mobileui-os 1.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/AGENTS.md +47 -0
- package/CHANGELOG.md +25 -0
- package/README.md +78 -0
- package/bin/cli.mjs +375 -0
- package/knowledge/android/00-apple-to-android-adaption.md +1499 -0
- package/knowledge/android/accessibility.md +333 -0
- package/knowledge/android/components-controls.md +270 -0
- package/knowledge/android/material-design-3.md +174 -0
- package/knowledge/android/navigation-patterns.md +212 -0
- package/knowledge/apple/00-skill-reading-protocol.md +1296 -0
- package/knowledge/apple/Accessibility, Inclusive Design & Human Factors Intelligence.md +735 -0
- package/knowledge/apple/Advanced Interaction Patterns, Gestures, Feedback & State Transitions.md +1140 -0
- package/knowledge/apple/Advanced Navigation, Information Architecture & Wayfinding.md +551 -0
- package/knowledge/apple/Autonomus Ui-UX Improvement Loop.md +611 -0
- package/knowledge/apple/Color, Materials, Contrast, Themes & Visual Depth.md +1351 -0
- package/knowledge/apple/Content, Copy, Microinteractions & UX Communication.md +642 -0
- package/knowledge/apple/Data-Heavy Interfaces, Tables, Lists, Search, Filtering & Large-Scale Content.md +721 -0
- package/knowledge/apple/Design Systems & Component Architecture.md +412 -0
- package/knowledge/apple/Forms, Input, Data Entry & Validation Intelligence.md +705 -0
- package/knowledge/apple/Interaction, State & Edge-Case Engineering.md +491 -0
- package/knowledge/apple/Interaction-behaviour.md +1378 -0
- package/knowledge/apple/Layout Architecture, Responsive Design & Spatial Systems.md +1365 -0
- package/knowledge/apple/MASTER UI-UX ORCHESTRATOR.md +1210 -0
- package/knowledge/apple/Navigation Architecture, Routing, Deep Linking & State Restoration.md +1392 -0
- package/knowledge/apple/Navigation, Information Architecture & Spatial Hierarchy.md +1613 -0
- package/knowledge/apple/Notifications, Permissions, Privacy and Trust.md +1540 -0
- package/knowledge/apple/Patterns-templates-composition.md +647 -0
- package/knowledge/apple/Performance, Perceived Speed, Motion & Rendering Intelligence.md +855 -0
- package/knowledge/apple/Responsive, Adaptive & Cross-Platform UI Intelligence.md +669 -0
- package/knowledge/apple/Responsive, Adaptive, Accessible & Performant UI.md +545 -0
- package/knowledge/apple/Tablet Adaptation & Multi-Device UX.md +1447 -0
- package/knowledge/apple/UI Implementation & Refactoring.md +498 -0
- package/knowledge/apple/UI-UX Decision-Making, Prioritization & Trade-offs.md +533 -0
- package/knowledge/apple/UI-UX Project Lifecycle & Delivery.md +544 -0
- package/knowledge/apple/User Flows & Experience Architecture.md +335 -0
- package/knowledge/apple/Visual Design Systems, Theming, Tokens & Brand Intelligence.md +764 -0
- package/knowledge/apple/Visual QA, Testing & Validation.md +557 -0
- package/knowledge/apple/accessibility-inclusive-interaction.md +1361 -0
- package/knowledge/apple/accessibility.md +2162 -0
- package/knowledge/apple/color.md +1933 -0
- package/knowledge/apple/component-architecture.md +2208 -0
- package/knowledge/apple/components.md +2172 -0
- package/knowledge/apple/design-decision-framework.md +1883 -0
- package/knowledge/apple/design-review-engine.md +2108 -0
- package/knowledge/apple/design-tokens.md +1943 -0
- package/knowledge/apple/designing-for-ios.md +1680 -0
- package/knowledge/apple/gestures, touch behavior, feedback, motion, and micro-interactions.md +1538 -0
- package/knowledge/apple/hig-foundation.md +1806 -0
- package/knowledge/apple/iconography.md +1903 -0
- package/knowledge/apple/interaction-patterns.md +2513 -0
- package/knowledge/apple/interaction.md +2141 -0
- package/knowledge/apple/ios-alerts-confirmations-destructive-actions.md +1342 -0
- package/knowledge/apple/ios-components-and-controls.md +1634 -0
- package/knowledge/apple/ios-components-patterns.md +1343 -0
- package/knowledge/apple/ios-design-system-architecture.md +1520 -0
- package/knowledge/apple/ios-empty-error-offline-states.md +1370 -0
- package/knowledge/apple/ios-empty-loading-error-recovery.md +1674 -0
- package/knowledge/apple/ios-forms-and-input.md +1458 -0
- package/knowledge/apple/ios-forms-input-data-entry.md +1308 -0
- package/knowledge/apple/ios-gestures-and-touch.md +1272 -0
- package/knowledge/apple/ios-lists-collections-and-data-display.md +1735 -0
- package/knowledge/apple/ios-loading-progress-async-states.md +1378 -0
- package/knowledge/apple/ios-materials-and-surfaces.md +1543 -0
- package/knowledge/apple/ios-motion-animation-transitions.md +1178 -0
- package/knowledge/apple/ios-navigation-and-information-architecture.md +1674 -0
- package/knowledge/apple/ios-navigation-user-flows-design-architecture.md +1195 -0
- package/knowledge/apple/ios-search-and-discovery.md +1456 -0
- package/knowledge/apple/ios-search-filtering-discovery.md +1402 -0
- package/knowledge/apple/ios-sheets-modals-popovers.md +1205 -0
- package/knowledge/apple/ios-typography-icons-visual-hierarchy.md +1431 -0
- package/knowledge/apple/layout.md +2331 -0
- package/knowledge/apple/media-centric-content-ui-patterns.md +1470 -0
- package/knowledge/apple/motion, transitions, physics, and animation language.md +1535 -0
- package/knowledge/apple/motion-and-animation.md +1698 -0
- package/knowledge/apple/motion.md +2087 -0
- package/knowledge/apple/navigation.md +2281 -0
- package/knowledge/apple/responsive-adaptive.md +2159 -0
- package/knowledge/apple/screen-architecture.md +2067 -0
- package/knowledge/apple/typography, Content Hierarchy & Readability.md +1411 -0
- package/knowledge/apple/typography.md +1802 -0
- package/knowledge/apple/ui-ux inteligence audit.md +106 -0
- package/knowledge/apple/visual-design-and-premium-ui.md +1555 -0
- package/knowledge/apple/visual-hierarchy-engine.md +1647 -0
- package/knowledge/apple/visual-materials.md +2189 -0
- package/package.json +53 -0
- package/principles/design-principles.md +37 -0
- package/principles/platform-principles.md +25 -0
- package/principles/ux-principles.md +16 -0
- package/references/official-links.md +11 -0
- package/skills/accessibility-engineer/SKILL.md +125 -0
- package/skills/analytics-engineer/SKILL.md +283 -0
- package/skills/animation-engineer/SKILL.md +316 -0
- package/skills/component-designer/SKILL.md +75 -0
- package/skills/component-library-engineer/SKILL.md +140 -0
- package/skills/component-library-ops/SKILL.md +155 -0
- package/skills/design-system/SKILL.md +77 -0
- package/skills/design-token-engineer/SKILL.md +203 -0
- package/skills/design-token-pipeline/SKILL.md +277 -0
- package/skills/device-lab-engineer/SKILL.md +387 -0
- package/skills/forms-engineer/SKILL.md +79 -0
- package/skills/internationalization-engineer/SKILL.md +256 -0
- package/skills/motion-designer/SKILL.md +77 -0
- package/skills/native-data-fetching/SKILL.md +50 -0
- package/skills/navigation-architect/SKILL.md +65 -0
- package/skills/performance-engineer/SKILL.md +250 -0
- package/skills/platform-specialist/SKILL.md +95 -0
- package/skills/pre-release-gate/SKILL.md +75 -0
- package/skills/screen-designer/SKILL.md +117 -0
- package/skills/security-engineer/SKILL.md +375 -0
- package/skills/skills.json +134 -0
- package/skills/testing-auditor/SKILL.md +62 -0
- package/skills/ui-architect/SKILL.md +86 -0
- package/skills/ui-implementer/SKILL.md +188 -0
- package/skills/ux-architect/SKILL.md +49 -0
- package/skills/ux-auditor/SKILL.md +52 -0
- package/skills/visual-auditor/SKILL.md +71 -0
- package/templates/audit-report.md +29 -0
- package/templates/design-tokens.ts +33 -0
- package/templates/screen-spec.md +61 -0
- package/workflows/new-screen.md +17 -0
- package/workflows/pre-release.md +21 -0
- package/workflows/redesign.md +14 -0
- package/workflows/ui-audit.md +22 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# Animation & Transition Engineer
|
|
2
|
+
|
|
3
|
+
Build performant, platform-native motion: shared elements, layout animations, spring physics, gesture-driven transitions.
|
|
4
|
+
|
|
5
|
+
## Core Principles
|
|
6
|
+
|
|
7
|
+
- **Motion communicates**: state, hierarchy, spatial continuity
|
|
8
|
+
- **Respect reduced motion**: `prefers-reduced-motion` → disable non-essential
|
|
9
|
+
- **60fps minimum**: 16.67ms/frame budget
|
|
10
|
+
- **Native driver**: Always use `useNativeDriver: true` (RN) / Compose `animate*AsState` / SwiftUI `.animation`
|
|
11
|
+
- **Interruptible**: Gestures can cancel/reverse mid-flight
|
|
12
|
+
- **Purposeful**: No decoration animation
|
|
13
|
+
|
|
14
|
+
## Platform Primitive Comparison
|
|
15
|
+
|
|
16
|
+
| Capability | React Native (Reanimated 3) | Compose | SwiftUI |
|
|
17
|
+
|------------|----------------------------|---------|---------|
|
|
18
|
+
| Spring | `withSpring()` | `animate*AsState(spring)` | `.spring()` |
|
|
19
|
+
| Timing | `withTiming()` | `animate*AsState(tween)` | `.easeInOut()` |
|
|
20
|
+
| Layout | `LayoutAnimation` / `Reanimated` `Layout` | `animateContentSize` / `SharedTransition` | `matchedGeometryEffect` |
|
|
21
|
+
| Gesture-driven | `useAnimatedGestureHandler` | `Modifier.pointerInput` | `.gesture()` |
|
|
22
|
+
| Shared element | `SharedTransition` (expo) | `SharedTransitionScope` | `matchedGeometryEffect` |
|
|
23
|
+
| Native thread | ✅ Worklets | ✅ Compose runtime | ✅ Render server |
|
|
24
|
+
|
|
25
|
+
## Shared Element Transitions
|
|
26
|
+
|
|
27
|
+
### Expo Router (Reanimated + Expo UI)
|
|
28
|
+
```tsx
|
|
29
|
+
// app/(tabs)/index.tsx
|
|
30
|
+
import { SharedTransition } from 'expo-ui/SharedTransition';
|
|
31
|
+
|
|
32
|
+
export default function Home() {
|
|
33
|
+
return (
|
|
34
|
+
<SharedTransition>
|
|
35
|
+
<FlashList
|
|
36
|
+
data={items}
|
|
37
|
+
renderItem={({ item }) => (
|
|
38
|
+
<SharedTransition.Item id={`item-${item.id}`}>
|
|
39
|
+
<Card item={item} />
|
|
40
|
+
</SharedTransition.Item>
|
|
41
|
+
)}
|
|
42
|
+
/>
|
|
43
|
+
</SharedTransition>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// app/detail/[id].tsx
|
|
48
|
+
export default function Detail({ localSearchParams }) {
|
|
49
|
+
return (
|
|
50
|
+
<SharedTransition>
|
|
51
|
+
<SharedTransition.Item id={`item-${localSearchParams.id}`}>
|
|
52
|
+
<DetailContent item={item} />
|
|
53
|
+
</SharedTransition.Item>
|
|
54
|
+
</SharedTransition>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Compose (Material3 SharedTransition)
|
|
60
|
+
```kotlin
|
|
61
|
+
@Composable
|
|
62
|
+
fun HomeScreen(navController: NavController) {
|
|
63
|
+
SharedTransitionScope {
|
|
64
|
+
LazyColumn {
|
|
65
|
+
items(items) { item ->
|
|
66
|
+
SharedTransitionItem(
|
|
67
|
+
key = "item-${item.id}",
|
|
68
|
+
navController = navController,
|
|
69
|
+
destinationRoute = "detail/${item.id}"
|
|
70
|
+
) { progress ->
|
|
71
|
+
Card(item = item, progress = progress)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@Composable
|
|
79
|
+
fun DetailScreen(item: Item, sharedTransition: SharedTransition) {
|
|
80
|
+
SharedTransitionItem(
|
|
81
|
+
key = "item-${item.id}",
|
|
82
|
+
progress = sharedTransition.progress
|
|
83
|
+
) { progress ->
|
|
84
|
+
DetailContent(item = item, progress = progress)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### SwiftUI (matchedGeometryEffect)
|
|
90
|
+
```swift
|
|
91
|
+
@Namespace private var namespace
|
|
92
|
+
|
|
93
|
+
// List
|
|
94
|
+
LazyVStack {
|
|
95
|
+
ForEach(items) { item in
|
|
96
|
+
NavigationLink(value: item) {
|
|
97
|
+
Card(item: item)
|
|
98
|
+
.matchedGeometryEffect(id: "item-\(item.id)", in: namespace)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Detail
|
|
104
|
+
DetailView(item: item)
|
|
105
|
+
.navigationTransition(.zoom(sourceID: "item-\(item.id)", in: namespace))
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Layout Animations
|
|
109
|
+
|
|
110
|
+
### React Native (LayoutAnimation)
|
|
111
|
+
```tsx
|
|
112
|
+
import { LayoutAnimation, UIManager } from 'react-native';
|
|
113
|
+
|
|
114
|
+
UIManager.setLayoutAnimationEnabledExperimental?.(true);
|
|
115
|
+
|
|
116
|
+
function animateLayout() {
|
|
117
|
+
LayoutAnimation.configureNext({
|
|
118
|
+
duration: 300,
|
|
119
|
+
create: { type: LayoutAnimation.Types.spring, property: LayoutAnimation.Properties.scaleXY },
|
|
120
|
+
update: { type: LayoutAnimation.Types.spring },
|
|
121
|
+
delete: { type: LayoutAnimation.Types.easeInEaseOut, property: LayoutAnimation.Properties.opacity },
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Usage: state change triggers layout recalc
|
|
126
|
+
const [items, setItems] = useState(initial);
|
|
127
|
+
const addItem = () => {
|
|
128
|
+
animateLayout();
|
|
129
|
+
setItems([...items, newItem]);
|
|
130
|
+
};
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Reanimated Layout (More Control)
|
|
134
|
+
```tsx
|
|
135
|
+
import { Layout, withSpring } from 'react-native-reanimated';
|
|
136
|
+
|
|
137
|
+
<Layout
|
|
138
|
+
animation={withSpring({}, { damping: 20, stiffness: 150 })}
|
|
139
|
+
onLayout={({ nativeEvent }) => { /* custom */ }}
|
|
140
|
+
>
|
|
141
|
+
<Animated.View style={style} />
|
|
142
|
+
</Layout>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Compose (animateContentSize)
|
|
146
|
+
```kotlin
|
|
147
|
+
var expanded by remember { mutableStateOf(false) }
|
|
148
|
+
|
|
149
|
+
Column(
|
|
150
|
+
modifier = Modifier
|
|
151
|
+
.fillMaxWidth()
|
|
152
|
+
.animateContentSize(animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy))
|
|
153
|
+
) {
|
|
154
|
+
Text("Title")
|
|
155
|
+
AnimatedVisibility(expanded) {
|
|
156
|
+
Text("Long description...")
|
|
157
|
+
}
|
|
158
|
+
Button(onClick = { expanded = !expanded }) {
|
|
159
|
+
Text(expanded ? "Collapse" : "Expand")
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### SwiftUI (withAnimation)
|
|
165
|
+
```swift
|
|
166
|
+
@State private var expanded = false
|
|
167
|
+
|
|
168
|
+
VStack {
|
|
169
|
+
Text("Title")
|
|
170
|
+
if expanded {
|
|
171
|
+
Text("Long description...")
|
|
172
|
+
.transition(.opacity.combined(with: .move(edge: .top)))
|
|
173
|
+
}
|
|
174
|
+
Button(expanded ? "Collapse" : "Expand") {
|
|
175
|
+
withAnimation(.spring(dampingFraction: 0.7)) {
|
|
176
|
+
expanded.toggle()
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Gesture-Driven Transitions
|
|
183
|
+
|
|
184
|
+
### Reanimated 3 (Gesture Handler)
|
|
185
|
+
```tsx
|
|
186
|
+
import { useAnimatedGestureHandler, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
187
|
+
import { PanGestureHandler } from 'react-native-gesture-handler';
|
|
188
|
+
|
|
189
|
+
const translateX = useSharedValue(0);
|
|
190
|
+
|
|
191
|
+
const gesture = useAnimatedGestureHandler({
|
|
192
|
+
onStart: (_, ctx) => { ctx.startX = translateX.value; },
|
|
193
|
+
onActive: (event, ctx) => {
|
|
194
|
+
translateX.value = ctx.startX + event.translationX;
|
|
195
|
+
},
|
|
196
|
+
onEnd: (event) => {
|
|
197
|
+
const velocity = event.velocityX;
|
|
198
|
+
if (Math.abs(translateX.value) > 100 || Math.abs(velocity) > 500) {
|
|
199
|
+
translateX.value = withSpring(translateX.value > 0 ? 300 : -300, { velocity });
|
|
200
|
+
// Trigger navigation/dismiss
|
|
201
|
+
} else {
|
|
202
|
+
translateX.value = withSpring(0);
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<PanGestureHandler onGestureEvent={gesture}>
|
|
209
|
+
<Animated.View style={{ transform: [{ translateX }] }}>
|
|
210
|
+
<Card />
|
|
211
|
+
</Animated.View>
|
|
212
|
+
</PanGestureHandler>
|
|
213
|
+
);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Compose (pointerInput + Animatable)
|
|
217
|
+
```kotlin
|
|
218
|
+
val offsetX = remember { Animatable(0f) }
|
|
219
|
+
|
|
220
|
+
Box(
|
|
221
|
+
modifier = Modifier
|
|
222
|
+
.fillMaxSize()
|
|
223
|
+
.pointerInput(Unit) {
|
|
224
|
+
detectDragGestures(
|
|
225
|
+
onDragStart = { offsetX.stop() },
|
|
226
|
+
onDrag = { change, _ ->
|
|
227
|
+
change.consume()
|
|
228
|
+
offsetX.snapTo(offsetX.value + change.positionChange().x)
|
|
229
|
+
},
|
|
230
|
+
onDragEnd = {
|
|
231
|
+
val velocity = it.velocity.x
|
|
232
|
+
if (abs(offsetX.value) > 100.dp || abs(velocity) > 500.dp/s) {
|
|
233
|
+
offsetX.animateTo(
|
|
234
|
+
targetValue = if (offsetX.value > 0) 300.dp else -300.dp,
|
|
235
|
+
initialVelocity = velocity,
|
|
236
|
+
animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy)
|
|
237
|
+
)
|
|
238
|
+
// Navigate/dismiss
|
|
239
|
+
} else {
|
|
240
|
+
offsetX.animateTo(0f, spring())
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
.graphicsLayer { translationX = offsetX.value }
|
|
246
|
+
) {
|
|
247
|
+
Card()
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Spring Physics Reference
|
|
252
|
+
|
|
253
|
+
| Platform | Config | Use Case |
|
|
254
|
+
|----------|--------|----------|
|
|
255
|
+
| **Gentle** | damping: 20, stiffness: 150 | Default UI transitions |
|
|
256
|
+
| **Bouncy** | damping: 15, stiffness: 180 | Delightful, attention |
|
|
257
|
+
| **Snappy** | damping: 25, stiffness: 250 | Fast, precise |
|
|
258
|
+
| **Critically damped** | damping: 2*sqrt(stiffness) | No overshoot, loading |
|
|
259
|
+
|
|
260
|
+
### Reanimated Spring Presets
|
|
261
|
+
```ts
|
|
262
|
+
export const springs = {
|
|
263
|
+
gentle: { damping: 20, stiffness: 150 },
|
|
264
|
+
bouncy: { damping: 15, stiffness: 180 },
|
|
265
|
+
snappy: { damping: 25, stiffness: 250 },
|
|
266
|
+
default: { damping: 20, stiffness: 150 },
|
|
267
|
+
} as const;
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Reduced Motion
|
|
271
|
+
|
|
272
|
+
### React Native
|
|
273
|
+
```tsx
|
|
274
|
+
import { useReducedMotion } from 'expo-ui'; // or custom hook
|
|
275
|
+
|
|
276
|
+
const reduceMotion = useReducedMotion();
|
|
277
|
+
|
|
278
|
+
const animation = reduceMotion
|
|
279
|
+
? withTiming(1, { duration: 0 }) // Instant
|
|
280
|
+
: withSpring(1, springs.gentle);
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Compose
|
|
284
|
+
```kotlin
|
|
285
|
+
val reduceMotion = LocalReduceMotion.current
|
|
286
|
+
val spec = if (reduceMotion) spring(dampingRatio = 1e10) else spring()
|
|
287
|
+
animateFloatAsState(target, animationSpec = spec)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### SwiftUI
|
|
291
|
+
```swift
|
|
292
|
+
@Environment(\.accessibilityReduceMotion) var reduceMotion
|
|
293
|
+
|
|
294
|
+
withAnimation(reduceMotion ? .none : .spring()) {
|
|
295
|
+
// ...
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Performance Rules
|
|
300
|
+
|
|
301
|
+
1. **Native driver only**: `useNativeDriver: true` / Compose `animate*AsState` / SwiftUI built-in
|
|
302
|
+
2. **No layout thrashing**: Animate `transform`, `opacity` — not `width`, `height`, `top`, `left`
|
|
303
|
+
3. **Batch reads/writes**: `useAnimatedReaction`, `runOnUI`
|
|
304
|
+
4. **Cancel on unmount**: Cleanup in `useEffect` / `DisposableEffect` / `.onDisappear`
|
|
305
|
+
5. **Profile**: `why-did-you-render`, Flipper Reanimated plugin, Xcode Core Animation
|
|
306
|
+
|
|
307
|
+
## Testing Checklist
|
|
308
|
+
|
|
309
|
+
- [ ] 60fps on mid-range device (iPhone SE / Pixel 7a)
|
|
310
|
+
- [ ] Reduced motion: all non-essential animation disabled
|
|
311
|
+
- [ ] Interruptible: gesture can reverse mid-flight
|
|
312
|
+
- [ ] Shared element: no flash, correct sizing
|
|
313
|
+
- [ ] Layout animation: no jank on insert/delete/reorder
|
|
314
|
+
- [ ] Spring: no overshoot on critical paths (or intentional)
|
|
315
|
+
- [ ] Memory: no leaks after 50 transitions
|
|
316
|
+
- [ ] Platform feel: iOS = springy, Android = snappy
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Component Designer
|
|
2
|
+
|
|
3
|
+
Create components from repeated semantics, not arbitrary visual fragments.
|
|
4
|
+
|
|
5
|
+
## Required Definition (Every Component)
|
|
6
|
+
|
|
7
|
+
| Property | Description |
|
|
8
|
+
|----------|-------------|
|
|
9
|
+
| **Purpose** | What user problem does this solve? When to use vs. alternatives? |
|
|
10
|
+
| **Anatomy** | Parts: container, label, icon, indicator, action area, helper text |
|
|
11
|
+
| **Variants** | Primary, secondary, tertiary, destructive, ghost, tonal (with token mapping) |
|
|
12
|
+
| **Sizes** | sm, md, lg (touch target, typography, padding scale) |
|
|
13
|
+
| **States** | Default, hover, pressed, focused, disabled, loading, error, selected |
|
|
14
|
+
| **Interaction** | Tap, long press, drag, keyboard, swipe, gesture response |
|
|
15
|
+
| **Accessibility** | Role, label, hint, state announcements, focus management |
|
|
16
|
+
| **Content Limits** | Max lines, truncation, character limits, overflow behavior |
|
|
17
|
+
| **Responsive** | Compact, regular, large; portrait/landscape; split view |
|
|
18
|
+
| **Platform Differences** | iOS vs Android: shape, elevation, icon, gesture, sheet style |
|
|
19
|
+
|
|
20
|
+
## Variant Token Mapping
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// Example: Button
|
|
24
|
+
variants: {
|
|
25
|
+
primary: {
|
|
26
|
+
background: 'color.primaryAction',
|
|
27
|
+
label: 'color.onPrimaryAction',
|
|
28
|
+
border: 'none',
|
|
29
|
+
pressed: 'color.primaryActionPressed',
|
|
30
|
+
},
|
|
31
|
+
secondary: {
|
|
32
|
+
background: 'color.secondaryAction',
|
|
33
|
+
label: 'color.onSecondaryAction',
|
|
34
|
+
border: 'color.outline',
|
|
35
|
+
pressed: 'color.secondaryActionPressed',
|
|
36
|
+
},
|
|
37
|
+
destructive: {
|
|
38
|
+
background: 'color.errorAction',
|
|
39
|
+
label: 'color.onErrorAction',
|
|
40
|
+
pressed: 'color.errorActionPressed',
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## State Matrix
|
|
46
|
+
|
|
47
|
+
| State | Visual | Interaction | A11y |
|
|
48
|
+
|-------|--------|-------------|------|
|
|
49
|
+
| Default | Base tokens | Enabled | Announced |
|
|
50
|
+
| Hover | Elevation +2, color shift | Cursor/pointer | — |
|
|
51
|
+
| Pressed | Scale 0.98, color deepen | Active | — |
|
|
52
|
+
| Focused | Ring (3px, primary) | Keyboard trap | Announced |
|
|
53
|
+
| Disabled | Opacity 0.38, no shadow | Non-interactive | `aria-disabled` |
|
|
54
|
+
| Loading | Spinner, label "Loading…" | Non-interactive | `aria-busy` |
|
|
55
|
+
| Error | Border error, shake (reduced motion) | Enabled | `aria-invalid` + live region |
|
|
56
|
+
| Selected | Primary bg, check icon | Toggle | `aria-pressed` |
|
|
57
|
+
|
|
58
|
+
## Content Limits
|
|
59
|
+
|
|
60
|
+
- Label: 1 line (truncate with tooltip)
|
|
61
|
+
- Helper text: 2 lines max
|
|
62
|
+
- Icon: 20×20dp (16×16dp in compact)
|
|
63
|
+
- Touch target: 48×48dp minimum (visual can be smaller)
|
|
64
|
+
|
|
65
|
+
## Anti-Patterns
|
|
66
|
+
|
|
67
|
+
- Creating component for one-off visual
|
|
68
|
+
- Variants without semantic distinction
|
|
69
|
+
- Missing states (especially loading/error/disabled)
|
|
70
|
+
- Hardcoded values instead of tokens
|
|
71
|
+
- Platform-specific only components without abstraction
|
|
72
|
+
|
|
73
|
+
## Output
|
|
74
|
+
|
|
75
|
+
Component spec + Storybook stories (all variants × states) + a11y test + token mapping table.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Component Library Engineer
|
|
2
|
+
|
|
3
|
+
Operate a reusable component library: versioning, releases, documentation, consumption.
|
|
4
|
+
|
|
5
|
+
## Responsibilities
|
|
6
|
+
|
|
7
|
+
- Define component API contracts (props, variants, states)
|
|
8
|
+
- Automate releases with semantic versioning
|
|
9
|
+
- Generate and publish documentation (Storybook, MDX)
|
|
10
|
+
- Manage peer dependencies (React Native, Expo, design tokens)
|
|
11
|
+
- Enforce breaking change policy
|
|
12
|
+
- Provide migration guides
|
|
13
|
+
|
|
14
|
+
## Versioning Strategy
|
|
15
|
+
|
|
16
|
+
| Change Type | Version Bump | Example |
|
|
17
|
+
|-------------|--------------|---------|
|
|
18
|
+
| Patch | `x.y.z+1` | Bug fix, a11y fix, token alias |
|
|
19
|
+
| Minor | `x.y+1.0` | New variant, new prop, new component (non-breaking) |
|
|
20
|
+
| Major | `x+1.0.0` | Removed prop, changed default, renamed component, token restructuring |
|
|
21
|
+
|
|
22
|
+
### Release Flow
|
|
23
|
+
```
|
|
24
|
+
main → changeset → version packages → publish → tag → docs deploy
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Component API Contract
|
|
28
|
+
|
|
29
|
+
Every component exports:
|
|
30
|
+
```typescript
|
|
31
|
+
// Component.tsx
|
|
32
|
+
export interface ComponentProps {
|
|
33
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
34
|
+
size?: 'sm' | 'md' | 'lg';
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
loading?: boolean;
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
onPress?: () => void;
|
|
39
|
+
accessibilityLabel?: string;
|
|
40
|
+
testID?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Component.stories.tsx (Storybook)
|
|
44
|
+
// Component.test.tsx (unit + a11y)
|
|
45
|
+
// Component.md (usage docs)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Breaking Change Policy
|
|
49
|
+
|
|
50
|
+
- **Never** remove props without major version
|
|
51
|
+
- **Never** change default behavior without major version
|
|
52
|
+
- **Deprecate** with `@deprecated` JSDoc + runtime warning (dev only)
|
|
53
|
+
- **Migration guide** required for every major release
|
|
54
|
+
|
|
55
|
+
## Documentation Standards
|
|
56
|
+
|
|
57
|
+
| Artifact | Tool | Required |
|
|
58
|
+
|----------|------|----------|
|
|
59
|
+
| Interactive playground | Storybook | Yes |
|
|
60
|
+
| Props table | Storybook Docs | Yes |
|
|
61
|
+
| Usage examples | MDX | Yes |
|
|
62
|
+
| Accessibility notes | MDX | Yes |
|
|
63
|
+
| Migration guide | MARKDOWN | Major only |
|
|
64
|
+
| Changelog | Changesets | Auto-generated |
|
|
65
|
+
|
|
66
|
+
## CI Gates
|
|
67
|
+
|
|
68
|
+
- [ ] TypeScript strict: pass
|
|
69
|
+
- [ ] Unit tests: 100% component coverage
|
|
70
|
+
- [ ] A11y tests: jest-axe pass
|
|
71
|
+
- [ ] Visual regression: 0 diffs
|
|
72
|
+
- [ ] Bundle size: within budget
|
|
73
|
+
- [ ] Docs build: pass
|
|
74
|
+
- [ ] Expo compatibility: verified
|
|
75
|
+
|
|
76
|
+
## Consumption
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
// package.json (consumer)
|
|
80
|
+
{
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"@my-org/ui-components": "^2.3.0",
|
|
83
|
+
"@my-org/design-tokens": "^1.1.0"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// Usage
|
|
90
|
+
import { Button, TextField } from '@my-org/ui-components';
|
|
91
|
+
import { spacing, color } from '@my-org/design-tokens';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Monorepo Structure
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
packages/
|
|
98
|
+
├── ui-components/ # React Native components
|
|
99
|
+
│ ├── src/
|
|
100
|
+
│ ├── stories/
|
|
101
|
+
│ ├── tests/
|
|
102
|
+
│ ├── package.json
|
|
103
|
+
│ └── tsconfig.json
|
|
104
|
+
├── design-tokens/ # Shared tokens
|
|
105
|
+
│ ├── tokens/
|
|
106
|
+
│ ├── transformers/ # Style Dictionary / Tokens Studio
|
|
107
|
+
│ └── package.json
|
|
108
|
+
├── docs/ # Storybook + site
|
|
109
|
+
└── eslint-config/ # Shared lint rules
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Release Automation
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
# .github/workflows/release.yml
|
|
116
|
+
on:
|
|
117
|
+
push:
|
|
118
|
+
branches: [main]
|
|
119
|
+
jobs:
|
|
120
|
+
release:
|
|
121
|
+
runs-on: ubuntu-latest
|
|
122
|
+
steps:
|
|
123
|
+
- uses: actions/checkout@v4
|
|
124
|
+
- uses: changesets/action@v1
|
|
125
|
+
with:
|
|
126
|
+
version: npm run version
|
|
127
|
+
publish: npm run release
|
|
128
|
+
- run: npm run build:docs && npm run deploy:docs
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Quality Metrics
|
|
132
|
+
|
|
133
|
+
| Metric | Target |
|
|
134
|
+
|--------|--------|
|
|
135
|
+
| Component test coverage | 100% |
|
|
136
|
+
| A11y violations | 0 |
|
|
137
|
+
| Bundle size (per component) | < 5KB gzipped |
|
|
138
|
+
| Storybook stories | ≥ 3 per component |
|
|
139
|
+
| Migration guide age | < 6 months |
|
|
140
|
+
| Open breaking issues | 0 |
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Component Library Engineer
|
|
2
|
+
|
|
3
|
+
Operate a versioned, documented, tested component library for cross-platform consumption.
|
|
4
|
+
|
|
5
|
+
## Responsibilities
|
|
6
|
+
|
|
7
|
+
- Versioning strategy (semver, breaking change policy)
|
|
8
|
+
- Changelog generation (conventional commits → release notes)
|
|
9
|
+
- Documentation site (Storybook, Docu, or custom)
|
|
10
|
+
- Release automation (CI → npm/GitHub Packages / Maven)
|
|
11
|
+
- Consumption guides (RN, Expo, Compose, SwiftUI, Web)
|
|
12
|
+
- Deprecation policy and migration tooling
|
|
13
|
+
- Bundle size tracking per version
|
|
14
|
+
- Peer dependency management (React, React Native, Expo SDK)
|
|
15
|
+
|
|
16
|
+
## Versioning
|
|
17
|
+
|
|
18
|
+
| Change | Version | Example |
|
|
19
|
+
|--------|---------|---------|
|
|
20
|
+
| Bug fix | Patch (1.0.1) | Fix button ripple on Android |
|
|
21
|
+
| New component/prop | Minor (1.1.0) | Add `Badge` component |
|
|
22
|
+
| Breaking API | Major (2.0.0) | Rename `onPress` → `onPressIn` |
|
|
23
|
+
|
|
24
|
+
### Breaking Change Checklist
|
|
25
|
+
- [ ] Migration guide written
|
|
26
|
+
- [ ] Codemod provided (jscodeshift)
|
|
27
|
+
- [ ] Deprecation warnings in prior minor
|
|
28
|
+
- [ ] 3-month overlap before removal
|
|
29
|
+
|
|
30
|
+
## Release Pipeline
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
# .github/workflows/release.yml
|
|
34
|
+
on:
|
|
35
|
+
push:
|
|
36
|
+
branches: [main]
|
|
37
|
+
jobs:
|
|
38
|
+
release:
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- uses: actions/setup-node@v4
|
|
43
|
+
- run: npm ci
|
|
44
|
+
- run: npm test
|
|
45
|
+
- run: npm run build
|
|
46
|
+
- run: npx semantic-release
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### semantic-release Config
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"branches": ["main"],
|
|
53
|
+
"plugins": [
|
|
54
|
+
"@semantic-release/commit-analyzer",
|
|
55
|
+
"@semantic-release/release-notes-generator",
|
|
56
|
+
"@semantic-release/npm",
|
|
57
|
+
"@semantic-release/github",
|
|
58
|
+
"@semantic-release/git"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Documentation (Storybook)
|
|
64
|
+
|
|
65
|
+
### Structure
|
|
66
|
+
```
|
|
67
|
+
stories/
|
|
68
|
+
Button/
|
|
69
|
+
Button.stories.tsx
|
|
70
|
+
Button.docs.mdx
|
|
71
|
+
Button.test.tsx
|
|
72
|
+
Button.a11y.test.tsx
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Required Per Component
|
|
76
|
+
- [ ] Canvas: all variants + states
|
|
77
|
+
- [ ] Controls: every prop documented
|
|
78
|
+
- [ ] Docs: usage, accessibility, platform notes
|
|
79
|
+
- [ ] Tests: visual regression, a11y, interaction
|
|
80
|
+
- [ ] Design token mapping table
|
|
81
|
+
|
|
82
|
+
### Storybook Config
|
|
83
|
+
```ts
|
|
84
|
+
// .storybook/main.ts
|
|
85
|
+
export default {
|
|
86
|
+
stories: ['../src/**/*.stories.@(ts|tsx)'],
|
|
87
|
+
addons: [
|
|
88
|
+
'@storybook/addon-essentials',
|
|
89
|
+
'@storybook/addon-a11y',
|
|
90
|
+
'@storybook/addon-interactions',
|
|
91
|
+
'storybook-addon-paddings', // spacing tokens
|
|
92
|
+
],
|
|
93
|
+
framework: '@storybook/react-native',
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Bundle Size Tracking
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Per component
|
|
101
|
+
npx bundlewatch --config bundlewatch.config.json
|
|
102
|
+
|
|
103
|
+
# bundlewatch.config.json
|
|
104
|
+
{
|
|
105
|
+
"files": [
|
|
106
|
+
{ "path": "dist/Button.js", "maxSize": "5kb" },
|
|
107
|
+
{ "path": "dist/index.js", "maxSize": "50kb" }
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Consumption Guides
|
|
113
|
+
|
|
114
|
+
### React Native / Expo
|
|
115
|
+
```bash
|
|
116
|
+
npm install @myorg/ui-components
|
|
117
|
+
```
|
|
118
|
+
```tsx
|
|
119
|
+
import { Button, Text } from '@myorg/ui-components';
|
|
120
|
+
import '@myorg/ui-components/styles.css'; // or nativewind
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Compose Multiplatform
|
|
124
|
+
```kotlin
|
|
125
|
+
// build.gradle.kts
|
|
126
|
+
implementation("com.myorg:ui-components-compose:1.0.0")
|
|
127
|
+
```
|
|
128
|
+
```kotlin
|
|
129
|
+
import com.myorg.ui.components.Button
|
|
130
|
+
import com.myorg.ui.components.Text
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### SwiftUI (via Expo UI / Native Modules)
|
|
134
|
+
```swift
|
|
135
|
+
// Package.swift
|
|
136
|
+
.package(url: "https://github.com/myorg/ui-components-swift", from: "1.0.0")
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Deprecation Workflow
|
|
140
|
+
|
|
141
|
+
1. Add `@deprecated` JSDoc + runtime warning
|
|
142
|
+
2. Publish minor with deprecation
|
|
143
|
+
3. Wait 3 months (2 minors)
|
|
144
|
+
4. Remove in next major
|
|
145
|
+
5. Provide codemod: `npx @myorg/codemods remove-deprecated`
|
|
146
|
+
|
|
147
|
+
## Quality Gates (Pre-Publish)
|
|
148
|
+
|
|
149
|
+
- [ ] TypeScript: `tsc --noEmit` passes
|
|
150
|
+
- [ ] Tests: 100% component coverage
|
|
151
|
+
- [ ] Visual: 0 regression diffs
|
|
152
|
+
- [ ] A11y: 0 violations
|
|
153
|
+
- [ ] Bundle: within budget
|
|
154
|
+
- [ ] Lint: 0 errors
|
|
155
|
+
- [ ] Docs: every component has story + docs
|