@leafer/interface 1.0.0-rc.2 → 1.0.0-rc.20
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/IApp.ts +3 -3
- package/src/app/ILeafer.ts +44 -20
- package/src/canvas/ICanvas.ts +7 -2
- package/src/canvas/IHitCanvasManager.ts +3 -3
- package/src/canvas/ILeaferCanvas.ts +19 -11
- package/src/canvas/ISkiaCanvas.ts +20 -1
- package/src/data/IData.ts +6 -5
- package/src/data/ILeafData.ts +11 -6
- package/src/data/IList.ts +9 -6
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +266 -93
- package/src/display/IView.ts +2 -6
- package/src/display/module/IBranchRender.ts +2 -2
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/display/module/ILeafDataProxy.ts +5 -3
- package/src/display/module/ILeafHit.ts +4 -1
- package/src/display/module/ILeafRender.ts +2 -1
- package/src/event/IEvent.ts +3 -23
- package/src/event/IEventer.ts +6 -1
- package/src/event/IUIEvent.ts +11 -8
- package/src/file/IExport.ts +34 -0
- package/src/file/IFileType.ts +1 -1
- package/src/function/IFunction.ts +9 -0
- package/src/image/IImageManager.ts +4 -0
- package/src/image/ILeaferImage.ts +13 -0
- package/src/index.ts +16 -15
- package/src/interaction/ICursor.ts +16 -0
- package/src/interaction/IInteraction.ts +33 -4
- package/src/layout/ILeafLayout.ts +30 -14
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +72 -35
- package/src/path/IPathDrawer.ts +6 -3
- package/src/platform/IPlatform.ts +17 -2
- package/src/plugin/IPlugin.ts +2 -2
- package/src/renderer/IRenderer.ts +4 -2
- package/src/selector/ISelector.ts +26 -9
- package/types/index.d.ts +619 -325
- package/src/display/module/ILeafMask.ts +0 -12
package/package.json
CHANGED
package/src/app/IApp.ts
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -1,42 +1,40 @@
|
|
|
1
|
-
import { ILeaf } from '../display/ILeaf'
|
|
1
|
+
import { ILeaf, ICursorType } from '../display/ILeaf'
|
|
2
2
|
import { IRenderer, IRendererConfig } from '../renderer/IRenderer'
|
|
3
3
|
import { IHitCanvas, ILeaferCanvas, ILeaferCanvasConfig, IHitCanvasConfig } from '../canvas/ILeaferCanvas'
|
|
4
4
|
import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
|
|
5
5
|
import { ISelector, ISelectorConfig } from '../selector/ISelector'
|
|
6
6
|
import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction'
|
|
7
7
|
import { IWatcher, IWatcherConfig } from '../watcher/IWatcher'
|
|
8
|
-
import { IAutoBounds, IScreenSizeData } from '../math/IMath'
|
|
8
|
+
import { IAutoBounds, IBoundsData, IPointData, IScreenSizeData, IBounds } from '../math/IMath'
|
|
9
9
|
import { ICanvasManager } from '../canvas/ICanvasManager'
|
|
10
10
|
import { IHitCanvasManager } from '../canvas/IHitCanvasManager'
|
|
11
11
|
import { IEventListenerId } from '../event/IEventer'
|
|
12
|
-
import { IObject } from '../data/IData'
|
|
12
|
+
import { IFourNumber, IObject } from '../data/IData'
|
|
13
13
|
import { IZoomView } from '../display/IView'
|
|
14
|
-
import {
|
|
14
|
+
import { IAppBase } from './IApp'
|
|
15
15
|
import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
|
|
16
16
|
import { IControl } from '../control/IControl'
|
|
17
17
|
import { IFunction } from '../function/IFunction'
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
export type ILeaferType = 'draw' | 'design' | 'board' | 'document' | '
|
|
20
|
+
export type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart'
|
|
21
21
|
export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
22
22
|
start?: boolean
|
|
23
23
|
type?: ILeaferType
|
|
24
24
|
realCanvas?: boolean
|
|
25
|
+
lazySpeard?: IFourNumber
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export interface
|
|
28
|
-
|
|
29
|
-
readonly isApp: boolean
|
|
30
|
-
readonly app: ILeafer
|
|
31
|
-
parent?: IApp
|
|
32
|
-
|
|
28
|
+
export interface ILeaferAttrData {
|
|
33
29
|
running: boolean
|
|
34
30
|
created: boolean
|
|
35
31
|
ready: boolean
|
|
36
32
|
viewReady: boolean
|
|
33
|
+
imageReady: boolean
|
|
37
34
|
viewCompleted: boolean
|
|
35
|
+
layoutLocked: boolean
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
transforming: boolean
|
|
40
38
|
|
|
41
39
|
view: unknown
|
|
42
40
|
|
|
@@ -53,31 +51,54 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
53
51
|
hitCanvasManager?: IHitCanvasManager
|
|
54
52
|
|
|
55
53
|
autoLayout?: IAutoBounds
|
|
54
|
+
lazyBounds: IBounds
|
|
56
55
|
|
|
57
56
|
config: ILeaferConfig
|
|
58
57
|
|
|
58
|
+
readonly cursorPoint: IPointData
|
|
59
|
+
leafs: number
|
|
60
|
+
|
|
59
61
|
__eventIds: IEventListenerId[]
|
|
60
62
|
__nextRenderWait: IFunction[]
|
|
61
63
|
|
|
62
|
-
init(userConfig?: ILeaferConfig, parentApp?:
|
|
63
|
-
|
|
64
|
+
init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void
|
|
65
|
+
|
|
66
|
+
start(): void
|
|
67
|
+
stop(): void
|
|
68
|
+
|
|
69
|
+
unlockLayout(): void
|
|
70
|
+
lockLayout(): void
|
|
71
|
+
|
|
64
72
|
forceFullRender(): void
|
|
65
|
-
|
|
73
|
+
forceRender(bounds?: IBoundsData): void
|
|
74
|
+
updateCursor(cursor?: ICursorType): void
|
|
66
75
|
resize(size: IScreenSizeData): void
|
|
67
76
|
|
|
68
|
-
waitReady(item: IFunction): void
|
|
69
|
-
waitViewReady(item: IFunction): void
|
|
70
|
-
waitViewCompleted(item: IFunction): void
|
|
77
|
+
waitReady(item: IFunction, bind?: IObject): void
|
|
78
|
+
waitViewReady(item: IFunction, bind?: IObject): void
|
|
79
|
+
waitViewCompleted(item: IFunction, bind?: IObject): void
|
|
80
|
+
|
|
81
|
+
zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData
|
|
82
|
+
getValidMove(moveX: number, moveY: number): IPointData
|
|
83
|
+
getValidScale(changeScale: number): number
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData
|
|
87
|
+
|
|
88
|
+
export interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
|
|
89
|
+
readonly isApp: boolean
|
|
90
|
+
readonly app: ILeaferBase
|
|
91
|
+
parent?: IAppBase
|
|
71
92
|
}
|
|
72
93
|
|
|
73
94
|
export interface ILeaferTypeCreator {
|
|
74
95
|
list: ILeaferTypeList
|
|
75
96
|
register(name: string, fn: ILeaferTypeFunction): void
|
|
76
|
-
run(name: string, leafer:
|
|
97
|
+
run(name: string, leafer: ILeaferBase): void
|
|
77
98
|
}
|
|
78
99
|
|
|
79
100
|
export interface ILeaferTypeFunction {
|
|
80
|
-
(leafer:
|
|
101
|
+
(leafer: ILeaferBase): void
|
|
81
102
|
}
|
|
82
103
|
|
|
83
104
|
export interface ILeaferTypeList {
|
|
@@ -88,6 +109,7 @@ export interface ICreator {
|
|
|
88
109
|
image?(options?: ILeaferImageConfig): ILeaferImage
|
|
89
110
|
canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas
|
|
90
111
|
hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas
|
|
112
|
+
hitCanvasManager?(): IHitCanvasManager
|
|
91
113
|
|
|
92
114
|
watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher
|
|
93
115
|
layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter
|
|
@@ -95,6 +117,8 @@ export interface ICreator {
|
|
|
95
117
|
selector?(target: ILeaf, options?: ISelectorConfig): ISelector
|
|
96
118
|
|
|
97
119
|
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
|
|
120
|
+
|
|
121
|
+
editor?(options?: IObject): ILeaf
|
|
98
122
|
}
|
|
99
123
|
|
|
100
124
|
export interface IUICreator {
|
package/src/canvas/ICanvas.ts
CHANGED
|
@@ -111,6 +111,8 @@ export interface CanvasPattern {
|
|
|
111
111
|
setTransform(transform?: DOMMatrix2DInit): void
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
export type ICanvasPattern = CanvasPattern
|
|
115
|
+
|
|
114
116
|
declare var CanvasPattern: {
|
|
115
117
|
prototype: CanvasPattern
|
|
116
118
|
new(): CanvasPattern
|
|
@@ -123,15 +125,18 @@ interface CanvasRect {
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
type PredefinedColorSpace = 'display-p3' | 'srgb'
|
|
126
|
-
interface
|
|
128
|
+
interface ICanvasRenderingContext2DSettings {
|
|
127
129
|
alpha?: boolean
|
|
128
130
|
colorSpace?: PredefinedColorSpace
|
|
129
131
|
desynchronized?: boolean
|
|
130
132
|
willReadFrequently?: boolean
|
|
131
133
|
}
|
|
134
|
+
|
|
135
|
+
export type ICanvasContext2DSettings = ICanvasRenderingContext2DSettings
|
|
136
|
+
|
|
132
137
|
export interface ICanvasContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface {
|
|
133
138
|
readonly canvas: HTMLCanvasElement
|
|
134
|
-
getContextAttributes():
|
|
139
|
+
getContextAttributes(): ICanvasRenderingContext2DSettings
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
declare var ICanvasContext2D: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ILeaf } from '../display/ILeaf'
|
|
2
|
-
import { IScreenSizeData } from '../math/IMath'
|
|
3
2
|
import { ICanvasManager } from './ICanvasManager'
|
|
4
|
-
import { IHitCanvas } from './ILeaferCanvas'
|
|
3
|
+
import { IHitCanvas, ILeaferCanvasConfig } from './ILeaferCanvas'
|
|
5
4
|
|
|
6
5
|
export interface IHitCanvasManager extends ICanvasManager {
|
|
6
|
+
maxTotal: number // 最多缓存多少张画布
|
|
7
7
|
getPathType(leaf: ILeaf): IHitCanvas
|
|
8
|
-
|
|
8
|
+
getPixelType(leaf: ILeaf, config: ILeaferCanvasConfig): IHitCanvas
|
|
9
9
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { IObject } from '../data/IData'
|
|
2
|
-
import { IBounds, IMatrixData, IBoundsData, IAutoBoundsData, IAutoBounds, IScreenSizeData, IMatrixWithBoundsData, IPointData } from '../math/IMath'
|
|
3
|
-
import { ICanvasContext2D, IWindingRule, IPath2D, ITextMetrics, CanvasGradient, CanvasPattern } from './ICanvas'
|
|
2
|
+
import { IBounds, IMatrixData, IBoundsData, IAutoBoundsData, IAutoBounds, IScreenSizeData, IMatrixWithBoundsData, IPointData, IRadiusPointData } from '../math/IMath'
|
|
3
|
+
import { ICanvasContext2D, IWindingRule, IPath2D, ITextMetrics, CanvasGradient, CanvasPattern, ICanvasContext2DSettings } from './ICanvas'
|
|
4
4
|
import { IResizeEventListener } from '../event/IEvent'
|
|
5
5
|
import { IPathDrawer } from '../path/IPathDrawer'
|
|
6
6
|
import { InnerId } from '../event/IEventer'
|
|
7
7
|
import { ICanvasManager } from './ICanvasManager'
|
|
8
|
-
import {
|
|
8
|
+
import { IExportFileType } from '../file/IFileType'
|
|
9
|
+
import { IExportOptions } from '../file/IExport'
|
|
9
10
|
|
|
10
11
|
export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
11
12
|
view?: string | IObject
|
|
@@ -14,6 +15,7 @@ export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
|
14
15
|
smooth?: boolean
|
|
15
16
|
hittable?: boolean
|
|
16
17
|
webgl?: boolean
|
|
18
|
+
contextSettings?: ICanvasContext2DSettings
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export type IHitCanvasConfig = ILeaferCanvasConfig
|
|
@@ -29,6 +31,11 @@ export interface ICanvasStrokeOptions {
|
|
|
29
31
|
miterLimit?: number
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
export interface ICanvasCacheOptions extends ICanvasStrokeOptions {
|
|
35
|
+
fillStyle?: string | object
|
|
36
|
+
strokeStyle?: string | object
|
|
37
|
+
}
|
|
38
|
+
|
|
32
39
|
export interface ICanvasAttr extends ICanvasStrokeOptions, IObject {
|
|
33
40
|
|
|
34
41
|
smooth: boolean // imageSmoothingEnabled: boolean
|
|
@@ -105,6 +112,8 @@ interface ICanvasMethod {
|
|
|
105
112
|
|
|
106
113
|
hitFill(point: IPointData, fillRule?: string): boolean
|
|
107
114
|
hitStroke(point: IPointData, strokeWidth?: number): boolean
|
|
115
|
+
hitPixel(radiusPoint: IRadiusPointData, offset?: IPointData, scale?: number): boolean
|
|
116
|
+
|
|
108
117
|
|
|
109
118
|
setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void
|
|
110
119
|
setStrokeOptions(options: ICanvasStrokeOptions): void
|
|
@@ -116,7 +125,7 @@ interface ICanvasMethod {
|
|
|
116
125
|
setWorldBlur(blur: number): void
|
|
117
126
|
|
|
118
127
|
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
119
|
-
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string): void
|
|
128
|
+
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string, onlyResetTransform?: boolean): void
|
|
120
129
|
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void
|
|
121
130
|
|
|
122
131
|
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
@@ -130,6 +139,7 @@ interface ICanvasMethod {
|
|
|
130
139
|
clear(): void
|
|
131
140
|
}
|
|
132
141
|
|
|
142
|
+
export type ILeaferCanvasView = any
|
|
133
143
|
export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
134
144
|
|
|
135
145
|
readonly innerId: InnerId
|
|
@@ -155,7 +165,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
155
165
|
|
|
156
166
|
autoLayout: boolean
|
|
157
167
|
|
|
158
|
-
view:
|
|
168
|
+
view: ILeaferCanvasView
|
|
159
169
|
parentView: any
|
|
160
170
|
|
|
161
171
|
unreal?: boolean
|
|
@@ -168,6 +178,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
168
178
|
|
|
169
179
|
init(): void
|
|
170
180
|
|
|
181
|
+
export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): string | Promise<any>
|
|
171
182
|
toBlob(type?: string, quality?: number): Promise<IBlob>
|
|
172
183
|
toDataURL(type?: string, quality?: number): string | Promise<string>
|
|
173
184
|
saveAs(filename: string, quality?: number): Promise<boolean>
|
|
@@ -179,13 +190,10 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
179
190
|
updateViewSize(): void
|
|
180
191
|
updateClientBounds(): void
|
|
181
192
|
|
|
182
|
-
setCursor(cursor: ICursorType | ICursorType[]): void
|
|
183
|
-
|
|
184
193
|
// other
|
|
185
194
|
isSameSize(options: ILeaferCanvasConfig): boolean
|
|
186
|
-
getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas
|
|
187
|
-
|
|
188
|
-
recycle(): void
|
|
195
|
+
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas
|
|
196
|
+
recycle(clearBounds?: IBoundsData): void
|
|
189
197
|
|
|
190
198
|
updateRender(): void
|
|
191
199
|
unrealCanvas(): void
|
|
@@ -194,7 +202,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
194
202
|
|
|
195
203
|
|
|
196
204
|
export interface IHitCanvas extends ILeaferCanvas {
|
|
197
|
-
|
|
205
|
+
hitScale?: number
|
|
198
206
|
}
|
|
199
207
|
|
|
200
208
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IExportFileType, IExportImageType } from '../file/IFileType'
|
|
2
2
|
|
|
3
|
-
export type ICanvasType = 'skia' | 'canvas' | 'wx'
|
|
3
|
+
export type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx'
|
|
4
4
|
|
|
5
|
+
// skia
|
|
5
6
|
export interface ISkiaCanvas {
|
|
6
7
|
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>
|
|
7
8
|
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any
|
|
@@ -17,4 +18,22 @@ export interface ISkiaCanvasExportConfig {
|
|
|
17
18
|
density?: number,
|
|
18
19
|
quality?: number,
|
|
19
20
|
outline?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// skia-napi
|
|
24
|
+
export interface ISkiaNAPICanvas {
|
|
25
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any
|
|
26
|
+
encodeSync(format: 'png'): any
|
|
27
|
+
|
|
28
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>
|
|
29
|
+
encode(format: 'png'): Promise<any>
|
|
30
|
+
|
|
31
|
+
toBuffer(mime: 'image/png'): any
|
|
32
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any
|
|
33
|
+
|
|
34
|
+
toDataURL(mime?: 'image/png'): string
|
|
35
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string
|
|
36
|
+
|
|
37
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>
|
|
38
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>
|
|
20
39
|
}
|
package/src/data/IData.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type __Value = __Number | __Boolean | __String | __Object //
|
|
1
|
+
export type INumber = number // number | string will convert to number
|
|
2
|
+
export type IBoolean = boolean // boolean | string will convert to boolean
|
|
3
|
+
export type IString = string // string | other will convert to string
|
|
4
|
+
export type IValue = INumber | IBoolean | IString | IObject
|
|
6
5
|
export type ITimer = any
|
|
7
6
|
|
|
8
7
|
export type IPathString = string
|
|
9
8
|
|
|
9
|
+
export type IFourNumber = number | number[]
|
|
10
|
+
|
|
10
11
|
export interface IObject {
|
|
11
12
|
[name: string]: any
|
|
12
13
|
}
|
package/src/data/ILeafData.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { ILeaf, ILeafComputedData } from '../display/ILeaf'
|
|
2
2
|
import { IObject } from './IData'
|
|
3
3
|
|
|
4
|
-
export interface IDataProcessor
|
|
4
|
+
export interface IDataProcessor {
|
|
5
5
|
__leaf: ILeaf
|
|
6
6
|
__input: IObject
|
|
7
7
|
__middle: IObject
|
|
8
8
|
|
|
9
|
-
__single: boolean
|
|
10
|
-
__checkSingle(): void
|
|
11
|
-
|
|
12
9
|
__get(name: string): any
|
|
10
|
+
__getData(): IObject
|
|
13
11
|
|
|
14
12
|
__setInput(name: string, value: any): void
|
|
15
13
|
__getInput(name: string): any
|
|
16
14
|
__removeInput(name: string): void
|
|
17
|
-
__getInputData(): IObject
|
|
15
|
+
__getInputData(names?: string[] | IObject): IObject
|
|
18
16
|
|
|
19
17
|
__setMiddle(name: string, value: any): void
|
|
20
18
|
__getMiddle(name: string): any
|
|
@@ -22,6 +20,13 @@ export interface IDataProcessor extends IObject {
|
|
|
22
20
|
destroy(): void
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
export interface
|
|
23
|
+
export interface ILeafDataOptions {
|
|
24
|
+
attrs?: 'all' | string[]
|
|
25
|
+
children?: boolean
|
|
26
|
+
}
|
|
26
27
|
|
|
28
|
+
export interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
29
|
+
__single?: boolean
|
|
30
|
+
__checkSingle(): void
|
|
31
|
+
__removeNaturalSize(): void
|
|
27
32
|
}
|
package/src/data/IList.ts
CHANGED
|
@@ -18,13 +18,16 @@ export interface ILeafList {
|
|
|
18
18
|
has(leaf: ILeaf): boolean
|
|
19
19
|
indexAt(index: number): ILeaf
|
|
20
20
|
indexOf(leaf: ILeaf): number
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
|
|
22
|
+
add(leaf: ILeaf): void
|
|
23
|
+
addAt(leaf: ILeaf, index: number): void
|
|
24
|
+
addList(list: ILeaf[]): void
|
|
25
25
|
remove(leaf: ILeaf): void
|
|
26
|
+
|
|
26
27
|
forEach(itemCallback: ILeafListItemCallback): void
|
|
28
|
+
sort(reverse?: boolean): void
|
|
27
29
|
clone(): ILeafList
|
|
30
|
+
update(): void
|
|
28
31
|
reset(): void
|
|
29
32
|
destroy(): void
|
|
30
33
|
}
|
|
@@ -37,8 +40,8 @@ export interface ILeafLevelList {
|
|
|
37
40
|
has(leaf: ILeaf): boolean
|
|
38
41
|
without(leaf: ILeaf): boolean
|
|
39
42
|
sort(reverse?: boolean): void
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
addList(list: ILeaf[]): void
|
|
44
|
+
add(leaf: ILeaf): void
|
|
42
45
|
forEach(itemCallback: ILeafListItemCallback): void
|
|
43
46
|
reset(): void
|
|
44
47
|
destroy(): void
|
package/src/display/IBranch.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { ILeaf } from './ILeaf'
|
|
1
2
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
2
3
|
import { IRenderOptions } from '../renderer/IRenderer'
|
|
3
|
-
import { ILeaf } from './ILeaf'
|
|
4
4
|
|
|
5
5
|
export interface IBranch extends ILeaf {
|
|
6
6
|
children: ILeaf[]
|
|
7
7
|
__renderBranch?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
8
8
|
addMany(...children: ILeaf[]): void
|
|
9
9
|
removeAll(destroy?: boolean): void
|
|
10
|
+
clear(): void
|
|
10
11
|
}
|