@kizmann/pico-js 2.0.5 → 2.0.7
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/dist/pico-js.browser.js +1 -1
- package/dist/pico-js.browser.js.map +1 -1
- package/dist/pico-js.esm.js +1 -1
- package/dist/pico-js.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/dom/DomAttribute.js +22 -0
- package/src/dom/DomEvent.js +14 -7
- package/src/dom/DomFinder.js +8 -1
- package/src/dom/DomObserver.js +1 -22
- package/src/dom/DomPopover.js +264 -0
- package/src/dom/DomRectangle.js +11 -0
- package/src/format/FormatOption.js +3 -3
- package/src/index.browser.js +7 -1
- package/src/index.esm.js +12 -2
- package/src/now/NowFormat.js +5 -2
- package/src/utils/Array.js +62 -31
- package/src/utils/Dom.js +6 -0
- package/src/utils/Mixed.js +8 -0
- package/src/utils/Runner.js +21 -11
- package/src/utils/{Event.js → Signal.js} +8 -7
- package/types/dom/DomEvent.d.ts +2 -1
- package/types/dom/DomFinder.d.ts +1 -0
- package/types/dom/DomObserver.d.ts +0 -9
- package/types/dom/DomPopover.d.ts +17 -0
- package/types/dom/DomRectangle.d.ts +1 -0
- package/types/index.esm.d.ts +6 -2
- package/types/now/NowFormat.d.ts +3 -0
- package/types/utils/Array.d.ts +20 -2
- package/types/utils/Dom.d.ts +6 -0
- package/types/utils/Runner.d.ts +2 -2
- package/types/utils/{Event.d.ts → Signal.d.ts} +12 -12
package/src/utils/Array.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Obj, Mix } from "../index.esm.js";
|
|
1
|
+
import { Obj, Mix, Any } from "../index.esm.js";
|
|
2
2
|
|
|
3
3
|
export class PicoArray
|
|
4
4
|
{
|
|
@@ -30,7 +30,7 @@ export class PicoArray
|
|
|
30
30
|
*/
|
|
31
31
|
static get(value, index, fallback = null)
|
|
32
32
|
{
|
|
33
|
-
if ( !
|
|
33
|
+
if ( !Mix.isArr(value) ) {
|
|
34
34
|
return value;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -111,10 +111,14 @@ export class PicoArray
|
|
|
111
111
|
return this.findIndex(value, search) !== - 1;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
if ( !
|
|
114
|
+
if ( !Mix.isRef(value) ) {
|
|
115
115
|
value = [value];
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
if ( !Mix.isArr(value) ) {
|
|
119
|
+
value = Mix.vals(value);
|
|
120
|
+
}
|
|
121
|
+
|
|
118
122
|
let index = value.findIndex((val) => {
|
|
119
123
|
return val == search;
|
|
120
124
|
});
|
|
@@ -241,13 +245,23 @@ export class PicoArray
|
|
|
241
245
|
|
|
242
246
|
let result = new Array(value.length);
|
|
243
247
|
|
|
244
|
-
for (let i = 0; i < value.length; i++) {
|
|
248
|
+
for ( let i = 0; i < value.length; i ++ ) {
|
|
245
249
|
result[i] = cb(value[i], i);
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
return retval != null ? retval : result;
|
|
249
253
|
}
|
|
250
254
|
|
|
255
|
+
/**
|
|
256
|
+
* Iterate over object keys
|
|
257
|
+
*
|
|
258
|
+
* @example Arr.eachObj({a:1}, (v,k) => v+1) // => [2]
|
|
259
|
+
*
|
|
260
|
+
* @param {any} value Input object
|
|
261
|
+
* @param {function} cb Iterate callback
|
|
262
|
+
* @param {any} [retval] Return value override
|
|
263
|
+
* @returns {any} Mapped values or retval
|
|
264
|
+
*/
|
|
251
265
|
static eachObj(value, cb, retval = null)
|
|
252
266
|
{
|
|
253
267
|
if ( Mix.isArr(value) ) {
|
|
@@ -304,32 +318,36 @@ export class PicoArray
|
|
|
304
318
|
*/
|
|
305
319
|
static recursive(value, key, cb, cascade = [])
|
|
306
320
|
{
|
|
307
|
-
|
|
308
|
-
|
|
321
|
+
// NIE WIEDER ANFASSEN !!!
|
|
322
|
+
let fn = (cas) => (val) => {
|
|
323
|
+
return this.recursive(val, key, cb, cas);
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
if ( Mix.isArr(value) ) {
|
|
327
|
+
return this.map(value, fn(cascade));
|
|
309
328
|
}
|
|
310
329
|
|
|
311
330
|
if ( Mix.isObj(value) ) {
|
|
312
|
-
|
|
331
|
+
value = cb(value, cascade) ?? value;
|
|
313
332
|
}
|
|
314
333
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
]), cb(item, this.clone(cascade)));
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
// [{childs: [{ childs: [] } ] }, { childs: [] } ] }]
|
|
322
|
-
}
|
|
334
|
+
cascade = [
|
|
335
|
+
...this.clone(cascade), value
|
|
336
|
+
];
|
|
323
337
|
|
|
324
|
-
static recursiveObj(value, key, cb, cascade = [])
|
|
325
|
-
{
|
|
326
338
|
if ( value == null ) {
|
|
327
339
|
return value;
|
|
328
340
|
}
|
|
329
341
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
342
|
+
if ( Mix.isObj(value[key]) ) {
|
|
343
|
+
value[key] = fn(cascade)(value[key]);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if ( Mix.isArr(value[key]) ) {
|
|
347
|
+
value[key] = this.map(value[key], fn(cascade));
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return value;
|
|
333
351
|
}
|
|
334
352
|
|
|
335
353
|
/**
|
|
@@ -365,6 +383,15 @@ export class PicoArray
|
|
|
365
383
|
});
|
|
366
384
|
}
|
|
367
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Remove values matching filter (mutates)
|
|
388
|
+
*
|
|
389
|
+
* @example Arr.filterRemove([1,2], 2) // => [1]
|
|
390
|
+
*
|
|
391
|
+
* @param {any} value Input list
|
|
392
|
+
* @param {any} [filter] Filter spec
|
|
393
|
+
* @returns {any} Mutated list
|
|
394
|
+
*/
|
|
368
395
|
static filterRemove(value, filter = null)
|
|
369
396
|
{
|
|
370
397
|
if ( value == null ) {
|
|
@@ -531,8 +558,12 @@ export class PicoArray
|
|
|
531
558
|
*/
|
|
532
559
|
static sortDeep(value, key)
|
|
533
560
|
{
|
|
561
|
+
let fn = (val) => {
|
|
562
|
+
return Obj.get(val, key);
|
|
563
|
+
}
|
|
564
|
+
|
|
534
565
|
let keys = Mix.keys(value).sort((a, b) => {
|
|
535
|
-
return Mix.compare(
|
|
566
|
+
return Mix.compare(fn(value[a]), fn(value[b]));
|
|
536
567
|
});
|
|
537
568
|
|
|
538
569
|
let result = [];
|
|
@@ -625,7 +656,7 @@ export class PicoArray
|
|
|
625
656
|
finder = target;
|
|
626
657
|
}
|
|
627
658
|
|
|
628
|
-
if ( this.findIndex(value, finder) !== -1 ) {
|
|
659
|
+
if ( this.findIndex(value, finder) !== - 1 ) {
|
|
629
660
|
return value;
|
|
630
661
|
}
|
|
631
662
|
|
|
@@ -650,7 +681,7 @@ export class PicoArray
|
|
|
650
681
|
|
|
651
682
|
let index = this.findIndex(value, finder);
|
|
652
683
|
|
|
653
|
-
if ( index !== -1 ) {
|
|
684
|
+
if ( index !== - 1 ) {
|
|
654
685
|
this.splice(value, index, 1);
|
|
655
686
|
}
|
|
656
687
|
|
|
@@ -675,7 +706,7 @@ export class PicoArray
|
|
|
675
706
|
|
|
676
707
|
let index = this.findIndex(value, finder);
|
|
677
708
|
|
|
678
|
-
if ( index === -1 ) {
|
|
709
|
+
if ( index === - 1 ) {
|
|
679
710
|
return value;
|
|
680
711
|
}
|
|
681
712
|
|
|
@@ -701,7 +732,7 @@ export class PicoArray
|
|
|
701
732
|
|
|
702
733
|
let index = this.findIndex(value, finder);
|
|
703
734
|
|
|
704
|
-
if ( index === -1 ) {
|
|
735
|
+
if ( index === - 1 ) {
|
|
705
736
|
return (value.push(target), value);
|
|
706
737
|
}
|
|
707
738
|
|
|
@@ -791,7 +822,7 @@ export class PicoArray
|
|
|
791
822
|
return Obj.clone(value);
|
|
792
823
|
}
|
|
793
824
|
|
|
794
|
-
if ( !
|
|
825
|
+
if ( !Mix.isArr(value) ) {
|
|
795
826
|
return value;
|
|
796
827
|
}
|
|
797
828
|
|
|
@@ -905,7 +936,7 @@ export class PicoArray
|
|
|
905
936
|
return Obj.includes(value, search);
|
|
906
937
|
}
|
|
907
938
|
|
|
908
|
-
if ( !
|
|
939
|
+
if ( !Mix.isArr(search) ) {
|
|
909
940
|
return value === search;
|
|
910
941
|
}
|
|
911
942
|
|
|
@@ -917,7 +948,7 @@ export class PicoArray
|
|
|
917
948
|
return true;
|
|
918
949
|
}
|
|
919
950
|
|
|
920
|
-
for ( let i = 0; result === false && i < length; i++) {
|
|
951
|
+
for ( let i = 0; result === false && i < length; i ++ ) {
|
|
921
952
|
result ||= this.has(value, search[i]);
|
|
922
953
|
}
|
|
923
954
|
|
|
@@ -938,7 +969,7 @@ export class PicoArray
|
|
|
938
969
|
let result = true;
|
|
939
970
|
|
|
940
971
|
for ( let key of Mix.vals(val) ) {
|
|
941
|
-
result &&= Mix.vals(arr).indexOf(key) !== -1;
|
|
972
|
+
result &&= Mix.vals(arr).indexOf(key) !== - 1;
|
|
942
973
|
}
|
|
943
974
|
|
|
944
975
|
return result;
|
|
@@ -959,7 +990,7 @@ export class PicoArray
|
|
|
959
990
|
return Obj.matches(value, search);
|
|
960
991
|
}
|
|
961
992
|
|
|
962
|
-
if ( !
|
|
993
|
+
if ( !Mix.isArr(value) ) {
|
|
963
994
|
return value === search;
|
|
964
995
|
}
|
|
965
996
|
|
|
@@ -973,7 +1004,7 @@ export class PicoArray
|
|
|
973
1004
|
return false;
|
|
974
1005
|
}
|
|
975
1006
|
|
|
976
|
-
for ( let i = 0; result === true && i < length; i++) {
|
|
1007
|
+
for ( let i = 0; result === true && i < length; i ++ ) {
|
|
977
1008
|
result &&= this.has(value, search[i]);
|
|
978
1009
|
}
|
|
979
1010
|
|
package/src/utils/Dom.js
CHANGED
|
@@ -9,6 +9,7 @@ import { PicoDomAttributePlugin } from "../dom/DomAttribute.js";
|
|
|
9
9
|
import { PicoDomInviewPlugin } from "../dom/DomInview.js";
|
|
10
10
|
import { PicoDomMetaPlugin } from "../dom/DomMeta.js";
|
|
11
11
|
import { PicoDomObserverPlugin } from "../dom/DomObserver.js";
|
|
12
|
+
import { PicoDomPopoverPlugin } from "../dom/DomPopover.js";
|
|
12
13
|
|
|
13
14
|
export const PicoDomPlugins = [
|
|
14
15
|
PicoDomFinderPlugin,
|
|
@@ -21,6 +22,7 @@ export const PicoDomPlugins = [
|
|
|
21
22
|
PicoDomInviewPlugin,
|
|
22
23
|
PicoDomMetaPlugin,
|
|
23
24
|
PicoDomObserverPlugin,
|
|
25
|
+
PicoDomPopoverPlugin,
|
|
24
26
|
];
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -43,6 +45,8 @@ export const PicoDomPlugins = [
|
|
|
43
45
|
* @typedef {import('../dom/DomMeta.js').PicoDomMetaInstance} PicoDomMetaInstance
|
|
44
46
|
* @typedef {import('../dom/DomObserver.js').PicoDomObserverStatic} PicoDomObserverStatic
|
|
45
47
|
* @typedef {import('../dom/DomObserver.js').PicoDomObserverInstance} PicoDomObserverInstance
|
|
48
|
+
* @typedef {import('../dom/DomPopover.js').PicoDomPopoverStatic} PicoDomPopoverStatic
|
|
49
|
+
* @typedef {import('../dom/DomPopover.js').PicoDomPopoverInstance} PicoDomPopoverInstance
|
|
46
50
|
*
|
|
47
51
|
* @mixes PicoDomFinderStatic
|
|
48
52
|
* @mixes PicoDomGlobalStatic
|
|
@@ -54,6 +58,7 @@ export const PicoDomPlugins = [
|
|
|
54
58
|
* @mixes PicoDomInviewStatic
|
|
55
59
|
* @mixes PicoDomMetaStatic
|
|
56
60
|
* @mixes PicoDomObserverStatic
|
|
61
|
+
* @mixes PicoDomPopoverStatic
|
|
57
62
|
*
|
|
58
63
|
* @extends PicoDomFinderInstance
|
|
59
64
|
* @extends PicoDomGlobalInstance
|
|
@@ -65,6 +70,7 @@ export const PicoDomPlugins = [
|
|
|
65
70
|
* @extends PicoDomInviewInstance
|
|
66
71
|
* @extends PicoDomMetaInstance
|
|
67
72
|
* @extends PicoDomObserverInstance
|
|
73
|
+
* @extends PicoDomPopoverInstance
|
|
68
74
|
*/
|
|
69
75
|
export class PicoDom {
|
|
70
76
|
|
package/src/utils/Mixed.js
CHANGED
|
@@ -454,6 +454,10 @@ export class PicoMixed
|
|
|
454
454
|
return [];
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
+
if ( this.isFunc(value.toJSON) ) {
|
|
458
|
+
value = value.toJSON();
|
|
459
|
+
}
|
|
460
|
+
|
|
457
461
|
if ( this.isIter(value) ) {
|
|
458
462
|
value = this.iter(value);
|
|
459
463
|
}
|
|
@@ -476,6 +480,10 @@ export class PicoMixed
|
|
|
476
480
|
return [];
|
|
477
481
|
}
|
|
478
482
|
|
|
483
|
+
if ( this.isFunc(value.toJSON) ) {
|
|
484
|
+
value = value.toJSON();
|
|
485
|
+
}
|
|
486
|
+
|
|
479
487
|
if ( this.isIter(value) ) {
|
|
480
488
|
value = this.iter(value);
|
|
481
489
|
}
|
package/src/utils/Runner.js
CHANGED
|
@@ -233,18 +233,28 @@ export class PicoRunner
|
|
|
233
233
|
*
|
|
234
234
|
* @param {function} cb Callback to run
|
|
235
235
|
* @param {string} key Buffer key
|
|
236
|
-
* @param {number} [
|
|
236
|
+
* @param {number} [priority] Sort priority
|
|
237
237
|
* @returns {function} Buffered handler
|
|
238
238
|
*/
|
|
239
|
-
static framebuffer(cb, key,
|
|
239
|
+
static framebuffer(cb, key, priority = 1000)
|
|
240
240
|
{
|
|
241
|
+
const item = {
|
|
242
|
+
key, cb, priority, args: [], active: false
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
Arr.add(this.$buffer, item);
|
|
246
|
+
|
|
241
247
|
return (e, ...args) => {
|
|
242
248
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
249
|
+
if ( /^drag/.test(e.type) ) {
|
|
250
|
+
e.preventDefault();
|
|
251
|
+
}
|
|
246
252
|
|
|
247
|
-
|
|
253
|
+
Obj.assign(item, {
|
|
254
|
+
args: [e, ...args], active: true
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
this.runFramebuffer();
|
|
248
258
|
};
|
|
249
259
|
}
|
|
250
260
|
|
|
@@ -265,7 +275,7 @@ export class PicoRunner
|
|
|
265
275
|
this.runFramebuffer();
|
|
266
276
|
}, 50);
|
|
267
277
|
|
|
268
|
-
if ( Date.now() - this.$timer
|
|
278
|
+
if ( Date.now() - this.$timer < 50 ) {
|
|
269
279
|
return;
|
|
270
280
|
}
|
|
271
281
|
|
|
@@ -283,10 +293,10 @@ export class PicoRunner
|
|
|
283
293
|
return;
|
|
284
294
|
}
|
|
285
295
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
296
|
+
buffer = Arr.sort(buffer, 'priority');
|
|
297
|
+
|
|
298
|
+
Arr.each(buffer.reverse(), (item) => {
|
|
299
|
+
item.cb(...item.args); item.active = false;
|
|
290
300
|
});
|
|
291
301
|
}
|
|
292
302
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Str, Event, For, Mix, Arr } from "../index.esm.js";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
export class PicoSignal
|
|
3
4
|
{
|
|
4
5
|
static $events = [];
|
|
5
6
|
|
|
@@ -13,7 +14,7 @@ export class PicoEvent
|
|
|
13
14
|
* @param {function} cb Event callback
|
|
14
15
|
* @param {any} [options] Listener options
|
|
15
16
|
* @param {boolean} [paused] Start paused
|
|
16
|
-
* @returns {typeof
|
|
17
|
+
* @returns {typeof PicoSignal} Event class
|
|
17
18
|
*/
|
|
18
19
|
static bind(event, cb, options = {}, paused = false)
|
|
19
20
|
{
|
|
@@ -40,7 +41,7 @@ export class PicoEvent
|
|
|
40
41
|
*
|
|
41
42
|
* @param {any} event Event name(s)
|
|
42
43
|
* @param {any} [options] Listener options
|
|
43
|
-
* @returns {typeof
|
|
44
|
+
* @returns {typeof PicoSignal} Event class
|
|
44
45
|
*/
|
|
45
46
|
static unbind(event, options = {})
|
|
46
47
|
{
|
|
@@ -66,7 +67,7 @@ export class PicoEvent
|
|
|
66
67
|
*
|
|
67
68
|
* @param {string} event Event name
|
|
68
69
|
* @param {...any} args Event args
|
|
69
|
-
* @returns {typeof
|
|
70
|
+
* @returns {typeof PicoSignal} Event class
|
|
70
71
|
*/
|
|
71
72
|
static fire(event, ...args)
|
|
72
73
|
{
|
|
@@ -90,7 +91,7 @@ export class PicoEvent
|
|
|
90
91
|
*
|
|
91
92
|
* @param {any} event Event name(s)
|
|
92
93
|
* @param {any} [options] Listener options
|
|
93
|
-
* @returns {typeof
|
|
94
|
+
* @returns {typeof PicoSignal} Event class
|
|
94
95
|
*/
|
|
95
96
|
static pause(event, options = {})
|
|
96
97
|
{
|
|
@@ -116,7 +117,7 @@ export class PicoEvent
|
|
|
116
117
|
*
|
|
117
118
|
* @param {any} event Event name(s)
|
|
118
119
|
* @param {any} [options] Listener options
|
|
119
|
-
* @returns {typeof
|
|
120
|
+
* @returns {typeof PicoSignal} Event class
|
|
120
121
|
*/
|
|
121
122
|
static unpause(event, options = {})
|
|
122
123
|
{
|
|
@@ -137,4 +138,4 @@ export class PicoEvent
|
|
|
137
138
|
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
export default
|
|
141
|
+
export default PicoSignal;
|
package/types/dom/DomEvent.d.ts
CHANGED
|
@@ -98,9 +98,10 @@ export class PicoDomEventInstance {
|
|
|
98
98
|
* @example Dom.find("div").fire("click")
|
|
99
99
|
*
|
|
100
100
|
* @param {string} event Event name
|
|
101
|
+
* @param {object} [detail] Event detail
|
|
101
102
|
* @returns {PicoDom} Current instance
|
|
102
103
|
*/
|
|
103
|
-
fire(event: string): PicoDom;
|
|
104
|
+
fire(event: string, detail?: object): PicoDom;
|
|
104
105
|
/**
|
|
105
106
|
* @see PicoDom.once
|
|
106
107
|
*/
|
package/types/dom/DomFinder.d.ts
CHANGED
|
@@ -8,15 +8,6 @@ export class PicoDomObserverStatic {
|
|
|
8
8
|
* @extends {PicoDom}
|
|
9
9
|
*/
|
|
10
10
|
export class PicoDomObserverInstance {
|
|
11
|
-
/**
|
|
12
|
-
* Get or set element value
|
|
13
|
-
*
|
|
14
|
-
* @example Dom.find("input").value("hello")
|
|
15
|
-
*
|
|
16
|
-
* @param {any} [value] New value
|
|
17
|
-
* @returns {any|PicoDom} Value or instance
|
|
18
|
-
*/
|
|
19
|
-
value(value?: any): any | PicoDom;
|
|
20
11
|
}
|
|
21
12
|
export function PicoDomObserverPlugin(self: typeof PicoDom): typeof PicoDom;
|
|
22
13
|
import { PicoDom } from "../utils/Dom.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberof PicoDom
|
|
3
|
+
*/
|
|
4
|
+
export class PicoDomPopoverStatic {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @memberof PicoDom
|
|
8
|
+
* @extends {PicoDom}
|
|
9
|
+
*/
|
|
10
|
+
export class PicoDomPopoverInstance {
|
|
11
|
+
popover(target: any, position?: string, options?: {}): any;
|
|
12
|
+
popoverY(target: any, position?: string, options?: {}): any;
|
|
13
|
+
popoverX(target: any, position?: string, options?: {}): any;
|
|
14
|
+
popoverNormalize(offset: any, self: any, rect: any, win: any): any;
|
|
15
|
+
}
|
|
16
|
+
export function PicoDomPopoverPlugin(self: typeof PicoDom): typeof PicoDom;
|
|
17
|
+
import { PicoDom } from "../utils/Dom.js";
|
package/types/index.esm.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* @type {typeof PicoMixed}
|
|
3
3
|
*/
|
|
4
4
|
export const Any: typeof PicoMixed;
|
|
5
|
+
/**
|
|
6
|
+
* @type {typeof PicoMixed}
|
|
7
|
+
*/
|
|
8
|
+
export const Event: typeof PicoMixed;
|
|
5
9
|
export function UUID(): string;
|
|
6
10
|
/**
|
|
7
11
|
* @type {typeof PicoDom}
|
|
@@ -22,7 +26,7 @@ import { default as Arr } from "./utils/Array.js";
|
|
|
22
26
|
import { default as Obj } from "./utils/Object.js";
|
|
23
27
|
import { default as Mix } from "./utils/Mixed.js";
|
|
24
28
|
import { default as Hash } from "./utils/Hash.js";
|
|
25
|
-
import { default as
|
|
29
|
+
import { default as Signal } from "./utils/Signal.js";
|
|
26
30
|
import { default as Locale } from "./utils/Locale.js";
|
|
27
31
|
import { default as Cookie } from "./utils/Cookie.js";
|
|
28
32
|
import { go } from "./tool/scope.js";
|
|
@@ -36,4 +40,4 @@ import { PicoMixed } from "./utils/Mixed.js";
|
|
|
36
40
|
import { PicoDom } from "./utils/Dom.js";
|
|
37
41
|
import { PicoNow } from "./utils/Now.js";
|
|
38
42
|
import { PicoFormat } from "./utils/Format.js";
|
|
39
|
-
export { Run, Str, Num, Arr, Obj, Mix, Hash,
|
|
43
|
+
export { Run, Str, Num, Arr, Obj, Mix, Hash, Signal, Locale, Cookie, go, browser, device, Map, Data, Route, Element };
|
package/types/now/NowFormat.d.ts
CHANGED
package/types/utils/Array.d.ts
CHANGED
|
@@ -134,7 +134,17 @@ export class PicoArray {
|
|
|
134
134
|
* @returns {any} Mapped array
|
|
135
135
|
*/
|
|
136
136
|
static each(value: any, cb: Function, retval?: any): any;
|
|
137
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Iterate over object keys
|
|
139
|
+
*
|
|
140
|
+
* @example Arr.eachObj({a:1}, (v,k) => v+1) // => [2]
|
|
141
|
+
*
|
|
142
|
+
* @param {any} value Input object
|
|
143
|
+
* @param {function} cb Iterate callback
|
|
144
|
+
* @param {any} [retval] Return value override
|
|
145
|
+
* @returns {any} Mapped values or retval
|
|
146
|
+
*/
|
|
147
|
+
static eachObj(value: any, cb: Function, retval?: any): any;
|
|
138
148
|
/**
|
|
139
149
|
* Map values in place (mutates)
|
|
140
150
|
*
|
|
@@ -157,7 +167,6 @@ export class PicoArray {
|
|
|
157
167
|
* @returns {any} Mapped tree
|
|
158
168
|
*/
|
|
159
169
|
static recursive(value: any, key: string, cb: Function, cascade?: Array<any>): any;
|
|
160
|
-
static recursiveObj(value: any, key: any, cb: any, cascade?: any[]): any;
|
|
161
170
|
/**
|
|
162
171
|
* Get matching indexes by filter
|
|
163
172
|
*
|
|
@@ -168,6 +177,15 @@ export class PicoArray {
|
|
|
168
177
|
* @returns {Array<string>} Matching keys
|
|
169
178
|
*/
|
|
170
179
|
static filterIndex(value: any, filter?: any): Array<string>;
|
|
180
|
+
/**
|
|
181
|
+
* Remove values matching filter (mutates)
|
|
182
|
+
*
|
|
183
|
+
* @example Arr.filterRemove([1,2], 2) // => [1]
|
|
184
|
+
*
|
|
185
|
+
* @param {any} value Input list
|
|
186
|
+
* @param {any} [filter] Filter spec
|
|
187
|
+
* @returns {any} Mutated list
|
|
188
|
+
*/
|
|
171
189
|
static filterRemove(value: any, filter?: any): any;
|
|
172
190
|
/**
|
|
173
191
|
* Filter values by filter
|
package/types/utils/Dom.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export const PicoDomPlugins: ((self: typeof PicoDom) => typeof PicoDom)[];
|
|
|
23
23
|
* @typedef {import('../dom/DomMeta.js').PicoDomMetaInstance} PicoDomMetaInstance
|
|
24
24
|
* @typedef {import('../dom/DomObserver.js').PicoDomObserverStatic} PicoDomObserverStatic
|
|
25
25
|
* @typedef {import('../dom/DomObserver.js').PicoDomObserverInstance} PicoDomObserverInstance
|
|
26
|
+
* @typedef {import('../dom/DomPopover.js').PicoDomPopoverStatic} PicoDomPopoverStatic
|
|
27
|
+
* @typedef {import('../dom/DomPopover.js').PicoDomPopoverInstance} PicoDomPopoverInstance
|
|
26
28
|
*
|
|
27
29
|
* @mixes PicoDomFinderStatic
|
|
28
30
|
* @mixes PicoDomGlobalStatic
|
|
@@ -34,6 +36,7 @@ export const PicoDomPlugins: ((self: typeof PicoDom) => typeof PicoDom)[];
|
|
|
34
36
|
* @mixes PicoDomInviewStatic
|
|
35
37
|
* @mixes PicoDomMetaStatic
|
|
36
38
|
* @mixes PicoDomObserverStatic
|
|
39
|
+
* @mixes PicoDomPopoverStatic
|
|
37
40
|
*
|
|
38
41
|
* @extends PicoDomFinderInstance
|
|
39
42
|
* @extends PicoDomGlobalInstance
|
|
@@ -45,6 +48,7 @@ export const PicoDomPlugins: ((self: typeof PicoDom) => typeof PicoDom)[];
|
|
|
45
48
|
* @extends PicoDomInviewInstance
|
|
46
49
|
* @extends PicoDomMetaInstance
|
|
47
50
|
* @extends PicoDomObserverInstance
|
|
51
|
+
* @extends PicoDomPopoverInstance
|
|
48
52
|
*/
|
|
49
53
|
export class PicoDom {
|
|
50
54
|
/**
|
|
@@ -136,3 +140,5 @@ export type PicoDomMetaStatic = import("../dom/DomMeta.js").PicoDomMetaStatic;
|
|
|
136
140
|
export type PicoDomMetaInstance = import("../dom/DomMeta.js").PicoDomMetaInstance;
|
|
137
141
|
export type PicoDomObserverStatic = import("../dom/DomObserver.js").PicoDomObserverStatic;
|
|
138
142
|
export type PicoDomObserverInstance = import("../dom/DomObserver.js").PicoDomObserverInstance;
|
|
143
|
+
export type PicoDomPopoverStatic = import("../dom/DomPopover.js").PicoDomPopoverStatic;
|
|
144
|
+
export type PicoDomPopoverInstance = import("../dom/DomPopover.js").PicoDomPopoverInstance;
|
package/types/utils/Runner.d.ts
CHANGED
|
@@ -107,10 +107,10 @@ export class PicoRunner {
|
|
|
107
107
|
*
|
|
108
108
|
* @param {function} cb Callback to run
|
|
109
109
|
* @param {string} key Buffer key
|
|
110
|
-
* @param {number} [
|
|
110
|
+
* @param {number} [priority] Sort priority
|
|
111
111
|
* @returns {function} Buffered handler
|
|
112
112
|
*/
|
|
113
|
-
static framebuffer(cb: Function, key: string,
|
|
113
|
+
static framebuffer(cb: Function, key: string, priority?: number): Function;
|
|
114
114
|
/**
|
|
115
115
|
* Flush buffered frame events
|
|
116
116
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class PicoSignal {
|
|
2
2
|
static $events: any[];
|
|
3
3
|
/**
|
|
4
4
|
* Bind callback to event name
|
|
@@ -10,9 +10,9 @@ export class PicoEvent {
|
|
|
10
10
|
* @param {function} cb Event callback
|
|
11
11
|
* @param {any} [options] Listener options
|
|
12
12
|
* @param {boolean} [paused] Start paused
|
|
13
|
-
* @returns {typeof
|
|
13
|
+
* @returns {typeof PicoSignal} Event class
|
|
14
14
|
*/
|
|
15
|
-
static bind(event: any, cb: Function, options?: any, paused?: boolean): typeof
|
|
15
|
+
static bind(event: any, cb: Function, options?: any, paused?: boolean): typeof PicoSignal;
|
|
16
16
|
/**
|
|
17
17
|
* Unbind callback(s) from event
|
|
18
18
|
*
|
|
@@ -21,9 +21,9 @@ export class PicoEvent {
|
|
|
21
21
|
*
|
|
22
22
|
* @param {any} event Event name(s)
|
|
23
23
|
* @param {any} [options] Listener options
|
|
24
|
-
* @returns {typeof
|
|
24
|
+
* @returns {typeof PicoSignal} Event class
|
|
25
25
|
*/
|
|
26
|
-
static unbind(event: any, options?: any): typeof
|
|
26
|
+
static unbind(event: any, options?: any): typeof PicoSignal;
|
|
27
27
|
/**
|
|
28
28
|
* Fire event with arguments
|
|
29
29
|
*
|
|
@@ -31,9 +31,9 @@ export class PicoEvent {
|
|
|
31
31
|
*
|
|
32
32
|
* @param {string} event Event name
|
|
33
33
|
* @param {...any} args Event args
|
|
34
|
-
* @returns {typeof
|
|
34
|
+
* @returns {typeof PicoSignal} Event class
|
|
35
35
|
*/
|
|
36
|
-
static fire(event: string, ...args: any[]): typeof
|
|
36
|
+
static fire(event: string, ...args: any[]): typeof PicoSignal;
|
|
37
37
|
/**
|
|
38
38
|
* Pause listeners for event
|
|
39
39
|
*
|
|
@@ -41,9 +41,9 @@ export class PicoEvent {
|
|
|
41
41
|
*
|
|
42
42
|
* @param {any} event Event name(s)
|
|
43
43
|
* @param {any} [options] Listener options
|
|
44
|
-
* @returns {typeof
|
|
44
|
+
* @returns {typeof PicoSignal} Event class
|
|
45
45
|
*/
|
|
46
|
-
static pause(event: any, options?: any): typeof
|
|
46
|
+
static pause(event: any, options?: any): typeof PicoSignal;
|
|
47
47
|
/**
|
|
48
48
|
* Unpause listeners for event
|
|
49
49
|
*
|
|
@@ -51,8 +51,8 @@ export class PicoEvent {
|
|
|
51
51
|
*
|
|
52
52
|
* @param {any} event Event name(s)
|
|
53
53
|
* @param {any} [options] Listener options
|
|
54
|
-
* @returns {typeof
|
|
54
|
+
* @returns {typeof PicoSignal} Event class
|
|
55
55
|
*/
|
|
56
|
-
static unpause(event: any, options?: any): typeof
|
|
56
|
+
static unpause(event: any, options?: any): typeof PicoSignal;
|
|
57
57
|
}
|
|
58
|
-
export default
|
|
58
|
+
export default PicoSignal;
|