Re: [csswg-drafts] [css-transitions] Transition to height (or width) "auto" (#626)

> `calc-size()` is a math function, but does not have a resolved type (it's an intrinsic length, which is only allowed by special permission in certain places; we'll explicitly add it to property grammars).

I wonder if this could be relaxed a bit, so e.g. if the basis is a `<length>`, then the `calc-size()` could have a length type? I'm assuming `calc-size(10px, 10deg)` is invalid BTW. `calc-size()` could also work with a `<number>` basis.

Then `calc-size()` could be (ab)used as a way to have a local variable, e.g. from https://github.com/w3c/csswg-drafts/issues/4673#issuecomment-574740884

```css
--is-tie: calc((1 - abs(sign(2*x - round(up, x) - round(down, x)))) * sign(round(up, x) - round(down, x)));
calc(round(x/2)*2 * var(--is-tie) + round(x) * (1 - var(--is-tie)));
```

could avoid polluting the cascade with a custom property as such:

```css
calc-size(
  calc((1 - abs(sign(2*x - round(up, x) - round(down, x)))) * sign(round(up, x) - round(down, x))),
  round(x/2)*2 * size + round(x) * size
);
```

Of course `x` could also be a complex expression, which would benefit from being able to nest a `calc-size()` as the 2nd argument of another `calc-size()`, and being able to use a different keyword to refer to each basis:

```css
calc-size(
  expr as --x,
  calc-size(
    calc((1 - abs(sign(2*--x - round(up, --x) - round(down, --x)))) * sign(round(up, --x) - round(down, --x))) as --is-tie,
    round(--x/2)*2 * --is-tie + round(--x) * --is-tie
  )
);
```

This may be too hacky and better addressed by a different feature, but just some thoughts.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/626#issuecomment-1866246160 using your GitHub account


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

Received on Thursday, 21 December 2023 13:30:22 UTC