@istmx/skills 1.1.0 → 2.0.0
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/CODE_OF_CONDUCT.md +47 -0
- package/LICENSE +30 -0
- package/README.md +48 -22
- package/bin/cli.js +130 -119
- package/istm-animate/SKILL.md +28 -58
- package/istm-animate/core/motion-principles/SKILL.md +284 -0
- package/istm-animate/core/motion-principles/references/designers.md +127 -0
- package/istm-animate/core/motion-principles/references/easing-guide.md +231 -0
- package/istm-animate/core/motion-principles/references/enter-exit-recipes.md +466 -0
- package/istm-animate/frameworks/canvas-generative/SKILL.md +325 -0
- package/istm-animate/frameworks/canvas-generative/references/algorithms.md +925 -0
- package/istm-animate/frameworks/css-native/SKILL.md +319 -0
- package/istm-animate/frameworks/css-native/references/modern-css.md +465 -0
- package/istm-animate/frameworks/framer-motion/SKILL.md +187 -0
- package/istm-animate/frameworks/framer-motion/references/api.md +312 -0
- package/istm-animate/frameworks/gsap/SKILL.md +188 -0
- package/istm-animate/frameworks/gsap/references/core.md +218 -0
- package/istm-animate/frameworks/gsap/references/plugins.md +371 -0
- package/istm-animate/frameworks/gsap/references/scrolltrigger.md +325 -0
- package/istm-animate/frameworks/gsap/references/timeline.md +218 -0
- package/istm-animate/frameworks/threejs-r3f/SKILL.md +243 -0
- package/istm-animate/frameworks/threejs-r3f/references/scene-setup.md +392 -0
- package/istm-animate/frameworks/threejs-r3f/references/shaders.md +446 -0
- package/istm-animate/mobile/android/compose-graphics/SKILL.md +503 -0
- package/istm-animate/mobile/android/compose-graphics/references/agsl-recipes.md +356 -0
- package/istm-animate/mobile/android/compose-graphics/references/canvas-generative.md +282 -0
- package/istm-animate/mobile/android/compose-graphics/references/m3-expressive-deep.md +303 -0
- package/istm-animate/mobile/android/compose-motion/SKILL.md +359 -0
- package/istm-animate/mobile/android/compose-motion/references/gestures-compose.md +273 -0
- package/istm-animate/mobile/android/compose-motion/references/recomposition-and-anim.md +196 -0
- package/istm-animate/mobile/android/compose-motion/references/shared-transitions.md +281 -0
- package/istm-animate/mobile/android/compose-multiplatform/SKILL.md +311 -0
- package/istm-animate/mobile/android/compose-multiplatform/references/cmp-interop.md +288 -0
- package/istm-animate/mobile/android/compose-multiplatform/references/cmp-platform-quirks.md +156 -0
- package/istm-animate/mobile/apple/swiftui-graphics/SKILL.md +408 -0
- package/istm-animate/mobile/apple/swiftui-graphics/references/canvas-swiftui.md +239 -0
- package/istm-animate/mobile/apple/swiftui-graphics/references/liquid-glass-deep.md +252 -0
- package/istm-animate/mobile/apple/swiftui-graphics/references/metal-recipes.md +382 -0
- package/istm-animate/mobile/apple/swiftui-motion/SKILL.md +379 -0
- package/istm-animate/mobile/apple/swiftui-motion/references/gestures-swiftui.md +336 -0
- package/istm-animate/mobile/apple/swiftui-motion/references/phase-keyframe-deep.md +231 -0
- package/istm-animate/mobile/apple/swiftui-motion/references/springs-cheatsheet.md +129 -0
- package/istm-animate/references/animate.md +199 -0
- package/istm-animate/references/audit.md +115 -0
- package/istm-animate/references/design-engineering.md +674 -0
- package/istm-animate/references/improve.md +101 -0
- package/istm-animate/references/opportunities.md +132 -0
- package/istm-animate/references/plan-template.md +73 -0
- package/istm-animate/references/recipes.md +324 -0
- package/istm-animate/references/review.md +112 -0
- package/istm-animate/references/standards.md +187 -0
- package/istm-animate/references/vocabulary.md +173 -0
- package/istm-architecture/SKILL.md +10 -1
- package/istm-awwward-designer/SKILL.md +28 -20
- package/istm-design/SKILL.md +31 -58
- package/istm-design/core/design-audit/SKILL.md +248 -0
- package/istm-design/core/desktop-principles/SKILL.md +363 -0
- package/istm-design/core/desktop-principles/references/keyboard-patterns.md +137 -0
- package/istm-design/core/desktop-principles/references/multi-window.md +105 -0
- package/istm-design/core/mobile-principles/SKILL.md +289 -0
- package/istm-design/core/mobile-principles/references/accessibility-mobile.md +175 -0
- package/istm-design/core/mobile-principles/references/gestures-deep.md +220 -0
- package/istm-design/core/ui-ux-pro-max/SKILL.md +392 -0
- package/istm-design/core/ui-ux-pro-max/UPSTREAM.md +23 -0
- package/istm-design/core/ui-ux-pro-max/data/app-interface.csv +31 -0
- package/istm-design/core/ui-ux-pro-max/data/charts.csv +26 -0
- package/istm-design/core/ui-ux-pro-max/data/colors.csv +193 -0
- package/istm-design/core/ui-ux-pro-max/data/google-fonts.csv +1924 -0
- package/istm-design/core/ui-ux-pro-max/data/icons.csv +106 -0
- package/istm-design/core/ui-ux-pro-max/data/landing.csv +35 -0
- package/istm-design/core/ui-ux-pro-max/data/motion.csv +17 -0
- package/istm-design/core/ui-ux-pro-max/data/products.csv +193 -0
- package/istm-design/core/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/angular.csv +51 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/avalonia.csv +57 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/javafx.csv +76 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/laravel.csv +51 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/nuxt-ui.csv +71 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/threejs.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/uno.csv +60 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/uwp.csv +56 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/winui.csv +60 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/wpf.csv +57 -0
- package/istm-design/core/ui-ux-pro-max/data/styles.csv +85 -0
- package/istm-design/core/ui-ux-pro-max/data/typography.csv +75 -0
- package/istm-design/core/ui-ux-pro-max/data/ui-reasoning.csv +162 -0
- package/istm-design/core/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/istm-design/core/ui-ux-pro-max/references/pro-rules.md +109 -0
- package/istm-design/core/ui-ux-pro-max/references/quick-reference.md +240 -0
- package/istm-design/core/ui-ux-pro-max/scripts/core.py +464 -0
- package/istm-design/core/ui-ux-pro-max/scripts/design_system.py +1371 -0
- package/istm-design/core/ui-ux-pro-max/scripts/search.py +162 -0
- package/istm-design/core/ui-ux-pro-max/scripts/tests/test_core.py +134 -0
- package/istm-design/core/ui-ux-pro-max/scripts/validate_data.py +114 -0
- package/istm-design/references/apple-design.md +282 -0
- package/istm-design/references/generation-guide.md +209 -0
- package/istm-design/references/pick-ui-library.md +77 -0
- package/istm-design/references/picker.md +197 -0
- package/istm-design/references/prototype.md +90 -0
- package/istm-design/references/schema.md +366 -0
- package/istm-workflow/istm-audit/SKILL.md +7 -7
- package/istm-workflow/istm-audit/agent-prompt.md +20 -20
- package/istm-workflow/istm-audit/modes/area.md +1 -1
- package/istm-workflow/istm-audit/modes/greenfield.md +4 -4
- package/istm-workflow/istm-audit/modes/tool-skills.md +1 -1
- package/istm-workflow/istm-check/SKILL.md +10 -10
- package/istm-workflow/istm-check/modes/review.md +9 -9
- package/istm-workflow/istm-check/modes/verify.md +19 -19
- package/istm-workflow/istm-check/review-agent-prompt.md +2 -2
- package/istm-workflow/istm-check/review-guide.md +4 -4
- package/istm-workflow/istm-craft/SKILL.md +20 -11
- package/istm-workflow/istm-craft/agent-modes/architecture.md +1 -1
- package/istm-workflow/istm-craft/agent-prompt.md +8 -8
- package/istm-workflow/istm-craft/internal/after-subagent.md +11 -11
- package/istm-workflow/istm-craft/internal/design-conversation.md +9 -9
- package/istm-workflow/istm-craft/internal/tool-discovery.md +2 -2
- package/istm-workflow/istm-craft/spec-template.md +18 -18
- package/istm-workflow/istm-debug/SKILL.md +6 -6
- package/istm-workflow/istm-develop/SKILL.md +31 -16
- package/istm-workflow/istm-develop/checklist.md +1 -1
- package/istm-workflow/istm-develop/flow/build.md +21 -21
- package/istm-workflow/istm-develop/flow/git.md +4 -4
- package/istm-workflow/istm-develop/logical-guide.md +5 -5
- package/istm-workflow/istm-develop/ui/implementation.md +2 -2
- package/istm-workflow/istm-develop/ui-guide.md +3 -3
- package/istm-workflow/istm-document/SKILL.md +6 -6
- package/istm-workflow/istm-document/templates/postmortem.md +1 -1
- package/istm-workflow/istm-scope/SKILL.md +20 -20
- package/istm-workflow/istm-scope/modes/add.md +1 -1
- package/istm-workflow/istm-scope/modes/plan-brownfield.md +2 -2
- package/istm-workflow/istm-scope/modes/plan-greenfield.md +4 -4
- package/istm-workflow/istm-scope/modes/plan-monorepo.md +3 -3
- package/istm-workflow/istm-scope/modes/plan.md +16 -16
- package/istm-workflow/istm-scope/modes/replan.md +2 -2
- package/istm-workflow/istm-scope/scope-template.md +29 -29
- package/istm-workflow/istm-sync/SKILL.md +37 -25
- package/istm-workflow/istm-sync/agent-prompt.md +37 -19
- package/istm-workflow/istm-test/SKILL.md +12 -12
- package/istm-workflow/istm-test/modes/setup.md +6 -6
- package/istm-workflow/istm-test/writing-guide.md +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: istm-design
|
|
3
|
+
description: Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Apple Design
|
|
7
|
+
|
|
8
|
+
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).
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## The Core Idea
|
|
13
|
+
|
|
14
|
+
> "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."
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
Apple frames design as serving four human needs: **safety/predictability, understanding, achievement, and joy.** Every rule here serves one of them.
|
|
19
|
+
|
|
20
|
+
## 1. Response — kill latency
|
|
21
|
+
|
|
22
|
+
The moment lag appears, the feeling of directness "falls off a cliff." Response is the foundation everything else is built on.
|
|
23
|
+
|
|
24
|
+
- **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.
|
|
25
|
+
- **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.
|
|
26
|
+
- **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.
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
/* Feedback lives on the press, and it's instant */
|
|
30
|
+
.button:active {
|
|
31
|
+
transform: scale(0.97);
|
|
32
|
+
transition: transform 100ms ease-out;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 2. Direct manipulation — 1:1 tracking
|
|
37
|
+
|
|
38
|
+
> "Touch and content should move together."
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
- Use Pointer Events with `setPointerCapture` so tracking continues even when the pointer leaves the element's bounds.
|
|
43
|
+
- Track a short **velocity/position history** (last few `pointermove` events), not just the current point — you'll need velocity at release.
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
el.addEventListener('pointerdown', (e) => {
|
|
47
|
+
el.setPointerCapture(e.pointerId);
|
|
48
|
+
const grabOffset = e.clientY - el.getBoundingClientRect().top; // respect where they grabbed
|
|
49
|
+
// ...track position + timestamp history for velocity
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 3. Interruptibility — the single most important principle
|
|
54
|
+
|
|
55
|
+
> "The thought and the gesture happen in parallel."
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
- **Never lock out input during a transition.**
|
|
60
|
+
- **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.
|
|
61
|
+
- **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.
|
|
62
|
+
- **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.)
|
|
63
|
+
- **Decompose 2D motion into independent X and Y springs.** A single spring on a 2D distance desyncs when X and Y have different velocities.
|
|
64
|
+
|
|
65
|
+
## 4. Behavior over animation — use springs
|
|
66
|
+
|
|
67
|
+
> "Think of animation as a conversation between you and the object, not something prescribed by the interface."
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
Apple deliberately replaced the physics triplet (mass/stiffness/damping) with two designer-friendly parameters. Think in these:
|
|
72
|
+
|
|
73
|
+
- **Damping ratio** — controls overshoot. `1.0` = critically damped, no bounce, smooth settle. `< 1.0` = overshoots and oscillates. Lower = bouncier.
|
|
74
|
+
- **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.
|
|
75
|
+
|
|
76
|
+
**Defaults:**
|
|
77
|
+
- Start most UI at **damping `1.0`** (critically damped) — graceful and non-distracting.
|
|
78
|
+
- 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.
|
|
79
|
+
|
|
80
|
+
**Concrete values Apple ships:**
|
|
81
|
+
|
|
82
|
+
| Interaction | Damping | Response |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| Move / reposition (e.g. PiP) | `1.0` | `0.4` |
|
|
85
|
+
| Rotation | `0.8` | `0.4` |
|
|
86
|
+
| Drawer / sheet | `0.8` | `0.3` |
|
|
87
|
+
|
|
88
|
+
**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.
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
import { animate } from 'motion';
|
|
92
|
+
|
|
93
|
+
// Critically damped default (no overshoot)
|
|
94
|
+
animate(el, { y: 0 }, { type: 'spring', bounce: 0, duration: 0.4 });
|
|
95
|
+
|
|
96
|
+
// Momentum interaction — a little bounce, only because a flick preceded it
|
|
97
|
+
animate(el, { y: target }, { type: 'spring', bounce: 0.2, duration: 0.4 });
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 5. Velocity handoff — the seam between drag and animation
|
|
101
|
+
|
|
102
|
+
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."
|
|
103
|
+
|
|
104
|
+
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:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
relativeVelocity = gestureVelocity / (targetValue − currentValue)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
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.
|
|
111
|
+
|
|
112
|
+
## 6. Momentum projection — animate to where the gesture is *going*
|
|
113
|
+
|
|
114
|
+
> "Take a small input and make a big output."
|
|
115
|
+
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
Apple's exact projection function (from the *Designing Fluid Interfaces* sample code):
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
// decelerationRate ≈ 0.998 for normal scroll feel; 0.99 for snappier
|
|
122
|
+
function project(initialVelocity /* px/s */, decelerationRate = 0.998) {
|
|
123
|
+
return (initialVelocity / 1000) * decelerationRate / (1 - decelerationRate);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const projectedEndpoint = currentPosition + project(releaseVelocity);
|
|
127
|
+
const target = nearestSnapPoint(projectedEndpoint); // choose target from the projection
|
|
128
|
+
animateSpringTo(target, { velocity: releaseVelocity }); // then hand off velocity (§5)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
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).
|
|
132
|
+
|
|
133
|
+
## 7. Spatial consistency — symmetric paths, anchored origins
|
|
134
|
+
|
|
135
|
+
> "If something disappears one way, we expect it to emerge from where it came."
|
|
136
|
+
|
|
137
|
+
- **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.
|
|
138
|
+
- **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.)
|
|
139
|
+
- **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).
|
|
140
|
+
|
|
141
|
+
## 8. Hint in the direction of the gesture
|
|
142
|
+
|
|
143
|
+
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.
|
|
144
|
+
|
|
145
|
+
## 9. Rubber-banding — soft boundaries
|
|
146
|
+
|
|
147
|
+
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.
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
// The further past the bound, the less the element follows — real things slow before they stop
|
|
151
|
+
function rubberband(overshoot, dimension, constant = 0.55) {
|
|
152
|
+
return (overshoot * dimension * constant) / (dimension + constant * Math.abs(overshoot));
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 10. Gesture design details (the "feel" checklist)
|
|
157
|
+
|
|
158
|
+
- **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.
|
|
159
|
+
- **Drag/swipe:** require a small movement threshold (hysteresis, ~10px) before committing to a direction, then track 1:1.
|
|
160
|
+
- **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.
|
|
161
|
+
- **Minimize disambiguation delays.** Double-tap detection unavoidably delays single taps; only pay that cost where double-tap truly exists.
|
|
162
|
+
|
|
163
|
+
## 11. Frame-level smoothness
|
|
164
|
+
|
|
165
|
+
Smoothness is about *what's in the frames*, not just the frame rate.
|
|
166
|
+
|
|
167
|
+
- Keep the per-frame positional change below the perception threshold to avoid strobing.
|
|
168
|
+
- For very fast motion, a subtle **motion blur / stretch** encodes speed and reads better than a hard sharp streak.
|
|
169
|
+
- `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.
|
|
170
|
+
|
|
171
|
+
## 12. Materials & depth — translucency conveys hierarchy
|
|
172
|
+
|
|
173
|
+
Apple uses translucent materials as a floating functional layer that brings structure without stealing focus. On the web, approximate with `backdrop-filter`.
|
|
174
|
+
|
|
175
|
+
- **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.
|
|
176
|
+
- **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.
|
|
177
|
+
- **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.
|
|
178
|
+
- **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.
|
|
179
|
+
- **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.
|
|
180
|
+
- **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.
|
|
181
|
+
- **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.
|
|
182
|
+
|
|
183
|
+
```css
|
|
184
|
+
.toolbar {
|
|
185
|
+
background: rgba(255, 255, 255, 0.6);
|
|
186
|
+
backdrop-filter: blur(20px) saturate(180%);
|
|
187
|
+
border-top: 1px solid rgba(255, 255, 255, 0.4); /* bright top edge = light catching the material */
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 13. Multimodal feedback — motion + sound + haptics
|
|
192
|
+
|
|
193
|
+
Three rules for combining senses (from *Designing Audio-Haptic Experiences*):
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
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).
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
## 14. Reduced motion & accessibility
|
|
200
|
+
|
|
201
|
+
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:
|
|
202
|
+
|
|
203
|
+
- **`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.
|
|
204
|
+
- **`prefers-reduced-transparency: reduce`** — make translucent surfaces frostier/solid: raise background opacity, drop the blur.
|
|
205
|
+
- **`prefers-contrast: more`** — near-solid backgrounds with a defined, contrasting border.
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
209
|
+
```css
|
|
210
|
+
@media (prefers-reduced-motion: reduce) {
|
|
211
|
+
.sheet { transition: opacity 200ms ease; transform: none !important; }
|
|
212
|
+
}
|
|
213
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
214
|
+
.toolbar { background: white; backdrop-filter: none; }
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## 15. Typography — optical sizing, tracking, leading
|
|
219
|
+
|
|
220
|
+
Apple designs type to change shape with size; the same discipline applies on the web. (From *The Details of UI Typography*, WWDC 2020.)
|
|
221
|
+
|
|
222
|
+
- **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`.
|
|
223
|
+
- **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.
|
|
224
|
+
- **Build hierarchy from weight + size + leading as a set,** not size alone. Emphasize with weight — it adds presence without taking more space.
|
|
225
|
+
- **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.
|
|
226
|
+
- **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.
|
|
227
|
+
|
|
228
|
+
```css
|
|
229
|
+
:root { font: 100%/1.5 system-ui, sans-serif; } /* body: system font, comfortable leading */
|
|
230
|
+
|
|
231
|
+
.display {
|
|
232
|
+
font-size: clamp(2rem, 5vw, 4rem);
|
|
233
|
+
line-height: 1.05; /* tight leading for large text */
|
|
234
|
+
letter-spacing: -0.02em; /* negative tracking as it grows */
|
|
235
|
+
font-optical-sizing: auto;
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 16. Design foundations — the eight principles
|
|
240
|
+
|
|
241
|
+
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:
|
|
242
|
+
|
|
243
|
+
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.
|
|
244
|
+
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).
|
|
245
|
+
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.
|
|
246
|
+
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.
|
|
247
|
+
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.
|
|
248
|
+
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.
|
|
249
|
+
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.
|
|
250
|
+
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.
|
|
251
|
+
|
|
252
|
+
Tactical rules that serve these:
|
|
253
|
+
|
|
254
|
+
- **Feedback comes in four kinds:** status, completion, warning, error. Confirm meaningful actions, expose ongoing status, warn before problems, validate inline (not on submit).
|
|
255
|
+
- **Wayfinding.** Every screen should answer: Where am I? Where can I go? What's there? How do I get out? Never trap the user.
|
|
256
|
+
- **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.
|
|
257
|
+
- **Direct, specific labels beat safe generic ones.** Name nav items for their contents ("Progress", "Library"), not vague umbrellas ("Home"). Specificity creates predictability.
|
|
258
|
+
|
|
259
|
+
## 17. Process
|
|
260
|
+
|
|
261
|
+
- **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.
|
|
262
|
+
- **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.
|
|
263
|
+
- **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.
|
|
264
|
+
|
|
265
|
+
## Quick Reference
|
|
266
|
+
|
|
267
|
+
| Need | Technique | Concrete value |
|
|
268
|
+
| --- | --- | --- |
|
|
269
|
+
| Default UI spring | Critically damped, no overshoot | `damping 1.0`, `response 0.3–0.4` |
|
|
270
|
+
| Momentum / flick spring | Under-damped, slight bounce | `damping ~0.8`, `response 0.3–0.4` |
|
|
271
|
+
| Gesture → spring velocity | Hand off release velocity | `gestureVelocity / (target − current)` if normalized |
|
|
272
|
+
| Flick landing point | Project momentum | `current + (v/1000)·d/(1−d)`, `d ≈ 0.998` |
|
|
273
|
+
| Interrupt cleanly | Start from presentation (live) value | read the on-screen transform |
|
|
274
|
+
| Avoid reversal "brick wall" | Carry velocity through re-target | spring that blends velocity |
|
|
275
|
+
| Reversible transition | Mirror the easing curve | inverse cubic-bézier |
|
|
276
|
+
| Decide reverse vs. commit | Use velocity **sign**, not position | at release |
|
|
277
|
+
| 1:1 drag | Pointer Events + capture | respect the grab offset |
|
|
278
|
+
| Feedback | On pointer-down, continuous | never only at the end |
|
|
279
|
+
| Boundary | Rubber-band, don't hard-stop | progressive resistance |
|
|
280
|
+
| Translucent chrome | `backdrop-filter` layer | content scrolls under |
|
|
281
|
+
| Type tracking | Size-specific, never fixed | tighten large text (`-0.02em`), body near `0` |
|
|
282
|
+
| Reduced motion | Cross-fade, not slide/spring | `@media (prefers-reduced-motion)` |
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Generation Guide
|
|
2
|
+
|
|
3
|
+
How to use a completed Design DNA JSON to generate designs in Phase 3. Covers all three dimensions.
|
|
4
|
+
|
|
5
|
+
## Priority Order
|
|
6
|
+
|
|
7
|
+
When generating a design from DNA JSON + content:
|
|
8
|
+
|
|
9
|
+
1. **Color & Typography** — define 80% of visual identity
|
|
10
|
+
2. **Spacing & Layout** — structural rhythm
|
|
11
|
+
3. **Shape & Elevation** — surface treatment
|
|
12
|
+
4. **Design Style qualitative fields** — mood, personality, composition approach
|
|
13
|
+
5. **Visual Effects** — special rendering layer (Canvas, WebGL, shaders, etc.)
|
|
14
|
+
6. **Motion & Interaction** — enhance after static layout and effects are solid
|
|
15
|
+
|
|
16
|
+
## Dimension 1: design_system → Code
|
|
17
|
+
|
|
18
|
+
### Tailwind CSS / Utility-First
|
|
19
|
+
```
|
|
20
|
+
color.primary.hex → --color-primary / bg-[hex]
|
|
21
|
+
typography.font_families → font-family config
|
|
22
|
+
spacing.scale → spacing config values
|
|
23
|
+
shape.border_radius → rounded-{sm|md|lg|full}
|
|
24
|
+
elevation.levels → shadow-{sm|md|lg}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Plain CSS / CSS Variables
|
|
28
|
+
Generate a `:root` block with all design tokens:
|
|
29
|
+
```css
|
|
30
|
+
:root {
|
|
31
|
+
--color-primary: {color.primary.hex};
|
|
32
|
+
--color-secondary: {color.secondary.hex};
|
|
33
|
+
--color-accent: {color.accent.hex};
|
|
34
|
+
--font-heading: {typography.font_families.heading};
|
|
35
|
+
--font-body: {typography.font_families.body};
|
|
36
|
+
--radius-sm: {shape.border_radius.small};
|
|
37
|
+
--radius-md: {shape.border_radius.medium};
|
|
38
|
+
--radius-lg: {shape.border_radius.large};
|
|
39
|
+
--shadow-low: {elevation.levels.low};
|
|
40
|
+
--shadow-med: {elevation.levels.medium};
|
|
41
|
+
--shadow-high: {elevation.levels.high};
|
|
42
|
+
--ease: {motion.easing};
|
|
43
|
+
--duration-micro: {motion.duration_scale.micro};
|
|
44
|
+
--duration-normal: {motion.duration_scale.normal};
|
|
45
|
+
--duration-macro: {motion.duration_scale.macro};
|
|
46
|
+
/* ... map all tokens */
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Component Decisions
|
|
51
|
+
- `components.button_style` → button classes and variants
|
|
52
|
+
- `components.card_style` → card container treatment
|
|
53
|
+
- `components.navigation_pattern` → nav component choice
|
|
54
|
+
- `interaction_feel.hover_behavior` → :hover / :focus states
|
|
55
|
+
- `motion.easing` + `motion.duration_scale` → transition properties
|
|
56
|
+
|
|
57
|
+
## Dimension 2: design_style → Subjective Decisions
|
|
58
|
+
|
|
59
|
+
| DNA Field | Guides |
|
|
60
|
+
|---|---|
|
|
61
|
+
| aesthetic.mood | Overall emotional feeling — warm tones, cool precision, etc. |
|
|
62
|
+
| visual_language.whitespace_usage | padding/margin generosity |
|
|
63
|
+
| visual_language.contrast_level | How much elements pop vs. blend |
|
|
64
|
+
| composition.hierarchy_method | What tool to use for emphasis |
|
|
65
|
+
| composition.balance_type | Symmetric layout vs. dynamic asymmetry |
|
|
66
|
+
| imagery.graphic_elements | Decorative SVGs, gradients, patterns |
|
|
67
|
+
| brand_voice_in_ui.tone | Microcopy phrasing |
|
|
68
|
+
| interaction_feel.microinteraction_density | How many hover/click effects |
|
|
69
|
+
|
|
70
|
+
## Dimension 3: visual_effects → Special Rendering
|
|
71
|
+
|
|
72
|
+
### Technology Selection by Performance Tier
|
|
73
|
+
|
|
74
|
+
| Tier | Technologies | When to Use |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| **lightweight** | CSS animations, SVG SMIL, vanilla JS | `overview.performance_tier` = "lightweight" |
|
|
77
|
+
| **medium** | Canvas 2D, GSAP, Lottie, anime.js | `overview.performance_tier` = "medium" |
|
|
78
|
+
| **heavy** | Three.js, custom GLSL, Pixi.js, WebGL | `overview.performance_tier` = "heavy" |
|
|
79
|
+
|
|
80
|
+
### Implementation Patterns
|
|
81
|
+
|
|
82
|
+
#### Background Effects
|
|
83
|
+
```
|
|
84
|
+
"none" → skip
|
|
85
|
+
"gradient-animation" → CSS @keyframes on linear-gradient or conic-gradient
|
|
86
|
+
"noise-field" → Canvas 2D with Perlin/simplex noise
|
|
87
|
+
"mesh-gradient" → SVG <mesh> or canvas interpolation
|
|
88
|
+
"video-bg" → <video autoplay muted loop> with poster fallback
|
|
89
|
+
"generative-art" → Canvas 2D or WebGL generative algorithms
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Particle Systems
|
|
93
|
+
When `particle_systems.enabled: true`:
|
|
94
|
+
- For `count` < 100 and no complex physics → vanilla JS + Canvas 2D
|
|
95
|
+
- For `count` >= 100 or complex interaction → consider Pixi.js or Three.js Points
|
|
96
|
+
- Map `interaction` ("mouse-repel", "mouse-attract") to pointer event handlers
|
|
97
|
+
- Use `requestAnimationFrame` loop; include destroy/cleanup on unmount
|
|
98
|
+
|
|
99
|
+
#### 3D Elements
|
|
100
|
+
When `3d_elements.enabled: true`:
|
|
101
|
+
- Default to Three.js unless DNA specifies otherwise
|
|
102
|
+
- Apply `lighting`, `camera`, `materials` from params
|
|
103
|
+
- Add `post_processing` effects via EffectComposer
|
|
104
|
+
- Handle resize with `ResizeObserver`
|
|
105
|
+
- Load via CDN: `https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js`
|
|
106
|
+
|
|
107
|
+
#### Shader Effects
|
|
108
|
+
When `shader_effects.enabled: true`:
|
|
109
|
+
- Create vertex/fragment shaders based on `type`
|
|
110
|
+
- Pass `uniforms` from params (time, resolution, mouse position)
|
|
111
|
+
- For "noise-distortion": use noise functions matching `noise_type`
|
|
112
|
+
- Animate via `requestAnimationFrame` updating `u_time` uniform
|
|
113
|
+
|
|
114
|
+
#### Scroll Effects
|
|
115
|
+
- **Parallax**: Use `transform: translateY()` with scroll offset × layer speed
|
|
116
|
+
- **Scroll-triggered**: Use `IntersectionObserver` with `threshold` array
|
|
117
|
+
- **Scrub behavior**: If "scrubbed", animation progress = scroll progress. If "triggered", play once on enter.
|
|
118
|
+
|
|
119
|
+
#### Text Effects
|
|
120
|
+
```
|
|
121
|
+
"split-letter-animate" → Split text into <span> per char/word, stagger CSS animation
|
|
122
|
+
"typewriter" → CSS steps() or JS interval revealing chars
|
|
123
|
+
"glitch" → Layered clip-path + color offset animation
|
|
124
|
+
"gradient-fill" → background-clip: text with animated gradient
|
|
125
|
+
"3d-extrude" → text-shadow stack or WebGL text geometry
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Cursor Effects
|
|
129
|
+
When `cursor_effects.enabled: true`:
|
|
130
|
+
- Hide default cursor: `cursor: none`
|
|
131
|
+
- Create custom cursor element following `pointermove`
|
|
132
|
+
- "magnetic-buttons": Apply transform pull on hover proximity
|
|
133
|
+
- "spotlight": Radial gradient mask following cursor
|
|
134
|
+
- "trail": Spawn fading elements on move
|
|
135
|
+
|
|
136
|
+
#### Glassmorphism / Neumorphism
|
|
137
|
+
```
|
|
138
|
+
"glass" → backdrop-filter: blur({blur_radius}); background: rgba(..., {transparency})
|
|
139
|
+
"neumorphic-light" → Dual box-shadow (light + dark offset) on light bg
|
|
140
|
+
"neumorphic-dark" → Dual box-shadow (inverted) on dark bg
|
|
141
|
+
"frosted-layers" → Stacked blur layers with varying opacity
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Canvas Drawings
|
|
145
|
+
When `canvas_drawings.enabled: true`:
|
|
146
|
+
- Initialize canvas with `width/height` matching container
|
|
147
|
+
- Use `draw_method` to select rendering approach
|
|
148
|
+
- Animate with `requestAnimationFrame`
|
|
149
|
+
- Handle `responsiveness` via ResizeObserver
|
|
150
|
+
|
|
151
|
+
#### SVG Animations
|
|
152
|
+
When `svg_animations.enabled: true`:
|
|
153
|
+
- "path-draw": Animate `stroke-dashoffset` from path length to 0
|
|
154
|
+
- "morph-shapes": Interpolate `d` attribute between two paths
|
|
155
|
+
- "stroke-animation": Animate stroke properties (dasharray, width, color)
|
|
156
|
+
|
|
157
|
+
### Fallback Strategy
|
|
158
|
+
|
|
159
|
+
Always implement the fallback defined in `overview.fallback_strategy`:
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
// Example: reduce to CSS on low-end devices
|
|
163
|
+
const prefersReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
164
|
+
const isLowEnd = navigator.hardwareConcurrency <= 2;
|
|
165
|
+
if (prefersReduced || isLowEnd) {
|
|
166
|
+
// Apply fallback: static CSS version, disable canvas/WebGL
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Output Format
|
|
171
|
+
|
|
172
|
+
Generate output as a single self-contained HTML file with inline CSS and JS (unless user specifies a framework). Include:
|
|
173
|
+
|
|
174
|
+
1. CSS custom properties block from `design_system` tokens
|
|
175
|
+
2. Component styles from `design_system.components` + `design_style`
|
|
176
|
+
3. Layout structure per `design_system.layout`
|
|
177
|
+
4. Content populated from user-provided content
|
|
178
|
+
5. Visual effects implemented per `visual_effects` specification
|
|
179
|
+
6. Animations/transitions if `design_system.motion.philosophy` is not "none"
|
|
180
|
+
7. Fallback handling for effects
|
|
181
|
+
|
|
182
|
+
For heavy effects requiring external libraries, load via CDN `<script>` tags:
|
|
183
|
+
```html
|
|
184
|
+
<!-- Three.js -->
|
|
185
|
+
<script type="importmap">{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js"}}</script>
|
|
186
|
+
|
|
187
|
+
<!-- GSAP -->
|
|
188
|
+
<script src="https://cdn.jsdelivr.net/npm/gsap@latest/dist/gsap.min.js"></script>
|
|
189
|
+
|
|
190
|
+
<!-- Lottie -->
|
|
191
|
+
<script src="https://cdn.jsdelivr.net/npm/lottie-web@latest/build/player/lottie.min.js"></script>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Quality Checks
|
|
195
|
+
|
|
196
|
+
Before delivering, verify:
|
|
197
|
+
- [ ] Every color in output traces back to DNA palette
|
|
198
|
+
- [ ] Font families match DNA specification
|
|
199
|
+
- [ ] Spacing rhythm matches DNA scale
|
|
200
|
+
- [ ] Border radius matches DNA shape tokens
|
|
201
|
+
- [ ] Overall mood matches `design_style.aesthetic.mood`
|
|
202
|
+
- [ ] Component patterns match DNA `components` descriptions
|
|
203
|
+
- [ ] Contrast ratios meet WCAG AA minimum (4.5:1 body text, 3:1 large text)
|
|
204
|
+
- [ ] Visual effects match `visual_effects` specification (type, technology, params)
|
|
205
|
+
- [ ] Fallback strategy is implemented for effects
|
|
206
|
+
- [ ] `prefers-reduced-motion` is respected
|
|
207
|
+
- [ ] No effects render when their `enabled` flag is `false`
|
|
208
|
+
- [ ] Canvas/WebGL contexts are properly sized and handle resize
|
|
209
|
+
- [ ] Animation loops use `requestAnimationFrame` (no `setInterval`)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: istm-design
|
|
3
|
+
description: Pick the right library for a given frontend task from a curated, opinionated list — numbers, OTP inputs, charts, command menus, virtualization, drag and drop, toasts, state, styling, and more. Only runs when explicitly invoked; it does not trigger on its own.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Picking The Right Library
|
|
8
|
+
|
|
9
|
+
A lookup skill. When invoked with a task ("I need toasts", "what should I use for drag and drop?"), match the task to the curated list below and recommend the library. These are deliberate, taste-driven picks — don't substitute alternatives outside this list unless the user asks for one or the task genuinely isn't covered.
|
|
10
|
+
|
|
11
|
+
## How to use this
|
|
12
|
+
|
|
13
|
+
1. **Identify the task**, not the library the user named. "I need to show a dropdown" is a UI-primitives task (base-ui), even if they asked about something else.
|
|
14
|
+
2. **Check what's already installed.** Look at `package.json` first. If the project already uses a listed library, use it. If it uses a competitor (e.g. react-window instead of Virtuoso), flag the recommendation but don't churn the dependency without being asked.
|
|
15
|
+
3. **Recommend one library**, state what it's for in one sentence, and install/wire it up if that's part of the request. Don't present a menu of options when the list has a clear answer.
|
|
16
|
+
4. If the task isn't covered by the list, say so explicitly and recommend from your own knowledge — but be clear you've left the curated list.
|
|
17
|
+
|
|
18
|
+
## The list
|
|
19
|
+
|
|
20
|
+
### UI components & primitives
|
|
21
|
+
|
|
22
|
+
| Task | Library |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| Unstyled, accessible UI components (dialogs, popovers, menus, selects…) | [base-ui](https://base-ui.com) |
|
|
25
|
+
| Command menus (⌘K palettes) | [cmdk](https://cmdk.paco.me) |
|
|
26
|
+
| Toasts / notifications | [Sonner](https://sonner.istmXkowal.ski) |
|
|
27
|
+
| One-time password / verification code inputs | [input-otp](https://input-otp.rodz.dev) |
|
|
28
|
+
| Customizable GUIs / control panels | [Leva](https://github.com/pmndrs/leva) — [dialkit](https://joshpuckett.me/dialkit) is an alternative |
|
|
29
|
+
|
|
30
|
+
### Motion & visuals
|
|
31
|
+
|
|
32
|
+
| Task | Library |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| General-purpose animation (springs, layout animations, enter/exit) | [motion](https://motion.dev) (Framer Motion) |
|
|
35
|
+
| Animating numbers (counters, prices, stats) | [NumberFlow](https://number-flow.barvian.me) |
|
|
36
|
+
| Animated text components | [torph](https://torph.lochie.me/) |
|
|
37
|
+
| 3D globes | [Cobe](https://cobe.vercel.app) |
|
|
38
|
+
| Dynamic OG images (HTML/CSS → SVG/PNG) | [Satori](https://github.com/vercel/satori) |
|
|
39
|
+
| Syntax highlighting | [shiki](https://shiki.style) |
|
|
40
|
+
|
|
41
|
+
Reach for motion when you need springs, layout animations, exit animations, or gesture-driven values. A simple hover or fade doesn't need it — plain CSS transitions are the right tool there.
|
|
42
|
+
|
|
43
|
+
### Charts
|
|
44
|
+
|
|
45
|
+
| Task | Library |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| Real-time / streaming charts | [Liveline](https://github.com/benjitaylor/liveline) |
|
|
48
|
+
| General charts (static or interactive dashboards) | [recharts](https://recharts.org) |
|
|
49
|
+
|
|
50
|
+
The split: if data points arrive live and the chart scrolls with time, use Liveline. Everything else is recharts.
|
|
51
|
+
|
|
52
|
+
### Interaction & performance
|
|
53
|
+
|
|
54
|
+
| Task | Library |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| Drag and drop | [dnd kit](https://dndkit.com) |
|
|
57
|
+
| Virtualization (long lists, large tables) | [Virtuoso](https://virtuoso.dev) |
|
|
58
|
+
|
|
59
|
+
### State & styling
|
|
60
|
+
|
|
61
|
+
| Task | Library |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| State management | [zustand](https://zustand.docs.pmnd.rs) |
|
|
64
|
+
| Constructing `className` strings conditionally | [clsx](https://github.com/lukeed/clsx) |
|
|
65
|
+
| Type-safe, variant-driven styling for Tailwind | [cva](https://cva.style) |
|
|
66
|
+
| Theme switching / dark mode (no flash on load) | [next-themes](https://github.com/pacocoursey/next-themes) |
|
|
67
|
+
|
|
68
|
+
The styling split: clsx for ad-hoc conditional classes; cva when a component has real variants (size, intent, state) that deserve a typed API. They compose — cva uses clsx-style inputs internally.
|
|
69
|
+
|
|
70
|
+
## Common mismatches to catch
|
|
71
|
+
|
|
72
|
+
- **Toasts built by hand or with a modal library** → Sonner exists for exactly this.
|
|
73
|
+
- **A `<div>`-based dropdown/dialog with manual focus handling** → base-ui, which handles accessibility, focus trapping, and dismissal.
|
|
74
|
+
- **Animating a number by re-rendering text** → NumberFlow handles digit transitions properly.
|
|
75
|
+
- **Rendering a 1,000+ row list directly** → Virtuoso before reaching for pagination hacks.
|
|
76
|
+
- **A `useState`-per-component web of props for shared state** → zustand.
|
|
77
|
+
- **Template-literal className ternaries three conditions deep** → clsx (or cva if it's variant-shaped).
|