算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
design-system【设计与创意】Build a new design system (tokens, variants, theming). Use when "create a design system" or "component library from scratch". Drifted existing system → housekeep-design. Plan-only unification → plan-uiux-unification.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Degree of freedom: MIXED. Token taxonomy and variants [HIGH freedom];
existing ui/ / token inventory [LOW freedom — run exactly].
Build scalable, maintainable design systems with consistent tokens, variants, and documentation.
components/ui, tokens, cva, shadcn/Radixcva covers real states (default/destructive/disabled)Inventory: shadcn
Buttonexists; colors are raw#3B82F6in three pages; no--primary. Tokenize:--primary/--primary-foregroundinglobals.css; Tailwind mapshsl(var(--primary)). Variant: extend existingbuttonVariants— do not addcomponents/Button2.tsx. Document: JSDoc lists variants/sizes; focus ring + dark.darkoverrides.
housekeep-design; plan-only unification → plan-uiux-unificationBefore creating ANY design system components, verify:
ls -la src/components/ui/
cat package.json | grep -i "shadcn\|radix\|headless"
cat components.json 2>/dev/null # shadcn config
cat tailwind.config.* | head -100
cat src/styles/globals.css | head -50
rg "var\(--" --type css | head -20
rg "cva\(|variants:" --type ts --type tsx | head -10
rg "cn\(|clsx\(|twMerge" --type tsx | head -5
Why: Don't recreate existing primitives. Extend and enhance what exists.
Face and ground are choices, not defaults: Inter/Roboto/Arial, a cream/off-white page, and a purple-gradient primary are the fallbacks to name and avoid. Add --font-sans / --font-display tokens for the faces you pick.
:root (--background, --foreground, --primary, --muted, --destructive, --border, --ring, …); .dark overrides the same names--spacing-xs…xl), radius (--radius ± 4px), shadows (--shadow-sm…lg), durations and easings as tokens too:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--primary: 221.2 83.2% 53.3%;
--primary-foreground: 210 40% 98%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
}
Full token set: references/tokens.md §CSS Custom Properties.
darkMode: 'class'; every color is hsl(var(--token)) with a DEFAULT / foreground pairborderRadius, boxShadow, transitionDuration read the CSS variables, never literalsFull config: references/tokens.md §Tailwind Config Integration.
cva() base string carries focus-visible ring and disabled: styles; variants.variant (default/destructive/outline/secondary/ghost/link) and variants.size (default/sm/lg/icon) with defaultVariantsVariantProps<typeof buttonVariants>; forwardRef and asChild via Slot*Variants so consumers can reuse the classes// lib/utils.ts
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
Full button.tsx: references/components.md §Button with CVA.
Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooterforwardRef wrapper over the native element with cn(defaults, className) and a displayNamebg-card text-card-foreground, text-muted-foregroundFull card.tsx: references/components.md §Compound Card.
Root, Trigger, Portal, Close from @radix-ui/react-dialog; style Overlay and Content with forwardRefdata-[state=open] / data-[state=closed] drive enter/exit animation classesContent with an sr-only labelFull dialog.tsx: references/components.md §Accessible Dialog with Radix.
JSDoc block per component: one-line purpose, @example usage, then ## Variants, ## Sizes (with pixel heights), and ## Accessibility (native element, disabled, focus ring, asChild).
Template: references/components.md §Component Documentation Pattern.
src/components/ui/*.tsx with an index.ts barrel, src/lib/utils.ts for cn(), src/styles/globals.css for tokens, tailwind.config.ts for the theme.
Tree: references/components.md §File Structure.
After creating design system components: