- From: Nico André via GitHub <sysbot+gh@w3.org>
- Date: Tue, 20 Aug 2024 15:39:13 +0000
- To: public-design-tokens-log@w3.org
I thought a lot about the issues you mention @doozMen, and I landed on the same conclusion: the json tree lacks data.
That said, the format specification aims for user-friendliness rather than ease of parsing when tradeoffs like this one shows up. I don't think we'll get the format to host the missing pieces.
BUT, we can still specify a mapping for allowed aliasing matches among tokens:
```ts
// Example with Border token
const borderTokenTypeMapping = {
_unionOf: [
{ _tokenType: borderTokenTypeName },
{
_mapOf: {
color: colorTokenTypeMapping,
style: strokeStyleTokenTypeMapping,
width: dimensionTokenTypeMapping,
},
},
],
} satisfies TokenTypesMapping;
```
[Full version of the code](https://github.com/nclsndr/design-tokens-tools/blob/main/packages/w3c-design-tokens-parser/src/definitions/tokenTypes.ts#L98-L222)
--
GitHub Notification of comment by nclsndr
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/236#issuecomment-2299162146 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 20 August 2024 15:39:14 UTC