Helpers for working with Figma DTCG exports.
Figma writes a fully-resolved literal value into every $value and keeps the
alias relationship only under
$extensions["com.figma.aliasData"]["targetVariableName"] (e.g. hue/300,
accent, blue/600).
to_refs/1 rewrites those aliased tokens so their $value becomes a Jetons
{dot.path} reference. That lets Jetons.CSS emit cascading var()
references and re-resolve a token across modifier contexts, instead of baking
in the literal that happened to be active at export time.
Summary
Functions
Returns the {dot.path} reference for a token, or nil when it carries no
Figma alias.
Rewrites aliased leaf tokens in a decoded DTCG map.
Functions
Returns the {dot.path} reference for a token, or nil when it carries no
Figma alias.
@spec to_refs(map()) :: {map(), non_neg_integer()}
Rewrites aliased leaf tokens in a decoded DTCG map.
Returns {converted_map, count} where count is the number of $values
replaced. Tokens without aliasData, and $values that are already string
references, are left untouched — so the transform is idempotent and a
reference never clobbers an alpha-adjusted or otherwise computed literal.