Re: [community-group] Split units and values in type definitions (#121)

I have some concerns regarding this proposal.

## It's simpler?

For the tool to parse it, yes perhaps, but it's making the value more complex by making it of type object.
I disagree that it's simpler: making the type more complex to address "complexity" of the string interpolation feels like a bad trade-off, considering how easy it is to the the string interpolation in this case.

## Objects in objects

If we make very simple token types object types (e.g. dimension, duration etc.), it means we get more instances where already composite type tokens will be allowed to contain nested objects:

```js
{
  shadow_token: {
    $value: {
      "xOffset": {
        "number": 0,
        // is unit required? can it be left out if number is 0?
      },
      "yOffset": {
        "number": 5,
        "unit": "px"
      }
    }
  }
}
```

## Multiple values

I have a small concern related to #239 which is actually quite a similar issue to this issue, the summary is whether we want to allow array values e.g. for shadows, animations, gradients/colors, to be layered within a single design token, as this is often conceptually a single "design decision". That issue doesn't have much feedback at all yet but if it were to be received positively, it would clash a bit with this proposal because both issues complicate the token `$value` type.

----

Summarizing, I feel like this proposal smells of over-engineering. I am not convinced that the benefits of splitting dimensions in syntax-tree like objects is worth it. The downsides are that tokens become more verbose/heavy, more complex (e.g. nested objects), less easy to author/read (if those are goals of the spec, to be debated).

My suggestion is to keep this open but to not push this forward until there is more of a consensus on the actual need of this to land in the spec. I just don't see the need right now.

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


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

Received on Monday, 9 September 2024 22:12:32 UTC