import * as i0 from '@angular/core'; import { InjectionToken, Signal, EnvironmentProviders } from '@angular/core'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Built-in color variants available to NGWR components. * * Kept in sync manually with the SCSS `$base-colors` map in * `theme/styles/_colors.scss`. Both sources must stay aligned — * adding a color requires updating both this array and the SCSS map. * * @example * ```ts * import { WR_COLORS } from 'ngwr/theme'; * * // Iterate all colors for demos or documentation * WR_COLORS.forEach(color => console.log(color)); * ``` */ declare const WR_COLORS: readonly ["primary", "secondary", "success", "warning", "danger", "light", "medium", "dark"]; /** * A color variant name. * * Use as an input type on components that accept a color: * * @example * ```ts * import type { WrColor } from 'ngwr/theme'; * * @Component({...}) * export class MyComponent { * readonly color = input('primary'); * } * ``` */ type WrColor = (typeof WR_COLORS)[number]; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** Mode the user explicitly selected. `auto` follows `prefers-color-scheme`. */ type WrThemeMode = 'light' | 'dark' | 'auto'; /** Resolved theme — what's actually applied to the DOM. */ type WrResolvedTheme = 'light' | 'dark'; /** Configuration for {@link WrTheme}. */ interface WrThemeConfig { /** Initial mode used when no persisted value is present. @default 'auto' */ readonly defaultMode: WrThemeMode; /** localStorage key for persistence. Set to `null` to disable persistence. @default 'wr-theme' */ readonly storageKey: string | null; /** Attribute applied to `` to expose the resolved theme. @default 'data-theme' */ readonly attribute: string; } declare const DEFAULT_WR_THEME_CONFIG: WrThemeConfig; declare const WR_THEME_CONFIG: InjectionToken; /** * Light / dark theme manager. * * - `mode` is what the user picked (`light` | `dark` | `auto`). * - `resolved` is what's actually applied — `auto` resolves through * {@link WrPlatform.prefersDark}. * - Writes `[data-theme]` (or your configured attribute) on ``. * - Persists the selected mode via {@link WrStorage} (defaults to * `localStorage`; swap the storage engine globally to change where). * * @example * ```ts * const theme = inject(WrTheme); * theme.set('dark'); * theme.toggle(); * theme.resolved(); // 'dark' * ``` * * @see https://ngwr.dev/services/theme */ declare class WrTheme { private readonly doc; private readonly platform; private readonly storage; private readonly config; /** User-selected mode. */ readonly mode: i0.WritableSignal; /** Resolved theme actually applied to the DOM. */ readonly resolved: Signal; constructor(); /** Switch to a specific mode. */ set(mode: WrThemeMode): void; /** Cycle: light → dark → light (skips auto). */ toggle(): void; private readPersisted; private persist; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Configure {@link WrTheme}. Partial — merged with defaults. * * @example * ```ts * provideWrTheme({ defaultMode: 'dark', storageKey: 'my-app-theme' }) * ``` */ declare function provideWrTheme(config?: Partial): EnvironmentProviders; export { DEFAULT_WR_THEME_CONFIG, WR_COLORS, WR_THEME_CONFIG, WrTheme, provideWrTheme }; export type { WrColor, WrResolvedTheme, WrThemeConfig, WrThemeMode };