@dxtmisha/functional-basic 0.12.0 → 0.12.4

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/dist/library.d.ts CHANGED
@@ -24,18 +24,19 @@ export declare function anyToString<V>(value: V, isArrayString?: boolean): strin
24
24
  * Класс для работы с запросами.
25
25
  */
26
26
  export declare class Api {
27
- protected static url: string;
28
- protected static headers: ApiHeaders;
29
- protected static requestDefault: ApiDefault;
30
- protected static status: ApiStatus;
31
- protected static response: ApiResponse;
32
- protected static preparation: ApiPreparation;
27
+ protected static item: ApiInstance;
33
28
  /**
34
29
  * Is the server local.
35
30
  *
36
31
  * Является ли сервер локальный.
37
32
  */
38
33
  static isLocalhost(): boolean;
34
+ /**
35
+ * Returns the instance of the class.
36
+ *
37
+ * Возвращает инстанс класса.
38
+ */
39
+ static getItem(): ApiInstance;
39
40
  /**
40
41
  * Returns the status of the last request.
41
42
  *
@@ -99,6 +100,13 @@ export declare class Api {
99
100
  * @param callback function for call/ функция для вызова
100
101
  */
101
102
  static setPreparation(callback: (apiFetch: ApiFetch) => Promise<void>): Api;
103
+ /**
104
+ * Set config for API.
105
+ *
106
+ * Установить конфигурацию для API.
107
+ * @param config config for API/ конфигурация для API
108
+ */
109
+ static setConfig(config?: ApiConfig): Api;
102
110
  /**
103
111
  * Modify the function after the request.
104
112
  *
@@ -141,47 +149,24 @@ export declare class Api {
141
149
  * @param request list of parameters/ список параметров
142
150
  */
143
151
  static delete<T>(request: ApiFetch): Promise<T>;
144
- /**
145
- * To execute a request.
146
- *
147
- * Выполнить запрос.
148
- * @param apiFetch property of the request/ свойство запроса
149
- */
150
- protected static fetch<T>(apiFetch: ApiFetch): Promise<T>;
151
- /**
152
- * Reading data from the response.
153
- *
154
- * Чтение данных из ответа.
155
- * @param query response from the server/ ответ от сервера
156
- * @param queryReturn custom function for reading data/ кастомная функция для чтения данных
157
- * @param end finalization data/ данные финализации
158
- */
159
- protected static readData<T>(query: Response, queryReturn: ApiFetch['queryReturn'], end: ApiPreparationEnd): Promise<ApiData<T>>;
160
- /**
161
- * Executing the request.
162
- *
163
- * Выполнение запроса.
164
- * @param apiFetch property of the request/ свойство запроса
165
- */
166
- protected static makeQuery(apiFetch: ApiFetch): Promise<Response>;
167
- /**
168
- * Transforms data if needed.
169
- *
170
- * Преобразует данные, если нужно.
171
- * @param data data for transformation/ данные для преобразования
172
- * @param toData is it necessary to process the data/ нужно ли обрабатывать данные
173
- */
174
- protected static makeData<T>(data: ApiData<T>, toData: boolean): ApiData<T>;
175
- /**
176
- * Appends the status object to the response data if possible.
177
- *
178
- * Добавляет объект статуса к данным ответа, если это возможно.
179
- * @param data response data/ данные ответа
180
- * @param status status object/ объект статуса
181
- */
182
- protected static makeStatus<T>(data: ApiData<T>, status: ApiStatus): ApiData<T>;
183
152
  }
184
153
 
154
+ /**
155
+ * API configuration/ Конфигурация API
156
+ */
157
+ export declare type ApiConfig = {
158
+ /** Base URL for API requests/ Базовый URL для API-запросов */
159
+ urlRoot?: string;
160
+ /** Default headers for API requests/ Заголовки по умолчанию для API-запросов */
161
+ headers?: Record<string, string>;
162
+ /** Default request data for API requests/ Данные запроса по умолчанию для API-запросов */
163
+ requestDefault?: Record<string, any>;
164
+ /** Function to call before request/ Функция для вызова перед запросом */
165
+ preparation?: (apiFetch: ApiFetch) => Promise<void>;
166
+ /** Function to call after request/ Функция для вызова после запроса */
167
+ end: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>;
168
+ };
169
+
185
170
  /**
186
171
  * Shape of API response data wrapper/ Структура обёртки данных ответа API
187
172
  */
@@ -279,6 +264,8 @@ export declare type ApiFetch = {
279
264
  devMode?: boolean;
280
265
  /** Suppress error logging/ Подавить логирование ошибок */
281
266
  hideError?: boolean;
267
+ /** Suppress loading/ Подавить загрузку */
268
+ hideLoading?: boolean;
282
269
  /** Custom response processor/ Пользовательский процессор ответа */
283
270
  queryReturn?: (query: Response) => Promise<any>;
284
271
  /** Run global preparation hooks/ Запускать глобальные хуки подготовки */
@@ -287,6 +274,8 @@ export declare type ApiFetch = {
287
274
  globalEnd?: boolean;
288
275
  /** Additional fetch() options/ Дополнительные опции fetch() */
289
276
  init?: RequestInit;
277
+ /** Timeout for the request in milliseconds/ Таймаут запроса в миллисекундах */
278
+ timeout?: number;
290
279
  /** AbortController for canceling the request/ AbortController для отмены запроса */
291
280
  controller?: AbortController;
292
281
  };
@@ -315,6 +304,231 @@ export declare class ApiHeaders {
315
304
  set(headers: Record<string, string>): this;
316
305
  }
317
306
 
307
+ /**
308
+ * Class for working with requests.
309
+ *
310
+ * Класс для работы с запросами.
311
+ */
312
+ export declare class ApiInstance {
313
+ protected url: string;
314
+ /** Headers / Заголовки */
315
+ protected headers: ApiHeaders;
316
+ /** Default request parameters / Параметры запроса по умолчанию */
317
+ protected requestDefault: ApiDefault;
318
+ /** Status of the last request / Статус последнего запроса */
319
+ protected status: ApiStatus;
320
+ /** Response handler / Обработчик ответа */
321
+ protected response: ApiResponse;
322
+ /** Request modification handler / Обработчик модификации запроса */
323
+ protected preparation: ApiPreparation;
324
+ /** Loading handler / Обработчик загрузки */
325
+ protected loading: LoadingInstance;
326
+ /** Error handler / Обработчик ошибок */
327
+ protected errorCenter: ErrorCenterInstance;
328
+ /**
329
+ * Constructor
330
+ * @param url base path to the script/ базовый путь к скрипту
331
+ * @param options options for the API instance/ опции для экземпляра API
332
+ */
333
+ constructor(url?: string, options?: ApiInstanceOptions);
334
+ /**
335
+ * Is the server local.
336
+ *
337
+ * Является ли сервер локальный.
338
+ */
339
+ isLocalhost(): boolean;
340
+ /**
341
+ * Returns the status of the last request.
342
+ *
343
+ * Возвращает статус последнего запроса.
344
+ */
345
+ getStatus(): ApiStatus;
346
+ /**
347
+ * Getting the response handler.
348
+ *
349
+ * Получение обработчика ответа.
350
+ */
351
+ getResponse(): ApiResponse;
352
+ /**
353
+ * Getting the full path to the request script.
354
+ *
355
+ * Получение полного пути к скрипту запроса.
356
+ * @param path path to the script/ путь к скрипту
357
+ * @param api adding a path to the site’s API/ добавление пути к API сайта
358
+ */
359
+ getUrl(path: string, api?: boolean): string;
360
+ /**
361
+ * Getting data for the body.
362
+ *
363
+ * Получение данных для тела.
364
+ * @param request this request/ данный запрос
365
+ * @param method method for request/ метод запрос
366
+ */
367
+ getBody(request?: ApiFetch['request'], method?: ApiMethodItem): string | FormData | undefined;
368
+ /**
369
+ * Getting data for the body of the get method.
370
+ *
371
+ * Получение данных для тела метода get.
372
+ * @param request this request/ данный запрос
373
+ * @param path path to request/ путь к запрос
374
+ * @param method method for request/ метод запрос
375
+ */
376
+ getBodyForGet(request: ApiFetch['request'], path?: string, method?: ApiMethodItem): string;
377
+ /**
378
+ * Modifies the default header data.
379
+ *
380
+ * Изменяет данные заголовка по умолчанию.
381
+ */
382
+ setHeaders(headers: Record<string, string>): this;
383
+ /**
384
+ * Modifies the default request data.
385
+ *
386
+ * Изменяет данные запроса по умолчанию.
387
+ */
388
+ setRequestDefault(request: Record<string, any>): this;
389
+ /**
390
+ * Change the base path to the script.
391
+ *
392
+ * Изменить базовый путь к скрипту.
393
+ * @param url path to the script/ путь к скрипту
394
+ */
395
+ setUrl(url: string): this;
396
+ /**
397
+ * The function is modified for a call before the request.
398
+ *
399
+ * Изменить функцию перед запросом.
400
+ * @param callback function for call/ функция для вызова
401
+ */
402
+ setPreparation(callback: (apiFetch: ApiFetch) => Promise<void>): this;
403
+ /**
404
+ * Modify the function after the request.
405
+ *
406
+ * Изменить функцию после запроса.
407
+ * @param callback function for call/ функция для вызова
408
+ */
409
+ setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
410
+ /**
411
+ * To execute a request.
412
+ *
413
+ * Выполнить запрос.
414
+ * @param pathRequest query string or list of parameters/ строка запроса или список параметров
415
+ */
416
+ request<T>(pathRequest: string | ApiFetch): Promise<T>;
417
+ /**
418
+ * Sends a get method request.
419
+ *
420
+ * Отправляет запрос метода get.
421
+ * @param request list of parameters/ список параметров
422
+ */
423
+ get<T>(request: ApiFetch): Promise<T>;
424
+ /**
425
+ * Sends a post method request.
426
+ *
427
+ * Отправляет запрос метода post.
428
+ * @param request list of parameters/ список параметров
429
+ */
430
+ post<T>(request: ApiFetch): Promise<T>;
431
+ /**
432
+ * Sends a put method request.
433
+ *
434
+ * Отправляет запрос метода put.
435
+ * @param request list of parameters/ список параметров
436
+ */
437
+ put<T>(request: ApiFetch): Promise<T>;
438
+ /**
439
+ * Sends a delete method request.
440
+ *
441
+ * Отправляет запрос метода delete.
442
+ * @param request list of parameters/ список параметров
443
+ */
444
+ delete<T>(request: ApiFetch): Promise<T>;
445
+ /**
446
+ * To execute a request.
447
+ *
448
+ * Выполнить запрос.
449
+ * @param apiFetch property of the request/ свойство запроса
450
+ */
451
+ protected fetch<T>(apiFetch: ApiFetch): Promise<T>;
452
+ /**
453
+ * Reading data from the response.
454
+ *
455
+ * Чтение данных из ответа.
456
+ * @param query response from the server/ ответ от сервера
457
+ * @param queryReturn custom function for reading data/ кастомная функция для чтения данных
458
+ * @param end finalization data/ данные финализации
459
+ */
460
+ protected readData<T>(query: Response, queryReturn: ApiFetch['queryReturn'], end: ApiPreparationEnd): Promise<ApiData<T>>;
461
+ /**
462
+ * Executing the request.
463
+ *
464
+ * Выполнение запроса.
465
+ * @param apiFetch property of the request/ свойство запроса
466
+ */
467
+ protected makeQuery(apiFetch: ApiFetch): Promise<{
468
+ query: Response;
469
+ timeoutId: any;
470
+ }>;
471
+ /**
472
+ * Transforms data if needed.
473
+ *
474
+ * Преобразует данные, если нужно.
475
+ * @param data data for transformation/ данные для преобразования
476
+ * @param toData is it necessary to process the data/ нужно ли обрабатывать данные
477
+ */
478
+ protected makeData<T>(data: ApiData<T>, toData: boolean): ApiData<T>;
479
+ /**
480
+ * Appends the status object to the response data if possible.
481
+ *
482
+ * Добавляет объект статуса к данным ответа, если это возможно.
483
+ * @param data response data/ данные ответа
484
+ * @param status status object/ объект статуса
485
+ */
486
+ protected makeStatus<T>(data: ApiData<T>, status: ApiStatus): ApiData<T>;
487
+ /**
488
+ * Processing an error.
489
+ *
490
+ * Обработка ошибки.
491
+ * @param error error object/ объект ошибки
492
+ * @param group error group/ группа ошибки
493
+ */
494
+ protected makeError(error: Record<string, any> & {
495
+ name: string;
496
+ }, group?: string): void;
497
+ /**
498
+ * Processing an error query.
499
+ *
500
+ * Обработка ошибки запроса.
501
+ * @param query error query/ ошибка запроса
502
+ */
503
+ protected makeErrorQuery(query: Response): void;
504
+ /**
505
+ * Initialize controller for request.
506
+ *
507
+ * Инициализация контроллера для запроса.
508
+ * @param apiFetch request options/ опции запроса
509
+ * @param fetchInit request initialization/ инициализация запроса
510
+ */
511
+ protected initController(apiFetch: ApiFetch, fetchInit: RequestInit): any;
512
+ }
513
+
514
+ /** Options for the API instance/ Опции для экземпляра API */
515
+ export declare type ApiInstanceOptions = {
516
+ /** Class for working with headers/ Класс для работы с заголовками */
517
+ headersClass?: typeof ApiHeaders;
518
+ /** Class for working with default request parameters/ Класс для работы с параметрами запроса по умолчанию */
519
+ requestDefaultClass?: typeof ApiDefault;
520
+ /** Class for working with status/ Класс для работы со статусом */
521
+ statusClass?: typeof ApiStatus;
522
+ /** Class for working with response/ Класс для работы с ответом */
523
+ responseClass?: typeof ApiResponse;
524
+ /** Class for working with preparation/ Класс для работы с модификацией запроса */
525
+ preparationClass?: typeof ApiPreparation;
526
+ /** Instance of loading handler/ Экземпляр обработчика загрузки */
527
+ loadingClass?: LoadingInstance;
528
+ /** Instance of error handler/ Экземпляр обработчика ошибок */
529
+ errorCenterClass?: ErrorCenterInstance;
530
+ };
531
+
318
532
  /**
319
533
  * Supported HTTP methods type/ Тип HTTP-методов
320
534
  * (derived from ApiMethodItem enum)/ (получен из перечисления ApiMethodItem)
@@ -721,8 +935,9 @@ export declare class BroadcastMessage<Message = any> {
721
935
  * @param name channel name/ название канала
722
936
  * @param callback callback on message received/ колбэк на получение сообщения
723
937
  * @param callbackError callback on message error/ колбэк на ошибку сообщения
938
+ * @param errorCenter error center instance/ экземпляр центра ошибок
724
939
  */
725
- constructor(name: string, callback?: ((event: MessageEvent<Message>) => void) | undefined, callbackError?: ((event: MessageEvent<Message>) => void) | undefined);
940
+ constructor(name: string, callback?: ((event: MessageEvent<Message>) => void) | undefined, callbackError?: ((event: MessageEvent<Message>) => void) | undefined, errorCenter?: ErrorCenterInstance);
726
941
  /**
727
942
  * Get the channel.
728
943
  *
@@ -1000,6 +1215,7 @@ export declare function createElement<T extends HTMLElement>(parentElement?: HTM
1000
1215
  export declare class DataStorage<T> {
1001
1216
  private name;
1002
1217
  private isSession;
1218
+ private errorCenter;
1003
1219
  /**
1004
1220
  * Changing the prefix in key names. Should be called at the beginning of the code.
1005
1221
  *
@@ -1013,8 +1229,9 @@ export declare class DataStorage<T> {
1013
1229
  * Constructor
1014
1230
  * @param name value name/ название значения
1015
1231
  * @param isSession should we use a session/ использовать ли сессию
1232
+ * @param errorCenter error center instance/ экземпляр центра ошибок
1016
1233
  */
1017
- constructor(name: string, isSession?: boolean);
1234
+ constructor(name: string, isSession?: boolean, errorCenter?: ErrorCenterInstance);
1018
1235
  /**
1019
1236
  * Getting data from local storage.
1020
1237
  *
@@ -1615,6 +1832,254 @@ export declare function encodeAttribute(text: string): string;
1615
1832
  */
1616
1833
  export declare function ensureMaxSize(file: Uint8Array, compress?: number, type?: string): Promise<string>;
1617
1834
 
1835
+ /**
1836
+ * Class for managing error storage and handling.
1837
+ *
1838
+ * Класс для управления хранилищем ошибок и их обработкой.
1839
+ */
1840
+ export declare class ErrorCenter {
1841
+ /** Instance of the error center / Экземпляр центра ошибок */
1842
+ protected static item: ErrorCenterInstance;
1843
+ /**
1844
+ * Checks if a cause with specific code exists.
1845
+ *
1846
+ * Проверяет наличие причины с конкретным кодом.
1847
+ * @param code error code / код ошибки
1848
+ * @param group error group / группа ошибки
1849
+ */
1850
+ static has(code: string, group?: string): boolean;
1851
+ /**
1852
+ * Gets a specific error cause by code and group.
1853
+ *
1854
+ * Получает конкретную причину ошибки по коду и группе.
1855
+ * @param code error code / код ошибки
1856
+ * @param group error group / группа ошибки
1857
+ */
1858
+ static get(code: string, group?: string): ErrorCenterCauseItem | undefined;
1859
+ /**
1860
+ * Returns the instance of the class.
1861
+ *
1862
+ * Возвращает инстанс класса.
1863
+ */
1864
+ static getItem(): ErrorCenterInstance;
1865
+ /**
1866
+ * Adds an error cause to the storage.
1867
+ *
1868
+ * Добавляет причину ошибки в хранилище.
1869
+ * @param cause error cause item / элемент причины ошибки
1870
+ */
1871
+ static add(cause: ErrorCenterCauseItem): ErrorCenter;
1872
+ /**
1873
+ * Adds a list of error causes to the storage.
1874
+ *
1875
+ * Добавляет список причин ошибок в хранилище.
1876
+ * @param causes error causes list / список причин ошибок
1877
+ */
1878
+ static addList(causes: ErrorCenterCauseList): ErrorCenter;
1879
+ /**
1880
+ * Registers a new handler.
1881
+ *
1882
+ * Регистрирует новый обработчик.
1883
+ * @param group target group / целевая группа
1884
+ * @param handler handler callback / обратный вызов обработчика
1885
+ */
1886
+ static addHandler(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): ErrorCenter;
1887
+ /**
1888
+ * Registers a list of handlers.
1889
+ *
1890
+ * Регистрирует список обработчиков.
1891
+ * @param handlers handlers list / список обработчиков
1892
+ */
1893
+ static addHandlerList(handlers: ErrorCenterHandlerList): ErrorCenter;
1894
+ /**
1895
+ * Triggers error handling for a group.
1896
+ *
1897
+ * Вызывает обработку ошибки для группы.
1898
+ * @param cause error cause details / детали причины ошибки
1899
+ */
1900
+ static on(cause: ErrorCenterCauseItem): ErrorCenter;
1901
+ }
1902
+
1903
+ /**
1904
+ * Interface for an error item / Интерфейс для элемента ошибки
1905
+ */
1906
+ export declare type ErrorCenterCauseItem = {
1907
+ /** Error group / Группа ошибки */
1908
+ group?: ErrorCenterGroup;
1909
+ /** Error code / Код ошибки */
1910
+ code: string;
1911
+ /** Error label / Название ошибки */
1912
+ label?: string;
1913
+ /** Error message / Сообщение ошибки */
1914
+ message?: string;
1915
+ /** Additional details / Дополнительные детали */
1916
+ details?: any;
1917
+ };
1918
+
1919
+ /**
1920
+ * List of error items / Список элементов ошибок
1921
+ */
1922
+ export declare type ErrorCenterCauseList = ErrorCenterCauseItem[];
1923
+
1924
+ /**
1925
+ * Error group identifier / Идентификатор группы ошибок
1926
+ */
1927
+ export declare type ErrorCenterGroup = string | undefined;
1928
+
1929
+ /**
1930
+ * Class for managing and triggering error handlers.
1931
+ *
1932
+ * Класс для управления и вызова обработчиков ошибок.
1933
+ */
1934
+ export declare class ErrorCenterHandler {
1935
+ /** Registered handlers list / Список зарегистрированных обработчиков */
1936
+ protected handlers: ErrorCenterHandlerList;
1937
+ /**
1938
+ * Constructor
1939
+ * @param handlers initial handlers list / начальный список обработчиков
1940
+ */
1941
+ constructor(handlers?: ErrorCenterHandlerList);
1942
+ /**
1943
+ * Checks if handlers exist for a group.
1944
+ *
1945
+ * Проверяет наличие обработчиков для группы.
1946
+ * @param group error group / группа ошибки
1947
+ */
1948
+ has(group: ErrorCenterGroup): boolean;
1949
+ /**
1950
+ * Gets handlers for a group.
1951
+ *
1952
+ * Получает обработчики для группы.
1953
+ * @param group error group / группа ошибки
1954
+ */
1955
+ get(group: ErrorCenterGroup): ErrorCenterHandlerItem | undefined;
1956
+ /**
1957
+ * Adds a handler for a specific group.
1958
+ *
1959
+ * Добавляет обработчик для определенной группы.
1960
+ * @param group error group / группа ошибки
1961
+ * @param handler callback function / функция обратного вызова
1962
+ */
1963
+ add(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): this;
1964
+ /**
1965
+ * Adds a list of group-based handlers.
1966
+ *
1967
+ * Добавляет список обработчиков по группам.
1968
+ * @param handlers handlers list / список обработчиков
1969
+ */
1970
+ addList(handlers: ErrorCenterHandlerList): this;
1971
+ /**
1972
+ * Triggers handlers for a group and logs to console.
1973
+ *
1974
+ * Вызывает обработчики для группы и выводит ошибку в консоль.
1975
+ * @param cause error cause details / детали причины ошибки
1976
+ */
1977
+ on(cause: ErrorCenterCauseItem): this;
1978
+ /**
1979
+ * Logs error cause to the console.
1980
+ *
1981
+ * Выводит причину ошибки в консоль.
1982
+ * @param cause error details / детали ошибки
1983
+ */
1984
+ protected toConsole(cause: ErrorCenterCauseItem): this;
1985
+ }
1986
+
1987
+ /**
1988
+ * Callback function for error handling / Функция обратного вызова для обработки ошибок
1989
+ */
1990
+ export declare type ErrorCenterHandlerCallback = (cause: ErrorCenterCauseItem) => void;
1991
+
1992
+ /**
1993
+ * Interface for error handler storage / Интерфейс для хранения обработчика ошибок
1994
+ */
1995
+ export declare type ErrorCenterHandlerItem = {
1996
+ /** Targeted error group / Целевая группа ошибок */
1997
+ group?: ErrorCenterGroup;
1998
+ /** List of handlers / Список обработчиков */
1999
+ handlers: ErrorCenterHandlerCallback[];
2000
+ };
2001
+
2002
+ /**
2003
+ * List of error handlers / Список обработчиков ошибок
2004
+ */
2005
+ export declare type ErrorCenterHandlerList = ErrorCenterHandlerItem[];
2006
+
2007
+ /**
2008
+ * Class for managing error storage and handling within an instance.
2009
+ *
2010
+ * Класс для управления хранилищем ошибок и их обработкой внутри экземпляра.
2011
+ */
2012
+ export declare class ErrorCenterInstance {
2013
+ protected handler: ErrorCenterHandler;
2014
+ /** List of stored error causes / Список сохраненных причин ошибок */
2015
+ protected causes: ErrorCenterCauseList;
2016
+ /**
2017
+ * Constructor
2018
+ * @param causes initial list of error causes / начальный список причин ошибок
2019
+ * @param handler handler instance / экземпляр обработчика
2020
+ */
2021
+ constructor(causes?: ErrorCenterCauseList, handler?: ErrorCenterHandler);
2022
+ /**
2023
+ * Checks if a cause with specific code exists.
2024
+ *
2025
+ * Проверяет наличие причины с конкретным кодом.
2026
+ * @param code error code / код ошибки
2027
+ * @param group error group / группа ошибки
2028
+ */
2029
+ has(code: string, group?: string): boolean;
2030
+ /**
2031
+ * Gets a specific error cause by code and group.
2032
+ *
2033
+ * Получает конкретную причину ошибки по коду и группе.
2034
+ * @param code error code / код ошибки
2035
+ * @param group error group / группа ошибки
2036
+ */
2037
+ get(code: string, group?: string): ErrorCenterCauseItem | undefined;
2038
+ /**
2039
+ * Adds an error cause to the storage.
2040
+ *
2041
+ * Добавляет причину ошибки в хранилище.
2042
+ * @param cause error cause item / элемент причины ошибки
2043
+ */
2044
+ add(cause: ErrorCenterCauseItem): this;
2045
+ /**
2046
+ * Adds a list of error causes to the storage.
2047
+ *
2048
+ * Добавляет список причин ошибок в хранилище.
2049
+ * @param causes error causes list / список причин ошибок
2050
+ */
2051
+ addList(causes: ErrorCenterCauseList): this;
2052
+ /**
2053
+ * Registers a new handler.
2054
+ *
2055
+ * Регистрирует новый обработчик.
2056
+ * @param group target group / целевая группа
2057
+ * @param handler handler callback / обратный вызов обработчика
2058
+ */
2059
+ addHandler(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): this;
2060
+ /**
2061
+ * Registers a list of handlers.
2062
+ *
2063
+ * Регистрирует список обработчиков.
2064
+ * @param handlers handlers list / список обработчиков
2065
+ */
2066
+ addHandlerList(handlers: ErrorCenterHandlerList): this;
2067
+ /**
2068
+ * Triggers error handling for a group.
2069
+ *
2070
+ * Вызывает обработку ошибки для группы.
2071
+ * @param cause error cause details / детали причины ошибки
2072
+ */
2073
+ on(cause: ErrorCenterCauseItem): this;
2074
+ /**
2075
+ * Merges provided cause with stored cause data.
2076
+ *
2077
+ * Объединяет предоставленную причину с сохраненными данными причины.
2078
+ * @param cause input cause / входная причина
2079
+ */
2080
+ protected assign(cause: ErrorCenterCauseItem): ErrorCenterCauseItem;
2081
+ }
2082
+
1618
2083
  /**
1619
2084
  * Escapes special regex characters in a string so it can be used safely in a RegExp.
1620
2085
  *
@@ -2590,6 +3055,7 @@ export declare type GeoHours = '12' | '24';
2590
3055
  * языка-зависимых функций
2591
3056
  */
2592
3057
  export declare class GeoIntl {
3058
+ private errorCenter;
2593
3059
  /**
2594
3060
  * Returns an instance of the class according to the specified country code.
2595
3061
  *
@@ -2603,8 +3069,9 @@ export declare class GeoIntl {
2603
3069
  * Constructor
2604
3070
  * @param code country code, full form language-country or one of them/
2605
3071
  * код страны, полный вид язык-страна или один из них
3072
+ * @param errorCenter error center instance/ экземпляр центра ошибок
2606
3073
  */
2607
- constructor(code?: string);
3074
+ constructor(code?: string, errorCenter?: ErrorCenterInstance);
2608
3075
  /**
2609
3076
  * Returns country code and language.
2610
3077
  *
@@ -2888,8 +3355,8 @@ export declare interface GeoItemFull extends Omit<GeoItem, 'firstDay'> {
2888
3355
  * Класс для хранения и обработка маски телефона.
2889
3356
  */
2890
3357
  export declare class GeoPhone {
2891
- protected static list: GeoPhoneValue[];
2892
- protected static map: Record<string, GeoPhoneMap>;
3358
+ protected static list?: GeoPhoneValue[];
3359
+ protected static map?: Record<string, GeoPhoneMap>;
2893
3360
  /**
2894
3361
  * Getting an object with information about the phone code and country.
2895
3362
  *
@@ -3475,6 +3942,13 @@ export declare class Icons {
3475
3942
  * @param url new file path/ новый путь к файлу
3476
3943
  */
3477
3944
  static setUrl(url: string): void;
3945
+ /**
3946
+ * Changes the configuration.
3947
+ *
3948
+ * Изменяет конфигурацию.
3949
+ * @param config new configuration/ новая конфигурация
3950
+ */
3951
+ static setConfig(config: IconsConfig): void;
3478
3952
  /**
3479
3953
  * Returns the icon name.
3480
3954
  *
@@ -3490,6 +3964,13 @@ export declare class Icons {
3490
3964
  protected static wait(): Promise<void>;
3491
3965
  }
3492
3966
 
3967
+ export declare type IconsConfig = {
3968
+ /** URL to the icons storage / URL к хранилищу иконок */
3969
+ url?: string;
3970
+ /** List of custom icons / Список пользовательских иконок */
3971
+ list?: Record<string, IconsItem>;
3972
+ };
3973
+
3493
3974
  export declare type IconsItem = string | Promise<string | any> | (() => Promise<string | any>);
3494
3975
 
3495
3976
  /** Type for 2D coordinates/ Тип для 2D координат */
@@ -3670,6 +4151,14 @@ export declare function isObject<T>(value: T): value is Extract<T, Record<any, a
3670
4151
  */
3671
4152
  export declare function isObjectNotArray<T>(value: T): value is Exclude<Extract<T, Record<any, any>>, any[] | undefined | null>;
3672
4153
 
4154
+ /**
4155
+ * Check if the device is online.
4156
+ *
4157
+ * Проверка, находится ли устройство в сети.
4158
+ * @returns true if the device is online, false otherwise/true, если устройство в сети, иначе false
4159
+ */
4160
+ export declare function isOnLine(): boolean;
4161
+
3673
4162
  /**
3674
4163
  * Checks if value is in the array selected or if value equals selected, if selected is a string.
3675
4164
  *
@@ -3741,14 +4230,84 @@ export declare type ItemName<V> = {
3741
4230
  };
3742
4231
 
3743
4232
  /**
3744
- * Generic item type with label and value properties/
3745
- * Дженерик тип элемента со свойствами label и value
4233
+ * Generic item type with label and value properties/
4234
+ * Дженерик тип элемента со свойствами label и value
4235
+ */
4236
+ export declare type ItemValue<V> = {
4237
+ /** Display text for the item/ Отображаемый текст для элемента */
4238
+ label: string;
4239
+ /** The actual value of the item/ Фактическое значение элемента */
4240
+ value: V;
4241
+ };
4242
+
4243
+ /**
4244
+ * Class for working with global loading.
4245
+ *
4246
+ * Класс для работы с глобальной загрузкой.
4247
+ */
4248
+ export declare class Loading {
4249
+ /** Instance of the loading class / Экземпляр класса загрузки */
4250
+ protected static item: LoadingInstance;
4251
+ /**
4252
+ * Check if the loader is active now.
4253
+ *
4254
+ * Проверить, активен ли сейчас загрузчик.
4255
+ */
4256
+ static is(): boolean;
4257
+ /**
4258
+ * Get current loading value.
4259
+ *
4260
+ * Получить текущее значение загрузки.
4261
+ */
4262
+ static get(): number;
4263
+ /**
4264
+ * Get instance of the loading class.
4265
+ *
4266
+ * Получить экземпляр класса загрузки.
4267
+ */
4268
+ static getItem(): LoadingInstance;
4269
+ /**
4270
+ * Shows the loader.
4271
+ *
4272
+ * Показывает загрузчик.
4273
+ */
4274
+ static show(): void;
4275
+ /**
4276
+ * Hides the loader.
4277
+ *
4278
+ * Скрывает загрузчик.
4279
+ */
4280
+ static hide(): void;
4281
+ /**
4282
+ * Event registration to listen for data changes.
4283
+ *
4284
+ * Регистрация события для прослушивания изменений данных.
4285
+ * @param listener the object that receives a notification (an object that implements the
4286
+ * Event interface) when an event of the specified type occurs/ объект, который принимает
4287
+ * уведомление, когда событие указанного типа произошло
4288
+ * @param element element/ элемент
4289
+ */
4290
+ static registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
4291
+ /**
4292
+ * Unregistration of an event.
4293
+ *
4294
+ * Отмена регистрации события.
4295
+ * @param listener the object that receives a notification (an object that implements the
4296
+ * Event interface) when an event of the specified type occurs/ объект, который принимает
4297
+ * уведомление, когда событие указанного типа произошло
4298
+ * @param element element/ элемент
4299
+ */
4300
+ static unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
4301
+ }
4302
+
4303
+ /**
4304
+ * Data for the loading event.
4305
+ *
4306
+ * Данные для события загрузки.
3746
4307
  */
3747
- export declare type ItemValue<V> = {
3748
- /** Display text for the item/ Отображаемый текст для элемента */
3749
- label: string;
3750
- /** The actual value of the item/ Фактическое значение элемента */
3751
- value: V;
4308
+ export declare type LoadingDetail = {
4309
+ /** Loading status / Статус загрузки */
4310
+ loading: boolean;
3752
4311
  };
3753
4312
 
3754
4313
  /**
@@ -3756,34 +4315,45 @@ export declare type ItemValue<V> = {
3756
4315
  *
3757
4316
  * Класс для работы с глобальной загрузкой.
3758
4317
  */
3759
- export declare class Loading {
3760
- protected static value: number;
3761
- protected static event?: EventItem<Window, CustomEvent>;
3762
- protected static registrationList: LoadingRegistrationItem[];
4318
+ export declare class LoadingInstance {
4319
+ protected eventName: string;
4320
+ /** Current loading value / Текущее значение загрузки */
4321
+ protected value: number;
4322
+ /** Event item / Элемент события */
4323
+ protected event?: EventItem<Window, CustomEvent>;
4324
+ /** Registration list / Список регистрации */
4325
+ protected registrationList: LoadingRegistrationItem[];
4326
+ /**
4327
+ * Constructor
4328
+ * @param eventName name of the event for tracking loading/ название события для отслеживания загрузки
4329
+ */
4330
+ constructor(eventName?: string);
3763
4331
  /**
3764
4332
  * Check if the loader is active now.
3765
4333
  *
3766
4334
  * Проверить, активен ли сейчас загрузчик.
4335
+ * @returns returns true if the loader is active/ возвращает true, если загрузчик активен
3767
4336
  */
3768
- static is(): boolean;
4337
+ is(): boolean;
3769
4338
  /**
3770
4339
  * Get current loading value.
3771
4340
  *
3772
4341
  * Получить текущее значение загрузки.
4342
+ * @returns returns the current loading value/ возвращает текущее значение загрузки
3773
4343
  */
3774
- static get(): number;
4344
+ get(): number;
3775
4345
  /**
3776
4346
  * Shows the loader.
3777
4347
  *
3778
4348
  * Показывает загрузчик.
3779
4349
  */
3780
- static show(): void;
4350
+ show(): void;
3781
4351
  /**
3782
4352
  * Hides the loader.
3783
4353
  *
3784
4354
  * Скрывает загрузчик.
3785
4355
  */
3786
- static hide(): void;
4356
+ hide(): void;
3787
4357
  /**
3788
4358
  * Event registration to listen for data changes.
3789
4359
  *
@@ -3793,7 +4363,7 @@ export declare class Loading {
3793
4363
  * уведомление, когда событие указанного типа произошло
3794
4364
  * @param element element/ элемент
3795
4365
  */
3796
- static registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
4366
+ registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
3797
4367
  /**
3798
4368
  * Unregistration of an event.
3799
4369
  *
@@ -3803,22 +4373,26 @@ export declare class Loading {
3803
4373
  * уведомление, когда событие указанного типа произошло
3804
4374
  * @param element element/ элемент
3805
4375
  */
3806
- static unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
4376
+ unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
3807
4377
  /**
3808
4378
  * Calls the event listener.
3809
4379
  *
3810
4380
  * Вызывает слушателя событий.
3811
4381
  */
3812
- protected static dispatch(): void;
4382
+ protected dispatch(): void;
3813
4383
  }
3814
4384
 
3815
- declare type LoadingDetail = {
3816
- loading: boolean;
3817
- };
3818
-
3819
- declare type LoadingRegistrationItem = {
4385
+ /**
4386
+ * Registration item for the loading event.
4387
+ *
4388
+ * Элемент регистрации для события загрузки.
4389
+ */
4390
+ export declare type LoadingRegistrationItem = {
4391
+ /** Event item / Элемент события */
3820
4392
  item: EventItem<Window, CustomEvent, LoadingDetail>;
4393
+ /** Event listener / Слушатель события */
3821
4394
  listener: EventListenerDetail<CustomEvent, LoadingDetail>;
4395
+ /** Element / Элемент */
3822
4396
  element?: ElementOrString<HTMLElement>;
3823
4397
  };
3824
4398
 
@@ -5708,13 +6282,7 @@ export declare function transformation(value: any, isFunction?: boolean): any;
5708
6282
  * Класс для получения переведенного текста.
5709
6283
  */
5710
6284
  export declare class Translate {
5711
- protected static url: string;
5712
- protected static propsName: string;
5713
- protected static readonly data: Record<string, string>;
5714
- protected static cache: string[];
5715
- protected static resolveList: (() => void)[];
5716
- protected static timeout?: any;
5717
- protected static isReadApi: boolean;
6285
+ protected static item: TranslateInstance;
5718
6286
  /**
5719
6287
  * Getting the translation text by its code.
5720
6288
  *
@@ -5723,6 +6291,12 @@ export declare class Translate {
5723
6291
  * @param replacement If set, replaces the text with the specified values/ если установлено, заменяет текст на указанные значения
5724
6292
  */
5725
6293
  static get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
6294
+ /**
6295
+ * Returns an instance of the class.
6296
+ *
6297
+ * Возвращает экземпляр класса.
6298
+ */
6299
+ static getItem(): TranslateInstance;
5726
6300
  /**
5727
6301
  * Getting the translation text by its code (Sync).
5728
6302
  *
@@ -5807,109 +6381,60 @@ export declare class Translate {
5807
6381
  */
5808
6382
  static setReadApi(value: boolean): Translate;
5809
6383
  /**
5810
- * Checks for translation by code, taking into account fallback options.
5811
- *
5812
- * Проверяет наличие перевода по коду с учетом запасных вариантов.
5813
- * @param name code name/ название кода
5814
- */
5815
- protected static hasName(name: string): boolean;
5816
- /**
5817
- * Retrieves translation text by code, returning the first matching fallback.
5818
- *
5819
- * Получает текст перевода по коду, возвращая первое совпадение из запасных вариантов.
5820
- * @param name code name/ название кода
5821
- */
5822
- protected static getText(name: string): string | undefined;
5823
- /**
5824
- * Getting the full title for translation.
5825
- *
5826
- * Получение полного названия для перевода.
5827
- * @param name code name/ название кода
5828
- */
5829
- protected static getName(name: string): string;
5830
- /**
5831
- * Getting the title for translation by language.
5832
- *
5833
- * Получение названия для перевода по языку.
5834
- * @param name code name/ название кода
5835
- */
5836
- protected static getNameByLanguage(name: string): string;
5837
- /**
5838
- * Getting the title for translation globally.
5839
- *
5840
- * Получение названия для перевода глобально.
5841
- * @param name code name/ название кода
5842
- */
5843
- protected static getNameByGlobal(name: string): string;
5844
- /**
5845
- * Returns a list of names that are not yet in the list.
5846
- *
5847
- * Возвращает список имен, которых еще нет в списке.
5848
- * @param names list of codes to get translations/ список кодов для получения переводов
5849
- */
5850
- protected static getNamesNone(names: string | string[]): string[];
5851
- /**
5852
- * Getting the list of translations from the server.
5853
- *
5854
- * Получение списка переводов с сервера.
5855
- */
5856
- protected static getResponse(): Promise<Record<string, string>>;
5857
- /**
5858
- * Replaces the text with the specified values.
5859
- *
5860
- * Заменяет текст на указанные значения.
5861
- * @param text text to replace/ текст для замены
5862
- * @param replacement values for replacement/ значения для замены
5863
- */
5864
- protected static replacement(text: string, replacement?: string[] | Record<string, string | number>): any;
5865
- /**
5866
- * Adding translation data from the server.
5867
- *
5868
- * Добавление данных по переводу с сервера.
5869
- */
5870
- protected static make(): Promise<void>;
5871
- /**
5872
- * Adding translation data from the list.
6384
+ * Set the configuration for the translation.
5873
6385
  *
5874
- * Добавление данных по переводу из списка.
5875
- * @param list list of translations/ список переводов
6386
+ * Установить конфигурацию для перевода.
6387
+ * @param config configuration/ конфигурация
5876
6388
  */
5877
- protected static makeList(list: Record<string, string>): void;
6389
+ static setConfig(config: TranslateConfig): Translate;
5878
6390
  }
5879
6391
 
5880
6392
  /**
5881
- * Prefix for global translations.
5882
- * Префикс для глобальных переводов.
6393
+ * Prefix for global translations/
6394
+ * Префикс для глобальных переводов
5883
6395
  */
5884
6396
  export declare const TRANSLATE_GLOBAL_PREFIX = "global";
5885
6397
 
5886
6398
  /**
5887
- * Request timeout for batch loading (ms).
5888
- * Таймаут запроса для пакетной загрузки (мс).
6399
+ * Request timeout for batch loading (ms)/
6400
+ * Таймаут запроса для пакетной загрузки (мс)
5889
6401
  */
5890
6402
  export declare const TRANSLATE_TIME_OUT = 160;
5891
6403
 
5892
6404
  /**
5893
- * Translation code or a list of translation codes for template replacement.
5894
- * Код перевода или список кодов для замены шаблона.
6405
+ * Translation code or a list of translation codes for template replacement/
6406
+ * Код перевода или список кодов для замены шаблона
5895
6407
  */
5896
6408
  export declare type TranslateCode = string | string[];
5897
6409
 
5898
6410
  /**
5899
- * A mapping of locale strings to their respective translation file loaders.
5900
- * Сопоставление строк локалей и соответствующих им загрузчиков файлов перевода.
6411
+ * Interface for the functional plugin options /
6412
+ * Интерфейс для опций функционального плагина
6413
+ */
6414
+ export declare type TranslateConfig = {
6415
+ /** URL to the translations script / URL к скрипту переводов */
6416
+ url?: string;
6417
+ /** Property name for translations / Имя свойства для переводов */
6418
+ propsName?: string;
6419
+ /** Read translations from API / Читать переводы из API */
6420
+ readApi?: boolean;
6421
+ };
6422
+
6423
+ /**
6424
+ * A mapping of locale strings to their respective translation file loaders/
6425
+ * Сопоставление строк локалей и соответствующих им загрузчиков файлов перевода
5901
6426
  */
5902
6427
  export declare type TranslateDataFile = Record<string, TranslateDataFileItem>;
5903
6428
 
5904
6429
  /**
5905
- * Asynchronous loader function for a translation file.
5906
- * Асинхронная функция-загрузчик для файла перевода.
6430
+ * Asynchronous loader function for a translation file/
6431
+ * Асинхронная функция-загрузчик для файла перевода
5907
6432
  */
5908
6433
  export declare type TranslateDataFileItem = () => Promise<TranslateDataFileList>;
5909
6434
 
5910
6435
  /**
5911
- * A simple key-value record of translations from a file.
5912
- * Простой рекорд «ключ-значение» с переводами из файла.
6436
+ * A simple key-value record of translations from a file/
6437
+ * Простой рекорд «ключ-значение» с переводами из файла
5913
6438
  */
5914
6439
  export declare type TranslateDataFileList = Record<string, string>;
5915
6440
 
@@ -5919,60 +6444,273 @@ export declare type TranslateDataFileList = Record<string, string>;
5919
6444
  * Класс для работы с файлами перевода.
5920
6445
  */
5921
6446
  export declare class TranslateFile {
6447
+ protected language: string | (() => string);
6448
+ protected location: string | (() => string);
5922
6449
  /** List of files with translations/ Список файлов с переводами */
5923
- protected static files: TranslateDataFile;
6450
+ protected files: TranslateDataFile;
5924
6451
  /** Data from files/ Данные из файлов */
5925
- protected static data: Record<string, TranslateDataFileList>;
6452
+ protected data: Record<string, TranslateDataFileList>;
6453
+ /**
6454
+ * Creates an instance of the class.
6455
+ *
6456
+ * Создает экземпляр класса.
6457
+ * @param data list of files/ список файлов
6458
+ * @param language language/ язык
6459
+ * @param location location/ местоположение
6460
+ */
6461
+ constructor(data?: TranslateDataFile, language?: string | (() => string), location?: string | (() => string));
5926
6462
  /**
5927
6463
  * Checks if there are files for the current location.
5928
6464
  *
5929
6465
  * Проверяет, есть ли файлы для текущего местоположения.
5930
6466
  */
5931
- static isFile(): boolean;
6467
+ isFile(): boolean;
6468
+ /**
6469
+ * Returns the location.
6470
+ *
6471
+ * Возвращает местоположение.
6472
+ */
6473
+ getLocation(): string;
6474
+ /**
6475
+ * Returns the language.
6476
+ *
6477
+ * Возвращает язык.
6478
+ */
6479
+ getLanguage(): string;
5932
6480
  /**
5933
6481
  * Returns a list of translations from the file for the current location.
5934
6482
  *
5935
6483
  * Возвращает список переводов из файла для текущего местоположения.
5936
6484
  */
5937
- static getList(): Promise<TranslateDataFileList | undefined>;
6485
+ getList(): Promise<TranslateDataFileList | undefined>;
5938
6486
  /**
5939
6487
  * Adds a list of files with translations.
5940
6488
  *
5941
6489
  * Добавляет список файлов с переводами.
5942
6490
  * @param data list of files/ список файлов
5943
6491
  */
5944
- static add(data: TranslateDataFile): void;
6492
+ add(data: TranslateDataFile): void;
5945
6493
  /**
5946
6494
  * Returns the key for the current location from the list of files.
5947
6495
  *
5948
6496
  * Возвращает ключ для текущего местоположения из списка файлов.
5949
6497
  */
5950
- protected static getIndex(): string | undefined;
6498
+ protected getIndex(): string | undefined;
5951
6499
  /**
5952
6500
  * Returns a list of translations from the cache.
5953
6501
  *
5954
6502
  * Возвращает список переводов из кэша.
5955
6503
  * @param index file key/ ключ файла
5956
6504
  */
5957
- protected static getByData(index: string): TranslateDataFileList | undefined;
6505
+ protected getByData(index: string): TranslateDataFileList | undefined;
5958
6506
  /**
5959
6507
  * Returns a list of translations from the file and caches the result.
5960
6508
  *
5961
6509
  * Возвращает список переводов из файла и кэширует результат.
5962
6510
  * @param index file key/ ключ файла
5963
6511
  */
5964
- protected static getByFile(index: string): Promise<TranslateDataFileList | undefined>;
6512
+ protected getByFile(index: string): Promise<TranslateDataFileList | undefined>;
6513
+ }
6514
+
6515
+ /**
6516
+ * Class for getting the translated text.
6517
+ *
6518
+ * Класс для получения переведенного текста.
6519
+ */
6520
+ export declare class TranslateInstance {
6521
+ protected url: string;
6522
+ protected propsName: string;
6523
+ protected readonly files: TranslateFile;
6524
+ /** List of translations/ Список переводов */
6525
+ protected readonly data: Record<string, string>;
6526
+ /** Cache of codes to get/ Кэш кодов для получения */
6527
+ protected cache: string[];
6528
+ /** List of resolves for promises/ Список разрешений для промисов */
6529
+ protected resolveList: (() => void)[];
6530
+ /** Timeout for getting translations/ Таймаут для получения переводов */
6531
+ protected timeout?: any;
6532
+ /** Flag indicating whether to read from the API/ Флаг, указывающий, нужно ли читать из API */
6533
+ protected isReadApi: boolean;
6534
+ /**
6535
+ * Creates an instance of the class.
6536
+ *
6537
+ * Создает экземпляр класса.
6538
+ * @param url URL for getting translations/ URL для получения переводов
6539
+ * @param propsName Property name for getting translations/ Имя свойства для получения переводов
6540
+ * @param files List of files with translations/ Список файлов с переводами
6541
+ */
6542
+ constructor(url?: string, propsName?: string, files?: TranslateFile);
6543
+ /**
6544
+ * Getting the translation text by its code.
6545
+ *
6546
+ * Получение текста перевода по его коду.
6547
+ * @param name code name/ название кода
6548
+ * @param replacement If set, replaces the text with the specified values/ если установлено, заменяет текст на указанные значения
6549
+ */
6550
+ get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
6551
+ /**
6552
+ * Getting the translation text by its code (Sync).
6553
+ *
6554
+ * Получение текста перевода по его коду (Sync).
6555
+ * @param name code name/ название кода
6556
+ * @param first If set to false, returns an empty string if there is no text/
6557
+ * если установлено false, возвращает пустую строку, если нет текста
6558
+ * @param replacement If set, replaces the text with the specified values/
6559
+ * если установлено, заменяет текст на указанные значения
6560
+ */
6561
+ getSync(name: string, first?: boolean, replacement?: string[] | Record<string, string | number>): string;
6562
+ /**
6563
+ * Getting a list of translations by an array of text codes.
6564
+ *
6565
+ * Получение списка переводов по массиву кодов текста.
6566
+ * @param names list of codes to get translations/ список кодов для получения переводов
6567
+ */
6568
+ getList<T extends TranslateCode[]>(names: T): Promise<TranslateList<T>>;
6569
+ /**
6570
+ * Getting a list of translations by an array of text codes.
6571
+ *
6572
+ * Получение списка переводов по массиву кодов текста.
6573
+ * @param names list of codes to get translations/ список кодов для получения переводов
6574
+ * @param first If set to false, returns an empty string if there is no text/
6575
+ * если установлено false, возвращает пустую строку, если нет текста
6576
+ */
6577
+ getListSync<T extends TranslateCode[]>(names: T, first?: boolean): TranslateList<T>;
6578
+ /**
6579
+ * Added a list of translated texts.
6580
+ *
6581
+ * Добавлен список переведенных текстов.
6582
+ * @param names list of codes to get translations/ список кодов для получения переводов
6583
+ */
6584
+ add(names: string | string[]): Promise<void>;
6585
+ /**
6586
+ * Adds texts in sync mode.
6587
+ *
6588
+ * Добавляет тексты в режиме синхронизации.
6589
+ * @param data list of texts in the form of key-value/ список текстов в виде ключ-значение
6590
+ */
6591
+ addSync(data: Record<string, string>): void;
6592
+ /**
6593
+ * Adding data in the form of a query or directly, depending on the execution environment.
6594
+ *
6595
+ * Добавление данных в виде запроса или напрямую, в зависимости от среды выполнения.
6596
+ * @param data list of texts in the form of key-value/ список текстов в виде ключ-значение
6597
+ */
6598
+ addNormalOrSync(data: Record<string, string>): Promise<void>;
6599
+ /**
6600
+ * Adds texts synchronously by location.
6601
+ *
6602
+ * Добавляет тексты синхронно по местоположению.
6603
+ * @param data list of texts by location/ список текстов по местоположению
6604
+ */
6605
+ addSyncByLocation(data: Record<string, Record<string, string>>): void;
6606
+ /**
6607
+ * Adds texts synchronously from the file.
6608
+ *
6609
+ * Добавляет тексты синхронно из файла.
6610
+ * @param data file with translations/ файл с переводами
6611
+ */
6612
+ addSyncByFile(data: TranslateDataFile): void;
6613
+ /**
6614
+ * Change the path to the script for obtaining the translation.
6615
+ *
6616
+ * Изменить путь к скрипту для получения перевода.
6617
+ * @param url path to the script/ путь к скрипту
6618
+ */
6619
+ setUrl(url: string): this;
6620
+ /**
6621
+ * Change the name of the property to get the translation.
6622
+ *
6623
+ * Изменить имя свойства для получения перевода.
6624
+ * @param name property name/ имя свойства
6625
+ */
6626
+ setPropsName(name: string): this;
6627
+ /**
6628
+ * Change the read mode from the API.
6629
+ *
6630
+ * Изменить режим чтения из API.
6631
+ * @param value read mode/ режим чтения
6632
+ */
6633
+ setReadApi(value: boolean): this;
6634
+ /**
6635
+ * Checks for translation by code, taking into account fallback options.
6636
+ *
6637
+ * Проверяет наличие перевода по коду с учетом запасных вариантов.
6638
+ * @param name code name/ название кода
6639
+ */
6640
+ protected hasName(name: string): boolean;
6641
+ /**
6642
+ * Retrieves translation text by code, returning the first matching fallback.
6643
+ *
6644
+ * Получает текст перевода по коду, возвращая первое совпадение из запасных вариантов.
6645
+ * @param name code name/ название кода
6646
+ */
6647
+ protected getText(name: string): string | undefined;
6648
+ /**
6649
+ * Getting the full title for translation.
6650
+ *
6651
+ * Получение полного названия для перевода.
6652
+ * @param name code name/ название кода
6653
+ */
6654
+ protected getName(name: string): string;
6655
+ /**
6656
+ * Getting the title for translation by language.
6657
+ *
6658
+ * Получение названия для перевода по языку.
6659
+ * @param name code name/ название кода
6660
+ */
6661
+ protected getNameByLanguage(name: string): string;
6662
+ /**
6663
+ * Getting the title for translation globally.
6664
+ *
6665
+ * Получение названия для перевода глобально.
6666
+ * @param name code name/ название кода
6667
+ */
6668
+ protected getNameByGlobal(name: string): string;
6669
+ /**
6670
+ * Returns a list of names that are not yet in the list.
6671
+ *
6672
+ * Возвращает список имен, которых еще нет в списке.
6673
+ * @param names list of codes to get translations/ список кодов для получения переводов
6674
+ */
6675
+ protected getNamesNone(names: string | string[]): string[];
6676
+ /**
6677
+ * Getting the list of translations from the server.
6678
+ *
6679
+ * Получение списка переводов с сервера.
6680
+ */
6681
+ protected getResponse(): Promise<Record<string, string>>;
6682
+ /**
6683
+ * Replaces the text with the specified values.
6684
+ *
6685
+ * Заменяет текст на указанные значения.
6686
+ * @param text text to replace/ текст для замены
6687
+ * @param replacement values for replacement/ значения для замены
6688
+ */
6689
+ protected replacement(text: string, replacement?: string[] | Record<string, string | number>): any;
6690
+ /**
6691
+ * Adding translation data from the server.
6692
+ *
6693
+ * Добавление данных по переводу с сервера.
6694
+ */
6695
+ protected make(): Promise<void>;
6696
+ /**
6697
+ * Adding translation data from the list.
6698
+ *
6699
+ * Добавление данных по переводу из списка.
6700
+ * @param list list of translations/ список переводов
6701
+ */
6702
+ protected makeList(list: Record<string, string>): void;
5965
6703
  }
5966
6704
 
5967
6705
  /**
5968
- * Return type for translation retrieval: an object if a list was requested, or a string for a single key.
5969
- * Тип возвращаемого значения для получения перевода: объект, если был запрошен список, или строка для одного ключа.
6706
+ * Return type for translation retrieval: an object if a list was requested, or a string for a single key/
6707
+ * Тип возвращаемого значения для получения перевода: объект, если был запрошен список, или строка для одного ключа
5970
6708
  */
5971
6709
  export declare type TranslateItemOrList<T extends TranslateCode> = T extends string[] ? TranslateList<T> : string;
5972
6710
 
5973
6711
  /**
5974
- * Object with translated strings, where the keys are the names of the translation codes.
5975
- * Объект с переведенными строками, где ключи — имена кодов переводов.
6712
+ * Object with translated strings, where the keys are the names of the translation codes/
6713
+ * Объект с переведенными строками, где ключи — имена кодов переводов
5976
6714
  */
5977
6715
  export declare type TranslateList<T extends TranslateCode[]> = {
5978
6716
  [K in T[number] as K extends readonly string[] ? K[0] : K]: string;