- From: Stijn Willems via GitHub <sysbot+gh@w3.org>
- Date: Wed, 28 Aug 2024 06:38:58 +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) > > Beside this off-initial-topic answer, shouldn't we close this issue? Thanks for taking my off-topic suggestion into account. Your suggestion to have a mapping slightly slows down the parsing and at least for me is less readable but if this is possible is there an issue I can track to when this mapping description lands in the spec? -- GitHub Notification of comment by doozMen Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/236#issuecomment-2314439325 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 28 August 2024 06:38:59 UTC