Re: [csswg-drafts] [css-properties-values-api] Shorthand for custom property declaration (#7523)

I don't want to shove the existing descriptors into an unlabeled prelude space; that's hostile to future expansion, as we'd have to make sure the descriptor syntaxes either work together, or have an alternate form when in the prelude.

However, generally the repetitive part comes from repeating the `@property` keyword itself, and the syntax/inherits descriptors. Initial values are either distinct per property, or at least short enough that it's fine to repeat.

So, since custom properties are grammatically distinct from normal descriptors, we can do the defaults and the name/initial pairs together, like so:

```
@properties {
  syntax: "<color>";
  inherits: false;
  --brand-color: teal;
  --text-color: black;
  --bg-color: white;
  /* more names and initial values here */
}
```

Hm, this isn't even more verbose than the current `@property` for a single variable. Dang, we probably could have just used it in the first place. I guess it does require setting an initial value, tho, which `@property` lets you forgo if you're using `"*"` syntax, but that's a pretty minor thing (and we could avoid it by saying `initial` as the value). It's probably too late for that tho, huh.

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


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

Received on Thursday, 17 August 2023 22:18:06 UTC