@nanahoshi/mona-ui 0.23.3 → 0.24.1
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/README.md +1 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +13 -11
- package/fesm2022/nanahoshi-mona-ui-card.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +4 -2
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +5 -3
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +265 -159
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +5 -3
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +5 -3
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +3 -1
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-BSVlcB9_.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-CnPhVIr4.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-B2pBOuLa.mjs → nanahoshi-mona-ui-grid-grid-list.component-DxY6bfTX.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-Buf4evf5.mjs → nanahoshi-mona-ui-grid-grid-row.component-CaO5Lae6.mjs} +3 -3
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-1RdqLEa9.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-jNYtqg5B.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-DeRc_QcP.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-9FtfCutf.mjs} +12 -10
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +888 -0
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +337 -104
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +401 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +399 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +399 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +399 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +397 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +399 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +397 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +397 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +399 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +401 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +397 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +397 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +397 -0
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +76 -5060
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +5 -3
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +299 -167
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +5 -3
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +4 -2
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +5 -3
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +2 -0
- package/i18n/catalogs/en-US.messages.json +373 -0
- package/i18n/icu/package.json +4 -0
- package/locales/ar-sa/ar-sa.messages.json +373 -0
- package/locales/ar-sa/package.json +4 -0
- package/locales/de-de/de-de.messages.json +373 -0
- package/locales/de-de/package.json +4 -0
- package/locales/es-es/es-es.messages.json +373 -0
- package/locales/es-es/package.json +4 -0
- package/locales/fr-fr/fr-fr.messages.json +373 -0
- package/locales/fr-fr/package.json +4 -0
- package/locales/id-id/id-id.messages.json +373 -0
- package/locales/id-id/package.json +4 -0
- package/locales/it-it/it-it.messages.json +373 -0
- package/locales/it-it/package.json +4 -0
- package/locales/ja-jp/ja-jp.messages.json +373 -0
- package/locales/ja-jp/package.json +4 -0
- package/locales/ko-kr/ko-kr.messages.json +373 -0
- package/locales/ko-kr/package.json +4 -0
- package/locales/pt-br/package.json +4 -0
- package/locales/pt-br/pt-br.messages.json +373 -0
- package/locales/ru-ru/package.json +4 -0
- package/locales/ru-ru/ru-ru.messages.json +373 -0
- package/locales/tr-tr/package.json +4 -0
- package/locales/tr-tr/tr-tr.messages.json +373 -0
- package/locales/zh-cn/package.json +4 -0
- package/locales/zh-cn/zh-cn.messages.json +373 -0
- package/locales/zh-tw/package.json +4 -0
- package/locales/zh-tw/zh-tw.messages.json +373 -0
- package/package.json +111 -53
- package/types/nanahoshi-mona-ui-common.d.ts +116 -73
- package/types/nanahoshi-mona-ui-i18n-icu.d.ts +74 -0
- package/types/nanahoshi-mona-ui-i18n.d.ts +108 -6
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +379 -0
- package/types/nanahoshi-mona-ui-locales.d.ts +30 -4915
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +113 -37
|
@@ -60,7 +60,12 @@ declare class ContainsPipe implements PipeTransform {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
declare class SlicePipe implements PipeTransform {
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Returns the elements from `start` up to, but not including, `end`, with the semantics of `Array.prototype.slice`:
|
|
65
|
+
* negative indices count from the end, and an omitted `end` slices to the end. Returns an empty array for
|
|
66
|
+
* `null` or `undefined`, such as the first value of the `async` pipe.
|
|
67
|
+
*/
|
|
68
|
+
transform<T>(value: Iterable<T> | null | undefined, start: number, end?: number): T[];
|
|
64
69
|
static ɵfac: i0.ɵɵFactoryDeclaration<SlicePipe, never>;
|
|
65
70
|
static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "monaSlice", true>;
|
|
66
71
|
}
|
|
@@ -76,10 +81,12 @@ type BuiltIn = Primitive | Date | RegExp | Function | Map<unknown, unknown> | Se
|
|
|
76
81
|
type DeepPartial<T> = T extends BuiltIn ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : {
|
|
77
82
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
78
83
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Every key path into `T`. Paths stop at built-in values (dates, maps, sets, functions), and index arrays by
|
|
86
|
+
* number, so `['tags', 0]` is a path and `['tags', 'map']` is not.
|
|
87
|
+
*/
|
|
88
|
+
type Path<T> = T extends BuiltIn ? never : T extends ReadonlyArray<infer U> ? [number] | (Path<U> extends infer P ? (P extends ReadonlyArray<PropertyKey> ? [number, ...P] : never) : never) : T extends object ? {
|
|
89
|
+
[K in keyof T]-?: [K] | (Path<T[K]> extends infer P ? (P extends ReadonlyArray<PropertyKey> ? [K, ...P] : never) : never);
|
|
83
90
|
}[keyof T] : never;
|
|
84
91
|
type PathValue<T, P> = P extends readonly [infer K, ...infer R] ? K extends keyof T ? R["length"] extends 0 ? T[K] : PathValue<T[K], Extract<R, ReadonlyArray<PropertyKey>>> : never : never;
|
|
85
92
|
type ArrayStrategy = {
|
|
@@ -92,18 +99,40 @@ type ArrayStrategy = {
|
|
|
92
99
|
};
|
|
93
100
|
interface DeepMergeOptions {
|
|
94
101
|
arrayStrategy?: ArrayStrategy | ((key: PropertyKey, path: ReadonlyArray<PropertyKey>) => ArrayStrategy);
|
|
102
|
+
/**
|
|
103
|
+
* What an own `undefined` value in the patch does. `"skip"` (the default) keeps the base value;
|
|
104
|
+
* `"assign"` sets the field to `undefined`.
|
|
105
|
+
*/
|
|
106
|
+
undefinedValues?: "assign" | "skip";
|
|
95
107
|
}
|
|
96
108
|
declare const isEmptyObject: (obj: Record<PropertyKey, unknown>) => boolean;
|
|
97
109
|
declare const isPlainObject: (v: unknown) => v is Record<PropertyKey, unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* Merges `patch` into a copy of `base`. Only plain objects (object literals, `JSON.parse` output) are merged
|
|
112
|
+
* key by key. Any other value in the patch, including a class instance, a `Date`, a `Map` or a `Set`, replaces
|
|
113
|
+
* the base value as a whole, so a partial patch for a class-instance field must carry the whole value.
|
|
114
|
+
* `__proto__` keys in the patch are ignored.
|
|
115
|
+
*/
|
|
98
116
|
declare function deepMerge<T>(base: T, patch: DeepPartial<T>, options?: DeepMergeOptions, path?: ReadonlyArray<PropertyKey>): T;
|
|
99
117
|
declare function deepMerge<T>(base: DeepPartial<T>, patch: DeepPartial<T>, options?: DeepMergeOptions, path?: ReadonlyArray<PropertyKey>): DeepPartial<T>;
|
|
100
118
|
declare function mergeInto<T>(base: T, patch: DeepPartial<T>, options?: DeepMergeOptions): T;
|
|
101
119
|
declare function mergePatchInto<T>(base: DeepPartial<T>, patch: DeepPartial<T>, options?: DeepMergeOptions): DeepPartial<T>;
|
|
102
|
-
|
|
103
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Builds a patch that sets `leaf` at `keys`. When `current` (the value the patch will be merged into) holds an
|
|
122
|
+
* array along the path, the patch carries a copy of that array with the one element replaced, since arrays are
|
|
123
|
+
* replaced rather than merged. Without `current`, every level is an object.
|
|
124
|
+
*/
|
|
125
|
+
declare function buildNested(keys: ReadonlyArray<PropertyKey>, leaf: unknown, current?: unknown): Record<PropertyKey, unknown>;
|
|
126
|
+
declare function patchAt<T, P extends Path<T>>(path: P, value: PathValue<T, P>, current?: T): DeepPartial<T>;
|
|
104
127
|
declare function setAt<T, P extends Path<T>>(obj: T, path: P, value: PathValue<T, P>, options?: DeepMergeOptions): T;
|
|
105
128
|
declare function prunePatch<T>(base: T, patch: DeepPartial<T>): DeepPartial<T> | undefined;
|
|
106
129
|
declare function prunePatch<T>(base: DeepPartial<T>, patch: DeepPartial<T>): DeepPartial<T> | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Structural equality for plain objects, arrays, `Date`, `RegExp`, `Map` and `Set`. Primitives are equal when
|
|
132
|
+
* `===` says so, and `NaN` equals `NaN`. Dates are equal when they hold the same time (two invalid dates are
|
|
133
|
+
* equal). Map keys and set members are matched by `SameValueZero`, like `Map.prototype.has`. Cyclic values are
|
|
134
|
+
* supported.
|
|
135
|
+
*/
|
|
107
136
|
declare function deepEquals<T>(o1: T, o2: T): boolean;
|
|
108
137
|
|
|
109
138
|
/**
|
|
@@ -142,18 +171,6 @@ interface IObjectPatchStore<T> {
|
|
|
142
171
|
* pending changes (i.e. the draft is an empty object).
|
|
143
172
|
*/
|
|
144
173
|
readonly changes: Signal<DeepPartial<T> | undefined>;
|
|
145
|
-
/**
|
|
146
|
-
* `true` when the current draft is structurally equal to the last
|
|
147
|
-
* committed snapshot, i.e. no unsaved changes exist relative to the
|
|
148
|
-
* last commit point.
|
|
149
|
-
*/
|
|
150
|
-
readonly pristine: Signal<boolean>;
|
|
151
|
-
/**
|
|
152
|
-
* The live merged view of base + draft. Prefer `select()` over reading
|
|
153
|
-
* this directly in computed signals when you only care about a specific
|
|
154
|
-
* slice of the object, to avoid unnecessary downstream invalidations.
|
|
155
|
-
*/
|
|
156
|
-
readonly view: Signal<T>;
|
|
157
174
|
/**
|
|
158
175
|
* Discard the current draft without affecting the committed snapshot.
|
|
159
176
|
* The view reverts to the base value.
|
|
@@ -174,7 +191,8 @@ interface IObjectPatchStore<T> {
|
|
|
174
191
|
* Deep-merge `patch` into the current draft. Only the fields present in
|
|
175
192
|
* `patch` are affected; all other fields retain their current draft or
|
|
176
193
|
* base values. Automatically prunes fields that match the base value so
|
|
177
|
-
* the draft stays minimal.
|
|
194
|
+
* the draft stays minimal. A field set to `undefined` is cleared, unless
|
|
195
|
+
* `options.undefinedValues` is `"skip"`.
|
|
178
196
|
*/
|
|
179
197
|
patch(patch: DeepPartial<T>, options?: DeepMergeOptions): void;
|
|
180
198
|
/**
|
|
@@ -185,26 +203,17 @@ interface IObjectPatchStore<T> {
|
|
|
185
203
|
* store.patchPath(['address', 'city'], 'London');
|
|
186
204
|
*/
|
|
187
205
|
patchPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
|
|
206
|
+
/**
|
|
207
|
+
* `true` when the current draft is structurally equal to the last
|
|
208
|
+
* committed snapshot, i.e. no unsaved changes exist relative to the
|
|
209
|
+
* last commit point.
|
|
210
|
+
*/
|
|
211
|
+
readonly pristine: Signal<boolean>;
|
|
188
212
|
/**
|
|
189
213
|
* Discard both the draft and the committed snapshot, fully resetting
|
|
190
214
|
* the store to a pristine, empty state.
|
|
191
215
|
*/
|
|
192
216
|
reset(): void;
|
|
193
|
-
/**
|
|
194
|
-
* Directly replace the draft with the given patch object, bypassing the
|
|
195
|
-
* merge logic. Use with care — this does not prune against the base.
|
|
196
|
-
* Prefer `patch()` for most use cases.
|
|
197
|
-
*/
|
|
198
|
-
setDraft(patch: DeepPartial<T>): void;
|
|
199
|
-
/**
|
|
200
|
-
* Convenience wrapper over `patch` that sets a single path to a value.
|
|
201
|
-
* Unlike the old implementation, this merges rather than replaces the
|
|
202
|
-
* draft, so unrelated draft fields are preserved.
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* store.setPath(['address', 'city'], 'London');
|
|
206
|
-
*/
|
|
207
|
-
setPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
|
|
208
217
|
/**
|
|
209
218
|
* Returns a `Signal` that emits only the slice of `view` selected by
|
|
210
219
|
* `projector`. Uses `deepEquals` as the equality function, so downstream
|
|
@@ -222,6 +231,28 @@ interface IObjectPatchStore<T> {
|
|
|
222
231
|
* readonly city = store.select(v => v.address.city);
|
|
223
232
|
*/
|
|
224
233
|
select<R>(projector: (view: T) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
|
|
234
|
+
/**
|
|
235
|
+
* Directly replace the draft with the given patch object, bypassing the
|
|
236
|
+
* merge logic. Use with care — this does not prune against the base, so
|
|
237
|
+
* a field equal to its base value still counts in `changes` and
|
|
238
|
+
* `hasDraft()`, while `pristine` ignores it. Prefer `patch()` for most use
|
|
239
|
+
* cases.
|
|
240
|
+
*/
|
|
241
|
+
setDraft(patch: DeepPartial<T>): void;
|
|
242
|
+
/**
|
|
243
|
+
* Same as `patchPath`: sets a single path to a value, merging into the
|
|
244
|
+
* draft, so unrelated draft fields are preserved.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* store.setPath(['address', 'city'], 'London');
|
|
248
|
+
*/
|
|
249
|
+
setPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
|
|
250
|
+
/**
|
|
251
|
+
* The live merged view of base + draft. Prefer `select()` over reading
|
|
252
|
+
* this directly in computed signals when you only care about a specific
|
|
253
|
+
* slice of the object, to avoid unnecessary downstream invalidations.
|
|
254
|
+
*/
|
|
255
|
+
readonly view: Signal<T>;
|
|
225
256
|
}
|
|
226
257
|
declare class ObjectPatchStore<T> implements IObjectPatchStore<T> {
|
|
227
258
|
#private;
|
|
@@ -236,11 +267,16 @@ declare class ObjectPatchStore<T> implements IObjectPatchStore<T> {
|
|
|
236
267
|
patch(patch: DeepPartial<T>, options?: DeepMergeOptions): void;
|
|
237
268
|
patchPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
|
|
238
269
|
reset(): void;
|
|
270
|
+
select<R>(projector: (view: T) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
|
|
239
271
|
setDraft(patch: DeepPartial<T>): void;
|
|
240
272
|
setPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
|
|
241
|
-
select<R>(projector: (view: T) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
|
|
242
273
|
}
|
|
243
274
|
interface IterablePatchStoreOptions<TItem, TId> {
|
|
275
|
+
/**
|
|
276
|
+
* Controls what happens to uncommitted drafts when the base signal emits
|
|
277
|
+
* a new value. Defaults to `'wipe'`.
|
|
278
|
+
*/
|
|
279
|
+
baseChangeStrategy?: BaseChangeStrategy;
|
|
244
280
|
/** Extracts the stable identity key from an item. */
|
|
245
281
|
idOf: (item: TItem) => TId;
|
|
246
282
|
/**
|
|
@@ -248,13 +284,10 @@ interface IterablePatchStoreOptions<TItem, TId> {
|
|
|
248
284
|
* per-row edits). Accepts either a `Map` or an `ImmutableDictionary`.
|
|
249
285
|
*/
|
|
250
286
|
initial?: () => Map<TId, DeepPartial<TItem>> | ImmutableDictionary<TId, DeepPartial<TItem>>;
|
|
287
|
+
/** Default merge options applied to all patch operations unless overridden per-call. */
|
|
288
|
+
mergeOptions?: DeepMergeOptions;
|
|
251
289
|
/** Factory that returns the authoritative base signal for this store. */
|
|
252
290
|
source: () => Signal<Iterable<TItem>>;
|
|
253
|
-
/**
|
|
254
|
-
* Controls what happens to uncommitted drafts when the base signal emits
|
|
255
|
-
* a new value. Defaults to `'wipe'`.
|
|
256
|
-
*/
|
|
257
|
-
baseChangeStrategy?: BaseChangeStrategy;
|
|
258
291
|
}
|
|
259
292
|
interface IIterablePatchStore<TItem, TId> {
|
|
260
293
|
/**
|
|
@@ -262,18 +295,6 @@ interface IIterablePatchStore<TItem, TId> {
|
|
|
262
295
|
* with its current draft. Items without a draft are excluded.
|
|
263
296
|
*/
|
|
264
297
|
readonly changes: Signal<TItem[]>;
|
|
265
|
-
/**
|
|
266
|
-
* `true` when every item's current draft is structurally equal to its
|
|
267
|
-
* last committed snapshot.
|
|
268
|
-
*/
|
|
269
|
-
readonly pristine: Signal<boolean>;
|
|
270
|
-
/**
|
|
271
|
-
* The live merged view of all base items with their drafts applied.
|
|
272
|
-
* Items without a draft are returned as-is (same reference).
|
|
273
|
-
* Prefer `select()` over reading this directly in computed signals when
|
|
274
|
-
* you only care about a specific slice.
|
|
275
|
-
*/
|
|
276
|
-
readonly view: Signal<TItem[]>;
|
|
277
298
|
/**
|
|
278
299
|
* Discard the draft for the item identified by `id`.
|
|
279
300
|
* Has no effect if the item has no draft.
|
|
@@ -298,6 +319,8 @@ interface IIterablePatchStore<TItem, TId> {
|
|
|
298
319
|
* Deep-merge `patch` into the draft for the item identified by `id`.
|
|
299
320
|
* Automatically prunes fields that now match the base item so the draft
|
|
300
321
|
* stays minimal. Removes the draft entry entirely if it becomes empty.
|
|
322
|
+
* A field set to `undefined` is cleared, unless `options.undefinedValues`
|
|
323
|
+
* is `"skip"`.
|
|
301
324
|
*/
|
|
302
325
|
patch(id: TId, patch: DeepPartial<TItem>, options?: DeepMergeOptions): void;
|
|
303
326
|
/**
|
|
@@ -314,26 +337,16 @@ interface IIterablePatchStore<TItem, TId> {
|
|
|
314
337
|
* store.patchPath(itemId, ['address', 'city'], 'London');
|
|
315
338
|
*/
|
|
316
339
|
patchPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
|
|
340
|
+
/**
|
|
341
|
+
* `true` when every item's current draft is structurally equal to its
|
|
342
|
+
* last committed snapshot.
|
|
343
|
+
*/
|
|
344
|
+
readonly pristine: Signal<boolean>;
|
|
317
345
|
/**
|
|
318
346
|
* Discard all drafts and committed snapshots, fully resetting the store
|
|
319
347
|
* to a pristine, empty state.
|
|
320
348
|
*/
|
|
321
349
|
reset(): void;
|
|
322
|
-
/**
|
|
323
|
-
* Directly replace the draft for `id` with the given patch object,
|
|
324
|
-
* bypassing the merge logic. Use with care — this does not prune against
|
|
325
|
-
* the base item. Prefer `patch()` for most use cases.
|
|
326
|
-
*/
|
|
327
|
-
setDraft(id: TId, patch: DeepPartial<TItem>): void;
|
|
328
|
-
/**
|
|
329
|
-
* Convenience wrapper over `patch` that sets a single path to a value
|
|
330
|
-
* for a specific item. Merges into the existing draft rather than
|
|
331
|
-
* replacing it, so unrelated draft fields are preserved.
|
|
332
|
-
*
|
|
333
|
-
* @example
|
|
334
|
-
* store.setPath(itemId, ['address', 'city'], 'London');
|
|
335
|
-
*/
|
|
336
|
-
setPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
|
|
337
350
|
/**
|
|
338
351
|
* Returns a `Signal` that emits only the slice of `view` selected by
|
|
339
352
|
* `projector`. Uses `deepEquals` as the equality function by default,
|
|
@@ -347,6 +360,30 @@ interface IIterablePatchStore<TItem, TId> {
|
|
|
347
360
|
* readonly cities = store.select(items => items.map(i => i.address.city));
|
|
348
361
|
*/
|
|
349
362
|
select<R>(projector: (view: TItem[]) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
|
|
363
|
+
/**
|
|
364
|
+
* Directly replace the draft for `id` with the given patch object,
|
|
365
|
+
* bypassing the merge logic. An empty patch removes the draft. Use with
|
|
366
|
+
* care — this does not prune against the base item, so a field equal to
|
|
367
|
+
* its base value still counts in `changes`, `hasDraft()` and
|
|
368
|
+
* `dirtyCount()`, while `pristine` ignores it. Prefer `patch()` for most
|
|
369
|
+
* use cases.
|
|
370
|
+
*/
|
|
371
|
+
setDraft(id: TId, patch: DeepPartial<TItem>): void;
|
|
372
|
+
/**
|
|
373
|
+
* Same as `patchPath`: sets a single path to a value for a specific item,
|
|
374
|
+
* merging into the existing draft, so unrelated draft fields are preserved.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* store.setPath(itemId, ['address', 'city'], 'London');
|
|
378
|
+
*/
|
|
379
|
+
setPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
|
|
380
|
+
/**
|
|
381
|
+
* The live merged view of all base items with their drafts applied.
|
|
382
|
+
* Items without a draft are returned as-is (same reference).
|
|
383
|
+
* Prefer `select()` over reading this directly in computed signals when
|
|
384
|
+
* you only care about a specific slice.
|
|
385
|
+
*/
|
|
386
|
+
readonly view: Signal<TItem[]>;
|
|
350
387
|
}
|
|
351
388
|
declare class IterablePatchStore<TItem, TId> implements IIterablePatchStore<TItem, TId> {
|
|
352
389
|
#private;
|
|
@@ -360,13 +397,13 @@ declare class IterablePatchStore<TItem, TId> implements IIterablePatchStore<TIte
|
|
|
360
397
|
dirtyCount(): number;
|
|
361
398
|
getCommitted(): ImmutableDictionary<TId, DeepPartial<TItem>>;
|
|
362
399
|
hasDraft(id: TId): boolean;
|
|
363
|
-
patch(id: TId, patch: DeepPartial<TItem>, options?: DeepMergeOptions): void;
|
|
364
|
-
patchMany(patchTuple: Iterable<[TId, DeepPartial<TItem>]>, options?: DeepMergeOptions): void;
|
|
400
|
+
patch(id: TId, patch: DeepPartial<TItem>, options?: DeepMergeOptions | undefined): void;
|
|
401
|
+
patchMany(patchTuple: Iterable<[TId, DeepPartial<TItem>]>, options?: DeepMergeOptions | undefined): void;
|
|
365
402
|
patchPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
|
|
366
403
|
reset(): void;
|
|
404
|
+
select<R>(projector: (view: TItem[]) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
|
|
367
405
|
setDraft(id: TId, patch: DeepPartial<TItem>): void;
|
|
368
406
|
setPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
|
|
369
|
-
select<R>(projector: (view: TItem[]) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
|
|
370
407
|
}
|
|
371
408
|
declare const createIterablePatchStore: <TItem, TId>(options: IterablePatchStoreOptions<TItem, TId>) => IIterablePatchStore<TItem, TId>;
|
|
372
409
|
declare const createObjectPatchStore: <T>(options: ObjectPatchStoreOptions<T>) => IObjectPatchStore<T>;
|
|
@@ -378,12 +415,18 @@ declare const classInputToClass: (input: ClassInputType) => string;
|
|
|
378
415
|
* @param value The current value.
|
|
379
416
|
* @param min The minimum value.
|
|
380
417
|
* @param max The maximum value.
|
|
381
|
-
* @param precision The number of decimal places to round the percentage to.
|
|
418
|
+
* @param precision The number of decimal places to round the percentage to, clamped to 0–100.
|
|
382
419
|
* @default 2
|
|
383
|
-
* @returns The percentage of the value within the range, rounded to the specified precision
|
|
420
|
+
* @returns The percentage of the value within the range, rounded to the specified precision, or 0 when the range
|
|
421
|
+
* or the value is not finite.
|
|
384
422
|
*/
|
|
385
423
|
declare const getPercentage: (value: number, min: number, max: number, precision?: number) => number;
|
|
386
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Moves the items at `indices` by `offset` positions, keeping their relative order. Returns a copy of the array
|
|
427
|
+
* unchanged when the offset is 0 or not an integer, or when any index is not an integer, is out of bounds, or would
|
|
428
|
+
* move out of bounds. Duplicate indices count once.
|
|
429
|
+
*/
|
|
387
430
|
declare function moveIndices<T>(array: T[], indices: number[], offset: number): T[];
|
|
388
431
|
|
|
389
432
|
export { AnyPipe, ContainsPipe, FilterChangeEvent, IterablePatchStore, ObjectPatchStore, PreventableEvent, SlicePipe, TakeFirstPipe, buildNested, classInputToClass, createIterablePatchStore, createObjectPatchStore, deepEquals, deepMerge, getPercentage, isEmptyObject, isPlainObject, mergeInto, mergePatchInto, moveIndices, patchAt, prunePatch, setAt };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { MonaTextDirection, MonaLocaleMessages, MonaLocale } from '@nanahoshi/mona-ui/i18n';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The messages of a {@link MonaLocaleData}: the same namespaces and keys as `MonaLocaleMessages`, with every message
|
|
5
|
+
* written as an ICU MessageFormat string, so a catalog is plain JSON.
|
|
6
|
+
*/
|
|
7
|
+
type MonaLocaleDataMessages = {
|
|
8
|
+
readonly [N in keyof MonaLocaleMessages]?: {
|
|
9
|
+
readonly [K in keyof MonaLocaleMessages[N]]?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** A locale as data, such as a JSON file exported from a translation-management system. */
|
|
13
|
+
interface MonaLocaleData {
|
|
14
|
+
readonly direction: MonaTextDirection;
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly messages: MonaLocaleDataMessages;
|
|
17
|
+
}
|
|
18
|
+
type MonaLocaleDataIssueCode = "invalid-direction" | "invalid-id" | "invalid-structure" | "missing-other" | "not-a-string" | "parameter-type" | "syntax" | "unknown-key" | "unknown-namespace" | "unknown-parameter";
|
|
19
|
+
/** A problem found in a {@link MonaLocaleData} by `validateMonaLocaleData` or `compileMonaLocale`. */
|
|
20
|
+
interface MonaLocaleDataIssue {
|
|
21
|
+
readonly code: MonaLocaleDataIssueCode;
|
|
22
|
+
/** A sentence that describes the problem. */
|
|
23
|
+
readonly message: string;
|
|
24
|
+
/** Where the problem is, such as `messages.pager.pageStatus`. */
|
|
25
|
+
readonly path: string;
|
|
26
|
+
}
|
|
27
|
+
interface MonaCompileLocaleOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Throws a `MonaLocaleDataError` listing every issue instead of skipping the messages that have one. Defaults to
|
|
30
|
+
* `false`.
|
|
31
|
+
*/
|
|
32
|
+
readonly strict?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** A parameter of a message, from the message function's signature. */
|
|
35
|
+
interface MonaMessageParameter {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly optional?: boolean;
|
|
38
|
+
readonly type: "number" | "string";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Thrown by `compileMonaLocale` in strict mode when the data has issues. */
|
|
42
|
+
declare class MonaLocaleDataError extends Error {
|
|
43
|
+
readonly issues: readonly MonaLocaleDataIssue[];
|
|
44
|
+
constructor(issues: readonly MonaLocaleDataIssue[]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Compiles locale data, such as a JSON catalog from a translation-management system, into a `MonaLocale`. Messages
|
|
48
|
+
* with parameters become functions; plain messages become strings.
|
|
49
|
+
*
|
|
50
|
+
* By default, a message with an issue (an unknown key or parameter, or a syntax error) is skipped, so components
|
|
51
|
+
* show their English default for it, and a dev-mode warning lists the issues. With `{ strict: true }`, any issue
|
|
52
|
+
* throws a {@link MonaLocaleDataError} instead.
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* provideMonaI18n({
|
|
56
|
+
* loadLocale: id => fetch(`/i18n/${id}.json`).then(r => r.json()).then(data => compileMonaLocale(data))
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare function compileMonaLocale(data: MonaLocaleData, options?: MonaCompileLocaleOptions): MonaLocale;
|
|
61
|
+
/**
|
|
62
|
+
* Checks locale data without compiling it, for example in CI before a catalog exported from a
|
|
63
|
+
* translation-management system ships. Returns every issue; an empty array means the data compiles cleanly.
|
|
64
|
+
*/
|
|
65
|
+
declare function validateMonaLocaleData(data: unknown): readonly MonaLocaleDataIssue[];
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The parameters of every message, by namespace and key, in the order the message function takes them. A plain
|
|
69
|
+
* string message has `null`.
|
|
70
|
+
*/
|
|
71
|
+
declare const MONA_MESSAGE_PARAMETERS: Readonly<Record<string, Readonly<Record<string, readonly MonaMessageParameter[] | null>>>>;
|
|
72
|
+
|
|
73
|
+
export { MONA_MESSAGE_PARAMETERS, MonaLocaleDataError, compileMonaLocale, validateMonaLocaleData };
|
|
74
|
+
export type { MonaCompileLocaleOptions, MonaLocaleData, MonaLocaleDataIssue, MonaLocaleDataIssueCode, MonaLocaleDataMessages, MonaMessageParameter };
|
|
@@ -483,6 +483,18 @@ interface MonaLocale {
|
|
|
483
483
|
declare const MONA_DEFAULT_LOCALE: MonaLocale;
|
|
484
484
|
|
|
485
485
|
interface MonaI18nConfig {
|
|
486
|
+
/**
|
|
487
|
+
* Locale id loaded with {@link MonaI18nConfig.loadLocale} before the application starts, so the first render
|
|
488
|
+
* is already localized. When loading fails, the application starts with {@link MonaI18nConfig.locale} (or
|
|
489
|
+
* English) and the error is logged.
|
|
490
|
+
*/
|
|
491
|
+
readonly initialLocale?: string;
|
|
492
|
+
/**
|
|
493
|
+
* Loads a locale by id for `MonaI18nService.load()` and {@link MonaI18nConfig.initialLocale}. Use
|
|
494
|
+
* `loadMonaLocale` from `@nanahoshi/mona-ui/locales` for the official locales, or any function that resolves
|
|
495
|
+
* to a `MonaLocale`, such as one that fetches a catalog over HTTP.
|
|
496
|
+
*/
|
|
497
|
+
readonly loadLocale?: (localeId: string) => Promise<MonaLocale>;
|
|
486
498
|
readonly locale?: MonaLocale;
|
|
487
499
|
/**
|
|
488
500
|
* Overrides applied only while the locale with that id is active, keyed by locale id such as "de-DE".
|
|
@@ -505,6 +517,10 @@ declare const MONA_I18N_CONFIG: InjectionToken<MonaI18nConfig>;
|
|
|
505
517
|
declare class MonaI18nService {
|
|
506
518
|
#private;
|
|
507
519
|
readonly direction: Signal<_nanahoshi_mona_ui_i18n.MonaTextDirection>;
|
|
520
|
+
/** The error of the latest `load()` when it failed, otherwise `null`. */
|
|
521
|
+
readonly loadError: Signal<unknown>;
|
|
522
|
+
/** Whether a `load()` is in progress and has not been superseded. */
|
|
523
|
+
readonly loading: Signal<boolean>;
|
|
508
524
|
readonly locale: Signal<MonaLocale>;
|
|
509
525
|
/**
|
|
510
526
|
* Canonical BCP 47 id of the active locale. POSIX ids such as `en_US` are converted to `en-US`,
|
|
@@ -518,6 +534,17 @@ declare class MonaI18nService {
|
|
|
518
534
|
*/
|
|
519
535
|
clearMessages(options?: MonaMessageOverrideOptions): void;
|
|
520
536
|
componentMessages<K extends keyof MonaLocaleMessages>(namespace: K, fallback: MonaLocaleMessages[K]): Signal<MonaLocaleMessages[K]>;
|
|
537
|
+
/**
|
|
538
|
+
* Loads a locale with the `loadLocale` function configured in `provideMonaI18n` and switches to it.
|
|
539
|
+
*
|
|
540
|
+
* - Ids are canonicalized, and each locale is loaded once: later calls reuse it, and concurrent calls for the
|
|
541
|
+
* same id share one request.
|
|
542
|
+
* - The latest `load()` or `use()` wins. When a newer one starts before this one finishes, this one resolves
|
|
543
|
+
* without switching.
|
|
544
|
+
* - When loading fails, the current locale stays, `loadError` is set and the promise rejects. The failed
|
|
545
|
+
* locale is not cached, so a later call retries it.
|
|
546
|
+
*/
|
|
547
|
+
load(localeId: string): Promise<void>;
|
|
521
548
|
/**
|
|
522
549
|
* Merges overrides into the existing ones. With `options.locale`, they apply only while that locale is
|
|
523
550
|
* active, so overrides patched for German do not show after switching to English.
|
|
@@ -527,6 +554,7 @@ declare class MonaI18nService {
|
|
|
527
554
|
* Replaces the existing overrides. With `options.locale`, only that locale's overrides are replaced.
|
|
528
555
|
*/
|
|
529
556
|
setMessages(messages: DeepPartial<MonaLocaleMessages>, options?: MonaMessageOverrideOptions): void;
|
|
557
|
+
/** Switches to a locale that is already loaded. It supersedes a `load()` still in progress. */
|
|
530
558
|
use(locale: MonaLocale): void;
|
|
531
559
|
static ɵfac: i0.ɵɵFactoryDeclaration<MonaI18nService, never>;
|
|
532
560
|
static ɵprov: i0.ɵɵInjectableDeclaration<MonaI18nService>;
|
|
@@ -573,7 +601,11 @@ interface NumberGroupingPattern {
|
|
|
573
601
|
declare function getNumberGroupingPattern(locale: string): NumberGroupingPattern;
|
|
574
602
|
declare function getNumberSymbols(locale: string): NumberSymbols;
|
|
575
603
|
declare function getNumberFormatter(locale: string, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
|
|
576
|
-
|
|
604
|
+
/**
|
|
605
|
+
* Formats a number for the locale. A decimal string, such as one returned by {@link parseLocalizedDecimal}, is
|
|
606
|
+
* formatted exactly, without converting it to a `number` first.
|
|
607
|
+
*/
|
|
608
|
+
declare function formatNumber(value: number | string, locale: string, options?: Intl.NumberFormatOptions): string;
|
|
577
609
|
/**
|
|
578
610
|
* Converts digits of any script to ASCII digits. Full-width forms typed by CJK input methods
|
|
579
611
|
* ("12.5", "-3", "1,000") are folded to ASCII first.
|
|
@@ -602,26 +634,96 @@ interface ParseLocalizedNumberOptions {
|
|
|
602
634
|
*/
|
|
603
635
|
alternateDecimal?: boolean;
|
|
604
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Why a value was refused:
|
|
639
|
+
* - `"syntax"`: the text is not a number in the locale.
|
|
640
|
+
* - `"decimals"`: it has more fraction digits than allowed.
|
|
641
|
+
* - `"precision"`: a JavaScript `number` cannot hold it exactly (an integer beyond
|
|
642
|
+
* `Number.MAX_SAFE_INTEGER`, or more than 15 significant digits), so accepting it would silently change it.
|
|
643
|
+
*/
|
|
644
|
+
type LocalizedNumberInvalidReason = "decimals" | "precision" | "syntax";
|
|
605
645
|
interface LocalizedNumberValidationResult {
|
|
606
|
-
value: number | null;
|
|
607
|
-
valid: boolean;
|
|
608
646
|
fractionDigits: number;
|
|
647
|
+
/** Set when `valid` is false. */
|
|
648
|
+
reason?: LocalizedNumberInvalidReason;
|
|
649
|
+
valid: boolean;
|
|
650
|
+
value: number | null;
|
|
609
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* Parses localized text to a number. Returns `null` when the text is not a number in the locale, or when a
|
|
654
|
+
* `number` cannot hold it exactly (see {@link LocalizedNumberInvalidReason}); it never rounds silently.
|
|
655
|
+
* Use {@link parseLocalizedDecimal} for values that need more precision.
|
|
656
|
+
*/
|
|
610
657
|
declare function parseLocalizedNumber(text: string | null | undefined, localeId: string, options?: ParseLocalizedNumberOptions): number | null;
|
|
658
|
+
/**
|
|
659
|
+
* Parses localized text with the same rules as {@link parseLocalizedNumber}, but returns a canonical decimal string
|
|
660
|
+
* (`"-1234.5"`: ASCII digits, `.` as the decimal separator, no grouping, exponent, leading zeros or trailing
|
|
661
|
+
* fraction zeros) and has no precision limit. Returns `null` when the text is not a number in the locale.
|
|
662
|
+
*/
|
|
663
|
+
declare function parseLocalizedDecimal(text: string | null | undefined, localeId: string, options?: ParseLocalizedNumberOptions): string | null;
|
|
611
664
|
declare function validateLocalizedNumber(text: string | null | undefined, localeId: string, options?: {
|
|
612
665
|
mode?: LocalizedNumberParseMode;
|
|
613
666
|
decimals?: number;
|
|
614
667
|
}): LocalizedNumberValidationResult;
|
|
668
|
+
interface LocalizedDecimalValidationResult {
|
|
669
|
+
fractionDigits: number;
|
|
670
|
+
/** Set when `valid` is false. */
|
|
671
|
+
reason?: LocalizedNumberInvalidReason;
|
|
672
|
+
valid: boolean;
|
|
673
|
+
/** A canonical decimal string, see {@link parseLocalizedDecimal}. */
|
|
674
|
+
value: string | null;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Validates localized text like {@link validateLocalizedNumber}, but returns a canonical decimal string and has no
|
|
678
|
+
* precision limit, so `reason` is never `"precision"`.
|
|
679
|
+
*/
|
|
680
|
+
declare function validateLocalizedDecimal(text: string | null | undefined, localeId: string, options?: {
|
|
681
|
+
mode?: LocalizedNumberParseMode;
|
|
682
|
+
decimals?: number;
|
|
683
|
+
}): LocalizedDecimalValidationResult;
|
|
615
684
|
interface LocalizedNumberEditValidationResult {
|
|
616
|
-
readonly valid: boolean;
|
|
617
685
|
readonly complete: boolean;
|
|
686
|
+
/** Set when `valid` is false. */
|
|
687
|
+
readonly reason?: LocalizedNumberInvalidReason;
|
|
688
|
+
readonly valid: boolean;
|
|
618
689
|
readonly value: number | null;
|
|
619
690
|
}
|
|
691
|
+
interface LocalizedDecimalEditValidationResult {
|
|
692
|
+
readonly complete: boolean;
|
|
693
|
+
/** Set when `valid` is false. */
|
|
694
|
+
readonly reason?: LocalizedNumberInvalidReason;
|
|
695
|
+
readonly valid: boolean;
|
|
696
|
+
/** A canonical decimal string, see {@link parseLocalizedDecimal}. */
|
|
697
|
+
readonly value: string | null;
|
|
698
|
+
}
|
|
620
699
|
interface ValidateLocalizedNumberEditOptions {
|
|
621
700
|
readonly decimals?: number;
|
|
622
701
|
readonly allowSign?: boolean;
|
|
623
702
|
}
|
|
624
703
|
declare function validateLocalizedNumberEdit(text: string | null | undefined, localeId: string, options?: ValidateLocalizedNumberEditOptions): LocalizedNumberEditValidationResult;
|
|
704
|
+
/**
|
|
705
|
+
* Validates text while it is typed, like {@link validateLocalizedNumberEdit}, but returns a canonical decimal string
|
|
706
|
+
* and has no precision limit.
|
|
707
|
+
*/
|
|
708
|
+
declare function validateLocalizedDecimalEdit(text: string | null | undefined, localeId: string, options?: ValidateLocalizedNumberEditOptions): LocalizedDecimalEditValidationResult;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Locale id used whenever a supplied id cannot be turned into a valid BCP 47 tag.
|
|
712
|
+
* Matches the id of `MONA_DEFAULT_LOCALE`.
|
|
713
|
+
*/
|
|
714
|
+
declare const MONA_FALLBACK_LOCALE_ID = "en-US";
|
|
715
|
+
/**
|
|
716
|
+
* Converts a locale id to a canonical BCP 47 tag, or returns `null` when it is not a valid tag.
|
|
717
|
+
*
|
|
718
|
+
* POSIX/Java style ids are accepted: `en_US` becomes `en-US`, and an encoding or modifier suffix
|
|
719
|
+
* (`de_DE.UTF-8`, `de_DE@euro`) is dropped.
|
|
720
|
+
*/
|
|
721
|
+
declare function tryCanonicalizeLocaleId(localeId: string | null | undefined): string | null;
|
|
722
|
+
/**
|
|
723
|
+
* Converts a locale id to a canonical BCP 47 tag. Ids that are empty or not valid tags resolve to
|
|
724
|
+
* {@link MONA_FALLBACK_LOCALE_ID}, so every formatter receives the same, valid locale.
|
|
725
|
+
*/
|
|
726
|
+
declare function canonicalizeLocaleId(localeId: string | null | undefined): string;
|
|
625
727
|
|
|
626
728
|
/**
|
|
627
729
|
* Normalizes a locale string to ensure it uses the Gregorian calendar system
|
|
@@ -722,5 +824,5 @@ declare function pseudoLocalizeCatalog<T extends object>(catalog: T, options?: P
|
|
|
722
824
|
*/
|
|
723
825
|
declare function generatePseudoLocale(catalogs: DeepPartial<MonaLocaleMessages>, options?: GeneratePseudoLocaleOptions): MonaLocale;
|
|
724
826
|
|
|
725
|
-
export { BIDI_CONTROL_REGEX, MONA_DEFAULT_LOCALE, MONA_I18N_CONFIG, MonaDirectionService, MonaI18nService, formatGregorianDateToLocaleString, formatNumber, generatePseudoLocale, getEditDecimalSeparators, getLocaleDateInputFormat, getLocaleDateTimeInputFormat, getLocaleFirstDayOfWeek, getLocaleTimeInputFormat, getNumberFormatter, getNumberGroupingPattern, getNumberSymbols, gregorianDateTime, gregorianDateTimeFromObject, injectComponentDirection, mergeMessages, mergeTwo, normalizeGregorianLocale, normalizeLocalizedDigits, normalizeLocalizedInput, normalizeLocalizedMinus, observeComponentDirection, parseGregorianDate, parseLocalizedNumber, provideMonaI18n, pseudoLocalize, pseudoLocalizeCatalog, resolveComponentDirection, sanitizeDateText, stripBidiControls, validateLocalizedNumber, validateLocalizedNumberEdit };
|
|
726
|
-
export type { CalendarMessages, DatePickerMessages, DateTimePickerMessages, DeepPartial, DialogMessages, DirectionObserverHandle, FilterMessages, GeneratePseudoLocaleOptions, LocaleFirstDayOfWeek, LocaleTimeFormatOptions, LocalizedNumberEditValidationResult, LocalizedNumberParseMode, LocalizedNumberValidationResult, MonaAutoCompleteMessages, MonaBreadcrumbMessages, MonaButtonGroupMessages, MonaCalendarMessages, MonaCardMessages, MonaChartMessages, MonaChipMessages, MonaColorGradientMessages, MonaColorPaletteMessages, MonaColorPickerMessages, MonaComboBoxMessages, MonaDatePickerMessages, MonaDateTimePickerMessages, MonaDialogMessages, MonaDropdownListMessages, MonaDropdownsMessages, MonaEditorMessages, MonaFilterMessages, MonaGridMessages, MonaI18nConfig, MonaListBoxMessages, MonaListMessages, MonaLocale, MonaLocaleMessages, MonaMessageNamespace, MonaMessageOverrideOptions, MonaMultiSelectMessages, MonaNotificationMessages, MonaNumericTextBoxMessages, MonaOtpInputMessages, MonaPagerMessages, MonaRatingMessages, MonaScrollViewMessages, MonaSheetMessages, MonaSliderMessages, MonaSpinnerMessages, MonaSplitButtonMessages, MonaSplitterMessages, MonaStepperMessages, MonaTabsMessages, MonaTextBoxMessages, MonaTextDirection, MonaTimePickerMessages, MonaTimeSelectorMessages, MonaTreeViewMessages, MonaWindowMessages, NotificationMessages, NumberGroupingPattern, NumberSymbols, ParseLocalizedNumberOptions, PseudoLocalizationOptions, SheetMessages, TimePickerMessages, TimeSelectorMessages, ValidateLocalizedNumberEditOptions, WindowMessages };
|
|
827
|
+
export { BIDI_CONTROL_REGEX, MONA_DEFAULT_LOCALE, MONA_FALLBACK_LOCALE_ID, MONA_I18N_CONFIG, MonaDirectionService, MonaI18nService, canonicalizeLocaleId, formatGregorianDateToLocaleString, formatNumber, generatePseudoLocale, getEditDecimalSeparators, getLocaleDateInputFormat, getLocaleDateTimeInputFormat, getLocaleFirstDayOfWeek, getLocaleTimeInputFormat, getNumberFormatter, getNumberGroupingPattern, getNumberSymbols, gregorianDateTime, gregorianDateTimeFromObject, injectComponentDirection, mergeMessages, mergeTwo, normalizeGregorianLocale, normalizeLocalizedDigits, normalizeLocalizedInput, normalizeLocalizedMinus, observeComponentDirection, parseGregorianDate, parseLocalizedDecimal, parseLocalizedNumber, provideMonaI18n, pseudoLocalize, pseudoLocalizeCatalog, resolveComponentDirection, sanitizeDateText, stripBidiControls, tryCanonicalizeLocaleId, validateLocalizedDecimal, validateLocalizedDecimalEdit, validateLocalizedNumber, validateLocalizedNumberEdit };
|
|
828
|
+
export type { CalendarMessages, DatePickerMessages, DateTimePickerMessages, DeepPartial, DialogMessages, DirectionObserverHandle, FilterMessages, GeneratePseudoLocaleOptions, LocaleFirstDayOfWeek, LocaleTimeFormatOptions, LocalizedDecimalEditValidationResult, LocalizedDecimalValidationResult, LocalizedNumberEditValidationResult, LocalizedNumberInvalidReason, LocalizedNumberParseMode, LocalizedNumberValidationResult, MonaAutoCompleteMessages, MonaBreadcrumbMessages, MonaButtonGroupMessages, MonaCalendarMessages, MonaCardMessages, MonaChartMessages, MonaChipMessages, MonaColorGradientMessages, MonaColorPaletteMessages, MonaColorPickerMessages, MonaComboBoxMessages, MonaDatePickerMessages, MonaDateTimePickerMessages, MonaDialogMessages, MonaDropdownListMessages, MonaDropdownsMessages, MonaEditorMessages, MonaFilterMessages, MonaGridMessages, MonaI18nConfig, MonaListBoxMessages, MonaListMessages, MonaLocale, MonaLocaleMessages, MonaMessageNamespace, MonaMessageOverrideOptions, MonaMultiSelectMessages, MonaNotificationMessages, MonaNumericTextBoxMessages, MonaOtpInputMessages, MonaPagerMessages, MonaRatingMessages, MonaScrollViewMessages, MonaSheetMessages, MonaSliderMessages, MonaSpinnerMessages, MonaSplitButtonMessages, MonaSplitterMessages, MonaStepperMessages, MonaTabsMessages, MonaTextBoxMessages, MonaTextDirection, MonaTimePickerMessages, MonaTimeSelectorMessages, MonaTreeViewMessages, MonaWindowMessages, NotificationMessages, NumberGroupingPattern, NumberSymbols, ParseLocalizedNumberOptions, PseudoLocalizationOptions, SheetMessages, TimePickerMessages, TimeSelectorMessages, ValidateLocalizedNumberEditOptions, WindowMessages };
|