diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5d6100..6dcd032 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,24 +29,24 @@ jobs: - name: Lint run: bunx biome ci . - typecheck: - runs-on: ubuntu-latest - steps: - - id: checkout - name: Checkout - uses: actions/checkout@v3 - - id: setup-bun - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: latest - - id: install-deps - name: Install dependencies - run: | - bun install + # typecheck: + # runs-on: ubuntu-latest + # steps: + # - id: checkout + # name: Checkout + # uses: actions/checkout@v3 + # - id: setup-bun + # name: Setup Bun + # uses: oven-sh/setup-bun@v1 + # with: + # bun-version: latest + # - id: install-deps + # name: Install dependencies + # run: | + # bun install - - name: Typecheck - run: bun run typecheck + # - name: Typecheck + # run: bun run typecheck test: runs-on: ${{ matrix.os }} diff --git a/bun.lockb b/bun.lockb index e7768a4..458450a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 28c5bc6..700b749 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cn-lorem-ipsum", - "version": "0.1.0", + "version": "0.1.1", "exports": { ".": { "types": "./dist/index.d.ts", @@ -25,7 +25,7 @@ }, "files": ["dist"], "keywords": ["bun", "lorem", "chinese"], - "workspaces": ["benchmark/"], + "workspaces": ["benchmark/", "playground/"], "license": "MIT", "homepage": "https://github.com/ZTL-UwU/cn-lorem-ipsum#readme", "repository": { diff --git a/playground/.gitignore b/playground/.gitignore new file mode 100644 index 0000000..8ee54e8 --- /dev/null +++ b/playground/.gitignore @@ -0,0 +1,30 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist +dist-ssr +coverage +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +*.tsbuildinfo diff --git a/playground/.vscode/extensions.json b/playground/.vscode/extensions.json new file mode 100644 index 0000000..a7cea0b --- /dev/null +++ b/playground/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["Vue.volar"] +} diff --git a/playground/README.md b/playground/README.md new file mode 100644 index 0000000..8eb16ca --- /dev/null +++ b/playground/README.md @@ -0,0 +1,33 @@ +# cn-lorem-ipsum playground + +This template should help get you started developing with Vue 3 in Vite. + +## Recommended IDE Setup + +[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). + +## Type Support for `.vue` Imports in TS + +TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. + +## Customize configuration + +See [Vite Configuration Reference](https://vitejs.dev/config/). + +## Project Setup + +```sh +bun install +``` + +### Compile and Hot-Reload for Development + +```sh +bun dev +``` + +### Type-Check, Compile and Minify for Production + +```sh +bun build +``` diff --git a/playground/bun.lockb b/playground/bun.lockb new file mode 100755 index 0000000..32dc8fc Binary files /dev/null and b/playground/bun.lockb differ diff --git a/playground/components.json b/playground/components.json new file mode 100644 index 0000000..0874d1e --- /dev/null +++ b/playground/components.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://shadcn-vue.com/schema.json", + "style": "default", + "typescript": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "src/assets/index.css", + "baseColor": "slate", + "cssVariables": true + }, + "framework": "vite", + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} diff --git a/playground/env.d.ts b/playground/env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/playground/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/playground/index.html b/playground/index.html new file mode 100644 index 0000000..572e465 --- /dev/null +++ b/playground/index.html @@ -0,0 +1,13 @@ + + + + + + + 中文假文&人名生成器 + + +
+ + + diff --git a/playground/package.json b/playground/package.json new file mode 100644 index 0000000..c6bd632 --- /dev/null +++ b/playground/package.json @@ -0,0 +1,40 @@ +{ + "name": "-cn-lorem-ipsum-playground", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "run-p type-check \"build-only {@}\" --", + "preview": "vite preview", + "build-only": "vite build", + "type-check": "vue-tsc --build --force" + }, + "dependencies": { + "@radix-icons/vue": "^1.0.0", + "@vueuse/core": "^10.9.0", + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.1", + "cn-lorem-ipsum": "^0.1.0", + "lucide-vue-next": "^0.377.0", + "radix-vue": "^1.7.3", + "tailwind-merge": "^2.3.0", + "tailwindcss-animate": "^1.0.7", + "vaul-vue": "^0.1.0", + "vue": "^3.4.21", + "vue-sonner": "^1.1.2" + }, + "devDependencies": { + "@tsconfig/node20": "^20.1.4", + "@types/node": "^20.12.5", + "@vitejs/plugin-vue": "^5.0.4", + "@vue/tsconfig": "^0.5.1", + "autoprefixer": "^10.4.19", + "npm-run-all2": "^6.1.2", + "shiki": "^1.4.0", + "tailwindcss": "^3.4.3", + "typescript": "~5.4.0", + "vite": "^5.2.8", + "vue-tsc": "^2.0.11" + } +} diff --git a/playground/public/favicon.ico b/playground/public/favicon.ico new file mode 100644 index 0000000..ea20fca Binary files /dev/null and b/playground/public/favicon.ico differ diff --git a/playground/src/App.vue b/playground/src/App.vue new file mode 100644 index 0000000..5fdedb7 --- /dev/null +++ b/playground/src/App.vue @@ -0,0 +1,209 @@ + + + + + \ No newline at end of file diff --git a/playground/src/assets/index.css b/playground/src/assets/index.css new file mode 100644 index 0000000..10b7e9c --- /dev/null +++ b/playground/src/assets/index.css @@ -0,0 +1,78 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; + + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; + + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; + + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + + --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 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + + --ring: 222.2 84% 4.9%; + + --radius: 0.5rem; + } + + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + + --popover: 222.2 84% 4.9%; + --popover-foreground: 210 40% 98%; + + --card: 222.2 84% 4.9%; + --card-foreground: 210 40% 98%; + + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + + --primary: 210 40% 98%; + --primary-foreground: 222.2 47.4% 11.2%; + + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + + --accent: 217.2 32.6% 17.5%; + --accent-foreground: 210 40% 98%; + + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + + --ring: 212.7 26.8% 83.9%; + } +} + +@layer base { + * { + @apply border-border; + } + body { + @apply bg-background text-foreground; + } +} \ No newline at end of file diff --git a/playground/src/components/DarkModeTrigger.vue b/playground/src/components/DarkModeTrigger.vue new file mode 100644 index 0000000..b292890 --- /dev/null +++ b/playground/src/components/DarkModeTrigger.vue @@ -0,0 +1,23 @@ + + + diff --git a/playground/src/components/ui/badge/Badge.vue b/playground/src/components/ui/badge/Badge.vue new file mode 100644 index 0000000..88e68b3 --- /dev/null +++ b/playground/src/components/ui/badge/Badge.vue @@ -0,0 +1,16 @@ + + + diff --git a/playground/src/components/ui/badge/index.ts b/playground/src/components/ui/badge/index.ts new file mode 100644 index 0000000..9448167 --- /dev/null +++ b/playground/src/components/ui/badge/index.ts @@ -0,0 +1,25 @@ +import { type VariantProps, cva } from 'class-variance-authority'; + +export { default as Badge } from './Badge.vue'; + +export 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 type BadgeVariants = VariantProps; diff --git a/playground/src/components/ui/button/Button.vue b/playground/src/components/ui/button/Button.vue new file mode 100644 index 0000000..019a9a8 --- /dev/null +++ b/playground/src/components/ui/button/Button.vue @@ -0,0 +1,26 @@ + + + diff --git a/playground/src/components/ui/button/index.ts b/playground/src/components/ui/button/index.ts new file mode 100644 index 0000000..799db28 --- /dev/null +++ b/playground/src/components/ui/button/index.ts @@ -0,0 +1,35 @@ +import { type VariantProps, cva } from 'class-variance-authority'; + +export { default as Button } from './Button.vue'; + +export const buttonVariants = cva( + 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', + { + variants: { + variant: { + default: 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: + 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: + 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', + secondary: + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + default: 'h-10 px-4 py-2', + xs: 'h-7 rounded px-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, + }, +); + +export type ButtonVariants = VariantProps; diff --git a/playground/src/components/ui/card/Card.vue b/playground/src/components/ui/card/Card.vue new file mode 100644 index 0000000..c296658 --- /dev/null +++ b/playground/src/components/ui/card/Card.vue @@ -0,0 +1,21 @@ + + + diff --git a/playground/src/components/ui/card/CardContent.vue b/playground/src/components/ui/card/CardContent.vue new file mode 100644 index 0000000..a92ebf8 --- /dev/null +++ b/playground/src/components/ui/card/CardContent.vue @@ -0,0 +1,14 @@ + + + diff --git a/playground/src/components/ui/card/CardDescription.vue b/playground/src/components/ui/card/CardDescription.vue new file mode 100644 index 0000000..4f02f8b --- /dev/null +++ b/playground/src/components/ui/card/CardDescription.vue @@ -0,0 +1,14 @@ + + + diff --git a/playground/src/components/ui/card/CardFooter.vue b/playground/src/components/ui/card/CardFooter.vue new file mode 100644 index 0000000..542fbe8 --- /dev/null +++ b/playground/src/components/ui/card/CardFooter.vue @@ -0,0 +1,14 @@ + + + diff --git a/playground/src/components/ui/card/CardHeader.vue b/playground/src/components/ui/card/CardHeader.vue new file mode 100644 index 0000000..3a67f4d --- /dev/null +++ b/playground/src/components/ui/card/CardHeader.vue @@ -0,0 +1,14 @@ + + + diff --git a/playground/src/components/ui/card/CardTitle.vue b/playground/src/components/ui/card/CardTitle.vue new file mode 100644 index 0000000..ad50fb8 --- /dev/null +++ b/playground/src/components/ui/card/CardTitle.vue @@ -0,0 +1,18 @@ + + + diff --git a/playground/src/components/ui/card/index.ts b/playground/src/components/ui/card/index.ts new file mode 100644 index 0000000..872bc81 --- /dev/null +++ b/playground/src/components/ui/card/index.ts @@ -0,0 +1,6 @@ +export { default as Card } from './Card.vue'; +export { default as CardHeader } from './CardHeader.vue'; +export { default as CardTitle } from './CardTitle.vue'; +export { default as CardDescription } from './CardDescription.vue'; +export { default as CardContent } from './CardContent.vue'; +export { default as CardFooter } from './CardFooter.vue'; diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenu.vue b/playground/src/components/ui/dropdown-menu/DropdownMenu.vue new file mode 100644 index 0000000..56a5575 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenu.vue @@ -0,0 +1,19 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue new file mode 100644 index 0000000..d992a74 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue @@ -0,0 +1,42 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuContent.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuContent.vue new file mode 100644 index 0000000..dd909dd --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuContent.vue @@ -0,0 +1,38 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuGroup.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuGroup.vue new file mode 100644 index 0000000..968d01d --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuGroup.vue @@ -0,0 +1,11 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuItem.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuItem.vue new file mode 100644 index 0000000..afa28b0 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuItem.vue @@ -0,0 +1,34 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuLabel.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuLabel.vue new file mode 100644 index 0000000..b8fd694 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuLabel.vue @@ -0,0 +1,30 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue new file mode 100644 index 0000000..7124d33 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue @@ -0,0 +1,19 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue new file mode 100644 index 0000000..e3cd31b --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue @@ -0,0 +1,43 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue new file mode 100644 index 0000000..53dcccb --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue @@ -0,0 +1,24 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue new file mode 100644 index 0000000..fc5620e --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue @@ -0,0 +1,14 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuSub.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuSub.vue new file mode 100644 index 0000000..bfda22f --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuSub.vue @@ -0,0 +1,19 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue new file mode 100644 index 0000000..7bf9004 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue @@ -0,0 +1,32 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue new file mode 100644 index 0000000..4c173d9 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue @@ -0,0 +1,35 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue b/playground/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue new file mode 100644 index 0000000..0717842 --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue @@ -0,0 +1,17 @@ + + + diff --git a/playground/src/components/ui/dropdown-menu/index.ts b/playground/src/components/ui/dropdown-menu/index.ts new file mode 100644 index 0000000..522a4df --- /dev/null +++ b/playground/src/components/ui/dropdown-menu/index.ts @@ -0,0 +1,16 @@ +export { DropdownMenuPortal } from 'radix-vue'; + +export { default as DropdownMenu } from './DropdownMenu.vue'; +export { default as DropdownMenuTrigger } from './DropdownMenuTrigger.vue'; +export { default as DropdownMenuContent } from './DropdownMenuContent.vue'; +export { default as DropdownMenuGroup } from './DropdownMenuGroup.vue'; +export { default as DropdownMenuRadioGroup } from './DropdownMenuRadioGroup.vue'; +export { default as DropdownMenuItem } from './DropdownMenuItem.vue'; +export { default as DropdownMenuCheckboxItem } from './DropdownMenuCheckboxItem.vue'; +export { default as DropdownMenuRadioItem } from './DropdownMenuRadioItem.vue'; +export { default as DropdownMenuShortcut } from './DropdownMenuShortcut.vue'; +export { default as DropdownMenuSeparator } from './DropdownMenuSeparator.vue'; +export { default as DropdownMenuLabel } from './DropdownMenuLabel.vue'; +export { default as DropdownMenuSub } from './DropdownMenuSub.vue'; +export { default as DropdownMenuSubTrigger } from './DropdownMenuSubTrigger.vue'; +export { default as DropdownMenuSubContent } from './DropdownMenuSubContent.vue'; diff --git a/playground/src/components/ui/input/Input.vue b/playground/src/components/ui/input/Input.vue new file mode 100644 index 0000000..a2c624c --- /dev/null +++ b/playground/src/components/ui/input/Input.vue @@ -0,0 +1,23 @@ + + + diff --git a/playground/src/components/ui/input/index.ts b/playground/src/components/ui/input/index.ts new file mode 100644 index 0000000..c5248c5 --- /dev/null +++ b/playground/src/components/ui/input/index.ts @@ -0,0 +1 @@ +export { default as Input } from './Input.vue'; diff --git a/playground/src/components/ui/label/Label.vue b/playground/src/components/ui/label/Label.vue new file mode 100644 index 0000000..75706bb --- /dev/null +++ b/playground/src/components/ui/label/Label.vue @@ -0,0 +1,27 @@ + + + diff --git a/playground/src/components/ui/label/index.ts b/playground/src/components/ui/label/index.ts new file mode 100644 index 0000000..c98e59f --- /dev/null +++ b/playground/src/components/ui/label/index.ts @@ -0,0 +1 @@ +export { default as Label } from './Label.vue'; diff --git a/playground/src/components/ui/select/Select.vue b/playground/src/components/ui/select/Select.vue new file mode 100644 index 0000000..160402f --- /dev/null +++ b/playground/src/components/ui/select/Select.vue @@ -0,0 +1,15 @@ + + + diff --git a/playground/src/components/ui/select/SelectContent.vue b/playground/src/components/ui/select/SelectContent.vue new file mode 100644 index 0000000..9d9d95f --- /dev/null +++ b/playground/src/components/ui/select/SelectContent.vue @@ -0,0 +1,53 @@ + + + diff --git a/playground/src/components/ui/select/SelectGroup.vue b/playground/src/components/ui/select/SelectGroup.vue new file mode 100644 index 0000000..e4d0de8 --- /dev/null +++ b/playground/src/components/ui/select/SelectGroup.vue @@ -0,0 +1,21 @@ + + + diff --git a/playground/src/components/ui/select/SelectItem.vue b/playground/src/components/ui/select/SelectItem.vue new file mode 100644 index 0000000..44004c6 --- /dev/null +++ b/playground/src/components/ui/select/SelectItem.vue @@ -0,0 +1,46 @@ + + + diff --git a/playground/src/components/ui/select/SelectItemText.vue b/playground/src/components/ui/select/SelectItemText.vue new file mode 100644 index 0000000..6a1e649 --- /dev/null +++ b/playground/src/components/ui/select/SelectItemText.vue @@ -0,0 +1,11 @@ + + + diff --git a/playground/src/components/ui/select/SelectLabel.vue b/playground/src/components/ui/select/SelectLabel.vue new file mode 100644 index 0000000..48b20ba --- /dev/null +++ b/playground/src/components/ui/select/SelectLabel.vue @@ -0,0 +1,15 @@ + + + diff --git a/playground/src/components/ui/select/SelectScrollDownButton.vue b/playground/src/components/ui/select/SelectScrollDownButton.vue new file mode 100644 index 0000000..55bc32b --- /dev/null +++ b/playground/src/components/ui/select/SelectScrollDownButton.vue @@ -0,0 +1,30 @@ + + + diff --git a/playground/src/components/ui/select/SelectScrollUpButton.vue b/playground/src/components/ui/select/SelectScrollUpButton.vue new file mode 100644 index 0000000..dcb54b4 --- /dev/null +++ b/playground/src/components/ui/select/SelectScrollUpButton.vue @@ -0,0 +1,30 @@ + + + diff --git a/playground/src/components/ui/select/SelectSeparator.vue b/playground/src/components/ui/select/SelectSeparator.vue new file mode 100644 index 0000000..3d34488 --- /dev/null +++ b/playground/src/components/ui/select/SelectSeparator.vue @@ -0,0 +1,19 @@ + + + diff --git a/playground/src/components/ui/select/SelectTrigger.vue b/playground/src/components/ui/select/SelectTrigger.vue new file mode 100644 index 0000000..ea1d805 --- /dev/null +++ b/playground/src/components/ui/select/SelectTrigger.vue @@ -0,0 +1,38 @@ + + + diff --git a/playground/src/components/ui/select/SelectValue.vue b/playground/src/components/ui/select/SelectValue.vue new file mode 100644 index 0000000..47fe941 --- /dev/null +++ b/playground/src/components/ui/select/SelectValue.vue @@ -0,0 +1,11 @@ + + + diff --git a/playground/src/components/ui/select/index.ts b/playground/src/components/ui/select/index.ts new file mode 100644 index 0000000..e22341a --- /dev/null +++ b/playground/src/components/ui/select/index.ts @@ -0,0 +1,11 @@ +export { default as Select } from './Select.vue'; +export { default as SelectValue } from './SelectValue.vue'; +export { default as SelectTrigger } from './SelectTrigger.vue'; +export { default as SelectContent } from './SelectContent.vue'; +export { default as SelectGroup } from './SelectGroup.vue'; +export { default as SelectItem } from './SelectItem.vue'; +export { default as SelectItemText } from './SelectItemText.vue'; +export { default as SelectLabel } from './SelectLabel.vue'; +export { default as SelectSeparator } from './SelectSeparator.vue'; +export { default as SelectScrollUpButton } from './SelectScrollUpButton.vue'; +export { default as SelectScrollDownButton } from './SelectScrollDownButton.vue'; diff --git a/playground/src/components/ui/sonner/Sonner.vue b/playground/src/components/ui/sonner/Sonner.vue new file mode 100644 index 0000000..546c3f8 --- /dev/null +++ b/playground/src/components/ui/sonner/Sonner.vue @@ -0,0 +1,22 @@ + + + diff --git a/playground/src/components/ui/sonner/index.ts b/playground/src/components/ui/sonner/index.ts new file mode 100644 index 0000000..93765a1 --- /dev/null +++ b/playground/src/components/ui/sonner/index.ts @@ -0,0 +1 @@ +export { default as Toaster } from './Sonner.vue'; diff --git a/playground/src/components/ui/tabs/Tabs.vue b/playground/src/components/ui/tabs/Tabs.vue new file mode 100644 index 0000000..230a380 --- /dev/null +++ b/playground/src/components/ui/tabs/Tabs.vue @@ -0,0 +1,15 @@ + + + diff --git a/playground/src/components/ui/tabs/TabsContent.vue b/playground/src/components/ui/tabs/TabsContent.vue new file mode 100644 index 0000000..81aa272 --- /dev/null +++ b/playground/src/components/ui/tabs/TabsContent.vue @@ -0,0 +1,24 @@ + + + diff --git a/playground/src/components/ui/tabs/TabsList.vue b/playground/src/components/ui/tabs/TabsList.vue new file mode 100644 index 0000000..ea1937b --- /dev/null +++ b/playground/src/components/ui/tabs/TabsList.vue @@ -0,0 +1,27 @@ + + + diff --git a/playground/src/components/ui/tabs/TabsTrigger.vue b/playground/src/components/ui/tabs/TabsTrigger.vue new file mode 100644 index 0000000..5e0491c --- /dev/null +++ b/playground/src/components/ui/tabs/TabsTrigger.vue @@ -0,0 +1,29 @@ + + + diff --git a/playground/src/components/ui/tabs/index.ts b/playground/src/components/ui/tabs/index.ts new file mode 100644 index 0000000..f90d5fe --- /dev/null +++ b/playground/src/components/ui/tabs/index.ts @@ -0,0 +1,4 @@ +export { default as Tabs } from './Tabs.vue'; +export { default as TabsTrigger } from './TabsTrigger.vue'; +export { default as TabsList } from './TabsList.vue'; +export { default as TabsContent } from './TabsContent.vue'; diff --git a/playground/src/lib/utils.ts b/playground/src/lib/utils.ts new file mode 100644 index 0000000..9ad0df4 --- /dev/null +++ b/playground/src/lib/utils.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} diff --git a/playground/src/main.ts b/playground/src/main.ts new file mode 100644 index 0000000..6b108b2 --- /dev/null +++ b/playground/src/main.ts @@ -0,0 +1,6 @@ +import { createApp } from 'vue'; +import App from './App.vue'; + +import './assets/index.css'; + +createApp(App).mount('#app'); diff --git a/playground/tailwind.config.js b/playground/tailwind.config.js new file mode 100644 index 0000000..df2777b --- /dev/null +++ b/playground/tailwind.config.js @@ -0,0 +1,93 @@ +const animate = require('tailwindcss-animate'); + +/** @type {import('tailwindcss').Config} */ +module.exports = { + darkMode: ['class'], + safelist: ['dark'], + prefix: '', + + content: [ + './pages/**/*.{ts,tsx,vue}', + './components/**/*.{ts,tsx,vue}', + './app/**/*.{ts,tsx,vue}', + './src/**/*.{ts,tsx,vue}', + ], + + 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: { + xl: 'calc(var(--radius) + 4px)', + lg: 'var(--radius)', + md: 'calc(var(--radius) - 2px)', + sm: 'calc(var(--radius) - 4px)', + }, + 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 }, + }, + 'collapsible-down': { + from: { height: 0 }, + to: { height: 'var(--radix-collapsible-content-height)' }, + }, + 'collapsible-up': { + from: { height: 'var(--radix-collapsible-content-height)' }, + to: { height: 0 }, + }, + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out', + 'collapsible-down': 'collapsible-down 0.2s ease-in-out', + 'collapsible-up': 'collapsible-up 0.2s ease-in-out', + }, + }, + }, + plugins: [animate], +}; diff --git a/playground/tsconfig.app.json b/playground/tsconfig.app.json new file mode 100644 index 0000000..e14c754 --- /dev/null +++ b/playground/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], + "exclude": ["src/**/__tests__/*"], + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/playground/tsconfig.json b/playground/tsconfig.json new file mode 100644 index 0000000..66b5e57 --- /dev/null +++ b/playground/tsconfig.json @@ -0,0 +1,11 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.node.json" + }, + { + "path": "./tsconfig.app.json" + } + ] +} diff --git a/playground/tsconfig.node.json b/playground/tsconfig.node.json new file mode 100644 index 0000000..cb71b4b --- /dev/null +++ b/playground/tsconfig.node.json @@ -0,0 +1,23 @@ +{ + "extends": "@tsconfig/node20/tsconfig.json", + "include": [ + "vite.config.*", + "vitest.config.*", + "cypress.config.*", + "nightwatch.conf.*", + "playwright.config.*" + ], + "compilerOptions": { + "composite": true, + "noEmit": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + + "module": "ESNext", + "moduleResolution": "Bundler", + "types": ["node"], + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/playground/vite.config.ts b/playground/vite.config.ts new file mode 100644 index 0000000..3d51459 --- /dev/null +++ b/playground/vite.config.ts @@ -0,0 +1,21 @@ +import vue from '@vitejs/plugin-vue'; +import { defineConfig } from 'vite'; + +import path from 'node:path'; +import autoprefixer from 'autoprefixer'; +import tailwind from 'tailwindcss'; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue()], + resolve: { + alias: { + '@': path.resolve(__dirname, './src'), + }, + }, + css: { + postcss: { + plugins: [tailwind(), autoprefixer()], + }, + }, +}); diff --git a/src/index.ts b/src/index.ts index be63cfa..59c2300 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,7 +73,7 @@ function article(opt: IOption = emptyOpt) { function name(opt: { len?: number } = { len: undefined }) { const len = opt.len ?? (Math.random() < 0.97 ? 3 : 2); - return `${lastName[randInt(lastName.length - 1)]}${getCharacter()}${ - len === 3 ? getCharacter() : '' - }`; + let firstName = ''; + for (let i = 0; i < len - 1; i += 1) firstName += getCharacter(); + return `${lastName[randInt(lastName.length - 1)]}${firstName}`; } diff --git a/test/index.test.ts b/test/index.test.ts index 824cef4..b9874c2 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -33,5 +33,6 @@ describe('name', () => { it('length', () => { expect(cnLorem.name({ len: 3 }).length).toBe(3); expect(cnLorem.name({ len: 2 }).length).toBe(2); + expect(cnLorem.name({ len: 100 }).length).toBe(100); }); });