dphelper 1.9.74 → 1.9.80

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/types/cache.d.ts DELETED
@@ -1,27 +0,0 @@
1
- /*!
2
- dphelper
3
- Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
4
- Licensed under MIT License, see
5
- https://dario.passariello.ca
6
- */
7
-
8
- /**
9
- * Cache is used for internal use only... but you can use if you need.
10
- * @return Some stuff you cache... usually used for dynamic imports from dphelper.
11
- */
12
-
13
- interface _cache {
14
-
15
- /**
16
- * Create a cache, please use state instead!
17
- *
18
- * @example
19
- * cache.myCache = any
20
- *
21
- * @since dphelper 1.0.6
22
- */
23
- [key: string]: any
24
- }
25
-
26
- declare var cache: _cache
27
- type cache = _cache
@@ -1,572 +0,0 @@
1
- /*!
2
- dphelper
3
- Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
4
- Licensed under MIT License, see
5
- https://dario.passariello.ca
6
- */
7
-
8
- ////////////////////
9
- // Global object
10
- ////////////////////
11
-
12
- /**
13
- * @return dphelper Root.
14
- */
15
- interface _dphelper {
16
- /**
17
- * Dynamic index signature for additional properties
18
- * @private
19
- */
20
- [key: string]: any
21
-
22
- /**
23
- * Anchor manipulation utilities
24
- */
25
- anchor: {
26
- /**
27
- * Converts anchor tags to onClick events
28
- * @param selector - CSS selector for target elements
29
- */
30
- toOnClick(selector: string): void
31
- }
32
-
33
- /**
34
- * Array manipulation utilities
35
- */
36
- array: {
37
- /**
38
- * Finds an element in an array by key
39
- * @param array - Input array to search
40
- * @param key - Key to search for
41
- * @returns Found element or undefined
42
- */
43
- find<T>(array: T[], key: any): T | any
44
-
45
- /**
46
- * Returns array with unique values
47
- * @param array - Input array
48
- * @returns New array with unique values
49
- */
50
- unique<T>(array: T[]): T[]
51
-
52
- /**
53
- * Deletes an element from array by key
54
- * @param array - Input array
55
- * @param key - Key to delete
56
- */
57
- delete<T>(array: T[], key: keyof T): void
58
-
59
- /**
60
- * Merges two arrays
61
- * @param arrayA - First array
62
- * @param arrayB - Second array
63
- * @returns Merged array
64
- */
65
- merge<T>(arrayA: T[], arrayB: T[]): T[]
66
-
67
- /**
68
- * Merges two arrays based on a key
69
- * @param arrayA - First array
70
- * @param arrayB - Second array
71
- * @param key - Key to merge on
72
- * @returns Merged array
73
- */
74
- mergeByKey<T extends Record<string, any>>(arrayA: T[], arrayB: T[], key: keyof T): T[]
75
-
76
- /**
77
- * Sorts array in ascending order
78
- * @param array - Input array
79
- * @returns Sorted array
80
- */
81
- asc<T>(array: T[]): T[]
82
-
83
- /**
84
- * Sorts array in descending order
85
- * @param array - Input array
86
- * @returns Sorted array
87
- */
88
- desc<T>(array: T[]): T[]
89
-
90
- /**
91
- * Finds duplicate values in array
92
- * @param array - Input array
93
- * @returns Array of duplicate values
94
- */
95
- duplicates<T>(array: T[]): T[]
96
-
97
- /**
98
- * Returns even elements from array
99
- * @param array - Input array
100
- * @returns Array with even elements
101
- */
102
- even<T>(array: T[]): T[]
103
-
104
- /**
105
- * Returns odd elements from array
106
- * @param array - Input array
107
- * @returns Array with odd elements
108
- */
109
- odd<T>(array: T[]): T[]
110
-
111
- /**
112
- * Converts array to object
113
- * @param array - Input array
114
- * @returns Resulting object
115
- */
116
- toObj<T>(array: T[]): Record<string, T>
117
-
118
- /**
119
- * Sums values in a specific column of 2D array
120
- * @param array - Input 2D array
121
- * @param column - Column index to sum
122
- * @returns Sum of values
123
- */
124
- sumColumn(array: number[][], column: number): number
125
-
126
- /**
127
- * Shuffles array elements randomly
128
- * @param array - Input array
129
- * @returns Shuffled array
130
- */
131
- shuffle<T>(array: T[]): T[]
132
-
133
- /**
134
- * Generates array with sequential numbers
135
- * @param num - Length of array to generate
136
- * @returns Generated array
137
- */
138
- generate(num: number): number[]
139
-
140
- /**
141
- * Tests if array contains only integers
142
- * @param array - Input array
143
- * @returns Array of valid integers
144
- */
145
- testArrayInt(array: unknown[]): number[]
146
-
147
- /**
148
- * Generates random 32-bit number
149
- * @param number - Upper bound
150
- * @returns Random number
151
- */
152
- rand32(number: number): number
153
-
154
- /**
155
- * Finds index of element by key
156
- * @param array - Input array
157
- * @param key - Key to search for
158
- * @returns Found index or -1
159
- */
160
- findindex<T>(array: T[], key: any): number
161
-
162
- /**
163
- * Converts path array to JSON object
164
- * @param array - Input array
165
- * @param separator - Path separator
166
- * @returns Resulting object
167
- */
168
- pathToJson(array: string[], separator?: string): Record<string, unknown>
169
-
170
- /**
171
- * Deep clones an object or array
172
- * @param src - Source to clone
173
- * @returns Cloned copy
174
- */
175
- deepClone<T>(src: T): T
176
-
177
- /**
178
- * Checks if arrays have matching elements
179
- * @param arrayWords - Array of words to match
180
- * @param arrayToCheck - Array to check against
181
- * @returns Whether arrays match
182
- */
183
- match(arrayWords: string[], arrayToCheck: string[]): boolean
184
- }
185
-
186
- audio: {
187
- play: (url: string) => void
188
- }
189
-
190
- avoid: {
191
- cache: (uri: string) => string
192
- }
193
-
194
- browser: {
195
- state(state: any, title: any, url: any): void
196
- forw(times: number): void
197
- back(times: number): void
198
- reload(): void
199
- href(url: string): void
200
- offLine(text?: string): void
201
- zoom(): number
202
- status(code: number): string
203
- }
204
-
205
- check: {
206
- url: (url: string) => any
207
- version: (v1: string, v2: string, opts: any) => any
208
- npmVer: (npm: string) => any
209
- }
210
-
211
- color: {
212
- hex: (c: any) => string
213
- toHex: (rgb: any) => string
214
- toRGB: (c: any) => []
215
- oleColor: (c: any) => string
216
- gradient: (colorStart: any, colorEnd: any, colorCount: any) => any
217
-
218
- }
219
-
220
- console: {
221
- info(name: string, message: string, fn: Function): void
222
- stop(options?: string[]): void
223
- toHtml(el: string): void
224
- }
225
-
226
- cookie: {
227
- set: (pars: {
228
- name: any,
229
- value: any,
230
- time?: any,
231
- path?: "/",
232
- sameSite?: "Lax",
233
- secure?: "Secure" | "false"
234
- }) => any
235
- get: (name: string) => any
236
- delete: (name: string) => any
237
- removeAll: () => any
238
- }
239
-
240
- coords: {
241
- degreesToRadians: (degrees: any) => any
242
- latToMeters: (points: any) => any
243
- toVector: (points: any) => any
244
- convertToDecDegrees: (deg: any, minutes: any, sec: any, direction: any) => any
245
- distance: (point1: any, point2: any) => any
246
- polarToCartesian: (centerX: any, centerY: any, radius: any, angleInDegrees: any) => any
247
- mapDegreesToPixels: (degree: number, minDegree: number, maxDegree: number, minPixel: number, maxPixel: number, padding: number) => number
248
- }
249
-
250
- date: {
251
- days: (lang?: string) => string[]
252
- months: (lang?: string) => string[]
253
- year: () => number
254
- toIso: (value: any, int?: string) => string | null
255
- toMMDDYYYY: (value: any) => string
256
- toYYYYMMDD: (value: any) => string | undefined
257
- toHuman: (value: any) => string
258
- convert: (value: any, format: string[]) => string | null
259
- iso2Epoch: (value: any) => number
260
- localIsoTime: (value: any) => string
261
- utc: () => string
262
- parse: (value: any, separator?: string) => string | null
263
- addDays: (date: any, days: number) => Date
264
- dateTimeToString: (dateObject: any) => string
265
- isoToHuman: (value: any, symbol?: string) => string | null
266
- fullDate: () => string
267
- epoch: () => number
268
- diffInDays: (d1: any, d2: any) => number
269
- diffInWeeks: (d1: any, d2: any) => number
270
- diffInMonths: (d1: any, d2: any) => number
271
- diffInYears: (d1: any, d2: any) => number
272
- dateToYMD: (date: any) => string
273
- collection: (params: { date?: Date; type: string; locale?: string }) => string | undefined
274
- timeZones: () => string[]
275
- }
276
-
277
- disable: {
278
- select: (el?: string) => void
279
- spellCheck: (tmr?: number) => void
280
- rightClick: (el?: string) => void
281
- copy: (el?: string) => void
282
- paste: (el?: string) => void
283
- cut: (el?: string) => void
284
- drag: (el?: string) => void
285
- }
286
-
287
- dispatch: {
288
- set: (name: string, value?: any) => void
289
- listen: (name: string, cb?: (e: Event) => void, flag?: boolean) => void
290
- remove: (name: string) => void
291
- }
292
-
293
- element: {
294
- fitScale: (el: any, scale?: number, fit?: boolean) => void
295
- scaleBasedOnWindow: (elm: any, scale: number, fit: boolean) => void
296
- }
297
-
298
- events: {
299
- list: (el: Element) => any
300
- multi: (element: Element, eventNames: string, listener: EventListener) => void
301
- copy: (el: string) => void
302
- onDrag: (elem: string) => void
303
- keys: (e: KeyboardEvent) => { key: string; ctrl: boolean; alt: boolean; shift: boolean }
304
- }
305
-
306
- form: {
307
- serialize: (form: HTMLFormElement) => { [key: string]: any }
308
- confirmType: (type: string, value: any) => boolean
309
- required: (value: any) => string | undefined
310
- minLength: (value: any, num?: number) => string | undefined
311
- maxLength: (value: any, num?: number) => string | undefined
312
- maxPhoneNumber: (value: any, num?: number) => string | undefined
313
- isNumeric: (value: any) => boolean
314
- isEmail: (value: any) => boolean
315
- pattern: (e: Event) => void
316
- noSpecialChars: (e: Event) => void
317
- table: (size: [number, number], id: string, elem: HTMLElement) => void
318
- sanitize: (str: string) => string | undefined
319
- }
320
-
321
- format: {
322
- currency: (value: number, locale?: string, currency?: string) => string
323
- phoneNumber: (value: string, countryCode?: string) => string
324
- }
325
-
326
- imports: {
327
- file: (elem: string, file: string) => Promise<void>
328
- }
329
-
330
- json: {
331
- counter: (json: any, key?: string, val?: any) => number | null
332
- toCsv: (jsonInput: any) => string
333
- saveCsvAs: (csvData: string, fileName: string) => void
334
- is: (str: string) => boolean
335
- parse: (file: string) => any
336
- sanitize: (str: string) => string
337
- sanitizeJsonValue: (str: string) => string
338
- }
339
-
340
- load: {
341
- all: (context, cacheName?: string) => void
342
- file: (filePath: string) => Promise<string>
343
- fileToElement: (elementSelector: string, filePath: string) => Promise<void>
344
- json: (filePath: string) => Promise<any>
345
- remote: (path: string, method?: string, headers?: HeadersInit) => Promise<any>
346
- script: (scripts: string[], elementSelector?: string) => void
347
- toJson: (context, cacheName?: string) => void
348
- }
349
-
350
- logging: {
351
- list: {
352
- type: string
353
- message: string
354
- }
355
- reg: (txt: string) => void
356
- debug: (txt: string) => void
357
- error: (txt: string) => void
358
- }
359
-
360
- math: {
361
- rnd: () => number
362
- tmr: () => number
363
- add: (a: number, b: number) => number
364
- sub: (a: number, b: number) => number
365
- multi: (a: number, b: number) => number
366
- div: (a: number, b: number) => number
367
- rem: (a: number, b: number) => number
368
- exp: (a: number, b: number) => number
369
- isOdd: (a: number) => boolean
370
- float2int: (a: number) => number
371
- percent: (n: number, tot: number) => number
372
- isPrime: (n: number) => boolean
373
- }
374
-
375
- memory: {
376
- lock: (obj: string) => void
377
- unlock: (obj: string) => void
378
- }
379
-
380
- object: {
381
- toArray: (object: Record<string, any>) => [string, any][]
382
- replaceNullObjects: (data: Record<string, any>) => Record<string, any>
383
- serialize: (value: any) => any
384
- deSerialize: (valueNew: any) => any
385
- sort: (o: Record<string, any>) => Record<string, any>
386
- toXML: (obj: Record<string, any>) => string
387
- find: (array: any[], key: string, value: any) => any
388
- instance: (obj: any) => any
389
- updateByKey: (obj: Record<string, any>, key: string, newValue: any) => Record<string, any>
390
- findindex: (array: any[], key: string) => number
391
- parse: (val: any) => any
392
- isObject: (val: any) => boolean
393
- diff: (obj1: Record<string, any>, obj2: Record<string, any>) => Record<string, { obj1: any, obj2: any }>
394
- path: (prop: string, array: string[], separator?: string) => string
395
- }
396
-
397
- path: {
398
- rail: () => string[]
399
- hash: () => string[]
400
- query: (url: string) => Record<string, string>
401
- }
402
-
403
- promise: {
404
- check: (p: any) => boolean
405
- resolve: (data: any) => Promise<any>
406
- }
407
-
408
- sanitize: {
409
- html: (s: string) => string
410
- }
411
-
412
- screen: {
413
- fullScreen: (el: string) => void
414
- toggle: (el: string) => void
415
- info: () => {
416
- width: number
417
- height: number
418
- availWidth: number
419
- availHeight: number
420
- colorDepth: number
421
- pixelDepth: number
422
- }
423
- }
424
-
425
- scrollbar: {
426
- custom: (el: string, options: any) => void
427
- indicator: (props: any) => void
428
- position: {
429
- get: (el: any) => void
430
- set: (el: any) => void
431
- }
432
- smooth: (target: any, speed: any, smooth: any) => void
433
- scrollTo: (container: string, element: string, gap?: number) => void
434
- }
435
-
436
- security: {
437
- uuid: {
438
- byVal: (string: string) => string
439
- v4: string
440
- v5: string
441
- }
442
- hashPass: (u: string, p: string, t?: string) => Promise<string>
443
- crypt: (u: string, p: string, mode?: string) => string
444
- deCrypt: (u: string, p: string, mode?: string) => string
445
- AES_KeyGen: (passKey?: string) => string
446
- SHA256_Hex: (passKey: string) => string
447
- }
448
-
449
- shortcut: {
450
- keys: (e: any, trigger: any) => void
451
- }
452
-
453
- socket: {
454
- info: () => string
455
- start: (element: any, server: any, name: string) => void
456
- conn: (id: any, server: any, name: string) => void
457
- connect: (server: any, name: string) => void
458
- open: (id: any, server: any, name: string) => void
459
- send: (mex: any, type?: string) => void
460
- ping: (name: string) => void
461
- receive: (el?: any, name?: string) => void
462
- keepAlive: (name: string) => void
463
- check: () => void
464
- list: () => WebSocket[]
465
- }
466
-
467
- svg: {
468
- init: (container: HTMLElement, source1: [HTMLElement, string], source2: [HTMLElement, string], cb?: Function) => void
469
- check: () => boolean
470
- update: (rect1: HTMLElement, rect2: HTMLElement, cxn: HTMLElement) => void
471
- getCurve: (p1: [number, number], p2: [number, number], dx: number) => string
472
- getIntersection: (dx: number, dy: number, cx: number, cy: number, w: number, h: number) => [number, number]
473
- setConnector: (source: HTMLElement, side: string) => HTMLElement
474
- removeConnection: (container: HTMLElement) => void
475
- makeScrollable: (svgContainer: HTMLElement, scrollContainer: HTMLElement, elm1: HTMLElement, elm2: HTMLElement, rect1: HTMLElement, rect2: HTMLElement) => void
476
- makeDraggable: (evt: Event) => void
477
- toggle: (evt: Event, container: HTMLElement, source1: HTMLElement, source2: HTMLElement) => void
478
- convert: (options) => string | void
479
- }
480
-
481
- system: {
482
- multiSplit: () => any
483
- }
484
-
485
- text: {
486
- trim(s: string, c: string, b: number, e: number): string
487
- capitalize(txt: string): string
488
- lower(txt: string): string
489
- upper(txt: string): string
490
- nl2br(str: string): string
491
- sanitize(str: string): string
492
- camelCase: {
493
- toSpace(string: string): string
494
- toUnderscore(string: string): string
495
- }
496
- fitContainer(el: string): void
497
- }
498
-
499
- timer: {
500
- sleep(ms: number): Promise<void>
501
- percentage(start: string, end: string): string
502
- }
503
-
504
- tools: {
505
- getip(): Promise<void>
506
- byteSize(bytes: number): string
507
- zIndex(): number
508
- zeroToFalse(value: number): boolean | number
509
- }
510
-
511
- translators: {
512
- convertMatrixToScale(values: any): number
513
- }
514
-
515
- trigger: {
516
- click(elem: string): void
517
- change(elem: string): void
518
- input(elem: string): void
519
- }
520
-
521
- type: {
522
- of(p: any): string
523
- instOfObj(p: any): boolean
524
- isNull(p: any): (i: any) => boolean
525
- isBool(val: any): boolean
526
- }
527
-
528
- ui: null
529
-
530
- window: {
531
- enhancement(): void
532
- animationframe(): any
533
- center(params: { url: string; title: string; name: string; w: number; h: number }): void
534
- onBeforeUnLoad(e: any): void
535
- purge(d?: Document, time?: number): void
536
- stopZoomWheel(e: any): void
537
- setZoom(element?: string, zoom?: number): string
538
- getZoom(element?: string): number
539
- }
540
-
541
- }
542
-
543
- ////////////////////////////////////////////////////////////////////////////
544
-
545
- declare var dphelper: _dphelper
546
- type dphelper = _dphelper
547
-
548
- declare var arguments: any
549
- type arguments = any
550
-
551
- ///////////////////
552
-
553
- interface SubCommand {
554
- name: string
555
- version: string
556
- example: string
557
- author: string
558
- creationDate: string
559
- lastMod: string
560
- type: string
561
- active: boolean
562
- description: string
563
- subCommand: Array<SubCommand> | typeof Array
564
- }
565
-
566
- interface Description {
567
- name: string,
568
- active: boolean,
569
- subCommand: Array<SubCommand>,
570
- }
571
-
572
- declare function confirm(message: string, func1: Function, func2?: Function): boolean
package/types/idb.d.ts DELETED
@@ -1,21 +0,0 @@
1
- /*!
2
- dphelper
3
- Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
4
- Licensed under MIT License, see
5
- https://dario.passariello.ca
6
- */
7
-
8
- /**
9
- * idb is indexedDB simplification by dphelper
10
- * @return IndexedDB editing and maintain.
11
- */
12
-
13
- interface _idb {
14
- [key: string]: any
15
- }
16
-
17
- declare var idb: _idb
18
- declare var idbases: any
19
-
20
- type idb = _idb
21
- type idbases = {}
package/types/jquery.d.ts DELETED
@@ -1,20 +0,0 @@
1
- /*!
2
- dphelper
3
- Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
4
- Licensed under MIT License, see
5
- https://dario.passariello.ca
6
- */
7
-
8
- declare var $: any
9
- declare var jQuery: any
10
- declare module 'jquery'
11
-
12
- // ////////////////////////////////////////////////////////////////
13
-
14
- interface window {
15
- $: any
16
- jQuery: any
17
- }
18
-
19
- type $ = {}
20
- type jQuery = {}
@@ -1,21 +0,0 @@
1
- /*!
2
- memorio
3
- Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
4
- Licensed under MIT License, see
5
- https://dario.passariello.ca
6
- */
7
-
8
- ////////////////////
9
- // Global object
10
- ////////////////////
11
-
12
- /**
13
- * @return memorio Root.
14
- */
15
- interface _memorio {}
16
-
17
- ////////////////////////////////////////////////////////////////////////////
18
-
19
- declare var memorio: _memorio
20
- type memorio = _memorio
21
-
@@ -1,47 +0,0 @@
1
- /*!
2
- memorio
3
- Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
4
- Licensed under MIT License, see
5
- https://dario.passariello.ca
6
- */
7
-
8
- /**
9
- * Observer run a callback anytime the associated state going to change
10
- * @return Execution of function after state change.
11
- */
12
- interface _observer {
13
-
14
- /**
15
- * Generate your observer
16
- *
17
- * @example
18
- * observer("myState", Function)
19
- *
20
- * @since memorio 1.0.6
21
- */
22
- (stateName: string, callBack: any): any
23
-
24
- /**
25
- * List of active observers
26
- *
27
- * @example
28
- * observer.list()
29
- *
30
- * @since memorio 1.0.6
31
- */
32
- readonly list?: () => void
33
-
34
- /**
35
- * Remove the active observer (not the state)
36
- *
37
- * @example
38
- * observer.remove("myState")
39
- *
40
- * @since memorio 1.0.6
41
- */
42
- readonly remove?: (name: string, callBack?: any, flag?: boolean) => void
43
-
44
- }
45
-
46
- declare var observer: _observer
47
- type observer = _observer