[csswg-drafts] Apply the range definition notation (#7400)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== Apply the range definition notation ==
I would like the [range definition notation](https://drafts.csswg.org/css-values-4/#numeric-ranges) to be applied to value definitions whose interval is currently defined in prose. I can make pull request (a single or one per spec) if it helps to get this change sooner. The motivation is automatic parsing of value definition.

At least, the lists below can serve as a reference for the spec authors to update their definitions.

## CSS property values

I excluded CSS 2 from my search.

- [ ] [css-align-3] [`row-gap`, `column-gap`](https://drafts.csswg.org/css-align-3/#column-row-gap): `normal | <length-percentage [0,∞]>`
- [ ] [css-animations-1] [`animation-duration`](https://drafts.csswg.org/css-animations-1/#animation-duration): `normal | <time [0,∞]>#`
- [ ] [css-animations-1] [`animation-iteration-count`](https://drafts.csswg.org/css-animations-1/#animation-duration): `normal | <time [0,∞]>#`
- [ ] [css-box-3][css-box-4] [`padding-top`, `padding-right`, `padding-bottom`, `padding-left`](https://drafts.csswg.org/css-box-3/#padding-physical): `<length-percentage [0,∞]>`
- [ ] [css-break-3][css-break-4] [`orphans`, `widows`](https://drafts.csswg.org/css-break-3/#widows-orphans): `<integer [1,∞]>`
- [ ] [css-content-3] [`bookmark-level`](https://drafts.csswg.org/css-content-3/#bookmark-level): `none | <integer [1,∞]>`
- [ ] [css-egg-1] [`<double-rainbow()>`](https://drafts.csswg.org/css-egg-1/#funcdef-double-rainbow): `double-rainbow(<position> [, [<extent> | <length [0,∞]> | <percentage [0,∞]>]]?)`
- [ ] [css-fonts-4] [`font-stretch`](https://drafts.csswg.org/css-fonts-4/#font-stretch-prop): `normal | <percentage [0,∞]> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded`
- [ ] [css-fonts-4] [`font-style`](https://drafts.csswg.org/css-fonts-4/#font-style-prop): `normal | italic | oblique <anglee [-90,90]>?`
- [ ] [css-fonts-4] [`font-size`](https://drafts.csswg.org/css-fonts-4/#font-size-prop): `<absolute-size> | <relative-size> | <length-percentage [0,∞]> | math`
- [ ] [css-fonts-4] [`font-size-adjust`](https://drafts.csswg.org/css-fonts-4/#font-size-adjust-prop): `none | <number [0,∞]>`
- [ ] [css-grid-1][css-grid-2] [`<grid-line>`](https://drafts.csswg.org/css-grid-1/#typedef-grid-row-start-grid-line): `auto | <custom-ident> | [<integer> && <custom-ident>?] | [span && [ <integer [1,∞]> || <custom-ident>]]`
- [ ] [css-images-3] [`<size>`](https://drafts.csswg.org/css-images-3/#typedef-size): `<extent-keyword> | <length [0,∞]> | <length-percentage [0,∞]>{2}`
- [ ] [css-images-4] [`<cf-image>`](https://drafts.csswg.org/css-images-4/#typedef-cf-image): `<percentage [0,100]>? && [<image> | <color>]`
- [ ] [css-inline-3] [`initial-letter`](https://drafts.csswg.org/css-inline-3/#propdef-initial-letter): `normal | <number> <integer [1,∞]> | <number [1,∞]> && [drop | raise]?`
- [ ] [css-overflow-3] [`max-lines`](https://drafts.csswg.org/css-overflow-3/#max-lines): `none | <integer [1,∞]>`
- [ ] [css-rythm-1] [`block-step-size`](https://drafts.csswg.org/css-rhythm-1/#block-step-size): `none | <length [0,∞]>`
- [ ] [css-rythm-1] [`line-height-step`](https://drafts.csswg.org/css-rhythm-1/#line-height-step): `<length [0,∞]>`
- [ ] [css-scroll-snap-1] [`scroll-padding-top`, `scroll-padding-right`, `scroll-padding-bottom`, `scroll-padding-left`, `scroll-padding-inline-start`, `scroll-padding-block-start`, `scroll-padding-inline-end`, `scroll-padding-block-end`](https://drafts.csswg.org/css-scroll-snap-1/#longhands): `auto | <length-percentage [0,∞]>`
- [ ] [css-scroll-snap-2] [`scroll-start`, `scroll-start-x`, `scroll-start-y`, `scroll-start-block`, `scroll-start-inline`](https://drafts.csswg.org/css-scroll-snap-2/#longhands): `auto | start | end | center | <length-percentage [0,∞]>`
- [ ] [css-shapes-1] [`<shape-radius>`](https://drafts.csswg.org/css-shapes-1/#typedef-shape-radius): `<length-percentage [0,∞]> | closest-side | farthest-side`
- [ ] [css-size-adjust-1] [`text-size-adjust`](https://drafts.csswg.org/css-size-adjust-1/#adjustment-control): `auto | none | <percentage [0,∞]>`
- [ ] [css-sizing-3] [`width`, `min-width`, `height`, `min-height`](https://drafts.csswg.org/css-sizing-3/#preferred-size-properties): `auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>)`
- [ ] [css-sizing-3] [`max-width`, `max-height`](https://drafts.csswg.org/css-sizing-3/#max-size-properties): `none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>)`
- [ ] [css-transitions-1] [`transition-duration`](https://drafts.csswg.org/css-transitions-1/#transition-duration-property): `<time [0,∞]>#`
- [ ] [css-writing-modes-4] [`text-combine-upright`](https://drafts.csswg.org/css-writing-modes-4/#text-combine-upright): `none | all | [ digits <integer [2,4]>? ]`

## Other CSS values

As noted in #7140, the range definition notation would need to be generalized in order to apply to a descriptor value or a value in a rule's prelude. I think it can be achieved with this change in [CSS Syntax 3](https://drafts.csswg.org/css-syntax-3/#rule-defs):

```diff
 Just like in property grammars, the notation `<foo>` refers to the "foo" grammar term, assumed to be defined elsewhere. Substituting the `<foo>` for its definition results in a semantically identical grammar.

+ For numeric data types, this type notation can annotate any range restrictions using the bracketed range notation described in [CSS Values](https://drafts.csswg.org/css-values-4/#numeric-ranges).
```

- [ ] [css-animations-1] [`<keyframe-selector>`](https://drafts.csswg.org/css-animations-1/#typedef-keyframe-selector): `normal | <length-percentage [0,∞]>`
- [ ] [css-fonts-4][css-fonts-5] [`ascent-override`, `descent-override`, `line-gap-override`](https://drafts.csswg.org/css-fonts-4/#font-metrics-override-desc): `normal | <percentage [0,∞]>`
- [ ] [mediaqueries-4][mediaqueries-5] [`<mq-boolean>`](https://drafts.csswg.org/css-writing-modes-4/#text-combine-upright): `<integer [0,1]>`

## Multiple interval syntax

Some range definitions cannot be defined with the current notation because they have multiple intervals. It was not discussed in #355, where this notation comes from. I'm thinking of `[x1,x2] [x3,x4]` for this, which is similar but simpler than `[x1,x2] ∪ [x3,x4]` (union). 

I thought there was a few more cases but I only found this one, so I guess I can live without this notation and implement a specific validation function for it.

- [ ] [css-grid-1][css-grid-2] [`<grid-line>`](https://drafts.csswg.org/css-grid-1/#typedef-grid-row-start-grid-line): `auto | <custom-ident> | [<integer [-∞,-1] [1,∞]> && <custom-ident>?] | [span && [ <integer [1,∞]> || <custom-ident>]]`

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7400 using your GitHub account


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

Received on Wednesday, 22 June 2022 13:37:57 UTC