fix: sync context panel iframe themes

Keeps embedded sessions aligned with parent theme
Prevents iframe reloads on theme changes
Supports theme hotkeys from focused iframes
This commit is contained in:
Bohdan Triapitsyn
2026-06-16 23:33:29 +03:00
parent 91e8e94961
commit 0fef61e25f
12 changed files with 484 additions and 118 deletions
@@ -0,0 +1,14 @@
import type { Theme } from '@/types/theme';
import { isValidTheme } from './theme-validation';
export type ThemeSyncPayloadShape = {
currentTheme?: unknown;
};
export const getSyncedThemeFromPayload = (payload: ThemeSyncPayloadShape): Theme | null => (
isValidTheme(payload.currentTheme) ? payload.currentTheme : null
);
export const getSyncedThemeVariant = (payload: ThemeSyncPayloadShape): 'light' | 'dark' | null => (
getSyncedThemeFromPayload(payload)?.metadata.variant ?? null
);