Re: [community-group] Tokens group $extends property proposal (#116)

I like this proposal.

@TravisSpomer [described something similar that his team were doing](https://github.com/design-tokens/community-group/issues/97#issuecomment-1012458947) in the discussion in #97. That was essentially allowing references to groups as a shorthand for creating aliases to all its nested tokens in another group. However, there was no way to then selectively override or add to the reference group.

I think your `$extends` proposal can cover that use-case as well. For example:

```jsonc
{
  "original-group": {
    "token-1": {
      "$value": "#123456",
      "$type": "color"
    },
    "token-2": {
      "$value": "2rem",
      "$type": "dimension"
    }
  },

  "copied-group": {
    "$extends": "{original-group}"
    // makes this group behave as though it contained 2 tokens
    // called "token-1" and "token-2" which are aliases of
    // "{original-group.token-1}" and "{original-group.token-2}"
    // respectively
  },
  
  "overriding-group": {
    "$extends": "{original-group}",
    "token-2": {
      "$value": "5rem",
      "$type": "dimension"
    },
    
    // behaves as though there was another token
    // in this group called "token-1", which was a reference
    // to "{original-group.token-1}"
  }
}
```

There are some details that need to worked out though:

* Presumably `$extends` can only be used on groups and must be a reference to another group, right? Extending tokens doesn't make sense to me (how would that be different to an alias token?)
* If group B extends group A, should B also inherit properties from A like `$description`, `$type`, etc.?

Thoughts?

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


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

Received on Monday, 21 March 2022 00:12:15 UTC