@vicaniddouglas/js_aide 1.5.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/LICENSE +21 -0
- package/README.md +172 -0
- package/declarations.d.ts +1465 -0
- package/dist/js_aide.cjs.js +1491 -0
- package/dist/js_aide.cjs.js.map +7 -0
- package/dist/js_aide.esm.js +1491 -0
- package/dist/js_aide.esm.js.map +7 -0
- package/dist/js_aide.min.js +1491 -0
- package/dist/js_aide.min.js.map +7 -0
- package/package.json +54 -0
|
@@ -0,0 +1,1465 @@
|
|
|
1
|
+
declare module "@vicaniddouglas/js_aide" {
|
|
2
|
+
// =========================================================
|
|
3
|
+
// Router (from router.js)
|
|
4
|
+
// =========================================================
|
|
5
|
+
interface NavigationContext {
|
|
6
|
+
from: string | null;
|
|
7
|
+
params: { [key: string]: string };
|
|
8
|
+
query: { [key: string]: string };
|
|
9
|
+
hash: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface RouterOptions {
|
|
13
|
+
replace?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface BeforeNavigateGuard {
|
|
17
|
+
(
|
|
18
|
+
to: string,
|
|
19
|
+
context: NavigationContext,
|
|
20
|
+
): boolean | string | Promise<boolean | string>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface RouterNavigatedDetail {
|
|
24
|
+
path: string;
|
|
25
|
+
pathname: string;
|
|
26
|
+
params: { [key: string]: string };
|
|
27
|
+
query: { [key: string]: string };
|
|
28
|
+
hash: string;
|
|
29
|
+
previousPath: string | null;
|
|
30
|
+
replace: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface RouterInitializedDetail {
|
|
34
|
+
path: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface RouterPopstateDetail {
|
|
38
|
+
path: string;
|
|
39
|
+
state: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface RouterBeforeViewChangeDetail {
|
|
43
|
+
from: string | null;
|
|
44
|
+
to: string;
|
|
45
|
+
fromPath: string | null;
|
|
46
|
+
toPath: string;
|
|
47
|
+
params: { [key: string]: string };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface RouterAfterViewChangeDetail {
|
|
51
|
+
viewId: string;
|
|
52
|
+
path: string;
|
|
53
|
+
params: { [key: string]: string };
|
|
54
|
+
viewElement: HTMLElement;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface RouterBeforeViewHideDetail {
|
|
58
|
+
viewId: string;
|
|
59
|
+
viewElement: HTMLElement;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface RouterAfterViewHideDetail {
|
|
63
|
+
viewId: string;
|
|
64
|
+
viewElement: HTMLElement;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface RouterErrorDetail {
|
|
68
|
+
error: Error;
|
|
69
|
+
path: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface RouterCurrentRoute {
|
|
73
|
+
path: string | null;
|
|
74
|
+
viewId: string | null;
|
|
75
|
+
viewElement: HTMLElement | null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export class Router {
|
|
79
|
+
constructor(routes: { [path: string]: string }, defaultPath?: string);
|
|
80
|
+
beforeNavigate: BeforeNavigateGuard | null;
|
|
81
|
+
navigate(path: string, options?: RouterOptions): Promise<boolean>;
|
|
82
|
+
getCurrentRoute(): RouterCurrentRoute;
|
|
83
|
+
destroy(): void;
|
|
84
|
+
goToDefault(options?: RouterOptions): Promise<boolean>;
|
|
85
|
+
hasRoute(path: string): boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// =========================================================
|
|
89
|
+
// Validator (from validator.js)
|
|
90
|
+
// =========================================================
|
|
91
|
+
type FieldType =
|
|
92
|
+
| HTMLInputElement
|
|
93
|
+
| HTMLTextAreaElement
|
|
94
|
+
| HTMLSelectElement
|
|
95
|
+
| HTMLElement;
|
|
96
|
+
|
|
97
|
+
interface ValidationResult {
|
|
98
|
+
isValid: boolean;
|
|
99
|
+
error: string | null;
|
|
100
|
+
cleanedName?: string;
|
|
101
|
+
cleanedNumber?: string;
|
|
102
|
+
prefix?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface ValidateNameOptions {
|
|
106
|
+
minLength?: number;
|
|
107
|
+
maxLength?: number;
|
|
108
|
+
allowNumbers?: boolean;
|
|
109
|
+
allowSpecialChars?: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface ValidatePhoneNumberOptions {
|
|
113
|
+
strict?: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function validateMandatoryFields(
|
|
117
|
+
fields: NodeListOf<FieldType> | FieldType[],
|
|
118
|
+
): boolean;
|
|
119
|
+
|
|
120
|
+
export function validateFieldByType(field: FieldType): boolean;
|
|
121
|
+
|
|
122
|
+
export function validateName(
|
|
123
|
+
name: string,
|
|
124
|
+
options?: ValidateNameOptions,
|
|
125
|
+
): ValidationResult;
|
|
126
|
+
|
|
127
|
+
export function validatePhoneNumber(
|
|
128
|
+
phone: string,
|
|
129
|
+
options?: ValidatePhoneNumberOptions,
|
|
130
|
+
): ValidationResult;
|
|
131
|
+
|
|
132
|
+
export function applyFieldValidation(
|
|
133
|
+
field: HTMLElement,
|
|
134
|
+
validationResult: ValidationResult,
|
|
135
|
+
): boolean;
|
|
136
|
+
|
|
137
|
+
export function validateNameField(
|
|
138
|
+
nameField: HTMLInputElement,
|
|
139
|
+
options?: ValidateNameOptions,
|
|
140
|
+
): boolean;
|
|
141
|
+
|
|
142
|
+
export function validatePhoneField(
|
|
143
|
+
phoneField: HTMLInputElement,
|
|
144
|
+
options?: ValidatePhoneNumberOptions,
|
|
145
|
+
): boolean;
|
|
146
|
+
|
|
147
|
+
// =========================================================
|
|
148
|
+
// inputHandlers (from DOMelementHandlers.js)
|
|
149
|
+
// =========================================================
|
|
150
|
+
interface AllowOnlyNumbersOptions {
|
|
151
|
+
allowDecimals?: boolean;
|
|
152
|
+
maxDecimals?: number;
|
|
153
|
+
allowNegative?: boolean;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface FormatNumberInputOptions {
|
|
157
|
+
maxDecimalPlaces?: number;
|
|
158
|
+
allowNegative?: boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface ProvideOtherSelectOptionOptions {
|
|
162
|
+
promptText?: string;
|
|
163
|
+
formatWithCommas?: boolean;
|
|
164
|
+
validator?: (value: string) => boolean | string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface FilterElementsByAnySelectorOptions {
|
|
168
|
+
itemSelector?: string;
|
|
169
|
+
caseSensitive?: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface CharacterCounterOptions {
|
|
173
|
+
showPercentage?: boolean;
|
|
174
|
+
warningThreshold?: number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const inputHandlers: {
|
|
178
|
+
allowOnlyNumbers(
|
|
179
|
+
inputElement: HTMLInputElement,
|
|
180
|
+
options?: AllowOnlyNumbersOptions,
|
|
181
|
+
): void;
|
|
182
|
+
formatNumberInput(
|
|
183
|
+
input: HTMLInputElement,
|
|
184
|
+
options?: FormatNumberInputOptions,
|
|
185
|
+
): void; // Note: There are two formatNumberInput functions. This is the one exported by inputHandlers object.
|
|
186
|
+
provideOtherSelectOption(
|
|
187
|
+
selectElement: HTMLSelectElement,
|
|
188
|
+
options?: ProvideOtherSelectOptionOptions,
|
|
189
|
+
): void;
|
|
190
|
+
filterElementsByAnySelector(
|
|
191
|
+
searchInput: HTMLInputElement,
|
|
192
|
+
container: HTMLElement,
|
|
193
|
+
contentSelectors?: string[],
|
|
194
|
+
options?: FilterElementsByAnySelectorOptions,
|
|
195
|
+
): void;
|
|
196
|
+
characterCounter(
|
|
197
|
+
input: HTMLInputElement | HTMLTextAreaElement,
|
|
198
|
+
counterElement: HTMLElement,
|
|
199
|
+
maxLength: number,
|
|
200
|
+
options?: CharacterCounterOptions,
|
|
201
|
+
): void;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* SmartInput - A versatile input management system for creating specialized input fields
|
|
206
|
+
*/
|
|
207
|
+
interface InputOptions {
|
|
208
|
+
id: string;
|
|
209
|
+
labelText: string;
|
|
210
|
+
container: HTMLElement;
|
|
211
|
+
wrapperClasses?: string[];
|
|
212
|
+
inputClasses?: string[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
interface NumberInputOptions {
|
|
216
|
+
placeholder?: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interface FormattedNumberInputOptions {
|
|
220
|
+
placeholder?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface SearchableInputItem {
|
|
224
|
+
key: string;
|
|
225
|
+
value: any;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
interface SearchableInputOptions {
|
|
229
|
+
data?: SearchableInputItem[];
|
|
230
|
+
placeholder?: string;
|
|
231
|
+
dropdownClasses?: string[];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface LimitedTextInputOptions {
|
|
235
|
+
maxLength: number;
|
|
236
|
+
allowedCharactersString?: string;
|
|
237
|
+
placeholder?: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface SearchableInputResult {
|
|
241
|
+
inputElement: HTMLInputElement;
|
|
242
|
+
getValue(): any;
|
|
243
|
+
setData(newData: SearchableInputItem[]): void;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export class SmartInput {
|
|
247
|
+
constructor();
|
|
248
|
+
/** Stores references to all created inputs */
|
|
249
|
+
inputs: { [id: string]: HTMLInputElement };
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Retrieves an input element by its ID
|
|
253
|
+
* @param id - ID of the input to retrieve
|
|
254
|
+
*/
|
|
255
|
+
getInput(id: string): HTMLInputElement | null;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Creates a text input that only accepts numeric characters
|
|
259
|
+
*/
|
|
260
|
+
createNumberInput(
|
|
261
|
+
options: InputOptions & NumberInputOptions,
|
|
262
|
+
): HTMLInputElement | null;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Creates a formatted number input with comma separators and decimal support
|
|
266
|
+
*/
|
|
267
|
+
createFormattedNumberInput(
|
|
268
|
+
options: InputOptions & FormattedNumberInputOptions,
|
|
269
|
+
): HTMLInputElement | null;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Creates a searchable input with dropdown functionality
|
|
273
|
+
*/
|
|
274
|
+
createSearchableInput(
|
|
275
|
+
options: InputOptions & SearchableInputOptions,
|
|
276
|
+
): SearchableInputResult | null;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Creates a text input with character limit and optional character restrictions
|
|
280
|
+
*/
|
|
281
|
+
createLimitedTextInput(
|
|
282
|
+
options: InputOptions & LimitedTextInputOptions,
|
|
283
|
+
): HTMLInputElement | null;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// =========================================================
|
|
287
|
+
// requests (from requests.js)
|
|
288
|
+
// =========================================================
|
|
289
|
+
interface RequestHandlerConfig {
|
|
290
|
+
apiUrl?: string;
|
|
291
|
+
timeout?: number;
|
|
292
|
+
maxRetries?: number;
|
|
293
|
+
retryStrategy?: "exponential" | "linear" | "fibonacci";
|
|
294
|
+
csrfToken?: string;
|
|
295
|
+
authToken?: string;
|
|
296
|
+
environment?: "development" | "production";
|
|
297
|
+
keys?: {
|
|
298
|
+
globalConfig?: string;
|
|
299
|
+
authToken?: string;
|
|
300
|
+
csrfToken?: string;
|
|
301
|
+
csrfCookie?: string;
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
interface RequestOptions {
|
|
306
|
+
method?: string;
|
|
307
|
+
endpoint: string;
|
|
308
|
+
payload?: object | FormData | null;
|
|
309
|
+
headers?: { [key: string]: string };
|
|
310
|
+
timeout?: number;
|
|
311
|
+
maxRetries?: number;
|
|
312
|
+
retryStrategy?: "exponential" | "linear" | "fibonacci";
|
|
313
|
+
useQueue?: boolean;
|
|
314
|
+
priority?: number;
|
|
315
|
+
responseType?: "json" | "text";
|
|
316
|
+
showLoading?: (isLoading: boolean) => void;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
type RequestInterceptor = (
|
|
320
|
+
config: RequestOptions,
|
|
321
|
+
) => RequestOptions | Promise<RequestOptions>;
|
|
322
|
+
type ResponseInterceptor = (response: {
|
|
323
|
+
data: any;
|
|
324
|
+
status: number;
|
|
325
|
+
url: string;
|
|
326
|
+
}) => any | Promise<any>;
|
|
327
|
+
type ErrorInterceptor = (error: XMLHttpRequest) => void;
|
|
328
|
+
|
|
329
|
+
interface InterceptorMethods {
|
|
330
|
+
request(onFulfilled: RequestInterceptor, onRejected?: Function): number;
|
|
331
|
+
response(onFulfilled: ResponseInterceptor, onRejected?: Function): number;
|
|
332
|
+
error(handler: ErrorInterceptor): void;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
interface QueueStatus {
|
|
336
|
+
active: number;
|
|
337
|
+
pending: number;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export const sendRequest: (options?: RequestOptions) => Promise<any>;
|
|
341
|
+
export const initRequestHandler: (options?: RequestHandlerConfig) => void;
|
|
342
|
+
export const interceptors: InterceptorMethods;
|
|
343
|
+
export const getQueueStatus: () => QueueStatus;
|
|
344
|
+
|
|
345
|
+
// =========================================================
|
|
346
|
+
// dates (from dates.js)
|
|
347
|
+
// =========================================================
|
|
348
|
+
interface DateValidationOptions {
|
|
349
|
+
showAlert?: boolean;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface HumanizeDateOptions {
|
|
353
|
+
format?: "short" | "medium" | "long" | "full" | "weekday";
|
|
354
|
+
locale?: string;
|
|
355
|
+
includeYear?: boolean;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
interface RelativeTimeOptions {
|
|
359
|
+
locale?: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
interface TimeAgoOptions {
|
|
363
|
+
showSeconds?: boolean;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
type TimeUnit = "days" | "weeks" | "months" | "years";
|
|
367
|
+
|
|
368
|
+
interface GetFutureDateOptions {
|
|
369
|
+
startDate?: string;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
interface GetDaysBetweenOptions {
|
|
373
|
+
inclusiveEndDate?: boolean;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export function validateDate(
|
|
377
|
+
dateString: string,
|
|
378
|
+
options?: DateValidationOptions,
|
|
379
|
+
): boolean;
|
|
380
|
+
export function humanizeDate(
|
|
381
|
+
dateString: string,
|
|
382
|
+
options?: HumanizeDateOptions,
|
|
383
|
+
): string;
|
|
384
|
+
export function getRelativeTime(
|
|
385
|
+
dateString: string,
|
|
386
|
+
options?: RelativeTimeOptions,
|
|
387
|
+
): string;
|
|
388
|
+
export function getCurrentDate(): string;
|
|
389
|
+
export function getDateYesterday(): string;
|
|
390
|
+
export function timeAgo(
|
|
391
|
+
timestamp: string | Date,
|
|
392
|
+
options?: TimeAgoOptions,
|
|
393
|
+
): string;
|
|
394
|
+
|
|
395
|
+
export function getEndDate(
|
|
396
|
+
startDate: string,
|
|
397
|
+
duration: number,
|
|
398
|
+
unit: TimeUnit,
|
|
399
|
+
): string;
|
|
400
|
+
|
|
401
|
+
export function getDateRange(
|
|
402
|
+
keyword:
|
|
403
|
+
| "today"
|
|
404
|
+
| "yesterday"
|
|
405
|
+
| "thisWeek"
|
|
406
|
+
| "lastWeek"
|
|
407
|
+
| "thisMonth"
|
|
408
|
+
| "lastMonth",
|
|
409
|
+
): [string, string];
|
|
410
|
+
export function getDateAgo(amount: number, unit: TimeUnit): string;
|
|
411
|
+
export function getDateTomorrow(): string;
|
|
412
|
+
export function getFutureDateRange(
|
|
413
|
+
keyword: "tomorrow" | "nextWeek" | "nextMonth" | "nextYear",
|
|
414
|
+
): [string, string];
|
|
415
|
+
export function getDaysBetween(
|
|
416
|
+
startDate: string,
|
|
417
|
+
endDate: string,
|
|
418
|
+
options?: GetDaysBetweenOptions,
|
|
419
|
+
): number;
|
|
420
|
+
export function getFutureDate(
|
|
421
|
+
amount: number,
|
|
422
|
+
unit: TimeUnit,
|
|
423
|
+
options?: GetFutureDateOptions,
|
|
424
|
+
): string;
|
|
425
|
+
export function isFutureDate(dateString: string): boolean;
|
|
426
|
+
export function isPastDate(dateString: string): boolean;
|
|
427
|
+
|
|
428
|
+
// =========================================================
|
|
429
|
+
// fileManager (from fileManager.js)
|
|
430
|
+
// =========================================================
|
|
431
|
+
interface DownloadFileOptions {
|
|
432
|
+
maxSize?: number;
|
|
433
|
+
onProgress?: (progress: number) => void;
|
|
434
|
+
fallbackFormats?: boolean;
|
|
435
|
+
csvDelimiter?: string;
|
|
436
|
+
excelOptions?: any; // Consider more specific type if possible
|
|
437
|
+
pdfOptions?: any; // Consider more specific type if possible
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
type FileType = "csv" | "json" | "txt" | "excel" | "pdf";
|
|
441
|
+
|
|
442
|
+
interface TableData {
|
|
443
|
+
headers: string[][];
|
|
444
|
+
rows: string[][];
|
|
445
|
+
footers: string[][];
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
interface ExtractTableDataOptions {
|
|
449
|
+
rowClass?: string;
|
|
450
|
+
cellClass?: string;
|
|
451
|
+
headerRowClass?: string;
|
|
452
|
+
footerRowClass?: string;
|
|
453
|
+
includeFooter?: boolean;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export function downloadFile(
|
|
457
|
+
data: string | Blob | object | any[],
|
|
458
|
+
fileType: FileType,
|
|
459
|
+
fileName?: string,
|
|
460
|
+
options?: DownloadFileOptions,
|
|
461
|
+
): Promise<void>;
|
|
462
|
+
|
|
463
|
+
export class DataExporter {
|
|
464
|
+
constructor(defaultFilename?: string);
|
|
465
|
+
exportToExcel(
|
|
466
|
+
table: HTMLElement,
|
|
467
|
+
options?: DownloadFileOptions & { filename?: string },
|
|
468
|
+
): Promise<void>;
|
|
469
|
+
exportToCSV(
|
|
470
|
+
table: HTMLElement,
|
|
471
|
+
options?: DownloadFileOptions & { filename?: string; delimiter?: string },
|
|
472
|
+
): Promise<void>;
|
|
473
|
+
exportToPDF(
|
|
474
|
+
table: HTMLElement,
|
|
475
|
+
options?: DownloadFileOptions & { filename?: string },
|
|
476
|
+
): Promise<void>;
|
|
477
|
+
extractTableData(
|
|
478
|
+
table: HTMLElement,
|
|
479
|
+
options?: ExtractTableDataOptions,
|
|
480
|
+
): TableData;
|
|
481
|
+
generateCsvContent(
|
|
482
|
+
tableData: TableData,
|
|
483
|
+
delimiter: string,
|
|
484
|
+
lineEnding: string,
|
|
485
|
+
includeBOM: boolean,
|
|
486
|
+
): string;
|
|
487
|
+
escapeCsvValue(value: any, delimiter: string): string;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// =========================================================
|
|
491
|
+
// camera (from camera.js)
|
|
492
|
+
// =========================================================
|
|
493
|
+
interface CameraModalOptions {
|
|
494
|
+
previewContainer?: string | HTMLElement | null;
|
|
495
|
+
onPictureTaken?: (imageData: string) => void;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export class CameraModal {
|
|
499
|
+
constructor(options?: CameraModalOptions);
|
|
500
|
+
open(): Promise<void>;
|
|
501
|
+
close(): void;
|
|
502
|
+
capture(): void;
|
|
503
|
+
usePicture(): void;
|
|
504
|
+
retake(): void;
|
|
505
|
+
switchCamera(): Promise<void>;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// =========================================================
|
|
509
|
+
// figures (from figures.js)
|
|
510
|
+
// =========================================================
|
|
511
|
+
type RoundingMethod = "round" | "floor" | "ceil" | "nearestUpper";
|
|
512
|
+
|
|
513
|
+
interface FormatNumberOptions {
|
|
514
|
+
decimalPlaces?: number;
|
|
515
|
+
roundToNearest?: number;
|
|
516
|
+
roundMethod?: RoundingMethod;
|
|
517
|
+
useGrouping?: boolean;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
interface FormatCurrencyOptions {
|
|
521
|
+
currency?: string;
|
|
522
|
+
symbol?: string;
|
|
523
|
+
decimalPlaces?: number;
|
|
524
|
+
useGrouping?: boolean;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
interface FormatPercentageOptions {
|
|
528
|
+
decimalPlaces?: number;
|
|
529
|
+
useGrouping?: boolean;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
interface AbbreviateNumberOptions {
|
|
533
|
+
decimalPlaces?: number;
|
|
534
|
+
suffixes?: string[];
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export function roundToNearest(
|
|
538
|
+
value: number,
|
|
539
|
+
nearest?: number,
|
|
540
|
+
method?: RoundingMethod,
|
|
541
|
+
): number;
|
|
542
|
+
export function formatNumber(
|
|
543
|
+
value: number,
|
|
544
|
+
options?: FormatNumberOptions,
|
|
545
|
+
): string;
|
|
546
|
+
export function formatCurrency(
|
|
547
|
+
value: number,
|
|
548
|
+
options?: FormatCurrencyOptions,
|
|
549
|
+
): string;
|
|
550
|
+
export function formatPercentage(
|
|
551
|
+
value: number,
|
|
552
|
+
options?: FormatPercentageOptions,
|
|
553
|
+
): string;
|
|
554
|
+
export function abbreviateNumber(
|
|
555
|
+
value: number,
|
|
556
|
+
options?: AbbreviateNumberOptions,
|
|
557
|
+
): string;
|
|
558
|
+
export function unformatNumber(formattedNumber: string): string;
|
|
559
|
+
export function getNumericValue(input: HTMLInputElement): number;
|
|
560
|
+
export function formatNumberInput(
|
|
561
|
+
input: HTMLInputElement,
|
|
562
|
+
options?: FormatNumberInputOptions,
|
|
563
|
+
): void; // Note: This is from figures.js, not inputHandlers
|
|
564
|
+
export function getRawInputValue(input: HTMLInputElement): string;
|
|
565
|
+
export function setInputValue(
|
|
566
|
+
input: HTMLInputElement,
|
|
567
|
+
value: number | string,
|
|
568
|
+
): void;
|
|
569
|
+
|
|
570
|
+
// =========================================================
|
|
571
|
+
// dependencyManager (from dependencyManager.js)
|
|
572
|
+
// =========================================================
|
|
573
|
+
interface DependencyConfig {
|
|
574
|
+
name: string;
|
|
575
|
+
cdn: string;
|
|
576
|
+
check: () => boolean;
|
|
577
|
+
requires?: string[];
|
|
578
|
+
integrity?: string;
|
|
579
|
+
fallbacks?: string[];
|
|
580
|
+
maxRetries?: number;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export class DependencyManager {
|
|
584
|
+
register(key: string, config: DependencyConfig): void;
|
|
585
|
+
hasDependency(libName: string): boolean;
|
|
586
|
+
ensureDependency(
|
|
587
|
+
libName: string,
|
|
588
|
+
fallbackAction?: () => any,
|
|
589
|
+
): Promise<boolean>;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export const dependencyManager: DependencyManager; // Export the singleton instance
|
|
593
|
+
|
|
594
|
+
// =========================================================
|
|
595
|
+
// Locations (from ug_locations.js)
|
|
596
|
+
// =========================================================
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Represents a location entity with ID and name
|
|
600
|
+
*/
|
|
601
|
+
interface LocationItem {
|
|
602
|
+
id: string;
|
|
603
|
+
name: string;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Complete address object returned when user confirms location selection
|
|
608
|
+
*/
|
|
609
|
+
interface SelectedAddress {
|
|
610
|
+
region: LocationItem;
|
|
611
|
+
district: LocationItem;
|
|
612
|
+
county: LocationItem;
|
|
613
|
+
subcounty: LocationItem;
|
|
614
|
+
village: LocationItem;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Error object returned when modal is cancelled
|
|
619
|
+
*/
|
|
620
|
+
interface AddressCancellationError extends Error {
|
|
621
|
+
message: string;
|
|
622
|
+
// Additional properties if any
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Locations utility object for fetching hierarchical location data
|
|
627
|
+
*/
|
|
628
|
+
export const Locations: {
|
|
629
|
+
/**
|
|
630
|
+
* Get all regions
|
|
631
|
+
* @returns Array of region objects with id and name
|
|
632
|
+
*/
|
|
633
|
+
getRegions(): LocationItem[];
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Get districts belonging to a specific region
|
|
637
|
+
* @param regionId - The ID of the region
|
|
638
|
+
* @returns Array of district objects with id and name
|
|
639
|
+
*/
|
|
640
|
+
getDistricts(regionId: string): LocationItem[];
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Get counties belonging to a specific district
|
|
644
|
+
* @param districtId - The ID of the district
|
|
645
|
+
* @returns Array of county objects with id and name
|
|
646
|
+
*/
|
|
647
|
+
getCounties(districtId: string): LocationItem[];
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Get sub-counties belonging to a specific county
|
|
651
|
+
* @param countyId - The ID of the county
|
|
652
|
+
* @returns Array of sub-county objects with id and name
|
|
653
|
+
*/
|
|
654
|
+
getSubCounties(countyId: string): LocationItem[];
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Get parishes belonging to a specific sub-county
|
|
658
|
+
* @param subCountyId - The ID of the sub-county
|
|
659
|
+
* @returns Array of parish objects with id and name
|
|
660
|
+
*/
|
|
661
|
+
getParishes(subCountyId: string): LocationItem[];
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Get villages belonging to a specific parish
|
|
665
|
+
* @param parishId - The ID of the parish
|
|
666
|
+
* @returns Array of village objects with id and name
|
|
667
|
+
*/
|
|
668
|
+
getVillages(parishId: string): LocationItem[];
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Opens a modal for selecting address/location information with cascading dropdowns
|
|
673
|
+
*
|
|
674
|
+
* This function displays a modal with five hierarchical dropdown selects (Region, District,
|
|
675
|
+
* County, Subcounty, Village) that allow users to select a complete address. The selections
|
|
676
|
+
* cascade such that each dropdown depends on the previous selection.
|
|
677
|
+
*
|
|
678
|
+
* @param onConfirm - Callback function executed when user confirms location selection.
|
|
679
|
+
* Receives a location object containing the selected address details.
|
|
680
|
+
* Example: `(location) => { console.log(location); }`
|
|
681
|
+
* @param onCancel - Optional callback function executed when user cancels or closes the modal.
|
|
682
|
+
* Receives an Error object with cancellation reason.
|
|
683
|
+
* Example: `(error) => { console.log(error.message); }`
|
|
684
|
+
*
|
|
685
|
+
* @returns The modal DOM element if successfully created, null if onConfirm callback is missing
|
|
686
|
+
*
|
|
687
|
+
* @throws {Alert} Shows an alert if the required onConfirm callback is not provided
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* // Basic usage with required callback
|
|
691
|
+
* getAddress(
|
|
692
|
+
* (location) => {
|
|
693
|
+
* console.log('Selected location:', location);
|
|
694
|
+
* // location structure:
|
|
695
|
+
* // {
|
|
696
|
+
* // region: { id: '1', name: 'Central Region' },
|
|
697
|
+
* // district: { id: '2', name: 'Kampala District' },
|
|
698
|
+
* // county: { id: '3', name: 'Kampala Central' },
|
|
699
|
+
* // subcounty: { id: '4', name: 'Central Division' },
|
|
700
|
+
* // village: { id: '5', name: 'Nakasero Village' }
|
|
701
|
+
* // }
|
|
702
|
+
* }
|
|
703
|
+
* );
|
|
704
|
+
*/
|
|
705
|
+
export function getAddress(
|
|
706
|
+
onConfirm: (location: SelectedAddress) => void,
|
|
707
|
+
onCancel?: (error: AddressCancellationError) => void,
|
|
708
|
+
): HTMLElement | null;
|
|
709
|
+
|
|
710
|
+
// =========================================================
|
|
711
|
+
// Icons (from icons.js)
|
|
712
|
+
// =========================================================
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Collection of SVG icon functions that return SVG strings
|
|
716
|
+
* All icons use "currentColor" so they can be colored via CSS
|
|
717
|
+
*/
|
|
718
|
+
export const icons: {
|
|
719
|
+
/**
|
|
720
|
+
* Heart/favorite icon
|
|
721
|
+
*/
|
|
722
|
+
heartIcon(): string;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Left arrow icon (pointing left)
|
|
726
|
+
*/
|
|
727
|
+
leftArrowIcon(): string;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Right arrow icon (pointing right)
|
|
731
|
+
*/
|
|
732
|
+
rightArrowIcon(): string;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Right arrow icon alternative
|
|
736
|
+
*/
|
|
737
|
+
rightArrowIcon2(): string;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Left arrow icon alternative
|
|
741
|
+
*/
|
|
742
|
+
leftArrowIcon2(): string;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Close/X icon for modals, notifications, etc.
|
|
746
|
+
*/
|
|
747
|
+
closeIcon(): string;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Close icon alternative
|
|
751
|
+
*/
|
|
752
|
+
closeIcon2(): string;
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Close icon alternative
|
|
756
|
+
*/
|
|
757
|
+
closeIcon3(): string;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Menu/hamburger icon (three horizontal lines)
|
|
761
|
+
*/
|
|
762
|
+
menuIcon(): string;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Hamburger menu icon alternative
|
|
766
|
+
*/
|
|
767
|
+
hamburgerIcon(): string;
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Hamburger menu icon alternative
|
|
771
|
+
*/
|
|
772
|
+
hamburgerIcon2(): string;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Hamburger menu icon alternative
|
|
776
|
+
*/
|
|
777
|
+
hamburgerIcon3(): string;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Search/magnifying glass icon
|
|
781
|
+
*/
|
|
782
|
+
searchIcon(): string;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* User/profile icon
|
|
786
|
+
*/
|
|
787
|
+
userIcon(): string;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Settings/gear icon
|
|
791
|
+
*/
|
|
792
|
+
settingsIcon(): string;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Logout/sign out icon
|
|
796
|
+
*/
|
|
797
|
+
logoutIcon(): string;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Home icon
|
|
801
|
+
*/
|
|
802
|
+
homeIcon(): string;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Profile icon (similar to user)
|
|
806
|
+
*/
|
|
807
|
+
profileIcon(): string;
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Notifications/bell icon
|
|
811
|
+
*/
|
|
812
|
+
notificationsIcon(): string;
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Messages/chat icon
|
|
816
|
+
*/
|
|
817
|
+
messagesIcon(): string;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Add/plus icon
|
|
821
|
+
*/
|
|
822
|
+
addIcon(): string;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Edit/pencil icon
|
|
826
|
+
*/
|
|
827
|
+
editIcon(): string;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Delete/trash icon
|
|
831
|
+
*/
|
|
832
|
+
deleteIcon(): string;
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Save icon
|
|
836
|
+
*/
|
|
837
|
+
saveIcon(): string;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Download icon
|
|
841
|
+
*/
|
|
842
|
+
downloadIcon(): string;
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Upload icon
|
|
846
|
+
*/
|
|
847
|
+
uploadIcon(): string;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Graduate/cap icon for education
|
|
851
|
+
*/
|
|
852
|
+
graduateIcon(): string;
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Work/briefcase icon
|
|
856
|
+
*/
|
|
857
|
+
workIcon(): string;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Work icon alternative
|
|
861
|
+
*/
|
|
862
|
+
workIcon2(): string;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* School/education icon
|
|
866
|
+
*/
|
|
867
|
+
schoolIcon(): string;
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* School icon alternative
|
|
871
|
+
*/
|
|
872
|
+
schoolIcon2(): string;
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Book icon for learning/literature
|
|
876
|
+
*/
|
|
877
|
+
bookIcon(): string;
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Book icon alternative
|
|
881
|
+
*/
|
|
882
|
+
bookIcon2(): string;
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Certificate/award icon
|
|
886
|
+
*/
|
|
887
|
+
certificateIcon(): string;
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Certificate icon alternative
|
|
891
|
+
*/
|
|
892
|
+
certificateIcon2(): string;
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Experience icon
|
|
896
|
+
*/
|
|
897
|
+
experienceIcon(): string;
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Experience icon alternative
|
|
901
|
+
*/
|
|
902
|
+
experienceIcon2(): string;
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Skills icon
|
|
906
|
+
*/
|
|
907
|
+
skillsIcon(): string;
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Skills icon alternative
|
|
911
|
+
*/
|
|
912
|
+
skillsIcon2(): string;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Projects icon
|
|
916
|
+
*/
|
|
917
|
+
projectsIcon(): string;
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Projects icon alternative
|
|
921
|
+
*/
|
|
922
|
+
projectsIcon2(): string;
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Language icon
|
|
926
|
+
*/
|
|
927
|
+
languageIcon(): string;
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Hobby/interest icon
|
|
931
|
+
*/
|
|
932
|
+
hobbyIcon(): string;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Award/achievement icon
|
|
936
|
+
*/
|
|
937
|
+
awardIcon(): string;
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* Award icon alternative
|
|
941
|
+
*/
|
|
942
|
+
awardIcon2(): string;
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Excel file icon
|
|
946
|
+
*/
|
|
947
|
+
excelIcon(): string;
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* PDF file icon
|
|
951
|
+
*/
|
|
952
|
+
pdfIcon(): string;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* CSV file icon
|
|
956
|
+
*/
|
|
957
|
+
csvIcon(): string;
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Refresh/reload icon
|
|
961
|
+
*/
|
|
962
|
+
refreshIcon(): string;
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Refresh icon alternative
|
|
966
|
+
*/
|
|
967
|
+
refreshIcon2(): string;
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Brightness/theme icon
|
|
971
|
+
*/
|
|
972
|
+
brightnessIcon(): string;
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Brightness icon alternative
|
|
976
|
+
*/
|
|
977
|
+
brightnessIcon2(): string;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Branch/fork icon
|
|
981
|
+
*/
|
|
982
|
+
branchIcon(): string;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Branch icon alternative
|
|
986
|
+
*/
|
|
987
|
+
branchIcon2(): string;
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Phone icon
|
|
991
|
+
*/
|
|
992
|
+
phoneIcon(): string;
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Phone icon alternative
|
|
996
|
+
*/
|
|
997
|
+
phoneIcon2(): string;
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Email icon
|
|
1001
|
+
*/
|
|
1002
|
+
emailIcon(): string;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Email icon alternative
|
|
1006
|
+
*/
|
|
1007
|
+
emailIcon2(): string;
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* Location/pin icon
|
|
1011
|
+
*/
|
|
1012
|
+
locationIcon(): string;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Location icon alternative
|
|
1016
|
+
*/
|
|
1017
|
+
locationIcon2(): string;
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Messenger/chat icon
|
|
1021
|
+
*/
|
|
1022
|
+
messengerIcon(): string;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Messenger icon alternative
|
|
1026
|
+
*/
|
|
1027
|
+
messengerIcon2(): string;
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Toggle on/switch icon (on state)
|
|
1031
|
+
*/
|
|
1032
|
+
toggleOnIcon(): string;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Toggle on icon alternative
|
|
1036
|
+
*/
|
|
1037
|
+
toggleOnIcon2(): string;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* Toggle on icon alternative
|
|
1041
|
+
*/
|
|
1042
|
+
toggleOnIcon3(): string;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Toggle off/switch icon (off state)
|
|
1046
|
+
*/
|
|
1047
|
+
toggleOffIcon(): string;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Toggle off icon alternative
|
|
1051
|
+
*/
|
|
1052
|
+
toggleOffIcon2(): string;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Toggle off icon alternative
|
|
1056
|
+
*/
|
|
1057
|
+
toggleOffIcon3(): string;
|
|
1058
|
+
|
|
1059
|
+
crashIcon(): string;
|
|
1060
|
+
|
|
1061
|
+
networkErrorIcon(): string;
|
|
1062
|
+
|
|
1063
|
+
smsIcon(): string;
|
|
1064
|
+
smsIcon2(): string;
|
|
1065
|
+
smsIcon3(): string;
|
|
1066
|
+
logsIcon(): string;
|
|
1067
|
+
institutionIcon(): string;
|
|
1068
|
+
medicalLabIcon(): string;
|
|
1069
|
+
firstAidIcon(): string;
|
|
1070
|
+
shieldIcon(): string;
|
|
1071
|
+
// PlusIcon(): string;
|
|
1072
|
+
libraryIcon(): string;
|
|
1073
|
+
chatBubbleIcon(): string;
|
|
1074
|
+
exclamationIcon(): string;
|
|
1075
|
+
bellIcon(): string;
|
|
1076
|
+
computerIcon(): string;
|
|
1077
|
+
savingsPotIcon(): string;
|
|
1078
|
+
calendarIcon(): string;
|
|
1079
|
+
collectionIcon(): string;
|
|
1080
|
+
userGroupIcon(): string;
|
|
1081
|
+
folderIcon(): string;
|
|
1082
|
+
pencilEditIcon(): string;
|
|
1083
|
+
identificationIcon(): string;
|
|
1084
|
+
usersIcon(): string;
|
|
1085
|
+
trendingUpIcon(): string;
|
|
1086
|
+
clockIcon(): string;
|
|
1087
|
+
eyeIcon(): string;
|
|
1088
|
+
inboxInIcon(): string;
|
|
1089
|
+
lightBulbIcon(): string;
|
|
1090
|
+
newsPaperIcon(): string;
|
|
1091
|
+
addUserIcon(): string;
|
|
1092
|
+
squarePlusIcon(): string;
|
|
1093
|
+
circlePlusIcon(): string;
|
|
1094
|
+
wrenchIcon(): string;
|
|
1095
|
+
pencilIcon(): string;
|
|
1096
|
+
reportDirectoryIcon(): string;
|
|
1097
|
+
shareIcon(): string;
|
|
1098
|
+
trashIcon(): string;
|
|
1099
|
+
accountSettingsIcon(): string;
|
|
1100
|
+
calculatorIcon(): string;
|
|
1101
|
+
unitedIcon(): string;
|
|
1102
|
+
complianceIcon(): string;
|
|
1103
|
+
savingsIcon(): string;
|
|
1104
|
+
auditTrailIcon(): string;
|
|
1105
|
+
filledAddIcon(): string;
|
|
1106
|
+
backIcon(): string;
|
|
1107
|
+
schemeIcon(): string;
|
|
1108
|
+
sharesIcon(): string;
|
|
1109
|
+
cupCakeIcon(): string;
|
|
1110
|
+
swimmingIcon(): string;
|
|
1111
|
+
runningcon(): string;
|
|
1112
|
+
meditationIcon(): string;
|
|
1113
|
+
writeIcon(): string;
|
|
1114
|
+
codeIcon(): string;
|
|
1115
|
+
codeIcon2(): string;
|
|
1116
|
+
movieIcon(): string;
|
|
1117
|
+
movieIcon2(): string;
|
|
1118
|
+
plantIcon(): string;
|
|
1119
|
+
wheelbarrelIcon(): string;
|
|
1120
|
+
whistleIcon(): string;
|
|
1121
|
+
artPalleteIcon(): string;
|
|
1122
|
+
shoppingTrollyIcon(): string;
|
|
1123
|
+
danceIcon(): string;
|
|
1124
|
+
bookIcon3(): string;
|
|
1125
|
+
trainIcon(): string;
|
|
1126
|
+
suitCaseIcon(): string;
|
|
1127
|
+
strongArmIcon(): string;
|
|
1128
|
+
fitnessIcon(): string;
|
|
1129
|
+
dumbellIcon(): string;
|
|
1130
|
+
cheffIcon(): string;
|
|
1131
|
+
cookingIcon(): string;
|
|
1132
|
+
cookingIcon2(): string;
|
|
1133
|
+
planeIcon(): string;
|
|
1134
|
+
transportation(): string;
|
|
1135
|
+
gamingIcon(): string;
|
|
1136
|
+
gamingIcon2(): string;
|
|
1137
|
+
gamingIcon3(): string;
|
|
1138
|
+
musicIcon(): string;
|
|
1139
|
+
musicIcon2(): string;
|
|
1140
|
+
musicIcon3(): string;
|
|
1141
|
+
christianIcon(): string;
|
|
1142
|
+
islamIcon(): string;
|
|
1143
|
+
loveChatIcon(): string;
|
|
1144
|
+
chatIcon(): string;
|
|
1145
|
+
chatIcon2(): string;
|
|
1146
|
+
heartBrokenIcon(): string;
|
|
1147
|
+
ringsIcon(): string;
|
|
1148
|
+
cupIcon(): string;
|
|
1149
|
+
cupIcon2(): string;
|
|
1150
|
+
cupIcon3(): string;
|
|
1151
|
+
heartsIcon(): string;
|
|
1152
|
+
heartsIcon2(): string;
|
|
1153
|
+
heartsIcon3(): string;
|
|
1154
|
+
inLoveIcon(): string;
|
|
1155
|
+
tickIcon(): string;
|
|
1156
|
+
addIcon2(): string;
|
|
1157
|
+
uploadIcon2(): string;
|
|
1158
|
+
downloadIcon2(): string;
|
|
1159
|
+
pauseIcon(): string;
|
|
1160
|
+
pauseIcon2(): string;
|
|
1161
|
+
cameraIcon(): string;
|
|
1162
|
+
cameraIcon2(): string;
|
|
1163
|
+
heartIcon(): string;
|
|
1164
|
+
viewIcon(): string;
|
|
1165
|
+
hideIcon(): string;
|
|
1166
|
+
lockIcon(): string;
|
|
1167
|
+
lockIcon2(): string;
|
|
1168
|
+
leftArrowIcon(): string;
|
|
1169
|
+
leftArrowIcon(): string;
|
|
1170
|
+
|
|
1171
|
+
messagesIcon2(): string;
|
|
1172
|
+
outgoingEmailIcon(): string;
|
|
1173
|
+
incomingEmailIcon(): string;
|
|
1174
|
+
unsentMailIcon(): string;
|
|
1175
|
+
attachIcon(): string;
|
|
1176
|
+
attachIcon2(): string;
|
|
1177
|
+
telephoneIcon(): string;
|
|
1178
|
+
telephoneIcon2(): string;
|
|
1179
|
+
failedCallsIcon(): string;
|
|
1180
|
+
contactIcon(): string;
|
|
1181
|
+
|
|
1182
|
+
csvIcon2(): string;
|
|
1183
|
+
csvIcon3(): string;
|
|
1184
|
+
dashboardIcon(): string;
|
|
1185
|
+
dashboardIcon2(): string;
|
|
1186
|
+
excelIcon2(): string;
|
|
1187
|
+
|
|
1188
|
+
homeIcon2(): string;
|
|
1189
|
+
logoutIcon2(): string;
|
|
1190
|
+
logoutIcon3(): string;
|
|
1191
|
+
pdfIcon2(): string;
|
|
1192
|
+
userIcon2(): string;
|
|
1193
|
+
settingsIcon2(): string;
|
|
1194
|
+
rightArrowIcon3(): string;
|
|
1195
|
+
leftArrowIcon3(): string;
|
|
1196
|
+
playIcon(): string;
|
|
1197
|
+
playIcon2(): string;
|
|
1198
|
+
privacyIcon(): string;
|
|
1199
|
+
privacyIcon2(): string;
|
|
1200
|
+
infoIcon(): string;
|
|
1201
|
+
bulbIcon(): string;
|
|
1202
|
+
|
|
1203
|
+
checkMarkIcon(): string;
|
|
1204
|
+
checkMarkIcon1(): string;
|
|
1205
|
+
checkMarkIcon3(): string;
|
|
1206
|
+
|
|
1207
|
+
phoneLockIcon(): string;
|
|
1208
|
+
phoneSMSicon(): string;
|
|
1209
|
+
phoneSMSicon2(): string;
|
|
1210
|
+
|
|
1211
|
+
galleryIcon(): string;
|
|
1212
|
+
galleryIcon2(): string;
|
|
1213
|
+
galleryIcon3(): string;
|
|
1214
|
+
|
|
1215
|
+
historyIcon(): string;
|
|
1216
|
+
replayIcon(): string;
|
|
1217
|
+
forwardIcon(): string;
|
|
1218
|
+
forwardIcon2(): string;
|
|
1219
|
+
shareIcon2(): string;
|
|
1220
|
+
shareIcon3(): string;
|
|
1221
|
+
sendIcon(): string;
|
|
1222
|
+
sendIcon2(): string;
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
//============================================================================
|
|
1226
|
+
// app loader to render different views
|
|
1227
|
+
//============================================================================
|
|
1228
|
+
/**
|
|
1229
|
+
* Configuration for a single view
|
|
1230
|
+
*/
|
|
1231
|
+
export interface ViewConfig {
|
|
1232
|
+
/** Path to the HTML file for the view (required) */
|
|
1233
|
+
html: string;
|
|
1234
|
+
/** Path to the CSS file for the view (optional) */
|
|
1235
|
+
css?: string;
|
|
1236
|
+
/** Path to the JavaScript module for the view (optional) */
|
|
1237
|
+
js?: string;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Collection of view configurations keyed by view name
|
|
1242
|
+
*/
|
|
1243
|
+
export interface ViewConfigs {
|
|
1244
|
+
[viewName: string]: ViewConfig;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Structure of a view module that can be dynamically imported
|
|
1249
|
+
*/
|
|
1250
|
+
export interface ViewModule {
|
|
1251
|
+
/** Optional initialization function called when view loads */
|
|
1252
|
+
init?: () => void;
|
|
1253
|
+
/** Optional cleanup function called when view unloads */
|
|
1254
|
+
cleanup?: () => void;
|
|
1255
|
+
/** Any other exports from the module */
|
|
1256
|
+
[key: string]: any;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* AppLoader - A dynamic view loader for single-page applications
|
|
1261
|
+
*/
|
|
1262
|
+
export class AppLoader {
|
|
1263
|
+
/**
|
|
1264
|
+
* Creates an instance of AppLoader
|
|
1265
|
+
* @param viewConfigs - Configuration object for all views
|
|
1266
|
+
*/
|
|
1267
|
+
constructor(viewConfigs: ViewConfigs);
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Loads a view by its ID, including its HTML, CSS, and JavaScript
|
|
1271
|
+
* @param viewId - The ID of the container element (should end with "-view")
|
|
1272
|
+
* @returns Promise that resolves when the view is loaded
|
|
1273
|
+
*/
|
|
1274
|
+
loadView(viewId: string): Promise<void>;
|
|
1275
|
+
|
|
1276
|
+
/**
|
|
1277
|
+
* Loads a CSS file for a specific view
|
|
1278
|
+
* @param viewName - Name of the view
|
|
1279
|
+
* @param cssPath - Path to the CSS file
|
|
1280
|
+
*/
|
|
1281
|
+
private loadCSS(viewName: string, cssPath: string): Promise<void>;
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Dynamically imports a JavaScript module for a specific view
|
|
1285
|
+
* @param viewName - Name of the view
|
|
1286
|
+
* @param jsPath - Path to the JavaScript module
|
|
1287
|
+
*/
|
|
1288
|
+
private loadJS(viewName: string, jsPath: string): Promise<void>;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Unloads a view and cleans up its resources
|
|
1292
|
+
* @param viewName - Name of the view to unload
|
|
1293
|
+
*/
|
|
1294
|
+
private unloadView(viewName: string): Promise<void>;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
// =========================================================
|
|
1298
|
+
// WebSocket (from websockets/index.js)
|
|
1299
|
+
// =========================================================
|
|
1300
|
+
|
|
1301
|
+
interface WebSocketReconnectOptions {
|
|
1302
|
+
maxAttempts?: number;
|
|
1303
|
+
baseDelay?: number;
|
|
1304
|
+
maxDelay?: number;
|
|
1305
|
+
jitter?: boolean;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
interface WebSocketHeartbeatOptions {
|
|
1309
|
+
enabled?: boolean;
|
|
1310
|
+
interval?: number;
|
|
1311
|
+
timeout?: number;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
interface WebSocketTransportOptions {
|
|
1315
|
+
transports?: string[];
|
|
1316
|
+
pollingInterval?: number;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
interface WebSocketClientOptions {
|
|
1320
|
+
autoConnect?: boolean;
|
|
1321
|
+
timeout?: number;
|
|
1322
|
+
reconnect?: boolean;
|
|
1323
|
+
reconnectOptions?: WebSocketReconnectOptions;
|
|
1324
|
+
heartbeat?: WebSocketHeartbeatOptions;
|
|
1325
|
+
transport?: WebSocketTransportOptions;
|
|
1326
|
+
debug?: boolean;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
interface WebSocketStatus {
|
|
1330
|
+
connected: boolean;
|
|
1331
|
+
state: string;
|
|
1332
|
+
url: string;
|
|
1333
|
+
transport: string;
|
|
1334
|
+
latency?: number;
|
|
1335
|
+
uptime: number;
|
|
1336
|
+
messagesSent: number;
|
|
1337
|
+
messagesReceived: number;
|
|
1338
|
+
reconnectAttempts: number;
|
|
1339
|
+
networkOnline: boolean;
|
|
1340
|
+
browser: string;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
export class WebSocketClient {
|
|
1344
|
+
constructor(url: string, options?: WebSocketClientOptions);
|
|
1345
|
+
|
|
1346
|
+
// Core methods
|
|
1347
|
+
connect(): Promise<void>;
|
|
1348
|
+
disconnect(code?: number, reason?: string): Promise<void>;
|
|
1349
|
+
send(data: any): void;
|
|
1350
|
+
sendWithAck(type: string, data: any, timeout?: number): Promise<any>;
|
|
1351
|
+
reconnect(): Promise<void>;
|
|
1352
|
+
destroy(): void;
|
|
1353
|
+
|
|
1354
|
+
// Event handling
|
|
1355
|
+
on(event: string, handler: (data: any) => void): this;
|
|
1356
|
+
off(event: string, handler?: (data: any) => void): this;
|
|
1357
|
+
onMessage(type: string, handler: (data: any) => void): this;
|
|
1358
|
+
offMessage(type: string, handler?: (data: any) => void): this;
|
|
1359
|
+
|
|
1360
|
+
// Status
|
|
1361
|
+
isConnected(): boolean;
|
|
1362
|
+
isHealthy(): boolean;
|
|
1363
|
+
getStatus(): WebSocketStatus;
|
|
1364
|
+
getTransportType(): string;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
// Feature: Namespaces
|
|
1368
|
+
export class Namespace {
|
|
1369
|
+
constructor(path: string, socket: WebSocketClient, options?: any);
|
|
1370
|
+
on(event: string, handler: Function): this;
|
|
1371
|
+
emit(event: string, data: any, options?: any): void;
|
|
1372
|
+
joinRoom(roomName: string, userId: string): Promise<boolean>;
|
|
1373
|
+
leaveRoom(roomName: string, userId: string): void;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
// Feature: Rooms
|
|
1377
|
+
export class Room {
|
|
1378
|
+
constructor(name: string, options?: any);
|
|
1379
|
+
addMember(userId: string, data?: any): boolean;
|
|
1380
|
+
removeMember(userId: string, reason?: string): boolean;
|
|
1381
|
+
broadcast(event: string, data: any, except?: string[]): void;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
// Utilities
|
|
1385
|
+
export function isOnline(): boolean;
|
|
1386
|
+
export function generateId(prefix?: string): string;
|
|
1387
|
+
|
|
1388
|
+
// =========================================================
|
|
1389
|
+
// Intersection Observer Watcher (from observers/watcher.js)
|
|
1390
|
+
// =========================================================
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Options for watching an element's visibility
|
|
1394
|
+
*/
|
|
1395
|
+
interface WatchElementOptions {
|
|
1396
|
+
/** Called when element enters the viewport (or meets threshold) */
|
|
1397
|
+
onEnter?: (element: Element, entry: IntersectionObserverEntry) => void;
|
|
1398
|
+
/** Called when element exits the viewport */
|
|
1399
|
+
onExit?: (element: Element, entry: IntersectionObserverEntry) => void;
|
|
1400
|
+
/** Visibility ratio to trigger (0-1), or array of ratios */
|
|
1401
|
+
threshold?: number | number[];
|
|
1402
|
+
/** Margin around the root (CSS values, e.g. '100px' or '10% 20px') */
|
|
1403
|
+
rootMargin?: string;
|
|
1404
|
+
/** Scrolling container element (null = viewport) */
|
|
1405
|
+
root?: Element | null;
|
|
1406
|
+
/** If true, automatically stop watching after the first onEnter trigger */
|
|
1407
|
+
triggerOnce?: boolean;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Statistics about active watchers
|
|
1412
|
+
*/
|
|
1413
|
+
interface WatcherStats {
|
|
1414
|
+
/** Total number of elements being watched */
|
|
1415
|
+
elements: number;
|
|
1416
|
+
/** Total number of registered callbacks */
|
|
1417
|
+
callbacks: number;
|
|
1418
|
+
/** Number of active observer pools */
|
|
1419
|
+
pools: number;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Watch a single element for visibility changes
|
|
1424
|
+
*
|
|
1425
|
+
* @param target - DOM element or CSS selector
|
|
1426
|
+
* @param options - Configuration with onEnter/onExit callbacks
|
|
1427
|
+
* @returns Cleanup function to stop watching
|
|
1428
|
+
*/
|
|
1429
|
+
export function watchElement(
|
|
1430
|
+
target: Element | string,
|
|
1431
|
+
options: WatchElementOptions,
|
|
1432
|
+
): () => void;
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Watch multiple elements matching a CSS selector
|
|
1436
|
+
*
|
|
1437
|
+
* @param selector - CSS selector matching one or more elements
|
|
1438
|
+
* @param options - Configuration with onEnter/onExit callbacks
|
|
1439
|
+
* @returns Cleanup function to stop watching all matched elements
|
|
1440
|
+
*/
|
|
1441
|
+
export function watchAll(
|
|
1442
|
+
selector: string,
|
|
1443
|
+
options: WatchElementOptions,
|
|
1444
|
+
): () => void;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* Stop watching all elements across all pools
|
|
1448
|
+
*/
|
|
1449
|
+
export function stopWatchingAll(): void;
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Check if an element is currently being watched
|
|
1453
|
+
*
|
|
1454
|
+
* @param element - The DOM element to check
|
|
1455
|
+
* @returns True if element has active watchers
|
|
1456
|
+
*/
|
|
1457
|
+
export function isBeingWatched(element: Element): boolean;
|
|
1458
|
+
|
|
1459
|
+
/**
|
|
1460
|
+
* Get statistics about active watchers
|
|
1461
|
+
*
|
|
1462
|
+
* @returns Object with element, callback, and pool counts
|
|
1463
|
+
*/
|
|
1464
|
+
export function getWatcherStats(): WatcherStats;
|
|
1465
|
+
}
|