@thienvu18/designable-shared 2.0.0 → 2.0.2
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/esm/animation.d.ts +8 -2
- package/esm/animation.js +29 -30
- package/esm/array.d.ts +163 -37
- package/esm/array.js +104 -87
- package/esm/clone.d.ts +4 -4
- package/esm/clone.js +79 -86
- package/esm/compose.d.ts +3 -1
- package/esm/compose.js +6 -6
- package/esm/coordinate.d.ts +120 -76
- package/esm/coordinate.js +480 -411
- package/esm/element.d.ts +11 -6
- package/esm/element.js +123 -125
- package/esm/event.d.ts +162 -75
- package/esm/event.js +197 -197
- package/esm/globalThisPolyfill.d.ts +1 -1
- package/esm/globalThisPolyfill.js +14 -17
- package/esm/index.d.ts +17 -17
- package/esm/index.js +17 -17
- package/esm/instanceof.d.ts +1 -1
- package/esm/instanceof.js +9 -10
- package/esm/keycode.d.ts +145 -145
- package/esm/keycode.js +149 -149
- package/esm/lru.d.ts +50 -47
- package/esm/lru.js +236 -245
- package/esm/observer.d.ts +7 -7
- package/esm/observer.js +37 -40
- package/esm/request-idle.d.ts +9 -6
- package/esm/request-idle.js +6 -6
- package/esm/scroller.d.ts +24 -8
- package/esm/scroller.js +78 -75
- package/esm/subscribable.d.ts +10 -10
- package/esm/subscribable.js +39 -40
- package/esm/types.d.ts +13 -13
- package/esm/types.js +19 -20
- package/esm/uid.d.ts +1 -1
- package/esm/uid.js +7 -7
- package/lib/animation.d.ts +8 -2
- package/lib/animation.js +34 -35
- package/lib/array.d.ts +163 -37
- package/lib/array.js +129 -101
- package/lib/clone.d.ts +4 -4
- package/lib/clone.js +84 -91
- package/lib/compose.d.ts +3 -1
- package/lib/compose.js +10 -10
- package/lib/coordinate.d.ts +120 -76
- package/lib/coordinate.js +538 -440
- package/lib/element.d.ts +11 -6
- package/lib/element.js +139 -133
- package/lib/event.d.ts +162 -75
- package/lib/event.js +206 -202
- package/lib/globalThisPolyfill.d.ts +1 -1
- package/lib/globalThisPolyfill.js +17 -20
- package/lib/index.d.ts +17 -17
- package/lib/index.js +49 -33
- package/lib/instanceof.d.ts +1 -1
- package/lib/instanceof.js +13 -14
- package/lib/keycode.d.ts +145 -145
- package/lib/keycode.js +153 -153
- package/lib/lru.d.ts +50 -47
- package/lib/lru.js +240 -249
- package/lib/observer.d.ts +7 -7
- package/lib/observer.js +41 -44
- package/lib/request-idle.d.ts +9 -6
- package/lib/request-idle.js +14 -11
- package/lib/scroller.d.ts +24 -8
- package/lib/scroller.js +89 -81
- package/lib/subscribable.d.ts +10 -10
- package/lib/subscribable.js +43 -44
- package/lib/types.d.ts +13 -13
- package/lib/types.js +40 -28
- package/lib/uid.d.ts +1 -1
- package/lib/uid.js +11 -11
- package/package.json +15 -15
package/lib/compose.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.compose = void 0
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.compose = void 0
|
|
4
4
|
const compose = (...fns) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
exports.compose = compose
|
|
5
|
+
return (payload) => {
|
|
6
|
+
return fns.reduce((buf, fn) => {
|
|
7
|
+
return fn(buf)
|
|
8
|
+
}, payload)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.compose = compose
|
package/lib/coordinate.d.ts
CHANGED
|
@@ -1,106 +1,150 @@
|
|
|
1
1
|
export interface IPoint {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
x: number
|
|
3
|
+
y: number
|
|
4
4
|
}
|
|
5
5
|
export interface ISize {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
width: number
|
|
7
|
+
height: number
|
|
8
8
|
}
|
|
9
9
|
export interface ILineSegment {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
start: IPoint
|
|
11
|
+
end: IPoint
|
|
12
12
|
}
|
|
13
13
|
export interface IRectEdgeLines {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
v: ILineSegment[]
|
|
15
|
+
h: ILineSegment[]
|
|
16
16
|
}
|
|
17
|
-
export declare function isRect(rect: any): rect is IRect
|
|
18
|
-
export declare function isPoint(val: any): val is IPoint
|
|
19
|
-
export declare function isLineSegment(val: any): val is ILineSegment
|
|
17
|
+
export declare function isRect(rect: any): rect is IRect
|
|
18
|
+
export declare function isPoint(val: any): val is IPoint
|
|
19
|
+
export declare function isLineSegment(val: any): val is ILineSegment
|
|
20
20
|
export declare class Point implements IPoint {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
x: number
|
|
22
|
+
y: number
|
|
23
|
+
constructor(x: number, y: number)
|
|
24
24
|
}
|
|
25
25
|
export declare class Rect implements IRect {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
x: number
|
|
27
|
+
y: number
|
|
28
|
+
width: number
|
|
29
|
+
height: number
|
|
30
|
+
constructor(x: number, y: number, width: number, height: number)
|
|
31
|
+
get left(): number
|
|
32
|
+
get right(): number
|
|
33
|
+
get top(): number
|
|
34
|
+
get bottom(): number
|
|
35
35
|
}
|
|
36
36
|
export declare class LineSegment {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
start: IPoint
|
|
38
|
+
end: IPoint
|
|
39
|
+
constructor(start: IPoint, end: IPoint)
|
|
40
40
|
}
|
|
41
41
|
export interface IRect {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
x: number
|
|
43
|
+
y: number
|
|
44
|
+
width: number
|
|
45
|
+
height: number
|
|
46
46
|
}
|
|
47
47
|
export declare enum RectQuadrant {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
Inner1 = 'I1',
|
|
49
|
+
Inner2 = 'I2',
|
|
50
|
+
Inner3 = 'I3',
|
|
51
|
+
Inner4 = 'I4',
|
|
52
|
+
Outer1 = 'O1',
|
|
53
|
+
Outer2 = 'O2',
|
|
54
|
+
Outer3 = 'O3',
|
|
55
|
+
Outer4 = 'O4',
|
|
56
56
|
}
|
|
57
57
|
export interface IPointToRectRelative {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
quadrant: RectQuadrant
|
|
59
|
+
distance: number
|
|
60
60
|
}
|
|
61
|
-
export declare function isPointInRect(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
export declare function isPointInRect(
|
|
62
|
+
point: IPoint,
|
|
63
|
+
rect: IRect,
|
|
64
|
+
sensitive?: boolean
|
|
65
|
+
): boolean
|
|
66
|
+
export declare function isEqualRect(target: IRect, source: IRect): boolean
|
|
67
|
+
export declare function getRectPoints(source: IRect): Point[]
|
|
68
|
+
export declare function isRectInRect(target: IRect, source: IRect): boolean
|
|
69
|
+
export declare function isCrossRectInRect(target: IRect, source: IRect): boolean
|
|
66
70
|
/**
|
|
67
71
|
* 计算点在矩形的哪个象限
|
|
68
72
|
* @param point
|
|
69
73
|
* @param rect
|
|
70
74
|
*/
|
|
71
|
-
export declare function calcQuadrantOfPointToRect(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
export declare function calcQuadrantOfPointToRect(
|
|
76
|
+
point: IPoint,
|
|
77
|
+
rect: IRect
|
|
78
|
+
): RectQuadrant
|
|
79
|
+
export declare function calcDistanceOfPointToRect(
|
|
80
|
+
point: IPoint,
|
|
81
|
+
rect: IRect
|
|
82
|
+
): number
|
|
83
|
+
export declare function calcDistancePointToEdge(
|
|
84
|
+
point: IPoint,
|
|
85
|
+
rect: IRect
|
|
86
|
+
): number
|
|
87
|
+
export declare function isNearAfter(
|
|
88
|
+
point: IPoint,
|
|
89
|
+
rect: IRect,
|
|
90
|
+
inline?: boolean
|
|
91
|
+
): boolean
|
|
75
92
|
/**
|
|
76
93
|
* 计算点鱼矩形的相对位置信息
|
|
77
94
|
* @param point
|
|
78
95
|
* @param rect
|
|
79
96
|
*/
|
|
80
|
-
export declare function calcRelativeOfPointToRect(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
export declare function
|
|
85
|
-
export declare function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
export declare function calcRelativeOfPointToRect(
|
|
98
|
+
point: IPoint,
|
|
99
|
+
rect: IRect
|
|
100
|
+
): IPointToRectRelative
|
|
101
|
+
export declare function calcBoundingRect(rects: IRect[]): Rect
|
|
102
|
+
export declare function calcRectByStartEndPoint(
|
|
103
|
+
startPoint: IPoint,
|
|
104
|
+
endPoint: IPoint,
|
|
105
|
+
scrollX?: number,
|
|
106
|
+
scrollY?: number
|
|
107
|
+
): Rect
|
|
108
|
+
export declare function calcEdgeLinesOfRect(rect: IRect): IRectEdgeLines
|
|
109
|
+
export declare function calcRectOfAxisLineSegment(line: ILineSegment): Rect
|
|
110
|
+
export declare function calcSpaceBlockOfRect(
|
|
111
|
+
target: IRect,
|
|
112
|
+
source: IRect,
|
|
113
|
+
type?: string
|
|
114
|
+
): {
|
|
115
|
+
type: string
|
|
116
|
+
distance: number
|
|
117
|
+
rect: Rect
|
|
118
|
+
}
|
|
119
|
+
export declare function calcExtendsLineSegmentOfRect(
|
|
120
|
+
targetRect: Rect,
|
|
121
|
+
referRect: Rect
|
|
122
|
+
): {
|
|
123
|
+
start: {
|
|
124
|
+
x: number
|
|
125
|
+
y: number
|
|
126
|
+
}
|
|
127
|
+
end: {
|
|
128
|
+
x: number
|
|
129
|
+
y: number
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export declare function calcOffsetOfSnapLineSegmentToEdge(
|
|
133
|
+
line: ILineSegment,
|
|
134
|
+
current: IRect
|
|
135
|
+
): {
|
|
136
|
+
x: number
|
|
137
|
+
y: number
|
|
138
|
+
}
|
|
139
|
+
export declare function calcDistanceOfSnapLineToEdges(
|
|
140
|
+
line: ILineSegment,
|
|
141
|
+
edges: IRectEdgeLines
|
|
142
|
+
): number
|
|
143
|
+
export declare function calcCombineSnapLineSegment(
|
|
144
|
+
target: ILineSegment,
|
|
145
|
+
source: ILineSegment
|
|
146
|
+
): ILineSegment
|
|
147
|
+
export declare function calcClosestEdges(
|
|
148
|
+
line: ILineSegment,
|
|
149
|
+
edges: IRectEdgeLines
|
|
150
|
+
): [number, ILineSegment]
|