import * as i0 from '@angular/core'; import { InjectionToken, Provider } from '@angular/core'; type DgaTheme = 'light' | 'dark'; /** * Toggles document theme via `data-theme` on . * Persists the choice in `localStorage` (`dga-theme`). * * Important: the reactive `themeChanges` signal updates when the new theme is * committed — bind icons/labels to `themeChanges`, do not flip UI on click. * * Preference for the circular reveal: * 1. Mask hole expand (GPU) — real themed UI shows through; no VT snapshots * 2. View Transitions API + clip-path (fallback) * 3. Instant when `prefers-reduced-motion` is set * * Motion is radial only (never translateX — locale wipe owns that). * * Browser-only: constructors no-op on the server (SSR-safe). */ declare class DgaThemeService { private readonly doc; private readonly isBrowser; private readonly themeSig; /** Updates when the new theme is committed (with the reveal), not on press. */ readonly themeChanges: i0.Signal; constructor(); get theme(): DgaTheme; setTheme(theme: DgaTheme, origin?: EventTarget | null): void; /** Queues a reveal to the other theme. UI should bind `themeChanges`. */ toggle(origin?: EventTarget | null): DgaTheme; private hydrate; private readDomTheme; private persist; /** CSS-only theme paint — no Angular signal / storage / color-scheme (keeps reveals smooth). */ private paintDomTheme; /** Full commit: DOM + signal + storage + color-scheme (after the circle finishes). */ private commitTheme; private reveal; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** Document writing direction for a locale. */ type DgaTextDirection = 'rtl' | 'ltr'; /** * Runtime locale code (e.g. `ar`, `en`, `ur`). * Validated against the registered {@link DGA_LOCALES} list. */ type DgaLocale = string; /** One entry in the configurable language list. */ interface DgaLocaleDefinition { /** BCP-47-ish short code stored in `data-locale` / localStorage. */ code: string; /** Writing direction applied to ``. */ dir: DgaTextDirection; /** Native display name for pickers (العربية / English / اردو). */ nativeName: string; /** Optional `lang` attribute override; defaults to `code`. */ htmlLang?: string; } /** Built-in bilingual defaults — apps opt into more via {@link provideDgaLocales}. */ declare const DGA_DEFAULT_LOCALES: readonly DgaLocaleDefinition[]; declare const DGA_LOCALES: InjectionToken; /** localStorage key for the companion direction (FOUC boot). */ declare const DGA_LOCALE_DIR_STORAGE_KEY = "dga-locale-dir"; /** * Register the app language list (codes + direction + native names). * Default without this provider is Arabic + English. * * @example * ```ts * provideDgaLocales([ * { code: 'ar', dir: 'rtl', nativeName: 'العربية' }, * { code: 'en', dir: 'ltr', nativeName: 'English' }, * { code: 'ur', dir: 'rtl', nativeName: 'اردو' }, * ]) * ``` */ declare function provideDgaLocales(locales: readonly DgaLocaleDefinition[]): Provider; /** Resolve a localized string map for the active locale with fallbacks. */ declare function dgaResolveLocalized(value: string | Record | undefined | null, locale: string, fallbackLocales?: readonly string[]): string | undefined; /** * Sets `lang` / `dir` / `data-locale` on `` and animates the change * with a directional wipe (writing-direction aware). * Persists the choice in `localStorage` (`dga-locale` + `dga-locale-dir`). * * Supported languages come from {@link DGA_LOCALES} (default ar/en, or * {@link provideDgaLocales} in the app config). * * Important: the reactive `localeChanges` signal updates only when the wipe * applies the new locale (inside the view-transition callback / after the * out animation) — not when `setLocale()` is pressed. Bind UI copy to * `localeChanges` so text flips with the animation, not before it. */ declare class DgaLocaleService { private readonly doc; private readonly appRef; private readonly isBrowser; private readonly registered; private wiping; private readonly localeSig; /** Updates when the new locale is applied (mid-wipe), not when setLocale is pressed. */ readonly localeChanges: i0.Signal; constructor(); /** Configured language list (dynamic / injectable). */ get locales(): readonly DgaLocaleDefinition[]; get locale(): DgaLocale; get direction(): DgaTextDirection; /** Look up a registered locale; falls back to the first entry. */ def(code?: string): DgaLocaleDefinition; setLocale(locale: DgaLocale): void; /** * Advance to the next registered locale. * Prefer the language picker + `setLocale` when more than two languages exist. */ cycleLocale(): DgaLocale; /** * @deprecated Use {@link cycleLocale} or {@link setLocale}. Kept for two-locale apps. */ toggle(): DgaLocale; private resolveCode; private hydrate; private readDomLocale; private persist; /** * Flush Angular templates after a locale signal write. * Always runs on a fresh microtask so it never nests inside an in-flight * `ApplicationRef.tick()` (NG0101). View Transition update callbacks may * return a Promise — await this so the new snapshot includes updated UI. */ private flushUi; private applyLocale; private wipe; private wipeWithViewTransition; /** Fallback: animate out → swap locale → animate in. */ private wipeWithTransform; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Document font families (Google Fonts Arabic-friendly stacks). * Default matches Platforms Code / DGA: IBM Plex Sans Arabic. */ type DgaFontFamily = 'ibm-plex' | 'noto-sans' | 'cairo' | 'tajawal' | 'almarai' | 'changa' | 'readex-pro' | 'amiri'; interface DgaFontOption { id: DgaFontFamily; /** Latin / brand name shown in EN UI */ label: string; /** Arabic display name */ labelAr: string; /** CSS font-family stack assigned to `--dga-font-sans` */ stack: string; } /** Curated Arabic Google Fonts commonly used in regional / gov UIs. */ declare const DGA_FONT_OPTIONS: readonly DgaFontOption[]; /** Google Fonts CSS for non-default families. IBM Plex is the document default. */ declare const DGA_FONT_STYLESHEETS: Record, string>; /** Inject a stylesheet for a non-default family (idempotent). */ declare function dgaEnsureFontStylesheet(doc: Document, font: DgaFontFamily): void; /** * Switches the document sans family via `data-font` on `` * and `--dga-font-sans` (see `@a.nemreen/dga-tokens` base styles). * Persists the choice in `localStorage` (`dga-font`). * * Load IBM Plex (the default) in `index.html`. Other families are injected * on demand by this service and by `prefs-boot.js`. */ declare class DgaFontService { private readonly doc; private readonly isBrowser; constructor(); get font(): DgaFontFamily; get options(): readonly DgaFontOption[]; option(id?: DgaFontFamily): DgaFontOption; setFont(font: DgaFontFamily): void; /** Advance to the next curated family (header icon control). */ cycle(): DgaFontFamily; private hydrate; private persist; private applyFont; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Brand color themes — remaps the primary ramp via `data-brand` on ``. * Default `green` is Platforms Code / DGA primary (no attribute). * Seasonal packs (`hajj`, `foundation`, `national`) follow DGA occasion templates. * `national` is National Day 96: campaign chrome lives in the demo layer; the * primary ramp stays DGA green. */ type DgaBrand = 'green' | 'blue' | 'purple' | 'gold' | 'teal' | 'hajj' | 'foundation' | 'national'; type DgaBrandGroup = 'color' | 'seasonal'; interface DgaBrandOption { id: DgaBrand; label: string; labelAr: string; /** Swatch color for the picker UI (primary-600 of the brand). */ swatch: string; /** Picker section — seasonal templates render under a divider. */ group?: DgaBrandGroup; } /** Curated brand themes + DGA seasonal occasion packs. */ declare const DGA_BRAND_OPTIONS: readonly DgaBrandOption[]; /** * Switches the document brand (primary color ramp) via `data-brand` on ``. * Independent of light/dark (`data-theme`) and font (`data-font`). * Persists the choice in `localStorage` (`dga-brand`). * * Uses the same circular reveal as dark mode when switching brands. * Bind chrome that re-skins with the pack to `brandChanges` (updates under the cover). */ declare class DgaBrandService { private readonly doc; private readonly isBrowser; private readonly appRef; private readonly brandSig; /** Reactive brand id — updates under the reveal cover so Angular chrome swaps with CSS. */ readonly brandChanges: i0.Signal; constructor(); get brand(): DgaBrand; get options(): readonly DgaBrandOption[]; option(id?: DgaBrand): DgaBrandOption; setBrand(brand: DgaBrand, origin?: EventTarget | null): void; cycle(origin?: EventTarget | null): DgaBrand; private hydrate; private persist; /** CSS + Angular signal under the cover so heroes remount before the hole expands. */ private paintDomBrand; /** Full commit: DOM + signal + storage. */ private commitBrand; private reveal; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { DGA_BRAND_OPTIONS, DGA_DEFAULT_LOCALES, DGA_FONT_OPTIONS, DGA_FONT_STYLESHEETS, DGA_LOCALES, DGA_LOCALE_DIR_STORAGE_KEY, DgaBrandService, DgaFontService, DgaLocaleService, DgaThemeService, dgaEnsureFontStylesheet, dgaResolveLocalized, provideDgaLocales }; export type { DgaBrand, DgaBrandGroup, DgaBrandOption, DgaFontFamily, DgaFontOption, DgaLocale, DgaLocaleDefinition, DgaTextDirection, DgaTheme };