Skip to content

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

feat: refactor docs, use fumadocs, remove content collections (#807)

Dillion Verma401618342865
diff --git a/.gitignore b/.gitignore
index c7f0e157..24c49006 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,7 +39,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
-.content-collections
# turbo cache
.turbo
diff --git a/.prettierignore b/.prettierignore
index f4f77eb7..eb9de67d 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,4 +1,4 @@
yarn.lock
node_modules
.next
-.content-collections
\ No newline at end of file
+.source
diff --git a/apps/.gitkeep b/apps/.gitkeep
deleted file mode 100644
index 8b137891..00000000
--- a/apps/.gitkeep
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/apps/www/.gitignore b/apps/www/.gitignore
index 20abb120..c7bafbcf 100644
--- a/apps/www/.gitignore
+++ b/apps/www/.gitignore
@@ -7,4 +7,4 @@ node_modules
.vercel
*.tsbuildinfo
next-env.d.ts
-.content-collections
+.source
diff --git a/apps/www/__registry__/index.tsx b/apps/www/__registry__/index.tsx
index 928185a9..bf62e540 100644
--- a/apps/www/__registry__/index.tsx
+++ b/apps/www/__registry__/index.tsx
@@ -3284,11 +3284,6 @@ export const Index: Record<string, any> = {
type: "registry:example",
target: "",
},
- {
- path: "registry/magicui/mode-toggle.tsx",
- type: "registry:ui",
- target: "",
- },
],
component: React.lazy(async () => {
const mod = await import("@/registry/example/dock-demo.tsx");
diff --git a/apps/www/app/(blog)/blog/[...slug]/page.tsx b/apps/www/app/(blog)/blog/[...slug]/page.tsx
new file mode 100644
index 00000000..14cce0b8
--- /dev/null
+++ b/apps/www/app/(blog)/blog/[...slug]/page.tsx
@@ -0,0 +1,146 @@
+import { BlogTableOfContents } from "@/components/blog/table-of-contents";
+import { SidebarCTA } from "@/components/sidebar-cta";
+import { buttonVariants } from "@/components/ui/button";
+import { siteConfig } from "@/config/site";
+import { blogSource } from "@/lib/source";
+import { absoluteUrl } from "@/lib/utils";
+import { mdxComponents } from "@/mdx-components";
+import { ArrowLeftIcon } from "lucide-react";
+import type { Metadata } from "next";
+import Link from "next/link";
+import { notFound } from "next/navigation";
+
+export const revalidate = false;
+export const dynamic = "force-static";
+export const dynamicParams = false;
+
+function getReadingTime(text: string): number {
+ const wordsPerMinute = 200;
+ const words = text.split(/\s+/).length;
+ return Math.ceil(words / wordsPerMinute);
+}
+
+interface PageProps {
+ params: Promise<{
+ slug: string[];
+ }>;
+}
+
+export function generateStaticParams() {
+ return blogSource.generateParams();
+}
+
+async function getDocFromParams({ params }: PageProps) {
+ const { slug } = await params;
+ const page = blogSource.getPage(slug);
+ if (!page) notFound();
+ const doc = page.data;
+ if (!doc.title || !doc.description) {
+ notFound();
+ }
+
+ return { doc, page };
+}
+
+export async function generateMetadata({
+ params,
+}: PageProps): Promise<Metadata> {
+ const { doc, page } = await getDocFromParams({ params });
+
+ if (!page) {
+ return {};
+ }
+
+ return {
+ title: `${doc.title} | ${siteConfig.name}`,
+ description: doc.description,
+ openGraph: {
+ title: doc.title,
+ description: doc.description,
+ type: "article",
+ url: absoluteUrl(page.url),
+ images: [
+ {
+ // @ts-expect-error - revisit fumadocs types.
+ url: doc.image || "",
+ width: 1200,
+ height: 630,
+ },
+ ],
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: doc.title,
+ description: doc.description,
+ // @ts-expect-error - revisit fumadocs types.
+ images: [doc.image || ""],
+ creator: "@dillionverma",
+ },
+ };
+}
+
+export default async function BlogPage({ params }: PageProps) {
+ const { doc, page } = await getDocFromParams({ params });
+
+ // @ts-expect-error - revisit fumadocs types.
+ const MDX = doc.body;
+
+ return (
+ <div className="mx-auto mt-5 max-w-6xl px-5 xl:px-0">
+ <div className="mb-4">
+ <Link href="/blog" className={buttonVariants({ variant: "link" })}>
+ <ArrowLeftIcon className="mr-2 h-4 w-4" />
+ Back to Blog
+ </Link>
+ </div>
+ <article className="mx-auto mt-5 max-w-6xl rounded-xl">
+ {doc && (
+ <div>
+ <div className="relative overflow-hidden rounded-xl p-5 md:p-10">
+ <img
+ // @ts-expect-error - revisit fumadocs types.
+ src={doc.image}
+ alt={doc.title}
+ className="size-full rounded-xl border border-border object-cover object-left"
+ />
+ </div>
+ <div className="mx-auto flex flex-col items-center justify-center gap-y-2 border-y border-border p-5">
+ <div className="mx-auto flex max-w-4xl flex-col items-center justify-center gap-y-2">
+ <h1 className="text-balance text-center text-3xl font-semibold tracking-tighter md:text-5xl">
+ {doc.title}
+ </h1>
+ <p className="text-balance text-center text-secondary-foreground md:text-lg">
+ {doc.description}
+ </p>
+ </div>
+ </div>
+ <div className="flex items-center justify-center gap-x-2 border-b border-border p-3 text-sm text-secondary-foreground">
+ {/* @ts-expect-error - revisit fumadocs types. */}
+ <span>{getReadingTime(doc.content)} min read</span>
+ {/* @ts-expect-error - revisit fumadocs types. */}
+ {doc.tag && (
+ <>
+ <span>·</span>
+ <span className="rounded-full border border-border bg-primary/5 px-2.5 py-0.5">
+ {/* @ts-expect-error - revisit fumadocs types. */}
+ {doc.tag}
+ </span>
+ </>
+ )}
+ </div>
+ </div>
+ )}
+ <div className="grid grid-cols-1 gap-x-1 lg:grid-cols-7">
+ <div className="article-content col-span-5 p-5 lg:p-10">
+ <MDX components={mdxComponents} />
+ </div>
+ <div className="sticky top-16 col-span-2 hidden h-fit w-full flex-col items-start justify-start p-5 text-primary lg:flex ">
+ <BlogTableOfContents />
+ <div className="h-10" />
+ <SidebarCTA />
+ </div>
+ </div>
+ </article>
+ </div>
+ );
+}
diff --git a/apps/www/app/(blog)/blog/[slug]/page.tsx b/apps/www/app/(blog)/blog/[slug]/page.tsx
deleted file mode 100644
index 3cd26868..00000000
--- a/apps/www/app/(blog)/blog/[slug]/page.tsx
+++ /dev/null
@@ -1,254 +0,0 @@
-/* eslint-disable jsx-a11y/alt-text */
-/* eslint-disable @next/next/no-img-element */
-
-import MoreArticles, { getReadingTime } from "@/components/blog/more-articles";
-import PromoSection from "@/components/blog/promo-section";
-import BlogTableOfContents from "@/components/blog/table-of-contents";
-import { siteConfig } from "@/config/site";
-import { absoluteUrl } from "@/lib/utils";
-import { MDXContent } from "@content-collections/mdx/react";
-import { allBlogs } from "content-collections";
-import { ArrowLeftIcon } from "lucide-react";
-import type { Metadata } from "next";
-import Link from "next/link";
-import type { ComponentProps } from "react";
-
-const components = {
- h1: ({ children, ...props }: ComponentProps<"h1">) => (
- <h1
- className="my-7 mb-5 scroll-m-20 text-3xl font-semibold tracking-tighter first:mt-0"
- {...props}
- >
- {children}
- </h1>
- ),
- h2: ({ children, ...props }: ComponentProps<"h2">) => (
- <h2
- id={
- typeof children === "string"
- ? children.toLowerCase().replace(/\s+/g, "-")
- : undefined
- }
- className="my-5 mb-3 scroll-m-20 text-2xl font-semibold tracking-tighter"
- {...props}
- >
- {children}
- </h2>
- ),
- h3: ({ children, ...props }: ComponentProps<"h3">) => (
- <h3
- className="my-5 mb-3 scroll-m-20 text-lg font-semibold tracking-tighter"
- {...props}
- >
- {children}
- </h3>
- ),
- h4: ({ children, ...props }: ComponentProps<"h4">) => (
- <h4
- className="my-5 mb-3 scroll-m-20 text-lg font-semibold tracking-tighter"
- {...props}
- >
- {children}
- </h4>
- ),
- p: ({ children, ...props }: ComponentProps<"p">) => (
- <p className="my-3" {...props}>
- {children}
- </p>
- ),
- ul: ({ children, ...props }: ComponentProps<"ul">) => (
- <ul className="my-6 ml-6 list-disc [&>li]:mt-2" {...props}>
- {children}
- </ul>
- ),
- ol: ({ children, ...props }: ComponentProps<"ol">) => (
- <ol className="my-6 ml-6 list-decimal [&>li]:mt-2" {...props}>
- {children}
- </ol>
- ),
- li: ({ children, ...props }: ComponentProps<"li">) => (
- <li className="" {...props}>
- {children}
- </li>
- ),
- table: ({ children, ...props }: ComponentProps<"table">) => (
- <div className="table-container my-6 w-full overflow-y-auto rounded-lg border border-border">
- <table className="table-container my-0 w-full overflow-hidden" {...props}>
- {children}
- </table>
- </div>
- ),
- th: ({ children, ...props }: ComponentProps<"th">) => (
- <th
- className="text-balance border-r border-border bg-neutral-50 px-6 py-3 text-left font-mono text-sm font-semibold tracking-tight text-secondary-foreground last:border-r-0 dark:bg-neutral-900"
- {...props}
- >
- {children}
- </th>
- ),
- tr: ({ children, ...props }: ComponentProps<"tr">) => (
- <tr
- className="border-b last:border-b-0 odd:bg-background even:bg-background/50"
- {...props}
- >
- {children}
- </tr>
- ),
- td: ({ children, ...props }: ComponentProps<"td">) => (
- <td
- className="border-r border-border px-6 py-4 text-sm text-secondary-foreground last:border-r-0"
- {...props}
- >
- {children}
- </td>
- ),
- pre: ({ children, ...props }: ComponentProps<"pre">) => (
- <pre
- className="flex h-fit items-center justify-start gap-x-2 overflow-x-auto rounded-md border border-border bg-primary/5 px-2 py-1 font-mono text-sm text-secondary-foreground"
- {...props}
- >
- {children}
- </pre>
- ),
- code: ({ children, ...props }: ComponentProps<"code">) => (
- <code
- className="rounded-md bg-primary/5 px-2 py-1 font-mono text-sm text-secondary-foreground"
- {...props}
- >
- {children}
- </code>
- ),
- img: ({ children, ...props }: ComponentProps<"img">) => (
- <img className="my-2 rounded-xl border border-border" {...props} />
- ),
- a: ({ children, ...props }: ComponentProps<"a">) => {
- const linkText = typeof children === "string" ? children : "Link";
- const autoTitle = props.href ? `Visit ${props.href}` : `Go to ${linkText}`;
-
- return (
- <a
- className="text-primary underline underline-offset-4"
- title={props.title || autoTitle}
- {...props}
- >
- {children}
- </a>
- );
- },
-};
-
-export async function generateMetadata({
- params,
-}: {
- params: Promise<{ slug: string[] }>;
-}): Promise<Metadata> {
- const { slug } = await params;
- const postSlug = Array.isArray(slug) ? slug[0] : slug;
- const post = allBlogs.find((post) => post._meta.path === postSlug);
-
- if (!post) {
- return {};
- }
-
- return {
- title: `${post.title} | ${siteConfig.name}`,
- description: post.description,
- openGraph: {
- title: post.title,
- description: post.description,
- type: "article",
- url: absoluteUrl(`/blog/${postSlug}`),
- images: [
- {
- url: post.image || "",
- width: 1200,
- height: 630,
- },
- ],
- },
- twitter: {
- card: "summary_large_image",
- title: post.title,
- description: post.description,
- images: [post.image || ""],
- creator: "@dillionverma",
- },
- };
-}
-
-export default async function BlogPage({
- params,
-}: {
- params: Promise<{ slug: string[] }>;
-}) {
- const { slug } = await params;
-
- const postSlug = Array.isArray(slug) ? slug[0] : slug;
- const currentIndex = allBlogs.findIndex(
- (post) => post._meta.path === postSlug,
- );
- const post = allBlogs[currentIndex];
-
- // Initialize with empty headings array - they will be populated after render
- const headings: string[] = [];
-
- return (
- <div className="mx-auto mt-5 max-w-6xl px-5 xl:px-0">
- <div className="mb-4">
- <Link
- href="/blog"
- className="flex h-8 w-fit items-center justify-center rounded-full border border-border bg-muted px-4 text-sm text-secondary-foreground"
- >
- <ArrowLeftIcon className="mr-2 size-4" />
- Back to Blog
- </Link>
- </div>
- <article className="mx-auto mt-5 max-w-6xl rounded-xl border border-border">
- {post && (
- <div>
- <div className="relative overflow-hidden rounded-xl p-5 md:p-10">
- <img
- src={post.image}
- alt={post.title}
- className="size-full rounded-xl border border-border object-cover object-left"
- />
- </div>
- <div className="mx-auto flex flex-col items-center justify-center gap-y-2 border-y border-border p-5">
- <div className="mx-auto flex max-w-4xl flex-col items-center justify-center gap-y-2">
- <h1 className="text-balance text-center text-3xl font-semibold tracking-tighter md:text-5xl">
- {post.title}
- </h1>
- <p className="text-balance text-center text-secondary-foreground md:text-lg">
- {post.description}
- </p>
- </div>
- </div>
- <div className="flex items-center justify-center gap-x-2 border-b border-border p-3 text-sm text-secondary-foreground">
- <span>{getReadingTime(post.body.raw)} min read</span>
- {post.tag && (
- <>
- <span>·</span>
- <span className="rounded-full border border-border bg-primary/5 px-2.5 py-0.5">
- {post.tag}
- </span>
- </>
- )}
- </div>
- </div>
- )}
- <div className="grid grid-cols-1 gap-x-1 lg:grid-cols-7">
- <div className="article-content col-span-5 border-border p-5 lg:border-r lg:p-10">
- <MDXContent code={post?.body.code} components={components} />
- </div>
- <div className="sticky top-16 col-span-2 hidden h-fit w-full flex-col items-start justify-start p-5 text-primary lg:flex ">
- <PromoSection />
- <div className="mt-10 w-full">
- <BlogTableOfContents headings={headings} />
- </div>
- </div>
- </div>
- </article>
- {post && <MoreArticles currentPost={post} />}
- </div>
- );
-}
diff --git a/apps/www/app/(blog)/blog/page.tsx b/apps/www/app/(blog)/blog/page.tsx
index 9da7a428..b6347a42 100644
--- a/apps/www/app/(blog)/blog/page.tsx
+++ b/apps/www/app/(blog)/blog/page.tsx
@@ -1,187 +1,120 @@
-/* eslint-disable @next/next/no-img-element */
-"use client";
-import { Input } from "@/components/ui/input";
-import { allBlogs } from "content-collections";
-import { Search } from "lucide-react";
import Link from "next/link";
-import { useState } from "react";
+import Image from "next/image";
+import { blogSource } from "@/lib/source";
-function calculateReadingTime(content: string): number {
+function calculateReadingTimeFromContent(content: string): number {
const wordsPerMinute = 200;
- const words = content.split(/\s+/).length;
- return Math.ceil(words / wordsPerMinute);
+ const words = content.trim().split(/\s+/).filter(Boolean).length;
+ return Math.max(1, Math.ceil(words / wordsPerMinute));
}
-export default function BlogPage() {
- const [searchQuery, setSearchQuery] = useState("");
- const [selectedTag, setSelectedTag] = useState<string | null>(null);
+export default async function Page({
+ searchParams,
+}: {
+ searchParams?: Promise<{ tag?: string }>;
+}) {
+ const params = await searchParams;
+ const posts = blogSource.getPages();
- // Get unique tags and filter out undefined
+ const selectedTag = params?.tag ?? "";
const tags = Array.from(
- new Set(allBlogs.map((blog) => blog.tag).filter(Boolean)),
- ).sort();
+ new Set(
+ // @ts-expect-error - revisit fumadocs types.
+ posts.map((p) => p.data?.tag).filter(Boolean),
+ ),
+ ) as string[];
+ tags.sort((a, b) => a.localeCompare(b));
- // Get featured posts
- const featuredPosts = allBlogs.filter((blog) => blog.featured).slice(0, 7);
-
- // Filter blogs based on search and tag
- const filteredBlogs = allBlogs.filter((blog) => {
- const matchesSearch =
- blog.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
- blog?.description?.toLowerCase().includes(searchQuery.toLowerCase());
- const matchesTag = !selectedTag || blog.tag === selectedTag;
- return matchesSearch && matchesTag;
- });
+ const filteredPosts = selectedTag
+ ? posts.filter(
+ // @ts-expect-error - revisit fumadocs types.
+ (p) => p.data?.tag === selectedTag,
+ )
+ : posts;
return (
- <section className="mx-auto w-full max-w-7xl p-5">
- {/* Featured Posts */}
- {featuredPosts.length > 0 && (
- <div className="mb-12 rounded-xl border border-border">
- <div className="grid grid-cols-1 lg:grid-cols-2">
- {/* Main featured post */}
- <div className="flex flex-col p-5 lg:border-r">
- <h2 className="mb-6 w-fit rounded-full border border-border bg-primary px-3 py-1 text-sm font-semibold tracking-tight text-primary-foreground">
- Featured
- </h2>
- <a
- href={`/blog/${featuredPosts[0]._meta.path}`}
- className="group relative"
- >
- <div className="aspect-[16/10] overflow-hidden rounded-xl border border-border">
- <img
- src={featuredPosts[0].image}
- alt={featuredPosts[0].title}
- className="size-full rounded-xl object-cover object-left"
- />
- </div>
- <div className="py-4">
- <div className="mb-2 flex items-center gap-2 text-sm">
- {calculateReadingTime(featuredPosts[0].body.raw)} min read
- <span className="flex h-6 w-fit items-center justify-center rounded-full border border-border bg-primary/5 px-3 text-sm">
- {featuredPosts[0].tag}
- </span>
- </div>
- <h3 className="text-xl font-semibold tracking-tighter underline-offset-4 group-hover:underline">
- {featuredPosts[0].title}
- </h3>
- </div>
- </a>
- </div>
-
- {/* Secondary featured posts */}
- <div className="flex flex-col">
- {featuredPosts.slice(1, 7).map((blog) => (
- <a
- key={blog._meta.path}
- href={`/blog/${blog._meta.path}`}
- className="group flex gap-4 border-b border-border p-5 first:border-t last:border-b-0 lg:first:border-t-0"
- >
- <div className="flex flex-col justify-center">
- <div className="mb-1 flex items-center gap-2 text-sm text-muted-foreground">
- {calculateReadingTime(blog.body.raw)} min read
- <span className="flex h-6 w-fit items-center justify-center rounded-full border border-border bg-primary/5 px-3 text-sm">
- {blog.tag}
- </span>
- </div>
- <h3 className="text-lg font-semibold tracking-tighter underline-offset-4 group-hover:underline">
- {blog.title}
- </h3>
- </div>
- </a>
- ))}
- </div>
- </div>
- </div>
- )}
+ <main className="mx-auto w-full max-w-6xl p-6">
+ <h1 className="mb-4 text-2xl font-semibold tracking-tight">Blog</h1>
- <div className="mb-8 space-y-4">
- {/* Search input */}
- <div className="relative">
- <Input
- type="text"
- placeholder="Search blogs..."
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- className="w-full rounded-lg border border-border px-4 py-2 focus:border-primary focus:outline-none"
- />
- </div>
-
- {/* Tag filters */}
- <div className="flex flex-wrap gap-2">
- <button
- type="button"
- onClick={() => setSelectedTag(null)}
- className={`rounded-full border border-border px-3 py-1 text-sm transition-colors ${
- selectedTag === null
- ? "bg-primary text-primary-foreground shadow-sm"
- : "bg-muted text-muted-foreground hover:bg-muted/80"
+ {tags.length > 0 ? (
+ <nav className="mb-6 flex flex-wrap gap-2">
+ <Link
+ href="/blog"
+ className={`rounded-full border px-3 py-1 text-sm ${
+ selectedTag === ""
+ ? "bg-primary text-primary-foreground"
+ : "text-muted-foreground hover:bg-muted"
}`}
>
All
- </button>
+ </Link>
{tags.map((tag) => (
- <button
+ <Link
key={tag}
- type="button"
- onClick={() => tag && setSelectedTag(tag)}
- className={`rounded-full border border-border px-3 py-1 text-sm transition-colors ${
+ href={`/blog?tag=${encodeURIComponent(tag)}`}
+ className={`rounded-full border px-3 py-1 text-sm ${
selectedTag === tag
- ? "bg-primary text-primary-foreground shadow-sm"
- : "bg-muted text-muted-foreground hover:bg-muted/80"
+ ? "bg-primary text-primary-foreground"
+ : "text-muted-foreground hover:bg-muted"
}`}
>
{tag}
- </button>
+ </Link>
))}
- </div>
- </div>
+ </nav>
+ ) : null}
- {filteredBlogs.length === 0 ? (
- <div className="flex flex-col items-center justify-center rounded-xl border border-dashed border-border bg-muted p-12 text-center">
- <Search className="mb-2 text-4xl" />
- <h3 className="mb-2 text-balance text-xl font-medium tracking-tighter">
- No blogs found
- </h3>
- <p className="text-balance text-muted-foreground">
- Try adjusting your search or filter to find what you&apos;re looking
- for
- </p>
- </div>
+ {filteredPosts.length === 0 ? (
+ <p className="text-muted-foreground">No posts yet.</p>
) : (
- <ul className="grid grid-cols-1 gap-1.5 overflow-hidden rounded-xl border border-border md:grid-cols-2 lg:grid-cols-3">
- {filteredBlogs.map((blog) => (
- <li
- key={blog._meta.path}
- className="relative p-4 before:absolute before:-left-1 before:top-0 before:z-10 before:h-screen before:w-px before:bg-border before:content-[''] after:absolute after:-top-1 after:left-0 after:z-10 after:h-px after:w-screen after:bg-border after:content-['']"
- >
- <Link
- href={`/blog/${blog._meta.path}`}
- className="group grid grid-rows-1"
- >
- <div className="overflow-hidden rounded-xl border border-border">
- <img
- src={blog.image}
- alt={blog.title}
- className="size-full object-cover object-left transition-transform duration-300 ease-in-out group-hover:scale-[1.01] md:max-h-[200px]"
- />
- </div>
- <div className="py-2">
- <h3 className="tr mb-2 text-xl font-semibold tracking-tighter underline-offset-4 group-hover:underline">
- {blog.title}
- </h3>
- <div className="flex items-center gap-3 text-sm text-muted-foreground">
- <span className="flex h-6 w-fit items-center justify-center rounded-full border border-border bg-primary/5 px-3 text-sm">
- {blog.tag}
- </span>
- <span>{calculateReadingTime(blog.body.raw)} min read</span>
+ <ul className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
+ {filteredPosts.map((post) => {
+ // @ts-expect-error - revisit fumadocs types.
+ const image = post.data?.image as string | undefined;
+ const title = (post.data?.title as string | undefined) ?? post.url;
+ const description = post.data?.description as string | undefined;
+ // @ts-expect-error - revisit fumadocs types.
+ const tag = post.data?.tag as string | undefined;
+ // @ts-expect-error - revisit fumadocs types.
+ const content = (post.data?.content as string | undefined) ?? "";
+ const readingTime = calculateReadingTimeFromContent(content);
+
+ return (
+ <li key={post.url} className="overflow-hidden rounded-md border">
+ <Link href={post.url} className="block">
+ {image ? (
+ <img
+ src={image}
+ alt={title}
+ width={640}
+ height={360}
+ className="h-40 w-full object-cover"
+ />
+ ) : null}
+ <div className="space-y-2 p-4">
+ <h2 className="line-clamp-2 font-medium leading-tight underline-offset-2 hover:underline">
+ {title}
+ </h2>
+ {description ? (
+ <p className="line-clamp-2 text-sm text-muted-foreground">
+ {description}
+ </p>
+ ) : null}
+ <div className="flex items-center gap-2 text-xs text-muted-foreground">
+ {tag ? (
+ <span className="rounded-full border px-2 py-0.5">
+ {tag}
+ </span>
+ ) : null}
+ <span>{readingTime} min read</span>
+ </div>
</div>
- </div>
- </Link>
- </li>
- ))}
+ </Link>
+ </li>
+ );
+ })}
</ul>
)}
- </section>
+ </main>
);
}
diff --git a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx b/apps/www/app/(docs)/docs/[[...slug]]/page.tsx
index 1ed029c6..0c1acb69 100644
--- a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx
+++ b/apps/www/app/(docs)/docs/[[...slug]]/page.tsx
@@ -1,21 +1,32 @@
-import { Mdx } from "@/components/mdx-components";
-import { DocPager, getPagerForDoc } from "@/components/pager";
-import { badgeVariants } from "@/components/ui/badge";
-import { getTableOfContents } from "@/lib/toc";
-import { absoluteUrl, cn } from "@/lib/utils";
+import { Badge } from "@/components/ui/badge";
+import { absoluteUrl } from "@/lib/utils";
import { DocsCopyPage } from "@/components/docs-copy-page";
-import { ChevronRightIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
-import { allDocs } from "content-collections";
import type { Metadata } from "next";
import Link from "next/link";
import { notFound } from "next/navigation";
-
+import { DocsTableOfContents } from "@/components/docs-toc";
import { Contribute } from "@/components/contribute";
import { SidebarCTA } from "@/components/sidebar-cta";
-import { TableOfContents } from "@/components/toc";
-import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
+import {
+ IconArrowLeft,
+ IconArrowRight,
+ IconArrowUpRight,
+} from "@tabler/icons-react";
import { Button } from "@/components/ui/button";
+import { source } from "@/lib/source";
+import { mdxComponents } from "@/mdx-components";
+import { findNeighbour } from "fumadocs-core/server";
+import { siteConfig } from "@/config/site";
+import { replaceComponentSource } from "@/lib/docs";
+
+export const revalidate = false;
+export const dynamic = "force-static";
+export const dynamicParams = false;
+
+export function generateStaticParams() {
+ return source.generateParams();
+}
interface DocPageProps {
params: Promise<{
@@ -24,26 +35,32 @@ interface DocPageProps {
}
async function getDocFromParams({ params }: DocPageProps) {
- const { slug: slugArray } = await params;
- const slug = slugArray?.join("/") || "index";
- const doc = allDocs.find((doc) => doc.slugAsParams === slug);
-
- if (!doc) {
- return null;
+ const { slug } = await params;
+ const page = source.getPage(slug);
+ if (!page) notFound();
+ const doc = page.data;
+ if (!doc.title || !doc.description) {
+ notFound();
}
- return doc;
+ return { doc, page };
}
export async function generateMetadata({
params,
}: DocPageProps): Promise<Metadata> {
- const doc = await getDocFromParams({ params });
+ const { doc, page } = await getDocFromParams({ params });
if (!doc) {
return {};
}
+ const url = process.env.NEXT_PUBLIC_APP_URL;
+
+ const ogUrl = new URL(`${url}/og`);
+ ogUrl.searchParams.set("title", doc.title ?? "");
+ ogUrl.searchParams.set("description", doc.description ?? "");
+
return {
title: `${doc.title} | Magic UI`,
description: doc.description,
@@ -51,10 +68,10 @@ export async function generateMetadata({
title: doc.title,
description: doc.description,
type: "article",
- url: absoluteUrl(doc.slug),
+ url: absoluteUrl(page.url),
images: [
{
- url: doc.image,
+ url: ogUrl.toString(),
width: 1200,
height: 630,
},
@@ -64,118 +81,139 @@ export async function generateMetadata({
card: "summary_large_image",
title: doc.title,
description: doc.description,
- images: [doc.image],
+ images: [ogUrl.toString()],
creator: "@dillionverma",
},
};
}
-export async function generateStaticParams(): Promise<{ slug: string[] }[]> {
- return allDocs.map((doc) => ({
- slug: doc.slugAsParams.split("/"),
- }));
-}
-
export default async function DocPage({ params }: DocPageProps) {
- const doc = await getDocFromParams({ params });
+ const { doc, page } = await getDocFromParams({ params });
- if (!doc || !doc.published) {
- notFound();
- }
+ // @ts-expect-error - revisit fumadocs types.
+ const MDX = doc.body;
+ const neighbours = findNeighbour(source.pageTree, page.url);
- const toc = await getTableOfContents(doc.body.raw);
- const pager = getPagerForDoc(doc);
+ // @ts-expect-error - revisit fumadocs types.
+ const links = doc.links;
return (
- <main className="relative lg:gap-10 xl:grid xl:grid-cols-[1fr_300px]">
- <div className="mx-auto w-full min-w-0 max-w-3xl py-6 lg:py-8">
- <div className="mb-4 flex items-center space-x-1 text-sm text-muted-foreground">
- <div className="truncate">Docs</div>
- <ChevronRightIcon className="size-4" />
- <div className="font-medium text-foreground">{doc.title}</div>
- </div>
- <div className="flex flex-col gap-2">
- <h1 className={cn("scroll-m-20 text-4xl font-bold tracking-tight")}>
- {doc.title}
- </h1>
- <div className="docs-nav bg-background/80 border-border/50 fixed inset-x-0 bottom-0 isolate z-50 sm:z-0 flex items-center gap-2 border-t px-6 py-4 backdrop-blur-sm sm:static sm:border-t-0 sm:bg-transparent sm:px-0 sm:pt-1.5 sm:backdrop-blur-none">
- <DocsCopyPage
- page={(doc.body as any).rawWithFrontmatter ?? doc.body.raw}
- url={absoluteUrl(doc.slug)}
- />
- {pager?.prev?.href && (
- <Button
- variant="secondary"
- size="icon"
- className="extend-touch-target ml-auto size-8 shadow-none md:size-7"
- asChild
- >
- <Link href={pager.prev.href}>
- <span className="sr-only">Previous</span>
- <IconArrowLeft />
- </Link>
- </Button>
- )}
- {pager?.next?.href && (
- <Button
- variant="secondary"
- size="icon"
- className="extend-touch-target size-8 shadow-none md:size-7"
- asChild
- >
- <Link href={pager.next.href}>
- <span className="sr-only">Next</span>
- <IconArrowRight />
- </Link>
- </Button>
- )}
+ <div
+ data-slot="docs"
+ className="flex items-stretch text-[1.05rem] sm:text-[15px] xl:w-full"
+ >
+ <div className="flex min-w-0 flex-1 flex-col">
+ <div className="h-(--top-spacing) shrink-0" />
+ <div className="mx-auto flex w-full max-w-3xl min-w-0 flex-1 flex-col gap-8 px-4 py-6 text-neutral-800 md:px-0 lg:py-8 dark:text-neutral-300">
+ <div className="flex flex-col gap-2">
+ <div className="flex flex-col gap-2">
+ <div className="flex items-start justify-between">
+ <h1 className="scroll-m-20 text-4xl font-semibold tracking-tight sm:text-3xl xl:text-4xl">
+ {doc.title}
+ </h1>
+ <div className="docs-nav bg-background/80 border-border/50 fixed inset-x-0 bottom-0 isolate z-50 flex items-center gap-2 border-t px-6 py-4 backdrop-blur-sm sm:static sm:z-0 sm:border-t-0 sm:bg-transparent sm:px-0 sm:pt-1.5 sm:backdrop-blur-none">
+ <DocsCopyPage
+ // @ts-expect-error - revisit fumadocs types.
+ page={await replaceComponentSource(doc.content)}
+ url={absoluteUrl(page.url)}
+ />
+ {neighbours.previous && (
+ <Button
+ variant="secondary"
+ size="icon"
+ className="extend-touch-target ml-auto size-8 shadow-none md:size-7"
+ asChild
+ >
+ <Link href={neighbours.previous.url}>
+ <IconArrowLeft />
+ <span className="sr-only">Previous</span>
+ </Link>
+ </Button>
+ )}
+ {neighbours.next && (
+ <Button
+ variant="secondary"
+ size="icon"
+ className="extend-touch-target size-8 shadow-none md:size-7"
+ asChild
+ >
+ <Link href={neighbours.next.url}>
+ <span className="sr-only">Next</span>
+ <IconArrowRight />
+ </Link>
+ </Button>
+ )}
+ </div>
+ </div>
+ {doc.description && (
+ <p className="text-muted-foreground text-[1.05rem] text-balance sm:text-base">
+ {doc.description}
+ </p>
+ )}
+ </div>
+ {links ? (
+ <div className="flex items-center space-x-2 pt-4">
+ {links?.doc && (
+ <Badge asChild variant="secondary">
+ <Link href={links.doc} target="_blank" rel="noreferrer">
+ Docs <IconArrowUpRight />
+ </Link>
+ </Badge>
+ )}
+ {links?.api && (
+ <Badge asChild variant="secondary">
+ <Link href={links.api} target="_blank" rel="noreferrer">
+ API Reference <IconArrowUpRight />
+ </Link>
+ </Badge>
+ )}
+ </div>
+ ) : null}
+ </div>
+ <div className="w-full flex-1 *:data-[slot=alert]:first:mt-0">
+ <MDX components={mdxComponents} />
</div>
- {doc.description && (
- <p className="text-balance text-lg text-muted-foreground">
- {doc.description}
- </p>
- )}
</div>
- {doc.links ? (
- <div className="flex items-center space-x-2 pt-4">
- {doc.links?.doc && (
- <Link
- href={doc.links.doc}
- target="_blank"
- rel="noreferrer"
- className={cn(badgeVariants({ variant: "secondary" }), "gap-1")}
- >
- Docs
- <ExternalLinkIcon className="size-3" />
+ <div className="mx-auto hidden h-16 w-full max-w-2xl items-center gap-2 px-4 sm:flex md:px-0">
+ {neighbours.previous && (
+ <Button
+ variant="secondary"
+ size="sm"
+ asChild
+ className="shadow-none"
+ >
+ <Link href={neighbours.previous.url}>
+ <IconArrowLeft /> {neighbours.previous.name}
</Link>
- )}
- {doc.links?.api && (
- <Link
- href={doc.links.api}
- target="_blank"
- rel="noreferrer"
- className={cn(badgeVariants({ variant: "secondary" }), "gap-1")}
- >
- API Reference
- <ExternalLinkIcon className="size-3" />
+ </Button>
+ )}
+ {neighbours.next && (
+ <Button
+ variant="secondary"
+ size="sm"
+ className="ml-auto shadow-none"
+ asChild
+ >
+ <Link href={neighbours.next.url}>
+ {neighbours.next.name} <IconArrowRight />
</Link>
- )}
- </div>
- ) : null}
- <div className="pb-12 pt-8">
- <Mdx code={doc.body.code} />
- </div>
- <DocPager doc={doc} />
+ </Button>
+ )}
+ </div>{" "}
</div>
- {doc.toc && (
- <div className="hidden border-l border-border py-6 pl-6 text-sm xl:block">
- <div className="sticky top-[90px] h-[calc(100vh-3.5rem)] space-y-4">
- <TableOfContents toc={toc} />
- <Contribute doc={doc} />
+ <div className="sticky top-[calc(var(--header-height)+1px)] z-30 ml-auto hidden h-[calc(100svh-var(--footer-height)+2rem)] w-84 flex-col gap-4 overflow-hidden overscroll-none pb-8 xl:flex">
+ <div className="h-(--top-spacing) shrink-0" />
+ {/* @ts-expect-error - revisit fumadocs types. */}
+ {doc.toc?.length ? (
+ <div className="no-scrollbar overflow-y-auto px-8">
+ {/* @ts-expect-error - revisit fumadocs types. */}
+ <DocsTableOfContents toc={doc.toc} />
+ <Contribute page={page} />
+ <div className="h-8" />
<SidebarCTA />
</div>
- </div>
- )}
- </main>
+ ) : null}
+ </div>
+ </div>
);
}
diff --git a/apps/www/app/(docs)/docs/layout.tsx b/apps/www/app/(docs)/docs/layout.tsx
index 624e573c..4295a952 100644
--- a/apps/www/app/(docs)/docs/layout.tsx
+++ b/apps/www/app/(docs)/docs/layout.tsx
@@ -1,5 +1,5 @@
-import { DocsSidebarNav } from "@/components/sidebar-nav";
-import { docsConfig } from "@/config/docs";
+import { DocsSidebar } from "@/components/docs-sidebar";
+import { SidebarProvider } from "@/components/ui/sidebar";
export default function DocsLayout({
children,
@@ -7,15 +7,11 @@ export default function DocsLayout({
children: React.ReactNode;
}) {
return (
- <div className="container-wrapper">
- <div className="container flex-1 items-start md:grid md:grid-cols-[240px_minmax(0,1fr)] md:gap-6 lg:grid-cols-[260px_minmax(0,1fr)] lg:gap-10">
- <aside className="fixed top-14 z-30 hidden h-[calc(100vh-3.5rem)] w-full shrink-0 border-r md:sticky md:block">
- <div className="no-scrollbar h-full overflow-auto py-6 pr-4 lg:py-8">
- <DocsSidebarNav items={docsConfig.sidebarNav} />
- </div>
- </aside>
- {children}
- </div>
+ <div className="container-wrapper flex flex-1 flex-col px-2">
+ <SidebarProvider className="3xl:fixed:container 3xl:fixed:px-3 min-h-min flex-1 items-start px-0 [--sidebar-width:220px] [--top-spacing:0] lg:grid lg:grid-cols-[var(--sidebar-width)_minmax(0,1fr)] lg:[--sidebar-width:240px] lg:[--top-spacing:calc(var(--spacing)*4)]">
+ <DocsSidebar />
+ <div className="h-full w-full">{children}</div>
+ </SidebarProvider>
</div>
);
}
diff --git a/apps/www/app/(marketing)/[...slug]/page.tsx b/apps/www/app/(marketing)/[...slug]/page.tsx
deleted file mode 100644
index 8189eba8..00000000
--- a/apps/www/app/(marketing)/[...slug]/page.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import { Mdx } from "@/components/mdx-components";
-import { siteConfig } from "@/config/site";
-import { absoluteUrl } from "@/lib/utils";
-
-import { allPages } from "content-collections";
-import { Metadata } from "next";
-import { notFound } from "next/navigation";
-
-interface PageProps {
- params: Promise<{
- slug: string[];
- }>;
-}
-
-async function getPageFromParams(params: PageProps["params"]) {
- const { slug } = await params;
- const slugString = slug?.join("/");
- const page = allPages.find((page) => page.slugAsParams === slugString);
-
- if (!page) {
- return null;
- }
-
- return page;
-}
-
-export async function generateMetadata({
- params,
-}: PageProps): Promise<Metadata> {
- const page = await getPageFromParams(params);
-
- if (!page) {
- return {};
- }
-
- const url = process.env.NEXT_PUBLIC_APP_URL;
-
- const ogUrl = new URL(`${url}/og`);
- ogUrl.searchParams.set("heading", page.title);
- ogUrl.searchParams.set("type", siteConfig.name);
- ogUrl.searchParams.set("mode", "light");
-
- return {
- title: page.title,
- description: page.description,
- openGraph: {
- title: page.title,
- description: page.description,
- type: "article",
- url: absoluteUrl(page.slug),
- images: [
- {
- url: ogUrl.toString(),
- width: 1200,
- height: 630,
- },
- ],
- },
- twitter: {
- card: "summary_large_image",
- title: page.title,
- description: page.description,
- images: [ogUrl.toString()],
- },
- };
-}
-
-export function generateStaticParams(): { slug: string[] }[] {
- return allPages.map((page) => ({
- slug: page.slugAsParams.split("/"),
- }));
-}
-
-export default async function PagePage({ params }: PageProps) {
- const page = await getPageFromParams(params);
-
- if (!page) {
- notFound();
- }
-
- return (
- <article className="container max-w-3xl py-6 lg:py-12">
- <div className="space-y-4">
- <h1 className="font-heading inline-block text-4xl lg:text-5xl">
- {page.title}
- </h1>
- {page.description && (
- <p className="text-xl text-muted-foreground">{page.description}</p>
- )}
- </div>
- <hr className="my-4" />
- <Mdx code={page.body.code} />
- </article>
- );
-}
diff --git a/apps/www/app/(marketing)/page.tsx b/apps/www/app/(marketing)/page.tsx
index 096ef2c5..ce54546c 100644
--- a/apps/www/app/(marketing)/page.tsx
+++ b/apps/www/app/(marketing)/page.tsx
@@ -1,4 +1,3 @@
-import { ComponentDemos } from "@/components/sections/component-demos";
import { Hero } from "@/components/sections/hero";
import { Showcase } from "@/components/sections/showcase";
import { Testimonials } from "@/components/sections/testimonials";
@@ -9,7 +8,6 @@ export default function Home() {
<>
<Hero />
<Showcase />
- <ComponentDemos />
<Testimonials />
<VideoTestimonials />
</>
diff --git a/apps/www/app/(marketing)/showcase/[...slug]/page.tsx b/apps/www/app/(marketing)/showcase/[...slug]/page.tsx
index fd54b9e6..6a94b0c5 100644
--- a/apps/www/app/(marketing)/showcase/[...slug]/page.tsx
+++ b/apps/www/app/(marketing)/showcase/[...slug]/page.tsx
@@ -1,11 +1,18 @@
-import { allShowcases } from "content-collections";
-import { Metadata } from "next";
-import { notFound } from "next/navigation";
-
import { ShowcaseCard } from "@/components/sections/showcase";
import { siteConfig } from "@/config/site";
+import { showcaseSource } from "@/lib/source";
import { absoluteUrl } from "@/lib/utils";
-import process from "process";
+
+import { Metadata } from "next";
+import { notFound } from "next/navigation";
+
+export const revalidate = false;
+export const dynamic = "force-static";
+export const dynamicParams = false;
+
+export function generateStaticParams() {
+ return showcaseSource.generateParams();
+}
interface PageProps {
params: Promise<{
@@ -13,28 +20,22 @@ interface PageProps {
}>;
}
-export function generateStaticParams(): { slug: string[] }[] {
- return allShowcases.map((page) => ({
- slug: page.slugAsParams.split("/"),
- }));
-}
-
-async function getPageFromParams(params: PageProps["params"]) {
+async function getDocFromParams({ params }: PageProps) {
const { slug } = await params;
- const slugString = slug?.join("/");
- const page = allShowcases.find((page) => page.slugAsParams === slugString);
-
- if (!page) {
- return null;
+ const page = showcaseSource.getPage(slug);
+ if (!page) notFound();
+ const doc = page.data;
+ if (!doc.title || !doc.description) {
+ notFound();
}
- return page;
+ return { doc, page };
}
export async function generateMetadata({
params,
}: PageProps): Promise<Metadata> {
- const page = await getPageFromParams(params);
+ const { doc, page } = await getDocFromParams({ params });
if (!page) {
return {};
@@ -43,18 +44,17 @@ export async function generateMetadata({
const url = process.env.NEXT_PUBLIC_APP_URL;
const ogUrl = new URL(`${url}/og`);
- ogUrl.searchParams.set("heading", page.title);
- ogUrl.searchParams.set("type", siteConfig.name);
- ogUrl.searchParams.set("mode", "light");
+ ogUrl.searchParams.set("title", doc.title ?? "");
+ ogUrl.searchParams.set("description", doc.description ?? "");
return {
- title: page.title,
- description: page.description,
+ title: doc.title,
+ description: doc.description,
openGraph: {
- title: page.title,
- description: page.description,
+ title: doc.title,
+ description: doc.description,
type: "article",
- url: absoluteUrl(page.slug),
+ url: absoluteUrl(page.url),
images: [
{
url: ogUrl.toString(),
@@ -65,33 +65,31 @@ export async function generateMetadata({
},
twitter: {
card: "summary_large_image",
- title: page.title,
- description: page.description,
+ title: doc.title,
+ description: doc.description,
images: [ogUrl.toString()],
},
};
}
export default async function PagePage({ params }: PageProps) {
- const page = await getPageFromParams(params);
-
- if (!page) {
- notFound();
- }
+ const { doc, page } = await getDocFromParams({ params });
return (
<article className="container max-w-2xl py-14">
<h2 className="mb-4 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">
- {page.title}
+ {doc.title}
</h2>
<h3 className="mx-auto mb-8 text-balance text-center text-lg font-medium tracking-tight text-foreground/80">
- {page.title} uses Magic UI to build their landing page.
+ {doc.title} uses Magic UI to build their landing page.
</h3>
<ShowcaseCard
- title={page.title}
- href={page.href}
- image={page.image}
- affiliation={page.affiliation}
+ title={doc.title ?? ""}
+ href={page.url}
+ // @ts-expect-error - revisit fumadocs types.
+ image={doc.image ?? ""}
+ // @ts-expect-error - revisit fumadocs types.
+ affiliation={doc.affiliation ?? ""}
/>
</article>
);
diff --git a/apps/www/app/(marketing)/showcase/page.tsx b/apps/www/app/(marketing)/showcase/page.tsx
index 9f97d366..7f4cf7ea 100644
--- a/apps/www/app/(marketing)/showcase/page.tsx
+++ b/apps/www/app/(marketing)/showcase/page.tsx
@@ -1,9 +1,9 @@
-import { allShowcases } from "content-collections";
-
+import { showcaseSource } from "@/lib/source";
import { ShowcaseCard } from "@/components/sections/showcase";
import { BlurFade } from "@/registry/magicui/blur-fade";
export default function Page() {
+ const showcases = showcaseSource.getPages();
return (
<article className="container max-w-[120ch] py-14">
<h2 className="mb-2 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">
@@ -13,9 +13,17 @@ export default function Page() {
Companies choose Magic UI to build their landing pages.
</h3>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
- {allShowcases.map((showcase, idx) => (
+ {showcases.map((showcase, idx) => (
<BlurFade key={idx} delay={0.25 + idx * 0.05}>
- <ShowcaseCard {...showcase} href={showcase.slug} />
+ <ShowcaseCard
+ {...showcase}
+ href={showcase.url}
+ title={showcase.data.title ?? ""}
+ // @ts-expect-error - revisit fumadocs types.
+ image={showcase.data.image ?? ""}
+ // @ts-expect-error - revisit fumadocs types.
+ affiliation={showcase.data.affiliation ?? ""}
+ />
</BlurFade>
))}
</div>
diff --git a/apps/www/app/layout.tsx b/apps/www/app/layout.tsx
index b1fb2cee..e1b364cd 100644
--- a/apps/www/app/layout.tsx
+++ b/apps/www/app/layout.tsx
@@ -3,15 +3,14 @@ import { PHProvider } from "@/components/posthog-provider";
import { ThemeProvider } from "@/components/theme-provider";
import { Toaster } from "@/components/ui/sonner";
import { TooltipProvider } from "@/components/ui/tooltip";
-import { fontMono, fontSans } from "@/lib/fonts";
+import { fontVariables } from "@/lib/fonts";
import { absoluteUrl, cn, constructMetadata } from "@/lib/utils";
import { Provider as JotaiProvider } from "jotai";
-
-import "@/styles/globals.css";
-
import type { Viewport } from "next";
import { Metadata } from "next";
+import "@/styles/globals.css";
+
export const metadata: Metadata = constructMetadata({
title: "Magic UI",
description:
@@ -33,13 +32,12 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
- <html lang="en" suppressHydrationWarning>
+ <html lang="en" suppressHydrationWarning className="layout-fixed">
<head />
<body
className={cn(
- "relative flex w-full flex-col justify-center overflow-x-hidden scroll-smooth bg-background font-sans antialiased",
- fontSans.variable,
- fontMono.variable,
+ "text-foreground group/body overscroll-none font-sans antialiased [--footer-height:calc(var(--spacing)*14)] [--header-height:calc(var(--spacing)*14)] xl:[--footer-height:calc(var(--spacing)*24)]",
+ fontVariables,
)}
>
<JotaiProvider>
@@ -47,7 +45,7 @@ export default function RootLayout({
<ThemeProvider attribute="class" defaultTheme="light">
<TooltipProvider>
{children}
- <Toaster />
+ <Toaster position="top-center" richColors toastOptions={{}} />
<Analytics />
</TooltipProvider>
</ThemeProvider>
diff --git a/apps/www/app/llm/[[...slug]]/route.ts b/apps/www/app/llm/[[...slug]]/route.ts
index 1d594190..5e30ee28 100644
--- a/apps/www/app/llm/[[...slug]]/route.ts
+++ b/apps/www/app/llm/[[...slug]]/route.ts
@@ -1,6 +1,7 @@
import { notFound } from "next/navigation";
import { NextResponse, type NextRequest } from "next/server";
-import { allDocs } from "content-collections";
+import { source } from "@/lib/source";
+import { replaceComponentSource } from "@/lib/docs";
export const revalidate = false;
@@ -8,15 +9,19 @@ export async function GET(
_req: NextRequest,
{ params }: { params: Promise<{ slug?: string[] }> },
) {
- const { slug: slugSegments } = await params;
- const slug = slugSegments?.join("/") || "index";
- const doc = allDocs.find((d) => d.slugAsParams === slug);
+ const slug = (await params).slug;
+ const page = source.getPage(slug);
- if (!doc) {
+ if (!page) {
notFound();
}
- const mdx = (doc.body as any).rawWithFrontmatter ?? doc.body.raw;
+ // @ts-expect-error - revisit fumadocs types.
+ let mdx = page.data.content as string;
+
+ // Replace component tags with actual source code
+ mdx = await replaceComponentSource(mdx);
+
return new NextResponse(mdx, {
headers: {
"Content-Type": "text/markdown; charset=utf-8",
@@ -26,7 +31,5 @@ export async function GET(
}
export function generateStaticParams() {
- return allDocs.map((doc) => ({
- slug: doc.slugAsParams === "index" ? [] : doc.slugAsParams.split("/"),
- }));
+ return source.generateParams();
}
diff --git a/apps/www/app/sitemap.ts b/apps/www/app/sitemap.ts
index 8c241d0b..1c226888 100644
--- a/apps/www/app/sitemap.ts
+++ b/apps/www/app/sitemap.ts
@@ -1,4 +1,4 @@
-import { allBlogs, allDocs, allPages } from "content-collections";
+import { blogSource, source } from "@/lib/source";
import type { MetadataRoute } from "next";
import { headers } from "next/headers";
@@ -6,23 +6,23 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const headersList = await headers();
const domain = headersList.get("host") as string;
const protocol = "https";
+ const allDocs = source.getPages();
+ const allBlogs = blogSource.getPages();
return [
{
url: `${protocol}://${domain}`,
lastModified: new Date(),
},
- ...allPages.map((post) => ({
- url: `${protocol}://${domain}/${post.slugAsParams}`,
- lastModified: new Date(),
- })),
...allDocs.map((post) => ({
- url: `${protocol}://${domain}/docs/${post.slugAsParams}`,
- lastModified: post.date,
+ url: `${protocol}://${domain}${post.url}`,
+ // @ts-expect-error - revisit fumadocs types.
+ lastModified: post.data.date,
})),
...allBlogs.map((post) => ({
- url: `${protocol}://${domain}/blog/${post.slugAsParams}`,
- lastModified: post.publishedOn,
+ url: `${protocol}://${domain}${post.url}`,
+ // @ts-expect-error - revisit fumadocs types.
+ lastModified: post.data.publishedOn,
})),
];
}
diff --git a/apps/www/components/blog/more-articles.tsx b/apps/www/components/blog/more-articles.tsx
deleted file mode 100644
index 0692df2f..00000000
--- a/apps/www/components/blog/more-articles.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* eslint-disable @next/next/no-img-element */
-import type { Blog } from "content-collections";
-import { allBlogs } from "content-collections";
-import { ArrowRightIcon } from "lucide-react";
-import Link from "next/link";
-
-export function getReadingTime(text: string): number {
- const wordsPerMinute = 200;
- const words = text.split(/\s+/).length;
- return Math.ceil(words / wordsPerMinute);
-}
-
-function getRelatedPosts(currentPost: Blog, limit = 3) {
- return allBlogs
- .filter((post) => post._meta.path !== currentPost._meta.path)
- .slice(0, limit);
-}
-
-export default function MoreArticles({ currentPost }: { currentPost: Blog }) {
- const relatedPosts = getRelatedPosts(currentPost);
-
- return (
- <section className="mx-auto max-w-6xl py-10">
- <h2 className="mb-5 flex items-center gap-2 text-xl font-medium tracking-tighter">
- Read more like this
- <ArrowRightIcon className="size-4" />
- </h2>
- <div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
- {relatedPosts.map((post) => (
- <Link
- key={post._meta.path}
- href={`/blog/${post._meta.path}`}
- title={post.title}
- className="group flex flex-col"
- >
- <div className="relative overflow-hidden rounded-xl border border-border">
- <img
- src={post.image}
- alt={post.title}
- className="size-full object-contain object-left transition-all duration-300 group-hover:scale-[1.01]"
- />
- </div>
- <div className="mt-4 flex flex-col gap-2">
- <div className="flex items-center gap-x-2 text-sm text-muted-foreground">
- <span>{getReadingTime(post.body.raw)} min read</span>
- {post.tag?.[0] && (
- <>
- <span>·</span>
- <span className="rounded-full border border-border bg-primary/5 px-2.5 py-0.5">
- {post.tag}
- </span>
- </>
- )}
- </div>
- <h3 className="text-lg font-medium tracking-tight underline-offset-4 group-hover:underline">
- {post.title}
- </h3>
- </div>
- </Link>
- ))}
- </div>
- </section>
- );
-}
diff --git a/apps/www/components/blog/promo-section.tsx b/apps/www/components/blog/promo-section.tsx
deleted file mode 100644
index 23c421ac..00000000
--- a/apps/www/components/blog/promo-section.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-"use client";
-
-import { Button } from "@/components/ui/button";
-import { ArrowRightIcon } from "lucide-react";
-import Link from "next/link";
-
-export default function PromoSection() {
- return (
- <div className="flex w-full flex-col items-center justify-center gap-y-3.5 rounded-xl border bg-indigo-600 p-5 text-white">
- <h2 className="text-balance text-center text-lg font-semibold tracking-tighter">
- Want to save time? Get beautifully designed website templates with Magic
- UI Pro.
- </h2>
- <p className="text-balance text-center">
- 30+ beautiful sections and templates built with React, Typescript,
- Tailwind CSS, and Motion.
- </p>
- <Button variant="default" asChild className="w-full">
- <Link href="https://pro.magicui.design">
- Get Pro
- <ArrowRightIcon className="ml-2 size-4" />
- </Link>
- </Button>
- </div>
- );
-}
diff --git a/apps/www/components/blog/table-of-contents.tsx b/apps/www/components/blog/table-of-contents.tsx
index 49d32454..8cd65eb9 100644
--- a/apps/www/components/blog/table-of-contents.tsx
+++ b/apps/www/components/blog/table-of-contents.tsx
@@ -1,6 +1,7 @@
"use client";
import { Skeleton } from "@/components/ui/skeleton";
+import { cn } from "@/lib/utils";
import { useEffect, useState } from "react";
// Helper function to generate consistent IDs
@@ -14,13 +15,9 @@ const generateHeadingId = (text: string) => {
.trim();
};
-export default function BlogTableOfContents({
- headings: initialHeadings,
-}: {
- headings: string[];
-}) {
+export function BlogTableOfContents({ className }: { className?: string }) {
const [activeHeading, setActiveHeading] = useState<string>("");
- const [headings, setHeadings] = useState<string[]>(initialHeadings);
+ const [headings, setHeadings] = useState<string[]>([]);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
@@ -92,17 +89,18 @@ export default function BlogTableOfContents({
};
return (
- <div className="mb-6 w-full">
- <h3 className="mb-4 font-medium text-primary underline underline-offset-8">
- On this page
- </h3>
- <div className="flex w-full flex-col gap-2.5">
+ <div className={cn("flex flex-col gap-2 p-4 pt-0 text-sm", className)}>
+ <p className="text-muted-foreground bg-background sticky top-0 h-6 text-xs">
+ On This Page
+ </p>
+
+ <nav className="space-y-1">
{isLoading ? (
// Skeleton loading state
- <div className="flex w-full flex-col gap-2.5">
- <Skeleton className="h-5 w-1/2" />
- <Skeleton className="h-5 w-2/3" />
- <Skeleton className="h-5 w-full" />
+ <div className="space-y-1">
+ <Skeleton className="h-4 w-3/4" />
+ <Skeleton className="h-4 w-2/3" />
+ <Skeleton className="h-4 w-4/5" />
</div>
) : (
headings.map((heading, i) => {
@@ -118,10 +116,10 @@ export default function BlogTableOfContents({
key={i}
href={`#${headingId}`}
onClick={() => handleClick(headingId)}
- className={`flex items-center gap-2 text-[15px] font-medium tracking-tight transition-colors ${
+ className={`block py-1 text-sm transition-colors ${
isActive
- ? "text-primary"
- : "text-muted-foreground hover:text-primary"
+ ? "font-medium text-foreground"
+ : "text-muted-foreground hover:text-foreground"
}`}
>
{heading}
@@ -129,7 +127,7 @@ export default function BlogTableOfContents({
);
})
)}
- </div>
+ </nav>
</div>
);
}
diff --git a/apps/www/components/callout.tsx b/apps/www/components/callout.tsx
index 8bb10752..897ac8c0 100644
--- a/apps/www/components/callout.tsx
+++ b/apps/www/components/callout.tsx
@@ -1,17 +1,26 @@
+import { cn } from "@/lib/utils";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
-interface CalloutProps {
- icon?: string;
- title?: string;
- children?: React.ReactNode;
-}
-
-export function Callout({ title, children, icon, ...props }: CalloutProps) {
+export function Callout({
+ title,
+ children,
+ icon,
+ className,
+ ...props
+}: React.ComponentProps<typeof Alert> & { icon?: React.ReactNode }) {
return (
- <Alert {...props}>
- {icon && <span className="mr-4 text-2xl">{icon}</span>}
+ <Alert
+ className={cn(
+ "bg-surface text-surface-foreground mt-6 w-auto border-none md:-mx-1",
+ className,
+ )}
+ {...props}
+ >
+ {icon}
{title && <AlertTitle>{title}</AlertTitle>}
- <AlertDescription>{children}</AlertDescription>
+ <AlertDescription className="text-card-foreground/80">
+ {children}
+ </AlertDescription>
</Alert>
);
}
diff --git a/apps/www/components/code-block-command.tsx b/apps/www/components/code-block-command.tsx
index e0556912..a68c31bd 100644
--- a/apps/www/components/code-block-command.tsx
+++ b/apps/www/components/code-block-command.tsx
@@ -1,23 +1,31 @@
"use client";
+import * as React from "react";
+import { CheckIcon, ClipboardIcon, TerminalIcon } from "lucide-react";
+
+import { useConfig } from "@/hooks/use-config";
import { copyToClipboardWithMeta } from "@/components/copy-button";
import { Button } from "@/components/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import { useConfig } from "@/hooks/use-config";
-import { useMounted } from "@/hooks/use-mounted";
-import { NpmCommands } from "@/types/unist";
-import { CheckIcon, ClipboardIcon } from "lucide-react";
-import * as React from "react";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
export function CodeBlockCommand({
- __npmCommand__,
- __yarnCommand__,
- __pnpmCommand__,
- __bunCommand__,
-}: React.ComponentProps<"pre"> & NpmCommands) {
+ __npm__,
+ __yarn__,
+ __pnpm__,
+ __bun__,
+}: React.ComponentProps<"pre"> & {
+ __npm__?: string;
+ __yarn__?: string;
+ __pnpm__?: string;
+ __bun__?: string;
+}) {
const [config, setConfig] = useConfig();
const [hasCopied, setHasCopied] = React.useState(false);
- const mounted = useMounted();
React.useEffect(() => {
if (hasCopied) {
@@ -29,12 +37,12 @@ export function CodeBlockCommand({
const packageManager = config.packageManager || "pnpm";
const tabs = React.useMemo(() => {
return {
- pnpm: __pnpmCommand__,
- npm: __npmCommand__,
- yarn: __yarnCommand__,
- bun: __bunCommand__,
+ pnpm: __pnpm__,
+ npm: __npm__,
+ yarn: __yarn__,
+ bun: __bun__,
};
- }, [__npmCommand__, __pnpmCommand__, __yarnCommand__, __bunCommand__]);
+ }, [__npm__, __pnpm__, __yarn__, __bun__]);
const copyCommand = React.useCallback(() => {
const command = tabs[packageManager];
@@ -53,31 +61,29 @@ export function CodeBlockCommand({
setHasCopied(true);
}, [packageManager, tabs]);
- if (!mounted) {
- return null;
- }
-
return (
- <div className="relative w-full mt-6 max-h-[650px] overflow-hidden rounded-xl border border-zinc-800 bg-zinc-950 dark:bg-zinc-900">
+ <div className="overflow-x-auto">
<Tabs
- className="w-full"
- defaultValue={packageManager}
+ value={packageManager}
+ className="gap-0"
onValueChange={(value) => {
- console.log("value", value, packageManager);
setConfig({
...config,
packageManager: value as "pnpm" | "npm" | "yarn" | "bun",
});
}}
>
- <div className="flex items-start justify-between border-b border-zinc-800 bg-zinc-900 px-3 pt-2.5 w-full">
- <TabsList className="h-7 translate-y-[2px] gap-3 bg-transparent p-0 pl-1 w-fit">
- {Object.entries(tabs).map(([key, value]) => {
+ <div className="border-border/50 flex items-center gap-2 border-b px-3 py-1">
+ <div className="bg-foreground flex size-4 items-center justify-center rounded-[1px] opacity-70">
+ <TerminalIcon className="text-code size-3" />
+ </div>
+ <TabsList className="rounded-none bg-transparent p-0">
+ {Object.entries(tabs).map(([key]) => {
return (
<TabsTrigger
key={key}
value={key}
- className="rounded-none border-b border-transparent bg-transparent p-0 pb-1.5 font-mono text-zinc-400 data-[state=active]:border-b-zinc-50 data-[state=active]:bg-transparent data-[state=active]:text-zinc-50"
+ className="data-[state=active]:bg-accent data-[state=active]:border-input h-7 border border-transparent pt-0.5 data-[state=active]:shadow-none"
>
{key}
</TabsTrigger>
@@ -85,30 +91,40 @@ export function CodeBlockCommand({
})}
</TabsList>
</div>
- {Object.entries(tabs).map(([key, value]) => {
- return (
- <TabsContent key={key} value={key} className="mt-0">
- <pre className="px-4 py-5 overflow-x-auto">
- <code
- className="relative font-mono text-sm leading-none"
- data-language="bash"
- >
- {value}
- </code>
- </pre>
- </TabsContent>
- );
- })}
+ <div className="no-scrollbar overflow-x-auto">
+ {Object.entries(tabs).map(([key, value]) => {
+ return (
+ <TabsContent key={key} value={key} className="mt-0 px-4 py-3.5">
+ <pre>
+ <code
+ className="relative font-mono text-sm leading-none"
+ data-language="bash"
+ >
+ {value}
+ </code>
+ </pre>
+ </TabsContent>
+ );
+ })}
+ </div>
</Tabs>
- <Button
- size="icon"
- variant="ghost"
- className="absolute right-2.5 top-2 z-10 h-6 w-6 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50 [&_svg]:h-3 [&_svg]:w-3"
- onClick={copyCommand}
- >
- <span className="sr-only">Copy</span>
- {hasCopied ? <CheckIcon /> : <ClipboardIcon />}
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ data-slot="copy-button"
+ size="icon"
+ variant="ghost"
+ className="absolute top-2 right-2 z-10 size-7 opacity-70 hover:opacity-100 focus-visible:opacity-100"
+ onClick={copyCommand}
+ >
+ <span className="sr-only">Copy</span>
+ {hasCopied ? <CheckIcon /> : <ClipboardIcon />}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ {hasCopied ? "Copied" : "Copy to Clipboard"}
+ </TooltipContent>
+ </Tooltip>
</div>
);
}
diff --git a/apps/www/components/code-collapsible-wrapper.tsx b/apps/www/components/code-collapsible-wrapper.tsx
new file mode 100644
index 00000000..8dc2af57
--- /dev/null
+++ b/apps/www/components/code-collapsible-wrapper.tsx
@@ -0,0 +1,51 @@
+"use client";
+
+import * as React from "react";
+
+import { cn } from "@/lib/utils";
+import { Button } from "@/components/ui/button";
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from "@/components/ui/collapsible";
+import { Separator } from "@/components/ui/separator";
+
+export function CodeCollapsibleWrapper({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof Collapsible>) {
+ const [isOpened, setIsOpened] = React.useState(false);
+
+ return (
+ <Collapsible
+ open={isOpened}
+ onOpenChange={setIsOpened}
+ className={cn("group/collapsible relative md:-mx-1", className)}
+ {...props}
+ >
+ <CollapsibleTrigger asChild>
+ <div className="absolute top-1.5 right-9 z-10 flex items-center">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground h-7 rounded-md px-2"
+ >
+ {isOpened ? "Collapse" : "Expand"}
+ </Button>
+ <Separator orientation="vertical" className="mx-1.5 !h-4" />
+ </div>
+ </CollapsibleTrigger>
+ <CollapsibleContent
+ forceMount
+ className="relative mt-6 overflow-hidden data-[state=closed]:max-h-64 [&>figure]:mt-0 [&>figure]:md:!mx-0"
+ >
+ {children}
+ </CollapsibleContent>
+ <CollapsibleTrigger className="from-code/70 to-code text-muted-foreground absolute inset-x-0 -bottom-2 flex h-20 items-center justify-center rounded-b-lg bg-gradient-to-b text-sm group-data-[state=open]/collapsible:hidden">
+ {isOpened ? "Collapse" : "Expand"}
+ </CollapsibleTrigger>
+ </Collapsible>
+ );
+}
diff --git a/apps/www/components/code-tabs.tsx b/apps/www/components/code-tabs.tsx
new file mode 100644
index 00000000..5d0f1767
--- /dev/null
+++ b/apps/www/components/code-tabs.tsx
@@ -0,0 +1,26 @@
+"use client";
+
+import * as React from "react";
+
+import { useConfig } from "@/hooks/use-config";
+import { Tabs } from "@/components/ui/tabs";
+
+export function CodeTabs({ children }: React.ComponentProps<typeof Tabs>) {
+ const [config, setConfig] = useConfig();
+
+ const installationType = React.useMemo(() => {
+ return config.installationType || "cli";
+ }, [config]);
+
+ return (
+ <Tabs
+ value={installationType}
+ onValueChange={(value) =>
+ setConfig({ ...config, installationType: value as "cli" | "manual" })
+ }
+ className="relative mt-6 w-full"
+ >
+ {children}
+ </Tabs>
+ );
+}
diff --git a/apps/www/components/component-preview-tabs.tsx b/apps/www/components/component-preview-tabs.tsx
new file mode 100644
index 00000000..e045a71d
--- /dev/null
+++ b/apps/www/components/component-preview-tabs.tsx
@@ -0,0 +1,97 @@
+"use client";
+
+import * as React from "react";
+
+import { cn } from "@/lib/utils";
+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { OpenInV0Button } from "@/components/open-in-v0-button";
+import { RotateCcw } from "lucide-react";
+import { Button } from "@/components/ui/button";
+
+export function ComponentPreviewTabs({
+ className,
+ name,
+ align = "center",
+ hideCode = false,
+ component,
+ source,
+ ...props
+}: React.ComponentProps<"div"> & {
+ name: string;
+ align?: "center" | "start" | "end";
+ hideCode?: boolean;
+ component: React.ReactNode;
+ source: React.ReactNode;
+}) {
+ const [key, setKey] = React.useState(0);
+ const [tab, setTab] = React.useState("preview");
+
+ return (
+ <div
+ className={cn("relative mt-4 mb-12 flex flex-col gap-2", className)}
+ {...props}
+ >
+ <Tabs
+ className="relative mr-auto w-full"
+ value={tab}
+ onValueChange={setTab}
+ >
+ <div className="flex items-center justify-between">
+ {!hideCode && (
+ <TabsList className="justify-start gap-4 rounded-none bg-transparent px-2 md:px-0">
+ <TabsTrigger
+ value="preview"
+ className="text-muted-foreground data-[state=active]:text-foreground px-0 text-base data-[state=active]:shadow-none dark:data-[state=active]:border-transparent dark:data-[state=active]:bg-transparent"
+ >
+ Preview
+ </TabsTrigger>
+ <TabsTrigger
+ value="code"
+ className="text-muted-foreground data-[state=active]:text-foreground px-0 text-base data-[state=active]:shadow-none dark:data-[state=active]:border-transparent dark:data-[state=active]:bg-transparent"
+ >
+ Code
+ </TabsTrigger>
+ </TabsList>
+ )}
+ </div>
+ </Tabs>
+ <div
+ data-tab={tab}
+ className="data-[tab=code]:border-code relative rounded-lg border md:-mx-1"
+ >
+ <div
+ data-slot="preview"
+ data-active={tab === "preview"}
+ className="invisible data-[active=true]:visible overflow-hidden"
+ >
+ <div className="flex items-center justify-end gap-2 p-4">
+ <OpenInV0Button url={`https://magicui.design/r/${name}.json`} />
+ <Button
+ onClick={() => setKey((prev) => prev + 1)}
+ className="flex items-center rounded-lg px-3 py-1"
+ variant="ghost"
+ >
+ <RotateCcw aria-label="restart-btn" size={16} />
+ </Button>
+ </div>
+ <div
+ key={key}
+ data-align={align}
+ className={cn(
+ "preview flex min-h-[450px] w-full justify-center p-10 data-[align=center]:items-center data-[align=end]:items-end data-[align=start]:items-start",
+ )}
+ >
+ {component}
+ </div>
+ </div>
+ <div
+ data-slot="code"
+ data-active={tab === "code"}
+ className="absolute inset-0 hidden overflow-hidden data-[active=true]:block **:[figure]:!m-0 **:[pre]:h-[450px]"
+ >
+ {source}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/www/components/component-preview.tsx b/apps/www/components/component-preview.tsx
index eefe8884..28f80ea8 100644
--- a/apps/www/components/component-preview.tsx
+++ b/apps/www/components/component-preview.tsx
@@ -1,14 +1,13 @@
-import { Index } from "@/__registry__";
-import { ComponentWrapper } from "@/components/component-wrapper";
-import { Icons } from "@/components/icons";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import { cn } from "@/lib/utils";
+import { ComponentPreviewTabs } from "@/components/component-preview-tabs";
+import { ComponentSource } from "@/components/component-source";
+import { getRegistryComponent } from "@/lib/registry";
import * as React from "react";
interface ComponentPreviewProps extends React.HTMLAttributes<HTMLDivElement> {
name: string;
align?: "center" | "start" | "end";
preview?: boolean;
+ hideCode?: boolean;
}
export function ComponentPreview({
@@ -17,79 +16,31 @@ export function ComponentPreview({
className,
align = "center",
preview = false,
+ hideCode = false,
...props
}: ComponentPreviewProps) {
- const Codes = React.Children.toArray(children) as React.ReactElement[];
- const Code = Codes[0];
-
- const Preview = React.useMemo(() => {
- const Component = Index[name]?.component;
-
- if (!Component) {
- console.error(`Component with name "${name}" not found in registry.`);
- return (
- <p className="text-sm text-muted-foreground">
- Component{" "}
- <code className="relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm">
- {name}
- </code>{" "}
- not found in registry.
- </p>
- );
- }
-
- return <Component />;
- }, [name]);
+ const Component = getRegistryComponent(name);
+ if (!Component) {
+ return (
+ <p className="text-muted-foreground text-sm">
+ Component{" "}
+ <code className="bg-muted relative rounded px-[0.3rem] py-[0.2rem] font-mono text-sm">
+ {name}
+ </code>{" "}
+ not found in registry.
+ </p>
+ );
+ }
return (
- <div
- className={cn(
- "relative my-4 flex flex-col space-y-2 lg:max-w-[120ch]",
- className,
- )}
+ <ComponentPreviewTabs
+ name={name}
+ className={className}
+ align={align}
+ hideCode={hideCode}
+ component={<Component />}
+ source={<ComponentSource name={name} collapsible={false} />}
{...props}
- >
- <Tabs defaultValue="preview" className="relative mr-auto w-full">
- {!preview && (
- <div className="flex items-center justify-between pb-3">
- <TabsList className="w-full justify-start rounded-none border-b bg-transparent p-0">
- <TabsTrigger
- value="preview"
- className="relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none"
- >
- Preview
- </TabsTrigger>
- <TabsTrigger
- value="code"
- className="relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none"
- >
- Code
- </TabsTrigger>
- </TabsList>
- </div>
- )}
- <TabsContent value="preview" className="relative rounded-md">
- <ComponentWrapper name={name}>
- <React.Suspense
- fallback={
- <div className="flex items-center text-sm text-muted-foreground">
- <Icons.spinner className="mr-2 size-4 animate-spin" />
- Loading...
- </div>
- }
- >
- {Preview}
- </React.Suspense>
- </ComponentWrapper>
- </TabsContent>
- <TabsContent value="code">
- <div className="flex flex-col space-y-4">
- <div className="w-full rounded-md [&_pre]:my-0 [&_pre]:max-h-[350px] [&_pre]:overflow-auto">
- {Code}
- </div>
- </div>
- </TabsContent>
- </Tabs>
- </div>
+ />
);
}
diff --git a/apps/www/components/component-source.tsx b/apps/www/components/component-source.tsx
index e2a62219..bd27f3dc 100644
--- a/apps/www/components/component-source.tsx
+++ b/apps/www/components/component-source.tsx
@@ -1,26 +1,101 @@
-"use client";
-
+import fs from "node:fs/promises";
+import path from "node:path";
import * as React from "react";
+import { highlightCode } from "@/lib/highlight-code";
+import { getRegistryItem } from "@/lib/registry";
import { cn } from "@/lib/utils";
-import { CodeBlockWrapper } from "@/components/code-block-wrapper";
+import { CodeCollapsibleWrapper } from "@/components/code-collapsible-wrapper";
+import { CopyButton } from "@/components/copy-button";
+import { getIconForLanguageExtension } from "@/components/icons";
+
+export async function ComponentSource({
+ name,
+ src,
+ title,
+ language,
+ collapsible = true,
+ className,
+}: React.ComponentProps<"div"> & {
+ name?: string;
+ src?: string;
+ title?: string;
+ language?: string;
+ collapsible?: boolean;
+}) {
+ if (!name && !src) {
+ return null;
+ }
+
+ let code: string | undefined;
+
+ if (name) {
+ const item = await getRegistryItem(name);
+ code = item?.files?.[0]?.content;
+ }
+
+ if (src) {
+ const file = await fs.readFile(path.join(process.cwd(), src), "utf-8");
+ code = file;
+ }
-interface ComponentSourceProps extends React.HTMLAttributes<HTMLDivElement> {
- src: string;
+ if (!code) {
+ return null;
+ }
+
+ const lang = language ?? title?.split(".").pop() ?? "tsx";
+ const highlightedCode = await highlightCode(code, lang);
+
+ if (!collapsible) {
+ return (
+ <div className={cn("relative", className)}>
+ <ComponentCode
+ code={code}
+ highlightedCode={highlightedCode}
+ language={lang}
+ title={title}
+ />
+ </div>
+ );
+ }
+
+ return (
+ <CodeCollapsibleWrapper className={className}>
+ <ComponentCode
+ code={code}
+ highlightedCode={highlightedCode}
+ language={lang}
+ title={title}
+ />
+ </CodeCollapsibleWrapper>
+ );
}
-export function ComponentSource({
- children,
- className,
- ...props
-}: ComponentSourceProps) {
+function ComponentCode({
+ code,
+ highlightedCode,
+ language,
+ title,
+}: {
+ code: string;
+ highlightedCode: string;
+ language: string;
+ title: string | undefined;
+}) {
return (
- <CodeBlockWrapper
- expandButtonTitle="Expand"
- className={cn("my-6 overflow-hidden rounded-md", className)}
- {...props}
- >
- {children}
- </CodeBlockWrapper>
+ <figure data-rehype-pretty-code-figure="" className="[&>pre]:max-h-96">
+ {title && (
+ <figcaption
+ data-rehype-pretty-code-title=""
+ className="text-code-foreground [&_svg]:text-code-foreground flex items-center gap-2 [&_svg]:size-4 [&_svg]:opacity-70"
+ data-language={language}
+ >
+ {getIconForLanguageExtension(language)}
+ {title}
+ </figcaption>
+ )}
+ <CopyButton value={code} />
+ <div dangerouslySetInnerHTML={{ __html: highlightedCode }} />
+ </figure>
);
}
diff --git a/apps/www/components/component-wrapper.tsx b/apps/www/components/component-wrapper.tsx
deleted file mode 100644
index b53a2554..00000000
--- a/apps/www/components/component-wrapper.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-"use client";
-
-import { OpenInV0Button } from "@/components/open-in-v0-button";
-import { Button } from "@/components/ui/button";
-import { cn } from "@/lib/utils";
-import { RotateCcw } from "lucide-react";
-import React from "react";
-
-interface ComponentWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
- name: string;
-}
-
-export const ComponentWrapper = ({
- className,
- children,
- name,
-}: ComponentWrapperProps) => {
- const [key, setKey] = React.useState(0);
-
- return (
- <div
- className={cn(
- "max-w-screen relative rounded-xl border bg-background",
- className,
- )}
- key={key}
- >
- {/* <div
- className={cn(
- `absolute inset-0 size-full`,
- `bg-[radial-gradient(#00000022_1px,transparent_1px)] dark:bg-[radial-gradient(#ffffff22_1px,transparent_1px)]`,
- "lab-bg pointer-events-none [background-size:16px_16px]",
- )}
- /> */}
- <div className="flex items-center justify-end gap-2 p-4">
- <OpenInV0Button url={`https://magicui.design/r/${name}.json`} />
- <Button
- onClick={() => setKey((prev) => prev + 1)}
- className="flex items-center rounded-lg px-3 py-1"
- variant="ghost"
- >
- <RotateCcw aria-label="restart-btn" size={16} />
- </Button>
- </div>
-
- <div className="flex min-h-[350px] w-full items-center justify-center p-10">
- {children}
- </div>
- </div>
- );
-};
diff --git a/apps/www/components/components-list.tsx b/apps/www/components/components-list.tsx
new file mode 100644
index 00000000..9de6e37e
--- /dev/null
+++ b/apps/www/components/components-list.tsx
@@ -0,0 +1,31 @@
+import Link from "next/link";
+
+import { source } from "@/lib/source";
+
+export function ComponentsList() {
+ const components = source.pageTree.children.find(
+ (page) => page.$id === "components",
+ );
+
+ if (components?.type !== "folder") {
+ return;
+ }
+
+ const list = components.children.filter(
+ (component) => component.type === "page",
+ );
+
+ return (
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 md:gap-x-8 lg:gap-x-8 lg:gap-y-6">
+ {list.map((component) => (
+ <Link
+ key={component.$id}
+ href={component.url}
+ className="text-lg font-medium underline-offset-4 hover:underline md:text-base"
+ >
+ {component.name}
+ </Link>
+ ))}
+ </div>
+ );
+}
diff --git a/apps/www/components/contribute.tsx b/apps/www/components/contribute.tsx
index 79d3a205..c516be6b 100644
--- a/apps/www/components/contribute.tsx
+++ b/apps/www/components/contribute.tsx
@@ -1,10 +1,9 @@
-import { Doc } from "content-collections";
import { BugIcon, LightbulbIcon, PencilIcon } from "lucide-react";
import Link from "next/link";
-
import { getGithubFileUrl, getGitHubIssueUrl } from "@/lib/github";
+import { Page, PageData } from "fumadocs-core/source";
-export function Contribute({ doc }: { doc: Doc }) {
+export function Contribute({ page }: { page: Page<PageData> }) {
const contributeLinks = [
{
text: "Report an issue",
@@ -12,7 +11,7 @@ export function Contribute({ doc }: { doc: Doc }) {
href: getGitHubIssueUrl({
owner: "magicuidesign",
repo: "magicui",
- title: `[bug]: ${doc.slug}`,
+ title: `[bug]: ${page.url}`,
labels: ["bug", "documentation"],
template: "bug_report.yml",
}),
@@ -23,7 +22,7 @@ export function Contribute({ doc }: { doc: Doc }) {
href: getGitHubIssueUrl({
owner: "magicuidesign",
repo: "magicui",
- title: `[feat]: ${doc.slug}`,
+ title: `[feat]: ${page.url}`,
labels: ["enhancement"],
template: "feature_request.yml",
}),
@@ -34,24 +33,24 @@ export function Contribute({ doc }: { doc: Doc }) {
href: getGithubFileUrl({
owner: "magicuidesign",
repo: "magicui",
- slug: doc.slug,
+ slug: page.url,
}),
},
];
return (
- <div className="space-y-2">
- <p className="font-medium">Contribute</p>
- <ul className="m-0 list-none">
+ <div className="flex flex-col gap-2 p-4">
+ <p className="text-xs font-medium text-muted-foreground">Contribute</p>
+ <ul className="m-0 list-none flex flex-col gap-1">
{contributeLinks.map((link, index) => (
- <li key={index} className="mt-0 pt-2">
+ <li key={index}>
<Link
href={link.href}
target="_blank"
rel="noopener noreferrer"
- className="inline-flex items-center text-sm text-muted-foreground transition-colors hover:text-foreground"
+ className="inline-flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground"
>
- <link.icon className="mr-2 size-4" />
+ <link.icon className="size-3" />
{link.text}
</Link>
</li>
diff --git a/apps/www/components/copy-button.tsx b/apps/www/components/copy-button.tsx
index 36d29c30..3d43cdfd 100644
--- a/apps/www/components/copy-button.tsx
+++ b/apps/www/components/copy-button.tsx
@@ -1,25 +1,16 @@
"use client";
import * as React from "react";
-import { DropdownMenuTriggerProps } from "@radix-ui/react-dropdown-menu";
import { CheckIcon, ClipboardIcon } from "lucide-react";
-import { NpmCommands } from "types/unist";
-
import { Event, trackEvent } from "@/lib/events";
import { cn } from "@/lib/utils";
-import { Button, ButtonProps } from "@/components/ui/button";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
-interface CopyButtonProps extends ButtonProps {
- value: string;
- src: string;
- event?: Event["name"];
-}
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
export async function copyToClipboardWithMeta(value: string, event?: Event) {
navigator.clipboard.writeText(value);
@@ -31,178 +22,56 @@ export async function copyToClipboardWithMeta(value: string, event?: Event) {
export function CopyButton({
value,
className,
- src,
variant = "ghost",
event,
...props
-}: CopyButtonProps) {
- const [hasCopied, setHasCopied] = React.useState(false);
-
- React.useEffect(() => {
- setTimeout(() => {
- setHasCopied(false);
- }, 2000);
- }, [hasCopied]);
-
- return (
- <Button
- size="icon"
- variant={variant}
- className={cn(
- "relative z-10 size-6 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50 [&_svg]:size-3",
- className,
- )}
- onClick={() => {
- copyToClipboardWithMeta(
- value,
- event
- ? {
- name: event,
- properties: {
- name: src,
- code: value,
- },
- }
- : undefined,
- );
- setHasCopied(true);
- }}
- {...props}
- >
- <span className="sr-only">Copy</span>
- {hasCopied ? <CheckIcon /> : <ClipboardIcon />}
- </Button>
- );
-}
-
-interface CopyWithClassNamesProps extends DropdownMenuTriggerProps {
+}: React.ComponentProps<typeof Button> & {
value: string;
- classNames: string;
- className?: string;
-}
-
-export function CopyWithClassNames({
- value,
- classNames,
- className,
- ...props
-}: CopyWithClassNamesProps) {
+ src?: string;
+ event?: Event["name"];
+}) {
const [hasCopied, setHasCopied] = React.useState(false);
React.useEffect(() => {
setTimeout(() => {
setHasCopied(false);
}, 2000);
- }, [hasCopied]);
-
- const copyToClipboard = React.useCallback((value: string) => {
- copyToClipboardWithMeta(value);
- setHasCopied(true);
}, []);
return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
+ <Tooltip>
+ <TooltipTrigger asChild>
<Button
+ data-slot="copy-button"
size="icon"
- variant="ghost"
+ variant={variant}
className={cn(
- "relative z-10 size-6 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50",
+ "bg-code absolute top-3 right-2 z-10 size-7 hover:opacity-100 focus-visible:opacity-100",
className,
)}
+ onClick={() => {
+ copyToClipboardWithMeta(
+ value,
+ event
+ ? {
+ name: event,
+ properties: {
+ code: value,
+ },
+ }
+ : undefined,
+ );
+ setHasCopied(true);
+ }}
+ {...props}
>
- {hasCopied ? (
- <CheckIcon className="size-3" />
- ) : (
- <ClipboardIcon className="size-3" />
- )}
<span className="sr-only">Copy</span>
+ {hasCopied ? <CheckIcon /> : <ClipboardIcon />}
</Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem onClick={() => copyToClipboard(value)}>
- Component
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => copyToClipboard(classNames)}>
- Classname
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- );
-}
-
-interface CopyNpmCommandButtonProps extends DropdownMenuTriggerProps {
- commands: Required<NpmCommands>;
-}
-
-export function CopyNpmCommandButton({
- commands,
- className,
- ...props
-}: CopyNpmCommandButtonProps) {
- const [hasCopied, setHasCopied] = React.useState(false);
-
- React.useEffect(() => {
- setTimeout(() => {
- setHasCopied(false);
- }, 2000);
- }, [hasCopied]);
-
- const copyCommand = React.useCallback(
- (value: string, pm: "npm" | "pnpm" | "yarn" | "bun") => {
- copyToClipboardWithMeta(value, {
- name: "copy_npm_command",
- properties: {
- command: value,
- pm,
- },
- });
- setHasCopied(true);
- },
- [],
- );
-
- return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- size="icon"
- variant="ghost"
- className={cn(
- "relative z-10 size-6 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50",
- className,
- )}
- >
- {hasCopied ? (
- <CheckIcon className="size-3" />
- ) : (
- <ClipboardIcon className="size-3" />
- )}
- <span className="sr-only">Copy</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem
- onClick={() => copyCommand(commands.__npmCommand__, "npm")}
- >
- npm
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={() => copyCommand(commands.__yarnCommand__, "yarn")}
- >
- yarn
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={() => copyCommand(commands.__pnpmCommand__, "pnpm")}
- >
- pnpm
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={() => copyCommand(commands.__bunCommand__, "bun")}
- >
- bun
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ </TooltipTrigger>
+ <TooltipContent>
+ {hasCopied ? "Copied" : "Copy to Clipboard"}
+ </TooltipContent>
+ </Tooltip>
);
}
diff --git a/apps/www/components/discord-link.tsx b/apps/www/components/discord-link.tsx
new file mode 100644
index 00000000..3ce032de
--- /dev/null
+++ b/apps/www/components/discord-link.tsx
@@ -0,0 +1,71 @@
+import * as React from "react";
+import Link from "next/link";
+
+import { siteConfig } from "@/config/site";
+import { Icons } from "@/components/icons";
+import { buttonVariants } from "@/components/ui/button";
+import { Skeleton } from "@/components/ui/skeleton";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { cn } from "@/lib/utils";
+import { PingDot } from "@/components/ping-dot";
+
+export function DiscordLink({ className }: { className?: string }) {
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Link
+ className={cn(
+ buttonVariants({ variant: "ghost", size: "sm" }),
+ "shadow-none transition-colors",
+ className,
+ )}
+ href={siteConfig.links.discord}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <Icons.discord />
+ <React.Suspense fallback={<Skeleton className="h-4 w-8" />}>
+ <ActiveMembersCount className="text-muted-foreground" />
+ </React.Suspense>
+ </Link>
+ </TooltipTrigger>
+ <TooltipContent>
+ <React.Suspense fallback={<Skeleton className="h-4 w-8" />}>
+ <span>
+ <ActiveMembersCount className="text-background" /> members online in
+ our Discord community
+ </span>
+ </React.Suspense>
+ </TooltipContent>
+ </Tooltip>
+ );
+}
+
+export async function ActiveMembersCount({
+ className,
+}: {
+ className?: string;
+}) {
+ const data = await fetch(
+ "https://discord.com/api/guilds/1151315619246002176/widget.json",
+ {
+ next: { revalidate: 3600 }, // Cache for 1 hour (3600 seconds)
+ },
+ );
+ const json = await data.json();
+
+ return (
+ <div className={cn("inline-flex items-center gap-1 ml-2", className)}>
+ <PingDot />
+ <span className="text-xs font-medium tabular-nums min-w-[2rem]">
+ {json.presence_count >= 1000
+ ? `${(json.presence_count / 1000).toFixed(1)}k`
+ : json.presence_count.toLocaleString()}
+ </span>
+ </div>
+ );
+}
diff --git a/apps/www/components/docs-sidebar.tsx b/apps/www/components/docs-sidebar.tsx
new file mode 100644
index 00000000..a732b68d
--- /dev/null
+++ b/apps/www/components/docs-sidebar.tsx
@@ -0,0 +1,125 @@
+"use client";
+
+import Link from "next/link";
+import { usePathname } from "next/navigation";
+
+import { docsConfig } from "@/config/docs";
+import {
+ Sidebar,
+ SidebarContent,
+ SidebarGroup,
+ SidebarGroupContent,
+ SidebarGroupLabel,
+ SidebarMenu,
+ SidebarMenuButton,
+ SidebarMenuItem,
+} from "@/components/ui/sidebar";
+import { cn } from "@/lib/utils";
+import { trackEvent } from "@/lib/events";
+import { NavItemWithChildren } from "@/types";
+
+interface DocsSidebarNavItemsProps {
+ items: NavItemWithChildren[];
+ pathname: string;
+ level?: number;
+}
+
+function DocsSidebarNavItems({
+ items,
+ pathname,
+ level = 0,
+}: DocsSidebarNavItemsProps) {
+ return (
+ <SidebarMenu className={cn("gap-0.5", level > 0 && "ml-4")}>
+ {items.map((item) => {
+ const isActive = item.href ? pathname === item.href : false;
+ const hasChildren = item.items && item.items.length > 0;
+
+ return (
+ <div key={item.href || item.title}>
+ <SidebarMenuItem>
+ <SidebarMenuButton
+ asChild={!!item.href}
+ isActive={isActive}
+ className="data-[active=true]:bg-accent data-[active=true]:border-accent 3xl:fixed:w-full 3xl:fixed:max-w-56 relative h-[30px] w-fit overflow-visible border border-transparent text-[0.8rem] font-medium after:absolute after:inset-x-0 after:-inset-y-1 after:z-0 after:rounded-md"
+ >
+ {item.href ? (
+ <Link
+ href={item.href}
+ onClick={() =>
+ item.event && trackEvent({ name: item.event })
+ }
+ >
+ <span className="absolute inset-0 flex w-(--sidebar-width) bg-transparent" />
+ <span className="flex items-center gap-2">
+ {item.title}
+ {item.label && (
+ <span className="rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
+ {item.label}
+ </span>
+ )}
+ {item.paid && (
+ <span className="rounded-md bg-gradient-to-r from-orange-400 to-orange-600 px-1.5 py-0.5 text-xs leading-none text-white no-underline group-hover:no-underline">
+ Pro
+ </span>
+ )}
+ </span>
+ </Link>
+ ) : (
+ <span className="flex items-center gap-2">
+ {item.title}
+ {item.label && (
+ <span className="rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
+ {item.label}
+ </span>
+ )}
+ </span>
+ )}
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ {hasChildren && (
+ <DocsSidebarNavItems
+ items={item.items!}
+ pathname={pathname}
+ level={level + 1}
+ />
+ )}
+ </div>
+ );
+ })}
+ </SidebarMenu>
+ );
+}
+
+export function DocsSidebar({
+ ...props
+}: React.ComponentProps<typeof Sidebar>) {
+ const pathname = usePathname();
+
+ return (
+ <Sidebar
+ className="sticky top-[calc(var(--header-height)+1px)] z-30 hidden h-[calc(100svh-var(--footer-height)+2rem)] bg-transparent lg:flex"
+ collapsible="none"
+ {...props}
+ >
+ <SidebarContent className="no-scrollbar overflow-x-hidden px-2 pb-12">
+ <div className="h-(--top-spacing) shrink-0" />
+ {docsConfig.sidebarNav.map((section) => {
+ return (
+ <SidebarGroup key={section.title}>
+ <SidebarGroupLabel className="text-muted-foreground font-medium">
+ {section.title}
+ </SidebarGroupLabel>
+ <SidebarGroupContent>
+ <DocsSidebarNavItems
+ items={section.items || []}
+ pathname={pathname}
+ />
+ </SidebarGroupContent>
+ </SidebarGroup>
+ );
+ })}
+ </SidebarContent>
+ </Sidebar>
+ );
+}
diff --git a/apps/www/components/docs-toc.tsx b/apps/www/components/docs-toc.tsx
new file mode 100644
index 00000000..7917c30d
--- /dev/null
+++ b/apps/www/components/docs-toc.tsx
@@ -0,0 +1,126 @@
+"use client";
+
+import * as React from "react";
+import { IconMenu3 } from "@tabler/icons-react";
+
+import { cn } from "@/lib/utils";
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+
+function useActiveItem(itemIds: string[]) {
+ const [activeId, setActiveId] = React.useState<string | null>(null);
+
+ React.useEffect(() => {
+ const observer = new IntersectionObserver(
+ (entries) => {
+ for (const entry of entries) {
+ if (entry.isIntersecting) {
+ setActiveId(entry.target.id);
+ }
+ }
+ },
+ { rootMargin: "0% 0% -80% 0%" },
+ );
+
+ for (const id of itemIds ?? []) {
+ const element = document.getElementById(id);
+ if (element) {
+ observer.observe(element);
+ }
+ }
+
+ return () => {
+ for (const id of itemIds ?? []) {
+ const element = document.getElementById(id);
+ if (element) {
+ observer.unobserve(element);
+ }
+ }
+ };
+ }, [itemIds]);
+
+ return activeId;
+}
+
+export function DocsTableOfContents({
+ toc,
+ variant = "list",
+ className,
+}: {
+ toc: {
+ title?: React.ReactNode;
+ url: string;
+ depth: number;
+ }[];
+ variant?: "dropdown" | "list";
+ className?: string;
+}) {
+ const [open, setOpen] = React.useState(false);
+ const itemIds = React.useMemo(
+ () => toc.map((item) => item.url.replace("#", "")),
+ [toc],
+ );
+ const activeHeading = useActiveItem(itemIds);
+
+ if (!toc?.length) {
+ return null;
+ }
+
+ if (variant === "dropdown") {
+ return (
+ <DropdownMenu open={open} onOpenChange={setOpen}>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="outline"
+ size="sm"
+ className={cn("h-8 md:h-7", className)}
+ >
+ <IconMenu3 /> On This Page
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="start"
+ className="no-scrollbar max-h-[70svh]"
+ >
+ {toc.map((item) => (
+ <DropdownMenuItem
+ key={item.url}
+ asChild
+ onClick={() => {
+ setOpen(false);
+ }}
+ data-depth={item.depth}
+ className="data-[depth=3]:pl-6 data-[depth=4]:pl-8"
+ >
+ <a href={item.url}>{item.title}</a>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+ }
+
+ return (
+ <div className={cn("flex flex-col gap-2 p-4 pt-0 text-sm", className)}>
+ <p className="text-muted-foreground bg-background sticky top-0 h-6 text-xs">
+ On This Page
+ </p>
+ {toc.map((item) => (
+ <a
+ key={item.url}
+ href={item.url}
+ className="text-muted-foreground hover:text-foreground data-[active=true]:text-foreground text-[0.8rem] no-underline transition-colors data-[depth=3]:pl-4 data-[depth=4]:pl-6"
+ data-active={item.url === `#${activeHeading}`}
+ data-depth={item.depth}
+ >
+ {item.title}
+ </a>
+ ))}
+ </div>
+ );
+}
diff --git a/apps/www/components/github-link.tsx b/apps/www/components/github-link.tsx
new file mode 100644
index 00000000..7c168dbc
--- /dev/null
+++ b/apps/www/components/github-link.tsx
@@ -0,0 +1,63 @@
+import * as React from "react";
+import Link from "next/link";
+
+import { siteConfig } from "@/config/site";
+import { Icons } from "@/components/icons";
+import { Button } from "@/components/ui/button";
+import { Skeleton } from "@/components/ui/skeleton";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+
+export function GitHubLink({ className }: { className?: string }) {
+ return (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button asChild size="lg" variant="ghost" className="h-8 shadow-none">
+ <Link
+ href={siteConfig.links.github}
+ target="_blank"
+ rel="noreferrer"
+ className={className}
+ >
+ <Icons.gitHub />
+ <React.Suspense fallback={<Skeleton className="h-4 w-8" />}>
+ <StarsCount />
+ </React.Suspense>
+ </Link>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>View on GitHub</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+}
+
+export async function StarsCount() {
+ const data = await fetch(
+ "https://api.github.com/repos/magicuidesign/magicui",
+ {
+ next: { revalidate: 86400 }, // Cache for 1 day (86400 seconds)
+ },
+ );
+ const json = await data.json();
+
+ return (
+ <span className="text-muted-foreground w-8 text-xs tabular-nums">
+ <span className="hidden sm:inline">
+ {json.stargazers_count.toLocaleString()}
+ </span>
+ <span className="sm:hidden">
+ {json.stargazers_count >= 1000
+ ? `${(json.stargazers_count / 1000).toFixed(1)}k`
+ : json.stargazers_count.toLocaleString()}
+ </span>
+ </span>
+ );
+}
diff --git a/apps/www/components/icons.tsx b/apps/www/components/icons.tsx
index d2fc0687..eec0e4b6 100644
--- a/apps/www/components/icons.tsx
+++ b/apps/www/components/icons.tsx
@@ -8,6 +8,7 @@ import {
Copy,
CreditCard,
File,
+ FileIcon,
FileText,
HelpCircle,
Image,
@@ -623,4 +624,61 @@ export const Icons = {
</g>
</svg>
),
+ json: (props: IconProps) => (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
+ <path
+ fill="currentColor"
+ d="M12.043 23.968c.479-.004.953-.029 1.426-.094a11.805 11.805 0 0 0 3.146-.863 12.404 12.404 0 0 0 3.793-2.542 11.977 11.977 0 0 0 2.44-3.427 11.794 11.794 0 0 0 1.02-3.476c.149-1.16.135-2.346-.045-3.499a11.96 11.96 0 0 0-.793-2.788 11.197 11.197 0 0 0-.854-1.617c-1.168-1.837-2.861-3.314-4.81-4.3a12.835 12.835 0 0 0-2.172-.87h-.005c.119.063.24.132.345.201.12.074.239.146.351.225a8.93 8.93 0 0 1 1.559 1.33c1.063 1.145 1.797 2.548 2.218 4.041.284.982.434 1.998.495 3.017.044.743.044 1.491-.047 2.229-.149 1.27-.554 2.51-1.228 3.596a7.475 7.475 0 0 1-1.903 2.084c-1.244.928-2.877 1.482-4.436 1.114a3.916 3.916 0 0 1-.748-.258 4.692 4.692 0 0 1-.779-.45 6.08 6.08 0 0 1-1.244-1.105 6.507 6.507 0 0 1-1.049-1.747 7.366 7.366 0 0 1-.494-2.54c-.03-1.273.225-2.553.854-3.67a6.43 6.43 0 0 1 1.663-1.918c.225-.178.464-.333.704-.479l.016-.007a5.121 5.121 0 0 0-1.441-.12 4.963 4.963 0 0 0-1.228.24c-.359.12-.704.27-1.019.45a6.146 6.146 0 0 0-.733.494c-.211.18-.42.36-.615.555-1.123 1.153-1.768 2.682-2.022 4.256-.15.973-.15 1.96-.091 2.95.105 1.395.391 2.787.945 4.062a8.518 8.518 0 0 0 1.348 2.173 8.14 8.14 0 0 0 3.132 2.23 7.934 7.934 0 0 0 2.113.54c.074.015.149.015.209.015zm-2.934-.398a4.102 4.102 0 0 1-.45-.228 8.5 8.5 0 0 1-2.038-1.534c-1.094-1.137-1.827-2.566-2.247-4.08a15.184 15.184 0 0 1-.495-3.172 12.14 12.14 0 0 1 .046-2.082c.135-1.257.495-2.501 1.124-3.58a6.889 6.889 0 0 1 1.783-2.053 6.23 6.23 0 0 1 1.633-.9 5.363 5.363 0 0 1 3.522-.045c.029 0 .029 0 .045.03.015.015.045.015.06.03.045.016.104.045.165.074.239.12.479.271.704.42a6.294 6.294 0 0 1 2.097 2.502c.42.914.615 1.934.631 2.938.014 1.079-.18 2.157-.645 3.146a6.42 6.42 0 0 1-2.638 2.832c.09.03.18.045.271.075.225.044.449.074.688.074 1.468.045 2.892-.66 3.94-1.647.195-.18.375-.375.54-.585.225-.27.435-.54.614-.823.239-.375.435-.75.614-1.154a8.112 8.112 0 0 0 .509-1.664c.196-1.004.211-2.022.149-3.026-.135-2.022-.673-4.045-1.842-5.724a9.054 9.054 0 0 0-.555-.719 9.868 9.868 0 0 0-1.063-1.034 8.477 8.477 0 0 0-1.363-.915 9.927 9.927 0 0 0-1.692-.598l-.3-.06c-.209-.03-.42-.044-.634-.06a8.453 8.453 0 0 0-1.015.016c-.704.045-1.412.16-2.112.337C5.799 1.227 2.863 3.566 1.3 6.67A11.834 11.834 0 0 0 .238 9.801a11.81 11.81 0 0 0-.104 3.775c.12 1.02.374 2.023.778 2.977.227.57.511 1.124.825 1.648 1.094 1.783 2.683 3.236 4.51 4.24.688.39 1.408.69 2.157.944.226.074.45.15.689.21z"
+ />
+ </svg>
+ ),
+ ts: (props: IconProps) => (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
+ <path d="M1.125 0C.502 0 0 .502 0 1.125v21.75C0 23.498.502 24 1.125 24h21.75c.623 0 1.125-.502 1.125-1.125V1.125C24 .502 23.498 0 22.875 0zm17.363 9.75c.612 0 1.154.037 1.627.111a6.38 6.38 0 0 1 1.306.34v2.458a3.95 3.95 0 0 0-.643-.361 5.093 5.093 0 0 0-.717-.26 5.453 5.453 0 0 0-1.426-.2c-.3 0-.573.028-.819.086a2.1 2.1 0 0 0-.623.242c-.17.104-.3.229-.393.374a.888.888 0 0 0-.14.49c0 .196.053.373.156.529.104.156.252.304.443.444s.423.276.696.41c.273.135.582.274.926.416.47.197.892.407 1.266.628.374.222.695.473.963.753.268.279.472.598.614.957.142.359.214.776.214 1.253 0 .657-.125 1.21-.373 1.656a3.033 3.033 0 0 1-1.012 1.085 4.38 4.38 0 0 1-1.487.596c-.566.12-1.163.18-1.79.18a9.916 9.916 0 0 1-1.84-.164 5.544 5.544 0 0 1-1.512-.493v-2.63a5.033 5.033 0 0 0 3.237 1.2c.333 0 .624-.03.872-.09.249-.06.456-.144.623-.25.166-.108.29-.234.373-.38a1.023 1.023 0 0 0-.074-1.089 2.12 2.12 0 0 0-.537-.5 5.597 5.597 0 0 0-.807-.444 27.72 27.72 0 0 0-1.007-.436c-.918-.383-1.602-.852-2.053-1.405-.45-.553-.676-1.222-.676-2.005 0-.614.123-1.141.369-1.582.246-.441.58-.804 1.004-1.089a4.494 4.494 0 0 1 1.47-.629 7.536 7.536 0 0 1 1.77-.201zm-15.113.188h9.563v2.166H9.506v9.646H6.789v-9.646H3.375z" />
+ </svg>
+ ),
+ css: (props: IconProps) => (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
+ <path d="M0 0v20.16A3.84 3.84 0 0 0 3.84 24h16.32A3.84 3.84 0 0 0 24 20.16V3.84A3.84 3.84 0 0 0 20.16 0Zm14.256 13.08c1.56 0 2.28 1.08 2.304 2.64h-1.608c.024-.288-.048-.6-.144-.84-.096-.192-.288-.264-.552-.264-.456 0-.696.264-.696.84-.024.576.288.888.768 1.08.72.288 1.608.744 1.92 1.296q.432.648.432 1.656c0 1.608-.912 2.592-2.496 2.592-1.656 0-2.4-1.032-2.424-2.688h1.68c0 .792.264 1.176.792 1.176.264 0 .456-.072.552-.24.192-.312.24-1.176-.048-1.512-.312-.408-.912-.6-1.32-.816q-.828-.396-1.224-.936c-.24-.36-.36-.888-.36-1.536 0-1.44.936-2.472 2.424-2.448m5.4 0c1.584 0 2.304 1.08 2.328 2.64h-1.608c0-.288-.048-.6-.168-.84-.096-.192-.264-.264-.528-.264-.48 0-.72.264-.72.84s.288.888.792 1.08c.696.288 1.608.744 1.92 1.296.264.432.408.984.408 1.656.024 1.608-.888 2.592-2.472 2.592-1.68 0-2.424-1.056-2.448-2.688h1.68c0 .744.264 1.176.792 1.176.264 0 .456-.072.552-.24.216-.312.264-1.176-.048-1.512-.288-.408-.888-.6-1.32-.816-.552-.264-.96-.576-1.2-.936s-.36-.888-.36-1.536c-.024-1.44.912-2.472 2.4-2.448m-11.031.018c.711-.006 1.419.198 1.839.63.432.432.672 1.128.648 1.992H9.336c.024-.456-.096-.792-.432-.96-.312-.144-.768-.048-.888.24-.12.264-.192.576-.168.864v3.504c0 .744.264 1.128.768 1.128a.65.65 0 0 0 .552-.264c.168-.24.192-.552.168-.84h1.776c.096 1.632-.984 2.712-2.568 2.688-1.536 0-2.496-.864-2.472-2.472v-4.032c0-.816.24-1.44.696-1.848.432-.408 1.146-.624 1.857-.63" />
+ </svg>
+ ),
+ bash: (props: IconProps) => (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
+ <path d="M21.038 4.9 13.461.402a2.86 2.86 0 0 0-2.923.001L2.961 4.9A3.023 3.023 0 0 0 1.5 7.503v8.995c0 1.073.557 2.066 1.462 2.603l7.577 4.497a2.86 2.86 0 0 0 2.922 0l7.577-4.497a3.023 3.023 0 0 0 1.462-2.603V7.503A3.021 3.021 0 0 0 21.038 4.9zM15.17 18.946l.013.646c.001.078-.05.167-.111.198l-.383.22c-.061.031-.111-.007-.112-.085l-.007-.635c-.328.136-.66.169-.872.084-.04-.016-.057-.075-.041-.142l.139-.584a.24.24 0 0 1 .069-.121.163.163 0 0 1 .036-.026c.022-.011.043-.014.062-.006.229.077.521.041.802-.101.357-.181.596-.545.592-.907-.003-.328-.181-.465-.613-.468-.55.001-1.064-.107-1.072-.917-.007-.667.34-1.361.889-1.8l-.007-.652c-.001-.08.048-.168.111-.2l.37-.236c.061-.031.111.007.112.087l.006.653c.273-.109.511-.138.726-.088.047.012.067.076.048.151l-.144.578a.255.255 0 0 1-.065.116.161.161 0 0 1-.038.028.083.083 0 0 1-.057.009c-.098-.022-.332-.073-.699.113-.385.195-.52.53-.517.778.003.297.155.387.681.396.7.012 1.003.318 1.01 1.023.007.689-.362 1.433-.928 1.888zm3.973-1.087c0 .06-.008.116-.058.145l-1.916 1.164c-.05.029-.09.004-.09-.056v-.494c0-.06.037-.093.087-.122l1.887-1.129c.05-.029.09-.004.09.056v.436zm1.316-11.062-7.168 4.427c-.894.523-1.553 1.109-1.553 2.187v8.833c0 .645.26 1.063.66 1.184a2.304 2.304 0 0 1-.398.039c-.42 0-.833-.114-1.197-.33L3.226 18.64a2.494 2.494 0 0 1-1.201-2.142V7.503c0-.881.46-1.702 1.201-2.142L10.803.863a2.342 2.342 0 0 1 2.394 0l7.577 4.498a2.479 2.479 0 0 1 1.164 1.732c-.252-.536-.818-.682-1.479-.296z" />
+ </svg>
+ ),
+ v0: (props: IconProps) => (
+ <svg
+ viewBox="0 0 40 20"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <path
+ d="M23.3919 0H32.9188C36.7819 0 39.9136 3.13165 39.9136 6.99475V16.0805H36.0006V6.99475C36.0006 6.90167 35.9969 6.80925 35.9898 6.71766L26.4628 16.079C26.4949 16.08 26.5272 16.0805 26.5595 16.0805H36.0006V19.7762H26.5595C22.6964 19.7762 19.4788 16.6139 19.4788 12.7508V3.68923H23.3919V12.7508C23.3919 12.9253 23.4054 13.0977 23.4316 13.2668L33.1682 3.6995C33.0861 3.6927 33.003 3.68923 32.9188 3.68923H23.3919V0Z"
+ fill="currentColor"
+ ></path>
+ <path
+ d="M13.7688 19.0956L0 3.68759H5.53933L13.6231 12.7337V3.68759H17.7535V17.5746C17.7535 19.6705 15.1654 20.6584 13.7688 19.0956Z"
+ fill="currentColor"
+ ></path>
+ </svg>
+ ),
};
+
+export function getIconForLanguageExtension(language: string) {
+ switch (language) {
+ case "json":
+ return <Icons.json />;
+ case "css":
+ return <Icons.css className="fill-foreground" />;
+ case "js":
+ case "jsx":
+ case "ts":
+ case "tsx":
+ case "typescript":
+ return <Icons.ts className="fill-foreground" />;
+ default:
+ return <FileIcon />;
+ }
+}
diff --git a/apps/www/components/logo-button.tsx b/apps/www/components/logo-button.tsx
new file mode 100644
index 00000000..4fa3a3b2
--- /dev/null
+++ b/apps/www/components/logo-button.tsx
@@ -0,0 +1,67 @@
+"use client";
+
+import Link from "next/link";
+
+import { Icons } from "@/components/icons";
+import { siteConfig } from "@/config/site";
+import {
+ ContextMenu,
+ ContextMenuTrigger,
+ ContextMenuContent,
+ ContextMenuItem,
+} from "@/components/ui/context-menu";
+import { toast } from "sonner";
+
+export function LogoButton() {
+ function copyLogoAsSVG(path: string) {
+ fetch(path)
+ .then((response) => response.blob())
+ .then((blob) => {
+ const reader = new FileReader();
+ reader.onload = function (event) {
+ const svgContent = event.target?.result;
+ navigator.clipboard.writeText(svgContent as string);
+ };
+ reader.readAsText(blob);
+ toast.success("Logo copied to clipboard");
+ });
+ }
+
+ function copyLogoAsPNG(path: string) {
+ fetch(path)
+ .then((response) => response.blob())
+ .then((blob) => {
+ const item = new ClipboardItem({ "image/png": blob });
+ navigator.clipboard.write([item]);
+ toast.success("Logo copied to clipboard");
+ });
+ }
+ return (
+ <ContextMenu>
+ <ContextMenuTrigger asChild>
+ <Link href="/" className="relative mr-6 flex items-center space-x-2">
+ <Icons.logo className="size-6" />
+ <span className="hidden font-bold md:inline-block">
+ {siteConfig.name}
+ </span>
+ </Link>
+ </ContextMenuTrigger>
+ <ContextMenuContent>
+ <ContextMenuItem
+ className="flex items-center gap-2"
+ onClick={() => copyLogoAsSVG("/icon.svg")}
+ >
+ <Icons.logo className="size-4" />
+ <span>Copy Logo as SVG</span>
+ </ContextMenuItem>
+ <ContextMenuItem
+ className="flex items-center gap-2"
+ onClick={() => copyLogoAsPNG("/icon.png")}
+ >
+ <Icons.logo className="size-4" />
+ <span>Copy Logo as PNG</span>
+ </ContextMenuItem>
+ </ContextMenuContent>
+ </ContextMenu>
+ );
+}
diff --git a/apps/www/components/main-nav.tsx b/apps/www/components/main-nav.tsx
index f970a9c5..078c5cb0 100644
--- a/apps/www/components/main-nav.tsx
+++ b/apps/www/components/main-nav.tsx
@@ -1,102 +1,38 @@
"use client";
-import { Icons } from "@/components/icons";
-import {
- ContextMenu,
- ContextMenuContent,
- ContextMenuItem,
- ContextMenuTrigger,
-} from "@/components/ui/context-menu";
-import { VersionSelect } from "@/components/version-select";
-import { docsConfig } from "@/config/docs";
-import { siteConfig } from "@/config/site";
+import { Button } from "@/components/ui/button";
+import { Event, trackEvent } from "@/lib/events";
import { cn } from "@/lib/utils";
-import { ExternalLinkIcon } from "@radix-ui/react-icons";
+import { NavItem } from "@/types";
import Link from "next/link";
import { usePathname } from "next/navigation";
-import posthog from "posthog-js";
-function copyLogoAsSVG(path: string) {
- fetch(path)
- .then((response) => response.blob())
- .then((blob) => {
- const reader = new FileReader();
- reader.onload = function (event) {
- const svgContent = event.target?.result;
- navigator.clipboard.writeText(svgContent as string);
- };
- reader.readAsText(blob);
- });
-}
-
-function copyLogoAsPNG(path: string) {
- fetch(path)
- .then((response) => response.blob())
- .then((blob) => {
- const item = new ClipboardItem({ "image/png": blob });
- navigator.clipboard.write([item]);
- });
-}
-
-export function MainNav() {
+export function MainNav({
+ items,
+ className,
+ ...props
+}: React.ComponentProps<"nav"> & {
+ items: NavItem[];
+}) {
const pathname = usePathname();
return (
- <div className="mr-4 hidden md:flex">
- <ContextMenu>
- <ContextMenuTrigger asChild>
- <Link href="/" className="relative mr-6 flex items-center space-x-2">
- <Icons.logo className="size-6" />
- <span className="hidden font-bold md:inline-block">
- {siteConfig.name}
- </span>
- </Link>
- </ContextMenuTrigger>
- <ContextMenuContent>
- <ContextMenuItem
- className="flex items-center gap-2"
- onClick={() => copyLogoAsSVG("/icon.svg")}
- >
- <Icons.logo className="size-4" />
- <span>Copy Logo as SVG</span>
- </ContextMenuItem>
- <ContextMenuItem
- className="flex items-center gap-2"
- onClick={() => copyLogoAsPNG("/icon.png")}
- >
- <Icons.logo className="size-4" />
- <span>Copy Logo as PNG</span>
- </ContextMenuItem>
- </ContextMenuContent>
- </ContextMenu>
- <div className="mr-4">
- <VersionSelect />
- </div>
- <nav className="hidden items-center space-x-6 text-sm font-medium xl:flex">
- {docsConfig.mainNav.map((item) => (
+ <nav className={cn("items-center gap-0.5", className)} {...props}>
+ {items.map((item) => (
+ <Button key={item.href} variant="ghost" asChild size="sm">
<Link
- key={item.href}
- href={item.href!}
- aria-label={item.title}
- onClick={() => item.event && posthog.capture(item.event)}
- target={item.external ? "_blank" : undefined}
- className={cn(
- "flex items-center justify-center transition-colors hover:text-foreground/80",
- pathname?.startsWith(item.href!)
- ? "text-foreground"
- : "text-foreground/60",
- )}
+ href={item.href ?? ""}
+ className={cn(pathname === item.href && "text-primary")}
+ onClick={() => {
+ if (item.event) {
+ trackEvent({ name: item.event });
+ }
+ }}
>
- <span className="shrink-0">{item.title}</span>
- {item.label && (
- <span className="ml-2 rounded-md bg-[#FFBD7A] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
- {item.label}
- </span>
- )}
- {item.external && <ExternalLinkIcon className="ml-2 size-4" />}
+ {item.title}
</Link>
- ))}
- </nav>
- </div>
+ </Button>
+ ))}
+ </nav>
);
}
diff --git a/apps/www/components/mdx-components.tsx b/apps/www/components/mdx-components.tsx
deleted file mode 100644
index b956905b..00000000
--- a/apps/www/components/mdx-components.tsx
+++ /dev/null
@@ -1,317 +0,0 @@
-import { Callout } from "@/components/callout";
-import { CodeBlockCommand } from "@/components/code-block-command";
-import TechStack from "@/components/tech-stack";
-import TemplatePreview from "@/components/template-preview";
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
-} from "@/components/ui/accordion";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import { Event } from "@/lib/events";
-import { cn } from "@/lib/utils";
-import { TweetCard } from "@/registry/magicui/tweet-card";
-import { useMDXComponent } from "@content-collections/mdx/react";
-import Image from "next/image";
-import Link from "next/link";
-import { ComponentPreview } from "@/components/component-preview";
-import { ComponentSource } from "@/components/component-source";
-import { CopyButton } from "@/components/copy-button";
-import { TemplateOpen } from "@/components/template-open";
-
-const CustomLink = (props: any) => {
- const href = props.href;
-
- if (href.startsWith("/")) {
- return (
- <Link {...props} href={href}>
- {props.children}
- </Link>
- );
- }
-
- if (href.startsWith("#")) {
- return <a {...props} />;
- }
-
- return <a target="_blank" rel="noopener noreferrer" {...props} />;
-};
-
-const components = {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
- Callout,
- TechStack,
- TemplateOpen,
- TemplatePreview,
- Image,
- Tweet: ({ id }: { id: string }) => <TweetCard id={id} className="mx-auto" />,
- ComponentPreview,
- ComponentSource: (props: any) => <ComponentSource {...props} />,
- h1: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
- <h1
- className={cn(
- "font-heading mt-2 scroll-m-20 text-4xl font-bold",
- className,
- )}
- {...props}
- />
- ),
- h2: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
- <h2
- className={cn(
- "font-heading mt-12 scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0",
- className,
- )}
- {...props}
- />
- ),
- h3: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
- <h3
- className={cn(
- "font-heading mt-8 scroll-m-20 text-xl font-semibold tracking-tight",
- className,
- )}
- {...props}
- />
- ),
- h4: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
- <h4
- className={cn(
- "font-heading mt-8 scroll-m-20 text-lg font-semibold tracking-tight",
- className,
- )}
- {...props}
- />
- ),
- h5: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
- <h5
- className={cn(
- "mt-8 scroll-m-20 text-lg font-semibold tracking-tight",
- className,
- )}
- {...props}
- />
- ),
- h6: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
- <h6
- className={cn(
- "mt-8 scroll-m-20 text-base font-semibold tracking-tight",
- className,
- )}
- {...props}
- />
- ),
- a: ({ className, ...props }: React.HTMLAttributes<HTMLAnchorElement>) => (
- <CustomLink
- className={cn("font-medium underline underline-offset-4", className)}
- {...props}
- />
- ),
- p: ({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) => (
- <p
- className={cn("leading-7 [&:not(:first-child)]:mt-6", className)}
- {...props}
- />
- ),
- ul: ({ className, ...props }: React.HTMLAttributes<HTMLUListElement>) => (
- <ul className={cn("ml-6 list-disc", className)} {...props} />
- ),
- ol: ({ className, ...props }: React.HTMLAttributes<HTMLOListElement>) => (
- <ol className={cn("ml-6 list-decimal", className)} {...props} />
- ),
- li: ({ className, ...props }: React.HTMLAttributes<HTMLElement>) => (
- <li className={cn("mt-2", className)} {...props} />
- ),
- blockquote: ({ className, ...props }: React.HTMLAttributes<HTMLElement>) => (
- <blockquote
- className={cn("mt-6 border-l-2 pl-6 italic", className)}
- {...props}
- />
- ),
- table: ({ className, ...props }: React.HTMLAttributes<HTMLTableElement>) => (
- <div className="my-6 w-full overflow-y-auto rounded-lg border dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400">
- <table
- className={cn("my-0 w-full overflow-hidden", className)}
- {...props}
- />
- </div>
- ),
- thead: ({
- className,
- ...props
- }: React.HTMLAttributes<HTMLTableSectionElement>) => (
- <thead className={cn("border-b last:border-b-0", className)} {...props} />
- ),
- tr: ({ className, ...props }: React.HTMLAttributes<HTMLTableRowElement>) => (
- <tr className={cn("border-b last:border-b-0", className)} {...props} />
- ),
- th: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (
- <th
- className={cn(
- "text-balance border-r px-6 py-3 text-left font-mono text-sm font-semibold tracking-tight last:border-r-0",
- className,
- )}
- {...props}
- />
- ),
- td: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (
- <td
- className={cn(
- "border-r px-6 py-3 text-sm last:border-r-0 [&[align=center]]:text-center [&[align=right]]:text-right",
- className,
- )}
- {...props}
- />
- ),
- Step: ({ className, ...props }: React.ComponentProps<"h3">) => (
- <h3
- className={cn(
- "font-heading mt-8 scroll-m-20 text-xl font-semibold tracking-tight",
- className,
- )}
- {...props}
- />
- ),
- Steps: ({ ...props }) => (
- <div
- className="[&>h3]:step steps mb-12 ml-4 pl-8 [counter-reset:step] relative before:absolute before:left-0 before:top-0 before:h-full before:w-px before:bg-gradient-to-b before:from-transparent before:via-muted-foreground/50 before:to-transparent"
- {...props}
- />
- ),
- Tabs: ({ className, ...props }: React.ComponentProps<typeof Tabs>) => (
- <Tabs
- className={cn("relative mt-6 w-full overflow-x-auto", className)}
- {...props}
- />
- ),
- TabsList: ({
- className,
- ...props
- }: React.ComponentProps<typeof TabsList>) => (
- <TabsList
- className={cn(
- "w-full justify-start rounded-none border-b bg-transparent p-0",
- className,
- )}
- {...props}
- />
- ),
- TabsTrigger: ({
- className,
- ...props
- }: React.ComponentProps<typeof TabsTrigger>) => (
- <TabsTrigger
- className={cn(
- "relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none",
- className,
- )}
- {...props}
- />
- ),
- TabsContent: ({
- className,
- ...props
- }: React.ComponentProps<typeof TabsContent>) => (
- <TabsContent
- className={cn(
- "relative [&_h3.font-heading]:text-base [&_h3.font-heading]:font-semibold",
- className,
- )}
- {...props}
- />
- ),
- pre: ({
- className,
- __rawString__,
- __npmCommand__,
- __pnpmCommand__,
- __yarnCommand__,
- __bunCommand__,
- __withMeta__,
- __src__,
- __event__,
- __name__,
- ...props
- }: React.HTMLAttributes<HTMLPreElement> & {
- __rawString__?: string;
- __npmCommand__?: string;
- __pnpmCommand__?: string;
- __yarnCommand__?: string;
- __bunCommand__?: string;
- __withMeta__?: boolean;
- __src__?: string;
- __event__?: Event["name"];
- __name__?: string;
- }) => {
- const isNpmCommand =
- __npmCommand__ && __yarnCommand__ && __pnpmCommand__ && __bunCommand__;
-
- if (isNpmCommand) {
- return (
- <CodeBlockCommand
- __npmCommand__={__npmCommand__}
- __yarnCommand__={__yarnCommand__}
- __pnpmCommand__={__pnpmCommand__}
- __bunCommand__={__bunCommand__}
- />
- );
- }
-
- return (
- <>
- <pre
- className={cn(
- "mb-4 mt-6 max-h-[650px] overflow-x-auto rounded-lg border bg-zinc-950 py-4 dark:bg-zinc-900",
- className,
- )}
- {...props}
- />
- {__rawString__ && __src__ && __event__ && (
- <CopyButton
- value={__rawString__}
- src={__src__}
- event={__event__}
- className={cn("absolute right-4 top-4", __withMeta__ && "top-16")}
- />
- )}
- </>
- );
- },
- code: ({ className, ...props }: React.HTMLAttributes<HTMLElement>) => (
- <code
- className={cn(
- "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm",
- className,
- )}
- {...props}
- />
- ),
- LinkedCard: ({ className, ...props }: React.ComponentProps<typeof Link>) => (
- <Link
- className={cn(
- "flex w-full flex-col items-center rounded-xl border bg-card p-6 text-card-foreground shadow transition-colors hover:bg-muted/50 sm:p-10",
- className,
- )}
- {...props}
- />
- ),
-};
-
-interface MDXProps {
- code: string;
- className?: string;
-}
-
-export function Mdx({ code, className }: MDXProps) {
- const Component = useMDXComponent(code);
-
- return (
- <article className={cn("mx-auto max-w-[120ch]", className)}>
- <Component components={components} />
- </article>
- );
-}
diff --git a/apps/www/components/mobile-nav.tsx b/apps/www/components/mobile-nav.tsx
index dd95f83b..49ae6baa 100644
--- a/apps/www/components/mobile-nav.tsx
+++ b/apps/www/components/mobile-nav.tsx
@@ -1,176 +1,161 @@
"use client";
-import Link, { LinkProps } from "next/link";
-import { usePathname, useRouter } from "next/navigation";
-import posthog from "posthog-js";
import * as React from "react";
+import Link, { LinkProps } from "next/link";
+import { useRouter } from "next/navigation";
-import { Icons } from "@/components/icons";
+import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
-import { ScrollArea } from "@/components/ui/scroll-area";
import {
- Sheet,
- SheetClose,
- SheetContent,
- SheetTrigger,
-} from "@/components/ui/sheet";
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
import { docsConfig } from "@/config/docs";
-import { siteConfig } from "@/config/site";
-import { cn } from "@/lib/utils";
-export function MobileNav() {
- const [isOpen, setIsOpen] = React.useState(false);
+export function MobileNav({ className }: { className?: string }) {
+ const [open, setOpen] = React.useState(false);
+
return (
- <Sheet open={isOpen} onOpenChange={setIsOpen}>
- <SheetTrigger asChild>
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
<Button
variant="ghost"
- className="mr-2 px-0 text-base hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 md:hidden"
- >
- <svg
- strokeWidth="1.5"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- className="size-5"
- >
- <path
- d="M3 5H11"
- stroke="currentColor"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- ></path>
- <path
- d="M3 12H16"
- stroke="currentColor"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- ></path>
- <path
- d="M3 19H21"
- stroke="currentColor"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- ></path>
- </svg>
- <span className="sr-only">Toggle Menu</span>
- </Button>
- </SheetTrigger>
- <SheetContent side="left" className="space-y-0 gap-0">
- <Link
- href="/"
- onClick={() => {
- setIsOpen(false);
- }}
- className="flex items-center h-16 px-4 border-b border-border"
+ className={cn(
+ "extend-touch-target h-8 touch-manipulation items-center justify-start gap-2.5 !p-0 hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 active:bg-transparent dark:hover:bg-transparent",
+ className,
+ )}
>
- <Icons.logo className="mr-2 size-4" />
- <span className="font-bold">{siteConfig.name}</span>
- </Link>
- <ScrollArea className="h-[calc(100vh-4rem)] p-4">
- <div className="flex flex-col space-y-1.5">
- {docsConfig.mainNav?.map(
- (item) =>
- item.href && (
- <MobileLink key={item.href} href={item.href}>
- {item.title}
- </MobileLink>
- ),
- )}
+ <div className="relative flex h-8 w-4 items-center justify-center">
+ <div className="relative size-4">
+ <span
+ className={cn(
+ "bg-foreground absolute left-0 block h-0.5 w-4 transition-all duration-100",
+ open ? "top-[0.4rem] -rotate-45" : "top-1",
+ )}
+ />
+ <span
+ className={cn(
+ "bg-foreground absolute left-0 block h-0.5 w-4 transition-all duration-100",
+ open ? "top-[0.4rem] rotate-45" : "top-2.5",
+ )}
+ />
+ </div>
+ <span className="sr-only">Toggle Menu</span>
</div>
- <div className="flex flex-col gap-y-2">
- {docsConfig.sidebarNav.map((item, index) => (
- <div key={index} className="flex flex-col gap-y-1.5 pt-6">
- <h4 className="font-medium">{item.title}</h4>
- {item.items?.map((item) =>
- !item.disabled && item.href ? (
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="bg-background/90 no-scrollbar h-(--radix-popper-available-height) w-(--radix-popper-available-width) overflow-y-auto rounded-none border-none p-0 shadow-none backdrop-blur duration-100"
+ align="start"
+ side="bottom"
+ alignOffset={-16}
+ sideOffset={14}
+ >
+ <div className="flex flex-col gap-12 overflow-auto px-6 py-6">
+ <div className="flex flex-col gap-4">
+ <div className="text-muted-foreground text-sm font-medium">
+ Menu
+ </div>
+ <div className="flex flex-col gap-3">
+ <MobileLink href="/" onOpenChange={setOpen}>
+ Home
+ </MobileLink>
+ {docsConfig.mainNav.map(
+ (item, index) =>
+ item.href && (
<MobileLink
- key={item.href}
+ key={index}
href={item.href}
- onClick={() => item.event && posthog.capture(item.event)}
- className={cn(
- "flex justify-between text-muted-foreground",
- item.disabled && "cursor-not-allowed opacity-60",
- )}
+ onOpenChange={setOpen}
>
- {item.title}
- <div>
+ <span className="flex items-center gap-2">
+ {item.title}
{item.label && (
- <span className="ml-2 rounded-md bg-[#FFBD7A] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
+ <span className="rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
{item.label}
</span>
)}
{item.paid && (
- <span className="ml-2 rounded-md bg-[#4ade80] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
+ <span className="rounded-md bg-gradient-to-r from-orange-400 to-orange-600 px-1.5 py-0.5 text-xs leading-none text-white no-underline group-hover:no-underline">
Pro
</span>
)}
- </div>
+ </span>
</MobileLink>
- ) : (
- <span
- key={index}
- className={cn(
- "text-muted-foreground",
- item.disabled && "cursor-not-allowed opacity-60",
- )}
- >
- {item.title}
- {item.label && (
- <span className="ml-2 rounded-md bg-muted px-1.5 py-0.5 text-xs leading-none text-muted-foreground no-underline group-hover:no-underline">
- {item.label}
- </span>
- )}
- </span>
),
- )}
- </div>
- ))}
+ )}
+ </div>
+ </div>
+ <div className="flex flex-col gap-8">
+ {docsConfig.sidebarNav.map((section, index) => {
+ return (
+ <div
+ key={`${section.title}-${index}`}
+ className="flex flex-col gap-4"
+ >
+ <div className="text-muted-foreground text-sm font-medium">
+ {section.title}
+ </div>
+ <div className="flex flex-col gap-3">
+ {section.items?.map(
+ (item) =>
+ item.href && (
+ <MobileLink
+ key={item.href}
+ href={item.href}
+ onOpenChange={setOpen}
+ >
+ <span className="flex items-center gap-2">
+ {item.title}
+ {item.label && (
+ <span className="rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
+ {item.label}
+ </span>
+ )}
+ {item.paid && (
+ <span className="rounded-md bg-gradient-to-r from-orange-400 to-orange-600 px-1.5 py-0.5 text-xs leading-none text-white no-underline group-hover:no-underline">
+ Pro
+ </span>
+ )}
+ </span>
+ </MobileLink>
+ ),
+ )}
+ </div>
+ </div>
+ );
+ })}
</div>
- </ScrollArea>
- </SheetContent>
- </Sheet>
+ </div>
+ </PopoverContent>
+ </Popover>
);
}
-interface MobileLinkProps extends LinkProps {
- onOpenChange?: (open: boolean) => void;
- children: React.ReactNode;
- className?: string;
-}
-
function MobileLink({
href,
onOpenChange,
className,
children,
...props
-}: MobileLinkProps) {
+}: LinkProps & {
+ onOpenChange?: (open: boolean) => void;
+ children: React.ReactNode;
+ className?: string;
+}) {
const router = useRouter();
- const pathname = usePathname();
- const isActive = pathname === href;
return (
- <SheetClose asChild>
- <Link
- href={href}
- onClick={() => {
- router.push(href.toString());
- onOpenChange?.(false);
- }}
- className={cn(
- className,
- "p-1 pl-2.5 text-[15px]",
- isActive
- ? "rounded-r-md border-l-2 border-primary/70 bg-secondary font-medium text-primary"
- : "",
- )}
- {...props}
- >
- {children}
- </Link>
- </SheetClose>
+ <Link
+ href={href}
+ onClick={() => {
+ router.push(href.toString());
+ onOpenChange?.(false);
+ }}
+ className={cn("text-2xl font-medium", className)}
+ {...props}
+ >
+ {children}
+ </Link>
);
}
diff --git a/apps/www/components/mode-toggle.tsx b/apps/www/components/mode-toggle.tsx
index 9621a13c..147e870c 100644
--- a/apps/www/components/mode-toggle.tsx
+++ b/apps/www/components/mode-toggle.tsx
@@ -1,33 +1,51 @@
"use client";
-import React from "react";
-import { MoonIcon, SunIcon } from "@radix-ui/react-icons";
+import * as React from "react";
import { useTheme } from "next-themes";
-import { cn } from "@/lib/utils";
+import { useMetaColor } from "@/hooks/use-meta-color";
import { Button } from "@/components/ui/button";
-export const ModeToggle = React.forwardRef<
- HTMLButtonElement,
- React.ComponentPropsWithoutRef<typeof Button> & { className?: string }
->(({ className, ...props }, ref) => {
- const { theme, setTheme } = useTheme();
+export function ModeToggle() {
+ const { setTheme, resolvedTheme } = useTheme();
+ const { setMetaColor, metaColor } = useMetaColor();
+
+ React.useEffect(() => {
+ setMetaColor(metaColor);
+ }, [metaColor, setMetaColor]);
+
+ const toggleTheme = React.useCallback(() => {
+ setTheme(resolvedTheme === "dark" ? "light" : "dark");
+ }, [resolvedTheme, setTheme]);
return (
<Button
- ref={ref}
variant="ghost"
- type="button"
size="icon"
- className={cn("px-2", className)}
- aria-label="Toggle theme"
- onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
- {...props}
+ className="group/toggle extend-touch-target size-8"
+ onClick={toggleTheme}
+ title="Toggle theme"
>
- <SunIcon className="size-[1.2rem] text-neutral-800 dark:hidden dark:text-neutral-200" />
- <MoonIcon className="hidden size-[1.2rem] text-neutral-800 dark:block dark:text-neutral-200" />
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className="size-4.5"
+ >
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" />
+ <path d="M12 3l0 18" />
+ <path d="M12 9l4.65 -4.65" />
+ <path d="M12 14.3l7.37 -7.37" />
+ <path d="M12 19.6l8.85 -8.85" />
+ </svg>
+ <span className="sr-only">Toggle theme</span>
</Button>
);
-});
-
-ModeToggle.displayName = "ModeToggle";
+}
diff --git a/apps/www/components/pager.tsx b/apps/www/components/pager.tsx
deleted file mode 100644
index c619cb9e..00000000
--- a/apps/www/components/pager.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { NavItem, NavItemWithChildren } from "@/types";
-import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons";
-import { Doc } from "content-collections";
-import Link from "next/link";
-
-import { buttonVariants } from "@/components/ui/button";
-import { docsConfig } from "@/config/docs";
-import { cn } from "@/lib/utils";
-
-interface DocsPagerProps {
- doc: Doc;
-}
-
-export function DocPager({ doc }: DocsPagerProps) {
- const pager = getPagerForDoc(doc);
-
- if (!pager) {
- return null;
- }
-
- return (
- <div className="flex flex-row items-center justify-between gap-4">
- {pager?.prev?.href && (
- <Link
- href={pager.prev.href}
- className={cn(buttonVariants({ variant: "outline" }), "min-w-0")}
- title={pager.prev.title}
- >
- <ChevronLeftIcon
- className="mr-2 size-4 shrink-0"
- aria-hidden="true"
- />
- <span className="truncate">{pager.prev.title}</span>
- </Link>
- )}
- {pager?.next?.href && (
- <Link
- href={pager.next.href}
- className={cn(
- buttonVariants({ variant: "outline" }),
- "ml-auto min-w-0 text-right",
- )}
- title={pager.next.title}
- >
- <span className="truncate">{pager.next.title}</span>
- <ChevronRightIcon
- className="ml-2 size-4 shrink-0"
- aria-hidden="true"
- />
- </Link>
- )}
- </div>
- );
-}
-
-export function getPagerForDoc(doc: Doc) {
- const flattenedLinks = [null, ...flatten(docsConfig.sidebarNav), null];
- const activeIndex = flattenedLinks.findIndex(
- (link) => doc.slug === link?.href,
- );
- const prev = activeIndex !== 0 ? flattenedLinks[activeIndex - 1] : null;
- const next =
- activeIndex !== flattenedLinks.length - 1
- ? flattenedLinks[activeIndex + 1]
- : null;
- return {
- prev,
- next,
- };
-}
-
-export function flatten(links: NavItemWithChildren[]): NavItem[] {
- return links
- .reduce<NavItem[]>((flat, link) => {
- return flat.concat(link.items?.length ? flatten(link.items) : link);
- }, [])
- .filter((link) => !link?.disabled);
-}
diff --git a/apps/www/components/ping-dot.tsx b/apps/www/components/ping-dot.tsx
new file mode 100644
index 00000000..a8eecc05
--- /dev/null
+++ b/apps/www/components/ping-dot.tsx
@@ -0,0 +1,8 @@
+export function PingDot() {
+ return (
+ <div className="relative inline-flex">
+ <span className="absolute size-2 animate-ping rounded-full bg-green-500 opacity-75"></span>
+ <span className="relative inline-flex size-2 rounded-full bg-green-500"></span>
+ </div>
+ );
+}
diff --git a/apps/www/components/sections/component-demos.tsx b/apps/www/components/sections/component-demos.tsx
index 7e7b3a7c..23891093 100644
--- a/apps/www/components/sections/component-demos.tsx
+++ b/apps/www/components/sections/component-demos.tsx
@@ -1,17 +1,20 @@
-import { Mdx } from "@/components/mdx-components";
-
-import { allPages } from "content-collections";
+import { source } from "@/lib/source";
+import { mdxComponents } from "@/mdx-components";
import { notFound } from "next/navigation";
const PAGE = "home";
export function ComponentDemos() {
- const page = allPages.find((page) => page.slugAsParams === PAGE);
+ const pages = source.getPages();
+ const page = pages.find((page) => page.url === PAGE);
if (!page) {
notFound();
}
+ // @ts-expect-error - revisit fumadocs types.
+ const MDX = page.data.body;
+
return (
<section id="component-demos" className="container max-w-5xl py-14">
<h2 className="mb-2 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">
@@ -21,7 +24,7 @@ export function ComponentDemos() {
Here are some of the components that you can use to build your landing
pages.
</h3>
- <Mdx code={page.body.code} />
+ <MDX components={mdxComponents} />
</section>
);
}
diff --git a/apps/www/components/sections/hero.tsx b/apps/www/components/sections/hero.tsx
index c200907e..6ea4d7a8 100644
--- a/apps/www/components/sections/hero.tsx
+++ b/apps/www/components/sections/hero.tsx
@@ -1,25 +1,25 @@
-import { allDocs } from "content-collections";
-import { compareDesc } from "date-fns";
+import { source } from "@/lib/source";
import { ChevronRight } from "lucide-react";
import Link from "next/link";
-
-import TechStack from "@/components/tech-stack";
+import { TechStack } from "@/components/tech-stack";
import { buttonVariants } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils";
-export async function Hero() {
- const post = allDocs
- .filter(
- (post) =>
- post.date && post.date <= new Date().toISOString() && post.published,
- )
- .sort((a, b) => {
- if (!a.date && !b.date) return 0; // Both dates are undefined, keep original order
- if (!a.date) return 1; // Move a to the end if date is undefined
- if (!b.date) return -1; // Move b to the end if date is undefined
- return compareDesc(new Date(a.date), new Date(b.date)); // Both dates are defined, proceed with comparison
- })[0];
+export function Hero() {
+ const pages = source.getPages() as Array<{
+ data?: { title?: string; date?: string };
+ url?: string;
+ }>;
+ const page = pages.sort((a, b) => {
+ const dateA = a?.data?.date;
+ const dateB = b?.data?.date;
+ if (!dateA && !dateB) return 0;
+ if (!dateA) return 1;
+ if (!dateB) return -1;
+ return new Date(dateB).getTime() - new Date(dateA).getTime();
+ })[0];
+ const pageTitle = page?.data?.title;
return (
<section id="hero">
@@ -28,7 +28,7 @@ export async function Hero() {
<div className="mt-10 grid grid-cols-1 md:mt-20">
<div className="flex flex-col items-start gap-6 px-7 pb-8 text-center md:items-center md:px-10">
<Link
- href={post.slug}
+ href={page?.url ?? ""}
className={cn(
buttonVariants({
variant: "outline",
@@ -38,7 +38,7 @@ export async function Hero() {
)}
>
🎉 <Separator className="mx-2 h-4" orientation="vertical" />
- Introducing {post.title}
+ Introducing {pageTitle}
<ChevronRight className="ml-1 size-4 text-muted-foreground" />
</Link>
<div className="relative flex flex-col gap-4 md:items-center lg:flex-row">
diff --git a/apps/www/components/sections/showcase.tsx b/apps/www/components/sections/showcase.tsx
index e5fda8cd..02cf68bb 100644
--- a/apps/www/components/sections/showcase.tsx
+++ b/apps/www/components/sections/showcase.tsx
@@ -1,5 +1,5 @@
import { ChevronRightIcon } from "@radix-ui/react-icons";
-import { allShowcases } from "content-collections";
+import { showcaseSource } from "@/lib/source";
import Link from "next/link";
import { Marquee } from "@/registry/magicui/marquee";
@@ -41,6 +41,7 @@ export function ShowcaseCard({
}
export function Showcase() {
+ const showcases = showcaseSource.getPages();
return (
<section id="showcase" className="container py-14">
<h2 className="mb-2 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">
@@ -51,10 +52,20 @@ export function Showcase() {
</h3>
<div className="relative flex flex-col">
<Marquee className="max-w-screen [--duration:40s]">
- {allShowcases
- .filter((showcase) => showcase.featured)
+ {showcases
+ // @ts-expect-error - revisit fumadocs types.
+ .filter((showcase) => showcase.data.featured)
.map((showcase, idx) => (
- <ShowcaseCard key={idx} {...showcase} href={showcase.slug} />
+ <ShowcaseCard
+ key={idx}
+ {...showcase}
+ href={showcase.url}
+ title={showcase.data.title ?? ""}
+ // @ts-expect-error - revisit fumadocs types.
+ affiliation={showcase.data.affiliation ?? ""}
+ // @ts-expect-error - revisit fumadocs types.
+ image={showcase.data.image ?? ""}
+ />
))}
</Marquee>
<div className="pointer-events-none absolute inset-y-0 left-0 h-full w-1/12 bg-gradient-to-r from-background"></div>
diff --git a/apps/www/components/sidebar-cta.tsx b/apps/www/components/sidebar-cta.tsx
index 78b80b8d..2fc6265c 100644
--- a/apps/www/components/sidebar-cta.tsx
+++ b/apps/www/components/sidebar-cta.tsx
@@ -2,27 +2,99 @@
import { ChevronRight } from "lucide-react";
import Link from "next/link";
-import posthog from "posthog-js";
import { AnimatedShinyText } from "@/registry/magicui/animated-shiny-text";
import { TextAnimate } from "@/registry/magicui/text-animate";
+import { Button } from "@/components/ui/button";
+import { AuroraText } from "@/registry/magicui/aurora-text";
+import { LineShadowText } from "@/registry/magicui/line-shadow-text";
+import { trackEvent } from "@/lib/events";
+import posthog from "posthog-js";
+import { PingDot } from "@/components/ping-dot";
export function ProCTA() {
return (
- <Link
- href="https://pro.magicui.design"
- target="_blank"
- onClick={() => posthog.capture("sidebar_cta_clicked")}
- className="group my-20 flex w-full flex-col items-center justify-center gap-2 rounded-xl bg-indigo-600 p-4 text-center text-lg font-medium leading-tight text-white"
- >
- <TextAnimate animate="slideUp" by="word" className="text-4xl">
- Looking for templates?
- </TextAnimate>
- <AnimatedShinyText className="group inline-flex items-center justify-center whitespace-pre via-white/80 text-white dark:text-white">
- ✨ Introducing Magic UI Pro
- <ChevronRight className="ml-1 size-4 transition-all duration-300 ease-out group-hover:translate-x-1" />
- </AnimatedShinyText>
- </Link>
+ <div className="my-6 flex w-full flex-col gap-4 rounded-xl border border-border p-6">
+ <div className="flex items-center gap-2">
+ <PingDot />
+ <span className="text-xs font-semibold uppercase tracking-wider text-emerald-600">
+ Limited Time Offer
+ </span>
+ </div>
+
+ <div className="space-y-3">
+ <p className="text-3xl font-bold leading-tight text-foreground">
+ Ship{" "}
+ <LineShadowText className="italic tracking-tighter font-bold">
+ Faster
+ </LineShadowText>{" "}
+ with <AuroraText>Magic UI Pro</AuroraText>
+ </p>
+ <p className="text-sm leading-relaxed text-muted-foreground">
+ Stop building from scratch. <br /> Get{" "}
+ <span className="font-semibold text-foreground">
+ 8 production-ready templates
+ </span>{" "}
+ and{" "}
+ <span className="font-semibold text-foreground">
+ 50+ premium components
+ </span>{" "}
+ that your users will love.
+ </p>
+ </div>
+
+ <div className="space-y-2.5">
+ <div className="flex items-center gap-3 text-sm text-muted-foreground">
+ <div className="flex h-5 w-5 items-center justify-center rounded-full bg-emerald-100">
+ <span className="text-xs font-bold text-emerald-600">✓</span>
+ </div>
+ <span>Next.js 15 + TypeScript ready</span>
+ </div>
+ <div className="flex items-center gap-3 text-sm text-muted-foreground">
+ <div className="flex h-5 w-5 items-center justify-center rounded-full bg-emerald-100">
+ <span className="text-xs font-bold text-emerald-600">✓</span>
+ </div>
+ <span>Copy, paste, customize in minutes</span>
+ </div>
+ <div className="flex items-center gap-3 text-sm text-muted-foreground">
+ <div className="flex h-5 w-5 items-center justify-center rounded-full bg-emerald-100">
+ <span className="text-xs font-bold text-emerald-600">✓</span>
+ </div>
+ <span>Save 100+ hours of development</span>
+ </div>
+ </div>
+
+ <div className="space-y-4 pt-2">
+ <div className="flex items-baseline justify-center gap-2">
+ <span className="text-3xl font-bold text-foreground">$199</span>
+ <span className="text-sm font-medium text-muted-foreground">
+ once
+ </span>
+ </div>
+
+ <Button
+ asChild
+ className="w-full bg-primary hover:bg-primary/90 text-primary-foreground font-semibold py-3 rounded-lg shadow-sm hover:shadow-md transition-all duration-200"
+ onClick={() => trackEvent({ name: "sidebar_cta_clicked" })}
+ >
+ <Link
+ href="https://pro.magicui.design"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center justify-center gap-2"
+ >
+ Get Instant Access
+ <ChevronRight className="size-4" />
+ </Link>
+ </Button>
+
+ <div className="text-center">
+ <p className="text-xs text-muted-foreground">
+ Trusted by <span className="font-semibold">5,000+</span> developers
+ </p>
+ </div>
+ </div>
+ </div>
);
}
@@ -54,5 +126,5 @@ export function ProductHuntCTA() {
}
export function SidebarCTA() {
- return null;
+ return <ProCTA />;
}
diff --git a/apps/www/components/sidebar-nav.tsx b/apps/www/components/sidebar-nav.tsx
deleted file mode 100644
index ec3c90ae..00000000
--- a/apps/www/components/sidebar-nav.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-"use client";
-
-import { SidebarNavItem } from "@/types";
-import { ExternalLinkIcon } from "@radix-ui/react-icons";
-import Link from "next/link";
-import { usePathname } from "next/navigation";
-import posthog from "posthog-js";
-
-import { cn } from "@/lib/utils";
-
-export interface DocsSidebarNavProps {
- items: SidebarNavItem[];
-}
-
-export function DocsSidebarNav({ items }: DocsSidebarNavProps) {
- const pathname = usePathname();
-
- return items.length ? (
- <div className="flex flex-col gap-6">
- {items.map((item, index) => (
- <div key={index} className="flex flex-col gap-1">
- <h4 className="rounded-md px-2 py-1 text-sm font-semibold">
- {item.title}{" "}
- {item.label && (
- <span className="ml-2 rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs font-normal leading-none text-[#000000] no-underline group-hover:no-underline">
- {item.label}
- </span>
- )}
- </h4>
- {item?.items?.length && (
- <DocsSidebarNavItems items={item.items} pathname={pathname} />
- )}
- </div>
- ))}
- </div>
- ) : null;
-}
-
-interface DocsSidebarNavItemsProps {
- items: SidebarNavItem[];
- pathname: string | null;
-}
-
-export function DocsSidebarNavItems({
- items,
- pathname,
-}: DocsSidebarNavItemsProps) {
- return items?.length ? (
- <div className="relative grid grid-flow-row auto-rows-max gap-0.5 text-sm">
- {items.map((item, index) =>
- item.href && !item.disabled ? (
- <Link
- key={index}
- href={item.href}
- onClick={() => item.event && posthog.capture(item.event)}
- className={cn(
- "group relative flex h-8 w-full items-center justify-between rounded-lg px-2 font-normal text-foreground",
- "transition-transform duration-200 hover:translate-x-px hover:text-accent-foreground",
- item.disabled && "cursor-not-allowed opacity-60",
- pathname === item.href &&
- "bg-accent font-medium text-accent-foreground",
- )}
- target={item.external ? "_blank" : ""}
- rel={item.external ? "noreferrer" : ""}
- >
- <span className="relative shrink-0">{item.title}</span>
- <div>
- {item.label && (
- <span className="ml-2 rounded-md bg-[#FFBD7A] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline">
- {item.label}
- </span>
- )}
- {item.paid && (
- <span className="ml-2 rounded-md bg-[#4ade80] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline">
- Pro
- </span>
- )}
- {item.external && <ExternalLinkIcon className="ml-2 size-4" />}
- </div>
- </Link>
- ) : (
- <span
- key={index}
- className={cn(
- "flex w-full cursor-not-allowed items-center rounded-md p-2 text-muted-foreground",
- item.disabled && "cursor-not-allowed opacity-60",
- )}
- >
- {item.title}
- {item.label && (
- <span className="ml-2 rounded-md bg-muted px-1.5 py-0.5 text-xs leading-none text-muted-foreground no-underline group-hover:no-underline">
- {item.label}
- </span>
- )}
- {item.paid && (
- <span className="ml-2 rounded-md bg-[#4ade80] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
- Pro
- </span>
- )}
- </span>
- ),
- )}
- </div>
- ) : null;
-}
diff --git a/apps/www/components/site-footer.tsx b/apps/www/components/site-footer.tsx
index bd834d4d..6a10556c 100644
--- a/apps/www/components/site-footer.tsx
+++ b/apps/www/components/site-footer.tsx
@@ -2,21 +2,31 @@ import { siteConfig } from "@/config/site";
export function SiteFooter() {
return (
- <footer className="relative border-t border-border py-6 md:py-0">
- <div className="container flex flex-col items-center justify-between gap-4 md:h-16 md:flex-row">
- <p className="text-center text-sm leading-loose text-muted-foreground md:text-left">
- Brought to you by{" "}
- <a
- href={siteConfig.links.twitter}
- title="Twitter"
- target="_blank"
- rel="noreferrer"
- className="font-medium underline underline-offset-4"
- >
- dillion
- </a>
- .
- </p>
+ <footer className="group-has-[.section-soft]/body:bg-surface/40 3xl:fixed:bg-transparent group-has-[.docs-nav]/body:pb-20 group-has-[.docs-nav]/body:sm:pb-0 dark:bg-transparent">
+ <div className="container-wrapper px-4 xl:px-6">
+ <div className="flex h-(--footer-height) items-center justify-between">
+ <div className="text-muted-foreground w-full px-1 text-center text-xs leading-loose sm:text-sm">
+ Built by{" "}
+ <a
+ href={siteConfig.links.twitter}
+ target="_blank"
+ rel="noreferrer"
+ className="font-medium underline underline-offset-4"
+ >
+ dillion
+ </a>
+ . The source code is available on{" "}
+ <a
+ href={siteConfig.links.github}
+ target="_blank"
+ rel="noreferrer"
+ className="font-medium underline underline-offset-4"
+ >
+ GitHub
+ </a>
+ .
+ </div>
+ </div>
</div>
</footer>
);
diff --git a/apps/www/components/site-header.tsx b/apps/www/components/site-header.tsx
index 3049b0e2..e6ec0692 100644
--- a/apps/www/components/site-header.tsx
+++ b/apps/www/components/site-header.tsx
@@ -1,137 +1,42 @@
-import { StarIcon } from "@heroicons/react/24/solid";
-import Link from "next/link";
-
-import { CommandMenu } from "@/components/command-menu";
-import { Icons } from "@/components/icons";
import { MainNav } from "@/components/main-nav";
import { MobileNav } from "@/components/mobile-nav";
+import { Separator } from "@/components/ui/separator";
+import { source } from "@/lib/source";
+import { VersionSelect } from "@/components/version-select";
+import { GitHubLink } from "@/components/github-link";
import { ModeToggle } from "@/components/mode-toggle";
-import { buttonVariants } from "@/components/ui/button";
-import { siteConfig } from "@/config/site";
-import { cn } from "@/lib/utils";
-import { NumberTicker } from "@/registry/magicui/number-ticker";
+import { LogoButton } from "@/components/logo-button";
+import { DiscordLink } from "@/components/discord-link";
+import { docsConfig } from "@/config/docs";
+import { CommandMenu } from "@/components/command-menu";
export async function SiteHeader() {
- let stars = 300; // Default value
-
- try {
- const response = await fetch(
- "https://api.github.com/repos/magicuidesign/magicui",
- {
- headers: process.env.GITHUB_OAUTH_TOKEN
- ? {
- Authorization: `Bearer ${process.env.GITHUB_OAUTH_TOKEN}`,
- "Content-Type": "application/json",
- }
- : {},
- next: {
- revalidate: 3600,
- },
- },
- );
-
- if (response.ok) {
- const data = await response.json();
- stars = data.stargazers_count || stars; // Update stars if API response is valid
- }
- } catch (error) {
- console.error("Error fetching GitHub stars:", error);
- }
-
return (
- <header
- className={cn(
- "supports-backdrop-blur:bg-background/90 sticky top-0 z-40 w-full border-b border-border bg-background/40 backdrop-blur-lg",
- )}
- >
- <div className="container flex h-16 items-center">
- <MainNav />
- <MobileNav />
- <div className="flex flex-1 items-center justify-between gap-2 md:justify-end">
- <Link
- className={cn(
- buttonVariants({
- variant: "rainbow",
- }),
- "hidden md:inline-flex",
- )}
- target="_blank"
- href={siteConfig.links.github}
- >
- <div className="flex items-center">
- <Icons.gitHub className="size-4" />
- <span className="ml-1 lg:hidden">Star</span>
- <span className="ml-1 hidden lg:inline">Star on GitHub</span>{" "}
- </div>
- <div className="ml-2 flex items-center gap-1 text-sm md:flex">
- <StarIcon className="size-4 text-gray-500 transition-all duration-300 group-hover:text-yellow-300" />
- <NumberTicker
- value={stars}
- className="font-display font-medium text-white dark:text-black"
+ <header className="bg-background sticky top-0 z-50 w-full">
+ <div className="container-wrapper 3xl:fixed:px-0 px-6">
+ <div className="3xl:fixed:container flex h-(--header-height) items-center gap-2 **:data-[slot=separator]:!h-4">
+ <MobileNav className="flex lg:hidden" />
+ <LogoButton />
+ <VersionSelect className="hidden lg:flex" />
+ <MainNav items={docsConfig.mainNav} className="hidden lg:flex" />
+ <div className="flex flex-1 items-center justify-between gap-2 md:justify-end">
+ <div className="ml-auto flex items-center gap-2 md:flex-1 md:justify-end">
+ <div className="hidden w-full flex-1 md:flex md:w-auto md:flex-none">
+ <CommandMenu />
+ </div>
+ <Separator
+ orientation="vertical"
+ className="ml-2 hidden lg:block"
/>
+ <GitHubLink />
+ <Separator orientation="vertical" className="3xl:flex hidden" />
+ <DiscordLink />
+ <Separator orientation="vertical" />
+ <ModeToggle />
</div>
- </Link>
-
- <div className="w-full flex-1 md:w-auto md:flex-none">
- <CommandMenu />
</div>
- <nav className="flex items-center gap-1">
- <Link
- href={siteConfig.links.discord}
- target="_blank"
- rel="noreferrer"
- >
- <div
- className={cn(
- buttonVariants({
- variant: "ghost",
- }),
- "w-9 px-0",
- )}
- >
- <Icons.discord className="size-4" />
- <span className="sr-only">Discord</span>
- </div>
- </Link>
- <Link
- href={siteConfig.links.github}
- target="_blank"
- rel="noreferrer"
- >
- <div
- className={cn(
- buttonVariants({
- variant: "ghost",
- }),
- "w-9 px-0",
- )}
- >
- <Icons.gitHub className="size-4" />
- <span className="sr-only">GitHub</span>
- </div>
- </Link>
- <Link
- href={siteConfig.links.twitter}
- target="_blank"
- rel="noreferrer"
- >
- <div
- className={cn(
- buttonVariants({
- variant: "ghost",
- }),
- "w-9 px-0",
- )}
- >
- <Icons.twitter className="size-4 fill-current" />
- <span className="sr-only">Twitter</span>
- </div>
- </Link>
- <ModeToggle />
- </nav>
</div>
</div>
- {/* <hr className="m-0 h-px w-full border-none bg-gradient-to-r from-neutral-200/0 via-neutral-200/30 to-neutral-200/0" /> */}
</header>
);
}
diff --git a/apps/www/components/tech-stack.tsx b/apps/www/components/tech-stack.tsx
index cdfa68e9..76a285a6 100644
--- a/apps/www/components/tech-stack.tsx
+++ b/apps/www/components/tech-stack.tsx
@@ -136,7 +136,7 @@ const techComponents: TechComponents = {
},
};
-export default function TechStack({
+export function TechStack({
technologies,
className,
}: {
diff --git a/apps/www/components/template-open.tsx b/apps/www/components/template-open.tsx
index aeced8f9..97accf39 100644
--- a/apps/www/components/template-open.tsx
+++ b/apps/www/components/template-open.tsx
@@ -32,7 +32,7 @@ export function TemplateOpen({ url, free = false }: TemplateOpenProps) {
return (
<Link
- href="https://pro.magicui.design/#pricing"
+ href="https://pro.magicui.design/"
target="_blank"
className={cn(
buttonVariants({
diff --git a/apps/www/components/template-preview.tsx b/apps/www/components/template-preview.tsx
index 792cd328..853cbfe4 100644
--- a/apps/www/components/template-preview.tsx
+++ b/apps/www/components/template-preview.tsx
@@ -5,7 +5,7 @@ import { ExternalLinkIcon } from "@radix-ui/react-icons";
import { cn } from "@/lib/utils";
import { buttonVariants } from "@/components/ui/button";
-export default function TemplatePreview({
+export function TemplatePreview({
href,
children,
}: {
diff --git a/apps/www/components/toc.tsx b/apps/www/components/toc.tsx
deleted file mode 100644
index fd7be2ed..00000000
--- a/apps/www/components/toc.tsx
+++ /dev/null
@@ -1,123 +0,0 @@
-"use client";
-
-import { useEffect, useMemo, useState } from "react";
-
-import { useMounted } from "@/hooks/use-mounted";
-import type { TableOfContents } from "@/lib/toc";
-import { cn } from "@/lib/utils";
-
-interface TocProps {
- toc: TableOfContents;
-}
-
-export function TableOfContents({ toc }: TocProps) {
- const refinedToc = useMemo(() => {
- if (!toc.items || toc.items.length === 0) {
- return toc;
- }
-
- const [linksInSteps, ...rest] = toc.items;
-
- if (linksInSteps.items && linksInSteps.items.length > 0) {
- return {
- items: [...linksInSteps.items, ...rest],
- };
- }
-
- return toc;
- }, [toc]);
-
- const itemIds: string[] = useMemo(
- () =>
- refinedToc.items
- ? refinedToc.items
- .flatMap((item) => [item.url, item?.items?.map((item) => item.url)])
- .flat()
- .filter(Boolean)
- .map((id) => id?.split("#")[1])
- : [],
- [refinedToc],
- ) as string[];
-
- const activeHeading = useActiveItem(itemIds);
- const mounted = useMounted();
-
- if (!toc?.items || !mounted) {
- return null;
- }
-
- return (
- <div className="space-y-2">
- <p className="font-medium">On This Page</p>
- <Tree tree={refinedToc} activeItem={activeHeading} />
- </div>
- );
-}
-
-function useActiveItem(itemIds: string[]): string | null {
- const [activeId, setActiveId] = useState<string | null>(null);
-
- useEffect(() => {
- const observer = new IntersectionObserver(
- (entries) => {
- entries.forEach((entry) => {
- if (entry.isIntersecting) {
- setActiveId(entry.target.id);
- }
- });
- },
- { rootMargin: `0% 0% -80% 0%` },
- );
-
- itemIds?.forEach((id) => {
- const element = document.getElementById(id);
- if (element) {
- observer.observe(element);
- }
- });
-
- return () => {
- itemIds?.forEach((id) => {
- const element = document.getElementById(id);
- if (element) {
- observer.unobserve(element);
- }
- });
- };
- }, [itemIds]);
-
- return activeId;
-}
-
-interface TreeProps {
- tree: TableOfContents;
- level?: number;
- activeItem?: string | null;
-}
-
-function Tree({ tree, level = 1, activeItem }: TreeProps) {
- return tree?.items?.length && level < 3 ? (
- <ul className={cn("m-0 list-none", { "pl-4": level !== 1 })}>
- {tree.items.map((item, index) => {
- return (
- <li key={index} className={cn("mt-0 pt-2")}>
- <a
- href={item.url}
- className={cn(
- "inline-block no-underline transition-colors hover:text-foreground",
- item.url === `#${activeItem}`
- ? "font-medium text-foreground"
- : "text-muted-foreground",
- )}
- >
- {item.title}
- </a>
- {item.items?.length ? (
- <Tree tree={item} level={level + 1} activeItem={activeItem} />
- ) : null}
- </li>
- );
- })}
- </ul>
- ) : null;
-}
diff --git a/apps/www/components/ui/button.tsx b/apps/www/components/ui/button.tsx
index 71b8142d..a54af151 100644
--- a/apps/www/components/ui/button.tsx
+++ b/apps/www/components/ui/button.tsx
@@ -10,14 +10,15 @@ const buttonVariants = cva(
variants: {
variant: {
default:
- "bg-primary text-primary-foreground shadow hover:bg-primary/90",
+ "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
destructive:
- "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
+ "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
- "border border-input bg-background text-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
- "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
- ghost: "hover:bg-accent hover:text-accent-foreground",
+ "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
+ ghost:
+ "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
rainbow:
"group relative animate-rainbow cursor-pointer border-0 bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] bg-[length:200%] text-primary-foreground [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] before:[filter:blur(calc(0.8*1rem))] dark:bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))]",
@@ -25,9 +26,9 @@ const buttonVariants = cva(
"group relative animate-rainbow cursor-pointer border-0 border-input bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] bg-[length:200%] px-4 text-foreground shadow-sm [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] before:[filter:blur(calc(0.8*1rem))] dark:bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))]",
},
size: {
- default: "h-9 px-4 py-2",
- sm: "h-8 rounded-xl px-3 text-xs",
- lg: "h-11 rounded-xl px-8",
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
},
},
@@ -38,26 +39,25 @@ const buttonVariants = cva(
},
);
-export interface ButtonProps
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
- VariantProps<typeof buttonVariants> {
- asChild?: boolean;
-}
-
-const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
- ({ className, variant, size, asChild = false, ...props }, ref) => {
- const Comp = asChild ? Slot : "button";
+function Button({
+ className,
+ variant,
+ size,
+ asChild = false,
+ ...props
+}: React.ComponentProps<"button"> &
+ VariantProps<typeof buttonVariants> & {
+ asChild?: boolean;
+ }) {
+ const Comp = asChild ? Slot : "button";
- return (
- <Comp
- data-slot="button"
- className={cn(buttonVariants({ variant, size, className }))}
- ref={ref}
- {...props}
- />
- );
- },
-);
-Button.displayName = "Button";
+ return (
+ <Comp
+ data-slot="button"
+ className={cn(buttonVariants({ variant, size, className }))}
+ {...props}
+ />
+ );
+}
export { Button, buttonVariants };
diff --git a/apps/www/components/ui/dialog.tsx b/apps/www/components/ui/dialog.tsx
index 7d7783fb..ac2b9bb5 100644
--- a/apps/www/components/ui/dialog.tsx
+++ b/apps/www/components/ui/dialog.tsx
@@ -2,134 +2,121 @@
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
-import { XIcon } from "lucide-react";
+import { X } from "lucide-react";
import { cn } from "@/lib/utils";
-function Dialog({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Root>) {
- return <DialogPrimitive.Root data-slot="dialog" {...props} />;
-}
+const Dialog = DialogPrimitive.Root;
-function DialogTrigger({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
-}
+const DialogTrigger = DialogPrimitive.Trigger;
-function DialogPortal({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
-}
+const DialogPortal = DialogPrimitive.Portal;
-function DialogClose({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Close>) {
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
-}
+const DialogClose = DialogPrimitive.Close;
-function DialogOverlay({
- className,
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
- return (
- <DialogPrimitive.Overlay
- data-slot="dialog-overlay"
- className={cn(
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DialogContent({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Content>) {
- return (
- <DialogPortal data-slot="dialog-portal">
- <DialogOverlay />
- <DialogPrimitive.Content
- data-slot="dialog-content"
- className={cn(
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
- className,
- )}
- {...props}
- >
- {children}
- <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
- <XIcon />
- <span className="sr-only">Close</span>
- </DialogPrimitive.Close>
- </DialogPrimitive.Content>
- </DialogPortal>
- );
-}
-
-function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="dialog-header"
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
- {...props}
- />
- );
-}
+const DialogOverlay = React.forwardRef<
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
+>(({ className, ...props }, ref) => (
+ <DialogPrimitive.Overlay
+ ref={ref}
+ className={cn(
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
+ className,
+ )}
+ {...props}
+ />
+));
+DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
-function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="dialog-footer"
+const DialogContent = React.forwardRef<
+ React.ElementRef<typeof DialogPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
+>(({ className, children, ...props }, ref) => (
+ <DialogPortal>
+ <DialogOverlay />
+ <DialogPrimitive.Content
+ ref={ref}
className={cn(
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className,
)}
{...props}
- />
- );
-}
+ >
+ {children}
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
+ <X className="h-4 w-4" />
+ <span className="sr-only">Close</span>
+ </DialogPrimitive.Close>
+ </DialogPrimitive.Content>
+ </DialogPortal>
+));
+DialogContent.displayName = DialogPrimitive.Content.displayName;
-function DialogTitle({
+const DialogHeader = ({
className,
...props
-}: React.ComponentProps<typeof DialogPrimitive.Title>) {
- return (
- <DialogPrimitive.Title
- data-slot="dialog-title"
- className={cn("text-lg leading-none font-semibold", className)}
- {...props}
- />
- );
-}
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn(
+ "flex flex-col space-y-1.5 text-center sm:text-left",
+ className,
+ )}
+ {...props}
+ />
+);
+DialogHeader.displayName = "DialogHeader";
-function DialogDescription({
+const DialogFooter = ({
className,
...props
-}: React.ComponentProps<typeof DialogPrimitive.Description>) {
- return (
- <DialogPrimitive.Description
- data-slot="dialog-description"
- className={cn("text-muted-foreground text-sm", className)}
- {...props}
- />
- );
-}
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn(
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
+ className,
+ )}
+ {...props}
+ />
+);
+DialogFooter.displayName = "DialogFooter";
+
+const DialogTitle = React.forwardRef<
+ React.ElementRef<typeof DialogPrimitive.Title>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
+>(({ className, ...props }, ref) => (
+ <DialogPrimitive.Title
+ ref={ref}
+ className={cn(
+ "text-lg font-semibold leading-none tracking-tight",
+ className,
+ )}
+ {...props}
+ />
+));
+DialogTitle.displayName = DialogPrimitive.Title.displayName;
+
+const DialogDescription = React.forwardRef<
+ React.ElementRef<typeof DialogPrimitive.Description>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
+>(({ className, ...props }, ref) => (
+ <DialogPrimitive.Description
+ ref={ref}
+ className={cn("text-sm text-muted-foreground", className)}
+ {...props}
+ />
+));
+DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
Dialog,
+ DialogPortal,
+ DialogOverlay,
+ DialogTrigger,
DialogClose,
DialogContent,
- DialogDescription,
- DialogFooter,
DialogHeader,
- DialogOverlay,
- DialogPortal,
+ DialogFooter,
DialogTitle,
- DialogTrigger,
+ DialogDescription,
};
diff --git a/apps/www/components/ui/dropdown-menu.tsx b/apps/www/components/ui/dropdown-menu.tsx
index 1fc1f4ee..78a751e0 100644
--- a/apps/www/components/ui/dropdown-menu.tsx
+++ b/apps/www/components/ui/dropdown-menu.tsx
@@ -2,256 +2,200 @@
import * as React from "react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
-import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
+import { Check, ChevronRight, Circle } from "lucide-react";
import { cn } from "@/lib/utils";
-function DropdownMenu({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
-}
-
-function DropdownMenuPortal({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
- return (
- <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
- );
-}
-
-function DropdownMenuTrigger({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
- return (
- <DropdownMenuPrimitive.Trigger
- data-slot="dropdown-menu-trigger"
- {...props}
- />
- );
-}
-
-function DropdownMenuContent({
- className,
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
- return (
- <DropdownMenuPrimitive.Portal>
- <DropdownMenuPrimitive.Content
- data-slot="dropdown-menu-content"
- sideOffset={sideOffset}
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
- className,
- )}
- {...props}
- />
- </DropdownMenuPrimitive.Portal>
- );
-}
-
-function DropdownMenuGroup({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
- return (
- <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
- );
-}
-
-function DropdownMenuItem({
- className,
- inset,
- variant = "default",
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
- inset?: boolean;
- variant?: "default" | "destructive";
-}) {
- return (
- <DropdownMenuPrimitive.Item
- data-slot="dropdown-menu-item"
- data-inset={inset}
- data-variant={variant}
- className={cn(
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DropdownMenuCheckboxItem({
- className,
- children,
- checked,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
- return (
- <DropdownMenuPrimitive.CheckboxItem
- data-slot="dropdown-menu-checkbox-item"
- className={cn(
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- checked={checked}
- {...props}
- >
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <CheckIcon className="size-4" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.CheckboxItem>
- );
-}
-
-function DropdownMenuRadioGroup({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
- return (
- <DropdownMenuPrimitive.RadioGroup
- data-slot="dropdown-menu-radio-group"
- {...props}
- />
- );
-}
-
-function DropdownMenuRadioItem({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
- return (
- <DropdownMenuPrimitive.RadioItem
- data-slot="dropdown-menu-radio-item"
- className={cn(
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <CircleIcon className="size-2 fill-current" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.RadioItem>
- );
-}
-
-function DropdownMenuLabel({
- className,
- inset,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
- inset?: boolean;
-}) {
- return (
- <DropdownMenuPrimitive.Label
- data-slot="dropdown-menu-label"
- data-inset={inset}
+const DropdownMenu = DropdownMenuPrimitive.Root;
+
+const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
+
+const DropdownMenuGroup = DropdownMenuPrimitive.Group;
+
+const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
+
+const DropdownMenuSub = DropdownMenuPrimitive.Sub;
+
+const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
+
+const DropdownMenuSubTrigger = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
+ inset?: boolean;
+ }
+>(({ className, inset, children, ...props }, ref) => (
+ <DropdownMenuPrimitive.SubTrigger
+ ref={ref}
+ className={cn(
+ "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
+ inset && "pl-8",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronRight className="ml-auto" />
+ </DropdownMenuPrimitive.SubTrigger>
+));
+DropdownMenuSubTrigger.displayName =
+ DropdownMenuPrimitive.SubTrigger.displayName;
+
+const DropdownMenuSubContent = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
+>(({ className, ...props }, ref) => (
+ <DropdownMenuPrimitive.SubContent
+ ref={ref}
+ className={cn(
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
+ className,
+ )}
+ {...props}
+ />
+));
+DropdownMenuSubContent.displayName =
+ DropdownMenuPrimitive.SubContent.displayName;
+
+const DropdownMenuContent = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
+>(({ className, sideOffset = 4, ...props }, ref) => (
+ <DropdownMenuPrimitive.Portal>
+ <DropdownMenuPrimitive.Content
+ ref={ref}
+ sideOffset={sideOffset}
className={cn(
- "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
+ "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
className,
)}
{...props}
/>
- );
-}
-
-function DropdownMenuSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
- return (
- <DropdownMenuPrimitive.Separator
- data-slot="dropdown-menu-separator"
- className={cn("bg-border -mx-1 my-1 h-px", className)}
- {...props}
- />
- );
-}
-
-function DropdownMenuShortcut({
+ </DropdownMenuPrimitive.Portal>
+));
+DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
+
+const DropdownMenuItem = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
+ inset?: boolean;
+ }
+>(({ className, inset, ...props }, ref) => (
+ <DropdownMenuPrimitive.Item
+ ref={ref}
+ className={cn(
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
+ inset && "pl-8",
+ className,
+ )}
+ {...props}
+ />
+));
+DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
+
+const DropdownMenuCheckboxItem = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
+>(({ className, children, checked, ...props }, ref) => (
+ <DropdownMenuPrimitive.CheckboxItem
+ ref={ref}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className,
+ )}
+ checked={checked}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <DropdownMenuPrimitive.ItemIndicator>
+ <Check className="h-4 w-4" />
+ </DropdownMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </DropdownMenuPrimitive.CheckboxItem>
+));
+DropdownMenuCheckboxItem.displayName =
+ DropdownMenuPrimitive.CheckboxItem.displayName;
+
+const DropdownMenuRadioItem = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
+>(({ className, children, ...props }, ref) => (
+ <DropdownMenuPrimitive.RadioItem
+ ref={ref}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className,
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <DropdownMenuPrimitive.ItemIndicator>
+ <Circle className="h-2 w-2 fill-current" />
+ </DropdownMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </DropdownMenuPrimitive.RadioItem>
+));
+DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
+
+const DropdownMenuLabel = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
+ inset?: boolean;
+ }
+>(({ className, inset, ...props }, ref) => (
+ <DropdownMenuPrimitive.Label
+ ref={ref}
+ className={cn(
+ "px-2 py-1.5 text-sm font-semibold",
+ inset && "pl-8",
+ className,
+ )}
+ {...props}
+ />
+));
+DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
+
+const DropdownMenuSeparator = React.forwardRef<
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
+>(({ className, ...props }, ref) => (
+ <DropdownMenuPrimitive.Separator
+ ref={ref}
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
+ {...props}
+ />
+));
+DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
+
+const DropdownMenuShortcut = ({
className,
...props
-}: React.ComponentProps<"span">) {
+}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
- data-slot="dropdown-menu-shortcut"
- className={cn(
- "text-muted-foreground ml-auto text-xs tracking-widest",
- className,
- )}
+ className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
{...props}
/>
);
-}
-
-function DropdownMenuSub({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
- return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
-}
-
-function DropdownMenuSubTrigger({
- className,
- inset,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
- inset?: boolean;
-}) {
- return (
- <DropdownMenuPrimitive.SubTrigger
- data-slot="dropdown-menu-sub-trigger"
- data-inset={inset}
- className={cn(
- "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
- className,
- )}
- {...props}
- >
- {children}
- <ChevronRightIcon className="ml-auto size-4" />
- </DropdownMenuPrimitive.SubTrigger>
- );
-}
-
-function DropdownMenuSubContent({
- className,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
- return (
- <DropdownMenuPrimitive.SubContent
- data-slot="dropdown-menu-sub-content"
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
- className,
- )}
- {...props}
- />
- );
-}
+};
+DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
export {
DropdownMenu,
- DropdownMenuPortal,
DropdownMenuTrigger,
DropdownMenuContent,
- DropdownMenuGroup,
- DropdownMenuLabel,
DropdownMenuItem,
DropdownMenuCheckboxItem,
- DropdownMenuRadioGroup,
DropdownMenuRadioItem,
+ DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
+ DropdownMenuGroup,
+ DropdownMenuPortal,
DropdownMenuSub,
- DropdownMenuSubTrigger,
DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuRadioGroup,
};
diff --git a/apps/www/components/ui/separator.tsx b/apps/www/components/ui/separator.tsx
index 06d1380a..72c18e33 100644
--- a/apps/www/components/ui/separator.tsx
+++ b/apps/www/components/ui/separator.tsx
@@ -13,7 +13,7 @@ function Separator({
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
return (
<SeparatorPrimitive.Root
- data-slot="separator-root"
+ data-slot="separator"
decorative={decorative}
orientation={orientation}
className={cn(
diff --git a/apps/www/components/ui/sidebar.tsx b/apps/www/components/ui/sidebar.tsx
new file mode 100644
index 00000000..ad584ca8
--- /dev/null
+++ b/apps/www/components/ui/sidebar.tsx
@@ -0,0 +1,781 @@
+"use client";
+
+import * as React from "react";
+import { Slot } from "@radix-ui/react-slot";
+import { VariantProps, cva } from "class-variance-authority";
+import { PanelLeft } from "lucide-react";
+
+import { useIsMobile } from "@/hooks/use-mobile";
+import { cn } from "@/lib/utils";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Separator } from "@/components/ui/separator";
+import {
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetHeader,
+ SheetTitle,
+} from "@/components/ui/sheet";
+import { Skeleton } from "@/components/ui/skeleton";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+
+const SIDEBAR_COOKIE_NAME = "sidebar_state";
+const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
+const SIDEBAR_WIDTH = "16rem";
+const SIDEBAR_WIDTH_MOBILE = "18rem";
+const SIDEBAR_WIDTH_ICON = "3rem";
+const SIDEBAR_KEYBOARD_SHORTCUT = "b";
+
+type SidebarContextProps = {
+ state: "expanded" | "collapsed";
+ open: boolean;
+ setOpen: (open: boolean) => void;
+ openMobile: boolean;
+ setOpenMobile: (open: boolean) => void;
+ isMobile: boolean;
+ toggleSidebar: () => void;
+};
+
+const SidebarContext = React.createContext<SidebarContextProps | null>(null);
+
+function useSidebar() {
+ const context = React.useContext(SidebarContext);
+ if (!context) {
+ throw new Error("useSidebar must be used within a SidebarProvider.");
+ }
+
+ return context;
+}
+
+const SidebarProvider = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & {
+ defaultOpen?: boolean;
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
+ }
+>(
+ (
+ {
+ defaultOpen = true,
+ open: openProp,
+ onOpenChange: setOpenProp,
+ className,
+ style,
+ children,
+ ...props
+ },
+ ref,
+ ) => {
+ const isMobile = useIsMobile();
+ const [openMobile, setOpenMobile] = React.useState(false);
+
+ // This is the internal state of the sidebar.
+ // We use openProp and setOpenProp for control from outside the component.
+ const [_open, _setOpen] = React.useState(defaultOpen);
+ const open = openProp ?? _open;
+ const setOpen = React.useCallback(
+ (value: boolean | ((value: boolean) => boolean)) => {
+ const openState = typeof value === "function" ? value(open) : value;
+ if (setOpenProp) {
+ setOpenProp(openState);
+ } else {
+ _setOpen(openState);
+ }
+
+ // This sets the cookie to keep the sidebar state.
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
+ },
+ [setOpenProp, open],
+ );
+
+ // Helper to toggle the sidebar.
+ const toggleSidebar = React.useCallback(() => {
+ return isMobile
+ ? setOpenMobile((open) => !open)
+ : setOpen((open) => !open);
+ }, [isMobile, setOpen, setOpenMobile]);
+
+ // Adds a keyboard shortcut to toggle the sidebar.
+ React.useEffect(() => {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (
+ event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
+ (event.metaKey || event.ctrlKey)
+ ) {
+ event.preventDefault();
+ toggleSidebar();
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+ return () => window.removeEventListener("keydown", handleKeyDown);
+ }, [toggleSidebar]);
+
+ // We add a state so that we can do data-state="expanded" or "collapsed".
+ // This makes it easier to style the sidebar with Tailwind classes.
+ const state = open ? "expanded" : "collapsed";
+
+ const contextValue = React.useMemo<SidebarContextProps>(
+ () => ({
+ state,
+ open,
+ setOpen,
+ isMobile,
+ openMobile,
+ setOpenMobile,
+ toggleSidebar,
+ }),
+ [
+ state,
+ open,
+ setOpen,
+ isMobile,
+ openMobile,
+ setOpenMobile,
+ toggleSidebar,
+ ],
+ );
+
+ return (
+ <SidebarContext.Provider value={contextValue}>
+ <TooltipProvider delayDuration={0}>
+ <div
+ style={
+ {
+ "--sidebar-width": SIDEBAR_WIDTH,
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
+ ...style,
+ } as React.CSSProperties
+ }
+ className={cn(
+ "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
+ className,
+ )}
+ ref={ref}
+ {...props}
+ >
+ {children}
+ </div>
+ </TooltipProvider>
+ </SidebarContext.Provider>
+ );
+ },
+);
+SidebarProvider.displayName = "SidebarProvider";
+
+const Sidebar = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & {
+ side?: "left" | "right";
+ variant?: "sidebar" | "floating" | "inset";
+ collapsible?: "offcanvas" | "icon" | "none";
+ }
+>(
+ (
+ {
+ side = "left",
+ variant = "sidebar",
+ collapsible = "offcanvas",
+ className,
+ children,
+ ...props
+ },
+ ref,
+ ) => {
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
+
+ if (collapsible === "none") {
+ return (
+ <div
+ className={cn(
+ "flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",
+ className,
+ )}
+ ref={ref}
+ {...props}
+ >
+ {children}
+ </div>
+ );
+ }
+
+ if (isMobile) {
+ return (
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
+ <SheetContent
+ data-sidebar="sidebar"
+ data-mobile="true"
+ className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
+ style={
+ {
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
+ } as React.CSSProperties
+ }
+ side={side}
+ >
+ <SheetHeader className="sr-only">
+ <SheetTitle>Sidebar</SheetTitle>
+ <SheetDescription>Displays the mobile sidebar.</SheetDescription>
+ </SheetHeader>
+ <div className="flex h-full w-full flex-col">{children}</div>
+ </SheetContent>
+ </Sheet>
+ );
+ }
+
+ return (
+ <div
+ ref={ref}
+ className="group peer hidden text-sidebar-foreground md:block"
+ data-state={state}
+ data-collapsible={state === "collapsed" ? collapsible : ""}
+ data-variant={variant}
+ data-side={side}
+ >
+ {/* This is what handles the sidebar gap on desktop */}
+ <div
+ className={cn(
+ "relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear",
+ "group-data-[collapsible=offcanvas]:w-0",
+ "group-data-[side=right]:rotate-180",
+ variant === "floating" || variant === "inset"
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
+ : "group-data-[collapsible=icon]:w-[--sidebar-width-icon]",
+ )}
+ />
+ <div
+ className={cn(
+ "fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",
+ side === "left"
+ ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
+ : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
+ // Adjust the padding for floating and inset variants.
+ variant === "floating" || variant === "inset"
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
+ : "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
+ className,
+ )}
+ {...props}
+ >
+ <div
+ data-sidebar="sidebar"
+ className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
+ >
+ {children}
+ </div>
+ </div>
+ </div>
+ );
+ },
+);
+Sidebar.displayName = "Sidebar";
+
+const SidebarTrigger = React.forwardRef<
+ React.ElementRef<typeof Button>,
+ React.ComponentProps<typeof Button>
+>(({ className, onClick, ...props }, ref) => {
+ const { toggleSidebar } = useSidebar();
+
+ return (
+ <Button
+ ref={ref}
+ data-sidebar="trigger"
+ variant="ghost"
+ size="icon"
+ className={cn("h-7 w-7", className)}
+ onClick={(event) => {
+ onClick?.(event);
+ toggleSidebar();
+ }}
+ {...props}
+ >
+ <PanelLeft />
+ <span className="sr-only">Toggle Sidebar</span>
+ </Button>
+ );
+});
+SidebarTrigger.displayName = "SidebarTrigger";
+
+const SidebarRail = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button">
+>(({ className, ...props }, ref) => {
+ const { toggleSidebar } = useSidebar();
+
+ return (
+ <button
+ ref={ref}
+ data-sidebar="rail"
+ aria-label="Toggle Sidebar"
+ tabIndex={-1}
+ onClick={toggleSidebar}
+ title="Toggle Sidebar"
+ className={cn(
+ "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
+ "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
+ "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarRail.displayName = "SidebarRail";
+
+const SidebarInset = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"main">
+>(({ className, ...props }, ref) => {
+ return (
+ <main
+ ref={ref}
+ className={cn(
+ "relative flex w-full flex-1 flex-col bg-background",
+ "md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarInset.displayName = "SidebarInset";
+
+const SidebarInput = React.forwardRef<
+ React.ElementRef<typeof Input>,
+ React.ComponentProps<typeof Input>
+>(({ className, ...props }, ref) => {
+ return (
+ <Input
+ ref={ref}
+ data-sidebar="input"
+ className={cn(
+ "h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarInput.displayName = "SidebarInput";
+
+const SidebarHeader = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="header"
+ className={cn("flex flex-col gap-2 p-2", className)}
+ {...props}
+ />
+ );
+});
+SidebarHeader.displayName = "SidebarHeader";
+
+const SidebarFooter = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="footer"
+ className={cn("flex flex-col gap-2 p-2", className)}
+ {...props}
+ />
+ );
+});
+SidebarFooter.displayName = "SidebarFooter";
+
+const SidebarSeparator = React.forwardRef<
+ React.ElementRef<typeof Separator>,
+ React.ComponentProps<typeof Separator>
+>(({ className, ...props }, ref) => {
+ return (
+ <Separator
+ ref={ref}
+ data-sidebar="separator"
+ className={cn("mx-2 w-auto bg-sidebar-border", className)}
+ {...props}
+ />
+ );
+});
+SidebarSeparator.displayName = "SidebarSeparator";
+
+const SidebarContent = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="content"
+ className={cn(
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarContent.displayName = "SidebarContent";
+
+const SidebarGroup = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="group"
+ className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
+ {...props}
+ />
+ );
+});
+SidebarGroup.displayName = "SidebarGroup";
+
+const SidebarGroupLabel = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & { asChild?: boolean }
+>(({ className, asChild = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : "div";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="group-label"
+ className={cn(
+ "flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarGroupLabel.displayName = "SidebarGroupLabel";
+
+const SidebarGroupAction = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button"> & { asChild?: boolean }
+>(({ className, asChild = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : "button";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="group-action"
+ className={cn(
+ "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ // Increases the hit area of the button on mobile.
+ "after:absolute after:-inset-2 after:md:hidden",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarGroupAction.displayName = "SidebarGroupAction";
+
+const SidebarGroupContent = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ data-sidebar="group-content"
+ className={cn("w-full text-sm", className)}
+ {...props}
+ />
+));
+SidebarGroupContent.displayName = "SidebarGroupContent";
+
+const SidebarMenu = React.forwardRef<
+ HTMLUListElement,
+ React.ComponentProps<"ul">
+>(({ className, ...props }, ref) => (
+ <ul
+ ref={ref}
+ data-sidebar="menu"
+ className={cn("flex w-full min-w-0 flex-col gap-1", className)}
+ {...props}
+ />
+));
+SidebarMenu.displayName = "SidebarMenu";
+
+const SidebarMenuItem = React.forwardRef<
+ HTMLLIElement,
+ React.ComponentProps<"li">
+>(({ className, ...props }, ref) => (
+ <li
+ ref={ref}
+ data-sidebar="menu-item"
+ className={cn("group/menu-item relative", className)}
+ {...props}
+ />
+));
+SidebarMenuItem.displayName = "SidebarMenuItem";
+
+const sidebarMenuButtonVariants = cva(
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
+ {
+ variants: {
+ variant: {
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
+ outline:
+ "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
+ },
+ size: {
+ default: "h-8 text-sm",
+ sm: "h-7 text-xs",
+ lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+ },
+);
+
+const SidebarMenuButton = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button"> & {
+ asChild?: boolean;
+ isActive?: boolean;
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
+ } & VariantProps<typeof sidebarMenuButtonVariants>
+>(
+ (
+ {
+ asChild = false,
+ isActive = false,
+ variant = "default",
+ size = "default",
+ tooltip,
+ className,
+ ...props
+ },
+ ref,
+ ) => {
+ const Comp = asChild ? Slot : "button";
+ const { isMobile, state } = useSidebar();
+
+ const button = (
+ <Comp
+ ref={ref}
+ data-sidebar="menu-button"
+ data-size={size}
+ data-active={isActive}
+ className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
+ {...props}
+ />
+ );
+
+ if (!tooltip) {
+ return button;
+ }
+
+ if (typeof tooltip === "string") {
+ tooltip = {
+ children: tooltip,
+ };
+ }
+
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
+ <TooltipContent
+ side="right"
+ align="center"
+ hidden={state !== "collapsed" || isMobile}
+ {...tooltip}
+ />
+ </Tooltip>
+ );
+ },
+);
+SidebarMenuButton.displayName = "SidebarMenuButton";
+
+const SidebarMenuAction = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button"> & {
+ asChild?: boolean;
+ showOnHover?: boolean;
+ }
+>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : "button";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="menu-action"
+ className={cn(
+ "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
+ // Increases the hit area of the button on mobile.
+ "after:absolute after:-inset-2 after:md:hidden",
+ "peer-data-[size=sm]/menu-button:top-1",
+ "peer-data-[size=default]/menu-button:top-1.5",
+ "peer-data-[size=lg]/menu-button:top-2.5",
+ "group-data-[collapsible=icon]:hidden",
+ showOnHover &&
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarMenuAction.displayName = "SidebarMenuAction";
+
+const SidebarMenuBadge = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ data-sidebar="menu-badge"
+ className={cn(
+ "pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground",
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
+ "peer-data-[size=sm]/menu-button:top-1",
+ "peer-data-[size=default]/menu-button:top-1.5",
+ "peer-data-[size=lg]/menu-button:top-2.5",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+));
+SidebarMenuBadge.displayName = "SidebarMenuBadge";
+
+const SidebarMenuSkeleton = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & {
+ showIcon?: boolean;
+ }
+>(({ className, showIcon = false, ...props }, ref) => {
+ // Random width between 50 to 90%.
+ const width = React.useMemo(() => {
+ return `${Math.floor(Math.random() * 40) + 50}%`;
+ }, []);
+
+ return (
+ <div
+ ref={ref}
+ data-sidebar="menu-skeleton"
+ className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
+ {...props}
+ >
+ {showIcon && (
+ <Skeleton
+ className="size-4 rounded-md"
+ data-sidebar="menu-skeleton-icon"
+ />
+ )}
+ <Skeleton
+ className="h-4 max-w-[--skeleton-width] flex-1"
+ data-sidebar="menu-skeleton-text"
+ style={
+ {
+ "--skeleton-width": width,
+ } as React.CSSProperties
+ }
+ />
+ </div>
+ );
+});
+SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
+
+const SidebarMenuSub = React.forwardRef<
+ HTMLUListElement,
+ React.ComponentProps<"ul">
+>(({ className, ...props }, ref) => (
+ <ul
+ ref={ref}
+ data-sidebar="menu-sub"
+ className={cn(
+ "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+));
+SidebarMenuSub.displayName = "SidebarMenuSub";
+
+const SidebarMenuSubItem = React.forwardRef<
+ HTMLLIElement,
+ React.ComponentProps<"li">
+>(({ ...props }, ref) => <li ref={ref} {...props} />);
+SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
+
+const SidebarMenuSubButton = React.forwardRef<
+ HTMLAnchorElement,
+ React.ComponentProps<"a"> & {
+ asChild?: boolean;
+ size?: "sm" | "md";
+ isActive?: boolean;
+ }
+>(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
+ const Comp = asChild ? Slot : "a";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="menu-sub-button"
+ data-size={size}
+ data-active={isActive}
+ className={cn(
+ "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
+ "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
+ size === "sm" && "text-xs",
+ size === "md" && "text-sm",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
+
+export {
+ Sidebar,
+ SidebarContent,
+ SidebarFooter,
+ SidebarGroup,
+ SidebarGroupAction,
+ SidebarGroupContent,
+ SidebarGroupLabel,
+ SidebarHeader,
+ SidebarInput,
+ SidebarInset,
+ SidebarMenu,
+ SidebarMenuAction,
+ SidebarMenuBadge,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ SidebarMenuSkeleton,
+ SidebarMenuSub,
+ SidebarMenuSubButton,
+ SidebarMenuSubItem,
+ SidebarProvider,
+ SidebarRail,
+ SidebarSeparator,
+ SidebarTrigger,
+ useSidebar,
+};
diff --git a/apps/www/components/ui/tooltip.tsx b/apps/www/components/ui/tooltip.tsx
index 92a97e46..bf4a342a 100644
--- a/apps/www/components/ui/tooltip.tsx
+++ b/apps/www/components/ui/tooltip.tsx
@@ -5,26 +5,57 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { cn } from "@/lib/utils";
-const TooltipProvider = TooltipPrimitive.Provider;
+function TooltipProvider({
+ delayDuration = 0,
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
+ return (
+ <TooltipPrimitive.Provider
+ data-slot="tooltip-provider"
+ delayDuration={delayDuration}
+ {...props}
+ />
+ );
+}
-const Tooltip = TooltipPrimitive.Root;
+function Tooltip({
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
+ return (
+ <TooltipProvider>
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
+ </TooltipProvider>
+ );
+}
-const TooltipTrigger = TooltipPrimitive.Trigger;
+function TooltipTrigger({
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
+}
-const TooltipContent = React.forwardRef<
- React.ElementRef<typeof TooltipPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
->(({ className, sideOffset = 4, ...props }, ref) => (
- <TooltipPrimitive.Content
- ref={ref}
- sideOffset={sideOffset}
- className={cn(
- "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
- className,
- )}
- {...props}
- />
-));
-TooltipContent.displayName = TooltipPrimitive.Content.displayName;
+function TooltipContent({
+ className,
+ sideOffset = 0,
+ children,
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
+ return (
+ <TooltipPrimitive.Portal>
+ <TooltipPrimitive.Content
+ data-slot="tooltip-content"
+ sideOffset={sideOffset}
+ className={cn(
+ "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
+ </TooltipPrimitive.Content>
+ </TooltipPrimitive.Portal>
+ );
+}
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
diff --git a/apps/www/components/version-select.tsx b/apps/www/components/version-select.tsx
index c3dce356..6c50e752 100644
--- a/apps/www/components/version-select.tsx
+++ b/apps/www/components/version-select.tsx
@@ -15,7 +15,7 @@ const DOMAINS = {
v4: "https://magicui.design",
} as const;
-export function VersionSelect() {
+export function VersionSelect({ className }: { className?: string }) {
const [version, setVersion] = React.useState<keyof typeof DOMAINS>("v4");
const handleVersionChange = (value: keyof typeof DOMAINS) => {
@@ -25,10 +25,15 @@ export function VersionSelect() {
return (
<DropdownMenu>
- <DropdownMenuTrigger className="flex h-7 w-14 cursor-pointer items-center justify-between rounded-full border border-muted-foreground/20 bg-muted py-1 pl-2 pr-0.5 text-sm font-medium text-muted-foreground">
+ <DropdownMenuTrigger
+ className={cn(
+ "flex h-7 w-14 cursor-pointer items-center justify-between rounded-full border bg-background py-1 pl-2 pr-0.5 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground",
+ className,
+ )}
+ >
{version}
- <div className="flex size-5 items-center justify-center rounded-full border border-muted-foreground/20">
- <ChevronDownIcon className="size-4 opacity-50" />
+ <div className="flex size-5 items-center justify-center rounded-full border">
+ <ChevronDownIcon className="size-4 text-muted-foreground" />
</div>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="min-w-[120px]">
@@ -36,7 +41,7 @@ export function VersionSelect() {
onClick={() => handleVersionChange("v3")}
className={cn(
"flex justify-between",
- version === "v3" && "bg-muted text-primary",
+ version === "v3" && "bg-accent text-accent-foreground",
)}
>
Tailwind v3
@@ -46,7 +51,7 @@ export function VersionSelect() {
onClick={() => handleVersionChange("v4")}
className={cn(
"flex justify-between",
- version === "v4" && "bg-muted text-primary",
+ version === "v4" && "bg-accent text-accent-foreground",
)}
>
Tailwind v4
diff --git a/apps/www/config/docs.ts b/apps/www/config/docs.ts
index 2a6fe4d8..0a72c509 100644
--- a/apps/www/config/docs.ts
+++ b/apps/www/config/docs.ts
@@ -1,8 +1,8 @@
-import { MainNavItem, SidebarNavItem } from "@/types";
+import { NavItem, NavItemWithChildren } from "@/types";
interface DocsConfig {
- mainNav: MainNavItem[];
- sidebarNav: SidebarNavItem[];
+ mainNav: NavItem[];
+ sidebarNav: NavItemWithChildren[];
}
export const docsConfig: DocsConfig = {
@@ -34,43 +34,7 @@ export const docsConfig: DocsConfig = {
{
title: "Installation",
href: "/docs/installation",
- items: [
- {
- title: "Next.js",
- href: `/docs/installation/next`,
- items: [],
- },
- {
- title: "Vite",
- href: `/docs/installation/vite`,
- items: [],
- },
- {
- title: "Remix",
- href: `/docs/installation/remix`,
- items: [],
- },
- {
- title: "Astro",
- href: `/docs/installation/astro`,
- items: [],
- },
- {
- title: "Laravel",
- href: `/docs/installation/laravel`,
- items: [],
- },
- {
- title: "Gatsby",
- href: `/docs/installation/gatsby`,
- items: [],
- },
- {
- title: "Manual",
- href: `/docs/installation/manual`,
- items: [],
- },
- ],
+ items: [],
},
{
title: "Tailwind v4",
@@ -84,6 +48,12 @@ export const docsConfig: DocsConfig = {
items: [],
label: "",
},
+ {
+ title: "Story",
+ href: "/docs/story",
+ items: [],
+ label: "New",
+ },
],
},
{
diff --git a/apps/www/config/site.ts b/apps/www/config/site.ts
index 142e3fc2..e4ef134b 100644
--- a/apps/www/config/site.ts
+++ b/apps/www/config/site.ts
@@ -5,7 +5,7 @@ export const siteConfig = {
description:
"Beautifully designed landing page components built with React & Tailwind CSS.",
links: {
- twitter: "https://twitter.com/magicuidesign",
+ twitter: "https://twitter.com/dillionverma",
discord: "https://discord.gg/87p2vpsat5",
github: "https://github.com/magicuidesign/magicui",
instagram: "https://instagram.com/magicuidesign/",
diff --git a/apps/www/content-collections.ts b/apps/www/content-collections.ts
deleted file mode 100644
index 15fced92..00000000
--- a/apps/www/content-collections.ts
+++ /dev/null
@@ -1,263 +0,0 @@
-import { defineCollection, defineConfig } from "@content-collections/core";
-import { compileMDX } from "@content-collections/mdx";
-import rehypeAutolinkHeadings from "rehype-autolink-headings";
-import rehypePrettyCode, { type Options } from "rehype-pretty-code";
-import rehypeSlug from "rehype-slug";
-import { codeImport } from "remark-code-import";
-import remarkGfm from "remark-gfm";
-import { createHighlighter } from "shiki";
-import { visit } from "unist-util-visit";
-import { readFile } from "node:fs/promises";
-import path from "node:path";
-import { z } from "zod";
-
-import { rehypeComponent } from "./lib/rehype-component";
-import { rehypeNpmCommand } from "./lib/rehype-npm-command";
-
-const prettyCodeOptions: Options = {
- theme: "github-dark",
- keepBackground: false,
- getHighlighter: (options) =>
- createHighlighter({
- ...options,
- }),
- onVisitLine(node) {
- // Prevent lines from collapsing in `display: grid` mode, and allow empty
- // lines to be copy/pasted
- if (node.children.length === 0) {
- node.children = [{ type: "text", value: " " }];
- }
- },
- onVisitHighlightedLine(node) {
- if (!node.properties.className) {
- node.properties.className = [];
- }
- node.properties.className.push("line--highlighted");
- },
- onVisitHighlightedChars(node) {
- if (!node.properties.className) {
- node.properties.className = [];
- }
- node.properties.className = ["word--highlighted"];
- },
-};
-
-const showcase = defineCollection({
- name: "Showcase",
- directory: "content/showcase",
- include: "**/*.mdx",
- schema: z.object({
- title: z.string(),
- description: z.string(),
- image: z.string(),
- href: z.string(),
- affiliation: z.string(),
- featured: z.boolean().optional().default(false),
- }),
- transform: async (document, context) => {
- const body = await compileMDX(context, document, {
- remarkPlugins: [codeImport, remarkGfm],
- });
- return {
- ...document,
- slug: `/showcase/${document._meta.path}`,
- slugAsParams: document._meta.path,
- body: {
- raw: document.content,
- code: body,
- },
- };
- },
-});
-
-const pages = defineCollection({
- name: "Page",
- directory: "content/pages",
- include: "**/*.mdx",
- schema: z.object({
- title: z.string(),
- description: z.string(),
- }),
- transform: async (document, context) => {
- const body = await compileMDX(context, document, {
- remarkPlugins: [codeImport, remarkGfm],
- });
- return {
- ...document,
- slug: `/${document._meta.path}`,
- slugAsParams: document._meta.path,
- body: {
- raw: document.content,
- code: body,
- },
- };
- },
-});
-
-const documents = defineCollection({
- name: "Doc",
- directory: "content/docs",
- include: "**/*.mdx",
- schema: z.object({
- title: z.string(),
- description: z.string(),
- published: z.boolean().default(true),
- date: z.string().optional(),
- links: z
- .object({
- doc: z.string().optional(),
- api: z.string().optional(),
- })
- .optional(),
- featured: z.boolean().optional().default(false),
- component: z.boolean().optional().default(false),
- toc: z.boolean().optional().default(true),
- image: z.string().optional(),
- }),
- transform: async (document, context) => {
- const slugAsParams = document._meta.path
- .replace(/\\/g, "/")
- .replace(/\/index$/, "");
- const body = await compileMDX(context, document, {
- remarkPlugins: [codeImport, remarkGfm],
- rehypePlugins: [
- rehypeSlug,
- rehypeComponent,
- () => (tree) => {
- visit(tree, (node) => {
- if (node?.type === "element" && node?.tagName === "pre") {
- const [codeEl] = node.children;
- if (codeEl.tagName !== "code") {
- return;
- }
- if (codeEl.data?.meta) {
- // Extract event from meta and pass it down the tree.
- const regex = /event="([^"]*)"/;
- const match = codeEl.data?.meta.match(regex);
- if (match) {
- node.__event__ = match ? match[1] : null;
- codeEl.data.meta = codeEl.data.meta.replace(regex, "");
- }
- }
- node.__rawString__ = codeEl.children?.[0].value;
- node.__src__ = node.properties?.__src__;
- node.__style__ = node.properties?.__style__;
- }
- });
- },
- [rehypePrettyCode, prettyCodeOptions],
- () => (tree) => {
- visit(tree, (node) => {
- if (node?.type === "element" && node?.tagName === "figure") {
- if (!("data-rehype-pretty-code-figure" in node.properties)) {
- return;
- }
-
- const preElement = node.children.at(-1);
- if (preElement.tagName !== "pre") {
- return;
- }
-
- preElement.properties["__withMeta__"] =
- node.children.at(0).tagName === "div";
- preElement.properties["__rawString__"] = node.__rawString__;
-
- if (node.__src__) {
- preElement.properties["__src__"] = node.__src__;
- }
-
- if (node.__event__) {
- preElement.properties["__event__"] = node.__event__;
- }
-
- if (node.__style__) {
- preElement.properties["__style__"] = node.__style__;
- }
- }
- });
- },
- rehypeNpmCommand,
- [
- rehypeAutolinkHeadings,
- {
- properties: {
- className: ["subheading-anchor"],
- ariaLabel: "Link to section",
- },
- },
- ],
- ],
- });
- return {
- ...document,
- image: `${process.env.NEXT_PUBLIC_APP_URL}/og?title=${encodeURI(
- document.title,
- )}&description=${encodeURI(document.description)}`,
- slug: `/docs/${slugAsParams}`,
- slugAsParams: slugAsParams,
- body: {
- raw: document.content,
- rawWithFrontmatter: await (async () => {
- try {
- const mdxPath = path.join(
- process.cwd(),
- "content/docs",
- `${document._meta.path}.mdx`,
- );
- return await readFile(mdxPath, "utf8");
- } catch {
- return undefined;
- }
- })(),
- code: body,
- },
- };
- },
-});
-
-const blog = defineCollection({
- name: "Blog",
- directory: "content/blog",
- include: "**/*.mdx",
- schema: z.object({
- title: z.string(),
- description: z.string().optional(),
- image: z.string().optional(),
- tag: z.string().optional(),
- author: z.string().optional(),
- publishedOn: z.string(),
- featured: z.boolean().optional().default(false),
- }),
- transform: async (document, context) => {
- const body = await compileMDX(context, document, {
- remarkPlugins: [codeImport, remarkGfm],
- rehypePlugins: [
- rehypeSlug,
- rehypeComponent,
- [rehypePrettyCode, prettyCodeOptions],
- [
- rehypeAutolinkHeadings,
- {
- properties: {
- className: ["subheading-anchor"],
- ariaLabel: "Link to section",
- },
- },
- ],
- ],
- });
- return {
- ...document,
- slug: `/blog/${document._meta.path}`,
- slugAsParams: document._meta.path,
- body: {
- raw: document.content,
- code: body,
- },
- };
- },
-});
-
-export default defineConfig({
- collections: [documents, pages, showcase, blog],
-});
diff --git a/apps/www/content/docs/components/android.mdx b/apps/www/content/docs/components/android.mdx
index b58df570..7c77c7c2 100644
--- a/apps/www/content/docs/components/android.mdx
+++ b/apps/www/content/docs/components/android.mdx
@@ -50,11 +50,11 @@ npx shadcn@latest add @magicui/android
## Usage
-```tsx
+```tsx showLineNumbers
import { Android } from "@/components/magicui/android";
```
-```tsx
+```tsx showLineNumbers
<Android />
```
diff --git a/apps/www/content/docs/components/animated-beam.mdx b/apps/www/content/docs/components/animated-beam.mdx
index 4d654694..61f15b62 100644
--- a/apps/www/content/docs/components/animated-beam.mdx
+++ b/apps/www/content/docs/components/animated-beam.mdx
@@ -61,11 +61,11 @@ npx shadcn@latest add @magicui/animated-beam
## Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedBeam } from "@/components/magicui/animated-beam";
```
-```tsx
+```tsx showLineNumbers
<AnimatedBeam containerRef={containerRef} fromRef={fromRef} toRef={toRef} />
```
diff --git a/apps/www/content/docs/components/animated-circular-progress-bar.mdx b/apps/www/content/docs/components/animated-circular-progress-bar.mdx
index 00af8845..566ec99c 100644
--- a/apps/www/content/docs/components/animated-circular-progress-bar.mdx
+++ b/apps/www/content/docs/components/animated-circular-progress-bar.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/animated-circular-progress-bar
## Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedCircularProgressBar } from "@/components/magicui/animated-circular-progress-bar";
```
-```tsx
+```tsx showLineNumbers
<AnimatedCircularProgressBar />
```
diff --git a/apps/www/content/docs/components/animated-gradient-text.mdx b/apps/www/content/docs/components/animated-gradient-text.mdx
index 49963133..862e8aff 100644
--- a/apps/www/content/docs/components/animated-gradient-text.mdx
+++ b/apps/www/content/docs/components/animated-gradient-text.mdx
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/animated-gradient-text
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-8}
+```css title="app/globals.css" showLineNumbers {2, 4-8}
@theme inline {
--animate-gradient: gradient 8s linear infinite;
@@ -65,11 +65,11 @@ Add the following animations to your global CSS file.
### Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedGradientText } from "@/components/magicui/animated-gradient-text";
```
-```tsx
+```tsx showLineNumbers
<AnimatedGradientText>Animated Gradient Text</AnimatedGradientText>
```
diff --git a/apps/www/content/docs/components/animated-grid-pattern.mdx b/apps/www/content/docs/components/animated-grid-pattern.mdx
index 0b081698..65095935 100644
--- a/apps/www/content/docs/components/animated-grid-pattern.mdx
+++ b/apps/www/content/docs/components/animated-grid-pattern.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/animated-grid-pattern
## Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedGridPattern } from "@/components/magicui/animated-grid-pattern";
```
-```tsx
+```tsx showLineNumbers
<AnimatedGridPattern />
```
diff --git a/apps/www/content/docs/components/animated-list.mdx b/apps/www/content/docs/components/animated-list.mdx
index eda5ed4b..19c91003 100644
--- a/apps/www/content/docs/components/animated-list.mdx
+++ b/apps/www/content/docs/components/animated-list.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/animated-list
## Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedList } from "@/components/magicui/animated-list";
```
-```tsx
+```tsx showLineNumbers
<AnimatedList>
<p>Item 1</p>
<p>Item 2</p>
diff --git a/apps/www/content/docs/components/animated-shiny-text.mdx b/apps/www/content/docs/components/animated-shiny-text.mdx
index 44ada200..a502f6b0 100644
--- a/apps/www/content/docs/components/animated-shiny-text.mdx
+++ b/apps/www/content/docs/components/animated-shiny-text.mdx
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/animated-shiny-text
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-14}
+```css title="app/globals.css" showLineNumbers {2, 4-14}
@theme inline {
--animate-shiny-text: shiny-text 8s infinite;
@@ -65,12 +65,12 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedShinyText } from "@/components/magicui/animated-shiny-text";
```
-```tsx
-<AnimatedShinyText>Animated Shiny Text</AnimatedShinyText>
+```tsx showLineNumbers
+<AnimatedShinyText>Hello</AnimatedShinyText>
```
## Props
diff --git a/apps/www/content/docs/components/animated-subscribe-button.mdx b/apps/www/content/docs/components/animated-subscribe-button.mdx
index 8fbcd89f..0f5e54d8 100644
--- a/apps/www/content/docs/components/animated-subscribe-button.mdx
+++ b/apps/www/content/docs/components/animated-subscribe-button.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/animated-subscribe-button
## Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedSubscribeButton } from "@/components/magicui/animated-subscribe-button";
```
-```tsx
+```tsx showLineNumbers
<AnimatedSubscribeButton>
<span>Follow</span>
<span>Subscribed</span>
diff --git a/apps/www/content/docs/components/animated-theme-toggler.mdx b/apps/www/content/docs/components/animated-theme-toggler.mdx
index 97fb0c4f..e7e82972 100644
--- a/apps/www/content/docs/components/animated-theme-toggler.mdx
+++ b/apps/www/content/docs/components/animated-theme-toggler.mdx
@@ -1,6 +1,6 @@
---
title: Theme Toggler
-date: 2025-0-17
+date: 2025-08-17
description: An Animated theme toggler component, fully customizable using Tailwind CSS.
author: Nazam Kalsi
published: true
@@ -34,9 +34,9 @@ npx shadcn@latest add @magicui/animated-theme-toggler
<Step>Update the import paths to match your project setup.</Step>
-<Step>Add the required CSS into your index.css</Step>
+<Step>Add the required CSS into your global CSS file</Step>
-```css title="./index.css"
+```css title="app/globals.css" showLineNumbers
::view-transition-old(root),
::view-transition-new(root) {
animation: none;
@@ -52,11 +52,11 @@ npx shadcn@latest add @magicui/animated-theme-toggler
## Usage
-```tsx
+```tsx showLineNumbers
import { AnimatedThemeToggler } from "@/components/magicui/animated-theme-toggler";
```
-```tsx
+```tsx showLineNumbers
<AnimatedThemeToggler />
```
diff --git a/apps/www/content/docs/components/arc-timeline.mdx b/apps/www/content/docs/components/arc-timeline.mdx
index 843cf39f..c6837372 100644
--- a/apps/www/content/docs/components/arc-timeline.mdx
+++ b/apps/www/content/docs/components/arc-timeline.mdx
@@ -40,11 +40,11 @@ npx shadcn@latest add @magicui/arc-timeline
## Usage
-```tsx
+```tsx showLineNumbers
import { ArcTimeline } from "@/components/magicui/arc-timeline";
```
-```tsx
+```tsx showLineNumbers
const data = [
{
time: "2025",
diff --git a/apps/www/content/docs/components/aurora-text.mdx b/apps/www/content/docs/components/aurora-text.mdx
index d69376b3..21c5bf1d 100644
--- a/apps/www/content/docs/components/aurora-text.mdx
+++ b/apps/www/content/docs/components/aurora-text.mdx
@@ -38,7 +38,7 @@ npx shadcn@latest add @magicui/aurora-text
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-25}
+```css title="app/globals.css" showLineNumbers {2, 4-25}
@theme inline {
--animate-aurora: aurora 8s ease-in-out infinite alternate;
@@ -75,11 +75,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { AuroraText } from "@/components/magicui/aurora-text";
```
-```tsx
+```tsx showLineNumbers
<AuroraText>Aurora Text</AuroraText>
```
diff --git a/apps/www/content/docs/components/avatar-circles.mdx b/apps/www/content/docs/components/avatar-circles.mdx
index 469508dd..ab724701 100644
--- a/apps/www/content/docs/components/avatar-circles.mdx
+++ b/apps/www/content/docs/components/avatar-circles.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/avatar-circles
## Usage
-```tsx
+```tsx showLineNumbers
import { AvatarCircles } from "@/components/magicui/avatar-circles";
```
-```tsx
+```tsx showLineNumbers
<AvatarCircles numPeople={99} avatarUrls={avatars} />
```
diff --git a/apps/www/content/docs/components/bento-grid.mdx b/apps/www/content/docs/components/bento-grid.mdx
index 400e2dc3..cbf4a125 100644
--- a/apps/www/content/docs/components/bento-grid.mdx
+++ b/apps/www/content/docs/components/bento-grid.mdx
@@ -46,11 +46,11 @@ npx shadcn@latest add @magicui/bento-grid
## Usage
-```tsx
+```tsx showLineNumbers
import { BentoCard, BentoGrid } from "@/components/magicui/bento-grid";
```
-```tsx
+```tsx showLineNumbers
<BentoGrid>
<BentoCard />
</BentoGrid>
diff --git a/apps/www/content/docs/components/blur-fade.mdx b/apps/www/content/docs/components/blur-fade.mdx
index 26997deb..39a97dac 100644
--- a/apps/www/content/docs/components/blur-fade.mdx
+++ b/apps/www/content/docs/components/blur-fade.mdx
@@ -46,11 +46,11 @@ npx shadcn@latest add @magicui/blur-fade
## Usage
-```tsx
+```tsx showLineNumbers
import { BlurFade } from "@/components/magicui/blur-fade";
```
-```tsx
+```tsx showLineNumbers
<BlurFade>
<img src="https://picsum.photos/300/200?random=1" alt="Sample 1" />
<img src="https://picsum.photos/300/200?random=2" alt="Sample 2" />
diff --git a/apps/www/content/docs/components/border-beam.mdx b/apps/www/content/docs/components/border-beam.mdx
index 5e198f8d..3724ac67 100644
--- a/apps/www/content/docs/components/border-beam.mdx
+++ b/apps/www/content/docs/components/border-beam.mdx
@@ -55,11 +55,11 @@ npx shadcn@latest add @magicui/border-beam
## Usage
-```tsx
+```tsx showLineNumbers
import { BorderBeam } from "@/components/magicui/border-beam";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<BorderBeam />
</div>
diff --git a/apps/www/content/docs/components/box-reveal.mdx b/apps/www/content/docs/components/box-reveal.mdx
index 46b252c1..adcf112e 100644
--- a/apps/www/content/docs/components/box-reveal.mdx
+++ b/apps/www/content/docs/components/box-reveal.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/box-reveal
## Usage
-```tsx
+```tsx showLineNumbers
import { BoxReveal } from "@/components/magicui/box-reveal";
```
-```tsx
+```tsx showLineNumbers
<BoxReveal>Box Reveal</BoxReveal>
```
diff --git a/apps/www/content/docs/components/code-comparison.mdx b/apps/www/content/docs/components/code-comparison.mdx
index 6d1ab712..0b969b3e 100644
--- a/apps/www/content/docs/components/code-comparison.mdx
+++ b/apps/www/content/docs/components/code-comparison.mdx
@@ -40,11 +40,11 @@ npx shadcn@latest add @magicui/code-comparison
## Usage
-```tsx
+```tsx showLineNumbers
import { CodeComparison } from "@/components/magicui/code-comparison";
```
-```tsx
+```tsx showLineNumbers
<CodeComparison beforeCode={beforeCode} afterCode={afterCode} />
```
diff --git a/apps/www/content/docs/components/comic-text.mdx b/apps/www/content/docs/components/comic-text.mdx
index 986564c3..128fd38e 100644
--- a/apps/www/content/docs/components/comic-text.mdx
+++ b/apps/www/content/docs/components/comic-text.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/comic-text
## Usage
-```tsx
+```tsx showLineNumbers
import { ComicText } from "@/components/magicui/comic-text";
```
-```tsx
+```tsx showLineNumbers
<ComicText>Comic Text</ComicText>
```
diff --git a/apps/www/content/docs/components/confetti.mdx b/apps/www/content/docs/components/confetti.mdx
index ce28853c..b33bf4e0 100644
--- a/apps/www/content/docs/components/confetti.mdx
+++ b/apps/www/content/docs/components/confetti.mdx
@@ -78,11 +78,11 @@ npm install canvas-confetti
### Usage
-```tsx
+```tsx showLineNumbers
import { Confetti } from "@/components/magicui/confetti";
```
-```tsx
+```tsx showLineNumbers
<Confetti />
```
diff --git a/apps/www/content/docs/components/cool-mode.mdx b/apps/www/content/docs/components/cool-mode.mdx
index b8c1fb82..ffbf24fc 100644
--- a/apps/www/content/docs/components/cool-mode.mdx
+++ b/apps/www/content/docs/components/cool-mode.mdx
@@ -48,11 +48,11 @@ npx shadcn@latest add @magicui/cool-mode
### Usage
-```tsx
+```tsx showLineNumbers
import { CoolMode } from "@/components/magicui/cool-mode";
```
-```tsx
+```tsx showLineNumbers
<CoolMode>
<button>Click me</button>
</CoolMode>
diff --git a/apps/www/content/docs/components/dock.mdx b/apps/www/content/docs/components/dock.mdx
index 87ad38c8..73b896b2 100644
--- a/apps/www/content/docs/components/dock.mdx
+++ b/apps/www/content/docs/components/dock.mdx
@@ -53,12 +53,12 @@ npx shadcn@latest add @magicui/dock
## Usage
-```tsx
+```tsx showLineNumbers
import { Dock, DockIcon } from "@/components/magicui/dock";
import { Home, Settings, Search } from "lucide-react";
```
-```tsx
+```tsx showLineNumbers
<Dock>
<DockIcon>
<Home />
diff --git a/apps/www/content/docs/components/dot-pattern.mdx b/apps/www/content/docs/components/dot-pattern.mdx
index 52d37a8b..cc7e023b 100644
--- a/apps/www/content/docs/components/dot-pattern.mdx
+++ b/apps/www/content/docs/components/dot-pattern.mdx
@@ -53,11 +53,11 @@ npx shadcn@latest add @magicui/dot-pattern
### Usage
-```tsx
+```tsx showLineNumbers
import { DotPattern } from "@/components/magicui/dot-pattern";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<DotPattern />
</div>
diff --git a/apps/www/content/docs/components/file-tree.mdx b/apps/www/content/docs/components/file-tree.mdx
index 73bb0530..3da84b46 100644
--- a/apps/www/content/docs/components/file-tree.mdx
+++ b/apps/www/content/docs/components/file-tree.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/file-tree
## Usage
-```tsx
+```tsx showLineNumbers
import { File, Folder, Tree } from "@/components/magicui/file-tree";
```
-```tsx
+```tsx showLineNumbers
<Tree>
<Folder>
<Folder>
diff --git a/apps/www/content/docs/components/flickering-grid.mdx b/apps/www/content/docs/components/flickering-grid.mdx
index 4aef3083..d5207380 100644
--- a/apps/www/content/docs/components/flickering-grid.mdx
+++ b/apps/www/content/docs/components/flickering-grid.mdx
@@ -48,11 +48,11 @@ npx shadcn@latest add @magicui/flickering-grid
### Usage
-```tsx
+```tsx showLineNumbers
import { FlickeringGrid } from "@/components/magicui/flickering-grid";
```
-```tsx
+```tsx showLineNumbers
<FlickeringGrid />
```
diff --git a/apps/www/content/docs/components/flip-text.mdx b/apps/www/content/docs/components/flip-text.mdx
index 82cb7a65..c71c17b5 100644
--- a/apps/www/content/docs/components/flip-text.mdx
+++ b/apps/www/content/docs/components/flip-text.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/flip-text
## Usage
-```tsx
+```tsx showLineNumbers
import { FlipText } from "@/components/magicui/flip-text";
```
-```tsx
+```tsx showLineNumbers
<FlipText>Flip Text</FlipText>
```
diff --git a/apps/www/content/docs/components/globe.mdx b/apps/www/content/docs/components/globe.mdx
index c78764e2..c44f2345 100644
--- a/apps/www/content/docs/components/globe.mdx
+++ b/apps/www/content/docs/components/globe.mdx
@@ -49,11 +49,11 @@ npm install cobe motion
## Usage
-```tsx
+```tsx showLineNumbers
import { Globe } from "@/components/magicui/globe";
```
-```tsx
+```tsx showLineNumbers
<Globe />
```
diff --git a/apps/www/content/docs/components/grid-beams.mdx b/apps/www/content/docs/components/grid-beams.mdx
index 0771cc33..15dbd467 100644
--- a/apps/www/content/docs/components/grid-beams.mdx
+++ b/apps/www/content/docs/components/grid-beams.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/grid-beams
## Usage
-```tsx
+```tsx showLineNumbers
import { GridBeams } from "@/components/magicui/grid-beams";
```
-```tsx
+```tsx showLineNumbers
<GridBeams>
<div className="flex h-96 items-center justify-center">
<h2 className="text-2xl font-bold text-white">Grid Beams Effect</h2>
diff --git a/apps/www/content/docs/components/grid-pattern.mdx b/apps/www/content/docs/components/grid-pattern.mdx
index 118477ad..f89cb780 100644
--- a/apps/www/content/docs/components/grid-pattern.mdx
+++ b/apps/www/content/docs/components/grid-pattern.mdx
@@ -53,11 +53,11 @@ npx shadcn@latest add @magicui/grid-pattern
### Usage
-```tsx
+```tsx showLineNumbers
import { GridPattern } from "@/components/magicui/grid-pattern";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<GridPattern />
</div>
diff --git a/apps/www/content/docs/components/hero-video-dialog.mdx b/apps/www/content/docs/components/hero-video-dialog.mdx
index ed30c14d..4e6b356c 100644
--- a/apps/www/content/docs/components/hero-video-dialog.mdx
+++ b/apps/www/content/docs/components/hero-video-dialog.mdx
@@ -48,11 +48,11 @@ npx shadcn@latest add @magicui/hero-video-dialog
## Usage
-```tsx
+```tsx showLineNumbers
import { HeroVideoDialog } from "@/components/magicui/hero-video-dialog";
```
-```tsx
+```tsx showLineNumbers
<HeroVideoDialog
className="block dark:hidden"
animationStyle="from-center"
diff --git a/apps/www/content/docs/components/highlighter.mdx b/apps/www/content/docs/components/highlighter.mdx
index b421a5d7..9b845574 100644
--- a/apps/www/content/docs/components/highlighter.mdx
+++ b/apps/www/content/docs/components/highlighter.mdx
@@ -40,11 +40,11 @@ npx shadcn@latest add @magicui/highlighter
## Usage
-```tsx
+```tsx showLineNumbers
import { Highlighter } from "@/components/magicui/highlighter";
```
-```tsx
+```tsx showLineNumbers
<p>
The{" "}
<Highlighter action="underline" color="#FF9800">
diff --git a/apps/www/content/docs/components/hyper-text.mdx b/apps/www/content/docs/components/hyper-text.mdx
index 3ac0226d..23fc0b8c 100644
--- a/apps/www/content/docs/components/hyper-text.mdx
+++ b/apps/www/content/docs/components/hyper-text.mdx
@@ -48,11 +48,11 @@ npm install motion
## Usage
-```tsx
+```tsx showLineNumbers
import { HyperText } from "@/components/magicui/hyper-text";
```
-```tsx
+```tsx showLineNumbers
<HyperText>Hover me</HyperText>
```
diff --git a/apps/www/content/docs/components/icon-cloud.mdx b/apps/www/content/docs/components/icon-cloud.mdx
index b676c830..ebd405fe 100644
--- a/apps/www/content/docs/components/icon-cloud.mdx
+++ b/apps/www/content/docs/components/icon-cloud.mdx
@@ -48,11 +48,11 @@ npx shadcn@latest add @magicui/icon-cloud
## Usage
-```tsx
+```tsx showLineNumbers
import { IconCloud } from "@/components/magicui/icon-cloud";
```
-```tsx
+```tsx showLineNumbers
<div className="relative overflow-hidden">
<IconCloud images={images} />
</div>
diff --git a/apps/www/content/docs/components/index.mdx b/apps/www/content/docs/components/index.mdx
new file mode 100644
index 00000000..f406bed1
--- /dev/null
+++ b/apps/www/content/docs/components/index.mdx
@@ -0,0 +1,6 @@
+---
+title: Components
+description: Here you can find all the components available in the library.
+---
+
+<ComponentsList />
diff --git a/apps/www/content/docs/components/interactive-grid-pattern.mdx b/apps/www/content/docs/components/interactive-grid-pattern.mdx
index c85cb263..d11a6ead 100644
--- a/apps/www/content/docs/components/interactive-grid-pattern.mdx
+++ b/apps/www/content/docs/components/interactive-grid-pattern.mdx
@@ -48,11 +48,11 @@ npx shadcn@latest add @magicui/interactive-grid-pattern
### Usage
-```tsx
+```tsx showLineNumbers
import { InteractiveGridPattern } from "@/components/magicui/interactive-grid-pattern";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<InteractiveGridPattern />
</div>
diff --git a/apps/www/content/docs/components/interactive-hover-button.mdx b/apps/www/content/docs/components/interactive-hover-button.mdx
index d02e5f98..fb538c10 100644
--- a/apps/www/content/docs/components/interactive-hover-button.mdx
+++ b/apps/www/content/docs/components/interactive-hover-button.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/interactive-hover-button
## Usage
-```tsx
+```tsx showLineNumbers
import { InteractiveHoverButton } from "@/components/magicui/interactive-hover-button";
```
-```tsx
+```tsx showLineNumbers
<InteractiveHoverButton>Interactive Hover Button</InteractiveHoverButton>
```
diff --git a/apps/www/content/docs/components/iphone-15-pro.mdx b/apps/www/content/docs/components/iphone-15-pro.mdx
index 89a98685..5a3cd3a3 100644
--- a/apps/www/content/docs/components/iphone-15-pro.mdx
+++ b/apps/www/content/docs/components/iphone-15-pro.mdx
@@ -52,11 +52,11 @@ npx shadcn@latest add @magicui/iphone-15-pro
## Usage
-```tsx
+```tsx showLineNumbers
import { Iphone15Pro } from "@/components/magicui/iphone-15-pro";
```
-```tsx
+```tsx showLineNumbers
<Iphone15Pro />
```
diff --git a/apps/www/content/docs/components/lens.mdx b/apps/www/content/docs/components/lens.mdx
index 15a3c5f4..6face8b1 100644
--- a/apps/www/content/docs/components/lens.mdx
+++ b/apps/www/content/docs/components/lens.mdx
@@ -52,11 +52,11 @@ npx shadcn@latest add @magicui/lens
## Usage
-```tsx
+```tsx showLineNumbers
import { Lens } from "@/components/magicui/lens";
```
-```tsx
+```tsx showLineNumbers
<Lens>
<img src="/images/lens-demo.jpg" alt="Lens Demo" />
</Lens>
diff --git a/apps/www/content/docs/components/line-shadow-text.mdx b/apps/www/content/docs/components/line-shadow-text.mdx
index d68d1ac6..916c2c12 100644
--- a/apps/www/content/docs/components/line-shadow-text.mdx
+++ b/apps/www/content/docs/components/line-shadow-text.mdx
@@ -38,7 +38,7 @@ npx shadcn@latest add @magicui/line-shadow-text
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 5-12}
+```css title="app/globals.css" showLineNumbers {2, 5-12}
@theme inline {
--animate-line-shadow: line-shadow 15s linear infinite;
@@ -61,11 +61,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { LineShadowText } from "@/components/magicui/line-shadow-text";
```
-```tsx
+```tsx showLineNumbers
<LineShadowText>Magic UI</LineShadowText>
```
diff --git a/apps/www/content/docs/components/magic-card.mdx b/apps/www/content/docs/components/magic-card.mdx
index 8ba4c73d..f807f9e2 100644
--- a/apps/www/content/docs/components/magic-card.mdx
+++ b/apps/www/content/docs/components/magic-card.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/magic-card
## Usage
-```tsx
+```tsx showLineNumbers
import { MagicCard } from "@/registry/magicui/magic-card";
```
-```tsx
+```tsx showLineNumbers
<MagicCard>
<div className="p-4">
<p>Hello World</p>
diff --git a/apps/www/content/docs/components/marquee.mdx b/apps/www/content/docs/components/marquee.mdx
index d70896c5..b7e26a62 100644
--- a/apps/www/content/docs/components/marquee.mdx
+++ b/apps/www/content/docs/components/marquee.mdx
@@ -11,7 +11,7 @@ video: https://cdn.magicui.design/marquee.mp4
## Installation
-<Tabs defaultValue="cli">
+<Tabs>
<TabsList>
<TabsTrigger value="cli">CLI</TabsTrigger>
@@ -31,7 +31,7 @@ npx shadcn@latest add @magicui/marquee
<Step>Copy and paste the following code into your project.</Step>
-<ComponentSource name="marquee" />
+<ComponentSource name="marquee" title="components/ui/marquee.tsx" />
<Step>Update the import paths to match your project setup.</Step>
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/marquee
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2-3, 4-20}
+```css title="app/globals.css" showLineNumbers {2-3, 4-20}
@theme inline {
--animate-marquee: marquee var(--duration) infinite linear;
--animate-marquee-vertical: marquee-vertical var(--duration) linear infinite;
@@ -81,11 +81,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { Marquee } from "@/components/magicui/marquee";
```
-```tsx
+```tsx showLineNumbers
<Marquee>
<span>Next.js</span>
<span>React</span>
diff --git a/apps/www/content/docs/components/meteors.mdx b/apps/www/content/docs/components/meteors.mdx
index 49e0e34f..6b2696c0 100644
--- a/apps/www/content/docs/components/meteors.mdx
+++ b/apps/www/content/docs/components/meteors.mdx
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/meteors
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-15}
+```css title="app/globals.css" showLineNumbers {2, 4-15}
@theme inline {
--animate-meteor: meteor 5s linear infinite;
@@ -67,12 +67,12 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { Meteors } from "@/components/magicui/meteors";
```
-```tsx
-<div className="relative overflow-hidden h-[500px] w-full max-w-[350px]">
+```tsx showLineNumbers
+<div className="relative overflow-hidden h-[500px] w-full">
<Meteors />
</div>
```
diff --git a/apps/www/content/docs/components/morphing-text.mdx b/apps/www/content/docs/components/morphing-text.mdx
index 794bf414..a3e99b8a 100644
--- a/apps/www/content/docs/components/morphing-text.mdx
+++ b/apps/www/content/docs/components/morphing-text.mdx
@@ -40,11 +40,11 @@ npx shadcn@latest add @magicui/morphing-text
## Usage
-```tsx
+```tsx showLineNumbers
import { MorphingText } from "@/components/magicui/morphing-text";
```
-```tsx
+```tsx showLineNumbers
<MorphingText texts={["Hello", "World"]} />
```
diff --git a/apps/www/content/docs/components/neon-gradient-card.mdx b/apps/www/content/docs/components/neon-gradient-card.mdx
index ba71f51e..74e91591 100644
--- a/apps/www/content/docs/components/neon-gradient-card.mdx
+++ b/apps/www/content/docs/components/neon-gradient-card.mdx
@@ -38,7 +38,7 @@ npx shadcn@latest add @magicui/neon-gradient-card
Add the following animations to your global CSS file .
-```css title="app/globals.css" {2-3, 5-12}
+```css title="app/globals.css" showLineNumbers {2-3, 5-12}
@theme inline {
--animate-background-position-spin: background-position-spin 3000ms infinite
alternate;
@@ -62,11 +62,11 @@ Add the following animations to your global CSS file .
## Usage
-```tsx
+```tsx showLineNumbers
import { NeonGradientCard } from "@/components/magicui/neon-gradient-card";
```
-```tsx
+```tsx showLineNumbers
<NeonGradientCard>
<div className="p-4">
<p>Hello</p>
diff --git a/apps/www/content/docs/components/number-ticker.mdx b/apps/www/content/docs/components/number-ticker.mdx
index 5b8390b1..ccb287b5 100644
--- a/apps/www/content/docs/components/number-ticker.mdx
+++ b/apps/www/content/docs/components/number-ticker.mdx
@@ -53,11 +53,11 @@ npx shadcn@latest add @magicui/number-ticker
### Usage
-```tsx
+```tsx showLineNumbers
import { NumberTicker } from "@/components/magicui/number-ticker";
```
-```tsx
+```tsx showLineNumbers
<NumberTicker value={100} />
```
diff --git a/apps/www/content/docs/components/orbiting-circles.mdx b/apps/www/content/docs/components/orbiting-circles.mdx
index a72d3b33..837f65d9 100644
--- a/apps/www/content/docs/components/orbiting-circles.mdx
+++ b/apps/www/content/docs/components/orbiting-circles.mdx
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/orbiting-circles
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-14}
+```css title="app/globals.css" showLineNumbers {2, 4-14}
@theme inline {
--animate-orbit: orbit calc(var(--duration) * 1s) linear infinite;
@@ -65,12 +65,12 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { OrbitingCircles } from "@/components/magicui/orbiting-circles";
import { File, Settings, Search } from "lucide-react";
```
-```tsx
+```tsx showLineNumbers
<div className="relative overflow-hidden h-[500px] w-full">
<OrbitingCircles>
<File />
diff --git a/apps/www/content/docs/components/particles.mdx b/apps/www/content/docs/components/particles.mdx
index d51d8bd7..410e1ece 100644
--- a/apps/www/content/docs/components/particles.mdx
+++ b/apps/www/content/docs/components/particles.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/particles
## Usage
-```tsx
+```tsx showLineNumbers
import { Particles } from "@/components/magicui/particles";
```
-```tsx
+```tsx showLineNumbers
<div className="relative overflow-hidden h-[500px] w-full">
<Particles />
</div>
diff --git a/apps/www/content/docs/components/pixel-image.mdx b/apps/www/content/docs/components/pixel-image.mdx
index f19a1373..5dd14ecf 100644
--- a/apps/www/content/docs/components/pixel-image.mdx
+++ b/apps/www/content/docs/components/pixel-image.mdx
@@ -40,21 +40,7 @@ npx shadcn@latest add @magicui/pixel-image
<ComponentSource name="pixel-image" />
-<Step>Add the component to your page or layout.</Step>
-
-```tsx
-import { PixelImage } from "@/registry/magicui/pixel-image";
-
-export default function Page() {
- return (
- <PixelImage
- src="/pixel-image-demo.jpg"
- grid="6x4"
- grayscaleAnimation={true}
- />
- );
-}
-```
+<Step>Update the import paths to match your project setup.</Step>
</Steps>
@@ -64,11 +50,11 @@ export default function Page() {
## Usage
-```tsx
+```tsx showLineNumbers
import { PixelImage } from "@/registry/magicui/pixel-image";
```
-```tsx
+```tsx showLineNumbers
<PixelImage src="/pixel-image-demo.jpg" grid="8x8" />
```
diff --git a/apps/www/content/docs/components/pointer.mdx b/apps/www/content/docs/components/pointer.mdx
index fb518e1a..8eb7630f 100644
--- a/apps/www/content/docs/components/pointer.mdx
+++ b/apps/www/content/docs/components/pointer.mdx
@@ -42,10 +42,10 @@ npx shadcn@latest add @magicui/pointer
## Usage
-```tsx
+```tsx showLineNumbers
import { Pointer } from "@/components/magicui/pointer";
```
-```tsx
+```tsx showLineNumbers
<Pointer />
```
diff --git a/apps/www/content/docs/components/progressive-blur.mdx b/apps/www/content/docs/components/progressive-blur.mdx
index 325ca2b3..8bff27e5 100644
--- a/apps/www/content/docs/components/progressive-blur.mdx
+++ b/apps/www/content/docs/components/progressive-blur.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/progressive-blur
## Usage
-```tsx
+```tsx showLineNumbers
import { ProgressiveBlur } from "@/components/magicui/progressive-blur";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[400px] w-full overflow-auto">
{/* Your scrollable content */}
<div className="p-4 space-y-4">{/* Content items */}</div>
diff --git a/apps/www/content/docs/components/pulsating-button.mdx b/apps/www/content/docs/components/pulsating-button.mdx
index ad9e44c8..2f9ab4a7 100644
--- a/apps/www/content/docs/components/pulsating-button.mdx
+++ b/apps/www/content/docs/components/pulsating-button.mdx
@@ -38,7 +38,7 @@ npx shadcn@latest add @magicui/pulsating-button
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-12}
+```css title="app/globals.css" showLineNumbers {2, 4-12}
@theme inline {
--animate-pulse: pulse var(--duration) ease-out infinite;
@@ -62,11 +62,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { PulsatingButton } from "@/components/magicui/pulsating-button";
```
-```tsx
+```tsx showLineNumbers
<PulsatingButton>Pulsating Button</PulsatingButton>
```
diff --git a/apps/www/content/docs/components/rainbow-button.mdx b/apps/www/content/docs/components/rainbow-button.mdx
index 0b36db6d..aa86d3dd 100644
--- a/apps/www/content/docs/components/rainbow-button.mdx
+++ b/apps/www/content/docs/components/rainbow-button.mdx
@@ -38,7 +38,7 @@ npx shadcn@latest add @magicui/rainbow-button
Add the following to your `globals.css` file:
-```css title="app/globals.css" {2-6}
+```css title="app/globals.css" showLineNumbers {2-6}
:root {
--color-1: 0 100% 63%;
--color-2: 270 100% 63%;
@@ -52,7 +52,7 @@ Add the following to your `globals.css` file:
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-11}
+```css title="app/globals.css" showLineNumbers {2, 4-11}
@theme inline {
--animate-rainbow: rainbow var(--speed, 2s) infinite linear;
@@ -81,11 +81,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { RainbowButton } from "@/components/magicui/rainbow-button";
```
-```tsx
+```tsx showLineNumbers
<RainbowButton>Rainbow Button</RainbowButton>
```
diff --git a/apps/www/content/docs/components/retro-grid.mdx b/apps/www/content/docs/components/retro-grid.mdx
index 2d7e2219..bb0bfd97 100644
--- a/apps/www/content/docs/components/retro-grid.mdx
+++ b/apps/www/content/docs/components/retro-grid.mdx
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/retro-grid
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-11}
+```css title="app/globals.css" showLineNumbers {2, 4-11}
@theme inline {
--animate-grid: grid 15s linear infinite;
@@ -62,11 +62,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { RetroGrid } from "@/components/magicui/retro-grid";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<RetroGrid />
</div>
diff --git a/apps/www/content/docs/components/ripple-button.mdx b/apps/www/content/docs/components/ripple-button.mdx
index f4972ff4..6e86c152 100644
--- a/apps/www/content/docs/components/ripple-button.mdx
+++ b/apps/www/content/docs/components/ripple-button.mdx
@@ -38,7 +38,7 @@ npx shadcn@latest add @magicui/ripple-button
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-12}
+```css title="app/globals.css" showLineNumbers {2, 4-12}
@theme inline {
--animate-rippling: rippling var(--duration) ease-out;
@@ -62,11 +62,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { RippleButton } from "@/components/magicui/ripple-button";
```
-```tsx
+```tsx showLineNumbers
<RippleButton>Ripple Button</RippleButton>
```
diff --git a/apps/www/content/docs/components/ripple.mdx b/apps/www/content/docs/components/ripple.mdx
index 518e8423..4a27c7ff 100644
--- a/apps/www/content/docs/components/ripple.mdx
+++ b/apps/www/content/docs/components/ripple.mdx
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/ripple
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2-3, 5-13}
+```css title="app/globals.css" showLineNumbers {2-3, 5-13}
@theme inline {
--animate-ripple: ripple var(--duration, 2s) ease calc(var(--i, 0) * 0.2s)
infinite;
@@ -64,11 +64,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { Ripple } from "@/components/magicui/ripple";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<Ripple />
</div>
diff --git a/apps/www/content/docs/components/safari.mdx b/apps/www/content/docs/components/safari.mdx
index bfeff577..0c017521 100644
--- a/apps/www/content/docs/components/safari.mdx
+++ b/apps/www/content/docs/components/safari.mdx
@@ -56,11 +56,11 @@ npx shadcn@latest add @magicui/safari
## Usage
-```tsx
+```tsx showLineNumbers
import { Safari } from "@/components/magicui/safari";
```
-```tsx
+```tsx showLineNumbers
<Safari url="https://magicui.design" />
```
diff --git a/apps/www/content/docs/components/scratch-to-reveal.mdx b/apps/www/content/docs/components/scratch-to-reveal.mdx
index a334c7e2..a04f3753 100644
--- a/apps/www/content/docs/components/scratch-to-reveal.mdx
+++ b/apps/www/content/docs/components/scratch-to-reveal.mdx
@@ -40,11 +40,11 @@ npx shadcn@latest add @magicui/scratch-to-reveal
## Usage
-```tsx
+```tsx showLineNumbers
import { ScratchToReveal } from "@/components/magicui/scratch-to-reveal";
```
-```tsx
+```tsx showLineNumbers
<ScratchToReveal width={300} height={300} minScratchPercentage={50}>
Scratch To Reveal
</ScratchToReveal>
diff --git a/apps/www/content/docs/components/script-copy-btn.mdx b/apps/www/content/docs/components/script-copy-btn.mdx
index 80887f22..10429925 100644
--- a/apps/www/content/docs/components/script-copy-btn.mdx
+++ b/apps/www/content/docs/components/script-copy-btn.mdx
@@ -40,11 +40,11 @@ npx shadcn@latest add @magicui/script-copy-btn
## Usage
-```tsx
+```tsx showLineNumbers
import { ScriptCopyBtn } from "@/components/magicui/script-copy-btn";
```
-```tsx
+```tsx showLineNumbers
<ScriptCopyBtn />
```
diff --git a/apps/www/content/docs/components/scroll-based-velocity.mdx b/apps/www/content/docs/components/scroll-based-velocity.mdx
index aaba07fb..1bd65d3e 100644
--- a/apps/www/content/docs/components/scroll-based-velocity.mdx
+++ b/apps/www/content/docs/components/scroll-based-velocity.mdx
@@ -50,14 +50,14 @@ npm install motion
## Usage
-```tsx
+```tsx showLineNumbers
import {
ScrollVelocityContainer,
ScrollVelocityRow,
} from "@/components/magicui/scroll-based-velocity";
```
-```tsx
+```tsx showLineNumbers
<ScrollVelocityContainer className="text-4xl md:text-7xl font-bold">
<ScrollVelocityRow baseVelocity={20} direction={1}>
Velocity Scroll
diff --git a/apps/www/content/docs/components/scroll-progress.mdx b/apps/www/content/docs/components/scroll-progress.mdx
index 7bc183b2..861d948d 100644
--- a/apps/www/content/docs/components/scroll-progress.mdx
+++ b/apps/www/content/docs/components/scroll-progress.mdx
@@ -39,11 +39,11 @@ npx shadcn@latest add @magicui/scroll-progress
## Usage
-```tsx
+```tsx showLineNumbers
import { ScrollProgress } from "@/components/magicui/scroll-progress";
```
-```tsx
+```tsx showLineNumbers
<ScrollProgress />
```
diff --git a/apps/www/content/docs/components/shimmer-button.mdx b/apps/www/content/docs/components/shimmer-button.mdx
index bdd75045..9be5b2c2 100644
--- a/apps/www/content/docs/components/shimmer-button.mdx
+++ b/apps/www/content/docs/components/shimmer-button.mdx
@@ -39,7 +39,7 @@ npx shadcn@latest add @magicui/shimmer-button
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2-4, 6-26}
+```css title="app/globals.css" showLineNumbers {2-4, 6-26}
@theme inline {
--animate-shimmer-slide: shimmer-slide var(--speed) ease-in-out infinite
alternate;
@@ -77,11 +77,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { ShimmerButton } from "@/components/magicui/shimmer-button";
```
-```tsx
+```tsx showLineNumbers
<ShimmerButton>Shimmer Button</ShimmerButton>
```
diff --git a/apps/www/content/docs/components/shine-border.mdx b/apps/www/content/docs/components/shine-border.mdx
index 81060c03..d1a9dcf5 100644
--- a/apps/www/content/docs/components/shine-border.mdx
+++ b/apps/www/content/docs/components/shine-border.mdx
@@ -38,7 +38,7 @@ npx shadcn@latest add @magicui/shine-border
Add the following animations to your global CSS file.
-```css title="app/globals.css" {2, 4-14}
+```css title="app/globals.css" showLineNumbers {2, 4-14}
@theme inline {
--animate-shine: shine var(--duration) infinite linear;
@@ -70,11 +70,11 @@ Add the following animations to your global CSS file.
## Usage
-```tsx
+```tsx showLineNumbers
import { ShineBorder } from "@/registry/magicui/shine-border";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<ShineBorder />
</div>
diff --git a/apps/www/content/docs/components/shiny-button.mdx b/apps/www/content/docs/components/shiny-button.mdx
index e892e6af..dbc41e19 100644
--- a/apps/www/content/docs/components/shiny-button.mdx
+++ b/apps/www/content/docs/components/shiny-button.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/shiny-button
## Usage
-```tsx
+```tsx showLineNumbers
import { ShinyButton } from "@/components/magicui/shiny-button";
```
-```tsx
+```tsx showLineNumbers
<ShinyButton>Shiny Button</ShinyButton>
```
diff --git a/apps/www/content/docs/components/smooth-cursor.mdx b/apps/www/content/docs/components/smooth-cursor.mdx
index be8f25fb..4ba582dd 100644
--- a/apps/www/content/docs/components/smooth-cursor.mdx
+++ b/apps/www/content/docs/components/smooth-cursor.mdx
@@ -42,7 +42,7 @@ npx shadcn@latest add @magicui/smooth-cursor
<Step>Add the component to your page or layout.</Step>
-```tsx
+```tsx showLineNumbers
import { SmoothCursor } from "@/components/ui/smooth-cursor";
export default function Page() {
@@ -63,11 +63,11 @@ export default function Page() {
## Usage
-```tsx
+```tsx showLineNumbers
import { SmoothCursor } from "@/components/ui/smooth-cursor";
```
-```tsx
+```tsx showLineNumbers
<SmoothCursor />
```
@@ -75,7 +75,7 @@ import { SmoothCursor } from "@/components/ui/smooth-cursor";
To prevent the default browser cursor from overlapping with the custom cursor, add the following CSS globally:
-```css
+```css showLineNumbers
* {
cursor: none !important;
}
@@ -83,7 +83,7 @@ To prevent the default browser cursor from overlapping with the custom cursor, a
### Optional: Keep text cursor for inputs
-```css
+```css showLineNumbers
input,
textarea,
select {
@@ -93,7 +93,7 @@ select {
💡 If you're using Tailwind CSS, you can add cursor-none to your layout wrapper:
-```tsx
+```tsx showLineNumbers
<div className="cursor-none">
<SmoothCursor />
{/* your app */}
@@ -109,7 +109,7 @@ select {
### SpringConfig Type
-```typescript
+```typescript showLineNumbers
interface SpringConfig {
damping: number; // Controls how quickly the animation settles
stiffness: number; // Controls the spring stiffness
@@ -120,7 +120,7 @@ interface SpringConfig {
### Default Spring Configuration
-```typescript
+```typescript showLineNumbers
const defaultSpringConfig = {
damping: 45,
stiffness: 400,
diff --git a/apps/www/content/docs/components/sparkles-text.mdx b/apps/www/content/docs/components/sparkles-text.mdx
index 6527b89e..f06cddad 100644
--- a/apps/www/content/docs/components/sparkles-text.mdx
+++ b/apps/www/content/docs/components/sparkles-text.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/sparkles-text
## Usage
-```tsx
+```tsx showLineNumbers
import { SparklesText } from "@/components/magicui/sparkles-text";
```
-```tsx
+```tsx showLineNumbers
<SparklesText>Sparkles Text</SparklesText>
```
diff --git a/apps/www/content/docs/components/spinning-text.mdx b/apps/www/content/docs/components/spinning-text.mdx
index 6f227b5f..6e1c8331 100644
--- a/apps/www/content/docs/components/spinning-text.mdx
+++ b/apps/www/content/docs/components/spinning-text.mdx
@@ -49,11 +49,11 @@ npx shadcn@latest add @magicui/spinning-text
### Usage
-```tsx
+```tsx showLineNumbers
import { SpinningText } from "@/components/magicui/spinning-text";
```
-```tsx
+```tsx showLineNumbers
<SpinningText>learn more • earn more • grow more •</SpinningText>
```
diff --git a/apps/www/content/docs/components/terminal.mdx b/apps/www/content/docs/components/terminal.mdx
index 4483b034..17202176 100644
--- a/apps/www/content/docs/components/terminal.mdx
+++ b/apps/www/content/docs/components/terminal.mdx
@@ -46,7 +46,7 @@ npx shadcn@latest add @magicui/terminal
## Usage
-```tsx
+```tsx showLineNumbers
import {
AnimatedSpan,
Terminal,
@@ -54,7 +54,7 @@ import {
} from "@/components/magicui/terminal";
```
-```tsx
+```tsx showLineNumbers
<Terminal>
<TypingAnimation>pnpm dlx shadcn@latest init</TypingAnimation>
<AnimatedSpan>✔ Preflight checks.</AnimatedSpan>
diff --git a/apps/www/content/docs/components/text-animate.mdx b/apps/www/content/docs/components/text-animate.mdx
index a2ae38d6..0105266a 100644
--- a/apps/www/content/docs/components/text-animate.mdx
+++ b/apps/www/content/docs/components/text-animate.mdx
@@ -76,11 +76,11 @@ npx shadcn@latest add @magicui/text-animate
## Usage
-```tsx
+```tsx showLineNumbers
import { TextAnimate } from "@/components/magicui/text-animate";
```
-```tsx
+```tsx showLineNumbers
<TextAnimate animation="blurInUp" by="word">
Blur in by word
</TextAnimate>
diff --git a/apps/www/content/docs/components/text-reveal.mdx b/apps/www/content/docs/components/text-reveal.mdx
index 762ce28a..1b1585fe 100644
--- a/apps/www/content/docs/components/text-reveal.mdx
+++ b/apps/www/content/docs/components/text-reveal.mdx
@@ -43,10 +43,10 @@ npx shadcn@latest add @magicui/text-reveal
## Usage
-```tsx
+```tsx showLineNumbers
import { TextReveal } from "@/components/magicui/text-reveal";
```
-```tsx
+```tsx showLineNumbers
<TextReveal>Magic UI will change the way you design.</TextReveal>
```
diff --git a/apps/www/content/docs/components/tweet-card.mdx b/apps/www/content/docs/components/tweet-card.mdx
index 24d4ba19..70a08fb9 100644
--- a/apps/www/content/docs/components/tweet-card.mdx
+++ b/apps/www/content/docs/components/tweet-card.mdx
@@ -55,15 +55,11 @@ Copy and paste the following code into your project.
</Tabs>
-<Steps>
-
-</Steps>
-
## Usage
To render on server side using RSC (Next.js 13):
-```tsx
+```tsx showLineNumbers
import { TweetCard } from "@/components/magicui/tweet-card";
export default async function App() {
@@ -73,7 +69,7 @@ export default async function App() {
To render on client side:
-```tsx
+```tsx showLineNumbers
"use client";
import { ClientTweetCard } from "@/components/magicui/client-tweet-card";
diff --git a/apps/www/content/docs/components/typing-animation.mdx b/apps/www/content/docs/components/typing-animation.mdx
index d558e2b5..f7139b40 100644
--- a/apps/www/content/docs/components/typing-animation.mdx
+++ b/apps/www/content/docs/components/typing-animation.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/typing-animation
## Usage
-```tsx
+```tsx showLineNumbers
import { TypingAnimation } from "@/components/magicui/typing-animation";
```
-```tsx
+```tsx showLineNumbers
<TypingAnimation>Typing Animation</TypingAnimation>
```
diff --git a/apps/www/content/docs/components/video-text.mdx b/apps/www/content/docs/components/video-text.mdx
index df6af390..72695da0 100644
--- a/apps/www/content/docs/components/video-text.mdx
+++ b/apps/www/content/docs/components/video-text.mdx
@@ -40,11 +40,11 @@ npx shadcn@latest add @magicui/video-text
## Usage
-```tsx
+```tsx showLineNumbers
import { VideoText } from "@/registry/magicui/video-text";
```
-```tsx
+```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
<VideoText src="https://cdn.magicui.design/ocean-small.webm">OCEAN</VideoText>
</div>
diff --git a/apps/www/content/docs/components/warp-background.mdx b/apps/www/content/docs/components/warp-background.mdx
index 2869d0f2..0dd1dbc9 100644
--- a/apps/www/content/docs/components/warp-background.mdx
+++ b/apps/www/content/docs/components/warp-background.mdx
@@ -42,11 +42,11 @@ npx shadcn@latest add @magicui/warp-background
## Usage
-```tsx
+```tsx showLineNumbers
import { WarpBackground } from "@/components/magicui/warp-background";
```
-```tsx
+```tsx showLineNumbers
<WarpBackground>
<div className="w-80">
<p>Warp Background</p>
diff --git a/apps/www/content/docs/components/word-rotate.mdx b/apps/www/content/docs/components/word-rotate.mdx
index 848c21eb..8cad5e98 100644
--- a/apps/www/content/docs/components/word-rotate.mdx
+++ b/apps/www/content/docs/components/word-rotate.mdx
@@ -48,11 +48,11 @@ npm install motion
## Usage
-```tsx
+```tsx showLineNumbers
import { WordRotate } from "@/components/magicui/word-rotate";
```
-```tsx
+```tsx showLineNumbers
<WordRotate words={["Word", "Rotate"]} />
```
diff --git a/apps/www/content/docs/installation/astro.mdx b/apps/www/content/docs/installation/astro.mdx
deleted file mode 100644
index 2f00984d..00000000
--- a/apps/www/content/docs/installation/astro.mdx
+++ /dev/null
@@ -1,133 +0,0 @@
----
-title: Astro
-description: Install and configure Astro.
----
-
-<Steps>
-
-### Create project
-
-Start by creating a new Astro project:
-
-```bash
-npm create astro@latest
-```
-
-### Configure your Astro project
-
-You will be asked a few questions to configure your project:
-
-```txt showLineNumbers
-- Where should we create your new project? ./your-app-name
-- How would you like to start your new project? Choose a template
-- Do you plan to write TypeScript? Yes
-- How strict should TypeScript be? Strict
-- Install dependencies? Yes
-- Initialize a new git repository? (optional) Yes/No
-```
-
-### Add React to your project
-
-Install React using the Astro CLI:
-
-```bash
-npx astro add react
-```
-
-<Callout className="mt-4">
-
-Answer `Yes` to all the question prompted by the CLI when installing React.
-
-</Callout>
-
-### Add Tailwind CSS to your project
-
-```bash
-npx astro add tailwind
-```
-
-<Step>Create a `styles/globals.css` file in the `src` folder.</Step>
-
-```css title="styles/globals.css" showLineNumbers
-@tailwind base;
-@tailwind components;
-@tailwind utilities;
-```
-
-<Step>Import the `globals.css` file</Step>
-
-Import the `styles/globals.css` file in the `src/pages/index.astro` file:
-
-```ts title="src/pages/index.astro" showLineNumbers
----
-import '@/styles/globals.css'
----
-```
-
-<Step>Update `astro.config.mjs` and set `applyBaseStyles` to `false`</Step>
-
-To prevent serving the Tailwind base styles twice, we need to tell Astro not to apply the base styles, since we already include them in our own `globals.css` file. To do this, set the `applyBaseStyles` config option for the tailwind plugin in `astro.config.mjs` to `false`.
-
-```js title="astro.config.mjs" {3-5} showLineNumbers
-export default defineConfig({
- integrations: [
- tailwind({
- applyBaseStyles: false,
- }),
- ],
-});
-```
-
-### Edit tsconfig.json file
-
-Add the following code to the `tsconfig.json` file to resolve paths:
-
-```ts title="tsconfig.json" {4-9} showLineNumbers
-{
- "compilerOptions": {
- // ...
- "baseUrl": ".",
- "paths": {
- "@/*": [
- "./src/*"
- ]
- }
- // ...
- }
-}
-```
-
-### Run the CLI
-
-Run the `shadcn` init command to setup your project:
-
-```bash
-npx shadcn@latest init
-```
-
-### That's it
-
-You can now start adding components to your project.
-
-```bash
-npx shadcn@latest add button
-```
-
-The command above will add the `Button` component to your project. You can then import it like this:
-
-```astro {2,10} showLineNumbers
----
-import { Button } from "@/components/ui/button"
----
-
-<html lang="en">
- <head>
- <title>Astro</title>
- </head>
- <body>
- <Button>Hello World</Button>
- </body>
-</html>
-```
-
-</Steps>
diff --git a/apps/www/content/docs/installation/gatsby.mdx b/apps/www/content/docs/installation/gatsby.mdx
deleted file mode 100644
index dee7226f..00000000
--- a/apps/www/content/docs/installation/gatsby.mdx
+++ /dev/null
@@ -1,120 +0,0 @@
----
-title: Gatsby
-description: Install and configure Gatsby.
----
-
-<Steps>
-
-### Create project
-
-Start by creating a new Gatsby project using `create-gatsby`:
-
-```bash
-npm init gatsby
-```
-
-### Configure your Gatsby project to use TypeScript and Tailwind CSS
-
-You will be asked a few questions to configure your project:
-
-```txt showLineNumbers
-✔ What would you like to call your site?
-· your-app-name
-✔ What would you like to name the folder where your site will be created?
-· your-app-name
-✔ Will you be using JavaScript or TypeScript?
-· TypeScript
-✔ Will you be using a CMS?
-· Choose whatever you want
-✔ Would you like to install a styling system?
-· Tailwind CSS
-✔ Would you like to install additional features with other plugins?
-· Choose whatever you want
-✔ Shall we do this? (Y/n) · Yes
-```
-
-### Edit tsconfig.json file
-
-Add the following code to the `tsconfig.json` file to resolve paths:
-
-```ts {4-9} showLineNumbers
-{
- "compilerOptions": {
- // ...
- "baseUrl": ".",
- "paths": {
- "@/*": [
- "./src/*"
- ]
- }
- // ...
- }
-}
-```
-
-### Create gatsby-node.ts file
-
-Create a `gatsby-node.ts` file at the root of your project if it doesn’t already exist, and add the code below to the `gatsby-node` file so your app can resolve paths:
-
-```ts
-import * as path from "path";
-
-export const onCreateWebpackConfig = ({ actions }) => {
- actions.setWebpackConfig({
- resolve: {
- alias: {
- "@/components": path.resolve(__dirname, "src/components"),
- "@/lib/utils": path.resolve(__dirname, "src/lib/utils"),
- },
- },
- });
-};
-```
-
-### Run the CLI
-
-Run the `shadcn-ui` init command to setup your project:
-
-```bash
-npx shadcn@latest init
-```
-
-### Configure components.json
-
-You will be asked a few questions to configure `components.json`:
-
-```txt showLineNumbers
-Would you like to use TypeScript (recommended)? no / yes
-Which style would you like to use? › Default
-Which color would you like to use as base color? › Slate
-Where is your global CSS file? › › ./src/styles/globals.css
-Do you want to use CSS variables for colors? › no / yes
-Where is your tailwind.config.js located? › tailwind.config.js
-Configure the import alias for components: › @/components
-Configure the import alias for utils: › @/lib/utils
-Are you using React Server Components? › no
-```
-
-### That's it
-
-You can now start adding components to your project.
-
-```bash
-npx shadcn@latest add button
-```
-
-The command above will add the `Button` component to your project. You can then import it like this:
-
-```tsx {1,6} showLineNumbers
-import { Button } from "@/components/ui/button";
-
-export default function Home() {
- return (
- <div>
- <Button>Click me</Button>
- </div>
- );
-}
-```
-
-</Steps>
diff --git a/apps/www/content/docs/installation/index.mdx b/apps/www/content/docs/installation/index.mdx
index 794ba5dc..3ede0e4b 100644
--- a/apps/www/content/docs/installation/index.mdx
+++ b/apps/www/content/docs/installation/index.mdx
@@ -1,6 +1,7 @@
---
title: Installation
description: How to install dependencies and structure your app.
+date: 2025-09-16
---
<Callout>
diff --git a/apps/www/content/docs/installation/laravel.mdx b/apps/www/content/docs/installation/laravel.mdx
deleted file mode 100644
index d3178ae0..00000000
--- a/apps/www/content/docs/installation/laravel.mdx
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: Laravel
-description: Install and configure Laravel with Inertia
----
-
-<Steps>
-
-### Create project
-
-Start by creating a new Laravel project with Inertia and React using the laravel installer `laravel new my-app`:
-
-```bash
-laravel new my-app --typescript --breeze --stack=react --git --no-interaction
-```
-
-### Run the CLI
-
-Run the `shadcn` init command to setup your project:
-
-```bash
-npx shadcn@latest init
-```
-
-### Configure components.json
-
-You will be asked a few questions to configure `components.json`:
-
-```txt showLineNumbers
-Which style would you like to use?
-Which color would you like to use as base color?
-Do you want to use CSS variables for colors? › yes
-```
-
-### That's it
-
-You can now start adding components to your project.
-
-```bash
-npx shadcn@latest add button
-```
-
-The command above will add the `Button` component to your project. You can then import it like this:
-
-```tsx {1,6} showLineNumbers
-import { Button } from "@/Components/ui/button";
-
-export default function Home() {
- return (
- <div>
- <Button>Click me</Button>
- </div>
- );
-}
-```
-
-</Steps>
diff --git a/apps/www/content/docs/installation/manual.mdx b/apps/www/content/docs/installation/manual.mdx
deleted file mode 100644
index 24bb112d..00000000
--- a/apps/www/content/docs/installation/manual.mdx
+++ /dev/null
@@ -1,245 +0,0 @@
----
-title: Manual Installation
-description: Add dependencies to your project manually.
----
-
-<Steps>
-
-### Add Tailwind CSS
-
-Components are styled using Tailwind CSS. You need to install Tailwind CSS in your project.
-
-[Follow the Tailwind CSS installation instructions to get started.](https://tailwindcss.com/docs/installation)
-
-### Add dependencies
-
-Add the following dependencies to your project:
-
-```bash
-npm install tailwindcss-animate class-variance-authority clsx tailwind-merge
-```
-
-### Add icon library
-
-If you're using the `default` style, install `lucide-react`:
-
-```bash
-npm install lucide-react
-```
-
-If you're using the `new-york` style, install `@radix-ui/react-icons`:
-
-```bash
-npm install @radix-ui/react-icons
-```
-
-### Configure path aliases
-
-I use the `@` alias. This is how I configure it in tsconfig.json:
-
-```json {3-6} title="tsconfig.json"
-{
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["./*"]
- }
- }
-}
-```
-
-The `@` alias is a preference. You can use other aliases if you want.
-
-**If you use a different alias such as ~, you'll need to update import statements when adding components.**
-
-### Configure tailwind.config.js
-
-Here's what my `tailwind.config.js` file looks like:
-
-```js title="tailwind.config.js"
-const { fontFamily } = require("tailwindcss/defaultTheme");
-
-/** @type {import('tailwindcss').Config} */
-module.exports = {
- darkMode: ["class"],
- content: ["app/**/*.{ts,tsx}", "components/**/*.{ts,tsx}"],
- theme: {
- container: {
- center: true,
- padding: "2rem",
- screens: {
- "2xl": "1400px",
- },
- },
- extend: {
- colors: {
- border: "hsl(var(--border))",
- input: "hsl(var(--input))",
- ring: "hsl(var(--ring))",
- background: "hsl(var(--background))",
- foreground: "hsl(var(--foreground))",
- primary: {
- DEFAULT: "hsl(var(--primary))",
- foreground: "hsl(var(--primary-foreground))",
- },
- secondary: {
- DEFAULT: "hsl(var(--secondary))",
- foreground: "hsl(var(--secondary-foreground))",
- },
- destructive: {
- DEFAULT: "hsl(var(--destructive))",
- foreground: "hsl(var(--destructive-foreground))",
- },
- muted: {
- DEFAULT: "hsl(var(--muted))",
- foreground: "hsl(var(--muted-foreground))",
- },
- accent: {
- DEFAULT: "hsl(var(--accent))",
- foreground: "hsl(var(--accent-foreground))",
- },
- popover: {
- DEFAULT: "hsl(var(--popover))",
- foreground: "hsl(var(--popover-foreground))",
- },
- card: {
- DEFAULT: "hsl(var(--card))",
- foreground: "hsl(var(--card-foreground))",
- },
- },
- borderRadius: {
- lg: `var(--radius)`,
- md: `calc(var(--radius) - 2px)`,
- sm: "calc(var(--radius) - 4px)",
- },
- fontFamily: {
- sans: ["var(--font-sans)", ...fontFamily.sans],
- },
- keyframes: {
- "accordion-down": {
- from: { height: "0" },
- to: { height: "var(--radix-accordion-content-height)" },
- },
- "accordion-up": {
- from: { height: "var(--radix-accordion-content-height)" },
- to: { height: "0" },
- },
- },
- animation: {
- "accordion-down": "accordion-down 0.2s ease-out",
- "accordion-up": "accordion-up 0.2s ease-out",
- },
- },
- },
- plugins: [require("tailwindcss-animate")],
-};
-```
-
-### Configure styles
-
-Add the following to your styles/globals.css file. You can learn more about using CSS variables for theming in the [theming section](/docs/theming).
-
-```css title="globals.css"
-@tailwind base;
-@tailwind components;
-@tailwind utilities;
-
-@layer base {
- :root {
- --background: 0 0% 100%;
- --foreground: 222.2 47.4% 11.2%;
-
- --muted: 210 40% 96.1%;
- --muted-foreground: 215.4 16.3% 46.9%;
-
- --popover: 0 0% 100%;
- --popover-foreground: 222.2 47.4% 11.2%;
-
- --border: 214.3 31.8% 91.4%;
- --input: 214.3 31.8% 91.4%;
-
- --card: 0 0% 100%;
- --card-foreground: 222.2 47.4% 11.2%;
-
- --primary: 222.2 47.4% 11.2%;
- --primary-foreground: 210 40% 98%;
-
- --secondary: 210 40% 96.1%;
- --secondary-foreground: 222.2 47.4% 11.2%;
-
- --accent: 210 40% 96.1%;
- --accent-foreground: 222.2 47.4% 11.2%;
-
- --destructive: 0 100% 50%;
- --destructive-foreground: 210 40% 98%;
-
- --ring: 215 20.2% 65.1%;
-
- --radius: 0.5rem;
- }
-
- .dark {
- --background: 224 71% 4%;
- --foreground: 213 31% 91%;
-
- --muted: 223 47% 11%;
- --muted-foreground: 215.4 16.3% 56.9%;
-
- --accent: 216 34% 17%;
- --accent-foreground: 210 40% 98%;
-
- --popover: 224 71% 4%;
- --popover-foreground: 215 20.2% 65.1%;
-
- --border: 216 34% 17%;
- --input: 216 34% 17%;
-
- --card: 224 71% 4%;
- --card-foreground: 213 31% 91%;
-
- --primary: 210 40% 98%;
- --primary-foreground: 222.2 47.4% 1.2%;
-
- --secondary: 222.2 47.4% 11.2%;
- --secondary-foreground: 210 40% 98%;
-
- --destructive: 0 63% 31%;
- --destructive-foreground: 210 40% 98%;
-
- --ring: 216 34% 17%;
-
- --radius: 0.5rem;
- }
-}
-
-@layer base {
- * {
- @apply border-border;
- }
- body {
- @apply bg-background text-foreground;
- font-feature-settings:
- "rlig" 1,
- "calt" 1;
- }
-}
-```
-
-### Add a cn helper
-
-I use a `cn` helper to make it easier to conditionally add Tailwind CSS classes. Here's how I define it in `lib/utils.ts`:
-
-```ts title="lib/utils.ts"
-import { clsx, type ClassValue } from "clsx";
-import { twMerge } from "tailwind-merge";
-
-export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs));
-}
-```
-
-### That's it
-
-You can now start adding components to your project.
-
-</Steps>
diff --git a/apps/www/content/docs/installation/next.mdx b/apps/www/content/docs/installation/next.mdx
deleted file mode 100644
index 57642f2e..00000000
--- a/apps/www/content/docs/installation/next.mdx
+++ /dev/null
@@ -1,58 +0,0 @@
----
-title: Next.js
-description: Install and configure Next.js.
----
-
-<Steps>
-
-### Create project
-
-Run the `init` command to create a new Next.js project or to setup an existing one:
-
-```bash
-npx shadcn@latest init
-```
-
-<Callout className="mt-4">
-
-You can use the `-d` flag for defaults i.e `new-york`, `zinc` and `yes` for the css variables.
-
-```bash
-npx shadcn@latest init -d
-```
-
-</Callout>
-
-### Configure components.json
-
-You will be asked a few questions to configure `components.json`:
-
-```txt showLineNumbers
-Which style would you like to use? › New York
-Which color would you like to use as base color? › Zinc
-Do you want to use CSS variables for colors? › no / yes
-```
-
-### That's it
-
-You can now start adding components to your project.
-
-```bash
-npx shadcn@latest add button
-```
-
-The command above will add the `Button` component to your project. You can then import it like this:
-
-```tsx {1,6} showLineNumbers
-import { Button } from "@/components/ui/button";
-
-export default function Home() {
- return (
- <div>
- <Button>Click me</Button>
- </div>
- );
-}
-```
-
-</Steps>
diff --git a/apps/www/content/docs/installation/remix.mdx b/apps/www/content/docs/installation/remix.mdx
deleted file mode 100644
index 642f9b33..00000000
--- a/apps/www/content/docs/installation/remix.mdx
+++ /dev/null
@@ -1,111 +0,0 @@
----
-title: Remix
-description: Install and configure Remix.
----
-
-<Steps>
-
-### Create project
-
-Start by creating a new Remix project using `create-remix`:
-
-```bash
-npx create-remix@latest my-app
-```
-
-### Run the CLI
-
-Run the `shadcn-ui` init command to setup your project:
-
-```bash
-npx shadcn@latest init
-```
-
-### Configure components.json
-
-You will be asked a few questions to configure `components.json`:
-
-```txt showLineNumbers
-Which style would you like to use? › New York
-Which color would you like to use as base color? › Zinc
-Do you want to use CSS variables for colors? › no / yes
-```
-
-### App structure
-
-<Callout>
-
-**Note**: This app structure is only a suggestion. You can place the files wherever you want.
-
-</Callout>
-
-- Place the UI components in the `app/components/ui` folder.
-- Your own components can be placed in the `app/components` folder.
-- The `app/lib` folder contains all the utility functions. We have a `utils.ts` where we define the `cn` helper.
-- The `app/tailwind.css` file contains the global CSS.
-
-### Install Tailwind CSS
-
-```bash
-npm add -D tailwindcss@latest autoprefixer@latest
-```
-
-Then we create a `postcss.config.js` file:
-
-```js
-export default {
- plugins: {
- tailwindcss: {},
- autoprefixer: {},
- },
-};
-```
-
-And finally we add the following to our `remix.config.js` file:
-
-```js {4-5}
-/** @type {import('@remix-run/dev').AppConfig} */
-export default {
- ...
- tailwind: true,
- postcss: true,
- ...
-};
-```
-
-### Add `tailwind.css` to your app
-
-In your `app/root.tsx` file, import the `tailwind.css` file:
-
-```js {1, 4}
-import styles from "./tailwind.css?url";
-
-export const links: LinksFunction = () => [
- { rel: "stylesheet", href: styles },
- ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
-];
-```
-
-### That's it
-
-You can now start adding components to your project.
-
-```bash
-npx shadcn@latest add button
-```
-
-The command above will add the `Button` component to your project. You can then import it like this:
-
-```tsx {1,6} showLineNumbers
-import { Button } from "~/components/ui/button";
-
-export default function Home() {
- return (
- <div>
- <Button>Click me</Button>
- </div>
- );
-}
-```
-
-</Steps>
diff --git a/apps/www/content/docs/installation/vite.mdx b/apps/www/content/docs/installation/vite.mdx
deleted file mode 100644
index 6264f562..00000000
--- a/apps/www/content/docs/installation/vite.mdx
+++ /dev/null
@@ -1,135 +0,0 @@
----
-title: Vite
-description: Install and configure Vite.
----
-
-<Steps>
-
-### Create project
-
-Start by creating a new React project using `vite`:
-
-```bash
-npm create vite@latest
-```
-
-### Add Tailwind and its configuration
-
-Install `tailwindcss` and its peer dependencies, then generate your `tailwind.config.js` and `postcss.config.js` files:
-
-```bash
-npm install -D tailwindcss postcss autoprefixer
-
-npx tailwindcss init -p
-```
-
-### Edit tsconfig.json file
-
-The current version of Vite splits TypeScript configuration into three files, two of which need to be edited.
-Add the `baseUrl` and `paths` properties to the `compilerOptions` section of the `tsconfig.json` and
-`tsconfig.app.json` files:
-
-```ts {11-16} showLineNumbers
-{
- "files": [],
- "references": [
- {
- "path": "./tsconfig.app.json"
- },
- {
- "path": "./tsconfig.node.json"
- }
- ],
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["./src/*"]
- }
- }
-}
-```
-
-### Edit tsconfig.app.json file
-
-Add the following code to the `tsconfig.app.json` file to resolve paths, for your IDE:
-
-```ts {4-9} showLineNumbers
-{
- "compilerOptions": {
- // ...
- "baseUrl": ".",
- "paths": {
- "@/*": [
- "./src/*"
- ]
- }
- // ...
- }
-}
-```
-
-### Update vite.config.ts
-
-Add the following code to the vite.config.ts so your app can resolve paths without error
-
-```bash
-# (so you can import "path" without error)
-npm i -D @types/node
-```
-
-```typescript
-import path from "path";
-import react from "@vitejs/plugin-react";
-import { defineConfig } from "vite";
-
-export default defineConfig({
- plugins: [react()],
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "./src"),
- },
- },
-});
-```
-
-### Run the CLI
-
-Run the `shadcn-ui` init command to setup your project:
-
-```bash
-npx shadcn@latest init
-```
-
-### Configure components.json
-
-You will be asked a few questions to configure `components.json`:
-
-```txt showLineNumbers
-Which style would you like to use? › New York
-Which color would you like to use as base color? › Zinc
-Do you want to use CSS variables for colors? › no / yes
-```
-
-### That's it
-
-You can now start adding components to your project.
-
-```bash
-npx shadcn@latest add button
-```
-
-The command above will add the `Button` component to your project. You can then import it like this:
-
-```tsx {1,6} showLineNumbers
-import { Button } from "@/components/ui/button";
-
-export default function Home() {
- return (
- <div>
- <Button>Click me</Button>
- </div>
- );
-}
-```
-
-</Steps>
diff --git a/apps/www/content/docs/story.mdx b/apps/www/content/docs/story.mdx
index fe5f997c..4601ee44 100644
--- a/apps/www/content/docs/story.mdx
+++ b/apps/www/content/docs/story.mdx
@@ -1,7 +1,8 @@
---
title: Story
description: Learn about how Magic UI started
-published: false
+published: true
+date: 2023-06-26
---
Magic UI started because of an annoying problem I faced in the summer of 2023.
@@ -14,7 +15,7 @@ I was trying to make landing pages like https://linear.app, https://wope.com and
That same week I tweeted that I would just build it myself.
-<Tweet id="1668408059125702661" />
+<Tweet id="1668408059125702661" className="mt-4" />
This tweet immediately went viral and it seemed like there were others like me who resonated!
@@ -22,7 +23,7 @@ I started building the foundations of this site as well as a few components and
People seem to love it and we're just getting started.
-<div className="columns-3 gap-4 [&>*]:mb-4">
+<div className="columns-3 gap-4 [&>*]:mb-4 mt-4">
<Tweet id="1722659583464968612" />
<Tweet id="1668442365625790465" />
<Tweet id="1684613797984800768" />
diff --git a/apps/www/content/pages/home.mdx b/apps/www/content/pages/home.mdx
deleted file mode 100644
index 94fd2bdc..00000000
--- a/apps/www/content/pages/home.mdx
+++ /dev/null
@@ -1,26 +0,0 @@
----
-title: Components
-description: A collection of components that are used to build the landing page of a website.
----
-
-<ComponentPreview name="bento-demo" preview />
-<ComponentPreview name="marquee-demo" preview />
-<ComponentPreview name="marquee-demo-vertical" preview />
-<ComponentPreview name="animated-list-demo" preview />
-<ComponentPreview name="animated-beam-demo" preview />
-<ComponentPreview name="animated-beam-multiple-inputs" preview />
-<ComponentPreview name="animated-beam-multiple-outputs" preview />
-<ComponentPreview name="border-beam-demo" preview />
-<ComponentPreview name="border-beam-demo-2" preview />
-<ComponentPreview name="border-beam-demo-3" preview />
-<ComponentPreview name="border-beam-demo-4" preview />
-<ComponentPreview name="shine-border-demo" preview />
-<ComponentPreview name="magic-card-demo" preview />
-<ComponentPreview name="dock-demo" preview />
-<ComponentPreview name="particles-demo" preview />
-<ComponentPreview name="blur-fade-demo" preview />
-<ComponentPreview name="blur-fade-text-demo" preview />
-<ComponentPreview name="retro-grid-demo" preview />
-<ComponentPreview name="orbiting-circles-demo" preview />
-<ComponentPreview name="ripple-demo" preview />
-<ComponentPreview name="confetti-demo" preview />
diff --git a/apps/www/content/pages/privacy.mdx b/apps/www/content/pages/privacy.mdx
deleted file mode 100644
index 9a6e32e3..00000000
--- a/apps/www/content/pages/privacy.mdx
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Privacy
-description: The Privacy Policy for Magic UI
----
diff --git a/apps/www/content/pages/terms.mdx b/apps/www/content/pages/terms.mdx
deleted file mode 100644
index 1aa145f1..00000000
--- a/apps/www/content/pages/terms.mdx
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Terms & Conditions
-description: Read our terms and conditions
----
diff --git a/apps/www/hooks/use-config.ts b/apps/www/hooks/use-config.ts
index 57c1d44a..f356f91c 100644
--- a/apps/www/hooks/use-config.ts
+++ b/apps/www/hooks/use-config.ts
@@ -3,10 +3,12 @@ import { atomWithStorage } from "jotai/utils";
type Config = {
packageManager: "npm" | "yarn" | "pnpm" | "bun";
+ installationType: "cli" | "manual";
};
const configAtom = atomWithStorage<Config>("config", {
packageManager: "pnpm",
+ installationType: "cli",
});
export function useConfig() {
diff --git a/apps/www/hooks/use-is-mac.ts b/apps/www/hooks/use-is-mac.ts
new file mode 100644
index 00000000..655ddbad
--- /dev/null
+++ b/apps/www/hooks/use-is-mac.ts
@@ -0,0 +1,11 @@
+import { useEffect, useState } from "react";
+
+export function useIsMac() {
+ const [isMac, setIsMac] = useState(true);
+
+ useEffect(() => {
+ setIsMac(navigator.platform.toUpperCase().includes("MAC"));
+ }, []);
+
+ return isMac;
+}
diff --git a/apps/www/hooks/use-meta-color.ts b/apps/www/hooks/use-meta-color.ts
new file mode 100644
index 00000000..cffaf749
--- /dev/null
+++ b/apps/www/hooks/use-meta-color.ts
@@ -0,0 +1,28 @@
+import * as React from "react";
+import { useTheme } from "next-themes";
+
+export const META_THEME_COLORS = {
+ light: "#ffffff",
+ dark: "#0a0a0a",
+};
+
+export function useMetaColor() {
+ const { resolvedTheme } = useTheme();
+
+ const metaColor = React.useMemo(() => {
+ return resolvedTheme !== "dark"
+ ? META_THEME_COLORS.light
+ : META_THEME_COLORS.dark;
+ }, [resolvedTheme]);
+
+ const setMetaColor = React.useCallback((color: string) => {
+ document
+ .querySelector('meta[name="theme-color"]')
+ ?.setAttribute("content", color);
+ }, []);
+
+ return {
+ metaColor,
+ setMetaColor,
+ };
+}
diff --git a/apps/www/hooks/use-mobile.ts b/apps/www/hooks/use-mobile.ts
new file mode 100644
index 00000000..a93d5839
--- /dev/null
+++ b/apps/www/hooks/use-mobile.ts
@@ -0,0 +1,21 @@
+import * as React from "react";
+
+const MOBILE_BREAKPOINT = 768;
+
+export function useIsMobile() {
+ const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
+ undefined,
+ );
+
+ React.useEffect(() => {
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
+ const onChange = () => {
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+ };
+ mql.addEventListener("change", onChange);
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+ return () => mql.removeEventListener("change", onChange);
+ }, []);
+
+ return !!isMobile;
+}
diff --git a/apps/www/hooks/use-mutation-observer.ts b/apps/www/hooks/use-mutation-observer.ts
new file mode 100644
index 00000000..59894201
--- /dev/null
+++ b/apps/www/hooks/use-mutation-observer.ts
@@ -0,0 +1,20 @@
+import * as React from "react";
+
+export const useMutationObserver = (
+ ref: React.RefObject<HTMLElement | null>,
+ callback: MutationCallback,
+ options: MutationObserverInit = {
+ attributes: true,
+ characterData: true,
+ childList: true,
+ subtree: true,
+ },
+) => {
+ React.useEffect(() => {
+ if (ref.current) {
+ const observer = new MutationObserver(callback);
+ observer.observe(ref.current, options);
+ return () => observer.disconnect();
+ }
+ }, [ref, callback, options]);
+};
diff --git a/apps/www/lib/docs.ts b/apps/www/lib/docs.ts
new file mode 100644
index 00000000..e412ff73
--- /dev/null
+++ b/apps/www/lib/docs.ts
@@ -0,0 +1,38 @@
+import { getRegistryItem } from "@/lib/registry";
+
+/**
+ * Replaces ComponentSource tags in content with actual source code from the registry.
+ *
+ * This function searches for `<ComponentSource name="XXXXX" ... >` tags in the provided
+ * content and replaces them with formatted code blocks containing the actual source code
+ * from the component registry.
+ *
+ * @param content - The content string containing ComponentSource tags to be replaced
+ * @returns A promise that resolves to the content with ComponentSource tags replaced by actual source code
+ *
+ * @example
+ * ```typescript
+ * const content = '<ComponentSource name="button" />';
+ * const result = await replaceComponentSource(content);
+ * // Returns: ```tsx\n[actual button component source code]\n```
+ * ```
+ */
+
+export const replaceComponentSource = async (content: string) => {
+ // Replace <ComponentSource name="XXXXX" ... > with actual source code
+ const componentSourceMatches = [
+ ...content.matchAll(/<ComponentSource\s+name="([^"]+)"[^>]*>/g),
+ ];
+ for (const [fullMatch, name] of componentSourceMatches) {
+ const component = await getRegistryItem(name);
+ if (component?.files?.[0]?.content) {
+ const sourceCode = component.files[0].content;
+ const replacement = `\`\`\`tsx\n${sourceCode}\n\`\`\``;
+ content = content.replace(fullMatch, replacement);
+ } else {
+ content = content.replace(fullMatch, fullMatch);
+ }
+ }
+
+ return content;
+};
diff --git a/apps/www/lib/events.ts b/apps/www/lib/events.ts
index 4bdc4ab2..7d8ff542 100644
--- a/apps/www/lib/events.ts
+++ b/apps/www/lib/events.ts
@@ -6,12 +6,23 @@ const eventSchema = z.object({
"copy_npm_command",
"copy_usage_code",
"copy_source_code",
- // "copy_primitive_code",
- // "copy_theme_code",
+ "set_layout",
+ "template_agent_clicked",
+ "template_devtool_clicked",
+ "template_mobile_clicked",
+ "template_saas_clicked",
+ "template_startup_clicked",
+ "template_portfolio_clicked",
+ "template_marketing_clicked",
+ "template_changelog_clicked",
+
+ "sidebar_cta_clicked",
]),
- // declare type AllowedPropertyValues = string | number | boolean | null
properties: z
- .record(z.union([z.string(), z.number(), z.boolean(), z.null()]))
+ .record(
+ z.string(),
+ z.union([z.string(), z.number(), z.boolean(), z.null()]),
+ )
.optional(),
});
diff --git a/apps/www/lib/fonts.ts b/apps/www/lib/fonts.ts
index 4e3a14b7..52ac214f 100644
--- a/apps/www/lib/fonts.ts
+++ b/apps/www/lib/fonts.ts
@@ -1,6 +1,29 @@
-import { GeistSans } from "geist/font/sans";
-import { GeistMono } from "geist/font/mono";
+import {
+ Geist_Mono as FontMono,
+ Geist as FontSans,
+ Inter,
+} from "next/font/google";
-export const fontSans = GeistSans;
+import { cn } from "@/lib/utils";
-export const fontMono = GeistMono;
+const fontSans = FontSans({
+ subsets: ["latin"],
+ variable: "--font-sans",
+});
+
+const fontMono = FontMono({
+ subsets: ["latin"],
+ variable: "--font-mono",
+ weight: ["400"],
+});
+
+const fontInter = Inter({
+ subsets: ["latin"],
+ variable: "--font-inter",
+});
+
+export const fontVariables = cn(
+ fontSans.variable,
+ fontMono.variable,
+ fontInter.variable,
+);
diff --git a/apps/www/lib/highlight-code.ts b/apps/www/lib/highlight-code.ts
new file mode 100644
index 00000000..55cc5043
--- /dev/null
+++ b/apps/www/lib/highlight-code.ts
@@ -0,0 +1,89 @@
+import { codeToHtml } from "shiki";
+import type { ShikiTransformer } from "shiki";
+
+export const transformers = [
+ {
+ code(node) {
+ if (node.tagName === "code") {
+ const raw = this.source;
+ node.properties["__raw__"] = raw;
+
+ if (raw.startsWith("npm install")) {
+ node.properties["__npm__"] = raw;
+ node.properties["__yarn__"] = raw.replace("npm install", "yarn add");
+ node.properties["__pnpm__"] = raw.replace("npm install", "pnpm add");
+ node.properties["__bun__"] = raw.replace("npm install", "bun add");
+ }
+
+ if (raw.startsWith("npx create-")) {
+ node.properties["__npm__"] = raw;
+ node.properties["__yarn__"] = raw.replace(
+ "npx create-",
+ "yarn create ",
+ );
+ node.properties["__pnpm__"] = raw.replace(
+ "npx create-",
+ "pnpm create ",
+ );
+ node.properties["__bun__"] = raw.replace("npx", "bunx --bun");
+ }
+
+ // npm create.
+ if (raw.startsWith("npm create")) {
+ node.properties["__npm__"] = raw;
+ node.properties["__yarn__"] = raw.replace(
+ "npm create",
+ "yarn create",
+ );
+ node.properties["__pnpm__"] = raw.replace(
+ "npm create",
+ "pnpm create",
+ );
+ node.properties["__bun__"] = raw.replace("npm create", "bun create");
+ }
+
+ // npx.
+ if (raw.startsWith("npx")) {
+ node.properties["__npm__"] = raw;
+ node.properties["__yarn__"] = raw.replace("npx", "yarn");
+ node.properties["__pnpm__"] = raw.replace("npx", "pnpm dlx");
+ node.properties["__bun__"] = raw.replace("npx", "bunx --bun");
+ }
+
+ // npm run.
+ if (raw.startsWith("npm run")) {
+ node.properties["__npm__"] = raw;
+ node.properties["__yarn__"] = raw.replace("npm run", "yarn");
+ node.properties["__pnpm__"] = raw.replace("npm run", "pnpm");
+ node.properties["__bun__"] = raw.replace("npm run", "bun");
+ }
+ }
+ },
+ },
+] as ShikiTransformer[];
+
+export async function highlightCode(code: string, language: string = "tsx") {
+ const html = await codeToHtml(code, {
+ lang: language,
+ themes: {
+ dark: "github-dark",
+ light: "github-light",
+ },
+ transformers: [
+ {
+ pre(node) {
+ node.properties["class"] =
+ "no-scrollbar min-w-0 overflow-x-auto px-4 py-3.5 outline-none has-[[data-highlighted-line]]:px-0 has-[[data-line-numbers]]:px-0 has-[[data-slot=tabs]]:p-0 !bg-transparent";
+ },
+ code(node) {
+ node.properties["data-line-numbers"] = "";
+ },
+ line(node) {
+ node.properties["data-line"] = "";
+ },
+ },
+ ],
+ });
+
+ return html;
+}
diff --git a/apps/www/lib/octokit.ts b/apps/www/lib/octokit.ts
deleted file mode 100644
index df0028cf..00000000
--- a/apps/www/lib/octokit.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { Octokit } from "octokit";
-
-export const octokit = new Octokit({
- auth: process.env.GITHUB_ACCESS_TOKEN,
-});
diff --git a/apps/www/lib/registry.ts b/apps/www/lib/registry.ts
new file mode 100644
index 00000000..90ec9635
--- /dev/null
+++ b/apps/www/lib/registry.ts
@@ -0,0 +1,216 @@
+// @ts-nocheck - Temporary disable type checking because of zod 4 type inference with z.infer.
+
+import fs from "node:fs/promises";
+import { tmpdir } from "os";
+import path from "path";
+import { registryItemFileSchema, registryItemSchema } from "shadcn/schema";
+import { Project, ScriptKind } from "ts-morph";
+import { z } from "zod";
+
+import { Index } from "@/__registry__/index";
+
+export function getRegistryComponent(name: string) {
+ return Index[name]?.component;
+}
+
+export async function getRegistryItem(name: string) {
+ const item = Index[name];
+
+ if (!item) {
+ return null;
+ }
+
+ // Convert all file paths to object.
+ // TODO: remove when we migrate to new registry.
+ item.files = item.files.map((file: unknown) =>
+ typeof file === "string" ? { path: file } : file,
+ );
+
+ // Fail early before doing expensive file operations.
+ const result = registryItemSchema.safeParse(item);
+ if (!result.success) {
+ return null;
+ }
+
+ let files: typeof result.data.files = [];
+ for (const file of item.files) {
+ const content = await getFileContent(file);
+ const relativePath = path.relative(process.cwd(), file.path);
+
+ files.push({
+ ...file,
+ path: relativePath,
+ content,
+ });
+ }
+
+ // Fix file paths.
+ files = fixFilePaths(files);
+
+ const parsed = registryItemSchema.safeParse({
+ ...result.data,
+ files,
+ });
+
+ if (!parsed.success) {
+ console.error(parsed.error.message);
+ return null;
+ }
+
+ return parsed.data;
+}
+
+async function getFileContent(file: z.infer<typeof registryItemFileSchema>) {
+ const raw = await fs.readFile(file.path, "utf-8");
+
+ const project = new Project({
+ compilerOptions: {},
+ });
+
+ const tempFile = await createTempSourceFile(file.path);
+ const sourceFile = project.createSourceFile(tempFile, raw, {
+ scriptKind: ScriptKind.TSX,
+ });
+
+ // Remove meta variables.
+ // removeVariable(sourceFile, "iframeHeight")
+ // removeVariable(sourceFile, "containerClassName")
+ // removeVariable(sourceFile, "description")
+
+ let code = sourceFile.getFullText();
+
+ // Some registry items uses default export.
+ // We want to use named export instead.
+ // TODO: do we really need this? - @shadcn.
+ if (file.type !== "registry:page") {
+ code = code.replaceAll("export default", "export");
+ }
+
+ // Fix imports.
+ code = fixImport(code);
+
+ return code;
+}
+
+function getFileTarget(file: z.infer<typeof registryItemFileSchema>) {
+ let target = file.target;
+
+ if (!target || target === "") {
+ const fileName = file.path.split("/").pop();
+ if (
+ file.type === "registry:block" ||
+ file.type === "registry:component" ||
+ file.type === "registry:example"
+ ) {
+ target = `components/${fileName}`;
+ }
+
+ if (file.type === "registry:ui") {
+ target = `components/ui/${fileName}`;
+ }
+
+ if (file.type === "registry:hook") {
+ target = `hooks/${fileName}`;
+ }
+
+ if (file.type === "registry:lib") {
+ target = `lib/${fileName}`;
+ }
+ }
+
+ return target ?? "";
+}
+
+async function createTempSourceFile(filename: string) {
+ const dir = await fs.mkdtemp(path.join(tmpdir(), "shadcn-"));
+ return path.join(dir, filename);
+}
+
+function fixFilePaths(files: z.infer<typeof registryItemSchema>["files"]) {
+ if (!files) {
+ return [];
+ }
+
+ // Resolve all paths relative to the first file's directory.
+ const firstFilePath = files[0].path;
+ const firstFilePathDir = path.dirname(firstFilePath);
+
+ return files.map((file) => {
+ return {
+ ...file,
+ path: path.relative(firstFilePathDir, file.path),
+ target: getFileTarget(file),
+ };
+ });
+}
+
+export function fixImport(content: string) {
+ const regex = /@\/(.+?)\/((?:.*?\/)?(?:components|ui|hooks|lib))\/([\w-]+)/g;
+
+ const replacement = (
+ match: string,
+ path: string,
+ type: string,
+ component: string,
+ ) => {
+ if (type.endsWith("components")) {
+ return `@/components/${component}`;
+ } else if (type.endsWith("ui")) {
+ return `@/components/ui/${component}`;
+ } else if (type.endsWith("hooks")) {
+ return `@/hooks/${component}`;
+ } else if (type.endsWith("lib")) {
+ return `@/lib/${component}`;
+ }
+
+ return match;
+ };
+
+ return content.replace(regex, replacement);
+}
+
+export type FileTree = {
+ name: string;
+ path?: string;
+ children?: FileTree[];
+};
+
+export function createFileTreeForRegistryItemFiles(
+ files: Array<{ path: string; target?: string }>,
+) {
+ const root: FileTree[] = [];
+
+ for (const file of files) {
+ const path = file.target ?? file.path;
+ const parts = path.split("/");
+ let currentLevel = root;
+
+ for (let i = 0; i < parts.length; i++) {
+ const part = parts[i];
+ const isFile = i === parts.length - 1;
+ const existingNode = currentLevel.find((node) => node.name === part);
+
+ if (existingNode) {
+ if (isFile) {
+ // Update existing file node with full path
+ existingNode.path = path;
+ } else {
+ // Move to next level in the tree
+ currentLevel = existingNode.children!;
+ }
+ } else {
+ const newNode: FileTree = isFile
+ ? { name: part, path }
+ : { name: part, children: [] };
+
+ currentLevel.push(newNode);
+
+ if (!isFile) {
+ currentLevel = newNode.children!;
+ }
+ }
+ }
+ }
+
+ return root;
+}
diff --git a/apps/www/lib/source.ts b/apps/www/lib/source.ts
new file mode 100644
index 00000000..fc247c25
--- /dev/null
+++ b/apps/www/lib/source.ts
@@ -0,0 +1,17 @@
+import { blog, docs, showcase } from "@/.source";
+import { loader } from "fumadocs-core/source";
+
+export const source: ReturnType<typeof loader> = loader({
+ baseUrl: "/docs",
+ source: docs.toFumadocsSource(),
+});
+
+export const blogSource: ReturnType<typeof loader> = loader({
+ baseUrl: "/blog",
+ source: blog.toFumadocsSource(),
+});
+
+export const showcaseSource: ReturnType<typeof loader> = loader({
+ baseUrl: "/showcase",
+ source: showcase.toFumadocsSource(),
+});
diff --git a/apps/www/lib/toc.ts b/apps/www/lib/toc.ts
deleted file mode 100644
index bf540207..00000000
--- a/apps/www/lib/toc.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { toc } from "mdast-util-toc";
-import { remark } from "remark";
-import { visit } from "unist-util-visit";
-
-const textTypes = ["text", "emphasis", "strong", "inlineCode"];
-
-function flattenNode(node: any) {
- const p: any[] = [];
- visit(node, (node) => {
- if (!textTypes.includes(node.type)) return;
- p.push(node.value);
- });
- return p.join(``);
-}
-
-interface Item {
- title: string;
- url: string;
- items?: Item[];
-}
-
-interface Items {
- items?: Item[];
-}
-
-function getItems(node: any, current: any): Items {
- if (!node) {
- return {};
- }
-
- if (node.type === "paragraph") {
- visit(node, (item) => {
- if (item.type === "link") {
- current.url = item.url;
- current.title = flattenNode(node);
- }
-
- if (item.type === "text") {
- current.title = flattenNode(node);
- }
- });
-
- return current;
- }
-
- if (node.type === "list") {
- current.items = node.children.map((i: any) => getItems(i, {}));
-
- return current;
- } else if (node.type === "listItem") {
- const heading = getItems(node.children[0], {});
-
- if (node.children.length > 1) {
- getItems(node.children[1], heading);
- }
-
- return heading;
- }
-
- return {};
-}
-
-const getToc = () => (node: any, file: any) => {
- const table = toc(node);
- file.data = getItems(table.map, {});
-};
-
-export type TableOfContents = Items;
-
-export async function getTableOfContents(
- content: string,
-): Promise<TableOfContents> {
- const result = await remark().use(getToc).process(content);
-
- return result.data as TableOfContents;
-}
diff --git a/apps/www/mdx-components.tsx b/apps/www/mdx-components.tsx
new file mode 100644
index 00000000..7756766c
--- /dev/null
+++ b/apps/www/mdx-components.tsx
@@ -0,0 +1,362 @@
+import * as React from "react";
+import Image from "next/image";
+import Link from "next/link";
+
+import { cn } from "@/lib/utils";
+import { Callout } from "@/components/callout";
+import { CodeBlockCommand } from "@/components/code-block-command";
+import { CodeCollapsibleWrapper } from "@/components/code-collapsible-wrapper";
+import { CodeTabs } from "@/components/code-tabs";
+import { ComponentPreview } from "@/components/component-preview";
+import { ComponentSource } from "@/components/component-source";
+import { ComponentsList } from "@/components/components-list";
+import { CopyButton } from "@/components/copy-button";
+import { getIconForLanguageExtension } from "@/components/icons";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@/components/ui/accordion";
+import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
+import { Button } from "@/components/ui/button";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { TemplateOpen } from "@/components/template-open";
+import { TemplatePreview } from "@/components/template-preview";
+import { TechStack } from "@/components/tech-stack";
+import { TweetCard } from "@/registry/magicui/tweet-card";
+
+export const mdxComponents = {
+ h1: ({ className, ...props }: React.ComponentProps<"h1">) => (
+ <h1
+ className={cn(
+ "font-heading mt-2 scroll-m-28 text-3xl font-bold tracking-tight",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ h2: ({ className, ...props }: React.ComponentProps<"h2">) => {
+ return (
+ <h2
+ id={props.children
+ ?.toString()
+ .replace(/ /g, "-")
+ .replace(/'/g, "")
+ .replace(/\?/g, "")
+ .toLowerCase()}
+ className={cn(
+ "font-heading mt-8 scroll-m-28 text-xl font-medium tracking-tight first:mt-0 lg:mt-8 [&+p]:!mt-4 *:[code]:text-xl",
+ className,
+ )}
+ {...props}
+ />
+ );
+ },
+ h3: ({ className, ...props }: React.ComponentProps<"h3">) => (
+ <h3
+ className={cn(
+ "font-heading mt-8 scroll-m-28 text-lg font-medium tracking-tight *:[code]:text-xl",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ h4: ({ className, ...props }: React.ComponentProps<"h4">) => (
+ <h4
+ className={cn(
+ "font-heading mt-8 scroll-m-28 text-base font-medium tracking-tight",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ h5: ({ className, ...props }: React.ComponentProps<"h5">) => (
+ <h5
+ className={cn(
+ "mt-8 scroll-m-28 text-base font-medium tracking-tight",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ h6: ({ className, ...props }: React.ComponentProps<"h6">) => (
+ <h6
+ className={cn(
+ "mt-8 scroll-m-28 text-base font-medium tracking-tight",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ a: ({ className, ...props }: React.ComponentProps<"a">) => (
+ <a
+ className={cn("font-medium underline underline-offset-4", className)}
+ {...props}
+ />
+ ),
+ p: ({ className, ...props }: React.ComponentProps<"p">) => (
+ <p
+ className={cn("leading-relaxed [&:not(:first-child)]:mt-6", className)}
+ {...props}
+ />
+ ),
+ strong: ({ className, ...props }: React.HTMLAttributes<HTMLElement>) => (
+ <strong className={cn("font-medium", className)} {...props} />
+ ),
+ ul: ({ className, ...props }: React.ComponentProps<"ul">) => (
+ <ul className={cn("my-6 ml-6 list-disc", className)} {...props} />
+ ),
+ ol: ({ className, ...props }: React.ComponentProps<"ol">) => (
+ <ol className={cn("my-6 ml-6 list-decimal", className)} {...props} />
+ ),
+ li: ({ className, ...props }: React.ComponentProps<"li">) => (
+ <li className={cn("mt-2", className)} {...props} />
+ ),
+ blockquote: ({ className, ...props }: React.ComponentProps<"blockquote">) => (
+ <blockquote
+ className={cn("mt-6 border-l-2 pl-6 italic", className)}
+ {...props}
+ />
+ ),
+ img: ({ className, alt, ...props }: React.ComponentProps<"img">) => (
+ // eslint-disable-next-line @next/next/no-img-element
+ <img className={cn("rounded-md", className)} alt={alt} {...props} />
+ ),
+ hr: ({ ...props }: React.ComponentProps<"hr">) => (
+ <hr className="my-4 md:my-8" {...props} />
+ ),
+ table: ({ className, ...props }: React.ComponentProps<"table">) => (
+ <div className="my-6 w-full overflow-y-auto">
+ <table
+ className={cn(
+ "relative w-full overflow-hidden border-none text-sm",
+ className,
+ )}
+ {...props}
+ />
+ </div>
+ ),
+ tr: ({ className, ...props }: React.ComponentProps<"tr">) => (
+ <tr
+ className={cn("last:border-b-none m-0 border-b", className)}
+ {...props}
+ />
+ ),
+ th: ({ className, ...props }: React.ComponentProps<"th">) => (
+ <th
+ className={cn(
+ "px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ td: ({ className, ...props }: React.ComponentProps<"td">) => (
+ <td
+ className={cn(
+ "px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ pre: ({ className, children, ...props }: React.ComponentProps<"pre">) => {
+ return (
+ <pre
+ className={cn(
+ "no-scrollbar min-w-0 overflow-x-auto px-4 py-3.5 outline-none has-[[data-highlighted-line]]:px-0 has-[[data-line-numbers]]:px-0 has-[[data-slot=tabs]]:p-0",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ </pre>
+ );
+ },
+ figure: ({ className, ...props }: React.ComponentProps<"figure">) => {
+ return <figure className={cn(className)} {...props} />;
+ },
+ figcaption: ({
+ className,
+ children,
+ ...props
+ }: React.ComponentProps<"figcaption">) => {
+ const iconExtension =
+ "data-language" in props && typeof props["data-language"] === "string"
+ ? getIconForLanguageExtension(props["data-language"])
+ : null;
+
+ return (
+ <figcaption
+ className={cn(
+ "text-code-foreground [&_svg]:text-code-foreground flex items-center gap-2 [&_svg]:size-4 [&_svg]:opacity-70",
+ className,
+ )}
+ {...props}
+ >
+ {iconExtension}
+ {children}
+ </figcaption>
+ );
+ },
+ code: ({
+ className,
+ __raw__,
+ __src__,
+ __npm__,
+ __yarn__,
+ __pnpm__,
+ __bun__,
+ ...props
+ }: React.ComponentProps<"code"> & {
+ __raw__?: string;
+ __src__?: string;
+ __npm__?: string;
+ __yarn__?: string;
+ __pnpm__?: string;
+ __bun__?: string;
+ }) => {
+ // Inline Code.
+ if (typeof props.children === "string") {
+ return (
+ <code
+ className={cn(
+ "bg-muted relative rounded-md px-[0.3rem] py-[0.2rem] font-mono text-[0.8rem] break-words outline-none",
+ className,
+ )}
+ {...props}
+ />
+ );
+ }
+
+ // npm command.
+ const isNpmCommand = __npm__ && __yarn__ && __pnpm__ && __bun__;
+ if (isNpmCommand) {
+ return (
+ <CodeBlockCommand
+ __npm__={__npm__}
+ __yarn__={__yarn__}
+ __pnpm__={__pnpm__}
+ __bun__={__bun__}
+ />
+ );
+ }
+
+ // Default codeblock.
+ return (
+ <>
+ {__raw__ && <CopyButton value={__raw__} src={__src__} />}
+ <code {...props} />
+ </>
+ );
+ },
+ Step: ({ className, ...props }: React.ComponentProps<"h3">) => (
+ <h3
+ className={cn(
+ "font-heading mt-8 scroll-m-32 text-xl font-medium tracking-tight",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ Steps: ({ ...props }) => (
+ <div className="[&>h3]:step steps mb-12 [counter-reset:step]" {...props} />
+ ),
+ Image: ({
+ src,
+ className,
+ width,
+ height,
+ alt,
+ ...props
+ }: React.ComponentProps<"img">) => (
+ <Image
+ className={cn("mt-6 rounded-md border", className)}
+ src={(src as string) || ""}
+ width={Number(width)}
+ height={Number(height)}
+ alt={alt || ""}
+ {...props}
+ />
+ ),
+ Tabs: ({ className, ...props }: React.ComponentProps<typeof Tabs>) => {
+ return (
+ <Tabs className={cn("relative mt-6 w-full", className)} {...props} />
+ );
+ },
+ TabsList: ({
+ className,
+ ...props
+ }: React.ComponentProps<typeof TabsList>) => (
+ <TabsList
+ className={cn(
+ "justify-start gap-4 rounded-none bg-transparent px-0",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ TabsTrigger: ({
+ className,
+ ...props
+ }: React.ComponentProps<typeof TabsTrigger>) => (
+ <TabsTrigger
+ className={cn(
+ "text-muted-foreground data-[state=active]:text-foreground data-[state=active]:border-primary dark:data-[state=active]:border-primary hover:text-primary rounded-none border-0 border-b-2 border-transparent bg-transparent px-0 pb-3 text-base data-[state=active]:bg-transparent data-[state=active]:shadow-none dark:data-[state=active]:bg-transparent",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ TabsContent: ({
+ className,
+ ...props
+ }: React.ComponentProps<typeof TabsContent>) => (
+ <TabsContent
+ className={cn(
+ "relative [&_h3.font-heading]:text-base [&_h3.font-heading]:font-medium *:[figure]:first:mt-0 [&>.steps]:mt-6",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ Tab: ({ className, ...props }: React.ComponentProps<"div">) => (
+ <div className={cn(className)} {...props} />
+ ),
+ Button,
+ Callout,
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+ Alert,
+ AlertTitle,
+ AlertDescription,
+ CodeTabs,
+ ComponentPreview,
+ ComponentSource,
+ CodeCollapsibleWrapper,
+ ComponentsList,
+ Link: ({ className, ...props }: React.ComponentProps<typeof Link>) => (
+ <Link
+ className={cn("font-medium underline underline-offset-4", className)}
+ {...props}
+ />
+ ),
+ LinkedCard: ({ className, ...props }: React.ComponentProps<typeof Link>) => (
+ <Link
+ className={cn(
+ "bg-surface text-surface-foreground hover:bg-surface/80 flex w-full flex-col items-center rounded-xl p-6 transition-colors sm:p-10",
+ className,
+ )}
+ {...props}
+ />
+ ),
+ TemplateOpen,
+ TemplatePreview,
+ TechStack,
+ Tweet: ({ id, className }: { id: string; className?: string }) => (
+ <TweetCard id={id} className={cn("mx-auto", className)} />
+ ),
+};
diff --git a/apps/www/next.config.mjs b/apps/www/next.config.mjs
index a5f2551a..191b89e3 100644
--- a/apps/www/next.config.mjs
+++ b/apps/www/next.config.mjs
@@ -1,14 +1,13 @@
-import { withContentCollections } from "@content-collections/next";
+import { createMDX } from "fumadocs-mdx/next";
/** @type {import('next').NextConfig} */
const nextConfig = {
- output: process.env.NODE_ENV === "production" ? "standalone" : undefined,
- reactStrictMode: true,
- experimental: {
- optimizeCss: true,
+ outputFileTracingIncludes: {
+ "/*": ["./registry/**/*"],
},
+ reactStrictMode: true,
images: {
- domains: ["localhost", "cdn.magicui.design"],
+ domains: ["localhost", "cdn.magicui.design", "images.unsplash.com"],
},
async redirects() {
return [
@@ -19,17 +18,7 @@ const nextConfig = {
},
{
source: "/components",
- destination: "/docs/components/marquee",
- permanent: true,
- },
- {
- source: "/components/:path*",
- destination: "/docs/components/:path*",
- permanent: true,
- },
- {
- source: "/docs/components",
- destination: "/docs/components/marquee",
+ destination: "/docs/components",
permanent: true,
},
{
@@ -49,4 +38,6 @@ const nextConfig = {
},
};
-export default withContentCollections(nextConfig);
+const withMDX = createMDX({});
+
+export default withMDX(nextConfig);
diff --git a/apps/www/package.json b/apps/www/package.json
index 4da7b19e..40263944 100644
--- a/apps/www/package.json
+++ b/apps/www/package.json
@@ -5,13 +5,13 @@
"type": "module",
"scripts": {
"preinstall": "npx only-allow pnpm",
+ "postinstall": "fumadocs-mdx",
"dev": "next dev",
- "prebuild": "pnpm build:docs && pnpm build:registry",
+ "prebuild": "pnpm build:registry",
"build": "next build",
"build:registry": "npx tsx ./scripts/build-registry.mts && pnpm format:fix",
"shadcn:build": "npx shadcn build registry.json --output ../www/public/r",
- "build:docs": "content-collections build",
- "typecheck": "pnpm build:docs && tsc --noEmit",
+ "typecheck": "tsc --noEmit",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
@@ -52,6 +52,9 @@
"cobe": "^0.6.4",
"concurrently": "^9.2.1",
"date-fns": "^2.30.0",
+ "fumadocs-core": "^15.7.12",
+ "fumadocs-mdx": "^11.10.0",
+ "fumadocs-ui": "^15.7.12",
"geist": "^1.5.1",
"gray-matter": "^4.0.3",
"jotai": "^2.14.0",
@@ -76,15 +79,11 @@
"tailwindcss": "^4.1.13",
"ts-morph": "^23.0.0",
"tw-animate-css": "^1.3.8",
- "zod": "^3.25.76"
+ "zod": "^4.1.8"
},
"devDependencies": {
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
- "@content-collections/cli": "^0.1.7",
- "@content-collections/core": "^0.11.1",
- "@content-collections/mdx": "^0.2.2",
- "@content-collections/next": "^0.2.7",
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
"@shikijs/transformers": "^2.5.0",
"@tailwindcss/typography": "^0.5.16",
diff --git a/apps/www/public/r/confetti.json b/apps/www/public/r/confetti.json
index cb021eeb..73a157f9 100644
--- a/apps/www/public/r/confetti.json
+++ b/apps/www/public/r/confetti.json
@@ -14,7 +14,7 @@
"files": [
{
"path": "registry/magicui/confetti.tsx",
- "content": "\"use client\";\n\nimport type {\n GlobalOptions as ConfettiGlobalOptions,\n CreateTypes as ConfettiInstance,\n Options as ConfettiOptions,\n} from \"canvas-confetti\";\nimport confetti from \"canvas-confetti\";\nimport type { ReactNode } from \"react\";\nimport React, {\n createContext,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { Button, ButtonProps } from \"@/components/ui/button\";\n\ntype Api = {\n fire: (options?: ConfettiOptions) => void;\n};\n\ntype Props = React.ComponentPropsWithRef<\"canvas\"> & {\n options?: ConfettiOptions;\n globalOptions?: ConfettiGlobalOptions;\n manualstart?: boolean;\n children?: ReactNode;\n};\n\nexport type ConfettiRef = Api | null;\n\nconst ConfettiContext = createContext<Api>({} as Api);\n\n// Define component first\nconst ConfettiComponent = forwardRef<ConfettiRef, Props>((props, ref) => {\n const {\n options,\n globalOptions = { resize: true, useWorker: true },\n manualstart = false,\n children,\n ...rest\n } = props;\n const instanceRef = useRef<ConfettiInstance | null>(null);\n\n const canvasRef = useCallback(\n (node: HTMLCanvasElement) => {\n if (node !== null) {\n if (instanceRef.current) return;\n instanceRef.current = confetti.create(node, {\n ...globalOptions,\n resize: true,\n });\n } else {\n if (instanceRef.current) {\n instanceRef.current.reset();\n instanceRef.current = null;\n }\n }\n },\n [globalOptions],\n );\n\n const fire = useCallback(\n async (opts = {}) => {\n try {\n await instanceRef.current?.({ ...options, ...opts });\n } catch (error) {\n console.error(\"Confetti error:\", error);\n }\n },\n [options],\n );\n\n const api = useMemo(\n () => ({\n fire,\n }),\n [fire],\n );\n\n useImperativeHandle(ref, () => api, [api]);\n\n useEffect(() => {\n if (!manualstart) {\n (async () => {\n try {\n await fire();\n } catch (error) {\n console.error(\"Confetti effect error:\", error);\n }\n })();\n }\n }, [manualstart, fire]);\n\n return (\n <ConfettiContext.Provider value={api}>\n <canvas ref={canvasRef} {...rest} />\n {children}\n </ConfettiContext.Provider>\n );\n});\n\n// Set display name immediately\nConfettiComponent.displayName = \"Confetti\";\n\n// Export as Confetti\nexport const Confetti = ConfettiComponent;\n\ninterface ConfettiButtonProps extends ButtonProps {\n options?: ConfettiOptions &\n ConfettiGlobalOptions & { canvas?: HTMLCanvasElement };\n children?: React.ReactNode;\n}\n\nconst ConfettiButtonComponent = ({\n options,\n children,\n ...props\n}: ConfettiButtonProps) => {\n const handleClick = async (event: React.MouseEvent<HTMLButtonElement>) => {\n try {\n const rect = event.currentTarget.getBoundingClientRect();\n const x = rect.left + rect.width / 2;\n const y = rect.top + rect.height / 2;\n await confetti({\n ...options,\n origin: {\n x: x / window.innerWidth,\n y: y / window.innerHeight,\n },\n });\n } catch (error) {\n console.error(\"Confetti button error:\", error);\n }\n };\n\n return (\n <Button onClick={handleClick} {...props}>\n {children}\n </Button>\n );\n};\n\nConfettiButtonComponent.displayName = \"ConfettiButton\";\n\nexport const ConfettiButton = ConfettiButtonComponent;\n",
+ "content": "\"use client\";\n\nimport type {\n GlobalOptions as ConfettiGlobalOptions,\n CreateTypes as ConfettiInstance,\n Options as ConfettiOptions,\n} from \"canvas-confetti\";\nimport confetti from \"canvas-confetti\";\nimport type { ReactNode } from \"react\";\nimport React, {\n createContext,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\n\ntype Api = {\n fire: (options?: ConfettiOptions) => void;\n};\n\ntype Props = React.ComponentPropsWithRef<\"canvas\"> & {\n options?: ConfettiOptions;\n globalOptions?: ConfettiGlobalOptions;\n manualstart?: boolean;\n children?: ReactNode;\n};\n\nexport type ConfettiRef = Api | null;\n\nconst ConfettiContext = createContext<Api>({} as Api);\n\n// Define component first\nconst ConfettiComponent = forwardRef<ConfettiRef, Props>((props, ref) => {\n const {\n options,\n globalOptions = { resize: true, useWorker: true },\n manualstart = false,\n children,\n ...rest\n } = props;\n const instanceRef = useRef<ConfettiInstance | null>(null);\n\n const canvasRef = useCallback(\n (node: HTMLCanvasElement) => {\n if (node !== null) {\n if (instanceRef.current) return;\n instanceRef.current = confetti.create(node, {\n ...globalOptions,\n resize: true,\n });\n } else {\n if (instanceRef.current) {\n instanceRef.current.reset();\n instanceRef.current = null;\n }\n }\n },\n [globalOptions],\n );\n\n const fire = useCallback(\n async (opts = {}) => {\n try {\n await instanceRef.current?.({ ...options, ...opts });\n } catch (error) {\n console.error(\"Confetti error:\", error);\n }\n },\n [options],\n );\n\n const api = useMemo(\n () => ({\n fire,\n }),\n [fire],\n );\n\n useImperativeHandle(ref, () => api, [api]);\n\n useEffect(() => {\n if (!manualstart) {\n (async () => {\n try {\n await fire();\n } catch (error) {\n console.error(\"Confetti effect error:\", error);\n }\n })();\n }\n }, [manualstart, fire]);\n\n return (\n <ConfettiContext.Provider value={api}>\n <canvas ref={canvasRef} {...rest} />\n {children}\n </ConfettiContext.Provider>\n );\n});\n\n// Set display name immediately\nConfettiComponent.displayName = \"Confetti\";\n\n// Export as Confetti\nexport const Confetti = ConfettiComponent;\n\ninterface ConfettiButtonProps extends React.ComponentProps<\"button\"> {\n options?: ConfettiOptions &\n ConfettiGlobalOptions & { canvas?: HTMLCanvasElement };\n}\n\nconst ConfettiButtonComponent = ({\n options,\n children,\n ...props\n}: ConfettiButtonProps) => {\n const handleClick = async (event: React.MouseEvent<HTMLButtonElement>) => {\n try {\n const rect = event.currentTarget.getBoundingClientRect();\n const x = rect.left + rect.width / 2;\n const y = rect.top + rect.height / 2;\n await confetti({\n ...options,\n origin: {\n x: x / window.innerWidth,\n y: y / window.innerHeight,\n },\n });\n } catch (error) {\n console.error(\"Confetti button error:\", error);\n }\n };\n\n return (\n <Button onClick={handleClick} {...props}>\n {children}\n </Button>\n );\n};\n\nConfettiButtonComponent.displayName = \"ConfettiButton\";\n\nexport const ConfettiButton = ConfettiButtonComponent;\n",
"type": "registry:ui"
}
]
diff --git a/apps/www/public/r/dock-demo.json b/apps/www/public/r/dock-demo.json
index 28d1b15a..083b9693 100644
--- a/apps/www/public/r/dock-demo.json
+++ b/apps/www/public/r/dock-demo.json
@@ -14,13 +14,8 @@
"files": [
{
"path": "registry/example/dock-demo.tsx",
- "content": "\"use client\";\n\nimport { CalendarIcon, HomeIcon, MailIcon, PencilIcon } from \"lucide-react\";\nimport Link from \"next/link\";\nimport React from \"react\";\n\nimport { ModeToggle } from \"@/components/mode-toggle\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { Separator } from \"@/components/ui/separator\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { cn } from \"@/lib/utils\";\nimport { Dock, DockIcon } from \"@/registry/magicui/dock\";\n\nexport type IconProps = React.HTMLAttributes<SVGElement>;\n\nconst Icons = {\n calendar: (props: IconProps) => <CalendarIcon {...props} />,\n email: (props: IconProps) => <MailIcon {...props} />,\n linkedin: (props: IconProps) => (\n <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <title>LinkedIn</title>\n <path\n fill=\"currentColor\"\n d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\"\n />\n </svg>\n ),\n x: (props: IconProps) => (\n <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <title>X</title>\n <path\n fill=\"currentColor\"\n d=\"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z\"\n />\n </svg>\n ),\n youtube: (props: IconProps) => (\n <svg\n width=\"32px\"\n height=\"32px\"\n viewBox=\"0 0 32 32\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <title>youtube</title>\n <path d=\"M29.41,9.26a3.5,3.5,0,0,0-2.47-2.47C24.76,6.2,16,6.2,16,6.2s-8.76,0-10.94.59A3.5,3.5,0,0,0,2.59,9.26,36.13,36.13,0,0,0,2,16a36.13,36.13,0,0,0,.59,6.74,3.5,3.5,0,0,0,2.47,2.47C7.24,25.8,16,25.8,16,25.8s8.76,0,10.94-.59a3.5,3.5,0,0,0,2.47-2.47A36.13,36.13,0,0,0,30,16,36.13,36.13,0,0,0,29.41,9.26ZM13.2,20.2V11.8L20.47,16Z\" />\n </svg>\n ),\n github: (props: IconProps) => (\n <svg viewBox=\"0 0 438.549 438.549\" {...props}>\n <path\n fill=\"currentColor\"\n d=\"M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.063-29.408-39.781 0-76.472 9.804-110.063 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.854 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-.571-.049-5.708-.144-15.417a2549.81 2549.81 0 01-.144-25.406l-6.567 1.136c-4.187.767-9.469 1.092-15.846 1-6.374-.089-12.991-.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-.572-1.335-.098-2.43 1.427-3.289 1.525-.859 4.281-1.276 8.28-1.276l5.708.853c3.807.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136 6.28 0 11.704-.476 16.274-1.423 4.565-.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.161 41.825-81.126 41.825-128.906-.01-39.771-9.818-76.454-29.414-110.049z\"\n ></path>\n </svg>\n ),\n};\n\nconst DATA = {\n navbar: [\n { href: \"#\", icon: HomeIcon, label: \"Home\" },\n { href: \"#\", icon: PencilIcon, label: \"Blog\" },\n ],\n contact: {\n social: {\n GitHub: {\n name: \"GitHub\",\n url: \"#\",\n icon: Icons.github,\n },\n LinkedIn: {\n name: \"LinkedIn\",\n url: \"#\",\n icon: Icons.linkedin,\n },\n X: {\n name: \"X\",\n url: \"#\",\n icon: Icons.x,\n },\n email: {\n name: \"Send Email\",\n url: \"#\",\n icon: Icons.email,\n },\n },\n },\n};\n\nexport default function DockDemo() {\n return (\n <div className=\"flex flex-col items-center justify-center\">\n <span className=\"pointer-events-none whitespace-pre-wrap bg-gradient-to-b from-black to-gray-300/80 bg-clip-text text-center text-8xl font-semibold leading-none text-transparent dark:from-white dark:to-slate-900/10\">\n Dock\n </span>\n <TooltipProvider>\n <Dock direction=\"middle\">\n {DATA.navbar.map((item) => (\n <DockIcon key={item.label}>\n <Tooltip>\n <TooltipTrigger asChild>\n <Link\n href={item.href}\n aria-label={item.label}\n className={cn(\n buttonVariants({ variant: \"ghost\", size: \"icon\" }),\n \"size-12 rounded-full\",\n )}\n >\n <item.icon className=\"size-4\" />\n </Link>\n </TooltipTrigger>\n <TooltipContent>\n <p>{item.label}</p>\n </TooltipContent>\n </Tooltip>\n </DockIcon>\n ))}\n <Separator orientation=\"vertical\" className=\"h-full\" />\n {Object.entries(DATA.contact.social).map(([name, social]) => (\n <DockIcon key={name}>\n <Tooltip>\n <TooltipTrigger asChild>\n <Link\n href={social.url}\n aria-label={social.name}\n className={cn(\n buttonVariants({ variant: \"ghost\", size: \"icon\" }),\n \"size-12 rounded-full \",\n )}\n >\n <social.icon className=\"size-4\" />\n </Link>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n </DockIcon>\n ))}\n <Separator orientation=\"vertical\" className=\"h-full py-2\" />\n <DockIcon>\n <Tooltip>\n <TooltipTrigger asChild>\n <ModeToggle className=\"size-12 rounded-full\" />\n </TooltipTrigger>\n <TooltipContent>\n <p>Theme</p>\n </TooltipContent>\n </Tooltip>\n </DockIcon>\n </Dock>\n </TooltipProvider>\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { CalendarIcon, HomeIcon, MailIcon, PencilIcon } from \"lucide-react\";\nimport Link from \"next/link\";\nimport React from \"react\";\n\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { Separator } from \"@/components/ui/separator\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { cn } from \"@/lib/utils\";\nimport { Dock, DockIcon } from \"@/registry/magicui/dock\";\n\nexport type IconProps = React.HTMLAttributes<SVGElement>;\n\nconst Icons = {\n calendar: (props: IconProps) => <CalendarIcon {...props} />,\n email: (props: IconProps) => <MailIcon {...props} />,\n linkedin: (props: IconProps) => (\n <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <title>LinkedIn</title>\n <path\n fill=\"currentColor\"\n d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\"\n />\n </svg>\n ),\n x: (props: IconProps) => (\n <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <title>X</title>\n <path\n fill=\"currentColor\"\n d=\"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z\"\n />\n </svg>\n ),\n youtube: (props: IconProps) => (\n <svg\n width=\"32px\"\n height=\"32px\"\n viewBox=\"0 0 32 32\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <title>youtube</title>\n <path d=\"M29.41,9.26a3.5,3.5,0,0,0-2.47-2.47C24.76,6.2,16,6.2,16,6.2s-8.76,0-10.94.59A3.5,3.5,0,0,0,2.59,9.26,36.13,36.13,0,0,0,2,16a36.13,36.13,0,0,0,.59,6.74,3.5,3.5,0,0,0,2.47,2.47C7.24,25.8,16,25.8,16,25.8s8.76,0,10.94-.59a3.5,3.5,0,0,0,2.47-2.47A36.13,36.13,0,0,0,30,16,36.13,36.13,0,0,0,29.41,9.26ZM13.2,20.2V11.8L20.47,16Z\" />\n </svg>\n ),\n github: (props: IconProps) => (\n <svg viewBox=\"0 0 438.549 438.549\" {...props}>\n <path\n fill=\"currentColor\"\n d=\"M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.063-29.408-39.781 0-76.472 9.804-110.063 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.854 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-.571-.049-5.708-.144-15.417a2549.81 2549.81 0 01-.144-25.406l-6.567 1.136c-4.187.767-9.469 1.092-15.846 1-6.374-.089-12.991-.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-.572-1.335-.098-2.43 1.427-3.289 1.525-.859 4.281-1.276 8.28-1.276l5.708.853c3.807.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136 6.28 0 11.704-.476 16.274-1.423 4.565-.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.161 41.825-81.126 41.825-128.906-.01-39.771-9.818-76.454-29.414-110.049z\"\n ></path>\n </svg>\n ),\n};\n\nconst DATA = {\n navbar: [\n { href: \"#\", icon: HomeIcon, label: \"Home\" },\n { href: \"#\", icon: PencilIcon, label: \"Blog\" },\n ],\n contact: {\n social: {\n GitHub: {\n name: \"GitHub\",\n url: \"#\",\n icon: Icons.github,\n },\n LinkedIn: {\n name: \"LinkedIn\",\n url: \"#\",\n icon: Icons.linkedin,\n },\n X: {\n name: \"X\",\n url: \"#\",\n icon: Icons.x,\n },\n email: {\n name: \"Send Email\",\n url: \"#\",\n icon: Icons.email,\n },\n },\n },\n};\n\nexport default function DockDemo() {\n return (\n <div className=\"flex flex-col items-center justify-center\">\n <span className=\"pointer-events-none whitespace-pre-wrap bg-gradient-to-b from-black to-gray-300/80 bg-clip-text text-center text-8xl font-semibold leading-none text-transparent dark:from-white dark:to-slate-900/10\">\n Dock\n </span>\n <TooltipProvider>\n <Dock direction=\"middle\">\n {DATA.navbar.map((item) => (\n <DockIcon key={item.label}>\n <Tooltip>\n <TooltipTrigger asChild>\n <Link\n href={item.href}\n aria-label={item.label}\n className={cn(\n buttonVariants({ variant: \"ghost\", size: \"icon\" }),\n \"size-12 rounded-full\",\n )}\n >\n <item.icon className=\"size-4\" />\n </Link>\n </TooltipTrigger>\n <TooltipContent>\n <p>{item.label}</p>\n </TooltipContent>\n </Tooltip>\n </DockIcon>\n ))}\n <Separator orientation=\"vertical\" className=\"h-full\" />\n {Object.entries(DATA.contact.social).map(([name, social]) => (\n <DockIcon key={name}>\n <Tooltip>\n <TooltipTrigger asChild>\n <Link\n href={social.url}\n aria-label={social.name}\n className={cn(\n buttonVariants({ variant: \"ghost\", size: \"icon\" }),\n \"size-12 rounded-full \",\n )}\n >\n <social.icon className=\"size-4\" />\n </Link>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n </DockIcon>\n ))}\n </Dock>\n </TooltipProvider>\n </div>\n );\n}\n",
"type": "registry:example"
- },
- {
- "path": "registry/magicui/mode-toggle.tsx",
- "content": "\"use client\";\n\nimport { MoonIcon, SunIcon } from \"@radix-ui/react-icons\";\nimport { useTheme } from \"next-themes\";\nimport React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\nexport const ModeToggle = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<typeof Button> & { className?: string }\n>(({ className, ...props }, ref) => {\n const { theme, setTheme } = useTheme();\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n type=\"button\"\n size=\"icon\"\n className={cn(\"px-2\", className)}\n aria-label=\"Toggle theme\"\n onClick={() => setTheme(theme === \"dark\" ? \"light\" : \"dark\")}\n {...props}\n >\n <SunIcon className=\"size-[1.2rem] text-neutral-800 dark:hidden dark:text-neutral-200\" />\n <MoonIcon className=\"hidden size-[1.2rem] text-neutral-800 dark:block dark:text-neutral-200\" />\n </Button>\n );\n});\n\nModeToggle.displayName = \"ModeToggle\";\n",
- "type": "registry:ui"
}
]
}
\ No newline at end of file
diff --git a/apps/www/public/r/index.json b/apps/www/public/r/index.json
index 8e85cbd8..3a8ab076 100644
--- a/apps/www/public/r/index.json
+++ b/apps/www/public/r/index.json
@@ -3,10 +3,12 @@
"name": "index",
"type": "registry:style",
"dependencies": [
- "tw-animate-css",
"class-variance-authority",
"lucide-react"
],
+ "devDependencies": [
+ "tw-animate-css"
+ ],
"registryDependencies": [
"utils"
],
diff --git a/apps/www/public/r/meteors-demo.json b/apps/www/public/r/meteors-demo.json
index db4ccfc2..790e0a6b 100644
--- a/apps/www/public/r/meteors-demo.json
+++ b/apps/www/public/r/meteors-demo.json
@@ -10,7 +10,7 @@
"files": [
{
"path": "registry/example/meteors-demo.tsx",
- "content": "import { Meteors } from \"@/registry/magicui/meteors\";\n\nexport default function MeteorDemo() {\n return (\n <div className=\"relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border\">\n <Meteors number={30} />\n <span className=\"pointer-events-none whitespace-pre-wrap bg-gradient-to-b from-black to-gray-300/80 bg-clip-text text-center text-8xl font-semibold leading-none text-transparent dark:from-white dark:to-slate-900/10\">\n Meteors\n </span>\n </div>\n );\n}\n",
+ "content": "import { Meteors } from \"@/registry/magicui/meteors\";\n\nexport default function MeteorDemo() {\n return (\n <div className=\"relative overflow-hidden h-[500px] w-full\">\n <Meteors number={30} />\n </div>\n );\n}\n",
"type": "registry:example"
}
]
diff --git a/apps/www/public/r/registry.json b/apps/www/public/r/registry.json
index 4ffc3a97..1c7c614e 100644
--- a/apps/www/public/r/registry.json
+++ b/apps/www/public/r/registry.json
@@ -6,10 +6,12 @@
"name": "index",
"type": "registry:style",
"dependencies": [
- "tw-animate-css",
"class-variance-authority",
"lucide-react"
],
+ "devDependencies": [
+ "tw-animate-css"
+ ],
"registryDependencies": [
"utils"
],
@@ -2321,10 +2323,6 @@
{
"path": "registry/example/dock-demo.tsx",
"type": "registry:example"
- },
- {
- "path": "registry/magicui/mode-toggle.tsx",
- "type": "registry:ui"
}
]
},
diff --git a/apps/www/public/r/tweet-card.json b/apps/www/public/r/tweet-card.json
index cccd020a..5a53e74b 100644
--- a/apps/www/public/r/tweet-card.json
+++ b/apps/www/public/r/tweet-card.json
@@ -10,7 +10,7 @@
"files": [
{
"path": "registry/magicui/tweet-card.tsx",
- "content": "/* eslint-disable @next/next/no-img-element */\nimport { 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 if (!tweet.video && !tweet.photos) return null;\n return (\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 src={\n // @ts-ignore\n tweet.card.binding_values.thumbnail_image_large.image_value.url\n }\n className=\"h-64 rounded-xl border object-cover shadow-sm\"\n alt={tweet.text}\n />\n )}\n </div>\n );\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",
+ "content": "/* eslint-disable @next/next/no-img-element */\nimport { 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 if (!tweet.video && !tweet.photos) return null;\n return (\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 src={\n // @ts-ignore\n tweet.card.binding_values.thumbnail_image_large.image_value.url\n }\n className=\"h-64 rounded-xl border object-cover shadow-sm\"\n alt={tweet.text}\n />\n )}\n </div>\n );\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 w-full h-fit 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",
"type": "registry:ui"
}
]
diff --git a/apps/www/registry.json b/apps/www/registry.json
index 4ffc3a97..1c7c614e 100644
--- a/apps/www/registry.json
+++ b/apps/www/registry.json
@@ -6,10 +6,12 @@
"name": "index",
"type": "registry:style",
"dependencies": [
- "tw-animate-css",
"class-variance-authority",
"lucide-react"
],
+ "devDependencies": [
+ "tw-animate-css"
+ ],
"registryDependencies": [
"utils"
],
@@ -2321,10 +2323,6 @@
{
"path": "registry/example/dock-demo.tsx",
"type": "registry:example"
- },
- {
- "path": "registry/magicui/mode-toggle.tsx",
- "type": "registry:ui"
}
]
},
diff --git a/apps/www/registry/example/dock-demo.tsx b/apps/www/registry/example/dock-demo.tsx
index 59588112..0b3ff893 100644
--- a/apps/www/registry/example/dock-demo.tsx
+++ b/apps/www/registry/example/dock-demo.tsx
@@ -4,7 +4,6 @@ import { CalendarIcon, HomeIcon, MailIcon, PencilIcon } from "lucide-react";
import Link from "next/link";
import React from "react";
-import { ModeToggle } from "@/components/mode-toggle";
import { buttonVariants } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import {
@@ -144,17 +143,6 @@ export default function DockDemo() {
</Tooltip>
</DockIcon>
))}
- <Separator orientation="vertical" className="h-full py-2" />
- <DockIcon>
- <Tooltip>
- <TooltipTrigger asChild>
- <ModeToggle className="size-12 rounded-full" />
- </TooltipTrigger>
- <TooltipContent>
- <p>Theme</p>
- </TooltipContent>
- </Tooltip>
- </DockIcon>
</Dock>
</TooltipProvider>
</div>
diff --git a/apps/www/registry/example/meteors-demo.tsx b/apps/www/registry/example/meteors-demo.tsx
index 290f3cf0..283eeb26 100644
--- a/apps/www/registry/example/meteors-demo.tsx
+++ b/apps/www/registry/example/meteors-demo.tsx
@@ -2,11 +2,8 @@ import { Meteors } from "@/registry/magicui/meteors";
export default function MeteorDemo() {
return (
- <div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border">
+ <div className="relative overflow-hidden h-[500px] w-full">
<Meteors number={30} />
- <span className="pointer-events-none whitespace-pre-wrap bg-gradient-to-b from-black to-gray-300/80 bg-clip-text text-center text-8xl font-semibold leading-none text-transparent dark:from-white dark:to-slate-900/10">
- Meteors
- </span>
</div>
);
}
diff --git a/apps/www/registry/index.ts b/apps/www/registry/index.ts
new file mode 100644
index 00000000..4e90625e
--- /dev/null
+++ b/apps/www/registry/index.ts
@@ -0,0 +1,31 @@
+import {
+ registryIndexSchema,
+ RegistryItem,
+ type Registry,
+} from "shadcn/schema";
+
+import { examples } from "@/registry/registry-examples";
+import { lib } from "@/registry/registry-lib";
+import { ui } from "@/registry/registry-ui";
+
+const DEPRECATED_ITEMS = [""];
+
+const DEFAULT: RegistryItem = {
+ name: "index",
+ type: "registry:style",
+ dependencies: ["class-variance-authority", "lucide-react"],
+ devDependencies: ["tw-animate-css"],
+ registryDependencies: ["utils"],
+ cssVars: {},
+ files: [],
+};
+
+export const registry = {
+ name: "magicui",
+ homepage: "https://magicui.design",
+ items: registryIndexSchema.parse(
+ [DEFAULT, ...ui, ...examples, ...lib].filter((item) => {
+ return !DEPRECATED_ITEMS.includes(item.name);
+ }),
+ ),
+} satisfies Registry;
diff --git a/apps/www/registry/magicui/confetti.tsx b/apps/www/registry/magicui/confetti.tsx
index c6df6cef..9fdc1178 100644
--- a/apps/www/registry/magicui/confetti.tsx
+++ b/apps/www/registry/magicui/confetti.tsx
@@ -17,7 +17,7 @@ import React, {
useRef,
} from "react";
-import { Button, ButtonProps } from "@/components/ui/button";
+import { Button } from "@/components/ui/button";
type Api = {
fire: (options?: ConfettiOptions) => void;
@@ -109,10 +109,9 @@ ConfettiComponent.displayName = "Confetti";
// Export as Confetti
export const Confetti = ConfettiComponent;
-interface ConfettiButtonProps extends ButtonProps {
+interface ConfettiButtonProps extends React.ComponentProps<"button"> {
options?: ConfettiOptions &
ConfettiGlobalOptions & { canvas?: HTMLCanvasElement };
- children?: React.ReactNode;
}
const ConfettiButtonComponent = ({
diff --git a/apps/www/registry/magicui/mode-toggle.tsx b/apps/www/registry/magicui/mode-toggle.tsx
deleted file mode 100644
index 77ab9933..00000000
--- a/apps/www/registry/magicui/mode-toggle.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-"use client";
-
-import { MoonIcon, SunIcon } from "@radix-ui/react-icons";
-import { useTheme } from "next-themes";
-import React from "react";
-
-import { Button } from "@/components/ui/button";
-import { cn } from "@/lib/utils";
-
-export const ModeToggle = React.forwardRef<
- HTMLButtonElement,
- React.ComponentPropsWithoutRef<typeof Button> & { className?: string }
->(({ className, ...props }, ref) => {
- const { theme, setTheme } = useTheme();
-
- return (
- <Button
- ref={ref}
- variant="ghost"
- type="button"
- size="icon"
- className={cn("px-2", className)}
- aria-label="Toggle theme"
- onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
- {...props}
- >
- <SunIcon className="size-[1.2rem] text-neutral-800 dark:hidden dark:text-neutral-200" />
- <MoonIcon className="hidden size-[1.2rem] text-neutral-800 dark:block dark:text-neutral-200" />
- </Button>
- );
-});
-
-ModeToggle.displayName = "ModeToggle";
diff --git a/apps/www/registry/magicui/tweet-card.tsx b/apps/www/registry/magicui/tweet-card.tsx
index 1caf7709..b2a3c824 100644
--- a/apps/www/registry/magicui/tweet-card.tsx
+++ b/apps/www/registry/magicui/tweet-card.tsx
@@ -240,7 +240,7 @@ export const MagicTweet = ({
return (
<div
className={cn(
- "relative flex size-full max-w-lg flex-col gap-2 overflow-hidden rounded-lg border p-4 backdrop-blur-md",
+ "relative flex w-full h-fit max-w-lg flex-col gap-2 overflow-hidden rounded-lg border p-4 backdrop-blur-md",
className,
)}
{...props}
diff --git a/apps/www/registry/registry-examples.ts b/apps/www/registry/registry-examples.ts
index 83f36188..8d04ae07 100644
--- a/apps/www/registry/registry-examples.ts
+++ b/apps/www/registry/registry-examples.ts
@@ -872,10 +872,6 @@ export const examples: Registry["items"] = [
path: "example/dock-demo.tsx",
type: "registry:example",
},
- {
- path: "magicui/mode-toggle.tsx",
- type: "registry:ui",
- },
],
},
{
diff --git a/apps/www/scripts/build-registry.mts b/apps/www/scripts/build-registry.mts
index 1396c5a9..e6cf0824 100644
--- a/apps/www/scripts/build-registry.mts
+++ b/apps/www/scripts/build-registry.mts
@@ -2,42 +2,11 @@ import { exec } from "child_process";
import { promises as fs } from "fs";
import path from "path";
import { rimraf } from "rimraf";
-import { registryItemSchema, type Registry } from "shadcn/schema";
-import { z } from "zod";
+import { Registry } from "shadcn/schema";
-import { examples } from "../registry/registry-examples";
-import { lib } from "../registry/registry-lib";
-import { ui } from "../registry/registry-ui";
+import { registry } from "../registry/index";
import { siteConfig } from "../config/site";
-const DEPRECATED_ITEMS = ["toast"];
-
-const registry = {
- name: "magicui",
- homepage: "https://magicui.design",
- items: z.array(registryItemSchema).parse(
- [
- {
- name: "index",
- type: "registry:style",
- dependencies: [
- "tw-animate-css",
- "class-variance-authority",
- "lucide-react",
- ],
- registryDependencies: ["utils"],
- cssVars: {},
- files: [],
- },
- ...ui,
- ...examples,
- ...lib,
- ].filter((item) => {
- return !DEPRECATED_ITEMS.includes(item.name);
- }),
- ),
-} satisfies Registry;
-
async function buildRegistryIndex() {
let index = `/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-explicit-any */
@@ -163,23 +132,25 @@ async function readRegistryFilesContents(item: RegistryItem): Promise<string> {
function getComponentExamples() {
const examplesByComponent = new Map<string, string[]>();
- examples.forEach((example) => {
- example.registryDependencies?.forEach((dep) => {
- const componentName = dep.split("/").pop();
- if (componentName) {
- if (!examplesByComponent.has(componentName)) {
- examplesByComponent.set(componentName, []);
+ registry.items
+ .filter((item) => item.type === "registry:example")
+ .forEach((example) => {
+ example.registryDependencies?.forEach((dep) => {
+ const componentName = dep.split("/").pop();
+ if (componentName) {
+ if (!examplesByComponent.has(componentName)) {
+ examplesByComponent.set(componentName, []);
+ }
+ examplesByComponent.get(componentName)!.push(example.name);
}
- examplesByComponent.get(componentName)!.push(example.name);
- }
+ });
});
- });
return examplesByComponent;
}
async function generateLlmsContent() {
- const components = ui
+ const components = registry.items
.filter((item) => item.type === "registry:ui")
.sort((a, b) => a.name.localeCompare(b.name))
.map((component) => {
@@ -190,7 +161,8 @@ async function generateLlmsContent() {
});
const exampleSet = new Set<string>();
- const examplesList = examples
+ const examplesList = registry.items
+ .filter((item) => item.type === "registry:example")
.filter((example) => {
if (exampleSet.has(example.name)) return false;
exampleSet.add(example.name);
@@ -230,7 +202,7 @@ async function generateLlmsContent() {
async function generateLlmsFullContent(
examplesByComponent: Map<string, string[]>,
) {
- const components = ui
+ const components = registry.items
.filter((item) => item.type === "registry:ui")
.sort((a, b) => a.name.localeCompare(b.name));
@@ -251,7 +223,7 @@ async function generateLlmsFullContent(
// Add examples for this component
const relatedExamples = examplesByComponent.get(component.name) || [];
for (const exampleName of relatedExamples) {
- const example = examples.find((e) => e.name === exampleName);
+ const example = registry.items.find((e) => e.name === exampleName);
if (example) {
const exTitle = (example as any).title || example.name;
content += [
diff --git a/apps/www/source.config.ts b/apps/www/source.config.ts
new file mode 100644
index 00000000..025958e6
--- /dev/null
+++ b/apps/www/source.config.ts
@@ -0,0 +1,81 @@
+import {
+ defineConfig,
+ defineDocs,
+ frontmatterSchema,
+} from "fumadocs-mdx/config";
+import rehypePrettyCode from "rehype-pretty-code";
+import { z } from "zod";
+import { transformers } from "@/lib/highlight-code";
+import { remarkImage } from "fumadocs-core/mdx-plugins";
+
+export default defineConfig({
+ mdxOptions: {
+ remarkPlugins: [
+ [
+ remarkImage,
+ {
+ onError: "ignore",
+ },
+ ],
+ ],
+ rehypePlugins: (plugins) => {
+ plugins.shift();
+ plugins.push([
+ // TODO: fix the type.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ rehypePrettyCode as any,
+ {
+ theme: {
+ dark: "github-dark",
+ light: "github-light-default",
+ },
+ transformers,
+ },
+ ]);
+
+ return plugins;
+ },
+ },
+});
+
+export const docs = defineDocs({
+ dir: "content/docs",
+ docs: {
+ schema: frontmatterSchema.extend({
+ date: z.string(),
+ author: z.string(),
+ published: z.boolean(),
+ video: z.string().optional(),
+ links: z
+ .object({
+ doc: z.string().optional(),
+ api: z.string().optional(),
+ })
+ .optional(),
+ }),
+ },
+});
+
+export const showcase = defineDocs({
+ dir: "content/showcase",
+ docs: {
+ schema: frontmatterSchema.extend({
+ affiliation: z.string().optional(),
+ featured: z.boolean().optional().default(false),
+ image: z.string().optional(),
+ }),
+ },
+});
+
+export const blog = defineDocs({
+ dir: "content/blog",
+ docs: {
+ schema: frontmatterSchema.extend({
+ tag: z.string().optional(),
+ publishedOn: z.string(),
+ featured: z.boolean().optional().default(false),
+ image: z.string().optional(),
+ author: z.string().optional(),
+ }),
+ },
+});
diff --git a/apps/www/styles/globals.css b/apps/www/styles/globals.css
index 61d8ce4a..9d902c04 100644
--- a/apps/www/styles/globals.css
+++ b/apps/www/styles/globals.css
@@ -1,7 +1,8 @@
@import "tailwindcss";
@import "tw-animate-css";
-@custom-variant dark (&:where(.dark, .dark *));
+@custom-variant dark (&:is(.dark *));
+@custom-variant fixed (&:is(.layout-fixed *));
:root {
--radius: 0.625rem;
@@ -36,6 +37,14 @@
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
+ --surface: oklch(0.98 0 0);
+ --surface-foreground: var(--foreground);
+ --code: var(--surface);
+ --code-foreground: var(--surface-foreground);
+ --code-highlight: oklch(0.96 0 0);
+ --code-number: oklch(0.56 0 0);
+ --selection: oklch(0.145 0 0);
+ --selection-foreground: oklch(1 0 0);
--color-1: oklch(66.2% 0.225 25.9);
--color-2: oklch(60.4% 0.26 302);
@@ -76,9 +85,19 @@
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
+ --surface: oklch(0.2 0 0);
+ --surface-foreground: oklch(0.708 0 0);
+ --code: var(--surface);
+ --code-foreground: var(--surface-foreground);
+ --code-highlight: oklch(0.27 0 0);
+ --code-number: oklch(0.72 0 0);
+ --selection: oklch(0.922 0 0);
+ --selection-foreground: oklch(0.205 0 0);
}
@theme inline {
+ --breakpoint-3xl: 1600px;
+ --breakpoint-4xl: 2000px;
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
--radius-sm: calc(var(--radius) - 4px);
@@ -116,6 +135,14 @@
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
+ --color-surface: var(--surface);
+ --color-surface-foreground: var(--surface-foreground);
+ --color-code: var(--code);
+ --color-code-foreground: var(--code-foreground);
+ --color-code-highlight: var(--code-highlight);
+ --color-code-number: var(--code-number);
+ --color-selection: var(--selection);
+ --color-selection-foreground: var(--selection-foreground);
/* Added Animation Variables */
--animate-accordion-down: accordion-down 0.2s ease-out;
@@ -141,6 +168,7 @@
--animate-rainbow: rainbow var(--speed, 2s) infinite linear;
--animate-line-shadow: line-shadow 15s linear infinite;
--animate-aurora: aurora 8s ease-in-out infinite alternate;
+ --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
/* End Animation Variables */
@@ -357,11 +385,26 @@
background-position: 100% -100%;
}
}
+
+ @keyframes ping {
+ 75%,
+ 100% {
+ transform: scale(2);
+ opacity: 0;
+ }
+ }
}
@layer base {
+ :root {
+ @apply overscroll-none overflow-x-hidden;
+ }
+
* {
- @apply border-border;
+ @apply border-border outline-ring/50;
+ }
+ ::selection {
+ @apply bg-selection text-selection-foreground;
}
html {
@apply scroll-smooth;
@@ -373,44 +416,38 @@
text-rendering: optimizeLegibility;
}
- ::-webkit-scrollbar {
- width: 5px;
+ a:active,
+ button:active {
+ @apply opacity-60 md:opacity-100;
}
- ::-webkit-scrollbar-track {
- background: transparent;
- }
- ::-webkit-scrollbar-thumb {
- background: hsl(var(--border));
- border-radius: 5px;
- }
- * {
- scrollbar-width: thin;
- scrollbar-color: hsl(var(--border)) transparent;
+
+ ::view-transition-old(root),
+ ::view-transition-new(root) {
+ animation: none;
+ mix-blend-mode: normal;
}
}
-@layer utilities {
- .steps {
- counter-reset: steps;
- }
+@utility no-scrollbar {
+ -ms-overflow-style: none;
+ scrollbar-width: none;
- .steps > h3 {
- counter-increment: steps;
- }
-
- .steps > h3:before {
- @apply absolute inline-flex h-9 w-9 items-center justify-center rounded-full border-4 border-background bg-muted text-center -indent-px font-mono text-base font-medium;
- @apply ml-[-50px] mt-[-4px];
- content: counter(steps);
+ &::-webkit-scrollbar {
+ display: none;
}
}
+@utility container-wrapper {
+ @apply 3xl:fixed:max-w-[calc(var(--breakpoint-2xl)+2rem)] mx-auto w-full px-2;
+}
@utility container {
- margin-left: auto;
- margin-right: auto;
- padding-left: 2rem;
- padding-right: 2rem;
- max-width: 1536px;
+ @apply 3xl:max-w-screen-2xl mx-auto max-w-[1400px] px-4 lg:px-8;
+}
+
+@utility extend-touch-target {
+ @media (pointer: coarse) {
+ @apply relative touch-manipulation after:absolute after:-inset-2;
+ }
}
.lab-bg {
@@ -445,84 +482,122 @@
mask-composite: intersect;
}
-[data-theme="light"] {
- display: block;
-}
-
-[data-theme="dark"] {
- display: none;
-}
-
-.dark [data-theme="light"] {
- display: none;
-}
-
-.dark [data-theme="dark"] {
- display: block;
-}
+@layer components {
+ .steps {
+ counter-reset: steps;
+ }
-[data-rehype-pretty-code-figure] {
- @apply relative text-white w-full;
-}
+ .steps > h3 {
+ counter-increment: steps;
+ }
-[data-rehype-pretty-code-figure] code {
- @apply grid min-w-full break-words rounded-none border-0 bg-transparent;
- counter-reset: line;
- box-decoration-break: clone;
-}
+ .steps > h3:before {
+ @apply absolute inline-flex h-9 w-9 items-center justify-center rounded-full border-4 border-background bg-muted text-center -indent-px font-mono text-base font-medium;
+ @apply ml-[-50px] mt-[-4px];
+ content: counter(steps);
+ }
-[data-rehype-pretty-code-figure] [data-line] {
- @apply px-4 min-h-[1rem] py-0.5 w-full inline-block;
-}
+ [data-rehype-pretty-code-figure] {
+ background-color: var(--color-code);
+ color: var(--color-code-foreground);
+ border-radius: var(--radius-lg);
+ border-width: 0px;
+ border-color: var(--border);
+ margin-top: calc(var(--spacing) * 6);
+ overflow: hidden;
+ font-size: var(--text-sm);
+ outline: none;
+ position: relative;
+ @apply -mx-1 md:-mx-1;
+
+ &:has([data-rehype-pretty-code-title]) [data-slot="copy-button"] {
+ top: calc(var(--spacing) * 1.5) !important;
+ }
+ }
-[data-rehype-pretty-code-figure] [data-line-numbers] [data-line] {
- @apply px-2;
-}
+ [data-rehype-pretty-code-title] {
+ border-bottom: color-mix(in oklab, var(--border) 30%, transparent);
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ padding-block: calc(var(--spacing) * 2.5);
+ padding-inline: calc(var(--spacing) * 4);
+ font-size: var(--text-sm);
+ font-family: var(--font-mono);
+ color: var(--color-code-foreground);
+ }
-[data-rehype-pretty-code-figure] [data-line-numbers] > [data-line]::before {
- @apply text-zinc-50/40 text-xs;
- counter-increment: line;
- content: counter(line);
- display: inline-block;
- width: 1.8rem;
- margin-right: 1.4rem;
- text-align: right;
-}
+ [data-line-numbers] {
+ display: grid;
+ min-width: 100%;
+ white-space: pre;
+ border: 0;
+ background: transparent;
+ padding: 0;
+ counter-reset: line;
+ box-decoration-break: clone;
+ }
-[data-rehype-pretty-code-figure] .line--highlighted {
- @apply bg-zinc-700/50;
-}
+ [data-line-numbers] [data-line]::before {
+ font-size: var(--text-sm);
+ counter-increment: line;
+ content: counter(line);
+ display: inline-block;
+ width: calc(var(--spacing) * 16);
+ padding-right: calc(var(--spacing) * 6);
+ text-align: right;
+ color: var(--color-code-number);
+ background-color: var(--color-code);
+ position: sticky;
+ left: 0;
+ }
-[data-rehype-pretty-code-figure] .line-highlighted span {
- @apply relative;
-}
+ [data-line-numbers] [data-highlighted-line][data-line]::before {
+ background-color: var(--color-code-highlight);
+ }
-[data-rehype-pretty-code-figure] .word--highlighted {
- @apply rounded-md bg-zinc-700/50 border-zinc-700/70 p-1;
-}
+ [data-line] {
+ padding-top: calc(var(--spacing) * 0.5);
+ padding-bottom: calc(var(--spacing) * 0.5);
+ min-height: calc(var(--spacing) * 1);
+ width: 100%;
+ display: inline-block;
+ }
-.dark [data-rehype-pretty-code-figure] .word--highlighted {
- @apply bg-zinc-900;
-}
+ [data-line] span {
+ color: var(--shiki-light);
-[data-rehype-pretty-code-title] {
- @apply mt-2 pt-6 px-4 text-sm font-medium text-foreground;
-}
+ @variant dark {
+ color: var(--shiki-dark) !important;
+ }
+ }
-[data-rehype-pretty-code-title] + pre {
- @apply mt-2;
-}
+ [data-highlighted-line],
+ [data-highlighted-chars] {
+ position: relative;
+ background-color: var(--color-code-highlight);
+ }
-.mdx > .steps:first-child > h3:first-child {
- @apply mt-0;
-}
+ [data-highlighted-line] {
+ &:after {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 2px;
+ height: 100%;
+ content: "";
+ background-color: color-mix(
+ in oklab,
+ var(--muted-foreground) 50%,
+ transparent
+ );
+ }
+ }
-.steps > h3 {
- @apply mt-8 mb-4 text-base font-semibold;
+ [data-highlighted-chars] {
+ border-radius: var(--radius-sm);
+ padding-inline: 0.3rem;
+ padding-block: 0.1rem;
+ font-family: var(--font-mono);
+ font-size: 0.8rem;
+ }
}
-
-::view-transition-old(root),
-::view-transition-new(root) {
- animation: none;
- mix-blend-mode: normal;
-}
\ No newline at end of file
diff --git a/apps/www/tsconfig.json b/apps/www/tsconfig.json
index a48f7931..9f876ac9 100644
--- a/apps/www/tsconfig.json
+++ b/apps/www/tsconfig.json
@@ -21,8 +21,7 @@
}
],
"paths": {
- "@/*": ["./*"],
- "content-collections": ["./.content-collections/generated"]
+ "@/*": ["./*"]
}
},
"include": [
diff --git a/apps/www/tsconfig.scripts.json b/apps/www/tsconfig.scripts.json
index e56c88c9..e81451a3 100644
--- a/apps/www/tsconfig.scripts.json
+++ b/apps/www/tsconfig.scripts.json
@@ -8,6 +8,6 @@
"esModuleInterop": true,
"isolatedModules": false
},
- "include": [".content-collections/generated", "scripts/**/*.ts"],
+ "include": ["scripts/**/*.ts"],
"exclude": ["node_modules"]
-}
\ No newline at end of file
+}
diff --git a/apps/www/types/index.d.ts b/apps/www/types/index.d.ts
index 09c6f8a2..25a4e835 100644
--- a/apps/www/types/index.d.ts
+++ b/apps/www/types/index.d.ts
@@ -8,18 +8,14 @@ export interface NavItem {
icon?: keyof typeof Icons;
label?: string;
paid?: boolean;
- event?: string;
+ event?: Event["name"];
}
export interface NavItemWithChildren extends NavItem {
items?: NavItemWithChildren[];
}
-export interface MainNavItem extends NavItem {}
-
-export interface SidebarNavItem extends NavItemWithChildren {}
-
export type DashboardConfig = {
- mainNav: MainNavItem[];
- sidebarNav: SidebarNavItem[];
+ mainNav: NavItem[];
+ sidebarNav: NavItemWithChildren[];
};
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index de7a70e3..5cac2b6b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -107,6 +107,15 @@ importers:
date-fns:
specifier: ^2.30.0
version: 2.30.0
+ fumadocs-core:
+ specifier: ^15.7.12
+ fumadocs-mdx:
+ specifier: ^11.10.0
+ fumadocs-ui:
+ specifier: ^15.7.12
geist:
specifier: ^1.5.1
@@ -180,8 +189,8 @@ importers:
specifier: ^1.3.8
version: 1.3.8
zod:
- specifier: ^3.25.76
- version: 3.25.76
+ specifier: ^4.1.8
+ version: 4.1.8
devDependencies:
'@commitlint/cli':
specifier: ^19.8.1
@@ -189,18 +198,6 @@ importers:
'@commitlint/config-conventional':
specifier: ^19.8.1
version: 19.8.1
- '@content-collections/cli':
- specifier: ^0.1.7
- version: 0.1.7(@content-collections/[email protected]([email protected]))
- '@content-collections/core':
- specifier: ^0.11.1
- version: 0.11.1([email protected])
- '@content-collections/mdx':
- specifier: ^0.2.2
- '@content-collections/next':
- specifier: ^0.2.7
'@ianvs/prettier-plugin-sort-imports':
specifier: ^4.7.0
version: 4.7.0([email protected])
@@ -426,29 +423,6 @@ packages:
'@bundled-es-modules/[email protected]':
resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}
- '@clerc/[email protected]':
- resolution: {integrity: sha512-o8RgXNcMRoHRujSw9OPDMxqrmoNk7HG0XAZkjZgOrSyIfRXCf85VLyHGBT3XmaOrPEGY964h02ZxMVFdp8RnNQ==}
-
- '@clerc/[email protected]':
- resolution: {integrity: sha512-r69KpaB+EcWccqe31OwK5iyJQZmgmhxJjEBL4RAGlRr2tu6MRX42AOmD3GDW+ZPHkc4D9NJdkqukLboTJlbycA==}
- peerDependencies:
- '@clerc/core': '*'
-
- '@clerc/[email protected]':
- resolution: {integrity: sha512-QIH+Lrk6WZtXKNxEAA4gOk7dwseS7U0jTZ0TbJfcyOoNA3fF2p48UV8c7hmKk7OhfPS5009eJRW5CVQEgBB8Ng==}
- peerDependencies:
- '@clerc/core': '*'
-
- '@clerc/[email protected]':
- resolution: {integrity: sha512-YETH54A0sO32oJcLABpb4P5FyhEkhIhe5oe3IXyeUj9/LMcInvKCm6x/gDMIUjTQuh0a5l4iton0A1RscAANhw==}
- peerDependencies:
- '@clerc/core': '*'
-
- '@clerc/[email protected]':
- resolution: {integrity: sha512-//1zl8UgVhv1NbqsRoCWWci0Y9uBxzAVn8TqoKZchDywGQNZWK6vQI/Ms9uGe3+PZTDXedoXbVjklOINcVC2aA==}
- peerDependencies:
- '@clerc/core': '*'
-
'@commitlint/[email protected]':
resolution: {integrity: sha512-LXUdNIkspyxrlV6VDHWBmCZRtkEVRpBKxi2Gtw3J54cGWhLCTouVD/Q6ZSaSvd2YaDObWK8mDjrz3TIKtaQMAA==}
engines: {node: '>=v18'}
@@ -518,35 +492,6 @@ packages:
resolution: {integrity: sha512-/yCrWGCoA1SVKOks25EGadP9Pnj0oAIHGpl2wH2M2Y46dPM2ueb8wyCVOD7O3WCTkaJ0IkKvzhl1JY7+uCT2Dw==}
engines: {node: '>=v18'}
- '@content-collections/[email protected]':
- resolution: {integrity: sha512-dZn8vd6JSu2mXE1KYOEEq6Y7pwZ3vWjHE/LDj+9aSXNEddfXRGem2NNMO24NCuqFH/uIoVpS00Wnkj6gNqqnQw==}
- hasBin: true
- peerDependencies:
- '@content-collections/core': 0.x
-
- '@content-collections/[email protected]':
- resolution: {integrity: sha512-4ZbjxOjaDAxnj7mIij1q1vxZgOJQkA20ThoNZ0CsnmhJmUp+IDqIRLUyDyZ+4ZAk+zQy6bKeOzWzyLg32vMgRQ==}
- peerDependencies:
- typescript: ^5.0.2
-
- '@content-collections/[email protected]':
- resolution: {integrity: sha512-He+TXQC94LO/1bNygTioh3J5H0K/mkFVPVkIrM5kHybprvi5bRmGa91ViZ6K6icFAzGH4jFD0iasR56fZcMGTA==}
- peerDependencies:
- '@content-collections/core': 0.x
-
- '@content-collections/[email protected]':
- resolution: {integrity: sha512-7Xx8AohrSuq1jn/k44qWIq1s666KnksGPk64nnoY/T9mFZ7fZkdEtYezBsNpzkDMMKTnf65CNIvyFHtwTD2muA==}
- peerDependencies:
- '@content-collections/core': 0.x
- react: '>= 18'
- react-dom: '>= 18'
-
- '@content-collections/[email protected]':
- resolution: {integrity: sha512-9IOyOgMrubACDw5ZQ4a2e68MoH+gvKv1J0H2Jbe2wcDqiuXvr4rIznPAYG/jRJLqKoT8PN2FrbrjeVt7cEbxTQ==}
- peerDependencies:
- '@content-collections/core': 0.x
- next: ^12 || ^13 || ^14 || ^15
-
'@dotenvx/[email protected]':
resolution: {integrity: sha512-M1cyP6YstFQCjih54SAxCqHLMMi8QqV8tenpgGE48RTXWD7vfMYJiw/6xcCDpS2h28AcLpTsFCZA863Ge9yxzA==}
hasBin: true
@@ -566,11 +511,6 @@ packages:
'@emnapi/[email protected]':
resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==}
- '@esbuild-plugins/[email protected]':
- resolution: {integrity: sha512-+t5FdX3ATQlb53UFDBRb4nqjYBz492bIrnVWvpQHpzZlu9BQL5HasMZhqc409ygUwOWCXZhrWr6NyZ6T6Y+cxw==}
- peerDependencies:
- esbuild: '*'
-
'@esbuild/[email protected]':
resolution: {integrity: sha512-OaGtL73Jck6pBKjNIe24BnFE6agGl+6KxDtTfHhy1HmhthfKouEcOhqpSL64K4/0WCtbKFLOdzD/44cJ4k9opA==}
engines: {node: '>=18'}
@@ -777,9 +717,6 @@ packages:
'@essentials/[email protected]':
resolution: {integrity: sha512-lKZPhKScNFnR1MBnk4+sxshk46fpvdN+Uh1LlKWFO5g1ocuz4EcknNIL7tm/rsCAs/+xMWiBTwbDUvm+pDNlXw==}
- '@fal-works/[email protected]':
- resolution: {integrity: sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==}
-
'@floating-ui/[email protected]':
resolution: {integrity: sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==}
@@ -795,6 +732,9 @@ packages:
'@floating-ui/[email protected]':
resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
+ '@formatjs/[email protected]':
+ resolution: {integrity: sha512-ePEgLgVCqi2BBFnTMWPfIghu6FkbZnnBVhO2sSxvLfrdFw7wCHAHiDoM2h4NRgjbaY7+B7HgOLZGkK187pZTZg==}
+
'@heroicons/[email protected]':
resolution: {integrity: sha512-LMcepvRaS9LYHJGsF0zzmgKCUim/X3N/DQKc4jepAXJ7l8QxJ1PmxJzqplF2Z3FE4PqBAIGyJAQ/w4B5dsqbtQ==}
peerDependencies:
@@ -1023,11 +963,6 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
- '@mdx-js/[email protected]':
- resolution: {integrity: sha512-NS35VhTdvKNj5/B1JSD5W3kN1R0WDHgk+zCWq+tSChQw5L2Bgeiz7yyZPFrc5LWuPVOxE1xMbJr82bO9VVzmfQ==}
- peerDependencies:
- esbuild: '>=0.14.0'
-
'@mdx-js/[email protected]':
resolution: {integrity: sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ==}
@@ -1240,6 +1175,10 @@ packages:
'@open-draft/[email protected]':
resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==}
+ '@orama/[email protected]':
+ resolution: {integrity: sha512-O0hdKt4K31i8fpq8Bw5RfdPVAqm0EdduBUcluPo2MRcfCOwUEf5JlnvRhf/J0ezOYOD8jQ/LumYZxOVi/XK/BA==}
+ engines: {node: '>= 20.0.0'}
+
'@posthog/[email protected]':
resolution: {integrity: sha512-hWk3rUtJl2crQK0WNmwg13n82hnTwB99BT99/XI5gZSvIlYZ1TPmMZE8H2dhJJ98J/rm9vYJ/UXNzw3RV5HTpQ==}
@@ -1481,6 +1420,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-YB9mTFQvCOAQMHU+C/jVl96WmuWeltyUEpRJJky51huhds5W2FQr1J8D/16sQlf0ozxkPK8uF3niQMdUwZPv5w==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-kr0X2+6Yy/vJzLYJUPCZEc8SfQcf+1COFoAqauJm74umQhta9M7lNJHP7QQS3vkvcGLQUbWpMzwrXYwrYztHKA==}
peerDependencies:
@@ -1803,24 +1755,48 @@ packages:
'@shikijs/[email protected]':
resolution: {integrity: sha512-uu/8RExTKtavlpH7XqnVYBrfBkUc20ngXiX9NSrBhOVZYv/7XQRKUyhtkeflY5QsxC0GbJThCerruZfsUaSldg==}
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-L1Safnhra3tX/oJK5kYHaWmLEBJi1irASwewzY3taX5ibyXyMkkSDZlq01qigjryOBwrXSdFgTiZ3ryzSNeu7Q==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-VjnOpnQf8WuCEZtNUdjjwGUbtAVKuZkVQ/5cHy/tojVVRIRtlWMYVjyWhxOmIq05AlSOv72z7hRNRGVBgQOl0w==}
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-Nm3/azSsaVS7hk6EwtHEnTythjQfwvrO5tKqMlaH9TwG1P+PNaR8M0EAKZ+GaH2DFwvcr4iSfTveyxMIvXEHMw==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-pGd1wRATzbo/uatrCIILlAdFVKdxImWJGQ5rFiB5VZi2ve5xj3Ax9jny8QvkaV93btQEwR/rSz5ERFpC5mKNIw==}
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-hozwnFHsLvujK4/CPVHNo3Bcg2EsnG8krI/ZQ2FlBlCRpPZW4XAEQmEwqegJsypsTAN9ehu2tEYe30lYKSZW/w==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-Qfrrt5OsNH5R+5tJ/3uYBBZv3SuGmnRPejV9IlIbFH3HTGLDlkqgHymAlzklVmKBjAaVmkPkyikAV/sQ1wSL+w==}
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-bVx5PfuZHDSHoBal+KzJZGheFuyH4qwwcwG/n+MsWno5cTlKmaNtTsGzJpHYQ8YPbB5BdEdKU1rga5/6JGY8ww==}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-9wg+FKv0ByaQScTonpZdrDhADOoJP/yCWLAuiYYG6GehwNV5rGwnLvWKj33UmtLedKMSHzWUdB+Un6rfDFo/FA==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-wGrk+R8tJnO0VMzmUExHR+QdSaPUl/NKs+a4cQQRWyoc3YFbUzuLEi/KWK1hj+8BfHRKm2jNhhJck1dfstJpiw==}
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-fTR3QAgnwYpfGczpIbzPjlRnxyONJOerguQv1iwpyQZ9QXX4qy/XFQqXlf17XTsorxnHoJGbH/LXBvwtqDsF5A==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-SI494W5X60CaUwgi8u4q4m4s3YAFSxln3tzNjOSYqq54wlVgz0/NbbXEb3mdLbqMBztcmS7bVTaEd2w0qMmfeg==}
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-+z1aMq4N5RoNGY8i7qnTYmG2MBYzFmwkm/yOd6cjEI7OVzcldVvzQCfxU1YbIVgsyB0xHVc2jFe1JhgoXyUoSQ==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-ygl5yhxki9ZLNuNpPitBWvcy9fsSKKaRuO4BAlMyagszQidxcpLAr0qiW/q43DtSIDxO6hEbtYLiFZNXO/hdGw==}
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-K5UIBzxCyv0YoxN3LMrKB9zuhp1bV+LgewxuVwHdl4Gz5oePoUFrr9EfgJlGlDeXCU1b/yhdnXeuRvAnz8HN8Q==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==}
@@ -1997,15 +1973,9 @@ packages:
resolution: {integrity: sha512-hHkbU/eoO3EG5/MZkuFSKmYqPbSVk5byPFa3e7y/8TybHiLMACgI8seVYlicwk7H5K/rI2px9xrQp/C+AUDTiQ==}
- '@types/[email protected]':
- resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==}
-
resolution: {integrity: sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==}
- '@types/[email protected]':
- resolution: {integrity: sha512-hcZhlNvMkQG/k1vcZ6yHOl6WAYftQ2MLfTHcYRZ2xYZFD8tGVnE3qFV0lj1smQeDSR7/yY0PyuUalauf33bJeA==}
-
resolution: {integrity: sha512-ZoaihZNLeZSxESbk9PUAPZOlSpcKx81I1+4emtULDVmBLkYutTcMlCj2K9VNlf9EWODxdO6gkAqEaLorXwZQVA==}
@@ -2397,10 +2367,6 @@ packages:
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==}
- engines: {node: '>=16'}
-
resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==}
@@ -2530,6 +2496,9 @@ packages:
resolution: {integrity: sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==}
+ resolution: {integrity: sha512-VRhuHOLoKYOy4UbilLbUzbYg93XLjv2PncJC50EuTWPA3gaja1UjBsUP/D/9/juV3vQFr6XBEzn9KCAHdUvOHw==}
+
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
@@ -2723,9 +2692,6 @@ packages:
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
-
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
engines: {node: '>= 0.8'}
@@ -3112,9 +3078,6 @@ packages:
resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==}
- resolution: {integrity: sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==}
-
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
engines: {node: '>=12.0.0'}
@@ -3170,10 +3133,6 @@ packages:
resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==}
engines: {node: '>=14'}
- resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==}
- engines: {node: '>=0.4.x'}
-
resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==}
engines: {node: '>=12.20.0'}
@@ -3212,6 +3171,76 @@ packages:
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
+ resolution: {integrity: sha512-b30+TYKaqdNoOQ75dQqWw338KZsgLPCdZrQNP1gyLiDhE/A0kzJBe+jjLyIFL/6rLtZFa3HYVaV9GnRtazPW6Q==}
+ peerDependencies:
+ '@mixedbread/sdk': ^0.19.0
+ '@oramacloud/client': 1.x.x || 2.x.x
+ '@tanstack/react-router': 1.x.x
+ '@types/react': '*'
+ algoliasearch: 5.x.x
+ next: 14.x.x || 15.x.x
+ react: 18.x.x || 19.x.x
+ react-dom: 18.x.x || 19.x.x
+ react-router: 7.x.x
+ waku: ^0.26.0
+ peerDependenciesMeta:
+ '@mixedbread/sdk':
+ optional: true
+ '@oramacloud/client':
+ optional: true
+ '@tanstack/react-router':
+ optional: true
+ '@types/react':
+ optional: true
+ algoliasearch:
+ optional: true
+ next:
+ optional: true
+ react:
+ optional: true
+ react-dom:
+ optional: true
+ react-router:
+ optional: true
+ waku:
+ optional: true
+
+ resolution: {integrity: sha512-KYq7l1AEvJ0P99cZBgbeymRazkadoUWqolmTd0ZP5TXxBU50yomvvuMMvcvdvzS4RQ/y79nO3V+X6xaPDAZa3w==}
+ hasBin: true
+ peerDependencies:
+ '@fumadocs/mdx-remote': ^1.4.0
+ fumadocs-core: ^14.0.0 || ^15.0.0
+ next: ^15.3.0
+ react: '*'
+ vite: 6.x.x || 7.x.x
+ peerDependenciesMeta:
+ '@fumadocs/mdx-remote':
+ optional: true
+ next:
+ optional: true
+ react:
+ optional: true
+ vite:
+ optional: true
+
+ resolution: {integrity: sha512-N0qkWMi10ly2UYS4RCZy/lcbhbgBAguwc96RCZnBKaRRouHesO4V8Mq/kksEZ4ZMO7FQME6ORS56Jo7xDiqslg==}
+ peerDependencies:
+ '@types/react': '*'
+ next: 14.x.x || 15.x.x
+ react: 18.x.x || 19.x.x
+ react-dom: 18.x.x || 19.x.x
+ tailwindcss: ^3.4.14 || ^4.0.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ next:
+ optional: true
+ tailwindcss:
+ optional: true
+
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
@@ -3436,6 +3465,11 @@ packages:
resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==}
engines: {node: '>= 4'}
+ resolution: {integrity: sha512-IRqXKlaXwgSMAMtpNzZa1ZAe8m+Sa1770Dhk8VkSsP9LS+iHD62Zd8FQKs8fbPiagBE7BzoFX23cxFnwshpV6w==}
+ engines: {node: '>=16.x'}
+ hasBin: true
+
resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==}
engines: {node: '>=6'}
@@ -3585,9 +3619,6 @@ packages:
resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==}
engines: {node: '>=12'}
- resolution: {integrity: sha512-AKxe6+dvzAQsDXhhhxGRL9G67q5rKiyTL0BUl5mCyQz2NdvmqWNmMsjoCOIVdyXOYpP6MhkmZ1DPYGkfgv0MpA==}
-
resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
@@ -3851,9 +3882,6 @@ packages:
resolution: {integrity: sha512-1wd/kpAdKRLwv7/3OKC8zZ5U8e/fajCfWMxacUvB79S5nLrYGPtUI/8chMQhn3LQjsRVErTb9i1ECAwW0ZIHnQ==}
engines: {node: '>=20.0.0'}
- resolution: {integrity: sha512-QMPrnwPho7lfkzZUN3a0RJ/oiwpt464eXf6aVh1HGOYh+s7Utu78q3FcFbW59c8TNWWQaz9flKN1cEb8dmxD+g==}
-
resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==}
engines: {node: '>=4'}
@@ -3951,9 +3979,6 @@ packages:
resolution: {integrity: sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==}
- resolution: {integrity: sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA==}
-
resolution: {integrity: sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==}
@@ -4005,12 +4030,6 @@ packages:
resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==}
- resolution: {integrity: sha512-87FtxC7miUPznwqEaAlJARinHJ6Qin9kDuG2E2BCCNEOszr62kHpqivI/IF/CmwObVSpvApVFFxN1ftM/Gykvw==}
- engines: {node: '>=18', npm: '>=6'}
- peerDependencies:
- esbuild: 0.*
-
resolution: {integrity: sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==}
engines: {node: '>= 0.8'}
@@ -4037,9 +4056,6 @@ packages:
resolution: {integrity: sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==}
- resolution: {integrity: sha512-C4AkuM3dA58cgZha7zVnuVxBhDsbttIMiytjgsM2XbHAB2faRVaHRle40558FBN+DJcrLNCoqG5mlrpdU4cRtg==}
-
resolution: {integrity: sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==}
@@ -4309,6 +4325,10 @@ packages:
resolution: {integrity: sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-tt6PvKu4WyzPwWUzy/hvPFqn+uwXO0K1ZHka8az3NnrhWJDmSqI8ncWq0fkL0k/lmmi5tAC11FXwXuh0rFbt1A==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
@@ -4367,9 +4387,15 @@ packages:
resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==}
+
resolution: {integrity: sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ==}
+ resolution: {integrity: sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg==}
+
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
@@ -4393,10 +4419,6 @@ packages:
resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
- resolution: {integrity: sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==}
- engines: {node: '>=18'}
-
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
engines: {node: '>=10'}
@@ -4516,10 +4538,6 @@ packages:
resolution: {integrity: sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ==}
engines: {node: '>=16.20.0'}
- resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
- engines: {node: '>=4'}
-
resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}
engines: {node: '>= 0.4'}
@@ -4760,9 +4778,6 @@ packages:
resolution: {integrity: sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==}
- resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
-
resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}
engines: {node: '>= 0.6'}
@@ -4791,6 +4806,12 @@ packages:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
+ resolution: {integrity: sha512-RCIzVlsKqy3BYgGgYbolUfuvx0aSKC7YhX/IJGEp+WJxsqdIVYJHkBdj++FAj6VD7RiWj6VVmdCfa/9vJE9hZg==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+
resolution: {integrity: sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==}
engines: {node: '>=10'}
@@ -4902,15 +4923,9 @@ packages:
resolution: {integrity: sha512-fgwLruqlZbVOIhCJFjY+JDwPZhA4/eK3InJzN8Ox8UDdtudpG212JwtRj6la+lAzJU7JmSEyewZSukVZdknt3Q==}
engines: {node: '>= 12'}
- resolution: {integrity: sha512-XTFYvNASMe5iPN0719nPrdItC9aU0ssC4v14mH1BCi1u0n1gAocqcujWUrByftZTbLhRtiKRyjYTSIOcr69UVQ==}
-
resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==}
- resolution: {integrity: sha512-PZzAiDGOEfv1Ua7exQ8S5kKxkD8CDaSb4nM+1Mprs6u8dyvQifakh+kCj6NovfGXW+bTvrhjaR3srzjS2qJHKg==}
-
resolution: {integrity: sha512-Pjj2IYlUY3+D8x00UJsIOg5BEvfMyeI+2uLPn9VO9Wg4MEtN/VTIq2NEJQfde9PnX15KgtHyl9S0BcTnWrIuWg==}
@@ -5013,6 +5028,9 @@ packages:
resolution: {integrity: sha512-RJr9EaCmsLzBX2NDiO5Z3ux2BVosNZN5jo0gWgsyKvxKIUL5R3swNvoorulAeL9kLB0iTSX7V6aokhla2m7xbg==}
+ resolution: {integrity: sha512-49oNpRjWRvnU8NyGVmUaYG4jtTkNonFZI86MmGRDqBphEK2EXT9gdEUoQPZhuBM8yWHxCWbobltqYO5M4XrUvQ==}
+
resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==}
engines: {node: '>=4'}
@@ -5034,9 +5052,6 @@ packages:
resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==}
engines: {node: '>= 18'}
- resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==}
-
resolution: {integrity: sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==}
engines: {node: '>= 18'}
@@ -5087,6 +5102,9 @@ packages:
resolution: {integrity: sha512-mI//trrsaiCIPsja5CNfsyNOqgAZUb6VpJA+340toL42UpzQlXpwRV9nch69X6gaUxrr9kaOOa6e3y3uAkGFxQ==}
+ resolution: {integrity: sha512-uIrKI+f9IPz1zDT+GMz+0RjzKJiijVr6WDWm9Pe3NNY6QigKCfifCEv9v9R2mDASKKjzjQ2QpFLcxaR3iHSnMA==}
+
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
engines: {node: '>= 0.4'}
@@ -5198,10 +5216,6 @@ packages:
resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==}
engines: {node: '>=12'}
- resolution: {integrity: sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==}
- engines: {node: '>=16'}
-
resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==}
engines: {node: '>=18'}
@@ -5350,9 +5364,6 @@ packages:
resolution: {integrity: sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
-
resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
@@ -5391,9 +5402,6 @@ packages:
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
engines: {node: '>=0.6'}
- resolution: {integrity: sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==}
-
resolution: {integrity: sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==}
engines: {node: '>=16'}
@@ -5492,9 +5500,6 @@ packages:
resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==}
engines: {node: '>=16'}
- resolution: {integrity: sha512-3YaYwMseXCAhBB14RXW5cRQfJQlEknS6i4C8fCfeUdS3ihG9EdccdR9kt3vP73ZdeTGmPb4bZtkDn5XMIn1DLA==}
-
resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==}
engines: {node: '>= 0.6'}
@@ -5625,10 +5630,6 @@ packages:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
- resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
- hasBin: true
-
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
@@ -5750,10 +5751,6 @@ packages:
resolution: {integrity: sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-qJNAmSF77lWjfRVwCZK3PcKYWrr+55RUQTiXDxXHGbxzf8WuuRgftIB3hqZ5fykjOF/MC62cazsG/2ZDBedOnQ==}
- engines: {node: '>=14.16'}
-
resolution: {integrity: sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==}
engines: {node: '>=18'}
@@ -5766,6 +5763,9 @@ packages:
resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==}
+ resolution: {integrity: sha512-5R1P+WwQqmmMIEACyzSvo4JXHY5WiAFHRMg+zBZKgKS+Q1viRa0C1hmUKtHltoIFKtIdki3pRxkmpP74jnNYHQ==}
+
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
@@ -5952,38 +5952,6 @@ snapshots:
dependencies:
statuses: 2.0.2
- '@clerc/[email protected]':
- dependencies:
- '@clerc/utils': 0.44.0(@clerc/[email protected])
- defu: 6.1.4
- is-platform: 1.0.0
- lite-emit: 2.3.0
- type-fest: 4.41.0
- type-flag: 3.0.0
-
- dependencies:
- '@clerc/core': 0.44.0
- '@clerc/utils': 0.44.0(@clerc/[email protected])
-
- dependencies:
- '@clerc/core': 0.44.0
- '@clerc/utils': 0.44.0(@clerc/[email protected])
- '@types/text-table': 0.2.5
- string-width: 6.1.0
- text-table: 0.2.0
- yoctocolors: 1.0.0
-
- dependencies:
- '@clerc/core': 0.44.0
- '@clerc/utils': 0.44.0(@clerc/[email protected])
-
- dependencies:
- '@clerc/core': 0.44.0
-
dependencies:
'@commitlint/format': 19.8.1
@@ -6094,52 +6062,6 @@ snapshots:
'@types/conventional-commits-parser': 5.0.1
chalk: 5.6.2
- '@content-collections/[email protected](@content-collections/[email protected]([email protected]))':
- dependencies:
- '@clerc/core': 0.44.0
- '@clerc/plugin-completions': 0.44.0(@clerc/[email protected])
- '@clerc/plugin-help': 0.44.0(@clerc/[email protected])
- '@clerc/plugin-version': 0.44.0(@clerc/[email protected])
- '@content-collections/core': 0.11.1([email protected])
- '@content-collections/integrations': 0.3.0(@content-collections/[email protected]([email protected]))
-
- '@content-collections/[email protected]([email protected])':
- dependencies:
- '@standard-schema/spec': 1.0.0
- camelcase: 8.0.0
- chokidar: 4.0.3
- esbuild: 0.25.9
- gray-matter: 4.0.3
- p-limit: 6.2.0
- picomatch: 4.0.3
- pluralize: 8.0.0
- serialize-javascript: 6.0.2
- tinyglobby: 0.2.15
- typescript: 5.9.2
- yaml: 2.8.1
- zod: 3.25.76
-
- '@content-collections/[email protected](@content-collections/[email protected]([email protected]))':
- dependencies:
- '@content-collections/core': 0.11.1([email protected])
-
- dependencies:
- '@content-collections/core': 0.11.1([email protected])
- esbuild: 0.25.9
- mdx-bundler: 10.1.1([email protected])
- react: 19.1.1
- react-dom: 19.1.1([email protected])
- unified: 11.0.5
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@content-collections/core': 0.11.1([email protected])
- '@content-collections/integrations': 0.3.0(@content-collections/[email protected]([email protected]))
-
'@dotenvx/[email protected]':
dependencies:
commander: 11.1.0
@@ -6172,16 +6094,6 @@ snapshots:
tslib: 2.8.1
optional: true
- '@esbuild-plugins/[email protected]([email protected])':
- dependencies:
- '@types/resolve': 1.20.6
- debug: 4.4.3
- esbuild: 0.25.9
- escape-string-regexp: 4.0.0
- resolve: 1.22.10
- transitivePeerDependencies:
- - supports-color
-
'@esbuild/[email protected]':
optional: true
@@ -6314,8 +6226,6 @@ snapshots:
dependencies:
'@essentials/raf': 1.2.0
- '@fal-works/[email protected]': {}
-
'@floating-ui/[email protected]':
dependencies:
'@floating-ui/utils': 0.2.10
@@ -6333,6 +6243,10 @@ snapshots:
'@floating-ui/[email protected]': {}
+ '@formatjs/[email protected]':
+ dependencies:
+ tslib: 2.8.1
+
dependencies:
react: 19.1.1
@@ -6511,17 +6425,6 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5
- dependencies:
- '@mdx-js/mdx': 3.1.1
- '@types/unist': 3.0.3
- esbuild: 0.25.9
- source-map: 0.7.6
- vfile: 6.0.3
- vfile-message: 4.0.3
- transitivePeerDependencies:
- - supports-color
-
'@mdx-js/[email protected]':
dependencies:
'@types/estree': 1.0.8
@@ -6793,6 +6696,8 @@ snapshots:
'@open-draft/[email protected]': {}
+ '@orama/[email protected]': {}
+
'@posthog/[email protected]': {}
'@radix-ui/[email protected]': {}
@@ -7042,6 +6947,28 @@ snapshots:
'@types/react': 19.1.13
'@types/react-dom': 19.1.9(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-visually-hidden': 1.2.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ react: 19.1.1
+ react-dom: 19.1.1([email protected])
+ optionalDependencies:
+ '@types/react': 19.1.13
+ '@types/react-dom': 19.1.9(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -7384,35 +7311,80 @@ snapshots:
'@types/hast': 3.0.4
hast-util-to-html: 9.0.5
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 3.12.2
+ '@shikijs/vscode-textmate': 10.0.2
+ '@types/hast': 3.0.4
+ hast-util-to-html: 9.0.5
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/types': 2.5.0
'@shikijs/vscode-textmate': 10.0.2
oniguruma-to-es: 3.1.1
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 3.12.2
+ '@shikijs/vscode-textmate': 10.0.2
+ oniguruma-to-es: 4.3.3
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/types': 2.5.0
'@shikijs/vscode-textmate': 10.0.2
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 3.12.2
+ '@shikijs/vscode-textmate': 10.0.2
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/types': 2.5.0
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 3.12.2
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 3.12.2
+ '@types/hast': 3.0.4
+ hast-util-to-string: 3.0.1
+ shiki: 3.12.2
+ unified: 11.0.5
+ unist-util-visit: 5.0.0
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/types': 2.5.0
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 3.12.2
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/core': 2.5.0
'@shikijs/types': 2.5.0
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/core': 3.12.2
+ '@shikijs/types': 3.12.2
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/vscode-textmate': 10.0.2
'@types/hast': 3.0.4
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/vscode-textmate': 10.0.2
+ '@types/hast': 3.0.4
+
'@shikijs/[email protected]': {}
'@sindresorhus/[email protected]': {}
@@ -7580,12 +7552,8 @@ snapshots:
dependencies:
csstype: 3.1.3
- '@types/[email protected]': {}
-
'@types/[email protected]': {}
- '@types/[email protected]': {}
-
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -8003,8 +7971,6 @@ snapshots:
-
dependencies:
browserslist: 4.26.0
@@ -8131,6 +8097,8 @@ snapshots:
array-ify: 1.0.0
dot-prop: 5.3.0
+
@@ -8340,8 +8308,6 @@ snapshots:
has-property-descriptors: 1.0.2
object-keys: 1.1.1
-
@@ -8937,10 +8903,6 @@ snapshots:
dependencies:
reusify: 1.1.0
- dependencies:
- format: 0.2.2
-
optionalDependencies:
picomatch: 4.0.3
@@ -9002,8 +8964,6 @@ snapshots:
cross-spawn: 7.0.6
signal-exit: 4.1.0
-
dependencies:
fetch-blob: 3.2.0
@@ -9032,6 +8992,93 @@ snapshots:
optional: true
+ dependencies:
+ '@formatjs/intl-localematcher': 0.6.1
+ '@orama/orama': 3.1.13
+ '@shikijs/rehype': 3.12.2
+ '@shikijs/transformers': 3.12.2
+ github-slugger: 2.0.0
+ hast-util-to-estree: 3.1.3
+ hast-util-to-jsx-runtime: 2.3.6
+ image-size: 2.0.2
+ negotiator: 1.0.0
+ npm-to-yarn: 3.0.1
+ react-remove-scroll: 2.7.1(@types/[email protected])([email protected])
+ remark: 15.0.1
+ remark-gfm: 4.0.1
+ remark-rehype: 11.1.2
+ scroll-into-view-if-needed: 3.1.0
+ shiki: 3.12.2
+ unist-util-visit: 5.0.0
+ optionalDependencies:
+ '@types/react': 19.1.13
+ react: 19.1.1
+ react-dom: 19.1.1([email protected])
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@mdx-js/mdx': 3.1.1
+ '@standard-schema/spec': 1.0.0
+ chokidar: 4.0.3
+ esbuild: 0.25.9
+ estree-util-value-to-estree: 3.4.0
+ js-yaml: 4.1.0
+ lru-cache: 11.2.1
+ picocolors: 1.1.1
+ remark-mdx: 3.1.1
+ remark-parse: 11.0.0
+ tinyexec: 1.0.1
+ tinyglobby: 0.2.15
+ unified: 11.0.5
+ unist-util-visit: 5.0.0
+ zod: 4.1.8
+ optionalDependencies:
+ react: 19.1.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@radix-ui/react-collapsible': 1.1.12(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-navigation-menu': 1.2.14(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-scroll-area': 1.2.10(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-slot': 1.2.3(@types/[email protected])([email protected])
+ class-variance-authority: 0.7.1
+ lodash.merge: 4.6.2
+ postcss-selector-parser: 7.1.0
+ react: 19.1.1
+ react-dom: 19.1.1([email protected])
+ react-medium-image-zoom: 5.3.0([email protected]([email protected]))([email protected])
+ scroll-into-view-if-needed: 3.1.0
+ tailwind-merge: 3.3.1
+ optionalDependencies:
+ '@types/react': 19.1.13
+ tailwindcss: 4.1.13
+ transitivePeerDependencies:
+ - '@mixedbread/sdk'
+ - '@oramacloud/client'
+ - '@tanstack/react-router'
+ - '@types/react-dom'
+ - algoliasearch
+ - react-router
+ - supports-color
+ - waku
+
@@ -9322,6 +9369,8 @@ snapshots:
+
dependencies:
parent-module: 1.0.1
@@ -9453,8 +9502,6 @@ snapshots:
-
@@ -9678,8 +9725,6 @@ snapshots:
rfdc: 1.4.1
wrap-ansi: 9.0.2
-
dependencies:
graceful-fs: 4.2.11
@@ -9795,17 +9840,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- '@types/mdast': 4.0.4
- devlop: 1.1.0
- escape-string-regexp: 5.0.0
- mdast-util-from-markdown: 2.0.2
- mdast-util-to-markdown: 2.1.2
- micromark-extension-frontmatter: 2.0.0
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@types/mdast': 4.0.4
@@ -9959,21 +9993,6 @@ snapshots:
- dependencies:
- '@babel/runtime': 7.28.4
- '@esbuild-plugins/node-resolve': 0.2.2([email protected])
- '@fal-works/esbuild-plugin-global-externals': 2.1.2
- '@mdx-js/esbuild': 3.1.1([email protected])
- esbuild: 0.25.9
- gray-matter: 4.0.3
- remark-frontmatter: 5.0.0
- remark-mdx-frontmatter: 4.0.0
- uuid: 9.0.1
- vfile: 6.0.3
- transitivePeerDependencies:
- - supports-color
-
@@ -10005,13 +10024,6 @@ snapshots:
micromark-util-symbol: 2.0.1
micromark-util-types: 2.0.2
- dependencies:
- fault: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
dependencies:
micromark-util-character: 2.1.1
@@ -10418,6 +10430,8 @@ snapshots:
path-key: 4.0.0
unicorn-magic: 0.3.0
+
dependencies:
boolbase: 1.0.0
@@ -10496,12 +10510,20 @@ snapshots:
dependencies:
mimic-function: 5.0.1
+
dependencies:
emoji-regex-xs: 1.0.0
regex: 6.0.1
regex-recursion: 6.0.2
+ dependencies:
+ oniguruma-parser: 0.12.1
+ regex: 6.0.1
+ regex-recursion: 6.0.2
+
dependencies:
deep-is: 0.1.4
@@ -10539,10 +10561,6 @@ snapshots:
dependencies:
yocto-queue: 1.2.1
- dependencies:
- yocto-queue: 1.2.1
-
dependencies:
p-limit: 3.1.0
@@ -10636,8 +10654,6 @@ snapshots:
-
@@ -10859,10 +10875,6 @@ snapshots:
- dependencies:
- safe-buffer: 5.2.1
-
@@ -10888,6 +10900,11 @@ snapshots:
+ dependencies:
+ react: 19.1.1
+ react-dom: 19.1.1([email protected])
+
dependencies:
react: 19.1.1
@@ -11060,15 +11077,6 @@ snapshots:
to-gatsby-remark-plugin: 0.1.0
unist-util-visit: 4.1.2
- dependencies:
- '@types/mdast': 4.0.4
- mdast-util-frontmatter: 2.0.1
- micromark-extension-frontmatter: 2.0.0
- unified: 11.0.5
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@types/mdast': 4.0.4
@@ -11080,15 +11088,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- '@types/mdast': 4.0.4
- estree-util-is-identifier-name: 3.0.0
- estree-util-value-to-estree: 3.4.0
- toml: 3.0.0
- unified: 11.0.5
- yaml: 2.8.1
-
dependencies:
mdast-util-mdx: 3.0.0
@@ -11215,6 +11214,10 @@ snapshots:
+ dependencies:
+ compute-scroll-into-view: 3.1.1
+
dependencies:
extend-shallow: 2.0.1
@@ -11242,10 +11245,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- randombytes: 2.1.0
-
dependencies:
encodeurl: 2.0.0
@@ -11370,6 +11369,17 @@ snapshots:
'@shikijs/vscode-textmate': 10.0.2
'@types/hast': 3.0.4
+ dependencies:
+ '@shikijs/core': 3.12.2
+ '@shikijs/engine-javascript': 3.12.2
+ '@shikijs/engine-oniguruma': 3.12.2
+ '@shikijs/langs': 3.12.2
+ '@shikijs/themes': 3.12.2
+ '@shikijs/types': 3.12.2
+ '@shikijs/vscode-textmate': 10.0.2
+ '@types/hast': 3.0.4
+
dependencies:
es-errors: 1.3.0
@@ -11476,12 +11486,6 @@ snapshots:
emoji-regex: 9.2.2
strip-ansi: 7.1.2
- dependencies:
- eastasianwidth: 0.2.0
- emoji-regex: 10.5.0
- strip-ansi: 7.1.2
-
dependencies:
emoji-regex: 10.5.0
@@ -11653,8 +11657,6 @@ snapshots:
-
@@ -11689,8 +11691,6 @@ snapshots:
-
dependencies:
tldts: 7.0.14
@@ -11781,8 +11781,6 @@ snapshots:
-
dependencies:
content-type: 1.0.5
@@ -11960,8 +11958,6 @@ snapshots:
-
dependencies:
spdx-correct: 3.2.0
@@ -12109,8 +12105,6 @@ snapshots:
-
@@ -12119,4 +12113,6 @@ snapshots:
+
diff --git a/turbo.json b/turbo.json
index c12306ee..6ab02ef5 100644
--- a/turbo.json
+++ b/turbo.json
@@ -2,7 +2,7 @@
"$schema": "https://turbo.build/schema.json",
"ui": "tui",
"envMode": "strict",
- "globalEnv": ["NODE_ENV"],
+ "globalEnv": ["NODE_ENV", "NEXT_PUBLIC_POSTHOG_API_KEY"],
"tasks": {
"build": {
"dependsOn": ["^build"],