This commit is contained in:
新新 committed 2026-04-27 17:03:56 +08:00
commit fe636432d0
154 files changed
+30381

No files matched your search

@@ -0,0 +1,49 @@
# Aesthetic Playbook
Pick ONE direction and commit. Swap colors/fonts if needed, but keep the intent. Choose a single **signature move** that someone will remember.
## Font Rule (avoid default vibes)
- If the repo already has a font system, stay consistent unless asked to change it.
- Otherwise: pick a characterful display font + a legible body font. Avoid overused “default tech” pairings.
## Brutalist Raw (high-contrast, rule-heavy)
- Fonts: Display `Bricolage Grotesque` / `Fraunces`; Body `Atkinson Hyperlegible` / `IBM Plex Sans`; Mono `IBM Plex Mono`.
- Colors: Ink/ivory with one acidic accent (e.g. tomato, chartreuse).
- Signature moves: oversized numeric index badges; thick 2px rules; hard invert hover.
- Backgrounds: checkerboard corner, dotted matrix, a single diagonal stripe.
## Editorial / Magazine (luxury, typographic hierarchy)
- Fonts: Display `Instrument Serif` / `Cormorant Garamond`; Body `Source Serif 4` / `Newsreader`; Mono `DM Mono`.
- Colors: warm off-white, deep ink, one burnt accent (rust/saffron).
- Signature moves: pull-quote rail; hairline rules; “issue number” metadata strip.
- Backgrounds: subtle paper grain, soft vignette.
## Techno-Gothic (dark, minimal, sharp accents)
- Fonts: Display `Unbounded` / `Syne`; Body `Work Sans` / `Barlow`; Mono `JetBrains Mono`.
- Colors: near-black base with cold accent (cyan/acid green) + muted steel.
- Signature moves: corner ticks, scanline sheen on hover, “system status” chips.
- Backgrounds: diagonal hatch, faint grid, tiny starfield.
## Neo-Poster (bold blocks, loud hierarchy)
- Fonts: Display `Bebas Neue` / `Archivo Black`; Body `Noto Sans`; Mono `Space Mono` (only if it fits the concept).
- Colors: high-sat primaries on warm neutral, with black rules.
- Signature moves: torn-paper edge (CSS mask vibe); huge headline with tight tracking; sticker CTA.
- Backgrounds: halftone dot field, off-register shadows.
## Soft Craft (warm, tactile, friendly)
- Fonts: Display `Sora` / `Epilogue`; Body `Alegreya Sans` / `Manrope`; Mono optional.
- Colors: warm cream, terracotta accent, sage secondary.
- Signature moves: stitched borders; stacked cards; gentle floating blobs (reduced-motion safe).
- Backgrounds: irregular gradient blobs + low-opacity noise.
## Industrial / Utilitarian (labeled panels, measured density)
- Fonts: Display `Archivo` / `Anton`; Body `Barlow` / `IBM Plex Sans`; Mono `JetBrains Mono`.
- Colors: cold neutrals with hazard accent (amber) and a secondary teal.
- Signature moves: panel labels; coordinate tags; “spec table” sectioning.
- Backgrounds: repeating hatch, soft inner glows for depth.
## How to Choose (fast)
1) Choose the emotional goal (luxe, raw, calm, severe, playful).
2) Pick type first (display sets the tone).
3) Pick one signature move and apply it in 2–3 places max.
4) Keep everything else quiet and supportive.
@@ -0,0 +1,42 @@
# AI-native UI Patterns (trust + control)
AI UI should feel like a product feature, not a bolt-on chatbot. Prioritize clarity, trust, and user control.
## Core patterns
### Copilot side panel (assistive AI)
- Persistent panel (often right rail) with:
- header + **AI disclosure**
- prompt input (or command chips/templates)
- output stream area
- actions (apply, copy, discard)
### AI-generated labeling (strict)
- AI output must not be visually confused with user-authored content.
- Use a badge/label (“AI-generated”) with tooltip text and/or subtle tinting.
### Citations / sources (recommended for factual outputs)
- Render as chips or footnotes under the relevant block.
- Make them clickable and scannable (title + optional section anchor).
### “Why this?” affordance
- Provide a short “why this suggestion?” expansion with neutral language.
- Prefer concrete reasons (policy, data, heuristic) over anthropomorphic phrasing.
## Human-in-the-loop (strict)
- Provide at least one of:
- **Apply / Undo**
- **Accept / Reject**
- confirmation for destructive actions
- Never silently perform irreversible changes.
## AI loading and motion
- Use subtle, purposeful indicators:
- typing dots, shimmer skeleton, progressive reveal
- Respect `prefers-reduced-motion` (no endless animated flourish).
## Signature move ideas (pick one)
- Citation rail (chips aligned to the right edge of the answer)
- Apply stack (queued changes with an “apply all” + per-item undo)
- Confidence capsule (uncertainty/assumptions shown as compact pills)
@@ -0,0 +1,23 @@
# Anti-Patterns (avoid “AI slop”)
Use this as a quick filter before shipping.
## Visual clichés
- Generic purple-on-white gradients with soft glass cards everywhere.
- Samey startup landing layout: centered hero, 3 cards, logo wall, FAQ, identical CTA band.
- Indiscriminate glow + blur layers that reduce legibility.
## Typography defaults
- Unintentional type: no scale, no rhythm, headings too close in size to body.
- Mixing too many fonts “because it looks cool” (unless the direction is explicitly chaotic).
- Defaulting to the same trendy “safe” font pairings (e.g., the usual modern grotesks) when the project calls for a stronger voice.
## Motion mistakes
- Random micro-animations everywhere instead of one orchestrated sequence.
- No `prefers-reduced-motion` handling.
- Hover-only affordances (mobile users get nothing).
## UX/a11y misses
- Weak focus states, low contrast, tiny hit targets.
- Buttons styled as links (or vice versa) without correct semantics.
- Missing labels on inputs, icon-only actions without accessible names.
@@ -0,0 +1,56 @@
# Implementation Patterns
Use these patterns to move quickly while keeping the aesthetic sharp. Prefer real code and real semantics over “design vibes”.
## Decision: Vanilla vs React
- Use **vanilla** for quick concepts, single pages, marketing-style layouts.
- Use **React** when the UI lives inside an app, needs state, routes, or reusable components.
## Vanilla HTML/CSS/JS Workflow
- Start with semantic structure: `header`, `main`, `section`, `article`, `footer`.
- Add skip links when there’s a nav/header: `a.skip-nav` → `#main`.
- Define theme tokens up top:
```css
:root {
--bg: #0b0c10;
--surface: #10131a;
--fg: #f7f2e9;
--muted: #9aa1b5;
--accent: #ff6b4a;
--radius: 18px;
--shadow: 0 18px 40px rgba(0,0,0,0.35);
--ease: cubic-bezier(.2,.9,.2,1);
}
```
- Layout: Grid for macro, Flexbox for clusters. Break the grid deliberately but preserve reading order.
- Motion: prefer CSS keyframes + `transition`. Orchestrate a few moments (load + hover), not everything.
- Reveal animations: use IntersectionObserver to toggle classes (small JS only).
## React Patterns (TypeScript)
- Keep components small: `Hero`, `FeatureList`, `SpecsRail`, `CTA`.
- Use data arrays for repeated UI (cards/steps/metrics) and map to components.
- Styling: prefer the repo’s existing approach. If unknown, CSS Modules is a safe default.
- Motion: keep durations < 500ms; stagger by 80–140ms; gate everything with reduced-motion.
## Motion & Reduced Motion
- Always include a reduced-motion fallback:
```css
@media (prefers-reduced-motion: reduce) {
* { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
```
- Keep animations paint-friendly (transform/opacity). Avoid animating large blur shadows.
## Layout & Spacing
- Use a spacing scale (4/8 base). Keep prose line-length ~68–76ch.
- If maximalist: constrain chaos inside frames. If minimal: increase margins and tighten hierarchy.
## Texture & Backgrounds (CSS-only)
- Use layered gradients and subtle noise-like patterns (no heavy assets by default).
- Prefer subtle grain overlays over full-page blur.
## QA Checklist
- One `h1`, logical heading order, landmarks present.
- Focus visible, keyboard usable, contrast AA+.
- Tap targets 44px minimum for primary interactions.
- Mobile layout feels intentional (not just “stack everything”).
@@ -0,0 +1,25 @@
# React + Next.js Best Practices (concise)
## React component design
- Keep components and Hooks pure: compute UI from props/state without side effects in render.
- Run side effects outside render (event handlers or Effects).
- Prefer event handlers for user-driven work; avoid “Effect for everything.”
- Follow the Rules of Hooks (top-level only; consistent call order; only in React functions).
- Don’t call component functions directly; use JSX so React controls rendering.
- Split large components into small, focused pieces; keep props stable and typed.
## Next.js App Router
- Server Components by default; add `"use client"` only when you need state, effects, or browser APIs.
- Keep Client Components small and isolated (UI islands).
- Use `next/link` for navigation and `next/image` for real images.
- Prefer `next/font` when changing typography to avoid layout shift/FOIT.
## Data fetching and caching
- Prefer server-side `fetch` and explicit caching with `cache`/`revalidate`.
- Avoid client-side fetch inside `useEffect` unless you truly need client-only data.
- Keep loading/error states explicit and user-friendly.
## State and performance
- Minimize global state; lift only when necessary.
- Memoize expensive calculations; keep derived state computed, not stored.
- Avoid unnecessary re-renders by splitting components and using stable props.