Re: [community-group] How to do tokens that share a name with a group (#97)

Going slightly (more) off-topic, it occurs to me that it might be nice to for "bare" references to also be usable as a shorthand for creating alias tokens. For example:

```jsonc
{
  "some-group": {
    "original-token": {
      "value": "2rem",
      "type": "dimension"
    }
  },

  // What we already know and love...
  "long-hand-alias": {
    "value": "{some-group.original-token}"
  },

  // ...could be equivalent to:
  "short-hand-alias": "{some-group.original-token}"
}
```

However, then we'd still need to find a way to reference groups. So maybe there's a slight extension to the reference syntax to allow that:

```jsonc
{
  "neutralcontrol": {
    "foreground": {
      "_type": "color",
      "_default": { "_value": "#..." },
      "hover": { "_value": "#..." },
      "pressed": { "_value": "#..." },
      "disabled": { "_value": "#..." }
    }
  },
  
  "button": {
    "text": {
      "color": "{neutralcontrol.foreground.*}" // notice the .* at the end!

      // and the above is basically a short-hand for doing this:
      "color-longhand": {
        "_default": { "_value": "{neutralcontrol.foreground}" },
        "hover": { "_value": "{neutralcontrol.foreground.hover}" },
        "pressed": { "_value": "{neutralcontrol.foreground.pressed}" },
        "disabled": { "_value": "{neutralcontrol.foreground.disabled}" }
      }
    }
  }
}
```

Probably none of this stuff will be in our initial spec, but the more I think about it, the more I'd like something like this to be possible in the future!

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


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

Received on Thursday, 13 January 2022 23:45:08 UTC