-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Composite Token Composition #179
Comments
If built-in composite tokens cannot be modified, I'd recommend introducing
Strengths
Weaknesses
Example: TypographyValid Definitions{
one: {
$type: 'typography',
$value: {
fontFamily: "{alias.to.a.fontFamily}",
fontWeight: "{alias.to.a.fontWeight}",
fontSize: "{alias.to.a.dimension}",
letterSpacing: "{alias.to.a.dimension}",
lineHeight: "{alias.to.a.string}"
}
},
two: {
$type: 'typography-part',
$value: {
fontFamily: "{alias.to.a.fontFamily}",
fontWeight: "{alias.to.a.fontWeight}"
}
},
three: {
$type: 'typography-part',
$value: {
fontSize: "{alias.to.a.dimension}",
letterSpacing: "{alias.to.a.dimension}",
lineHeight: "{alias.to.a.string}"
}
}
}
Invalid Definitions{
four: {
$type: 'typography',
$value: {
foo: 42
}
},
five: {
$type: 'typography-part',
$value: {
foo: 42
}
},
six: {
$type: 'typography-part',
$value: {
}
}
}
|
FYI: My recent comment on #116 doesn't conflict with the primary topic of this issue, which is to support partial definition of composite tokens. The examples using an |
@CITguy the editors have reviewed this proposal. It's an interesting idea that could DRY up some token source files, but the level of complexity for vendors to implement is higher than we want to add to the spec at this time. Alias usage within a composite token will allow "parts" of a composite token to be reused across multiple composite tokens. It will require being more verbose than what you're proposing, but right now we believe the tradeoff in favor of clarity over brevity is where the spec needs to go.
|
Context
I'm in the process of defining some rather complex typography tokens that define responsive parameters (i.e., values may range from a min to a max, based on viewport/window width). Additionally, the min/max styles have to be defined for (currently) 10 text styles (heading1, headingN, subheadingLg, bodySm, etc.). To make things even more complex, there are three different font families that may be applied to each text style. And to top it all off, we need to be able to mix and match some of these combinations at will.
The issue
The problem I've run into is that I have to duplicate a LOT of composite properties in order to account for every possible combination of font + style + min/max. There are two things that would help with this.
typography
token properties), such that I can compose a complete token/style laterThis could generate the following Sass code after transformation:
$heading1: map.merge($type-base, $type-heading1-base)
$type-heading2
and$type-heading2-alt
Questions
#/type/base
qualify as a$type: "typography"
or would we need a different$type
?$type: 'object'
for the partial defs? (not sure how this would affect environment-specific transforms)$type: 'object'
essentially be a custom generic composite token?The text was updated successfully, but these errors were encountered: