Skip to content

New style system, take 3. #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2025
Merged

New style system, take 3. #53

merged 2 commits into from
Jan 7, 2025

Conversation

museun
Copy link
Owner

@museun museun commented Jan 7, 2025

No description provided.

museun added 2 commits January 7, 2025 18:39
This one is a lot better and unifies a lot of ideas.

Now the Builder only needs to optionally return the views ApplicableStyle.

With this, the ViewExt can do all sorts of things like:
- style
- style_if
- class
- class_if
- or
- disabled
- hoverable
- disabled_if
- hoverable_if

This introduces a 'StyleState' which can be used to determine whether a view is:
- hoverable
- disabled

To apply a style, `style.apply()` now takes a `StyleApplicator` (a `&Render` or `&Ui`) which returns the evaluated style

Instead of weird `args: Self::Args` in the styles, we now have a `StyleOptions<Self::Args>` which has:
- hovered: bool
- focused: bool
- selected: bool
- interactive: bool
- state: StyleState
- args: Self::Args

`style.apply()` now also takes a closure for setting the 'args' (the current state from the View for the style to use)
@museun museun merged commit 594943f into dev Jan 7, 2025
@museun museun deleted the new-style branch January 7, 2025 23:47
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