feat: add color theme switching and expose admin theme to iframe apps#1181
Draft
Fabian Hüske (fabianhueske) wants to merge 1 commit into
Draft
feat: add color theme switching and expose admin theme to iframe apps#1181Fabian Hüske (fabianhueske) wants to merge 1 commit into
Fabian Hüske (fabianhueske) wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Description
Adds color theme switching for Meteor apps and exposes the Administration's resolved theme to iframe apps through the Admin SDK.
Closes #1174
Closes #1129
Component library (#1174)
mt-theme-select— a select component for choosing the application color theme (light,dark,system), with localized labels (en/de) and Storybook stories.useColorSchemecomposable — tracks the user's preference, resolvessystemagainstprefers-color-scheme, applies the resolved theme to a target'sdata-themeattribute, and persists the choice tolocalStorage.storageKey(setnullto disable persistence),target,defaultScheme,applyToTarget.scheme,resolvedScheme,setScheme, andstop(to detach the OS-preference listener when used outside an effect scope; cleanup is automatic inside a component/effectScope).Admin SDK (#1129)
context.getTheme()— resolves the current Administration theme; asystempreference is always resolved tolightordark.context.subscribeTheme(cb)— fires whenever the resolved theme changes; returns an unsubscribe function.context.syncTheme({ target? })— mirrors the resolved theme onto an element'sdata-themeattribute (document root by default), applies it immediately, and keeps it in sync. Subscribes before the initial fetch so a change during startup can't be missed.Tests
useColorScheme.spec.ts— defaults, system resolution, explicit preference, persistence, OS-change reactivity, custom target,applyToTarget: false, scope disposal, manualstop(), and disabled persistence.mt-theme-select.spec.ts— label rendering, options, re-emit, disabled, custom label.theme.spec.ts(admin-sdk) —getTheme, subscribe/unsubscribe, andsyncThemeto document root and custom target.Changesets
@shopware-ag/meteor-component-library: minor@shopware-ag/meteor-admin-sdk: minor