-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dimension type expanded unit types #245
Comments
I'm not sold on the If the idea is that The only other use I can imagine for such a property would be for design tools to optionally denote that the unit is platform specific... {
"value": 5,
"unit": "vh",
"vendor": "web"
} ...but for this approach to be useful, design tools would all need to be consistent in their usage of both |
No the If a vendor is prototyping a new unit and wants to already start using this in token files, then they can create their own This allows tool creators to ship features without needing to wait for the standard to catch up. But also without causing naming conflicts with other tools or the spec itself. We don't want multiple vendors coming up with multiple different definitions for Ideally this never happens and every vendor always goes through the standards process. Even if a vendor starts prototyping while going through the standards process it is still prudent to use the Alternatively a vendor might have a unit that only makes sense in their ecosystem. I would strongly urge tools not to do this. But if it does happen, then it is better to have an annotation as to who "owns" this non-standard unit. This has nothing to do with the platforms that values will be used on. A vendor might be |
@romainmenke thank you for the more in depth explanation.
How do you define a commonly needed unit? Are the spec authors open to standardizing platform specific units? My understanding was that there was a desire to keep the spec mostly platform agnostic. Additionally, this explanation makes it sound like option 3 in @drwpow's original post is not so much its own distinct option, rather its an additional detail that could be paired with option 1 or 2. It might be helpful to update that list for clarity.
I think you just outlined many of the reasons why browser's have moved away from using vendor prefixes for prototype implementations of new CSS features. "Nothing is more permanent than a temporary solution" as the saying goes. If the spec designate a new CSS spec implementers have solved this issue by shipping new implementations behind features flags in the end user environment (browsers). That approach works because CSS parsers are forgiving, they ignore lines they don't understand rather than throwing an error. I think a similar approach would be a better way to address prototype/pre-spec implementations. The spec can allow parsers/transformers to ignore invalid tokens. If a vendor wants to add a unit that isn't in the spec yet, they just use it in the |
This is difficult to talk about in the abstract. If you have a specific unit in mind, maybe better to open an issue for that? I think that most units will have a common idea that exists in each platform.
This only means that the list is well defined and that undefined units are invalid.
This is a nice idea but it does have very sharp edges.
Each time they get it wrong it requires shipping use counters to analyse what the impact would be of breaking changes. Each time they have to cross their fingers and hope that developers haven't used a feature too eagerly. The only browser that can effectively do this analysis is Chrome because of their oversized market share. You can't have tools shipping support for a unit You have to measure how much you will break and have some allowed margin that is deemed acceptable. A good example of this is : https://developer.chrome.com/blog/smooshgate I am not saying that vendor prefixes are a good solution. I think that token files are slightly different. A major issue on the web is that most websites aren't actively maintained. So a removal of a vendor prefixed CSS property is extremely risky. This is not true for token files.
In other words removing a tool specific unit can be handled much more easily and with much less dramatic impact that a property removal on the web. I am also not particularly in favor of a However I do think these things are important:
I think that a |
That's not the case with feature flags, which is how most new features are prototyped. Because enabling the feature flag requires an end user to change their browser's settings, developers have no way of guaranteeing they'll be supported in for any user (even those that are using whatever browser has implemented the prototype). Because of this, developers don't ship those features in production, with the exception of small features that only serve as progressive enhancements or those that can be polyfilled by the developer shipping additional code.
I agree that "unmaintained but still in use" will probably be a less common problem for token collections than it is for the web, but I wouldn't be surprised if it still happens. Open source projects where a maintainer becomes disinterested and corporate environments where resources get shuffled away from something that's "working fine" to something more pressing both spring to mind as ways this could happen.
It could, but I'd caution going down that route. Versioning the spec (as opposed to it being a backwards compatible living document) could cause a lot of churn for users. Two ways this manifests:
I realize breaking changes are already happening with things like
The latter is definitely already the case, and while the spec doesn't currently have a canonical method for the former, you could easily just use the file name to version them. The more things with versions numbers that are coupled, the harder it gets to have conversations without causing confusion. I believe that's one of the reasons docker has moved away from versioning the compose file format. I'm starting to feel like maybe I'm getting a little bit off in the weeds now though as this is probably tangential to the original issue. I'll try to reign it back in,
Totally agree with the mentality. I think all three of these goals can be achieved with option 2 from the original post:
I think the key with that approach will be spec authors being receptive to various platform needs in a timely and cooperative manner. |
In response to opening up
$type: dimension
tokens units and allow more thanpx
andrem
, there are 4 paths forward:px
andrem
forever.@romainmenke made an excellent argument against 4. And instead proposed a path forward for 3: keep the current list of valid units restricted, but add an escape hatch to allow vendor-specific units where needed. The following describes that escape hatch:
We should have a fixed set of specified units and allow any other unit as long as it is vendor prefixed.
Then there can't be conflicts between tools as those would be different vendors.
There also can't be conflicts between tools and future spec expansion.
It still leaves plenty of room for custom definitions.
Keep in mind that design token files are a carrier format.
How a unit is encoded in a file doesn't dictate how it is exposed in a design tool or the final output for developers.
Figma can create a custom unit
y
that is exposed to designers asy
and output to developers asy
while encoding it asfigma-y
in token files.If a custom, vendor prefixed, unit is popular and gains adoption among other tools it is also a clear signal that it is useful. Such a custom unit should then go through the spec process to standardize it.
Instead of
figma-y
as the encoded unit it could also be a separate prop.Originally posted by @romainmenke in #244 (comment)
The text was updated successfully, but these errors were encountered: