@forgeroute/ui 0.4.79 → 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
|
@@ -407,6 +407,9 @@ export type BulkUpdateOption<T = any> = string | {
|
|
|
407
407
|
/**
|
|
408
408
|
* Direct action only: the past-tense word in the result toast. "N <doneLabel>, M skipped." when anything was skipped / not allowed,
|
|
409
409
|
* else "N <itemLabel>(s) <doneLabel>.". Default 'updated'.
|
|
410
|
+
* English keeps the past-tense word ('resent' -> "N contacts resent."). In Spanish the summary reads "<doneLabel>: N <items>." and the word is
|
|
411
|
+
* a capitalised NOUN, not a participle: pass 'Reenvío' ("Reenvío: 3 contactos."), not 'enviados' ("enviados: 3 contactos."). The built-in
|
|
412
|
+
* default ('updated') is translated by the dictionary and needs nothing.
|
|
410
413
|
*/
|
|
411
414
|
doneLabel?: string;
|
|
412
415
|
/**
|
|
@@ -568,7 +571,7 @@ export interface PageResponse<T> {
|
|
|
568
571
|
* (`emailTemplateEditor.subjectPlaceholder`, `messagingSendMessagePanel.bulkMergeTagHint`): a dictionary handed to another interpolating system must escape them.
|
|
569
572
|
*
|
|
570
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
|
|
571
|
-
* `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
|
|
572
575
|
* dictionary of another language without the marker gets 'en-US' dates until the app sets a locale.
|
|
573
576
|
*
|
|
574
577
|
* Known limitation (ambient `uiText()` / `uiLocale()`): they read ONE process-wide service, the last `UiLabelsService` that was constructed.
|
|
@@ -2216,6 +2219,8 @@ export declare const UI_DEFAULT_LABELS: {
|
|
|
2216
2219
|
readonly 'fileInput.word.audio': "audio";
|
|
2217
2220
|
readonly 'integrations.language': "en";
|
|
2218
2221
|
readonly 'i18n.locale': "en-US";
|
|
2222
|
+
readonly 'language.label': "Language";
|
|
2223
|
+
readonly 'language.automatic': "Automatic ({{ name }})";
|
|
2219
2224
|
readonly 'setupWizard.integrationTitle.twilio': "Twilio (calls & texts)";
|
|
2220
2225
|
readonly 'validation.requiredNoLabel': "This field is required.";
|
|
2221
2226
|
readonly 'common.nSelected': "{{ count }} selected";
|
|
@@ -2248,7 +2253,7 @@ export declare class UiLabelsService implements OnDestroy {
|
|
|
2248
2253
|
private readonly _explicitLocale;
|
|
2249
2254
|
/**
|
|
2250
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
|
|
2251
|
-
* `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
|
|
2252
2257
|
* without the marker, or no dictionary).
|
|
2253
2258
|
*/
|
|
2254
2259
|
readonly locale: Signal<string>;
|
|
@@ -2944,7 +2949,7 @@ export declare class SelectComponent implements ControlValueAccessor, Validator,
|
|
|
2944
2949
|
readonly error: import("@angular/core").InputSignal<string>;
|
|
2945
2950
|
/** Reveal the built-in error messages now (e.g. after a failed Save click), without waiting for blur. */
|
|
2946
2951
|
readonly showErrors: import("@angular/core").InputSignal<boolean>;
|
|
2947
|
-
readonly size: import("@angular/core").InputSignal<"
|
|
2952
|
+
readonly size: import("@angular/core").InputSignal<"default" | "sm">;
|
|
2948
2953
|
readonly _disabledInput: import("@angular/core").InputSignal<boolean>;
|
|
2949
2954
|
private readonly _cvaDisabled;
|
|
2950
2955
|
protected readonly disabled: import("@angular/core").Signal<boolean>;
|
|
@@ -4305,7 +4310,7 @@ export declare class ModalComponent implements OnInit, OnDestroy {
|
|
|
4305
4310
|
*/
|
|
4306
4311
|
readonly describedBy: import("@angular/core").InputSignal<string | null>;
|
|
4307
4312
|
readonly maxWidth: import("@angular/core").InputSignal<string>;
|
|
4308
|
-
readonly bodyOverflow: import("@angular/core").InputSignal<"
|
|
4313
|
+
readonly bodyOverflow: import("@angular/core").InputSignal<"auto" | "hidden" | "visible">;
|
|
4309
4314
|
/** `data-testid` of the dialog element itself (the host `<ui-modal>` is always in the page, the dialog only while open). None when empty. */
|
|
4310
4315
|
readonly dialogTestId: import("@angular/core").InputSignal<string>;
|
|
4311
4316
|
/** Hides the header X button (e.g. while a request is running). Escape and a backdrop click still close unless `closable` is false. */
|
|
@@ -4970,7 +4975,7 @@ export declare class AudioPlayerComponent {
|
|
|
4970
4975
|
/** Accessible name of the player. */
|
|
4971
4976
|
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
4972
4977
|
/** How much to load before play: 'metadata' (default), 'auto' or 'none'. */
|
|
4973
|
-
readonly preload: import("@angular/core").InputSignal<"
|
|
4978
|
+
readonly preload: import("@angular/core").InputSignal<"auto" | "none" | "metadata">;
|
|
4974
4979
|
/** Fires when the browser can't load or decode the source. */
|
|
4975
4980
|
readonly playbackError: import("@angular/core").OutputEmitterRef<void>;
|
|
4976
4981
|
protected readonly failed: import("@angular/core").WritableSignal<boolean>;
|
|
@@ -5391,7 +5396,7 @@ export declare class CheckboxComponent implements ControlValueAccessor, Validato
|
|
|
5391
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.
|
|
5392
5397
|
* Default null: plain label text, exactly as before. Single mode only.
|
|
5393
5398
|
*/
|
|
5394
|
-
readonly headingLevel: import("@angular/core").InputSignal<1 | 3 | 4 |
|
|
5399
|
+
readonly headingLevel: import("@angular/core").InputSignal<2 | 1 | 3 | 4 | 5 | 6 | null>;
|
|
5395
5400
|
readonly indeterminate: import("@angular/core").InputSignal<boolean>;
|
|
5396
5401
|
readonly checked: import("@angular/core").ModelSignal<boolean>;
|
|
5397
5402
|
/**
|
|
@@ -6366,7 +6371,7 @@ export declare class PhoneNumberPickerComponent {
|
|
|
6366
6371
|
protected readonly modeCtl: FormControl<string>;
|
|
6367
6372
|
protected readonly zipCtl: FormControl<string>;
|
|
6368
6373
|
protected readonly areaCtl: FormControl<string>;
|
|
6369
|
-
protected readonly step: import("@angular/core").WritableSignal<
|
|
6374
|
+
protected readonly step: import("@angular/core").WritableSignal<2 | 1 | 3>;
|
|
6370
6375
|
protected readonly mode: import("@angular/core").WritableSignal<PhoneNumberSearchMode>;
|
|
6371
6376
|
private readonly _zip;
|
|
6372
6377
|
private readonly _area;
|
|
@@ -6482,7 +6487,7 @@ export declare class ButtonComponent {
|
|
|
6482
6487
|
* `ghost-start`: a ghost button for list / section toggles - a full-width row with its content aligned to the start, transparent
|
|
6483
6488
|
* background, hover tint and the normal focus ring. Pair it with `ariaExpanded` / `ariaPressed`; the label may contain a heading element.
|
|
6484
6489
|
*/
|
|
6485
|
-
readonly variant: import("@angular/core").InputSignal<"primary" | "secondary" | "
|
|
6490
|
+
readonly variant: import("@angular/core").InputSignal<"primary" | "secondary" | "danger" | "warning" | "link" | "ghost" | "ghost-start" | "tab" | "icon" | "icon-danger">;
|
|
6486
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`). */
|
|
6487
6492
|
readonly routerLink: import("@angular/core").InputSignal<string | readonly unknown[] | null>;
|
|
6488
6493
|
/** Query params of the `routerLink` (e.g. `{ section: 'deal-defaults' }`). */
|
|
@@ -6528,7 +6533,7 @@ export declare class ButtonComponent {
|
|
|
6528
6533
|
readonly color: import("@angular/core").InputSignal<string | undefined>;
|
|
6529
6534
|
readonly active: import("@angular/core").InputSignal<boolean>;
|
|
6530
6535
|
readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg" | "xs">;
|
|
6531
|
-
readonly type: import("@angular/core").InputSignal<"
|
|
6536
|
+
readonly type: import("@angular/core").InputSignal<"reset" | "submit" | "button">;
|
|
6532
6537
|
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
6533
6538
|
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
6534
6539
|
readonly fullWidth: import("@angular/core").InputSignal<boolean>;
|
|
@@ -6778,7 +6783,7 @@ export declare class PillTabsComponent {
|
|
|
6778
6783
|
*/
|
|
6779
6784
|
readonly showDescription: import("@angular/core").InputSignal<boolean>;
|
|
6780
6785
|
/** Heading level of the active tab's title when `showDescription` is on: 2 (default) or 3. */
|
|
6781
|
-
readonly headingLevel: import("@angular/core").InputSignal<
|
|
6786
|
+
readonly headingLevel: import("@angular/core").InputSignal<2 | 3>;
|
|
6782
6787
|
readonly tabChange: import("@angular/core").OutputEmitterRef<string>;
|
|
6783
6788
|
protected readonly activeTab: import("@angular/core").Signal<PillTab | null>;
|
|
6784
6789
|
protected titleId(): string;
|
|
@@ -7115,7 +7120,7 @@ export declare class BulkMessagePanelComponent {
|
|
|
7115
7120
|
readonly sending: import("@angular/core").InputSignal<boolean>;
|
|
7116
7121
|
readonly closed: import("@angular/core").OutputEmitterRef<void>;
|
|
7117
7122
|
readonly send: import("@angular/core").OutputEmitterRef<BulkMessageSendEvent>;
|
|
7118
|
-
readonly channel: import("@angular/core").WritableSignal<"
|
|
7123
|
+
readonly channel: import("@angular/core").WritableSignal<"email" | "text">;
|
|
7119
7124
|
private readonly _subject;
|
|
7120
7125
|
private readonly _body;
|
|
7121
7126
|
get subject(): string;
|
|
@@ -7659,7 +7664,7 @@ export declare class TextInputComponent implements ControlValueAccessor, Validat
|
|
|
7659
7664
|
readonly passwordRequirements: import("@angular/core").InputSignal<boolean>;
|
|
7660
7665
|
/** Rules for `passwordRequirements`; default = the library's five rules (8+ characters, upper, lower, digit, special). */
|
|
7661
7666
|
readonly passwordRules: import("@angular/core").InputSignal<readonly PasswordRule[] | undefined>;
|
|
7662
|
-
readonly type: import("@angular/core").InputSignal<"number" | "
|
|
7667
|
+
readonly type: import("@angular/core").InputSignal<"number" | "email" | "text" | "tel" | "password" | "url">;
|
|
7663
7668
|
readonly maxlength: import("@angular/core").InputSignal<number | undefined>;
|
|
7664
7669
|
readonly required: import("@angular/core").InputSignal<boolean>;
|
|
7665
7670
|
readonly autocomplete: import("@angular/core").InputSignal<string>;
|
|
@@ -7668,7 +7673,7 @@ export declare class TextInputComponent implements ControlValueAccessor, Validat
|
|
|
7668
7673
|
* `search`, `text`, `none`). Empty (default) = the browser's default for the field, except `type="tel"`, which keeps `tel`.
|
|
7669
7674
|
* It only picks the keyboard; it does not restrict what can be typed or pasted.
|
|
7670
7675
|
*/
|
|
7671
|
-
readonly inputmode: import("@angular/core").InputSignal<"" | "
|
|
7676
|
+
readonly inputmode: import("@angular/core").InputSignal<"" | "email" | "text" | "none" | "numeric" | "decimal" | "search" | "tel" | "url">;
|
|
7672
7677
|
readonly readonly: import("@angular/core").InputSignal<boolean>;
|
|
7673
7678
|
readonly hint: import("@angular/core").InputSignal<string>;
|
|
7674
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. */
|
|
@@ -7740,7 +7745,7 @@ export declare class TextInputComponent implements ControlValueAccessor, Validat
|
|
|
7740
7745
|
protected readonly _stepAttr: import("@angular/core").Signal<string | null>;
|
|
7741
7746
|
protected readonly _revealable: import("@angular/core").Signal<boolean>;
|
|
7742
7747
|
protected readonly _shown: import("@angular/core").WritableSignal<boolean>;
|
|
7743
|
-
protected readonly _inputType: import("@angular/core").Signal<"number" | "
|
|
7748
|
+
protected readonly _inputType: import("@angular/core").Signal<"number" | "email" | "text" | "tel" | "password" | "url">;
|
|
7744
7749
|
protected readonly _eyePath: string;
|
|
7745
7750
|
protected readonly _eyeOffPath: string;
|
|
7746
7751
|
protected readonly _showRequirements: import("@angular/core").Signal<boolean>;
|
|
@@ -8691,7 +8696,7 @@ export declare class CopyFieldComponent implements OnDestroy {
|
|
|
8691
8696
|
/** Neither the Clipboard API nor the fallback could copy. */
|
|
8692
8697
|
readonly copyFailed: import("@angular/core").OutputEmitterRef<void>;
|
|
8693
8698
|
protected readonly _id: string;
|
|
8694
|
-
protected readonly _state: import("@angular/core").WritableSignal<"idle" | "
|
|
8699
|
+
protected readonly _state: import("@angular/core").WritableSignal<"idle" | "copied" | "failed">;
|
|
8695
8700
|
protected readonly _announcement: import("@angular/core").Signal<string>;
|
|
8696
8701
|
protected readonly _buttonName: import("@angular/core").Signal<string>;
|
|
8697
8702
|
protected readonly _describedBy: import("@angular/core").Signal<string | null>;
|
|
@@ -9804,7 +9809,7 @@ export declare class FormSectionComponent {
|
|
|
9804
9809
|
}, {}, never, ["*"], true, never>;
|
|
9805
9810
|
}
|
|
9806
9811
|
export declare class FormRowComponent {
|
|
9807
|
-
readonly cols: import("@angular/core").InputSignal<1 | 3 | 4
|
|
9812
|
+
readonly cols: import("@angular/core").InputSignal<2 | 1 | 3 | 4>;
|
|
9808
9813
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormRowComponent, never>;
|
|
9809
9814
|
static ɵcmp: i0.ɵɵComponentDeclaration<FormRowComponent, "ui-form-row", never, {
|
|
9810
9815
|
"cols": {
|
|
@@ -9821,7 +9826,7 @@ export declare class FormRowComponent {
|
|
|
9821
9826
|
* child simply takes the full width. Keep a numeric span within the row's `cols` (use `all` for the whole row).
|
|
9822
9827
|
*/
|
|
9823
9828
|
export declare class FormColSpanDirective {
|
|
9824
|
-
readonly uiColSpan: import("@angular/core").InputSignal<"" |
|
|
9829
|
+
readonly uiColSpan: import("@angular/core").InputSignal<"" | 2 | 3 | "2" | "3" | "all">;
|
|
9825
9830
|
protected readonly _class: import("@angular/core").Signal<string>;
|
|
9826
9831
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormColSpanDirective, never>;
|
|
9827
9832
|
static ɵdir: i0.ɵɵDirectiveDeclaration<FormColSpanDirective, "[uiColSpan]", never, {
|
|
@@ -11055,7 +11060,7 @@ export declare class ChipGroupComponent {
|
|
|
11055
11060
|
readonly spaceAbove: import("@angular/core").InputSignal<"none" | "sm" | "md">;
|
|
11056
11061
|
/** Space below the chip group. */
|
|
11057
11062
|
readonly spaceBelow: import("@angular/core").InputSignal<"none" | "sm" | "md">;
|
|
11058
|
-
protected readonly _gap: import("@angular/core").Signal<"
|
|
11063
|
+
protected readonly _gap: import("@angular/core").Signal<"6px" | "12px" | "8px">;
|
|
11059
11064
|
protected readonly _spaceAbove: import("@angular/core").Signal<"0" | "6px" | "12px">;
|
|
11060
11065
|
protected readonly _spaceBelow: import("@angular/core").Signal<"0" | "6px" | "12px">;
|
|
11061
11066
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChipGroupComponent, never>;
|
|
@@ -11476,7 +11481,7 @@ export declare class IconComponent {
|
|
|
11476
11481
|
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
11477
11482
|
/** Icon size in px. */
|
|
11478
11483
|
readonly size: import("@angular/core").InputSignal<number>;
|
|
11479
|
-
readonly variant: import("@angular/core").InputSignal<"
|
|
11484
|
+
readonly variant: import("@angular/core").InputSignal<"default" | "danger">;
|
|
11480
11485
|
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
11481
11486
|
/** The host is running the request this icon started: a spinner replaces the picture and the button is disabled (no click) until it is false again. */
|
|
11482
11487
|
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
@@ -11930,7 +11935,7 @@ export declare class AddressInputComponent implements ControlValueAccessor, Vali
|
|
|
11930
11935
|
* the object. `valueChange` always emits the object. A written string is read with `parseAddressValue` for display only: the control keeps
|
|
11931
11936
|
* the original text until the user edits a field (so a text the parser cannot split is not rewritten on load).
|
|
11932
11937
|
*/
|
|
11933
|
-
readonly valueFormat: import("@angular/core").InputSignal<"object" | "
|
|
11938
|
+
readonly valueFormat: import("@angular/core").InputSignal<"object" | "auto" | "text">;
|
|
11934
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. */
|
|
11935
11940
|
readonly zipPattern: import("@angular/core").InputSignal<RegExp | null>;
|
|
11936
11941
|
/** Message shown when the ZIP breaks `zipPattern`. */
|
|
@@ -13919,7 +13924,7 @@ export declare class DetailCardComponent {
|
|
|
13919
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. */
|
|
13920
13925
|
readonly uppercaseTitle: import("@angular/core").InputSignal<boolean>;
|
|
13921
13926
|
/** 1-6 makes the title a real heading for screen readers (role=heading, aria-level); null keeps it plain text. */
|
|
13922
|
-
readonly headingLevel: import("@angular/core").InputSignal<1 | 3 | 4 |
|
|
13927
|
+
readonly headingLevel: import("@angular/core").InputSignal<2 | 1 | 3 | 4 | 5 | 6 | null>;
|
|
13923
13928
|
/** Optional id for the title text; the card is then labelled by it. Without it the title is the card's aria-label. */
|
|
13924
13929
|
readonly titleId: import("@angular/core").InputSignal<string>;
|
|
13925
13930
|
/** Accessible name of the card when the header gives none (no header, or no title). A visible title wins; blank = no name. */
|
|
@@ -18913,7 +18918,7 @@ export declare class PaymentSidePanelComponent {
|
|
|
18913
18918
|
private readonly terminalAvailable;
|
|
18914
18919
|
/** value -> label of every live method the rendered plugins contribute (the first plugin wins a duplicate value). */
|
|
18915
18920
|
private readonly liveMethods;
|
|
18916
|
-
protected readonly kind: import("@angular/core").Signal<"none" | "
|
|
18921
|
+
protected readonly kind: import("@angular/core").Signal<"none" | "live" | "terminal" | "manual">;
|
|
18917
18922
|
private kindOf;
|
|
18918
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. */
|
|
18919
18924
|
readonly methodList: import("@angular/core").Signal<PaymentMethodOption[]>;
|
|
@@ -19187,15 +19192,15 @@ export declare function uiFormatDate(value: Date | string | number | null | unde
|
|
|
19187
19192
|
export declare function uiFormatNumber(value: number | null | undefined, locale?: string, options?: Intl.NumberFormatOptions): string;
|
|
19188
19193
|
/**
|
|
19189
19194
|
* `{ currencyDisplay: 'narrowSymbol' }` for US dollars in a locale that would print the bare ISO code ("USD 12.50") and has no "$" money of its own, else `{}`.
|
|
19190
|
-
* A locale where "$" also names the local currency (es-MX, es-AR
|
|
19191
|
-
* `uiFormatCurrency`), which writes "US$12.50" there. Other currencies always get `{}`.
|
|
19195
|
+
* A locale where "$" also names the local currency (it depends on the ICU data which ones do; es-MX and en-AU are typical, some ICU versions already print "US$" for es-AR) gets `{}` here because a bare "$" would be ambiguous: use `uiCurrencyFormatter` (or
|
|
19196
|
+
* `uiFormatCurrency`), which writes "US$12.50" there when the data would otherwise print a bare "$". Other currencies always get `{}`.
|
|
19192
19197
|
*/
|
|
19193
19198
|
export declare function usdCurrencyDisplay(currency: string, locale?: string): {
|
|
19194
19199
|
currencyDisplay?: 'narrowSymbol';
|
|
19195
19200
|
};
|
|
19196
19201
|
/**
|
|
19197
19202
|
* A number formatter for money. The rule for US dollars (see `usdPlan`): "$12.50" in en-US / es-US, the locale's own unambiguous writing where it has one
|
|
19198
|
-
* (en-CA "US$12.50", de-DE "12,50 $", ja-JP "$12.50"), "US$12.50" where the locale would print the bare "USD" and its own money also uses "$" (es-MX
|
|
19203
|
+
* (en-CA "US$12.50", de-DE "12,50 $", ja-JP "$12.50"), "US$12.50" where the locale would print the bare "USD" and its own money also uses "$" (depends on the ICU data: es-MX and en-AU are typical; where ICU already prints "US$" nothing is added).
|
|
19199
19204
|
* An explicit `currencyDisplay` in `options` and every other currency are left to Intl. Works on `formatToParts`, so it does not depend on one ICU version's patterns.
|
|
19200
19205
|
*/
|
|
19201
19206
|
export declare function uiCurrencyFormatter(currency: string, locale?: string, options?: Intl.NumberFormatOptions): Pick<Intl.NumberFormat, 'format'>;
|
|
@@ -19209,23 +19214,179 @@ export declare function uiWeekdayName(day: number, style?: 'long' | 'short' | 'n
|
|
|
19209
19214
|
export declare function uiFormatClock(hour: number, minute?: number, locale?: string): string;
|
|
19210
19215
|
/** "9 AM" (English) / "9 a. m." (Spanish): an hour with no minutes, for calendar gutters. */
|
|
19211
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";
|
|
19212
19219
|
/**
|
|
19213
|
-
*
|
|
19214
|
-
* the
|
|
19215
|
-
* `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 />`.
|
|
19216
19222
|
*
|
|
19217
|
-
*
|
|
19218
|
-
*
|
|
19219
|
-
|
|
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.
|
|
19220
19278
|
*
|
|
19221
|
-
*
|
|
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>`.
|
|
19222
19285
|
*
|
|
19223
|
-
*
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
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.
|
|
19227
19356
|
*/
|
|
19228
|
-
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
|
+
}
|
|
19229
19390
|
/** A charge type the host offers (for example a community's configured charge types). `defaultAmount` and `description` pre-fill the form. */
|
|
19230
19391
|
export interface ChargeTypeOption {
|
|
19231
19392
|
/** Stable id (used for `track`; not sent). */
|