Type styles travel whole.
A type style is a collection of properties — family, size,
weight, line-height, tracking. typography() makes it
one token, the W3 typography composite, so it sits in
a scope next to everything else. Its fields are tracked in the
graph like any rule's: a ref() carries the whole
style, ref('type.heading.fontSize') reads one field.
Renderers write a variable per field and a CSS class for the
browser, a $type: 'typography' token for the W3
Design Tokens spec.
type.set('heading', typography({
fontFamily: ref('fonts.serif'),
fontSize: rem(2.5),
fontWeight: '700',
lineHeight: 1,
letterSpacing: '-0.02em',
}));
// a variant reads the rest from its base, live
type.set('hero', variant(
ref('type.heading'),
{ fontSize: rem(4) },
));
// one field, anywhere
callout.set('size', ref('type.heading.fontSize'));