- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Wed, 29 Jun 2022 19:43:39 +0000
- To: public-css-archive@w3.org
Put a slightly different way - the approach I'm taking (just multiply the value by the substituted variable) works for *everything* that acts like a "unit" should - can be added together, multiplied, etc. If you're wanting something that doesn't work under this approach, you're not wanting a "unit", but something more complex, and we should address that with a different method. For example, with your --fluid example, that can *mostly* be done as: ```css @property --fluid { syntax: "<length>"; initial: min(1vw, 1rem); inherits: true; } ``` This does not enforce the "no fluid lengths are ever allowed be less than `1rem` condition in your version, because that's not something you can reasonably apply at the individual-value level - it means that, say, `.01--fluid` and `calc(1--fluid / 100)` are very likely *not* equal (the first is much larger, instead). What you *want*, instead, is a way to clamp a value at an author-specified time, in a short readable fashion. Like, pretend for a moment that we have simple custom functions, like: ```css @custom-function --fluid(--value) { arg-syntax: --value "<number>"; result: clamp(1rem, var(--value) * 1vw, var(--value) * 1rem); } ``` *This* could work - you can say `width: --fluid(5);` and get a reasonable result, and importantly, there is *no expectation* that `calc(--fluid(1) + --fluid(2))` is equivalent to `--fluid(3)`, or that `calc(--fluid(.01) * 100)` is equivalent to `--fluid(1)`. These expressions are reasonable to be different values, so you don't have the same issues as a "unit" does. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7379#issuecomment-1170415284 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 29 June 2022 19:43:41 UTC