Re: [community-group] Conditional token values (#169)

In SD format:

```json
{
  "color": {
    "value": "#444",
    "value_hc": "#222"
  },
  "size": {
    "value": 24,
    "value_breakpoint-md": 32
  },
  "fontFamily": {
    "value": "Scto Grotesk",
    "value_lang-el": "Noto Sans",
    "value_lang-jp": "Noto Sans"
  }
}
```

In W3C token format, I'm not sure what the best would be. I could have the same naive approach:


```json
{
  "color": {
    "$value": "#444",
    "$value_hc": "#222"
  },
  "size": {
    "$value": "24px",
    "$value_breakpoint-md": "32px"
  },
  "fontFamily": {
    "$value": "Scto Grotesk",
    "$value_lang-el": "Noto Sans",
    "$value_lang-jp": "Noto Sans"
  }
}
```

Or one with an `$extraValues` that simplifies tooling support for such extra values, and also saves tool users from declaring the names of the custom value fields:

```json
{
  "color": {
    "$value": "#444",
    "$extraValues": [
      "high-contrast": "#222"
    ]
  },
  "size": {
    "$value": "24px",
    "$extraValues": [
      "breakpoint-md": "32px",
    ]
  },
  "fontFamily": {
    "$value": "Scto Grotesk",
    "$extraValues": [
      "lang-el": "Noto Sans",
      "lang-jp": "Noto Sans"
    ]
  }
}
```

Or this could technically be hosted under `$extensions` and be invisible for the token spec itself. Because the W3C spec has a wider range of consumers than SD, I wouldn't necessarily propose the same format, but I haven't yet given it enough thought to have an opinion.

-- 
GitHub Notification of comment by Sidnioulz
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/169#issuecomment-1371988605 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 5 January 2023 09:41:19 UTC