@dxtmisha/functional-basic 0.11.1 → 0.11.3
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 +133 -1
- package/dist/library.js +3195 -6040
- package/package.json +1 -1
package/dist/library.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ export declare function addTagHighlightMatch(value: string, search?: string, cla
|
|
|
13
13
|
*
|
|
14
14
|
* Преобразование значения в строку.
|
|
15
15
|
* @param value values for conversion/ значения для преобразования
|
|
16
|
+
* @param isArrayString if true, then arrays will be converted to strings/
|
|
17
|
+
* если true, то массивы будут преобразованы в строки
|
|
16
18
|
*/
|
|
17
|
-
export declare function anyToString<V>(value: V): string;
|
|
19
|
+
export declare function anyToString<V>(value: V, isArrayString?: boolean): string;
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Class for working with requests.
|
|
@@ -1602,6 +1604,17 @@ export declare type EmptyValue = Undefined | 0 | false | '' | 'undefined' | 'nul
|
|
|
1602
1604
|
*/
|
|
1603
1605
|
export declare function encodeAttribute(text: string): string;
|
|
1604
1606
|
|
|
1607
|
+
/**
|
|
1608
|
+
* Ensures that an image does not exceed the maximum size by resizing it if needed.
|
|
1609
|
+
*
|
|
1610
|
+
* Гарантирует, что изображение не превышает максимальный размер, изменяя его размер при необходимости.
|
|
1611
|
+
* @param file image file as Uint8Array / файл изображения в виде Uint8Array
|
|
1612
|
+
* @param compress maximum size as a fraction of the original size (default is 0.7)/
|
|
1613
|
+
* максимальный размер в виде доли от оригинального размера (по умолчанию 0.7)
|
|
1614
|
+
* @param type image type (default is 'image/jpeg') / тип изображения (по умолчанию 'image/jpeg')
|
|
1615
|
+
*/
|
|
1616
|
+
export declare function ensureMaxSize(file: Uint8Array, compress?: number, type?: string): Promise<string>;
|
|
1617
|
+
|
|
1605
1618
|
/**
|
|
1606
1619
|
* Escapes special regex characters in a string so it can be used safely in a RegExp.
|
|
1607
1620
|
*
|
|
@@ -5671,6 +5684,7 @@ export declare class Translate {
|
|
|
5671
5684
|
protected static cache: string[];
|
|
5672
5685
|
protected static resolveList: (() => void)[];
|
|
5673
5686
|
protected static timeout?: any;
|
|
5687
|
+
protected static isReadApi: boolean;
|
|
5674
5688
|
/**
|
|
5675
5689
|
* Getting the translation text by its code.
|
|
5676
5690
|
*
|
|
@@ -5734,6 +5748,13 @@ export declare class Translate {
|
|
|
5734
5748
|
* @param data list of texts by location/ список текстов по местоположению
|
|
5735
5749
|
*/
|
|
5736
5750
|
static addSyncByLocation(data: Record<string, Record<string, string>>): void;
|
|
5751
|
+
/**
|
|
5752
|
+
* Adds texts synchronously from the file.
|
|
5753
|
+
*
|
|
5754
|
+
* Добавляет тексты синхронно из файла.
|
|
5755
|
+
* @param data file with translations/ файл с переводами
|
|
5756
|
+
*/
|
|
5757
|
+
static addSyncByFile(data: TranslateDataFile): void;
|
|
5737
5758
|
/**
|
|
5738
5759
|
* Change the path to the script for obtaining the translation.
|
|
5739
5760
|
*
|
|
@@ -5741,7 +5762,20 @@ export declare class Translate {
|
|
|
5741
5762
|
* @param url path to the script/ путь к скрипту
|
|
5742
5763
|
*/
|
|
5743
5764
|
static setUrl(url: string): Translate;
|
|
5765
|
+
/**
|
|
5766
|
+
* Change the name of the property to get the translation.
|
|
5767
|
+
*
|
|
5768
|
+
* Изменить имя свойства для получения перевода.
|
|
5769
|
+
* @param name property name/ имя свойства
|
|
5770
|
+
*/
|
|
5744
5771
|
static setPropsName(name: string): Translate;
|
|
5772
|
+
/**
|
|
5773
|
+
* Change the read mode from the API.
|
|
5774
|
+
*
|
|
5775
|
+
* Изменить режим чтения из API.
|
|
5776
|
+
* @param value read mode/ режим чтения
|
|
5777
|
+
*/
|
|
5778
|
+
static setReadApi(value: boolean): Translate;
|
|
5745
5779
|
/**
|
|
5746
5780
|
* Checks for translation by code, taking into account fallback options.
|
|
5747
5781
|
*
|
|
@@ -5804,14 +5838,112 @@ export declare class Translate {
|
|
|
5804
5838
|
* Добавление данных по переводу с сервера.
|
|
5805
5839
|
*/
|
|
5806
5840
|
protected static make(): Promise<void>;
|
|
5841
|
+
/**
|
|
5842
|
+
* Adding translation data from the list.
|
|
5843
|
+
*
|
|
5844
|
+
* Добавление данных по переводу из списка.
|
|
5845
|
+
* @param list list of translations/ список переводов
|
|
5846
|
+
*/
|
|
5847
|
+
protected static makeList(list: Record<string, string>): void;
|
|
5807
5848
|
}
|
|
5808
5849
|
|
|
5850
|
+
/**
|
|
5851
|
+
* Prefix for global translations.
|
|
5852
|
+
* Префикс для глобальных переводов.
|
|
5853
|
+
*/
|
|
5809
5854
|
export declare const TRANSLATE_GLOBAL_PREFIX = "global";
|
|
5810
5855
|
|
|
5856
|
+
/**
|
|
5857
|
+
* Request timeout for batch loading (ms).
|
|
5858
|
+
* Таймаут запроса для пакетной загрузки (мс).
|
|
5859
|
+
*/
|
|
5860
|
+
export declare const TRANSLATE_TIME_OUT = 160;
|
|
5861
|
+
|
|
5862
|
+
/**
|
|
5863
|
+
* Translation code or a list of translation codes for template replacement.
|
|
5864
|
+
* Код перевода или список кодов для замены шаблона.
|
|
5865
|
+
*/
|
|
5811
5866
|
export declare type TranslateCode = string | string[];
|
|
5812
5867
|
|
|
5868
|
+
/**
|
|
5869
|
+
* A mapping of locale strings to their respective translation file loaders.
|
|
5870
|
+
* Сопоставление строк локалей и соответствующих им загрузчиков файлов перевода.
|
|
5871
|
+
*/
|
|
5872
|
+
export declare type TranslateDataFile = Record<string, TranslateDataFileItem>;
|
|
5873
|
+
|
|
5874
|
+
/**
|
|
5875
|
+
* Asynchronous loader function for a translation file.
|
|
5876
|
+
* Асинхронная функция-загрузчик для файла перевода.
|
|
5877
|
+
*/
|
|
5878
|
+
export declare type TranslateDataFileItem = () => Promise<TranslateDataFileList>;
|
|
5879
|
+
|
|
5880
|
+
/**
|
|
5881
|
+
* A simple key-value record of translations from a file.
|
|
5882
|
+
* Простой рекорд «ключ-значение» с переводами из файла.
|
|
5883
|
+
*/
|
|
5884
|
+
export declare type TranslateDataFileList = Record<string, string>;
|
|
5885
|
+
|
|
5886
|
+
/**
|
|
5887
|
+
* Class for working with translation files.
|
|
5888
|
+
*
|
|
5889
|
+
* Класс для работы с файлами перевода.
|
|
5890
|
+
*/
|
|
5891
|
+
export declare class TranslateFile {
|
|
5892
|
+
/** List of files with translations/ Список файлов с переводами */
|
|
5893
|
+
protected static files: TranslateDataFile;
|
|
5894
|
+
/** Data from files/ Данные из файлов */
|
|
5895
|
+
protected static data: Record<string, TranslateDataFileList>;
|
|
5896
|
+
/**
|
|
5897
|
+
* Checks if there are files for the current location.
|
|
5898
|
+
*
|
|
5899
|
+
* Проверяет, есть ли файлы для текущего местоположения.
|
|
5900
|
+
*/
|
|
5901
|
+
static isFile(): boolean;
|
|
5902
|
+
/**
|
|
5903
|
+
* Returns a list of translations from the file for the current location.
|
|
5904
|
+
*
|
|
5905
|
+
* Возвращает список переводов из файла для текущего местоположения.
|
|
5906
|
+
*/
|
|
5907
|
+
static getList(): Promise<TranslateDataFileList | undefined>;
|
|
5908
|
+
/**
|
|
5909
|
+
* Adds a list of files with translations.
|
|
5910
|
+
*
|
|
5911
|
+
* Добавляет список файлов с переводами.
|
|
5912
|
+
* @param data list of files/ список файлов
|
|
5913
|
+
*/
|
|
5914
|
+
static add(data: TranslateDataFile): void;
|
|
5915
|
+
/**
|
|
5916
|
+
* Returns the key for the current location from the list of files.
|
|
5917
|
+
*
|
|
5918
|
+
* Возвращает ключ для текущего местоположения из списка файлов.
|
|
5919
|
+
*/
|
|
5920
|
+
protected static getIndex(): string | undefined;
|
|
5921
|
+
/**
|
|
5922
|
+
* Returns a list of translations from the cache.
|
|
5923
|
+
*
|
|
5924
|
+
* Возвращает список переводов из кэша.
|
|
5925
|
+
* @param index file key/ ключ файла
|
|
5926
|
+
*/
|
|
5927
|
+
protected static getByData(index: string): TranslateDataFileList | undefined;
|
|
5928
|
+
/**
|
|
5929
|
+
* Returns a list of translations from the file and caches the result.
|
|
5930
|
+
*
|
|
5931
|
+
* Возвращает список переводов из файла и кэширует результат.
|
|
5932
|
+
* @param index file key/ ключ файла
|
|
5933
|
+
*/
|
|
5934
|
+
protected static getByFile(index: string): Promise<TranslateDataFileList | undefined>;
|
|
5935
|
+
}
|
|
5936
|
+
|
|
5937
|
+
/**
|
|
5938
|
+
* Return type for translation retrieval: an object if a list was requested, or a string for a single key.
|
|
5939
|
+
* Тип возвращаемого значения для получения перевода: объект, если был запрошен список, или строка для одного ключа.
|
|
5940
|
+
*/
|
|
5813
5941
|
export declare type TranslateItemOrList<T extends TranslateCode> = T extends string[] ? TranslateList<T> : string;
|
|
5814
5942
|
|
|
5943
|
+
/**
|
|
5944
|
+
* Object with translated strings, where the keys are the names of the translation codes.
|
|
5945
|
+
* Объект с переведенными строками, где ключи — имена кодов переводов.
|
|
5946
|
+
*/
|
|
5815
5947
|
export declare type TranslateList<T extends TranslateCode[]> = {
|
|
5816
5948
|
[K in T[number] as K extends readonly string[] ? K[0] : K]: string;
|
|
5817
5949
|
};
|