@leafer/interface 1.0.0-alpha.1
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/LICENSE +21 -0
- package/README.md +1 -0
- package/package.json +19 -0
- package/src/app/ILeafer.ts +74 -0
- package/src/app/ISupperLeafer.ts +5 -0
- package/src/canvas/ICanvas.ts +344 -0
- package/src/canvas/ICanvasManager.ts +10 -0
- package/src/canvas/ICanvasPathDrawer.ts +16 -0
- package/src/canvas/IHitCanvasManager.ts +10 -0
- package/src/canvas/ILeaferCanvas.ts +163 -0
- package/src/data/IData.ts +27 -0
- package/src/data/ILeafData.ts +17 -0
- package/src/data/IList.ts +45 -0
- package/src/display/IBranch.ts +9 -0
- package/src/display/ILeaf.ts +191 -0
- package/src/display/IView.ts +9 -0
- package/src/display/module/ILeafBounds.ts +21 -0
- package/src/display/module/ILeafDataProxy.ts +11 -0
- package/src/display/module/ILeafEventer.ts +18 -0
- package/src/display/module/ILeafHit.ts +10 -0
- package/src/display/module/ILeafMatrix.ts +8 -0
- package/src/display/module/ILeafRender.ts +17 -0
- package/src/event/IEvent.ts +89 -0
- package/src/event/IEventer.ts +43 -0
- package/src/event/IUIEvent.ts +69 -0
- package/src/function/IFunction.ts +13 -0
- package/src/image/IImageManager.ts +3 -0
- package/src/image/ILeaferImage.ts +8 -0
- package/src/index.ts +48 -0
- package/src/interaction/IInteraction.ts +53 -0
- package/src/layout/ILeafLayout.ts +87 -0
- package/src/layouter/ILayouter.ts +52 -0
- package/src/math/IMath.ts +141 -0
- package/src/path/IPathCommand.ts +50 -0
- package/src/platform/IPlatform.ts +7 -0
- package/src/plugin/IPlugin.ts +11 -0
- package/src/renderer/IRenderer.ts +37 -0
- package/src/selector/ISelector.ts +28 -0
- package/src/watcher/IWatcher.ts +25 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type __Number = number // number | string will convert to number
|
|
2
|
+
export type __Boolean = boolean // boolean | string will convert to boolean
|
|
3
|
+
export type __String = string // string | other will convert to string
|
|
4
|
+
export type __Object = IObject // will convert to object
|
|
5
|
+
export type __Value = __Number | __Boolean | __String | __Object //
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export interface IObject {
|
|
9
|
+
[name: string]: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IBooleanMap {
|
|
13
|
+
[name: string]: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface INumberMap {
|
|
17
|
+
[name: string]: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IStringMap {
|
|
21
|
+
[name: string]: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IDataTypeHandle {
|
|
25
|
+
(target: any): void
|
|
26
|
+
}
|
|
27
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ILeaf, ILeafComputedData } from '../display/ILeaf'
|
|
2
|
+
import { IObject } from './IData'
|
|
3
|
+
|
|
4
|
+
export interface IDataProcessor extends IObject {
|
|
5
|
+
__leaf: ILeaf
|
|
6
|
+
__input: IObject
|
|
7
|
+
__middle: IObject
|
|
8
|
+
__setInput(name: string, value: unknown): void
|
|
9
|
+
__getInput(name: string): unknown
|
|
10
|
+
__setMiddle(name: string, value: unknown): void
|
|
11
|
+
__getMiddle(name: string): unknown
|
|
12
|
+
destroy(): void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
16
|
+
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ILeaf } from '../display/ILeaf'
|
|
2
|
+
import { INumberMap } from './IData'
|
|
3
|
+
|
|
4
|
+
export interface ILeafMap {
|
|
5
|
+
[name: string]: ILeaf
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ILeafArrayMap {
|
|
9
|
+
[name: string]: ILeaf[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ILeafListItemCallback = (item: ILeaf, index?: number) => void
|
|
13
|
+
|
|
14
|
+
export interface ILeafList {
|
|
15
|
+
list: ILeaf[]
|
|
16
|
+
keys: INumberMap
|
|
17
|
+
readonly length: number
|
|
18
|
+
has(leaf: ILeaf): boolean
|
|
19
|
+
indexAt(index: number): ILeaf
|
|
20
|
+
indexOf(leaf: ILeaf): number
|
|
21
|
+
unshift(leaf: ILeaf): void
|
|
22
|
+
pushList(list: ILeaf[]): void
|
|
23
|
+
push(leaf: ILeaf): void
|
|
24
|
+
sort(reverse?: boolean): void
|
|
25
|
+
remove(leaf: ILeaf): void
|
|
26
|
+
forEach(itemCallback: ILeafListItemCallback): void
|
|
27
|
+
clone(): ILeafList
|
|
28
|
+
reset(): void
|
|
29
|
+
destroy(): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ILeafLevelList {
|
|
33
|
+
levelMap: ILeafArrayMap
|
|
34
|
+
keys: INumberMap
|
|
35
|
+
levels: number[]
|
|
36
|
+
readonly length: number
|
|
37
|
+
has(leaf: ILeaf): boolean
|
|
38
|
+
without(leaf: ILeaf): boolean
|
|
39
|
+
sort(reverse?: boolean): void
|
|
40
|
+
pushList(list: ILeaf[]): void
|
|
41
|
+
push(leaf: ILeaf): void
|
|
42
|
+
forEach(itemCallback: ILeafListItemCallback): void
|
|
43
|
+
reset(): void
|
|
44
|
+
destroy(): void
|
|
45
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { ILeafer } from '../app/ILeafer'
|
|
2
|
+
import { IEventer } from '../event/IEventer'
|
|
3
|
+
|
|
4
|
+
import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
|
|
5
|
+
import { IRenderOptions } from '../renderer/IRenderer'
|
|
6
|
+
|
|
7
|
+
import { IObject, __Number, __Boolean, __Value, __String } from '../data/IData'
|
|
8
|
+
import { IMatrixWithBoundsData, IMatrix, IBoundsData, IRadiusPointData } from '../math/IMath'
|
|
9
|
+
import { IFunction } from '../function/IFunction'
|
|
10
|
+
|
|
11
|
+
import { ILeafDataProxy } from './module/ILeafDataProxy'
|
|
12
|
+
import { ILeafMatrix } from './module/ILeafMatrix'
|
|
13
|
+
import { ILeafBounds } from './module/ILeafBounds'
|
|
14
|
+
import { ILeafLayout } from '../layout/ILeafLayout'
|
|
15
|
+
import { ILeafHit } from './module/ILeafHit'
|
|
16
|
+
import { ILeafRender } from './module/ILeafRender'
|
|
17
|
+
import { ILeafData } from '../data/ILeafData'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export interface ICachedLeaf {
|
|
21
|
+
canvas: ILeaferCanvas,
|
|
22
|
+
matrix?: IMatrix,
|
|
23
|
+
bounds: IBoundsData
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ILeafAttrData {
|
|
27
|
+
// layer data
|
|
28
|
+
id: __String
|
|
29
|
+
name: __String
|
|
30
|
+
className: __String
|
|
31
|
+
|
|
32
|
+
opacity: __Number
|
|
33
|
+
visible: __Boolean
|
|
34
|
+
zIndex: __Number
|
|
35
|
+
|
|
36
|
+
// layout data
|
|
37
|
+
x: __Number
|
|
38
|
+
y: __Number
|
|
39
|
+
width: __Number
|
|
40
|
+
height: __Number
|
|
41
|
+
scaleX: __Number
|
|
42
|
+
scaleY: __Number
|
|
43
|
+
rotation: __Number
|
|
44
|
+
skewX: __Number
|
|
45
|
+
skewY: __Number
|
|
46
|
+
|
|
47
|
+
draggable: __Boolean
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ILeafInputData {
|
|
51
|
+
// layer data
|
|
52
|
+
id?: __String
|
|
53
|
+
name?: __String
|
|
54
|
+
className?: __String
|
|
55
|
+
|
|
56
|
+
opacity?: __Number
|
|
57
|
+
visible?: __Boolean
|
|
58
|
+
zIndex?: __Number
|
|
59
|
+
|
|
60
|
+
// layout data
|
|
61
|
+
x?: __Number
|
|
62
|
+
y?: __Number
|
|
63
|
+
width?: __Number
|
|
64
|
+
height?: __Number
|
|
65
|
+
scaleX?: __Number
|
|
66
|
+
scaleY?: __Number
|
|
67
|
+
rotation?: __Number
|
|
68
|
+
skewX?: __Number
|
|
69
|
+
skewY?: __Number
|
|
70
|
+
|
|
71
|
+
draggable?: __Boolean
|
|
72
|
+
}
|
|
73
|
+
export interface ILeafComputedData {
|
|
74
|
+
// layer data
|
|
75
|
+
id?: string
|
|
76
|
+
name?: string
|
|
77
|
+
className?: string
|
|
78
|
+
|
|
79
|
+
opacity?: number
|
|
80
|
+
visible?: boolean
|
|
81
|
+
zIndex?: number
|
|
82
|
+
|
|
83
|
+
// layout data
|
|
84
|
+
x?: number
|
|
85
|
+
y?: number
|
|
86
|
+
width?: number
|
|
87
|
+
height?: number
|
|
88
|
+
scaleX?: number
|
|
89
|
+
scaleY?: number
|
|
90
|
+
rotation?: number
|
|
91
|
+
skewX?: number
|
|
92
|
+
skewY?: number
|
|
93
|
+
|
|
94
|
+
draggable?: boolean
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
98
|
+
readonly tag: string
|
|
99
|
+
readonly __DataProcessor: IObject // IDataProcessor
|
|
100
|
+
readonly __LayoutProcessor: IObject // ILeafLayout
|
|
101
|
+
|
|
102
|
+
leafer?: ILeafer
|
|
103
|
+
root?: ILeaf
|
|
104
|
+
parent?: ILeaf
|
|
105
|
+
|
|
106
|
+
__interactionOff?: boolean
|
|
107
|
+
__childrenInteractionOff?: boolean
|
|
108
|
+
|
|
109
|
+
__isRoot?: boolean
|
|
110
|
+
__isBranch?: boolean
|
|
111
|
+
__isBranchLeaf?: boolean
|
|
112
|
+
|
|
113
|
+
__: ILeafData
|
|
114
|
+
__layout: ILeafLayout
|
|
115
|
+
|
|
116
|
+
__relative: IMatrixWithBoundsData
|
|
117
|
+
__world: IMatrixWithBoundsData
|
|
118
|
+
|
|
119
|
+
__worldOpacity: number
|
|
120
|
+
__renderTime: number // μs 1000微秒 = 1毫秒
|
|
121
|
+
__complex: boolean // 外观是否复杂, 将调用__drawComplex()
|
|
122
|
+
|
|
123
|
+
__level: number // 图层级别 root(1) -> hight
|
|
124
|
+
__tempNumber?: number // 用于临时运算储存状态
|
|
125
|
+
|
|
126
|
+
__hitCanvas?: IHitCanvas
|
|
127
|
+
|
|
128
|
+
__parentWait?: IFunction[]
|
|
129
|
+
|
|
130
|
+
__addParentWait(item: IFunction): void
|
|
131
|
+
__runParentWait(): void
|
|
132
|
+
|
|
133
|
+
__setAsLeafer(): void
|
|
134
|
+
__setAsRoot(): void
|
|
135
|
+
|
|
136
|
+
__bindRoot(root: ILeaf): void
|
|
137
|
+
|
|
138
|
+
// ILeafData ->
|
|
139
|
+
__set(attrName: string, newValue: __Value): void
|
|
140
|
+
__get(attrName: string): __Value
|
|
141
|
+
__updateAttr(attrName: string): void
|
|
142
|
+
|
|
143
|
+
// ILeafMatrix ->
|
|
144
|
+
__updateWorldMatrix(): void
|
|
145
|
+
__updateRelativeMatrix(): void
|
|
146
|
+
|
|
147
|
+
// ILeafBounds ->
|
|
148
|
+
__updateWorldBounds(): void
|
|
149
|
+
|
|
150
|
+
__updateRelativeBoxBounds(): void
|
|
151
|
+
__updateRelativeEventBounds(): void
|
|
152
|
+
__updateRelativeRenderBounds(): void
|
|
153
|
+
|
|
154
|
+
__updateBoxBounds(): void
|
|
155
|
+
__updateEventBounds(): void
|
|
156
|
+
__updateRenderBounds(): void
|
|
157
|
+
|
|
158
|
+
__updateEventBoundsSpreadWidth(): number
|
|
159
|
+
__updateRenderBoundsSpreadWidth(): number
|
|
160
|
+
|
|
161
|
+
__onUpdateSize(): void
|
|
162
|
+
|
|
163
|
+
// ILeafHit ->
|
|
164
|
+
__hitWorld(point: IRadiusPointData): boolean
|
|
165
|
+
__hit(local: IRadiusPointData): boolean
|
|
166
|
+
__updateHitCanvas(): void
|
|
167
|
+
|
|
168
|
+
// ILeafRender ->
|
|
169
|
+
__render(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
170
|
+
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
171
|
+
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
172
|
+
|
|
173
|
+
__updateWorldOpacity(): void
|
|
174
|
+
__updateChange(): void
|
|
175
|
+
|
|
176
|
+
// path
|
|
177
|
+
__drawPath(canvas: ILeaferCanvas): void
|
|
178
|
+
__drawRenderPath(canvas: ILeaferCanvas): void
|
|
179
|
+
__updatePath(): void
|
|
180
|
+
__updateRenderPath(): void
|
|
181
|
+
|
|
182
|
+
// branch
|
|
183
|
+
children?: ILeaf[]
|
|
184
|
+
__childBranchNumber?: number // 存在子分支的个数
|
|
185
|
+
|
|
186
|
+
__updateSortChildren(): void
|
|
187
|
+
add(child: ILeaf, index?: number): void
|
|
188
|
+
remove(child?: ILeaf): void
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ILeaf } from '../ILeaf'
|
|
2
|
+
|
|
3
|
+
export type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>
|
|
4
|
+
|
|
5
|
+
export interface ILeafBounds {
|
|
6
|
+
__updateWorldBounds?(): void
|
|
7
|
+
|
|
8
|
+
__updateRelativeBoxBounds?(): void
|
|
9
|
+
__updateRelativeEventBounds?(): void
|
|
10
|
+
__updateRelativeRenderBounds?(): void
|
|
11
|
+
|
|
12
|
+
__updateBoxBounds?(): void
|
|
13
|
+
__updateEventBounds?(): void
|
|
14
|
+
__updateRenderBounds?(): void
|
|
15
|
+
|
|
16
|
+
__updateEventBoundsSpreadWidth?(): number
|
|
17
|
+
__updateRenderBoundsSpreadWidth?(): number
|
|
18
|
+
|
|
19
|
+
__onUpdateSize?(): void
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ILeaf } from '../ILeaf'
|
|
2
|
+
import { __Value } from '../../data/IData'
|
|
3
|
+
|
|
4
|
+
export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
|
|
5
|
+
|
|
6
|
+
export interface ILeafDataProxy {
|
|
7
|
+
__set?(attrName: string, newValue: __Value): void
|
|
8
|
+
__get?(attrName: string): __Value
|
|
9
|
+
__updateAttr?(attrName: string): void
|
|
10
|
+
}
|
|
11
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ILeaf } from '../ILeaf'
|
|
2
|
+
import { IEventListener, IEventListenerId, IEventListenerOptions } from '../../event/IEventer'
|
|
3
|
+
import { } from '@leafer/interface'
|
|
4
|
+
import { IEvent } from '../../event/IEvent'
|
|
5
|
+
import { IObject } from '../../data/IData'
|
|
6
|
+
|
|
7
|
+
export type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>
|
|
8
|
+
|
|
9
|
+
export interface ILeafEventer {
|
|
10
|
+
on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
|
|
11
|
+
off?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
|
|
12
|
+
on__?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
|
|
13
|
+
off__?(id: IEventListenerId | IEventListenerId[]): void
|
|
14
|
+
once?(type: string | string[], listener: IEventListener, capture?: boolean): void
|
|
15
|
+
emit?(type: string, event?: IEvent | IObject, capture?: boolean): void
|
|
16
|
+
emitEvent?(event?: IEvent, capture?: boolean): void
|
|
17
|
+
hasEvent?(type: string, capture?: boolean): boolean
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IRadiusPointData } from '../../math/IMath'
|
|
2
|
+
import { ILeaf } from '../ILeaf'
|
|
3
|
+
|
|
4
|
+
export type ILeafHitModule = ILeafHit & ThisType<ILeaf>
|
|
5
|
+
|
|
6
|
+
export interface ILeafHit {
|
|
7
|
+
__hitWorld?(point: IRadiusPointData): boolean
|
|
8
|
+
__hit?(local: IRadiusPointData): boolean
|
|
9
|
+
__updateHitCanvas?(): void
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
|
|
2
|
+
import { IRenderOptions } from '../../renderer/IRenderer'
|
|
3
|
+
import { ILeaf } from '../ILeaf'
|
|
4
|
+
|
|
5
|
+
export type ILeafRenderModule = ILeafRender & ThisType<ILeaf>
|
|
6
|
+
|
|
7
|
+
export interface ILeafRender {
|
|
8
|
+
__render?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
9
|
+
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
10
|
+
__draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
11
|
+
|
|
12
|
+
__drawBefore?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
13
|
+
__drawAfter?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
14
|
+
|
|
15
|
+
__updateWorldOpacity?(): void
|
|
16
|
+
__updateChange?(): void
|
|
17
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { IEventer } from './IEventer'
|
|
2
|
+
import { IWatchEventData } from '../watcher/IWatcher'
|
|
3
|
+
import { ILayoutBlockData } from '../layouter/ILayouter'
|
|
4
|
+
import { ILeaf } from '../display/ILeaf'
|
|
5
|
+
import { IScreenSizeData } from '../math/IMath'
|
|
6
|
+
|
|
7
|
+
export interface IEvent {
|
|
8
|
+
type: string
|
|
9
|
+
target: IEventTarget
|
|
10
|
+
current: IEventTarget
|
|
11
|
+
|
|
12
|
+
bubbles?: boolean
|
|
13
|
+
phase?: number
|
|
14
|
+
|
|
15
|
+
isStopDefault: boolean
|
|
16
|
+
isStop: boolean
|
|
17
|
+
isStopNow: boolean
|
|
18
|
+
stopDefault(): void
|
|
19
|
+
stopNow(): void
|
|
20
|
+
stop(): void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IEventTarget extends IEventer {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IRenderEvent {
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface IChildEvent extends IEvent {
|
|
32
|
+
parent?: ILeaf
|
|
33
|
+
child?: ILeaf
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface IResizeEvent extends IEvent {
|
|
37
|
+
readonly width: number
|
|
38
|
+
readonly height: number
|
|
39
|
+
readonly pixelRatio: number
|
|
40
|
+
|
|
41
|
+
readonly bigger: boolean
|
|
42
|
+
readonly smaller: boolean
|
|
43
|
+
readonly samePixelRatio: boolean
|
|
44
|
+
readonly old: IScreenSizeData
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface IResizeEventListener {
|
|
48
|
+
(event: IResizeEvent): void
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IUpdateEvent extends IEvent {
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface IAttrEvent extends IEvent {
|
|
56
|
+
readonly attrName: string
|
|
57
|
+
readonly oldValue: unknown
|
|
58
|
+
readonly newValue: unknown
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ILayoutEvent extends IEvent {
|
|
62
|
+
readonly data: ILayoutBlockData[]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IWatchEvent extends IEvent {
|
|
66
|
+
readonly data: IWatchEventData
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface ITransformEventData {
|
|
70
|
+
x: number
|
|
71
|
+
y: number
|
|
72
|
+
scaleX: number
|
|
73
|
+
scaleY: number
|
|
74
|
+
rotation: number
|
|
75
|
+
|
|
76
|
+
readonly zooming: boolean
|
|
77
|
+
readonly moving: boolean
|
|
78
|
+
readonly rotating: boolean
|
|
79
|
+
readonly changing: boolean
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface ITransformEvent extends IEvent, ITransformEventData {
|
|
83
|
+
readonly x: number
|
|
84
|
+
readonly y: number
|
|
85
|
+
readonly scaleX: number
|
|
86
|
+
readonly scaleY: number
|
|
87
|
+
readonly rotation: number
|
|
88
|
+
}
|
|
89
|
+
export type TransformMode = 'move' | 'zoom' | 'rotate'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IEvent, IFunction, IObject } from '@leafer/interface'
|
|
2
|
+
import { LeafEventer } from '../display/module/ILeafEventer'
|
|
3
|
+
|
|
4
|
+
export type IEventListener = IFunction
|
|
5
|
+
|
|
6
|
+
export interface IEventListenerOptions {
|
|
7
|
+
capture?: boolean
|
|
8
|
+
once?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IEventListenerItem extends IEventListenerOptions {
|
|
12
|
+
listener: IEventListener
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IEventListenerMap {
|
|
16
|
+
[name: string]: IEventListenerItem[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IEventListenerId {
|
|
20
|
+
type: string | string[]
|
|
21
|
+
listener: IEventListener
|
|
22
|
+
options?: IEventListenerOptions | boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type InnerId = number
|
|
26
|
+
|
|
27
|
+
export interface IEventer extends LeafEventer {
|
|
28
|
+
|
|
29
|
+
readonly innerId: InnerId
|
|
30
|
+
__captureMap?: IEventListenerMap
|
|
31
|
+
__bubbleMap?: IEventListenerMap
|
|
32
|
+
|
|
33
|
+
on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
|
|
34
|
+
off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
|
|
35
|
+
on__(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
|
|
36
|
+
off__(id: IEventListenerId | IEventListenerId[]): void
|
|
37
|
+
once(type: string | string[], listener: IEventListener): void
|
|
38
|
+
emit(type: string, event?: IEvent | IObject, capture?: boolean): void
|
|
39
|
+
emitEvent(event?: IEvent, capture?: boolean): void
|
|
40
|
+
hasEvent(type: string, capture?: boolean): boolean
|
|
41
|
+
|
|
42
|
+
destroy(): void
|
|
43
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ILeafList } from '../data/IList'
|
|
2
|
+
import { IEvent } from './IEvent'
|
|
3
|
+
|
|
4
|
+
export interface IUIEvent extends IEvent {
|
|
5
|
+
x: number
|
|
6
|
+
y: number
|
|
7
|
+
|
|
8
|
+
altKey: boolean
|
|
9
|
+
ctrlKey: boolean
|
|
10
|
+
shiftKey: boolean
|
|
11
|
+
metaKey: boolean
|
|
12
|
+
readonly spaceKey: boolean
|
|
13
|
+
|
|
14
|
+
readonly left: boolean
|
|
15
|
+
readonly right: boolean
|
|
16
|
+
readonly middle: boolean
|
|
17
|
+
buttons: number
|
|
18
|
+
|
|
19
|
+
path: ILeafList
|
|
20
|
+
throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
|
|
21
|
+
|
|
22
|
+
stopDefault(): void
|
|
23
|
+
stopNow(): void
|
|
24
|
+
stop(): void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export interface IPointerEvent extends IUIEvent {
|
|
29
|
+
width: number
|
|
30
|
+
height: number
|
|
31
|
+
pointerType: PointerType
|
|
32
|
+
pressure: number
|
|
33
|
+
tangentialPressure?: number
|
|
34
|
+
tiltX?: number
|
|
35
|
+
tiltY?: number
|
|
36
|
+
twist?: number
|
|
37
|
+
}
|
|
38
|
+
export type PointerType = 'mouse' | 'pen' | 'touch'
|
|
39
|
+
|
|
40
|
+
export interface IDragEvent extends IPointerEvent {
|
|
41
|
+
moveX: number
|
|
42
|
+
moveY: number
|
|
43
|
+
totalX: number
|
|
44
|
+
totalY: number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface IDropEvent extends IPointerEvent {
|
|
48
|
+
list: ILeafList
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IRotateEvent extends IUIEvent {
|
|
52
|
+
rotation: number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface IZoomEvent extends IUIEvent {
|
|
56
|
+
scale: number
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface IMoveEvent extends IDragEvent {
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ISwipeEvent extends IDragEvent {
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface IKeyEvent extends IUIEvent {
|
|
68
|
+
|
|
69
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export { ISupperLeafer } from './app/ISupperLeafer'
|
|
2
|
+
export { ILeafer, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
|
|
3
|
+
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf } from './display/ILeaf'
|
|
4
|
+
export { IBranch } from './display/IBranch'
|
|
5
|
+
export { IZoomView } from './display/IView'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export { ILeafData, IDataProcessor } from './data/ILeafData'
|
|
9
|
+
export { ILeafLayout, ILayoutLocationType, ILayoutBoundsType } from './layout/ILeafLayout'
|
|
10
|
+
|
|
11
|
+
export { ILeafDataProxy, ILeafDataProxyModule } from './display/module/ILeafDataProxy'
|
|
12
|
+
export { ILeafMatrix, ILeafMatrixModule } from './display/module/ILeafMatrix'
|
|
13
|
+
export { ILeafBounds, ILeafBoundsModule } from './display/module/ILeafBounds'
|
|
14
|
+
export { ILeafHit, ILeafHitModule } from './display/module/ILeafHit'
|
|
15
|
+
export { ILeafRender, ILeafRenderModule } from './display/module/ILeafRender'
|
|
16
|
+
export { ILeafEventer, ILeafEventerModule } from './display/module/ILeafEventer'
|
|
17
|
+
|
|
18
|
+
export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
|
|
19
|
+
export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
|
|
20
|
+
export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
|
|
21
|
+
export { ISelector, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
|
|
22
|
+
|
|
23
|
+
export { ICanvasManager } from './canvas/ICanvasManager'
|
|
24
|
+
export { IHitCanvasManager } from './canvas/IHitCanvasManager'
|
|
25
|
+
export { IImageManager } from './image/IImageManager'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export { IPlatform } from './platform/IPlatform'
|
|
29
|
+
export { IPlugin } from './plugin/IPlugin'
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasContext, ILeaferCanvasConfig, IHitCanvasConfig } from './canvas/ILeaferCanvas'
|
|
33
|
+
export { ICanvasDrawPath } from './canvas/ICanvasPathDrawer'
|
|
34
|
+
export { CanvasFillRule, CanvasRenderingContext2D, TextMetrics, Path2D } from './canvas/ICanvas'
|
|
35
|
+
export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
|
|
36
|
+
|
|
37
|
+
export { ILeaferImage, ILeaferImageConfig } from './image/ILeaferImage'
|
|
38
|
+
|
|
39
|
+
export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
40
|
+
export { IEventTarget, IEvent, IAttrEvent, ILayoutEvent, IRenderEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode } from './event/IEvent'
|
|
41
|
+
export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent } from './event/IUIEvent'
|
|
42
|
+
export { IInteraction, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export { __Number, __Boolean, __String, __Object, __Value, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
|
|
46
|
+
export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
|
|
47
|
+
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData } from './math/IMath'
|
|
48
|
+
export { IFunction } from './function/IFunction'
|