@dxtmisha/functional-basic 1.4.1 → 1.4.2
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/CHANGELOG.md +15 -0
- package/ai-description.md +19 -22
- package/ai-types.md +154 -53
- package/dist/library.js +13 -5
- package/dist/src/classes/Api.d.ts +8 -0
- package/dist/src/classes/ApiInstance.d.ts +11 -0
- package/dist/src/types/apiTypes.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.4.2] - 2026-06-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Api**: Added request wrapper support via a custom `wrapper` callback configuration option in both `ApiConfig` and `ApiFetch`, enabling developer interception or custom wrapping of the fetch request lifecycle.
|
|
9
|
+
- **Tests**: Added comprehensive unit tests for request wrapping options on both instance-level and individual request-level.
|
|
10
|
+
|
|
11
|
+
## [1.4.1] - 2026-06-23
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **GeoFlag**: Added language-specific metadata lookup and filtering methods:
|
|
15
|
+
- `getLanguage(code)`: Looks up language details and its flag icon.
|
|
16
|
+
- `getListLanguage(codes)`: Retrieves a list of unique languages without country duplicates.
|
|
17
|
+
- `getNationalLanguage(codes)`: Retrieves localized (national) language names.
|
|
18
|
+
- **geoTypes**: Extended `GeoFlagItem` type definition with `languageCode` and `countryCode` properties.
|
|
19
|
+
|
|
5
20
|
## [1.4.0] - 2026-06-22
|
|
6
21
|
|
|
7
22
|
### Added
|
package/ai-description.md
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
### 1. Core Purpose
|
|
2
|
+
This library provides a comprehensive, isomorphic (SSR/Client) utility framework for web applications. It centralizes cross-cutting concerns, including HTTP request management with middleware/hooks, reactive URL state synchronization (Query/Hash), global configuration, internationalization, metadata management, and data caching.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
### 2. Key Expositions
|
|
5
|
+
* **Networking**: `Api`, `ApiInstance`, and `ApiCache` manage HTTP requests, caching layers, error handling (`ApiError`), and SSR hydration.
|
|
6
|
+
* **State & Sync**: `QueryInstance` and `HashInstance` provide reactive, syncable interfaces for URL-based states. `DataStorage` handles `localStorage`/`sessionStorage` with SSR isolation.
|
|
7
|
+
* **Localization (Geo/Intl)**: `Geo`, `GeoInstance`, and `GeoIntl` manage locale, timezone, and phone mask logic. `Translate` and `TranslateInstance` provide file-based and API-backed localization.
|
|
8
|
+
* **UI Helpers**: `EventItem` (DOM event wrapper with memory leak protection), `Loading` (global load state), `Icons` (asset management), and `Formatters` (data display utilities).
|
|
9
|
+
* **Meta Management**: `Meta` and its manager classes control document `<head>` elements, including Open Graph and Twitter Cards.
|
|
10
|
+
* **Core Utilities**: A suite of functions in `src/functions/` for type-safe data transformation, deep object cloning, DOM manipulation, and URL encoding.
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- Utils: A broad collection of pure functional utilities (e.g., `copyObject`, `toNumber`, `isFilled`, `sleep`, `frame`).
|
|
12
|
+
### 3. Triggers for Studying ai-types.md
|
|
13
|
+
The `ai-types.md` file is **mandatory** if the AI is tasked with:
|
|
14
|
+
* Extending or implementing new `ApiFetch` or `ApiConfig` interfaces.
|
|
15
|
+
* Integrating custom error handling via `ErrorCenter` or `ApiErrorStorageItem`.
|
|
16
|
+
* Extending geographical data schemas (`GeoItem`, `GeoPhoneValue`).
|
|
17
|
+
* Implementing new meta-tag configurations or Open Graph properties.
|
|
18
|
+
* Implementing search functionality using `SearchList` and associated types.
|
|
19
|
+
* **Crucial**: Whenever the task involves modifying request/response schemas or adding global middleware via `ApiInstance` options, as the types define strict constraints on request lifecycle hooks (`ApiPreparation`, `ApiPreparationEnd`).
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- When configuring global error handling (ErrorCenter).
|
|
19
|
-
- When standardizing data localization or date/time formatting (Geo, GeoIntl, Datetime).
|
|
20
|
-
- When managing complex SSR hydration patterns (ServerStorage, ApiHydration).
|
|
21
|
-
- When integrating deep-search components (SearchList).
|
|
22
|
-
- When developing custom UI components requiring lifecycle-safe event binding (EventItem).
|
|
23
|
-
|
|
24
|
-
Integration Context:
|
|
25
|
-
Operates as a foundational layer in the stack, compatible with both browser and Node.js (SSR) environments. It acts as a dependency for managing global application state, handling data-driven side effects, and normalizing communication with backend services. It is designed to be injected into frameworks (Vue/React) via lifecycle hooks or custom configuration providers.
|
|
21
|
+
### 4. Integration Context
|
|
22
|
+
The library acts as a foundational "System Toolkit." It is designed to be injected into frontend frameworks (Vue/React) via lifecycle-aware wrappers (e.g., triggering `createElement` only on mount). It bridge the gap between server (SSR) and client states through `ServerStorage` and `ApiHydration`, ensuring that state generated on the server is correctly transferred to the client without hydration mismatches.
|
package/ai-types.md
CHANGED
|
@@ -37,6 +37,7 @@ export declare class Api {
|
|
|
37
37
|
static setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): void;
|
|
38
38
|
static setTimeout(timeout: number): void;
|
|
39
39
|
static setOrigin(origin: string): void;
|
|
40
|
+
static setWrapper(wrapper: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>): void;
|
|
40
41
|
static setConfig(config?: ApiConfig): void;
|
|
41
42
|
static request<T>(pathRequest: string | ApiFetch): Promise<T>;
|
|
42
43
|
static get<T>(request: ApiFetch): Promise<T>;
|
|
@@ -45,6 +46,7 @@ export declare class Api {
|
|
|
45
46
|
static patch<T>(request: ApiFetch): Promise<T>;
|
|
46
47
|
static delete<T>(request: ApiFetch): Promise<T>;
|
|
47
48
|
}
|
|
49
|
+
|
|
48
50
|
// File: src/classes/ApiCache.d.ts
|
|
49
51
|
import { ApiCacheItem, ApiCacheList, ApiFetch } from '../types/apiTypes';
|
|
50
52
|
/**
|
|
@@ -59,6 +61,7 @@ export declare class ApiCache {
|
|
|
59
61
|
static setByFetch<T>(fetch: ApiFetch, value: T): Promise<void>;
|
|
60
62
|
static remove(key: string): Promise<void>;
|
|
61
63
|
}
|
|
64
|
+
|
|
62
65
|
// File: src/classes/ApiDataReturn.d.ts
|
|
63
66
|
import { ApiStatus } from './ApiStatus';
|
|
64
67
|
import { ApiErrorItem } from './ApiErrorItem';
|
|
@@ -73,10 +76,11 @@ export declare class ApiDataReturn<T = any> {
|
|
|
73
76
|
getAndStatus(status: ApiStatus): ApiData<T>;
|
|
74
77
|
getData(): ApiData<T> | undefined;
|
|
75
78
|
}
|
|
79
|
+
|
|
76
80
|
// File: src/classes/ApiDefault.d.ts
|
|
77
81
|
import { ApiDefaultValue, ApiFetch } from '../types/apiTypes';
|
|
78
82
|
/**
|
|
79
|
-
* Class for
|
|
83
|
+
* Class for managing default API request data.
|
|
80
84
|
*/
|
|
81
85
|
export declare class ApiDefault {
|
|
82
86
|
is(): boolean;
|
|
@@ -84,22 +88,24 @@ export declare class ApiDefault {
|
|
|
84
88
|
request(request: ApiFetch['request']): ApiFetch['request'];
|
|
85
89
|
set(request: ApiDefaultValue): this;
|
|
86
90
|
}
|
|
91
|
+
|
|
87
92
|
// File: src/classes/ApiError.d.ts
|
|
88
93
|
import { ApiErrorItem } from './ApiErrorItem';
|
|
89
94
|
import { ApiErrorStorage } from './ApiErrorStorage';
|
|
90
|
-
import { ApiMethodItem } from '../types/apiTypes';
|
|
95
|
+
import { ApiErrorStorageItem, ApiMethodItem } from '../types/apiTypes';
|
|
91
96
|
/**
|
|
92
97
|
* Utility for managing API error storage and creating error items.
|
|
93
98
|
*/
|
|
94
99
|
export declare class ApiError {
|
|
95
100
|
static getStorage(): ApiErrorStorage;
|
|
96
|
-
static add(item:
|
|
101
|
+
static add(item: Partial<ApiErrorStorageItem> | Partial<ApiErrorStorageItem>[], url?: string | RegExp, method?: ApiMethodItem): void;
|
|
97
102
|
static getItem(method: ApiMethodItem, response: Response): Promise<ApiErrorItem>;
|
|
98
103
|
}
|
|
104
|
+
|
|
99
105
|
// File: src/classes/ApiErrorItem.d.ts
|
|
100
106
|
import { ApiErrorStorageItem, ApiMethodItem } from '../types/apiTypes';
|
|
101
107
|
/**
|
|
102
|
-
* Class for managing and extracting data from
|
|
108
|
+
* Class for managing and extracting data from API error responses.
|
|
103
109
|
*/
|
|
104
110
|
export declare class ApiErrorItem {
|
|
105
111
|
constructor(method: ApiMethodItem, response: Response, error: ApiErrorStorageItem);
|
|
@@ -110,15 +116,17 @@ export declare class ApiErrorItem {
|
|
|
110
116
|
getMessage(): string | undefined;
|
|
111
117
|
getStatus(): number;
|
|
112
118
|
}
|
|
119
|
+
|
|
113
120
|
// File: src/classes/ApiErrorStorage.d.ts
|
|
114
121
|
import { ApiErrorStorageList, ApiErrorStorageItem, ApiMethodItem } from '../types/apiTypes';
|
|
115
122
|
/**
|
|
116
|
-
* Manager for handling
|
|
123
|
+
* Manager for handling API error states.
|
|
117
124
|
*/
|
|
118
125
|
export declare class ApiErrorStorage {
|
|
119
126
|
find(method: ApiMethodItem, response: Response): Promise<ApiErrorStorageItem>;
|
|
120
|
-
add(item:
|
|
127
|
+
add(item: Partial<ApiErrorStorageItem> | Partial<ApiErrorStorageItem>[], url?: string | RegExp, method?: ApiMethodItem): this;
|
|
121
128
|
}
|
|
129
|
+
|
|
122
130
|
// File: src/classes/ApiHeaders.d.ts
|
|
123
131
|
import { ApiFetch, ApiHeadersValue } from '../types/apiTypes';
|
|
124
132
|
/**
|
|
@@ -129,17 +137,19 @@ export declare class ApiHeaders {
|
|
|
129
137
|
getByRequest(request: ApiFetch['request'], value?: Record<string, string> | null, type?: string): Record<string, string> | undefined;
|
|
130
138
|
set(headers: ApiHeadersValue): this;
|
|
131
139
|
}
|
|
140
|
+
|
|
132
141
|
// File: src/classes/ApiHydration.d.ts
|
|
133
142
|
import { ApiResponse } from './ApiResponse';
|
|
134
143
|
import { ApiFetch, ApiHydrationList } from '../types/apiTypes';
|
|
135
144
|
/**
|
|
136
|
-
* Class for collecting API data for
|
|
145
|
+
* Class for collecting API data for SSR client-side hydration.
|
|
137
146
|
*/
|
|
138
147
|
export declare class ApiHydration {
|
|
139
148
|
initResponse(response: ApiResponse): void;
|
|
140
149
|
toClient<T>(apiFetch: ApiFetch, response: T): void;
|
|
141
150
|
toString(): string;
|
|
142
151
|
}
|
|
152
|
+
|
|
143
153
|
// File: src/classes/ApiInstance.d.ts
|
|
144
154
|
import { LoadingInstance } from './LoadingInstance';
|
|
145
155
|
import { ErrorCenterInstance } from './ErrorCenterInstance';
|
|
@@ -159,6 +169,7 @@ export type ApiInstanceOptions = {
|
|
|
159
169
|
loadingClass?: LoadingInstance;
|
|
160
170
|
errorCenterClass?: ErrorCenterInstance;
|
|
161
171
|
hydrationClass?: typeof ApiHydration;
|
|
172
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
162
173
|
};
|
|
163
174
|
/**
|
|
164
175
|
* Core class for managing HTTP requests using the Fetch API.
|
|
@@ -181,6 +192,7 @@ export declare class ApiInstance {
|
|
|
181
192
|
setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
|
|
182
193
|
setTimeout(timeout: number): this;
|
|
183
194
|
setOrigin(origin: string): this;
|
|
195
|
+
setWrapper(wrapper: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>): this;
|
|
184
196
|
request<T>(pathRequest: string | ApiFetch): Promise<T>;
|
|
185
197
|
get<T>(request: ApiFetch): Promise<T>;
|
|
186
198
|
post<T>(request: ApiFetch): Promise<T>;
|
|
@@ -188,6 +200,7 @@ export declare class ApiInstance {
|
|
|
188
200
|
patch<T>(request: ApiFetch): Promise<T>;
|
|
189
201
|
delete<T>(request: ApiFetch): Promise<T>;
|
|
190
202
|
}
|
|
203
|
+
|
|
191
204
|
// File: src/classes/ApiPreparation.d.ts
|
|
192
205
|
import { ApiFetch, ApiPreparationEnd } from '../types/apiTypes';
|
|
193
206
|
/**
|
|
@@ -199,6 +212,7 @@ export declare class ApiPreparation {
|
|
|
199
212
|
set(callback: (apiFetch: ApiFetch) => Promise<void>): this;
|
|
200
213
|
setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
|
|
201
214
|
}
|
|
215
|
+
|
|
202
216
|
// File: src/classes/ApiResponse.d.ts
|
|
203
217
|
import { ApiDefault } from './ApiDefault';
|
|
204
218
|
import { ApiFetch, ApiMethod, ApiResponseItem } from '../types/apiTypes';
|
|
@@ -214,6 +228,7 @@ export declare class ApiResponse {
|
|
|
214
228
|
emulator<T>(apiFetch: ApiFetch): Promise<T | undefined>;
|
|
215
229
|
emulatorAsync<T>(apiFetch: ApiFetch): T | undefined;
|
|
216
230
|
}
|
|
231
|
+
|
|
217
232
|
// File: src/classes/ApiStatus.d.ts
|
|
218
233
|
import { ApiStatusItem, ApiStatusType } from '../types/apiTypes';
|
|
219
234
|
/**
|
|
@@ -236,6 +251,7 @@ export declare class ApiStatus {
|
|
|
236
251
|
setLastCode(code?: string): this;
|
|
237
252
|
setLastMessage(message?: string): this;
|
|
238
253
|
}
|
|
254
|
+
|
|
239
255
|
// File: src/classes/BroadcastMessage.d.ts
|
|
240
256
|
import { ErrorCenterInstance } from './ErrorCenterInstance';
|
|
241
257
|
/**
|
|
@@ -249,19 +265,21 @@ export declare class BroadcastMessage<Message = any> {
|
|
|
249
265
|
setCallbackError(callbackError: (event: MessageEvent<Message>) => void): this;
|
|
250
266
|
destroy(): this;
|
|
251
267
|
}
|
|
268
|
+
|
|
252
269
|
// File: src/classes/Cache.d.ts
|
|
253
270
|
/**
|
|
254
271
|
* Simple in-memory cache class.
|
|
255
|
-
* @deprecated
|
|
272
|
+
* @deprecated Use alternative caching mechanisms.
|
|
256
273
|
*/
|
|
257
274
|
export declare class Cache {
|
|
258
275
|
get<T>(name: string, callback: () => T, comparison?: any[]): T;
|
|
259
276
|
getAsync<T>(name: string, callback: () => T, comparison?: any[]): Promise<T>;
|
|
260
277
|
}
|
|
278
|
+
|
|
261
279
|
// File: src/classes/CacheItem.d.ts
|
|
262
280
|
/**
|
|
263
281
|
* Class for managing a single cached value.
|
|
264
|
-
* @deprecated
|
|
282
|
+
* @deprecated Use alternative caching mechanisms.
|
|
265
283
|
*/
|
|
266
284
|
export declare class CacheItem<T> {
|
|
267
285
|
constructor(callback: () => T);
|
|
@@ -269,16 +287,18 @@ export declare class CacheItem<T> {
|
|
|
269
287
|
getCacheOld(): T | undefined;
|
|
270
288
|
getCacheAsync(comparison: any[]): Promise<T>;
|
|
271
289
|
}
|
|
290
|
+
|
|
272
291
|
// File: src/classes/CacheStatic.d.ts
|
|
273
292
|
import { Cache } from './Cache';
|
|
274
293
|
/**
|
|
275
294
|
* Static cache class.
|
|
276
|
-
* @deprecated
|
|
295
|
+
* @deprecated Use alternative caching mechanisms.
|
|
277
296
|
*/
|
|
278
297
|
export declare class CacheStatic {
|
|
279
298
|
static get<T>(name: string, callback: () => T, comparison?: any[]): T;
|
|
280
299
|
static getAsync<T>(name: string, callback: () => T, comparison?: any[]): Promise<T>;
|
|
281
300
|
}
|
|
301
|
+
|
|
282
302
|
// File: src/classes/Cookie.d.ts
|
|
283
303
|
import { CookieOptions } from './CookieStorage';
|
|
284
304
|
/**
|
|
@@ -291,6 +311,7 @@ export declare class Cookie<T> {
|
|
|
291
311
|
set(value?: T | string | (() => (T | string)), options?: CookieOptions): void;
|
|
292
312
|
remove(): void;
|
|
293
313
|
}
|
|
314
|
+
|
|
294
315
|
// File: src/classes/CookieBlock.d.ts
|
|
295
316
|
import { CookieBlockInstance } from './CookieBlockInstance';
|
|
296
317
|
/**
|
|
@@ -301,6 +322,7 @@ export declare class CookieBlock {
|
|
|
301
322
|
static get(): boolean;
|
|
302
323
|
static set(value: boolean): void;
|
|
303
324
|
}
|
|
325
|
+
|
|
304
326
|
// File: src/classes/CookieBlockInstance.d.ts
|
|
305
327
|
/**
|
|
306
328
|
* Class for changing cookie access status.
|
|
@@ -309,6 +331,7 @@ export declare class CookieBlockInstance {
|
|
|
309
331
|
get(): boolean;
|
|
310
332
|
set(value: boolean): void;
|
|
311
333
|
}
|
|
334
|
+
|
|
312
335
|
// File: src/classes/CookieStorage.d.ts
|
|
313
336
|
export type CookieSameSite = 'strict' | 'lax';
|
|
314
337
|
export type CookieOptions = {
|
|
@@ -332,6 +355,7 @@ export declare class CookieStorage {
|
|
|
332
355
|
static remove(name: string): void;
|
|
333
356
|
static update(): void;
|
|
334
357
|
}
|
|
358
|
+
|
|
335
359
|
// File: src/classes/DataStorage.d.ts
|
|
336
360
|
import { ErrorCenterInstance } from './ErrorCenterInstance';
|
|
337
361
|
/**
|
|
@@ -345,12 +369,13 @@ export declare class DataStorage<T> {
|
|
|
345
369
|
remove(): this;
|
|
346
370
|
update(): this;
|
|
347
371
|
}
|
|
372
|
+
|
|
348
373
|
// File: src/classes/Datetime.d.ts
|
|
349
374
|
import { GeoIntl } from './GeoIntl';
|
|
350
375
|
import { NumberOrStringOrDate } from '../types/basicTypes';
|
|
351
376
|
import { GeoDate, GeoFirstDay, GeoHours, GeoTimeZoneStyle } from '../types/geoTypes';
|
|
352
377
|
/**
|
|
353
|
-
*
|
|
378
|
+
* Class for working with dates.
|
|
354
379
|
*/
|
|
355
380
|
export declare class Datetime {
|
|
356
381
|
constructor(date?: NumberOrStringOrDate, type?: GeoDate, code?: string);
|
|
@@ -425,6 +450,7 @@ export declare class Datetime {
|
|
|
425
450
|
cloneDayNext(): Datetime;
|
|
426
451
|
cloneDayPrevious(): Datetime;
|
|
427
452
|
}
|
|
453
|
+
|
|
428
454
|
// File: src/classes/ErrorCenter.d.ts
|
|
429
455
|
import { ErrorCenterInstance } from './ErrorCenterInstance';
|
|
430
456
|
import { ErrorCenterCauseItem, ErrorCenterCauseList, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerList } from '../types/errorCenter';
|
|
@@ -441,19 +467,21 @@ export declare class ErrorCenter {
|
|
|
441
467
|
static addHandlerList(handlers: ErrorCenterHandlerList): void;
|
|
442
468
|
static on(cause: ErrorCenterCauseItem): void;
|
|
443
469
|
}
|
|
470
|
+
|
|
444
471
|
// File: src/classes/ErrorCenterHandler.d.ts
|
|
445
|
-
import { ErrorCenterCauseItem, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerList } from '../types/errorCenter';
|
|
472
|
+
import { ErrorCenterCauseItem, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerItem, ErrorCenterHandlerList } from '../types/errorCenter';
|
|
446
473
|
/**
|
|
447
474
|
* Class for managing and triggering error handlers.
|
|
448
475
|
*/
|
|
449
476
|
export declare class ErrorCenterHandler {
|
|
450
477
|
constructor(handlers?: ErrorCenterHandlerList);
|
|
451
478
|
has(group: ErrorCenterGroup): boolean;
|
|
452
|
-
get(group: ErrorCenterGroup):
|
|
479
|
+
get(group: ErrorCenterGroup): ErrorCenterHandlerItem | undefined;
|
|
453
480
|
add(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): this;
|
|
454
481
|
addList(handlers: ErrorCenterHandlerList): this;
|
|
455
482
|
on(cause: ErrorCenterCauseItem): this;
|
|
456
483
|
}
|
|
484
|
+
|
|
457
485
|
// File: src/classes/ErrorCenterInstance.d.ts
|
|
458
486
|
import { ErrorCenterHandler } from './ErrorCenterHandler';
|
|
459
487
|
import { ErrorCenterCauseItem, ErrorCenterCauseList, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerList } from '../types/errorCenter';
|
|
@@ -470,10 +498,11 @@ export declare class ErrorCenterInstance {
|
|
|
470
498
|
addHandlerList(handlers: ErrorCenterHandlerList): this;
|
|
471
499
|
on(cause: ErrorCenterCauseItem): this;
|
|
472
500
|
}
|
|
501
|
+
|
|
473
502
|
// File: src/classes/EventItem.d.ts
|
|
474
503
|
import { ElementOrString, ElementOrWindow, EventListenerDetail, EventOptions } from '../types/basicTypes';
|
|
475
504
|
/**
|
|
476
|
-
* Advanced wrapper for managing event listeners.
|
|
505
|
+
* Advanced wrapper for managing event listeners on DOM elements.
|
|
477
506
|
*/
|
|
478
507
|
export declare class EventItem<E extends ElementOrWindow, O extends Event, D extends Record<string, any> = Record<string, any>> {
|
|
479
508
|
constructor(elementSelector?: ElementOrString<E>, type?: string | string[], listener?: EventListenerDetail<O, D> | undefined, options?: EventOptions, detail?: D | undefined);
|
|
@@ -491,21 +520,25 @@ export declare class EventItem<E extends ElementOrWindow, O extends Event, D ext
|
|
|
491
520
|
toggle(activity: boolean): this;
|
|
492
521
|
reset(): this;
|
|
493
522
|
}
|
|
523
|
+
|
|
494
524
|
// File: src/classes/Formatters.d.ts
|
|
495
|
-
import { FormattersType, FormattersOptionsList,
|
|
525
|
+
import { FormattersType, FormattersOptionsList, FormattersOptionsCurrency, FormattersOptionsDate, FormattersOptionsName, FormattersOptionsNumber, FormattersOptionsPlural, FormattersOptionsUnit, FormattersReturn, FormattersListProp, FormattersItemProp } from '../types/formattersTypes';
|
|
496
526
|
/**
|
|
497
527
|
* Class for formatting a list of data.
|
|
498
528
|
*/
|
|
499
529
|
export declare class Formatters<Options extends FormattersOptionsList = FormattersOptionsList, List extends FormattersListProp = FormattersListProp, Item extends FormattersItemProp<List> = FormattersItemProp<List>> {
|
|
500
530
|
constructor(options: Options, list?: List | undefined);
|
|
501
531
|
is(): boolean;
|
|
502
|
-
isArray(): this is this & {
|
|
532
|
+
isArray(): this is this & {
|
|
533
|
+
list: any[];
|
|
534
|
+
};
|
|
503
535
|
length(): number;
|
|
504
536
|
getList(): any[];
|
|
505
537
|
getOptions(): Options;
|
|
506
538
|
setList(list?: List): this;
|
|
507
539
|
to(): FormattersReturn<List, Options>;
|
|
508
540
|
}
|
|
541
|
+
|
|
509
542
|
// File: src/classes/Geo.d.ts
|
|
510
543
|
import { GeoInstance } from './GeoInstance';
|
|
511
544
|
import { GeoItem, GeoItemFull } from '../types/geoTypes';
|
|
@@ -536,7 +569,9 @@ export declare class Geo {
|
|
|
536
569
|
static setTimezone(timezone: number): void;
|
|
537
570
|
static setValueDefault(code?: string | (() => string)): void;
|
|
538
571
|
}
|
|
572
|
+
|
|
539
573
|
// File: src/classes/GeoFlag.d.ts
|
|
574
|
+
import { GeoIntl } from './GeoIntl';
|
|
540
575
|
import { GeoFlagItem, GeoFlagNational } from '../types/geoTypes';
|
|
541
576
|
export declare const GEO_FLAG_ICON_NAME = "f";
|
|
542
577
|
/**
|
|
@@ -546,12 +581,16 @@ export declare class GeoFlag {
|
|
|
546
581
|
static flags: Record<string, string>;
|
|
547
582
|
constructor(code?: string);
|
|
548
583
|
get(code?: string): GeoFlagItem | undefined;
|
|
584
|
+
getLanguage(code?: string): GeoFlagItem | undefined;
|
|
549
585
|
getCode(): string;
|
|
550
586
|
getFlag(code?: string): string | undefined;
|
|
551
587
|
getList(codes?: string[], sort?: boolean): GeoFlagItem[];
|
|
588
|
+
getListLanguage(codes?: string[], sort?: boolean): GeoFlagItem[];
|
|
552
589
|
getNational(codes?: string[], sort?: boolean): GeoFlagNational[];
|
|
590
|
+
getNationalLanguage(codes?: string[], sort?: boolean): GeoFlagNational[];
|
|
553
591
|
setCode(code: string): this;
|
|
554
592
|
}
|
|
593
|
+
|
|
555
594
|
// File: src/classes/GeoInstance.d.ts
|
|
556
595
|
import { GeoItem, GeoItemFull } from '../types/geoTypes';
|
|
557
596
|
export declare const UI_GEO_COOKIE_KEY = "ui-geo-code";
|
|
@@ -582,12 +621,13 @@ export declare class GeoInstance {
|
|
|
582
621
|
setTimezone(timezone: number): void;
|
|
583
622
|
setValueDefault(code?: string | (() => string)): void;
|
|
584
623
|
}
|
|
624
|
+
|
|
585
625
|
// File: src/classes/GeoIntl.d.ts
|
|
586
626
|
import { ErrorCenterInstance } from './ErrorCenterInstance';
|
|
587
627
|
import { NumberOrStringOrDate, NumberOrString, ItemValue } from '../types/basicTypes';
|
|
588
628
|
import { GeoDate } from '../types/geoTypes';
|
|
589
629
|
/**
|
|
590
|
-
*
|
|
630
|
+
* Geo internationalization utility class.
|
|
591
631
|
*/
|
|
592
632
|
export declare class GeoIntl {
|
|
593
633
|
static isItem(code?: string): boolean;
|
|
@@ -620,10 +660,11 @@ export declare class GeoIntl {
|
|
|
620
660
|
time(value: NumberOrStringOrDate): string;
|
|
621
661
|
sort<T>(data: T[], compareFn?: (a: T, b: T) => [string, string]): T[];
|
|
622
662
|
}
|
|
663
|
+
|
|
623
664
|
// File: src/classes/GeoPhone.d.ts
|
|
624
665
|
import { GeoPhoneValue, GeoPhoneMap, GeoPhoneMapInfo } from '../types/geoTypes';
|
|
625
666
|
/**
|
|
626
|
-
*
|
|
667
|
+
* Class for storing and processing phone number masks.
|
|
627
668
|
*/
|
|
628
669
|
export declare class GeoPhone {
|
|
629
670
|
static get(code: string): GeoPhoneValue | undefined;
|
|
@@ -634,19 +675,21 @@ export declare class GeoPhone {
|
|
|
634
675
|
static toMask(phone: string, masks?: string[]): string | undefined;
|
|
635
676
|
static removeZero(phone: string): string;
|
|
636
677
|
}
|
|
678
|
+
|
|
637
679
|
// File: src/classes/Global.d.ts
|
|
638
680
|
/**
|
|
639
|
-
* Static
|
|
681
|
+
* Static class for global data storage.
|
|
640
682
|
*/
|
|
641
683
|
export declare class Global {
|
|
642
684
|
static getItem(): Record<string, any>;
|
|
643
685
|
static get<R = any>(name: string): R;
|
|
644
686
|
static add(data: Record<string, any>): void;
|
|
645
687
|
}
|
|
688
|
+
|
|
646
689
|
// File: src/classes/Hash.d.ts
|
|
647
690
|
import { HashInstance } from './HashInstance';
|
|
648
691
|
/**
|
|
649
|
-
* Static class for URL hash data.
|
|
692
|
+
* Static class for working with URL hash data.
|
|
650
693
|
*/
|
|
651
694
|
export declare class Hash {
|
|
652
695
|
static getItem(): HashInstance;
|
|
@@ -656,13 +699,14 @@ export declare class Hash {
|
|
|
656
699
|
static removeWatch<T>(name: string, callback: (value: T) => void): void;
|
|
657
700
|
static reload(): void;
|
|
658
701
|
}
|
|
702
|
+
|
|
659
703
|
// File: src/classes/HashInstance.d.ts
|
|
660
704
|
import { UrlInstanceAbstract } from './UrlInstanceAbstract';
|
|
661
705
|
/**
|
|
662
|
-
* Class for URL hash data.
|
|
706
|
+
* Class for working with URL hash data.
|
|
663
707
|
*/
|
|
664
|
-
export declare class HashInstance extends UrlInstanceAbstract {
|
|
665
|
-
|
|
708
|
+
export declare class HashInstance extends UrlInstanceAbstract {}
|
|
709
|
+
|
|
666
710
|
// File: src/classes/Icons.d.ts
|
|
667
711
|
export type IconsItem = string | Promise<string | any> | (() => Promise<string | any>);
|
|
668
712
|
export type IconsConfig = {
|
|
@@ -685,11 +729,12 @@ export declare class Icons {
|
|
|
685
729
|
static setUrl(url: string): void;
|
|
686
730
|
static setConfig(config: IconsConfig): void;
|
|
687
731
|
}
|
|
732
|
+
|
|
688
733
|
// File: src/classes/Loading.d.ts
|
|
689
734
|
import { LoadingInstance } from './LoadingInstance';
|
|
690
735
|
import { ElementOrString, EventListenerDetail } from '../types/basicTypes';
|
|
691
736
|
/**
|
|
692
|
-
* Class for
|
|
737
|
+
* Class for global loading management.
|
|
693
738
|
*/
|
|
694
739
|
export declare class Loading {
|
|
695
740
|
static is(): boolean;
|
|
@@ -700,13 +745,20 @@ export declare class Loading {
|
|
|
700
745
|
static registrationEvent(listener: EventListenerDetail<CustomEvent, any>, element?: ElementOrString<HTMLElement>): void;
|
|
701
746
|
static unregistrationEvent(listener: EventListenerDetail<CustomEvent, any>, element?: ElementOrString<HTMLElement>): void;
|
|
702
747
|
}
|
|
748
|
+
|
|
703
749
|
// File: src/classes/LoadingInstance.d.ts
|
|
750
|
+
import { EventItem } from './EventItem';
|
|
704
751
|
import { ElementOrString, EventListenerDetail } from '../types/basicTypes';
|
|
705
752
|
export type LoadingDetail = {
|
|
706
753
|
loading: boolean;
|
|
707
754
|
};
|
|
755
|
+
export type LoadingRegistrationItem = {
|
|
756
|
+
item: EventItem<Window, CustomEvent, LoadingDetail>;
|
|
757
|
+
listener: EventListenerDetail<CustomEvent, LoadingDetail>;
|
|
758
|
+
element?: ElementOrString<HTMLElement>;
|
|
759
|
+
};
|
|
708
760
|
/**
|
|
709
|
-
* Class for
|
|
761
|
+
* Class for global loading management instance.
|
|
710
762
|
*/
|
|
711
763
|
export declare class LoadingInstance {
|
|
712
764
|
constructor(eventName?: string);
|
|
@@ -717,13 +769,14 @@ export declare class LoadingInstance {
|
|
|
717
769
|
registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
718
770
|
unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
719
771
|
}
|
|
772
|
+
|
|
720
773
|
// File: src/classes/Meta.d.ts
|
|
721
774
|
import { MetaManager } from './MetaManager';
|
|
722
775
|
import { MetaOg } from './MetaOg';
|
|
723
776
|
import { MetaTwitter } from './MetaTwitter';
|
|
724
777
|
import { MetaRobots, MetaTag } from '../types/metaTypes';
|
|
725
778
|
/**
|
|
726
|
-
*
|
|
779
|
+
* Class for managing meta tags (HTML, OG, Twitter).
|
|
727
780
|
*/
|
|
728
781
|
export declare class Meta extends MetaManager<MetaTag[]> {
|
|
729
782
|
constructor();
|
|
@@ -751,21 +804,29 @@ export declare class Meta extends MetaManager<MetaTag[]> {
|
|
|
751
804
|
html(): string;
|
|
752
805
|
htmlTitle(): string;
|
|
753
806
|
}
|
|
807
|
+
|
|
754
808
|
// File: src/classes/MetaManager.d.ts
|
|
755
|
-
|
|
809
|
+
type MetaList<T extends readonly string[]> = {
|
|
810
|
+
[K in T[number]]?: string;
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* Base class for meta tag management.
|
|
814
|
+
*/
|
|
815
|
+
export declare class MetaManager<T extends readonly string[], Key extends keyof MetaList<T> = keyof MetaList<T>> {
|
|
756
816
|
constructor(listMeta: T, isProperty?: boolean);
|
|
757
817
|
getListMeta(): T;
|
|
758
818
|
get(name: Key): string;
|
|
759
|
-
getItems():
|
|
819
|
+
getItems(): MetaList<T>;
|
|
760
820
|
html(): string;
|
|
761
821
|
set(name: Key, content: string): this;
|
|
762
|
-
setByList(metaList:
|
|
822
|
+
setByList(metaList: MetaList<T>): this;
|
|
763
823
|
}
|
|
824
|
+
|
|
764
825
|
// File: src/classes/MetaOg.d.ts
|
|
765
826
|
import { MetaManager } from './MetaManager';
|
|
766
827
|
import { MetaOpenGraphTag, MetaOpenGraphType } from '../types/metaTypes';
|
|
767
828
|
/**
|
|
768
|
-
* Class for Open Graph meta tags.
|
|
829
|
+
* Class for managing Open Graph meta tags.
|
|
769
830
|
*/
|
|
770
831
|
export declare class MetaOg extends MetaManager<MetaOpenGraphTag[]> {
|
|
771
832
|
constructor();
|
|
@@ -784,13 +845,14 @@ export declare class MetaOg extends MetaManager<MetaOpenGraphTag[]> {
|
|
|
784
845
|
setLocale(locale: string): this;
|
|
785
846
|
setSiteName(siteName: string): this;
|
|
786
847
|
}
|
|
848
|
+
|
|
787
849
|
// File: src/classes/MetaStatic.d.ts
|
|
788
850
|
import { Meta } from './Meta';
|
|
789
851
|
import { MetaOg } from './MetaOg';
|
|
790
852
|
import { MetaTwitter } from './MetaTwitter';
|
|
791
853
|
import { MetaRobots } from '../types/metaTypes';
|
|
792
854
|
/**
|
|
793
|
-
* Static
|
|
855
|
+
* Static interface for meta tag management.
|
|
794
856
|
*/
|
|
795
857
|
export declare class MetaStatic {
|
|
796
858
|
static getItem(): Meta;
|
|
@@ -818,11 +880,12 @@ export declare class MetaStatic {
|
|
|
818
880
|
static html(): string;
|
|
819
881
|
static htmlTitle(): string;
|
|
820
882
|
}
|
|
883
|
+
|
|
821
884
|
// File: src/classes/MetaTwitter.d.ts
|
|
822
885
|
import { MetaManager } from './MetaManager';
|
|
823
886
|
import { MetaTwitterCard, MetaTwitterTag } from '../types/metaTypes';
|
|
824
887
|
/**
|
|
825
|
-
* Class for Twitter Card meta tags.
|
|
888
|
+
* Class for managing Twitter Card meta tags.
|
|
826
889
|
*/
|
|
827
890
|
export declare class MetaTwitter extends MetaManager<MetaTwitterTag[]> {
|
|
828
891
|
constructor();
|
|
@@ -841,10 +904,11 @@ export declare class MetaTwitter extends MetaManager<MetaTwitterTag[]> {
|
|
|
841
904
|
setDescription(description: string): this;
|
|
842
905
|
setImage(image: string): this;
|
|
843
906
|
}
|
|
907
|
+
|
|
844
908
|
// File: src/classes/Query.d.ts
|
|
845
909
|
import { QueryInstance } from './QueryInstance';
|
|
846
910
|
/**
|
|
847
|
-
* Static class for URL query parameters.
|
|
911
|
+
* Static class for working with URL query parameters.
|
|
848
912
|
*/
|
|
849
913
|
export declare class Query {
|
|
850
914
|
static getItem(): QueryInstance;
|
|
@@ -854,17 +918,18 @@ export declare class Query {
|
|
|
854
918
|
static removeWatch<T>(name: string, callback: (value: T) => void): void;
|
|
855
919
|
static reload(): void;
|
|
856
920
|
}
|
|
921
|
+
|
|
857
922
|
// File: src/classes/QueryInstance.d.ts
|
|
858
923
|
import { UrlInstanceAbstract } from './UrlInstanceAbstract';
|
|
859
924
|
/**
|
|
860
|
-
* Class for URL query parameters.
|
|
925
|
+
* Class for working with URL query parameters.
|
|
861
926
|
*/
|
|
862
|
-
export declare class QueryInstance extends UrlInstanceAbstract {
|
|
863
|
-
|
|
927
|
+
export declare class QueryInstance extends UrlInstanceAbstract {}
|
|
928
|
+
|
|
864
929
|
// File: src/classes/ResumableTimer.d.ts
|
|
865
930
|
import { FunctionVoid } from '../types/basicTypes';
|
|
866
931
|
/**
|
|
867
|
-
*
|
|
932
|
+
* Timer that can be paused and resumed.
|
|
868
933
|
*/
|
|
869
934
|
export declare class ResumableTimer {
|
|
870
935
|
constructor(callback: FunctionVoid, delay?: number, blockStart?: boolean);
|
|
@@ -873,10 +938,11 @@ export declare class ResumableTimer {
|
|
|
873
938
|
reset(): this;
|
|
874
939
|
clear(): this;
|
|
875
940
|
}
|
|
941
|
+
|
|
876
942
|
// File: src/classes/ScrollbarWidth.d.ts
|
|
877
943
|
import { DataStorage } from './DataStorage';
|
|
878
944
|
/**
|
|
879
|
-
* Class for
|
|
945
|
+
* Class for measuring scrollbar width.
|
|
880
946
|
*/
|
|
881
947
|
export declare class ScrollbarWidth {
|
|
882
948
|
static is(): Promise<boolean>;
|
|
@@ -884,6 +950,7 @@ export declare class ScrollbarWidth {
|
|
|
884
950
|
static getStorage(): DataStorage<number>;
|
|
885
951
|
static getCalculate(): boolean;
|
|
886
952
|
}
|
|
953
|
+
|
|
887
954
|
// File: src/classes/SearchList.d.ts
|
|
888
955
|
import { SearchListData } from './SearchListData';
|
|
889
956
|
import { SearchListItem } from './SearchListItem';
|
|
@@ -891,7 +958,7 @@ import { SearchListMatcher } from './SearchListMatcher';
|
|
|
891
958
|
import { SearchListOptions } from './SearchListOptions';
|
|
892
959
|
import { SearchColumns, SearchFormatList, SearchItem, SearchListValue, SearchOptions } from '../types/searchTypes';
|
|
893
960
|
/**
|
|
894
|
-
* Main
|
|
961
|
+
* Main manager for searchable lists.
|
|
895
962
|
*/
|
|
896
963
|
export declare class SearchList<T extends SearchItem, K extends SearchColumns<T>> {
|
|
897
964
|
constructor(list: SearchListValue<T>, columns?: K, value?: string, options?: SearchOptions);
|
|
@@ -907,17 +974,23 @@ export declare class SearchList<T extends SearchItem, K extends SearchColumns<T>
|
|
|
907
974
|
setOptions(options: SearchOptions): this;
|
|
908
975
|
to(): SearchFormatList<T, K>;
|
|
909
976
|
}
|
|
977
|
+
|
|
910
978
|
// File: src/classes/SearchListData.d.ts
|
|
911
979
|
import { SearchListItem } from './SearchListItem';
|
|
912
980
|
import { SearchListOptions } from './SearchListOptions';
|
|
913
981
|
import { SearchCacheItem, SearchColumns, SearchFormatItem, SearchFormatList, SearchItem, SearchListValue } from '../types/searchTypes';
|
|
914
982
|
/**
|
|
915
|
-
*
|
|
983
|
+
* Manager for search data and caching.
|
|
916
984
|
*/
|
|
917
985
|
export declare class SearchListData<T extends SearchItem, K extends SearchColumns<T>> {
|
|
918
986
|
constructor(list: SearchListValue<T>, columns: K | undefined, item: SearchListItem, options: SearchListOptions);
|
|
919
|
-
is(): this is this & {
|
|
920
|
-
|
|
987
|
+
is(): this is this & {
|
|
988
|
+
list: T[];
|
|
989
|
+
columns: string[];
|
|
990
|
+
};
|
|
991
|
+
isList(): this is this & {
|
|
992
|
+
list: T[];
|
|
993
|
+
};
|
|
921
994
|
getList(): SearchListValue<T>;
|
|
922
995
|
getColumns(): K | undefined;
|
|
923
996
|
setList(list: SearchListValue<T>): this;
|
|
@@ -926,24 +999,28 @@ export declare class SearchListData<T extends SearchItem, K extends SearchColumn
|
|
|
926
999
|
forEach(callback: (item: SearchCacheItem<T>['item'], value: SearchCacheItem<T>['value']) => SearchFormatItem<T, K> | undefined): SearchFormatList<T, K>;
|
|
927
1000
|
toFormatItem(item: T, selection: boolean): SearchFormatItem<T, K>;
|
|
928
1001
|
}
|
|
1002
|
+
|
|
929
1003
|
// File: src/classes/SearchListItem.d.ts
|
|
930
1004
|
import { SearchListOptions } from './SearchListOptions';
|
|
931
1005
|
/**
|
|
932
|
-
*
|
|
1006
|
+
* State for a single search item.
|
|
933
1007
|
*/
|
|
934
1008
|
export declare class SearchListItem {
|
|
935
1009
|
constructor(value: string | undefined, options: SearchListOptions);
|
|
936
|
-
is(): this is this & {
|
|
1010
|
+
is(): this is this & {
|
|
1011
|
+
value: string;
|
|
1012
|
+
};
|
|
937
1013
|
isSearch(): boolean;
|
|
938
1014
|
get(): string;
|
|
939
1015
|
set(value?: string): this;
|
|
940
1016
|
}
|
|
1017
|
+
|
|
941
1018
|
// File: src/classes/SearchListMatcher.d.ts
|
|
942
1019
|
import { SearchListItem } from './SearchListItem';
|
|
943
1020
|
import { SearchListOptions } from './SearchListOptions';
|
|
944
1021
|
import { SearchCacheItem } from '../types/searchTypes';
|
|
945
1022
|
/**
|
|
946
|
-
*
|
|
1023
|
+
* Logic for matching search items.
|
|
947
1024
|
*/
|
|
948
1025
|
export declare class SearchListMatcher {
|
|
949
1026
|
constructor(item: SearchListItem, options: SearchListOptions);
|
|
@@ -952,10 +1029,11 @@ export declare class SearchListMatcher {
|
|
|
952
1029
|
get(): RegExp | undefined;
|
|
953
1030
|
update(): void;
|
|
954
1031
|
}
|
|
1032
|
+
|
|
955
1033
|
// File: src/classes/SearchListOptions.d.ts
|
|
956
1034
|
import { SearchOptions } from '../types/searchTypes';
|
|
957
1035
|
/**
|
|
958
|
-
* Class for managing search
|
|
1036
|
+
* Class for managing search options.
|
|
959
1037
|
*/
|
|
960
1038
|
export declare class SearchListOptions {
|
|
961
1039
|
constructor(options?: SearchOptions | undefined);
|
|
@@ -967,9 +1045,10 @@ export declare class SearchListOptions {
|
|
|
967
1045
|
getClassName(): string;
|
|
968
1046
|
setOptions(options: SearchOptions): this;
|
|
969
1047
|
}
|
|
1048
|
+
|
|
970
1049
|
// File: src/classes/ServerStorage.d.ts
|
|
971
1050
|
/**
|
|
972
|
-
*
|
|
1051
|
+
* SSR-safe storage management.
|
|
973
1052
|
*/
|
|
974
1053
|
export declare class ServerStorage {
|
|
975
1054
|
static init(listener: () => Record<string, any> | undefined): typeof ServerStorage;
|
|
@@ -981,9 +1060,10 @@ export declare class ServerStorage {
|
|
|
981
1060
|
static remove(key: string): void;
|
|
982
1061
|
static toString(): string;
|
|
983
1062
|
}
|
|
1063
|
+
|
|
984
1064
|
// File: src/classes/StorageCallback.d.ts
|
|
985
1065
|
/**
|
|
986
|
-
*
|
|
1066
|
+
* Helper for managing storage callbacks.
|
|
987
1067
|
*/
|
|
988
1068
|
export declare class StorageCallback<T = any, Callback = (value: T) => void | Promise<void>> {
|
|
989
1069
|
static getInstance<T>(name: string, group?: string): StorageCallback<T, (value: T) => void | Promise<void>>;
|
|
@@ -996,11 +1076,12 @@ export declare class StorageCallback<T = any, Callback = (value: T) => void | Pr
|
|
|
996
1076
|
preparation(): this;
|
|
997
1077
|
run(value: T): Promise<this>;
|
|
998
1078
|
}
|
|
1079
|
+
|
|
999
1080
|
// File: src/classes/Translate.d.ts
|
|
1000
1081
|
import { TranslateInstance } from './TranslateInstance';
|
|
1001
1082
|
import { TranslateCode, TranslateConfig, TranslateDataFile, TranslateList } from '../types/translateTypes';
|
|
1002
1083
|
/**
|
|
1003
|
-
*
|
|
1084
|
+
* Static interface for translations.
|
|
1004
1085
|
*/
|
|
1005
1086
|
export declare class Translate {
|
|
1006
1087
|
static get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
|
|
@@ -1018,10 +1099,11 @@ export declare class Translate {
|
|
|
1018
1099
|
static setReadApi(value: boolean): void;
|
|
1019
1100
|
static setConfig(config: TranslateConfig): void;
|
|
1020
1101
|
}
|
|
1102
|
+
|
|
1021
1103
|
// File: src/classes/TranslateFile.d.ts
|
|
1022
1104
|
import { TranslateDataFile, TranslateDataFileList } from '../types/translateTypes';
|
|
1023
1105
|
/**
|
|
1024
|
-
* Class for
|
|
1106
|
+
* Class for managing translation files.
|
|
1025
1107
|
*/
|
|
1026
1108
|
export declare class TranslateFile {
|
|
1027
1109
|
constructor(data?: TranslateDataFile, language?: string | (() => string), location?: string | (() => string));
|
|
@@ -1031,11 +1113,12 @@ export declare class TranslateFile {
|
|
|
1031
1113
|
getList(): Promise<TranslateDataFileList | undefined>;
|
|
1032
1114
|
add(data: TranslateDataFile): void;
|
|
1033
1115
|
}
|
|
1116
|
+
|
|
1034
1117
|
// File: src/classes/TranslateInstance.d.ts
|
|
1035
1118
|
import { TranslateFile } from './TranslateFile';
|
|
1036
1119
|
import { TranslateCode, TranslateDataFile, TranslateList } from '../types/translateTypes';
|
|
1037
1120
|
/**
|
|
1038
|
-
*
|
|
1121
|
+
* Manager for translation instances.
|
|
1039
1122
|
*/
|
|
1040
1123
|
export declare class TranslateInstance {
|
|
1041
1124
|
constructor(url?: string, propsName?: string, files?: TranslateFile);
|
|
@@ -1052,9 +1135,10 @@ export declare class TranslateInstance {
|
|
|
1052
1135
|
setPropsName(name: string): this;
|
|
1053
1136
|
setReadApi(value: boolean): this;
|
|
1054
1137
|
}
|
|
1138
|
+
|
|
1055
1139
|
// File: src/classes/UrlInstanceAbstract.d.ts
|
|
1056
1140
|
/**
|
|
1057
|
-
*
|
|
1141
|
+
* Abstract class for URL-based state management.
|
|
1058
1142
|
*/
|
|
1059
1143
|
export declare abstract class UrlInstanceAbstract {
|
|
1060
1144
|
get<T>(name: string, defaultValue?: T | (() => T)): T;
|
|
@@ -1063,9 +1147,10 @@ export declare abstract class UrlInstanceAbstract {
|
|
|
1063
1147
|
removeWatch<T>(name: string, callback: (value: T) => void): this;
|
|
1064
1148
|
reload(): this;
|
|
1065
1149
|
}
|
|
1150
|
+
|
|
1066
1151
|
// File: src/classes/UrlItem.d.ts
|
|
1067
1152
|
/**
|
|
1068
|
-
*
|
|
1153
|
+
* Utility for URL manipulation.
|
|
1069
1154
|
*/
|
|
1070
1155
|
export declare class UrlItem {
|
|
1071
1156
|
static getInstance(): UrlItem;
|
|
@@ -1092,6 +1177,7 @@ export declare class UrlItem {
|
|
|
1092
1177
|
toString(): string;
|
|
1093
1178
|
toJSON(): string;
|
|
1094
1179
|
}
|
|
1180
|
+
|
|
1095
1181
|
// File: src/functions/addTagHighlightMatch.d.ts
|
|
1096
1182
|
export declare function addTagHighlightMatch(value: string, search?: string | RegExp, className?: string, shouldEscape?: boolean): string;
|
|
1097
1183
|
// File: src/functions/anyToString.d.ts
|
|
@@ -1349,6 +1435,7 @@ export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
|
|
|
1349
1435
|
export declare function uniqueArray<T>(value: T[]): T[];
|
|
1350
1436
|
// File: src/functions/writeClipboardData.d.ts
|
|
1351
1437
|
export declare function writeClipboardData(text: string): Promise<void>;
|
|
1438
|
+
|
|
1352
1439
|
// File: src/library.d.ts
|
|
1353
1440
|
export * from './classes/Api';
|
|
1354
1441
|
export * from './classes/ApiCache';
|
|
@@ -1531,10 +1618,13 @@ export * from './types/geoTypes';
|
|
|
1531
1618
|
export * from './types/metaTypes';
|
|
1532
1619
|
export * from './types/searchTypes';
|
|
1533
1620
|
export * from './types/translateTypes';
|
|
1621
|
+
|
|
1534
1622
|
// File: src/media/errorCauseList.d.ts
|
|
1535
1623
|
import { ErrorCenterCauseList } from '../types/errorCenter';
|
|
1536
1624
|
export declare const errorCauseList: ErrorCenterCauseList;
|
|
1625
|
+
|
|
1537
1626
|
// File: src/types/apiTypes.d.ts
|
|
1627
|
+
import { ApiErrorItem } from '../classes/ApiErrorItem';
|
|
1538
1628
|
export declare enum ApiMethodItem {
|
|
1539
1629
|
delete = "DELETE",
|
|
1540
1630
|
get = "GET",
|
|
@@ -1557,6 +1647,7 @@ export type ApiConfig = {
|
|
|
1557
1647
|
end?: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>;
|
|
1558
1648
|
timeout?: number;
|
|
1559
1649
|
devMode?: boolean;
|
|
1650
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
1560
1651
|
};
|
|
1561
1652
|
export type ApiData<T = any> = T extends any[] ? T : ApiDataItem<T>;
|
|
1562
1653
|
export type ApiDataValidation = {
|
|
@@ -1603,6 +1694,7 @@ export type ApiFetch = {
|
|
|
1603
1694
|
enableClientCache?: boolean;
|
|
1604
1695
|
cacheId?: number | string;
|
|
1605
1696
|
endResetLimit?: number;
|
|
1697
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
1606
1698
|
};
|
|
1607
1699
|
export type ApiHydrationItem = {
|
|
1608
1700
|
path: string;
|
|
@@ -1644,6 +1736,7 @@ export type ApiStatusItem = {
|
|
|
1644
1736
|
lastMessage?: string;
|
|
1645
1737
|
};
|
|
1646
1738
|
export type ApiStatusType = 'success' | 'error' | 'warning' | 'info';
|
|
1739
|
+
|
|
1647
1740
|
// File: src/types/basicTypes.d.ts
|
|
1648
1741
|
export type Undefined = undefined | null;
|
|
1649
1742
|
export type EmptyValue = Undefined | 0 | false | '' | 'undefined' | 'null' | '0' | 'false' | '[]';
|
|
@@ -1686,6 +1779,7 @@ export type ImageCoordinator = {
|
|
|
1686
1779
|
x: number;
|
|
1687
1780
|
y: number;
|
|
1688
1781
|
};
|
|
1782
|
+
|
|
1689
1783
|
// File: src/types/errorCenter.d.ts
|
|
1690
1784
|
export type ErrorCenterGroup = string | undefined;
|
|
1691
1785
|
export type ErrorCenterCauseItem<D = any> = {
|
|
@@ -1703,6 +1797,7 @@ export type ErrorCenterHandlerItem = {
|
|
|
1703
1797
|
handlers: ErrorCenterHandlerCallback[];
|
|
1704
1798
|
};
|
|
1705
1799
|
export type ErrorCenterHandlerList = ErrorCenterHandlerItem[];
|
|
1800
|
+
|
|
1706
1801
|
// File: src/types/formattersTypes.d.ts
|
|
1707
1802
|
import { ArrayToItem } from './basicTypes';
|
|
1708
1803
|
import { GeoDate } from './geoTypes';
|
|
@@ -1762,6 +1857,7 @@ export type FormattersListColumns<T extends FormattersListItem, O extends Format
|
|
|
1762
1857
|
export type FormattersListProp = FormattersList<FormattersListItem> | FormattersListItem;
|
|
1763
1858
|
export type FormattersItemProp<List extends FormattersListProp> = ArrayToItem<List>;
|
|
1764
1859
|
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);
|
|
1860
|
+
|
|
1765
1861
|
// File: src/types/geoTypes.d.ts
|
|
1766
1862
|
export type GeoDate = 'full' | 'datetime' | 'date' | 'year-month' | 'year' | 'month' | 'day' | 'day-month' | 'time' | 'hour-minute' | 'hour' | 'minute' | 'second';
|
|
1767
1863
|
export type GeoFirstDay = 1 | 6 | 0;
|
|
@@ -1788,7 +1884,9 @@ export interface GeoItemFull extends Omit<GeoItem, 'firstDay'> {
|
|
|
1788
1884
|
}
|
|
1789
1885
|
export interface GeoFlagItem {
|
|
1790
1886
|
language: string;
|
|
1887
|
+
languageCode: string;
|
|
1791
1888
|
country: string;
|
|
1889
|
+
countryCode: string;
|
|
1792
1890
|
standard: string;
|
|
1793
1891
|
icon?: string;
|
|
1794
1892
|
label: string;
|
|
@@ -1818,6 +1916,7 @@ export interface GeoPhoneMapInfo {
|
|
|
1818
1916
|
item?: GeoPhoneMap;
|
|
1819
1917
|
phone?: string;
|
|
1820
1918
|
}
|
|
1919
|
+
|
|
1821
1920
|
// File: src/types/metaTypes.d.ts
|
|
1822
1921
|
export declare enum MetaTag {
|
|
1823
1922
|
title = "title",
|
|
@@ -2004,6 +2103,7 @@ export declare enum MetaTwitterCard {
|
|
|
2004
2103
|
audio = "audio",
|
|
2005
2104
|
poll = "poll"
|
|
2006
2105
|
}
|
|
2106
|
+
|
|
2007
2107
|
// File: src/types/searchTypes.d.ts
|
|
2008
2108
|
export type SearchItem = Record<string, any>;
|
|
2009
2109
|
export type SearchColumnPath<K, P> = K extends string ? P extends string ? `${K}.${P}` : never : never;
|
|
@@ -2036,6 +2136,7 @@ export type HighlightMatchItem = {
|
|
|
2036
2136
|
text: string;
|
|
2037
2137
|
isMatch: boolean;
|
|
2038
2138
|
};
|
|
2139
|
+
|
|
2039
2140
|
// File: src/types/translateTypes.d.ts
|
|
2040
2141
|
export type TranslateConfig = {
|
|
2041
2142
|
url?: string;
|
package/dist/library.js
CHANGED
|
@@ -1597,9 +1597,9 @@ var Ye = "d-response-loading", Xe = class {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
}, Ze = class {
|
|
1599
1599
|
constructor(e = "/api/", t = {}) {
|
|
1600
|
-
w(this, "url", void 0), w(this, "headers", void 0), w(this, "requestDefault", void 0), w(this, "status", void 0), w(this, "response", void 0), w(this, "preparation", void 0), w(this, "loading", void 0), w(this, "errorCenter", void 0), w(this, "hydration", void 0), w(this, "timeout", 16e3), w(this, "origin", void 0), this.url = e;
|
|
1601
|
-
let { headersClass: n = We, requestDefaultClass: r = Be, statusClass: i = Le, responseClass: a = Xe, preparationClass: o = qe, loadingClass: s = N.getItem(), errorCenterClass: c = T.getItem(), hydrationClass: l = Ke } = t;
|
|
1602
|
-
this.headers = new n(), this.requestDefault = new r(), this.status = new i(), this.response = new a(this.requestDefault), this.preparation = new o(), this.loading = s, this.errorCenter = c, this.hydration = new l(), this.hydration.initResponse(this.response);
|
|
1600
|
+
w(this, "url", void 0), w(this, "headers", void 0), w(this, "requestDefault", void 0), w(this, "status", void 0), w(this, "response", void 0), w(this, "preparation", void 0), w(this, "loading", void 0), w(this, "errorCenter", void 0), w(this, "hydration", void 0), w(this, "timeout", 16e3), w(this, "origin", void 0), w(this, "wrapper", void 0), this.url = e;
|
|
1601
|
+
let { headersClass: n = We, requestDefaultClass: r = Be, statusClass: i = Le, responseClass: a = Xe, preparationClass: o = qe, loadingClass: s = N.getItem(), errorCenterClass: c = T.getItem(), hydrationClass: l = Ke, wrapper: u } = t;
|
|
1602
|
+
this.headers = new n(), this.requestDefault = new r(), this.status = new i(), this.response = new a(this.requestDefault), this.preparation = new o(), this.loading = s, this.errorCenter = c, this.hydration = new l(), this.wrapper = u, this.hydration.initResponse(this.response);
|
|
1603
1603
|
}
|
|
1604
1604
|
isLocalhost() {
|
|
1605
1605
|
return s() && typeof location < "u" && location.hostname === "localhost";
|
|
@@ -1654,8 +1654,13 @@ var Ye = "d-response-loading", Xe = class {
|
|
|
1654
1654
|
setOrigin(e) {
|
|
1655
1655
|
return this.origin = e, this;
|
|
1656
1656
|
}
|
|
1657
|
+
setWrapper(e) {
|
|
1658
|
+
return this.wrapper = e, this;
|
|
1659
|
+
}
|
|
1657
1660
|
async request(e) {
|
|
1658
|
-
|
|
1661
|
+
var t;
|
|
1662
|
+
let n = d(e) ? { path: e } : e, r = (t = n.wrapper) == null ? this.wrapper : t;
|
|
1663
|
+
return r ? await r(() => this.fetch(n), n) : await this.fetch(n);
|
|
1659
1664
|
}
|
|
1660
1665
|
get(e) {
|
|
1661
1666
|
return this.request({
|
|
@@ -1862,8 +1867,11 @@ var Ye = "d-response-loading", Xe = class {
|
|
|
1862
1867
|
static setOrigin(e) {
|
|
1863
1868
|
this.getItem().setOrigin(e);
|
|
1864
1869
|
}
|
|
1870
|
+
static setWrapper(e) {
|
|
1871
|
+
this.getItem().setWrapper(e);
|
|
1872
|
+
}
|
|
1865
1873
|
static setConfig(e) {
|
|
1866
|
-
e && n(e) && (e.urlRoot && this.setUrl(e.urlRoot), e.headers && this.setHeaders(e.headers), e.requestDefault && this.setRequestDefault(e.requestDefault), e.preparation && this.setPreparation(e.preparation), e.end && this.setEnd(e.end), e.timeout && this.setTimeout(e.timeout), e.devMode && this.getResponse().setDevMode(e.devMode), e.origin && this.setOrigin(e.origin));
|
|
1874
|
+
e && n(e) && (e.urlRoot && this.setUrl(e.urlRoot), e.headers && this.setHeaders(e.headers), e.requestDefault && this.setRequestDefault(e.requestDefault), e.preparation && this.setPreparation(e.preparation), e.end && this.setEnd(e.end), e.timeout && this.setTimeout(e.timeout), e.devMode && this.getResponse().setDevMode(e.devMode), e.origin && this.setOrigin(e.origin), e.wrapper && this.setWrapper(e.wrapper));
|
|
1867
1875
|
}
|
|
1868
1876
|
static async request(e) {
|
|
1869
1877
|
return this.getItem().request(e);
|
|
@@ -142,6 +142,14 @@ export declare class Api {
|
|
|
142
142
|
* @returns void / ничего не возвращает
|
|
143
143
|
*/
|
|
144
144
|
static setOrigin(origin: string): void;
|
|
145
|
+
/**
|
|
146
|
+
* Sets the wrapper function for requests.
|
|
147
|
+
*
|
|
148
|
+
* Устанавливает функцию-обертку для запросов.
|
|
149
|
+
* @param wrapper wrapper function / функция-обертка
|
|
150
|
+
* @returns void / ничего не возвращает
|
|
151
|
+
*/
|
|
152
|
+
static setWrapper(wrapper: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>): void;
|
|
145
153
|
/**
|
|
146
154
|
* Sets multiple API configuration options at once.
|
|
147
155
|
*
|
|
@@ -26,6 +26,8 @@ export type ApiInstanceOptions = {
|
|
|
26
26
|
errorCenterClass?: ErrorCenterInstance;
|
|
27
27
|
/** Class for working with hydration / Класс для работы с гидратацией */
|
|
28
28
|
hydrationClass?: typeof ApiHydration;
|
|
29
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
30
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* Core class for managing HTTP requests using the Fetch API.
|
|
@@ -53,6 +55,8 @@ export declare class ApiInstance {
|
|
|
53
55
|
/** Timeout for the request in milliseconds / Таймаут запроса в миллисекундах */
|
|
54
56
|
protected timeout: number;
|
|
55
57
|
protected origin?: string;
|
|
58
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
59
|
+
protected wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
56
60
|
/**
|
|
57
61
|
* Constructor
|
|
58
62
|
* @param url base path to the script / базовый путь к скрипту
|
|
@@ -178,6 +182,13 @@ export declare class ApiInstance {
|
|
|
178
182
|
* @param origin protocol and domain / протокол и домен
|
|
179
183
|
*/
|
|
180
184
|
setOrigin(origin: string): this;
|
|
185
|
+
/**
|
|
186
|
+
* Sets the wrapper function for requests.
|
|
187
|
+
*
|
|
188
|
+
* Устанавливает функцию-обертку для запросов.
|
|
189
|
+
* @param wrapper wrapper function / функция-обертка
|
|
190
|
+
*/
|
|
191
|
+
setWrapper(wrapper: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>): this;
|
|
181
192
|
/**
|
|
182
193
|
* Executes a request with the given path or configuration.
|
|
183
194
|
*
|
|
@@ -65,6 +65,8 @@ export type ApiConfig = {
|
|
|
65
65
|
timeout?: number;
|
|
66
66
|
/** Enable development logging/ Включить логирование разработки */
|
|
67
67
|
devMode?: boolean;
|
|
68
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
69
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
68
70
|
};
|
|
69
71
|
/**
|
|
70
72
|
* Shape of API response data wrapper/ Структура обёртки данных ответа API
|
|
@@ -163,6 +165,8 @@ export type ApiFetch = {
|
|
|
163
165
|
cacheId?: number | string;
|
|
164
166
|
/** Limit of end reset/ Лимит сброса end */
|
|
165
167
|
endResetLimit?: number;
|
|
168
|
+
/** Wrapper function for requests / Функция-обертка для запросов */
|
|
169
|
+
wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
|
|
166
170
|
};
|
|
167
171
|
/**
|
|
168
172
|
* Type of API hydration item/ Тип элемента гидратации API
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/functional-basic",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Foundational utility library for modern web development — HTTP client, geolocation, i18n, SEO meta tags, caching, storage, DOM utilities, and more. Framework-agnostic, zero dependencies, TypeScript-first.",
|
|
7
7
|
"keywords": [
|