@aegis-framework/artemis 0.3.29 → 0.4.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 +1 -1
- package/dist/artemis.browser.js +4 -0
- package/dist/artemis.browser.js.map +24 -0
- package/dist/artemis.js +3 -1
- package/dist/artemis.js.map +23 -1
- package/dist/types/DOM.d.ts +383 -0
- package/dist/types/DOM.d.ts.map +1 -0
- package/dist/types/Debug.d.ts +118 -0
- package/dist/types/Debug.d.ts.map +1 -0
- package/dist/types/FileSystem.d.ts +69 -0
- package/dist/types/FileSystem.d.ts.map +1 -0
- package/dist/types/Form.d.ts +32 -0
- package/dist/types/Form.d.ts.map +1 -0
- package/dist/types/Platform.d.ts +93 -0
- package/dist/types/Platform.d.ts.map +1 -0
- package/dist/types/Preload.d.ts +26 -0
- package/dist/types/Preload.d.ts.map +1 -0
- package/dist/types/Request.d.ts +86 -0
- package/dist/types/Request.d.ts.map +1 -0
- package/dist/types/Space.d.ts +205 -0
- package/dist/types/Space.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/IndexedDB.d.ts +130 -0
- package/dist/types/SpaceAdapter/IndexedDB.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/LocalStorage.d.ts +125 -0
- package/dist/types/SpaceAdapter/LocalStorage.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts +122 -0
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/SessionStorage.d.ts +30 -0
- package/dist/types/SpaceAdapter/SessionStorage.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/types.d.ts +76 -0
- package/dist/types/SpaceAdapter/types.d.ts.map +1 -0
- package/dist/types/Text.d.ts +47 -0
- package/dist/types/Text.d.ts.map +1 -0
- package/dist/types/Util.d.ts +31 -0
- package/dist/types/Util.d.ts.map +1 -0
- package/dist/types/browser.d.ts +7 -0
- package/dist/types/browser.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +42 -53
- package/dist/artemis.min.js +0 -2
- package/dist/artemis.min.js.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/index.js +0 -10
- package/src/DOM.js +0 -993
- package/src/Debug.js +0 -233
- package/src/FileSystem.js +0 -109
- package/src/Form.js +0 -73
- package/src/Platform.js +0 -166
- package/src/Preload.js +0 -48
- package/src/Request.js +0 -163
- package/src/Space.js +0 -334
- package/src/SpaceAdapter/IndexedDB.js +0 -345
- package/src/SpaceAdapter/LocalStorage.js +0 -395
- package/src/SpaceAdapter/RemoteStorage.js +0 -225
- package/src/SpaceAdapter/SessionStorage.js +0 -46
- package/src/Text.js +0 -133
- package/src/Util.js +0 -55
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* DOM
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Type for elements that can be used as a selector
|
|
8
|
+
*/
|
|
9
|
+
export type DOMSelector = string | Element | Element[] | NodeList | NodeListOf<Element> | HTMLElement[] | DOM | null;
|
|
10
|
+
/**
|
|
11
|
+
* Type for style properties object
|
|
12
|
+
*/
|
|
13
|
+
export type StyleProperties = Record<string, string | number>;
|
|
14
|
+
/**
|
|
15
|
+
* Type for offset object
|
|
16
|
+
*/
|
|
17
|
+
export interface DOMOffset {
|
|
18
|
+
top: number;
|
|
19
|
+
left: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Event callback type
|
|
23
|
+
*/
|
|
24
|
+
export type EventCallback = (event: Event) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Element callback type
|
|
27
|
+
*/
|
|
28
|
+
export type ElementCallback = (element: Element) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Simple DOM manipulation functions
|
|
31
|
+
*/
|
|
32
|
+
export declare class DOM {
|
|
33
|
+
collection: Element[] | NodeListOf<Element>;
|
|
34
|
+
length: number;
|
|
35
|
+
_selector: DOMSelector;
|
|
36
|
+
/**
|
|
37
|
+
* Create a new DOM object
|
|
38
|
+
*
|
|
39
|
+
* @param selector - Selector or DOM element to use
|
|
40
|
+
*/
|
|
41
|
+
constructor(selector: DOMSelector);
|
|
42
|
+
/**
|
|
43
|
+
* Hide elements by setting their `display` property to 'none'.
|
|
44
|
+
*
|
|
45
|
+
* @returns Current instance
|
|
46
|
+
*/
|
|
47
|
+
hide(): this;
|
|
48
|
+
/**
|
|
49
|
+
* Show elements by setting their `display` property to the given value.
|
|
50
|
+
*
|
|
51
|
+
* @param display - Display property to set
|
|
52
|
+
* @returns Current instance
|
|
53
|
+
*/
|
|
54
|
+
show(display?: string): this;
|
|
55
|
+
/**
|
|
56
|
+
* Add a class to the classList object
|
|
57
|
+
*
|
|
58
|
+
* @param newClass - Class name to add
|
|
59
|
+
* @returns Current instance
|
|
60
|
+
*/
|
|
61
|
+
addClass(newClass: string): this;
|
|
62
|
+
/**
|
|
63
|
+
* Remove a given class from the classList object
|
|
64
|
+
*
|
|
65
|
+
* @param oldClass - Class to remove. If it's empty or null, all classes will be removed
|
|
66
|
+
* @returns Current instance
|
|
67
|
+
*/
|
|
68
|
+
removeClass(oldClass?: string | null): this;
|
|
69
|
+
/**
|
|
70
|
+
* Toggle between two classes
|
|
71
|
+
*
|
|
72
|
+
* @param classes - Space separated class names
|
|
73
|
+
* @returns Current instance
|
|
74
|
+
*/
|
|
75
|
+
toggleClass(classes: string): this;
|
|
76
|
+
/**
|
|
77
|
+
* Check if ALL elements in the collection have the given class
|
|
78
|
+
*
|
|
79
|
+
* @param classToCheck - Class name to check for
|
|
80
|
+
* @returns Whether all elements have the class
|
|
81
|
+
*/
|
|
82
|
+
hasClass(classToCheck: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Get or set the value from the elements
|
|
85
|
+
*
|
|
86
|
+
* @param value - Value to set to the elements
|
|
87
|
+
* @returns If a value is provided, returns current instance. Otherwise returns the value(s) - single value if one element, array if multiple.
|
|
88
|
+
*/
|
|
89
|
+
value(value?: string): this | string | string[] | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Focus on the first element matching the selector
|
|
92
|
+
*
|
|
93
|
+
* @returns Current instance
|
|
94
|
+
*/
|
|
95
|
+
focus(): this;
|
|
96
|
+
/**
|
|
97
|
+
* Add a callback for the 'click' event on every element matching the selector
|
|
98
|
+
*
|
|
99
|
+
* @param callback - Callback function to run when the event is triggered
|
|
100
|
+
* @returns Current instance
|
|
101
|
+
*/
|
|
102
|
+
click(callback: EventCallback): this;
|
|
103
|
+
/**
|
|
104
|
+
* Add a callback for the 'keyup' event on every element matching the selector
|
|
105
|
+
*
|
|
106
|
+
* @param callback - Callback function to run when the event is triggered
|
|
107
|
+
* @returns Current instance
|
|
108
|
+
*/
|
|
109
|
+
keyup(callback: EventCallback): this;
|
|
110
|
+
/**
|
|
111
|
+
* Add a callback for the 'keydown' event on every element matching the selector
|
|
112
|
+
*
|
|
113
|
+
* @param callback - Callback function to run when the event is triggered
|
|
114
|
+
* @returns Current instance
|
|
115
|
+
*/
|
|
116
|
+
keydown(callback: EventCallback): this;
|
|
117
|
+
/**
|
|
118
|
+
* Add a callback for the 'submit' event on every element matching the selector
|
|
119
|
+
*
|
|
120
|
+
* @param callback - Callback function to run when the event is triggered
|
|
121
|
+
* @returns Current instance
|
|
122
|
+
*/
|
|
123
|
+
submit(callback: EventCallback): this;
|
|
124
|
+
/**
|
|
125
|
+
* Add a callback for the 'change' event on every element matching the selector
|
|
126
|
+
*
|
|
127
|
+
* @param callback - Callback function to run when the event is triggered
|
|
128
|
+
* @returns Current instance
|
|
129
|
+
*/
|
|
130
|
+
change(callback: EventCallback): this;
|
|
131
|
+
/**
|
|
132
|
+
* Add a callback for the 'scroll' event on every element matching the selector
|
|
133
|
+
*
|
|
134
|
+
* @param callback - Callback function to run when the event is triggered
|
|
135
|
+
* @returns Current instance
|
|
136
|
+
*/
|
|
137
|
+
scroll(callback: EventCallback): this;
|
|
138
|
+
/**
|
|
139
|
+
* Add a callback function to a given event
|
|
140
|
+
*
|
|
141
|
+
* @param event - Event to add the listener to
|
|
142
|
+
* @param target - Target element on which to detect the event or callback function
|
|
143
|
+
* @param callback - Callback function to run when the event is triggered
|
|
144
|
+
* @returns Current instance
|
|
145
|
+
*/
|
|
146
|
+
on(event: string, target: string | EventCallback, callback?: EventCallback): this;
|
|
147
|
+
/**
|
|
148
|
+
* Filter from the current collection to only those matching the new selector
|
|
149
|
+
* Applies to ALL elements in the collection
|
|
150
|
+
*
|
|
151
|
+
* @param selector - Selector to filter the collection with
|
|
152
|
+
* @returns New DOM instance with the filtered collection
|
|
153
|
+
*/
|
|
154
|
+
filter(selector: string): DOM;
|
|
155
|
+
/**
|
|
156
|
+
* Check if there are any elements that match the selector.
|
|
157
|
+
*
|
|
158
|
+
* @returns Whether elements matching the selector existed or not
|
|
159
|
+
*/
|
|
160
|
+
exists(): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Get or set a `data` property
|
|
163
|
+
*
|
|
164
|
+
* @param name - Name of the data property
|
|
165
|
+
* @param value - Value of the property
|
|
166
|
+
* @returns If no value is provided, returns the value(s) - single value if one element, array if multiple.
|
|
167
|
+
*/
|
|
168
|
+
data(name: string, value?: string): this | string | string[] | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Remove a data property from all the elements on the collection given its name.
|
|
171
|
+
*
|
|
172
|
+
* @param name - Name of the data property to remove
|
|
173
|
+
* @returns Current instance
|
|
174
|
+
*/
|
|
175
|
+
removeData(name: string): this;
|
|
176
|
+
/**
|
|
177
|
+
* Get or set the text of elements
|
|
178
|
+
*
|
|
179
|
+
* @param value - Value to set the text to
|
|
180
|
+
* @returns If no value is provided, returns the text(s) - single value if one element, array if multiple.
|
|
181
|
+
*/
|
|
182
|
+
text(value?: string): this | string | (string | null)[] | null | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Get or set the inner HTML of elements
|
|
185
|
+
*
|
|
186
|
+
* @param value - Value to set the HTML to
|
|
187
|
+
* @returns If no value is provided, returns the HTML(s) - single value if one element, array if multiple.
|
|
188
|
+
*/
|
|
189
|
+
html(value?: string): this | string | string[] | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Append an element to ALL elements in the collection
|
|
192
|
+
*
|
|
193
|
+
* @param element - String representation of the element to add or an Element
|
|
194
|
+
* @returns Current instance
|
|
195
|
+
*/
|
|
196
|
+
append(element: string | Element): this;
|
|
197
|
+
/**
|
|
198
|
+
* Prepend an element to ALL elements in the collection
|
|
199
|
+
*
|
|
200
|
+
* @param element - String representation of the element to add or an Element
|
|
201
|
+
* @returns Current instance
|
|
202
|
+
*/
|
|
203
|
+
prepend(element: string | Element): this;
|
|
204
|
+
/**
|
|
205
|
+
* Iterate over the collection of elements matching the selector
|
|
206
|
+
*
|
|
207
|
+
* @param callback - Callback to run for every element
|
|
208
|
+
* @returns Current instance
|
|
209
|
+
*/
|
|
210
|
+
each(callback: ElementCallback): this;
|
|
211
|
+
/**
|
|
212
|
+
* Get an element from the collection given its index
|
|
213
|
+
*
|
|
214
|
+
* @param index - Index of the element to retrieve
|
|
215
|
+
* @returns HTML Element in the position indicated by the index
|
|
216
|
+
*/
|
|
217
|
+
get(index: number): Element | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* Get the first element in the collection
|
|
220
|
+
*
|
|
221
|
+
* @returns DOM instance with the first element
|
|
222
|
+
*/
|
|
223
|
+
first(): DOM;
|
|
224
|
+
/**
|
|
225
|
+
* Get the last element in the collection
|
|
226
|
+
*
|
|
227
|
+
* @returns DOM instance with the last element
|
|
228
|
+
*/
|
|
229
|
+
last(): DOM;
|
|
230
|
+
/**
|
|
231
|
+
* Check if any element in the collection is visible by checking their
|
|
232
|
+
* display, offsetWidth and offsetHeight properties
|
|
233
|
+
*
|
|
234
|
+
* @returns Whether any element is visible
|
|
235
|
+
*/
|
|
236
|
+
isVisible(): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Get the parents of ALL elements in the collection
|
|
239
|
+
*
|
|
240
|
+
* @returns DOM instance of the parent elements
|
|
241
|
+
*/
|
|
242
|
+
parent(): DOM;
|
|
243
|
+
/**
|
|
244
|
+
* Find elements that match the given selector in ALL elements of the collection
|
|
245
|
+
*
|
|
246
|
+
* @param selector - Selector to find elements with
|
|
247
|
+
* @returns DOM instance with found elements
|
|
248
|
+
*/
|
|
249
|
+
find(selector: string): DOM;
|
|
250
|
+
/**
|
|
251
|
+
* Get the top and left offsets of elements in the collection
|
|
252
|
+
*
|
|
253
|
+
* @returns Single offset object if one element, array of offset objects if multiple
|
|
254
|
+
*/
|
|
255
|
+
offset(): DOMOffset | DOMOffset[] | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Find the closest element matching the given selector for ALL elements.
|
|
258
|
+
* This bubbles up from the initial object and then follows to its parents.
|
|
259
|
+
*
|
|
260
|
+
* @param selector - Selector to match the closest element with
|
|
261
|
+
* @returns DOM instance with the closest HTML elements matching the selector
|
|
262
|
+
*/
|
|
263
|
+
closest(selector: string): DOM;
|
|
264
|
+
/**
|
|
265
|
+
* Find the closest parent element matching the given selector. This bubbles up
|
|
266
|
+
* from the initial object and then follows to its parents.
|
|
267
|
+
*
|
|
268
|
+
* @param selector - Selector to match the closest element with
|
|
269
|
+
* @param limit - Selector for limit element. If the limit is reached and no element matching the provided selector was found, it will cause an early return.
|
|
270
|
+
* @returns DOM instance with the closest HTML element matching the selector
|
|
271
|
+
*/
|
|
272
|
+
closestParent(selector: string, limit?: string): DOM;
|
|
273
|
+
/**
|
|
274
|
+
* Get or set the value of a given attribute
|
|
275
|
+
*
|
|
276
|
+
* @param attribute - Attribute's name
|
|
277
|
+
* @param value - Value to set the attribute to
|
|
278
|
+
* @returns If no value is provided, returns the attribute value(s) - single value if one element, array if multiple.
|
|
279
|
+
*/
|
|
280
|
+
attribute(attribute: string, value?: string | number): this | string | (string | null)[] | null | undefined;
|
|
281
|
+
/**
|
|
282
|
+
* Check whether ALL elements have an attribute
|
|
283
|
+
*
|
|
284
|
+
* @param attribute - The name of the attribute to check existence for
|
|
285
|
+
* @returns Whether all elements have the attribute
|
|
286
|
+
*/
|
|
287
|
+
hasAttribute(attribute: string): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Insert content after all elements in the collection
|
|
290
|
+
*
|
|
291
|
+
* @param content - String representation of the content to add
|
|
292
|
+
* @returns Current instance
|
|
293
|
+
*/
|
|
294
|
+
after(content: string): this;
|
|
295
|
+
/**
|
|
296
|
+
* Insert content before all elements in the collection
|
|
297
|
+
*
|
|
298
|
+
* @param content - String representation of the content to add
|
|
299
|
+
* @returns Current instance
|
|
300
|
+
*/
|
|
301
|
+
before(content: string): this;
|
|
302
|
+
/**
|
|
303
|
+
* Get or modify the `style` properties of the elements matching the selector
|
|
304
|
+
*
|
|
305
|
+
* @param properties - Properties to change or get. Can be either an individual property or a JSON object with key-value pairs
|
|
306
|
+
* @param value - Value to set the property to when only changing one property
|
|
307
|
+
* @returns If a property is given but not a value for it, returns the style value(s) - single value if one element, array if multiple.
|
|
308
|
+
*/
|
|
309
|
+
style(properties: string | StyleProperties, value?: string): this | string | string[] | undefined;
|
|
310
|
+
/**
|
|
311
|
+
* Animate the given `style` properties on all elements in the collection
|
|
312
|
+
* with a given time duration
|
|
313
|
+
*
|
|
314
|
+
* @param style - JSON object with the key-value pairs of properties to animate
|
|
315
|
+
* @param time - Time in milliseconds during which the properties will be animated
|
|
316
|
+
* @returns Current instance
|
|
317
|
+
*/
|
|
318
|
+
animate(style: Record<string, number>, time: number): this;
|
|
319
|
+
/**
|
|
320
|
+
* Use a fade in animation on ALL elements in the collection
|
|
321
|
+
*
|
|
322
|
+
* @param time - Time duration for the animation
|
|
323
|
+
* @param callback - Callback function to run once all animations are over
|
|
324
|
+
* @returns Current instance
|
|
325
|
+
*/
|
|
326
|
+
fadeIn(time?: number, callback?: () => void): this;
|
|
327
|
+
/**
|
|
328
|
+
* Use a fade out animation on ALL elements in the collection
|
|
329
|
+
*
|
|
330
|
+
* @param time - Time duration for the animation
|
|
331
|
+
* @param callback - Callback function to run once all animations are over
|
|
332
|
+
* @returns Current instance
|
|
333
|
+
*/
|
|
334
|
+
fadeOut(time?: number, callback?: () => void): this;
|
|
335
|
+
/**
|
|
336
|
+
* Check if ALL elements in the collection match a given selector
|
|
337
|
+
*
|
|
338
|
+
* @param selector - Selector to match
|
|
339
|
+
* @returns Whether all elements match the selector
|
|
340
|
+
*/
|
|
341
|
+
matches(selector: string): boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Remove all elements in the collection
|
|
344
|
+
*
|
|
345
|
+
* @returns Current instance
|
|
346
|
+
*/
|
|
347
|
+
remove(): this;
|
|
348
|
+
/**
|
|
349
|
+
* Replace ALL elements in the collection with a new element
|
|
350
|
+
*
|
|
351
|
+
* @param newElement - The replacement element or HTML string
|
|
352
|
+
* @returns Current instance
|
|
353
|
+
*/
|
|
354
|
+
replaceWith(newElement: string | Element): this;
|
|
355
|
+
/**
|
|
356
|
+
* Reset every element in the collection (for form elements)
|
|
357
|
+
*
|
|
358
|
+
* @returns Current instance
|
|
359
|
+
*/
|
|
360
|
+
reset(): this;
|
|
361
|
+
/**
|
|
362
|
+
* Get or set a property for elements in the collection
|
|
363
|
+
*
|
|
364
|
+
* @param property - Property name to set or get
|
|
365
|
+
* @param value - Value to set the property to
|
|
366
|
+
* @returns If no value is provided, returns the property value(s) - single value if one element, array if multiple.
|
|
367
|
+
*/
|
|
368
|
+
property<T = unknown>(property: string, value?: T): this | T | T[] | undefined;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Simple wrapper function to use the DOM library
|
|
372
|
+
*
|
|
373
|
+
* @param selector - Selector or DOM element to use
|
|
374
|
+
* @returns DOM instance
|
|
375
|
+
*/
|
|
376
|
+
export declare function $_(selector: DOMSelector): DOM;
|
|
377
|
+
/**
|
|
378
|
+
* Utility function to attach the 'load' listener to the window
|
|
379
|
+
*
|
|
380
|
+
* @param callback - Callback function to run when the window is ready
|
|
381
|
+
*/
|
|
382
|
+
export declare function $_ready(callback: EventListener): void;
|
|
383
|
+
//# sourceMappingURL=DOM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOM.d.ts","sourceRoot":"","sources":["../../src/DOM.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,EAAE,GAAG,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC;AAErH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAEzD;;GAEG;AACH,qBAAa,GAAG;IACR,UAAU,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,WAAW,CAAC;IAE9B;;;;OAIG;gBACS,QAAQ,EAAE,WAAW;IAmCjC;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAOZ;;;;;OAKG;IACH,IAAI,CAAC,OAAO,GAAE,MAAgB,GAAG,IAAI;IAOrC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOhC;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,IAAI;IAkBjD;;;;;OAKG;IACH,WAA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
|
8
|
+
*/
|
|
9
|
+
export declare enum DebugLevel {
|
|
10
|
+
NONE = 0,
|
|
11
|
+
ERROR = 1,
|
|
12
|
+
WARNING = 2,
|
|
13
|
+
INFO = 3,
|
|
14
|
+
DEBUG = 4,
|
|
15
|
+
ALL = 5
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This class acts as a proxy for the console. It shares the same methods as the
|
|
19
|
+
* web console but they are conditioned to a debug level.
|
|
20
|
+
*/
|
|
21
|
+
export declare class Debug {
|
|
22
|
+
private static _level;
|
|
23
|
+
/**
|
|
24
|
+
* Set or get the log level
|
|
25
|
+
*
|
|
26
|
+
* @param level - The debug level to use
|
|
27
|
+
* @returns The current debug level
|
|
28
|
+
*/
|
|
29
|
+
static level(level?: DebugLevel): DebugLevel;
|
|
30
|
+
/**
|
|
31
|
+
* Log the given elements.
|
|
32
|
+
* Logs will only be made if the level is set to DEBUG or above
|
|
33
|
+
*
|
|
34
|
+
* @param args - Arguments to log
|
|
35
|
+
*/
|
|
36
|
+
static log(...args: unknown[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Show a debugging log
|
|
39
|
+
* Logs will only be made if the level is set DEBUG or above
|
|
40
|
+
*
|
|
41
|
+
* @param args - Arguments to log
|
|
42
|
+
*/
|
|
43
|
+
static debug(...args: unknown[]): void;
|
|
44
|
+
/**
|
|
45
|
+
* Show an info log
|
|
46
|
+
* Logs will only be made if the level is set to INFO or above
|
|
47
|
+
*
|
|
48
|
+
* @param args - Arguments to log
|
|
49
|
+
*/
|
|
50
|
+
static info(...args: unknown[]): void;
|
|
51
|
+
/**
|
|
52
|
+
* Show an error log
|
|
53
|
+
* Logs will only be made if the level is set to ERROR or above
|
|
54
|
+
*
|
|
55
|
+
* @param args - Arguments to log
|
|
56
|
+
*/
|
|
57
|
+
static error(...args: unknown[]): void;
|
|
58
|
+
/**
|
|
59
|
+
* Show a warning log
|
|
60
|
+
* Logs will only be made if the level is set to WARNING or above
|
|
61
|
+
*
|
|
62
|
+
* @param args - Arguments to log
|
|
63
|
+
*/
|
|
64
|
+
static warning(...args: unknown[]): void;
|
|
65
|
+
/**
|
|
66
|
+
* Show data as a table
|
|
67
|
+
* Table will only be made if the level is set to DEBUG or above
|
|
68
|
+
*
|
|
69
|
+
* @param args - Arguments to display as table
|
|
70
|
+
*/
|
|
71
|
+
static table(...args: unknown[]): void;
|
|
72
|
+
/**
|
|
73
|
+
* Start an indented group
|
|
74
|
+
*
|
|
75
|
+
* @param args - Group label arguments
|
|
76
|
+
*/
|
|
77
|
+
static group(...args: unknown[]): void;
|
|
78
|
+
/**
|
|
79
|
+
* Start an indented group collapsed by default
|
|
80
|
+
*
|
|
81
|
+
* @param args - Group label arguments
|
|
82
|
+
*/
|
|
83
|
+
static groupCollapsed(...args: unknown[]): void;
|
|
84
|
+
/**
|
|
85
|
+
* End a previously started group
|
|
86
|
+
*/
|
|
87
|
+
static groupEnd(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Start a timer
|
|
90
|
+
* The timer will only start if the level is set to DEBUG or above
|
|
91
|
+
*
|
|
92
|
+
* @param label - Timer label
|
|
93
|
+
*/
|
|
94
|
+
static time(label?: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Log the time a timer has been running for
|
|
97
|
+
* The time will only be logged if the level is set to DEBUG or above
|
|
98
|
+
*
|
|
99
|
+
* @param label - Timer label
|
|
100
|
+
* @param args - Additional arguments to log
|
|
101
|
+
*/
|
|
102
|
+
static timeLog(label?: string, ...args: unknown[]): void;
|
|
103
|
+
/**
|
|
104
|
+
* End a timer
|
|
105
|
+
* The timer will only be available if the level is set to DEBUG or above
|
|
106
|
+
*
|
|
107
|
+
* @param label - Timer label
|
|
108
|
+
*/
|
|
109
|
+
static timeEnd(label?: string): void;
|
|
110
|
+
/**
|
|
111
|
+
* Show the stack trace
|
|
112
|
+
* The stack trace will only be available if the level is set to DEBUG or above
|
|
113
|
+
*
|
|
114
|
+
* @param args - Arguments to log with trace
|
|
115
|
+
*/
|
|
116
|
+
static trace(...args: unknown[]): void;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=Debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Debug.d.ts","sourceRoot":"","sources":["../../src/Debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH;;GAEG;AACH,oBAAY,UAAU;IACrB,IAAI,IAAI;IACR,KAAK,IAAI;IACT,OAAO,IAAI;IACX,IAAI,IAAI;IACR,KAAK,IAAI;IACT,GAAG,IAAI;CACP;AAED;;;GAGG;AACH,qBAAa,KAAK;IACjB,OAAO,CAAC,MAAM,CAAC,MAAM,CAA+B;IAEpD;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU;IAO5C;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMpC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMrC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMxC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/C;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,IAAI;IAMvB;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAMjC;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMxD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAMpC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAKtC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* File System
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
import { RequestOptions } from './Request';
|
|
7
|
+
/**
|
|
8
|
+
* File read type options
|
|
9
|
+
*/
|
|
10
|
+
export type FileReadType = 'text' | 'base64' | 'buffer';
|
|
11
|
+
/**
|
|
12
|
+
* File read result type based on read type
|
|
13
|
+
*/
|
|
14
|
+
export interface FileReadResult {
|
|
15
|
+
event: ProgressEvent<FileReader>;
|
|
16
|
+
content: string | ArrayBuffer | null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A simple class wrapper for the File and FileReader web API, while this class
|
|
20
|
+
* doesn't actually provide access to the host file system, it does provide useful
|
|
21
|
+
* utilities for form file inputs and remote content loading.
|
|
22
|
+
*/
|
|
23
|
+
export declare class FileSystem {
|
|
24
|
+
/**
|
|
25
|
+
* Read a file from a remote location given a URL. This function will fetch
|
|
26
|
+
* the file blob using the Request class and then use the read() function
|
|
27
|
+
* to read the blob in the format required.
|
|
28
|
+
*
|
|
29
|
+
* @param url - URL to fetch the file from
|
|
30
|
+
* @param type - Type of data to be read, values can be 'text', 'base64' and 'buffer'
|
|
31
|
+
* @param props - Props to send to the Request object
|
|
32
|
+
* @returns Content of the file. The format depends on the type parameter used.
|
|
33
|
+
*/
|
|
34
|
+
static readRemote(url: string, type?: FileReadType, props?: RequestOptions): Promise<FileReadResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Read a given File or Blob object.
|
|
37
|
+
*
|
|
38
|
+
* @param file - File to read
|
|
39
|
+
* @param type - Type of data to be read, values can be 'text', 'base64' and 'buffer'
|
|
40
|
+
* @returns Promise that resolves to the load event and content of the file
|
|
41
|
+
*/
|
|
42
|
+
static read(file: File | Blob, type?: FileReadType): Promise<FileReadResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a new File, this uses the File API and will not actually create
|
|
45
|
+
* a file in the user's file system, however using it with other features,
|
|
46
|
+
* that may be possible
|
|
47
|
+
*
|
|
48
|
+
* @param name - Name of the file (Including extension)
|
|
49
|
+
* @param content - Content to save in the file
|
|
50
|
+
* @param type - Mime Type for the file
|
|
51
|
+
* @returns Promise resolving to the created File
|
|
52
|
+
*/
|
|
53
|
+
static create(name: string, content: BlobPart, type?: string): Promise<File>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the extension of a file given its file name.
|
|
56
|
+
*
|
|
57
|
+
* @param name - Name or full path of the file
|
|
58
|
+
* @returns File extension without the leading dot (.)
|
|
59
|
+
*/
|
|
60
|
+
static extension(name: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Check if a file is an image by its extension.
|
|
63
|
+
*
|
|
64
|
+
* @param name - Name or full path of the file
|
|
65
|
+
* @returns Whether the file is an image
|
|
66
|
+
*/
|
|
67
|
+
static isImage(name: string): boolean;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=FileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../src/FileSystem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAW,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;CACrC;AAED;;;;GAIG;AACH,qBAAa,UAAU;IACtB;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,YAAuB,EAAE,KAAK,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAMlH;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAE,YAAqB,GAAG,OAAO,CAAC,cAAc,CAAC;IA0BpF;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAE,MAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAItC;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAIrC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* Form
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Form data object type
|
|
8
|
+
*/
|
|
9
|
+
export type FormData = Record<string, string | File | FileList | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Utility class that provides simple functions for filling and retrieving values
|
|
12
|
+
* from forms. This class requires the use of the `data-form` attribute.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Form {
|
|
15
|
+
/**
|
|
16
|
+
* Fill a form's inputs with the given values. Each key in the provided object
|
|
17
|
+
* must match the `name` attribute of the input to fill.
|
|
18
|
+
*
|
|
19
|
+
* @param name - Form name. Must match the `data-form` attribute of the Form.
|
|
20
|
+
* @param data - JSON object with key-value pairs to fill the inputs.
|
|
21
|
+
*/
|
|
22
|
+
static fill(name: string, data: Record<string, string>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get all the values from a form's inputs. The keys are mapped using the
|
|
25
|
+
* `name` attribute of each input.
|
|
26
|
+
*
|
|
27
|
+
* @param name - Form name. Must match the `data-form` attribute of the Form.
|
|
28
|
+
* @returns Key-value JSON object
|
|
29
|
+
*/
|
|
30
|
+
static values(name: string): FormData;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/Form.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;AAE5E;;;GAGG;AACH,qBAAa,IAAI;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAkB7D;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;CAwBrC"}
|