@dxtmisha/functional-basic 0.14.1 → 1.1.0
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/ai-types.txt +1656 -0
- package/dist/library.d.ts +2478 -818
- package/dist/library.js +1661 -850
- package/package.json +6 -4
package/ai-types.txt
ADDED
|
@@ -0,0 +1,1656 @@
|
|
|
1
|
+
1) All these methods are in the @dxtmisha/functional-basic library.
|
|
2
|
+
2) Everything that is exported can be used.
|
|
3
|
+
3) Use what is in this library if it exists; do not use other libraries if there is an analogue here. Do not create new ones if an analogue already exists here.
|
|
4
|
+
|
|
5
|
+
The following is the content of "exports" from package.json:
|
|
6
|
+
{
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/library.js",
|
|
9
|
+
"types": "./dist/library.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"./ai-types": "./ai-types.txt",
|
|
12
|
+
"./style": "./dist/style.css",
|
|
13
|
+
"./types/*": "./dist/*",
|
|
14
|
+
"./types/**/*.d.ts": "./dist/**/*.d.ts"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// File: library.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* Add highlighting tag to matches in a string.
|
|
20
|
+
* @param value initial string
|
|
21
|
+
* @param search search string or RegExp
|
|
22
|
+
* @param className CSS class
|
|
23
|
+
* @param shouldEscape escape value
|
|
24
|
+
* @returns string with highlighting
|
|
25
|
+
*/
|
|
26
|
+
export declare function addTagHighlightMatch(value: string, search?: string | RegExp, className?: string, shouldEscape?: boolean): string;
|
|
27
|
+
/**
|
|
28
|
+
* Convert value to string.
|
|
29
|
+
* @param value value to convert
|
|
30
|
+
* @param isArrayString convert arrays to strings
|
|
31
|
+
* @param trim trim result
|
|
32
|
+
* @returns string representation
|
|
33
|
+
*/
|
|
34
|
+
export declare function anyToString<V>(value: V, isArrayString?: boolean, trim?: boolean): string;
|
|
35
|
+
/**
|
|
36
|
+
* Helper for HTTP requests.
|
|
37
|
+
*/
|
|
38
|
+
export declare class Api {
|
|
39
|
+
/** Check if server is localhost. */
|
|
40
|
+
static isLocalhost(): boolean;
|
|
41
|
+
/** Get ApiInstance singleton. */
|
|
42
|
+
static getItem(): ApiInstance;
|
|
43
|
+
/** Get status of last request. */
|
|
44
|
+
static getStatus(): ApiStatus;
|
|
45
|
+
/** Get response handler. */
|
|
46
|
+
static getResponse(): ApiResponse;
|
|
47
|
+
/** Get hydration handler. */
|
|
48
|
+
static getHydration(): ApiHydration;
|
|
49
|
+
/** Get hydration script for client. */
|
|
50
|
+
static getHydrationScript(): string;
|
|
51
|
+
/** Get full URL for path. */
|
|
52
|
+
static getUrl(path: string, api?: boolean): string;
|
|
53
|
+
/** Get request body data. */
|
|
54
|
+
static getBody(request?: ApiFetch['request'], method?: ApiMethodItem): string | FormData | undefined;
|
|
55
|
+
/** Get query string for GET requests. */
|
|
56
|
+
static getBodyForGet(request: ApiFetch['request'], path?: string, method?: ApiMethodItem): string;
|
|
57
|
+
/** Set default headers. */
|
|
58
|
+
static setHeaders(headers: Record<string, string>): void;
|
|
59
|
+
/** Set default request data. */
|
|
60
|
+
static setRequestDefault(request: Record<string, any>): void;
|
|
61
|
+
/** Set base URL. */
|
|
62
|
+
static setUrl(url: string): void;
|
|
63
|
+
/** Set pre-request callback. */
|
|
64
|
+
static setPreparation(callback: (apiFetch: ApiFetch) => Promise<void>): void;
|
|
65
|
+
/** Set post-request callback. */
|
|
66
|
+
static setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): void;
|
|
67
|
+
/** Set request timeout (ms). */
|
|
68
|
+
static setTimeout(timeout: number): void;
|
|
69
|
+
/** Set API configuration. */
|
|
70
|
+
static setConfig(config?: ApiConfig): void;
|
|
71
|
+
/** Execute request. */
|
|
72
|
+
static request<T>(pathRequest: string | ApiFetch): Promise<T>;
|
|
73
|
+
/** GET request. */
|
|
74
|
+
static get<T>(request: ApiFetch): Promise<T>;
|
|
75
|
+
/** POST request. */
|
|
76
|
+
static post<T>(request: ApiFetch): Promise<T>;
|
|
77
|
+
/** PUT request. */
|
|
78
|
+
static put<T>(request: ApiFetch): Promise<T>;
|
|
79
|
+
/** PATCH request. */
|
|
80
|
+
static patch<T>(request: ApiFetch): Promise<T>;
|
|
81
|
+
/** DELETE request. */
|
|
82
|
+
static delete<T>(request: ApiFetch): Promise<T>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* API response caching.
|
|
86
|
+
*/
|
|
87
|
+
export declare class ApiCache {
|
|
88
|
+
/** Initialize storage listeners. */
|
|
89
|
+
static init(getListener: (key: string) => Promise<ApiCacheItem | undefined>, setListener: (key: string, value: ApiCacheItem) => Promise<boolean>, removeListener: (key: string) => Promise<boolean>, cacheStepAgeClearOld?: number): void;
|
|
90
|
+
/** Reset cache and listeners. */
|
|
91
|
+
static reset(): void;
|
|
92
|
+
/** Get cached data. */
|
|
93
|
+
static get<T>(key: string): Promise<T | undefined>;
|
|
94
|
+
/** Get cached data by fetch options. */
|
|
95
|
+
static getByFetch<T>(fetch: ApiFetch): Promise<T | undefined>;
|
|
96
|
+
/** Save data to cache. */
|
|
97
|
+
static set<T>(key: string, value: T, age?: number): Promise<void>;
|
|
98
|
+
/** Save data to cache by fetch options. */
|
|
99
|
+
static setByFetch<T>(fetch: ApiFetch, value: T): Promise<void>;
|
|
100
|
+
/** Remove data from cache. */
|
|
101
|
+
static remove(key: string): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
export declare type ApiCacheItem<T = any> = {
|
|
104
|
+
value: T;
|
|
105
|
+
age?: number;
|
|
106
|
+
cacheAge: number;
|
|
107
|
+
};
|
|
108
|
+
export declare type ApiCacheList = Record<string, ApiCacheItem>;
|
|
109
|
+
export declare type ApiConfig = {
|
|
110
|
+
urlRoot?: string;
|
|
111
|
+
headers?: Record<string, string>;
|
|
112
|
+
requestDefault?: Record<string, any>;
|
|
113
|
+
preparation?: (apiFetch: ApiFetch) => Promise<void>;
|
|
114
|
+
end?: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>;
|
|
115
|
+
timeout?: number;
|
|
116
|
+
};
|
|
117
|
+
export declare type ApiData<T = any> = T extends any[] ? T : ApiDataItem<T>;
|
|
118
|
+
export declare type ApiDataItem<T = any> = T & ApiDataValidation & {
|
|
119
|
+
data?: T;
|
|
120
|
+
success?: boolean;
|
|
121
|
+
statusObject?: ApiStatusItem;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Processes API response data.
|
|
125
|
+
*/
|
|
126
|
+
export declare class ApiDataReturn<T = any> {
|
|
127
|
+
constructor(apiFetch: ApiFetch, query: Response, end: ApiPreparationEnd);
|
|
128
|
+
/** Read data from response. */
|
|
129
|
+
init(): Promise<this>;
|
|
130
|
+
/** Get processed data. */
|
|
131
|
+
get(): ApiData<T>;
|
|
132
|
+
/** Get data with status. */
|
|
133
|
+
getAndStatus(status: ApiStatus): ApiData<T>;
|
|
134
|
+
/** Get raw response data. */
|
|
135
|
+
getData(): ApiData<T> | undefined;
|
|
136
|
+
}
|
|
137
|
+
export declare type ApiDataValidation = {
|
|
138
|
+
status?: ApiStatusType;
|
|
139
|
+
code?: string | number;
|
|
140
|
+
message?: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Default request data management.
|
|
144
|
+
*/
|
|
145
|
+
export declare class ApiDefault {
|
|
146
|
+
/** Check if default data exists. */
|
|
147
|
+
is(): boolean;
|
|
148
|
+
/** Get default data. */
|
|
149
|
+
get(): ApiDefaultValue | undefined;
|
|
150
|
+
/** Merge default data with request. */
|
|
151
|
+
request(request: ApiFetch['request']): ApiFetch['request'];
|
|
152
|
+
/** Set default data. */
|
|
153
|
+
set(request: ApiDefaultValue): this;
|
|
154
|
+
}
|
|
155
|
+
export declare type ApiDefaultValue = Record<string, any>;
|
|
156
|
+
export declare type ApiFetch = {
|
|
157
|
+
api?: boolean;
|
|
158
|
+
path?: string;
|
|
159
|
+
pathFull?: string;
|
|
160
|
+
method?: ApiMethod;
|
|
161
|
+
request?: FormData | Record<string, any> | string;
|
|
162
|
+
auth?: boolean;
|
|
163
|
+
headers?: Record<string, string> | null;
|
|
164
|
+
type?: string;
|
|
165
|
+
toData?: boolean;
|
|
166
|
+
global?: boolean;
|
|
167
|
+
devMode?: boolean;
|
|
168
|
+
hideError?: boolean;
|
|
169
|
+
hideLoading?: boolean;
|
|
170
|
+
retry?: number;
|
|
171
|
+
retryDelay?: number;
|
|
172
|
+
queryReturn?: (query: Response) => Promise<any | ApiDataValidation>;
|
|
173
|
+
globalPreparation?: boolean;
|
|
174
|
+
globalEnd?: boolean;
|
|
175
|
+
init?: RequestInit;
|
|
176
|
+
timeout?: number;
|
|
177
|
+
controller?: AbortController;
|
|
178
|
+
cache?: number;
|
|
179
|
+
enableClientCache?: boolean;
|
|
180
|
+
cacheId?: number | string;
|
|
181
|
+
endResetLimit?: number;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Request headers management.
|
|
185
|
+
*/
|
|
186
|
+
export declare class ApiHeaders {
|
|
187
|
+
/** Get merged headers. */
|
|
188
|
+
get(value?: Record<string, string> | null, type?: string | undefined | null): Record<string, string> | undefined;
|
|
189
|
+
/** Get headers based on request type. */
|
|
190
|
+
getByRequest(request: ApiFetch['request'], value?: Record<string, string> | null, type?: string): Record<string, string> | undefined;
|
|
191
|
+
/** Set default headers. */
|
|
192
|
+
set(headers: Record<string, string>): this;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Data hydration for SSR.
|
|
196
|
+
*/
|
|
197
|
+
export declare class ApiHydration {
|
|
198
|
+
/** Init response with hydration. */
|
|
199
|
+
initResponse(response: ApiResponse): void;
|
|
200
|
+
/** Save response for client. */
|
|
201
|
+
toClient<T>(apiFetch: ApiFetch, response: T): void;
|
|
202
|
+
/** String representation for client. */
|
|
203
|
+
toString(): string;
|
|
204
|
+
}
|
|
205
|
+
export declare type ApiHydrationItem = {
|
|
206
|
+
path: string;
|
|
207
|
+
method: ApiMethod;
|
|
208
|
+
request?: ApiFetch['request'];
|
|
209
|
+
response: any;
|
|
210
|
+
};
|
|
211
|
+
export declare type ApiHydrationList = ApiHydrationItem[];
|
|
212
|
+
/**
|
|
213
|
+
* Core Fetch API manager.
|
|
214
|
+
*/
|
|
215
|
+
export declare class ApiInstance {
|
|
216
|
+
constructor(url?: string, options?: ApiInstanceOptions);
|
|
217
|
+
/** Check if localhost. */
|
|
218
|
+
isLocalhost(): boolean;
|
|
219
|
+
/** Get request status. */
|
|
220
|
+
getStatus(): ApiStatus;
|
|
221
|
+
/** Get response handler. */
|
|
222
|
+
getResponse(): ApiResponse;
|
|
223
|
+
/** Get hydration handler. */
|
|
224
|
+
getHydration(): ApiHydration;
|
|
225
|
+
/** Get full script URL. */
|
|
226
|
+
getUrl(path: string, api?: boolean): string;
|
|
227
|
+
/** Get body data. */
|
|
228
|
+
getBody(request?: ApiFetch['request'], method?: ApiMethodItem): string | FormData | undefined;
|
|
229
|
+
/** Get GET query string. */
|
|
230
|
+
getBodyForGet(request: ApiFetch['request'], path?: string, method?: ApiMethodItem): string;
|
|
231
|
+
/** Get hydration script. */
|
|
232
|
+
getHydrationScript(): string;
|
|
233
|
+
/** Set default headers. */
|
|
234
|
+
setHeaders(headers: Record<string, string>): this;
|
|
235
|
+
/** Set default request data. */
|
|
236
|
+
setRequestDefault(request: Record<string, any>): this;
|
|
237
|
+
/** Set base URL. */
|
|
238
|
+
setUrl(url: string): this;
|
|
239
|
+
/** Set preparation callback. */
|
|
240
|
+
setPreparation(callback: (apiFetch: ApiFetch) => Promise<void>): this;
|
|
241
|
+
/** Set end callback. */
|
|
242
|
+
setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
|
|
243
|
+
/** Set timeout (ms). */
|
|
244
|
+
setTimeout(timeout: number): this;
|
|
245
|
+
/** Execute request. */
|
|
246
|
+
request<T>(pathRequest: string | ApiFetch): Promise<T>;
|
|
247
|
+
/** GET method. */
|
|
248
|
+
get<T>(request: ApiFetch): Promise<T>;
|
|
249
|
+
/** POST method. */
|
|
250
|
+
post<T>(request: ApiFetch): Promise<T>;
|
|
251
|
+
/** PUT method. */
|
|
252
|
+
put<T>(request: ApiFetch): Promise<T>;
|
|
253
|
+
/** PATCH method. */
|
|
254
|
+
patch<T>(request: ApiFetch): Promise<T>;
|
|
255
|
+
/** DELETE method. */
|
|
256
|
+
delete<T>(request: ApiFetch): Promise<T>;
|
|
257
|
+
}
|
|
258
|
+
export declare type ApiInstanceOptions = {
|
|
259
|
+
headersClass?: typeof ApiHeaders;
|
|
260
|
+
requestDefaultClass?: typeof ApiDefault;
|
|
261
|
+
statusClass?: typeof ApiStatus;
|
|
262
|
+
responseClass?: typeof ApiResponse;
|
|
263
|
+
preparationClass?: typeof ApiPreparation;
|
|
264
|
+
loadingClass?: LoadingInstance;
|
|
265
|
+
errorCenterClass?: ErrorCenterInstance;
|
|
266
|
+
hydrationClass?: typeof ApiHydration;
|
|
267
|
+
};
|
|
268
|
+
export declare type ApiMethod = string & ApiMethodItem;
|
|
269
|
+
export declare enum ApiMethodItem {
|
|
270
|
+
delete = "DELETE",
|
|
271
|
+
get = "GET",
|
|
272
|
+
post = "POST",
|
|
273
|
+
put = "PUT",
|
|
274
|
+
patch = "PATCH"
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Request preparation hooks.
|
|
278
|
+
*/
|
|
279
|
+
export declare class ApiPreparation {
|
|
280
|
+
/** Execute pre-request preparation. */
|
|
281
|
+
make(active: boolean, apiFetch: ApiFetch): Promise<void>;
|
|
282
|
+
/** Process request after execution. */
|
|
283
|
+
makeEnd(active: boolean, query: Response, apiFetch: ApiFetch): Promise<ApiPreparationEnd>;
|
|
284
|
+
/** Set pre-request hook. */
|
|
285
|
+
set(callback: (apiFetch: ApiFetch) => Promise<void>): this;
|
|
286
|
+
/** Set post-request hook. */
|
|
287
|
+
setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
|
|
288
|
+
}
|
|
289
|
+
export declare type ApiPreparationEnd = {
|
|
290
|
+
reset?: boolean;
|
|
291
|
+
data?: any;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* API response management and emulation.
|
|
295
|
+
*/
|
|
296
|
+
export declare class ApiResponse {
|
|
297
|
+
constructor(requestDefault: ApiDefault);
|
|
298
|
+
/** Get cached request. */
|
|
299
|
+
get(path: string | undefined, method: ApiMethod, request?: ApiFetch['request'], devMode?: boolean): ApiResponseItem | undefined;
|
|
300
|
+
/** Get list of cached responses. */
|
|
301
|
+
getList(): (ApiResponseItem & Record<string, any>)[];
|
|
302
|
+
/** Add response for caching. */
|
|
303
|
+
add(response: ApiResponseItem | ApiResponseItem[]): this;
|
|
304
|
+
/** Set developer mode. */
|
|
305
|
+
setDevMode(devMode: boolean): this;
|
|
306
|
+
/** Run response emulator. */
|
|
307
|
+
emulator<T>(apiFetch: ApiFetch): Promise<T | undefined>;
|
|
308
|
+
}
|
|
309
|
+
export declare type ApiResponseItem = {
|
|
310
|
+
path: string | RegExp;
|
|
311
|
+
method: ApiMethod;
|
|
312
|
+
request?: ApiFetch['request'] | '*any';
|
|
313
|
+
response: any | ((request?: ApiFetch['request']) => any);
|
|
314
|
+
disable?: any;
|
|
315
|
+
isForGlobal?: boolean;
|
|
316
|
+
lag?: any;
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* API request status tracking.
|
|
320
|
+
*/
|
|
321
|
+
export declare class ApiStatus {
|
|
322
|
+
/** Get status data. */
|
|
323
|
+
get(): ApiStatusItem | undefined;
|
|
324
|
+
/** Get HTTP status code. */
|
|
325
|
+
getStatus(): number | undefined;
|
|
326
|
+
/** Get status text. */
|
|
327
|
+
getStatusText(): string | undefined;
|
|
328
|
+
/** Get status type. */
|
|
329
|
+
getStatusType(): ApiStatusType | undefined;
|
|
330
|
+
/** Get response code. */
|
|
331
|
+
getCode(): string | undefined;
|
|
332
|
+
/** Get error message. */
|
|
333
|
+
getError(): string | undefined;
|
|
334
|
+
/** Get last response data. */
|
|
335
|
+
getResponse<T>(): T | undefined;
|
|
336
|
+
/** Get status message. */
|
|
337
|
+
getMessage(): string;
|
|
338
|
+
/** Set status data. */
|
|
339
|
+
set(data: ApiStatusItem): this;
|
|
340
|
+
/** Set status code/text. */
|
|
341
|
+
setStatus(status?: number, statusText?: string): this;
|
|
342
|
+
/** Set error message. */
|
|
343
|
+
setError(error?: string): this;
|
|
344
|
+
/** Set response data and extract status. */
|
|
345
|
+
setLastResponse(response?: any): this;
|
|
346
|
+
/** Set status type. */
|
|
347
|
+
setLastStatus(status?: ApiStatusType): this;
|
|
348
|
+
/** Set status code. */
|
|
349
|
+
setLastCode(code?: string): this;
|
|
350
|
+
/** Set status message. */
|
|
351
|
+
setLastMessage(message?: string): this;
|
|
352
|
+
}
|
|
353
|
+
export declare type ApiStatusItem = {
|
|
354
|
+
status?: number;
|
|
355
|
+
statusText?: string;
|
|
356
|
+
error?: string;
|
|
357
|
+
lastResponse?: any;
|
|
358
|
+
lastStatus?: ApiStatusType;
|
|
359
|
+
lastCode?: string;
|
|
360
|
+
lastMessage?: string;
|
|
361
|
+
};
|
|
362
|
+
export declare type ApiStatusType = 'success' | 'error' | 'warning' | 'info';
|
|
363
|
+
/** Replace keys in text with template values. */
|
|
364
|
+
export declare const applyTemplate: (text: string, replacement?: Record<string, string | number | boolean> | string[]) => string;
|
|
365
|
+
export declare type ArrayToItem<T> = T extends any[] ? T[number] : T;
|
|
366
|
+
/** Fill array with value. */
|
|
367
|
+
export declare function arrFill<T>(value: T, count: number): T[];
|
|
368
|
+
/** Convert Blob to Base64. */
|
|
369
|
+
export declare function blobToBase64(blob: Blob, clean?: boolean): Promise<string | undefined>;
|
|
370
|
+
/**
|
|
371
|
+
* BroadcastChannel message wrapper.
|
|
372
|
+
*/
|
|
373
|
+
export declare class BroadcastMessage<Message = any> {
|
|
374
|
+
constructor(name: string, callback?: ((event: MessageEvent<Message>) => void) | undefined, callbackError?: ((event: MessageEvent<Message>) => void) | undefined, errorCenter?: ErrorCenterInstance);
|
|
375
|
+
/** Get BroadcastChannel instance. */
|
|
376
|
+
getChannel(): BroadcastChannel | undefined;
|
|
377
|
+
/** Send message. */
|
|
378
|
+
post(message: Message): this;
|
|
379
|
+
/** Set message callback. */
|
|
380
|
+
setCallback(callback: (event: MessageEvent<Message>) => void): this;
|
|
381
|
+
/** Set error callback. */
|
|
382
|
+
setCallbackError(callbackError: (event: MessageEvent<Message>) => void): this;
|
|
383
|
+
/** Close channel. */
|
|
384
|
+
destroy(): this;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* In-memory value caching.
|
|
388
|
+
* @deprecated Use modern caching solutions.
|
|
389
|
+
*/
|
|
390
|
+
declare class Cache_2 {
|
|
391
|
+
/** Get or compute cached value. */
|
|
392
|
+
get<T>(name: string, callback: () => T, comparison?: any[]): T;
|
|
393
|
+
/** Get or compute cached value asynchronously. */
|
|
394
|
+
getAsync<T>(name: string, callback: () => T, comparison?: any[]): Promise<T>;
|
|
395
|
+
}
|
|
396
|
+
export { Cache_2 as Cache }
|
|
397
|
+
/**
|
|
398
|
+
* Cached value with dependency tracking.
|
|
399
|
+
* @deprecated Use modern caching solutions.
|
|
400
|
+
*/
|
|
401
|
+
export declare class CacheItem<T> {
|
|
402
|
+
constructor(callback: () => T);
|
|
403
|
+
/** Get cached value; recomputes if comparison changes. */
|
|
404
|
+
getCache(comparison: any[]): T;
|
|
405
|
+
/** Get previous cached value. */
|
|
406
|
+
getCacheOld(): T | undefined;
|
|
407
|
+
/** Get cached value asynchronously. */
|
|
408
|
+
getCacheAsync(comparison: any[]): Promise<T>;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Static persistent cache using ServerStorage.
|
|
412
|
+
* @deprecated Use modern caching solutions.
|
|
413
|
+
*/
|
|
414
|
+
export declare class CacheStatic {
|
|
415
|
+
/** Get cached value. */
|
|
416
|
+
static get<T>(name: string, callback: () => T, comparison?: any[]): T;
|
|
417
|
+
/** Get cached value asynchronously. */
|
|
418
|
+
static getAsync<T>(name: string, callback: () => T, comparison?: any[]): Promise<T>;
|
|
419
|
+
}
|
|
420
|
+
/** Capitalize string. */
|
|
421
|
+
export declare function capitalize(value: string, isLocale?: boolean): string;
|
|
422
|
+
/**
|
|
423
|
+
* Cookie management.
|
|
424
|
+
*/
|
|
425
|
+
export declare class Cookie<T> {
|
|
426
|
+
static getInstance<T>(name: string): Cookie<unknown>;
|
|
427
|
+
constructor(name: string);
|
|
428
|
+
/** Get cookie value. */
|
|
429
|
+
get(defaultValue?: T | string | (() => (T | string)), options?: CookieOptions): string | T | undefined;
|
|
430
|
+
/** Set cookie value. */
|
|
431
|
+
set(value?: T | string | (() => (T | string)), options?: CookieOptions): void;
|
|
432
|
+
/** Remove cookie. */
|
|
433
|
+
remove(): void;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Global cookie access toggle.
|
|
437
|
+
*/
|
|
438
|
+
export declare class CookieBlock {
|
|
439
|
+
static getItem(): CookieBlockInstance;
|
|
440
|
+
static get(): boolean;
|
|
441
|
+
static set(value: boolean): void;
|
|
442
|
+
}
|
|
443
|
+
export declare class CookieBlockInstance {
|
|
444
|
+
get(): boolean;
|
|
445
|
+
set(value: boolean): void;
|
|
446
|
+
}
|
|
447
|
+
export declare type CookieOptions = {
|
|
448
|
+
age?: number;
|
|
449
|
+
sameSite?: CookieSameSite_2;
|
|
450
|
+
arguments?: string[] | Record<string, string | number | boolean>;
|
|
451
|
+
};
|
|
452
|
+
declare type CookieSameSite_2 = 'strict' | 'lax';
|
|
453
|
+
export { CookieSameSite_2 as CookieSameSite }
|
|
454
|
+
/**
|
|
455
|
+
* Shared cookie storage with SSR support.
|
|
456
|
+
*/
|
|
457
|
+
export declare class CookieStorage {
|
|
458
|
+
static init(getListener: (key: string) => any | undefined, setListener: (key: string, value: any, options?: CookieOptions) => void): void;
|
|
459
|
+
static reset(): void;
|
|
460
|
+
/** Get data from storage. */
|
|
461
|
+
static get<T>(name: string, defaultValue?: T | (() => T)): T | undefined;
|
|
462
|
+
/** Save data to storage. */
|
|
463
|
+
static set<T>(name: string, value: T | (() => T), options?: CookieOptions): T;
|
|
464
|
+
/** Remove data from storage. */
|
|
465
|
+
static remove(name: string): void;
|
|
466
|
+
/** Update from cookies. */
|
|
467
|
+
static update(): void;
|
|
468
|
+
}
|
|
469
|
+
/** Deep copy object. */
|
|
470
|
+
export declare function copyObject<T>(value: T): T;
|
|
471
|
+
/** Copy simple object. */
|
|
472
|
+
export declare function copyObjectLite<T, R = T>(value: T, source?: any): R;
|
|
473
|
+
/** Create DOM element. Client-only. */
|
|
474
|
+
export declare function createElement<T extends HTMLElement>(parentElement?: HTMLElement, tagName?: string, options?: Partial<T> | Record<keyof T, T[keyof T]> | ((element: T) => void), referenceElement?: HTMLElement): T | undefined;
|
|
475
|
+
/**
|
|
476
|
+
* Storage wrapper for local/session storage with SSR isolation.
|
|
477
|
+
*/
|
|
478
|
+
export declare class DataStorage<T> {
|
|
479
|
+
static setPrefix(newPrefix: string): void;
|
|
480
|
+
constructor(name: string, isSession?: boolean, errorCenter?: ErrorCenterInstance);
|
|
481
|
+
/** Get data. */
|
|
482
|
+
get(defaultValue?: T | (() => T), cache?: number): T | undefined;
|
|
483
|
+
/** Set data. */
|
|
484
|
+
set(value?: T | (() => T)): T | undefined;
|
|
485
|
+
/** Remove data. */
|
|
486
|
+
remove(): this;
|
|
487
|
+
/** Sync from storage. */
|
|
488
|
+
update(): this;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Language-sensitive date and time management.
|
|
492
|
+
* @remarks Creating instance without specific date in SSR may cause hydration mismatches.
|
|
493
|
+
*/
|
|
494
|
+
export declare class Datetime {
|
|
495
|
+
constructor(date?: NumberOrStringOrDate, type?: GeoDate, code?: string);
|
|
496
|
+
getIntl(): GeoIntl;
|
|
497
|
+
getDate(): Date;
|
|
498
|
+
getType(): GeoDate;
|
|
499
|
+
getHoursType(): GeoHours;
|
|
500
|
+
getHour24(): boolean;
|
|
501
|
+
getTimeZoneOffset(): number;
|
|
502
|
+
getTimeZone(style?: GeoTimeZoneStyle): string;
|
|
503
|
+
getFirstDayCode(): GeoFirstDay;
|
|
504
|
+
getYear(): number;
|
|
505
|
+
getMonth(): number;
|
|
506
|
+
getDay(): number;
|
|
507
|
+
getHour(): number;
|
|
508
|
+
getMinute(): number;
|
|
509
|
+
getSecond(): number;
|
|
510
|
+
getMaxDay(): number;
|
|
511
|
+
locale(type?: GeoDate, styleOptions?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions): string;
|
|
512
|
+
localeYear(style?: Intl.DateTimeFormatOptions['year']): string;
|
|
513
|
+
localeMonth(style?: Intl.DateTimeFormatOptions['month']): string;
|
|
514
|
+
localeDay(style?: Intl.DateTimeFormatOptions['day']): string;
|
|
515
|
+
localeHour(style?: Intl.DateTimeFormatOptions['hour']): string;
|
|
516
|
+
localeMinute(style?: Intl.DateTimeFormatOptions['minute']): string;
|
|
517
|
+
localeSecond(style?: Intl.DateTimeFormatOptions['second']): string;
|
|
518
|
+
standard(timeZone?: boolean): string;
|
|
519
|
+
setDate(value: NumberOrStringOrDate): this;
|
|
520
|
+
setType(value: GeoDate): this;
|
|
521
|
+
setHour24(value: boolean): this;
|
|
522
|
+
setCode(code: string): this;
|
|
523
|
+
setWatch(watch: (date: Date, type: GeoDate, hour24: boolean) => void): this;
|
|
524
|
+
setYear(value: number): this;
|
|
525
|
+
setMonth(value: number): this;
|
|
526
|
+
setDay(value: number): this;
|
|
527
|
+
setHour(value: number): this;
|
|
528
|
+
setMinute(value: number): this;
|
|
529
|
+
setSecond(value: number): this;
|
|
530
|
+
moveByYear(value: number): this;
|
|
531
|
+
moveByMonth(value: number): this;
|
|
532
|
+
moveByDay(value: number): this;
|
|
533
|
+
moveByHour(value: number): this;
|
|
534
|
+
moveByMinute(value: number): this;
|
|
535
|
+
moveBySecond(value: number): this;
|
|
536
|
+
moveMonthFirst(): this;
|
|
537
|
+
moveMonthLast(): this;
|
|
538
|
+
moveMonthNext(): this;
|
|
539
|
+
moveMonthPrevious(): this;
|
|
540
|
+
moveWeekdayFirst(): this;
|
|
541
|
+
moveWeekdayLast(): this;
|
|
542
|
+
moveWeekdayFirstByMonth(): this;
|
|
543
|
+
moveWeekdayLastByMonth(): this;
|
|
544
|
+
moveWeekdayNext(): this;
|
|
545
|
+
moveWeekdayPrevious(): this;
|
|
546
|
+
moveDayFirst(): this;
|
|
547
|
+
moveDayLast(): this;
|
|
548
|
+
moveDayNext(): this;
|
|
549
|
+
moveDayPrevious(): this;
|
|
550
|
+
clone(): Date;
|
|
551
|
+
cloneClass(): Datetime;
|
|
552
|
+
cloneMonthFirst(): Datetime;
|
|
553
|
+
cloneMonthLast(): Datetime;
|
|
554
|
+
cloneMonthNext(): Datetime;
|
|
555
|
+
cloneMonthPrevious(): Datetime;
|
|
556
|
+
cloneWeekdayFirst(): Datetime;
|
|
557
|
+
cloneWeekdayLast(): Datetime;
|
|
558
|
+
cloneWeekdayFirstByMonth(): Datetime;
|
|
559
|
+
cloneWeekdayLastByMonth(): Datetime;
|
|
560
|
+
cloneWeekdayNext(): Datetime;
|
|
561
|
+
cloneWeekdayPrevious(): Datetime;
|
|
562
|
+
cloneDayFirst(): Datetime;
|
|
563
|
+
cloneDayLast(): Datetime;
|
|
564
|
+
cloneDayNext(): Datetime;
|
|
565
|
+
cloneDayPrevious(): Datetime;
|
|
566
|
+
}
|
|
567
|
+
/** DOM query selector helper. */
|
|
568
|
+
export declare function domQuerySelector<E extends Element = Element>(selectors: string): E | undefined;
|
|
569
|
+
/** DOM query selector all helper. */
|
|
570
|
+
export declare function domQuerySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E> | undefined;
|
|
571
|
+
export declare type ElementOrString<E extends ElementOrWindow> = E | string;
|
|
572
|
+
export declare type ElementOrWindow = HTMLElement | Window;
|
|
573
|
+
export declare type EmptyValue = Undefined | 0 | false | '' | 'undefined' | 'null' | '0' | 'false' | '[]';
|
|
574
|
+
/** Encode text for HTML attributes. */
|
|
575
|
+
export declare function encodeAttribute(text: string): string;
|
|
576
|
+
/** Lite encode text for HTML attributes. */
|
|
577
|
+
export declare function encodeLiteAttribute(text: string): string;
|
|
578
|
+
/** Resize image to ensure max size. */
|
|
579
|
+
export declare function ensureMaxSize(file: Uint8Array, compress?: number, type?: string): Promise<string>;
|
|
580
|
+
/**
|
|
581
|
+
* Global error management.
|
|
582
|
+
*/
|
|
583
|
+
export declare class ErrorCenter {
|
|
584
|
+
static getItem(): ErrorCenterInstance;
|
|
585
|
+
static has(code: string, group?: string): boolean;
|
|
586
|
+
static get(code: string, group?: string): ErrorCenterCauseItem | undefined;
|
|
587
|
+
static add(cause: ErrorCenterCauseItem): void;
|
|
588
|
+
static addList(causes: ErrorCenterCauseList): void;
|
|
589
|
+
static addHandler(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): void;
|
|
590
|
+
static addHandlerList(handlers: ErrorCenterHandlerList): void;
|
|
591
|
+
static on(cause: ErrorCenterCauseItem): void;
|
|
592
|
+
}
|
|
593
|
+
export declare type ErrorCenterCauseItem = {
|
|
594
|
+
group?: ErrorCenterGroup;
|
|
595
|
+
code: string;
|
|
596
|
+
priority?: number;
|
|
597
|
+
label?: string;
|
|
598
|
+
message?: string;
|
|
599
|
+
details?: any;
|
|
600
|
+
};
|
|
601
|
+
export declare type ErrorCenterCauseList = ErrorCenterCauseItem[];
|
|
602
|
+
export declare type ErrorCenterGroup = string | undefined;
|
|
603
|
+
/**
|
|
604
|
+
* Error handler registry.
|
|
605
|
+
*/
|
|
606
|
+
export declare class ErrorCenterHandler {
|
|
607
|
+
constructor(handlers?: ErrorCenterHandlerList);
|
|
608
|
+
has(group: ErrorCenterGroup): boolean;
|
|
609
|
+
get(group: ErrorCenterGroup): ErrorCenterHandlerItem | undefined;
|
|
610
|
+
add(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): this;
|
|
611
|
+
addList(handlers: ErrorCenterHandlerList): this;
|
|
612
|
+
on(cause: ErrorCenterCauseItem): this;
|
|
613
|
+
}
|
|
614
|
+
export declare type ErrorCenterHandlerCallback = (cause: ErrorCenterCauseItem) => void;
|
|
615
|
+
export declare type ErrorCenterHandlerItem = {
|
|
616
|
+
group?: ErrorCenterGroup;
|
|
617
|
+
handlers: ErrorCenterHandlerCallback[];
|
|
618
|
+
};
|
|
619
|
+
export declare type ErrorCenterHandlerList = ErrorCenterHandlerItem[];
|
|
620
|
+
/**
|
|
621
|
+
* Instance-specific error center.
|
|
622
|
+
*/
|
|
623
|
+
export declare class ErrorCenterInstance {
|
|
624
|
+
constructor(causes?: ErrorCenterCauseList, handler?: ErrorCenterHandler);
|
|
625
|
+
has(code: string, group?: string): boolean;
|
|
626
|
+
get(code: string, group?: string): ErrorCenterCauseItem | undefined;
|
|
627
|
+
add(cause: ErrorCenterCauseItem): this;
|
|
628
|
+
addList(causes: ErrorCenterCauseList): this;
|
|
629
|
+
addHandler(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): this;
|
|
630
|
+
addHandlerList(handlers: ErrorCenterHandlerList): this;
|
|
631
|
+
on(cause: ErrorCenterCauseItem): this;
|
|
632
|
+
}
|
|
633
|
+
/** Escape regex special characters. */
|
|
634
|
+
export declare function escapeExp(value: string): string;
|
|
635
|
+
export declare type EventActivityItem<E extends ElementOrWindow> = {
|
|
636
|
+
element: E | undefined;
|
|
637
|
+
type: string;
|
|
638
|
+
listener?: (event: any | Event) => void;
|
|
639
|
+
observer?: ResizeObserver;
|
|
640
|
+
};
|
|
641
|
+
/**
|
|
642
|
+
* Advanced event listener wrapper with DOM safety and optimizations.
|
|
643
|
+
*/
|
|
644
|
+
export declare class EventItem<E extends ElementOrWindow, O extends Event, D extends Record<string, any> = Record<string, any>> {
|
|
645
|
+
constructor(elementSelector?: ElementOrString<E>, type?: string | string[], listener?: EventListenerDetail<O, D> | undefined, options?: EventOptions, detail?: D | undefined);
|
|
646
|
+
isActive(): boolean;
|
|
647
|
+
getElement(): E | undefined;
|
|
648
|
+
setElement(elementSelector?: ElementOrString<E>): this;
|
|
649
|
+
setElementControl<EC extends HTMLElement>(elementSelector?: ElementOrString<EC>): this;
|
|
650
|
+
setType(type: string | string[]): this;
|
|
651
|
+
setListener(listener: EventListenerDetail<O, D>): this;
|
|
652
|
+
setOptions(options?: EventOptions): this;
|
|
653
|
+
setDetail(detail?: D): this;
|
|
654
|
+
dispatch(detail?: D | undefined): this;
|
|
655
|
+
start(): this;
|
|
656
|
+
stop(): this;
|
|
657
|
+
toggle(activity: boolean): this;
|
|
658
|
+
reset(): this;
|
|
659
|
+
}
|
|
660
|
+
export declare type EventListenerDetail<O extends Event, D extends Record<string, any>> = (event: O, detail?: D) => void;
|
|
661
|
+
export declare type EventOptions = AddEventListenerOptions | boolean | undefined;
|
|
662
|
+
/** Stop event propagation. */
|
|
663
|
+
export declare function eventStopPropagation(event: Event): void;
|
|
664
|
+
/** Executes argument if function, or returns as is. */
|
|
665
|
+
export declare function executeFunction<T>(callback: T | FunctionArgs<any, T>, ...args: any[]): T;
|
|
666
|
+
/** Execute and await result safely. */
|
|
667
|
+
export declare function executePromise<T>(callback: ((...args: any[]) => Promise<T>) | ((...args: any[]) => T) | T, ...args: any[]): Promise<T>;
|
|
668
|
+
/** Iterate over object/array/map/set and return results array. */
|
|
669
|
+
export declare function forEach<T, R, D extends T[] | Record<string, T> | Map<string, T> | Set<T> = T[] | Record<string, T> | Map<string, T> | Set<T>, K = D extends T[] ? number : string>(data: D & (T[] | Record<string, T> | Map<string, T> | Set<T>), callback: (item: T, key: K, dataMain: typeof data) => R, saveUndefined?: boolean): R[];
|
|
670
|
+
/**
|
|
671
|
+
* Data list formatting manager.
|
|
672
|
+
*/
|
|
673
|
+
export declare class Formatters<Options extends FormattersOptionsList = FormattersOptionsList, List extends FormattersListProp = FormattersListProp, Item extends FormattersItemProp<List> = FormattersItemProp<List>> {
|
|
674
|
+
constructor(options: Options, list?: List | undefined);
|
|
675
|
+
is(): boolean;
|
|
676
|
+
isArray(): this is this & {
|
|
677
|
+
list: FormattersList<Item>;
|
|
678
|
+
};
|
|
679
|
+
length(): number;
|
|
680
|
+
getList(): FormattersList<Item>;
|
|
681
|
+
getOptions(): Options;
|
|
682
|
+
setList(list?: List): this;
|
|
683
|
+
/** Apply formatting to list/item. */
|
|
684
|
+
to(): FormattersReturn<List, Options>;
|
|
685
|
+
}
|
|
686
|
+
export declare type FormattersCapitalize<K extends string> = K extends `${infer First}.${infer Rest}` ? `${First}${Capitalize<FormattersCapitalize<Rest>>}` : K;
|
|
687
|
+
export declare type FormattersColumns<T extends FormattersOptionsList> = (keyof T & string)[];
|
|
688
|
+
export declare type FormattersDataItem<T extends FormattersListItem, KT extends string[]> = {
|
|
689
|
+
[K in keyof T | FormattersKey<KT[number]>]: K extends keyof T ? T[K] : string;
|
|
690
|
+
};
|
|
691
|
+
export declare type FormattersItemProp<List extends FormattersListProp> = ArrayToItem<List>;
|
|
692
|
+
export declare type FormattersKey<K, A extends string = 'Format'> = K extends string ? `${FormattersCapitalize<K>}${A}` : never;
|
|
693
|
+
export declare type FormattersList<Item extends FormattersListItem> = Item[];
|
|
694
|
+
export declare type FormattersListColumnItem<T extends FormattersListItem, O extends FormattersOptionsList> = FormattersDataItem<T, FormattersColumns<O>>;
|
|
695
|
+
export declare type FormattersListColumns<T extends FormattersListItem, O extends FormattersOptionsList> = FormattersListFormat<T, FormattersColumns<O>>;
|
|
696
|
+
export declare type FormattersListFormat<T extends FormattersListItem, K extends string[]> = FormattersDataItem<T, K>[];
|
|
697
|
+
export declare type FormattersListItem = Record<string, any>;
|
|
698
|
+
export declare type FormattersListProp = FormattersList<FormattersListItem> | FormattersListItem;
|
|
699
|
+
export declare type FormattersOptionsCurrency = {
|
|
700
|
+
currencyPropName?: string;
|
|
701
|
+
options?: string | Intl.NumberFormatOptions;
|
|
702
|
+
numberOnly?: boolean;
|
|
703
|
+
};
|
|
704
|
+
export declare type FormattersOptionsDate = {
|
|
705
|
+
type?: GeoDate;
|
|
706
|
+
options?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions;
|
|
707
|
+
hour24?: boolean;
|
|
708
|
+
};
|
|
709
|
+
export declare 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>;
|
|
710
|
+
export declare type FormattersOptionsItem<Type extends FormattersType = FormattersType, R = string> = {
|
|
711
|
+
type?: Type;
|
|
712
|
+
transformation?: (valueOriginal: any, item: any, options?: FormattersOptionsInformation<Type>) => R;
|
|
713
|
+
options?: FormattersOptionsInformation<Type>;
|
|
714
|
+
};
|
|
715
|
+
export declare type FormattersOptionsList = Record<string, FormattersOptionsItem>;
|
|
716
|
+
export declare type FormattersOptionsName = {
|
|
717
|
+
lastPropName?: string;
|
|
718
|
+
firstPropName?: string;
|
|
719
|
+
surname?: string;
|
|
720
|
+
short?: boolean;
|
|
721
|
+
};
|
|
722
|
+
export declare type FormattersOptionsNumber = {
|
|
723
|
+
options?: Intl.NumberFormatOptions;
|
|
724
|
+
};
|
|
725
|
+
export declare type FormattersOptionsPlural = {
|
|
726
|
+
words: string;
|
|
727
|
+
options?: Intl.PluralRulesOptions;
|
|
728
|
+
optionsNumber?: Intl.NumberFormatOptions;
|
|
729
|
+
};
|
|
730
|
+
export declare type FormattersOptionsUnit = {
|
|
731
|
+
unit: string | Intl.NumberFormatOptions;
|
|
732
|
+
};
|
|
733
|
+
export declare 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);
|
|
734
|
+
export declare enum FormattersType {
|
|
735
|
+
currency = "currency",
|
|
736
|
+
date = "date",
|
|
737
|
+
name = "name",
|
|
738
|
+
number = "number",
|
|
739
|
+
plural = "plural",
|
|
740
|
+
unit = "unit"
|
|
741
|
+
}
|
|
742
|
+
/** Cyclic requestAnimationFrame. */
|
|
743
|
+
export declare function frame(callback: () => void, next?: () => boolean, end?: () => void): void;
|
|
744
|
+
export declare type FunctionAnyType<T = any, R = any> = (...args: T[]) => R;
|
|
745
|
+
export declare type FunctionArgs<T, R> = (...args: T[]) => R;
|
|
746
|
+
export declare type FunctionReturn<R = any> = () => R;
|
|
747
|
+
export declare type FunctionVoid = () => void;
|
|
748
|
+
/**
|
|
749
|
+
* Geographical data manager.
|
|
750
|
+
*/
|
|
751
|
+
export declare class Geo {
|
|
752
|
+
static getObject(): GeoInstance;
|
|
753
|
+
static get(): GeoItemFull;
|
|
754
|
+
static getCountry(): string;
|
|
755
|
+
static getLanguage(): string;
|
|
756
|
+
static getStandard(): string;
|
|
757
|
+
static getFirstDay(): string;
|
|
758
|
+
static getLocation(): string;
|
|
759
|
+
static getItem(): GeoItemFull;
|
|
760
|
+
static getList(): GeoItem[];
|
|
761
|
+
static getByCode(code?: string): GeoItemFull;
|
|
762
|
+
static getByCodeFull(code: string): GeoItem | undefined;
|
|
763
|
+
static getByCountry(country: string): GeoItem | undefined;
|
|
764
|
+
static getByLanguage(language: string): GeoItem | undefined;
|
|
765
|
+
static getTimezone(): number;
|
|
766
|
+
static getTimezoneFormat(): string;
|
|
767
|
+
static find(code: string): GeoItemFull;
|
|
768
|
+
static toStandard(item: GeoItem): string;
|
|
769
|
+
static set(code: string, save?: boolean): void;
|
|
770
|
+
static setTimezone(timezone: number): void;
|
|
771
|
+
}
|
|
772
|
+
export declare const GEO_FLAG_ICON_NAME = "f";
|
|
773
|
+
export declare type GeoDate = 'full' | 'datetime' | 'date' | 'year-month' | 'year' | 'month' | 'day' | 'day-month' | 'time' | 'hour-minute' | 'hour' | 'minute' | 'second';
|
|
774
|
+
export declare type GeoFirstDay = 1 | 6 | 0;
|
|
775
|
+
/**
|
|
776
|
+
* Country flags and names.
|
|
777
|
+
*/
|
|
778
|
+
export declare class GeoFlag {
|
|
779
|
+
static flags: Record<string, string>;
|
|
780
|
+
constructor(code?: string);
|
|
781
|
+
get(code?: string): GeoFlagItem | undefined;
|
|
782
|
+
getFlag(code?: string): string | undefined;
|
|
783
|
+
getList(codes?: string[]): GeoFlagItem[];
|
|
784
|
+
getNational(codes?: string[]): GeoFlagNational[];
|
|
785
|
+
setCode(code: string): this;
|
|
786
|
+
}
|
|
787
|
+
export declare interface GeoFlagItem {
|
|
788
|
+
language: string;
|
|
789
|
+
country: string;
|
|
790
|
+
standard: string;
|
|
791
|
+
icon?: string;
|
|
792
|
+
label: string;
|
|
793
|
+
value: string;
|
|
794
|
+
}
|
|
795
|
+
export declare interface GeoFlagNational extends GeoFlagItem {
|
|
796
|
+
description: string;
|
|
797
|
+
nationalLanguage: string;
|
|
798
|
+
nationalCountry: string;
|
|
799
|
+
}
|
|
800
|
+
export declare type GeoHours = '12' | '24';
|
|
801
|
+
/**
|
|
802
|
+
* Geographic state instance.
|
|
803
|
+
*/
|
|
804
|
+
export declare class GeoInstance {
|
|
805
|
+
constructor();
|
|
806
|
+
get(): GeoItemFull;
|
|
807
|
+
getCountry(): string;
|
|
808
|
+
getLanguage(): string;
|
|
809
|
+
getStandard(): string;
|
|
810
|
+
getFirstDay(): string;
|
|
811
|
+
getLocation(): string;
|
|
812
|
+
getItem(): GeoItemFull;
|
|
813
|
+
getList(): GeoItem[];
|
|
814
|
+
getByCode(code?: string): GeoItemFull;
|
|
815
|
+
getByCodeFull(code: string): GeoItem | undefined;
|
|
816
|
+
getByCountry(country: string): GeoItem | undefined;
|
|
817
|
+
getByLanguage(language: string): GeoItem | undefined;
|
|
818
|
+
getTimezone(): number;
|
|
819
|
+
getTimezoneFormat(): string;
|
|
820
|
+
find(code: string): GeoItemFull;
|
|
821
|
+
toStandard(item: GeoItem): string;
|
|
822
|
+
set(code: string, save?: boolean): void;
|
|
823
|
+
setTimezone(timezone: number): void;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Internationalization wrapper.
|
|
827
|
+
*/
|
|
828
|
+
export declare class GeoIntl {
|
|
829
|
+
static isItem(code?: string): boolean;
|
|
830
|
+
static getLocation(code?: string): string;
|
|
831
|
+
static getInstance(code?: string): GeoIntl;
|
|
832
|
+
constructor(code?: string, errorCenter?: ErrorCenterInstance);
|
|
833
|
+
getLocation(): string;
|
|
834
|
+
getFirstDay(): string;
|
|
835
|
+
display(value?: string, typeOptions?: Intl.DisplayNamesOptions['type'] | Intl.DisplayNamesOptions): string;
|
|
836
|
+
languageName(value?: string, style?: Intl.RelativeTimeFormatStyle): string;
|
|
837
|
+
countryName(value?: string, style?: Intl.RelativeTimeFormatStyle): string;
|
|
838
|
+
fullName(last: string, first: string, surname?: string, short?: boolean): string;
|
|
839
|
+
number(value: NumberOrString, options?: Intl.NumberFormatOptions): string;
|
|
840
|
+
decimal(): string;
|
|
841
|
+
currency(value: NumberOrString, currencyOptions?: string | Intl.NumberFormatOptions, numberOnly?: boolean): string;
|
|
842
|
+
currencySymbol(currency: string, currencyDisplay?: keyof Intl.NumberFormatOptionsCurrencyDisplayRegistry): string;
|
|
843
|
+
unit(value: NumberOrString, unitOptions?: string | Intl.NumberFormatOptions): string;
|
|
844
|
+
sizeFile(value: NumberOrString, unitOptions?: 'byte' | 'kilobyte' | 'megabyte' | 'gigabyte' | 'terabyte' | 'petabyte' | Intl.NumberFormatOptions): string;
|
|
845
|
+
percent(value: NumberOrString, options?: Intl.NumberFormatOptions): string;
|
|
846
|
+
percentBy100(value: NumberOrString, options?: Intl.NumberFormatOptions): string;
|
|
847
|
+
plural(value: NumberOrString, words: string, options?: Intl.PluralRulesOptions, optionsNumber?: Intl.NumberFormatOptions): string;
|
|
848
|
+
date(value: NumberOrStringOrDate, type?: GeoDate, styleOptions?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions, hour24?: boolean): string;
|
|
849
|
+
relative(value: NumberOrStringOrDate, styleOptions?: Intl.RelativeTimeFormatStyle | Intl.RelativeTimeFormatOptions, todayValue?: Date): string;
|
|
850
|
+
relativeLimit(value: NumberOrStringOrDate, limit: number, todayValue?: Date, relativeOptions?: Intl.RelativeTimeFormatStyle | Intl.RelativeTimeFormatOptions, dateOptions?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions, type?: GeoDate, hour24?: boolean): string;
|
|
851
|
+
relativeByValue(value: NumberOrString, unit: Intl.RelativeTimeFormatUnit, styleOptions?: Intl.RelativeTimeFormatStyle | Intl.RelativeTimeFormatOptions): string;
|
|
852
|
+
month(value?: NumberOrStringOrDate, style?: Intl.DateTimeFormatOptions['month']): string;
|
|
853
|
+
months(style?: Intl.DateTimeFormatOptions['month']): ItemValue<number | undefined>[];
|
|
854
|
+
weekday(value?: NumberOrStringOrDate, style?: Intl.DateTimeFormatOptions['weekday']): string;
|
|
855
|
+
weekdays(style?: Intl.DateTimeFormatOptions['weekday']): ItemValue<number | undefined>[];
|
|
856
|
+
time(value: NumberOrStringOrDate): string;
|
|
857
|
+
sort<T>(data: T[], compareFn?: (a: T, b: T) => [string, string]): T[];
|
|
858
|
+
}
|
|
859
|
+
export declare interface GeoItem {
|
|
860
|
+
country: string;
|
|
861
|
+
countryAlternative?: string[];
|
|
862
|
+
language: string;
|
|
863
|
+
languageAlternative?: string[];
|
|
864
|
+
firstDay?: string | null;
|
|
865
|
+
zone?: string | null;
|
|
866
|
+
phoneCode?: string;
|
|
867
|
+
phoneWithin?: string;
|
|
868
|
+
phoneMask?: string | string[];
|
|
869
|
+
nameFormat?: 'fl' | 'fsl' | 'lf' | 'lsf' | string;
|
|
870
|
+
}
|
|
871
|
+
export declare interface GeoItemFull extends Omit<GeoItem, 'firstDay'> {
|
|
872
|
+
standard: string;
|
|
873
|
+
firstDay: string;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Phone mask processing.
|
|
877
|
+
*/
|
|
878
|
+
export declare class GeoPhone {
|
|
879
|
+
static get(code: string): GeoPhoneValue | undefined;
|
|
880
|
+
static getByPhone(phone: string): GeoPhoneMapInfo;
|
|
881
|
+
static getByCode(code: string): GeoPhoneMap | undefined;
|
|
882
|
+
static getList(): GeoPhoneValue[];
|
|
883
|
+
static getMap(): Record<string, GeoPhoneMap>;
|
|
884
|
+
static toMask(phone: string, masks?: string[]): string | undefined;
|
|
885
|
+
static removeZero(phone: string): string;
|
|
886
|
+
}
|
|
887
|
+
export declare interface GeoPhoneMap {
|
|
888
|
+
items: GeoPhoneValue[];
|
|
889
|
+
info: GeoPhoneValue | undefined;
|
|
890
|
+
value: string | undefined;
|
|
891
|
+
mask: string[];
|
|
892
|
+
maskFull: string[];
|
|
893
|
+
next: Record<string, GeoPhoneMap>;
|
|
894
|
+
}
|
|
895
|
+
export declare interface GeoPhoneMapInfo {
|
|
896
|
+
item?: GeoPhoneMap;
|
|
897
|
+
phone?: string;
|
|
898
|
+
}
|
|
899
|
+
export declare interface GeoPhoneValue {
|
|
900
|
+
phone: number;
|
|
901
|
+
within: number;
|
|
902
|
+
mask: string[];
|
|
903
|
+
value: string;
|
|
904
|
+
}
|
|
905
|
+
export declare type GeoTimeZoneStyle = 'minute' | 'hour' | 'ISO8601' | 'RFC';
|
|
906
|
+
/** Get array for match highlighting. */
|
|
907
|
+
export declare function getArrayHighlightMatch(value: string, search?: string | RegExp): HighlightMatchItem[];
|
|
908
|
+
/** Get element attributes. */
|
|
909
|
+
export declare function getAttributes<E extends ElementOrWindow>(element?: ElementOrString<E>): Record<string, string | undefined>;
|
|
910
|
+
/** Get clipboard text. */
|
|
911
|
+
export declare function getClipboardData(event?: ClipboardEvent): Promise<string>;
|
|
912
|
+
/** Get values from specific column. */
|
|
913
|
+
export declare function getColumn<T, K extends keyof T>(array: ObjectOrArray<T>, column: K): (T[K] | undefined)[];
|
|
914
|
+
/** Get current formatted date. Client-only hook recommended. */
|
|
915
|
+
export declare function getCurrentDate(format?: GeoDate): string;
|
|
916
|
+
/** Get timestamp (ms). SSR Warning. */
|
|
917
|
+
export declare function getCurrentTime(): number;
|
|
918
|
+
/** Find DOM element. */
|
|
919
|
+
export declare function getElement<E extends ElementOrWindow, R extends Exclude<E, Window>>(element?: ElementOrString<E>): R | undefined;
|
|
920
|
+
/** Get or create element ID. */
|
|
921
|
+
export declare function getElementId<E extends ElementOrWindow>(element?: ElementOrString<E>, selector?: string): string;
|
|
922
|
+
/** Get HTMLImageElement. */
|
|
923
|
+
export declare function getElementImage(image: HTMLImageElement | string): HTMLImageElement | undefined;
|
|
924
|
+
/** Get property from element. */
|
|
925
|
+
export declare function getElementItem<T extends ElementOrWindow, K extends keyof T, D>(element: ElementOrString<T>, index: K | string, defaultValue?: D): T[K] | D | undefined;
|
|
926
|
+
/** Get element or window. */
|
|
927
|
+
export declare function getElementOrWindow<E extends ElementOrWindow>(element?: ElementOrString<E>): E | undefined;
|
|
928
|
+
/** Generate safe hydration script. */
|
|
929
|
+
export declare function getElementSafeScript(id: string, data: any): string;
|
|
930
|
+
/** Exact phrase search regex. */
|
|
931
|
+
export declare function getExactSearchExp(search: string): RegExp;
|
|
932
|
+
/** Generate RegExp from pattern. */
|
|
933
|
+
export declare function getExp(value: string, flags?: string, pattern?: string): RegExp;
|
|
934
|
+
/** Get hydration data from DOM. */
|
|
935
|
+
export declare function getHydrationData<T>(id: string, defaultValue: T, remove?: boolean): T;
|
|
936
|
+
/** Get data by path. */
|
|
937
|
+
export declare function getItemByPath<T extends Record<string, any>, R = string>(item: T, path: string): R | undefined;
|
|
938
|
+
/** Get pressed key from event. */
|
|
939
|
+
export declare function getKey(event: KeyboardEvent): string;
|
|
940
|
+
/** Length of all array elements. */
|
|
941
|
+
export declare function getLengthOfAllArray(value: ObjectOrArray<string>): number[];
|
|
942
|
+
/** Max string length in array. */
|
|
943
|
+
export declare function getMaxLengthAllArray(data: ObjectOrArray<string>): number;
|
|
944
|
+
/** Min string length in array. */
|
|
945
|
+
export declare function getMinLengthAllArray(data: ObjectOrArray<string>): number;
|
|
946
|
+
/** Get mouse coordinates. */
|
|
947
|
+
export declare function getMouseClient(event: MouseEvent & TouchEvent): ImageCoordinator;
|
|
948
|
+
/** Mouse X coordinate. */
|
|
949
|
+
export declare function getMouseClientX(event: MouseEvent & TouchEvent): number;
|
|
950
|
+
/** Mouse Y coordinate. */
|
|
951
|
+
export declare function getMouseClientY(event: MouseEvent & TouchEvent): number;
|
|
952
|
+
/** Pick object properties. */
|
|
953
|
+
export declare function getObjectByKeys<T extends Record<string, any>, K extends keyof T>(data: T, keys: K[]): Pick<T, K>;
|
|
954
|
+
/** Remove properties with specific exception value. */
|
|
955
|
+
export declare function getObjectNoUndefined<T extends Record<string | number, any>>(data: T, exception?: any): T;
|
|
956
|
+
/** Ensure value is object. */
|
|
957
|
+
export declare function getObjectOrNone<T>(value: T): T & Record<string, any>;
|
|
958
|
+
/** Extract alphanumeric and spaces. */
|
|
959
|
+
export declare function getOnlyText(text: any): string;
|
|
960
|
+
/** Generate random text. */
|
|
961
|
+
export declare function getRandomText(min: number, max: number, symbol?: string, lengthMin?: number, lengthMax?: number): string;
|
|
962
|
+
/** Format request query string. */
|
|
963
|
+
export declare function getRequestString(request: Record<string, any> | any[], sign?: string, separator?: string, subKey?: string): string;
|
|
964
|
+
/** Multi-word "contains all" RegExp. */
|
|
965
|
+
export declare function getSearchExp(search: string, limit?: number): RegExp;
|
|
966
|
+
/** Space-separated word search RegExp. */
|
|
967
|
+
export declare function getSeparatingSearchExp(search: string | RegExp, limit?: number): RegExp;
|
|
968
|
+
/** Unit for 1 step (%). */
|
|
969
|
+
export declare function getStepPercent(min: number | undefined, max: number): number;
|
|
970
|
+
/** Unit for 1 step (value). */
|
|
971
|
+
export declare function getStepValue(min: number | undefined, max: number): number;
|
|
972
|
+
/**
|
|
973
|
+
* Global application storage.
|
|
974
|
+
*/
|
|
975
|
+
export declare class Global {
|
|
976
|
+
static getItem(): Record<string, any>;
|
|
977
|
+
static get<R = any>(name: string): R;
|
|
978
|
+
static add(data: Record<string, any>): void;
|
|
979
|
+
}
|
|
980
|
+
/** Scroll to element. */
|
|
981
|
+
export declare function goScroll(selector: string, elementTo: HTMLElement | undefined, elementCenter?: HTMLElement): void;
|
|
982
|
+
/** Smooth scroll to element. */
|
|
983
|
+
export declare function goScrollSmooth<E extends HTMLElement>(element: E, options?: ScrollIntoViewOptions, shift?: number): void;
|
|
984
|
+
/** Container visibility scroll. */
|
|
985
|
+
export declare function goScrollTo(element?: HTMLElement, elementTo?: HTMLElement, behavior?: ScrollBehavior): void;
|
|
986
|
+
/** Web Share API wrapper. */
|
|
987
|
+
export declare function handleShare(data: ShareData): Promise<boolean>;
|
|
988
|
+
/**
|
|
989
|
+
* URL hash management.
|
|
990
|
+
*/
|
|
991
|
+
export declare class Hash {
|
|
992
|
+
static getItem(): HashInstance;
|
|
993
|
+
static get<T>(name: string, defaultValue?: T | (() => T)): T;
|
|
994
|
+
static set<T>(name: string, callback: T | (() => T)): void;
|
|
995
|
+
static addWatch<T>(name: string, callback: (value: T) => void): void;
|
|
996
|
+
static removeWatch<T>(name: string, callback: (value: T) => void): void;
|
|
997
|
+
static reload(): void;
|
|
998
|
+
}
|
|
999
|
+
export declare class HashInstance {
|
|
1000
|
+
get<T>(name: string, defaultValue?: T | (() => T)): T;
|
|
1001
|
+
set<T>(name: string, callback: T | (() => T)): this;
|
|
1002
|
+
addWatch<T>(name: string, callback: (value: T) => void): this;
|
|
1003
|
+
removeWatch<T>(name: string, callback: (value: T) => void): this;
|
|
1004
|
+
reload(): this;
|
|
1005
|
+
}
|
|
1006
|
+
export declare type HighlightMatchItem = {
|
|
1007
|
+
text: string;
|
|
1008
|
+
isMatch: boolean;
|
|
1009
|
+
};
|
|
1010
|
+
/**
|
|
1011
|
+
* Icon management.
|
|
1012
|
+
*/
|
|
1013
|
+
export declare class Icons {
|
|
1014
|
+
static is(index: string): boolean;
|
|
1015
|
+
static get(index: string, url?: string, wait?: number): Promise<string>;
|
|
1016
|
+
static getNameList(): string[];
|
|
1017
|
+
static getUrlGlobal(): string;
|
|
1018
|
+
static add(index: string, file: IconsItem): void;
|
|
1019
|
+
static addLoad(index: string): void;
|
|
1020
|
+
static addGlobal(index: string, file: string): void;
|
|
1021
|
+
static addByList(list: Record<string, IconsItem>): void;
|
|
1022
|
+
static setUrl(url: string): void;
|
|
1023
|
+
static setConfig(config: IconsConfig): void;
|
|
1024
|
+
}
|
|
1025
|
+
export declare type IconsConfig = {
|
|
1026
|
+
url?: string;
|
|
1027
|
+
list?: Record<string, IconsItem>;
|
|
1028
|
+
};
|
|
1029
|
+
export declare type IconsItem = string | Promise<string | any> | (() => Promise<string | any>);
|
|
1030
|
+
export declare type ImageCoordinator = {
|
|
1031
|
+
x: number;
|
|
1032
|
+
y: number;
|
|
1033
|
+
};
|
|
1034
|
+
/** Check if value in array. */
|
|
1035
|
+
export declare function inArray<T>(array: T[], value: T): boolean;
|
|
1036
|
+
/** Initialize ID listener for SSR. Mandatory. */
|
|
1037
|
+
export declare function initGetElementId(newListener: () => string | number): void;
|
|
1038
|
+
/** Initialize scroll control. */
|
|
1039
|
+
export declare function initScrollbarOffset(): Promise<void>;
|
|
1040
|
+
/** Intersect object keys. */
|
|
1041
|
+
export declare function intersectKey<T, KT extends keyof T, C, KC extends keyof C>(data?: T, comparison?: C): Record<KT & KC, T[KT]>;
|
|
1042
|
+
/** Check for successful API response. */
|
|
1043
|
+
export declare const isApiSuccess: <T>(data: ApiData<T>) => boolean;
|
|
1044
|
+
/** Check if array. */
|
|
1045
|
+
export declare function isArray<T, R>(value: T): value is Extract<T, R[]>;
|
|
1046
|
+
/** Check if object values differ. */
|
|
1047
|
+
export declare function isDifferent<T>(value: ObjectItem<T>, old: ObjectItem<T>): boolean;
|
|
1048
|
+
/** Check if data URL environment. */
|
|
1049
|
+
export declare function isDomData(): boolean;
|
|
1050
|
+
/** Check if running in browser with window. */
|
|
1051
|
+
export declare function isDomRuntime(): boolean;
|
|
1052
|
+
/** Check element visibility (CSS/DOM). */
|
|
1053
|
+
export declare function isElementVisible<E extends ElementOrWindow>(elementSelectors?: ElementOrString<E>): boolean;
|
|
1054
|
+
/** Check if Enter/Space key. */
|
|
1055
|
+
export declare const isEnter: (event: KeyboardEvent, isInputElement?: boolean) => boolean;
|
|
1056
|
+
/** Check if value is filled. */
|
|
1057
|
+
export declare function isFilled<T>(value: T, zeroTrue?: boolean): value is Exclude<T, EmptyValue>;
|
|
1058
|
+
/** Check if float/number. */
|
|
1059
|
+
export declare function isFloat(value: any): boolean;
|
|
1060
|
+
/** Check if function. */
|
|
1061
|
+
export declare function isFunction<T>(callback: T): callback is Extract<T, FunctionArgs<any, any>>;
|
|
1062
|
+
/** Check if element in DOM tree. */
|
|
1063
|
+
export declare function isInDom<E extends ElementOrWindow>(element?: ElementOrString<E>): boolean;
|
|
1064
|
+
/** Check if element is input/editable. */
|
|
1065
|
+
export declare const isInput: (element: HTMLElement | EventTarget | null) => boolean;
|
|
1066
|
+
/** Check if integer in range. */
|
|
1067
|
+
export declare function isIntegerBetween(value: number, between: number): boolean;
|
|
1068
|
+
/** Check if null/undefined. */
|
|
1069
|
+
export declare function isNull<T>(value: T): value is Extract<T, Undefined>;
|
|
1070
|
+
/** Check if number. */
|
|
1071
|
+
export declare function isNumber(value: any): boolean;
|
|
1072
|
+
/** Check if object. */
|
|
1073
|
+
export declare function isObject<T>(value: T): value is Extract<T, Record<any, any>>;
|
|
1074
|
+
/** Check if object and not array. */
|
|
1075
|
+
export declare function isObjectNotArray<T>(value: T): value is Exclude<Extract<T, Record<any, any>>, any[] | undefined | null>;
|
|
1076
|
+
/** Check online status. */
|
|
1077
|
+
export declare function isOnLine(): boolean;
|
|
1078
|
+
/** Check if value matches selection (array or string). */
|
|
1079
|
+
export declare function isSelected<T, S>(value: T, selected: T | T[] | S): boolean;
|
|
1080
|
+
/** Check isSelected for entire list. */
|
|
1081
|
+
export declare function isSelectedByList<T>(values: T | T[], selected: T | T[]): boolean;
|
|
1082
|
+
/** Check Share API support. */
|
|
1083
|
+
export declare function isShare(): boolean;
|
|
1084
|
+
/** Check if string. */
|
|
1085
|
+
export declare function isString<T>(value: T): value is Extract<T, string>;
|
|
1086
|
+
/** Check if Window object. */
|
|
1087
|
+
export declare function isWindow<E>(element: E): element is Extract<E, Window>;
|
|
1088
|
+
export declare type Item<V> = {
|
|
1089
|
+
index: string;
|
|
1090
|
+
value: V;
|
|
1091
|
+
};
|
|
1092
|
+
export declare type ItemList<T = any> = Record<string, T>;
|
|
1093
|
+
export declare type ItemName<V> = {
|
|
1094
|
+
name: string | number;
|
|
1095
|
+
value: V;
|
|
1096
|
+
};
|
|
1097
|
+
export declare type ItemValue<V> = {
|
|
1098
|
+
label: string;
|
|
1099
|
+
value: V;
|
|
1100
|
+
};
|
|
1101
|
+
/**
|
|
1102
|
+
* Global loading tracking.
|
|
1103
|
+
*/
|
|
1104
|
+
export declare class Loading {
|
|
1105
|
+
static is(): boolean;
|
|
1106
|
+
static get(): number;
|
|
1107
|
+
static getItem(): LoadingInstance;
|
|
1108
|
+
static show(): void;
|
|
1109
|
+
static hide(): void;
|
|
1110
|
+
static registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
1111
|
+
static unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
1112
|
+
}
|
|
1113
|
+
export declare type LoadingDetail = {
|
|
1114
|
+
loading: boolean;
|
|
1115
|
+
};
|
|
1116
|
+
export declare class LoadingInstance {
|
|
1117
|
+
constructor(eventName?: string);
|
|
1118
|
+
is(): boolean;
|
|
1119
|
+
get(): number;
|
|
1120
|
+
show(): void;
|
|
1121
|
+
hide(): void;
|
|
1122
|
+
registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
1123
|
+
unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
1124
|
+
}
|
|
1125
|
+
export declare type LoadingRegistrationItem = {
|
|
1126
|
+
item: EventItem<Window, CustomEvent, LoadingDetail>;
|
|
1127
|
+
listener: EventListenerDetail<CustomEvent, LoadingDetail>;
|
|
1128
|
+
element?: ElementOrString<HTMLElement>;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* Meta tag manager (HTML, OG, Twitter).
|
|
1132
|
+
*/
|
|
1133
|
+
export declare class Meta extends MetaManager<MetaTag[]> {
|
|
1134
|
+
constructor();
|
|
1135
|
+
getOg(): MetaOg;
|
|
1136
|
+
getTwitter(): MetaTwitter;
|
|
1137
|
+
getTitle(): string;
|
|
1138
|
+
getKeywords(): string;
|
|
1139
|
+
getDescription(): string;
|
|
1140
|
+
getImage(): string;
|
|
1141
|
+
getCanonical(): string;
|
|
1142
|
+
getRobots(): MetaRobots;
|
|
1143
|
+
getAuthor(): string;
|
|
1144
|
+
getSiteName(): string;
|
|
1145
|
+
getLocale(): string;
|
|
1146
|
+
setTitle(title: string): this;
|
|
1147
|
+
setKeywords(keywords: string | string[]): this;
|
|
1148
|
+
setDescription(description: string): this;
|
|
1149
|
+
setImage(image: string): this;
|
|
1150
|
+
setCanonical(canonical: string): this;
|
|
1151
|
+
setRobots(robots: MetaRobots): this;
|
|
1152
|
+
setAuthor(author: string): this;
|
|
1153
|
+
setSiteName(siteName: string): this;
|
|
1154
|
+
setLocale(locale: string): this;
|
|
1155
|
+
setSuffix(suffix?: string): void;
|
|
1156
|
+
html(): string;
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Meta attribute manager.
|
|
1160
|
+
*/
|
|
1161
|
+
export declare class MetaManager<T extends readonly string[], Key extends keyof MetaList<T> = keyof MetaList<T>> {
|
|
1162
|
+
constructor(listMeta: T, isProperty?: boolean);
|
|
1163
|
+
getListMeta(): T;
|
|
1164
|
+
get(name: Key): string;
|
|
1165
|
+
getItems(): MetaList<T>;
|
|
1166
|
+
html(): string;
|
|
1167
|
+
set(name: Key, content: string): this;
|
|
1168
|
+
setByList(metaList: MetaList<T>): this;
|
|
1169
|
+
}
|
|
1170
|
+
/** Open Graph tags. */
|
|
1171
|
+
export declare class MetaOg extends MetaManager<MetaOpenGraphTag[]> {
|
|
1172
|
+
constructor();
|
|
1173
|
+
getTitle(): string;
|
|
1174
|
+
getType(): MetaOpenGraphType;
|
|
1175
|
+
getUrl(): string;
|
|
1176
|
+
getImage(): string;
|
|
1177
|
+
getDescription(): string;
|
|
1178
|
+
getLocale(): string;
|
|
1179
|
+
getSiteName(): string;
|
|
1180
|
+
setTitle(title: string): this;
|
|
1181
|
+
setType(type: MetaOpenGraphType): this;
|
|
1182
|
+
setUrl(url: string): this;
|
|
1183
|
+
setImage(url: string): this;
|
|
1184
|
+
setDescription(description: string): this;
|
|
1185
|
+
setLocale(locale: string): this;
|
|
1186
|
+
setSiteName(siteName: string): this;
|
|
1187
|
+
}
|
|
1188
|
+
export declare enum MetaOpenGraphTag {
|
|
1189
|
+
title = "og:title",
|
|
1190
|
+
type = "og:type",
|
|
1191
|
+
url = "og:url",
|
|
1192
|
+
image = "og:image",
|
|
1193
|
+
description = "og:description",
|
|
1194
|
+
locale = "og:locale",
|
|
1195
|
+
siteName = "og:site_name",
|
|
1196
|
+
localeAlternate = "og:locale:alternate",
|
|
1197
|
+
imageUrl = "og:image:url",
|
|
1198
|
+
imageSecureUrl = "og:image:secure_url",
|
|
1199
|
+
imageType = "og:image:type",
|
|
1200
|
+
imageWidth = "og:image:width",
|
|
1201
|
+
imageHeight = "og:image:height",
|
|
1202
|
+
imageAlt = "og:image:alt",
|
|
1203
|
+
video = "og:video",
|
|
1204
|
+
videoUrl = "og:video:url",
|
|
1205
|
+
videoSecureUrl = "og:video:secure_url",
|
|
1206
|
+
videoType = "og:video:type",
|
|
1207
|
+
videoWidth = "og:video:width",
|
|
1208
|
+
videoHeight = "og:video:height",
|
|
1209
|
+
audio = "og:audio",
|
|
1210
|
+
audioSecureUrl = "og:audio:secure_url",
|
|
1211
|
+
audioType = "og:audio:type",
|
|
1212
|
+
articlePublishedTime = "article:published_time",
|
|
1213
|
+
articleModifiedTime = "article:modified_time",
|
|
1214
|
+
articleExpirationTime = "article:expiration_time",
|
|
1215
|
+
articleAuthor = "article:author",
|
|
1216
|
+
articleSection = "article:section",
|
|
1217
|
+
articleTag = "article:tag",
|
|
1218
|
+
bookAuthor = "book:author",
|
|
1219
|
+
bookIsbn = "book:isbn",
|
|
1220
|
+
bookReleaseDate = "book:release_date",
|
|
1221
|
+
bookTag = "book:tag",
|
|
1222
|
+
musicDuration = "music:duration",
|
|
1223
|
+
musicAlbum = "music:album",
|
|
1224
|
+
musicAlbumDisc = "music:album:disc",
|
|
1225
|
+
musicAlbumTrack = "music:album:track",
|
|
1226
|
+
musicMusician = "music:musician",
|
|
1227
|
+
musicSong = "music:song",
|
|
1228
|
+
musicSongDisc = "music:song:disc",
|
|
1229
|
+
musicSongTrack = "music:song:track",
|
|
1230
|
+
musicReleaseDate = "music:release_date",
|
|
1231
|
+
musicCreator = "music:creator",
|
|
1232
|
+
videoActor = "video:actor",
|
|
1233
|
+
videoActorRole = "video:actor:role",
|
|
1234
|
+
videoDirector = "video:director",
|
|
1235
|
+
videoWriter = "video:writer",
|
|
1236
|
+
videoDuration = "video:duration",
|
|
1237
|
+
videoReleaseDate = "video:release_date",
|
|
1238
|
+
videoTag = "video:tag",
|
|
1239
|
+
videoSeries = "video:series",
|
|
1240
|
+
profileFirstName = "profile:first_name",
|
|
1241
|
+
profileLastName = "profile:last_name",
|
|
1242
|
+
profileUsername = "profile:username",
|
|
1243
|
+
profileGender = "profile:gender",
|
|
1244
|
+
productBrand = "product:brand",
|
|
1245
|
+
productAvailability = "product:availability",
|
|
1246
|
+
productCondition = "product:condition",
|
|
1247
|
+
productPriceAmount = "product:price:amount",
|
|
1248
|
+
productPriceCurrency = "product:price:currency",
|
|
1249
|
+
productRetailerItemId = "product:retailer_item_id",
|
|
1250
|
+
productCategory = "product:category",
|
|
1251
|
+
productEan = "product:ean",
|
|
1252
|
+
productIsbn = "product:isbn",
|
|
1253
|
+
productMfrPartNo = "product:mfr_part_no",
|
|
1254
|
+
productUpc = "product:upc",
|
|
1255
|
+
productWeightValue = "product:weight:value",
|
|
1256
|
+
productWeightUnits = "product:weight:units",
|
|
1257
|
+
productColor = "product:color",
|
|
1258
|
+
productMaterial = "product:material",
|
|
1259
|
+
productPattern = "product:pattern",
|
|
1260
|
+
productAgeGroup = "product:age_group",
|
|
1261
|
+
productGender = "product:gender"
|
|
1262
|
+
}
|
|
1263
|
+
export declare enum MetaOpenGraphType {
|
|
1264
|
+
website = "website",
|
|
1265
|
+
article = "article",
|
|
1266
|
+
video = "video.other",
|
|
1267
|
+
videoTvShow = "video.tv_show",
|
|
1268
|
+
videoEpisode = "video.episode",
|
|
1269
|
+
videoMovie = "video.movie",
|
|
1270
|
+
musicAlbum = "music.album",
|
|
1271
|
+
musicPlaylist = "music.playlist",
|
|
1272
|
+
musicSong = "music.song",
|
|
1273
|
+
musicRadioStation = "music.radio_station",
|
|
1274
|
+
app = "app",
|
|
1275
|
+
product = "product",
|
|
1276
|
+
business = "business.business",
|
|
1277
|
+
place = "place",
|
|
1278
|
+
event = "event",
|
|
1279
|
+
profile = "profile",
|
|
1280
|
+
book = "book"
|
|
1281
|
+
}
|
|
1282
|
+
export declare enum MetaRobots {
|
|
1283
|
+
indexFollow = "index, follow",
|
|
1284
|
+
noIndexFollow = "noindex, follow",
|
|
1285
|
+
indexNoFollow = "index, nofollow",
|
|
1286
|
+
noIndexNoFollow = "noindex, nofollow",
|
|
1287
|
+
noArchive = "noarchive",
|
|
1288
|
+
nosnippet = "nosnippet",
|
|
1289
|
+
noimageindex = "noimageindex",
|
|
1290
|
+
images = "images",
|
|
1291
|
+
notranslate = "notranslate",
|
|
1292
|
+
nopreview = "nopreview",
|
|
1293
|
+
textOnly = "textonly",
|
|
1294
|
+
noIndexSubpages = "noindex, noarchive",
|
|
1295
|
+
none = "none"
|
|
1296
|
+
}
|
|
1297
|
+
/** Static meta management. */
|
|
1298
|
+
export declare class MetaStatic {
|
|
1299
|
+
static getItem(): Meta;
|
|
1300
|
+
static getOg(): MetaOg;
|
|
1301
|
+
static getTwitter(): MetaTwitter;
|
|
1302
|
+
static getTitle(): string;
|
|
1303
|
+
static getKeywords(): string;
|
|
1304
|
+
static getDescription(): string;
|
|
1305
|
+
static getImage(): string;
|
|
1306
|
+
static getCanonical(): string;
|
|
1307
|
+
static getRobots(): MetaRobots;
|
|
1308
|
+
static getAuthor(): string;
|
|
1309
|
+
static getSiteName(): string;
|
|
1310
|
+
static getLocale(): string;
|
|
1311
|
+
static setTitle(title: string): typeof MetaStatic;
|
|
1312
|
+
static setKeywords(keywords: string | string[]): typeof MetaStatic;
|
|
1313
|
+
static setDescription(description: string): typeof MetaStatic;
|
|
1314
|
+
static setImage(image: string): typeof MetaStatic;
|
|
1315
|
+
static setCanonical(canonical: string): typeof MetaStatic;
|
|
1316
|
+
static setRobots(robots: MetaRobots): typeof MetaStatic;
|
|
1317
|
+
static setAuthor(author: string): typeof MetaStatic;
|
|
1318
|
+
static setSiteName(siteName: string): typeof MetaStatic;
|
|
1319
|
+
static setLocale(locale: string): typeof MetaStatic;
|
|
1320
|
+
static setSuffix(suffix?: string): typeof MetaStatic;
|
|
1321
|
+
static html(): string;
|
|
1322
|
+
}
|
|
1323
|
+
export declare enum MetaTag {
|
|
1324
|
+
title = "title",
|
|
1325
|
+
description = "description",
|
|
1326
|
+
keywords = "keywords",
|
|
1327
|
+
canonical = "canonical",
|
|
1328
|
+
robots = "robots",
|
|
1329
|
+
author = "author"
|
|
1330
|
+
}
|
|
1331
|
+
/** Twitter Card tags. */
|
|
1332
|
+
export declare class MetaTwitter extends MetaManager<MetaTwitterTag[]> {
|
|
1333
|
+
constructor();
|
|
1334
|
+
getCard(): MetaTwitterCard;
|
|
1335
|
+
getSite(): string;
|
|
1336
|
+
getCreator(): string;
|
|
1337
|
+
getUrl(): string;
|
|
1338
|
+
getTitle(): string;
|
|
1339
|
+
getDescription(): string;
|
|
1340
|
+
getImage(): string;
|
|
1341
|
+
setCard(card: MetaTwitterCard): this;
|
|
1342
|
+
setSite(site: string): this;
|
|
1343
|
+
setCreator(creator: string): this;
|
|
1344
|
+
setUrl(url: string): this;
|
|
1345
|
+
setTitle(title: string): this;
|
|
1346
|
+
setDescription(description: string): this;
|
|
1347
|
+
setImage(image: string): this;
|
|
1348
|
+
}
|
|
1349
|
+
export declare enum MetaTwitterCard {
|
|
1350
|
+
summary = "summary",
|
|
1351
|
+
summaryLargeImage = "summary_large_image",
|
|
1352
|
+
app = "app",
|
|
1353
|
+
player = "player",
|
|
1354
|
+
product = "product",
|
|
1355
|
+
gallery = "gallery",
|
|
1356
|
+
photo = "photo",
|
|
1357
|
+
leadGeneration = "lead_generation",
|
|
1358
|
+
audio = "audio",
|
|
1359
|
+
poll = "poll"
|
|
1360
|
+
}
|
|
1361
|
+
export declare enum MetaTwitterTag {
|
|
1362
|
+
card = "twitter:card",
|
|
1363
|
+
site = "twitter:site",
|
|
1364
|
+
creator = "twitter:creator",
|
|
1365
|
+
url = "twitter:url",
|
|
1366
|
+
title = "twitter:title",
|
|
1367
|
+
description = "twitter:description",
|
|
1368
|
+
image = "twitter:image",
|
|
1369
|
+
imageAlt = "twitter:image:alt",
|
|
1370
|
+
imageSrc = "twitter:image:src",
|
|
1371
|
+
imageWidth = "twitter:image:width",
|
|
1372
|
+
imageHeight = "twitter:image:height",
|
|
1373
|
+
label1 = "twitter:label1",
|
|
1374
|
+
data1 = "twitter:data1",
|
|
1375
|
+
label2 = "twitter:label2",
|
|
1376
|
+
data2 = "twitter:data2",
|
|
1377
|
+
appNameIphone = "twitter:app:name:iphone",
|
|
1378
|
+
appIdIphone = "twitter:app:id:iphone",
|
|
1379
|
+
appUrlIphone = "twitter:app:url:iphone",
|
|
1380
|
+
appNameIpad = "twitter:app:name:ipad",
|
|
1381
|
+
appIdIpad = "twitter:app:id:ipad",
|
|
1382
|
+
appUrlIpad = "twitter:app:url:ipad",
|
|
1383
|
+
appNameGooglePlay = "twitter:app:name:googleplay",
|
|
1384
|
+
appIdGooglePlay = "twitter:app:id:googleplay",
|
|
1385
|
+
appUrlGooglePlay = "twitter:app:url:googleplay",
|
|
1386
|
+
player = "twitter:player",
|
|
1387
|
+
playerWidth = "twitter:player:width",
|
|
1388
|
+
playerHeight = "twitter:player:height",
|
|
1389
|
+
playerStream = "twitter:player:stream",
|
|
1390
|
+
playerStreamContentType = "twitter:player:stream:content_type"
|
|
1391
|
+
}
|
|
1392
|
+
export declare type NormalOrArray<T = NumberOrString> = T | T[];
|
|
1393
|
+
export declare type NormalOrPromise<T> = T | Promise<T>;
|
|
1394
|
+
export declare type NumberOrString = number | string;
|
|
1395
|
+
export declare type NumberOrStringOrBoolean = number | string | boolean;
|
|
1396
|
+
export declare type NumberOrStringOrDate = NumberOrString | Date;
|
|
1397
|
+
export declare type ObjectItem<T = any> = Record<string, T>;
|
|
1398
|
+
export declare type ObjectOrArray<T = any> = T[] | ObjectItem<T>;
|
|
1399
|
+
/** Random integer. */
|
|
1400
|
+
export declare function random(min: number, max: number): number;
|
|
1401
|
+
/** Remove common prefix. */
|
|
1402
|
+
export declare function removeCommonPrefix(mainStr: string, prefix: string): string;
|
|
1403
|
+
/** Replace component name in text. */
|
|
1404
|
+
export declare const replaceComponentName: (text: string | undefined, name: string, componentName: string) => string | undefined;
|
|
1405
|
+
/** Recursive object merge. */
|
|
1406
|
+
export declare function replaceRecursive<I>(array: ObjectItem<I>, replacement?: ObjectOrArray<I>, isMerge?: boolean): ObjectItem<I>;
|
|
1407
|
+
/** Template replacement by object map. */
|
|
1408
|
+
export declare function replaceTemplate(value: string, replaces: Record<string, string | FunctionReturn<string>>): string;
|
|
1409
|
+
/** Resize image to fit max constraints. */
|
|
1410
|
+
export declare function resizeImageByMax(image: HTMLImageElement | string, maxSize: number, type?: ResizeImageByMaxType, typeData?: string): string | undefined;
|
|
1411
|
+
declare type ResizeImageByMaxType = 'auto' | 'width' | 'height';
|
|
1412
|
+
/**
|
|
1413
|
+
* Timer with pause/resume.
|
|
1414
|
+
*/
|
|
1415
|
+
export declare class ResumableTimer {
|
|
1416
|
+
constructor(callback: FunctionVoid, delay?: number, blockStart?: boolean);
|
|
1417
|
+
resume(): this;
|
|
1418
|
+
pause(): this;
|
|
1419
|
+
reset(): this;
|
|
1420
|
+
clear(): this;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Scrollbar width detection.
|
|
1424
|
+
*/
|
|
1425
|
+
export declare class ScrollbarWidth {
|
|
1426
|
+
static is(): Promise<boolean>;
|
|
1427
|
+
static get(): Promise<number>;
|
|
1428
|
+
static getStorage(): DataStorage<number>;
|
|
1429
|
+
static getCalculate(): boolean;
|
|
1430
|
+
}
|
|
1431
|
+
export declare type SearchCache<T extends SearchItem> = SearchCacheItem<T>[];
|
|
1432
|
+
export declare type SearchCacheItem<T extends SearchItem> = {
|
|
1433
|
+
item: T;
|
|
1434
|
+
value: string;
|
|
1435
|
+
};
|
|
1436
|
+
export declare type SearchColumn<T extends SearchItem> = {
|
|
1437
|
+
[K in keyof T]-?: NonNullable<T[K]> extends object ? K | SearchColumnPath<K, keyof NonNullable<T[K]>> : K;
|
|
1438
|
+
}[keyof T];
|
|
1439
|
+
export declare type SearchColumnPath<K, P> = K extends string ? P extends string ? `${K}.${P}` : never : never;
|
|
1440
|
+
export declare type SearchColumns<T extends SearchItem> = (SearchColumn<T> & string)[];
|
|
1441
|
+
export declare type SearchFormatCapitalize<K extends string> = K extends `${infer First}.${infer Rest}` ? `${First}${Capitalize<SearchFormatCapitalize<Rest>>}` : K;
|
|
1442
|
+
export declare type SearchFormatItem<T extends SearchItem, KT extends string[]> = {
|
|
1443
|
+
[K in keyof T | SearchFormatKey<KT[number]>]: K extends keyof T ? T[K] : string;
|
|
1444
|
+
} & {
|
|
1445
|
+
searchActive?: boolean;
|
|
1446
|
+
};
|
|
1447
|
+
export declare type SearchFormatKey<K> = K extends string ? `${SearchFormatCapitalize<K>}Search` : never;
|
|
1448
|
+
export declare type SearchFormatList<T extends SearchItem, K extends string[]> = SearchFormatItem<T, K>[];
|
|
1449
|
+
export declare type SearchItem = Record<string, any>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Searchable list manager.
|
|
1452
|
+
*/
|
|
1453
|
+
export declare class SearchList<T extends SearchItem, K extends SearchColumns<T>> {
|
|
1454
|
+
constructor(list: SearchListValue<T>, columns?: K, value?: string, options?: SearchOptions);
|
|
1455
|
+
getData(): SearchListData<T, K>;
|
|
1456
|
+
getList(): SearchListValue<T>;
|
|
1457
|
+
getColumns(): K | undefined;
|
|
1458
|
+
getItem(): SearchListItem;
|
|
1459
|
+
getValue(): string | undefined;
|
|
1460
|
+
getOptions(): SearchListOptions;
|
|
1461
|
+
setList(list: SearchListValue<T>): this;
|
|
1462
|
+
setColumns(columns?: K): this;
|
|
1463
|
+
setValue(value?: string): this;
|
|
1464
|
+
setOptions(options: SearchOptions): this;
|
|
1465
|
+
to(): SearchFormatList<T, K>;
|
|
1466
|
+
}
|
|
1467
|
+
export declare class SearchListData<T extends SearchItem, K extends SearchColumns<T>> {
|
|
1468
|
+
constructor(list: SearchListValue<T>, columns: K | undefined, item: SearchListItem, options: SearchListOptions);
|
|
1469
|
+
is(): this is this & {
|
|
1470
|
+
list: T[];
|
|
1471
|
+
columns: string[];
|
|
1472
|
+
};
|
|
1473
|
+
isList(): this is this & {
|
|
1474
|
+
list: T[];
|
|
1475
|
+
};
|
|
1476
|
+
getList(): SearchListValue<T>;
|
|
1477
|
+
getColumns(): K | undefined;
|
|
1478
|
+
setList(list: SearchListValue<T>): this;
|
|
1479
|
+
setColumns(columns?: SearchColumns<T>): this;
|
|
1480
|
+
findCacheItem(item: T): SearchCacheItem<T> | undefined;
|
|
1481
|
+
forEach(callback: (item: SearchCacheItem<T>['item'], value: SearchCacheItem<T>['value']) => SearchFormatItem<T, K> | undefined): SearchFormatList<T, K>;
|
|
1482
|
+
toFormatItem(item: T, selection: boolean): SearchFormatItem<T, K>;
|
|
1483
|
+
}
|
|
1484
|
+
export declare class SearchListItem {
|
|
1485
|
+
constructor(value: string | undefined, options: SearchListOptions);
|
|
1486
|
+
is(): this is this & {
|
|
1487
|
+
value: string;
|
|
1488
|
+
};
|
|
1489
|
+
isSearch(): boolean;
|
|
1490
|
+
get(): string;
|
|
1491
|
+
set(value?: string): this;
|
|
1492
|
+
}
|
|
1493
|
+
export declare class SearchListMatcher {
|
|
1494
|
+
constructor(item: SearchListItem, options: SearchListOptions);
|
|
1495
|
+
is(): boolean;
|
|
1496
|
+
isSelection(value: SearchCacheItem<any>['value']): boolean;
|
|
1497
|
+
get(): RegExp | undefined;
|
|
1498
|
+
update(): void;
|
|
1499
|
+
}
|
|
1500
|
+
export declare class SearchListOptions {
|
|
1501
|
+
constructor(options?: SearchOptions | undefined);
|
|
1502
|
+
getOptions(): SearchOptions;
|
|
1503
|
+
getLimit(): number;
|
|
1504
|
+
getReturnEverything(): boolean;
|
|
1505
|
+
getDelay(): number;
|
|
1506
|
+
getFindExactMatch(): boolean;
|
|
1507
|
+
getClassName(): string;
|
|
1508
|
+
setOptions(options: SearchOptions): this;
|
|
1509
|
+
}
|
|
1510
|
+
export declare type SearchListValue<T extends SearchItem> = T[] | undefined;
|
|
1511
|
+
export declare type SearchOptions = {
|
|
1512
|
+
limit?: number;
|
|
1513
|
+
returnEverything?: boolean;
|
|
1514
|
+
delay?: number;
|
|
1515
|
+
findExactMatch?: boolean;
|
|
1516
|
+
classSearchName?: string;
|
|
1517
|
+
};
|
|
1518
|
+
/** Seconds to time string. */
|
|
1519
|
+
export declare function secondToTime(second: number | string | undefined, hasHour?: boolean): string;
|
|
1520
|
+
/**
|
|
1521
|
+
* Server-side data storage for SSR request isolation.
|
|
1522
|
+
*/
|
|
1523
|
+
export declare class ServerStorage {
|
|
1524
|
+
static init(listener: () => Record<string, any>): typeof ServerStorage;
|
|
1525
|
+
static reset(): void;
|
|
1526
|
+
static has(key: string): boolean;
|
|
1527
|
+
static get<T = any>(key: string, defaultValue?: () => T, hydration?: boolean): T;
|
|
1528
|
+
static set<T = any>(key: string, value: () => T, hydration?: boolean): T;
|
|
1529
|
+
static setErrorStatus(hide: boolean): void;
|
|
1530
|
+
static remove(key: string): void;
|
|
1531
|
+
static toString(): string;
|
|
1532
|
+
}
|
|
1533
|
+
/** Modify element property by key. */
|
|
1534
|
+
export declare function setElementItem<E extends ElementOrWindow, K extends keyof E, V extends E[K] = E[K]>(element: ElementOrString<E>, index: K, value: V | Record<string, V>): E | undefined;
|
|
1535
|
+
/** Update value(s) with options for multiple/maxlength. */
|
|
1536
|
+
export declare function setValues<T>(selected: T | T[] | undefined, value: any, { multiple, maxlength, alwaysChange, notEmpty }: {
|
|
1537
|
+
multiple?: boolean | undefined;
|
|
1538
|
+
maxlength?: number | undefined;
|
|
1539
|
+
alwaysChange?: boolean | undefined;
|
|
1540
|
+
notEmpty?: boolean | undefined;
|
|
1541
|
+
}): T | T[] | undefined;
|
|
1542
|
+
/** Delay execution. */
|
|
1543
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
1544
|
+
/** Splicing object values. */
|
|
1545
|
+
export declare function splice<I>(array: ObjectItem<I>, replacement?: ObjectItem<I> | I, indexStart?: string): ObjectItem<I>;
|
|
1546
|
+
/**
|
|
1547
|
+
* Callback registry for storage.
|
|
1548
|
+
*/
|
|
1549
|
+
export declare class StorageCallback<T = any, Callback = (value: T) => void | Promise<void>> {
|
|
1550
|
+
static getInstance<T>(name: string, group?: string): StorageCallback<T, (value: T) => void | Promise<void>>;
|
|
1551
|
+
constructor(name: string, group?: string);
|
|
1552
|
+
isLoading(): boolean;
|
|
1553
|
+
getName(): string;
|
|
1554
|
+
getLoading(): boolean;
|
|
1555
|
+
addCallback(callback: Callback, isOnce?: boolean): this;
|
|
1556
|
+
removeCallback(callback: Callback): this;
|
|
1557
|
+
preparation(): this;
|
|
1558
|
+
run(value: T): Promise<this>;
|
|
1559
|
+
}
|
|
1560
|
+
/** Repeat character count times. */
|
|
1561
|
+
export declare function strFill(value: string, count: number): string;
|
|
1562
|
+
/** Split string with limit; last element contains rest. */
|
|
1563
|
+
export declare function strSplit(value: number | string, separator: string, limit?: number): string[];
|
|
1564
|
+
/** Convert value to array. */
|
|
1565
|
+
export declare function toArray<T>(value: T): T extends any[] ? T : [T];
|
|
1566
|
+
/** Camel Case (upper). */
|
|
1567
|
+
export declare function toCamelCase(value: string): string;
|
|
1568
|
+
/** Camel Case (first letter upper). */
|
|
1569
|
+
export declare function toCamelCaseFirst(value: string): string;
|
|
1570
|
+
/** Convert to Date. */
|
|
1571
|
+
export declare function toDate<T extends Date | number | string>(value?: T): (T & Date) | Date;
|
|
1572
|
+
/** kebab-case conversion. */
|
|
1573
|
+
export declare function toKebabCase(value: string): string;
|
|
1574
|
+
/** Convert to finite floating point number. SSR Safe. */
|
|
1575
|
+
export declare function toNumber(value?: NumberOrString): number;
|
|
1576
|
+
/** Number conversion with max limit and formatting. */
|
|
1577
|
+
export declare function toNumberByMax(value: string | number, max?: string | number, formatting?: boolean, language?: string): string | number;
|
|
1578
|
+
/** Percentage of max. */
|
|
1579
|
+
export declare function toPercent(maxValue: number, value: number): number;
|
|
1580
|
+
/** Percentage of max * 100. */
|
|
1581
|
+
export declare function toPercentBy100(maxValue: number, value: number): number;
|
|
1582
|
+
/** String conversion. Null/undefined returns empty. */
|
|
1583
|
+
declare function toString_2<T>(value: T): string;
|
|
1584
|
+
export { toString_2 as toString }
|
|
1585
|
+
/** String to typed data conversion. */
|
|
1586
|
+
export declare function transformation(value: any, isFunction?: boolean): any;
|
|
1587
|
+
/**
|
|
1588
|
+
* Text translation helper.
|
|
1589
|
+
*/
|
|
1590
|
+
export declare class Translate {
|
|
1591
|
+
static get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
|
|
1592
|
+
static getItem(): TranslateInstance;
|
|
1593
|
+
static getSync(name: string, first?: boolean, replacement?: string[] | Record<string, string | number>): string;
|
|
1594
|
+
static getList<T extends TranslateCode[]>(names: T): Promise<TranslateList<T>>;
|
|
1595
|
+
static getListSync<T extends TranslateCode[]>(names: T, first?: boolean): TranslateList<T>;
|
|
1596
|
+
static add(names: string | string[]): Promise<void>;
|
|
1597
|
+
static addSync(data: Record<string, string>): void;
|
|
1598
|
+
static addNormalOrSync(data: Record<string, string>): Promise<void>;
|
|
1599
|
+
static addSyncByLocation(data: Record<string, Record<string, string>>): void;
|
|
1600
|
+
static addSyncByFile(data: TranslateDataFile): void;
|
|
1601
|
+
static setUrl(url: string): void;
|
|
1602
|
+
static setPropsName(name: string): void;
|
|
1603
|
+
static setReadApi(value: boolean): void;
|
|
1604
|
+
static setConfig(config: TranslateConfig): void;
|
|
1605
|
+
}
|
|
1606
|
+
export declare const TRANSLATE_GLOBAL_PREFIX = "global";
|
|
1607
|
+
export declare const TRANSLATE_TIME_OUT = 160;
|
|
1608
|
+
export declare type TranslateCode = string | string[];
|
|
1609
|
+
export declare type TranslateConfig = {
|
|
1610
|
+
url?: string;
|
|
1611
|
+
propsName?: string;
|
|
1612
|
+
readApi?: boolean;
|
|
1613
|
+
};
|
|
1614
|
+
export declare type TranslateDataFile = Record<string, TranslateDataFileItem>;
|
|
1615
|
+
export declare type TranslateDataFileItem = () => Promise<TranslateDataFileList>;
|
|
1616
|
+
export declare type TranslateDataFileList = Record<string, string>;
|
|
1617
|
+
/**
|
|
1618
|
+
* Translation file management.
|
|
1619
|
+
*/
|
|
1620
|
+
export declare class TranslateFile {
|
|
1621
|
+
constructor(data?: TranslateDataFile, language?: string | (() => string), location?: string | (() => string));
|
|
1622
|
+
isFile(): boolean;
|
|
1623
|
+
getLocation(): string;
|
|
1624
|
+
getLanguage(): string;
|
|
1625
|
+
getList(): Promise<TranslateDataFileList | undefined>;
|
|
1626
|
+
add(data: TranslateDataFile): void;
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Text translation logic.
|
|
1630
|
+
*/
|
|
1631
|
+
export declare class TranslateInstance {
|
|
1632
|
+
constructor(url?: string, propsName?: string, files?: TranslateFile);
|
|
1633
|
+
get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
|
|
1634
|
+
getSync(name: string, first?: boolean, replacement?: string[] | Record<string, string | number>): string;
|
|
1635
|
+
getList<T extends TranslateCode[]>(names: T): Promise<TranslateList<T>>;
|
|
1636
|
+
getListSync<T extends TranslateCode[]>(names: T, first?: boolean): TranslateList<T>;
|
|
1637
|
+
add(names: string | string[]): Promise<void>;
|
|
1638
|
+
addSync(data: Record<string, string>): void;
|
|
1639
|
+
addNormalOrSync(data: Record<string, string>): Promise<void>;
|
|
1640
|
+
addSyncByLocation(data: Record<string, Record<string, string>>): void;
|
|
1641
|
+
addSyncByFile(data: TranslateDataFile): void;
|
|
1642
|
+
setUrl(url: string): this;
|
|
1643
|
+
setPropsName(name: string): this;
|
|
1644
|
+
setReadApi(value: boolean): this;
|
|
1645
|
+
}
|
|
1646
|
+
export declare type TranslateItemOrList<T extends TranslateCode> = T extends string[] ? TranslateList<T> : string;
|
|
1647
|
+
export declare type TranslateList<T extends TranslateCode[]> = {
|
|
1648
|
+
[K in T[number] as K extends readonly string[] ? K[0] : K]: string;
|
|
1649
|
+
};
|
|
1650
|
+
/** Uint8Array to Base64. */
|
|
1651
|
+
export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
|
|
1652
|
+
export declare type Undefined = undefined | null;
|
|
1653
|
+
/** Unique array values. */
|
|
1654
|
+
export declare function uniqueArray<T>(value: T[]): T[];
|
|
1655
|
+
/** Write to clipboard. */
|
|
1656
|
+
export declare function writeClipboardData(text: string): Promise<void>;
|