import { WorkspaceStorageProxyStore } from '../../../../client-api-platform/src/api/controllers/workspace-storage-proxy-store'; import { StorageProxy } from '../../../../client-api-platform/src/api/utils'; import { ColorSchemeOptionType, CustomPaletteSet } from '../../../../client-api-platform/src/shapes'; /** * Converts a string => (string | number) dictionary into a set of css vars. */ export declare const getVars: (vars: Record) => string; /** * Palette extensions can be used to add new variables to the palette set. * * This is particularly useful if a value uses a different palette constant depending on scheme. */ export declare const getPaletteExtensions: (palette: CustomPaletteSet, paletteScheme: "light" | "dark", isWindows: boolean) => { dockExpandedContainerBorderRadius: string; fillerBackgroundColor: string; 'computed-scrollbar-thumb-alpha': number; 'computed-scrollbar-track-alpha': number; 'scrollbar-thumb-rgb': string; 'scrollbar-track-rgb': string; selectedTab: string; }; export type LegacyPalettes = { dark: CustomPaletteSet; light: CustomPaletteSet; }; export type Palettes = { light: string; dark: string; }; /** * Generates `--workspace-palette-*` CSS variable strings from a CustomPaletteSet. * Used to produce legacy CSS vars for backwards compatibility with workspace apps * that still consume the legacy theme system. */ export declare const generateLegacyCSSVars: (palettes: LegacyPalettes, isWindows: boolean) => { light: string; dark: string; }; export declare class ThemeStorageController { private providerStorage; private workspaceStorageProxyStore; private darkPaletteVars?; private lightPaletteVars?; private themePaletteSheet?; private isLegacySinglePaletteTheme; constructor(providerStorage: Pick, workspaceStorageProxyStore?: WorkspaceStorageProxyStore); /** * Sets the storage factory. This can only be done once, and will throw for subsequent calls. * * All storage writes will be pending until the factory is created. * @param factory */ setStorageFactory: (factory: () => StorageProxy) => void; /** * Close the storage proxy window and clear the reference. Called when the last browser window * closes so the platform can quit (storage proxy would otherwise keep the process alive). * Clears the reference before awaiting destroy() to avoid a race with getOrCreateStorageProxy. */ destroyWorkspaceStorageProxy: () => Promise; /** * Check if there's an explicit user preference stored in localStorage. * A user preference is indicated by the presence of a SelectedColorScheme key. Which is something assigned if you click on the Appearance dropdown. * @returns true if user has manually selected a scheme, false if using defaults */ private hasUserPreference; /** * Synchronize the current palette and scheme with workspace's storage instance if * storage based theming is enabled. * * Workspace storage is consumed by workspace apps still on the legacy theme system * whose theme-loader does NOT set `data-scheme` on the document. To maintain * backwards compatibility the sheet written here uses the legacy format: for an * explicit light/dark scheme only that scheme's vars are placed inside `:root{}`, * while "system" uses `@media (prefers-color-scheme)` queries with `:root`. */ synchronizeWorkspaceStorage: () => Promise; /** * Set the current Palette to be used by workspace. This palette will be converted into * css vars and combined into a single stylesheet. This stylesheet is exposed in localstorage * to allow workspace UI elements to load the palette before their first paint. * @param palettes Light and Dark Palette constants */ setLegacyPalettes: ({ light, dark }: LegacyPalettes, isWindows: boolean) => Promise; setPalettes: ({ light, dark }: { light: string; dark: string; }) => Promise; /** * Set the current scheme of workspace. Specifically setting light or dark * will ignore the OS scheme, whereas 'system' will always respect it. * * This will also update the CSS vars to either support media queries in System mode or force a palette. * @param scheme 'light', 'dark' or 'system'. */ setScheme(scheme: ColorSchemeOptionType): void; /** * Clears an explicit user scheme choice (e.g. from Appearance) so resolution falls back to theme default. */ clearUserSelectedSchemePreference(): void; setLegacySinglePaletteTheme(value: boolean): void; /** @internal */ getIsLegacySinglePaletteTheme(): boolean; /** * Set the theme's default scheme from palette configuration * @param scheme The default scheme specified in the palette */ setThemeDefaultScheme(scheme: ColorSchemeOptionType): void; /** * Write the theme palette sheet to both in-memory state and providerStorage (namespaced localStorage) * immediately. This ensures the theme is available for themeLoader on same-origin pages * without waiting for the workspace storage proxy to be initialised. */ setThemePaletteSheet(sheet: string): void; /** * Returns the current scheme * @returns 'light' | 'system' | 'dark' */ getScheme(): ColorSchemeOptionType; getThemePaletteSheet(): string | undefined; getThemePalette(): { light: string; dark: string; }; }