- From: Drew Powers via GitHub <sysbot+gh@w3.org>
- Date: Mon, 28 Feb 2022 19:12:14 +0000
- To: public-design-tokens-log@w3.org
I think there’s a unique problem with the `string | object` polymorphism here which doesn’t exist on other tokens. `font`, for example, may be a `string | string[]`. But if `string` is passed, you could normalize that by simply placing that in an array, and it would be equivalent (in other words, you can “expand” one type into another). I would expect for `strokeStyle` the `string` value should be “expandable” to the object value, but that doesn’t seem to be the case. If I’m reading this right, the object value would always be the `dashed` style? If so, I’d suggest the following: ```json { "alert-border-style": { "$type": "strokeStyle", "$value": { "style": "dashed", "dashArray": ["0.5rem", "0.25rem"], "lineCap": "round" } } } ``` Having a `"style"` that corresponds to the string value (feel free to bikeshed the name; I’m not opinionated about “style”) allows the two types to be interchangeable. So `"$value": "dashed"` and `"$value": { "style": "dashed" }` are two ways to write the same thing. Of course, that begs the question of whether or not `"$value": "solid"` has any other attributes that could be set; I’d probably lean toward some expanded set of attributes for the object notation, that either apply or don’t based on `style`. Because I could realistically see other stroke attributes applying to multiple styles and not being mutually-exclusive. Just from a schema standpoint, if the same `$type` can have different values of different shapes and there are “sub-types,” I’d argue those are actually two different types. So I guess another proposal would be to split apart all strokes, e.g. `$type: "solidStroke"`, `$type: "dashedStroke"`, so that the value shapes could truly diverge and be clear both to the author and the tool implementor. -- GitHub Notification of comment by drwpow Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/98#issuecomment-1054576655 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 28 February 2022 19:12:16 UTC