@leafer/interface 1.0.0-beta.6 → 1.0.0-beta.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/package.json +1 -1
- package/src/app/ILeafer.ts +1 -0
- package/src/canvas/ILeaferCanvas.ts +8 -3
- package/src/canvas/ISkiaCanvas.ts +1 -1
- package/src/display/IBranch.ts +1 -0
- package/src/display/ILeaf.ts +2 -0
- package/src/event/IEvent.ts +15 -2
- package/src/event/IUIEvent.ts +8 -0
- package/src/index.ts +2 -2
- package/src/interaction/IInteraction.ts +8 -3
- package/src/platform/IPlatform.ts +23 -2
- package/src/plugin/IPlugin.ts +3 -1
- package/src/watcher/IWatcher.ts +3 -1
package/package.json
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -146,13 +146,14 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
146
146
|
hittable?: boolean
|
|
147
147
|
|
|
148
148
|
bounds: IBounds
|
|
149
|
+
clientBounds: IBoundsData
|
|
149
150
|
|
|
150
151
|
config: ILeaferCanvasConfig
|
|
151
152
|
|
|
152
153
|
autoLayout: boolean
|
|
153
154
|
|
|
154
|
-
view:
|
|
155
|
-
parentView:
|
|
155
|
+
view: any
|
|
156
|
+
parentView: any
|
|
156
157
|
|
|
157
158
|
unreal?: boolean
|
|
158
159
|
|
|
@@ -175,6 +176,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
175
176
|
|
|
176
177
|
resize(size: IScreenSizeData): void
|
|
177
178
|
updateViewSize(): void
|
|
179
|
+
updateClientBounds(): void
|
|
178
180
|
|
|
179
181
|
// other
|
|
180
182
|
isSameSize(options: ILeaferCanvasConfig): boolean
|
|
@@ -187,7 +189,10 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
|
|
190
|
-
export
|
|
192
|
+
export interface IHitCanvas extends ILeaferCanvas {
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
191
196
|
|
|
192
197
|
export interface IBlobFunction {
|
|
193
198
|
(blob: IBlob | null): void
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IExportFileType, IExportImageType } from '../file/IFileType'
|
|
2
2
|
|
|
3
|
-
export type ICanvasType = 'skia' | 'canvas'
|
|
3
|
+
export type ICanvasType = 'skia' | 'canvas' | 'wx'
|
|
4
4
|
|
|
5
5
|
export interface ISkiaCanvas {
|
|
6
6
|
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>
|
package/src/display/IBranch.ts
CHANGED
package/src/display/ILeaf.ts
CHANGED
|
@@ -158,6 +158,8 @@ export interface ILeafComputedData {
|
|
|
158
158
|
// other
|
|
159
159
|
__childBranchNumber?: number // 存在子分支的个数
|
|
160
160
|
__complex?: boolean // 外观是否复杂
|
|
161
|
+
__naturalWidth?: number
|
|
162
|
+
__naturalHeight?: number
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
package/src/event/IEvent.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { IEventer } from './IEventer'
|
|
|
2
2
|
import { IWatchEventData } from '../watcher/IWatcher'
|
|
3
3
|
import { ILayoutBlockData } from '../layouter/ILayouter'
|
|
4
4
|
import { ILeaf } from '../display/ILeaf'
|
|
5
|
-
import { IScreenSizeData } from '../math/IMath'
|
|
5
|
+
import { IScreenSizeData, IPointData } from '../math/IMath'
|
|
6
6
|
|
|
7
7
|
export interface IEvent {
|
|
8
8
|
type?: string
|
|
@@ -95,4 +95,17 @@ export interface ITransformEvent extends IEvent, ITransformEventData {
|
|
|
95
95
|
readonly scaleY: number
|
|
96
96
|
readonly rotation: number
|
|
97
97
|
}
|
|
98
|
-
export type TransformMode = 'move' | 'zoom' | 'rotate'
|
|
98
|
+
export type TransformMode = 'move' | 'zoom' | 'rotate'
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
export interface IMultiTouchData {
|
|
102
|
+
move: IPointData,
|
|
103
|
+
scale: number,
|
|
104
|
+
angle: number,
|
|
105
|
+
center: IPointData
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface IKeepTouchData {
|
|
109
|
+
from: IPointData
|
|
110
|
+
to: IPointData
|
|
111
|
+
}
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { IObject } from '../data/IData'
|
|
|
2
2
|
import { ILeafList } from '../data/IList'
|
|
3
3
|
import { IEvent } from './IEvent'
|
|
4
4
|
import { ILeaferImage } from '../image/ILeaferImage'
|
|
5
|
+
import { ILeaf } from '../display/ILeaf'
|
|
6
|
+
import { IPointData } from '../math/IMath'
|
|
5
7
|
|
|
6
8
|
export interface IUIEvent extends IEvent {
|
|
7
9
|
x: number
|
|
@@ -22,6 +24,9 @@ export interface IUIEvent extends IEvent {
|
|
|
22
24
|
throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
|
|
23
25
|
|
|
24
26
|
origin?: IObject
|
|
27
|
+
|
|
28
|
+
getInner?(target?: ILeaf): IPointData
|
|
29
|
+
getLocal?(target?: ILeaf): IPointData
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
|
|
@@ -42,6 +47,9 @@ export interface IDragEvent extends IPointerEvent {
|
|
|
42
47
|
moveY: number
|
|
43
48
|
totalX: number
|
|
44
49
|
totalY: number
|
|
50
|
+
|
|
51
|
+
getInnerMove?(target?: ILeaf): IPointData
|
|
52
|
+
getLocalMove?(target?: ILeaf): IPointData
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
export interface IDropEvent extends IPointerEvent {
|
package/src/index.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { ITaskProcessor, ITaskProcessorConfig } from './task/ITaskProcessor'
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
export { IControl } from './control/IControl'
|
|
33
|
-
export { IPlatform } from './platform/IPlatform'
|
|
33
|
+
export { IPlatform, IMiniapp, IMiniappSelect, IMiniappSizeView } from './platform/IPlatform'
|
|
34
34
|
export { IPlugin } from './plugin/IPlugin'
|
|
35
35
|
|
|
36
36
|
|
|
@@ -44,7 +44,7 @@ export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnE
|
|
|
44
44
|
export { IExportFileType, IExportImageType } from './file/IFileType'
|
|
45
45
|
|
|
46
46
|
export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
47
|
-
export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode } from './event/IEvent'
|
|
47
|
+
export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode, IMultiTouchData, IKeepTouchData } from './event/IEvent'
|
|
48
48
|
export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
|
|
49
49
|
export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
|
|
50
50
|
|
|
@@ -6,6 +6,8 @@ import { IPointData } from '../math/IMath'
|
|
|
6
6
|
import { ISelector } from '../selector/ISelector'
|
|
7
7
|
import { IBounds } from '../math/IMath'
|
|
8
8
|
import { IControl } from '../control/IControl'
|
|
9
|
+
import { IKeepTouchData } from '../event/IEvent'
|
|
10
|
+
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
9
11
|
|
|
10
12
|
export interface IInteraction extends IControl {
|
|
11
13
|
target: ILeaf
|
|
@@ -23,12 +25,16 @@ export interface IInteraction extends IControl {
|
|
|
23
25
|
downData: IPointerEvent
|
|
24
26
|
downTime: number
|
|
25
27
|
|
|
28
|
+
receive(event: any): void
|
|
29
|
+
|
|
26
30
|
pointerDown(data: IPointerEvent): void
|
|
27
31
|
pointerMove(data: IPointerEvent): void
|
|
28
32
|
pointerMoveReal(data: IPointerEvent): void
|
|
29
33
|
pointerUp(data: IPointerEvent): void
|
|
30
34
|
pointerCancel(): void
|
|
31
35
|
|
|
36
|
+
multiTouch(data: IUIEvent, list: IKeepTouchData[]): void
|
|
37
|
+
|
|
32
38
|
move(data: IMoveEvent): void
|
|
33
39
|
zoom(data: IZoomEvent): void
|
|
34
40
|
rotate(data: IRotateEvent): void
|
|
@@ -36,9 +42,8 @@ export interface IInteraction extends IControl {
|
|
|
36
42
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
export interface IInteractionCanvas {
|
|
40
|
-
|
|
41
|
-
view: unknown
|
|
45
|
+
export interface IInteractionCanvas extends ILeaferCanvas {
|
|
46
|
+
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
export interface IInteractionConfig {
|
|
@@ -2,13 +2,17 @@ import { IFunction } from '../function/IFunction'
|
|
|
2
2
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
3
3
|
import { ILeaf } from '../display/ILeaf'
|
|
4
4
|
import { IExportFileType, IExportImageType } from '../file/IFileType'
|
|
5
|
+
import { IBoundsData, ISizeData } from '../math/IMath'
|
|
6
|
+
import { IObject } from '../data/IData'
|
|
5
7
|
|
|
6
8
|
export interface IPlatform {
|
|
9
|
+
name?: 'web' | 'node' | 'miniapp'
|
|
10
|
+
os?: 'Mac' | 'Windows' | 'Linux'
|
|
7
11
|
requestRender?(render: IFunction): void
|
|
8
12
|
canvas?: ILeaferCanvas
|
|
9
13
|
isWorker?: boolean
|
|
10
14
|
devicePixelRatio?: number
|
|
11
|
-
intWheelDeltaY?: boolean // firxfox need
|
|
15
|
+
intWheelDeltaY?: boolean // firxfox / Windows need
|
|
12
16
|
conicGradientSupport?: boolean
|
|
13
17
|
conicGradientRotate90?: boolean // fixfox need rotate
|
|
14
18
|
fullImageShadow?: boolean // safari need
|
|
@@ -20,5 +24,22 @@ export interface IPlatform {
|
|
|
20
24
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
|
|
21
25
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
|
|
22
26
|
loadImage(url: string): Promise<any>
|
|
23
|
-
}
|
|
27
|
+
},
|
|
28
|
+
miniapp?: IMiniapp
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export interface IMiniappSelect extends IObject { }
|
|
33
|
+
|
|
34
|
+
export interface IMiniappSizeView extends ISizeData {
|
|
35
|
+
view: any
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface IMiniapp {
|
|
39
|
+
select(name: string): IMiniappSelect
|
|
40
|
+
getBounds(select: IMiniappSelect): Promise<IBoundsData>
|
|
41
|
+
getSizeView(select: IMiniappSelect): Promise<IMiniappSizeView>
|
|
42
|
+
onWindowResize(fun: IFunction): void
|
|
43
|
+
offWindowResize(fun: IFunction): void
|
|
44
|
+
saveToAlbum(path: string): Promise<any>
|
|
24
45
|
}
|
package/src/plugin/IPlugin.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { ILeafer } from '../app/ILeafer'
|
|
1
2
|
import { IObject } from '../data/IData'
|
|
2
3
|
|
|
3
4
|
export interface IPlugin extends IObject {
|
|
4
5
|
name?: string
|
|
5
6
|
importVersion: string
|
|
6
7
|
import: string[]
|
|
7
|
-
run(LeaferUI: IObject): void
|
|
8
|
+
run(LeaferUI: IObject, config: IObject): void
|
|
9
|
+
onLeafer?(leafer: ILeafer): void
|
|
8
10
|
}
|
package/src/watcher/IWatcher.ts
CHANGED
|
@@ -12,16 +12,18 @@ export interface IWatcherConfig {
|
|
|
12
12
|
|
|
13
13
|
export interface IWatcher extends IControl {
|
|
14
14
|
target: ILeaf
|
|
15
|
-
updatedList: ILeafList
|
|
16
15
|
|
|
17
16
|
totalTimes: number
|
|
18
17
|
|
|
19
18
|
disabled: boolean
|
|
20
19
|
running: boolean
|
|
21
20
|
changed: boolean
|
|
21
|
+
hasRemoved: boolean
|
|
22
22
|
|
|
23
23
|
config: IWatcherConfig
|
|
24
24
|
|
|
25
|
+
updatedList: ILeafList
|
|
26
|
+
|
|
25
27
|
disable(): void
|
|
26
28
|
|
|
27
29
|
update(): void
|