@webalternatif/js-core 1.0.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.
Files changed (118) hide show
  1. package/.babelrc +12 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +12 -0
  3. package/.idea/js-core.iml +8 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/php.xml +20 -0
  6. package/.idea/vcs.xml +6 -0
  7. package/LICENSE +21 -0
  8. package/README.md +7 -0
  9. package/dist/cjs/array.js +116 -0
  10. package/dist/cjs/dom.js +466 -0
  11. package/dist/cjs/eventDispatcher.js +96 -0
  12. package/dist/cjs/i18n.js +50 -0
  13. package/dist/cjs/index.js +55 -0
  14. package/dist/cjs/is.js +85 -0
  15. package/dist/cjs/math.js +92 -0
  16. package/dist/cjs/random.js +38 -0
  17. package/dist/cjs/string.js +474 -0
  18. package/dist/cjs/stringPrototype.js +16 -0
  19. package/dist/cjs/traversal.js +110 -0
  20. package/dist/cjs/utils.js +118 -0
  21. package/dist/esm/array.js +116 -0
  22. package/dist/esm/dom.js +466 -0
  23. package/dist/esm/eventDispatcher.js +96 -0
  24. package/dist/esm/i18n.js +50 -0
  25. package/dist/esm/index.js +55 -0
  26. package/dist/esm/is.js +85 -0
  27. package/dist/esm/math.js +92 -0
  28. package/dist/esm/random.js +38 -0
  29. package/dist/esm/string.js +474 -0
  30. package/dist/esm/stringPrototype.js +16 -0
  31. package/dist/esm/traversal.js +110 -0
  32. package/dist/esm/utils.js +118 -0
  33. package/i18n/agenda/en.js +73 -0
  34. package/i18n/agenda/fr.js +73 -0
  35. package/i18n/agenda/index.js +2 -0
  36. package/i18n/ajaxform/en.js +5 -0
  37. package/i18n/ajaxform/fr.js +5 -0
  38. package/i18n/ajaxform/index.js +2 -0
  39. package/i18n/ajaxupload/en.js +12 -0
  40. package/i18n/ajaxupload/fr.js +12 -0
  41. package/i18n/ajaxupload/index.js +2 -0
  42. package/i18n/autocomplete/en.js +3 -0
  43. package/i18n/autocomplete/fr.js +3 -0
  44. package/i18n/autocomplete/index.js +2 -0
  45. package/i18n/confirm/en.js +5 -0
  46. package/i18n/confirm/fr.js +5 -0
  47. package/i18n/confirm/index.js +2 -0
  48. package/i18n/core/en.js +4 -0
  49. package/i18n/core/fr.js +4 -0
  50. package/i18n/core/index.js +2 -0
  51. package/i18n/datagrid/en.js +8 -0
  52. package/i18n/datagrid/fr.js +8 -0
  53. package/i18n/datagrid/index.js +2 -0
  54. package/i18n/date/en.js +51 -0
  55. package/i18n/date/fr.js +51 -0
  56. package/i18n/date/index.js +2 -0
  57. package/i18n/datetimepicker/en.js +30 -0
  58. package/i18n/datetimepicker/fr.js +30 -0
  59. package/i18n/datetimepicker/index.js +2 -0
  60. package/i18n/dialog/en.js +3 -0
  61. package/i18n/dialog/fr.js +3 -0
  62. package/i18n/dialog/index.js +2 -0
  63. package/i18n/fulldayeventagenda/en.js +73 -0
  64. package/i18n/fulldayeventagenda/fr.js +73 -0
  65. package/i18n/fulldayeventagenda/index.js +2 -0
  66. package/i18n/index.d.ts +4 -0
  67. package/i18n/index.js +15 -0
  68. package/i18n/richtexteditor/en.js +58 -0
  69. package/i18n/richtexteditor/fr.js +58 -0
  70. package/i18n/richtexteditor/index.js +2 -0
  71. package/i18n/select/en.js +3 -0
  72. package/i18n/select/fr.js +3 -0
  73. package/i18n/select/index.js +2 -0
  74. package/i18n/timepicker/en.js +3 -0
  75. package/i18n/timepicker/fr.js +3 -0
  76. package/i18n/timepicker/index.js +2 -0
  77. package/i18n/useragenda/en.js +74 -0
  78. package/i18n/useragenda/fr.js +73 -0
  79. package/i18n/useragenda/index.js +2 -0
  80. package/jest.config.js +14 -0
  81. package/package.json +33 -0
  82. package/src/array.js +124 -0
  83. package/src/dom.js +569 -0
  84. package/src/eventDispatcher.js +118 -0
  85. package/src/i18n.js +55 -0
  86. package/src/index.js +33 -0
  87. package/src/is.js +89 -0
  88. package/src/math.js +109 -0
  89. package/src/random.js +40 -0
  90. package/src/string.js +576 -0
  91. package/src/stringPrototype.js +15 -0
  92. package/src/traversal.js +134 -0
  93. package/src/utils.js +130 -0
  94. package/tests/array.test.js +326 -0
  95. package/tests/dom.test.js +239 -0
  96. package/tests/eventdispatcher.test.js +177 -0
  97. package/tests/i18n.test.js +132 -0
  98. package/tests/index.test.js +29 -0
  99. package/tests/is.test.js +354 -0
  100. package/tests/math.test.js +221 -0
  101. package/tests/random.test.js +72 -0
  102. package/tests/string.test.js +1106 -0
  103. package/tests/traversal.test.js +517 -0
  104. package/tests/utils.test.js +371 -0
  105. package/tsconfig.json +16 -0
  106. package/types/array.d.ts +8 -0
  107. package/types/dom.d.ts +241 -0
  108. package/types/eventDispatcher.d.ts +12 -0
  109. package/types/i18n.d.ts +4 -0
  110. package/types/index.d.ts +139 -0
  111. package/types/is.d.ts +16 -0
  112. package/types/math.d.ts +7 -0
  113. package/types/random.d.ts +7 -0
  114. package/types/string.d.ts +37 -0
  115. package/types/stringPrototype.d.ts +1 -0
  116. package/types/traversal.d.ts +7 -0
  117. package/types/utils.d.ts +7 -0
  118. package/webpack.config.cjs +31 -0
@@ -0,0 +1,371 @@
1
+ import {
2
+ equals,
3
+ sizeOf,
4
+ flatten, noop,
5
+ strParseFloat, throttle, debounce
6
+ } from "../src/utils";
7
+
8
+ describe('utils methods', () => {
9
+ describe('equals()', () => {
10
+ it('should return true for strictly equal primitive values', () => {
11
+ expect(equals(42, 42)).toBe(true);
12
+ expect(equals('hello', 'hello')).toBe(true);
13
+ expect(equals(true, true)).toBe(true);
14
+ })
15
+
16
+ it('should return false for different primitive values', () => {
17
+ expect(equals(42, 24)).toBe(false);
18
+ expect(equals('hello', 'world')).toBe(false);
19
+ expect(equals(true, false)).toBe(false);
20
+ })
21
+
22
+ it('should return false if types are different', () => {
23
+ expect(equals(42, '42')).toBe(false);
24
+ expect(equals(true, 'true')).toBe(false);
25
+ })
26
+
27
+ it('should return false if one value is null or undefined', () => {
28
+ expect(equals(null, {})).toBe(false);
29
+ expect(equals({}, null)).toBe(false);
30
+ expect(equals(undefined, {})).toBe(false);
31
+ })
32
+
33
+ it('should return true for deeply equal objects', () => {
34
+ const obj1 = { a: 1, b: { c: 2 } };
35
+ const obj2 = { a: 1, b: { c: 2 } };
36
+
37
+ expect(equals(obj1, obj2)).toBe(true);
38
+ })
39
+
40
+ it('should return false for objects with different structures', () => {
41
+ const obj1 = { a: 1, b: { c: 2 } };
42
+ const obj2 = { a: 1, b: { d: 3 } };
43
+
44
+ expect(equals(obj1, obj2)).toBe(false);
45
+ })
46
+
47
+ it('should return false for objects with different keys', () => {
48
+ const obj1 = { a: 1, b: 2 };
49
+ const obj2 = { a: 1, c: 3 };
50
+
51
+ expect(equals(obj1, obj2)).toBe(false);
52
+ })
53
+
54
+ it('should return true for deeply nested empty objects', () => {
55
+ const obj1 = {};
56
+ const obj2 = {};
57
+
58
+ expect(equals(obj1, obj2)).toBe(true);
59
+ })
60
+
61
+ it('should handle circular references gracefully', () => {
62
+ const obj1 = {};
63
+ const obj2 = {};
64
+ obj1.self = obj1;
65
+ obj2.self = obj2;
66
+
67
+ expect(equals(obj1, obj2)).toBe(true);
68
+ })
69
+
70
+ it('should return true for empty objects', () => {
71
+ const obj1 = {};
72
+ const obj2 = {};
73
+
74
+ expect(equals(obj1, obj2)).toBe(true);
75
+ })
76
+
77
+ it('should return false for objects with different lengths', () => {
78
+ const obj1 = { a: 1 };
79
+ const obj2 = { a: 1, b: 2 };
80
+
81
+ expect(equals(obj1, obj2)).toBe(false);
82
+ })
83
+ })
84
+
85
+ describe('sizeOf()', () => {
86
+ it('should return the length of an array, object', () => {
87
+ expect(sizeOf([1, 2, 3])).toBe(3);
88
+ expect(sizeOf({ a: 1, b: 2, c: 3 })).toBe(3);
89
+ })
90
+
91
+ it('should return 0 for an empty array, empty object, null, undefined', () => {
92
+ expect(sizeOf([])).toBe(0);
93
+ expect(sizeOf({})).toBe(0);
94
+ expect(sizeOf(null)).toBe(0);
95
+ expect(sizeOf(undefined)).toBe(0);
96
+ })
97
+ })
98
+
99
+ describe('flatten()', () => {
100
+ it('should flatten a nested array', () => {
101
+ const input = [1, [2, [3, [4, 5]]], 6];
102
+ const result = flatten(input);
103
+ expect(result).toEqual([1, 2, 3, 4, 5, 6]);
104
+ })
105
+
106
+ it('should flatten an object into an array', () => {
107
+ const input = { a: 1, b: [2, { c: 3 }], d: 4 };
108
+ const result = flatten(input);
109
+ expect(result).toEqual([1, 2, 3, 4]);
110
+ })
111
+
112
+ it('should return a flat array when input is already flat', () => {
113
+ const input = [1, 2, 3, 4, 5];
114
+ const result = flatten(input);
115
+ expect(result).toEqual([1, 2, 3, 4, 5]);
116
+ })
117
+
118
+ it('should return the input unchanged if it is not an object or array', () => {
119
+ const input = 42;
120
+ const result = flatten(input);
121
+ expect(result).toBe(42);
122
+
123
+ const inputString = 'hello';
124
+ const resultString = flatten(inputString);
125
+ expect(resultString).toBe('hello');
126
+ })
127
+
128
+ it('should handle null or undefined inputs', () => {
129
+ expect(flatten(null)).toBe(null);
130
+ expect(flatten(undefined)).toBe(undefined);
131
+ })
132
+
133
+ it('should handle an empty array', () => {
134
+ const input = [];
135
+ const result = flatten(input);
136
+ expect(result).toEqual([]);
137
+ })
138
+
139
+ it('should handle an empty object', () => {
140
+ const input = {};
141
+ const result = flatten(input);
142
+ expect(result).toEqual([]);
143
+ })
144
+ })
145
+
146
+ describe('noop()', () => {
147
+ it('should not perform any operation', () => {
148
+ const spy = jest.fn(noop);
149
+ spy();
150
+ expect(spy).toHaveBeenCalledTimes(1);
151
+ })
152
+ })
153
+
154
+ describe('strParseFloat()', () => {
155
+ it('should parse a valid float string', () => {
156
+ expect(strParseFloat('123.45')).toBe(123.45);
157
+ })
158
+
159
+ it('should parse a string with commas as decimal separator', () => {
160
+ expect(strParseFloat('123,45')).toBe(123.45);
161
+ })
162
+
163
+ it('should parse a string with spaces', () => {
164
+ expect(strParseFloat(' 123.45 ')).toBe(123.45);
165
+ })
166
+
167
+ it('should handle a string with mixed spaces and commas', () => {
168
+ expect(strParseFloat(' 1 234,56 ')).toBe(1234.56);
169
+ })
170
+
171
+ it('should handle null input and return 0', () => {
172
+ expect(strParseFloat(null)).toBe(0);
173
+ })
174
+
175
+ it('should handle undefined input and return 0', () => {
176
+ expect(strParseFloat(undefined)).toBe(0);
177
+ })
178
+
179
+ it('should handle an empty string and return 0', () => {
180
+ expect(strParseFloat('')).toBe(0);
181
+ })
182
+
183
+ it('should handle input that is already a number', () => {
184
+ expect(strParseFloat(123.45)).toBe(123.45);
185
+ })
186
+
187
+ it('should handle input with extra characters gracefully', () => {
188
+ expect(strParseFloat('123.45abc')).toBe(123.45);
189
+ })
190
+
191
+ it('should handle strings with no numeric values and return NaN', () => {
192
+ expect(strParseFloat('abc')).toBeNaN();
193
+ })
194
+ })
195
+
196
+ describe('throttle', () => {
197
+ jest.useFakeTimers();
198
+
199
+ it('should call the function immediately if leading is true', () => {
200
+ const mockfunc = jest.fn();
201
+ const throttled = throttle(mockfunc, 1000, true, false);
202
+
203
+ throttled();
204
+ expect(mockfunc).toHaveBeenCalledTimes(1);
205
+
206
+ throttled();
207
+ expect(mockfunc).toHaveBeenCalledTimes(1);
208
+
209
+ jest.advanceTimersByTime(1000);
210
+ throttled();
211
+ expect(mockfunc).toHaveBeenCalledTimes(2);
212
+ })
213
+
214
+ it('should not call the function immediately if leading is false', () => {
215
+ const mockfunc = jest.fn();
216
+ const throttled = throttle(mockfunc, 1000, false, true);
217
+
218
+ throttled();
219
+ expect(mockfunc).toHaveBeenCalledTimes(0);
220
+
221
+ jest.advanceTimersByTime(1000);
222
+ expect(mockfunc).toHaveBeenCalledTimes(1);
223
+ })
224
+
225
+ it('should call the function at the end if trailing is true', () => {
226
+ const mockfunc = jest.fn();
227
+ const throttled = throttle(mockfunc, 1000, false, true);
228
+
229
+ throttled();
230
+ jest.advanceTimersByTime(500);
231
+ throttled();
232
+ jest.advanceTimersByTime(500);
233
+ expect(mockfunc).toHaveBeenCalledTimes(1);
234
+ })
235
+
236
+ it('should not call the function at the end if trailing is false', () => {
237
+ const func = jest.fn();
238
+ const throttled = throttle(func, 1000, true, false);
239
+
240
+ throttled();
241
+ jest.advanceTimersByTime(500);
242
+ throttled();
243
+ jest.advanceTimersByTime(500);
244
+ expect(func).toHaveBeenCalledTimes(1);
245
+ })
246
+
247
+ it('should respect the wait time between calls', () => {
248
+ const func = jest.fn();
249
+ const throttled = throttle(func, 1000);
250
+
251
+ throttled();
252
+ expect(func).toHaveBeenCalledTimes(1);
253
+
254
+ jest.advanceTimersByTime(500);
255
+ throttled();
256
+ expect(func).toHaveBeenCalledTimes(1);
257
+
258
+ jest.advanceTimersByTime(500);
259
+ throttled();
260
+ expect(func).toHaveBeenCalledTimes(2);
261
+ })
262
+
263
+ it('should use the provided context', () => {
264
+ const context = { value: 42 };
265
+ const func = jest.fn(function() {
266
+ expect(this.value).toBe(42);
267
+ })
268
+
269
+ const throttled = throttle(func, 1000, true, true, context);
270
+ throttled();
271
+ })
272
+
273
+ it('should handle multiple calls within the wait period', () => {
274
+ const func = jest.fn();
275
+ const throttled = throttle(func, 1000);
276
+
277
+ throttled();
278
+ throttled();
279
+ throttled();
280
+ expect(func).toHaveBeenCalledTimes(1);
281
+
282
+ jest.advanceTimersByTime(1000);
283
+ expect(func).toHaveBeenCalledTimes(2);
284
+ })
285
+ })
286
+
287
+ describe('debounce', () => {
288
+ jest.useFakeTimers();
289
+
290
+ it('should call the function after the wait time', () => {
291
+ const func = jest.fn();
292
+ const debounced = debounce(func, 1000);
293
+
294
+ debounced();
295
+ expect(func).not.toHaveBeenCalled();
296
+
297
+ jest.advanceTimersByTime(1000);
298
+ expect(func).toHaveBeenCalledTimes(1);
299
+ })
300
+
301
+ it('should reset the timer if called again within the wait time', () => {
302
+ const func = jest.fn();
303
+ const debounced = debounce(func, 1000);
304
+
305
+ debounced();
306
+ jest.advanceTimersByTime(500);
307
+ debounced();
308
+ jest.advanceTimersByTime(500);
309
+
310
+ expect(func).not.toHaveBeenCalled();
311
+
312
+ jest.advanceTimersByTime(500);
313
+ expect(func).toHaveBeenCalledTimes(1);
314
+ })
315
+
316
+ it('should call the function immediately if immediate is true', () => {
317
+ const func = jest.fn();
318
+ const debounced = debounce(func, 1000, true);
319
+
320
+ debounced();
321
+ expect(func).toHaveBeenCalledTimes(1);
322
+
323
+ debounced();
324
+ expect(func).toHaveBeenCalledTimes(1);
325
+
326
+ jest.advanceTimersByTime(1000);
327
+ debounced();
328
+ expect(func).toHaveBeenCalledTimes(2);
329
+ })
330
+
331
+ it('should use the provided context', () => {
332
+ const context = { value: 42 };
333
+ const func = jest.fn(function () {
334
+ expect(this.value).toBe(42);
335
+ })
336
+
337
+ const debounced = debounce(func, 1000, false, context);
338
+ debounced();
339
+
340
+ jest.advanceTimersByTime(1000);
341
+ expect(func).toHaveBeenCalledTimes(1);
342
+ })
343
+
344
+ it('should use the provided context', () => {
345
+ const context = { value: 42 };
346
+ const func = jest.fn(function () {
347
+ expect(this.value).toBe(42);
348
+ })
349
+ const debounced = debounce(func, 1000, true, context);
350
+
351
+ debounced();
352
+ expect(func).toHaveBeenCalledTimes(1);
353
+
354
+ debounced();
355
+ expect(func).toHaveBeenCalledTimes(1);
356
+
357
+ jest.advanceTimersByTime(1000);
358
+ debounced();
359
+ expect(func).toHaveBeenCalledTimes(2);
360
+ })
361
+
362
+ it('should not call the function if never invoked after the delay', () => {
363
+ const func = jest.fn();
364
+ const debounced = debounce(func, 1000);
365
+
366
+ debounced();
367
+ jest.advanceTimersByTime(500);
368
+ expect(func).not.toHaveBeenCalled();
369
+ })
370
+ })
371
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["esnext", "dom"],
4
+ "declaration": true,
5
+ "emitDeclarationOnly": true,
6
+ "outDir": "types",
7
+ "allowJs": true,
8
+ "checkJs": false,
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "baseUrl": "./",
13
+ },
14
+ "include": ["src/**/*.js"],
15
+ "exclude": ["i18n", "index.js"]
16
+ }
@@ -0,0 +1,8 @@
1
+ export function inArray(value: any, arr: Object | any[], index?: number, strict?: boolean): boolean;
2
+ export function indexOf(arr: any, elt: any, from?: number): number;
3
+ export function compareArray(a1: any, a2: any): any;
4
+ export function arrayUnique(arr: any): any;
5
+ export function array_unique(arr: any): any;
6
+ export function arrayDiff(array1: any, array2: any, strict?: boolean): any;
7
+ export function array_diff(arr: any): any;
8
+ export function range(size: any, startAt?: number, step?: number): any[];
package/types/dom.d.ts ADDED
@@ -0,0 +1,241 @@
1
+ export function isWindow(o: any): boolean;
2
+ export function isDomElement(o: any): boolean;
3
+ export function getStyle(elem: any, cssRule: any): any;
4
+ declare namespace _default {
5
+ /**
6
+ * @param {Element} el
7
+ * @param {string} [selector]
8
+ * @returns {NodeList}
9
+ */
10
+ function children(el: Element, selector?: string): NodeList;
11
+ /**
12
+ * @param {Element} el
13
+ * @param {string} [selector]
14
+ * @returns {Element|null}
15
+ */
16
+ function child(el: Element, selector?: string): Element | null;
17
+ /**
18
+ * @param {Element|Document|string} refEl
19
+ * @param {string} [selector='*']
20
+ * @returns {NodeList}
21
+ */
22
+ function find(refEl: Element | Document | string, selector?: string): NodeList;
23
+ /**
24
+ * @param {Element|Document|string} refEl
25
+ * @param {string} [selector='*']
26
+ * @returns {Element|null}
27
+ */
28
+ function findOne(refEl: Element | Document | string, selector?: string): Element | null;
29
+ /**
30
+ * @param {Element} el
31
+ * @param {string} className
32
+ * @returns {Element}
33
+ */
34
+ function addClass(el: Element, className: string): Element;
35
+ /**
36
+ * @param {Element} el
37
+ * @param {string} classNames
38
+ * @returns {Element}
39
+ */
40
+ function removeClass(el: Element, classNames: string): Element;
41
+ /**
42
+ * @param {Element} el
43
+ * @param {string} classNames
44
+ * @param {boolean} [force]
45
+ * @returns {Element}
46
+ */
47
+ function toggleClass(el: Element, classNames: string, force?: boolean): Element;
48
+ /**
49
+ * @param {Element} el
50
+ * @param {string} classNames
51
+ * @returns {boolean}
52
+ */
53
+ function hasClass(el: Element, classNames: string): boolean;
54
+ /**
55
+ * @param {Element} el
56
+ * @param {Element} child
57
+ * @returns {Element}
58
+ */
59
+ function append(el: Element, child: Element): Element;
60
+ /**
61
+ * @param {Element} el
62
+ * @param {Element} child
63
+ * @returns {Element}
64
+ */
65
+ function prepend(el: Element, child: Element): Element;
66
+ /**
67
+ * @param {Element} el
68
+ * @returns {void}
69
+ */
70
+ function remove(el: Element): void;
71
+ /**
72
+ * @param {Element} el
73
+ * @param {string} [selector]
74
+ * @returns {Element|null}
75
+ */
76
+ function closest(el: Element, selector?: string): Element | null;
77
+ /**
78
+ * @param {Element} el
79
+ * @param {string} [selector]
80
+ * @returns {Element|null}
81
+ */
82
+ function next(el: Element, selector?: string): Element | null;
83
+ /**
84
+ * @param {Element} el
85
+ * @param {string|null} [selector]
86
+ * @returns {Element|null}
87
+ */
88
+ function prev(el: Element, selector?: string | null): Element | null;
89
+ /**
90
+ * @param {Element} el
91
+ * @param {string} [selector]
92
+ * @returns {Element[]}
93
+ */
94
+ function nextAll(el: Element, selector?: string): Element[];
95
+ /**
96
+ * @param {Element} el
97
+ * @param {string} [selector]
98
+ * @returns {Element[]}
99
+ */
100
+ function prevAll(el: Element, selector?: string): Element[];
101
+ /**
102
+ * @param {Element} el
103
+ * @param {Element} wrappingElement
104
+ * @returns {Element}
105
+ */
106
+ function wrap(el: Element, wrappingElement: Element): Element;
107
+ /**
108
+ * @param {Element} el
109
+ * @param {string} name
110
+ * @param {*} [value]
111
+ * @returns {Element|*}
112
+ */
113
+ function attr(el: Element, name: string, value?: any): Element | any;
114
+ /**
115
+ * @param {Element} el
116
+ * @param {string} name
117
+ * @param {*} [value]
118
+ * @returns {*|Element}
119
+ */
120
+ function prop(el: Element, name: string, value?: any): any | Element;
121
+ /**
122
+ * @param {Element} el
123
+ * @param {string} [html]
124
+ * @returns {Element|*}
125
+ */
126
+ function html(el: Element, html?: string): Element | any;
127
+ /**
128
+ * @param {Element} el
129
+ * @param {string} [text]
130
+ * @returns {Element|*}
131
+ */
132
+ function text(el: Element, text?: string): Element | any;
133
+ /**
134
+ * @param {Element} el
135
+ * @returns {Element}
136
+ */
137
+ function hide(el: Element): Element;
138
+ /**
139
+ * @param {Element} el
140
+ * @returns {Element}
141
+ */
142
+ function show(el: Element): Element;
143
+ /**
144
+ * @param {Element} el
145
+ * @returns {Element}
146
+ */
147
+ function toggle(el: Element): Element;
148
+ /**
149
+ * @param {Element} el
150
+ * @param {Object<string, string>|string} name
151
+ * @param {string} [value]
152
+ * @returns {Element}
153
+ */
154
+ function data(el: Element, name: {
155
+ [x: string]: string;
156
+ } | string, value?: string): Element;
157
+ /**
158
+ * @param {Element} el
159
+ * @param {string} name
160
+ * @returns {Element|*}
161
+ */
162
+ function removeData(el: Element, name: string): Element | any;
163
+ /**
164
+ * @param {Element|Document|Window} el
165
+ * @param {string} event
166
+ * @param {function} handler
167
+ * @param {AddEventListenerOptions|false} options
168
+ * @returns {Element}
169
+ */
170
+ function on(el: Element | Document | Window, event: string, handler: Function, options?: AddEventListenerOptions | false): Element;
171
+ /**
172
+ * @param {Element|Document|Window} el
173
+ * @param {string} event
174
+ * @param {function} handler
175
+ * @param {Object} options
176
+ * @returns {Element}
177
+ */
178
+ function off(el: Element | Document | Window, event: string, handler: Function, options: Object): Element;
179
+ /**
180
+ * @param {HTMLElement} el
181
+ * @param {Object<string, string>|string} styles
182
+ * @param {string} [value]
183
+ * @returns {Element}
184
+ */
185
+ function css(el: HTMLElement, styles: {
186
+ [x: string]: string;
187
+ } | string, value?: string): Element;
188
+ /**
189
+ * @param {Element} el
190
+ * @param {string} selectorClosest
191
+ * @param {string} selectorFind
192
+ * @returns {NodeList|null}
193
+ */
194
+ function closestFind(el: Element, selectorClosest: string, selectorFind: string): NodeList | null;
195
+ /**
196
+ * @param {Element} el
197
+ * @param {string} selectorClosest
198
+ * @param {string} selectorFindOne
199
+ * @returns {Element|null}
200
+ */
201
+ function closestFindOne(el: Element, selectorClosest: string, selectorFindOne: string): Element | null;
202
+ /**
203
+ * @param {NodeList} nodeList
204
+ * @returns {Element|null}
205
+ */
206
+ function first(nodeList: NodeList): Element | null;
207
+ /**
208
+ * @param {NodeList} nodeList
209
+ * @returns {Element|null}
210
+ */
211
+ function last(nodeList: NodeList): Element | null;
212
+ /**
213
+ * @param {string} html
214
+ * @returns {Element}
215
+ */
216
+ function create(html: string): Element;
217
+ /**
218
+ * @param {NodeList} nodeList
219
+ * @param {number} [index=0]
220
+ * @returns {Element|null}
221
+ */
222
+ function eq(nodeList: NodeList, index?: number): Element | null;
223
+ /**
224
+ * @param {Element} el
225
+ * @param {Element} newEl
226
+ * @returns {Element}
227
+ */
228
+ function after(el: Element, newEl: Element): Element;
229
+ /**
230
+ * @param {Element} el
231
+ * @param {Element} newEl
232
+ * @returns {Element}
233
+ */
234
+ function before(el: Element, newEl: Element): Element;
235
+ /**
236
+ * @param {Element} el
237
+ * @returns {Element}
238
+ */
239
+ function empty(el: Element): Element;
240
+ }
241
+ export default _default;
@@ -0,0 +1,12 @@
1
+ export default eventDispatcher;
2
+ declare const eventDispatcher: EventDispatcher;
3
+ declare class EventDispatcher {
4
+ addListener(eventsName: any, callback: any, context: any, ...args: any[]): this;
5
+ addListenerOnce(eventsName: any, callback: any, context: any, ...listenerArgs: any[]): this;
6
+ dispatch(eventsName: any, ...args: any[]): this;
7
+ hasListener(eventName: any, callback: any, context: any): boolean;
8
+ removeListener(eventName: any, callback: any, context: any): this;
9
+ getListeners(eventName: any): any;
10
+ reset(): void;
11
+ #private;
12
+ }
@@ -0,0 +1,4 @@
1
+ export function translate(lang: any, ns: any, label: any): any;
2
+ export function _(lang: any, ns: any, label: any): any;
3
+ export function getLang(): any;
4
+ export function setLang(lang: any): void;