@dxtmisha/functional-basic 1.1.0 → 1.1.6

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.
Files changed (178) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/ai-description.txt +1 -0
  3. package/ai-types.txt +1062 -951
  4. package/dist/classes/Api.d.ts +201 -0
  5. package/dist/classes/ApiCache.d.ts +152 -0
  6. package/dist/classes/ApiDataReturn.d.ts +76 -0
  7. package/dist/classes/ApiDefault.d.ts +49 -0
  8. package/dist/classes/ApiHeaders.d.ts +37 -0
  9. package/dist/classes/ApiHydration.d.ts +39 -0
  10. package/dist/classes/ApiInstance.d.ts +283 -0
  11. package/dist/classes/ApiPreparation.d.ts +58 -0
  12. package/dist/classes/ApiResponse.d.ts +154 -0
  13. package/dist/classes/ApiStatus.d.ts +130 -0
  14. package/dist/classes/BroadcastMessage.d.ts +75 -0
  15. package/dist/classes/Cache.d.ts +38 -0
  16. package/dist/classes/CacheItem.d.ts +62 -0
  17. package/dist/classes/CacheStatic.d.ts +36 -0
  18. package/dist/classes/Cookie.d.ts +54 -0
  19. package/dist/classes/CookieBlock.d.ts +30 -0
  20. package/dist/classes/CookieBlockInstance.d.ts +23 -0
  21. package/dist/classes/CookieStorage.d.ts +174 -0
  22. package/dist/classes/DataStorage.d.ts +107 -0
  23. package/dist/classes/Datetime.d.ts +570 -0
  24. package/dist/classes/ErrorCenter.d.ts +72 -0
  25. package/dist/classes/ErrorCenterHandler.d.ts +64 -0
  26. package/dist/classes/ErrorCenterInstance.d.ts +85 -0
  27. package/dist/classes/EventItem.d.ts +251 -0
  28. package/dist/classes/Formatters.d.ts +161 -0
  29. package/dist/classes/Geo.d.ts +151 -0
  30. package/dist/classes/GeoFlag.d.ts +98 -0
  31. package/dist/classes/GeoInstance.d.ts +215 -0
  32. package/dist/classes/GeoIntl.d.ts +304 -0
  33. package/dist/classes/GeoPhone.d.ts +108 -0
  34. package/dist/classes/Global.d.ts +29 -0
  35. package/dist/classes/Hash.d.ts +57 -0
  36. package/dist/classes/HashInstance.d.ts +95 -0
  37. package/dist/classes/Icons.d.ts +128 -0
  38. package/dist/classes/Loading.d.ts +66 -0
  39. package/dist/classes/LoadingInstance.d.ts +99 -0
  40. package/dist/classes/Meta.d.ts +186 -0
  41. package/dist/classes/MetaManager.d.ts +121 -0
  42. package/dist/classes/MetaOg.d.ts +115 -0
  43. package/dist/classes/MetaStatic.d.ts +179 -0
  44. package/dist/classes/MetaTwitter.d.ts +115 -0
  45. package/dist/classes/ResumableTimer.d.ts +81 -0
  46. package/dist/classes/ScrollbarWidth.d.ts +51 -0
  47. package/dist/classes/SearchList.d.ts +128 -0
  48. package/dist/classes/SearchListData.d.ts +143 -0
  49. package/dist/classes/SearchListItem.d.ts +49 -0
  50. package/dist/classes/SearchListMatcher.d.ts +57 -0
  51. package/dist/classes/SearchListOptions.d.ts +66 -0
  52. package/dist/classes/ServerStorage.d.ts +106 -0
  53. package/dist/classes/StorageCallback.d.ts +84 -0
  54. package/dist/classes/Translate.d.ts +119 -0
  55. package/dist/classes/TranslateFile.d.ts +81 -0
  56. package/dist/classes/TranslateInstance.d.ts +206 -0
  57. package/dist/functions/addTagHighlightMatch.d.ts +11 -0
  58. package/dist/functions/anyToString.d.ts +10 -0
  59. package/dist/functions/applyTemplate.d.ts +10 -0
  60. package/dist/functions/arrFill.d.ts +9 -0
  61. package/dist/functions/blobToBase64.d.ts +9 -0
  62. package/dist/functions/capitalize.d.ts +9 -0
  63. package/dist/functions/copyObject.d.ts +10 -0
  64. package/dist/functions/copyObjectLite.d.ts +9 -0
  65. package/dist/functions/createElement.d.ts +21 -0
  66. package/dist/functions/domQuerySelector.d.ts +8 -0
  67. package/dist/functions/domQuerySelectorAll.d.ts +8 -0
  68. package/dist/functions/encodeAttribute.d.ts +8 -0
  69. package/dist/functions/encodeLiteAttribute.d.ts +8 -0
  70. package/dist/functions/ensureMaxSize.d.ts +10 -0
  71. package/dist/functions/escapeExp.d.ts +7 -0
  72. package/dist/functions/eventStopPropagation.d.ts +7 -0
  73. package/dist/functions/executeFunction.d.ts +12 -0
  74. package/dist/functions/executePromise.d.ts +11 -0
  75. package/dist/functions/forEach.d.ts +14 -0
  76. package/dist/functions/frame.d.ts +10 -0
  77. package/dist/functions/getArrayHighlightMatch.d.ts +10 -0
  78. package/dist/functions/getAttributes.d.ts +9 -0
  79. package/dist/functions/getClipboardData.d.ts +9 -0
  80. package/dist/functions/getColumn.d.ts +10 -0
  81. package/dist/functions/getCurrentDate.d.ts +19 -0
  82. package/dist/functions/getCurrentTime.d.ts +15 -0
  83. package/dist/functions/getElement.d.ts +9 -0
  84. package/dist/functions/getElementId.d.ts +26 -0
  85. package/dist/functions/getElementImage.d.ts +8 -0
  86. package/dist/functions/getElementItem.d.ts +12 -0
  87. package/dist/functions/getElementOrWindow.d.ts +8 -0
  88. package/dist/functions/getElementSafeScript.d.ts +9 -0
  89. package/dist/functions/getExactSearchExp.d.ts +8 -0
  90. package/dist/functions/getExp.d.ts +14 -0
  91. package/dist/functions/getHydrationData.d.ts +10 -0
  92. package/dist/functions/getItemByPath.d.ts +9 -0
  93. package/dist/functions/getKey.d.ts +8 -0
  94. package/dist/functions/getLengthOfAllArray.d.ts +8 -0
  95. package/dist/functions/getMaxLengthAllArray.d.ts +9 -0
  96. package/dist/functions/getMinLengthAllArray.d.ts +8 -0
  97. package/dist/functions/getMouseClient.d.ts +9 -0
  98. package/dist/functions/getMouseClientX.d.ts +8 -0
  99. package/dist/functions/getMouseClientY.d.ts +8 -0
  100. package/dist/functions/getObjectByKeys.d.ts +8 -0
  101. package/dist/functions/getObjectNoUndefined.d.ts +9 -0
  102. package/dist/functions/getObjectOrNone.d.ts +8 -0
  103. package/dist/functions/getOnlyText.d.ts +8 -0
  104. package/dist/functions/getRandomText.d.ts +12 -0
  105. package/dist/functions/getRequestString.d.ts +11 -0
  106. package/dist/functions/getSearchExp.d.ts +12 -0
  107. package/dist/functions/getSeparatingSearchExp.d.ts +9 -0
  108. package/dist/functions/getStepPercent.d.ts +9 -0
  109. package/dist/functions/getStepValue.d.ts +9 -0
  110. package/dist/functions/goScroll.d.ts +10 -0
  111. package/dist/functions/goScrollSmooth.d.ts +10 -0
  112. package/dist/functions/goScrollTo.d.ts +10 -0
  113. package/dist/functions/handleShare.d.ts +10 -0
  114. package/dist/functions/inArray.d.ts +9 -0
  115. package/dist/functions/initScrollbarOffset.d.ts +7 -0
  116. package/dist/functions/intersectKey.d.ts +9 -0
  117. package/dist/functions/isApiSuccess.d.ts +9 -0
  118. package/dist/functions/isArray.d.ts +8 -0
  119. package/dist/functions/isDifferent.d.ts +10 -0
  120. package/dist/functions/isDomData.d.ts +7 -0
  121. package/dist/functions/isDomRuntime.d.ts +10 -0
  122. package/dist/functions/isElementVisible.d.ts +11 -0
  123. package/dist/functions/isEnter.d.ts +9 -0
  124. package/dist/functions/isFilled.d.ts +10 -0
  125. package/dist/functions/isFloat.d.ts +8 -0
  126. package/dist/functions/isFunction.d.ts +9 -0
  127. package/dist/functions/isInDom.d.ts +9 -0
  128. package/dist/functions/isInput.d.ts +8 -0
  129. package/dist/functions/isIntegerBetween.d.ts +9 -0
  130. package/dist/functions/isNull.d.ts +9 -0
  131. package/dist/functions/isNumber.d.ts +8 -0
  132. package/dist/functions/isObject.d.ts +8 -0
  133. package/dist/functions/isObjectNotArray.d.ts +8 -0
  134. package/dist/functions/isOnLine.d.ts +7 -0
  135. package/dist/functions/isSelected.d.ts +9 -0
  136. package/dist/functions/isSelectedByList.d.ts +9 -0
  137. package/dist/functions/isShare.d.ts +7 -0
  138. package/dist/functions/isString.d.ts +8 -0
  139. package/dist/functions/isWindow.d.ts +7 -0
  140. package/dist/functions/random.d.ts +9 -0
  141. package/dist/functions/removeCommonPrefix.d.ts +9 -0
  142. package/dist/functions/replaceComponentName.d.ts +9 -0
  143. package/dist/functions/replaceRecursive.d.ts +11 -0
  144. package/dist/functions/replaceTemplate.d.ts +10 -0
  145. package/dist/functions/resizeImageByMax.d.ts +19 -0
  146. package/dist/functions/secondToTime.d.ts +9 -0
  147. package/dist/functions/setElementItem.d.ts +11 -0
  148. package/dist/functions/setValues.d.ts +18 -0
  149. package/dist/functions/sleep.d.ts +8 -0
  150. package/dist/functions/splice.d.ts +13 -0
  151. package/dist/functions/strFill.d.ts +9 -0
  152. package/dist/functions/strSplit.d.ts +12 -0
  153. package/dist/functions/toArray.d.ts +17 -0
  154. package/dist/functions/toCamelCase.d.ts +8 -0
  155. package/dist/functions/toCamelCaseFirst.d.ts +8 -0
  156. package/dist/functions/toDate.d.ts +8 -0
  157. package/dist/functions/toKebabCase.d.ts +15 -0
  158. package/dist/functions/toNumber.d.ts +19 -0
  159. package/dist/functions/toNumberByMax.d.ts +11 -0
  160. package/dist/functions/toPercent.d.ts +9 -0
  161. package/dist/functions/toPercentBy100.d.ts +9 -0
  162. package/dist/functions/toString.d.ts +8 -0
  163. package/dist/functions/transformation.d.ts +21 -0
  164. package/dist/functions/uint8ArrayToBase64.d.ts +8 -0
  165. package/dist/functions/uniqueArray.d.ts +8 -0
  166. package/dist/functions/writeClipboardData.d.ts +8 -0
  167. package/dist/library.d.ts +171 -8722
  168. package/dist/library.js +416 -338
  169. package/dist/media/errorCauseList.d.ts +2 -0
  170. package/dist/types/apiTypes.d.ts +217 -0
  171. package/dist/types/basicTypes.d.ts +131 -0
  172. package/dist/types/errorCenter.d.ts +42 -0
  173. package/dist/types/formattersTypes.d.ts +224 -0
  174. package/dist/types/geoTypes.d.ts +86 -0
  175. package/dist/types/metaTypes.d.ts +586 -0
  176. package/dist/types/searchTypes.d.ts +53 -0
  177. package/dist/types/translateTypes.d.ts +54 -0
  178. package/package.json +7 -5
@@ -0,0 +1,2 @@
1
+ import { ErrorCenterCauseList } from '../types/errorCenter';
2
+ export declare const errorCauseList: ErrorCenterCauseList;
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Supported HTTP methods for API requests.
3
+ * Поддерживаемые HTTP-методы для API-запросов.
4
+ */
5
+ export declare enum ApiMethodItem {
6
+ /**
7
+ * HTTP DELETE — used to delete resources.
8
+ * HTTP DELETE — используется для удаления ресурсов.
9
+ */
10
+ delete = "DELETE",
11
+ /**
12
+ * HTTP GET — used to retrieve resources (no request body).
13
+ * HTTP GET — используется для получения ресурсов (без тела запроса).
14
+ */
15
+ get = "GET",
16
+ /**
17
+ * HTTP POST — used to create resources or send data.
18
+ * HTTP POST — используется для создания ресурсов или отправки данных.
19
+ */
20
+ post = "POST",
21
+ /**
22
+ * HTTP PUT — used to update/replace resources.
23
+ * HTTP PUT — используется для обновления/замены ресурсов.
24
+ */
25
+ put = "PUT",
26
+ /**
27
+ * HTTP PATCH — used to partially update resources.
28
+ * HTTP PATCH — используется для частичного обновления ресурсов.
29
+ */
30
+ patch = "PATCH"
31
+ }
32
+ /**
33
+ * Saved value in cache/ Сохраненное значение в кэше
34
+ */
35
+ export type ApiCacheItem<T = any> = {
36
+ /** Saved value / Сохраненное значение */
37
+ value: T;
38
+ /** Age of the cache / Возраст кэша */
39
+ age?: number;
40
+ /** Cache age in seconds / Возраст кэша в секундах */
41
+ cacheAge: number;
42
+ };
43
+ /**
44
+ * List of saved values in cache/ Список сохраненных значений в кэше
45
+ */
46
+ export type ApiCacheList = Record<string, ApiCacheItem>;
47
+ /**
48
+ * API configuration/ Конфигурация API
49
+ */
50
+ export type ApiConfig = {
51
+ /** Base URL for API requests/ Базовый URL для API-запросов */
52
+ urlRoot?: string;
53
+ /** Base origin for API requests (protocol and domain)/ Базовый источник для API-запросов (протокол и домен) */
54
+ origin?: string;
55
+ /** Default headers for API requests/ Заголовки по умолчанию для API-запросов */
56
+ headers?: Record<string, string>;
57
+ /** Default request data for API requests/ Данные запроса по умолчанию для API-запросов */
58
+ requestDefault?: Record<string, any>;
59
+ /** Function to call before request/ Функция для вызова перед запросом */
60
+ preparation?: (apiFetch: ApiFetch) => Promise<void>;
61
+ /** Function to call after request/ Функция для вызова после запроса */
62
+ end?: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>;
63
+ /** Timeout for the request in milliseconds/ Таймаут запроса в миллисекундах */
64
+ timeout?: number;
65
+ };
66
+ /**
67
+ * Shape of API response data wrapper/ Структура обёртки данных ответа API
68
+ */
69
+ export type ApiData<T = any> = T extends any[] ? T : ApiDataItem<T>;
70
+ /**
71
+ * API response validation result/ Результат валидации ответа API
72
+ */
73
+ export type ApiDataValidation = {
74
+ /** Status/ Статус */
75
+ status?: ApiStatusType;
76
+ /** Code / Код */
77
+ code?: string | number;
78
+ /** Message/ Сообщение */
79
+ message?: string;
80
+ };
81
+ /**
82
+ * Type of API response data item/ Тип элемента данных ответа API
83
+ */
84
+ export type ApiDataItem<T = any> = T & ApiDataValidation & {
85
+ /** Primary payload (optional)/ Основная полезная нагрузка (опционально) */
86
+ data?: T;
87
+ /** Success flag/ Флаг успешности */
88
+ success?: boolean;
89
+ /** Status object/ Объект статуса */
90
+ statusObject?: ApiStatusItem;
91
+ };
92
+ /**
93
+ * Default API request data type/ Тип данных запроса API по умолчанию
94
+ */
95
+ export type ApiDefaultValue = Record<string, any>;
96
+ /**
97
+ * Options for making API requests/ Опции для выполнения API-запросов
98
+ */
99
+ export type ApiFetch = {
100
+ /** Use base API URL/ Использовать базовый URL API */
101
+ api?: boolean;
102
+ /** Endpoint path relative to base URL/ Путь endpoint относительно базового URL */
103
+ path?: string;
104
+ /** Complete URL (overrides api + path)/ Полный URL (переопределяет api + path) */
105
+ pathFull?: string;
106
+ /** HTTP method/ HTTP метод */
107
+ method?: ApiMethod;
108
+ /** Request body data or query parameters/ Данные тела запроса или параметры запроса */
109
+ request?: FormData | Record<string, any> | string;
110
+ /** Include authentication headers/ Включить заголовки аутентификации */
111
+ auth?: boolean;
112
+ /** Custom headers (null = no headers)/ Пользовательские заголовки (null = без заголовков) */
113
+ headers?: Record<string, string> | null;
114
+ /** Content-Type header value/ Значение заголовка Content-Type */
115
+ type?: string;
116
+ /** Extract 'data' field from response/ Извлечь поле 'data' из ответа */
117
+ toData?: boolean;
118
+ /** Use global response cache/ Использовать глобальный кеш ответов */
119
+ global?: boolean;
120
+ /** Enable development logging/ Включить логирование разработки */
121
+ devMode?: boolean;
122
+ /** Suppress error logging/ Подавить логирование ошибок */
123
+ hideError?: boolean;
124
+ /** Suppress loading/ Подавить загрузку */
125
+ hideLoading?: boolean;
126
+ /** Retry count/ Количество повторов */
127
+ retry?: number;
128
+ /** Retry delay in milliseconds/ Задержка повтора в миллисекундах */
129
+ retryDelay?: number;
130
+ /** Custom response processor/ Пользовательский процессор ответа */
131
+ queryReturn?: (query: Response) => Promise<any | ApiDataValidation>;
132
+ /** Run global preparation hooks/ Запускать глобальные хуки подготовки */
133
+ globalPreparation?: boolean;
134
+ /** Run global end hooks/ Запускать глобальные хуки завершения */
135
+ globalEnd?: boolean;
136
+ /** Additional fetch() options/ Дополнительные опции fetch() */
137
+ init?: RequestInit;
138
+ /** Timeout for the request in milliseconds/ Таймаут запроса в миллисекундах */
139
+ timeout?: number;
140
+ /** AbortController for canceling the request/ AbortController для отмены запроса */
141
+ controller?: AbortController;
142
+ /** Cache age in seconds/ Возраст кэша в секундах */
143
+ cache?: number;
144
+ enableClientCache?: boolean;
145
+ /** Cache ID for grouping/ ID кэша для группировки */
146
+ cacheId?: number | string;
147
+ /** Limit of end reset/ Лимит сброса end */
148
+ endResetLimit?: number;
149
+ };
150
+ /**
151
+ * Type of API hydration item/ Тип элемента гидратации API
152
+ */
153
+ export type ApiHydrationItem = {
154
+ /** Path string or RegExp to match request URL/ Путь или RegExp для сопоставления URL */
155
+ path: string;
156
+ /** Expected HTTP method/ Ожидаемый HTTP метод */
157
+ method: ApiMethod;
158
+ /** Expected request payload or special marker '*any'/ Ожидаемая нагрузка запроса или маркер '*any' */
159
+ request?: ApiFetch['request'];
160
+ /** Static response or factory function/ Статический ответ или функция, возвращающая ответ */
161
+ response: any;
162
+ };
163
+ /**
164
+ * List of API hydration items/ Список элементов гидратации API
165
+ */
166
+ export type ApiHydrationList = ApiHydrationItem[];
167
+ /**
168
+ * Supported HTTP methods type/ Тип HTTP-методов
169
+ * (derived from ApiMethodItem enum)/ (получен из перечисления ApiMethodItem)
170
+ */
171
+ export type ApiMethod = string | ApiMethodItem;
172
+ /**
173
+ * Result of global preparation/end hooks/ Результат глобальных хуков
174
+ */
175
+ export type ApiPreparationEnd = {
176
+ /** Reset flag to indicate state reset/ Флаг сброса состояния */
177
+ reset?: boolean;
178
+ /** Arbitrary data returned by hook/ Произвольные данные, возвращаемые хуком */
179
+ data?: any;
180
+ };
181
+ /**
182
+ * Mock API response descriptor/ Описание мок-ответа API
183
+ */
184
+ export type ApiResponseItem = {
185
+ /** Path string or RegExp to match request URL/ Путь или RegExp для сопоставления URL */
186
+ path: string | RegExp;
187
+ /** Expected HTTP method/ Ожидаемый HTTP метод */
188
+ method: ApiMethod;
189
+ /** Expected request payload or special marker '*any'/ Ожидаемая нагрузка запроса или маркер '*any' */
190
+ request?: ApiFetch['request'] | '*any';
191
+ /** Static response or factory function/ Статический ответ или функция, возвращающая ответ */
192
+ response: any | ((request?: ApiFetch['request']) => any);
193
+ /** Disable this mock/ Отключить этот мок */
194
+ disable?: any;
195
+ /** Mark as global mock/ Мок для глобального использования */
196
+ isForGlobal?: boolean;
197
+ /** Simulate network lag/ Имитировать задержку */
198
+ lag?: any;
199
+ };
200
+ export type ApiStatusItem = {
201
+ /** HTTP status code/ Код статуса HTTP */
202
+ status?: number;
203
+ /** HTTP status text/ Текст статуса HTTP */
204
+ statusText?: string;
205
+ /** Error message/ Сообщение об ошибке */
206
+ error?: string;
207
+ /** Last response/ Последний ответ */
208
+ lastResponse?: any;
209
+ /** Last status/ Последний статус */
210
+ lastStatus?: ApiStatusType;
211
+ /** Last code / Последний код */
212
+ lastCode?: string;
213
+ /** Last message/ Последнее сообщение */
214
+ lastMessage?: string;
215
+ };
216
+ /** API status type/ Тип статуса API */
217
+ export type ApiStatusType = 'success' | 'error' | 'warning' | 'info';
@@ -0,0 +1,131 @@
1
+ /** Union type for undefined and null values/ Объединенный тип для undefined и null значений */
2
+ export type Undefined = undefined | null;
3
+ /**
4
+ * Union type for all "empty" values including falsy primitives and string representations/
5
+ * Объединенный тип для всех "пустых" значений включая ложные примитивы и строковые представления
6
+ */
7
+ export type EmptyValue = Undefined | 0 | false | '' | 'undefined' | 'null' | '0' | 'false' | '[]';
8
+ /** Union type for numeric and string values/ Объединенный тип для числовых и строковых значений */
9
+ export type NumberOrString = number | string;
10
+ /**
11
+ * Union type for numeric, string, and boolean values/
12
+ * Объединенный тип для числовых, строковых и булевых значений
13
+ */
14
+ export type NumberOrStringOrBoolean = number | string | boolean;
15
+ /**
16
+ * Union type for numeric, string, and Date values/
17
+ * Объединенный тип для числовых, строковых значений и Date
18
+ */
19
+ export type NumberOrStringOrDate = NumberOrString | Date;
20
+ /**
21
+ * Generic type that can be either a single value or an array of values/
22
+ * Дженерик тип для одиночного значения или массива значений
23
+ */
24
+ export type NormalOrArray<T = NumberOrString> = T | T[];
25
+ /**
26
+ * Generic type that can be either a direct value or a Promise resolving to that value/
27
+ * Дженерик тип для прямого значения или Promise
28
+ */
29
+ export type NormalOrPromise<T> = T | Promise<T>;
30
+ /**
31
+ * Generic record/object type with string keys/
32
+ * Дженерик тип записи/объекта со строковыми ключами
33
+ */
34
+ export type ObjectItem<T = any> = Record<string, T>;
35
+ /** Generic type that can be either an array or an object/ Дженерик тип для массива или объекта */
36
+ export type ObjectOrArray<T = any> = T[] | ObjectItem<T>;
37
+ /**
38
+ * Converts an array type to an item type (extracts the item type from an array)/
39
+ * Преобразует тип массива в тип элемента (извлекает тип элемента из массива)
40
+ */
41
+ export type ArrayToItem<T> = T extends any[] ? T[number] : T;
42
+ /**
43
+ * Function type that returns a value of type R/
44
+ * Тип функции, возвращающей значение типа R
45
+ */
46
+ export type FunctionReturn<R = any> = () => R;
47
+ /** Function type that returns void/ Тип функции, возвращающей void */
48
+ export type FunctionVoid = () => void;
49
+ /**
50
+ * Function type that accepts multiple arguments of type T and returns type R/
51
+ * Тип функции с переменными аргументами
52
+ */
53
+ export type FunctionArgs<T, R> = (...args: T[]) => R;
54
+ /**
55
+ * Most generic function type that accepts any arguments and returns any value/
56
+ * Наиболее общий тип функции
57
+ */
58
+ export type FunctionAnyType<T = any, R = any> = (...args: T[]) => R;
59
+ /**
60
+ * Generic record type for lists with string keys/
61
+ * Дженерик тип записи для списков со строковыми ключами
62
+ */
63
+ export type ItemList<T = any> = Record<string, T>;
64
+ /**
65
+ * Generic item type with index and value properties/
66
+ * Дженерик тип элемента со свойствами index и value
67
+ */
68
+ export type Item<V> = {
69
+ /** Unique string identifier for the item/ Уникальный строковый идентификатор элемента */
70
+ index: string;
71
+ /** The actual value of the item/ Фактическое значение элемента */
72
+ value: V;
73
+ };
74
+ /**
75
+ * Generic item type with label and value properties/
76
+ * Дженерик тип элемента со свойствами label и value
77
+ */
78
+ export type ItemValue<V> = {
79
+ /** Display text for the item/ Отображаемый текст для элемента */
80
+ label: string;
81
+ /** The actual value of the item/ Фактическое значение элемента */
82
+ value: V;
83
+ };
84
+ /**
85
+ * Generic item type with name and value properties/
86
+ * Дженерик тип элемента со свойствами name и value
87
+ */
88
+ export type ItemName<V> = {
89
+ /** Name identifier (string or number)/ Идентификатор имени (строка или число) */
90
+ name: string | number;
91
+ /** The actual value of the item/ Фактическое значение элемента */
92
+ value: V;
93
+ };
94
+ /**
95
+ * Union type for HTML elements and Window object/
96
+ * Объединенный тип для HTML элементов и объекта Window
97
+ */
98
+ export type ElementOrWindow = HTMLElement | Window;
99
+ /**
100
+ * Generic type that can be either an element or a string selector/
101
+ * Дженерик тип для элемента или строкового селектора
102
+ */
103
+ export type ElementOrString<E extends ElementOrWindow> = E | string;
104
+ /** Type for event listener options/ Тип для опций обработчика событий */
105
+ export type EventOptions = AddEventListenerOptions | boolean | undefined;
106
+ /**
107
+ * Generic event listener function type with additional detail parameter/
108
+ * Дженерик тип функции обработчика событий с дополнительным параметром detail
109
+ */
110
+ export type EventListenerDetail<O extends Event, D extends Record<string, any>> = (event: O, detail?: D) => void;
111
+ /**
112
+ * Type for tracking active event listeners and observers/
113
+ * Тип для отслеживания активных обработчиков событий и наблюдателей
114
+ */
115
+ export type EventActivityItem<E extends ElementOrWindow> = {
116
+ /** The target element for the event/ Целевой элемент для события */
117
+ element: E | undefined;
118
+ /** The event type name/ Название типа события */
119
+ type: string;
120
+ /** Optional custom event listener/ Опциональный пользовательский обработчик событий */
121
+ listener?: (event: any | Event) => void;
122
+ /** Optional ResizeObserver instance/ Опциональный экземпляр ResizeObserver */
123
+ observer?: ResizeObserver;
124
+ };
125
+ /** Type for 2D coordinates/ Тип для 2D координат */
126
+ export type ImageCoordinator = {
127
+ /** X-axis coordinate/ Координата по оси X */
128
+ x: number;
129
+ /** Y-axis coordinate/ Координата по оси Y */
130
+ y: number;
131
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Error group identifier / Идентификатор группы ошибок
3
+ */
4
+ export type ErrorCenterGroup = string | undefined;
5
+ /**
6
+ * Interface for an error item / Интерфейс для элемента ошибки
7
+ */
8
+ export type ErrorCenterCauseItem = {
9
+ /** Error group / Группа ошибки */
10
+ group?: ErrorCenterGroup;
11
+ /** Error code / Код ошибки */
12
+ code: string;
13
+ /** Priority / Приоритет */
14
+ priority?: number;
15
+ /** Error label / Название ошибки */
16
+ label?: string;
17
+ /** Error message / Сообщение ошибки */
18
+ message?: string;
19
+ /** Additional details / Дополнительные детали */
20
+ details?: any;
21
+ };
22
+ /**
23
+ * List of error items / Список элементов ошибок
24
+ */
25
+ export type ErrorCenterCauseList = ErrorCenterCauseItem[];
26
+ /**
27
+ * Callback function for error handling / Функция обратного вызова для обработки ошибок
28
+ */
29
+ export type ErrorCenterHandlerCallback = (cause: ErrorCenterCauseItem) => void;
30
+ /**
31
+ * Interface for error handler storage / Интерфейс для хранения обработчика ошибок
32
+ */
33
+ export type ErrorCenterHandlerItem = {
34
+ /** Targeted error group / Целевая группа ошибок */
35
+ group?: ErrorCenterGroup;
36
+ /** List of handlers / Список обработчиков */
37
+ handlers: ErrorCenterHandlerCallback[];
38
+ };
39
+ /**
40
+ * List of error handlers / Список обработчиков ошибок
41
+ */
42
+ export type ErrorCenterHandlerList = ErrorCenterHandlerItem[];
@@ -0,0 +1,224 @@
1
+ import { ArrayToItem } from './basicTypes';
2
+ import { GeoDate } from './geoTypes';
3
+ /**
4
+ * Enumeration of available formatter types.
5
+ *
6
+ * Перечисление доступных типов форматировщиков.
7
+ */
8
+ export declare enum FormattersType {
9
+ /** Currency formatting / Форматирование валюты. */
10
+ currency = "currency",
11
+ /** Date formatting / Форматирование даты. */
12
+ date = "date",
13
+ /** Name formatting / Форматирование имени. */
14
+ name = "name",
15
+ /** Number formatting / Форматирование чисел. */
16
+ number = "number",
17
+ /** Plural forms formatting / Форматирование форм множественного числа. */
18
+ plural = "plural",
19
+ /** Unit formatting (e.g., meters, kilograms) / Форматирование единиц измерения (например, метры, килограммы). */
20
+ unit = "unit"
21
+ }
22
+ /**
23
+ * Options for currency formatting.
24
+ *
25
+ * Параметры для форматирования валюты.
26
+ */
27
+ export type FormattersOptionsCurrency = {
28
+ /** The name of the property in the data item that contains the currency code / Имя свойства в элементе данных, которое содержит код валюты. */
29
+ currencyPropName?: string;
30
+ /** Currency code or international number format options / Код валюты или международные параметры форматирования чисел. */
31
+ options?: string | Intl.NumberFormatOptions;
32
+ /** If true, only the numeric value will be returned / Если true, будет возвращено только числовое значение. */
33
+ numberOnly?: boolean;
34
+ };
35
+ /**
36
+ * Options for date formatting.
37
+ *
38
+ * Параметры для форматирования даты.
39
+ */
40
+ export type FormattersOptionsDate = {
41
+ /** The type of date representation / Тип представления даты. */
42
+ type?: GeoDate;
43
+ /** International date-time format options / Междунар. параметры форматирования даты и времени. */
44
+ options?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions;
45
+ /** Use 24-hour format if true / Использовать 24-часовой формат, если true. */
46
+ hour24?: boolean;
47
+ };
48
+ /**
49
+ * Options for name formatting.
50
+ *
51
+ * Параметры для форматирования имени.
52
+ */
53
+ export type FormattersOptionsName = {
54
+ /** Property name for the last name / Имя свойства для фамилии. */
55
+ lastPropName?: string;
56
+ /** Property name for the first name / Имя свойства для имени. */
57
+ firstPropName?: string;
58
+ /** Property name for the middle name / Имя свойства для отчества. */
59
+ surname?: string;
60
+ /** If true, returns a short version of the name / Если true, возвращает сокращенную версию имени. */
61
+ short?: boolean;
62
+ };
63
+ /**
64
+ * Options for number formatting.
65
+ *
66
+ * Параметры для форматирования чисел.
67
+ */
68
+ export type FormattersOptionsNumber = {
69
+ /** International number format options / Междунар. параметры форматирования чисел. */
70
+ options?: Intl.NumberFormatOptions;
71
+ };
72
+ /**
73
+ * Options for plural forms formatting.
74
+ *
75
+ * Параметры для форматирования форм множественного числа.
76
+ */
77
+ export type FormattersOptionsPlural = {
78
+ /** A string containing plural forms / Строка, содержащая формы множественного числа. */
79
+ words: string;
80
+ /** International plural rules options / Междунар. параметры правил множественного числа. */
81
+ options?: Intl.PluralRulesOptions;
82
+ /** International number format options for the numeric part / Междунар. параметры форматирования чисел для числовой части. */
83
+ optionsNumber?: Intl.NumberFormatOptions;
84
+ };
85
+ /**
86
+ * Options for unit formatting.
87
+ *
88
+ * Параметры для форматирования единиц измерения.
89
+ */
90
+ export type FormattersOptionsUnit = {
91
+ /** The unit to format or international number format options / Ед. изм. для форматирования или междунар. параметры форматирования чисел. */
92
+ unit: string | Intl.NumberFormatOptions;
93
+ };
94
+ /**
95
+ * Mapping of formatter types to their respective option types.
96
+ *
97
+ * Соответствие типов форматировщиков их типам параметров.
98
+ *
99
+ * @template Type - The formatter type / Тип форматировщика.
100
+ */
101
+ export type FormattersOptionsInformation<Type extends FormattersType> = Type extends FormattersType.currency ? FormattersOptionsCurrency : Type extends FormattersType.date ? FormattersOptionsDate : Type extends FormattersType.name ? FormattersOptionsName : Type extends FormattersType.number ? FormattersOptionsNumber : Type extends FormattersType.plural ? FormattersOptionsPlural : Type extends FormattersType.unit ? FormattersOptionsUnit : Record<string, any>;
102
+ /**
103
+ * Configuration for a single property formatter.
104
+ *
105
+ * Конфигурация для форматировщика одного свойства.
106
+ *
107
+ * @template Type - The type of formatter / Тип форматировщика.
108
+ * @template R - The return type / Возвращаемый тип.
109
+ */
110
+ export type FormattersOptionsItem<Type extends FormattersType = FormattersType, R = string> = {
111
+ /** The type of formatter / Тип форматировщика. */
112
+ type?: Type;
113
+ /** Custom transformation function / Пользовательская функция преобразования. */
114
+ transformation?: (valueOriginal: any, item: any, options?: FormattersOptionsInformation<Type>) => R;
115
+ /** Options for the specified formatter type / Параметры для указанного типа форматировщика. */
116
+ options?: FormattersOptionsInformation<Type>;
117
+ };
118
+ /**
119
+ * A dictionary mapping property paths to their formatting configurations.
120
+ *
121
+ * Словарь, сопоставляющий пути к свойствам с их конфигурациями форматирования.
122
+ */
123
+ export type FormattersOptionsList = Record<string, FormattersOptionsItem>;
124
+ /**
125
+ * Represents a single data item as a key-value record.
126
+ *
127
+ * Представляет один элемент данных как запись "ключ-значение".
128
+ */
129
+ export type FormattersListItem = Record<string, any>;
130
+ /**
131
+ * An array of data items to be formatted.
132
+ *
133
+ * Массив элементов данных для форматирования.
134
+ *
135
+ * @template Item - The type of data items / Тип элементов данных.
136
+ */
137
+ export type FormattersList<Item extends FormattersListItem> = Item[];
138
+ /**
139
+ * Utility type to capitalize a camelCase or dot-notated string.
140
+ *
141
+ * Вспомогательный тип для капитализации строки.
142
+ *
143
+ * @template K - The string to capitalize / Строка для капитализации.
144
+ */
145
+ export type FormattersCapitalize<K extends string> = K extends `${infer First}.${infer Rest}` ? `${First}${Capitalize<FormattersCapitalize<Rest>>}` : K;
146
+ /**
147
+ * Utility type to extract column keys from formatting options.
148
+ *
149
+ * Вспомогательный тип для извлечения ключей столбцов.
150
+ *
151
+ * @template T - The formatting options list type / Тип списка параметров форматирования.
152
+ */
153
+ export type FormattersColumns<T extends FormattersOptionsList> = (keyof T & string)[];
154
+ /**
155
+ * Utility type to generate a formatted property key.
156
+ *
157
+ * Вспомогательный тип для генерации ключа отформатированного свойства.
158
+ *
159
+ * @template K - The original property key / Ключ исходного свойства.
160
+ * @template A - The suffix to add / Суффикс.
161
+ */
162
+ export type FormattersKey<K, A extends string = 'Format'> = K extends string ? `${FormattersCapitalize<K>}${A}` : never;
163
+ /**
164
+ * Represents a data item with additional formatted properties.
165
+ *
166
+ * Представляет элемент данных с доп. отформатированными свойствами.
167
+ *
168
+ * @template T - The original item type / Исходный тип элемента.
169
+ * @template KT - Array of property keys / Массив ключей свойств.
170
+ */
171
+ export type FormattersDataItem<T extends FormattersListItem, KT extends string[]> = {
172
+ [K in keyof T | FormattersKey<KT[number]>]: K extends keyof T ? T[K] : string;
173
+ };
174
+ /**
175
+ * An array of data items with additional formatted properties.
176
+ *
177
+ * Массив элементов данных с доп. отформатированными свойствами.
178
+ *
179
+ * @template T - The original item type / Исходный тип элемента.
180
+ * @template K - Array of property keys / Массив ключей свойств.
181
+ */
182
+ export type FormattersListFormat<T extends FormattersListItem, K extends string[]> = FormattersDataItem<T, K>[];
183
+ /**
184
+ * A single data item formatted based on the provided options list.
185
+ *
186
+ * Один элемент данных, отформатированный на основе параметров.
187
+ *
188
+ * @template T - The original item type / Исходный тип элемента.
189
+ * @template O - The formatting options / Параметры форматирования.
190
+ */
191
+ export type FormattersListColumnItem<T extends FormattersListItem, O extends FormattersOptionsList> = FormattersDataItem<T, FormattersColumns<O>>;
192
+ /**
193
+ * A list of data items formatted based on the provided options list.
194
+ *
195
+ * Список элементов данных, отформатированных на основе параметров.
196
+ *
197
+ * @template T - The original item type / Исходный тип элемента.
198
+ * @template O - The formatting options / Параметры форматирования.
199
+ */
200
+ export type FormattersListColumns<T extends FormattersListItem, O extends FormattersOptionsList> = FormattersListFormat<T, FormattersColumns<O>>;
201
+ /**
202
+ * Possible formats for input data: either a single item or a list of items.
203
+ *
204
+ * Возможные форматы входных данных: либо один элемент, либо список элементов.
205
+ */
206
+ export type FormattersListProp = FormattersList<FormattersListItem> | FormattersListItem;
207
+ /**
208
+ * Extracts the single item type from a single item or a list of items.
209
+ *
210
+ * Извлекает тип одного элемента из одного элемента или из списка элементов.
211
+ *
212
+ * @template List - The type of the input data / Тип входных данных.
213
+ */
214
+ export type FormattersItemProp<List extends FormattersListProp> = ArrayToItem<List>;
215
+ /**
216
+ * The return type of the formatter, matching the structure of the input data.
217
+ *
218
+ * Возвращаемый тип форматировщика, соответствующий структуре входных данных.
219
+ *
220
+ * @template List - The input data type / Тип входных данных.
221
+ * @template Options - The formatting options / Параметры форматирования.
222
+ * @template Item - The type of a single item / Тип одного элемента.
223
+ */
224
+ export type FormattersReturn<List extends FormattersListProp, Options extends FormattersOptionsList = FormattersOptionsList, Item extends FormattersItemProp<List> = FormattersItemProp<List>> = List extends any[] ? FormattersListColumns<Item, Options> : (FormattersListColumnItem<Item, Options> | undefined);