@webalternatif/js-core 1.5.4 → 1.6.0
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/README.md +54 -2
- package/dist/cjs/Mouse.js +27 -10
- package/dist/cjs/Translator.js +5 -9
- package/dist/cjs/array.js +42 -7
- package/dist/cjs/dom.js +41 -262
- package/dist/cjs/index.js +64 -6
- package/dist/cjs/is.js +78 -5
- package/dist/cjs/onOff.js +308 -0
- package/dist/esm/Mouse.js +27 -10
- package/dist/esm/Translator.js +5 -9
- package/dist/esm/array.js +42 -7
- package/dist/esm/dom.js +42 -262
- package/dist/esm/index.js +69 -4
- package/dist/esm/is.js +79 -5
- package/dist/esm/onOff.js +299 -0
- package/package.json +11 -7
- package/types/Mouse.d.ts +20 -5
- package/types/Translator.d.ts +3 -3
- package/types/array.d.ts +2 -1
- package/types/dom.d.ts +63 -67
- package/types/index.d.ts +13 -63
- package/types/is.d.ts +3 -3
- package/types/onOff.d.ts +19 -0
package/types/dom.d.ts
CHANGED
|
@@ -9,177 +9,177 @@ declare namespace dom {
|
|
|
9
9
|
* @param {string} [selector]
|
|
10
10
|
* @returns {NodeList}
|
|
11
11
|
*/
|
|
12
|
-
function children(el: Element, selector?: string): NodeList;
|
|
12
|
+
export function children(el: Element, selector?: string): NodeList;
|
|
13
13
|
/**
|
|
14
14
|
* @param {Element} el
|
|
15
15
|
* @param {string} [selector]
|
|
16
16
|
* @returns {Element|null}
|
|
17
17
|
*/
|
|
18
|
-
function child(el: Element, selector?: string): Element | null;
|
|
18
|
+
export function child(el: Element, selector?: string): Element | null;
|
|
19
19
|
/**
|
|
20
20
|
* @param {Element|Document|string} refEl
|
|
21
21
|
* @param {string|Element|NodeList|Array<Element>} [selector]
|
|
22
22
|
* @returns {Element}
|
|
23
23
|
*/
|
|
24
|
-
function findOne(refEl: Element | Document | string, selector?: string | Element | NodeList | Array<Element>): Element;
|
|
24
|
+
export function findOne(refEl: Element | Document | string, selector?: string | Element | NodeList | Array<Element>): Element;
|
|
25
25
|
/**
|
|
26
26
|
* @param {Element|Document|string} refEl
|
|
27
27
|
* @param {string|Element|NodeList|Array<Element>} [selector]
|
|
28
28
|
* @returns {Array<Element>}
|
|
29
29
|
*/
|
|
30
|
-
function find(refEl: Element | Document | string, selector?: string | Element | NodeList | Array<Element>): Array<Element>;
|
|
30
|
+
export function find(refEl: Element | Document | string, selector?: string | Element | NodeList | Array<Element>): Array<Element>;
|
|
31
31
|
/**
|
|
32
32
|
* @param {Element|string} el
|
|
33
33
|
* @param {string} data
|
|
34
34
|
* @param {string} [value]
|
|
35
35
|
* @returns {Element|null}
|
|
36
36
|
*/
|
|
37
|
-
function findOneByData(el: Element | string, data: string, value?: string): Element | null;
|
|
37
|
+
export function findOneByData(el: Element | string, data: string, value?: string): Element | null;
|
|
38
38
|
/**
|
|
39
39
|
* @param {Element|string} el
|
|
40
40
|
* @param {string} data
|
|
41
41
|
* @param {string} [value]
|
|
42
42
|
* @returns {Element[]}
|
|
43
43
|
*/
|
|
44
|
-
function findByData(el: Element | string, data: string, value?: string): Element[];
|
|
44
|
+
export function findByData(el: Element | string, data: string, value?: string): Element[];
|
|
45
45
|
/**
|
|
46
46
|
* @param {Element|NodeList|Array<Element>} el
|
|
47
47
|
* @param {string} className
|
|
48
48
|
* @returns {Element|NodeList|Array<Element>}
|
|
49
49
|
*/
|
|
50
|
-
function addClass(el: Element | NodeList | Array<Element>, className: string): Element | NodeList | Array<Element>;
|
|
50
|
+
export function addClass(el: Element | NodeList | Array<Element>, className: string): Element | NodeList | Array<Element>;
|
|
51
51
|
/**
|
|
52
52
|
* @param {Element|NodeList|Array<Element>} el
|
|
53
53
|
* @param {string} className
|
|
54
54
|
* @returns {Element|NodeList|Array<Element>}
|
|
55
55
|
*/
|
|
56
|
-
function removeClass(el: Element | NodeList | Array<Element>, className: string): Element | NodeList | Array<Element>;
|
|
56
|
+
export function removeClass(el: Element | NodeList | Array<Element>, className: string): Element | NodeList | Array<Element>;
|
|
57
57
|
/**
|
|
58
58
|
* @param {Element} el
|
|
59
59
|
* @param {string} classNames
|
|
60
60
|
* @param {boolean} [force]
|
|
61
61
|
* @returns {Element}
|
|
62
62
|
*/
|
|
63
|
-
function toggleClass(el: Element, classNames: string, force?: boolean): Element;
|
|
63
|
+
export function toggleClass(el: Element, classNames: string, force?: boolean): Element;
|
|
64
64
|
/**
|
|
65
65
|
* @param {Element} el
|
|
66
66
|
* @param {string} classNames
|
|
67
67
|
* @returns {boolean}
|
|
68
68
|
*/
|
|
69
|
-
function hasClass(el: Element, classNames: string): boolean;
|
|
69
|
+
export function hasClass(el: Element, classNames: string): boolean;
|
|
70
70
|
/**
|
|
71
71
|
* @param {Node} node
|
|
72
72
|
* @param {...(Node|string)} children
|
|
73
73
|
* @returns {Node}
|
|
74
74
|
*/
|
|
75
|
-
function append(node: Node, ...children: (Node | string)[]): Node;
|
|
75
|
+
export function append(node: Node, ...children: (Node | string)[]): Node;
|
|
76
76
|
/**
|
|
77
77
|
* @param {Node} node
|
|
78
78
|
* @param {...(Node|string)} children
|
|
79
79
|
* @returns {Node}
|
|
80
80
|
*/
|
|
81
|
-
function prepend(node: Node, ...children: (Node | string)[]): Node;
|
|
81
|
+
export function prepend(node: Node, ...children: (Node | string)[]): Node;
|
|
82
82
|
/**
|
|
83
83
|
* @param {Element|NodeList|Array<Element>|string} els
|
|
84
84
|
* @returns {void}
|
|
85
85
|
*/
|
|
86
|
-
function remove(...els: Element | NodeList | Array<Element> | string): void;
|
|
86
|
+
export function remove(...els: Element | NodeList | Array<Element> | string): void;
|
|
87
87
|
/**
|
|
88
88
|
* @param {Element} el
|
|
89
89
|
* @param {string|Element} [selector]
|
|
90
90
|
* @returns {Element|null}
|
|
91
91
|
*/
|
|
92
|
-
function closest(el: Element, selector?: string | Element): Element | null;
|
|
92
|
+
export function closest(el: Element, selector?: string | Element): Element | null;
|
|
93
93
|
/**
|
|
94
94
|
* @param {Element} el
|
|
95
95
|
* @param {string} [selector]
|
|
96
96
|
* @returns {Element|null}
|
|
97
97
|
*/
|
|
98
|
-
function next(el: Element, selector?: string): Element | null;
|
|
98
|
+
export function next(el: Element, selector?: string): Element | null;
|
|
99
99
|
/**
|
|
100
100
|
* @param {Element} el
|
|
101
101
|
* @param {string|null} [selector]
|
|
102
102
|
* @returns {Element|null}
|
|
103
103
|
*/
|
|
104
|
-
function prev(el: Element, selector?: string | null): Element | null;
|
|
104
|
+
export function prev(el: Element, selector?: string | null): Element | null;
|
|
105
105
|
/**
|
|
106
106
|
* @param {Element} el
|
|
107
107
|
* @param {string} [selector]
|
|
108
108
|
* @returns {Element[]}
|
|
109
109
|
*/
|
|
110
|
-
function nextAll(el: Element, selector?: string): Element[];
|
|
110
|
+
export function nextAll(el: Element, selector?: string): Element[];
|
|
111
111
|
/**
|
|
112
112
|
* @param {Element} el
|
|
113
113
|
* @param {string} [selector]
|
|
114
114
|
* @returns {Element[]}
|
|
115
115
|
*/
|
|
116
|
-
function prevAll(el: Element, selector?: string): Element[];
|
|
116
|
+
export function prevAll(el: Element, selector?: string): Element[];
|
|
117
117
|
/**
|
|
118
118
|
* @param {Element} el
|
|
119
119
|
* @param {Element|string} selector
|
|
120
120
|
* @returns {Element[]}
|
|
121
121
|
*/
|
|
122
|
-
function nextUntil(el: Element, selector: Element | string): Element[];
|
|
122
|
+
export function nextUntil(el: Element, selector: Element | string): Element[];
|
|
123
123
|
/**
|
|
124
124
|
* @param {Element} el
|
|
125
125
|
* @param {Element|string} selector
|
|
126
126
|
* @returns {Element[]}
|
|
127
127
|
*/
|
|
128
|
-
function prevUntil(el: Element, selector: Element | string): Element[];
|
|
128
|
+
export function prevUntil(el: Element, selector: Element | string): Element[];
|
|
129
129
|
/**
|
|
130
130
|
* @param {Element} el
|
|
131
131
|
* @param {Element} wrappingElement
|
|
132
132
|
* @returns {Element}
|
|
133
133
|
*/
|
|
134
|
-
function wrap(el: Element, wrappingElement: Element): Element;
|
|
134
|
+
export function wrap(el: Element, wrappingElement: Element): Element;
|
|
135
135
|
/**
|
|
136
136
|
* @param {Element} el
|
|
137
137
|
* @param {string} name
|
|
138
138
|
* @param {*} [value]
|
|
139
139
|
* @returns {Element|*}
|
|
140
140
|
*/
|
|
141
|
-
function attr(el: Element, name: string, value?: any): Element | any;
|
|
141
|
+
export function attr(el: Element, name: string, value?: any): Element | any;
|
|
142
142
|
/**
|
|
143
143
|
* @param {Element} el
|
|
144
144
|
* @param {string} name
|
|
145
145
|
* @param {*} [value]
|
|
146
146
|
* @returns {*|Element}
|
|
147
147
|
*/
|
|
148
|
-
function prop(el: Element, name: string, value?: any): any | Element;
|
|
148
|
+
export function prop(el: Element, name: string, value?: any): any | Element;
|
|
149
149
|
/**
|
|
150
150
|
* @param {Element} el
|
|
151
151
|
* @param {string} [html]
|
|
152
|
-
* @returns {Element
|
|
152
|
+
* @returns {Element|string}
|
|
153
153
|
*/
|
|
154
|
-
function html(el: Element, html?: string): Element |
|
|
154
|
+
export function html(el: Element, html?: string): Element | string;
|
|
155
155
|
/**
|
|
156
156
|
* @param {Element} el
|
|
157
157
|
* @param {string} [text]
|
|
158
|
-
* @returns {Element
|
|
158
|
+
* @returns {Element|string}
|
|
159
159
|
*/
|
|
160
|
-
function text(el: Element, text?: string): Element |
|
|
160
|
+
export function text(el: Element, text?: string): Element | string;
|
|
161
161
|
/**
|
|
162
162
|
* @param {Element} el
|
|
163
163
|
* @returns {Element}
|
|
164
164
|
*/
|
|
165
|
-
function hide(el: Element): Element;
|
|
165
|
+
export function hide(el: Element): Element;
|
|
166
166
|
/**
|
|
167
167
|
* @param {Element} el
|
|
168
168
|
* @returns {Element}
|
|
169
169
|
*/
|
|
170
|
-
function show(el: Element): Element;
|
|
170
|
+
export function show(el: Element): Element;
|
|
171
171
|
/**
|
|
172
172
|
* @param {Element} el
|
|
173
173
|
* @returns {Element}
|
|
174
174
|
*/
|
|
175
|
-
function toggle(el: Element): Element;
|
|
175
|
+
export function toggle(el: Element): Element;
|
|
176
176
|
/**
|
|
177
177
|
* @param {Element} el
|
|
178
178
|
* @param {Object<string, string>|string} name
|
|
179
179
|
* @param {string} [value]
|
|
180
180
|
* @returns {Element|DOMStringMap}
|
|
181
181
|
*/
|
|
182
|
-
function data(el: Element, name: {
|
|
182
|
+
export function data(el: Element, name: {
|
|
183
183
|
[x: string]: string;
|
|
184
184
|
} | string, value?: string): Element | DOMStringMap;
|
|
185
185
|
/**
|
|
@@ -187,32 +187,14 @@ declare namespace dom {
|
|
|
187
187
|
* @param {string} name
|
|
188
188
|
* @returns {Element|*}
|
|
189
189
|
*/
|
|
190
|
-
function removeData(el: Element, name: string): Element | any;
|
|
191
|
-
/**
|
|
192
|
-
* @param {Element|Document|Window} el
|
|
193
|
-
* @param {string} events
|
|
194
|
-
* @param {string|Element|function} selector
|
|
195
|
-
* @param {function|AddEventListenerOptions|boolean} [handler]
|
|
196
|
-
* @param {AddEventListenerOptions|boolean} [options]
|
|
197
|
-
* @returns {Element}
|
|
198
|
-
*/
|
|
199
|
-
function on(el: Element | Document | Window, events: string, selector: string | Element | Function, handler?: Function | AddEventListenerOptions | boolean, options?: AddEventListenerOptions | boolean): Element;
|
|
200
|
-
/**
|
|
201
|
-
* @param {Element|Document|Window} el
|
|
202
|
-
* @param {string} [events]
|
|
203
|
-
* @param {string|Element|function} [selector]
|
|
204
|
-
* @param {function|AddEventListenerOptions|boolean} [handler]
|
|
205
|
-
* @param {AddEventListenerOptions|boolean} [options]
|
|
206
|
-
* @returns {Element}
|
|
207
|
-
*/
|
|
208
|
-
function off(el: Element | Document | Window, events?: string, selector?: string | Element | Function, handler?: Function | AddEventListenerOptions | boolean, options?: AddEventListenerOptions | boolean): Element;
|
|
190
|
+
export function removeData(el: Element, name: string): Element | any;
|
|
209
191
|
/**
|
|
210
192
|
* @param {HTMLElement} el
|
|
211
193
|
* @param {Object<string, string>|string} style
|
|
212
194
|
* @param {string} [value]
|
|
213
195
|
* @returns {Element}
|
|
214
196
|
*/
|
|
215
|
-
function css(el: HTMLElement, style: {
|
|
197
|
+
export function css(el: HTMLElement, style: {
|
|
216
198
|
[x: string]: string;
|
|
217
199
|
} | string, value?: string): Element;
|
|
218
200
|
/**
|
|
@@ -221,87 +203,101 @@ declare namespace dom {
|
|
|
221
203
|
* @param {string} selectorFind
|
|
222
204
|
* @returns {Array<Element>}
|
|
223
205
|
*/
|
|
224
|
-
function closestFind(el: Element, selectorClosest: string, selectorFind: string): Array<Element>;
|
|
206
|
+
export function closestFind(el: Element, selectorClosest: string, selectorFind: string): Array<Element>;
|
|
225
207
|
/**
|
|
226
208
|
* @param {Element} el
|
|
227
209
|
* @param {string} selectorClosest
|
|
228
210
|
* @param {string} selectorFindOne
|
|
229
211
|
* @returns {Element|null}
|
|
230
212
|
*/
|
|
231
|
-
function closestFindOne(el: Element, selectorClosest: string, selectorFindOne: string): Element | null;
|
|
213
|
+
export function closestFindOne(el: Element, selectorClosest: string, selectorFindOne: string): Element | null;
|
|
232
214
|
/**
|
|
233
215
|
* @param {NodeList|Element|Array<Element>} nodeList
|
|
234
216
|
* @returns {Element|null}
|
|
235
217
|
*/
|
|
236
|
-
function first(nodeList: NodeList | Element | Array<Element>): Element | null;
|
|
218
|
+
export function first(nodeList: NodeList | Element | Array<Element>): Element | null;
|
|
237
219
|
/**
|
|
238
220
|
* @param {NodeList|Array<Element>} nodeList
|
|
239
221
|
* @returns {Element|null}
|
|
240
222
|
*/
|
|
241
|
-
function last(nodeList: NodeList | Array<Element>): Element | null;
|
|
223
|
+
export function last(nodeList: NodeList | Array<Element>): Element | null;
|
|
242
224
|
/**
|
|
243
225
|
* @param {string} html
|
|
244
226
|
* @returns {Element|DocumentFragment|null}
|
|
245
227
|
*/
|
|
246
|
-
function create(html: string): Element | DocumentFragment | null;
|
|
228
|
+
export function create(html: string): Element | DocumentFragment | null;
|
|
247
229
|
/**
|
|
248
230
|
* @param {NodeList|Array<Element>} nodeList
|
|
249
231
|
* @param {number} [index=0]
|
|
250
232
|
* @returns {Element|null}
|
|
251
233
|
*/
|
|
252
|
-
function eq(nodeList: NodeList | Array<Element>, index?: number): Element | null;
|
|
234
|
+
export function eq(nodeList: NodeList | Array<Element>, index?: number): Element | null;
|
|
253
235
|
/**
|
|
254
236
|
* @param {Element} el
|
|
255
237
|
* @param {Element|string} newEl
|
|
256
238
|
* @returns {Element|null}
|
|
257
239
|
*/
|
|
258
|
-
function after(el: Element, newEl: Element | string): Element | null;
|
|
240
|
+
export function after(el: Element, newEl: Element | string): Element | null;
|
|
259
241
|
/**
|
|
260
242
|
* @param {Element} el
|
|
261
243
|
* @param {Element|string} newEl
|
|
262
244
|
* @returns {Element|null}
|
|
263
245
|
*/
|
|
264
|
-
function before(el: Element, newEl: Element | string): Element | null;
|
|
246
|
+
export function before(el: Element, newEl: Element | string): Element | null;
|
|
265
247
|
/**
|
|
266
|
-
* @param {Element
|
|
248
|
+
* @param {Element} el
|
|
267
249
|
* @returns {Element}
|
|
268
250
|
*/
|
|
269
|
-
function empty(el: Element
|
|
251
|
+
export function empty(el: Element): Element;
|
|
270
252
|
/**
|
|
271
253
|
* @param {Element|NodeList|Array<Element>} el
|
|
272
254
|
* @param {string|Element} selector
|
|
273
255
|
* @return {Array<Element>}
|
|
274
256
|
*/
|
|
275
|
-
function not(el: Element | NodeList | Array<Element>, selector: string | Element): Array<Element>;
|
|
257
|
+
export function not(el: Element | NodeList | Array<Element>, selector: string | Element): Array<Element>;
|
|
276
258
|
/**
|
|
277
259
|
* @param {Element} elem1
|
|
278
260
|
* @param {Element} elem2
|
|
279
261
|
* @returns {boolean}
|
|
280
262
|
*/
|
|
281
|
-
function collide(elem1: Element, elem2: Element): boolean;
|
|
263
|
+
export function collide(elem1: Element, elem2: Element): boolean;
|
|
282
264
|
/**
|
|
283
265
|
* @param {Element} el
|
|
284
266
|
* @param {string|Element} selector
|
|
285
267
|
*/
|
|
286
|
-
function matches(el: Element, selector: string | Element): boolean;
|
|
268
|
+
export function matches(el: Element, selector: string | Element): boolean;
|
|
287
269
|
/**
|
|
288
270
|
* @param {Element} el
|
|
289
271
|
* @param {Element} child
|
|
290
272
|
* @param {Element} oldChild
|
|
291
273
|
*/
|
|
292
|
-
function replaceChild(el: Element, child: Element, oldChild: Element): Element;
|
|
274
|
+
export function replaceChild(el: Element, child: Element, oldChild: Element): Element;
|
|
293
275
|
/**
|
|
294
276
|
* @param {Element} el
|
|
295
277
|
* @param {NodeList|Array<Element>|string[]} children
|
|
296
278
|
* @returns {Element}
|
|
297
279
|
*/
|
|
298
|
-
function replaceChildren(el: Element, ...children: NodeList | Array<Element> | string[]): Element;
|
|
280
|
+
export function replaceChildren(el: Element, ...children: NodeList | Array<Element> | string[]): Element;
|
|
299
281
|
/**
|
|
300
282
|
* @param {Element|Document|Window} el
|
|
301
283
|
* @returns {{top: number, left: number}}
|
|
302
284
|
*/
|
|
303
|
-
function offset(el: Element | Document | Window): {
|
|
285
|
+
export function offset(el: Element | Document | Window): {
|
|
304
286
|
top: number;
|
|
305
287
|
left: number;
|
|
306
288
|
};
|
|
289
|
+
/**
|
|
290
|
+
* @param {Node} el
|
|
291
|
+
* @returns {boolean}
|
|
292
|
+
*/
|
|
293
|
+
export function isEditable(el: Node): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* @param {Node} node
|
|
296
|
+
* @returns {boolean}
|
|
297
|
+
*/
|
|
298
|
+
export function isInDOM(node: Node): boolean;
|
|
299
|
+
export { on };
|
|
300
|
+
export { off };
|
|
307
301
|
}
|
|
302
|
+
import { on } from './onOff.js';
|
|
303
|
+
import { off } from './onOff.js';
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export default webf;
|
|
2
|
+
/**
|
|
3
|
+
* Main entry point of js-core.
|
|
4
|
+
*
|
|
5
|
+
* Provides pure JavaScript utility functions such as string, array,
|
|
6
|
+
* type checking, traversal, math and other helpers.
|
|
7
|
+
*
|
|
8
|
+
* @module webf
|
|
9
|
+
*/
|
|
2
10
|
declare const webf: {
|
|
3
|
-
default: typeof i18n.default;
|
|
4
11
|
equals: (o1: any, o2: any, seen?: WeakMap<WeakKey, any>) => any;
|
|
5
12
|
noop: () => void;
|
|
6
13
|
sizeOf: (o: any) => number;
|
|
@@ -15,63 +22,6 @@ declare const webf: {
|
|
|
15
22
|
max: (list: any, cmp_func: any) => number | undefined;
|
|
16
23
|
dec2hex: (n: number) => string;
|
|
17
24
|
hex2dec: (hex: string) => number;
|
|
18
|
-
dom: {
|
|
19
|
-
children(el: Element, selector?: string): NodeList;
|
|
20
|
-
child(el: Element, selector?: string): Element | null;
|
|
21
|
-
findOne(refEl: Element | Document | string, selector?: string | Element | NodeList | Array<Element>): Element;
|
|
22
|
-
find(refEl: Element | Document | string, selector?: string | Element | NodeList | Array<Element>): Array<Element>;
|
|
23
|
-
findOneByData(el: Element | string, data: string, value?: string): Element | null;
|
|
24
|
-
findByData(el: Element | string, data: string, value?: string): Element[];
|
|
25
|
-
addClass(el: Element | NodeList | Array<Element>, className: string): Element | NodeList | Array<Element>;
|
|
26
|
-
removeClass(el: Element | NodeList | Array<Element>, className: string): Element | NodeList | Array<Element>;
|
|
27
|
-
toggleClass(el: Element, classNames: string, force?: boolean): Element;
|
|
28
|
-
hasClass(el: Element, classNames: string): boolean;
|
|
29
|
-
append(node: Node, ...children: (Node | string)[]): Node;
|
|
30
|
-
prepend(node: Node, ...children: (Node | string)[]): Node;
|
|
31
|
-
remove(...els: Element | NodeList | Array<Element> | string): void;
|
|
32
|
-
closest(el: Element, selector?: string | Element): Element | null;
|
|
33
|
-
next(el: Element, selector?: string): Element | null;
|
|
34
|
-
prev(el: Element, selector?: string | null): Element | null;
|
|
35
|
-
nextAll(el: Element, selector?: string): Element[];
|
|
36
|
-
prevAll(el: Element, selector?: string): Element[];
|
|
37
|
-
nextUntil(el: Element, selector: Element | string): Element[];
|
|
38
|
-
prevUntil(el: Element, selector: Element | string): Element[];
|
|
39
|
-
wrap(el: Element, wrappingElement: Element): Element;
|
|
40
|
-
attr(el: Element, name: string, value?: any): Element | any;
|
|
41
|
-
prop(el: Element, name: string, value?: any): any | Element;
|
|
42
|
-
html(el: Element, html?: string): Element | any;
|
|
43
|
-
text(el: Element, text?: string): Element | any;
|
|
44
|
-
hide(el: Element): Element;
|
|
45
|
-
show(el: Element): Element;
|
|
46
|
-
toggle(el: Element): Element;
|
|
47
|
-
data(el: Element, name: {
|
|
48
|
-
[x: string]: string;
|
|
49
|
-
} | string, value?: string): Element | DOMStringMap;
|
|
50
|
-
removeData(el: Element, name: string): Element | any;
|
|
51
|
-
on(el: Element | Document | Window, events: string, selector: string | Element | Function, handler?: Function | AddEventListenerOptions | boolean, options?: AddEventListenerOptions | boolean): Element;
|
|
52
|
-
off(el: Element | Document | Window, events?: string, selector?: string | Element | Function, handler?: Function | AddEventListenerOptions | boolean, options?: AddEventListenerOptions | boolean): Element;
|
|
53
|
-
css(el: HTMLElement, style: {
|
|
54
|
-
[x: string]: string;
|
|
55
|
-
} | string, value?: string): Element;
|
|
56
|
-
closestFind(el: Element, selectorClosest: string, selectorFind: string): Array<Element>;
|
|
57
|
-
closestFindOne(el: Element, selectorClosest: string, selectorFindOne: string): Element | null;
|
|
58
|
-
first(nodeList: NodeList | Element | Array<Element>): Element | null;
|
|
59
|
-
last(nodeList: NodeList | Array<Element>): Element | null;
|
|
60
|
-
create(html: string): Element | DocumentFragment | null;
|
|
61
|
-
eq(nodeList: NodeList | Array<Element>, index?: number): Element | null;
|
|
62
|
-
after(el: Element, newEl: Element | string): Element | null;
|
|
63
|
-
before(el: Element, newEl: Element | string): Element | null;
|
|
64
|
-
empty(el: Element | string): Element;
|
|
65
|
-
not(el: Element | NodeList | Array<Element>, selector: string | Element): Array<Element>;
|
|
66
|
-
collide(elem1: Element, elem2: Element): boolean;
|
|
67
|
-
matches(el: Element, selector: string | Element): boolean;
|
|
68
|
-
replaceChild(el: Element, child: Element, oldChild: Element): Element;
|
|
69
|
-
replaceChildren(el: Element, ...children: NodeList | Array<Element> | string[]): Element;
|
|
70
|
-
offset(el: Element | Document | Window): {
|
|
71
|
-
top: number;
|
|
72
|
-
left: number;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
25
|
isWindow: (o: any) => boolean;
|
|
76
26
|
isDocument: (o: any) => boolean;
|
|
77
27
|
isDomElement: (o: any) => boolean;
|
|
@@ -89,15 +39,15 @@ declare const webf: {
|
|
|
89
39
|
isPlainObject: (o: any) => boolean;
|
|
90
40
|
isBoolean: (b: any) => boolean;
|
|
91
41
|
isBool: (b: any) => boolean;
|
|
92
|
-
isUndefined: (v: any) =>
|
|
42
|
+
isUndefined: (v: any) => boolean;
|
|
93
43
|
isArrayLike: (o: any) => boolean;
|
|
94
|
-
isArray: (a: any) =>
|
|
44
|
+
isArray: (a: any) => boolean;
|
|
95
45
|
isDate: (o: any) => boolean;
|
|
96
46
|
isEvent: (o: any) => boolean;
|
|
97
47
|
isInteger: (n: any) => boolean;
|
|
98
48
|
isInt: (n: any) => boolean;
|
|
99
49
|
isFloat: (n: any) => boolean;
|
|
100
|
-
isScalar: (
|
|
50
|
+
isScalar: (v: any) => boolean;
|
|
101
51
|
isEventSupported: (eventName: any) => boolean;
|
|
102
52
|
isTouchDevice: () => boolean;
|
|
103
53
|
each: <T>(o: Collection<T>, callback: (key: number | string, value: T, o: Collection<T>, index: number) => (void | boolean), context?: any) => typeof o;
|
|
@@ -108,7 +58,8 @@ declare const webf: {
|
|
|
108
58
|
clone: <T>(o: T) => T;
|
|
109
59
|
merge: <T>(first: Collection<T>, second?: Collection<T>, ...args: Collection<T>[]) => Array<T>;
|
|
110
60
|
inArray: (value: any, arr: Object | any[], index?: number, strict?: boolean) => boolean;
|
|
111
|
-
indexOf: (arr: any, elt: any, from?: number) => number;
|
|
61
|
+
indexOf: (arr: Array<any> | string, elt: any, from?: number) => number;
|
|
62
|
+
lastIndexOf: (arr: Array<any> | string, elt: any, from?: number) => number;
|
|
112
63
|
compareArray: (a1: any, a2: any) => any;
|
|
113
64
|
arrayUnique: (arr: any) => any;
|
|
114
65
|
array_unique: (arr: any) => any;
|
|
@@ -165,5 +116,4 @@ import * as utils from './utils.js';
|
|
|
165
116
|
import eventDispatcher from './eventDispatcher.js';
|
|
166
117
|
import Mouse from './Mouse.js';
|
|
167
118
|
import Translator from './Translator.js';
|
|
168
|
-
import * as i18n from './Translator.js';
|
|
169
119
|
export { stringFunctions, arrayFunctions, traversal, is, random, getStyle, dom, math, utils, eventDispatcher, Mouse, Translator };
|
package/types/is.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ export function isFunction(f: any): boolean;
|
|
|
4
4
|
export function isPlainObject(o: any): boolean;
|
|
5
5
|
export function isBoolean(b: any): boolean;
|
|
6
6
|
export function isBool(b: any): boolean;
|
|
7
|
-
export function isUndefined(v: any):
|
|
7
|
+
export function isUndefined(v: any): boolean;
|
|
8
8
|
export function isArrayLike(o: any): boolean;
|
|
9
|
-
export function isArray(a: any):
|
|
9
|
+
export function isArray(a: any): boolean;
|
|
10
10
|
export function isDate(o: any): boolean;
|
|
11
11
|
export function isEvent(o: any): boolean;
|
|
12
12
|
export function isInteger(n: any): boolean;
|
|
13
13
|
export function isInt(n: any): boolean;
|
|
14
14
|
export function isFloat(n: any): boolean;
|
|
15
|
-
export function isScalar(
|
|
15
|
+
export function isScalar(v: any): boolean;
|
|
16
16
|
export function isEventSupported(eventName: any): boolean;
|
|
17
17
|
export function isTouchDevice(): boolean;
|
package/types/onOff.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Element|Document|Window} el
|
|
3
|
+
* @param {string} events
|
|
4
|
+
* @param {string|Element|function} selector
|
|
5
|
+
* @param {function|AddEventListenerOptions|boolean} [handler]
|
|
6
|
+
* @param {AddEventListenerOptions|boolean} [options]
|
|
7
|
+
* @returns {Element}
|
|
8
|
+
*/
|
|
9
|
+
export function on(el: Element | Document | Window, events: string, selector: string | Element | Function, handler?: Function | AddEventListenerOptions | boolean, options?: AddEventListenerOptions | boolean): Element;
|
|
10
|
+
/**
|
|
11
|
+
* @param {Element|Document|Window} el
|
|
12
|
+
* @param {string} [events]
|
|
13
|
+
* @param {string|Element|function} [selector]
|
|
14
|
+
* @param {function|AddEventListenerOptions|boolean} [handler]
|
|
15
|
+
* @param {AddEventListenerOptions|boolean} [options]
|
|
16
|
+
* @returns {Element}
|
|
17
|
+
*/
|
|
18
|
+
export function off(el: Element | Document | Window, events?: string, selector?: string | Element | Function, handler?: Function | AddEventListenerOptions | boolean, options?: AddEventListenerOptions | boolean): Element;
|
|
19
|
+
export function __resetCustomEventsForTests(): void;
|