Skip to content

Commit 4d02e94

Browse files
committed
fix(docs): the motion guide's knob list names its style; drop an unneeded assertion
The motion guide's new list block names style 'unordered', which the reference doc type requires, and completeMotion reads tempo and character without a type assertion.
1 parent e8d68d0 commit 4d02e94

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎packages/cli/assets/docs/motion.doc.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ const styles = stylex.create({
153153
},
154154
{
155155
type: 'list',
156+
style: 'unordered',
156157
items: [
157158
"`tempo` scales every motion duration: 1 is Astryx's own, 0.75 the quickest and 1.5 the slowest (values outside are clamped).",
158159
"`character` sets how lively motion is: `'crisp'` decelerates without overshoot, `'standard'` is Astryx's own, and `'expressive'` overshoots slightly on entrances and moves. Exits and fades never overshoot.",

‎packages/core/src/theme/themeAdaptations.ts‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -578,19 +578,17 @@ function completeMotion(
578578
rule: Partial<MotionScaleConfig> & ThemeMotionKnobs,
579579
path: string,
580580
): ThemeMotionConfig {
581-
if ((rule as ThemeMotionKnobs).reducedMotion !== undefined) {
581+
if (rule.reducedMotion !== undefined) {
582582
throw new Error(
583583
`${path}.reducedMotion is a theme-wide setting: set it on the theme's own ` +
584584
`motion, not in an adaptation rule.`,
585585
);
586586
}
587+
const tempo = rule.tempo ?? root?.tempo;
588+
const character = rule.character ?? root?.character;
587589
const knobs: ThemeMotionKnobs = {
588-
...((rule.tempo ?? root?.tempo) !== undefined
589-
? {tempo: (rule.tempo ?? root?.tempo) as number}
590-
: {}),
591-
...((rule.character ?? root?.character) !== undefined
592-
? {character: rule.character ?? root?.character}
593-
: {}),
590+
...(tempo !== undefined ? {tempo} : {}),
591+
...(character !== undefined ? {character} : {}),
594592
};
595593
if (knobs.tempo !== undefined) {
596594
assertFiniteNumber(knobs.tempo, `${path}.tempo`);

0 commit comments

Comments
 (0)