@motion-script/core / applyTextDefaults
Function: applyTextDefaults()
applyTextDefaults(
node,props?):void
Defined in: runtime/builtin-context.ts:118
Apply text-style defaults to a text node, for each style key the author didn't
pass explicitly. Shared by Text and RichText's init.
Precedence per key, highest to lowest:
- explicit author prop (present in
props) — never overridden; - the node's
varianttypography preset, fromtheme.typography(registered by setTheme, looked up via getTypographyPreset); - the inherited TextStyleToken default from an ancestor
<DefaultTextStyle>; - the theme's
defaulttypography preset (theme.typography.default) — a project-wide base style applied with novariantor<DefaultTextStyle>required; (5. the node's own@propertydefault — already applied by the constructor.)
Assignment goes through the node's property setter, which runs the field's
registered mapper (so a preset/inherited fill: 'brand-500' is resolved
exactly as if the author had written it). props is the node's own
constructor props.
Parameters
node
props?
Record<string, unknown>
Returns
void