refactor(src-tokens): convert syntax to W3C DTCG format#14146
refactor(src-tokens): convert syntax to W3C DTCG format#14146
Conversation
|
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
There was a problem hiding this comment.
Pull request overview
Refactors the @esri/calcite-design-tokens source token JSON files to Tokens Studio’s preferred W3C DTCG format (switching type/value/description to $type/$value/$description) and updates the Style Dictionary build pipeline to read the new DTCG properties so generated outputs remain stable.
Changes:
- Convert core + semantic token sources to DTCG (
$type,$value,$description) without changing token names/values. - Update build utilities/transforms/filters/formatters to use
token.$type/token.$valueandtoken.original.$value. - Adjust Token Studio / Style Dictionary override logic to work with DTCG token shapes.
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/design-tokens/src/tokens/semantic/z-index.json | Convert semantic z-index tokens to DTCG keys. |
| packages/design-tokens/src/tokens/semantic/typography.json | Convert semantic typography tokens to DTCG keys (including nested values and extensions). |
| packages/design-tokens/src/tokens/semantic/space.json | Convert semantic spacing/space tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/semantic/size.json | Convert semantic size tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/semantic/shadow.json | Convert semantic shadow tokens to DTCG keys. |
| packages/design-tokens/src/tokens/semantic/opacity.json | Convert semantic opacity tokens to DTCG keys. |
| packages/design-tokens/src/tokens/semantic/font.json | Convert semantic font tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/semantic/corner-radius.json | Convert semantic corner-radius tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/semantic/container-size.json | Convert semantic container-size (breakpoint) tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/semantic/color/light.json | Convert semantic light color tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/semantic/color/dark.json | Convert semantic dark color tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/semantic/border.json | Convert semantic border tokens to DTCG keys. |
| packages/design-tokens/src/tokens/core/z-index.json | Convert core z-index tokens to DTCG keys. |
| packages/design-tokens/src/tokens/core/size.json | Convert core size tokens to DTCG keys. |
| packages/design-tokens/src/tokens/core/shadow.json | Convert core shadow tokens to DTCG keys. |
| packages/design-tokens/src/tokens/core/opacity.json | Convert core opacity tokens to DTCG keys. |
| packages/design-tokens/src/tokens/core/font.json | Convert core font tokens to DTCG keys and $description. |
| packages/design-tokens/src/tokens/core/container-size.json | Convert core container-size tokens to DTCG keys. |
| packages/design-tokens/src/tokens/core/$themes.json | Convert Tokens Studio theme metadata to DTCG keys. |
| packages/design-tokens/src/tokens/core/$metadata.json | Convert Tokens Studio metadata to DTCG keys. |
| packages/design-tokens/src/build/utils/token-types.ts | Update token-type helpers to use .$type. |
| packages/design-tokens/src/build/utils/output-references.ts | Update output reference logic to use .$type. |
| packages/design-tokens/src/build/utils/get-number-and-unit.ts | Update numeric parsing helper to prioritize .$value. |
| packages/design-tokens/src/build/transforms/value/px-to-rem.ts | Update px→rem transform to use .$type/.$value and simplify filter typing. |
| packages/design-tokens/src/build/transforms/value/merge-value.ts | Return token.$value from merge-value transform. |
| packages/design-tokens/src/build/transforms/value/ensure-type.ts | Use token.$type/token.$value for ensure-type transform. |
| packages/design-tokens/src/build/transforms/value/correct-prop-name.ts | Update corrected-prop-name transform to use .$type/.$value. |
| packages/design-tokens/src/build/transforms/value/correct-pretransform-value.ts | Update preprocessing correction transform to use .$type/.$value. |
| packages/design-tokens/src/build/transforms/value/correct-posttransform-value.ts | Update postprocessing correction transform to use .$type/.$value. |
| packages/design-tokens/src/build/transforms/name/include-plus-minus.ts | Update plus/minus name transform filtering to use .$type. |
| packages/design-tokens/src/build/preprocessors/store-same-value-theme-tokens.ts | Update themed token merge preprocessor to use .$value (partially). |
| packages/design-tokens/src/build/overrides/index.ts | Update built-in + Tokens Studio override transforms to manipulate .$type/.$value. |
| packages/design-tokens/src/build/format/typography.ts | Read unresolved typography values from token.original.$value. |
| packages/design-tokens/src/build/format/docs.ts | Serialize docs output using token.$value. |
| packages/design-tokens/src/build/filter/semantic.ts | Update semantic filter to use .$type. |
| packages/design-tokens/src/build/filter/global.ts | Update global filter to use .$type. |
| packages/design-tokens/src/build/filter/core.ts | Update core filter to use .$type. |
packages/design-tokens/src/build/transforms/name/include-plus-minus.ts
Outdated
Show resolved
Hide resolved
packages/design-tokens/src/build/preprocessors/store-same-value-theme-tokens.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 37 out of 38 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
packages/design-tokens/src/tokens/core/size.json:349
- Within
core.size.rem.0-875, there is still a nested legacy token object ("1": { "value": ..., "type": ... }). This breaks the stated goal of converting src tokens to DTCG and may be interpreted as an actual child token by Tokens Studio/Style Dictionary. Remove this nested legacy entry or convert it to valid DTCG (or rename if it was meant to be a grouping node).
"0-875": {
"1": {
"value": "1",
"type": "sizing",
"attributes": {
2c87be1 to
6bea949
Compare
for consistency and cleanliness
align with neighboring files
|
@isaacbraun Will the additional |
isaacbraun
left a comment
There was a problem hiding this comment.
LGTM!
Will the additional $s in front of the values, descriptions, and types be a problem for the doc site?
Yes, we will have to update all of those property references to support this change. Think we will have to coordinate the doc site PR merge with whenever the Tokens package with these changes releases to next.
|
We can wait on merging this then, but we should make an internal issue for the doc site side of things then. As for package releases, I'll defer to this convo, but I'm wondering if doc-site specific updates like this (that don't impact users directly) should be something other than refactors 🤔 |
Related Issue: #12089
Summary
Note: no final design token names or values are affected
$characters