@kizmann/pico-js 2.0.6 → 2.0.8
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 +39 -8
- package/src/dom/DomFinder.js +27 -16
- package/src/dom/DomObserver.js +1 -22
- package/src/dom/DomPopover.js +264 -0
- package/src/dom/DomRectangle.js +15 -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 +58 -1
- package/src/utils/Dom.js +6 -0
- package/src/utils/Mixed.js +43 -4
- package/src/utils/Runner.js +38 -45
- package/src/utils/{Event.js → Signal.js} +8 -7
- package/types/dom/DomEvent.d.ts +3 -1
- package/types/dom/DomFinder.d.ts +6 -5
- package/types/dom/DomObserver.d.ts +0 -9
- package/types/dom/DomPopover.d.ts +17 -0
- package/types/dom/DomRectangle.d.ts +6 -0
- package/types/index.esm.d.ts +6 -2
- package/types/now/NowFormat.d.ts +3 -0
- package/types/utils/Array.d.ts +3 -0
- package/types/utils/Dom.d.ts +6 -0
- package/types/utils/Mixed.d.ts +1 -0
- package/types/utils/Runner.d.ts +7 -17
- package/types/utils/{Event.d.ts → Signal.d.ts} +12 -12
package/src/utils/Array.js
CHANGED
|
@@ -70,6 +70,32 @@ export class PicoArray
|
|
|
70
70
|
return this.splice(target, index, 1);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
static prev(target, index, fallback = 0)
|
|
74
|
+
{
|
|
75
|
+
if ( Mix.isEmpty(target) || !Mix.isArr(target) ) {
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ( index - 1 < 0 ) {
|
|
80
|
+
return target.length-1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return index - 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static next(target, index, fallback = 0)
|
|
87
|
+
{
|
|
88
|
+
if ( Mix.isEmpty(target) || !Mix.isArr(target) ) {
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if ( index + 1 > target.length ) {
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return index + 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
73
99
|
/**
|
|
74
100
|
* Create array with callback values
|
|
75
101
|
*
|
|
@@ -111,10 +137,14 @@ export class PicoArray
|
|
|
111
137
|
return this.findIndex(value, search) !== - 1;
|
|
112
138
|
}
|
|
113
139
|
|
|
114
|
-
if ( !Mix.
|
|
140
|
+
if ( !Mix.isRef(value) ) {
|
|
115
141
|
value = [value];
|
|
116
142
|
}
|
|
117
143
|
|
|
144
|
+
if ( !Mix.isArr(value) ) {
|
|
145
|
+
value = Mix.vals(value);
|
|
146
|
+
}
|
|
147
|
+
|
|
118
148
|
let index = value.findIndex((val) => {
|
|
119
149
|
return val == search;
|
|
120
150
|
});
|
|
@@ -331,6 +361,10 @@ export class PicoArray
|
|
|
331
361
|
...this.clone(cascade), value
|
|
332
362
|
];
|
|
333
363
|
|
|
364
|
+
if ( value == null ) {
|
|
365
|
+
return value;
|
|
366
|
+
}
|
|
367
|
+
|
|
334
368
|
if ( Mix.isObj(value[key]) ) {
|
|
335
369
|
value[key] = fn(cascade)(value[key]);
|
|
336
370
|
}
|
|
@@ -342,6 +376,29 @@ export class PicoArray
|
|
|
342
376
|
return value;
|
|
343
377
|
}
|
|
344
378
|
|
|
379
|
+
static cascade(value, childs, key, cascade = [], result = {})
|
|
380
|
+
{
|
|
381
|
+
if ( value == null ) {
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if ( Mix.isObj(value) ) {
|
|
386
|
+
return this.cascade(value[key], key, cb);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const fn = (val) => {
|
|
390
|
+
return this.cascade(...[
|
|
391
|
+
val[childs], childs, key, result[val[key]], result
|
|
392
|
+
]);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
this.each(value, (val) => {
|
|
396
|
+
(result[val[key]] = [...cascade, val[key] ], fn(val));
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
return result;
|
|
400
|
+
}
|
|
401
|
+
|
|
345
402
|
/**
|
|
346
403
|
* Get matching indexes by filter
|
|
347
404
|
*
|
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
|
}
|
|
@@ -520,7 +528,7 @@ export class PicoMixed
|
|
|
520
528
|
let result = {};
|
|
521
529
|
|
|
522
530
|
for ( const key of Object.getOwnPropertyNames(value) ) {
|
|
523
|
-
if ( exclude.length && !
|
|
531
|
+
if ( exclude.length && !Arr.has(exclude, key) ) {
|
|
524
532
|
result[key] = value[key];
|
|
525
533
|
}
|
|
526
534
|
}
|
|
@@ -528,6 +536,38 @@ export class PicoMixed
|
|
|
528
536
|
return result;
|
|
529
537
|
}
|
|
530
538
|
|
|
539
|
+
static extend(target, value, exclude = ['constructor'])
|
|
540
|
+
{
|
|
541
|
+
if ( value == null ) {
|
|
542
|
+
return {};
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
let proto = Object.getPrototypeOf(value);
|
|
546
|
+
|
|
547
|
+
for ( const key of Object.getOwnPropertyNames(value) ) {
|
|
548
|
+
|
|
549
|
+
if ( !exclude.length || Arr.has(exclude, key) ) {
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
let desc = Object.getOwnPropertyDescriptor(proto, key);
|
|
554
|
+
|
|
555
|
+
if ( !desc ) {
|
|
556
|
+
desc = Object.getOwnPropertyDescriptor(value, key);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if ( !desc && (!desc.get && !desc.set) ) {
|
|
560
|
+
target[key] = value[key];
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if ( desc && (desc.get || desc.set) ) {
|
|
564
|
+
Object.defineProperty(target, key, desc);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
return target;
|
|
569
|
+
}
|
|
570
|
+
|
|
531
571
|
/**
|
|
532
572
|
* Get static class props
|
|
533
573
|
*
|
|
@@ -623,7 +663,7 @@ export class PicoMixed
|
|
|
623
663
|
return value.length;
|
|
624
664
|
}
|
|
625
665
|
|
|
626
|
-
if ( !
|
|
666
|
+
if ( !this.isRef(value) ) {
|
|
627
667
|
return this.string(value).length;
|
|
628
668
|
}
|
|
629
669
|
|
|
@@ -683,7 +723,7 @@ export class PicoMixed
|
|
|
683
723
|
return value;
|
|
684
724
|
}
|
|
685
725
|
|
|
686
|
-
if ( !
|
|
726
|
+
if ( !this.isStr(value) ) {
|
|
687
727
|
return [value];
|
|
688
728
|
}
|
|
689
729
|
|
|
@@ -883,5 +923,4 @@ PicoMixed.convertBoolean = function (...args) {
|
|
|
883
923
|
};
|
|
884
924
|
|
|
885
925
|
|
|
886
|
-
|
|
887
926
|
export default PicoMixed;
|
package/src/utils/Runner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arr,
|
|
1
|
+
import { Arr, Mix, Obj } from "../index.esm.js";
|
|
2
2
|
|
|
3
3
|
export class PicoRunner
|
|
4
4
|
{
|
|
@@ -8,6 +8,15 @@ export class PicoRunner
|
|
|
8
8
|
|
|
9
9
|
static $buffer = [];
|
|
10
10
|
|
|
11
|
+
static interval(fn, intval = 0)
|
|
12
|
+
{
|
|
13
|
+
const idle = setInterval(() => {
|
|
14
|
+
fn();
|
|
15
|
+
}, intval);
|
|
16
|
+
|
|
17
|
+
return () => clearInterval(idle);
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
/**
|
|
12
21
|
* Clear timer or call function
|
|
13
22
|
*
|
|
@@ -41,7 +50,7 @@ export class PicoRunner
|
|
|
41
50
|
static tryin(cb)
|
|
42
51
|
{
|
|
43
52
|
try {
|
|
44
|
-
|
|
53
|
+
cb();
|
|
45
54
|
} catch (e) {
|
|
46
55
|
//
|
|
47
56
|
}
|
|
@@ -80,34 +89,16 @@ export class PicoRunner
|
|
|
80
89
|
* @example Run.frame(cb)
|
|
81
90
|
*
|
|
82
91
|
* @param {function} fn Callback function
|
|
83
|
-
* @param {any} [
|
|
84
|
-
* @returns {function} Noop clear function
|
|
85
|
-
*/
|
|
86
|
-
static frame(fn, ...args)
|
|
87
|
-
{
|
|
88
|
-
requestAnimationFrame(() => {
|
|
89
|
-
fn(...args)
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return () => null;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Run function when browser is idle
|
|
97
|
-
*
|
|
98
|
-
* @example Run.idle(cb)
|
|
99
|
-
*
|
|
100
|
-
* @param {function} fn Callback function
|
|
101
|
-
* @param {any} [...args] Callback arguments
|
|
92
|
+
* @param {any} [options] Callback options
|
|
102
93
|
* @returns {function} Noop clear function
|
|
103
94
|
*/
|
|
104
|
-
static
|
|
95
|
+
static frame(fn, options = {})
|
|
105
96
|
{
|
|
106
|
-
|
|
107
|
-
fn(
|
|
97
|
+
const frame = requestAnimationFrame(() => {
|
|
98
|
+
fn();
|
|
108
99
|
});
|
|
109
100
|
|
|
110
|
-
return () =>
|
|
101
|
+
return () => cancelAnimationFrame(frame);
|
|
111
102
|
}
|
|
112
103
|
|
|
113
104
|
/**
|
|
@@ -116,16 +107,15 @@ export class PicoRunner
|
|
|
116
107
|
* @example Run.async(cb)
|
|
117
108
|
*
|
|
118
109
|
* @param {function} fn Callback function
|
|
119
|
-
* @param {any} [...args] Callback arguments
|
|
120
110
|
* @returns {function} Noop clear function
|
|
121
111
|
*/
|
|
122
|
-
static async(fn
|
|
112
|
+
static async(fn)
|
|
123
113
|
{
|
|
124
|
-
setTimeout(() => {
|
|
125
|
-
fn(
|
|
114
|
+
const idle = setTimeout(() => {
|
|
115
|
+
fn()
|
|
126
116
|
});
|
|
127
117
|
|
|
128
|
-
return () =>
|
|
118
|
+
return () => clearTimeout(idle);
|
|
129
119
|
}
|
|
130
120
|
|
|
131
121
|
/**
|
|
@@ -135,13 +125,12 @@ export class PicoRunner
|
|
|
135
125
|
*
|
|
136
126
|
* @param {function} fn Callback function
|
|
137
127
|
* @param {number} [delay] Delay ms
|
|
138
|
-
* @param {any} [...args] Callback arguments
|
|
139
128
|
* @returns {function} Clear function
|
|
140
129
|
*/
|
|
141
|
-
static delay(fn, delay = 0
|
|
130
|
+
static delay(fn, delay = 0)
|
|
142
131
|
{
|
|
143
132
|
let idler = setTimeout(() => {
|
|
144
|
-
fn(
|
|
133
|
+
fn();
|
|
145
134
|
}, delay);
|
|
146
135
|
|
|
147
136
|
return () => clearTimeout(idler);
|
|
@@ -210,20 +199,25 @@ export class PicoRunner
|
|
|
210
199
|
*
|
|
211
200
|
* @param {function} cb Callback to run
|
|
212
201
|
* @param {number} [fps] Max frames per sec
|
|
202
|
+
* @param {boolean} [finish] Finish last frame
|
|
213
203
|
* @returns {function} Rate-limited fn
|
|
214
204
|
*/
|
|
215
|
-
static framerate(cb, fps = 30)
|
|
205
|
+
static framerate(cb, fps = 30, finish = true)
|
|
216
206
|
{
|
|
217
|
-
let last = 0;
|
|
207
|
+
let timer, last = 0, hertz = 1000 / fps;
|
|
218
208
|
|
|
219
|
-
|
|
209
|
+
const fn = (...args) => {
|
|
220
210
|
|
|
221
|
-
|
|
222
|
-
|
|
211
|
+
clearTimeout(timer);
|
|
212
|
+
|
|
213
|
+
if ( Date.now() - last <= hertz ) {
|
|
214
|
+
return finish && (timer = setTimeout(fn, hertz + 1));
|
|
223
215
|
}
|
|
224
216
|
|
|
225
|
-
(this.frame(cb
|
|
217
|
+
(this.frame(() => cb(...args)), last = Date.now());
|
|
226
218
|
};
|
|
219
|
+
|
|
220
|
+
return fn;
|
|
227
221
|
}
|
|
228
222
|
|
|
229
223
|
/**
|
|
@@ -244,17 +238,17 @@ export class PicoRunner
|
|
|
244
238
|
|
|
245
239
|
Arr.add(this.$buffer, item);
|
|
246
240
|
|
|
247
|
-
let fn = () => {
|
|
248
|
-
this.runFramebuffer();
|
|
249
|
-
};
|
|
250
|
-
|
|
251
241
|
return (e, ...args) => {
|
|
252
242
|
|
|
243
|
+
if ( /^drag/.test(e.type) ) {
|
|
244
|
+
e.preventDefault();
|
|
245
|
+
}
|
|
246
|
+
|
|
253
247
|
Obj.assign(item, {
|
|
254
248
|
args: [e, ...args], active: true
|
|
255
249
|
});
|
|
256
250
|
|
|
257
|
-
|
|
251
|
+
this.runFramebuffer();
|
|
258
252
|
};
|
|
259
253
|
}
|
|
260
254
|
|
|
@@ -272,7 +266,6 @@ export class PicoRunner
|
|
|
272
266
|
}
|
|
273
267
|
|
|
274
268
|
this.$idler = setTimeout(() => {
|
|
275
|
-
console.log('delayed runFramebuffer')
|
|
276
269
|
this.runFramebuffer();
|
|
277
270
|
}, 50);
|
|
278
271
|
|
|
@@ -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,11 @@ 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;
|
|
105
|
+
pointerdown(button?: number): this;
|
|
104
106
|
/**
|
|
105
107
|
* @see PicoDom.once
|
|
106
108
|
*/
|
package/types/dom/DomFinder.d.ts
CHANGED
|
@@ -17,11 +17,10 @@ export class PicoDomFinderStatic {
|
|
|
17
17
|
*
|
|
18
18
|
* @example Dom.getNodePoint(100, 100)
|
|
19
19
|
*
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {number} posy Y position
|
|
20
|
+
* @param {object} event Event data
|
|
22
21
|
* @returns {Array<Element>} Nodes at point
|
|
23
22
|
*/
|
|
24
|
-
static getNodePoint(
|
|
23
|
+
static getNodePoint(event: object): Array<Element>;
|
|
25
24
|
/**
|
|
26
25
|
* Get target by selector
|
|
27
26
|
*
|
|
@@ -193,7 +192,7 @@ export class PicoDomFinderInstance {
|
|
|
193
192
|
* @param {number} [filter] Node type
|
|
194
193
|
* @returns {PicoDom} Child instance
|
|
195
194
|
*/
|
|
196
|
-
child(selector
|
|
195
|
+
child(selector?: any, filter?: number): PicoDom;
|
|
197
196
|
/**
|
|
198
197
|
* Get child elements
|
|
199
198
|
*
|
|
@@ -213,6 +212,7 @@ export class PicoDomFinderInstance {
|
|
|
213
212
|
* @returns {Element} Found element
|
|
214
213
|
*/
|
|
215
214
|
closest(selector: any): Element;
|
|
215
|
+
upnode(selector: any): PicoDom;
|
|
216
216
|
/**
|
|
217
217
|
* Get previous element
|
|
218
218
|
*
|
|
@@ -245,9 +245,10 @@ export class PicoDomFinderInstance {
|
|
|
245
245
|
* @example Dom.find("div").is(".active") // => true
|
|
246
246
|
*
|
|
247
247
|
* @param {any} selector Test selector
|
|
248
|
+
* @param {boolean} [empty] Test selector
|
|
248
249
|
* @returns {boolean} True if matches
|
|
249
250
|
*/
|
|
250
|
-
is(selector: any): boolean;
|
|
251
|
+
is(selector: any, empty?: boolean): boolean;
|
|
251
252
|
/**
|
|
252
253
|
* Check if contains match
|
|
253
254
|
*
|
|
@@ -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
|
@@ -42,6 +42,8 @@ export class PicoArray {
|
|
|
42
42
|
* @returns {any} Splice result
|
|
43
43
|
*/
|
|
44
44
|
static unset(target: Array<any>, index: number): any;
|
|
45
|
+
static prev(target: any, index: any, fallback?: number): number;
|
|
46
|
+
static next(target: any, index: any, fallback?: number): any;
|
|
45
47
|
/**
|
|
46
48
|
* Create array with callback values
|
|
47
49
|
*
|
|
@@ -167,6 +169,7 @@ export class PicoArray {
|
|
|
167
169
|
* @returns {any} Mapped tree
|
|
168
170
|
*/
|
|
169
171
|
static recursive(value: any, key: string, cb: Function, cascade?: Array<any>): any;
|
|
172
|
+
static cascade(value: any, childs: any, key: any, cascade?: any[], result?: {}): any;
|
|
170
173
|
/**
|
|
171
174
|
* Get matching indexes by filter
|
|
172
175
|
*
|
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/Mixed.d.ts
CHANGED
|
@@ -294,6 +294,7 @@ export class PicoMixed {
|
|
|
294
294
|
* @returns {Record<string, any>} Props map
|
|
295
295
|
*/
|
|
296
296
|
static props(value: any, exclude?: Array<any>): Record<string, any>;
|
|
297
|
+
static extend(target: any, value: any, exclude?: string[]): any;
|
|
297
298
|
/**
|
|
298
299
|
* Get static class props
|
|
299
300
|
*
|