@leafer-ui/interface 1.0.0-rc.6 → 1.0.0-rc.7
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 +2 -2
- package/src/ICommonAttr.ts +6 -6
- package/src/IUI.ts +35 -10
- package/src/app/IApp.ts +16 -0
- package/src/app/ILeafer.ts +18 -0
- package/src/editor/IEditor.ts +87 -0
- package/src/index.ts +10 -4
- package/src/module/IExport.ts +1 -0
- package/src/type/IType.ts +5 -1
- package/types/index.d.ts +124 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interface",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.7",
|
|
4
4
|
"description": "@leafer-ui/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-rc.
|
|
25
|
+
"@leafer/interface": "1.0.0-rc.7"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/ICommonAttr.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, IUnitData, ITextWrap, IStroke, IFill } from './type/IType'
|
|
2
2
|
import { ILeafStrokePaint, ILeafShadowEffect, ILeafPaint } from './type/IComputedType'
|
|
3
|
-
import {
|
|
3
|
+
import { IDashPatternString, IShadowString, IColorString, IStrokeWidthString, ICornerRadiusString } from './type/IStringType'
|
|
4
4
|
|
|
5
5
|
// corner---
|
|
6
6
|
export interface ICornerRadiusAttrData {
|
|
@@ -18,10 +18,10 @@ export interface ICornerRadiusComputedData {
|
|
|
18
18
|
|
|
19
19
|
// fill---
|
|
20
20
|
export interface IFillAttrData {
|
|
21
|
-
fill:
|
|
21
|
+
fill: IFill
|
|
22
22
|
}
|
|
23
23
|
export interface IFillInputData {
|
|
24
|
-
fill?:
|
|
24
|
+
fill?: IFill
|
|
25
25
|
}
|
|
26
26
|
export interface IFillComputedData {
|
|
27
27
|
fill?: IColorString | ILeafPaint[]
|
|
@@ -35,7 +35,7 @@ export interface IBorderComputedData {
|
|
|
35
35
|
|
|
36
36
|
// stroke---
|
|
37
37
|
export interface IStrokeAttrData {
|
|
38
|
-
stroke:
|
|
38
|
+
stroke: IStroke
|
|
39
39
|
|
|
40
40
|
strokeAlign: IStrokeAlign
|
|
41
41
|
strokeWidth: number | number[] | IStrokeWidthString
|
|
@@ -46,7 +46,7 @@ export interface IStrokeAttrData {
|
|
|
46
46
|
miterLimit: number
|
|
47
47
|
}
|
|
48
48
|
export interface IStrokeInputData {
|
|
49
|
-
stroke?:
|
|
49
|
+
stroke?: IStroke
|
|
50
50
|
|
|
51
51
|
strokeAlign?: IStrokeAlign
|
|
52
52
|
strokeWidth?: number | number[] | IStrokeWidthString
|
package/src/IUI.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, ILeafComputedData, ILeafData,
|
|
1
|
+
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IBlob, IPathCreator, AnswerType } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
IFillAttrData, IFillInputData, IFillComputedData,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from './ICommonAttr'
|
|
11
11
|
import { IOverflow } from './type/IType'
|
|
12
12
|
import { IExportOptions } from './module/IExport'
|
|
13
|
+
import { ILeafer } from './app/ILeafer'
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
// Line
|
|
@@ -19,12 +20,14 @@ export interface ILine extends IUI {
|
|
|
19
20
|
points: number[]
|
|
20
21
|
curve: boolean | number
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
interface ILineAttrData {
|
|
24
25
|
toPoint?: IPointData
|
|
25
26
|
points?: number[]
|
|
26
27
|
curve?: boolean | number
|
|
27
28
|
}
|
|
29
|
+
export interface ILineData extends ILineAttrData, IUIData { }
|
|
30
|
+
export interface ILineInputData extends ILineAttrData, IUIBaseInputData { }
|
|
28
31
|
|
|
29
32
|
|
|
30
33
|
// Rect
|
|
@@ -212,6 +215,12 @@ export interface ILeaferInputData extends IGroupInputData {
|
|
|
212
215
|
pixelRatio?: number
|
|
213
216
|
}
|
|
214
217
|
|
|
218
|
+
export interface IAppData extends ILeaferData {
|
|
219
|
+
|
|
220
|
+
}
|
|
221
|
+
export interface IAppInputData extends ILeaferInputData {
|
|
222
|
+
|
|
223
|
+
}
|
|
215
224
|
|
|
216
225
|
// Frame
|
|
217
226
|
export interface IFrame extends IBox {
|
|
@@ -249,6 +258,7 @@ export interface IGroup extends IUI {
|
|
|
249
258
|
addAt(child: IUI, index: number): void
|
|
250
259
|
addAfter(child: IUI, after: IUI): void
|
|
251
260
|
addBefore(child: IUI, before: IUI): void
|
|
261
|
+
addMany(...children: ILeaf[]): void
|
|
252
262
|
remove(child?: IUI): void
|
|
253
263
|
removeAll(): void
|
|
254
264
|
}
|
|
@@ -258,30 +268,41 @@ export interface IGroupInputData extends IUIBaseInputData { }
|
|
|
258
268
|
// UI
|
|
259
269
|
export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
260
270
|
__: IUIData
|
|
271
|
+
|
|
272
|
+
readonly app: ILeafer
|
|
273
|
+
leafer?: ILeafer
|
|
261
274
|
parent?: IGroup
|
|
275
|
+
isFrame?: boolean
|
|
262
276
|
|
|
263
277
|
proxyData?: IUIInputData
|
|
278
|
+
__proxyData?: IUIInputData
|
|
279
|
+
|
|
280
|
+
children?: IUI[]
|
|
264
281
|
|
|
265
|
-
reset(
|
|
282
|
+
reset(data?: IUIInputData): void
|
|
266
283
|
|
|
267
284
|
set(data: IUIInputData): void
|
|
268
285
|
toJSON(): IUIInputData
|
|
269
286
|
|
|
270
|
-
get(
|
|
271
|
-
|
|
287
|
+
get(): IUIInputData
|
|
288
|
+
createProxyData(): IUIInputData
|
|
272
289
|
|
|
273
|
-
find(condition: number | string |
|
|
274
|
-
findOne(condition: number | string |
|
|
290
|
+
find(condition: number | string | IFindUIMethod, options?: any): IUI[]
|
|
291
|
+
findOne(condition: number | string | IFindUIMethod, options?: any): IUI
|
|
275
292
|
|
|
276
293
|
getPath(curve?: boolean): IPathCommandData
|
|
277
294
|
getPathString(curve?: boolean): IPathString
|
|
278
295
|
|
|
279
296
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
|
|
297
|
+
__drawPathByBox(drawer: IPathDrawer): void
|
|
280
298
|
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
281
299
|
|
|
282
300
|
export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>
|
|
283
301
|
clone(): IUI
|
|
302
|
+
}
|
|
284
303
|
|
|
304
|
+
export interface IFindUIMethod {
|
|
305
|
+
(leaf: IUI, options?: any): AnswerType
|
|
285
306
|
}
|
|
286
307
|
|
|
287
308
|
export interface IUIData extends IUIComputedData, ILeafData {
|
|
@@ -305,6 +326,10 @@ export interface IUIData extends IUIComputedData, ILeafData {
|
|
|
305
326
|
|
|
306
327
|
__useEffect?: boolean
|
|
307
328
|
|
|
329
|
+
__autoWidth: boolean
|
|
330
|
+
__autoHeight: boolean
|
|
331
|
+
__autoBounds: boolean
|
|
332
|
+
|
|
308
333
|
// path
|
|
309
334
|
path?: IPathCommandData
|
|
310
335
|
windingRule?: IWindingRule
|
|
@@ -328,7 +353,7 @@ export interface IUIComputedData extends IFillComputedData, IBorderComputedData,
|
|
|
328
353
|
export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
329
354
|
padding?: number | number[]
|
|
330
355
|
locked?: boolean
|
|
331
|
-
children?:
|
|
356
|
+
children?: IUIInputData[]
|
|
332
357
|
}
|
|
333
358
|
|
|
334
359
|
|
|
@@ -351,5 +376,5 @@ export type IUITag =
|
|
|
351
376
|
|
|
352
377
|
|
|
353
378
|
export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
|
|
354
|
-
|
|
379
|
+
children?: IUIInputData[]
|
|
355
380
|
}
|
package/src/app/IApp.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ILeaferConfig } from '@leafer/interface'
|
|
2
|
+
|
|
3
|
+
import { ILeafer } from './ILeafer'
|
|
4
|
+
import { IEditorConfig } from '../editor/IEditor'
|
|
5
|
+
|
|
6
|
+
export interface IApp extends ILeafer {
|
|
7
|
+
children: ILeafer[]
|
|
8
|
+
realCanvas: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IAppConfig extends ILeaferConfig {
|
|
12
|
+
ground?: ILeaferConfig
|
|
13
|
+
tree?: ILeaferConfig
|
|
14
|
+
sky?: ILeaferConfig
|
|
15
|
+
editor?: IEditorConfig
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IControl, ILeaferAttrData, ILeaferConfig } from '@leafer/interface'
|
|
2
|
+
import { IApp } from './IApp'
|
|
3
|
+
import { IGroup } from '../IUI'
|
|
4
|
+
import { IEditorBase } from '../editor/IEditor'
|
|
5
|
+
|
|
6
|
+
export interface ILeafer extends IGroup, ILeaferAttrData, IControl {
|
|
7
|
+
readonly isApp: boolean
|
|
8
|
+
readonly app: ILeafer
|
|
9
|
+
parent?: IApp
|
|
10
|
+
zoomLayer?: IGroup
|
|
11
|
+
editor?: IEditorBase
|
|
12
|
+
|
|
13
|
+
ground?: ILeafer
|
|
14
|
+
tree?: ILeafer
|
|
15
|
+
sky?: ILeafer
|
|
16
|
+
|
|
17
|
+
userConfig?: ILeaferConfig
|
|
18
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { IGroup, IUI, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAround, IDragEvent, IRotateEvent, IStroke, IFill, ILeafList, ILeaf, IObject, IBoxInputData } from '@leafer-ui/interface'
|
|
2
|
+
|
|
3
|
+
export interface IEditorBase extends IGroup, ISelectorProxy {
|
|
4
|
+
config: IEditorConfig
|
|
5
|
+
|
|
6
|
+
hoverTarget: IUI
|
|
7
|
+
target: IUI | IUI[] | ILeafList
|
|
8
|
+
|
|
9
|
+
readonly list: IUI[]
|
|
10
|
+
|
|
11
|
+
readonly hasTarget: boolean
|
|
12
|
+
readonly multiple: boolean
|
|
13
|
+
readonly single: boolean
|
|
14
|
+
|
|
15
|
+
readonly dragging: boolean
|
|
16
|
+
|
|
17
|
+
element: IUI
|
|
18
|
+
buttons: IGroup
|
|
19
|
+
|
|
20
|
+
selector: IGroup
|
|
21
|
+
editBox: IGroup
|
|
22
|
+
editTool: IObject
|
|
23
|
+
|
|
24
|
+
hasItem(item: IUI): boolean
|
|
25
|
+
shiftItem(item: IUI): void
|
|
26
|
+
addItem(item: IUI): void
|
|
27
|
+
removeItem(item: IUI): void
|
|
28
|
+
|
|
29
|
+
update(): void
|
|
30
|
+
updateEditTool(): void
|
|
31
|
+
|
|
32
|
+
getEditSize(ui: ILeaf): IEditSize
|
|
33
|
+
|
|
34
|
+
onMove(e: IDragEvent): void
|
|
35
|
+
onScale(e: IDragEvent): void
|
|
36
|
+
onRotate(e: IDragEvent | IRotateEvent): void
|
|
37
|
+
onSkew(e: IDragEvent): void
|
|
38
|
+
|
|
39
|
+
group(): void
|
|
40
|
+
ungroup(): void
|
|
41
|
+
|
|
42
|
+
lock(): void
|
|
43
|
+
unlock(): void
|
|
44
|
+
|
|
45
|
+
toTop(): void
|
|
46
|
+
toBottom(): void
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IEditorConfig {
|
|
50
|
+
editSize?: 'auto' | IEditSize
|
|
51
|
+
|
|
52
|
+
stroke?: IStroke
|
|
53
|
+
strokeWidth?: number
|
|
54
|
+
|
|
55
|
+
pointFill?: IFill
|
|
56
|
+
pointSize?: number
|
|
57
|
+
pointRadius?: number
|
|
58
|
+
|
|
59
|
+
point?: IBoxInputData | IBoxInputData[]
|
|
60
|
+
middlePoint?: IBoxInputData | IBoxInputData[]
|
|
61
|
+
rotatePoint?: IBoxInputData
|
|
62
|
+
|
|
63
|
+
rect?: IBoxInputData
|
|
64
|
+
area?: IRectInputData
|
|
65
|
+
|
|
66
|
+
buttonsDirection?: 'top' | 'right' | 'bottom' | 'left'
|
|
67
|
+
buttonsFixed?: boolean
|
|
68
|
+
buttonsMargin?: number
|
|
69
|
+
|
|
70
|
+
hideOnMove?: boolean
|
|
71
|
+
|
|
72
|
+
moveCursor?: ICursorType
|
|
73
|
+
resizeCursor?: ICursorType[]
|
|
74
|
+
rotateCursor?: ICursorType[]
|
|
75
|
+
|
|
76
|
+
around?: IAround
|
|
77
|
+
lockRatio?: boolean
|
|
78
|
+
rotateGap?: number
|
|
79
|
+
|
|
80
|
+
selector?: boolean
|
|
81
|
+
hover?: boolean
|
|
82
|
+
boxSelect?: boolean
|
|
83
|
+
|
|
84
|
+
rotateable?: boolean
|
|
85
|
+
resizeable?: boolean
|
|
86
|
+
skewable?: boolean
|
|
87
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * from '@leafer/interface'
|
|
2
2
|
|
|
3
|
+
export { IApp, IAppConfig } from './app/IApp'
|
|
4
|
+
export { ILeafer } from './app/ILeafer'
|
|
5
|
+
|
|
3
6
|
export {
|
|
4
7
|
ILine, ILineInputData, ILineData,
|
|
5
8
|
IRect, IRectInputData, IRectData,
|
|
@@ -15,10 +18,12 @@ export {
|
|
|
15
18
|
IBox, IBoxInputData, IBoxData,
|
|
16
19
|
IGroup, IGroupInputData, IGroupData,
|
|
17
20
|
ILeaferInputData, ILeaferData,
|
|
18
|
-
|
|
21
|
+
IAppInputData, IAppData,
|
|
22
|
+
IUI, IUIBaseInputData, IUIData, IFindUIMethod,
|
|
19
23
|
IUITag, IUIInputData
|
|
20
24
|
} from './IUI'
|
|
21
|
-
|
|
25
|
+
|
|
26
|
+
export { IUnitData, IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IStrokeAlign, IStrokeJoin, IStrokeCap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap } from './type/IType'
|
|
22
27
|
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString as IStringColor } from './type/IStringType'
|
|
23
28
|
export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
24
29
|
|
|
@@ -29,7 +34,8 @@ export { ITextConvertModule } from './module/ITextConvert'
|
|
|
29
34
|
export { IColorConvertModule } from './module/IColorConvert'
|
|
30
35
|
export { IExportModule, IExportOptions, IExportResult, IExportResultFunction } from './module/IExport'
|
|
31
36
|
|
|
32
|
-
|
|
33
37
|
export { IPaintModule } from './module/IPaint'
|
|
34
38
|
export { IEffectModule } from './module/IEffect'
|
|
35
|
-
export { ICachedShape } from './ICachedShape'
|
|
39
|
+
export { ICachedShape } from './ICachedShape'
|
|
40
|
+
|
|
41
|
+
export { IEditorBase, IEditorConfig } from './editor/IEditor'
|
package/src/module/IExport.ts
CHANGED
package/src/type/IType.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType } from '@leafer/interface'
|
|
2
|
-
import { IColorString } from './IStringType'
|
|
2
|
+
import { IColorString, IPaintString } from './IStringType'
|
|
3
3
|
|
|
4
4
|
export interface IUnitData {
|
|
5
5
|
type: 'percent' | 'px'
|
|
@@ -8,6 +8,10 @@ export interface IUnitData {
|
|
|
8
8
|
|
|
9
9
|
export type IPaint = ISolidPaint | IGradientPaint | IImagePaint
|
|
10
10
|
|
|
11
|
+
export type IFill = IPaint | IPaint[] | IPaintString
|
|
12
|
+
|
|
13
|
+
export type IStroke = IPaint | IPaint[] | IPaintString
|
|
14
|
+
|
|
11
15
|
export interface IPaintBase {
|
|
12
16
|
type: IPaintType
|
|
13
17
|
blendMode?: IBlendMode
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IPointData, IExportFileType, IWindingRule, IPathCommandData, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, IBlob, ILeaf, IPathString, IPathCreator, IBoundsData, ILeaferImageConfig, ILeaferCanvas, IRenderOptions,
|
|
1
|
+
import { IPointData, IExportFileType, IWindingRule, IPathCommandData, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, IBlob, ILeaf, IPathString, IPathCreator, IBoundsData, ILeaferImageConfig, ILeaferCanvas, IRenderOptions, IPathDrawer, AnswerType, ILeafData, IPath2D, ILeafComputedData, ILeafInputData, IObject, ILeaferAttrData, IControl, ILeaferConfig, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap } from '@leafer/interface';
|
|
2
2
|
export * from '@leafer/interface';
|
|
3
|
+
import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject as IObject$1, ILeaf as ILeaf$1, IEditSize, IDragEvent, IRotateEvent, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, ICursorType, IAround } from '@leafer-ui/interface';
|
|
3
4
|
|
|
4
5
|
type IPercent = string;
|
|
5
6
|
type IColorString = string;
|
|
@@ -17,6 +18,8 @@ interface IUnitData {
|
|
|
17
18
|
value: number;
|
|
18
19
|
}
|
|
19
20
|
type IPaint = ISolidPaint | IGradientPaint | IImagePaint;
|
|
21
|
+
type IFill = IPaint | IPaint[] | IPaintString;
|
|
22
|
+
type IStroke = IPaint | IPaint[] | IPaintString;
|
|
20
23
|
interface IPaintBase {
|
|
21
24
|
type: IPaintType;
|
|
22
25
|
blendMode?: IBlendMode;
|
|
@@ -159,10 +162,10 @@ interface ICornerRadiusComputedData {
|
|
|
159
162
|
cornerSmoothing?: number;
|
|
160
163
|
}
|
|
161
164
|
interface IFillAttrData {
|
|
162
|
-
fill:
|
|
165
|
+
fill: IFill;
|
|
163
166
|
}
|
|
164
167
|
interface IFillInputData {
|
|
165
|
-
fill?:
|
|
168
|
+
fill?: IFill;
|
|
166
169
|
}
|
|
167
170
|
interface IFillComputedData {
|
|
168
171
|
fill?: IColorString | ILeafPaint[];
|
|
@@ -172,7 +175,7 @@ interface IBorderComputedData {
|
|
|
172
175
|
borderRadius?: number | number[];
|
|
173
176
|
}
|
|
174
177
|
interface IStrokeAttrData {
|
|
175
|
-
stroke:
|
|
178
|
+
stroke: IStroke;
|
|
176
179
|
strokeAlign: IStrokeAlign;
|
|
177
180
|
strokeWidth: number | number[] | IStrokeWidthString;
|
|
178
181
|
strokeCap: IStrokeCap;
|
|
@@ -182,7 +185,7 @@ interface IStrokeAttrData {
|
|
|
182
185
|
miterLimit: number;
|
|
183
186
|
}
|
|
184
187
|
interface IStrokeInputData {
|
|
185
|
-
stroke?:
|
|
188
|
+
stroke?: IStroke;
|
|
186
189
|
strokeAlign?: IStrokeAlign;
|
|
187
190
|
strokeWidth?: number | number[] | IStrokeWidthString;
|
|
188
191
|
strokeCap?: IStrokeCap;
|
|
@@ -283,6 +286,7 @@ interface IExportResultFunction {
|
|
|
283
286
|
(data: IExportResult): void;
|
|
284
287
|
}
|
|
285
288
|
interface IExportModule {
|
|
289
|
+
running?: boolean;
|
|
286
290
|
export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
287
291
|
}
|
|
288
292
|
|
|
@@ -292,13 +296,15 @@ interface ILine extends IUI {
|
|
|
292
296
|
points: number[];
|
|
293
297
|
curve: boolean | number;
|
|
294
298
|
}
|
|
295
|
-
interface
|
|
296
|
-
}
|
|
297
|
-
interface ILineInputData extends IUIBaseInputData {
|
|
299
|
+
interface ILineAttrData {
|
|
298
300
|
toPoint?: IPointData;
|
|
299
301
|
points?: number[];
|
|
300
302
|
curve?: boolean | number;
|
|
301
303
|
}
|
|
304
|
+
interface ILineData extends ILineAttrData, IUIData {
|
|
305
|
+
}
|
|
306
|
+
interface ILineInputData extends ILineAttrData, IUIBaseInputData {
|
|
307
|
+
}
|
|
302
308
|
interface IRect extends IUI {
|
|
303
309
|
__: IRectData;
|
|
304
310
|
}
|
|
@@ -462,6 +468,10 @@ interface ILeaferData extends IGroupData {
|
|
|
462
468
|
interface ILeaferInputData extends IGroupInputData {
|
|
463
469
|
pixelRatio?: number;
|
|
464
470
|
}
|
|
471
|
+
interface IAppData extends ILeaferData {
|
|
472
|
+
}
|
|
473
|
+
interface IAppInputData extends ILeaferInputData {
|
|
474
|
+
}
|
|
465
475
|
interface IFrame extends IBox {
|
|
466
476
|
__: IFrameData;
|
|
467
477
|
}
|
|
@@ -489,6 +499,7 @@ interface IGroup extends IUI {
|
|
|
489
499
|
addAt(child: IUI, index: number): void;
|
|
490
500
|
addAfter(child: IUI, after: IUI): void;
|
|
491
501
|
addBefore(child: IUI, before: IUI): void;
|
|
502
|
+
addMany(...children: ILeaf[]): void;
|
|
492
503
|
remove(child?: IUI): void;
|
|
493
504
|
removeAll(): void;
|
|
494
505
|
}
|
|
@@ -498,22 +509,31 @@ interface IGroupInputData extends IUIBaseInputData {
|
|
|
498
509
|
}
|
|
499
510
|
interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
500
511
|
__: IUIData;
|
|
512
|
+
readonly app: ILeafer;
|
|
513
|
+
leafer?: ILeafer;
|
|
501
514
|
parent?: IGroup;
|
|
515
|
+
isFrame?: boolean;
|
|
502
516
|
proxyData?: IUIInputData;
|
|
503
|
-
|
|
517
|
+
__proxyData?: IUIInputData;
|
|
518
|
+
children?: IUI[];
|
|
519
|
+
reset(data?: IUIInputData): void;
|
|
504
520
|
set(data: IUIInputData): void;
|
|
505
521
|
toJSON(): IUIInputData;
|
|
506
|
-
get(
|
|
507
|
-
|
|
508
|
-
find(condition: number | string |
|
|
509
|
-
findOne(condition: number | string |
|
|
522
|
+
get(): IUIInputData;
|
|
523
|
+
createProxyData(): IUIInputData;
|
|
524
|
+
find(condition: number | string | IFindUIMethod, options?: any): IUI[];
|
|
525
|
+
findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
|
|
510
526
|
getPath(curve?: boolean): IPathCommandData;
|
|
511
527
|
getPathString(curve?: boolean): IPathString;
|
|
512
528
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
529
|
+
__drawPathByBox(drawer: IPathDrawer): void;
|
|
513
530
|
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
514
531
|
export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>;
|
|
515
532
|
clone(): IUI;
|
|
516
533
|
}
|
|
534
|
+
interface IFindUIMethod {
|
|
535
|
+
(leaf: IUI, options?: any): AnswerType;
|
|
536
|
+
}
|
|
517
537
|
interface IUIData extends IUIComputedData, ILeafData {
|
|
518
538
|
padding?: number | number[];
|
|
519
539
|
locked?: boolean;
|
|
@@ -527,6 +547,9 @@ interface IUIData extends IUIComputedData, ILeafData {
|
|
|
527
547
|
__isOverflow?: boolean;
|
|
528
548
|
__blendLayer?: boolean;
|
|
529
549
|
__useEffect?: boolean;
|
|
550
|
+
__autoWidth: boolean;
|
|
551
|
+
__autoHeight: boolean;
|
|
552
|
+
__autoBounds: boolean;
|
|
530
553
|
path?: IPathCommandData;
|
|
531
554
|
windingRule?: IWindingRule;
|
|
532
555
|
__pathForRender?: IPathCommandData;
|
|
@@ -542,10 +565,96 @@ interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrok
|
|
|
542
565
|
interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
543
566
|
padding?: number | number[];
|
|
544
567
|
locked?: boolean;
|
|
545
|
-
children?:
|
|
568
|
+
children?: IUIInputData[];
|
|
546
569
|
}
|
|
547
570
|
type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
|
|
548
571
|
interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
|
|
572
|
+
children?: IUIInputData[];
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
interface IEditorBase extends IGroup$1, ISelectorProxy {
|
|
576
|
+
config: IEditorConfig;
|
|
577
|
+
hoverTarget: IUI$1;
|
|
578
|
+
target: IUI$1 | IUI$1[] | ILeafList;
|
|
579
|
+
readonly list: IUI$1[];
|
|
580
|
+
readonly hasTarget: boolean;
|
|
581
|
+
readonly multiple: boolean;
|
|
582
|
+
readonly single: boolean;
|
|
583
|
+
readonly dragging: boolean;
|
|
584
|
+
element: IUI$1;
|
|
585
|
+
buttons: IGroup$1;
|
|
586
|
+
selector: IGroup$1;
|
|
587
|
+
editBox: IGroup$1;
|
|
588
|
+
editTool: IObject$1;
|
|
589
|
+
hasItem(item: IUI$1): boolean;
|
|
590
|
+
shiftItem(item: IUI$1): void;
|
|
591
|
+
addItem(item: IUI$1): void;
|
|
592
|
+
removeItem(item: IUI$1): void;
|
|
593
|
+
update(): void;
|
|
594
|
+
updateEditTool(): void;
|
|
595
|
+
getEditSize(ui: ILeaf$1): IEditSize;
|
|
596
|
+
onMove(e: IDragEvent): void;
|
|
597
|
+
onScale(e: IDragEvent): void;
|
|
598
|
+
onRotate(e: IDragEvent | IRotateEvent): void;
|
|
599
|
+
onSkew(e: IDragEvent): void;
|
|
600
|
+
group(): void;
|
|
601
|
+
ungroup(): void;
|
|
602
|
+
lock(): void;
|
|
603
|
+
unlock(): void;
|
|
604
|
+
toTop(): void;
|
|
605
|
+
toBottom(): void;
|
|
606
|
+
}
|
|
607
|
+
interface IEditorConfig {
|
|
608
|
+
editSize?: 'auto' | IEditSize;
|
|
609
|
+
stroke?: IStroke$1;
|
|
610
|
+
strokeWidth?: number;
|
|
611
|
+
pointFill?: IFill$1;
|
|
612
|
+
pointSize?: number;
|
|
613
|
+
pointRadius?: number;
|
|
614
|
+
point?: IBoxInputData$1 | IBoxInputData$1[];
|
|
615
|
+
middlePoint?: IBoxInputData$1 | IBoxInputData$1[];
|
|
616
|
+
rotatePoint?: IBoxInputData$1;
|
|
617
|
+
rect?: IBoxInputData$1;
|
|
618
|
+
area?: IRectInputData$1;
|
|
619
|
+
buttonsDirection?: 'top' | 'right' | 'bottom' | 'left';
|
|
620
|
+
buttonsFixed?: boolean;
|
|
621
|
+
buttonsMargin?: number;
|
|
622
|
+
hideOnMove?: boolean;
|
|
623
|
+
moveCursor?: ICursorType;
|
|
624
|
+
resizeCursor?: ICursorType[];
|
|
625
|
+
rotateCursor?: ICursorType[];
|
|
626
|
+
around?: IAround;
|
|
627
|
+
lockRatio?: boolean;
|
|
628
|
+
rotateGap?: number;
|
|
629
|
+
selector?: boolean;
|
|
630
|
+
hover?: boolean;
|
|
631
|
+
boxSelect?: boolean;
|
|
632
|
+
rotateable?: boolean;
|
|
633
|
+
resizeable?: boolean;
|
|
634
|
+
skewable?: boolean;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
interface ILeafer extends IGroup, ILeaferAttrData, IControl {
|
|
638
|
+
readonly isApp: boolean;
|
|
639
|
+
readonly app: ILeafer;
|
|
640
|
+
parent?: IApp;
|
|
641
|
+
zoomLayer?: IGroup;
|
|
642
|
+
editor?: IEditorBase;
|
|
643
|
+
ground?: ILeafer;
|
|
644
|
+
tree?: ILeafer;
|
|
645
|
+
sky?: ILeafer;
|
|
646
|
+
userConfig?: ILeaferConfig;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
interface IApp extends ILeafer {
|
|
650
|
+
children: ILeafer[];
|
|
651
|
+
realCanvas: boolean;
|
|
652
|
+
}
|
|
653
|
+
interface IAppConfig extends ILeaferConfig {
|
|
654
|
+
ground?: ILeaferConfig;
|
|
655
|
+
tree?: ILeaferConfig;
|
|
656
|
+
sky?: ILeaferConfig;
|
|
657
|
+
editor?: IEditorConfig;
|
|
549
658
|
}
|
|
550
659
|
|
|
551
660
|
type IUIRenderModule = IUIRender & ThisType<IUI>;
|
|
@@ -610,4 +719,4 @@ interface IEffectModule {
|
|
|
610
719
|
backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, renderOptions: IRenderOptions): void;
|
|
611
720
|
}
|
|
612
721
|
|
|
613
|
-
export type { IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, ICornerRadiusString, IDashPatternString, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IExportOptions, IExportResult, IExportResultFunction, IFontWeight, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGradientPaint, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintModule, IPaintString, IPath, IPathData, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IColorString as IStringColor, IStrokeAlign, IStrokeCap, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextWordData, ITextWrap, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIRenderModule, IUITag, IUnitData, IVectorPath, IVerticalAlign };
|
|
722
|
+
export type { IApp, IAppConfig, IAppData, IAppInputData, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, ICornerRadiusString, IDashPatternString, IEditorBase, IEditorConfig, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IExportOptions, IExportResult, IExportResultFunction, IFill, IFindUIMethod, IFontWeight, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGradientPaint, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintModule, IPaintString, IPath, IPathData, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IColorString as IStringColor, IStroke, IStrokeAlign, IStrokeCap, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextWordData, ITextWrap, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIRenderModule, IUITag, IUnitData, IVectorPath, IVerticalAlign };
|