@forgeroute/ui 0.4.80 → 0.4.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/types/forgeroute-ui.d.ts
CHANGED
|
@@ -571,7 +571,7 @@ export interface PageResponse<T> {
|
|
|
571
571
|
* (`emailTemplateEditor.subjectPlaceholder`, `messagingSendMessagePanel.bulkMergeTagHint`): a dictionary handed to another interpolating system must escape them.
|
|
572
572
|
*
|
|
573
573
|
* Language and locale: the dictionary carries the locale of its dates, times and numbers in the `i18n.locale` marker ('en-US' / 'es-US'), so
|
|
574
|
-
* `setLabels(
|
|
574
|
+
* handing `setLabels()` the Spanish dictionary alone gives Spanish texts AND Spanish dates (`provideUiLanguage()` does this for you; the dictionary is a lazy chunk, see ui-language.ts). An app that calls `setLocale()` keeps full control (e.g. 'es-MX'); a
|
|
575
575
|
* dictionary of another language without the marker gets 'en-US' dates until the app sets a locale.
|
|
576
576
|
*
|
|
577
577
|
* Known limitation (ambient `uiText()` / `uiLocale()`): they read ONE process-wide service, the last `UiLabelsService` that was constructed.
|
|
@@ -2219,6 +2219,8 @@ export declare const UI_DEFAULT_LABELS: {
|
|
|
2219
2219
|
readonly 'fileInput.word.audio': "audio";
|
|
2220
2220
|
readonly 'integrations.language': "en";
|
|
2221
2221
|
readonly 'i18n.locale': "en-US";
|
|
2222
|
+
readonly 'language.label': "Language";
|
|
2223
|
+
readonly 'language.automatic': "Automatic ({{ name }})";
|
|
2222
2224
|
readonly 'setupWizard.integrationTitle.twilio': "Twilio (calls & texts)";
|
|
2223
2225
|
readonly 'validation.requiredNoLabel': "This field is required.";
|
|
2224
2226
|
readonly 'common.nSelected': "{{ count }} selected";
|
|
@@ -2251,7 +2253,7 @@ export declare class UiLabelsService implements OnDestroy {
|
|
|
2251
2253
|
private readonly _explicitLocale;
|
|
2252
2254
|
/**
|
|
2253
2255
|
* BCP 47 locale used for dates, times and numbers. Resolution: the value the app set with `setLocale()` (full control), else the active dictionary's
|
|
2254
|
-
* `i18n.locale` marker (so `setLabels(
|
|
2256
|
+
* `i18n.locale` marker (so `setLabels()` with the Spanish dictionary alone gives Spanish dates and times: 'es-US'), else `en-US` (a dictionary of another language
|
|
2255
2257
|
* without the marker, or no dictionary).
|
|
2256
2258
|
*/
|
|
2257
2259
|
readonly locale: Signal<string>;
|
|
@@ -4176,7 +4178,7 @@ export declare class SidePanelComponent implements OnDestroy {
|
|
|
4176
4178
|
readonly cancelLabel: import("@angular/core").Signal<string>;
|
|
4177
4179
|
/** Right-aligned primary action button label. Empty string = hidden. */
|
|
4178
4180
|
readonly primaryLabel: import("@angular/core").InputSignal<string>;
|
|
4179
|
-
readonly primaryVariant: import("@angular/core").InputSignal<"
|
|
4181
|
+
readonly primaryVariant: import("@angular/core").InputSignal<"primary" | "danger" | "warning">;
|
|
4180
4182
|
readonly primaryLoading: import("@angular/core").InputSignal<boolean>;
|
|
4181
4183
|
readonly primaryDisabled: import("@angular/core").InputSignal<boolean>;
|
|
4182
4184
|
/** `data-testid` of the Cancel button; none when empty (default). */
|
|
@@ -4973,7 +4975,7 @@ export declare class AudioPlayerComponent {
|
|
|
4973
4975
|
/** Accessible name of the player. */
|
|
4974
4976
|
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
4975
4977
|
/** How much to load before play: 'metadata' (default), 'auto' or 'none'. */
|
|
4976
|
-
readonly preload: import("@angular/core").InputSignal<"
|
|
4978
|
+
readonly preload: import("@angular/core").InputSignal<"auto" | "none" | "metadata">;
|
|
4977
4979
|
/** Fires when the browser can't load or decode the source. */
|
|
4978
4980
|
readonly playbackError: import("@angular/core").OutputEmitterRef<void>;
|
|
4979
4981
|
protected readonly failed: import("@angular/core").WritableSignal<boolean>;
|
|
@@ -5394,7 +5396,7 @@ export declare class CheckboxComponent implements ControlValueAccessor, Validato
|
|
|
5394
5396
|
* clicking it still toggles the box - e.g. a product name that is both the heading of its card and the label of its checkbox.
|
|
5395
5397
|
* Default null: plain label text, exactly as before. Single mode only.
|
|
5396
5398
|
*/
|
|
5397
|
-
readonly headingLevel: import("@angular/core").InputSignal<2 | 3 | 4 |
|
|
5399
|
+
readonly headingLevel: import("@angular/core").InputSignal<2 | 1 | 3 | 4 | 5 | 6 | null>;
|
|
5398
5400
|
readonly indeterminate: import("@angular/core").InputSignal<boolean>;
|
|
5399
5401
|
readonly checked: import("@angular/core").ModelSignal<boolean>;
|
|
5400
5402
|
/**
|
|
@@ -5823,7 +5825,7 @@ export declare class StepperComponent {
|
|
|
5823
5825
|
* its circle, one continuous line behind the circles that fills as steps complete; a complete step shows a check, the current step an
|
|
5824
5826
|
* accent ring with a dot, an upcoming step an empty circle (no numbers). Circles are 40px (32px with `size="sm"`).
|
|
5825
5827
|
*/
|
|
5826
|
-
readonly labelPosition: import("@angular/core").InputSignal<"
|
|
5828
|
+
readonly labelPosition: import("@angular/core").InputSignal<"beside" | "below">;
|
|
5827
5829
|
/** Viewport width in px below which a horizontal stepper is drawn vertical (labels beside the circles), e.g. `640`. null (default) = never. */
|
|
5828
5830
|
readonly stackBelow: import("@angular/core").InputSignal<number | null>;
|
|
5829
5831
|
/** CSS length (e.g. `10.5rem`): horizontal only - the list gets `min-width: calc(<step count> * <value>)`. Empty (default) = no minimum. */
|
|
@@ -6369,7 +6371,7 @@ export declare class PhoneNumberPickerComponent {
|
|
|
6369
6371
|
protected readonly modeCtl: FormControl<string>;
|
|
6370
6372
|
protected readonly zipCtl: FormControl<string>;
|
|
6371
6373
|
protected readonly areaCtl: FormControl<string>;
|
|
6372
|
-
protected readonly step: import("@angular/core").WritableSignal<2 |
|
|
6374
|
+
protected readonly step: import("@angular/core").WritableSignal<2 | 1 | 3>;
|
|
6373
6375
|
protected readonly mode: import("@angular/core").WritableSignal<PhoneNumberSearchMode>;
|
|
6374
6376
|
private readonly _zip;
|
|
6375
6377
|
private readonly _area;
|
|
@@ -6485,7 +6487,7 @@ export declare class ButtonComponent {
|
|
|
6485
6487
|
* `ghost-start`: a ghost button for list / section toggles - a full-width row with its content aligned to the start, transparent
|
|
6486
6488
|
* background, hover tint and the normal focus ring. Pair it with `ariaExpanded` / `ariaPressed`; the label may contain a heading element.
|
|
6487
6489
|
*/
|
|
6488
|
-
readonly variant: import("@angular/core").InputSignal<"
|
|
6490
|
+
readonly variant: import("@angular/core").InputSignal<"primary" | "secondary" | "danger" | "warning" | "link" | "ghost" | "ghost-start" | "tab" | "icon" | "icon-danger">;
|
|
6489
6491
|
/** Renders an anchor to this route instead of a button (use with `variant="link"` for an inline text link). `['/settings']` or `'/settings'`. While `disabled` or `loading` it renders a non-clickable `<span role="link" aria-disabled>` with no href (like `href`). */
|
|
6490
6492
|
readonly routerLink: import("@angular/core").InputSignal<string | readonly unknown[] | null>;
|
|
6491
6493
|
/** Query params of the `routerLink` (e.g. `{ section: 'deal-defaults' }`). */
|
|
@@ -6531,7 +6533,7 @@ export declare class ButtonComponent {
|
|
|
6531
6533
|
readonly color: import("@angular/core").InputSignal<string | undefined>;
|
|
6532
6534
|
readonly active: import("@angular/core").InputSignal<boolean>;
|
|
6533
6535
|
readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg" | "xs">;
|
|
6534
|
-
readonly type: import("@angular/core").InputSignal<"
|
|
6536
|
+
readonly type: import("@angular/core").InputSignal<"reset" | "submit" | "button">;
|
|
6535
6537
|
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
6536
6538
|
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
6537
6539
|
readonly fullWidth: import("@angular/core").InputSignal<boolean>;
|
|
@@ -7671,7 +7673,7 @@ export declare class TextInputComponent implements ControlValueAccessor, Validat
|
|
|
7671
7673
|
* `search`, `text`, `none`). Empty (default) = the browser's default for the field, except `type="tel"`, which keeps `tel`.
|
|
7672
7674
|
* It only picks the keyboard; it does not restrict what can be typed or pasted.
|
|
7673
7675
|
*/
|
|
7674
|
-
readonly inputmode: import("@angular/core").InputSignal<"" | "email" | "text" | "
|
|
7676
|
+
readonly inputmode: import("@angular/core").InputSignal<"" | "email" | "text" | "none" | "numeric" | "decimal" | "search" | "tel" | "url">;
|
|
7675
7677
|
readonly readonly: import("@angular/core").InputSignal<boolean>;
|
|
7676
7678
|
readonly hint: import("@angular/core").InputSignal<string>;
|
|
7677
7679
|
/** Id(s) of an external element that also describes this control (e.g. one shared error text for a group of fields). Space separated; MERGED after the control's own hint / error id in `aria-describedby`, never replacing it. Empty = unchanged. */
|
|
@@ -8694,7 +8696,7 @@ export declare class CopyFieldComponent implements OnDestroy {
|
|
|
8694
8696
|
/** Neither the Clipboard API nor the fallback could copy. */
|
|
8695
8697
|
readonly copyFailed: import("@angular/core").OutputEmitterRef<void>;
|
|
8696
8698
|
protected readonly _id: string;
|
|
8697
|
-
protected readonly _state: import("@angular/core").WritableSignal<"idle" | "
|
|
8699
|
+
protected readonly _state: import("@angular/core").WritableSignal<"idle" | "copied" | "failed">;
|
|
8698
8700
|
protected readonly _announcement: import("@angular/core").Signal<string>;
|
|
8699
8701
|
protected readonly _buttonName: import("@angular/core").Signal<string>;
|
|
8700
8702
|
protected readonly _describedBy: import("@angular/core").Signal<string | null>;
|
|
@@ -9491,7 +9493,7 @@ export declare class DropdownComponent {
|
|
|
9491
9493
|
readonly loader: import("@angular/core").InputSignal<(() => Promise<DropdownItem[]>) | null>;
|
|
9492
9494
|
readonly active: import("@angular/core").InputSignal<boolean>;
|
|
9493
9495
|
readonly activeValue: import("@angular/core").InputSignal<string>;
|
|
9494
|
-
readonly variant: import("@angular/core").InputSignal<"
|
|
9496
|
+
readonly variant: import("@angular/core").InputSignal<"badge" | "button">;
|
|
9495
9497
|
/** Trigger size for `variant="button"`: `sm` (default, the compact toolbar look) or `md` (same padding and type as a medium `ui-button`). */
|
|
9496
9498
|
readonly size: import("@angular/core").InputSignal<"sm" | "md">;
|
|
9497
9499
|
readonly menuWidth: import("@angular/core").InputSignal<string>;
|
|
@@ -9807,7 +9809,7 @@ export declare class FormSectionComponent {
|
|
|
9807
9809
|
}, {}, never, ["*"], true, never>;
|
|
9808
9810
|
}
|
|
9809
9811
|
export declare class FormRowComponent {
|
|
9810
|
-
readonly cols: import("@angular/core").InputSignal<2 |
|
|
9812
|
+
readonly cols: import("@angular/core").InputSignal<2 | 1 | 3 | 4>;
|
|
9811
9813
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormRowComponent, never>;
|
|
9812
9814
|
static ɵcmp: i0.ɵɵComponentDeclaration<FormRowComponent, "ui-form-row", never, {
|
|
9813
9815
|
"cols": {
|
|
@@ -9824,7 +9826,7 @@ export declare class FormRowComponent {
|
|
|
9824
9826
|
* child simply takes the full width. Keep a numeric span within the row's `cols` (use `all` for the whole row).
|
|
9825
9827
|
*/
|
|
9826
9828
|
export declare class FormColSpanDirective {
|
|
9827
|
-
readonly uiColSpan: import("@angular/core").InputSignal<"" | 2 | "2" |
|
|
9829
|
+
readonly uiColSpan: import("@angular/core").InputSignal<"" | 2 | 3 | "2" | "3" | "all">;
|
|
9828
9830
|
protected readonly _class: import("@angular/core").Signal<string>;
|
|
9829
9831
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormColSpanDirective, never>;
|
|
9830
9832
|
static ɵdir: i0.ɵɵDirectiveDeclaration<FormColSpanDirective, "[uiColSpan]", never, {
|
|
@@ -9904,7 +9906,7 @@ export type ListItemIconColor = 'slate' | 'amber' | 'red' | 'blue' | 'green' | '
|
|
|
9904
9906
|
export declare class ListItemComponent implements AfterContentChecked {
|
|
9905
9907
|
private readonly host;
|
|
9906
9908
|
/** Show a radio button, checkbox, or nothing on the left. */
|
|
9907
|
-
readonly leading: import("@angular/core").InputSignal<"none" | "
|
|
9909
|
+
readonly leading: import("@angular/core").InputSignal<"none" | "checkbox" | "radio">;
|
|
9908
9910
|
/** `name` attribute for the radio/checkbox (groups radios together). */
|
|
9909
9911
|
readonly inputName: import("@angular/core").InputSignal<string>;
|
|
9910
9912
|
/** `id` attribute for the radio/checkbox (links the label). */
|
|
@@ -11604,7 +11606,7 @@ export declare class TimelineComponent {
|
|
|
11604
11606
|
/** Any CSS length (e.g. `600px`). When set, the list scrolls inside a keyboard-focusable region of at most this height. Empty = no wrapper. */
|
|
11605
11607
|
readonly maxHeight: import("@angular/core").InputSignal<string>;
|
|
11606
11608
|
/** `below` (default): the time is under the title / description. `end`: the time sits right-aligned on the title row. */
|
|
11607
|
-
readonly timePosition: import("@angular/core").InputSignal<"
|
|
11609
|
+
readonly timePosition: import("@angular/core").InputSignal<"end" | "below">;
|
|
11608
11610
|
/**
|
|
11609
11611
|
* Group the items under a heading per calendar day of `dateTime` ("Today", "Yesterday", "Oct 3", "Oct 3, 2025"). Default false = no headings,
|
|
11610
11612
|
* DOM unchanged. The given order is kept: consecutive items of one day share a heading, the same day appearing again later starts a new group.
|
|
@@ -11933,7 +11935,7 @@ export declare class AddressInputComponent implements ControlValueAccessor, Vali
|
|
|
11933
11935
|
* the object. `valueChange` always emits the object. A written string is read with `parseAddressValue` for display only: the control keeps
|
|
11934
11936
|
* the original text until the user edits a field (so a text the parser cannot split is not rewritten on load).
|
|
11935
11937
|
*/
|
|
11936
|
-
readonly valueFormat: import("@angular/core").InputSignal<"object" | "
|
|
11938
|
+
readonly valueFormat: import("@angular/core").InputSignal<"object" | "auto" | "text">;
|
|
11937
11939
|
/** ZIP rule; the default is the US 5 digits / 5+4 rule. `null` accepts any non-empty ZIP. The ZIP is validated and stored trimmed. */
|
|
11938
11940
|
readonly zipPattern: import("@angular/core").InputSignal<RegExp | null>;
|
|
11939
11941
|
/** Message shown when the ZIP breaks `zipPattern`. */
|
|
@@ -13782,7 +13784,7 @@ export declare class PdfHotspotComponent {
|
|
|
13782
13784
|
/** `ready`: clickable; `blocked`: disabled (a prerequisite is missing); `signed`: shows `image`. */
|
|
13783
13785
|
readonly state: import("@angular/core").InputSignal<"ready" | "blocked" | "signed">;
|
|
13784
13786
|
/** `warning` gives the ready state an amber look (e.g. for initials), default is blue. */
|
|
13785
|
-
readonly tone: import("@angular/core").InputSignal<"
|
|
13787
|
+
readonly tone: import("@angular/core").InputSignal<"primary" | "warning">;
|
|
13786
13788
|
/** Text of the ready button (e.g. "Sign Here"). */
|
|
13787
13789
|
readonly labelInput: import("@angular/core").InputSignal<string | null>;
|
|
13788
13790
|
readonly label: import("@angular/core").Signal<string>;
|
|
@@ -13922,7 +13924,7 @@ export declare class DetailCardComponent {
|
|
|
13922
13924
|
/** true (default) = the title is displayed in capitals (CSS only); false = shown as written. The text, aria-label and heading name are never changed. */
|
|
13923
13925
|
readonly uppercaseTitle: import("@angular/core").InputSignal<boolean>;
|
|
13924
13926
|
/** 1-6 makes the title a real heading for screen readers (role=heading, aria-level); null keeps it plain text. */
|
|
13925
|
-
readonly headingLevel: import("@angular/core").InputSignal<2 | 3 | 4 |
|
|
13927
|
+
readonly headingLevel: import("@angular/core").InputSignal<2 | 1 | 3 | 4 | 5 | 6 | null>;
|
|
13926
13928
|
/** Optional id for the title text; the card is then labelled by it. Without it the title is the card's aria-label. */
|
|
13927
13929
|
readonly titleId: import("@angular/core").InputSignal<string>;
|
|
13928
13930
|
/** Accessible name of the card when the header gives none (no header, or no title). A visible title wins; blank = no name. */
|
|
@@ -13936,7 +13938,7 @@ export declare class DetailCardComponent {
|
|
|
13936
13938
|
/** Background colour of the footer bar (the `[card-footer]` slot) as any CSS colour. Empty = no colour of its own. */
|
|
13937
13939
|
readonly footerBackground: import("@angular/core").InputSignal<string>;
|
|
13938
13940
|
/** Alignment of the `[card-footer]` content: `'start'` (default, unchanged) or `'end'` = a right-aligned action row with an 8px gap. */
|
|
13939
|
-
readonly footerAlign: import("@angular/core").InputSignal<"
|
|
13941
|
+
readonly footerAlign: import("@angular/core").InputSignal<"start" | "end">;
|
|
13940
13942
|
/** Text colour as any CSS colour (`#fff`, `var(--on-dark)` …). Empty = the default colours. Colours the title, subtitle, chevron and body text. */
|
|
13941
13943
|
readonly textColor: import("@angular/core").InputSignal<string>;
|
|
13942
13944
|
/** false = no header at all (no title, edit button, toggle or divider): the card is only the body, always open. */
|
|
@@ -18916,7 +18918,7 @@ export declare class PaymentSidePanelComponent {
|
|
|
18916
18918
|
private readonly terminalAvailable;
|
|
18917
18919
|
/** value -> label of every live method the rendered plugins contribute (the first plugin wins a duplicate value). */
|
|
18918
18920
|
private readonly liveMethods;
|
|
18919
|
-
protected readonly kind: import("@angular/core").Signal<"none" | "
|
|
18921
|
+
protected readonly kind: import("@angular/core").Signal<"none" | "live" | "terminal" | "manual">;
|
|
18920
18922
|
private kindOf;
|
|
18921
18923
|
/** The method list as shown: record-only built-ins (a plugin takes over its own values), plugin extras, and only manual ones while a split is being built. */
|
|
18922
18924
|
readonly methodList: import("@angular/core").Signal<PaymentMethodOption[]>;
|
|
@@ -19212,23 +19214,179 @@ export declare function uiWeekdayName(day: number, style?: 'long' | 'short' | 'n
|
|
|
19212
19214
|
export declare function uiFormatClock(hour: number, minute?: number, locale?: string): string;
|
|
19213
19215
|
/** "9 AM" (English) / "9 a. m." (Spanish): an hour with no minutes, for calendar gutters. */
|
|
19214
19216
|
export declare function uiFormatHour(hour: number, locale?: string): string;
|
|
19217
|
+
/** The switcher value (and `choice()` answer) meaning "no manual choice: follow the browser / the embedding page". */
|
|
19218
|
+
export declare const UI_LANGUAGE_AUTO = "auto";
|
|
19215
19219
|
/**
|
|
19216
|
-
*
|
|
19217
|
-
* the
|
|
19218
|
-
* `labels.setLabels({ ...UI_LABELS_ES, 'dataTable.itemWord': 'cliente' })`.
|
|
19220
|
+
* Language selection for the whole app, in a few lines. Everything is optional: with no configuration the library offers English and Spanish
|
|
19221
|
+
* (English by default), detects the visitor's language automatically, remembers a manual pick, and lets the visitor change it with `<ui-language-switcher />`.
|
|
19219
19222
|
*
|
|
19220
|
-
*
|
|
19221
|
-
*
|
|
19222
|
-
|
|
19223
|
+
* provideUiLanguage() // en + es, automatic
|
|
19224
|
+
* provideUiLanguage({ onApplied: lang => loadMyOwnDictionary(lang) }) // + the app loads ITS texts before the language is announced
|
|
19225
|
+
*/
|
|
19226
|
+
export interface UiLanguageConfig {
|
|
19227
|
+
/** Supported language codes (default `['en', 'es']`). The first one is NOT assumed to be the default: see `defaultLanguage`. */
|
|
19228
|
+
readonly languages?: readonly string[];
|
|
19229
|
+
/** The language used when nothing else decides, and the fallback when a dictionary cannot be loaded (default `'en'`). Must be one of `languages`. */
|
|
19230
|
+
readonly defaultLanguage?: string;
|
|
19231
|
+
/** localStorage key of the visitor's MANUAL choice (default `'ui-language'`). */
|
|
19232
|
+
readonly storageKey?: string;
|
|
19233
|
+
/** Address parameter that sets the language when nothing was chosen manually: `?lang=es` (default `'lang'`). */
|
|
19234
|
+
readonly queryParam?: string;
|
|
19235
|
+
/** `type` of the message an embedding page posts to its iframe: `{ type: 'ui-language', lang: 'es' }` (default `'ui-language'`). */
|
|
19236
|
+
readonly messageType?: string;
|
|
19237
|
+
/** Name of each language in its own language (endonym) for the switcher. Default: a built-in table (en, es, fr, de, pt, it, nl, pl, tr, ar, zh, ja, ko, ru), then `Intl.DisplayNames`, then the code. */
|
|
19238
|
+
readonly languageNames?: Readonly<Record<string, string>>;
|
|
19239
|
+
/** BCP 47 locale of dates and numbers per language. A language without an entry uses the `i18n.locale` marker of its dictionary (`en-US` / `es-US` for the built-in ones). */
|
|
19240
|
+
readonly locales?: Readonly<Record<string, string>>;
|
|
19241
|
+
/**
|
|
19242
|
+
* Loader of the library texts per language: a dynamic import, an HttpClient call or a static object. Overrides the built-in dictionary of that language
|
|
19243
|
+
* (English and Spanish are built in); a language with neither shows the library's built-in English text.
|
|
19244
|
+
*/
|
|
19245
|
+
readonly dictionaries?: Readonly<Record<string, () => Promise<UiLabelDictionary>>>;
|
|
19246
|
+
/** `false` = never read or write browser storage (useful in an iframe: the page follows its embedding page / the browser). Default `true`. */
|
|
19247
|
+
readonly persist?: boolean;
|
|
19248
|
+
/** `false` = ignore messages from an embedding page. Default `true`. */
|
|
19249
|
+
readonly trackEmbeddingParent?: boolean;
|
|
19250
|
+
/**
|
|
19251
|
+
* Awaited while a language is applied, BEFORE `lang()` announces it: the place for the app to load its OWN dictionary (e.g. Transloco's) so no key flashes.
|
|
19252
|
+
* A rejection is swallowed (it never blocks the app).
|
|
19253
|
+
*/
|
|
19254
|
+
readonly onApplied?: (lang: string) => void | Promise<void>;
|
|
19255
|
+
/** `false` = do not register the app initializer; call `UiLanguageService.init()` yourself. Default `true`. */
|
|
19256
|
+
readonly initialize?: boolean;
|
|
19257
|
+
/**
|
|
19258
|
+
* Longest time, in milliseconds, a dictionary loader or `onApplied` may take (default 15000; 0 = wait forever). A loader that takes longer counts as a failed load
|
|
19259
|
+
* (the library stays in the default language and `degraded()` turns true); an `onApplied` that takes longer is given up on. So a hung request can never hold the app initializer forever.
|
|
19260
|
+
*/
|
|
19261
|
+
readonly loadTimeoutMs?: number;
|
|
19262
|
+
/** Origin(s) a parent message must come from (`event.origin`, e.g. `'https://www.example.com'`). Default: any origin. */
|
|
19263
|
+
readonly parentOrigin?: string | readonly string[];
|
|
19264
|
+
}
|
|
19265
|
+
/** Holds the configuration given to `provideUiLanguage()`. */
|
|
19266
|
+
export declare const UI_LANGUAGE_CONFIG: InjectionToken<UiLanguageConfig>;
|
|
19267
|
+
/** The window that embeds this page (iframe parent), or null when the page is not embedded. Specs provide their own to simulate an embedding page. */
|
|
19268
|
+
export declare const EMBEDDING_PARENT: InjectionToken<Window | null>;
|
|
19269
|
+
/**
|
|
19270
|
+
* The library's own dictionary of a built-in language, loaded on demand (a separate lazy chunk): `{}` for English (the built-in texts), the Spanish
|
|
19271
|
+
* dictionary for 'es' (also 'ES', 'es-MX', 'es_CO'), `null` for any other code (no built-in dictionary).
|
|
19272
|
+
*/
|
|
19273
|
+
export declare function loadUiLabels(lang: string): Promise<UiLabelDictionary | null>;
|
|
19274
|
+
/** Registers the language service with its configuration (all optional) and, unless `initialize: false`, an app initializer that waits for the first language to be applied. */
|
|
19275
|
+
export declare function provideUiLanguage(config?: UiLanguageConfig): EnvironmentProviders;
|
|
19276
|
+
/**
|
|
19277
|
+
* The one place that knows the active language.
|
|
19223
19278
|
*
|
|
19224
|
-
*
|
|
19279
|
+
* AUTOMATIC by default, and the visitor can always choose:
|
|
19280
|
+
* 1. the visitor's MANUAL choice (the switcher; the only thing that is saved in the browser) always wins;
|
|
19281
|
+
* 2. otherwise it is detected, first match wins: a message from the embedding page (iframes, live), `?lang=` in the address, the browser's whole
|
|
19282
|
+
* language preference list (`navigator.languages`; regional variants map to their language), then `defaultLanguage`.
|
|
19283
|
+
* An automatic result is never saved, so it keeps following the browser / the embedding page; `setAutomatic()` clears a manual choice. Applying a language
|
|
19284
|
+
* loads its dictionary, hands it to `UiLabelsService` (texts + dates/numbers), runs `onApplied`, then announces it in `lang()` and `<html lang>`.
|
|
19225
19285
|
*
|
|
19226
|
-
*
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19286
|
+
* To follow it from the app's own i18n (Transloco): `effect(() => transloco.setActiveLang(language.lang()))`, and load that library's dictionary in `onApplied`.
|
|
19287
|
+
*/
|
|
19288
|
+
export declare class UiLanguageService implements OnDestroy {
|
|
19289
|
+
private readonly config;
|
|
19290
|
+
private readonly doc;
|
|
19291
|
+
private readonly uiLabels;
|
|
19292
|
+
private readonly embeddingParent;
|
|
19293
|
+
private newest;
|
|
19294
|
+
/** The language most recently asked for (may still be loading); `lang()` only changes once it is ready. */
|
|
19295
|
+
private target;
|
|
19296
|
+
private current;
|
|
19297
|
+
private initPromise;
|
|
19298
|
+
private destroyed;
|
|
19299
|
+
/** True while the library locale in use was set by this service (so only then may it be cleared again; an app's own `setLocale()` is left alone). */
|
|
19300
|
+
private localeSetByService;
|
|
19301
|
+
/** The latest valid language an embedding parent asked for; used before `?lang=` and the browser list whenever no manual choice exists. */
|
|
19302
|
+
private parentLang;
|
|
19303
|
+
private readonly _lang;
|
|
19304
|
+
/**
|
|
19305
|
+
* The language in use, announced after its dictionaries are loaded. If the library's dictionary for it could not be loaded, this is still the REQUESTED
|
|
19306
|
+
* language while the library texts stay in the default language: read `degraded()` to tell.
|
|
19307
|
+
*/
|
|
19308
|
+
readonly lang: Signal<string>;
|
|
19309
|
+
private readonly _degraded;
|
|
19310
|
+
/** `true` after the library dictionary of the last applied language failed to load (or timed out): the library texts and locale are those of the default language. */
|
|
19311
|
+
readonly degraded: Signal<boolean>;
|
|
19312
|
+
private readonly _manual;
|
|
19313
|
+
/** What the visitor picked: a language code, or `'auto'` when nothing was chosen manually. */
|
|
19314
|
+
readonly choice: Signal<string>;
|
|
19315
|
+
/** BCP 47 locale of dates and numbers in the library right now (from `locales`, else the dictionary's `i18n.locale` marker). */
|
|
19316
|
+
readonly locale: Signal<string>;
|
|
19317
|
+
/** The supported language codes. */
|
|
19318
|
+
readonly languages: Signal<readonly string[]>;
|
|
19319
|
+
/** Each supported language written in its own language. */
|
|
19320
|
+
readonly names: Signal<Readonly<Record<string, string>>>;
|
|
19321
|
+
private messageListener;
|
|
19322
|
+
/** Called once at startup (the app initializer): resolves after the first language is applied, so no text flashes. Calling it again returns the same work. */
|
|
19323
|
+
init(): Promise<void>;
|
|
19324
|
+
private start;
|
|
19325
|
+
/** A MANUAL choice (the switcher): applied now and saved in this browser (unless `persist` is false). A code that is not supported becomes `defaultLanguage`. */
|
|
19326
|
+
setLanguage(code: string): Promise<void>;
|
|
19327
|
+
/** Back to automatic: forgets a manual choice and follows the embedding page / `?lang=` / the browser again. */
|
|
19328
|
+
setAutomatic(): Promise<void>;
|
|
19329
|
+
ngOnDestroy(): void;
|
|
19330
|
+
private apply;
|
|
19331
|
+
private run;
|
|
19332
|
+
/** The configured locale of the language, or (no entry) the dictionary's marker; an explicit locale the APP set itself is never cleared. */
|
|
19333
|
+
private applyLocale;
|
|
19334
|
+
/** The dictionary of a language: the app's loader, else the built-in one; none = the library's built-in English text (empty dictionary). A throwing loader is a failed load. */
|
|
19335
|
+
private loadDictionary;
|
|
19336
|
+
private withTimeout;
|
|
19337
|
+
private store;
|
|
19338
|
+
private savedChoice;
|
|
19339
|
+
/** Automatic detection (no manual choice): the embedding page's language, `?lang=`, the browser's whole preference list, then the default language. */
|
|
19340
|
+
private detect;
|
|
19341
|
+
/**
|
|
19342
|
+
* An embedded page follows its embedding page: `postMessage({ type: 'ui-language', lang }, '*')` from the parent window sets the language (live, no reload),
|
|
19343
|
+
* unless the visitor chose manually. Only the parent window is listened to (and, with `parentOrigin`, only that origin), and only a supported language counts.
|
|
19344
|
+
* The latest valid parent language is remembered, so `setAutomatic()` keeps following the parent.
|
|
19345
|
+
*/
|
|
19346
|
+
private listenToEmbeddingPage;
|
|
19347
|
+
private buildNames;
|
|
19348
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiLanguageService, never>;
|
|
19349
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
19350
|
+
}
|
|
19351
|
+
/**
|
|
19352
|
+
* Language picker for the whole app: `<ui-language-switcher />` (needs `provideUiLanguage()`). A native select, so keyboard, screen readers and phones work
|
|
19353
|
+
* with no extra code. The first option, "Automatic (<language in use>)", follows the visitor's browser / the embedding page; picking a language is a manual
|
|
19354
|
+
* choice that is remembered and always wins. Every language is listed in its own name. Test ids: `ui-language-switcher` (the select; `testId` changes it),
|
|
19355
|
+
* `<testId>-option-<code>` and `<testId>-option-auto` on the options.
|
|
19230
19356
|
*/
|
|
19231
|
-
export declare
|
|
19357
|
+
export declare class UiLanguageSwitcherComponent {
|
|
19358
|
+
protected readonly language: UiLanguageService;
|
|
19359
|
+
protected readonly labels: UiLabelsService;
|
|
19360
|
+
protected readonly auto = "auto";
|
|
19361
|
+
/** Accessible name of the select; `null` (default) = the library text for the active language ("Language"). */
|
|
19362
|
+
readonly ariaLabelInput: import("@angular/core").InputSignal<string | null>;
|
|
19363
|
+
protected readonly ariaLabel: import("@angular/core").Signal<string>;
|
|
19364
|
+
/** `id` of the select; empty (default) = a unique generated id (`ui-language-select-1`, `-2` ...), so two switchers on a page never share one. */
|
|
19365
|
+
readonly selectId: import("@angular/core").InputSignal<string>;
|
|
19366
|
+
private readonly generatedId;
|
|
19367
|
+
protected readonly id: import("@angular/core").Signal<string>;
|
|
19368
|
+
/** `data-testid` of the select (default `ui-language-switcher`). */
|
|
19369
|
+
readonly testId: import("@angular/core").InputSignal<string>;
|
|
19370
|
+
protected choose(value: string): void;
|
|
19371
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiLanguageSwitcherComponent, never>;
|
|
19372
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UiLanguageSwitcherComponent, "ui-language-switcher", never, {
|
|
19373
|
+
"ariaLabelInput": {
|
|
19374
|
+
"alias": "ariaLabel";
|
|
19375
|
+
"required": false;
|
|
19376
|
+
"isSignal": true;
|
|
19377
|
+
};
|
|
19378
|
+
"selectId": {
|
|
19379
|
+
"alias": "selectId";
|
|
19380
|
+
"required": false;
|
|
19381
|
+
"isSignal": true;
|
|
19382
|
+
};
|
|
19383
|
+
"testId": {
|
|
19384
|
+
"alias": "testId";
|
|
19385
|
+
"required": false;
|
|
19386
|
+
"isSignal": true;
|
|
19387
|
+
};
|
|
19388
|
+
}, {}, never, never, true, never>;
|
|
19389
|
+
}
|
|
19232
19390
|
/** A charge type the host offers (for example a community's configured charge types). `defaultAmount` and `description` pre-fill the form. */
|
|
19233
19391
|
export interface ChargeTypeOption {
|
|
19234
19392
|
/** Stable id (used for `track`; not sent). */
|