Re: [community-group] Proposal: changes to type: $dimension and type: $duration tokens (#244)

@romainmenke Those are all great points, thanks for raising. I was originally trying to solve for multiple things here, but agree that may be too big a change here:

- Tools may interpret units differently anyway (e.g. `10px == 1rem`). But to your point, the specification should still define these values because then it’s clear the tool doesn’t match the spec
- I was scared the review process of adding more units may take too long, and many other units hadn’t been been proposed.

But you address those nicely with the `vendor` addition proposal. I really like this version specifically for the following reasons:

```json
{
  "value": 10,
  "unit": "y",
  "vendor": "figma"
}
```

- I agree not using `$extensions` here because that is not part of the value, and shouldn’t affect interpretation of the value in every tool
- Having some sort of prefix in `unit` is dicey because it brings back string parsing/pattern matching that this PR tries to move away from that puts it back on tooling. Defining what a valid or invalid prefix is seems like a can of worms.
- The inclusion of `vendor` as an optional property is great because it “disables” unit validation in a sense, but without disabling it in every scenario.
- We also have other tokens (including @resource11’s upcoming proposal to the color format) where the addition of one object key changes the interpretation of the other values (it’s all one “value”)

Minor point: I would assume that if the following were provided:

```json
{
  "value": 10,
  "unit": "px",
  "vendor": "foobar"
}
```

This would NOT be interpreted as `px` as-defined by the spec. Because if, say, the intent was that it’s parsed as a `px` dimension by tooling by default, but a particular tool wants to convert it differently, then that’s the case where `$extensions` should be used instead (all tooling operates in a standard way, but in one particular tool, additional metadata overrides behavior). So am I correct in understanding `unit` + `vendor` = a unique unit that has no relation to any other?

-- 
GitHub Notification of comment by drwpow
Please view or discuss this issue at https://github.com/design-tokens/community-group/pull/244#issuecomment-2294863465 using your GitHub account


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

Received on Saturday, 17 August 2024 13:42:21 UTC