import { ReactiveController, ReactiveElement } from 'lit'; /** * Symbol used to track language resolver updates in reactive element lifecycle. * When the language context changes, components use this symbol to trigger updates * to locale-dependent content (e.g., formatted dates, numbers, currency). * * @example * ```typescript * protected override updated(changes: PropertyValues): void { * if (changes.has(languageResolverUpdatedSymbol)) { * // Re-render locale-dependent content * this.setAttribute('aria-valuetext', this.formatProgress()); * } * } * ``` */ export declare const languageResolverUpdatedSymbol: unique symbol; /** * A reactive controller that manages language/locale resolution for components. * * This controller: * - Gets initial language from ``, then `navigator.language`, then `'en-US'` * - Optionally subscribes to a provider (e.g. 1st-gen ``) via the * `sp-language-context` event; if something up the tree handles it and calls the * callback, that becomes the source of truth for live updates * - Observes `` attribute changes via a shared singleton observer so that * when the document language changes at runtime (e.g. app-level locale switching), * the controller updates and the host re-renders (e.g. aria-valuetext reformats) * - Validates locale support using Intl API and falls back to `'en-US'` if unsupported * * In 2nd-gen there is no sp-theme language provider, so live updates come from * `` changes. Apps that support locale switching should set * `document.documentElement.lang` when the locale changes; the controller will * pick it up and trigger updates. * * Components using this controller can access the current language via the `language` * property and will automatically re-render when the language context changes. * * @example * ```typescript * class MyComponent extends SpectrumElement { * private languageResolver = new LanguageResolutionController(this); * * protected override updated(changes: PropertyValues): void { * if (changes.has(languageResolverUpdatedSymbol)) { * // Update locale-dependent formatting * this.formattedValue = new Intl.NumberFormat( * this.languageResolver.language * ).format(this.value); * } * } * } * ``` */ export declare class LanguageResolutionController implements ReactiveController { private host; /** * The currently resolved language/locale code (e.g., 'en-US', 'fr-FR'). * Defaults to document language, browser language, or 'en-US'. */ language: string; /** Unsubscribe from the sp-language-context provider (if any). */ private unsubscribe?; /** Unsubscribe from the shared observer. */ private removeLangListener?; constructor(host: ReactiveElement); /** * Reads language from document and validates. Used for initial value and * when syncing from `` changes. */ private getDocumentLanguage; hostConnected(): void; hostDisconnected(): void; /** * Called by the shared observer when `` changes. * Skipped when a provider (e.g. sp-theme) is the source of truth. */ private handleLangChange; /** * Resolves the language: syncs from document, then queries for a provider * (e.g. sp-theme) via 'sp-language-context'. If a provider calls the * callback, it becomes the source of truth until disconnected. * * @private */ private resolveLanguage; }