From 53b7f24b620f30ed5d373f4407a3d12252bc2361 Mon Sep 17 00:00:00 2001 From: ruru <142723369+ruru-m07@users.noreply.github.com> Date: Sat, 17 Aug 2024 13:54:28 +0530 Subject: [PATCH] refactor(components): refactor context and update CLIs --- apps/www/app/global.css | 26 +- apps/www/app/layout.tsx | 5 +- apps/www/app/playground/page.tsx | 565 ++++++++++++++++++ apps/www/app/source.ts | 1 - apps/www/components/SwitchEvent.tsx | 19 + apps/www/components/animationToggle.tsx | 6 +- apps/www/components/ui/ModeToggle.tsx | 18 + apps/www/components/ui/card.tsx | 21 + apps/www/content/docs/animation.mdx | 5 + apps/www/content/docs/cli.mdx | 2 +- apps/www/content/docs/components/avatar.mdx | 186 +++--- apps/www/content/docs/components/badge.mdx | 156 ++--- apps/www/content/docs/components/button.mdx | 225 +++---- apps/www/content/docs/components/checkbox.mdx | 124 ++-- apps/www/content/docs/components/input.mdx | 236 ++------ apps/www/content/docs/components/spinner.mdx | 49 +- apps/www/content/docs/components/switch.mdx | 134 +++-- apps/www/content/docs/components/tabs.mdx | 67 +-- apps/www/content/docs/components/textarea.mdx | 156 ++--- apps/www/content/docs/installation.mdx | 4 +- apps/www/content/docs/provider.mdx | 4 + apps/www/content/docs/ruru-json.mdx | 5 + apps/www/mdx-components.tsx | 4 + apps/www/package.json | 2 + .../public/registry/components/avatar.json | 2 +- .../public/registry/components/button.json | 2 +- .../public/registry/components/select.json | 2 +- .../public/registry/components/switch.json | 2 +- apps/www/public/registry/components/tabs.json | 2 +- .../public/registry/components/tooltip.json | 2 +- .../registry/interface/RuruContextType.json | 4 + .../registry/interface/RuruProviderProps.json | 4 + .../interface/RuruThemeProviderProps.json | 4 + apps/www/public/registry/interface/index.json | 11 + .../registry/providers/components/index.json | 10 + .../registry/providers/components/theme.json | 10 + apps/www/public/registry/providers/index.json | 12 + apps/www/public/schema.json | 55 ++ apps/www/registry/components.ts | 14 + apps/www/registry/registry.ts | 3 +- apps/www/scripts/build-registry.mts | 145 +++-- apps/www/tailwind.config.js | 26 +- apps/www/tsconfig.json | 23 +- packages/cli/src/commands/add.ts | 8 +- packages/cli/src/commands/init.ts | 140 ++++- packages/cli/src/utils/get-config.ts | 16 +- packages/cli/src/utils/registry/index.ts | 60 +- packages/cli/src/utils/registry/schema.ts | 17 + .../utils/transformers/transform-import.ts | 23 + packages/ui/package.json | 4 + packages/ui/src/components/avatar.tsx | 50 +- packages/ui/src/components/checkbox.tsx | 14 +- packages/ui/src/components/select.tsx | 4 +- packages/ui/src/components/switch.tsx | 15 +- packages/ui/src/components/tabs.tsx | 41 +- packages/ui/src/components/tooltip.tsx | 56 +- .../RuruContextType.ts | 0 .../RuruProviderProps.ts | 2 +- .../RuruThemeProviderProps.ts | 1 - packages/ui/src/provider/index.tsx | 13 +- packages/ui/src/provider/theme.tsx | 8 +- pnpm-lock.yaml | 26 + 62 files changed, 1969 insertions(+), 882 deletions(-) create mode 100644 apps/www/app/playground/page.tsx create mode 100644 apps/www/components/SwitchEvent.tsx create mode 100644 apps/www/components/ui/ModeToggle.tsx create mode 100644 apps/www/components/ui/card.tsx create mode 100644 apps/www/content/docs/animation.mdx create mode 100644 apps/www/content/docs/provider.mdx create mode 100644 apps/www/content/docs/ruru-json.mdx create mode 100644 apps/www/public/registry/interface/RuruContextType.json create mode 100644 apps/www/public/registry/interface/RuruProviderProps.json create mode 100644 apps/www/public/registry/interface/RuruThemeProviderProps.json create mode 100644 apps/www/public/registry/interface/index.json create mode 100644 apps/www/public/registry/providers/components/index.json create mode 100644 apps/www/public/registry/providers/components/theme.json create mode 100644 apps/www/public/registry/providers/index.json create mode 100644 apps/www/public/schema.json create mode 100644 apps/www/registry/components.ts rename packages/ui/src/{interface => interfaces}/RuruContextType.ts (100%) rename packages/ui/src/{interface => interfaces}/RuruProviderProps.ts (95%) rename packages/ui/src/{interface => interfaces}/RuruThemeProviderProps.ts (99%) diff --git a/apps/www/app/global.css b/apps/www/app/global.css index 7e4c53f..c493916 100644 --- a/apps/www/app/global.css +++ b/apps/www/app/global.css @@ -18,6 +18,10 @@ --headless-color: 250 80% 54%; --mdx-color: 0 0% 9%; --ui-color: 220deg 91% 54%; + --shiki-light: #4c4f69; + --shiki-dark: #cdd6f4; + --shiki-light-bg: #eff1f5; + --shiki-dark-bg: #0f0f0f !important; } .dark { @@ -49,8 +53,12 @@ --card: 230 40% 26.3% !important; } +/* #nd-docs-layout { + background: var(--popover); +} */ + .words_width_animat { - animation: words_width_animation 4s normal; + animation: words_width_animation 2.5s normal; } .words_width_lens_body { @@ -66,11 +74,11 @@ } .words_interfaces::after { - animation: words_interfaces_after_animation 3.5s normal; + animation: words_interfaces_after_animation 1.5s normal; } .words_interfaces::before { - animation: words_interfaces_before_animation 3.5s normal; + animation: words_interfaces_before_animation 1.5s normal; } @keyframes words_width_animation { @@ -82,6 +90,10 @@ top: -28px; opacity: 0.5; } + 75% { + top: -28px; + opacity: 1; + } 100% { top: -28px; opacity: 1; @@ -126,10 +138,10 @@ width: 0; opacity: 0; } - 65% { + /* 65% { width: 205px; opacity: 0.5; - } + } */ 100% { width: 205px; opacity: 1; @@ -141,10 +153,10 @@ height: 0; opacity: 0; } - 65% { + /* 65% { height: 60px; opacity: 0.5; - } + } */ 100% { height: 60px; opacity: 1; diff --git a/apps/www/app/layout.tsx b/apps/www/app/layout.tsx index e3b27f6..5656366 100644 --- a/apps/www/app/layout.tsx +++ b/apps/www/app/layout.tsx @@ -6,7 +6,9 @@ import { GeistSans } from "geist/font/sans"; import type { ReactNode } from "react"; import { RuruProvider } from "ruru-ui/provider"; import "fumadocs-ui/style.css"; +import "fumadocs-ui/twoslash.css"; import { ScrollArea } from "@/components/scroll-area"; +import { Analytics } from "@vercel/analytics/react"; export const metadata = createMetadata({ title: { @@ -29,8 +31,9 @@ export default function Layout({ children }: { children: ReactNode }) { return ( + - + {children} diff --git a/apps/www/app/playground/page.tsx b/apps/www/app/playground/page.tsx new file mode 100644 index 0000000..0aed718 --- /dev/null +++ b/apps/www/app/playground/page.tsx @@ -0,0 +1,565 @@ +"use client"; + +import React from "react"; +import Card from "@/components/ui/card"; +import { ModeToggle } from "@/components/ui/ModeToggle"; +import { + ArrowLeftIcon, + ArrowRightIcon, + CubeIcon, + PersonIcon, +} from "@radix-ui/react-icons"; +import { Button } from "ruru-ui/components/button"; +import { Spinner } from "ruru-ui/components/spinner"; +import { + Avatar, + AvatarGroup, + AvatarWithBadge, +} from "ruru-ui/components/avatar"; +import { Badge } from "ruru-ui/components/badge"; +import { Checkbox } from "ruru-ui/components/checkbox"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "ruru-ui/components/tooltip"; +import { Input, SearchInput } from "ruru-ui/components/input"; +import { Textarea } from "ruru-ui/components/textarea"; +import { Tabs, Tab } from "ruru-ui/components/tabs"; +import { Switch } from "ruru-ui/components/switch"; +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectLabel, + SelectTrigger, + SelectValue, + SelectSeparator, +} from "ruru-ui/components/select"; +import AnimationToggle from "@/components/animationToggle"; + +const Playground = () => { + return ( +
+ + + + + + + + + + {/* +

+ Types +

*/} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/* + + Click here + + */} + + {/* + + */} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ }> + gray + + }> + gray + + }> + gray + + + }> + gray-subtle + + }> + gray-subtle + + }> + gray-subtle + +
+ +
+ }> + blue + + }> + blue + + }> + blue + + + }> + blue-subtle + + }> + blue-subtle + + }> + blue-subtle + +
+ +
+ }> + purple + + }> + purple + + }> + purple + + + }> + purple-subtle + + }> + purple-subtle + + }> + purple-subtle + +
+ +
+ }> + amber + + }> + amber + + }> + amber + + + }> + amber-subtle + + }> + amber-subtle + + }> + amber-subtle + +
+ +
+ }> + red + + }> + red + + }> + red + + + }> + red-subtle + + }> + red-subtle + + }> + red-subtle + +
+ +
+ }> + pink + + }> + pink + + }> + pink + + + }> + pink-subtle + + }> + pink-subtle + + }> + pink-subtle + +
+ +
+ }> + green + + }> + green + + }> + green + + + }> + green-subtle + + }> + green-subtle + + }> + green-subtle + +
+ +
+ }> + teal + + }> + teal + + }> + teal + + + }> + teal-subtle + + }> + teal-subtle + + }> + teal-subtle + +
+ +
+ }> + inverted + + }> + inverted + + }> + inverted + +
+
+
+ + + + sm + + + md + + + lg + + + + + + + + +
+ + + + {/* */} + @ruru + + +

author of ruru UI

+
+
+
+
+ + +
+
+
+ + } placeholder="Enter your name" /> + } placeholder="Enter your name" /> + } + suffix={} + placeholder="Enter your name" + /> + + + + + + + + +
+ + + + + + +
+