dphelper 3.2.1 → 3.2.3
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/docs/SUMMARY.md +54 -0
- package/docs/tools/ai.md +25 -0
- package/docs/tools/anchor.md +33 -0
- package/docs/tools/array.md +36 -0
- package/docs/tools/audio.md +30 -0
- package/docs/tools/avoid.md +28 -0
- package/docs/tools/browser.md +45 -0
- package/docs/tools/check.md +24 -0
- package/docs/tools/color.md +28 -0
- package/docs/tools/cookie.md +27 -0
- package/docs/tools/coords.md +28 -0
- package/docs/tools/credits.md +28 -0
- package/docs/tools/date.md +44 -0
- package/docs/tools/disable.md +28 -0
- package/docs/tools/dispatch.md +26 -0
- package/docs/tools/element.md +25 -0
- package/docs/tools/event.md +27 -0
- package/docs/tools/form.md +49 -0
- package/docs/tools/format.md +25 -0
- package/docs/tools/json.md +28 -0
- package/docs/tools/load.md +26 -0
- package/docs/tools/logging.md +27 -0
- package/docs/tools/math.md +28 -0
- package/docs/tools/memory.md +25 -0
- package/docs/tools/navigation.md +43 -0
- package/docs/tools/net.md +24 -0
- package/docs/tools/obj.md +34 -0
- package/docs/tools/path.md +46 -0
- package/docs/tools/promise.md +24 -0
- package/docs/tools/sanitize.md +24 -0
- package/docs/tools/screen.md +25 -0
- package/docs/tools/scrollbar.md +29 -0
- package/docs/tools/security.md +32 -0
- package/docs/tools/shortcut.md +24 -0
- package/docs/tools/socket.md +29 -0
- package/docs/tools/svg.md +29 -0
- package/docs/tools/sync.md +25 -0
- package/docs/tools/system.md +32 -0
- package/docs/tools/terminal.md +28 -0
- package/docs/tools/text.md +28 -0
- package/docs/tools/timer.md +25 -0
- package/docs/tools/tools.md +26 -0
- package/docs/tools/translators.md +24 -0
- package/docs/tools/trigger.md +26 -0
- package/docs/tools/type.md +27 -0
- package/docs/tools/ui.md +45 -0
- package/docs/tools/window.md +30 -0
- package/dphelper.umd.js +16 -16
- package/index.js +16 -16
- package/package.json +1 -1
- package/types/dphelper.d.ts +0 -656
package/package.json
CHANGED
package/types/dphelper.d.ts
DELETED
|
@@ -1,656 +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
|
-
export { }
|
|
9
|
-
|
|
10
|
-
declare global {
|
|
11
|
-
|
|
12
|
-
const __DPH_VERSION__: string
|
|
13
|
-
|
|
14
|
-
// --- AUTO-GENERATED TOOL TYPES START ---
|
|
15
|
-
// --- ai ---
|
|
16
|
-
interface AiTool {
|
|
17
|
-
tokenCount: (data: any) => number
|
|
18
|
-
smartSanitize: (text: string) => string
|
|
19
|
-
toon: (data: any) => string
|
|
20
|
-
toonToJson: (toon: string) => any
|
|
21
|
-
chunker: (text: string, options?: { size?: number, overlap?: number }) => string[]
|
|
22
|
-
similarity: (a: number[], b: number[]) => number
|
|
23
|
-
extractReasoning: (text: string) => { reasoning: string, content: string }
|
|
24
|
-
prompt: (template: string, vars: Record<string, any>) => string
|
|
25
|
-
schema: (data: any) => string
|
|
26
|
-
snapshot: () => string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// --- anchor ---
|
|
30
|
-
interface AnchorTool {
|
|
31
|
-
/**
|
|
32
|
-
* Converts anchor tags to onClick events
|
|
33
|
-
* @param selector - CSS selector for target elements
|
|
34
|
-
*/
|
|
35
|
-
toOnClick(selector: string): void
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// --- array ---
|
|
39
|
-
interface ArrayTool {
|
|
40
|
-
find<T>(array: T[], key: any): T | any
|
|
41
|
-
unique<T>(array: T[]): T[]
|
|
42
|
-
delete<T>(array: T[], key: keyof T): void
|
|
43
|
-
merge<T>(arrayA: T[], arrayB: T[]): T[]
|
|
44
|
-
mergeByKey<T extends Record<string, any>>(arrayA: T[], arrayB: T[], key: keyof T): T[]
|
|
45
|
-
asc<T>(array: T[]): T[]
|
|
46
|
-
desc<T>(array: T[]): T[]
|
|
47
|
-
duplicates<T>(array: T[]): T[]
|
|
48
|
-
even<T>(array: T[]): T[]
|
|
49
|
-
odd<T>(array: T[]): T[]
|
|
50
|
-
toObj<T>(array: T[]): Record<string, T>
|
|
51
|
-
sumColumn(array: number[][], column: number): number
|
|
52
|
-
shuffle<T>(array: T[]): T[]
|
|
53
|
-
generate(num: number): number[]
|
|
54
|
-
testArrayInt(array: unknown[]): number[]
|
|
55
|
-
rand32(number: number): number
|
|
56
|
-
findindex<T>(array: T[], key: any): number
|
|
57
|
-
pathToJson(array: string[], separator?: string): Record<string, unknown>
|
|
58
|
-
deepClone<T>(src: T): T
|
|
59
|
-
match(arrayWords: string[], arrayToCheck: string[]): boolean
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// --- audio ---
|
|
63
|
-
interface AudioTool {
|
|
64
|
-
/**
|
|
65
|
-
* Plays an audio file if it is not already playing.
|
|
66
|
-
* If no file is specified, removes all audio elements from the document.
|
|
67
|
-
*
|
|
68
|
-
* @param file - The name of the audio file to play.
|
|
69
|
-
* @param path - The path to the audio file.
|
|
70
|
-
* @param loop - Whether the audio should loop.
|
|
71
|
-
*/
|
|
72
|
-
play: (file?: string, path?: string, loop?: boolean) => void
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// --- avoid ---
|
|
76
|
-
interface AvoidTool {
|
|
77
|
-
cache: (uri: string) => string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// --- browser ---
|
|
81
|
-
interface BrowserTool {
|
|
82
|
-
state(state: any, title: any, url: any): void
|
|
83
|
-
forw(times: number): void
|
|
84
|
-
back(times: number): void
|
|
85
|
-
reload(): void
|
|
86
|
-
href(url: string): void
|
|
87
|
-
offLine(text?: string): void
|
|
88
|
-
zoom(): number
|
|
89
|
-
status(code: number): string
|
|
90
|
-
interlock(onUpdate: (tabs: number) => void): void
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// --- check ---
|
|
94
|
-
interface CheckTool {
|
|
95
|
-
url: (url: string) => any
|
|
96
|
-
version: (v1: string, v2: string, opts?: any) => any
|
|
97
|
-
npmVer: (npm: string) => any
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// --- color ---
|
|
101
|
-
interface ColorTool {
|
|
102
|
-
hex: (c: any) => string
|
|
103
|
-
toHex: (rgb: any) => string
|
|
104
|
-
toRGB: (c: any) => number[]
|
|
105
|
-
oleColor: (c: any) => string
|
|
106
|
-
gradient: (colorStart: any, colorEnd: any, colorCount: any) => any
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// --- cookie ---
|
|
110
|
-
interface CookieTool {
|
|
111
|
-
set: (pars: {
|
|
112
|
-
name: any,
|
|
113
|
-
value: any,
|
|
114
|
-
time?: any,
|
|
115
|
-
path?: string,
|
|
116
|
-
sameSite?: string,
|
|
117
|
-
secure?: string
|
|
118
|
-
}) => any
|
|
119
|
-
get: (name: string) => any
|
|
120
|
-
delete: (name: string) => any
|
|
121
|
-
removeAll: () => any
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// --- coords ---
|
|
125
|
-
interface CoordsTool {
|
|
126
|
-
degreesToRadians: (degrees: any) => any
|
|
127
|
-
latToMeters: (points: any) => any
|
|
128
|
-
toVector: (points: any) => any
|
|
129
|
-
convertToDecDegrees: (deg: any, minutes: any, sec: any, direction: any) => any
|
|
130
|
-
distance: (point1: any, point2: any) => any
|
|
131
|
-
polarToCartesian: (centerX: any, centerY: any, radius: any, angleInDegrees: any) => any
|
|
132
|
-
mapDegreesToPixels: (degree: number, minDegree: number, maxDegree: number, minPixel: number, maxPixel: number, padding: number) => number
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// --- credits ---
|
|
136
|
-
interface Credits {
|
|
137
|
-
name: string
|
|
138
|
-
version: string
|
|
139
|
-
description: string
|
|
140
|
-
license: string
|
|
141
|
-
author: {
|
|
142
|
-
name: string
|
|
143
|
-
email: string
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
type CreditsTool = (props: Credits) => void
|
|
148
|
-
|
|
149
|
-
// --- date ---
|
|
150
|
-
interface DateTool {
|
|
151
|
-
days: (lang?: string) => string[]
|
|
152
|
-
months: (lang?: string) => string[]
|
|
153
|
-
year: () => number
|
|
154
|
-
toIso: (value: any, int?: string) => string | null
|
|
155
|
-
toMMDDYYYY: (value: any) => string
|
|
156
|
-
toYYYYMMDD: (value: any) => string | undefined
|
|
157
|
-
toHuman: (value: any) => string
|
|
158
|
-
convert: (value: any, format: string[]) => string | null
|
|
159
|
-
iso2Epoch: (value: any) => number
|
|
160
|
-
localIsoTime: (value: any) => string
|
|
161
|
-
utc: () => string
|
|
162
|
-
parse: (value: any, separator?: string) => string | null
|
|
163
|
-
addDays: (date: any, days: number) => Date
|
|
164
|
-
dateTimeToString: (dateObject: any) => string
|
|
165
|
-
isoToHuman: (value: any, symbol?: string) => string | null
|
|
166
|
-
fullDate: () => string
|
|
167
|
-
epoch: () => number
|
|
168
|
-
diffInDays: (d1: any, d2: any) => number
|
|
169
|
-
diffInWeeks: (d1: any, d2: any) => number
|
|
170
|
-
diffInMonths: (d1: any, d2: any) => number
|
|
171
|
-
diffInYears: (d1: any, d2: any) => number
|
|
172
|
-
dateToYMD: (date: any) => string
|
|
173
|
-
collection: (params: { date?: Date; type: string; locale?: string }) => string | undefined
|
|
174
|
-
timeZones: () => string[]
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// --- disable ---
|
|
178
|
-
interface DisableTool {
|
|
179
|
-
select: (el?: string) => void
|
|
180
|
-
spellCheck: (tmr?: number) => void
|
|
181
|
-
rightClick: (el?: string) => void
|
|
182
|
-
copy: (el?: string) => void
|
|
183
|
-
paste: (el?: string) => void
|
|
184
|
-
cut: (el?: string) => void
|
|
185
|
-
drag: (el?: string) => void
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// --- dispatch ---
|
|
189
|
-
interface DispatchTool {
|
|
190
|
-
set: (name: string, value?: any) => void
|
|
191
|
-
listen: (name: string, cb?: (e: Event) => void, flag?: boolean) => void
|
|
192
|
-
remove: (name: string) => void
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// --- elements ---
|
|
196
|
-
interface ElementsTool {
|
|
197
|
-
fitScale: (el: any, scale?: number, fit?: boolean) => void
|
|
198
|
-
scaleBasedOnWindow: (elm: any, scale: number, fit: boolean) => void
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// --- events ---
|
|
202
|
-
interface EventsTool {
|
|
203
|
-
list: (el: Element) => any
|
|
204
|
-
multi: (element: Element, eventNames: string, listener: EventListener) => void
|
|
205
|
-
copy: (el: string) => void
|
|
206
|
-
onDrag: (elem: string) => void
|
|
207
|
-
keys: (e: KeyboardEvent) => { key: string; ctrl: boolean; alt: boolean; shift: boolean }
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// --- fetch ---
|
|
211
|
-
interface FetchTool {
|
|
212
|
-
/**
|
|
213
|
-
* Perform a resilient fetch with automatic retries and exponential backoff.
|
|
214
|
-
*/
|
|
215
|
-
(url: string, options?: any, retries?: number, backoff?: number): Promise<Response>
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Perform a GET request.
|
|
219
|
-
*/
|
|
220
|
-
get: (url: string, options?: any) => Promise<Response>
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Perform a POST request with optional JSON body auto-serialization.
|
|
224
|
-
*/
|
|
225
|
-
post: (url: string, body: any, options?: any) => Promise<Response>
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// --- form ---
|
|
229
|
-
interface FormTool {
|
|
230
|
-
serialize: (form: HTMLFormElement) => { [key: string]: any }
|
|
231
|
-
confirmType: (type: string, value: any) => boolean
|
|
232
|
-
required: (value: any) => string | undefined
|
|
233
|
-
minLength: (value: any, num?: number) => string | undefined
|
|
234
|
-
maxLength: (value: any, num?: number) => string | undefined
|
|
235
|
-
maxPhoneNumber: (value: any, num?: number) => string | undefined
|
|
236
|
-
isNumeric: (value: any) => boolean
|
|
237
|
-
isEmail: (value: any) => boolean
|
|
238
|
-
pattern: (e: Event) => void
|
|
239
|
-
noSpecialChars: (e: Event) => void
|
|
240
|
-
table: (size: [number, number], id: string, elem: HTMLElement) => void
|
|
241
|
-
sanitize: (str: string) => string | undefined
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// --- format ---
|
|
245
|
-
interface FormatTool {
|
|
246
|
-
currency: (value: number, locale?: string, currency?: string) => string
|
|
247
|
-
phoneNumber: (value: string, countryCode?: string) => string
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// --- json ---
|
|
251
|
-
interface JsonTool {
|
|
252
|
-
counter: (json: any, key?: string, val?: any) => number | null
|
|
253
|
-
toCsv: (jsonInput: any) => string
|
|
254
|
-
saveCsvAs: (csvData: string, fileName: string) => void
|
|
255
|
-
is: (str: string) => boolean
|
|
256
|
-
parse: (file: string) => any
|
|
257
|
-
sanitize: (str: string) => string
|
|
258
|
-
sanitizeJsonValue: (str: string) => string
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// --- load ---
|
|
262
|
-
interface LoadTool {
|
|
263
|
-
all: (context: any, cacheName?: string) => void
|
|
264
|
-
file: (filePath: string) => Promise<string>
|
|
265
|
-
fileToElement: (elementSelector: string, filePath: string) => Promise<void>
|
|
266
|
-
json: (filePath: string) => Promise<any>
|
|
267
|
-
remote: (path: string, method?: string, headers?: HeadersInit) => Promise<any>
|
|
268
|
-
script: (scripts: string[], elementSelector?: string) => void
|
|
269
|
-
toJson: (context: any, cacheName?: string) => void
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// --- logging ---
|
|
273
|
-
interface LoggingTool {
|
|
274
|
-
list: {
|
|
275
|
-
type: string
|
|
276
|
-
message: string
|
|
277
|
-
}[]
|
|
278
|
-
reg: (txt: string) => void
|
|
279
|
-
debug: (txt: string) => void
|
|
280
|
-
error: (txt: string) => void
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// --- math ---
|
|
284
|
-
interface MathTool {
|
|
285
|
-
rnd: () => number
|
|
286
|
-
tmr: () => number
|
|
287
|
-
add: (a: number, b: number) => number
|
|
288
|
-
sub: (a: number, b: number) => number
|
|
289
|
-
multi: (a: number, b: number) => number
|
|
290
|
-
div: (a: number, b: number) => number
|
|
291
|
-
rem: (a: number, b: number) => number
|
|
292
|
-
exp: (a: number, b: number) => number
|
|
293
|
-
isOdd: (a: number) => boolean
|
|
294
|
-
float2int: (a: number) => number
|
|
295
|
-
percent: (n: number, tot: number) => number
|
|
296
|
-
isPrime: (n: number) => boolean
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// --- memory ---
|
|
300
|
-
interface MemoryTool {
|
|
301
|
-
lock: (obj: string) => void
|
|
302
|
-
unlock: (obj: string) => void
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// --- navigation ---
|
|
306
|
-
interface NavigationTool {
|
|
307
|
-
load(url: string): Promise<void>
|
|
308
|
-
ajax(): void
|
|
309
|
-
ajax_running?: boolean
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// --- objects ---
|
|
313
|
-
interface ObjectsTool {
|
|
314
|
-
toArray: (object: Record<string, any>) => [string, any][]
|
|
315
|
-
replaceNullObjects: (data: Record<string, any>) => Record<string, any>
|
|
316
|
-
serialize: (value: any) => any
|
|
317
|
-
deSerialize: (valueNew: any) => any
|
|
318
|
-
sort: (o: Record<string, any>) => Record<string, any>
|
|
319
|
-
toXML: (obj: Record<string, any>) => string
|
|
320
|
-
find: (array: any[], key: string, value: any) => any
|
|
321
|
-
instance: (obj: any) => any
|
|
322
|
-
updateByKey: (obj: Record<string, any>, key: string, newValue: any) => Record<string, any>
|
|
323
|
-
findindex: (array: any[], key: string) => number
|
|
324
|
-
parse: (val: any) => any
|
|
325
|
-
isObject: (val: any) => boolean
|
|
326
|
-
diff: (obj1: Record<string, any>, obj2: Record<string, any>) => Record<string, { obj1: any, obj2: any }>
|
|
327
|
-
path: (prop: string, array: string[], separator?: string) => string
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// --- path ---
|
|
331
|
-
interface PathTool {
|
|
332
|
-
rail: () => string[]
|
|
333
|
-
hash: () => string[]
|
|
334
|
-
query: (url: string) => Record<string, string>
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// --- promise ---
|
|
338
|
-
interface PromiseTool {
|
|
339
|
-
check: (p: any) => boolean
|
|
340
|
-
resolve: (data: any) => Promise<any>
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// --- sanitize ---
|
|
344
|
-
interface SanitizeTool {
|
|
345
|
-
html: (s: string) => string
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// --- screen ---
|
|
349
|
-
interface ScreenTool {
|
|
350
|
-
fullScreen: (el: string) => void
|
|
351
|
-
toggle: (el: string) => void
|
|
352
|
-
info: () => {
|
|
353
|
-
width: number
|
|
354
|
-
height: number
|
|
355
|
-
availWidth: number
|
|
356
|
-
availHeight: number
|
|
357
|
-
colorDepth: number
|
|
358
|
-
pixelDepth: number
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// --- scrollbar ---
|
|
363
|
-
interface ScrollbarTool {
|
|
364
|
-
custom: (el: string, options: any) => void
|
|
365
|
-
indicator: (props: any) => void
|
|
366
|
-
position: {
|
|
367
|
-
get: (el: any) => void
|
|
368
|
-
set: (el: any) => void
|
|
369
|
-
}
|
|
370
|
-
smooth: (target: any, speed: any, smooth: any) => void
|
|
371
|
-
scrollTo: (container: string, element: string, gap?: number) => void
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// --- security ---
|
|
375
|
-
interface SecurityTool {
|
|
376
|
-
uuid: {
|
|
377
|
-
byVal: (string: string) => string
|
|
378
|
-
v4: string
|
|
379
|
-
v5: string
|
|
380
|
-
}
|
|
381
|
-
hashPass: (u: string, p: string, t?: string) => Promise<string>
|
|
382
|
-
crypt: (u: string, p: string, mode?: string) => string
|
|
383
|
-
deCrypt: (u: string, p: string, mode?: string) => string
|
|
384
|
-
AES_KeyGen: (passKey?: string) => string
|
|
385
|
-
SHA256_Hex: (passKey: string) => string
|
|
386
|
-
ulid: () => string
|
|
387
|
-
fingerprint: () => string
|
|
388
|
-
saveEncrypted: (key: string, value: string, secret: string) => void
|
|
389
|
-
getEncrypted: (key: string, secret: string) => string | null
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// --- shortcut ---
|
|
393
|
-
interface ShortcutTool {
|
|
394
|
-
keys: (e: any, trigger: any) => void
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// --- socket ---
|
|
398
|
-
interface SocketTool {
|
|
399
|
-
info: () => string
|
|
400
|
-
start: (element: any, server: any, name: string) => void
|
|
401
|
-
conn: (id: any, server: any, name: string) => void
|
|
402
|
-
connect: (server: any, name: string) => void
|
|
403
|
-
open: (id: any, server: any, name: string) => void
|
|
404
|
-
send: (mex: any, type?: string) => void
|
|
405
|
-
ping: (name: string) => void
|
|
406
|
-
receive: (el?: any, name?: string) => void
|
|
407
|
-
keepAlive: (name: string) => void
|
|
408
|
-
check: () => void
|
|
409
|
-
list: () => WebSocket[]
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// --- sse ---
|
|
413
|
-
interface SseTool {
|
|
414
|
-
/**
|
|
415
|
-
* Opens an SSE connection with support for custom fetch options (POST, Headers, etc).
|
|
416
|
-
*/
|
|
417
|
-
open(url: string, options?: any): {
|
|
418
|
-
on(event: "message" | "error" | "open", cb: (data: any) => void): void
|
|
419
|
-
close(): void
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// --- svg ---
|
|
424
|
-
interface SvgTool {
|
|
425
|
-
init: (container: HTMLElement, source1: [HTMLElement, string], source2: [HTMLElement, string], cb?: Function) => void
|
|
426
|
-
check: () => boolean
|
|
427
|
-
update: (rect1: HTMLElement, rect2: HTMLElement, cxn: HTMLElement) => void
|
|
428
|
-
getCurve: (p1: [number, number], p2: [number, number], dx: number) => string
|
|
429
|
-
getIntersection: (dx: number, dy: number, cx: number, cy: number, w: number, h: number) => [number, number]
|
|
430
|
-
setConnector: (source: HTMLElement, side: string) => HTMLElement
|
|
431
|
-
removeConnection: (container: HTMLElement) => void
|
|
432
|
-
makeScrollable: (svgContainer: HTMLElement, scrollContainer: HTMLElement, elm1: HTMLElement, elm2: HTMLElement, rect1: HTMLElement, rect2: HTMLElement) => void
|
|
433
|
-
makeDraggable: (evt: Event) => void
|
|
434
|
-
toggle: (evt: Event, container: HTMLElement, source1: HTMLElement, source2: HTMLElement) => void
|
|
435
|
-
convert: (options: any) => string | void
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
// --- sync ---
|
|
439
|
-
interface SyncTool {
|
|
440
|
-
/**
|
|
441
|
-
* Synchronize data between tabs using BroadcastChannel.
|
|
442
|
-
*/
|
|
443
|
-
tab: (channelName: string, callback: (data: any) => void) => { post: (data: any) => void, close: () => void }
|
|
444
|
-
/**
|
|
445
|
-
* Create a Proxy object linked to localStorage for auto-sync with optional encryption.
|
|
446
|
-
*/
|
|
447
|
-
storageProxy: <T extends object>(key: string, initialValue: T, secret?: string) => T
|
|
448
|
-
/**
|
|
449
|
-
* Low-latency cross-tab event bus.
|
|
450
|
-
*/
|
|
451
|
-
pulse: (channelName: string, callback: (data: any) => void) => { emit: (data: any) => void, stop: () => void }
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// --- system ---
|
|
455
|
-
interface SystemTool {
|
|
456
|
-
multiSplit: () => any
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// --- text ---
|
|
460
|
-
interface TextTool {
|
|
461
|
-
trim(s: string, c: string, b: number, e: number): string
|
|
462
|
-
capitalize(txt: string): string
|
|
463
|
-
lower(txt: string): string
|
|
464
|
-
upper(txt: string): string
|
|
465
|
-
nl2br(str: string): string
|
|
466
|
-
sanitize(str: string): string
|
|
467
|
-
camelCase: {
|
|
468
|
-
toSpace(string: string): string
|
|
469
|
-
toUnderscore(string: string): string
|
|
470
|
-
}
|
|
471
|
-
fitContainer(el: string): void
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// --- timer ---
|
|
475
|
-
interface TimerTool {
|
|
476
|
-
sleep(ms: number): Promise<void>
|
|
477
|
-
percentage(start: string, end: string): string
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// --- tools ---
|
|
481
|
-
interface ToolsTool {
|
|
482
|
-
getip(): Promise<void>
|
|
483
|
-
byteSize(bytes: number): string
|
|
484
|
-
zIndex(): number
|
|
485
|
-
zeroToFalse(value: number): boolean | number
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
// --- translators ---
|
|
489
|
-
interface TranslatorsTool {
|
|
490
|
-
convertMatrixToScale(values: any): number
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
// --- triggers ---
|
|
494
|
-
interface TriggersTool {
|
|
495
|
-
/**
|
|
496
|
-
* Add a trigger for custom events.
|
|
497
|
-
* @param event - The event name
|
|
498
|
-
* @param callback - The callback to execute when the event is triggered
|
|
499
|
-
*/
|
|
500
|
-
add: (event: string, callback: (...args: any[]) => void) => void
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Listen for a trigger event (alias for add).
|
|
504
|
-
*/
|
|
505
|
-
on: (event: string, callback: (...args: any[]) => void) => void
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Emit a trigger event and call all registered callbacks.
|
|
509
|
-
* @param event - The event name
|
|
510
|
-
* @param args - Arguments to pass to the callbacks
|
|
511
|
-
*/
|
|
512
|
-
emit: (event: string, ...args: any[]) => void
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Remove a trigger event and all its callbacks.
|
|
516
|
-
* @param event - The event name
|
|
517
|
-
*/
|
|
518
|
-
remove: (event: string) => void
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Remove a specific callback from an event.
|
|
522
|
-
* @param event - The event name
|
|
523
|
-
* @param callback - The callback to remove
|
|
524
|
-
*/
|
|
525
|
-
off: (event: string, callback: (...args: any[]) => void) => void
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Clear all triggers.
|
|
529
|
-
*/
|
|
530
|
-
clear: () => void
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* List all registered trigger events.
|
|
534
|
-
* @returns Array of event names
|
|
535
|
-
*/
|
|
536
|
-
list: () => string[]
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// --- types ---
|
|
540
|
-
interface TypesTool {
|
|
541
|
-
of(p: any): string
|
|
542
|
-
instOfObj(p: any): boolean
|
|
543
|
-
isNull(p: any): (p: any) => boolean
|
|
544
|
-
isBool(val: any): boolean
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
// --- ui ---
|
|
548
|
-
interface UiTool {
|
|
549
|
-
anchorContext(): void
|
|
550
|
-
[key: string]: any
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
// --- window ---
|
|
554
|
-
interface WindowTool {
|
|
555
|
-
enhancement(): void
|
|
556
|
-
animationframe(): any
|
|
557
|
-
center(params: { url: string; title: string; name: string; w: number; h: number }): void
|
|
558
|
-
onBeforeUnLoad(e: any): void
|
|
559
|
-
purge(d?: Document, time?: number): void
|
|
560
|
-
stopZoomWheel(e: any): void
|
|
561
|
-
setZoom(element?: string, zoom?: number): string
|
|
562
|
-
getZoom(element?: string): number
|
|
563
|
-
}
|
|
564
|
-
// --- AUTO-GENERATED TOOL TYPES END ---
|
|
565
|
-
|
|
566
|
-
interface _dphelper {
|
|
567
|
-
[key: string]: any
|
|
568
|
-
// --- AUTO-GENERATED TOOL MEMBERS START ---
|
|
569
|
-
ai: AiTool
|
|
570
|
-
anchor: AnchorTool
|
|
571
|
-
array: ArrayTool
|
|
572
|
-
audio: AudioTool
|
|
573
|
-
avoid: AvoidTool
|
|
574
|
-
browser: BrowserTool
|
|
575
|
-
check: CheckTool
|
|
576
|
-
color: ColorTool
|
|
577
|
-
cookie: CookieTool
|
|
578
|
-
coords: CoordsTool
|
|
579
|
-
credits: CreditsTool
|
|
580
|
-
date: DateTool
|
|
581
|
-
disable: DisableTool
|
|
582
|
-
dispatch: DispatchTool
|
|
583
|
-
element: ElementsTool
|
|
584
|
-
events: EventsTool
|
|
585
|
-
fetch: FetchTool
|
|
586
|
-
form: FormTool
|
|
587
|
-
format: FormatTool
|
|
588
|
-
json: JsonTool
|
|
589
|
-
load: LoadTool
|
|
590
|
-
logging: LoggingTool
|
|
591
|
-
math: MathTool
|
|
592
|
-
memory: MemoryTool
|
|
593
|
-
navigation: NavigationTool
|
|
594
|
-
object: ObjectsTool
|
|
595
|
-
path: PathTool
|
|
596
|
-
promise: PromiseTool
|
|
597
|
-
sanitize: SanitizeTool
|
|
598
|
-
screen: ScreenTool
|
|
599
|
-
scrollbar: ScrollbarTool
|
|
600
|
-
security: SecurityTool
|
|
601
|
-
shortcut: ShortcutTool
|
|
602
|
-
socket: SocketTool
|
|
603
|
-
sse: SseTool
|
|
604
|
-
svg: SvgTool
|
|
605
|
-
sync: SyncTool
|
|
606
|
-
system: SystemTool
|
|
607
|
-
text: TextTool
|
|
608
|
-
timer: TimerTool
|
|
609
|
-
tools: ToolsTool
|
|
610
|
-
translators: TranslatorsTool
|
|
611
|
-
trigger: TriggersTool
|
|
612
|
-
type: TypesTool
|
|
613
|
-
ui: UiTool
|
|
614
|
-
window: WindowTool
|
|
615
|
-
// --- AUTO-GENERATED TOOL MEMBERS END ---
|
|
616
|
-
setDescription: (description: Description, newObj: any) => void
|
|
617
|
-
setProps: (root: any, desc: any, options?: any) => void
|
|
618
|
-
_list: {
|
|
619
|
-
scripts: Description[]
|
|
620
|
-
sockets: any[]
|
|
621
|
-
[key: string]: any
|
|
622
|
-
}
|
|
623
|
-
version: string
|
|
624
|
-
isServer: boolean
|
|
625
|
-
isBrowser: boolean
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
var dphelper: _dphelper
|
|
629
|
-
|
|
630
|
-
interface Window {
|
|
631
|
-
dphelper: _dphelper
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
interface SubCommand {
|
|
635
|
-
name: string
|
|
636
|
-
version: string
|
|
637
|
-
example: string
|
|
638
|
-
author: string
|
|
639
|
-
creationDate: string
|
|
640
|
-
lastMod: string
|
|
641
|
-
type: string
|
|
642
|
-
active: boolean
|
|
643
|
-
description: string
|
|
644
|
-
env?: "client" | "server" | "both"
|
|
645
|
-
subCommand: SubCommand[]
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
interface Description {
|
|
649
|
-
name: string
|
|
650
|
-
active: boolean
|
|
651
|
-
subCommand: SubCommand[]
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
function confirm(message: string, func1: Function, func2?: Function): boolean
|
|
655
|
-
|
|
656
|
-
} // end declare global
|