w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.48k stars 659 forks source link

[css-values-5] Syntax of progress() vs mix() functions #10489

Open fantasai opened 4 months ago

fantasai commented 4 months ago

We currently have the progress() functions defined like

progress(<value> from <start> to <end>)

but the mix() functions are defined like

mix(<progress>, <start>, <end>)

Would it make sense to align these a bit more, e.g.

mix(<progress> of <start> to <end>)

?

fantasai commented 2 weeks ago

The other option (see discussion in https://github.com/w3c/csswg-drafts/issues/10862) would be to align on commas.

css-meeting-bot commented 2 weeks ago

The CSS Working Group just discussed [css-values-5] Receive comma-separated arguments in `*-progress()`, and agreed to the following:

The full IRC log of that discussion <fantasai> github: https://github.com/w3c/csswg-drafts/issues/10489
<emilio> fantasai: so we have progress() and mix(), both in values-5
<emilio> ... they have subtly different syntax, but they both have value then range
<emilio> ... progress has keywords, mix() commas
<emilio> ... this is inconsistent, we should try to make them consistent
<emilio> ... align on either commas or keywords
<emilio> ... question is which direction to go for
<emilio> astearns: TabAtkins mentioned mix() can't use keywords
<emilio> fantasai: that's true, top-level mix ??
<emilio> ... well it can
<emilio> ... but might be better for it to use commas or something else
<emilio> ... we discussed at TPAC about upgradable commas
<emilio> ... we probably need to talk about it again
<emilio> ... other advantage of commas is it's consistent with clamp()
<emilio> q+
<emilio> astearns: I have a preference for keywords so it's unfortunate to not be able to use them in mix()
<emilio> fantasai: so resolution we did about keywords was disambiguating using curly braces, then keywords would be fine here
<emilio> ... I think keywords are more readable in general
<emilio> ... but I can see the argument for consistency
<astearns> ack emilio
<fantasai> emilio: was going to argue for commas
<fantasai> emilio: if I know syntax uses commas, I can use both
<fantasai> emilio: otherwise, presumably the keywords would vary from one to the other
<fantasai> emilio: so if keywords are inconsistent, the strongly prefer commas
<fantasai> astearns: we could make the keywords consistent, but maybe less than optimal for one
<emilio> fantasai: we could probably do of/to
<emilio> ... that might be workable for both
<fantasai> mix(<progress> of <start> to <end>)
<fantasai> progress(<value> of <start> to <end>)
<oriol> q+
<fantasai> astearns: but only if we make authors wrap values that they're passing in in curly braces if those values contain 'of' or 'to'.
<astearns> ack oriol
<fantasai> fantasai: Right. Though we don't generally use those as top-level values.
<fantasai> oriol: I'm not a big fan of adding restrictions of what mix() can accept.
<fantasai> oriol: extra constraints would be confusing
<fantasai> oriol: so given the nature of mix() would prefer commas instead of keywords
<fantasai> oriol: also seems confusing even if you are not using one of the keywords that we use as separators, the values could contain keywords, and it's not visually clear where one value starts and other ends
<emilio> q+
<fantasai> astearns: commas also have the issue of values containing commas
<fantasai> *: would need to wrap it in braces in that case
<fantasai> oriol: instead of something specific for mix(), you don't need to worry about special keywords, just only wrap if have commas
<astearns> ack emilio
<fantasai> emilio: color-mix() also uses commas
<fantasai> emilio: that makes me stronger for commas
<fantasai> astearns: Sounds like we are getting close to a resolution to use commas as separators
<fantasai> astearns: for progress() to match mix()
<dholbert> scribe+ dholbert
<dholbert> fantasai: I think that's useful because progress with calc ... can take values with calc [...] it's probably better to use commas
<fantasai> fantasai: I think it's also beneficial because progres() is a math funtion, can take expressions directly without wrapping in calc(); and so using commas is easier to visually parse in this case
<fantasai> RESOLVED: Use commas for progress()