Skip to content

feat(elements): make ElementDeclaration fields nullable#1

Merged
andreakarasho merged 1 commit into
mainfrom
feat/optional-element-declaration
May 25, 2026
Merged

feat(elements): make ElementDeclaration fields nullable#1
andreakarasho merged 1 commit into
mainfrom
feat/optional-element-declaration

Conversation

@andreakarasho

Copy link
Copy Markdown
Owner

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.

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.
@andreakarasho andreakarasho merged commit cdf2fa2 into main May 25, 2026
1 check passed
@andreakarasho andreakarasho deleted the feat/optional-element-declaration branch May 25, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant