@kizmann/pico-js 1.0.13 → 2.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.
- package/README.md +27 -7
- package/dist/pico-js.browser.js +2 -0
- package/dist/pico-js.browser.js.map +1 -0
- package/dist/pico-js.esm.js +2 -0
- package/dist/pico-js.esm.js.map +1 -0
- package/package.json +20 -7
- package/src/dom/DomAttribute.js +374 -0
- package/src/dom/DomBuilder.js +152 -0
- package/src/dom/DomEvent.js +253 -0
- package/src/dom/DomFinder.js +669 -0
- package/src/dom/DomForm.js +57 -0
- package/src/dom/DomGlobal.js +193 -0
- package/src/dom/DomInview.js +332 -0
- package/src/dom/DomMeta.js +66 -0
- package/src/dom/DomObserver.js +57 -0
- package/src/dom/DomRectangle.js +657 -0
- package/src/format/FormatFile.js +54 -0
- package/src/format/FormatOption.js +108 -0
- package/src/format/FormatParam.js +107 -0
- package/src/format/FormatParser.js +156 -0
- package/src/format/FormatUrl.js +75 -0
- package/src/index.browser.js +10 -0
- package/src/index.esm.js +138 -0
- package/src/now/NowDefault.js +533 -0
- package/src/now/NowFormat.js +196 -0
- package/src/now/NowGrid.js +251 -0
- package/src/now/NowHuman.js +118 -0
- package/src/now/NowMatch.js +175 -0
- package/src/now/NowRange.js +70 -0
- package/src/now/NowWalker.js +544 -0
- package/src/tool/scope.js +103 -0
- package/src/utils/Array.js +986 -0
- package/src/utils/Cookie.js +184 -0
- package/src/utils/Data.js +200 -0
- package/src/utils/Dom.js +208 -0
- package/src/utils/Event.js +140 -0
- package/src/utils/Format.js +62 -0
- package/src/utils/Hash.js +164 -0
- package/src/utils/Locale.js +229 -0
- package/src/utils/Mixed.js +887 -0
- package/src/utils/Now.js +234 -0
- package/src/utils/Number.js +238 -0
- package/src/utils/Object.js +655 -0
- package/src/utils/Route.js +67 -0
- package/src/utils/Runner.js +327 -0
- package/src/utils/String.js +618 -0
- package/src/{library/element.js → wip/Element.js} +90 -16
- package/src/{library/map.js → wip/Map.js} +256 -40
- package/types/dom/DomAttribute.d.ts +137 -0
- package/types/dom/DomBuilder.d.ts +67 -0
- package/types/dom/DomEvent.d.ts +103 -0
- package/types/dom/DomFinder.d.ts +321 -0
- package/types/dom/DomForm.d.ts +21 -0
- package/types/dom/DomGlobal.d.ts +79 -0
- package/types/dom/DomInview.d.ts +114 -0
- package/types/dom/DomMeta.d.ts +29 -0
- package/types/dom/DomObserver.d.ts +21 -0
- package/types/dom/DomRectangle.d.ts +270 -0
- package/types/format/FormatFile.d.ts +18 -0
- package/types/format/FormatOption.d.ts +40 -0
- package/types/format/FormatParam.d.ts +39 -0
- package/types/format/FormatParser.d.ts +46 -0
- package/types/format/FormatUrl.d.ts +17 -0
- package/types/index.browser.d.ts +1 -0
- package/types/index.esm.d.ts +52 -0
- package/types/now/NowDefault.d.ts +183 -0
- package/types/now/NowFormat.d.ts +70 -0
- package/types/now/NowGrid.d.ts +107 -0
- package/types/now/NowHuman.d.ts +37 -0
- package/types/now/NowMatch.d.ts +108 -0
- package/types/now/NowRange.d.ts +21 -0
- package/types/now/NowWalker.d.ts +301 -0
- package/types/tool/scope.d.ts +24 -0
- package/types/utils/Array.d.ts +480 -0
- package/types/utils/Cookie.d.ts +60 -0
- package/types/utils/Data.d.ts +91 -0
- package/types/utils/Dom.d.ts +138 -0
- package/types/utils/Event.d.ts +58 -0
- package/types/utils/Format.d.ts +37 -0
- package/types/utils/Hash.d.ts +81 -0
- package/types/utils/Locale.d.ts +115 -0
- package/types/utils/Mixed.d.ts +469 -0
- package/types/utils/Now.d.ts +125 -0
- package/types/utils/Number.d.ts +127 -0
- package/types/utils/Object.d.ts +255 -0
- package/types/utils/Route.d.ts +37 -0
- package/types/utils/Runner.d.ts +139 -0
- package/types/utils/String.d.ts +330 -0
- package/types/wip/Element.d.ts +119 -0
- package/types/wip/Map.d.ts +254 -0
- package/dist/.ignore.js +0 -0
- package/dist/pico-js.js +0 -2
- package/dist/pico-js.js.map +0 -1
- package/src/element/default.js +0 -46
- package/src/element/example.js +0 -58
- package/src/index.js +0 -90
- package/src/library/cookie.js +0 -123
- package/src/library/data.js +0 -111
- package/src/library/event.js +0 -91
- package/src/library/locale.js +0 -84
- package/src/library/queue.js +0 -64
- package/src/library/route.js +0 -28
- package/src/utility/any.js +0 -369
- package/src/utility/array.js +0 -410
- package/src/utility/dom.js +0 -1425
- package/src/utility/now.js +0 -544
- package/src/utility/number.js +0 -128
- package/src/utility/object.js +0 -429
- package/src/utility/string.js +0 -328
- package/types/index.d.ts +0 -77
- package/types/library/cookie.d.ts +0 -10
- package/types/library/data.d.ts +0 -15
- package/types/library/element.d.ts +0 -22
- package/types/library/event.d.ts +0 -13
- package/types/library/locale.d.ts +0 -14
- package/types/library/map.d.ts +0 -43
- package/types/library/queue.d.ts +0 -18
- package/types/library/route.d.ts +0 -11
- package/types/utility/any.d.ts +0 -35
- package/types/utility/array.d.ts +0 -46
- package/types/utility/dom.d.ts +0 -101
- package/types/utility/now.d.ts +0 -79
- package/types/utility/number.d.ts +0 -17
- package/types/utility/object.d.ts +0 -29
- package/types/utility/string.d.ts +0 -26
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberof PicoDom
|
|
3
|
+
*/
|
|
4
|
+
export class PicoDomGlobalStatic {
|
|
5
|
+
/**
|
|
6
|
+
* Get document ready state
|
|
7
|
+
*
|
|
8
|
+
* @example Dom.getDomState() // => "complete"
|
|
9
|
+
*
|
|
10
|
+
* @returns {string} State string
|
|
11
|
+
*/
|
|
12
|
+
static getDomState(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Check if DOM is ready
|
|
15
|
+
*
|
|
16
|
+
* @example Dom.isDomReady() // => true
|
|
17
|
+
*
|
|
18
|
+
* @returns {boolean} True if ready
|
|
19
|
+
*/
|
|
20
|
+
static isDomReady(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Check if DOM is complete
|
|
23
|
+
*
|
|
24
|
+
* @example Dom.isDomComplete() // => true
|
|
25
|
+
*
|
|
26
|
+
* @returns {boolean} True if complete
|
|
27
|
+
*/
|
|
28
|
+
static isDomComplete(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Run callback when ready
|
|
31
|
+
*
|
|
32
|
+
* @example Dom.ready(cb)
|
|
33
|
+
*
|
|
34
|
+
* @param {function} cb Callback fn
|
|
35
|
+
* @param {number} [delay] Execution delay
|
|
36
|
+
* @param {number} [limit] Wait limit
|
|
37
|
+
* @returns {this} Static class
|
|
38
|
+
*/
|
|
39
|
+
static ready(cb: Function, delay?: number, limit?: number): this;
|
|
40
|
+
/**
|
|
41
|
+
* Run callback when complete
|
|
42
|
+
*
|
|
43
|
+
* @example Dom.complete(cb)
|
|
44
|
+
*
|
|
45
|
+
* @param {function} cb Callback fn
|
|
46
|
+
* @param {number} [delay] Execution delay
|
|
47
|
+
* @param {number} [limit] Wait limit
|
|
48
|
+
* @returns {this} Static class
|
|
49
|
+
*/
|
|
50
|
+
static complete(cb: Function, delay?: number, limit?: number): this;
|
|
51
|
+
}
|
|
52
|
+
export namespace PicoDomGlobalStatic {
|
|
53
|
+
function required(): void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @memberof PicoDom
|
|
57
|
+
* @extends {PicoDom}
|
|
58
|
+
*/
|
|
59
|
+
export class PicoDomGlobalInstance {
|
|
60
|
+
/**
|
|
61
|
+
* Check if node is complete
|
|
62
|
+
*
|
|
63
|
+
* @example Dom.find("img").isNodeComplete() // => true
|
|
64
|
+
*
|
|
65
|
+
* @returns {boolean} True if complete
|
|
66
|
+
*/
|
|
67
|
+
isNodeComplete(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Run callback when loaded
|
|
70
|
+
*
|
|
71
|
+
* @example Dom.find("img").loaded(cb)
|
|
72
|
+
*
|
|
73
|
+
* @param {function} cb Callback fn
|
|
74
|
+
* @param {number} [limit] Wait limit
|
|
75
|
+
* @returns {this} Current instance
|
|
76
|
+
*/
|
|
77
|
+
loaded(cb: Function, limit?: number): this;
|
|
78
|
+
}
|
|
79
|
+
export function PicoDomGlobalPlugin(self: any): typeof import("#src/utils/Dom.js").PicoDom;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberof PicoDom
|
|
3
|
+
*/
|
|
4
|
+
export class PicoDomInviewStatic {
|
|
5
|
+
/**
|
|
6
|
+
* Get first inview element Y
|
|
7
|
+
*
|
|
8
|
+
* @example Dom.inviewMaxY(".item")
|
|
9
|
+
*
|
|
10
|
+
* @param {any} options Find options
|
|
11
|
+
* @param {function} [cb] Success callback
|
|
12
|
+
* @returns {any} Found element
|
|
13
|
+
*/
|
|
14
|
+
static inviewMaxY(options: any, cb?: Function): any;
|
|
15
|
+
/**
|
|
16
|
+
* Get first inview element X
|
|
17
|
+
*
|
|
18
|
+
* @example Dom.inviewMaxX(".item")
|
|
19
|
+
*
|
|
20
|
+
* @param {any} options Find options
|
|
21
|
+
* @param {function} [cb] Success callback
|
|
22
|
+
* @returns {any} Found element
|
|
23
|
+
*/
|
|
24
|
+
static inviewMaxX(options: any, cb?: Function): any;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @memberof PicoDom
|
|
28
|
+
* @extends {PicoDom}
|
|
29
|
+
*/
|
|
30
|
+
export class PicoDomInviewInstance {
|
|
31
|
+
/**
|
|
32
|
+
* Get X view offset
|
|
33
|
+
*
|
|
34
|
+
* @example Dom.find("div").viewoffX()
|
|
35
|
+
*
|
|
36
|
+
* @returns {any} Offset object
|
|
37
|
+
*/
|
|
38
|
+
viewoffX(): any;
|
|
39
|
+
/**
|
|
40
|
+
* Get X inview pixels
|
|
41
|
+
*
|
|
42
|
+
* @example Dom.find("div").inviewX()
|
|
43
|
+
*
|
|
44
|
+
* @param {any} [boundry] View boundry
|
|
45
|
+
* @returns {number} Inview pixels
|
|
46
|
+
*/
|
|
47
|
+
inviewX(boundry?: any): number;
|
|
48
|
+
/**
|
|
49
|
+
* Get X inview ratio
|
|
50
|
+
*
|
|
51
|
+
* @example Dom.find("div").inratioX()
|
|
52
|
+
*
|
|
53
|
+
* @param {any} [boundry] View boundry
|
|
54
|
+
* @returns {number} Inview ratio
|
|
55
|
+
*/
|
|
56
|
+
inratioX(boundry?: any): number;
|
|
57
|
+
/**
|
|
58
|
+
* Check if is inview X
|
|
59
|
+
*
|
|
60
|
+
* @example Dom.find("div").isInviewX(0.5)
|
|
61
|
+
*
|
|
62
|
+
* @param {number} [threshold] View threshold
|
|
63
|
+
* @param {string} [mode] View mode
|
|
64
|
+
* @param {any} [boundry] View boundry
|
|
65
|
+
* @returns {boolean} True if inview
|
|
66
|
+
*/
|
|
67
|
+
isInviewX(threshold?: number, mode?: string, boundry?: any): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Get Y view offset
|
|
70
|
+
*
|
|
71
|
+
* @example Dom.find("div").viewoffY()
|
|
72
|
+
*
|
|
73
|
+
* @returns {any} Offset object
|
|
74
|
+
*/
|
|
75
|
+
viewoffY(): any;
|
|
76
|
+
/**
|
|
77
|
+
* Get Y inview pixels
|
|
78
|
+
*
|
|
79
|
+
* @example Dom.find("div").inviewY()
|
|
80
|
+
*
|
|
81
|
+
* @param {any} [boundry] View boundry
|
|
82
|
+
* @returns {number} Inview pixels
|
|
83
|
+
*/
|
|
84
|
+
inviewY(boundry?: any): number;
|
|
85
|
+
/**
|
|
86
|
+
* Get Y inview ratio
|
|
87
|
+
*
|
|
88
|
+
* @example Dom.find("div").inratioY()
|
|
89
|
+
*
|
|
90
|
+
* @param {any} [boundry] View boundry
|
|
91
|
+
* @returns {number} Inview ratio
|
|
92
|
+
*/
|
|
93
|
+
inratioY(boundry?: any): number;
|
|
94
|
+
/**
|
|
95
|
+
* Check if is inview Y
|
|
96
|
+
*
|
|
97
|
+
* @example Dom.find("div").isInviewY(0.5)
|
|
98
|
+
*
|
|
99
|
+
* @param {number} [threshold] View threshold
|
|
100
|
+
* @param {string} [mode] View mode
|
|
101
|
+
* @param {any} [boundry] View boundry
|
|
102
|
+
* @returns {boolean} True if inview
|
|
103
|
+
*/
|
|
104
|
+
isInviewY(threshold?: number, mode?: string, boundry?: any): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @see PicoDom.inviewY
|
|
107
|
+
*/
|
|
108
|
+
inviewHeight(...args: any[]): number;
|
|
109
|
+
/**
|
|
110
|
+
* @see PicoDom.inviewX
|
|
111
|
+
*/
|
|
112
|
+
inviewWidth(...args: any[]): number;
|
|
113
|
+
}
|
|
114
|
+
export function PicoDomInviewPlugin(self: any): typeof import("#src/utils/Dom.js").PicoDom;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberof PicoDom
|
|
3
|
+
*/
|
|
4
|
+
export class PicoDomMetaStatic {
|
|
5
|
+
static $meta: {};
|
|
6
|
+
/**
|
|
7
|
+
* Set document title
|
|
8
|
+
*
|
|
9
|
+
* @example Dom.setMetaTitle("Home")
|
|
10
|
+
*
|
|
11
|
+
* @param {string} value New title
|
|
12
|
+
* @param {string} [glue] Title glue
|
|
13
|
+
* @returns {this} Static class
|
|
14
|
+
*/
|
|
15
|
+
static setMetaTitle(value: string, glue?: string): this;
|
|
16
|
+
}
|
|
17
|
+
export namespace PicoDomMetaStatic {
|
|
18
|
+
/**
|
|
19
|
+
* @see PicoDom.setMetaTitle
|
|
20
|
+
*/
|
|
21
|
+
function title(value: any): any;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @memberof PicoDom
|
|
25
|
+
* @extends {PicoDom}
|
|
26
|
+
*/
|
|
27
|
+
export class PicoDomMetaInstance {
|
|
28
|
+
}
|
|
29
|
+
export function PicoDomMetaPlugin(self: any): typeof import("#src/utils/Dom.js").PicoDom;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberof PicoDom
|
|
3
|
+
*/
|
|
4
|
+
export class PicoDomObserverStatic {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @memberof PicoDom
|
|
8
|
+
* @extends {PicoDom}
|
|
9
|
+
*/
|
|
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|this} Value or instance
|
|
18
|
+
*/
|
|
19
|
+
value(value?: any): any | this;
|
|
20
|
+
}
|
|
21
|
+
export function PicoDomObserverPlugin(self: any): typeof import("#src/utils/Dom.js").PicoDom;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberof PicoDom
|
|
3
|
+
*/
|
|
4
|
+
export class PicoDomRectangleStatic {
|
|
5
|
+
/**
|
|
6
|
+
* Cast value to number
|
|
7
|
+
*
|
|
8
|
+
* @example Dom.num("10px") // => 10
|
|
9
|
+
*
|
|
10
|
+
* @param {any} value Input value
|
|
11
|
+
* @returns {number} Number value
|
|
12
|
+
*/
|
|
13
|
+
static num(value: any): number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @memberof PicoDom
|
|
17
|
+
* @extends {PicoDom}
|
|
18
|
+
*/
|
|
19
|
+
export class PicoDomRectangleInstance {
|
|
20
|
+
/**
|
|
21
|
+
* Get margin values
|
|
22
|
+
*
|
|
23
|
+
* @example Dom.find("div").margin()
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [key] Margin key
|
|
26
|
+
* @param {number} [fallback] Fallback value
|
|
27
|
+
* @returns {any} Margin values
|
|
28
|
+
*/
|
|
29
|
+
margin(key?: string, fallback?: number): any;
|
|
30
|
+
/**
|
|
31
|
+
* Get padding values
|
|
32
|
+
*
|
|
33
|
+
* @example Dom.find("div").padding()
|
|
34
|
+
*
|
|
35
|
+
* @param {string} [key] Padding key
|
|
36
|
+
* @param {number} [fallback] Fallback value
|
|
37
|
+
* @returns {any} Padding values
|
|
38
|
+
*/
|
|
39
|
+
padding(key?: string, fallback?: number): any;
|
|
40
|
+
/**
|
|
41
|
+
* Get element height
|
|
42
|
+
*
|
|
43
|
+
* @example Dom.find("div").height() // => 100
|
|
44
|
+
*
|
|
45
|
+
* @returns {number} Height value
|
|
46
|
+
*/
|
|
47
|
+
height(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Get client height
|
|
50
|
+
*
|
|
51
|
+
* @example Dom.find("div").clientHeight()
|
|
52
|
+
*
|
|
53
|
+
* @returns {number} Height value
|
|
54
|
+
*/
|
|
55
|
+
clientHeight(): number;
|
|
56
|
+
/**
|
|
57
|
+
* Get scroll height
|
|
58
|
+
*
|
|
59
|
+
* @example Dom.find("div").scrollHeight()
|
|
60
|
+
*
|
|
61
|
+
* @returns {number} Height value
|
|
62
|
+
*/
|
|
63
|
+
scrollHeight(): number;
|
|
64
|
+
/**
|
|
65
|
+
* Get inner height
|
|
66
|
+
*
|
|
67
|
+
* @example Dom.find("div").innerHeight()
|
|
68
|
+
*
|
|
69
|
+
* @returns {number} Height value
|
|
70
|
+
*/
|
|
71
|
+
innerHeight(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Get real height
|
|
74
|
+
*
|
|
75
|
+
* @example Dom.find("div").realHeight({ display: "block" })
|
|
76
|
+
*
|
|
77
|
+
* @param {any} [style] Temp style
|
|
78
|
+
* @returns {number} Height value
|
|
79
|
+
*/
|
|
80
|
+
realHeight(style?: any): number;
|
|
81
|
+
/**
|
|
82
|
+
* Evaluate target height
|
|
83
|
+
*
|
|
84
|
+
* @example Dom.find("div").evaluateHeight(".container")
|
|
85
|
+
*
|
|
86
|
+
* @param {any} [target] Target element
|
|
87
|
+
* @param {boolean} [apply] Apply style
|
|
88
|
+
* @returns {number} Height value
|
|
89
|
+
*/
|
|
90
|
+
evaluateHeight(target?: any, apply?: boolean): number;
|
|
91
|
+
/**
|
|
92
|
+
* Get element width
|
|
93
|
+
*
|
|
94
|
+
* @example Dom.find("div").width() // => 100
|
|
95
|
+
*
|
|
96
|
+
* @returns {number} Width value
|
|
97
|
+
*/
|
|
98
|
+
width(): number;
|
|
99
|
+
/**
|
|
100
|
+
* Get client width
|
|
101
|
+
*
|
|
102
|
+
* @example Dom.find("div").clientWidth()
|
|
103
|
+
*
|
|
104
|
+
* @returns {number} Width value
|
|
105
|
+
*/
|
|
106
|
+
clientWidth(): number;
|
|
107
|
+
/**
|
|
108
|
+
* Get scroll width
|
|
109
|
+
*
|
|
110
|
+
* @example Dom.find("div").scrollWidth()
|
|
111
|
+
*
|
|
112
|
+
* @returns {number} Width value
|
|
113
|
+
*/
|
|
114
|
+
scrollWidth(): number;
|
|
115
|
+
/**
|
|
116
|
+
* Get inner width
|
|
117
|
+
*
|
|
118
|
+
* @example Dom.find("div").innerWidth()
|
|
119
|
+
*
|
|
120
|
+
* @returns {number} Width value
|
|
121
|
+
*/
|
|
122
|
+
innerWidth(): number;
|
|
123
|
+
/**
|
|
124
|
+
* Get real width
|
|
125
|
+
*
|
|
126
|
+
* @example Dom.find("div").realWidth({ display: "block" })
|
|
127
|
+
*
|
|
128
|
+
* @param {any} [style] Temp style
|
|
129
|
+
* @returns {number} Width value
|
|
130
|
+
*/
|
|
131
|
+
realWidth(style?: any): number;
|
|
132
|
+
/**
|
|
133
|
+
* Evaluate target width
|
|
134
|
+
*
|
|
135
|
+
* @example Dom.find("div").evaluateWidth(".container")
|
|
136
|
+
*
|
|
137
|
+
* @param {any} [target] Target element
|
|
138
|
+
* @param {boolean} [apply] Apply style
|
|
139
|
+
* @returns {number} Width value
|
|
140
|
+
*/
|
|
141
|
+
evaluateWidth(target?: any, apply?: boolean): number;
|
|
142
|
+
/**
|
|
143
|
+
* Get element offset
|
|
144
|
+
*
|
|
145
|
+
* @example Dom.find("div").offset()
|
|
146
|
+
*
|
|
147
|
+
* @param {string} [key] Offset key
|
|
148
|
+
* @param {any} [boundry] View boundry
|
|
149
|
+
* @returns {any} Offset values
|
|
150
|
+
*/
|
|
151
|
+
offset(key?: string, boundry?: any): any;
|
|
152
|
+
/**
|
|
153
|
+
* Get top offset
|
|
154
|
+
*
|
|
155
|
+
* @example Dom.find("div").offsetTop()
|
|
156
|
+
*
|
|
157
|
+
* @param {any} [boundry] View boundry
|
|
158
|
+
* @returns {number} Top offset
|
|
159
|
+
*/
|
|
160
|
+
offsetTop(boundry?: any): number;
|
|
161
|
+
/**
|
|
162
|
+
* Get bottom offset
|
|
163
|
+
*
|
|
164
|
+
* @example Dom.find("div").offsetBottom()
|
|
165
|
+
*
|
|
166
|
+
* @param {any} [boundry] View boundry
|
|
167
|
+
* @returns {number} Bottom offset
|
|
168
|
+
*/
|
|
169
|
+
offsetBottom(boundry?: any): number;
|
|
170
|
+
/**
|
|
171
|
+
* Get left offset
|
|
172
|
+
*
|
|
173
|
+
* @example Dom.find("div").offsetLeft()
|
|
174
|
+
*
|
|
175
|
+
* @param {any} [boundry] View boundry
|
|
176
|
+
* @returns {number} Left offset
|
|
177
|
+
*/
|
|
178
|
+
offsetLeft(boundry?: any): number;
|
|
179
|
+
/**
|
|
180
|
+
* Get right offset
|
|
181
|
+
*
|
|
182
|
+
* @example Dom.find("div").offsetRight()
|
|
183
|
+
*
|
|
184
|
+
* @param {any} [boundry] View boundry
|
|
185
|
+
* @returns {number} Right offset
|
|
186
|
+
*/
|
|
187
|
+
offsetRight(boundry?: any): number;
|
|
188
|
+
/**
|
|
189
|
+
* Loop through offset parents
|
|
190
|
+
*
|
|
191
|
+
* @example Dom.find("div").loopOffset((el) => console.log(el))
|
|
192
|
+
*
|
|
193
|
+
* @param {function} cb Callback fn
|
|
194
|
+
* @param {any} [boundry] Loop limit
|
|
195
|
+
* @returns {this} Current instance
|
|
196
|
+
*/
|
|
197
|
+
loopOffset(cb: Function, boundry?: any): this;
|
|
198
|
+
/**
|
|
199
|
+
* Calculate relative offset
|
|
200
|
+
*
|
|
201
|
+
* @example Dom.calcOffset(offset, 100, 100)
|
|
202
|
+
*
|
|
203
|
+
* @param {any} offset Base offset
|
|
204
|
+
* @param {number} width Element width
|
|
205
|
+
* @param {number} height Element height
|
|
206
|
+
* @returns {any} Calculated offset
|
|
207
|
+
*/
|
|
208
|
+
calcOffset(offset: any, width: number, height: number): any;
|
|
209
|
+
/**
|
|
210
|
+
* Get relative offset
|
|
211
|
+
*
|
|
212
|
+
* @example Dom.find("div").getOffset()
|
|
213
|
+
*
|
|
214
|
+
* @param {any} [boundry] View boundry
|
|
215
|
+
* @returns {any} Offset values
|
|
216
|
+
*/
|
|
217
|
+
getOffset(boundry?: any): any;
|
|
218
|
+
/**
|
|
219
|
+
* Get element scroll
|
|
220
|
+
*
|
|
221
|
+
* @example Dom.find("div").scroll()
|
|
222
|
+
*
|
|
223
|
+
* @param {any} [key] Scroll key
|
|
224
|
+
* @param {any} [boundry] View boundry
|
|
225
|
+
* @returns {any} Scroll values
|
|
226
|
+
*/
|
|
227
|
+
scroll(key?: any, boundry?: any): any;
|
|
228
|
+
/**
|
|
229
|
+
* Get or set scroll top
|
|
230
|
+
*
|
|
231
|
+
* @example Dom.find("div").scrollTop(100)
|
|
232
|
+
*
|
|
233
|
+
* @param {any} [value] Scroll value
|
|
234
|
+
* @param {any} [boundry] View boundry
|
|
235
|
+
* @returns {number|this} Value or instance
|
|
236
|
+
*/
|
|
237
|
+
scrollTop(value?: any, boundry?: any): number | this;
|
|
238
|
+
/**
|
|
239
|
+
* Get or set scroll left
|
|
240
|
+
*
|
|
241
|
+
* @example Dom.find("div").scrollLeft(100)
|
|
242
|
+
*
|
|
243
|
+
* @param {any} [value] Scroll value
|
|
244
|
+
* @param {any} [boundry] View boundry
|
|
245
|
+
* @returns {number|this} Value or instance
|
|
246
|
+
*/
|
|
247
|
+
scrollLeft(value?: any, boundry?: any): number | this;
|
|
248
|
+
/**
|
|
249
|
+
* Get relative scroll
|
|
250
|
+
*
|
|
251
|
+
* @example Dom.find("div").getScroll()
|
|
252
|
+
*
|
|
253
|
+
* @param {any} [boundry] View boundry
|
|
254
|
+
* @returns {any} Scroll values
|
|
255
|
+
*/
|
|
256
|
+
getScroll(boundry?: any): any;
|
|
257
|
+
/**
|
|
258
|
+
* @see PicoDom.loopOffsetParent
|
|
259
|
+
*/
|
|
260
|
+
loopOffsetParent(...args: any[]): PicoDomRectangleInstance;
|
|
261
|
+
/**
|
|
262
|
+
* @see PicoDom.scrollTopGlobal
|
|
263
|
+
*/
|
|
264
|
+
scrollTopGlobal(): any;
|
|
265
|
+
/**
|
|
266
|
+
* @see PicoDom.scrollLeftGlobal
|
|
267
|
+
*/
|
|
268
|
+
scrollLeftGlobal(): any;
|
|
269
|
+
}
|
|
270
|
+
export function PicoDomRectanglePlugin(self: any): typeof import("#src/utils/Dom.js").PicoDom;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const FILE_UNITS: string[];
|
|
2
|
+
/**
|
|
3
|
+
* @memberof PicoFormat
|
|
4
|
+
* @extends {PicoFormat}
|
|
5
|
+
*/
|
|
6
|
+
export class PicoFormatFileStatic {
|
|
7
|
+
/**
|
|
8
|
+
* Format file size
|
|
9
|
+
*
|
|
10
|
+
* @example Format.filesize(1000) // => "1.0 KB"
|
|
11
|
+
*
|
|
12
|
+
* @param {any} value Bytes value
|
|
13
|
+
* @param {number} [decimals] Decimal points
|
|
14
|
+
* @returns {string} Formatted size
|
|
15
|
+
*/
|
|
16
|
+
static filesize(value: any, decimals?: number): string;
|
|
17
|
+
}
|
|
18
|
+
export function PicoFormatFilePlugin(self: any): typeof import("#src/utils/Format.js").PicoFormat;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export namespace OPTION_REGEX {
|
|
2
|
+
let entry: RegExp;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* @memberof PicoFormat
|
|
6
|
+
*/
|
|
7
|
+
export class PicoFormatOptionStatic {
|
|
8
|
+
/**
|
|
9
|
+
* Cast object to options string
|
|
10
|
+
*
|
|
11
|
+
* @example Format.castOptions({ a: 1 }) // => "a: 1;"
|
|
12
|
+
*
|
|
13
|
+
* @param {any} [options] Input options
|
|
14
|
+
* @param {boolean} [space] Add space
|
|
15
|
+
* @returns {string} Options string
|
|
16
|
+
*/
|
|
17
|
+
static castOptions(options?: any, space?: boolean): string;
|
|
18
|
+
/**
|
|
19
|
+
* Cast single option to string
|
|
20
|
+
*
|
|
21
|
+
* @example Format.castOption("a", 1) // => "a: 1"
|
|
22
|
+
*
|
|
23
|
+
* @param {string} key Option key
|
|
24
|
+
* @param {any} value Option value
|
|
25
|
+
* @param {string} [path] Key path
|
|
26
|
+
* @param {boolean} [space] Add space
|
|
27
|
+
* @returns {string} Option string
|
|
28
|
+
*/
|
|
29
|
+
static castOption(key: string, value: any, path?: string, space?: boolean): string;
|
|
30
|
+
/**
|
|
31
|
+
* Parse options string
|
|
32
|
+
*
|
|
33
|
+
* @example Format.parseOptions("a: 1;") // => { a: 1 }
|
|
34
|
+
*
|
|
35
|
+
* @param {string} value Options string
|
|
36
|
+
* @returns {any} Options object
|
|
37
|
+
*/
|
|
38
|
+
static parseOptions(value: string): any;
|
|
39
|
+
}
|
|
40
|
+
export function PicoFormatOptionPlugin(self: any): typeof import("#src/utils/Format.js").PicoFormat;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export namespace PARAM_REGEX {
|
|
2
|
+
let entry: RegExp;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* @memberof PicoFormat
|
|
6
|
+
* @extends {PicoFormat}
|
|
7
|
+
*/
|
|
8
|
+
export class PicoFormatParamStatic {
|
|
9
|
+
/**
|
|
10
|
+
* Cast object to params string
|
|
11
|
+
*
|
|
12
|
+
* @example Format.castParams({ a: 1 }) // => "a=1"
|
|
13
|
+
*
|
|
14
|
+
* @param {any} [params] Input params
|
|
15
|
+
* @returns {string} Params string
|
|
16
|
+
*/
|
|
17
|
+
static castParams(params?: any): string;
|
|
18
|
+
/**
|
|
19
|
+
* Cast single param to string
|
|
20
|
+
*
|
|
21
|
+
* @example Format.castParam("a", 1) // => "a=1"
|
|
22
|
+
*
|
|
23
|
+
* @param {string} key Param key
|
|
24
|
+
* @param {any} value Param value
|
|
25
|
+
* @param {string} [path] Key path
|
|
26
|
+
* @returns {string} Param string
|
|
27
|
+
*/
|
|
28
|
+
static castParam(key: string, value: any, path?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Parse params string
|
|
31
|
+
*
|
|
32
|
+
* @example Format.parseParams("a=1") // => { a: 1 }
|
|
33
|
+
*
|
|
34
|
+
* @param {string} value Params string
|
|
35
|
+
* @returns {any} Params object
|
|
36
|
+
*/
|
|
37
|
+
static parseParams(value: string): any;
|
|
38
|
+
}
|
|
39
|
+
export function PicoFormatParamPlugin(self: any): typeof import("#src/utils/Format.js").PicoFormat;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const TYPE_PARSERS: {
|
|
2
|
+
match: (val: any) => boolean;
|
|
3
|
+
parse: (val: any) => any;
|
|
4
|
+
}[];
|
|
5
|
+
export const TYPE_CASTERS: {
|
|
6
|
+
match: (val: any) => boolean;
|
|
7
|
+
parse: (val: any) => string;
|
|
8
|
+
}[];
|
|
9
|
+
/**
|
|
10
|
+
* @memberof PicoFormat
|
|
11
|
+
*/
|
|
12
|
+
export class PicoFormatParserStatic {
|
|
13
|
+
/**
|
|
14
|
+
* Convert key path format
|
|
15
|
+
*
|
|
16
|
+
* @example Format.keyed("a[b]") // => "a.b"
|
|
17
|
+
*
|
|
18
|
+
* @param {any} value Input key
|
|
19
|
+
* @param {any} [fallback] Fallback value
|
|
20
|
+
* @returns {string} Keyed string
|
|
21
|
+
*/
|
|
22
|
+
static keyed(value: any, fallback?: any): string;
|
|
23
|
+
/**
|
|
24
|
+
* Parse value by type
|
|
25
|
+
*
|
|
26
|
+
* @example Format.parsed("true") // => true
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value Input value
|
|
29
|
+
* @param {any} [fallback] Fallback value
|
|
30
|
+
* @param {Array<any>} [parsers] Custom parsers
|
|
31
|
+
* @returns {any} Parsed value
|
|
32
|
+
*/
|
|
33
|
+
static parsed(value: any, fallback?: any, parsers?: Array<any>): any;
|
|
34
|
+
/**
|
|
35
|
+
* Cast value to string
|
|
36
|
+
*
|
|
37
|
+
* @example Format.casted(true) // => "true"
|
|
38
|
+
*
|
|
39
|
+
* @param {any} value Input value
|
|
40
|
+
* @param {boolean} [encode] Encode value
|
|
41
|
+
* @param {Array<any>} [casters] Custom casters
|
|
42
|
+
* @returns {string} Casted string
|
|
43
|
+
*/
|
|
44
|
+
static casted(value: any, encode?: boolean, casters?: Array<any>): string;
|
|
45
|
+
}
|
|
46
|
+
export function PicoFormatParserPlugin(self: any): typeof import("#src/utils/Format.js").PicoFormat;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const SLUG_CONVERT: string[][];
|
|
2
|
+
/**
|
|
3
|
+
* @memberof PicoFormat
|
|
4
|
+
* @extends {PicoFormat}
|
|
5
|
+
*/
|
|
6
|
+
export class PicoFormatUrlStatic {
|
|
7
|
+
/**
|
|
8
|
+
* Create slug from string
|
|
9
|
+
*
|
|
10
|
+
* @example Format.slugify("Hello World") // => "hello-world"
|
|
11
|
+
*
|
|
12
|
+
* @param {any} value Input string
|
|
13
|
+
* @returns {string} Slug string
|
|
14
|
+
*/
|
|
15
|
+
static slugify(value: any): string;
|
|
16
|
+
}
|
|
17
|
+
export function PicoFormatUrlPlugin(self: any): typeof import("#src/utils/Format.js").PicoFormat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|