feat(theme): add ThemeSwitcher component and useTheme singleton#762
Open
aerodeval wants to merge 7 commits into
Open
feat(theme): add ThemeSwitcher component and useTheme singleton#762aerodeval wants to merge 7 commits into
aerodeval wants to merge 7 commits into
Conversation
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.
ThemeSwitcher Component
Adds a
ThemeSwitchercomponent for choosing between light, dark, and system appearance, and refactorsuseThemeinto a shared singleton so every theme control stays in sync.What's Included
ThemeSwitcher— renders the three options as live preview cards (built on reka-uiRadioGroup). Selecting one drives the global<html data-theme>, so a bare<ThemeSwitcher />switches the whole app with no wiring.useThemerefactor — hoisted to a module-level singleton with a single app-lifetime system-preference listener and SSR guards. Same return shape as before (no breakage). Now the switcher, a sidebar toggle, etc. all read/write one source of truth.modelValue(v-model),label,description,logo(image URL or Component),name,themeLabels(for translation).Notes
stories/andThemeSwitcher.md), so no manual nav wiring needed.Testing
vue-tsc— no new type errors.aria-checked, and driving<html data-theme>.Coverage: 57.12% (+0.23% vs
main)