- From: nesquarx via GitHub <sysbot+gh@w3.org>
- Date: Thu, 31 Mar 2022 13:25:57 +0000
- To: public-design-tokens-log@w3.org
If alias and extends are token and group level keywords for the same
activity. Would it decrease or increase confusion to have a single keyword
for it?
On Tue, 29 Mar, 2022, 6:58 pm Joren Broekema, ***@***.***>
wrote:
>
> - 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?
>
> Yes to both those questions for me. Indeed, alias is the extends
> equivalent for a single token, or vice versa, extends is the alias
> equivalent for a token group. And yes, I think it makes sense to inherit
> the other properties, saves a lot of duplicate work I think.
>
> @TravisSpomer <https://github.com/TravisSpomer> with regards to your
> extension question, I would say we should follow something along the lines
> of what deepmerge <https://www.npmjs.com/package/deepmerge> does, which
> if I recall correctly is something along the lines of this:
>
> const obj1 = {
> group: {
> nested: {
> nestedValA: 'foo',
> nestedValB: 'qux',
> },
> val: 'bar',
> },};
>
> const obj2 = {
> group: {
> nested: {
> nestedValB: 'something',
> nestedValC: 'else',
> },
> },};
> // obj2 extends obj1 or aka obj2 deepmerges with obj1// so it becomesconst obj3 = {
> ...obj1,
> ...obj2,
> group: {
> ...obj1.group,
> ...obj2.group,
> nested: {
> ...obj1.group.nested,
> ...obj2.group.nested,
> },
> },}
> // which is equivalent toconst obj3 = {
> group: {
> nested: {
> nestedValA: 'foo', // obj1
> nestedValB: 'something', // obj2 override
> nestedValC: 'else', // obj2 override
> },
> val: 'bar', // obj 1
> },};
>
> I want to add however something to @c1rrus <https://github.com/c1rrus> 's
> comment:
>
> // makes this group behave as though it contained 2 tokens
>
> This is the right wording I think, I think it's up to design token tools,
> not the spec itself, to decide what to do with this $extends metadata:
>
> - Leave it as metadata
> - Hard-copy the super-group's (for a lack of a better term)
> properties/tokens into the group that extends it
>
> The reason why I'd leave it as meta-data is for example because I don't
> want to bloat my CSS Custom Properties with tokens that are just duplicates
> of tokens in the super-group from which it extends, but I do want to have
> the metadata in order to help consumers of my design tokens to understand
> where they need to look to find the token they need. Let me know if that
> makes sense or if I should elaborate on this further with examples.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/design-tokens/community-group/issues/116#issuecomment-1081872298>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEKS36B27HNE5ZR4LD4K4C3VCMAO3ANCNFSM5QI7I2JQ>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
--
GitHub Notification of comment by nesquarx
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/116#issuecomment-1084574717 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 31 March 2022 13:26:00 UTC