@theproductguy/create-mission-control 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +63 -7
- package/package.json +2 -2
- package/src/template/.env.example +28 -0
- package/src/template/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- package/src/template/.github/ISSUE_TEMPLATE/feature_request.md +30 -0
- package/src/template/.github/PULL_REQUEST_TEMPLATE.md +33 -0
- package/src/template/.github/workflows/ci.yml +83 -0
- package/src/template/.husky/commit-msg +1 -0
- package/src/template/.husky/pre-commit +1 -0
- package/src/template/.prettierrc +11 -0
- package/src/template/README.md +78 -0
- package/src/template/agent-os/commands/create-constitution/create-constitution.md +89 -0
- package/src/template/agent-os/commands/export-product/export-product.md +24 -0
- package/src/template/agent-os/commands/initialize-design/initialize-design.md +10 -1
- package/src/template/agent-os/commands/research-tech/research-tech.md +93 -0
- package/src/template/agent-os/commands/shape-spec/shape-spec.md +2 -1
- package/src/template/agent-os/docs/context7.md +20 -0
- package/src/template/commitlint.config.js +25 -0
- package/src/template/control-center/backend/index.js +67 -4
- package/src/template/control-center/frontend/src/App.tsx +193 -64
- package/src/template/design-system/{.claude → .gemini}/commands/design-os/design-shell.md +95 -69
- package/src/template/design-system/.gemini/commands/design-os/design-tokens.md +211 -0
- package/src/template/design-system/.gemini/commands/impeccable/WORKFLOW.md +163 -0
- package/src/template/design-system/.gemini/commands/impeccable/adapt.md +189 -0
- package/src/template/design-system/.gemini/commands/impeccable/animate.md +184 -0
- package/src/template/design-system/.gemini/commands/impeccable/audit.md +123 -0
- package/src/template/design-system/.gemini/commands/impeccable/bolder.md +126 -0
- package/src/template/design-system/.gemini/commands/impeccable/clarify.md +173 -0
- package/src/template/design-system/.gemini/commands/impeccable/colorize.md +152 -0
- package/src/template/design-system/.gemini/commands/impeccable/critique.md +112 -0
- package/src/template/design-system/.gemini/commands/impeccable/delight.md +311 -0
- package/src/template/design-system/.gemini/commands/impeccable/extract.md +88 -0
- package/src/template/design-system/.gemini/commands/impeccable/harden.md +351 -0
- package/src/template/design-system/.gemini/commands/impeccable/normalize.md +61 -0
- package/src/template/design-system/.gemini/commands/impeccable/onboard.md +236 -0
- package/src/template/design-system/.gemini/commands/impeccable/optimize.md +262 -0
- package/src/template/design-system/.gemini/commands/impeccable/polish.md +196 -0
- package/src/template/design-system/.gemini/commands/impeccable/quieter.md +112 -0
- package/src/template/design-system/.gemini/commands/impeccable/simplify.md +131 -0
- package/src/template/design-system/.gemini/commands/impeccable/teach-impeccable.md +67 -0
- package/src/template/design-system/.gemini/hooks/ai-slop-guard.md +80 -0
- package/src/template/design-system/.gemini/hooks/on-design-complete.md +63 -0
- package/src/template/design-system/.gemini/skills/frontend-design/SKILL.md +126 -0
- package/src/template/design-system/.gemini/skills/frontend-design/reference/color-and-contrast.md +132 -0
- package/src/template/design-system/.gemini/skills/frontend-design/reference/interaction-design.md +123 -0
- package/src/template/design-system/.gemini/skills/frontend-design/reference/motion-design.md +99 -0
- package/src/template/design-system/.gemini/skills/frontend-design/reference/responsive-design.md +114 -0
- package/src/template/design-system/.gemini/skills/frontend-design/reference/spatial-design.md +100 -0
- package/src/template/design-system/.gemini/skills/frontend-design/reference/typography.md +131 -0
- package/src/template/design-system/.gemini/skills/frontend-design/reference/ux-writing.md +107 -0
- package/src/template/design-system/src/components/DesignPage.tsx +104 -0
- package/src/template/eslint.config.js +37 -0
- package/src/template/lint-staged.config.js +6 -0
- package/src/template/package-lock.json +10308 -0
- package/src/template/package.json +25 -2
- package/src/template/src/__tests__/example.test.ts +17 -0
- package/src/template/src/__tests__/setup.ts +14 -0
- package/src/template/vitest.config.ts +25 -0
- package/src/template/design-system/.claude/commands/design-os/design-tokens.md +0 -166
- package/src/template/design-system/.claude/skills/frontend-design/SKILL.md +0 -42
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/data-model.md +0 -0
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/design-screen.md +0 -0
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/export-product.md +0 -0
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/product-roadmap.md +0 -0
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/product-vision.md +0 -0
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/sample-data.md +0 -0
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/screenshot-design.md +0 -0
- /package/src/template/design-system/{.claude → .gemini}/commands/design-os/shape-section.md +0 -0
- /package/src/template/design-system/{claude.md → gemini.md} +0 -0
package/src/template/design-system/.gemini/skills/frontend-design/reference/interaction-design.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Interaction Design
|
|
2
|
+
|
|
3
|
+
## The Eight Interactive States
|
|
4
|
+
|
|
5
|
+
Every interactive element needs these states designed:
|
|
6
|
+
|
|
7
|
+
| State | When | Visual Treatment |
|
|
8
|
+
|-------|------|------------------|
|
|
9
|
+
| **Default** | At rest | Base styling |
|
|
10
|
+
| **Hover** | Pointer over (not touch) | Subtle lift, color shift |
|
|
11
|
+
| **Focus** | Keyboard/programmatic focus | Visible ring (see below) |
|
|
12
|
+
| **Active** | Being pressed | Pressed in, darker |
|
|
13
|
+
| **Disabled** | Not interactive | Reduced opacity, no pointer |
|
|
14
|
+
| **Loading** | Processing | Spinner, skeleton |
|
|
15
|
+
| **Error** | Invalid state | Red border, icon, message |
|
|
16
|
+
| **Success** | Completed | Green check, confirmation |
|
|
17
|
+
|
|
18
|
+
**The common miss**: Designing hover without focus, or vice versa. They're different. Keyboard users never see hover states.
|
|
19
|
+
|
|
20
|
+
## Focus Rings: Do Them Right
|
|
21
|
+
|
|
22
|
+
**Never `outline: none` without replacement.** It's an accessibility violation. Instead, use `:focus-visible` to show focus only for keyboard users:
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
/* Hide focus ring for mouse/touch */
|
|
26
|
+
button:focus {
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Show focus ring for keyboard */
|
|
31
|
+
button:focus-visible {
|
|
32
|
+
outline: 2px solid var(--color-accent);
|
|
33
|
+
outline-offset: 2px;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Focus ring design**:
|
|
38
|
+
- High contrast (3:1 minimum against adjacent colors)
|
|
39
|
+
- 2-3px thick
|
|
40
|
+
- Offset from element (not inside it)
|
|
41
|
+
- Consistent across all interactive elements
|
|
42
|
+
|
|
43
|
+
## Form Design: The Non-Obvious
|
|
44
|
+
|
|
45
|
+
**Placeholders aren't labels**—they disappear on input. Always use visible `<label>` elements. **Validate on blur**, not on every keystroke (exception: password strength). Place errors **below** fields with `aria-describedby` connecting them.
|
|
46
|
+
|
|
47
|
+
## Loading States
|
|
48
|
+
|
|
49
|
+
**Optimistic updates**: Show success immediately, rollback on failure. Use for low-stakes actions (likes, follows), not payments or destructive actions. **Skeleton screens > spinners**—they preview content shape and feel faster than generic spinners.
|
|
50
|
+
|
|
51
|
+
## Modals: The Inert Approach
|
|
52
|
+
|
|
53
|
+
Focus trapping in modals used to require complex JavaScript. Now use the `inert` attribute:
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<!-- When modal is open -->
|
|
57
|
+
<main inert>
|
|
58
|
+
<!-- Content behind modal can't be focused or clicked -->
|
|
59
|
+
</main>
|
|
60
|
+
<dialog open>
|
|
61
|
+
<h2>Modal Title</h2>
|
|
62
|
+
<!-- Focus stays inside modal -->
|
|
63
|
+
</dialog>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or use the native `<dialog>` element:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
const dialog = document.querySelector('dialog');
|
|
70
|
+
dialog.showModal(); // Opens with focus trap, closes on Escape
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## The Popover API
|
|
74
|
+
|
|
75
|
+
For tooltips, dropdowns, and non-modal overlays, use native popovers:
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<button popovertarget="menu">Open menu</button>
|
|
79
|
+
<div id="menu" popover>
|
|
80
|
+
<button>Option 1</button>
|
|
81
|
+
<button>Option 2</button>
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Benefits**: Light-dismiss (click outside closes), proper stacking, no z-index wars, accessible by default.
|
|
86
|
+
|
|
87
|
+
## Destructive Actions: Undo > Confirm
|
|
88
|
+
|
|
89
|
+
**Undo is better than confirmation dialogs**—users click through confirmations mindlessly. Remove from UI immediately, show undo toast, actually delete after toast expires. Use confirmation only for truly irreversible actions (account deletion), high-cost actions, or batch operations.
|
|
90
|
+
|
|
91
|
+
## Keyboard Navigation Patterns
|
|
92
|
+
|
|
93
|
+
### Roving Tabindex
|
|
94
|
+
|
|
95
|
+
For component groups (tabs, menu items, radio groups), one item is tabbable; arrow keys move within:
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<div role="tablist">
|
|
99
|
+
<button role="tab" tabindex="0">Tab 1</button>
|
|
100
|
+
<button role="tab" tabindex="-1">Tab 2</button>
|
|
101
|
+
<button role="tab" tabindex="-1">Tab 3</button>
|
|
102
|
+
</div>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Arrow keys move `tabindex="0"` between items. Tab moves to the next component entirely.
|
|
106
|
+
|
|
107
|
+
### Skip Links
|
|
108
|
+
|
|
109
|
+
Provide skip links (`<a href="#main-content">Skip to main content</a>`) for keyboard users to jump past navigation. Hide off-screen, show on focus.
|
|
110
|
+
|
|
111
|
+
## Gesture Discoverability
|
|
112
|
+
|
|
113
|
+
Swipe-to-delete and similar gestures are invisible. Hint at their existence:
|
|
114
|
+
|
|
115
|
+
- **Partially reveal**: Show delete button peeking from edge
|
|
116
|
+
- **Onboarding**: Coach marks on first use
|
|
117
|
+
- **Alternative**: Always provide a visible fallback (menu with "Delete")
|
|
118
|
+
|
|
119
|
+
Don't rely on gestures as the only way to perform actions.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
**Avoid**: Removing focus indicators without alternatives. Using placeholder text as labels. Touch targets <44x44px. Generic error messages. Custom controls without ARIA/keyboard support.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Motion Design
|
|
2
|
+
|
|
3
|
+
## Duration: The 100/300/500 Rule
|
|
4
|
+
|
|
5
|
+
Timing matters more than easing. These durations feel right for most UI:
|
|
6
|
+
|
|
7
|
+
| Duration | Use Case | Examples |
|
|
8
|
+
|----------|----------|----------|
|
|
9
|
+
| **100-150ms** | Instant feedback | Button press, toggle, color change |
|
|
10
|
+
| **200-300ms** | State changes | Menu open, tooltip, hover states |
|
|
11
|
+
| **300-500ms** | Layout changes | Accordion, modal, drawer |
|
|
12
|
+
| **500-800ms** | Entrance animations | Page load, hero reveals |
|
|
13
|
+
|
|
14
|
+
**Exit animations are faster than entrances**—use ~75% of enter duration.
|
|
15
|
+
|
|
16
|
+
## Easing: Pick the Right Curve
|
|
17
|
+
|
|
18
|
+
**Don't use `ease`.** It's a compromise that's rarely optimal. Instead:
|
|
19
|
+
|
|
20
|
+
| Curve | Use For | CSS |
|
|
21
|
+
|-------|---------|-----|
|
|
22
|
+
| **ease-out** | Elements entering | `cubic-bezier(0.16, 1, 0.3, 1)` |
|
|
23
|
+
| **ease-in** | Elements leaving | `cubic-bezier(0.7, 0, 0.84, 0)` |
|
|
24
|
+
| **ease-in-out** | State toggles (there → back) | `cubic-bezier(0.65, 0, 0.35, 1)` |
|
|
25
|
+
|
|
26
|
+
**For micro-interactions, use exponential curves**—they feel natural because they mimic real physics (friction, deceleration):
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
/* Quart out - smooth, refined (recommended default) */
|
|
30
|
+
--ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
|
|
31
|
+
|
|
32
|
+
/* Quint out - slightly more dramatic */
|
|
33
|
+
--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
|
|
34
|
+
|
|
35
|
+
/* Expo out - snappy, confident */
|
|
36
|
+
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Avoid bounce and elastic curves.** They were trendy in 2015 but now feel tacky and amateurish. Real objects don't bounce when they stop—they decelerate smoothly. Overshoot effects draw attention to the animation itself rather than the content.
|
|
40
|
+
|
|
41
|
+
## The Only Two Properties You Should Animate
|
|
42
|
+
|
|
43
|
+
**transform** and **opacity** only—everything else causes layout recalculation. For height animations (accordions), use `grid-template-rows: 0fr → 1fr` instead of animating `height` directly.
|
|
44
|
+
|
|
45
|
+
## Staggered Animations
|
|
46
|
+
|
|
47
|
+
Use CSS custom properties for cleaner stagger: `animation-delay: calc(var(--i, 0) * 50ms)` with `style="--i: 0"` on each item. **Cap total stagger time**—10 items at 50ms = 500ms total. For many items, reduce per-item delay or cap staggered count.
|
|
48
|
+
|
|
49
|
+
## Reduced Motion
|
|
50
|
+
|
|
51
|
+
This is not optional. Vestibular disorders affect ~35% of adults over 40.
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
/* Define animations normally */
|
|
55
|
+
.card {
|
|
56
|
+
animation: slide-up 500ms ease-out;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Provide alternative for reduced motion */
|
|
60
|
+
@media (prefers-reduced-motion: reduce) {
|
|
61
|
+
.card {
|
|
62
|
+
animation: fade-in 200ms ease-out; /* Crossfade instead of motion */
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Or disable entirely */
|
|
67
|
+
@media (prefers-reduced-motion: reduce) {
|
|
68
|
+
*, *::before, *::after {
|
|
69
|
+
animation-duration: 0.01ms !important;
|
|
70
|
+
transition-duration: 0.01ms !important;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**What to preserve**: Functional animations like progress bars, loading spinners (slowed down), and focus indicators should still work—just without spatial movement.
|
|
76
|
+
|
|
77
|
+
## Perceived Performance
|
|
78
|
+
|
|
79
|
+
**Nobody cares how fast your site is—just how fast it feels.** Perception can be as effective as actual performance.
|
|
80
|
+
|
|
81
|
+
**The 80ms threshold**: Our brains buffer sensory input for ~80ms to synchronize perception. Anything under 80ms feels instant and simultaneous. This is your target for micro-interactions.
|
|
82
|
+
|
|
83
|
+
**Active vs passive time**: Passive waiting (staring at a spinner) feels longer than active engagement. Strategies to shift the balance:
|
|
84
|
+
|
|
85
|
+
- **Preemptive start**: Begin transitions immediately while loading (iOS app zoom, skeleton UI). Users perceive work happening.
|
|
86
|
+
- **Early completion**: Show content progressively—don't wait for everything. Video buffering, progressive images, streaming HTML.
|
|
87
|
+
- **Optimistic UI**: Update the interface immediately, handle failures gracefully. Instagram likes work offline—the UI updates instantly, syncs later. Use for low-stakes actions; avoid for payments or destructive operations.
|
|
88
|
+
|
|
89
|
+
**Easing affects perceived duration**: Ease-in (accelerating toward completion) makes tasks feel shorter because the peak-end effect weights final moments heavily. Ease-out feels satisfying for entrances, but ease-in toward a task's end compresses perceived time.
|
|
90
|
+
|
|
91
|
+
**Caution**: Too-fast responses can decrease perceived value. Users may distrust instant results for complex operations (search, analysis). Sometimes a brief delay signals "real work" is happening.
|
|
92
|
+
|
|
93
|
+
## Performance
|
|
94
|
+
|
|
95
|
+
Don't use `will-change` preemptively—only when animation is imminent (`:hover`, `.animating`). For scroll-triggered animations, use Intersection Observer instead of scroll events; unobserve after animating once. Create motion tokens for consistency (durations, easings, common transitions).
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
**Avoid**: Animating everything (animation fatigue is real). Using >500ms for UI feedback. Ignoring `prefers-reduced-motion`. Using animation to hide slow loading.
|
package/src/template/design-system/.gemini/skills/frontend-design/reference/responsive-design.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Responsive Design
|
|
2
|
+
|
|
3
|
+
## Mobile-First: Write It Right
|
|
4
|
+
|
|
5
|
+
Start with base styles for mobile, use `min-width` queries to layer complexity. Desktop-first (`max-width`) means mobile loads unnecessary styles first.
|
|
6
|
+
|
|
7
|
+
## Breakpoints: Content-Driven
|
|
8
|
+
|
|
9
|
+
Don't chase device sizes—let content tell you where to break. Start narrow, stretch until design breaks, add breakpoint there. Three breakpoints usually suffice (640, 768, 1024px). Use `clamp()` for fluid values without breakpoints.
|
|
10
|
+
|
|
11
|
+
## Detect Input Method, Not Just Screen Size
|
|
12
|
+
|
|
13
|
+
**Screen size doesn't tell you input method.** A laptop with touchscreen, a tablet with keyboard—use pointer and hover queries:
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
/* Fine pointer (mouse, trackpad) */
|
|
17
|
+
@media (pointer: fine) {
|
|
18
|
+
.button { padding: 8px 16px; }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Coarse pointer (touch, stylus) */
|
|
22
|
+
@media (pointer: coarse) {
|
|
23
|
+
.button { padding: 12px 20px; } /* Larger touch target */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Device supports hover */
|
|
27
|
+
@media (hover: hover) {
|
|
28
|
+
.card:hover { transform: translateY(-2px); }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Device doesn't support hover (touch) */
|
|
32
|
+
@media (hover: none) {
|
|
33
|
+
.card { /* No hover state - use active instead */ }
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Critical**: Don't rely on hover for functionality. Touch users can't hover.
|
|
38
|
+
|
|
39
|
+
## Safe Areas: Handle the Notch
|
|
40
|
+
|
|
41
|
+
Modern phones have notches, rounded corners, and home indicators. Use `env()`:
|
|
42
|
+
|
|
43
|
+
```css
|
|
44
|
+
body {
|
|
45
|
+
padding-top: env(safe-area-inset-top);
|
|
46
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
47
|
+
padding-left: env(safe-area-inset-left);
|
|
48
|
+
padding-right: env(safe-area-inset-right);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* With fallback */
|
|
52
|
+
.footer {
|
|
53
|
+
padding-bottom: max(1rem, env(safe-area-inset-bottom));
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Enable viewport-fit** in your meta tag:
|
|
58
|
+
```html
|
|
59
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Responsive Images: Get It Right
|
|
63
|
+
|
|
64
|
+
### srcset with Width Descriptors
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<img
|
|
68
|
+
src="hero-800.jpg"
|
|
69
|
+
srcset="
|
|
70
|
+
hero-400.jpg 400w,
|
|
71
|
+
hero-800.jpg 800w,
|
|
72
|
+
hero-1200.jpg 1200w
|
|
73
|
+
"
|
|
74
|
+
sizes="(max-width: 768px) 100vw, 50vw"
|
|
75
|
+
alt="Hero image"
|
|
76
|
+
>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**How it works**:
|
|
80
|
+
- `srcset` lists available images with their actual widths (`w` descriptors)
|
|
81
|
+
- `sizes` tells the browser how wide the image will display
|
|
82
|
+
- Browser picks the best file based on viewport width AND device pixel ratio
|
|
83
|
+
|
|
84
|
+
### Picture Element for Art Direction
|
|
85
|
+
|
|
86
|
+
When you need different crops/compositions (not just resolutions):
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<picture>
|
|
90
|
+
<source media="(min-width: 768px)" srcset="wide.jpg">
|
|
91
|
+
<source media="(max-width: 767px)" srcset="tall.jpg">
|
|
92
|
+
<img src="fallback.jpg" alt="...">
|
|
93
|
+
</picture>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Layout Adaptation Patterns
|
|
97
|
+
|
|
98
|
+
**Navigation**: Three stages—hamburger + drawer on mobile, horizontal compact on tablet, full with labels on desktop. **Tables**: Transform to cards on mobile using `display: block` and `data-label` attributes. **Progressive disclosure**: Use `<details>/<summary>` for content that can collapse on mobile.
|
|
99
|
+
|
|
100
|
+
## Testing: Don't Trust DevTools Alone
|
|
101
|
+
|
|
102
|
+
DevTools device emulation is useful for layout but misses:
|
|
103
|
+
|
|
104
|
+
- Actual touch interactions
|
|
105
|
+
- Real CPU/memory constraints
|
|
106
|
+
- Network latency patterns
|
|
107
|
+
- Font rendering differences
|
|
108
|
+
- Browser chrome/keyboard appearances
|
|
109
|
+
|
|
110
|
+
**Test on at least**: One real iPhone, one real Android, a tablet if relevant. Cheap Android phones reveal performance issues you'll never see on simulators.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
**Avoid**: Desktop-first design. Device detection instead of feature detection. Separate mobile/desktop codebases. Ignoring tablet and landscape. Assuming all mobile devices are powerful.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Spatial Design
|
|
2
|
+
|
|
3
|
+
## Spacing Systems
|
|
4
|
+
|
|
5
|
+
### Use 4pt Base, Not 8pt
|
|
6
|
+
|
|
7
|
+
8pt systems are too coarse—you'll frequently need 12px (between 8 and 16). Use 4pt for granularity: 4, 8, 12, 16, 24, 32, 48, 64, 96px.
|
|
8
|
+
|
|
9
|
+
### Name Tokens Semantically
|
|
10
|
+
|
|
11
|
+
Name by relationship (`--space-sm`, `--space-lg`), not value (`--spacing-8`). Use `gap` instead of margins for sibling spacing—it eliminates margin collapse and cleanup hacks.
|
|
12
|
+
|
|
13
|
+
## Grid Systems
|
|
14
|
+
|
|
15
|
+
### The Self-Adjusting Grid
|
|
16
|
+
|
|
17
|
+
Use `repeat(auto-fit, minmax(280px, 1fr))` for responsive grids without breakpoints. Columns are at least 280px, as many as fit per row, leftovers stretch. For complex layouts, use named grid areas (`grid-template-areas`) and redefine them at breakpoints.
|
|
18
|
+
|
|
19
|
+
## Visual Hierarchy
|
|
20
|
+
|
|
21
|
+
### The Squint Test
|
|
22
|
+
|
|
23
|
+
Blur your eyes (or screenshot and blur). Can you still identify:
|
|
24
|
+
- The most important element?
|
|
25
|
+
- The second most important?
|
|
26
|
+
- Clear groupings?
|
|
27
|
+
|
|
28
|
+
If everything looks the same weight blurred, you have a hierarchy problem.
|
|
29
|
+
|
|
30
|
+
### Hierarchy Through Multiple Dimensions
|
|
31
|
+
|
|
32
|
+
Don't rely on size alone. Combine:
|
|
33
|
+
|
|
34
|
+
| Tool | Strong Hierarchy | Weak Hierarchy |
|
|
35
|
+
|------|------------------|----------------|
|
|
36
|
+
| **Size** | 3:1 ratio or more | <2:1 ratio |
|
|
37
|
+
| **Weight** | Bold vs Regular | Medium vs Regular |
|
|
38
|
+
| **Color** | High contrast | Similar tones |
|
|
39
|
+
| **Position** | Top/left (primary) | Bottom/right |
|
|
40
|
+
| **Space** | Surrounded by white space | Crowded |
|
|
41
|
+
|
|
42
|
+
**The best hierarchy uses 2-3 dimensions at once**: A heading that's larger, bolder, AND has more space above it.
|
|
43
|
+
|
|
44
|
+
### Cards Are Not Required
|
|
45
|
+
|
|
46
|
+
Cards are overused. Spacing and alignment create visual grouping naturally. Use cards only when content is truly distinct and actionable, items need visual comparison in a grid, or content needs clear interaction boundaries. **Never nest cards inside cards**—use spacing, typography, and subtle dividers for hierarchy within a card.
|
|
47
|
+
|
|
48
|
+
## Container Queries
|
|
49
|
+
|
|
50
|
+
Viewport queries are for page layouts. **Container queries are for components**:
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
.card-container {
|
|
54
|
+
container-type: inline-size;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.card {
|
|
58
|
+
display: grid;
|
|
59
|
+
gap: var(--space-md);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Card layout changes based on its container, not viewport */
|
|
63
|
+
@container (min-width: 400px) {
|
|
64
|
+
.card {
|
|
65
|
+
grid-template-columns: 120px 1fr;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Why this matters**: A card in a narrow sidebar stays compact, while the same card in a main content area expands—automatically, without viewport hacks.
|
|
71
|
+
|
|
72
|
+
## Optical Adjustments
|
|
73
|
+
|
|
74
|
+
Text at `margin-left: 0` looks indented due to letterform whitespace—use negative margin (`-0.05em`) to optically align. Geometrically centered icons often look off-center; play icons need to shift right, arrows shift toward their direction.
|
|
75
|
+
|
|
76
|
+
### Touch Targets vs Visual Size
|
|
77
|
+
|
|
78
|
+
Buttons can look small but need large touch targets (44px minimum). Use padding or pseudo-elements:
|
|
79
|
+
|
|
80
|
+
```css
|
|
81
|
+
.icon-button {
|
|
82
|
+
width: 24px; /* Visual size */
|
|
83
|
+
height: 24px;
|
|
84
|
+
position: relative;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.icon-button::before {
|
|
88
|
+
content: '';
|
|
89
|
+
position: absolute;
|
|
90
|
+
inset: -10px; /* Expand tap target to 44px */
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Depth & Elevation
|
|
95
|
+
|
|
96
|
+
Create semantic z-index scales (dropdown → sticky → modal-backdrop → modal → toast → tooltip) instead of arbitrary numbers. For shadows, create a consistent elevation scale (sm → md → lg → xl). **Key insight**: Shadows should be subtle—if you can clearly see it, it's probably too strong.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
**Avoid**: Arbitrary spacing values outside your scale. Making all spacing equal (variety creates hierarchy). Creating hierarchy through size alone - combine size, weight, color, and space.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Typography
|
|
2
|
+
|
|
3
|
+
## Classic Typography Principles
|
|
4
|
+
|
|
5
|
+
### Vertical Rhythm
|
|
6
|
+
|
|
7
|
+
Your line-height should be the base unit for ALL vertical spacing. If body text has `line-height: 1.5` on `16px` type (= 24px), spacing values should be multiples of 24px. This creates subconscious harmony—text and space share a mathematical foundation.
|
|
8
|
+
|
|
9
|
+
### Modular Scale & Hierarchy
|
|
10
|
+
|
|
11
|
+
The common mistake: too many font sizes that are too close together (14px, 15px, 16px, 18px...). This creates muddy hierarchy.
|
|
12
|
+
|
|
13
|
+
**Use fewer sizes with more contrast.** A 5-size system covers most needs:
|
|
14
|
+
|
|
15
|
+
| Role | Typical Ratio | Use Case |
|
|
16
|
+
|------|---------------|----------|
|
|
17
|
+
| xs | 0.75rem | Captions, legal |
|
|
18
|
+
| sm | 0.875rem | Secondary UI, metadata |
|
|
19
|
+
| base | 1rem | Body text |
|
|
20
|
+
| lg | 1.25-1.5rem | Subheadings, lead text |
|
|
21
|
+
| xl+ | 2-4rem | Headlines, hero text |
|
|
22
|
+
|
|
23
|
+
Popular ratios: 1.25 (major third), 1.333 (perfect fourth), 1.5 (perfect fifth). Pick one and commit.
|
|
24
|
+
|
|
25
|
+
### Readability & Measure
|
|
26
|
+
|
|
27
|
+
Use `ch` units for character-based measure (`max-width: 65ch`). Line-height scales inversely with line length—narrow columns need tighter leading, wide columns need more.
|
|
28
|
+
|
|
29
|
+
**Non-obvious**: Increase line-height for light text on dark backgrounds. The perceived weight is lighter, so text needs more breathing room. Add 0.05-0.1 to your normal line-height.
|
|
30
|
+
|
|
31
|
+
## Font Selection & Pairing
|
|
32
|
+
|
|
33
|
+
### Choosing Distinctive Fonts
|
|
34
|
+
|
|
35
|
+
**Avoid the invisible defaults**: Inter, Roboto, Open Sans, Lato, Montserrat. These are everywhere, making your design feel generic. They're fine for documentation or tools where personality isn't the goal—but if you want distinctive design, look elsewhere.
|
|
36
|
+
|
|
37
|
+
**Better Google Fonts alternatives**:
|
|
38
|
+
- Instead of Inter → **Instrument Sans**, **Plus Jakarta Sans**, **Outfit**
|
|
39
|
+
- Instead of Roboto → **Onest**, **Figtree**, **Urbanist**
|
|
40
|
+
- Instead of Open Sans → **Source Sans 3**, **Nunito Sans**, **DM Sans**
|
|
41
|
+
- For editorial/premium feel → **Fraunces**, **Newsreader**, **Lora**
|
|
42
|
+
|
|
43
|
+
**System fonts are underrated**: `-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui` looks native, loads instantly, and is highly readable. Consider this for apps where performance > personality.
|
|
44
|
+
|
|
45
|
+
### Pairing Principles
|
|
46
|
+
|
|
47
|
+
**The non-obvious truth**: You often don't need a second font. One well-chosen font family in multiple weights creates cleaner hierarchy than two competing typefaces. Only add a second font when you need genuine contrast (e.g., display headlines + body serif).
|
|
48
|
+
|
|
49
|
+
When pairing, contrast on multiple axes:
|
|
50
|
+
- Serif + Sans (structure contrast)
|
|
51
|
+
- Geometric + Humanist (personality contrast)
|
|
52
|
+
- Condensed display + Wide body (proportion contrast)
|
|
53
|
+
|
|
54
|
+
**Never pair fonts that are similar but not identical** (e.g., two geometric sans-serifs). They create visual tension without clear hierarchy.
|
|
55
|
+
|
|
56
|
+
### Web Font Loading
|
|
57
|
+
|
|
58
|
+
The layout shift problem: fonts load late, text reflows, and users see content jump. Here's the fix:
|
|
59
|
+
|
|
60
|
+
```css
|
|
61
|
+
/* 1. Use font-display: swap for visibility */
|
|
62
|
+
@font-face {
|
|
63
|
+
font-family: 'CustomFont';
|
|
64
|
+
src: url('font.woff2') format('woff2');
|
|
65
|
+
font-display: swap;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* 2. Match fallback metrics to minimize shift */
|
|
69
|
+
@font-face {
|
|
70
|
+
font-family: 'CustomFont-Fallback';
|
|
71
|
+
src: local('Arial');
|
|
72
|
+
size-adjust: 105%; /* Scale to match x-height */
|
|
73
|
+
ascent-override: 90%; /* Match ascender height */
|
|
74
|
+
descent-override: 20%; /* Match descender depth */
|
|
75
|
+
line-gap-override: 10%; /* Match line spacing */
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
body {
|
|
79
|
+
font-family: 'CustomFont', 'CustomFont-Fallback', sans-serif;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Tools like [Fontaine](https://github.com/unjs/fontaine) calculate these overrides automatically.
|
|
84
|
+
|
|
85
|
+
## Modern Web Typography
|
|
86
|
+
|
|
87
|
+
### Fluid Type
|
|
88
|
+
|
|
89
|
+
Use `clamp(min, preferred, max)` for fluid typography. The middle value (e.g., `5vw + 1rem`) controls scaling rate—higher vw = faster scaling. Add a rem offset so it doesn't collapse to 0 on small screens.
|
|
90
|
+
|
|
91
|
+
**When NOT to use fluid type**: Button text, labels, UI elements (should be consistent), very short text, or when you need precise breakpoint control.
|
|
92
|
+
|
|
93
|
+
### OpenType Features
|
|
94
|
+
|
|
95
|
+
Most developers don't know these exist. Use them for polish:
|
|
96
|
+
|
|
97
|
+
```css
|
|
98
|
+
/* Tabular numbers for data alignment */
|
|
99
|
+
.data-table { font-variant-numeric: tabular-nums; }
|
|
100
|
+
|
|
101
|
+
/* Proper fractions */
|
|
102
|
+
.recipe-amount { font-variant-numeric: diagonal-fractions; }
|
|
103
|
+
|
|
104
|
+
/* Small caps for abbreviations */
|
|
105
|
+
abbr { font-variant-caps: all-small-caps; }
|
|
106
|
+
|
|
107
|
+
/* Disable ligatures in code */
|
|
108
|
+
code { font-variant-ligatures: none; }
|
|
109
|
+
|
|
110
|
+
/* Enable kerning (usually on by default, but be explicit) */
|
|
111
|
+
body { font-kerning: normal; }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Check what features your font supports at [Wakamai Fondue](https://wakamaifondue.com/).
|
|
115
|
+
|
|
116
|
+
## Typography System Architecture
|
|
117
|
+
|
|
118
|
+
Name tokens semantically (`--text-body`, `--text-heading`), not by value (`--font-size-16`). Include font stacks, size scale, weights, line-heights, and letter-spacing in your token system.
|
|
119
|
+
|
|
120
|
+
## Accessibility Considerations
|
|
121
|
+
|
|
122
|
+
Beyond contrast ratios (which are well-documented), consider:
|
|
123
|
+
|
|
124
|
+
- **Never disable zoom**: `user-scalable=no` breaks accessibility. If your layout breaks at 200% zoom, fix the layout.
|
|
125
|
+
- **Use rem/em for font sizes**: This respects user browser settings. Never `px` for body text.
|
|
126
|
+
- **Minimum 16px body text**: Smaller than this strains eyes and fails WCAG on mobile.
|
|
127
|
+
- **Adequate touch targets**: Text links need padding or line-height that creates 44px+ tap targets.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
**Avoid**: More than 2-3 font families per project. Skipping fallback font definitions. Ignoring font loading performance (FOUT/FOIT). Using decorative fonts for body text.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# UX Writing
|
|
2
|
+
|
|
3
|
+
## The Button Label Problem
|
|
4
|
+
|
|
5
|
+
**Never use "OK", "Submit", or "Yes/No".** These are lazy and ambiguous. Use specific verb + object patterns:
|
|
6
|
+
|
|
7
|
+
| Bad | Good | Why |
|
|
8
|
+
|-----|------|-----|
|
|
9
|
+
| OK | Save changes | Says what will happen |
|
|
10
|
+
| Submit | Create account | Outcome-focused |
|
|
11
|
+
| Yes | Delete message | Confirms the action |
|
|
12
|
+
| Cancel | Keep editing | Clarifies what "cancel" means |
|
|
13
|
+
| Click here | Download PDF | Describes the destination |
|
|
14
|
+
|
|
15
|
+
**For destructive actions**, name the destruction:
|
|
16
|
+
- "Delete" not "Remove" (delete is permanent, remove implies recoverable)
|
|
17
|
+
- "Delete 5 items" not "Delete selected" (show the count)
|
|
18
|
+
|
|
19
|
+
## Error Messages: The Formula
|
|
20
|
+
|
|
21
|
+
Every error message should answer: (1) What happened? (2) Why? (3) How to fix it? Example: "Email address isn't valid. Please include an @ symbol." not "Invalid input".
|
|
22
|
+
|
|
23
|
+
### Error Message Templates
|
|
24
|
+
|
|
25
|
+
| Situation | Template |
|
|
26
|
+
|-----------|----------|
|
|
27
|
+
| **Format error** | "[Field] needs to be [format]. Example: [example]" |
|
|
28
|
+
| **Missing required** | "Please enter [what's missing]" |
|
|
29
|
+
| **Permission denied** | "You don't have access to [thing]. [What to do instead]" |
|
|
30
|
+
| **Network error** | "We couldn't reach [thing]. Check your connection and [action]." |
|
|
31
|
+
| **Server error** | "Something went wrong on our end. We're looking into it. [Alternative action]" |
|
|
32
|
+
|
|
33
|
+
### Don't Blame the User
|
|
34
|
+
|
|
35
|
+
Reframe errors: "Please enter a date in MM/DD/YYYY format" not "You entered an invalid date".
|
|
36
|
+
|
|
37
|
+
## Empty States Are Opportunities
|
|
38
|
+
|
|
39
|
+
Empty states are onboarding moments: (1) Acknowledge briefly, (2) Explain the value of filling it, (3) Provide a clear action. "No projects yet. Create your first one to get started." not just "No items".
|
|
40
|
+
|
|
41
|
+
## Voice vs Tone
|
|
42
|
+
|
|
43
|
+
**Voice** is your brand's personality—consistent everywhere.
|
|
44
|
+
**Tone** adapts to the moment.
|
|
45
|
+
|
|
46
|
+
| Moment | Tone Shift |
|
|
47
|
+
|--------|------------|
|
|
48
|
+
| Success | Celebratory, brief: "Done! Your changes are live." |
|
|
49
|
+
| Error | Empathetic, helpful: "That didn't work. Here's what to try..." |
|
|
50
|
+
| Loading | Reassuring: "Saving your work..." |
|
|
51
|
+
| Destructive confirm | Serious, clear: "Delete this project? This can't be undone." |
|
|
52
|
+
|
|
53
|
+
**Never use humor for errors.** Users are already frustrated. Be helpful, not cute.
|
|
54
|
+
|
|
55
|
+
## Writing for Accessibility
|
|
56
|
+
|
|
57
|
+
**Link text** must have standalone meaning—"View pricing plans" not "Click here". **Alt text** describes information, not the image—"Revenue increased 40% in Q4" not "Chart". Use `alt=""` for decorative images. **Icon buttons** need `aria-label` for screen reader context.
|
|
58
|
+
|
|
59
|
+
## Writing for Translation
|
|
60
|
+
|
|
61
|
+
### Plan for Expansion
|
|
62
|
+
|
|
63
|
+
German text is ~30% longer than English. Allocate space:
|
|
64
|
+
|
|
65
|
+
| Language | Expansion |
|
|
66
|
+
|----------|-----------|
|
|
67
|
+
| German | +30% |
|
|
68
|
+
| French | +20% |
|
|
69
|
+
| Finnish | +30-40% |
|
|
70
|
+
| Chinese | -30% (fewer chars, but same width) |
|
|
71
|
+
|
|
72
|
+
### Translation-Friendly Patterns
|
|
73
|
+
|
|
74
|
+
Keep numbers separate ("New messages: 3" not "You have 3 new messages"). Use full sentences as single strings (word order varies by language). Avoid abbreviations ("5 minutes ago" not "5 mins ago"). Give translators context about where strings appear.
|
|
75
|
+
|
|
76
|
+
## Consistency: The Terminology Problem
|
|
77
|
+
|
|
78
|
+
Pick one term and stick with it:
|
|
79
|
+
|
|
80
|
+
| Inconsistent | Consistent |
|
|
81
|
+
|--------------|------------|
|
|
82
|
+
| Delete / Remove / Trash | Delete |
|
|
83
|
+
| Settings / Preferences / Options | Settings |
|
|
84
|
+
| Sign in / Log in / Enter | Sign in |
|
|
85
|
+
| Create / Add / New | Create |
|
|
86
|
+
|
|
87
|
+
Build a terminology glossary and enforce it. Variety creates confusion.
|
|
88
|
+
|
|
89
|
+
## Avoid Redundant Copy
|
|
90
|
+
|
|
91
|
+
If the heading explains it, the intro is redundant. If the button is clear, don't explain it again. Say it once, say it well.
|
|
92
|
+
|
|
93
|
+
## Loading States
|
|
94
|
+
|
|
95
|
+
Be specific: "Saving your draft..." not "Loading...". For long waits, set expectations ("This usually takes 30 seconds") or show progress.
|
|
96
|
+
|
|
97
|
+
## Confirmation Dialogs: Use Sparingly
|
|
98
|
+
|
|
99
|
+
Most confirmation dialogs are design failures—consider undo instead. When you must confirm: name the action, explain consequences, use specific button labels ("Delete project" / "Keep project", not "Yes" / "No").
|
|
100
|
+
|
|
101
|
+
## Form Instructions
|
|
102
|
+
|
|
103
|
+
Show format with placeholders, not instructions. For non-obvious fields, explain why you're asking.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
**Avoid**: Jargon without explanation. Blaming users ("You made an error" → "This field is required"). Vague errors ("Something went wrong"). Varying terminology for variety. Humor for errors.
|