Repository navigation
feat(theme): add switches, segmented controls, smart reset and search - #1831
Conversation
|
392c092 to
4dd874c
Compare
eythaann
left a comment
There was a problem hiding this comment.
Do the requested changes, and remove the unnecessary mappings.
| if (!isValidCssVariableName(def.name)) { | ||
| return; | ||
| } | ||
| const syntax = def.syntax === "<boolean>" ? "*" : def.syntax; |
There was a problem hiding this comment.
syntax on boolean should be mapped to <number>
| falseVal: string; | ||
| } | ||
|
|
||
| function detectBooleanOptions(options: unknown[]): BooleanPair | null { |
There was a problem hiding this comment.
remove this, adds a behavior that is not expected on the settings definition.
| } | ||
|
|
||
| function isSwitchSetting(definition: ThemeVariableDefinition): boolean { | ||
| if (definition.options && detectBooleanOptions(definition.options)) { |
|
|
||
| switch (definition.syntax) { | ||
| case "<boolean>": { | ||
| const isChecked = userStoredValue != null |
There was a problem hiding this comment.
here value is boolean no doesn't need a mapping functions, just compare direct checked = userStoredValue === "1"
|
Done! |
Summary
This PR improves theme variable customization in the Settings app:
Boolean Switches (
<Switch />):<boolean>syntax in core definition, typescript types and@propertystyles.[1, 0],[1.0, 0.0],["true", "false"],["on", "off"],["enabled", "disabled"]) or numeric ranges withmin: 0, max: 1in existing themes and renders them as modern toggle switches.Segmented Controls (
<Segmented />):left | center | right) as inline tabs for 1-click switching instead of bulky dropdown menus.Smart Reset Button:
initialValue).Modified Indicator:
resources.modified).Live Search Filter:
Recording_19_09_2026_20_13_39.mp4