1- export { colors , shadows , radius , fonts , gradient } from './tokens'
1+ /**
2+ * @forkzero /ui — Shared design system for Forkzero applications.
3+ *
4+ * ## Quick start
5+ *
6+ * ```ts
7+ * import {
8+ * colors, fonts, fontSizes, shadows, radius, gradient,
9+ * pageWrapper, cardBase, codeBlock, inlineCode, sectionTitle,
10+ * containerNarrow, containerWide,
11+ * useHoverLift, useReducedMotion, injectGlobalStyles,
12+ * Header, PoweredByHeader, Footer, CopyButton,
13+ * } from '@forkzero/ui'
14+ * ```
15+ *
16+ * ## Tokens
17+ *
18+ * ### Colors (`colors`)
19+ *
20+ * | Token | Purpose |
21+ * |-----------------|--------------------------------------------------|
22+ * | `bgPrimary` | Main page background |
23+ * | `bgSecondary` | Slightly darker background (page wrapper default) |
24+ * | `bgCard` | Card / elevated surface background |
25+ * | `bgDeep` | Deepest background (code blocks, inset areas) |
26+ * | `bgGlass` | Semi-transparent header backdrop |
27+ * | `textPrimary` | Primary text (headings, labels) |
28+ * | `textOnAccent` | Text on accent-colored backgrounds |
29+ * | `textSecondary` | Body text, descriptions |
30+ * | `textMuted` | Captions, hints, metadata — WCAG AA compliant |
31+ * | `borderColor` | Subtle borders on cards and dividers |
32+ * | `accentBlue` | Primary accent — links, CTAs, focus rings |
33+ * | `accentGreen` | Success states, available badges |
34+ * | `accentYellow` | Warnings, requirement layer |
35+ * | `accentRed` | Errors, destructive actions |
36+ * | `accentPurple` | Thesis layer, secondary accent |
37+ *
38+ * Always use tokens — never hardcode color values. For opacity variants
39+ * use template literals: `` `${colors.accentGreen}14` `` (hex alpha suffix).
40+ *
41+ * ### Typography (`fonts`, `fontSizes`)
42+ *
43+ * - `fonts.system` — UI text, headings, body copy
44+ * - `fonts.mono` — Code blocks, technical labels, CLI output
45+ * - `fontSizes` — Scale from `xs` (0.75rem) to `3xl` (2rem)
46+ *
47+ * ### Shadows (`shadows`)
48+ *
49+ * - `shadows.sm` — Subtle cards, badges
50+ * - `shadows.md` — Default card elevation (used by `cardBase`)
51+ * - `shadows.lg` — Hover-lifted / emphasized cards
52+ *
53+ * ### Other
54+ *
55+ * - `radius` — Standard border radius (8px)
56+ * - `gradient` — Hero/section gradient background
57+ *
58+ * ## Style objects
59+ *
60+ * Pre-composed `CSSProperties` objects. Spread and extend as needed:
61+ *
62+ * ```ts
63+ * const myCard = { ...cardBase, padding: '1.5rem', marginBottom: '1rem' }
64+ * ```
65+ *
66+ * | Object | Use for |
67+ * |-------------------|--------------------------------------------|
68+ * | `pageWrapper` | Top-level page `<div>` (bg, min-height, font) |
69+ * | `cardBase` | Any card surface (bg, radius, shadow, border) |
70+ * | `codeBlock` | `<pre>` code blocks |
71+ * | `inlineCode` | `<code>` inline snippets |
72+ * | `sectionTitle` | `<h2>` section headings |
73+ * | `containerNarrow` | Centered content column (max 800px) |
74+ * | `containerWide` | Centered content column (max 1200px) |
75+ *
76+ * ## Hooks
77+ *
78+ * ### `useHoverLift(defaultShadow?)`
79+ *
80+ * Returns `{ style, handlers }`. Apply both to a card/link element for a
81+ * lift-on-hover effect. Automatically disabled when the user prefers
82+ * reduced motion. Replaces the deprecated `hoverLiftHandlers` function.
83+ *
84+ * ```tsx
85+ * function Card() {
86+ * const { style, handlers } = useHoverLift(shadows.md)
87+ * return <div style={{ ...cardBase, ...style }} {...handlers}>...</div>
88+ * }
89+ * ```
90+ *
91+ * For elements rendered in a loop, wrap in a component so the hook is
92+ * called per-instance (hooks cannot be called conditionally or in loops).
93+ *
94+ * ### `useReducedMotion()`
95+ *
96+ * Returns `boolean` — `true` when the user's OS prefers reduced motion.
97+ * Use to conditionally skip custom animations.
98+ *
99+ * ### `injectGlobalStyles()`
100+ *
101+ * Call once (idempotent) to inject global CSS:
102+ * - `:focus-visible` ring (2px solid accentBlue, 2px offset) on elements
103+ * inside `[data-fzui]` containers
104+ * - `prefers-reduced-motion: reduce` suppression of animations/transitions
105+ * inside `[data-fzui]` containers
106+ *
107+ * All built-in components (Header, Footer, CopyButton) call this
108+ * automatically. When building custom components, call it and add
109+ * `data-fzui` to your root element.
110+ *
111+ * ## Components
112+ *
113+ * ### `<Header>`
114+ *
115+ * Props:
116+ * - `navLinks?: { label: string; href: string }[]` — nav items
117+ * - `githubUrl?: string` — renders a GitHub pill button
118+ * - `ctaLink?: { label: string; href: string }` — accent CTA pill
119+ * between nav links and GitHub button
120+ * - `minimal?: boolean` — logo only, no nav
121+ *
122+ * ### `<PoweredByHeader>`
123+ *
124+ * Compact header for embedded/sub-apps.
125+ * Props: `poweredByUrl?`, `poweredByLabel?`
126+ *
127+ * ### `<Footer>`
128+ *
129+ * Props: `repoUrl?`, `repoLabel?`, `orgName?`
130+ *
131+ * ### `<CopyButton>`
132+ *
133+ * Props: `text: string` — the value copied to clipboard.
134+ * Position inside a `position: relative` container.
135+ * Has a 44px min touch target for mobile accessibility.
136+ *
137+ * ## Accessibility checklist
138+ *
139+ * - Add `data-fzui` to root elements of custom components
140+ * - Call `injectGlobalStyles()` in component render (idempotent)
141+ * - Use `useHoverLift` (not `hoverLiftHandlers`) for motion-safe hover
142+ * - Buttons/links must be at least 44px in the smallest dimension
143+ * - Use `textMuted` (not lower-alpha values) for de-emphasized text
144+ *
145+ * ## Branding
146+ *
147+ * - Write "Forkzero" in prose, never "ForkZero"
148+ * - Logo renders as "FORK" (bold) + "ZERO" (thin) via Header component
149+ *
150+ * ## Do not
151+ *
152+ * - Hardcode color hex/hsl values — always use `colors.*`
153+ * - Use `hoverLiftHandlers` — it is deprecated, use `useHoverLift`
154+ * - Skip `data-fzui` on component roots — focus rings won't work
155+ * - Set touch targets below 44px
156+ */
157+
158+ export { colors , shadows , radius , fonts , fontSizes , gradient } from './tokens'
2159export {
3160 codeBlock ,
4161 inlineCode ,
@@ -10,6 +167,9 @@ export {
10167 LATTICE_LAYERS ,
11168 LATTICE_EDGES ,
12169 hoverLiftHandlers ,
170+ useHoverLift ,
171+ useReducedMotion ,
172+ injectGlobalStyles ,
13173} from './styles'
14174export { Header } from './components/Header'
15175export type { HeaderLink , HeaderProps , PoweredByHeaderProps } from './components/Header'
0 commit comments