From e5a4c6d4fcb5630dddf468cd2259340024f339e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Mon, 26 Aug 2024 13:55:04 +0900 Subject: [PATCH] feat: Prepare SWC plugin registry (#41) --- .gitignore | 3 +- apps/swc-plugins/.eslintignore | 8 + apps/swc-plugins/.eslintrc.json | 2 +- apps/swc-plugins/app/api-client-provider.tsx | 35 + .../app/api/auth/[...nextauth]/route.ts | 2 + apps/swc-plugins/app/api/trpc/[trpc]/route.ts | 3 + apps/swc-plugins/app/client-providers.tsx | 13 + apps/swc-plugins/app/globals.css | 82 +- apps/swc-plugins/app/layout.tsx | 43 +- apps/swc-plugins/app/robots.ts | 11 + apps/swc-plugins/components.json | 17 + apps/swc-plugins/components/ui/accordion.tsx | 58 + .../components/ui/alert-dialog.tsx | 141 + apps/swc-plugins/components/ui/alert.tsx | 59 + .../components/ui/aspect-ratio.tsx | 7 + apps/swc-plugins/components/ui/avatar.tsx | 50 + apps/swc-plugins/components/ui/badge.tsx | 36 + apps/swc-plugins/components/ui/breadcrumb.tsx | 115 + apps/swc-plugins/components/ui/button.tsx | 56 + apps/swc-plugins/components/ui/calendar.tsx | 66 + apps/swc-plugins/components/ui/card.tsx | 79 + apps/swc-plugins/components/ui/carousel.tsx | 262 + apps/swc-plugins/components/ui/chart.tsx | 365 ++ apps/swc-plugins/components/ui/checkbox.tsx | 30 + .../swc-plugins/components/ui/collapsible.tsx | 11 + apps/swc-plugins/components/ui/command.tsx | 155 + .../components/ui/context-menu.tsx | 200 + apps/swc-plugins/components/ui/dialog.tsx | 122 + apps/swc-plugins/components/ui/drawer.tsx | 118 + .../components/ui/dropdown-menu.tsx | 200 + apps/swc-plugins/components/ui/form.tsx | 178 + apps/swc-plugins/components/ui/hover-card.tsx | 29 + apps/swc-plugins/components/ui/input-otp.tsx | 71 + apps/swc-plugins/components/ui/input.tsx | 25 + apps/swc-plugins/components/ui/label.tsx | 26 + apps/swc-plugins/components/ui/menubar.tsx | 236 + .../components/ui/navigation-menu.tsx | 128 + apps/swc-plugins/components/ui/pagination.tsx | 117 + apps/swc-plugins/components/ui/popover.tsx | 31 + apps/swc-plugins/components/ui/progress.tsx | 28 + .../swc-plugins/components/ui/radio-group.tsx | 44 + apps/swc-plugins/components/ui/resizable.tsx | 45 + .../swc-plugins/components/ui/scroll-area.tsx | 48 + apps/swc-plugins/components/ui/select.tsx | 160 + apps/swc-plugins/components/ui/separator.tsx | 31 + apps/swc-plugins/components/ui/sheet.tsx | 140 + apps/swc-plugins/components/ui/skeleton.tsx | 15 + apps/swc-plugins/components/ui/slider.tsx | 28 + apps/swc-plugins/components/ui/sonner.tsx | 31 + apps/swc-plugins/components/ui/switch.tsx | 29 + apps/swc-plugins/components/ui/table.tsx | 117 + apps/swc-plugins/components/ui/tabs.tsx | 55 + apps/swc-plugins/components/ui/textarea.tsx | 24 + apps/swc-plugins/components/ui/toast.tsx | 129 + apps/swc-plugins/components/ui/toaster.tsx | 35 + .../components/ui/toggle-group.tsx | 61 + apps/swc-plugins/components/ui/toggle.tsx | 45 + apps/swc-plugins/components/ui/tooltip.tsx | 30 + apps/swc-plugins/components/ui/use-toast.ts | 194 + apps/swc-plugins/lib/abilities.ts | 79 + apps/swc-plugins/lib/api/auth.ts | 42 + apps/swc-plugins/lib/api/router.ts | 12 + apps/swc-plugins/lib/api/server.ts | 176 + apps/swc-plugins/lib/api/users/router.ts | 11 + apps/swc-plugins/lib/auth.ts | 12 + apps/swc-plugins/lib/auth/user-context.tsx | 117 + apps/swc-plugins/lib/base/index.ts | 133 + apps/swc-plugins/lib/hooks/use-user.ts | 9 + apps/swc-plugins/lib/prisma/.gitignore | 1 + apps/swc-plugins/lib/prisma/client.ts | 18 + apps/swc-plugins/lib/prisma/index.ts | 2 + apps/swc-plugins/lib/server.ts | 176 + apps/swc-plugins/lib/trpc/web-client.ts | 6 + apps/swc-plugins/lib/type-utils.ts | 10 + apps/swc-plugins/lib/utils.ts | 6 + apps/swc-plugins/mocks/empty.ts | 1 + apps/swc-plugins/next.config.mjs | 7 +- apps/swc-plugins/package.json | 98 +- apps/swc-plugins/prisma/schema.prisma | 133 + apps/swc-plugins/tailwind.config.ts | 82 +- docs/stc/package.json | 2 +- package.json | 2 +- packages/dudykr-utils/package.json | 2 +- packages/jest-expect-image/package.json | 2 +- packages/next-image-snapshot/.gitignore | 8 - packages/next-image-snapshot/.npmignore | 10 - packages/next-image-snapshot/CHANGELOG.md | 17 - packages/next-image-snapshot/README.md | 84 - .../examples/next-app/.eslintrc.json | 3 - .../examples/next-app/.gitignore | 35 - .../examples/next-app/README.md | 34 - .../examples/next-app/app/favicon.ico | Bin 25931 -> 0 bytes .../examples/next-app/app/globals.css | 3 - .../examples/next-app/app/layout.tsx | 16 - .../examples/next-app/app/page.tsx | 3 - .../examples/next-app/next.config.js | 4 - .../examples/next-app/package.json | 24 - .../examples/next-app/postcss.config.js | 6 - .../examples/next-app/public/next.svg | 1 - .../examples/next-app/public/vercel.svg | 1 - .../examples/next-app/tailwind.config.js | 18 - .../examples/next-app/tsconfig.json | 28 - packages/next-image-snapshot/jest.config.js | 8 - packages/next-image-snapshot/lib/browser.ts | 207 - packages/next-image-snapshot/lib/index.ts | 72 - .../next-image-snapshot/lib/next-server.ts | 58 - packages/next-image-snapshot/lib/util.ts | 5 - packages/next-image-snapshot/package.json | 47 - ...est-ts-browser-screenshot-works-1-snap.png | Bin 6873 -> 0 bytes ...est-ts-browser-screenshot-works-2-snap.png | Bin 16196 -> 0 bytes ...-server-proof-of-concepts-works-1-snap.png | Bin 5306 -> 0 bytes .../next-image-snapshot/tests/browser.test.ts | 122 - .../next-image-snapshot/tests/server.test.ts | 60 - packages/next-image-snapshot/tsconfig.json | 20 - packages/next-trpc-openapi/package.json | 2 +- pnpm-lock.yaml | 5264 ++++++++++++----- turbo.json | 54 +- 117 files changed, 9344 insertions(+), 2488 deletions(-) create mode 100644 apps/swc-plugins/.eslintignore create mode 100644 apps/swc-plugins/app/api-client-provider.tsx create mode 100644 apps/swc-plugins/app/api/auth/[...nextauth]/route.ts create mode 100644 apps/swc-plugins/app/api/trpc/[trpc]/route.ts create mode 100644 apps/swc-plugins/app/client-providers.tsx create mode 100644 apps/swc-plugins/app/robots.ts create mode 100644 apps/swc-plugins/components.json create mode 100644 apps/swc-plugins/components/ui/accordion.tsx create mode 100644 apps/swc-plugins/components/ui/alert-dialog.tsx create mode 100644 apps/swc-plugins/components/ui/alert.tsx create mode 100644 apps/swc-plugins/components/ui/aspect-ratio.tsx create mode 100644 apps/swc-plugins/components/ui/avatar.tsx create mode 100644 apps/swc-plugins/components/ui/badge.tsx create mode 100644 apps/swc-plugins/components/ui/breadcrumb.tsx create mode 100644 apps/swc-plugins/components/ui/button.tsx create mode 100644 apps/swc-plugins/components/ui/calendar.tsx create mode 100644 apps/swc-plugins/components/ui/card.tsx create mode 100644 apps/swc-plugins/components/ui/carousel.tsx create mode 100644 apps/swc-plugins/components/ui/chart.tsx create mode 100644 apps/swc-plugins/components/ui/checkbox.tsx create mode 100644 apps/swc-plugins/components/ui/collapsible.tsx create mode 100644 apps/swc-plugins/components/ui/command.tsx create mode 100644 apps/swc-plugins/components/ui/context-menu.tsx create mode 100644 apps/swc-plugins/components/ui/dialog.tsx create mode 100644 apps/swc-plugins/components/ui/drawer.tsx create mode 100644 apps/swc-plugins/components/ui/dropdown-menu.tsx create mode 100644 apps/swc-plugins/components/ui/form.tsx create mode 100644 apps/swc-plugins/components/ui/hover-card.tsx create mode 100644 apps/swc-plugins/components/ui/input-otp.tsx create mode 100644 apps/swc-plugins/components/ui/input.tsx create mode 100644 apps/swc-plugins/components/ui/label.tsx create mode 100644 apps/swc-plugins/components/ui/menubar.tsx create mode 100644 apps/swc-plugins/components/ui/navigation-menu.tsx create mode 100644 apps/swc-plugins/components/ui/pagination.tsx create mode 100644 apps/swc-plugins/components/ui/popover.tsx create mode 100644 apps/swc-plugins/components/ui/progress.tsx create mode 100644 apps/swc-plugins/components/ui/radio-group.tsx create mode 100644 apps/swc-plugins/components/ui/resizable.tsx create mode 100644 apps/swc-plugins/components/ui/scroll-area.tsx create mode 100644 apps/swc-plugins/components/ui/select.tsx create mode 100644 apps/swc-plugins/components/ui/separator.tsx create mode 100644 apps/swc-plugins/components/ui/sheet.tsx create mode 100644 apps/swc-plugins/components/ui/skeleton.tsx create mode 100644 apps/swc-plugins/components/ui/slider.tsx create mode 100644 apps/swc-plugins/components/ui/sonner.tsx create mode 100644 apps/swc-plugins/components/ui/switch.tsx create mode 100644 apps/swc-plugins/components/ui/table.tsx create mode 100644 apps/swc-plugins/components/ui/tabs.tsx create mode 100644 apps/swc-plugins/components/ui/textarea.tsx create mode 100644 apps/swc-plugins/components/ui/toast.tsx create mode 100644 apps/swc-plugins/components/ui/toaster.tsx create mode 100644 apps/swc-plugins/components/ui/toggle-group.tsx create mode 100644 apps/swc-plugins/components/ui/toggle.tsx create mode 100644 apps/swc-plugins/components/ui/tooltip.tsx create mode 100644 apps/swc-plugins/components/ui/use-toast.ts create mode 100644 apps/swc-plugins/lib/abilities.ts create mode 100644 apps/swc-plugins/lib/api/auth.ts create mode 100644 apps/swc-plugins/lib/api/router.ts create mode 100644 apps/swc-plugins/lib/api/server.ts create mode 100644 apps/swc-plugins/lib/api/users/router.ts create mode 100644 apps/swc-plugins/lib/auth.ts create mode 100644 apps/swc-plugins/lib/auth/user-context.tsx create mode 100644 apps/swc-plugins/lib/base/index.ts create mode 100644 apps/swc-plugins/lib/hooks/use-user.ts create mode 100644 apps/swc-plugins/lib/prisma/.gitignore create mode 100644 apps/swc-plugins/lib/prisma/client.ts create mode 100644 apps/swc-plugins/lib/prisma/index.ts create mode 100644 apps/swc-plugins/lib/server.ts create mode 100644 apps/swc-plugins/lib/trpc/web-client.ts create mode 100644 apps/swc-plugins/lib/type-utils.ts create mode 100644 apps/swc-plugins/lib/utils.ts create mode 100644 apps/swc-plugins/mocks/empty.ts create mode 100644 apps/swc-plugins/prisma/schema.prisma delete mode 100644 packages/next-image-snapshot/.gitignore delete mode 100644 packages/next-image-snapshot/.npmignore delete mode 100644 packages/next-image-snapshot/CHANGELOG.md delete mode 100644 packages/next-image-snapshot/README.md delete mode 100644 packages/next-image-snapshot/examples/next-app/.eslintrc.json delete mode 100644 packages/next-image-snapshot/examples/next-app/.gitignore delete mode 100644 packages/next-image-snapshot/examples/next-app/README.md delete mode 100644 packages/next-image-snapshot/examples/next-app/app/favicon.ico delete mode 100644 packages/next-image-snapshot/examples/next-app/app/globals.css delete mode 100644 packages/next-image-snapshot/examples/next-app/app/layout.tsx delete mode 100644 packages/next-image-snapshot/examples/next-app/app/page.tsx delete mode 100644 packages/next-image-snapshot/examples/next-app/next.config.js delete mode 100644 packages/next-image-snapshot/examples/next-app/package.json delete mode 100644 packages/next-image-snapshot/examples/next-app/postcss.config.js delete mode 100644 packages/next-image-snapshot/examples/next-app/public/next.svg delete mode 100644 packages/next-image-snapshot/examples/next-app/public/vercel.svg delete mode 100644 packages/next-image-snapshot/examples/next-app/tailwind.config.js delete mode 100644 packages/next-image-snapshot/examples/next-app/tsconfig.json delete mode 100644 packages/next-image-snapshot/jest.config.js delete mode 100644 packages/next-image-snapshot/lib/browser.ts delete mode 100644 packages/next-image-snapshot/lib/index.ts delete mode 100644 packages/next-image-snapshot/lib/next-server.ts delete mode 100644 packages/next-image-snapshot/lib/util.ts delete mode 100644 packages/next-image-snapshot/package.json delete mode 100644 packages/next-image-snapshot/tests/__image_snapshots__/browser-test-ts-browser-screenshot-works-1-snap.png delete mode 100644 packages/next-image-snapshot/tests/__image_snapshots__/browser-test-ts-browser-screenshot-works-2-snap.png delete mode 100644 packages/next-image-snapshot/tests/__image_snapshots__/server-test-ts-next-test-server-proof-of-concepts-works-1-snap.png delete mode 100644 packages/next-image-snapshot/tests/browser.test.ts delete mode 100644 packages/next-image-snapshot/tests/server.test.ts delete mode 100644 packages/next-image-snapshot/tsconfig.json diff --git a/.gitignore b/.gitignore index e88a105..0a853a4 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,5 @@ yarn/lock *.tsbuildinfo -out/ \ No newline at end of file +out/ +generated/ \ No newline at end of file diff --git a/apps/swc-plugins/.eslintignore b/apps/swc-plugins/.eslintignore new file mode 100644 index 0000000..318bf5e --- /dev/null +++ b/apps/swc-plugins/.eslintignore @@ -0,0 +1,8 @@ +*.d.ts +/lib/generated +/components/ui + + +# TODO: Fix eslint config +app/ +lib/ \ No newline at end of file diff --git a/apps/swc-plugins/.eslintrc.json b/apps/swc-plugins/.eslintrc.json index bffb357..0e81f9b 100644 --- a/apps/swc-plugins/.eslintrc.json +++ b/apps/swc-plugins/.eslintrc.json @@ -1,3 +1,3 @@ { "extends": "next/core-web-vitals" -} +} \ No newline at end of file diff --git a/apps/swc-plugins/app/api-client-provider.tsx b/apps/swc-plugins/app/api-client-provider.tsx new file mode 100644 index 0000000..17049ea --- /dev/null +++ b/apps/swc-plugins/app/api-client-provider.tsx @@ -0,0 +1,35 @@ +"use client"; + +import { apiClient } from "@/lib/trpc/web-client"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { httpBatchLink } from "@trpc/client"; +import { PropsWithChildren, useState } from "react"; +import superjson from "superjson"; + +export function ApiClientProvider({ children }: PropsWithChildren<{}>) { + const [queryClient] = useState( + () => + new QueryClient({ + defaultOptions: { + queries: { + queryKeyHashFn: (queryKey) => superjson.stringify(queryKey), + }, + }, + }) + ); + const [trpcClient] = useState(() => + apiClient.createClient({ + links: [ + httpBatchLink({ + url: "/api/trpc", + transformer: superjson, + }), + ], + }) + ); + return ( + + {children} + + ); +} diff --git a/apps/swc-plugins/app/api/auth/[...nextauth]/route.ts b/apps/swc-plugins/app/api/auth/[...nextauth]/route.ts new file mode 100644 index 0000000..73228a0 --- /dev/null +++ b/apps/swc-plugins/app/api/auth/[...nextauth]/route.ts @@ -0,0 +1,2 @@ +import { handlers } from "@/lib/auth"; +export const { GET, POST } = handlers; diff --git a/apps/swc-plugins/app/api/trpc/[trpc]/route.ts b/apps/swc-plugins/app/api/trpc/[trpc]/route.ts new file mode 100644 index 0000000..09bbacc --- /dev/null +++ b/apps/swc-plugins/app/api/trpc/[trpc]/route.ts @@ -0,0 +1,3 @@ +import { handler } from "@/lib/api/server"; + +export { handler as GET, handler as POST }; diff --git a/apps/swc-plugins/app/client-providers.tsx b/apps/swc-plugins/app/client-providers.tsx new file mode 100644 index 0000000..3780978 --- /dev/null +++ b/apps/swc-plugins/app/client-providers.tsx @@ -0,0 +1,13 @@ +"use client"; + +import { ThemeProvider } from "next-themes"; +import { PropsWithChildren } from "react"; +import { ApiClientProvider } from "./api-client-provider"; + +export function ClientProviders({ children }: PropsWithChildren) { + return ( + + {children} + + ); +} diff --git a/apps/swc-plugins/app/globals.css b/apps/swc-plugins/app/globals.css index 875c01e..99a7b0c 100644 --- a/apps/swc-plugins/app/globals.css +++ b/apps/swc-plugins/app/globals.css @@ -2,32 +2,68 @@ @tailwind components; @tailwind utilities; -:root { - --foreground-rgb: 0, 0, 0; - --background-start-rgb: 214, 219, 220; - --background-end-rgb: 255, 255, 255; -} - -@media (prefers-color-scheme: dark) { +@layer base { :root { - --foreground-rgb: 255, 255, 255; - --background-start-rgb: 0, 0, 0; - --background-end-rgb: 0, 0, 0; + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; + --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%; + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + --accent: 210 40% 96.1%; + --accent-foreground: 222.2 47.4% 11.2%; + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + --ring: 222.2 84% 4.9%; + --radius: 0.5rem; + --chart-1: 12 76% 61%; + --chart-2: 173 58% 39%; + --chart-3: 197 37% 24%; + --chart-4: 43 74% 66%; + --chart-5: 27 87% 67%; } -} -body { - color: rgb(var(--foreground-rgb)); - background: linear-gradient( - to bottom, - transparent, - rgb(var(--background-end-rgb)) - ) - rgb(var(--background-start-rgb)); + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + --card: 222.2 84% 4.9%; + --card-foreground: 210 40% 98%; + --popover: 222.2 84% 4.9%; + --popover-foreground: 210 40% 98%; + --primary: 210 40% 98%; + --primary-foreground: 222.2 47.4% 11.2%; + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + --accent: 217.2 32.6% 17.5%; + --accent-foreground: 210 40% 98%; + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + --ring: 212.7 26.8% 83.9%; + --chart-1: 220 70% 50%; + --chart-2: 160 60% 45%; + --chart-3: 30 80% 55%; + --chart-4: 280 65% 60%; + --chart-5: 340 75% 55%; + } } -@layer utilities { - .text-balance { - text-wrap: balance; +@layer base { + * { + @apply border-border; } -} + body { + @apply bg-background text-foreground; + } +} \ No newline at end of file diff --git a/apps/swc-plugins/app/layout.tsx b/apps/swc-plugins/app/layout.tsx index 3314e47..0d850b2 100644 --- a/apps/swc-plugins/app/layout.tsx +++ b/apps/swc-plugins/app/layout.tsx @@ -1,22 +1,37 @@ -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; +import { Toaster } from "@/components/ui/toaster"; +import { cn } from "@/lib/utils"; +import { SessionProvider } from "next-auth/react"; +import { Manrope } from "next/font/google"; +import NextTopLoader from "nextjs-toploader"; +import { PropsWithChildren } from "react"; +import { ClientProviders } from "./client-providers"; import "./globals.css"; -const inter = Inter({ subsets: ["latin"] }); +const fontHeading = Manrope({ + subsets: ["latin"], + display: "swap", + variable: "--font-heading", +}); -export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", -}; +const fontBody = Manrope({ + subsets: ["latin"], + display: "swap", + variable: "--font-body", +}); -export default function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { +export default function RootLayout({ children }: PropsWithChildren) { return ( - - {children} + + + + + + {children} + + + ); } diff --git a/apps/swc-plugins/app/robots.ts b/apps/swc-plugins/app/robots.ts new file mode 100644 index 0000000..9442ca5 --- /dev/null +++ b/apps/swc-plugins/app/robots.ts @@ -0,0 +1,11 @@ +import { MetadataRoute } from "next"; + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: "*", + allow: "/", + }, + // sitemap: `${BASE_URL}/sitemap.xml`, + }; +} diff --git a/apps/swc-plugins/components.json b/apps/swc-plugins/components.json new file mode 100644 index 0000000..15f2b02 --- /dev/null +++ b/apps/swc-plugins/components.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "app/globals.css", + "baseColor": "slate", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} \ No newline at end of file diff --git a/apps/swc-plugins/components/ui/accordion.tsx b/apps/swc-plugins/components/ui/accordion.tsx new file mode 100644 index 0000000..24c788c --- /dev/null +++ b/apps/swc-plugins/components/ui/accordion.tsx @@ -0,0 +1,58 @@ +"use client" + +import * as React from "react" +import * as AccordionPrimitive from "@radix-ui/react-accordion" +import { ChevronDown } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Accordion = AccordionPrimitive.Root + +const AccordionItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AccordionItem.displayName = "AccordionItem" + +const AccordionTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + svg]:rotate-180", + className + )} + {...props} + > + {children} + + + +)) +AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName + +const AccordionContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + +
{children}
+
+)) + +AccordionContent.displayName = AccordionPrimitive.Content.displayName + +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } diff --git a/apps/swc-plugins/components/ui/alert-dialog.tsx b/apps/swc-plugins/components/ui/alert-dialog.tsx new file mode 100644 index 0000000..25e7b47 --- /dev/null +++ b/apps/swc-plugins/components/ui/alert-dialog.tsx @@ -0,0 +1,141 @@ +"use client" + +import * as React from "react" +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" + +import { cn } from "@/lib/utils" +import { buttonVariants } from "@/components/ui/button" + +const AlertDialog = AlertDialogPrimitive.Root + +const AlertDialogTrigger = AlertDialogPrimitive.Trigger + +const AlertDialogPortal = AlertDialogPrimitive.Portal + +const AlertDialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName + +const AlertDialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + +)) +AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName + +const AlertDialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogHeader.displayName = "AlertDialogHeader" + +const AlertDialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogFooter.displayName = "AlertDialogFooter" + +const AlertDialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName + +const AlertDialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogDescription.displayName = + AlertDialogPrimitive.Description.displayName + +const AlertDialogAction = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName + +const AlertDialogCancel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName + +export { + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/apps/swc-plugins/components/ui/alert.tsx b/apps/swc-plugins/components/ui/alert.tsx new file mode 100644 index 0000000..41fa7e0 --- /dev/null +++ b/apps/swc-plugins/components/ui/alert.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const alertVariants = cva( + "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", + { + variants: { + variant: { + default: "bg-background text-foreground", + destructive: + "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +const Alert = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes & VariantProps +>(({ className, variant, ...props }, ref) => ( +
+)) +Alert.displayName = "Alert" + +const AlertTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertTitle.displayName = "AlertTitle" + +const AlertDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertDescription.displayName = "AlertDescription" + +export { Alert, AlertTitle, AlertDescription } diff --git a/apps/swc-plugins/components/ui/aspect-ratio.tsx b/apps/swc-plugins/components/ui/aspect-ratio.tsx new file mode 100644 index 0000000..d6a5226 --- /dev/null +++ b/apps/swc-plugins/components/ui/aspect-ratio.tsx @@ -0,0 +1,7 @@ +"use client" + +import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" + +const AspectRatio = AspectRatioPrimitive.Root + +export { AspectRatio } diff --git a/apps/swc-plugins/components/ui/avatar.tsx b/apps/swc-plugins/components/ui/avatar.tsx new file mode 100644 index 0000000..51e507b --- /dev/null +++ b/apps/swc-plugins/components/ui/avatar.tsx @@ -0,0 +1,50 @@ +"use client" + +import * as React from "react" +import * as AvatarPrimitive from "@radix-ui/react-avatar" + +import { cn } from "@/lib/utils" + +const Avatar = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +Avatar.displayName = AvatarPrimitive.Root.displayName + +const AvatarImage = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarImage.displayName = AvatarPrimitive.Image.displayName + +const AvatarFallback = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName + +export { Avatar, AvatarImage, AvatarFallback } diff --git a/apps/swc-plugins/components/ui/badge.tsx b/apps/swc-plugins/components/ui/badge.tsx new file mode 100644 index 0000000..f000e3e --- /dev/null +++ b/apps/swc-plugins/components/ui/badge.tsx @@ -0,0 +1,36 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ) +} + +export { Badge, badgeVariants } diff --git a/apps/swc-plugins/components/ui/breadcrumb.tsx b/apps/swc-plugins/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..71a5c32 --- /dev/null +++ b/apps/swc-plugins/components/ui/breadcrumb.tsx @@ -0,0 +1,115 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { ChevronRight, MoreHorizontal } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Breadcrumb = React.forwardRef< + HTMLElement, + React.ComponentPropsWithoutRef<"nav"> & { + separator?: React.ReactNode + } +>(({ ...props }, ref) =>