- From: Ryan Johnson via GitHub <sysbot+gh@w3.org>
- Date: Wed, 21 Sep 2022 02:40:30 +0000
- To: public-design-tokens-log@w3.org
> for example :
>
> ```json
> {
> "type styles": {
> "heading-level-1": {
> "$type": "typography",
> "fontFamily": { "$value": "Roboto", "$type": "string" },
> "fontSize": { "$value": "42px" },
> "fontWeight": { "$value": 700 },
> "letterSpacing": { "$value": "0.1px" },
> "lineHeight": { "$value": 1.2 }
> }
> }
> }
> ```
The biggest problem I see with this example is that there's no clear differentiation between a composite _property_ and a group _token_. The basic rule for whether data is considered a Token is the presence of the `$value` property. Without an explicit `$value` for the composite token, given the algorithm for resolving `$type` inheritance from a group, the configuration above would result in 5 separate tokens (not 1 as probably intended) and 4 of them would resolve as `"$type": "typography"`.
The resolved tokens would be as follows...
```json
{
"type styles.heading-level-1.fontFamily": {
"$type": "string",
"$value": "Roboto"
},
"type styles.heading-level-1.fontSize": {
"$type": "typography",
"$value": "42px"
},
"type styles.heading-level-1.fontWeight": {
"$type": "typography",
"$value": 700
},
"type styles.heading-level-1.letterSpacing": {
"$type": "typography",
"$value": "0.1px"
},
"type styles.heading-level-1.lineHeight": {
"$type": "typography",
"$value": 1.2
}
}
```
--
GitHub Notification of comment by CITguy
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/148#issuecomment-1253135185 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 21 September 2022 02:40:32 UTC