Repository navigation
feat: resolve widget styles in one place, with named states - #50
Merged
Merged
Conversation
…ts widgets The setup preview shows the bar's scripts through a second store. It prepares its own presentations, and scripts report to the first store that prepared them, so the bar keeps its updates.
Every style object accepts a states map, and the hover shorthand keys fold into it; when one style sets both, states wins. focusedStyle, visibleStyle, emptyStyle, focusedAppStyle and visibleAppStyle are shorthand for workspace states, and the underline takes focused and visible states. States merge through includes, templates, profiles, widget overrides and packages, theme packages included, one state and property at a time, and a later layer removes one with null. Colors inside states take light and dark pairs and tokens. The modular example's theme sets its hover color as a state. Customize's hover background rows show the hover the bar draws and set the shorthand with states.hover.background cleared, so their color beats an include's state while an active profile still wins.
…round Hover applies over the data state, so a hover background replaced the background a state such as critical set while keeping its text color: dark text on the modular theme's hover color, and white text on the theme's hover color in the README's example. Both now set a hover background in the state's own states, the README says to do so, and a test pins the modular theme's hovered critical colors.
An output with "state": "" counted as a state named "", so it blocked the widget's rules and the snapshot reported an empty state. It now counts as no state: rules still apply and the snapshot reports none. A rule with an empty state is rejected when the configuration loads, naming its path, and the schema requires at least one character.
minWidth and maxWidth were checked only on a widget's base style merged over the defaults, so a state such as states.hover.minWidth above the maxWidth, or a negative minWidth inside a state, loaded and would have given contradictory frames. Each state merged over that style is now checked too, with the same messages.
The data state of a widget's resolved style can come from its rules as well as its output, and dataState now takes the rules as a second argument.
A later states.hover set to null doesn't remove a hover set with hoverBackground or hoverForeground, because the shorthand is folded back in, so those need a null too. The open state also reaches a widget's overlay, and a block's own background, border and other box properties change for it only through that block's own states.
This was referenced Oct 17, 2026
This was referenced Oct 19, 2026
|
🎉 This PR is included in version 0.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #15.
Bar widgets, workspace cells, layout and popup blocks and the bar each worked out their style in their views. They used different rules and had no tests, so every new kind of state needed a layer in four places. Built-in providers couldn't change their style by value at all.
Changes
refactorcommits and aperf):stateson every style. A style can havestatesthat apply over it while a state is active:hover,open, the workspace statesfocused,visibleandempty, and data states.hoverBackgroundandhoverForegroundforstates.hover, andfocusedStyle,visibleStyle,emptyStyle,focusedAppStyleandvisibleAppStylefor the workspace states.focusedandvisiblestates.null.states. They are compared after the layers merge, so astates.hover.backgroundfrom any layer wins overhoverBackgroundfrom any layer. The README's States section says so.states.hover.background, so the chosen color beats an include's hover state while an active profile still wins.openstate for a widget whose popup shows, on the instance that opened it."state", andrulesset a state from a built-in provider'svaluesorfields, such as battery below 20 %. The README documents the shared nameswarning,critical,activeandmuted, and the modular example's theme defines them.Left out, as in the issue's proposal:
bar.styleand groups;Testing
swift testpasses 175 tests: main's 130 and 45 new ones. Every commit builds with its tests and passes the suite.main.main:store.actionErrors, so a failed action redraws every widget.Merging
A merge commit, so each commit reaches the changelog: four
feat, twofixand oneperf.Issues #16 and #17 build on this branch. Their pull requests will follow.
Claude Opus 5.5 via Claude Code