@dxtmisha/functional-basic 1.14.0 → 2.0.1
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 +163 -0
- package/ai-description.md +3 -3
- package/ai-mcp-resources.json +1 -1
- package/ai-resources/api-reference.md +3 -0
- package/ai-types.md +547 -373
- package/dist/library.d.ts +1184 -393
- package/dist/library.js +1647 -1423
- package/package.json +2 -2
package/ai-types.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
All these methods are in the @dxtmisha/functional-basic (
|
|
1
|
+
All these methods are in the @dxtmisha/functional-basic (v2.0.1) library.
|
|
2
2
|
|
|
3
3
|
```typescript
|
|
4
4
|
/** HTTP client manager for making requests and configuring API settings. @keywords http, client, api, request, fetch */
|
|
@@ -79,18 +79,20 @@ export declare class Cache {
|
|
|
79
79
|
getAsync<T>(name: string, callback: () => T, comparison?: unknown[]): Promise<T>;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
/** Resolves the return type of Cookie.get based on generic type and default fallback. @keywords cookie, return type, fallback */
|
|
83
|
+
export type CookieGet<T, D = undefined> = [D] extends [undefined] ? (T | undefined) : unknown extends T ? (D extends () => infer R ? R : D) : (T | (D extends () => infer R ? R : D));
|
|
84
|
+
/** Cookie manager for reading, writing, and deleting browser cookies. @keywords cookie, storage, browser */
|
|
85
|
+
export declare class Cookie<T = unknown> {
|
|
86
|
+
/** Initializes a Cookie instance for the specified cookie name. @keywords cookie, init, constructor */
|
|
87
|
+
constructor(name: string);
|
|
88
|
+
/** Retrieves a Cookie instance by the specified cookie name. @keywords cookie, getInstance, factory */
|
|
89
|
+
static getInstance<T = unknown>(name: string): Cookie<T>;
|
|
90
|
+
/** Retrieves the cookie value or sets and returns a default value if not set. @keywords cookie, get, read, fallback */
|
|
91
|
+
get<D extends T | string | (() => (T | string)) | undefined = undefined>(defaultValue?: D, options?: CookieOptions): CookieGet<T, D>;
|
|
92
|
+
/** Updates the cookie value with optional configuration parameters. @keywords cookie, set, write, update */
|
|
93
|
+
set(value?: T | string | (() => (T | string)), options?: CookieOptions): void;
|
|
94
|
+
/** Deletes the cookie. @keywords cookie, remove, delete, clear */
|
|
95
|
+
remove(): void;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
/** Manages cookie access and blocking status. @keywords cookie, block, access, permissions */
|
|
@@ -103,9 +105,13 @@ export declare class CookieBlock {
|
|
|
103
105
|
static getItem(): CookieBlockInstance;
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
export type CookieSameSite = 'strict' | 'lax';
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
export type CookieSameSite = 'strict' | 'lax' | 'none';
|
|
109
|
+
/** Resolves return type of CookieStorage.get based on fallback value. @keywords cookie return type */
|
|
110
|
+
export type CookieStorageGet<T, D = undefined> = [
|
|
111
|
+
D
|
|
112
|
+
] extends [
|
|
113
|
+
undefined
|
|
114
|
+
] ? (T | undefined) : unknown extends T ? (D extends () => infer R ? R : D) : T;
|
|
109
115
|
export type CookieOptions = {
|
|
110
116
|
age?: number;
|
|
111
117
|
sameSite?: CookieSameSite;
|
|
@@ -114,216 +120,237 @@ export type CookieOptions = {
|
|
|
114
120
|
secure?: boolean;
|
|
115
121
|
httpOnly?: boolean;
|
|
116
122
|
partitioned?: boolean;
|
|
117
|
-
arguments?: string[] | Record<string,
|
|
123
|
+
arguments?: string[] | Record<string, unknown>;
|
|
118
124
|
};
|
|
119
|
-
|
|
120
|
-
/** Universal cookie storage manager supporting custom listeners for DOM and SSR environments @keywords cookie, storage, ssr, persistence */
|
|
125
|
+
/** Manages cookies with support for DOM, SSR, and custom storage listeners. @keywords cookie storage ssr browser */
|
|
121
126
|
export declare class CookieStorage {
|
|
122
|
-
/** Retrieves
|
|
123
|
-
static get<T
|
|
124
|
-
/**
|
|
125
|
-
static set<T>(name: string, value: T | (() => T), options?: CookieOptions): T;
|
|
126
|
-
/**
|
|
127
|
-
static remove(name: string): void;
|
|
128
|
-
/** Synchronizes and updates
|
|
127
|
+
/** Retrieves a cookie value or returns the default fallback. @keywords cookie get read storage */
|
|
128
|
+
static get<T = unknown, D extends T | (() => T) | undefined = undefined>(name: string, defaultValue?: D, options?: CookieOptions): CookieStorageGet<T, D>;
|
|
129
|
+
/** Writes a cookie value with optional attributes. @keywords cookie set save write */
|
|
130
|
+
static set<T = unknown>(name: string, value: T | (() => T), options?: CookieOptions): T;
|
|
131
|
+
/** Deletes a cookie from storage. @keywords cookie remove delete */
|
|
132
|
+
static remove(name: string, options?: CookieOptions): void;
|
|
133
|
+
/** Synchronizes and updates cache from current cookie sources. @keywords cookie update refresh sync */
|
|
129
134
|
static update(): void;
|
|
130
|
-
/** Clears
|
|
135
|
+
/** Clears in-memory items and resets listeners to default state. @keywords cookie reset clear */
|
|
131
136
|
static reset(): void;
|
|
132
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Initializes storage listeners and hooks for custom or SSR runtimes.
|
|
139
|
+
* @remarks When omitted, DOM runtime defaults to `document.cookie`, while non-DOM/SSR falls back to in-memory caching.
|
|
140
|
+
* @keywords cookie init setup listeners ssr
|
|
141
|
+
*/
|
|
133
142
|
static init(getListener?: (key: string) => unknown, getListenerRaw?: () => string, setListener?: (key: string, value: string, cookie: string, options?: CookieOptions) => void): void;
|
|
134
143
|
}
|
|
135
144
|
|
|
136
|
-
/**
|
|
137
|
-
export
|
|
138
|
-
|
|
145
|
+
/** Resolution type for DataStorage.get return value with fallback handling. @keywords storage, return type */
|
|
146
|
+
export type DataStorageGet<T, D = undefined> = [
|
|
147
|
+
D
|
|
148
|
+
] extends [
|
|
149
|
+
undefined
|
|
150
|
+
] ? (T | undefined) : unknown extends T ? (D extends () => infer R ? R : D) : T;
|
|
151
|
+
/** Manages localStorage and sessionStorage with prefixing, expiration caching, and SSR request isolation. @keywords storage, localStorage, sessionStorage, cache, ssr */
|
|
152
|
+
export declare class DataStorage<T = unknown> {
|
|
153
|
+
/** Initializes storage instance with key name, storage target, and error handler. @keywords storage, constructor, session */
|
|
139
154
|
constructor(name: string, isSession?: boolean, errorCenter?: ErrorCenterInstance);
|
|
140
|
-
/** Retrieves
|
|
141
|
-
get
|
|
142
|
-
/**
|
|
155
|
+
/** Retrieves item from storage with optional default fallback and cache TTL in seconds. @keywords storage, get, read, cache */
|
|
156
|
+
get<D extends T | (() => T) | undefined = undefined>(defaultValue?: D, cache?: number): DataStorageGet<T, D>;
|
|
157
|
+
/** Writes value or generator result to storage. @keywords storage, set, write */
|
|
143
158
|
set(value?: T | (() => T)): T | undefined;
|
|
144
|
-
/**
|
|
159
|
+
/** Returns fully-qualified storage key including prefix. @keywords storage, key, index, prefix */
|
|
160
|
+
getIndex(): string;
|
|
161
|
+
/** Sets process-wide key prefix for bootstrapping. @note Applies globally to entire runtime process in SSR. @keywords storage, prefix, config */
|
|
145
162
|
static setPrefix(newPrefix: string): void;
|
|
146
|
-
/**
|
|
163
|
+
/** Deletes item from storage. @keywords storage, remove, delete, clear */
|
|
147
164
|
remove(): this;
|
|
148
|
-
/** Synchronizes data from storage
|
|
165
|
+
/** Synchronizes and refreshes data from storage. @keywords storage, sync, update, refresh */
|
|
149
166
|
update(): this;
|
|
150
167
|
}
|
|
151
168
|
|
|
152
169
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* @
|
|
156
|
-
* Creating a `Datetime` instance without a specific date (using the current time)
|
|
157
|
-
* for rendering in SSR may lead to hydration mismatches because the time or time zone
|
|
158
|
-
* on the server may differ from the time on the client.
|
|
159
|
-
* @keywords datetime, date, calendar, timezone, localization, intl
|
|
170
|
+
* Class for working with dates, time, and internationalized calendar calculations.
|
|
171
|
+
* @remarks Creating a `Datetime` instance without a specific date (using the current time) for rendering in SSR may lead to hydration mismatches because the time or time zone on the server may differ from the time on the client.
|
|
172
|
+
* @keywords datetime, date, calendar, time, timezone, intl
|
|
160
173
|
*/
|
|
161
174
|
export declare class Datetime {
|
|
162
|
-
/**
|
|
175
|
+
/** Initializes a Datetime instance with date, format type, and locale. @keywords init, constructor */
|
|
163
176
|
constructor(date?: NumberOrStringOrDate, type?: GeoDate, code?: string);
|
|
164
|
-
/**
|
|
177
|
+
/** Returns the GeoIntl internationalization helper instance. @keywords intl, localization, format */
|
|
165
178
|
getIntl(): GeoIntl;
|
|
166
|
-
/**
|
|
179
|
+
/** Returns the underlying native Date instance. @keywords date, native */
|
|
167
180
|
getDate(): Date;
|
|
168
|
-
/**
|
|
181
|
+
/** Returns the date output format type. @keywords type, format */
|
|
169
182
|
getType(): GeoDate;
|
|
170
|
-
/**
|
|
183
|
+
/** Returns the hour display format type. @keywords hours, format */
|
|
171
184
|
getHoursType(): GeoHours;
|
|
172
|
-
/** Checks whether 24-hour time format is enabled. @keywords
|
|
185
|
+
/** Checks whether the 24-hour time format is enabled. @keywords 24-hour, time format */
|
|
173
186
|
getHour24(): boolean;
|
|
174
|
-
/** Returns
|
|
187
|
+
/** Returns the country and language locale code. @keywords locale, language, country, code */
|
|
188
|
+
getCode(): string;
|
|
189
|
+
/** Returns the time zone offset in minutes relative to UTC. @keywords timezone, offset, utc */
|
|
175
190
|
getTimeZoneOffset(): number;
|
|
176
|
-
/**
|
|
191
|
+
/** Returns the formatted time zone string. @keywords timezone, tz */
|
|
177
192
|
getTimeZone(style?: GeoTimeZoneStyle): string;
|
|
178
|
-
/**
|
|
193
|
+
/** Returns the first day of the week code for the current locale. @keywords first day, week, weekday */
|
|
179
194
|
getFirstDayCode(): GeoFirstDay;
|
|
180
|
-
/**
|
|
195
|
+
/** Returns the full year according to local time. @keywords year, local time */
|
|
181
196
|
getYear(): number;
|
|
182
|
-
/**
|
|
197
|
+
/** Returns the 1-based month (1-12) according to local time. @keywords month */
|
|
183
198
|
getMonth(): number;
|
|
184
|
-
/**
|
|
199
|
+
/** Returns the day of the month (1-31) according to local time. @keywords day, day of month */
|
|
185
200
|
getDay(): number;
|
|
186
|
-
/**
|
|
201
|
+
/** Returns the day of the week (0-6) according to local time. @keywords weekday, day of week */
|
|
202
|
+
getWeekday(): number;
|
|
203
|
+
/** Returns the hour (0-23) according to local time. @keywords hour, time */
|
|
187
204
|
getHour(): number;
|
|
188
|
-
/**
|
|
205
|
+
/** Returns the minutes (0-59) according to local time. @keywords minute, time */
|
|
189
206
|
getMinute(): number;
|
|
190
|
-
/**
|
|
207
|
+
/** Returns the seconds (0-59) according to local time. @keywords second, time */
|
|
191
208
|
getSecond(): number;
|
|
192
|
-
/**
|
|
209
|
+
/** Returns the total number of days in the current month (28-31). @keywords max day, days in month */
|
|
193
210
|
getMaxDay(): number;
|
|
194
|
-
/**
|
|
195
|
-
setDate(value
|
|
196
|
-
/** Sets the output
|
|
211
|
+
/** Sets the date value completely. @keywords set date */
|
|
212
|
+
setDate(value?: NumberOrStringOrDate): this;
|
|
213
|
+
/** Sets the date format output type. @keywords set type, format */
|
|
197
214
|
setType(value: GeoDate): this;
|
|
198
|
-
/**
|
|
215
|
+
/** Configures whether to use the 24-hour time format. @keywords 24-hour, format */
|
|
199
216
|
setHour24(value: boolean): this;
|
|
200
|
-
/**
|
|
201
|
-
setCode(code
|
|
202
|
-
/** Registers a
|
|
203
|
-
setWatch(watch
|
|
204
|
-
/** Sets the full year in local time. @keywords
|
|
217
|
+
/** Updates the locale code and triggers watcher notification. @keywords set locale, code */
|
|
218
|
+
setCode(code?: string): this;
|
|
219
|
+
/** Registers a callback invoked whenever date values update. @keywords watch, listener, callback */
|
|
220
|
+
setWatch(watch?: (date: Date, type: GeoDate, hour24: boolean) => void): this;
|
|
221
|
+
/** Sets the full year in local time, clamping day to avoid month overflow. @keywords set year */
|
|
205
222
|
setYear(value: number): this;
|
|
206
|
-
/** Sets the 1-based month (1-12) in local time. @keywords
|
|
223
|
+
/** Sets the 1-based month (1-12) in local time, clamping day to avoid overflow. @keywords set month */
|
|
207
224
|
setMonth(value: number): this;
|
|
208
|
-
/** Sets the day of the month
|
|
225
|
+
/** Sets the day of the month in local time. @keywords set day */
|
|
209
226
|
setDay(value: number): this;
|
|
210
|
-
/** Sets the hour
|
|
227
|
+
/** Sets the hour in local time. @keywords set hour */
|
|
211
228
|
setHour(value: number): this;
|
|
212
|
-
/** Sets the
|
|
229
|
+
/** Sets the minutes in local time. @keywords set minute */
|
|
213
230
|
setMinute(value: number): this;
|
|
214
|
-
/** Sets the
|
|
231
|
+
/** Sets the seconds in local time. @keywords set second */
|
|
215
232
|
setSecond(value: number): this;
|
|
216
|
-
/** Formats date and time according to locale and format options. @keywords locale, format,
|
|
233
|
+
/** Formats date and time according to locale and format options. @keywords locale, format, intl */
|
|
217
234
|
locale(type?: GeoDate, styleOptions?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions): string;
|
|
218
|
-
/** Formats the year according to locale. @keywords
|
|
235
|
+
/** Formats the year according to locale options. @keywords format year, locale */
|
|
219
236
|
localeYear(style?: Intl.DateTimeFormatOptions['year']): string;
|
|
220
|
-
/** Formats the month according to locale. @keywords
|
|
237
|
+
/** Formats the month according to locale options. @keywords format month, locale */
|
|
221
238
|
localeMonth(style?: Intl.DateTimeFormatOptions['month']): string;
|
|
222
|
-
/** Formats the day according to locale. @keywords
|
|
239
|
+
/** Formats the day according to locale options. @keywords format day, locale */
|
|
223
240
|
localeDay(style?: Intl.DateTimeFormatOptions['day']): string;
|
|
224
|
-
/** Formats the hour according to locale. @keywords
|
|
241
|
+
/** Formats the hour according to locale options. @keywords format hour, locale */
|
|
225
242
|
localeHour(style?: Intl.DateTimeFormatOptions['hour']): string;
|
|
226
|
-
/** Formats the minute according to locale. @keywords
|
|
243
|
+
/** Formats the minute according to locale options. @keywords format minute, locale */
|
|
227
244
|
localeMinute(style?: Intl.DateTimeFormatOptions['minute']): string;
|
|
228
|
-
/** Formats the second according to locale. @keywords
|
|
245
|
+
/** Formats the second according to locale options. @keywords format second, locale */
|
|
229
246
|
localeSecond(style?: Intl.DateTimeFormatOptions['second']): string;
|
|
230
|
-
/**
|
|
247
|
+
/** Outputs date in standard format with optional timezone offset. @keywords standard, iso, format */
|
|
231
248
|
standard(timeZone?: boolean): string;
|
|
232
|
-
/** Shifts the date by a
|
|
249
|
+
/** Shifts the date by a given number of years. @keywords move year, shift, offset */
|
|
233
250
|
moveByYear(value: number): this;
|
|
234
|
-
/** Shifts the date by a
|
|
251
|
+
/** Shifts the date by a given number of months. @keywords move month, shift, offset */
|
|
235
252
|
moveByMonth(value: number): this;
|
|
236
|
-
/** Shifts the date by a
|
|
253
|
+
/** Shifts the date by a given number of days. @keywords move day, shift, offset */
|
|
237
254
|
moveByDay(value: number): this;
|
|
238
|
-
/** Shifts the date by a
|
|
255
|
+
/** Shifts the date by a given number of hours. @keywords move hour, shift, offset */
|
|
239
256
|
moveByHour(value: number): this;
|
|
240
|
-
/** Shifts the date by a
|
|
257
|
+
/** Shifts the date by a given number of minutes. @keywords move minute, shift, offset */
|
|
241
258
|
moveByMinute(value: number): this;
|
|
242
|
-
/** Shifts the date by a
|
|
259
|
+
/** Shifts the date by a given number of seconds. @keywords move second, shift, offset */
|
|
243
260
|
moveBySecond(value: number): this;
|
|
244
|
-
/**
|
|
261
|
+
/** Sets the month to January. @keywords january, first month */
|
|
245
262
|
moveMonthFirst(): this;
|
|
246
|
-
/**
|
|
263
|
+
/** Sets the month to December. @keywords december, last month */
|
|
247
264
|
moveMonthLast(): this;
|
|
248
|
-
/**
|
|
265
|
+
/** Moves date to the first day of the next month. @keywords next month */
|
|
249
266
|
moveMonthNext(): this;
|
|
250
|
-
/**
|
|
267
|
+
/** Moves date to the first day of the previous month. @keywords previous month */
|
|
251
268
|
moveMonthPrevious(): this;
|
|
252
|
-
/** Moves
|
|
269
|
+
/** Moves date to the first day of the current week. @keywords first day, week */
|
|
253
270
|
moveWeekdayFirst(): this;
|
|
254
|
-
/** Moves
|
|
271
|
+
/** Moves date to the last day of the current week. @keywords last day, week */
|
|
255
272
|
moveWeekdayLast(): this;
|
|
256
|
-
/** Moves to the first
|
|
273
|
+
/** Moves date to the first day of the first week of the month. @keywords first week, calendar grid */
|
|
257
274
|
moveWeekdayFirstByMonth(): this;
|
|
258
|
-
/** Moves to the
|
|
275
|
+
/** Moves date to the last day of the last week of the month. @keywords last week, calendar grid */
|
|
259
276
|
moveWeekdayLastByMonth(): this;
|
|
260
|
-
/**
|
|
277
|
+
/** Shifts date to the next week. @keywords next week */
|
|
261
278
|
moveWeekdayNext(): this;
|
|
262
|
-
/**
|
|
279
|
+
/** Shifts date to the previous week. @keywords previous week */
|
|
263
280
|
moveWeekdayPrevious(): this;
|
|
264
|
-
/** Moves
|
|
281
|
+
/** Moves date to the first day of the month. @keywords start of month, day first */
|
|
265
282
|
moveDayFirst(): this;
|
|
266
|
-
/** Moves
|
|
283
|
+
/** Moves date to the last day of the month. @keywords end of month, day last */
|
|
267
284
|
moveDayLast(): this;
|
|
268
|
-
/**
|
|
285
|
+
/** Shifts date forward by one day. @keywords next day, tomorrow */
|
|
269
286
|
moveDayNext(): this;
|
|
270
|
-
/**
|
|
287
|
+
/** Shifts date backward by one day. @keywords previous day, yesterday */
|
|
271
288
|
moveDayPrevious(): this;
|
|
272
|
-
/** Clones
|
|
289
|
+
/** Clones date as a native Date instance. @keywords clone date */
|
|
273
290
|
clone(): Date;
|
|
274
|
-
/** Clones
|
|
291
|
+
/** Clones the Datetime instance. @keywords clone datetime */
|
|
275
292
|
cloneClass(): Datetime;
|
|
276
|
-
/** Clones instance and sets month to January. @keywords
|
|
293
|
+
/** Clones Datetime instance and sets month to January. @keywords clone, january */
|
|
277
294
|
cloneMonthFirst(): Datetime;
|
|
278
|
-
/** Clones instance and sets month to December. @keywords
|
|
295
|
+
/** Clones Datetime instance and sets month to December. @keywords clone, december */
|
|
279
296
|
cloneMonthLast(): Datetime;
|
|
280
|
-
/** Clones instance
|
|
297
|
+
/** Clones Datetime instance and shifts one month ahead. @keywords clone, next month */
|
|
281
298
|
cloneMonthNext(): Datetime;
|
|
282
|
-
/** Clones instance
|
|
299
|
+
/** Clones Datetime instance and shifts one month back. @keywords clone, previous month */
|
|
283
300
|
cloneMonthPrevious(): Datetime;
|
|
284
|
-
/** Clones instance set to the first day of the week. @keywords
|
|
301
|
+
/** Clones Datetime instance set to the first day of the week. @keywords clone, start of week */
|
|
285
302
|
cloneWeekdayFirst(): Datetime;
|
|
286
|
-
/** Clones instance set to the last day of the week. @keywords
|
|
303
|
+
/** Clones Datetime instance set to the last day of the week. @keywords clone, end of week */
|
|
287
304
|
cloneWeekdayLast(): Datetime;
|
|
288
|
-
/** Clones instance set to the first
|
|
305
|
+
/** Clones Datetime instance set to the first day of the first week of the month. @keywords clone, calendar start */
|
|
289
306
|
cloneWeekdayFirstByMonth(): Datetime;
|
|
290
|
-
/** Clones instance set to the
|
|
307
|
+
/** Clones Datetime instance set to the last day of the last week of the month. @keywords clone, calendar end */
|
|
291
308
|
cloneWeekdayLastByMonth(): Datetime;
|
|
292
|
-
/** Clones instance
|
|
309
|
+
/** Clones Datetime instance shifted one week ahead. @keywords clone, next week */
|
|
293
310
|
cloneWeekdayNext(): Datetime;
|
|
294
|
-
/** Clones instance
|
|
311
|
+
/** Clones Datetime instance shifted one week back. @keywords clone, previous week */
|
|
295
312
|
cloneWeekdayPrevious(): Datetime;
|
|
296
|
-
/** Clones instance set to the first day of the month. @keywords
|
|
313
|
+
/** Clones Datetime instance set to the first day of the month. @keywords clone, start of month */
|
|
297
314
|
cloneDayFirst(): Datetime;
|
|
298
|
-
/** Clones instance set to the last day of the month. @keywords
|
|
315
|
+
/** Clones Datetime instance set to the last day of the month. @keywords clone, end of month */
|
|
299
316
|
cloneDayLast(): Datetime;
|
|
300
|
-
/** Clones instance
|
|
317
|
+
/** Clones Datetime instance shifted one day ahead. @keywords clone, next day */
|
|
301
318
|
cloneDayNext(): Datetime;
|
|
302
|
-
/** Clones instance
|
|
319
|
+
/** Clones Datetime instance shifted one day back. @keywords clone, previous day */
|
|
303
320
|
cloneDayPrevious(): Datetime;
|
|
304
321
|
}
|
|
305
322
|
|
|
306
|
-
/**
|
|
323
|
+
/** Manages error storage and dispatching. @keywords error management, handler, error center */
|
|
307
324
|
export declare class ErrorCenter {
|
|
308
|
-
/** Retrieves
|
|
309
|
-
static get(code: string, group?:
|
|
310
|
-
/**
|
|
311
|
-
static
|
|
312
|
-
/**
|
|
325
|
+
/** Retrieves a specific error cause by code and group. @keywords get error, find cause */
|
|
326
|
+
static get(code: string, group?: ErrorCenterGroup): ErrorCenterCauseItem | undefined;
|
|
327
|
+
/** Returns the error handler instance. @keywords error handler, get handler */
|
|
328
|
+
static getHandler(): ErrorCenterHandler;
|
|
329
|
+
/** Checks if an error cause exists for a code and group. @keywords check error, has cause */
|
|
330
|
+
static has(code: string, group?: ErrorCenterGroup): boolean;
|
|
331
|
+
/** Returns the global singleton instance of ErrorCenterInstance. @keywords singleton, instance */
|
|
313
332
|
static getItem(): ErrorCenterInstance;
|
|
314
|
-
/** Configures console logging
|
|
333
|
+
/** Configures console logging flag or filter for errors. @keywords console log, filter, debug */
|
|
315
334
|
static setIsConsole(isConsole: ErrorCenterHandlerIsConsole): void;
|
|
316
|
-
/**
|
|
335
|
+
/** Adds an error cause item to storage. @keywords add error, register cause */
|
|
317
336
|
static add(cause: ErrorCenterCauseItem): void;
|
|
318
|
-
/** Registers a global callback executed on any
|
|
337
|
+
/** Registers a global callback executed on any error. @keywords global error callback, listener */
|
|
319
338
|
static addCallback(callback: ErrorCenterHandlerCallback): void;
|
|
320
|
-
/** Registers an error handler
|
|
339
|
+
/** Registers an error handler for a specific group. @keywords register handler, group error */
|
|
321
340
|
static addHandler(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): void;
|
|
322
|
-
/** Registers multiple
|
|
341
|
+
/** Registers multiple error handlers simultaneously. @keywords batch handlers, handler list */
|
|
323
342
|
static addHandlerList(handlers: ErrorCenterHandlerList): void;
|
|
324
|
-
/**
|
|
343
|
+
/** Adds a list of error causes to storage. @keywords batch causes, error list */
|
|
325
344
|
static addList(causes: ErrorCenterCauseList): void;
|
|
326
|
-
/**
|
|
345
|
+
/** Removes an error cause from storage by code and group. @keywords remove error, delete cause */
|
|
346
|
+
static remove(code: string, group?: ErrorCenterGroup): void;
|
|
347
|
+
/** Removes a specific handler or all handlers for a group. @keywords remove handler, unregister */
|
|
348
|
+
static removeHandler(group?: ErrorCenterGroup, handler?: ErrorCenterHandlerCallback): void;
|
|
349
|
+
/** Removes a registered global callback. @keywords remove callback, unbind */
|
|
350
|
+
static removeCallback(callback: ErrorCenterHandlerCallback): void;
|
|
351
|
+
/** Resets all registered handlers and callbacks. @keywords reset, clear handlers */
|
|
352
|
+
static reset(): void;
|
|
353
|
+
/** Dispatches error handling for a given cause. @keywords trigger error, dispatch, notify */
|
|
327
354
|
static on(cause: ErrorCenterCauseItem): void;
|
|
328
355
|
}
|
|
329
356
|
|
|
@@ -387,56 +414,56 @@ export declare class Formatters<Options extends FormattersOptionsList = Formatte
|
|
|
387
414
|
to(): FormattersReturn<List, Options>;
|
|
388
415
|
}
|
|
389
416
|
|
|
390
|
-
/** Static
|
|
417
|
+
/** Static class providing centralized interface for managing locale, country, and time zone data. @keywords geo, locale, country, timezone */
|
|
391
418
|
export declare class Geo {
|
|
392
|
-
/** Returns
|
|
419
|
+
/** Returns current country and language data. @keywords current, geo, country, language */
|
|
393
420
|
static get(): GeoItemFull;
|
|
394
|
-
/** Sets
|
|
395
|
-
static set(code
|
|
396
|
-
/** Resolves geo data by country or language code from
|
|
421
|
+
/** Sets current geographical location and updates instance state. @keywords set, location, locale */
|
|
422
|
+
static set(code?: string, save?: boolean): void;
|
|
423
|
+
/** Resolves geo data by country or language code from global database. @keywords lookup, code, country, language */
|
|
397
424
|
static getByCode(code?: string): GeoItemFull;
|
|
398
|
-
/**
|
|
399
|
-
static getByCodeFull(code
|
|
400
|
-
/**
|
|
401
|
-
static getByCountry(country
|
|
402
|
-
/**
|
|
403
|
-
static getByLanguage(language
|
|
404
|
-
/** Returns
|
|
425
|
+
/** Resolves exact geo data by matching full locale string (e.g., 'en-US'). @keywords lookup, exact, full, locale */
|
|
426
|
+
static getByCodeFull(code?: string): GeoItem | undefined;
|
|
427
|
+
/** Resolves geo data for specific country code. @keywords country, code, lookup */
|
|
428
|
+
static getByCountry(country?: string): GeoItem | undefined;
|
|
429
|
+
/** Resolves geo data for specific language code. @keywords language, code, lookup */
|
|
430
|
+
static getByLanguage(language?: string): GeoItem | undefined;
|
|
431
|
+
/** Returns 2-letter code of current country. @keywords country, code, current */
|
|
405
432
|
static getCountry(): string;
|
|
406
|
-
/** Returns
|
|
433
|
+
/** Returns code for first day of the week for current locale. @keywords firstDay, week, locale */
|
|
407
434
|
static getFirstDay(): string;
|
|
408
|
-
/** Returns fully processed geo data updated with
|
|
435
|
+
/** Returns fully processed geo data updated with current language. @note Deprecated: use get() @keywords item, current, language */
|
|
409
436
|
static getItem(): GeoItemFull;
|
|
410
|
-
/** Returns
|
|
437
|
+
/** Returns 2-letter code of current language. @keywords language, code, current */
|
|
411
438
|
static getLanguage(): string;
|
|
412
|
-
/** Returns
|
|
439
|
+
/** Returns complete list of available countries and regions. @keywords list, countries, regions */
|
|
413
440
|
static getList(): GeoItem[];
|
|
414
|
-
/** Returns
|
|
441
|
+
/** Returns current location string. @keywords location, current */
|
|
415
442
|
static getLocation(): string;
|
|
416
|
-
/** Returns
|
|
417
|
-
static getLocationCountry(): string;
|
|
418
|
-
/** Returns the language code extracted from the location string. @keywords location, language, extract */
|
|
443
|
+
/** Returns country code extracted from current location string. @keywords location, country, code */
|
|
419
444
|
static getLocationLanguage(): string;
|
|
420
|
-
/** Returns
|
|
445
|
+
/** Returns language code extracted from current location string. @keywords location, language, code */
|
|
446
|
+
static getLocationCountry(): string;
|
|
447
|
+
/** Returns request-isolated instance of GeoInstance. @keywords instance, isolated, request */
|
|
421
448
|
static getObject(): GeoInstance;
|
|
422
|
-
/** Returns
|
|
449
|
+
/** Returns combined locale string in standard format (e.g., 'en-US'). @keywords standard, locale, format */
|
|
423
450
|
static getStandard(): string;
|
|
424
|
-
/** Returns
|
|
451
|
+
/** Returns timezone offset in minutes for current context. @keywords timezone, offset, minutes */
|
|
425
452
|
static getTimezone(): number;
|
|
426
|
-
/** Returns
|
|
453
|
+
/** Returns formatted timezone string (e.g., '+00:00') for current context. @keywords timezone, format, offset */
|
|
427
454
|
static getTimezoneFormat(): string;
|
|
428
|
-
/** Sets
|
|
455
|
+
/** Sets custom timezone offset in minutes for current context. @keywords timezone, set, offset */
|
|
429
456
|
static setTimezone(timezone: number): void;
|
|
430
|
-
/** Sets
|
|
431
|
-
static setValueDefault(code?: string | (() => string)): void;
|
|
432
|
-
/** Adds or updates country geo data and merges with existing records. @keywords add, country, update
|
|
433
|
-
static add(country: string, item
|
|
434
|
-
/** Adds or updates multiple
|
|
435
|
-
static addList(list
|
|
436
|
-
/** Resolves geo data for
|
|
437
|
-
static find(code
|
|
438
|
-
/**
|
|
439
|
-
static toStandard(item
|
|
457
|
+
/** Sets default value or resolver for country code. @keywords default, country, code */
|
|
458
|
+
static setValueDefault(code?: string | (() => string | undefined)): void;
|
|
459
|
+
/** Adds or updates country geo data and merges with existing records. @keywords add, country, update */
|
|
460
|
+
static add(country: string, item?: Partial<GeoItem>): GeoInstance;
|
|
461
|
+
/** Adds or updates multiple countries in geo list. @keywords add, batch, countries, list */
|
|
462
|
+
static addList(list?: Record<string, Partial<GeoItem>>): GeoInstance;
|
|
463
|
+
/** Resolves geo data for given code. Alias for getByCode. @note Deprecated: use getByCode() @keywords find, lookup, code */
|
|
464
|
+
static find(code?: string): GeoItemFull;
|
|
465
|
+
/** Formats geo item into standard concatenated locale string (e.g., 'en-US'). @keywords standard, locale, format */
|
|
466
|
+
static toStandard(item?: GeoItem, language?: string, raw?: boolean): string;
|
|
440
467
|
}
|
|
441
468
|
|
|
442
469
|
export declare const GEO_FLAG_ICON_NAME = "f";
|
|
@@ -531,6 +558,24 @@ export declare class GeoIntl {
|
|
|
531
558
|
]): T[];
|
|
532
559
|
}
|
|
533
560
|
|
|
561
|
+
/** Cookie key for storing the geo location code. @keywords cookie, geo, key */
|
|
562
|
+
export declare const UI_GEO_COOKIE_KEY = "ui-geo-code";
|
|
563
|
+
/** Manages and resolves the current location code, storage persistence, and DOM fallbacks. @keywords geo, location, locale, storage */
|
|
564
|
+
export declare class GeoLocation {
|
|
565
|
+
/** Initializes location state from storage, cookies, DOM, or defaults. @keywords constructor, init, geo */
|
|
566
|
+
constructor(valueDefault?: string | (() => string | undefined) | undefined);
|
|
567
|
+
/** Gets the current location code string. @keywords get, location, code */
|
|
568
|
+
get(): string;
|
|
569
|
+
/** Updates the current location code with optional storage and cookie persistence. @keywords set, update, persist */
|
|
570
|
+
set(code?: string, save?: boolean): this;
|
|
571
|
+
/** Gets the country code extracted from the current location. @keywords country, code */
|
|
572
|
+
getCountry(): string;
|
|
573
|
+
/** Gets the language code extracted from the current location. @keywords language, locale */
|
|
574
|
+
getLanguage(): string;
|
|
575
|
+
/** Sets the default location code value or dynamic resolver. @keywords default, fallback */
|
|
576
|
+
setValueDefault(code?: string | (() => string | undefined)): this;
|
|
577
|
+
}
|
|
578
|
+
|
|
534
579
|
/** Manages phone number masks, country codes, and formatting. @keywords phone mask country code parser */
|
|
535
580
|
export declare class GeoPhone {
|
|
536
581
|
/** Retrieves phone code and country mask data by country or language code. @keywords phone mask country code lookup */
|
|
@@ -789,31 +834,30 @@ export declare class SearchList<T extends SearchItem, K extends SearchColumns<T>
|
|
|
789
834
|
to(): SearchFormatList<T, K>;
|
|
790
835
|
}
|
|
791
836
|
|
|
792
|
-
type ServerStorageItem = {
|
|
837
|
+
export type ServerStorageItem = {
|
|
793
838
|
value: unknown;
|
|
794
839
|
hydration: boolean;
|
|
795
840
|
};
|
|
796
|
-
type ServerStorageList = Record<string, ServerStorageItem>;
|
|
797
|
-
/** Manages isolated data storage
|
|
841
|
+
export type ServerStorageList = Record<string, ServerStorageItem>;
|
|
842
|
+
/** Manages request-isolated data storage and client hydration during SSR. @keywords ssr, storage, hydration, context */
|
|
798
843
|
export declare class ServerStorage {
|
|
799
|
-
/**
|
|
800
|
-
static get<T = unknown>(key: string, defaultValue?: () => T, hydration?: boolean): T;
|
|
801
|
-
/** Stores a value produced by a factory function. @keywords set save store cache */
|
|
802
|
-
static set<T = unknown>(key: string, value: () => T, hydration?: boolean, storageList?: ServerStorageList): T;
|
|
803
|
-
/** Checks if a key exists in the storage. @keywords has exists contains key */
|
|
844
|
+
/** Checks whether a key exists in storage. @keywords has, exists, check */
|
|
804
845
|
static has(key: string): boolean;
|
|
805
|
-
/**
|
|
846
|
+
/** Retrieves a value from storage or initializes it with a fallback. @keywords get, read, default, hydration */
|
|
847
|
+
static get<T = unknown>(key: string, defaultValue?: (() => T) | T, hydration?: boolean): T;
|
|
848
|
+
/** Saves a value to storage with optional client hydration flag. @keywords set, store, write, hydration */
|
|
849
|
+
static set<T = unknown>(key: string, value: (() => T) | T, hydration?: boolean, storageList?: ServerStorageList): T;
|
|
850
|
+
/** Sets the visibility of error messages. @keywords error, status, logging */
|
|
806
851
|
static setErrorStatus(hide: boolean): void;
|
|
807
|
-
/** Removes a
|
|
852
|
+
/** Removes a key and its value from storage. @keywords remove, delete, purge */
|
|
808
853
|
static remove(key: string): void;
|
|
809
|
-
/**
|
|
854
|
+
/** Resets the storage state. @keywords reset, clear, flush */
|
|
810
855
|
static reset(): void;
|
|
811
|
-
/** Initializes storage with a context
|
|
856
|
+
/** Initializes storage with a per-request context provider. @keywords init, setup, context, listener */
|
|
812
857
|
static init(listener: () => Record<string, unknown> | undefined): typeof ServerStorage;
|
|
813
|
-
/** Serializes storage state into a script
|
|
858
|
+
/** Serializes hydratable storage state into a script string. @keywords toString, serialize, hydration, script */
|
|
814
859
|
static toString(): string;
|
|
815
860
|
}
|
|
816
|
-
export {};
|
|
817
861
|
|
|
818
862
|
/** Manages storage callback lists and execution state. @keywords storage, callbacks, listeners */
|
|
819
863
|
export declare class StorageCallback<T = unknown, Callback = (value: T) => void | Promise<void>> {
|
|
@@ -919,61 +963,109 @@ export declare class UrlItem {
|
|
|
919
963
|
toJSON(): string;
|
|
920
964
|
}
|
|
921
965
|
|
|
922
|
-
|
|
923
|
-
|
|
966
|
+
export interface AddTagHighlightMatchOptions {
|
|
967
|
+
className?: string;
|
|
968
|
+
shouldEscape?: boolean;
|
|
969
|
+
shouldRemoveTag?: boolean;
|
|
970
|
+
}
|
|
971
|
+
/** Wraps matched substrings in an HTML tag for visual search highlighting. @keywords highlight, search, match, tag, mark, html */
|
|
972
|
+
export declare function addTagHighlightMatch(value?: string | number | null, search?: string | RegExp, options?: AddTagHighlightMatchOptions): string;
|
|
924
973
|
|
|
925
|
-
|
|
926
|
-
|
|
974
|
+
export interface AnyToStringOptions {
|
|
975
|
+
isArrayString?: boolean;
|
|
976
|
+
isBooleanString?: boolean;
|
|
977
|
+
trim?: boolean;
|
|
978
|
+
}
|
|
927
979
|
|
|
928
|
-
/**
|
|
929
|
-
|
|
980
|
+
/**
|
|
981
|
+
* Safely converts any value to a string with configurable array, boolean, and trimming rules.
|
|
982
|
+
* @keywords any to string, convert, cast, serialize, stringify
|
|
983
|
+
* @example
|
|
984
|
+
* anyToString(' Hello ') // => 'Hello'
|
|
985
|
+
* anyToString(' Hello ', { trim: false }) // => ' Hello '
|
|
986
|
+
* anyToString([1, 2, 3]) // => '1,2,3'
|
|
987
|
+
* anyToString([1, 2, 3], { isArrayString: false }) // => '[1,2,3]'
|
|
988
|
+
* anyToString({ a: 1 }) // => '{"a":1}'
|
|
989
|
+
* anyToString(true) // => '1'
|
|
990
|
+
* anyToString(false) // => '0'
|
|
991
|
+
* anyToString(true, { isBooleanString: true }) // => 'true'
|
|
992
|
+
* anyToString(false, { isBooleanString: true }) // => 'false'
|
|
993
|
+
* anyToString(null) // => ''
|
|
994
|
+
*/
|
|
995
|
+
export declare function anyToString<V = unknown>(value?: V, options?: AnyToStringOptions): string;
|
|
996
|
+
|
|
997
|
+
/** Replaces template placeholders in text with values from an object or array. @keywords template, replace, interpolate, string format, placeholders */
|
|
998
|
+
export declare function applyTemplate(text: unknown, replacement?: Record<string, unknown> | readonly unknown[]): string;
|
|
930
999
|
|
|
931
1000
|
/** Creates an array of specified length filled with the given value. @keywords array, fill, repeat, populate, initialize */
|
|
932
1001
|
export declare function arrFill<T>(value: T, count: number): T[];
|
|
933
1002
|
|
|
934
|
-
/** Converts a Blob to a Base64 string, optionally
|
|
935
|
-
export declare function blobToBase64(blob
|
|
1003
|
+
/** Converts a Blob to a Base64 string, optionally removing the data URL prefix. @keywords blob, base64, convert, data url, file, encode */
|
|
1004
|
+
export declare function blobToBase64(blob?: Blob | null, clean?: boolean): Promise<string | undefined>;
|
|
936
1005
|
|
|
937
|
-
/** Capitalizes the first letter of a string. @keywords capitalize, uppercase,
|
|
938
|
-
export declare function capitalize<T
|
|
1006
|
+
/** Capitalizes the first letter of a string. @keywords capitalize, uppercase, first letter, string */
|
|
1007
|
+
export declare function capitalize<T = string>(value?: T, locale?: boolean | string): T extends string ? Capitalize<T> : string;
|
|
939
1008
|
|
|
940
|
-
/** Creates a deep copy of an object to prevent
|
|
1009
|
+
/** Creates a deep copy of an object to prevent unintended mutations. @keywords deep copy clone duplicate object */
|
|
941
1010
|
export declare function copyObject<T>(value: T): T;
|
|
942
1011
|
|
|
943
|
-
/** Creates a
|
|
944
|
-
export declare function copyObjectLite<T, R = T>(value
|
|
1012
|
+
/** Creates a shallow copy of an object with optional additional properties. @keywords copy, clone, shallow copy, object lite, merge */
|
|
1013
|
+
export declare function copyObjectLite<T = Record<PropertyKey, unknown>, R = T>(value?: T | null, source?: Record<PropertyKey, unknown> | null): R;
|
|
945
1014
|
|
|
946
1015
|
/**
|
|
947
|
-
* Creates an HTML element, configures
|
|
948
|
-
* @remarks
|
|
949
|
-
* @keywords createElement,
|
|
1016
|
+
* Creates an HTML element, configures attributes or runs a modifier callback, and optionally appends it to a parent node.
|
|
1017
|
+
* @remarks Returns `undefined` during SSR. Uses `document.createElement`; use `document.createElementNS` for SVG/MathML. Sanitize input when providing `innerHTML` through options.
|
|
1018
|
+
* @keywords createElement, dom, html, create element, insert node
|
|
950
1019
|
*/
|
|
951
|
-
export declare function createElement<T extends HTMLElement>(parentElement?: Element | DocumentFragment, tagName?: string, options?: Partial<T> | Record<string, unknown> | ((element: T) => void), referenceElement?: Node | null): T | undefined;
|
|
1020
|
+
export declare function createElement<T extends HTMLElement = HTMLDivElement>(parentElement?: Element | DocumentFragment | null, tagName?: string, options?: Partial<T> | Record<string, unknown> | ((element: T) => void) | null, referenceElement?: Node | null): T | undefined;
|
|
952
1021
|
|
|
953
|
-
/**
|
|
954
|
-
|
|
1022
|
+
/**
|
|
1023
|
+
* Executes a callback when DOMContentLoaded fires, or immediately if the DOM is already loaded.
|
|
1024
|
+
* @remarks In non-DOM environments (SSR), execution can be disabled by passing `isServer: false`.
|
|
1025
|
+
* @keywords dom, ready, domContentLoaded, ssr, readyState, event
|
|
1026
|
+
*/
|
|
1027
|
+
export declare function domContentLoaded<T = void>(callback?: (() => T | Promise<T>) | null, isServer?: boolean): Promise<T>;
|
|
955
1028
|
|
|
956
|
-
/**
|
|
1029
|
+
/**
|
|
1030
|
+
* Returns an array of all elements at the specified coordinates.
|
|
1031
|
+
* @remarks In non-DOM (SSR) environments or when `document.elementsFromPoint` is unsupported, the function returns an empty array `[]`. Coordinates are evaluated relative to the viewport.
|
|
1032
|
+
* @keywords dom, elementsFromPoint, hit test, coordinates, viewport elements
|
|
1033
|
+
*/
|
|
1034
|
+
export declare function domElementsFromPoint(coordinator?: ImageCoordinator | null): Element[];
|
|
1035
|
+
|
|
1036
|
+
/** Selects the first element matching the specified selectors. @keywords dom, querySelector, find element */
|
|
957
1037
|
export declare function domQuerySelector<E extends Element = Element>(selectors: string): E | undefined;
|
|
958
1038
|
|
|
959
|
-
/** Selects all elements matching the specified selectors. @keywords dom, querySelectorAll,
|
|
1039
|
+
/** Selects all DOM elements matching the specified selectors. @keywords dom, querySelectorAll, selector, query, elements */
|
|
960
1040
|
export declare function domQuerySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E> | undefined;
|
|
961
1041
|
|
|
962
|
-
/**
|
|
963
|
-
|
|
1042
|
+
/**
|
|
1043
|
+
* Encodes special characters for safe use in HTML attributes.
|
|
1044
|
+
* @keywords html, attribute, encode, escape, sanitize
|
|
1045
|
+
* @example
|
|
1046
|
+
*
|
|
1047
|
+
* encodeAttribute('<div class="box">') // => '<div class="box">'
|
|
1048
|
+
* encodeAttribute(undefined) // => ''
|
|
1049
|
+
*
|
|
1050
|
+
*/
|
|
1051
|
+
export declare function encodeAttribute(text?: string | number | null): string;
|
|
964
1052
|
|
|
965
1053
|
/**
|
|
966
|
-
* Encodes basic HTML characters (<, >, &) while preserving quotes.
|
|
967
|
-
* @
|
|
968
|
-
* @
|
|
1054
|
+
* Encodes basic HTML special characters (<, >, &) while preserving quotes.
|
|
1055
|
+
* @keywords html encode, escape html, lite attribute, html entities, title encode
|
|
1056
|
+
* @example
|
|
1057
|
+
* encodeLiteAttribute('Tom & Jerry') // => 'Tom & Jerry'
|
|
1058
|
+
* encodeLiteAttribute('<title> "Hello" </title>') // => '<title> "Hello" </title>'
|
|
1059
|
+
* encodeLiteAttribute(undefined) // => ''
|
|
1060
|
+
* @remarks Does NOT encode quotes (" and '). For untrusted input inside HTML attributes, use `encodeAttribute`.
|
|
969
1061
|
*/
|
|
970
|
-
export declare function encodeLiteAttribute(text
|
|
1062
|
+
export declare function encodeLiteAttribute(text?: string | number | null): string;
|
|
971
1063
|
|
|
972
1064
|
/** Resizes an image if it exceeds the maximum size, returning base64 encoded data. @keywords resize, compress, image, max size, base64 */
|
|
973
1065
|
export declare function ensureMaxSize(file: Uint8Array, compress?: number, type?: string): Promise<string>;
|
|
974
1066
|
|
|
975
|
-
/** Escapes special regex characters in a string for safe
|
|
976
|
-
export declare function escapeExp(value
|
|
1067
|
+
/** Escapes special regex characters in a string or number for safe RegExp usage. @keywords escape, regex, regexp, sanitize, pattern */
|
|
1068
|
+
export declare function escapeExp(value?: string | number | null): string;
|
|
977
1069
|
|
|
978
1070
|
/** Stops event propagation in the DOM tree. @keywords event, stopPropagation, prevent bubbling */
|
|
979
1071
|
export declare function eventStopPropagation(event: Event): void;
|
|
@@ -984,20 +1076,15 @@ export declare function executeFunction<T, Args extends unknown[] = unknown[]>(c
|
|
|
984
1076
|
/** Safely executes a function, promise, or static value and awaits its resolution. @keywords execute promise, async executor, run promise, safe call */
|
|
985
1077
|
export declare function executePromise<T, Args extends unknown[] = unknown[]>(callback: ((...args: Args) => PromiseLike<T> | T) | PromiseLike<T> | T, ...args: Args): Promise<Awaited<T>>;
|
|
986
1078
|
|
|
987
|
-
|
|
988
|
-
export type
|
|
989
|
-
/** Resolves key type based on collection structure. @keywords key type inference */
|
|
1079
|
+
export type ForEachData<T = any> = readonly T[] | Record<PropertyKey, T> | Map<unknown, T> | Set<T> | object;
|
|
1080
|
+
export type ForEachItem<D> = D extends readonly (infer T)[] ? T : D extends Set<infer S> ? S : D extends Map<unknown, infer V> ? V : D extends object ? D[keyof D] : unknown;
|
|
990
1081
|
export type ForEachKey<D> = D extends readonly unknown[] ? number : D extends Set<infer S> ? S : D extends Map<infer K, unknown> ? K : string;
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
/** Iterates over
|
|
996
|
-
export declare function
|
|
997
|
-
/** Iterates over an object record and returns mapped callback results. @keywords forEach record object iterate */
|
|
998
|
-
export declare function forEach<T, R, D extends Record<string, unknown> = Record<string, T>>(data: D & Record<string, T>, callback: (item: T, key: string, collection: D) => R, saveUndefined?: boolean): R[];
|
|
999
|
-
/** Iterates over a collection and returns mapped callback results. @keywords forEach collection iterate */
|
|
1000
|
-
export declare function forEach<T, R, D extends ForEachData<T> = ForEachData<T>, K = ForEachKey<D>>(data: D & ForEachData<T>, callback: (item: T, key: K, collection: D) => R, saveUndefined?: boolean): R[];
|
|
1082
|
+
export type ForEachReturn<R, S extends boolean = false> = (S extends true ? R : Exclude<R, undefined>)[];
|
|
1083
|
+
/** Iterates over collection items (Array, Object, Map, Set) executing a callback and returning mapped results, omitting undefined unless specified. @keywords foreach, iterate, map, collection, array, object, set */
|
|
1084
|
+
export declare function forEach<T = any, R = any, D extends ForEachData<T> = ForEachData<T>, K = ForEachKey<D>, S extends boolean = false>(data: D, callback: (item: D extends object ? ForEachItem<D> : T, key: K, collection: D) => R, saveUndefined?: S): ForEachReturn<R, S>;
|
|
1085
|
+
|
|
1086
|
+
/** Iterates over own enumerable object properties safely skipping prototype pollution keys, supporting early exit when false is returned. @keywords forOwn, iterate, loop, object, enumerable, prototype pollution */
|
|
1087
|
+
export declare function forOwn<T extends object = Record<string, unknown>, K extends Extract<keyof T, string> = Extract<keyof T, string>>(data?: T, callback?: (value: T[K], key: K, collection: T) => void | boolean): void;
|
|
1001
1088
|
|
|
1002
1089
|
/** Cyclically calls requestAnimationFrame while the next predicate returns true. @keywords requestAnimationFrame animation loop frame ticker */
|
|
1003
1090
|
export declare function frame(callback: (timestamp: DOMHighResTimeStamp) => void, next?: (timestamp: DOMHighResTimeStamp) => boolean, end?: () => void): void;
|
|
@@ -1028,8 +1115,8 @@ export declare function getCurrentDate(format?: GeoDate): string;
|
|
|
1028
1115
|
*/
|
|
1029
1116
|
export declare function getCurrentTime(): number;
|
|
1030
1117
|
|
|
1031
|
-
/**
|
|
1032
|
-
export declare function getElement<E extends ElementOrWindow, R extends
|
|
1118
|
+
/** Resolves a selector string, Element, or Window to a DOM element (or document.body for Window). @keywords element, querySelector, getElement, resolve, dom, window, ssr */
|
|
1119
|
+
export declare function getElement<E extends ElementOrWindow = HTMLElement, R extends ElementResolved<E> = ElementResolved<E>>(element?: ElementOrString<E> | null): R | undefined;
|
|
1033
1120
|
|
|
1034
1121
|
/** Returns or generates a unique element ID, targeting document.body if Window is provided. @keywords element id, get id, generate id, dom id */
|
|
1035
1122
|
export declare function getElementId<E extends ElementOrWindow>(element?: ElementOrString<E>, selector?: string): string;
|
|
@@ -1050,17 +1137,24 @@ export declare function initGetElementId(newListener: () => string | number): vo
|
|
|
1050
1137
|
export declare function resetGetElementId(): void;
|
|
1051
1138
|
|
|
1052
1139
|
export type GetElementImageCallback = (image: HTMLImageElement, event?: Event | string) => void;
|
|
1053
|
-
/**
|
|
1054
|
-
|
|
1140
|
+
/**
|
|
1141
|
+
* Resolves or creates an HTMLImageElement from an existing element or URL string.
|
|
1142
|
+
* @remarks
|
|
1143
|
+
* If `image` is a string, a new `HTMLImageElement` is created with load and error callbacks attached before assigning `src`.
|
|
1144
|
+
* If already an `HTMLImageElement`, it is returned directly. Returns `undefined` for null, undefined, or in SSR environments.
|
|
1145
|
+
* Created elements are not attached to the DOM tree.
|
|
1146
|
+
* @keywords image, HTMLImageElement, load image, image loader, create element, DOM
|
|
1147
|
+
*/
|
|
1148
|
+
export declare function getElementImage(image?: HTMLImageElement | string | null, onload?: GetElementImageCallback, onerror?: GetElementImageCallback): HTMLImageElement | undefined;
|
|
1055
1149
|
|
|
1056
|
-
/** Retrieves an element
|
|
1057
|
-
export declare function getElementItem<
|
|
1150
|
+
/** Retrieves an element property by key, resolving to document.body for Window instances, or returning a default value. @keywords element property get value dom window document */
|
|
1151
|
+
export declare function getElementItem<E extends ElementOrWindow = HTMLElement, K extends keyof ElementResolved<E> = keyof ElementResolved<E>, D = undefined>(element?: ElementOrString<E> | null, property?: K | string | number, defaultValue?: D): ElementResolved<E>[K] | D;
|
|
1058
1152
|
|
|
1059
|
-
/** Resolves
|
|
1060
|
-
export declare function getElementOrWindow<E extends ElementOrWindow>(element?: ElementOrString<E>): E | undefined;
|
|
1153
|
+
/** Resolves the specified selector or element, returning the Element or preserving the Window object directly. @keywords dom, window, element, selector, querySelector, getElementOrWindow */
|
|
1154
|
+
export declare function getElementOrWindow<E extends ElementOrWindow = HTMLElement>(element?: ElementOrString<E> | null): E | undefined;
|
|
1061
1155
|
|
|
1062
|
-
/** Generates a safe script tag
|
|
1063
|
-
export declare function getElementSafeScript<T = unknown>(id: string, data
|
|
1156
|
+
/** Generates a safe HTML script tag containing serialized data for client hydration. @keywords safe script, hydration, state transfer, serialization, html */
|
|
1157
|
+
export declare function getElementSafeScript<T = unknown>(id: string | number, data?: T): string;
|
|
1064
1158
|
|
|
1065
1159
|
/** Creates a case-insensitive regular expression for an exact match of a phrase without anchors. @keywords regex, regular expression, exact match, search pattern */
|
|
1066
1160
|
export declare function getExactSearchExp(search: string): RegExp;
|
|
@@ -1068,14 +1162,14 @@ export declare function getExactSearchExp(search: string): RegExp;
|
|
|
1068
1162
|
/** Creates a RegExp object with the escaped value substituted into the pattern. @keywords regex, regexp, pattern, match, escape */
|
|
1069
1163
|
export declare function getExp(value: string, flags?: string, pattern?: string): RegExp;
|
|
1070
1164
|
|
|
1071
|
-
/** Returns the first element of an array or object. @keywords first, head, element, array, object
|
|
1072
|
-
export declare function getFirst<T>(value
|
|
1165
|
+
/** Returns the first element of an array or object. @keywords first, head, element, array, object */
|
|
1166
|
+
export declare function getFirst<T = undefined>(value?: T | readonly T[] | Record<PropertyKey, T>): T;
|
|
1073
1167
|
|
|
1074
|
-
/** Retrieves and parses JSON hydration data from a
|
|
1075
|
-
export declare function getHydrationData<T>(id: string, defaultValue: T, remove?: boolean): T;
|
|
1168
|
+
/** Retrieves and parses JSON hydration data from a script element in the DOM. @keywords hydration, script tag, json parse, dom state */
|
|
1169
|
+
export declare function getHydrationData<T>(id: string | number, defaultValue: T, remove?: boolean): T;
|
|
1076
1170
|
|
|
1077
|
-
/**
|
|
1078
|
-
export declare function getImageSrc(image?: HTMLImageElement | string): string;
|
|
1171
|
+
/** Extracts the image source string from an HTMLImageElement, object with a src property, or string URL. @keywords image, src, url, source, extract */
|
|
1172
|
+
export declare function getImageSrc(image?: HTMLImageElement | Record<string, unknown> | string | null): string;
|
|
1079
1173
|
|
|
1080
1174
|
/** Retrieves a nested value from an object by its path. @keywords get by path, object path, nested property, deep get */
|
|
1081
1175
|
export declare function getItemByPath<T extends Record<string, unknown>, R = string>(item: T, path: string): R | undefined;
|
|
@@ -1083,8 +1177,8 @@ export declare function getItemByPath<T extends Record<string, unknown>, R = str
|
|
|
1083
1177
|
/** Returns the pressed key from a keyboard event. @keywords keyboard, key, event, pressed key */
|
|
1084
1178
|
export declare function getKey(event: KeyboardEvent): string | number | undefined;
|
|
1085
1179
|
|
|
1086
|
-
/** Returns the last element of an array or object. @keywords last, element, array, object
|
|
1087
|
-
export declare function getLast<T>(value
|
|
1180
|
+
/** Returns the last element of an array or object. @keywords last, element, tail, array, object */
|
|
1181
|
+
export declare function getLast<T = undefined>(value?: T | readonly T[] | Record<PropertyKey, T>): T;
|
|
1088
1182
|
|
|
1089
1183
|
/** Returns the length or size of arrays, objects, maps, sets, or strings, or 0 if unsupported or empty. @keywords length, size, count, collection, array, object, map, set, string */
|
|
1090
1184
|
export declare function getLength(value: unknown): number;
|
|
@@ -1115,6 +1209,9 @@ export declare function getObjectNoUndefined<V>(data: readonly V[], exception?:
|
|
|
1115
1209
|
/** Removes properties matching the exception value from an object. @keywords filter, omit, clean, undefined, compact */
|
|
1116
1210
|
export declare function getObjectNoUndefined<T extends Record<PropertyKey, unknown>>(data: T, exception?: unknown): T;
|
|
1117
1211
|
|
|
1212
|
+
/** Creates a prototype-less object (`Object.create(null)`), optionally copying properties from the provided data. @keywords object create null prototype dictionary clean */
|
|
1213
|
+
export declare function getObjectNull<T = unknown>(data?: Record<string, T>): Record<string, T>;
|
|
1214
|
+
|
|
1118
1215
|
/** Returns the object if its values are set, or an empty object. @keywords object fallback empty validate */
|
|
1119
1216
|
export declare function getObjectOrNone<T>(value: T): T & Record<string, unknown>;
|
|
1120
1217
|
|
|
@@ -1130,11 +1227,11 @@ export declare function getRandomText(min: number, max: number, symbol?: string,
|
|
|
1130
1227
|
/** Serializes an object or array into a key-value request string. @keywords request string, query string, serialize, key value, params */
|
|
1131
1228
|
export declare function getRequestString(request: Record<string, unknown> | readonly unknown[], sign?: string, separator?: string, subKey?: string): string;
|
|
1132
1229
|
|
|
1133
|
-
/** Builds a case-insensitive RegExp matching strings containing all
|
|
1134
|
-
export declare function getSearchExp(search
|
|
1230
|
+
/** Builds a case-insensitive RegExp matching strings containing all specified words in any order. @keywords regex search query multi-word lookahead */
|
|
1231
|
+
export declare function getSearchExp(search?: unknown, limit?: number): RegExp;
|
|
1135
1232
|
|
|
1136
|
-
/** Creates a case-insensitive, global
|
|
1137
|
-
export declare function getSeparatingSearchExp(search
|
|
1233
|
+
/** Creates a case-insensitive, global word-separating search RegExp or clones an existing RegExp. @keywords search regexp regex query filter words */
|
|
1234
|
+
export declare function getSeparatingSearchExp(search?: unknown, limit?: number): RegExp;
|
|
1138
1235
|
|
|
1139
1236
|
/** Calculates the step value as a percentage within a min-max range. @keywords step, percent, range, slider, scale */
|
|
1140
1237
|
export declare function getStepPercent(min: number | undefined, max: number): number;
|
|
@@ -1154,8 +1251,11 @@ export declare function goScrollTo(container?: HTMLElement | Element | null, ele
|
|
|
1154
1251
|
/** Invokes the native sharing mechanism via the Web Share API. @keywords share, web share api, navigator share, device share */
|
|
1155
1252
|
export declare function handleShare(data: ShareData): Promise<boolean>;
|
|
1156
1253
|
|
|
1157
|
-
/** Checks if an object has the specified own property. @keywords hasKey, hasOwnProperty,
|
|
1158
|
-
export declare function hasKey<K extends PropertyKey, T extends object = Record<K, unknown>>(object: unknown, key: K): object is T & Record<K, unknown>;
|
|
1254
|
+
/** Checks if an object has the specified own property. @keywords hasKey, hasOwnProperty, object, key, property check */
|
|
1255
|
+
export declare function hasKey<K extends PropertyKey = PropertyKey, T extends object = Record<K, unknown>>(object: unknown, key: K): object is T & Record<K, unknown>;
|
|
1256
|
+
|
|
1257
|
+
/** Checks whether an object has at least one own property. @keywords hasKeys, object, keys, own properties, not empty */
|
|
1258
|
+
export declare function hasKeys<T extends object = Record<PropertyKey, unknown>>(object: unknown): object is T;
|
|
1159
1259
|
|
|
1160
1260
|
/** Checks if a value exists within the specified array. @keywords inArray, array, includes, contains, search */
|
|
1161
1261
|
export declare function inArray<T>(array: T[], value: T): boolean;
|
|
@@ -1169,7 +1269,7 @@ export declare function intersectKey<T extends Record<PropertyKey, unknown>, C e
|
|
|
1169
1269
|
/** Checks if the API response indicates success. @keywords api, response, success, status, check */
|
|
1170
1270
|
export declare function isApiSuccess<T>(data?: ApiData<T>): boolean;
|
|
1171
1271
|
|
|
1172
|
-
/** Checks if a value is an array. @keywords isArray, array
|
|
1272
|
+
/** Checks if a value is an array. @keywords isArray, array, type guard */
|
|
1173
1273
|
export declare function isArray<T = unknown>(value: unknown): value is T[];
|
|
1174
1274
|
|
|
1175
1275
|
/** Checks if the values of two objects are different. @keywords compare, diff, equality, object difference */
|
|
@@ -1181,19 +1281,19 @@ export declare function isDomData(): boolean;
|
|
|
1181
1281
|
/** Checks whether code is running in a browser environment with `window` available. @keywords dom, browser, runtime, window, client */
|
|
1182
1282
|
export declare function isDomRuntime(): boolean;
|
|
1183
1283
|
|
|
1184
|
-
/** Checks if an element is visible
|
|
1185
|
-
export declare function isElementVisible<E extends ElementOrWindow>(elementSelectors?: ElementOrString<E>): boolean;
|
|
1284
|
+
/** Checks if an element is visible in the DOM and not hidden by CSS. @keywords visibility, dom, is visible, element, hidden */
|
|
1285
|
+
export declare function isElementVisible<E extends ElementOrWindow = HTMLElement>(elementSelectors?: ElementOrString<E> | null): boolean;
|
|
1186
1286
|
|
|
1187
1287
|
/** Checks if the pressed key is Enter or Space (WAI-ARIA action key) outside of text inputs. @keywords enter space wai-aria keyboard event */
|
|
1188
1288
|
export declare function isEnter(event: KeyboardEvent, isInputElement?: boolean): boolean;
|
|
1189
1289
|
|
|
1190
|
-
/** Checks if a value is filled (not empty), optionally
|
|
1191
|
-
export declare function isFilled<T>(value
|
|
1290
|
+
/** Checks if a value is filled (not empty), optionally considering '0' as filled. @keywords isFilled, empty check, filled, validation */
|
|
1291
|
+
export declare function isFilled<T>(value?: T, zeroTrue?: boolean): value is Exclude<T, EmptyValue>;
|
|
1192
1292
|
|
|
1193
1293
|
/** Checks if the value is an integer or floating-point number. @keywords isFloat, float, number, numeric, check */
|
|
1194
1294
|
export declare function isFloat(value: unknown): boolean;
|
|
1195
1295
|
|
|
1196
|
-
/** Checks
|
|
1296
|
+
/** Checks whether a value is a function. @keywords isFunction, function check, type guard, predicate */
|
|
1197
1297
|
export declare function isFunction<T>(callback: T): callback is Extract<T, FunctionAnyType>;
|
|
1198
1298
|
|
|
1199
1299
|
/** Checks if an element or selector is attached to the DOM tree. @keywords dom, attached, is connected, element in dom, is in document */
|
|
@@ -1208,16 +1308,16 @@ export declare function isIntegerBetween(value: number, between: number): boolea
|
|
|
1208
1308
|
/** Checks if a keyboard event contains active modifier or meta keys. @keywords meta key, modifier, keyboard event, ctrl, alt, shift, cmd */
|
|
1209
1309
|
export declare function isMetaKey(event: KeyboardEvent): boolean;
|
|
1210
1310
|
|
|
1211
|
-
/** Checks if a value is null or undefined. @keywords isNull, isNil, null, undefined, check */
|
|
1311
|
+
/** Checks if a value is null or undefined. @keywords isNull, isNil, null, undefined, check, guard */
|
|
1212
1312
|
export declare function isNull<T>(value: T): value is Extract<T, Undefined>;
|
|
1213
1313
|
|
|
1214
|
-
/** Checks if the value is a number
|
|
1215
|
-
export declare function isNumber(value
|
|
1314
|
+
/** Checks if the value is a number, numeric string, or bigint. @keywords isNumber, is numeric, check number, bigint, numeric string */
|
|
1315
|
+
export declare function isNumber(value?: unknown): value is number | string | bigint;
|
|
1216
1316
|
|
|
1217
|
-
/** Checks if a value is an object. @keywords isObject, object, type guard
|
|
1218
|
-
export declare function isObject<T>(value:
|
|
1317
|
+
/** Checks if a value is an object. @keywords isObject, object, type guard */
|
|
1318
|
+
export declare function isObject<T = unknown>(value: unknown): value is ObjectItem<T>;
|
|
1219
1319
|
|
|
1220
|
-
/** Checks if
|
|
1320
|
+
/** Checks if the value is an object and not an array. @keywords isObjectNotArray, object, not array, record, type guard */
|
|
1221
1321
|
export declare function isObjectNotArray<T>(value: T): value is Exclude<Extract<T, ObjectItem>, unknown[] | undefined | null>;
|
|
1222
1322
|
|
|
1223
1323
|
/** Check if the device is currently online. @keywords online, network, connectivity, internet */
|
|
@@ -1226,8 +1326,11 @@ export declare function isOnLine(): boolean;
|
|
|
1226
1326
|
/** Checks if a property key is a prototype pollution key (__proto__, constructor, prototype). @keywords prototype pollution, security, safe key, sanitize, proto, constructor */
|
|
1227
1327
|
export declare function isPrototypeKey(key: unknown): boolean;
|
|
1228
1328
|
|
|
1229
|
-
/** Checks if a value is
|
|
1230
|
-
export declare function
|
|
1329
|
+
/** Checks if a value is a regular expression (including cross-realm instances). @keywords regex, regexp, regular expression, type guard */
|
|
1330
|
+
export declare function isRegExp(value: unknown): value is RegExp;
|
|
1331
|
+
|
|
1332
|
+
/** Checks if a value matches a target or array of selected values with numeric equivalence support. @keywords isSelected, selection, match, compare */
|
|
1333
|
+
export declare function isSelected<T = unknown>(value?: T, selected?: unknown): boolean;
|
|
1231
1334
|
|
|
1232
1335
|
/** Checks if all specified values are selected. @keywords select, isSelected, selection, list, comparison */
|
|
1233
1336
|
export declare function isSelectedByList<T>(values: T | T[], selected: T | T[]): boolean;
|
|
@@ -1235,8 +1338,8 @@ export declare function isSelectedByList<T>(values: T | T[], selected: T | T[]):
|
|
|
1235
1338
|
/** Checks if the Web Share API is supported in the current environment. @keywords web share, navigator.share, share api, support check */
|
|
1236
1339
|
export declare function isShare(): boolean;
|
|
1237
1340
|
|
|
1238
|
-
/** Checks if
|
|
1239
|
-
export declare function isString(value
|
|
1341
|
+
/** Checks if the value is of type string. @keywords is string, type guard, validation */
|
|
1342
|
+
export declare function isString(value?: unknown): value is string;
|
|
1240
1343
|
|
|
1241
1344
|
/** Checks if the pressed key is Tab. @keywords tab key keyboard event check */
|
|
1242
1345
|
export declare function isTab(event: KeyboardEvent): boolean;
|
|
@@ -1244,17 +1347,48 @@ export declare function isTab(event: KeyboardEvent): boolean;
|
|
|
1244
1347
|
/** Checks if an object is a Window instance. @keywords window, isWindow, type guard, DOM */
|
|
1245
1348
|
export declare function isWindow<E>(element: E): element is Extract<E, Window>;
|
|
1246
1349
|
|
|
1247
|
-
/** Generates a random integer within
|
|
1350
|
+
/** Generates a random integer within the specified range (inclusive). @keywords random, integer, range, math, number */
|
|
1248
1351
|
export declare function random(min: number, max: number): number;
|
|
1249
1352
|
|
|
1250
1353
|
/** Removes the common prefix from a string, optionally trimming the result. @keywords string prefix remove strip trim */
|
|
1251
1354
|
export declare function removeCommonPrefix(mainString: string, prefix: string, trim?: boolean): string;
|
|
1252
1355
|
|
|
1356
|
+
export interface RemoveTagOptions {
|
|
1357
|
+
tag?: string | string[];
|
|
1358
|
+
replacement?: string;
|
|
1359
|
+
removeContent?: boolean | string | string[];
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Removes all HTML/XML tags or specified tags from a string.
|
|
1363
|
+
* @keywords html, xml, strip tags, sanitize, remove tag, strip html
|
|
1364
|
+
* @remarks
|
|
1365
|
+
* When `removeContent` is true (or a list of tags is provided),
|
|
1366
|
+
* executable and styling tags (`<script>`, `<style>`, `<noscript>`) or specified content tags
|
|
1367
|
+
* are silently removed along with their inner content without applying `replacement`.
|
|
1368
|
+
* Other formatting and layout tags preserve their text content, and their tag syntax
|
|
1369
|
+
* is replaced with `replacement`.
|
|
1370
|
+
* @example
|
|
1371
|
+
*
|
|
1372
|
+
* removeTag('<p>Hello <b>world</b>!</p>') // => 'Hello world!'
|
|
1373
|
+
* removeTag('<b>Hello</b> <p>world</p>', { tag: 'b' }) // => 'Hello <p>world</p>'
|
|
1374
|
+
* removeTag('<b>Hello</b> <p>world</p>', { tag: ['b', 'p'] }) // => 'Hello world'
|
|
1375
|
+
* removeTag('<p>Hello</p><p>world</p>', { replacement: ' ' }) // => ' Hello world '
|
|
1376
|
+
* removeTag('<p>Hello</p><script>alert(1)</script>') // => 'Hello'
|
|
1377
|
+
* removeTag('<p>Hello</p><script>alert(1)</script>', { removeContent: false }) // => 'Helloalert(1)'
|
|
1378
|
+
* removeTag('<div>Text</div><script>alert(1)</script>', { tag: 'script', removeContent: false }) // => '<div>Text</div>alert(1)'
|
|
1379
|
+
*
|
|
1380
|
+
*/
|
|
1381
|
+
export declare function removeTag(value?: string | number | null, options?: RemoveTagOptions): string;
|
|
1382
|
+
|
|
1253
1383
|
/** Replaces occurrences of a component name within the provided text. @keywords replace component name, text replacement, rename component */
|
|
1254
1384
|
export declare function replaceComponentName(text: string | undefined, name: string, componentName: string): string | undefined;
|
|
1255
1385
|
|
|
1256
|
-
/**
|
|
1257
|
-
|
|
1386
|
+
/**
|
|
1387
|
+
* Recursively merges a target object with elements from a replacement object or array without mutating source data.
|
|
1388
|
+
* @warning Intended exclusively for plain JSON-like objects and arrays; built-in class instances (`Date`, `RegExp`, `Map`, `Set`) and functions are not supported.
|
|
1389
|
+
* @keywords deep merge, recursive replace, object merge, immutable merge
|
|
1390
|
+
*/
|
|
1391
|
+
export declare function replaceRecursive<I = unknown>(target?: ObjectItem<I> | null, replacement?: ObjectOrArray<I> | readonly I[] | null, isMerge?: boolean, disableCopy?: boolean): ObjectItem<I>;
|
|
1258
1392
|
|
|
1259
1393
|
/** Replaces `[key]` placeholders in a template string with matching values or function results. @keywords template, replace, placeholder, substitute, string interpolation */
|
|
1260
1394
|
export declare function replaceTemplate(value: string, replaces: Record<string, FunctionOr<string | number | boolean>>): string;
|
|
@@ -1265,17 +1399,29 @@ export declare function resizeImage(image: HTMLImageElement | string, maxSize?:
|
|
|
1265
1399
|
export type ResizeImageByMaxType = 'auto' | 'width' | 'height';
|
|
1266
1400
|
|
|
1267
1401
|
/**
|
|
1268
|
-
* Resizes an image
|
|
1269
|
-
* @remarks
|
|
1270
|
-
* @keywords resize
|
|
1402
|
+
* Resizes an image to fit within a maximum size constraint using HTML Canvas.
|
|
1403
|
+
* @remarks Synchronous; requires a fully loaded image with valid natural dimensions. Returns a Base64 Data URL only when scaled; returns `undefined` if already within `maxSize` or unprocessable to prevent redundant Canvas re-encoding. For a fallback to the original source, use `resizeImage`.
|
|
1404
|
+
* @keywords image resize, scale image, max dimension, canvas resize, thumbnail, base64 data url
|
|
1271
1405
|
*/
|
|
1272
1406
|
export declare function resizeImageByMax(image: HTMLImageElement | string, maxSize: number, type?: ResizeImageByMaxType, typeData?: string, quality?: number): string | undefined;
|
|
1273
1407
|
|
|
1408
|
+
/** Validates and normalizes an external locale code string for URL safety and ECMA-402 BCP-47 compatibility. @keywords locale, sanitize, normalize, bcp47, ecma402 */
|
|
1409
|
+
export declare function sanitizeLocation(code?: unknown): string | undefined;
|
|
1410
|
+
|
|
1274
1411
|
/** Converts seconds into a formatted time string (MM:SS or HH:MM:SS). @keywords time format, seconds to time, duration, timestamp */
|
|
1275
1412
|
export declare function secondToTime(second: number | string | undefined, hasHour?: boolean): string;
|
|
1276
1413
|
|
|
1277
|
-
/** Modifies the property, attribute, or style
|
|
1278
|
-
export declare function setElementItem<E extends ElementOrWindow, K extends keyof E = keyof E, V extends E[K] = E[K]>(element
|
|
1414
|
+
/** Modifies the value of an element property, attribute, or style by key. @keywords element attribute property style set modify */
|
|
1415
|
+
export declare function setElementItem<E extends ElementOrWindow = HTMLElement, K extends keyof E = keyof E, V extends E[K] = E[K]>(element?: ElementOrString<E> | null, index?: K | string, value?: V | Record<string, V> | unknown): boolean;
|
|
1416
|
+
|
|
1417
|
+
/** Sets or removes an HTML or ARIA attribute on a DOM element. @keywords set attribute, remove attribute, html attribute, aria attribute, dom */
|
|
1418
|
+
export declare function setElementItemAttribute<E extends ElementOrWindow = HTMLElement>(element?: ElementOrString<E> | null, attribute?: string, value?: unknown): boolean;
|
|
1419
|
+
|
|
1420
|
+
/** Sets or merges nested properties on an element with prototype pollution protection. @keywords set element property, merge properties, prototype pollution */
|
|
1421
|
+
export declare function setElementItemProperty<E extends ElementOrWindow = HTMLElement>(element?: ElementOrString<E> | null, index?: PropertyKey, value?: unknown): boolean;
|
|
1422
|
+
|
|
1423
|
+
/** Sets style properties, CSS custom properties, or cssText on a DOM element or window. @keywords style, css properties, custom properties, cssText, set element style */
|
|
1424
|
+
export declare function setElementItemStyle<E extends ElementOrWindow = HTMLElement>(element?: ElementOrString<E> | null, styles?: unknown): boolean;
|
|
1279
1425
|
|
|
1280
1426
|
export interface SetValuesOptions {
|
|
1281
1427
|
multiple?: boolean;
|
|
@@ -1295,8 +1441,12 @@ export declare function sleep(ms: number): Promise<void>;
|
|
|
1295
1441
|
/** Sorts an array of items by column paths, directions, or a custom comparison function. @keywords sort, order, multi-column, comparator, array */
|
|
1296
1442
|
export declare function sortList<T = Record<string, unknown>>(list: T[], sortColumns: SortColumnItem[], customSort?: SortFunction<T>): T[];
|
|
1297
1443
|
|
|
1298
|
-
/**
|
|
1299
|
-
|
|
1444
|
+
/**
|
|
1445
|
+
* Recursively merges properties from a replacement object into a target object, optionally replacing a matched entry in place.
|
|
1446
|
+
* @warning Supports plain JSON-like objects only; built-in instances (`Date`, `RegExp`, `Map`, `Set`) and functions are not supported.
|
|
1447
|
+
* @keywords splice, merge, object, replace, recursive
|
|
1448
|
+
*/
|
|
1449
|
+
export declare function splice<I = unknown>(array?: ObjectItem<I> | null, replacement?: ObjectItem<I> | I | null, indexStart?: string | null): ObjectItem<I>;
|
|
1300
1450
|
|
|
1301
1451
|
/** Creates a string of the specified length filled with the given character. @keywords string fill repeat pad */
|
|
1302
1452
|
export declare function strFill(value: string, count: number): string;
|
|
@@ -1313,21 +1463,39 @@ export declare function toCamelCase(value?: string): string;
|
|
|
1313
1463
|
/** Converts a string to PascalCase (CamelCase with first letter capitalized). @keywords pascalCase, camelCase, capitalize, case conversion */
|
|
1314
1464
|
export declare function toCamelCaseFirst(value?: string): string;
|
|
1315
1465
|
|
|
1466
|
+
/** Extracts and validates a 2-letter country code from a location or locale string. @keywords country, locale, bcp47, geolist, parse country */
|
|
1467
|
+
export declare function toCountry(code?: unknown, raw?: boolean): string;
|
|
1468
|
+
|
|
1316
1469
|
/** Converts a value to a Date object. @keywords date, parse, convert, timestamp */
|
|
1317
1470
|
export declare function toDate<T extends Date | number | string>(value?: T): (T & Date) | Date;
|
|
1318
1471
|
|
|
1472
|
+
/** Finds geographical country and locale data by language-country, country, or language code. @keywords geo, country, locale, language code, geo item */
|
|
1473
|
+
export declare function toGeoItem(code?: unknown): GeoItem | undefined;
|
|
1474
|
+
|
|
1475
|
+
/** Transforms a basic geo item into a full geo item with resolved location data and defaults. @keywords geo item, location resolution, defaults, country code */
|
|
1476
|
+
export declare function toGeoItemFull(item: GeoItem, code?: string): GeoItemFull;
|
|
1477
|
+
|
|
1478
|
+
/** Converts a geo item to its standard string representation (language-country). @keywords geo standard country language code format */
|
|
1479
|
+
export declare function toGeoStandard(item?: GeoItem, language?: string, raw?: boolean): string;
|
|
1480
|
+
|
|
1319
1481
|
/** Converts a string to kebab-case format by replacing spaces and separators with hyphens. @keywords kebab-case, dash-case, slugify, string */
|
|
1320
1482
|
export declare function toKebabCase(value?: string): string;
|
|
1321
1483
|
|
|
1484
|
+
/** Extracts and validates a canonical language code from a location or language string (BCP-47, ISO 639). @keywords language, locale, bcp47, iso639, geolist, parse, normalize */
|
|
1485
|
+
export declare function toLanguage(code?: unknown, raw?: boolean): string;
|
|
1486
|
+
|
|
1487
|
+
/** Converts a full locale string into canonical standard 'aa-AA' format, or returns an empty string if incomplete. @keywords locale, canonicalize, format, language, country */
|
|
1488
|
+
export declare function toLocale(code?: unknown): string;
|
|
1489
|
+
|
|
1322
1490
|
/**
|
|
1323
|
-
* Converts a
|
|
1324
|
-
* @keywords
|
|
1491
|
+
* Converts a value to a finite floating-point number, normalizing separators and stripping non-numeric characters.
|
|
1492
|
+
* @keywords parse, float, number, cast, numeric conversion, separator
|
|
1325
1493
|
* @example
|
|
1326
1494
|
* toNumber("1 234,56") // 1234.56
|
|
1327
1495
|
* toNumber("1,234.56") // 1234.56
|
|
1328
1496
|
* toNumber("1,234") // 1.234
|
|
1329
1497
|
*/
|
|
1330
|
-
export declare function toNumber(value?:
|
|
1498
|
+
export declare function toNumber(value?: unknown): number;
|
|
1331
1499
|
|
|
1332
1500
|
/** Converts a value to a number clamped by a maximum permissible value, with optional formatting. @keywords toNumberByMax, clamp, max, number, format */
|
|
1333
1501
|
export declare function toNumberByMax(value?: NumberOrString, max?: NumberOrString, formatting?: boolean, language?: string): string | number;
|
|
@@ -1356,15 +1524,15 @@ export declare function toPercentBy100(maxValue: number, value: number): number;
|
|
|
1356
1524
|
export declare function toString<T>(value: T): string;
|
|
1357
1525
|
|
|
1358
1526
|
/**
|
|
1359
|
-
* Transforms a string into its corresponding data type (
|
|
1360
|
-
* @keywords transform, parse, cast, deserialize, type
|
|
1527
|
+
* Transforms a string into its corresponding data type (boolean, number, object, null, undefined, or function).
|
|
1528
|
+
* @keywords transform, parse, cast, deserialize, type conversion
|
|
1361
1529
|
* @example
|
|
1362
1530
|
* transformation('true') // true
|
|
1363
1531
|
* transformation('12.5') // 12.5
|
|
1364
1532
|
* transformation('{"a":1}') // { a: 1 }
|
|
1365
1533
|
* transformation('null') // null
|
|
1366
1534
|
*/
|
|
1367
|
-
export declare function transformation<T = unknown>(value
|
|
1535
|
+
export declare function transformation<T = unknown>(value?: unknown, isFunctionCheck?: boolean): T;
|
|
1368
1536
|
|
|
1369
1537
|
/**
|
|
1370
1538
|
* Converts a Uint8Array to a base64 encoded string across Node.js, modern ECMAScript, and browsers.
|
|
@@ -1374,8 +1542,8 @@ export declare function transformation<T = unknown>(value: unknown, isFunctionCh
|
|
|
1374
1542
|
*/
|
|
1375
1543
|
export declare function uint8ArrayToBase64(bytes?: Uint8Array | null): string;
|
|
1376
1544
|
|
|
1377
|
-
/** Removes duplicate elements from an array. @keywords unique, deduplicate, distinct, array
|
|
1378
|
-
export declare function uniqueArray<T>(value
|
|
1545
|
+
/** Removes duplicate elements from an array. @keywords unique, deduplicate, distinct, array */
|
|
1546
|
+
export declare function uniqueArray<T = unknown>(value?: readonly T[] | null): T[];
|
|
1379
1547
|
|
|
1380
1548
|
/** Writes text data to the system clipboard. @keywords clipboard, copy, write, text */
|
|
1381
1549
|
export declare function writeClipboardData(text: string): Promise<void>;
|
|
@@ -1507,7 +1675,7 @@ export type ApiStatusItem = {
|
|
|
1507
1675
|
export type ApiStatusType = 'success' | 'error' | 'warning' | 'info';
|
|
1508
1676
|
|
|
1509
1677
|
export type Undefined = undefined | null;
|
|
1510
|
-
/** Union
|
|
1678
|
+
/** Union representing falsy, nullish, or string-serialized empty values @keywords empty, nullish, falsy */
|
|
1511
1679
|
export type EmptyValue = Undefined | 0 | false | '' | 'undefined' | 'null' | '0' | 'false' | '[]';
|
|
1512
1680
|
export type NumberOrString = number | string;
|
|
1513
1681
|
export type NumberOrStringOrBoolean = number | string | boolean;
|
|
@@ -1516,7 +1684,7 @@ export type NormalOrArray<T = NumberOrString> = T | T[];
|
|
|
1516
1684
|
export type NormalOrPromise<T> = T | Promise<T>;
|
|
1517
1685
|
export type ObjectItem<T = any> = Record<string, T>;
|
|
1518
1686
|
export type ObjectOrArray<T = any> = T[] | ObjectItem<T>;
|
|
1519
|
-
/**
|
|
1687
|
+
/** Unwraps an array type to its element type @keywords array, unwrap, extract */
|
|
1520
1688
|
export type ArrayToItem<T> = T extends any[] ? T[number] : T;
|
|
1521
1689
|
export type FunctionOr<T = any> = T | FunctionReturn<T>;
|
|
1522
1690
|
export type FunctionReturn<R = any> = () => R;
|
|
@@ -1525,32 +1693,34 @@ export type FunctionArgs<T, R> = (...args: T[]) => R;
|
|
|
1525
1693
|
export type FunctionAnyType<T = any, R = any> = (...args: T[]) => R;
|
|
1526
1694
|
export type ItemList<T = any> = Record<string, T>;
|
|
1527
1695
|
export type Item<V> = {
|
|
1528
|
-
|
|
1529
|
-
|
|
1696
|
+
index: string;
|
|
1697
|
+
value: V;
|
|
1530
1698
|
};
|
|
1531
1699
|
export type ItemValue<V> = {
|
|
1532
|
-
|
|
1533
|
-
|
|
1700
|
+
label: string;
|
|
1701
|
+
value: V;
|
|
1534
1702
|
};
|
|
1535
1703
|
export type ItemName<V> = {
|
|
1536
|
-
|
|
1537
|
-
|
|
1704
|
+
name: string | number;
|
|
1705
|
+
value: V;
|
|
1538
1706
|
};
|
|
1539
|
-
export type ElementOrWindow = HTMLElement | Window;
|
|
1707
|
+
export type ElementOrWindow = HTMLElement | SVGElement | Element | Window;
|
|
1708
|
+
/** Resolves ElementOrWindow types, substituting Window with HTMLElement @keywords element, dom, window */
|
|
1709
|
+
export type ElementResolved<E extends ElementOrWindow = HTMLElement> = E extends Window ? HTMLElement : Exclude<E, Window>;
|
|
1540
1710
|
export type ElementOrString<E extends ElementOrWindow> = E | string;
|
|
1541
1711
|
export type EventOptions = AddEventListenerOptions | boolean | undefined;
|
|
1542
|
-
/** Event listener
|
|
1712
|
+
/** Event listener accepting an event and an optional custom detail payload @keywords event, listener, detail */
|
|
1543
1713
|
export type EventListenerDetail<O extends Event, D extends Record<string, any>> = (event: O, detail?: D) => void;
|
|
1544
|
-
/**
|
|
1714
|
+
/** Tracks an active event listener or observer registration @keywords event, listener, observer, activity */
|
|
1545
1715
|
export type EventActivityItem<E extends ElementOrWindow> = {
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1716
|
+
element: E | undefined;
|
|
1717
|
+
type: string;
|
|
1718
|
+
listener?: (event: any | Event) => void;
|
|
1719
|
+
observer?: ResizeObserver;
|
|
1550
1720
|
};
|
|
1551
1721
|
export type ImageCoordinator = {
|
|
1552
|
-
|
|
1553
|
-
|
|
1722
|
+
x: number;
|
|
1723
|
+
y: number;
|
|
1554
1724
|
};
|
|
1555
1725
|
|
|
1556
1726
|
export type ErrorCenterGroup = string | undefined;
|
|
@@ -1649,89 +1819,84 @@ export type FormattersReturn<List extends FormattersListProp, Options extends Fo
|
|
|
1649
1819
|
|
|
1650
1820
|
export type GeoDate = 'full' | 'datetime' | 'date' | 'year-month' | 'year' | 'month' | 'day' | 'day-month' | 'time' | 'hour-minute' | 'hour' | 'minute' | 'second';
|
|
1651
1821
|
export type GeoFirstDay = 1 | 6 | 0;
|
|
1822
|
+
/** Default first day of the week ('Mo' = Monday). @keywords calendar, first_day, locale */
|
|
1823
|
+
export declare const GEO_DEFAULT_FIRST_DAY = "Mo";
|
|
1652
1824
|
export type GeoHours = '12' | '24';
|
|
1653
1825
|
export type GeoTimeZoneStyle = 'minute' | 'hour' | 'ISO8601' | 'RFC';
|
|
1654
|
-
|
|
1655
|
-
/** Geographic configuration item containing country, language, and locale formatting rules @keywords geo, locale, country, language */
|
|
1826
|
+
/** Geographic item configuration for country, language, and regional formats. @keywords geo, country, language, locale, unit */
|
|
1656
1827
|
export interface GeoItem {
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1828
|
+
country: string;
|
|
1829
|
+
countryAlternative?: string[];
|
|
1830
|
+
language: string;
|
|
1831
|
+
languageAlternative?: string[];
|
|
1832
|
+
firstDay?: string | null;
|
|
1833
|
+
zone?: string | null;
|
|
1834
|
+
phoneCode?: string;
|
|
1835
|
+
phoneWithin?: string;
|
|
1836
|
+
phoneMask?: string | string[];
|
|
1837
|
+
nameFormat?: 'fl' | 'fsl' | 'lf' | 'lsf' | string;
|
|
1838
|
+
unit?: {
|
|
1839
|
+
'millimeter'?: string;
|
|
1840
|
+
'centimeter'?: string;
|
|
1841
|
+
'meter'?: string;
|
|
1842
|
+
'kilometer'?: string;
|
|
1843
|
+
'square-meter'?: string;
|
|
1844
|
+
'hectare'?: string;
|
|
1845
|
+
'gram'?: string;
|
|
1846
|
+
'kilogram'?: string;
|
|
1847
|
+
'tonne'?: string;
|
|
1848
|
+
'milliliter'?: string;
|
|
1849
|
+
'liter'?: string;
|
|
1850
|
+
'celsius'?: string;
|
|
1851
|
+
'kilometer-per-hour'?: string;
|
|
1852
|
+
};
|
|
1682
1853
|
}
|
|
1683
|
-
|
|
1684
|
-
/** Extended geographic item with resolved required locale fields @keywords geo, locale, full */
|
|
1854
|
+
/** Complete geographic item with resolved locale and location identifiers. @keywords geo, location, locale, country */
|
|
1685
1855
|
export interface GeoItemFull extends Omit<GeoItem, 'firstDay'> {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1856
|
+
standard: string;
|
|
1857
|
+
firstDay: string;
|
|
1858
|
+
location: string;
|
|
1859
|
+
locationCountry: string;
|
|
1860
|
+
locationLanguage: string;
|
|
1691
1861
|
}
|
|
1692
|
-
|
|
1693
|
-
/** Geographic flag and country display metadata @keywords flag, country, language */
|
|
1862
|
+
/** Country flag selection and display item. @keywords flag, country, language, option */
|
|
1694
1863
|
export interface GeoFlagItem {
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1864
|
+
language: string;
|
|
1865
|
+
languageCode: string;
|
|
1866
|
+
country: string;
|
|
1867
|
+
countryCode: string;
|
|
1868
|
+
standard: string;
|
|
1869
|
+
icon?: string;
|
|
1870
|
+
label: string;
|
|
1871
|
+
value: string;
|
|
1872
|
+
phoneCode?: string;
|
|
1704
1873
|
}
|
|
1705
|
-
|
|
1706
|
-
/** Geographic flag item with localized native language descriptions @keywords flag, national, localized */
|
|
1874
|
+
/** Extended geographic flag item containing localized national language and country names. @keywords flag, national, localization */
|
|
1707
1875
|
export interface GeoFlagNational extends GeoFlagItem {
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1876
|
+
description: string;
|
|
1877
|
+
nationalLanguage: string;
|
|
1878
|
+
nationalCountry: string;
|
|
1711
1879
|
}
|
|
1712
|
-
|
|
1713
|
-
/** Country phone prefix and mask pattern metadata @keywords phone, mask, countryCode */
|
|
1880
|
+
/** Phone dialing configuration and mask metadata for a country. @keywords phone, country_code, mask, dialing */
|
|
1714
1881
|
export interface GeoPhoneValue {
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1882
|
+
phone: number;
|
|
1883
|
+
within: number;
|
|
1884
|
+
mask: string[];
|
|
1885
|
+
value: string;
|
|
1719
1886
|
}
|
|
1720
|
-
|
|
1721
|
-
/** Prefix tree node for phone code lookup and mask formatting @keywords phone, trie, prefix, mask */
|
|
1887
|
+
/** Node in the internal phone prefix tree (Trie) for number lookup. @keywords phone, trie, prefix_tree, lookup */
|
|
1722
1888
|
export interface GeoPhoneMap {
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1889
|
+
items: GeoPhoneValue[];
|
|
1890
|
+
info: GeoPhoneValue | undefined;
|
|
1891
|
+
value: string | undefined;
|
|
1892
|
+
mask: string[];
|
|
1893
|
+
maskFull: string[];
|
|
1894
|
+
next: Record<string, GeoPhoneMap>;
|
|
1729
1895
|
}
|
|
1730
|
-
|
|
1731
|
-
/** Result of a phone number lookup against the prefix tree @keywords phone, lookup, result */
|
|
1896
|
+
/** Result of matching a phone number against the prefix tree. @keywords phone, lookup, result, match */
|
|
1732
1897
|
export interface GeoPhoneMapInfo {
|
|
1733
|
-
|
|
1734
|
-
|
|
1898
|
+
item?: GeoPhoneMap;
|
|
1899
|
+
phone?: string;
|
|
1735
1900
|
}
|
|
1736
1901
|
|
|
1737
1902
|
export declare enum MetaTag {
|
|
@@ -1964,27 +2129,36 @@ export type SortColumnItem = {
|
|
|
1964
2129
|
/** Custom comparator function for sorting items. @keywords sort, comparator, sort-function */
|
|
1965
2130
|
export type SortFunction<T = Record<string, unknown>> = (a: T, b: T, column?: string, dir?: SortDir) => number;
|
|
1966
2131
|
|
|
1967
|
-
/**
|
|
2132
|
+
/** Configuration options for the translation plugin. @keywords translate, config, options */
|
|
1968
2133
|
export type TranslateConfig = {
|
|
1969
2134
|
url?: string;
|
|
1970
2135
|
propsName?: string;
|
|
1971
2136
|
readApi?: boolean;
|
|
1972
2137
|
};
|
|
1973
|
-
/** Translation code or list of translation codes @keywords i18n, key, code */
|
|
1974
2138
|
export type TranslateCode = string | string[];
|
|
1975
|
-
/** Map of translation
|
|
2139
|
+
/** Map of translation codes to their localized string values. @keywords translate, list, mapping */
|
|
1976
2140
|
export type TranslateList<T extends TranslateCode[]> = {
|
|
1977
2141
|
[K in T[number] as K extends readonly string[] ? K[0] : K]: string;
|
|
1978
2142
|
};
|
|
1979
|
-
/**
|
|
2143
|
+
/** Resolves return type to a single translated string or a mapped dictionary. @keywords translate, conditional */
|
|
1980
2144
|
export type TranslateItemOrList<T extends TranslateCode> = T extends string[] ? TranslateList<T> : string;
|
|
1981
2145
|
export type TranslateDataFileList = Record<string, string>;
|
|
1982
|
-
/** Asynchronous loader function for translation data @keywords i18n, loader, async */
|
|
1983
2146
|
export type TranslateDataFileItem = () => Promise<TranslateDataFileList>;
|
|
1984
|
-
/** Mapping of locale identifiers to translation file loaders @keywords i18n, locale, dictionary */
|
|
1985
2147
|
export type TranslateDataFile = Record<string, TranslateDataFileItem>;
|
|
1986
|
-
|
|
2148
|
+
export type TranslatePromiseItem = {
|
|
2149
|
+
id: number;
|
|
2150
|
+
promise: Promise<TranslateDataFileList | undefined>;
|
|
2151
|
+
};
|
|
2152
|
+
/** Translation batch queued for retrieval by locale and language. @keywords translate, batch, queue */
|
|
2153
|
+
export interface TranslateBatch {
|
|
2154
|
+
readonly location: string;
|
|
2155
|
+
readonly language: string;
|
|
2156
|
+
readonly path: string;
|
|
2157
|
+
readonly codes: string[];
|
|
2158
|
+
readonly resolves: (() => void)[];
|
|
2159
|
+
}
|
|
2160
|
+
/** Prefix for global translation keys. @keywords translate, prefix, global */
|
|
1987
2161
|
export declare const TRANSLATE_GLOBAL_PREFIX = "global";
|
|
1988
|
-
/**
|
|
2162
|
+
/** Request debounce timeout in milliseconds for batch translation loading. @keywords translate, timeout, debounce */
|
|
1989
2163
|
export declare const TRANSLATE_TIME_OUT = 160;
|
|
1990
2164
|
```
|