Commit 8ec18b2
committed
feat(elements): make ElementDeclaration fields nullable
Optional opt-in via field presence — declaring a field is enough.
Drops `HasImage`/`HasShadow`/`HasBorder`/`HasCustomData`/`IsFloating`/
`IsScrollable` sentinel checks in ConfigureOpenElement; checks for
`is not null` instead. Layout falls back to default when null. Id
stays required.
ClayUI widgets that previously assigned `Shadow = s.Shadow` /
`Border = s.Border` unconditionally now guard with `HasShadow` /
`HasBorder` so empty styles map to null. Avoids spurious Shadow
render commands (the renderer emits unconditionally on config
presence) and saves storage for empty Border configs.
Adds OptionalElementDeclarationTests (23 cases) covering null-by-
default, declaration-is-enough (empty Custom/Shadow/Scroll), and
regression for factory methods + existing styled paths.1 parent 1e6a07a commit 8ec18b2
5 files changed
Lines changed: 458 additions & 56 deletions
File tree
- src
- Clay.Test
- Clay
- Core
- Elements
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| |||
0 commit comments