[community-group] Reference composite type attributes individually (#148)

bheston has just created a new issue for https://github.com/design-tokens/community-group:

== Reference composite type attributes individually ==
The guidance doesn't specify whether individual attributes of a composite type can be referenced individually. I suspect the expectation is that they can't, but I'm not sure that's obvious from a tooling or authoring standpoint.

For instance, adapting the typography example:

```
{
  "type styles": {
    "base": {
      "$type": "typography",
      "$value": {
        "fontFamily": "Roboto",
        "fontSize": "14px",
        "fontWeight": "400",
        "letterSpacing": "0px",
        "lineHeight": "1"
      }
    },
    "heading": {
      "$type": "typography",
      "$value": {
        "fontFamily": "{type styles.base.fontFamily}",
        "fontSize": "18px",
        "fontWeight": "700",
        "letterSpacing": "{type styles.base.letterSpacing}",
        "lineHeight": "{type styles.base.lineHeight}"
      }
    }
  }
}
```

Or applying only a portion of a type definition to a downstream token, or referencing only the `width` or `color` of a `border`, etc.

This could be refactored to reference other non-composite tokens, but this format is more concise and may better represent how people think about their values, that is, in the context of a "base" usage with relative modifiers. For instance, with mathematical operations, the `heading` `fontSize` could be `{type styles.base.fontSize} + 4`.

Related, I see potential use for something like custom composite types discussed in #54 as well as something more functional as being discussed in #88. In both cases the models represent a set of attributes where only a few are referenced downstream, that is, the output values from some transformation.

I support explicitly declaring that aliases MAY resolve to individual composite type attributes. If for some reason that doesn't work, we should explicitly declare that they MAY NOT.

Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/148 using your GitHub account


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

Received on Tuesday, 21 June 2022 23:05:27 UTC