feat: add motion tokens (spring, easing, duration)#4922
feat: add motion tokens (spring, easing, duration)#4922adrcotfas wants to merge 9 commits into@adrcotfas/refactor/tokens_typographyfrom
Conversation
Adds src/theme/tokens/sys/color/roles.ts with a roleToTone table keyed by (mode, contrast) and a buildScheme() function. LightTheme and DarkTheme replace their hand-duplicated color literals with a single buildScheme() call each. Output shape is identical; tone values match the existing hand-written spec.
|
Hey @adrcotfas, thank you for your pull request 🤗. The documentation from this branch can be viewed here. |
|
The mobile version of example app from this branch is ready! You can see it here. |
Adds the 10 MD3 shape scale tokens to theme.shapes.*, ShapeCorners for directional variants, and cornersToStyle() for mapping to RN style props. Deprecates theme.roundness in favour of theme.shapes.
Adds 15 *Emphasized entries per M3 Design Kit: Display/Headline/TitleLarge/Body use Medium (500), TitleMedium/TitleSmall/Label use Bold (700). Adds weightBold to ref.typeface. Fixes displayLarge letterSpacing (0 -> -0.25) and bodyLarge letterSpacing (0.15 -> 0.5).
919f3be to
8ce4e46
Compare
Adds theme.motion with two preset schemes (expressiveMotion default, standardMotion), M3 easing curves, and duration constants verified against the material.io spec. Includes toRawSpring() helper to convert the spec damping ratio to the raw coefficient expected by Animated.spring and Reanimated. Deprecates animation.defaultAnimationDuration in favour of theme.motion.duration.*. No component consumes the tokens yet.
520d21e to
f1e1cf1
Compare
satya164
left a comment
There was a problem hiding this comment.
No components are using this, so I assume it'll be a follow-up.
| /** @deprecated Use `theme.motion.duration.*` instead. Will be removed in a future version. */ | ||
| defaultAnimationDuration?: number; |
There was a problem hiding this comment.
Drop deprecated values from theme.
| expressiveMotion, | ||
| standardMotion, | ||
| toRawSpring, | ||
| } from './theme/tokens/sys/motion'; |
There was a problem hiding this comment.
Remove these exports. Keep the public API surface small.
| legacy: [0.4, 0, 0.2, 1], | ||
| legacyAccelerate: [0.4, 0, 1, 1], | ||
| legacyDecelerate: [0, 0, 0.2, 1], |
There was a problem hiding this comment.
Do we need to expose these? If these are legacy, then probably nothing on paper will use them, nor should consumers use them, so they're essentially dead tokens.
There was a problem hiding this comment.
Indeed, these were used pre M3 Expressive and we can drop them.
8ce4e46 to
c4dc2f1
Compare
Motivation
Adds theme.motion with two preset schemes (expressiveMotion default, standardMotion), M3 easing curves, and duration constants verified against the material.io spec. Includes toRawSpring() helper to convert the spec damping ratio to the raw coefficient expected by Animated.spring and Reanimated. Deprecates animation.defaultAnimationDuration in favour of theme.motion.duration.*. No component consumes the tokens yet.
Related issue
See https://www.notion.so/callstack/React-Native-Paper-Foundation-for-MD3-Expressive-34c5d027c0f880edba3df107cd35946f?source=copy_link
Merge order:
Test plan
yarn typescript-- no new type errorsyarn test-- all tests pass