@kizmann/pico-js 2.0.9 → 2.0.11
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.ts +8 -2
- package/src/dom/DomEvent.ts +19 -12
- package/src/dom/DomFinder.ts +21 -6
- package/src/dom/DomGlobal.ts +8 -4
- package/src/dom/DomMeta.ts +1 -0
- package/src/dom/DomObserver.ts +0 -1
- package/src/dom/DomPopover.ts +39 -0
- package/src/dom/DomRectangle.ts +8 -0
- package/src/format/FormatFile.ts +1 -2
- package/src/format/FormatOption.ts +0 -1
- package/src/format/FormatParam.ts +0 -1
- package/src/now/NowDefault.ts +80 -32
- package/src/now/NowGrid.ts +30 -12
- package/src/now/NowMatch.ts +1 -1
- package/src/now/NowRange.ts +5 -2
- package/src/now/NowWalker.ts +0 -1
- package/src/tool/scope.ts +6 -0
- package/src/utils/Array.ts +130 -21
- package/src/utils/Dom.ts +1 -1
- package/src/utils/Locale.ts +3 -3
- package/src/utils/Mixed.ts +59 -13
- package/src/utils/Now.ts +5 -2
- package/src/utils/Number.ts +8 -2
- package/src/utils/Object.ts +26 -5
- package/src/utils/Signal.ts +1 -1
- package/src/utils/String.ts +24 -18
- package/src/wip/Map.ts +131 -101
- package/types/dom/DomEvent.d.ts +1 -1
- package/types/dom/DomGlobal.d.ts +4 -0
- package/types/dom/DomPopover.d.ts +39 -0
- package/types/dom/DomRectangle.d.ts +8 -0
- package/types/tool/scope.d.ts +6 -0
- package/types/utils/Array.d.ts +55 -4
- package/types/utils/Locale.d.ts +1 -1
- package/types/utils/Mixed.d.ts +10 -0
- package/types/utils/Object.d.ts +9 -0
|
@@ -16,6 +16,14 @@ export declare class PicoDomRectangle {
|
|
|
16
16
|
* @returns {number} Number value
|
|
17
17
|
*/
|
|
18
18
|
static num(value: any): number;
|
|
19
|
+
/**
|
|
20
|
+
* Get bounding rectangle
|
|
21
|
+
*
|
|
22
|
+
* @example Dom.find("div").rect()
|
|
23
|
+
*
|
|
24
|
+
* @param {any} [fallback] Fallback value
|
|
25
|
+
* @returns {any} Rect object
|
|
26
|
+
*/
|
|
19
27
|
rect(fallback?: any): any;
|
|
20
28
|
/**
|
|
21
29
|
* Get margin values
|
package/types/tool/scope.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export declare function browser(): void;
|
|
|
22
22
|
* @returns {void} No return value
|
|
23
23
|
*/
|
|
24
24
|
export declare function device(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Trait multiple classes
|
|
27
|
+
*
|
|
28
|
+
* @param {any[]} values Class array
|
|
29
|
+
* @returns {any} Traited class
|
|
30
|
+
*/
|
|
25
31
|
export declare function trait(values: any[]): any;
|
|
26
32
|
declare const _default: {
|
|
27
33
|
go: typeof go;
|
package/types/utils/Array.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Arr } from "../index.esm.ts";
|
|
2
1
|
export declare class PicoArray {
|
|
3
2
|
/**
|
|
4
3
|
* Wrap value into an array
|
|
@@ -43,7 +42,25 @@ export declare class PicoArray {
|
|
|
43
42
|
* @returns {any} Splice result
|
|
44
43
|
*/
|
|
45
44
|
static unset(target: any, index: number): any;
|
|
45
|
+
/**
|
|
46
|
+
* Get previous index
|
|
47
|
+
*
|
|
48
|
+
* @example Arr.prev([1,2,3], 0) // => 2
|
|
49
|
+
*
|
|
50
|
+
* @param {any} target Target array
|
|
51
|
+
* @param {number} index Current index
|
|
52
|
+
* @returns {number} Previous index
|
|
53
|
+
*/
|
|
46
54
|
static prev(target: any, index: number): number;
|
|
55
|
+
/**
|
|
56
|
+
* Get next index
|
|
57
|
+
*
|
|
58
|
+
* @example Arr.next([1,2,3], 2) // => 0
|
|
59
|
+
*
|
|
60
|
+
* @param {any} target Target array
|
|
61
|
+
* @param {number} index Current index
|
|
62
|
+
* @returns {number} Next index
|
|
63
|
+
*/
|
|
47
64
|
static next(target: any, index: number): number;
|
|
48
65
|
/**
|
|
49
66
|
* Create array with callback values
|
|
@@ -170,7 +187,41 @@ export declare class PicoArray {
|
|
|
170
187
|
* @returns {any} Mapped tree
|
|
171
188
|
*/
|
|
172
189
|
static recursive(value: any, key: string, cb: Function, cascade?: any[]): any;
|
|
173
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Run callback on cascade
|
|
192
|
+
*
|
|
193
|
+
* @example Arr.cascade({a:1, b:[{a:2}]}, "b", v => v.a) // => [1, 2]
|
|
194
|
+
*
|
|
195
|
+
* @param {any} value Input object
|
|
196
|
+
* @param {string} childs Child key
|
|
197
|
+
* @param {Function} cb Callback fn
|
|
198
|
+
* @param {any[]} [cascade] Initial cascade
|
|
199
|
+
* @param {any[]} [result] Initial result
|
|
200
|
+
* @returns {any} Cascade result
|
|
201
|
+
*/
|
|
202
|
+
static cascade(value: any, childs: string, cb: Function, cascade?: any[], result?: any[]): any;
|
|
203
|
+
/**
|
|
204
|
+
* Find item in cascade
|
|
205
|
+
*
|
|
206
|
+
* @example Arr.cascadeFind({a:1, b:[{a:2}]}, "b", v => v.a === 2) // => [{...}, {a:2}]
|
|
207
|
+
*
|
|
208
|
+
* @param {any} value Input object
|
|
209
|
+
* @param {string} childs Child key
|
|
210
|
+
* @param {Function} cb Callback fn
|
|
211
|
+
* @returns {any} Find result
|
|
212
|
+
*/
|
|
213
|
+
static cascadeFind(value: any, childs: string, cb: Function): any;
|
|
214
|
+
/**
|
|
215
|
+
* Map items in cascade
|
|
216
|
+
*
|
|
217
|
+
* @example Arr.cascadeMap({a:1, b:[{a:2}]}, "b", "a") // => {1: [1], 2: [1, 2]}
|
|
218
|
+
*
|
|
219
|
+
* @param {any} value Input object
|
|
220
|
+
* @param {string} childs Child key
|
|
221
|
+
* @param {string} key Map key
|
|
222
|
+
* @returns {any} Map result
|
|
223
|
+
*/
|
|
224
|
+
static cascadeMap(value: any, childs: string, key: string): any;
|
|
174
225
|
/**
|
|
175
226
|
* Get matching indexes by filter
|
|
176
227
|
*
|
|
@@ -403,7 +454,7 @@ export declare class PicoArray {
|
|
|
403
454
|
/**
|
|
404
455
|
* @see PicoArray.diff
|
|
405
456
|
*/
|
|
406
|
-
static diffrence: typeof
|
|
457
|
+
static diffrence: typeof PicoArray.diff;
|
|
407
458
|
/**
|
|
408
459
|
* Get intersecting items
|
|
409
460
|
*
|
|
@@ -416,7 +467,7 @@ export declare class PicoArray {
|
|
|
416
467
|
/**
|
|
417
468
|
* @see PicoArray.diff
|
|
418
469
|
*/
|
|
419
|
-
static intersect: typeof
|
|
470
|
+
static intersect: typeof PicoArray.isect;
|
|
420
471
|
/**
|
|
421
472
|
* Extract property values from list
|
|
422
473
|
*
|
package/types/utils/Locale.d.ts
CHANGED
package/types/utils/Mixed.d.ts
CHANGED
|
@@ -295,6 +295,16 @@ export declare class PicoMixed {
|
|
|
295
295
|
* @returns {Record<string, any>} Props map
|
|
296
296
|
*/
|
|
297
297
|
static props(value: any, exclude?: string[]): Record<string, any>;
|
|
298
|
+
/**
|
|
299
|
+
* Extend object with another object
|
|
300
|
+
*
|
|
301
|
+
* @example Mix.extend({}, {a:1}) // => {a:1}
|
|
302
|
+
*
|
|
303
|
+
* @param {any} target Target object
|
|
304
|
+
* @param {any} value Source object
|
|
305
|
+
* @param {string[]} [exclude] Exclude keys
|
|
306
|
+
* @returns {any} Extended target
|
|
307
|
+
*/
|
|
298
308
|
static extend(target: any, value: any, exclude?: string[]): any;
|
|
299
309
|
/**
|
|
300
310
|
* Get static class props
|
package/types/utils/Object.d.ts
CHANGED
|
@@ -229,6 +229,15 @@ export declare class PicoObject {
|
|
|
229
229
|
* @returns {boolean} True if matches
|
|
230
230
|
*/
|
|
231
231
|
static matches(value: any, search: any): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Sort object entries by key
|
|
234
|
+
*
|
|
235
|
+
* @example Obj.sort({b:1,a:2}, "key") // => [{_key:"a",...},{_key:"b",...}]
|
|
236
|
+
*
|
|
237
|
+
* @param {any} value Input object
|
|
238
|
+
* @param {string} key Sort key
|
|
239
|
+
* @returns {any} Sorted result
|
|
240
|
+
*/
|
|
232
241
|
static sort(value: any, key: string): any;
|
|
233
242
|
}
|
|
234
243
|
export default PicoObject;
|