vibecodeagent 0.0.0-stage → 0.1.65
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/LICENSE +21 -0
- package/README.md +46 -2
- package/THIRD-PARTY-NOTICES.txt +1427 -0
- package/dist/agen.js +138920 -0
- package/dist/bin.js +1245 -0
- package/dist/daemon.js +163701 -0
- package/dist/node_modules/node-ensure/index.js +10 -0
- package/dist/node_modules/node-ensure/package.json +31 -0
- package/dist/node_modules/pdf-parse/lib/pdf-parse.js +102 -0
- package/dist/node_modules/pdf-parse/lib/pdf.js/v1.10.100/build/pdf.js +18538 -0
- package/dist/node_modules/pdf-parse/lib/pdf.js/v1.10.100/build/pdf.worker.js +45507 -0
- package/dist/node_modules/pdf-parse/package.json +49 -0
- package/dist/node_modules/sql.js/dist/sql-wasm.js +186 -0
- package/dist/node_modules/sql.js/dist/sql-wasm.wasm +0 -0
- package/dist/node_modules/sql.js/package.json +58 -0
- package/dist/resources/skills/builtin/.gitkeep +0 -0
- package/dist/resources/skills/builtin/NOTICE.md +35 -0
- package/dist/resources/skills/builtin/README.md +74 -0
- package/dist/resources/skills/builtin/backend-engineering/SKILL.md +102 -0
- package/dist/resources/skills/builtin/backend-engineering/references/api-contracts.md +320 -0
- package/dist/resources/skills/builtin/backend-engineering/references/auth-and-secrets.md +268 -0
- package/dist/resources/skills/builtin/backend-engineering/references/concurrency-and-jobs.md +386 -0
- package/dist/resources/skills/builtin/backend-engineering/references/data-modelling.md +367 -0
- package/dist/resources/skills/builtin/backend-engineering/references/deploy-and-config.md +228 -0
- package/dist/resources/skills/builtin/backend-engineering/references/migrations.md +320 -0
- package/dist/resources/skills/builtin/backend-engineering/references/observability.md +301 -0
- package/dist/resources/skills/builtin/backend-engineering/references/plan-template.md +152 -0
- package/dist/resources/skills/builtin/backend-engineering/references/review-audit.md +213 -0
- package/dist/resources/skills/builtin/backend-engineering/references/security.md +251 -0
- package/dist/resources/skills/builtin/backend-engineering/references/stack-go.md +238 -0
- package/dist/resources/skills/builtin/backend-engineering/references/stack-node.md +274 -0
- package/dist/resources/skills/builtin/backend-engineering/references/stack-python.md +296 -0
- package/dist/resources/skills/builtin/backend-engineering/references/testing-and-perf.md +298 -0
- package/dist/resources/skills/builtin/backend-engineering/references/validation-and-errors.md +266 -0
- package/dist/resources/skills/builtin/dasar-vibecode/SKILL.md +312 -0
- package/dist/resources/skills/builtin/excel-maker/SKILL.md +71 -0
- package/dist/resources/skills/builtin/frontend-design/SKILL.md +131 -0
- package/dist/resources/skills/builtin/frontend-design/data/app-interface.csv +33 -0
- package/dist/resources/skills/builtin/frontend-design/data/catalog-summary.json +78 -0
- package/dist/resources/skills/builtin/frontend-design/data/charts.csv +26 -0
- package/dist/resources/skills/builtin/frontend-design/data/colors.csv +193 -0
- package/dist/resources/skills/builtin/frontend-design/data/data-provenance.json +1348 -0
- package/dist/resources/skills/builtin/frontend-design/data/google-font-licenses.json +20185 -0
- package/dist/resources/skills/builtin/frontend-design/data/google-fonts.csv +1935 -0
- package/dist/resources/skills/builtin/frontend-design/data/icons.csv +106 -0
- package/dist/resources/skills/builtin/frontend-design/data/landing.csv +35 -0
- package/dist/resources/skills/builtin/frontend-design/data/motion.csv +18 -0
- package/dist/resources/skills/builtin/frontend-design/data/phosphor-icons-upstream.json +32582 -0
- package/dist/resources/skills/builtin/frontend-design/data/products.csv +193 -0
- package/dist/resources/skills/builtin/frontend-design/data/react-performance.csv +45 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/angular.csv +51 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/astro.csv +54 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/avalonia.csv +57 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/flutter.csv +53 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/html-tailwind.csv +60 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/javafx.csv +76 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/jetpack-compose.csv +53 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/laravel.csv +51 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/nextjs.csv +62 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/nuxt-ui.csv +71 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/nuxtjs.csv +68 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/react-native.csv +52 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/react.csv +62 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/shadcn.csv +69 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/svelte.csv +56 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/swiftui.csv +51 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/threejs.csv +54 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/uno.csv +60 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/uwp.csv +56 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/vue.csv +50 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/winui.csv +60 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/wpf.csv +57 -0
- package/dist/resources/skills/builtin/frontend-design/data/styles.csv +89 -0
- package/dist/resources/skills/builtin/frontend-design/data/typography.csv +75 -0
- package/dist/resources/skills/builtin/frontend-design/data/ui-reasoning.csv +193 -0
- package/dist/resources/skills/builtin/frontend-design/data/ux-guidelines.csv +120 -0
- package/dist/resources/skills/builtin/frontend-design/references/animation-patterns.md +705 -0
- package/dist/resources/skills/builtin/frontend-design/references/app-polish.md +117 -0
- package/dist/resources/skills/builtin/frontend-design/references/apple-fluid.md +278 -0
- package/dist/resources/skills/builtin/frontend-design/references/art-direction.md +280 -0
- package/dist/resources/skills/builtin/frontend-design/references/case-studies.md +599 -0
- package/dist/resources/skills/builtin/frontend-design/references/craft.md +128 -0
- package/dist/resources/skills/builtin/frontend-design/references/expo.md +251 -0
- package/dist/resources/skills/builtin/frontend-design/references/layout-systems.md +533 -0
- package/dist/resources/skills/builtin/frontend-design/references/libraries.md +72 -0
- package/dist/resources/skills/builtin/frontend-design/references/motion.md +222 -0
- package/dist/resources/skills/builtin/frontend-design/references/picker.md +197 -0
- package/dist/resources/skills/builtin/frontend-design/references/plan-template.md +73 -0
- package/dist/resources/skills/builtin/frontend-design/references/prototype.md +85 -0
- package/dist/resources/skills/builtin/frontend-design/references/recipes-expo.md +385 -0
- package/dist/resources/skills/builtin/frontend-design/references/recipes-web.md +421 -0
- package/dist/resources/skills/builtin/frontend-design/references/review-audit.md +107 -0
- package/dist/resources/skills/builtin/frontend-design/references/sonner.md +143 -0
- package/dist/resources/skills/builtin/frontend-design/references/technical-stack.md +543 -0
- package/dist/resources/skills/builtin/frontend-design/references/theming.md +60 -0
- package/dist/resources/skills/builtin/frontend-design/references/typography.md +393 -0
- package/dist/resources/skills/builtin/frontend-design/references/ux-rules.md +256 -0
- package/dist/resources/skills/builtin/frontend-design/references/vocabulary.md +169 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/core.py +993 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/design_system.py +1643 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/reasoning_contract.py +123 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/search.py +171 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/validate_data.py +1091 -0
- package/dist/resources/skills/builtin/kerja-agentik/SKILL.md +117 -0
- package/dist/resources/skills/builtin/pdf-maker/SKILL.md +51 -0
- package/dist/resources/skills/builtin/tinjau-keamanan/SKILL.md +53 -0
- package/dist/resources/skills/builtin/word-maker/SKILL.md +58 -0
- package/dist/resources/skills/builtin/write-swift/SKILL.md +388 -0
- package/package.json +35 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Common Rules for Professional UI + Pre-Delivery Checklist
|
|
2
|
+
|
|
3
|
+
Load this file before final delivery of native/mobile app UI (iOS/Android/React Native/Flutter), or when the user reports the UI "doesn't look professional" and the cause isn't obvious from the priority table in the frontend-design SKILL.md.
|
|
4
|
+
|
|
5
|
+
**Scope notice:** everything below targets native/mobile app UI. For web/desktop interaction patterns, use `references/quick-reference.md` (stack-agnostic) instead — these tables assume touch targets, safe areas, and platform gesture conventions that don't apply 1:1 to desktop web.
|
|
6
|
+
|
|
7
|
+
These are frequently overlooked issues that make UI look unprofessional.
|
|
8
|
+
|
|
9
|
+
## Icons & Visual Elements
|
|
10
|
+
|
|
11
|
+
| Rule | Standard | Avoid | Why It Matters |
|
|
12
|
+
|------|----------|--------|----------------|
|
|
13
|
+
| **No Emoji as Structural Icons** | Use vector-based icons (e.g., Lucide, react-native-vector-icons, @expo/vector-icons). | Using emojis (🎨 🚀 ⚙️) for navigation, settings, or system controls. | Emojis are font-dependent, inconsistent across platforms, and cannot be controlled via design tokens. |
|
|
14
|
+
| **Vector-Only Assets** | Use SVG or platform vector icons that scale cleanly and support theming. | Raster PNG icons that blur or pixelate. | Ensures scalability, crisp rendering, and dark/light mode adaptability. |
|
|
15
|
+
| **Contextual Semantics** | Choose semantics from use, not glyph: hide decorative icons beside visible text from the accessibility tree; give meaningful standalone icons a text alternative; give icon controls an accessible name and expose selected/pressed/expanded state when applicable. | Treating one icon name as permanently decorative, meaningful, or interactive. | The same glyph can serve different purposes in different components. |
|
|
16
|
+
| **Stable Interaction States** | Use color, opacity, or elevation transitions for press states without changing layout bounds. | Layout-shifting transforms that move surrounding content or trigger visual jitter. | Prevents unstable interactions and preserves smooth motion/perceived quality on mobile. |
|
|
17
|
+
| **Correct Brand Logos** | Use official brand assets and follow their usage guidelines (spacing, color, clear space). | Guessing logo paths, recoloring unofficially, or modifying proportions. | Prevents brand misuse and ensures legal/platform compliance. |
|
|
18
|
+
| **Consistent Icon Sizing** | Define icon sizes as design tokens (e.g., icon-sm, icon-md = 24pt, icon-lg). | Mixing arbitrary values like 20pt / 24pt / 28pt randomly. | Maintains rhythm and visual hierarchy across the interface. |
|
|
19
|
+
| **Stroke Consistency** | Use a consistent stroke width within the same visual layer (e.g., 1.5px or 2px). | Mixing thick and thin stroke styles arbitrarily. | Inconsistent strokes reduce perceived polish and cohesion. |
|
|
20
|
+
| **Filled vs Outline Discipline** | Use one icon style per hierarchy level. | Mixing filled and outline icons at the same hierarchy level. | Maintains semantic clarity and stylistic coherence. |
|
|
21
|
+
| **Touch Target Minimum** | Use at least 44pt on iOS and 48dp on Android; expand the hit area when the visual icon is smaller. | Small icons without expanded tap area, or one unit reused across platforms. | Matches platform-specific target guidance. |
|
|
22
|
+
| **Icon Alignment** | Align icons to text baseline and maintain consistent padding. | Misaligned icons or inconsistent spacing around them. | Prevents subtle visual imbalance that reduces perceived quality. |
|
|
23
|
+
| **Icon Contrast** | Meaningful icons and control boundaries need at least 3:1 against adjacent colors; decorative icons must not carry information. | Low-contrast icons that carry meaning or state. | Applies the non-text contrast role instead of a text-size rule. |
|
|
24
|
+
|
|
25
|
+
## Interaction (App)
|
|
26
|
+
|
|
27
|
+
| Rule | Do | Don't |
|
|
28
|
+
|------|----|----- |
|
|
29
|
+
| **Tap feedback** | Provide clear pressed feedback (ripple/opacity/elevation) within 80-150ms | No visual response on tap |
|
|
30
|
+
| **Animation timing** | Use shared tokens chosen for distance, complexity, platform, and user context | One duration/easing copied to every transition |
|
|
31
|
+
| **Accessibility focus** | Ensure screen reader focus order matches visual order and labels are descriptive | Unlabeled controls or confusing focus traversal |
|
|
32
|
+
| **Disabled state clarity** | Use disabled semantics (`disabled`/native disabled props), reduced emphasis, and no tap action | Controls that look tappable but do nothing |
|
|
33
|
+
| **Touch target minimum** | Keep tap areas >=44x44pt (iOS) or >=48x48dp (Android), expand hit area when icon is smaller | Tiny tap targets or icon-only hit areas without padding |
|
|
34
|
+
| **Gesture conflict prevention** | Keep one primary gesture per region and avoid nested tap/drag conflicts | Overlapping gestures causing accidental actions |
|
|
35
|
+
| **Semantic native controls** | Prefer native interactive primitives (`Button`, `Pressable`, platform equivalents) with proper accessibility roles | Generic containers used as primary controls without semantics |
|
|
36
|
+
|
|
37
|
+
## Light/Dark Mode Contrast
|
|
38
|
+
|
|
39
|
+
| Rule | Do | Don't |
|
|
40
|
+
|------|----|----- |
|
|
41
|
+
| **Surface readability (light)** | Keep cards/surfaces clearly separated from background with sufficient opacity/elevation | Overly transparent surfaces that blur hierarchy |
|
|
42
|
+
| **Text contrast (light)** | Maintain body text contrast >=4.5:1 against light surfaces | Low-contrast gray body text |
|
|
43
|
+
| **Text contrast (dark)** | Maintain normal text contrast >=4.5:1 on dark surfaces; 3:1 is only for large text or non-text UI | Muted normal text that falls below the text threshold |
|
|
44
|
+
| **Border and divider visibility** | Ensure separators are visible in both themes (not just light mode) | Theme-specific borders disappearing in one mode |
|
|
45
|
+
| **State contrast parity** | Keep pressed/focused/disabled states equally distinguishable in light and dark themes | Defining interaction states for one theme only |
|
|
46
|
+
| **Token-driven theming** | Use semantic color tokens mapped per theme across app surfaces/text/icons | Hardcoded per-screen hex values |
|
|
47
|
+
| **Scrim and modal legibility** | Measure the composed result and use a scrim strong enough to isolate foreground content | Reusing one opacity without checking the actual background |
|
|
48
|
+
|
|
49
|
+
## Layout & Spacing
|
|
50
|
+
|
|
51
|
+
| Rule | Do | Don't |
|
|
52
|
+
|------|----|----- |
|
|
53
|
+
| **Safe-area compliance** | Respect top/bottom safe areas for all fixed headers, tab bars, and CTA bars | Placing fixed UI under notch, status bar, or gesture area |
|
|
54
|
+
| **System bar clearance** | Add spacing for status/navigation bars and gesture home indicator | Let tappable content collide with OS chrome |
|
|
55
|
+
| **Consistent content width** | Keep predictable content width per device class (phone/tablet) | Mixing arbitrary widths between screens |
|
|
56
|
+
| **8dp spacing rhythm** | Use a consistent 4/8dp spacing system for padding/gaps/section spacing | Random spacing increments with no rhythm |
|
|
57
|
+
| **Readable text measure** | Keep long-form text readable on large devices (avoid edge-to-edge paragraphs on tablets) | Full-width long text that hurts readability |
|
|
58
|
+
| **Section spacing hierarchy** | Define clear vertical rhythm tiers (e.g., 16/24/32/48) by hierarchy | Similar UI levels with inconsistent spacing |
|
|
59
|
+
| **Adaptive gutters by breakpoint** | Increase horizontal insets on larger widths and in landscape | Same narrow gutter on all device sizes/orientations |
|
|
60
|
+
| **Scroll and fixed element coexistence** | Add bottom/top content insets so lists are not hidden behind fixed bars | Scroll content obscured by sticky headers/footers |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Pre-Delivery Checklist (canonical — the only one)
|
|
65
|
+
|
|
66
|
+
Before delivering app UI code, verify every item below. Start with the process steps, then the per-area checkboxes.
|
|
67
|
+
|
|
68
|
+
### Process
|
|
69
|
+
- [ ] Ran only searches relevant to the interface, such as `"keyboard focus modal" --domain ux` for modal keyboard behavior
|
|
70
|
+
- [ ] Reviewed `quick-reference.md` §1–§3 (CRITICAL + HIGH) as a final pass
|
|
71
|
+
- [ ] Tested on 375px (small phone) and in landscape orientation
|
|
72
|
+
- [ ] Verified behavior with **reduced-motion** enabled and **Dynamic Type**/largest system text size
|
|
73
|
+
- [ ] Checked dark mode contrast independently (never assume light-mode values carry over)
|
|
74
|
+
- [ ] Confirmed all touch targets ≥44pt and no content hidden behind safe areas
|
|
75
|
+
|
|
76
|
+
### Visual Quality
|
|
77
|
+
- [ ] No emojis used as icons (use SVG instead)
|
|
78
|
+
- [ ] All icons come from a consistent icon family and style
|
|
79
|
+
- [ ] Official brand assets are used with correct proportions and clear space
|
|
80
|
+
- [ ] Pressed-state visuals do not shift layout bounds or cause jitter
|
|
81
|
+
- [ ] Semantic theme tokens are used consistently (no ad-hoc per-screen hardcoded colors)
|
|
82
|
+
|
|
83
|
+
### Interaction
|
|
84
|
+
- [ ] All tappable elements provide clear pressed feedback (ripple/opacity/elevation)
|
|
85
|
+
- [ ] Touch targets meet minimum size (>=44x44pt iOS, >=48x48dp Android)
|
|
86
|
+
- [ ] Micro-interaction timing uses shared, platform-appropriate tokens and remains responsive in context
|
|
87
|
+
- [ ] Disabled states are visually clear and non-interactive
|
|
88
|
+
- [ ] Screen reader focus order matches visual order, and interactive labels are descriptive
|
|
89
|
+
- [ ] Gesture regions avoid nested/conflicting interactions (tap/drag/back-swipe conflicts)
|
|
90
|
+
|
|
91
|
+
### Light/Dark Mode
|
|
92
|
+
- [ ] Primary text contrast >=4.5:1 in both light and dark mode
|
|
93
|
+
- [ ] Normal primary and secondary text contrast >=4.5:1 in both light and dark mode
|
|
94
|
+
- [ ] Dividers/borders and interaction states are distinguishable in both modes
|
|
95
|
+
- [ ] Modal/drawer scrim is measured against the real background and preserves foreground legibility
|
|
96
|
+
- [ ] Both themes are tested before delivery (not inferred from a single theme)
|
|
97
|
+
|
|
98
|
+
### Layout
|
|
99
|
+
- [ ] Safe areas are respected for headers, tab bars, and bottom CTA bars
|
|
100
|
+
- [ ] Scroll content is not hidden behind fixed/sticky bars
|
|
101
|
+
- [ ] Verified on small phone, large phone, and tablet (portrait + landscape)
|
|
102
|
+
- [ ] Horizontal insets/gutters adapt correctly by device size and orientation
|
|
103
|
+
- [ ] 4/8dp spacing rhythm is maintained across component, section, and page levels
|
|
104
|
+
- [ ] Long-form text measure remains readable on larger devices (no edge-to-edge paragraphs)
|
|
105
|
+
|
|
106
|
+
### Accessibility
|
|
107
|
+
- [ ] Decorative icons beside visible text are hidden from the accessibility tree (`aria-hidden="true"` on web or the native equivalent)
|
|
108
|
+
- [ ] Meaningful images/icons without equivalent visible text have a text alternative
|
|
109
|
+
- [ ] Icon controls have an accessible name and announce applicable selected/pressed/expanded state
|
|
110
|
+
- [ ] Form fields have labels, hints, and clear error messages
|
|
111
|
+
- [ ] Color is not the only indicator
|
|
112
|
+
- [ ] Reduced motion and dynamic text size are supported without layout breakage
|
|
113
|
+
- [ ] Sticky UI and overlays do not obscure keyboard focus
|
|
114
|
+
- [ ] Dragging and swipe-only interactions have button/keyboard alternatives
|
|
115
|
+
- [ ] Authentication allows password managers and paste, with a non-cognitive alternative
|
|
116
|
+
- [ ] Auto-rotating content has pause/stop controls and stops on focus or reduced motion
|
|
117
|
+
- [ ] Failed forms retain inline field errors; multi-error forms also focus a linked error summary after submit
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
|
|
2
|
+
# Apple Design
|
|
3
|
+
|
|
4
|
+
How Apple builds interfaces that stop feeling like a computer and start feeling like an extension of you. This knowledge comes from Apple's WWDC design talks — chiefly *Designing Fluid Interfaces* (WWDC 2018) — distilled and translated into the web platform (CSS, Pointer Events, `requestAnimationFrame`, spring libraries like Motion/Framer Motion).
|
|
5
|
+
|
|
6
|
+
The through-line: **an interface feels alive when motion starts from the current on-screen value, inherits the user's velocity, projects momentum forward, and can be grabbed and reversed at any instant.** Springs are the tool that makes all of this natural, because they are inherently interruptible and velocity-aware.
|
|
7
|
+
|
|
8
|
+
## The Core Idea
|
|
9
|
+
|
|
10
|
+
> "When we align the interface to the way we think and move, something magical happens — it stops feeling like a computer and starts feeling like a seamless extension of us."
|
|
11
|
+
|
|
12
|
+
An interface is fluid when it behaves like the physical world: things respond instantly, move continuously, carry momentum, resist at boundaries, and can be redirected mid-motion. Everything below is a way to get closer to that.
|
|
13
|
+
|
|
14
|
+
Apple frames design as serving four human needs: **safety/predictability, understanding, achievement, and joy.** Every rule here serves one of them.
|
|
15
|
+
|
|
16
|
+
## 1. Response — kill latency
|
|
17
|
+
|
|
18
|
+
The moment lag appears, the feeling of directness "falls off a cliff." Response is the foundation everything else is built on.
|
|
19
|
+
|
|
20
|
+
- **Respond on pointer-down, not on release.** Highlight a button the instant it's pressed. Waiting for `click`/touch-up to show feedback feels dead.
|
|
21
|
+
- **Be vigilant about every latency.** Audit debounces, artificial timers, transition waits, and the ~300ms tap delay. Anything on the input path that isn't essential is a regression.
|
|
22
|
+
- **Feedback must be continuous *during* the interaction, not just at the end.** For a drag, slider, or drawer, update the UI 1:1 with the pointer the whole way through — never animate only when the gesture completes.
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
/* Feedback lives on the press, and it's instant */
|
|
26
|
+
.button:active {
|
|
27
|
+
transform: scale(0.97);
|
|
28
|
+
transition: transform 100ms ease-out;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 2. Direct manipulation — 1:1 tracking
|
|
33
|
+
|
|
34
|
+
> "Touch and content should move together."
|
|
35
|
+
|
|
36
|
+
When the user drags something, it must stay glued to the finger — and respect the offset from *where they grabbed it*. Snapping to the element's center on grab breaks the illusion immediately.
|
|
37
|
+
|
|
38
|
+
- Use Pointer Events with `setPointerCapture` so tracking continues even when the pointer leaves the element's bounds.
|
|
39
|
+
- Track a short **velocity/position history** (last few `pointermove` events), not just the current point — you'll need velocity at release.
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
el.addEventListener('pointerdown', (e) => {
|
|
43
|
+
el.setPointerCapture(e.pointerId);
|
|
44
|
+
const grabOffset = e.clientY - el.getBoundingClientRect().top; // respect where they grabbed
|
|
45
|
+
// ...track position + timestamp history for velocity
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 3. Interruptibility — the single most important principle
|
|
50
|
+
|
|
51
|
+
> "The thought and the gesture happen in parallel."
|
|
52
|
+
|
|
53
|
+
Every animation must be interruptible and redirectable at any moment. A user must be able to grab a moving element mid-flight and reverse it without waiting for the animation to finish. A closing modal the user grabs again should follow the finger — not finish closing first, then reopen.
|
|
54
|
+
|
|
55
|
+
- **Never lock out input during a transition.**
|
|
56
|
+
- **Always animate from the *presentation* (current) value, never the target value.** On interrupt, read the element's live on-screen transform and start the new animation from there. Starting from the logical/target value causes a visible jump.
|
|
57
|
+
- **Avoid CSS transitions and `@keyframes` for anything gesture-driven** — they can't be smoothly grabbed and reversed mid-flight. Springs animate from the current value by default, which is exactly what interruption needs.
|
|
58
|
+
- **When a gesture reverses, blend velocity — don't hard-cut it.** Replacing one animation with another at a reversal creates a velocity discontinuity, a "brick wall." Spring libraries that carry velocity through a re-target avoid it. (This is what iOS's *additive animations* do natively; on the web, choose a spring library that re-targets from the current velocity.)
|
|
59
|
+
- **Decompose 2D motion into independent X and Y springs.** A single spring on a 2D distance desyncs when X and Y have different velocities.
|
|
60
|
+
|
|
61
|
+
## 4. Behavior over animation — use springs
|
|
62
|
+
|
|
63
|
+
> "Think of animation as a conversation between you and the object, not something prescribed by the interface."
|
|
64
|
+
|
|
65
|
+
A pre-scripted, fixed-duration animation can't respond to new input. A spring can — new input just changes the target, and the motion stays continuous. Reach for springs for anything a user can touch.
|
|
66
|
+
|
|
67
|
+
Apple deliberately replaced the physics triplet (mass/stiffness/damping) with two designer-friendly parameters. Think in these:
|
|
68
|
+
|
|
69
|
+
- **Damping ratio** — controls overshoot. `1.0` = critically damped, no bounce, smooth settle. `< 1.0` = overshoots and oscillates. Lower = bouncier.
|
|
70
|
+
- **Response** — how quickly the value reaches the target, in seconds. Lower = snappier. **This is not "duration"** — a spring has no fixed duration; its settle time emerges from the parameters.
|
|
71
|
+
|
|
72
|
+
**Defaults:**
|
|
73
|
+
- Start most UI at **damping `1.0`** (critically damped) — graceful and non-distracting.
|
|
74
|
+
- Add bounce (**damping ~`0.8`**) **only when the gesture itself carried momentum** (a flick, a throw, a drag release). Overshoot on a menu that just faded in feels wrong; overshoot on a card you flicked feels right.
|
|
75
|
+
|
|
76
|
+
**Concrete values Apple ships:**
|
|
77
|
+
|
|
78
|
+
| Interaction | Damping | Response |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| Move / reposition (e.g. PiP) | `1.0` | `0.4` |
|
|
81
|
+
| Rotation | `0.8` | `0.4` |
|
|
82
|
+
| Drawer / sheet | `0.8` | `0.3` |
|
|
83
|
+
|
|
84
|
+
**Web mapping (Motion / Framer Motion):** the `bounce` + `duration` spring API maps closely to Apple's damping + response. A safe house style is `damping: 1.0` springs everywhere by default; reserve bounce for momentum-driven, physical interactions.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import { animate } from 'motion';
|
|
88
|
+
|
|
89
|
+
// Critically damped default (no overshoot)
|
|
90
|
+
animate(el, { y: 0 }, { type: 'spring', bounce: 0, duration: 0.4 });
|
|
91
|
+
|
|
92
|
+
// Momentum interaction — a little bounce, only because a flick preceded it
|
|
93
|
+
animate(el, { y: target }, { type: 'spring', bounce: 0.2, duration: 0.4 });
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 5. Velocity handoff — the seam between drag and animation
|
|
97
|
+
|
|
98
|
+
When a gesture ends, the animation must **continue at the finger's exact velocity**, so there's no visible seam between dragging and animating. This is the detail that most separates "fluid" from "fine."
|
|
99
|
+
|
|
100
|
+
Pass the pointer's release velocity as the spring's initial velocity. Some spring APIs want **relative** velocity — normalize it by the remaining distance to the target:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
relativeVelocity = gestureVelocity / (targetValue − currentValue)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Example: element at `y=50`, target `y=150` (100px to go), finger moving 50px/s → initial spring velocity = `50 / 100 = 0.5`. Framer Motion / Motion take absolute px/s velocity directly (`velocity` option), so you usually hand it the raw value.
|
|
107
|
+
|
|
108
|
+
## 6. Momentum projection — animate to where the gesture is *going*
|
|
109
|
+
|
|
110
|
+
> "Take a small input and make a big output."
|
|
111
|
+
|
|
112
|
+
Don't snap to the nearest boundary from the *release point*. Use velocity to **project the resting position** — exactly like scroll deceleration — then snap to the target nearest that projected point. This is what makes a flick feel like it throws the element.
|
|
113
|
+
|
|
114
|
+
Apple's exact projection function (from the *Designing Fluid Interfaces* sample code):
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
// decelerationRate ≈ 0.998 for normal scroll feel; 0.99 for snappier
|
|
118
|
+
function project(initialVelocity /* px/s */, decelerationRate = 0.998) {
|
|
119
|
+
return (initialVelocity / 1000) * decelerationRate / (1 - decelerationRate);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const projectedEndpoint = currentPosition + project(releaseVelocity);
|
|
123
|
+
const target = nearestSnapPoint(projectedEndpoint); // choose target from the projection
|
|
124
|
+
animateSpringTo(target, { velocity: releaseVelocity }); // then hand off velocity (§5)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Note: the physics-textbook `v²/(2·decel)` is *not* what Apple ships — use the exponential-decay form above. This is the standard behavior in good bottom-sheets and carousels (Vaul, Embla).
|
|
128
|
+
|
|
129
|
+
## 7. Spatial consistency — symmetric paths, anchored origins
|
|
130
|
+
|
|
131
|
+
> "If something disappears one way, we expect it to emerge from where it came."
|
|
132
|
+
|
|
133
|
+
- **Enter and exit along the same path.** A panel that slides in from the right must dismiss to the right. In-from-right / out-the-bottom feels disconnected and confusing.
|
|
134
|
+
- **Anchor interactions to their source.** A menu, popover, or sheet should originate from the element that triggered it — set `transform-origin` to the trigger, so the spatial relationship between button and content is obvious. (This is the same origin-awareness point as popovers scaling from their trigger, not their center.)
|
|
135
|
+
- **Mirror the easing on reversible transitions** so the outbound path matches the return path (use inverse cubic-bézier control points for the two directions).
|
|
136
|
+
|
|
137
|
+
## 8. Hint in the direction of the gesture
|
|
138
|
+
|
|
139
|
+
Humans predict a final state from a trajectory. Intermediate motion should telegraph where things are going — Control Center modules "grow up and out toward your finger." Make the in-between frames point at the outcome, not just interpolate blindly to it.
|
|
140
|
+
|
|
141
|
+
## 9. Rubber-banding — soft boundaries
|
|
142
|
+
|
|
143
|
+
At an edge, resist progressively instead of stopping hard. A hard stop reads as "frozen"; continuous resistance reads as "responsive, but there's nothing more here." Apply damping that increases the further past the boundary the user drags.
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
// The further past the bound, the less the element follows — real things slow before they stop
|
|
147
|
+
function rubberband(overshoot, dimension, constant = 0.55) {
|
|
148
|
+
return (overshoot * dimension * constant) / (dimension + constant * Math.abs(overshoot));
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## 10. Gesture design details (the "feel" checklist)
|
|
153
|
+
|
|
154
|
+
- **Tap:** highlight on touch-*down* (instant), commit on touch-*up*. Add ~10px of hysteresis/hit padding around the target, and allow cancel-by-dragging-away and back.
|
|
155
|
+
- **Drag/swipe:** require a small movement threshold (hysteresis, ~10px) before committing to a direction, then track 1:1.
|
|
156
|
+
- **Detect all plausible gestures in parallel from the first move**, then confidently cancel the losers once intent is clear. Avoid recognizers that only report a *final* state (`swipeleft`-type events) — they throw away the continuous tracking you need for feedback.
|
|
157
|
+
- **Minimize disambiguation delays.** Double-tap detection unavoidably delays single taps; only pay that cost where double-tap truly exists.
|
|
158
|
+
|
|
159
|
+
## 11. Frame-level smoothness
|
|
160
|
+
|
|
161
|
+
Smoothness is about *what's in the frames*, not just the frame rate.
|
|
162
|
+
|
|
163
|
+
- Keep the per-frame positional change below the perception threshold to avoid strobing.
|
|
164
|
+
- For very fast motion, a subtle **motion blur / stretch** encodes speed and reads better than a hard sharp streak.
|
|
165
|
+
- `requestAnimationFrame` is the web's display-synced clock (Apple uses `CADisplayLink`). Animate only compositor-friendly properties — `transform` and `opacity` — and hint with `will-change` where motion is imminent.
|
|
166
|
+
|
|
167
|
+
## 12. Materials & depth — translucency conveys hierarchy
|
|
168
|
+
|
|
169
|
+
Apple uses translucent materials as a floating functional layer that brings structure without stealing focus. On the web, approximate with `backdrop-filter`.
|
|
170
|
+
|
|
171
|
+
- **Build nav/toolbars/sheets as translucent layers** (`backdrop-filter: blur()` + a semi-transparent background) with content scrolling underneath — not opaque bars that consume a fixed strip.
|
|
172
|
+
- **Material weight encodes hierarchy:** darker/heavier materials separate structural regions (sidebars); lighter materials draw attention to interactive elements (buttons). **Never stack a light translucent surface on another** — legibility collapses.
|
|
173
|
+
- **Bigger surfaces should read as thicker:** stronger blur + a deeper shadow than small chips. Consider context-aware shadow — heavier over busy/text content for separation, lighter over plain backgrounds.
|
|
174
|
+
- **Dim to focus, separate to keep flow.** A modal task pairs the surface with a dimming scrim and pushes the background back/down. A parallel, non-blocking panel uses translucency and offset *without* a scrim so the flow isn't broken. For stacked sheets, progressively dim and push back each parent layer.
|
|
175
|
+
- **Vibrancy keeps text legible over changing backgrounds.** Over blurred/translucent surfaces, don't use flat gray text — use higher-contrast, slightly heavier weight, and a small letter-spacing bump. Put color on a solid layer, not the translucent foreground.
|
|
176
|
+
- **Scroll edge effects, not hard dividers.** Instead of a 1px border under a sticky header, fade a small blur/gradient mask where content meets floating chrome — only where floating UI actually overlaps content.
|
|
177
|
+
- **Materialize, don't just fade.** For glass/blur surfaces, animate blur radius and scale together on enter/exit, so the surface reads as a real material arriving rather than a plain opacity fade.
|
|
178
|
+
|
|
179
|
+
```css
|
|
180
|
+
.toolbar {
|
|
181
|
+
background: rgba(255, 255, 255, 0.6);
|
|
182
|
+
backdrop-filter: blur(20px) saturate(180%);
|
|
183
|
+
border-top: 1px solid rgba(255, 255, 255, 0.4); /* bright top edge = light catching the material */
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 13. Multimodal feedback — motion + sound + haptics
|
|
188
|
+
|
|
189
|
+
Three rules for combining senses (from *Designing Audio-Haptic Experiences*):
|
|
190
|
+
|
|
191
|
+
1. **Causality** — it must be obvious what caused the feedback. Trigger it on the actual causal event (the toggle flipping, the item snapping home), and match its character to the action's physicality.
|
|
192
|
+
2. **Harmony** — the visual, the sound, and the haptic must fire on the **same frame**. Latency between them destroys the illusion. Don't let a CSS transition lag the audio/haptic (Vibration API).
|
|
193
|
+
3. **Utility** — add feedback only where it earns its place. Reserve haptics/sound for meaningful moments (success, error, commit, snap). Over-feedback trains users to ignore all of it.
|
|
194
|
+
|
|
195
|
+
## 14. Reduced motion & accessibility
|
|
196
|
+
|
|
197
|
+
Reduced motion doesn't mean *no* feedback — it means a gentler, non-vestibular equivalent. Respond to three independent signals and bake them into your components:
|
|
198
|
+
|
|
199
|
+
- **`prefers-reduced-motion: reduce`** — replace slides/springs/parallax with short opacity **cross-fades or static transitions**. Drop elastic/overshoot. Keep opacity/color changes that aid comprehension.
|
|
200
|
+
- **`prefers-reduced-transparency: reduce`** — make translucent surfaces frostier/solid: raise background opacity, drop the blur.
|
|
201
|
+
- **`prefers-contrast: more`** — near-solid backgrounds with a defined, contrasting border.
|
|
202
|
+
|
|
203
|
+
Also: avoid full-viewport moving backgrounds, slow looping oscillations (near 0.2 Hz / one cycle per 5s), and abrupt brightness jumps (ease dark↔light theme changes). Make large moving objects semi-transparent while they travel, and fade big surfaces out during a large reposition and back in once settled.
|
|
204
|
+
|
|
205
|
+
```css
|
|
206
|
+
@media (prefers-reduced-motion: reduce) {
|
|
207
|
+
.sheet { transition: opacity 200ms ease; transform: none !important; }
|
|
208
|
+
}
|
|
209
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
210
|
+
.toolbar { background: white; backdrop-filter: none; }
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## 15. Typography — optical sizing, tracking, leading
|
|
215
|
+
|
|
216
|
+
Apple designs type to change shape with size; the same discipline applies on the web. (From *The Details of UI Typography*, WWDC 2020.)
|
|
217
|
+
|
|
218
|
+
- **Tracking (letter-spacing) is size-specific — never one value for all sizes.** Large display text wants *negative* tracking (letters read too far apart as they grow); small text wants slightly *positive* tracking for legibility. A fixed `letter-spacing` is wrong somewhere. Tighten headings, leave body near `0`.
|
|
219
|
+
- **Leading (line-height) tracks size inversely.** Tight on large headings, looser on body copy. Increase it for scripts with tall ascenders/descenders; tighten it for dense, information-heavy UI.
|
|
220
|
+
- **Build hierarchy from weight + size + leading as a set,** not size alone. Emphasize with weight — it adds presence without taking more space.
|
|
221
|
+
- **Respect the user's text-size setting** (Dynamic Type). Scale layout *with* the text — spacing in `rem`/`em`, not fixed px — so a larger font doesn't break the layout.
|
|
222
|
+
- **Default to the platform's system font** before a custom face; it already ships optical sizing, tracking tables, and legibility tuning. Override only with a reason.
|
|
223
|
+
|
|
224
|
+
```css
|
|
225
|
+
:root { font: 100%/1.5 system-ui, sans-serif; } /* body: system font, comfortable leading */
|
|
226
|
+
|
|
227
|
+
.display {
|
|
228
|
+
font-size: clamp(2rem, 5vw, 4rem);
|
|
229
|
+
line-height: 1.05; /* tight leading for large text */
|
|
230
|
+
letter-spacing: -0.02em; /* negative tracking as it grows */
|
|
231
|
+
font-optical-sizing: auto;
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## 16. Design foundations — the eight principles
|
|
236
|
+
|
|
237
|
+
The motion and craft above serve Apple's eight design principles (*Principles of Great Design*, WWDC 2026). Use these as the names you reason with:
|
|
238
|
+
|
|
239
|
+
1. **Purpose.** Make with intention; decide what *not* to build. Every feature asks for the user's time, attention, and trust — spend that budget only where it pays off.
|
|
240
|
+
2. **Agency.** Keep people in control: offer choices, don't force a single path. Back it with forgiveness — easy undo for slips, a confirmation dialog only for genuinely destructive, irreversible actions (use sparingly; overusing it trains people to click through).
|
|
241
|
+
3. **Responsibility.** Act in the user's interest. Privacy: ask at the right moment, only for what's needed, transparently. Safety: anticipate misuse and harm — especially with AI (an allergy-aware recipe app must not suggest a harmful ingredient). Add previews, confirmations, disclaimers; cut a feature whose risk outweighs its value.
|
|
242
|
+
4. **Familiarity.** Build on what people already know. Use metaphors that are neither too literal nor too abstract (a trash can means delete), and honor their physics. Be consistent: things that look the same must behave the same and live in the same place (close is always top-left on macOS) so people can predict what happens next. Only break a familiar pattern if you can prove it's better — then test it, don't assume.
|
|
243
|
+
5. **Flexibility.** Design for different contexts, devices, and the full range of abilities. Adapt to the platform (iPhone = quick touch; desktop = deep workflows with precise pointer control) and to the situation. Design inclusively (age, language, expertise, accessibility). When no single layout fits everyone, let people personalize — rearrange controls, hide what they don't use.
|
|
244
|
+
6. **Simplicity — not minimalism.** Strip the unnecessary so the core purpose shines; burying everything in one place looks minimal but isn't simple. Be concise (plain language, no jargon, fewer steps) and clear (use hierarchy — order, spacing, contrast — so the most important thing is the most obvious). Every element earns its place; sometimes *adding* context simplifies (a video scrubber that shows time remaining). Show the common path first, advanced options one level deeper.
|
|
245
|
+
7. **Craft.** Uncompromising attention to detail builds trust. Beautiful typography, colors that adapt to light/dark, clear iconography, and responsive animations that give immediate, natural feedback. Nothing is random — every spacing, timing, and alignment value is a deliberate choice you can defend. Jittery scroll, misaligned icons, and layouts that break on rotation read as carelessness. Craft needs iteration and longevity — keep evolving the design as features and hardware change.
|
|
246
|
+
8. **Delight.** The result of getting the other seven right, not confetti tacked on top. Decide the emotion you want people to feel (calm, confident, excited) and reinforce it in every decision.
|
|
247
|
+
|
|
248
|
+
Tactical rules that serve these:
|
|
249
|
+
|
|
250
|
+
- **Feedback comes in four kinds:** status, completion, warning, error. Confirm meaningful actions, expose ongoing status, warn before problems, validate inline (not on submit).
|
|
251
|
+
- **Wayfinding.** Every screen should answer: Where am I? Where can I go? What's there? How do I get out? Never trap the user.
|
|
252
|
+
- **Grouping & mapping.** Proximity implies relationship; place a control near what it affects and arrange controls to mirror what they change. If you need a label to explain a control, the mapping is weak.
|
|
253
|
+
- **Direct, specific labels beat safe generic ones.** Name nav items for their contents ("Progress", "Library"), not vague umbrellas ("Home"). Specificity creates predictability.
|
|
254
|
+
|
|
255
|
+
## 17. Process
|
|
256
|
+
|
|
257
|
+
- **Prototype interactively — an interactive demo is worth "a million static designs."** You discover the interface by building and playing with it; a working prototype also sets a concrete bar that prevents a mediocre final implementation.
|
|
258
|
+
- **Design interaction and visuals together.** "You shouldn't be able to tell where one ends and the other begins." Motion is not a layer added after the pixels.
|
|
259
|
+
- **Test with real people in real context**, and review motion with fresh eyes — play it in slow motion / frame-by-frame to catch what's invisible at full speed.
|
|
260
|
+
|
|
261
|
+
## Quick Reference
|
|
262
|
+
|
|
263
|
+
| Need | Technique | Concrete value |
|
|
264
|
+
| --- | --- | --- |
|
|
265
|
+
| Default UI spring | Critically damped, no overshoot | `damping 1.0`, `response 0.3–0.4` |
|
|
266
|
+
| Momentum / flick spring | Under-damped, slight bounce | `damping ~0.8`, `response 0.3–0.4` |
|
|
267
|
+
| Gesture → spring velocity | Hand off release velocity | `gestureVelocity / (target − current)` if normalized |
|
|
268
|
+
| Flick landing point | Project momentum | `current + (v/1000)·d/(1−d)`, `d ≈ 0.998` |
|
|
269
|
+
| Interrupt cleanly | Start from presentation (live) value | read the on-screen transform |
|
|
270
|
+
| Avoid reversal "brick wall" | Carry velocity through re-target | spring that blends velocity |
|
|
271
|
+
| Reversible transition | Mirror the easing curve | inverse cubic-bézier |
|
|
272
|
+
| Decide reverse vs. commit | Use velocity **sign**, not position | at release |
|
|
273
|
+
| 1:1 drag | Pointer Events + capture | respect the grab offset |
|
|
274
|
+
| Feedback | On pointer-down, continuous | never only at the end |
|
|
275
|
+
| Boundary | Rubber-band, don't hard-stop | progressive resistance |
|
|
276
|
+
| Translucent chrome | `backdrop-filter` layer | content scrolls under |
|
|
277
|
+
| Type tracking | Size-specific, never fixed | tighten large text (`-0.02em`), body near `0` |
|
|
278
|
+
| Reduced motion | Cross-fade, not slide/spring | `@media (prefers-reduced-motion)` |
|