From b7fc3167d82b2a275c3992c6cbef69a799415fbe Mon Sep 17 00:00:00 2001 From: shadcn Date: Mon, 26 Aug 2024 16:55:29 +0400 Subject: [PATCH] fix(www): themes --- .../new-york/block/sidebar-01.tsx | 1 - .../registry/styles/default/daylight.json | 58 ----------------- .../registry/styles/default/hello-block.json | 50 --------------- .../styles/default/theme-daylight.json | 28 ++++----- .../styles/default/theme-midnight.json | 28 ++++----- .../styles/default/use-media-query.json | 14 ----- .../registry/styles/new-york/daylight.json | 58 ----------------- .../registry/styles/new-york/hello-block.json | 50 --------------- .../registry/styles/new-york/sidebar-01.json | 4 +- .../styles/new-york/theme-daylight.json | 28 ++++----- .../styles/new-york/theme-midnight.json | 28 ++++----- .../styles/new-york/use-media-query.json | 14 ----- .../new-york/block/sidebar-01/page.tsx | 1 - .../new-york/block/sidebar-01/ui/sidebar.tsx | 11 ++-- apps/www/registry/registry-themes.ts | 56 ++++++++--------- apps/www/scripts/build-registry.mts | 63 ++++++++++--------- packages/cli/src/utils/get-project-info.ts | 2 +- 17 files changed, 125 insertions(+), 369 deletions(-) delete mode 100644 apps/www/public/registry/styles/default/daylight.json delete mode 100644 apps/www/public/registry/styles/default/hello-block.json delete mode 100644 apps/www/public/registry/styles/default/use-media-query.json delete mode 100644 apps/www/public/registry/styles/new-york/daylight.json delete mode 100644 apps/www/public/registry/styles/new-york/hello-block.json delete mode 100644 apps/www/public/registry/styles/new-york/use-media-query.json diff --git a/apps/www/__registry__/new-york/block/sidebar-01.tsx b/apps/www/__registry__/new-york/block/sidebar-01.tsx index 59a662b345..71ac9cef57 100644 --- a/apps/www/__registry__/new-york/block/sidebar-01.tsx +++ b/apps/www/__registry__/new-york/block/sidebar-01.tsx @@ -2,7 +2,6 @@ import { cookies } from "next/headers" import { AppSidebar } from "@/registry/new-york/block/sidebar-01/components/app-sidebar" import { - SIDEBAR_STATE_COOKIE, SidebarLayout, SidebarTrigger, } from "@/registry/new-york/block/sidebar-01/ui/sidebar" diff --git a/apps/www/public/registry/styles/default/daylight.json b/apps/www/public/registry/styles/default/daylight.json deleted file mode 100644 index dfa57165c8..0000000000 --- a/apps/www/public/registry/styles/default/daylight.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "daylight", - "type": "registry:theme", - "cssVars": { - "light": { - "background": "0 0% 100%", - "foreground": "240 10% 3.9%", - "card": "0 0% 100%", - "card-foreground": "240 10% 3.9%", - "popover": "0 0% 100%", - "popover-foreground": "240 10% 3.9%", - "primary": "240 5.9% 10%", - "primary-foreground": "0 0% 98%", - "secondary": "240 4.8% 95.9%", - "secondary-foreground": "240 5.9% 10%", - "muted": "240 4.8% 95.9%", - "muted-foreground": "240 3.8% 46.1%", - "accent": "240 4.8% 95.9%", - "accent-foreground": "240 5.9% 10%", - "destructive": "0 84.2% 60.2%", - "destructive-foreground": "0 0% 98%", - "border": "240 5.9% 90%", - "input": "240 5.9% 90%", - "ring": "240 10% 3.9%", - "chart-1": "173 58% 39%", - "chart-2": "12 76% 61%", - "chart-3": "197 37% 24%", - "chart-4": "43 74% 66%", - "chart-5": "27 87% 67%" - }, - "dark": { - "background": "240 10% 3.9%", - "foreground": "0 0% 98%", - "card": "240 10% 3.9%", - "card-foreground": "0 0% 98%", - "popover": "240 10% 3.9%", - "popover-foreground": "0 0% 98%", - "primary": "0 0% 98%", - "primary-foreground": "240 5.9% 10%", - "secondary": "240 3.7% 15.9%", - "secondary-foreground": "0 0% 98%", - "muted": "240 3.7% 15.9%", - "muted-foreground": "240 5% 64.9%", - "accent": "240 3.7% 15.9%", - "accent-foreground": "0 0% 98%", - "destructive": "0 62.8% 30.6%", - "destructive-foreground": "0 0% 98%", - "border": "240 3.7% 15.9%", - "input": "240 3.7% 15.9%", - "ring": "240 4.9% 83.9%", - "chart-1": "220 70% 50%", - "chart-5": "160 60% 45%", - "chart-3": "30 80% 55%", - "chart-4": "280 65% 60%", - "chart-2": "340 75% 55%" - } - } -} \ No newline at end of file diff --git a/apps/www/public/registry/styles/default/hello-block.json b/apps/www/public/registry/styles/default/hello-block.json deleted file mode 100644 index 96c4d18f20..0000000000 --- a/apps/www/public/registry/styles/default/hello-block.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "hello-block", - "type": "registry:block", - "registryDependencies": [ - "button", - "use-media-query", - "card" - ], - "files": [ - { - "path": "block/hello-block/hello-block.tsx", - "type": "registry:block", - "content": "\"use client\"\n\nimport { HelloCard } from \"@/registry/default/block/hello-block/components/hello-card\"\nimport { useMediaQuery } from \"@/registry/default/hooks/use-media-query\"\nimport { cn } from \"@/registry/default/lib/utils\"\nimport { Button } from \"@/registry/default/ui/button\"\n\nexport default function HelloBlock() {\n const isDesktop = useMediaQuery(\"(min-width: 768px)\")\n\n return (\n \n

Hello. This is a component inside a block.

\n

You are currently on {isDesktop ? \"desktop\" : \"mobile\"}

\n \n \n )\n}\n" - }, - { - "path": "block/hello-block/components/hello-card.tsx", - "type": "registry:block", - "content": "import {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from \"@/registry/default/ui/card\"\n\nexport function HelloCard({\n title,\n children,\n className,\n}: {\n title: string\n} & React.ComponentProps) {\n return (\n \n \n {title}\n \n {children}\n \n )\n}\n" - } - ], - "tailwind": { - "config": { - "theme": { - "extend": { - "colors": { - "brand": { - "primary": "var(--brand-primary)", - "secondary": "var(--brand-secondary)" - } - }, - "boxShadow": { - "brand": "0px 0px 10px 0px rgba(255, 255, 255, 0.10)" - } - } - } - } - }, - "cssVars": { - "light": { - "brand-primary": "#a855f7", - "brand-secondary": "#10b981" - }, - "dark": { - "brand-primary": "#831843", - "brand-secondary": "#ccfbf1" - } - }, - "category": "Application", - "subcategory": "Examples" -} \ No newline at end of file diff --git a/apps/www/public/registry/styles/default/theme-daylight.json b/apps/www/public/registry/styles/default/theme-daylight.json index a3c91efe1a..a6f4f11089 100644 --- a/apps/www/public/registry/styles/default/theme-daylight.json +++ b/apps/www/public/registry/styles/default/theme-daylight.json @@ -6,19 +6,19 @@ "background": "36 39% 88%", "foreground": "36 45% 15%", "primary": "36 45% 70%", - "primaryForeground": "36 45% 11%", + "primary-foreground": "36 45% 11%", "secondary": "40 35% 77%", - "secondaryForeground": "36 45% 25%", + "secondary-foreground": "36 45% 25%", "accent": "36 64% 57%", - "accentForeground": "36 72% 17%", + "accent-foreground": "36 72% 17%", "destructive": "0 84% 37%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "36 33% 75%", - "mutedForeground": "36 45% 25%", + "muted-foreground": "36 45% 25%", "card": "36 46% 82%", - "cardForeground": "36 45% 20%", + "card-foreground": "36 45% 20%", "popover": "0 0% 100%", - "popoverForeground": "240 10% 3.9%", + "popover-foreground": "240 10% 3.9%", "border": "36 45% 60%", "input": "36 45% 60%", "ring": "36 45% 30%", @@ -32,19 +32,19 @@ "background": "36 39% 88%", "foreground": "36 45% 15%", "primary": "36 45% 70%", - "primaryForeground": "36 45% 11%", + "primary-foreground": "36 45% 11%", "secondary": "40 35% 77%", - "secondaryForeground": "36 45% 25%", + "secondary-foreground": "36 45% 25%", "accent": "36 64% 57%", - "accentForeground": "36 72% 17%", + "accent-foreground": "36 72% 17%", "destructive": "0 84% 37%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "36 33% 75%", - "mutedForeground": "36 45% 25%", + "muted-foreground": "36 45% 25%", "card": "36 46% 82%", - "cardForeground": "36 45% 20%", + "card-foreground": "36 45% 20%", "popover": "0 0% 100%", - "popoverForeground": "240 10% 3.9%", + "popover-foreground": "240 10% 3.9%", "border": "36 45% 60%", "input": "36 45% 60%", "ring": "36 45% 30%", diff --git a/apps/www/public/registry/styles/default/theme-midnight.json b/apps/www/public/registry/styles/default/theme-midnight.json index 3f788b528c..af39a8a05d 100644 --- a/apps/www/public/registry/styles/default/theme-midnight.json +++ b/apps/www/public/registry/styles/default/theme-midnight.json @@ -6,19 +6,19 @@ "background": "240 5% 6%", "foreground": "60 5% 90%", "primary": "240 0% 90%", - "primaryForeground": "60 0% 0%", + "primary-foreground": "60 0% 0%", "secondary": "240 4% 15%", - "secondaryForeground": "60 5% 85%", + "secondary-foreground": "60 5% 85%", "accent": "240 0% 13%", - "accentForeground": "60 0% 100%", + "accent-foreground": "60 0% 100%", "destructive": "0 60% 50%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "240 5% 25%", - "mutedForeground": "60 5% 85%", + "muted-foreground": "60 5% 85%", "card": "240 4% 10%", - "cardForeground": "60 5% 90%", + "card-foreground": "60 5% 90%", "popover": "240 5% 15%", - "popoverForeground": "60 5% 85%", + "popover-foreground": "60 5% 85%", "border": "240 6% 20%", "input": "240 6% 20%", "ring": "240 5% 90%", @@ -32,19 +32,19 @@ "background": "240 5% 6%", "foreground": "60 5% 90%", "primary": "240 0% 90%", - "primaryForeground": "60 0% 0%", + "primary-foreground": "60 0% 0%", "secondary": "240 4% 15%", - "secondaryForeground": "60 5% 85%", + "secondary-foreground": "60 5% 85%", "accent": "240 0% 13%", - "accentForeground": "60 0% 100%", + "accent-foreground": "60 0% 100%", "destructive": "0 60% 50%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "240 5% 25%", - "mutedForeground": "60 5% 85%", + "muted-foreground": "60 5% 85%", "card": "240 4% 10%", - "cardForeground": "60 5% 90%", + "card-foreground": "60 5% 90%", "popover": "240 5% 15%", - "popoverForeground": "60 5% 85%", + "popover-foreground": "60 5% 85%", "border": "240 6% 20%", "input": "240 6% 20%", "ring": "240 5% 90%", diff --git a/apps/www/public/registry/styles/default/use-media-query.json b/apps/www/public/registry/styles/default/use-media-query.json deleted file mode 100644 index d2b1781d52..0000000000 --- a/apps/www/public/registry/styles/default/use-media-query.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "use-media-query", - "type": "registry:hook", - "dependencies": [ - "@react-hook/window-size@1.0.3" - ], - "files": [ - { - "path": "hooks/use-media-query.ts", - "type": "registry:hook", - "content": "import * as React from \"react\"\n\nexport function useMediaQuery(query: string) {\n const [value, setValue] = React.useState(false)\n\n React.useEffect(() => {\n function onChange(event: MediaQueryListEvent) {\n setValue(event.matches)\n }\n\n const result = matchMedia(query)\n result.addEventListener(\"change\", onChange)\n setValue(result.matches)\n\n return () => result.removeEventListener(\"change\", onChange)\n }, [query])\n\n return value\n}\n" - } - ] -} \ No newline at end of file diff --git a/apps/www/public/registry/styles/new-york/daylight.json b/apps/www/public/registry/styles/new-york/daylight.json deleted file mode 100644 index dfa57165c8..0000000000 --- a/apps/www/public/registry/styles/new-york/daylight.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "daylight", - "type": "registry:theme", - "cssVars": { - "light": { - "background": "0 0% 100%", - "foreground": "240 10% 3.9%", - "card": "0 0% 100%", - "card-foreground": "240 10% 3.9%", - "popover": "0 0% 100%", - "popover-foreground": "240 10% 3.9%", - "primary": "240 5.9% 10%", - "primary-foreground": "0 0% 98%", - "secondary": "240 4.8% 95.9%", - "secondary-foreground": "240 5.9% 10%", - "muted": "240 4.8% 95.9%", - "muted-foreground": "240 3.8% 46.1%", - "accent": "240 4.8% 95.9%", - "accent-foreground": "240 5.9% 10%", - "destructive": "0 84.2% 60.2%", - "destructive-foreground": "0 0% 98%", - "border": "240 5.9% 90%", - "input": "240 5.9% 90%", - "ring": "240 10% 3.9%", - "chart-1": "173 58% 39%", - "chart-2": "12 76% 61%", - "chart-3": "197 37% 24%", - "chart-4": "43 74% 66%", - "chart-5": "27 87% 67%" - }, - "dark": { - "background": "240 10% 3.9%", - "foreground": "0 0% 98%", - "card": "240 10% 3.9%", - "card-foreground": "0 0% 98%", - "popover": "240 10% 3.9%", - "popover-foreground": "0 0% 98%", - "primary": "0 0% 98%", - "primary-foreground": "240 5.9% 10%", - "secondary": "240 3.7% 15.9%", - "secondary-foreground": "0 0% 98%", - "muted": "240 3.7% 15.9%", - "muted-foreground": "240 5% 64.9%", - "accent": "240 3.7% 15.9%", - "accent-foreground": "0 0% 98%", - "destructive": "0 62.8% 30.6%", - "destructive-foreground": "0 0% 98%", - "border": "240 3.7% 15.9%", - "input": "240 3.7% 15.9%", - "ring": "240 4.9% 83.9%", - "chart-1": "220 70% 50%", - "chart-5": "160 60% 45%", - "chart-3": "30 80% 55%", - "chart-4": "280 65% 60%", - "chart-2": "340 75% 55%" - } - } -} \ No newline at end of file diff --git a/apps/www/public/registry/styles/new-york/hello-block.json b/apps/www/public/registry/styles/new-york/hello-block.json deleted file mode 100644 index b875578682..0000000000 --- a/apps/www/public/registry/styles/new-york/hello-block.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "hello-block", - "type": "registry:block", - "registryDependencies": [ - "button", - "use-media-query", - "card" - ], - "files": [ - { - "path": "block/hello-block/hello-block.tsx", - "type": "registry:block", - "content": "\"use client\"\n\nimport { HelloCard } from \"@/registry/new-york/block/hello-block/components/hello-card\"\nimport { useMediaQuery } from \"@/registry/new-york/hooks/use-media-query\"\nimport { cn } from \"@/registry/new-york/lib/utils\"\nimport { Button } from \"@/registry/new-york/ui/button\"\n\nexport default function HelloBlock() {\n const isDesktop = useMediaQuery(\"(min-width: 768px)\")\n\n return (\n \n

Hello. This is a component inside a block.

\n

You are currently on {isDesktop ? \"desktop\" : \"mobile\"}

\n \n \n )\n}\n" - }, - { - "path": "block/hello-block/components/hello-card.tsx", - "type": "registry:block", - "content": "import {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york/ui/card\"\n\nexport function HelloCard({\n title,\n children,\n className,\n}: {\n title: string\n} & React.ComponentProps) {\n return (\n \n \n {title}\n \n {children}\n \n )\n}\n" - } - ], - "tailwind": { - "config": { - "theme": { - "extend": { - "colors": { - "brand": { - "primary": "var(--brand-primary)", - "secondary": "var(--brand-secondary)" - } - }, - "boxShadow": { - "brand": "0px 0px 10px 0px rgba(255, 255, 255, 0.10)" - } - } - } - } - }, - "cssVars": { - "light": { - "brand-primary": "#a855f7", - "brand-secondary": "#10b981" - }, - "dark": { - "brand-primary": "#831843", - "brand-secondary": "#ccfbf1" - } - }, - "category": "Application", - "subcategory": "Examples" -} \ No newline at end of file diff --git a/apps/www/public/registry/styles/new-york/sidebar-01.json b/apps/www/public/registry/styles/new-york/sidebar-01.json index daf2fee4e2..9973184a58 100644 --- a/apps/www/public/registry/styles/new-york/sidebar-01.json +++ b/apps/www/public/registry/styles/new-york/sidebar-01.json @@ -19,7 +19,7 @@ "files": [ { "path": "block/sidebar-01/page.tsx", - "content": "import { cookies } from \"next/headers\"\n\nimport { AppSidebar } from \"@/registry/new-york/block/sidebar-01/components/app-sidebar\"\nimport {\n SIDEBAR_STATE_COOKIE,\n SidebarLayout,\n SidebarTrigger,\n} from \"@/registry/new-york/block/sidebar-01/ui/sidebar\"\n\nexport default function Page() {\n return (\n \n \n
\n
\n \n
\n
\n \n )\n}\n", + "content": "import { cookies } from \"next/headers\"\n\nimport { AppSidebar } from \"@/registry/new-york/block/sidebar-01/components/app-sidebar\"\nimport {\n SidebarLayout,\n SidebarTrigger,\n} from \"@/registry/new-york/block/sidebar-01/ui/sidebar\"\n\nexport default function Page() {\n return (\n \n \n
\n
\n \n
\n
\n \n )\n}\n", "type": "registry:page" }, { @@ -64,7 +64,7 @@ }, { "path": "block/sidebar-01/ui/sidebar.tsx", - "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { PanelLeft } from \"lucide-react\"\n\nimport { useIsMobile } from \"@/registry/new-york/hooks/use-mobile\"\nimport { cn } from \"@/registry/new-york/lib/utils\"\nimport { Button } from \"@/registry/new-york/ui/button\"\nimport { Drawer } from \"@/registry/new-york/ui/drawer\"\nimport { Sheet, SheetContent } from \"@/registry/new-york/ui/sheet\"\n\nexport const SIDEBAR_STATE_COOKIE = \"sidebar:state\"\n\ntype SidebarContext = {\n state: \"open\" | \"closed\"\n open: boolean\n onOpenChange: (open: boolean) => void\n}\n\nconst SidebarContext = React.createContext({\n state: \"open\",\n open: true,\n onOpenChange: () => {},\n})\n\nfunction useSidebar() {\n return React.useContext(SidebarContext)\n}\n\nconst SidebarLayout = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean\n }\n>(({ defaultOpen, className, ...props }, ref) => {\n const [open, setOpen] = React.useState(defaultOpen ?? true)\n\n const onOpenChange = React.useCallback((open: boolean) => {\n setOpen(open)\n document.cookie = `${SIDEBAR_STATE_COOKIE}=${open}; path=/; max-age=${\n 60 * 60 * 24 * 7\n }`\n }, [])\n\n const state = open ? \"open\" : \"closed\"\n\n return (\n \n \n \n )\n})\nSidebarLayout.displayName = \"SidebarLayout\"\n\nconst SidebarTrigger = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\">\n>(({ className, ...props }, ref) => {\n const { open, onOpenChange } = useSidebar()\n\n return (\n onOpenChange(!open)}\n {...props}\n >\n \n Toggle Sidebar\n \n )\n})\nSidebarTrigger.displayName = \"SidebarTrigger\"\n\nconst Sidebar = React.forwardRef>(\n ({ className, children }, ref) => {\n const isMobile = useIsMobile()\n const { open, onOpenChange } = useSidebar()\n\n const sidebar = (\n \n {children}\n \n )\n\n if (isMobile) {\n return (\n \n \n {sidebar}\n \n \n )\n }\n\n return (\n \n )\n }\n)\nSidebar.displayName = \"Sidebar\"\n\nconst SidebarHeader = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarHeader.displayName = \"SidebarHeader\"\n\nconst SidebarFooter = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarFooter.displayName = \"SidebarFooter\"\n\nconst SidebarContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarContent.displayName = \"SidebarContent\"\n\nconst SidebarItem = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n
\n )\n})\nSidebarItem.displayName = \"SidebarItem\"\n\nconst SidebarLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarLabel.displayName = \"SidebarLabel\"\n\nexport {\n useSidebar,\n SidebarLayout,\n SidebarTrigger,\n Sidebar,\n SidebarHeader,\n SidebarFooter,\n SidebarContent,\n SidebarItem,\n SidebarLabel,\n}\n", + "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { PanelLeft } from \"lucide-react\"\n\nimport { useIsMobile } from \"@/registry/new-york/hooks/use-mobile\"\nimport { cn } from \"@/registry/new-york/lib/utils\"\nimport { Button } from \"@/registry/new-york/ui/button\"\nimport { Sheet, SheetContent } from \"@/registry/new-york/ui/sheet\"\n\nexport const SIDEBAR_STATE_COOKIE = \"sidebar:state\"\n\ntype SidebarContext = {\n state: \"open\" | \"closed\"\n open: boolean\n onOpenChange: (open: boolean) => void\n}\n\nconst SidebarContext = React.createContext({\n state: \"open\",\n open: true,\n onOpenChange: () => {},\n})\n\nfunction useSidebar() {\n return React.useContext(SidebarContext)\n}\n\nconst SidebarLayout = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean\n }\n>(({ defaultOpen, className, ...props }, ref) => {\n const [open, setOpen] = React.useState(defaultOpen ?? true)\n\n const onOpenChange = React.useCallback((open: boolean) => {\n setOpen(open)\n document.cookie = `${SIDEBAR_STATE_COOKIE}=${open}; path=/; max-age=${\n 60 * 60 * 24 * 7\n }`\n }, [])\n\n const state = open ? \"open\" : \"closed\"\n\n return (\n \n \n \n )\n})\nSidebarLayout.displayName = \"SidebarLayout\"\n\nconst SidebarTrigger = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\">\n>(({ className, ...props }, ref) => {\n const { open, onOpenChange } = useSidebar()\n\n return (\n onOpenChange(!open)}\n {...props}\n >\n \n Toggle Sidebar\n \n )\n})\nSidebarTrigger.displayName = \"SidebarTrigger\"\n\nconst Sidebar = React.forwardRef>(\n ({ className, children }, ref) => {\n const isMobile = useIsMobile()\n const { open, onOpenChange } = useSidebar()\n\n const sidebar = (\n \n {children}\n
\n )\n\n if (isMobile) {\n return (\n \n \n {sidebar}\n \n \n )\n }\n\n return (\n \n )\n }\n)\nSidebar.displayName = \"Sidebar\"\n\nconst SidebarHeader = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarHeader.displayName = \"SidebarHeader\"\n\nconst SidebarFooter = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarFooter.displayName = \"SidebarFooter\"\n\nconst SidebarContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarContent.displayName = \"SidebarContent\"\n\nconst SidebarItem = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n
\n )\n})\nSidebarItem.displayName = \"SidebarItem\"\n\nconst SidebarLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n \n )\n})\nSidebarLabel.displayName = \"SidebarLabel\"\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarHeader,\n SidebarItem,\n SidebarLabel,\n SidebarLayout,\n SidebarTrigger,\n useSidebar,\n}\n", "type": "registry:ui" } ] diff --git a/apps/www/public/registry/styles/new-york/theme-daylight.json b/apps/www/public/registry/styles/new-york/theme-daylight.json index a3c91efe1a..a6f4f11089 100644 --- a/apps/www/public/registry/styles/new-york/theme-daylight.json +++ b/apps/www/public/registry/styles/new-york/theme-daylight.json @@ -6,19 +6,19 @@ "background": "36 39% 88%", "foreground": "36 45% 15%", "primary": "36 45% 70%", - "primaryForeground": "36 45% 11%", + "primary-foreground": "36 45% 11%", "secondary": "40 35% 77%", - "secondaryForeground": "36 45% 25%", + "secondary-foreground": "36 45% 25%", "accent": "36 64% 57%", - "accentForeground": "36 72% 17%", + "accent-foreground": "36 72% 17%", "destructive": "0 84% 37%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "36 33% 75%", - "mutedForeground": "36 45% 25%", + "muted-foreground": "36 45% 25%", "card": "36 46% 82%", - "cardForeground": "36 45% 20%", + "card-foreground": "36 45% 20%", "popover": "0 0% 100%", - "popoverForeground": "240 10% 3.9%", + "popover-foreground": "240 10% 3.9%", "border": "36 45% 60%", "input": "36 45% 60%", "ring": "36 45% 30%", @@ -32,19 +32,19 @@ "background": "36 39% 88%", "foreground": "36 45% 15%", "primary": "36 45% 70%", - "primaryForeground": "36 45% 11%", + "primary-foreground": "36 45% 11%", "secondary": "40 35% 77%", - "secondaryForeground": "36 45% 25%", + "secondary-foreground": "36 45% 25%", "accent": "36 64% 57%", - "accentForeground": "36 72% 17%", + "accent-foreground": "36 72% 17%", "destructive": "0 84% 37%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "36 33% 75%", - "mutedForeground": "36 45% 25%", + "muted-foreground": "36 45% 25%", "card": "36 46% 82%", - "cardForeground": "36 45% 20%", + "card-foreground": "36 45% 20%", "popover": "0 0% 100%", - "popoverForeground": "240 10% 3.9%", + "popover-foreground": "240 10% 3.9%", "border": "36 45% 60%", "input": "36 45% 60%", "ring": "36 45% 30%", diff --git a/apps/www/public/registry/styles/new-york/theme-midnight.json b/apps/www/public/registry/styles/new-york/theme-midnight.json index 3f788b528c..af39a8a05d 100644 --- a/apps/www/public/registry/styles/new-york/theme-midnight.json +++ b/apps/www/public/registry/styles/new-york/theme-midnight.json @@ -6,19 +6,19 @@ "background": "240 5% 6%", "foreground": "60 5% 90%", "primary": "240 0% 90%", - "primaryForeground": "60 0% 0%", + "primary-foreground": "60 0% 0%", "secondary": "240 4% 15%", - "secondaryForeground": "60 5% 85%", + "secondary-foreground": "60 5% 85%", "accent": "240 0% 13%", - "accentForeground": "60 0% 100%", + "accent-foreground": "60 0% 100%", "destructive": "0 60% 50%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "240 5% 25%", - "mutedForeground": "60 5% 85%", + "muted-foreground": "60 5% 85%", "card": "240 4% 10%", - "cardForeground": "60 5% 90%", + "card-foreground": "60 5% 90%", "popover": "240 5% 15%", - "popoverForeground": "60 5% 85%", + "popover-foreground": "60 5% 85%", "border": "240 6% 20%", "input": "240 6% 20%", "ring": "240 5% 90%", @@ -32,19 +32,19 @@ "background": "240 5% 6%", "foreground": "60 5% 90%", "primary": "240 0% 90%", - "primaryForeground": "60 0% 0%", + "primary-foreground": "60 0% 0%", "secondary": "240 4% 15%", - "secondaryForeground": "60 5% 85%", + "secondary-foreground": "60 5% 85%", "accent": "240 0% 13%", - "accentForeground": "60 0% 100%", + "accent-foreground": "60 0% 100%", "destructive": "0 60% 50%", - "destructiveForeground": "0 0% 98%", + "destructive-foreground": "0 0% 98%", "muted": "240 5% 25%", - "mutedForeground": "60 5% 85%", + "muted-foreground": "60 5% 85%", "card": "240 4% 10%", - "cardForeground": "60 5% 90%", + "card-foreground": "60 5% 90%", "popover": "240 5% 15%", - "popoverForeground": "60 5% 85%", + "popover-foreground": "60 5% 85%", "border": "240 6% 20%", "input": "240 6% 20%", "ring": "240 5% 90%", diff --git a/apps/www/public/registry/styles/new-york/use-media-query.json b/apps/www/public/registry/styles/new-york/use-media-query.json deleted file mode 100644 index d2b1781d52..0000000000 --- a/apps/www/public/registry/styles/new-york/use-media-query.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "use-media-query", - "type": "registry:hook", - "dependencies": [ - "@react-hook/window-size@1.0.3" - ], - "files": [ - { - "path": "hooks/use-media-query.ts", - "type": "registry:hook", - "content": "import * as React from \"react\"\n\nexport function useMediaQuery(query: string) {\n const [value, setValue] = React.useState(false)\n\n React.useEffect(() => {\n function onChange(event: MediaQueryListEvent) {\n setValue(event.matches)\n }\n\n const result = matchMedia(query)\n result.addEventListener(\"change\", onChange)\n setValue(result.matches)\n\n return () => result.removeEventListener(\"change\", onChange)\n }, [query])\n\n return value\n}\n" - } - ] -} \ No newline at end of file diff --git a/apps/www/registry/new-york/block/sidebar-01/page.tsx b/apps/www/registry/new-york/block/sidebar-01/page.tsx index 59a662b345..71ac9cef57 100644 --- a/apps/www/registry/new-york/block/sidebar-01/page.tsx +++ b/apps/www/registry/new-york/block/sidebar-01/page.tsx @@ -2,7 +2,6 @@ import { cookies } from "next/headers" import { AppSidebar } from "@/registry/new-york/block/sidebar-01/components/app-sidebar" import { - SIDEBAR_STATE_COOKIE, SidebarLayout, SidebarTrigger, } from "@/registry/new-york/block/sidebar-01/ui/sidebar" diff --git a/apps/www/registry/new-york/block/sidebar-01/ui/sidebar.tsx b/apps/www/registry/new-york/block/sidebar-01/ui/sidebar.tsx index f67eb3f425..f4759f8dbc 100644 --- a/apps/www/registry/new-york/block/sidebar-01/ui/sidebar.tsx +++ b/apps/www/registry/new-york/block/sidebar-01/ui/sidebar.tsx @@ -6,7 +6,6 @@ import { PanelLeft } from "lucide-react" import { useIsMobile } from "@/registry/new-york/hooks/use-mobile" import { cn } from "@/registry/new-york/lib/utils" import { Button } from "@/registry/new-york/ui/button" -import { Drawer } from "@/registry/new-york/ui/drawer" import { Sheet, SheetContent } from "@/registry/new-york/ui/sheet" export const SIDEBAR_STATE_COOKIE = "sidebar:state" @@ -190,13 +189,13 @@ const SidebarLabel = React.forwardRef< SidebarLabel.displayName = "SidebarLabel" export { - useSidebar, - SidebarLayout, - SidebarTrigger, Sidebar, - SidebarHeader, - SidebarFooter, SidebarContent, + SidebarFooter, + SidebarHeader, SidebarItem, SidebarLabel, + SidebarLayout, + SidebarTrigger, + useSidebar, } diff --git a/apps/www/registry/registry-themes.ts b/apps/www/registry/registry-themes.ts index 9a5d79f9f1..ec0b129937 100644 --- a/apps/www/registry/registry-themes.ts +++ b/apps/www/registry/registry-themes.ts @@ -9,19 +9,19 @@ export const themes: Registry = [ background: "36 39% 88%", foreground: "36 45% 15%", primary: "36 45% 70%", - primaryForeground: "36 45% 11%", + "primary-foreground": "36 45% 11%", secondary: "40 35% 77%", - secondaryForeground: "36 45% 25%", + "secondary-foreground": "36 45% 25%", accent: "36 64% 57%", - accentForeground: "36 72% 17%", + "accent-foreground": "36 72% 17%", destructive: "0 84% 37%", - destructiveForeground: "0 0% 98%", + "destructive-foreground": "0 0% 98%", muted: "36 33% 75%", - mutedForeground: "36 45% 25%", + "muted-foreground": "36 45% 25%", card: "36 46% 82%", - cardForeground: "36 45% 20%", + "card-foreground": "36 45% 20%", popover: "0 0% 100%", - popoverForeground: "240 10% 3.9%", + "popover-foreground": "240 10% 3.9%", border: "36 45% 60%", input: "36 45% 60%", ring: "36 45% 30%", @@ -35,19 +35,19 @@ export const themes: Registry = [ background: "36 39% 88%", foreground: "36 45% 15%", primary: "36 45% 70%", - primaryForeground: "36 45% 11%", + "primary-foreground": "36 45% 11%", secondary: "40 35% 77%", - secondaryForeground: "36 45% 25%", + "secondary-foreground": "36 45% 25%", accent: "36 64% 57%", - accentForeground: "36 72% 17%", + "accent-foreground": "36 72% 17%", destructive: "0 84% 37%", - destructiveForeground: "0 0% 98%", + "destructive-foreground": "0 0% 98%", muted: "36 33% 75%", - mutedForeground: "36 45% 25%", + "muted-foreground": "36 45% 25%", card: "36 46% 82%", - cardForeground: "36 45% 20%", + "card-foreground": "36 45% 20%", popover: "0 0% 100%", - popoverForeground: "240 10% 3.9%", + "popover-foreground": "240 10% 3.9%", border: "36 45% 60%", input: "36 45% 60%", ring: "36 45% 30%", @@ -67,19 +67,19 @@ export const themes: Registry = [ background: "240 5% 6%", foreground: "60 5% 90%", primary: "240 0% 90%", - primaryForeground: "60 0% 0%", + "primary-foreground": "60 0% 0%", secondary: "240 4% 15%", - secondaryForeground: "60 5% 85%", + "secondary-foreground": "60 5% 85%", accent: "240 0% 13%", - accentForeground: "60 0% 100%", + "accent-foreground": "60 0% 100%", destructive: "0 60% 50%", - destructiveForeground: "0 0% 98%", + "destructive-foreground": "0 0% 98%", muted: "240 5% 25%", - mutedForeground: "60 5% 85%", + "muted-foreground": "60 5% 85%", card: "240 4% 10%", - cardForeground: "60 5% 90%", + "card-foreground": "60 5% 90%", popover: "240 5% 15%", - popoverForeground: "60 5% 85%", + "popover-foreground": "60 5% 85%", border: "240 6% 20%", input: "240 6% 20%", ring: "240 5% 90%", @@ -93,19 +93,19 @@ export const themes: Registry = [ background: "240 5% 6%", foreground: "60 5% 90%", primary: "240 0% 90%", - primaryForeground: "60 0% 0%", + "primary-foreground": "60 0% 0%", secondary: "240 4% 15%", - secondaryForeground: "60 5% 85%", + "secondary-foreground": "60 5% 85%", accent: "240 0% 13%", - accentForeground: "60 0% 100%", + "accent-foreground": "60 0% 100%", destructive: "0 60% 50%", - destructiveForeground: "0 0% 98%", + "destructive-foreground": "0 0% 98%", muted: "240 5% 25%", - mutedForeground: "60 5% 85%", + "muted-foreground": "60 5% 85%", card: "240 4% 10%", - cardForeground: "60 5% 90%", + "card-foreground": "60 5% 90%", popover: "240 5% 15%", - popoverForeground: "60 5% 85%", + "popover-foreground": "60 5% 85%", border: "240 6% 20%", input: "240 6% 20%", ring: "240 5% 90%", diff --git a/apps/www/scripts/build-registry.mts b/apps/www/scripts/build-registry.mts index 175db8f072..5c665853d0 100644 --- a/apps/www/scripts/build-registry.mts +++ b/apps/www/scripts/build-registry.mts @@ -332,42 +332,45 @@ async function buildStyles(registry: Registry) { } for (const item of registry) { - if (!REGISTRY_INDEX_WHITELIST.includes(item.type) || !item.files) { + if (!REGISTRY_INDEX_WHITELIST.includes(item.type)) { continue } - const files = await Promise.all( - item.files.map(async (_file) => { - const file = - typeof _file === "string" - ? { - path: _file, - type: item.type, - content: "", - } - : _file + let files + if (item.files) { + files = await Promise.all( + item.files.map(async (_file) => { + const file = + typeof _file === "string" + ? { + path: _file, + type: item.type, + content: "", + } + : _file - const content = await fs.readFile( - path.join(process.cwd(), "registry", style.name, file.path), - "utf8" - ) + const content = await fs.readFile( + path.join(process.cwd(), "registry", style.name, file.path), + "utf8" + ) - const tempFile = await createTempSourceFile(file.path) - const sourceFile = project.createSourceFile(tempFile, content, { - scriptKind: ScriptKind.TSX, + const tempFile = await createTempSourceFile(file.path) + const sourceFile = project.createSourceFile(tempFile, content, { + scriptKind: ScriptKind.TSX, + }) + + sourceFile.getVariableDeclaration("iframeHeight")?.remove() + sourceFile.getVariableDeclaration("containerClassName")?.remove() + sourceFile.getVariableDeclaration("description")?.remove() + + return { + path: file.path, + type: file.type, + content: sourceFile.getText(), + } }) - - sourceFile.getVariableDeclaration("iframeHeight")?.remove() - sourceFile.getVariableDeclaration("containerClassName")?.remove() - sourceFile.getVariableDeclaration("description")?.remove() - - return { - path: file.path, - type: file.type, - content: sourceFile.getText(), - } - }) - ) + ) + } const payload = registryEntrySchema .omit({ diff --git a/packages/cli/src/utils/get-project-info.ts b/packages/cli/src/utils/get-project-info.ts index c00fe1aaa5..0444826c63 100644 --- a/packages/cli/src/utils/get-project-info.ts +++ b/packages/cli/src/utils/get-project-info.ts @@ -227,7 +227,7 @@ export async function getProjectConfig( prefix: "", }, aliases: { - ui: `${projectInfo.aliasPrefix}/ui`, + ui: `${projectInfo.aliasPrefix}/components/ui`, components: `${projectInfo.aliasPrefix}/components`, lib: `${projectInfo.aliasPrefix}/lib`, utils: `${projectInfo.aliasPrefix}/lib/utils`,