import * as _angular_core from '@angular/core'; import { EnvironmentProviders, InjectionToken, Signal, Type, OnDestroy, ElementRef, TemplateRef, AfterContentChecked, OnInit } from '@angular/core'; import * as _eagami_ui from '@eagami/ui'; import { ControlValueAccessor } from '@angular/forms'; /** * BCP 47 locale tags supported out of the box. Consumers select one of these * via `provideEagamiUi({ locale })` or `EagamiI18nService.setLocale()`. */ type EagamiLocale = 'en' | 'de' | 'es-ES' | 'fr-FR' | 'is' | 'nl' | 'pl' | 'pt-BR' | 'el' | 'ru' | 'uk' | 'he' | 'ar' | 'hi' | 'zh-CN'; /** * Display metadata for a built-in locale: the language's name in its own * language and a representative flag emoji. */ interface EagamiLocaleMeta { locale: EagamiLocale; label: string; flag: string; /** Reading direction of the locale's script, for consumers wiring `dir`. */ dir: 'ltr' | 'rtl'; } /** * Display metadata for every built-in locale. The single source the Storybook * locale toolbar and any consumer-built language switcher derive from, so the * displayed list never drifts from the locales the library ships. */ declare const EAGAMI_LOCALE_META: readonly EagamiLocaleMeta[]; /** * Supported locales for language switchers, in display order. Derived from * `EAGAMI_LOCALE_META` so the two never drift. */ declare const EAGAMI_LOCALES: readonly EagamiLocale[]; /** * Every user-facing string baked into the component library, grouped by * component. Parameterized strings are functions so each locale controls its * own word order and pluralization. */ interface EagamiMessages { alert: { dismiss: string; }; autocomplete: { empty: string; }; avatarEditor: { upload: string; dropzone: string; canvas: string; canvasInstructions: string; change: string; revert: string; zoomOut: string; zoom: string; zoomIn: string; remove: string; invalidType: string; tooLarge: (maxMb: number) => string; }; breadcrumbs: { label: string; }; codeInput: { groupLabel: (length: number) => string; digitLabel: (index: number, length: number) => string; }; commandPalette: { dialogLabel: string; searchPlaceholder: string; empty: string; }; colorPicker: { dialogLabel: string; placeholder: string; clear: string; hue: string; saturationAndValue: string; saturationAndValueStatus: (saturation: number, value: number) => string; alpha: string; eyedropper: string; presets: string; toggleFormat: string; }; dataTable: { noData: string; }; /** Locale numeric formatting rules, used to group numbers even when the * runtime's `Intl` lacks this locale's data (some browsers ship a reduced * ICU that drops long-tail locales). */ numberFormat: { /** Decimal mark, e.g. `.` (en) or `,` (de). */ decimal: string; /** Grouping separator, e.g. `,` (en), `.` (de), or a no-break space (fr). */ group: string; /** Digit-group sizes from the right: `[3]` for most locales, `[3, 2]` for * Indian-style lakh/crore grouping. */ grouping: readonly number[]; }; datePicker: { placeholder: string; dialogLabel: string; clear: string; previousYear: string; previousMonth: string; nextMonth: string; nextYear: string; today: string; /** Abbreviated weekday names, Sunday first (index 0), for the calendar * header. Bundled so the calendar localizes even when the runtime's * `Intl` lacks this locale's date data. */ weekdaysShort: readonly string[]; /** Full month names, January first (index 0), for the calendar heading and * formatted values when `Intl` cannot localize this locale. */ months: readonly string[]; }; dialog: { close: string; }; drawer: { close: string; }; dropdown: { placeholder: string; }; fileUploader: { prompt: string; promptSingle: string; browse: string; removeFile: (name: string) => string; fileListLabel: string; constraintsAccept: (accept: string) => string; constraintsMaxSize: (size: string) => string; constraintsMaxFiles: (count: number) => string; rejectionType: (name: string) => string; rejectionSize: (name: string, max: string) => string; rejectionCount: (max: number) => string; bytesUnit: { b: string; kb: string; mb: string; gb: string; tb: string; }; }; input: { showPassword: string; hidePassword: string; clear: string; }; menu: { label: string; }; multiSelect: { dialogLabel: string; placeholder: string; searchPlaceholder: string; searchEmpty: string; selectAll: string; clearAll: string; removeOption: (label: string) => string; selectedCount: (count: number) => string; create: (text: string) => string; }; paginator: { label: string; rowsPerPage: string; range: (start: string, end: string, total: string) => string; previousPage: string; nextPage: string; page: (page: string) => string; }; progressBar: { label: string; }; rangeSlider: { lowThumbLabel: string; highThumbLabel: string; }; rating: { label: string; valueLabel: (value: number, max: number) => string; clear: string; }; spinner: { label: string; }; stepper: { stepsLabel: string; optional: string; stepCompleted: string; }; tag: { remove: string; }; timePicker: { placeholder: string; dialogLabel: string; clear: string; hoursLabel: string; minutesLabel: string; secondsLabel: string; incrementHours: string; decrementHours: string; incrementMinutes: string; decrementMinutes: string; incrementSeconds: string; decrementSeconds: string; amLabel: string; pmLabel: string; }; toast: { dismiss: string; }; transferList: { sourceLabel: string; targetLabel: string; controlsLabel: string; moveSelectedToTarget: string; moveAllToTarget: string; moveSelectedToSource: string; moveAllToSource: string; empty: string; moved: (count: string, listLabel: string) => string; }; validation: { required: string; email: string; min: (min: number) => string; max: (max: number) => string; minlength: (requiredLength: number) => string; maxlength: (requiredLength: number) => string; pattern: string; invalid: string; }; wordmark: { overline: string; tagline: string; }; } /** A partial set of message overrides, applied per component group. */ type EagamiMessagesOverride = { [G in keyof EagamiMessages]?: Partial; }; /** * A self-identifying locale dictionary. Import the ones you need and register * them via `provideEagamiUi({ locales: [...] })` so only those ship in your * bundle; English is always available without registration. */ interface EagamiLocaleBundle { locale: EagamiLocale; messages: EagamiMessages; } /** Lazily resolves a locale's dictionary, typically via a dynamic `import()`. */ type EagamiLocaleLoader = () => Promise; /** Configuration accepted by `provideEagamiUi()`. */ interface EagamiI18nConfig { /** Initial locale. Defaults to `'en'`. Falls back to English if not registered. */ locale?: EagamiLocale; /** * Locale dictionaries to make available at runtime, beyond the built-in * English. Pass `EAGAMI_ALL_LOCALES` for every shipped language, or a subset * to keep your bundle lean. */ locales?: readonly EagamiLocaleBundle[]; /** * Lazy loaders for locale dictionaries, keyed by locale. A locale with a * loader stays out of the initial bundle and is fetched the first time it * is activated via `setLocale()` (or preloaded via `loadLocale()`). Point * each loader at a module that re-exports a single locale bundle so the * bundler emits one chunk per locale. */ localeLoaders?: Partial>; /** Optional per-string overrides merged over the active locale's messages. */ messages?: EagamiMessagesOverride; } /** Public types for the eagami palette provider API. */ /** The 10 derived shade positions, matching the library's existing scale. */ type PaletteShade = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'; /** * Which shade backs each semantic role. Defaults match the library's * hand-tuned palette so passing only `base` produces behaviour * indistinguishable from the un-themed library. */ interface PaletteRoles { /** `--color-brand-default` in light mode. */ surfaceLight: PaletteShade; /** `--color-brand-default` in dark mode. */ surfaceDark: PaletteShade; /** `--color-brand-hover` in light mode. */ surfaceHoverLight: PaletteShade; /** `--color-brand-hover` in dark mode. */ surfaceHoverDark: PaletteShade; /** `--color-brand-active` in light mode. */ surfaceActiveLight: PaletteShade; /** `--color-brand-active` in dark mode. */ surfaceActiveDark: PaletteShade; /** `--color-brand-text` in light mode. */ textLight: PaletteShade; /** `--color-brand-text` in dark mode. */ textDark: PaletteShade; /** `--color-brand-subtle` in light mode. */ subtleLight: PaletteShade; /** `--color-brand-muted` in light mode. */ mutedLight: PaletteShade; /** The shade washed at a tenth and a fifth for `--color-brand-subtle` and `--color-brand-muted` in dark mode. */ tintDark: PaletteShade; } declare const DEFAULT_PALETTE_ROLES: PaletteRoles; interface PaletteConfig { /** Anchor hex (`#RRGGBB`). The library derives the full 50–900 scale from * this point in OKLCH space, holding hue and chroma roughly constant while * stepping lightness. */ base: string; /** Pin individual shades to specific hex values, bypassing derivation for * those slots. */ overrides?: Partial>; /** Remap semantic roles onto different shades. Most consumers leave this * unset and accept the defaults. */ roles?: Partial; } /** Top-level palette config accepted by `provideEagamiUi()`. */ interface EagamiPaletteConfig { primary?: PaletteConfig; secondary?: PaletteConfig; } /** Flat CSS-custom-property name to value map for a single mode. */ type DerivedPalette = Record; /** * Output of `derivePalette`. Carries a separate map per mode so tokens that * have to track the canvas (brand-text, brand-subtle, brand-muted) can hold * different values in light and dark, while surface roles stay shared. */ interface ModePalette { light: DerivedPalette; dark: DerivedPalette; } /** * Full provider configuration for `provideEagamiUi()`. Extends the i18n config * with an optional brand palette; omit `palette` to keep the un-themed SCSS * defaults. */ interface EagamiUiConfig extends EagamiI18nConfig { /** * Brand palette config. The library derives a 10-shade scale via OKLCH * from each base hex, then asserts WCAG AA contrast on every brand-role * pairing. A contrast violation throws at bootstrap. */ palette?: EagamiPaletteConfig; } /** * Configures Eagami UI for the application. * * ```ts * import { frFR, provideEagamiUi } from '@eagami/ui'; * * bootstrapApplication(AppComponent, { * providers: [ * provideEagamiUi({ * locale: 'fr-FR', * locales: [frFR], * palette: { primary: { base: '#3674a1' } }, * }), * ], * }); * ``` * * Optional. Without it, the library defaults to English and ships its * built-in brand colours. Only English is bundled until you register more * languages via `locales` (pass `EAGAMI_ALL_LOCALES` for all of them), or * keep them out of the initial bundle entirely with `localeLoaders`: * * ```ts * provideEagamiUi({ * localeLoaders: { * 'fr-FR': () => import('./i18n/fr-FR').then(m => m.frFR), * }, * }); * ``` * * A `palette` installs a `