feat(core): theme service refactor (#DS-3003) - #1856
Open
NikGurev wants to merge 3 commits into
Open
Conversation
|
Visit the preview URL for this PR (updated for commit 7211a09): https://koobiq-next--prs-1856-jmotwjcq.web.app (expires Mon, 10 Aug 2026 10:38:40 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c |
NikGurev
marked this pull request as ready for review
August 7, 2026 10:42
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.
Summary
Refactors
ThemeService(DS-3003): moves it to signals, adds a built-inautomode that follows the OS color scheme, and persists the selected mode tolocalStorageout of the box.ThemeServiceis kept as a deprecated alias so existing consumers don't break, and the newKbqThemeServiceis fully DI-configurable viakbqThemeProvider().List of notable changes
KbqThemeService— signal-based (mode,resolvedMode,currentTheme,themes) replacement forThemeService, withsetAuto()/toggle(), internalmatchMediahandling forautomode, andlocalStoragepersistence via a new swappableKBQ_THEME_STORE/KbqThemeLocalStorageStore(same pattern asKBQ_ACCORDION_STATE_STORE)kbqThemeProvider(config)/KBQ_THEME_CONFIGfor DI-based setup (themes,mode,storageKey,autoLight,autoDark) instead of imperativesetThemes()/setTheme()callsautoLight/autoDarkconfig soautomode resolves correctly against fully custom theme sets, not just the built-inlight/darknamesThemeService(deprecated alias ofKbqThemeService),KbqTheme.selected(deprecated, still synced), andcurrent/setTheme()/getTheme()(deprecated, still functional) for backward compatibility — nong updateschematic needed for the renamematchMedialistener andlocalStoragewiring innavbar.component.ts/navbar-property.ts— now just callssetAuto()/setMode(); configured withkbqThemeProvider({ storageKey: 'docs_theme' })inapps/docs/src/app/config.tsto preserve existing users' saved preference under the old keyThemeServiceconsumers (theme-toggle.ts,welcome.component.ts,tokens-overview.ts,docsearch.directive.ts, 7 docs-examples) to the signal APItheme.service.spec.ts— unit tests forautoresolution, mode selection, custom themes, persistence, SSR-safety, and the deprecated shimsdocs/guides/migration.en.md/migration.ru.mdwith a new "13. Theme service review (20.3.0)" section, and approved thecore.api.mdpublic API snapshotWhat should reviewers focus on?
ThemeService,current,selected,setTheme/getTheme) is worth keeping vs. a cleaner breakautoLight/autoDarkas the mechanism for custom themes to opt intoautomode — reasonable default, or should it be required when custom themes are registered?