@leafer-ui/interface 1.0.0-rc.5 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/interface",
3
- "version": "1.0.0-rc.5",
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.5"
25
+ "@leafer/interface": "1.0.0-rc.7"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
- import { IPaint, IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, IUnitData } from './type/IType'
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 { IPaintString, IDashPatternString, IShadowString, IColorString, IStrokeWidthString, ICornerRadiusString } from './type/IStringType'
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: IPaint | IPaint[] | IPaintString
21
+ fill: IFill
22
22
  }
23
23
  export interface IFillInputData {
24
- fill?: IPaint | IPaint[] | IPaintString
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: IPaint | IPaint[] | IPaintString
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?: IPaint | IPaint[] | IPaintString
49
+ stroke?: IStroke
50
50
 
51
51
  strokeAlign?: IStrokeAlign
52
52
  strokeWidth?: number | number[] | IStrokeWidthString
@@ -86,6 +86,7 @@ export interface ITextStyleAttrData {
86
86
  textAlign: ITextAlign
87
87
  verticalAlign: IVerticalAlign
88
88
 
89
+ textWrap: ITextWrap
89
90
  textOverflow: IOverflow | string
90
91
  }
91
92
  export interface ITextStyleInputData {
@@ -104,6 +105,7 @@ export interface ITextStyleInputData {
104
105
  textAlign?: ITextAlign
105
106
  verticalAlign?: IVerticalAlign
106
107
 
108
+ textWrap?: ITextWrap
107
109
  textOverflow?: IOverflow | string
108
110
  }
109
111
  export interface ITextStyleComputedData {
@@ -121,7 +123,9 @@ export interface ITextStyleComputedData {
121
123
 
122
124
  textAlign?: ITextAlign
123
125
  verticalAlign?: IVerticalAlign
124
- textOverflow?: IOverflow
126
+
127
+ textWrap?: ITextWrap
128
+ textOverflow?: IOverflow | string
125
129
  }
126
130
 
127
131
  // effect---
package/src/IUI.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, IPathString, ILeaferImage, IBlob, IPathCreator } from '@leafer/interface'
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
- export interface ILineData extends IUIData { }
23
- export interface ILineInputData extends IUIBaseInputData {
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
@@ -124,6 +127,8 @@ export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIDat
124
127
  __baseLine?: number
125
128
  __lineHeight?: number
126
129
  __letterSpacing?: number
130
+ __clipText?: boolean
131
+ __textBoxBounds?: IBoundsData
127
132
  }
128
133
  export interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
129
134
 
@@ -144,6 +149,7 @@ export interface ITextRowData {
144
149
  paraStart?: boolean // paragraph start
145
150
  paraEnd?: boolean // paragraph end
146
151
  isOverflow?: boolean
152
+ textMode?: boolean
147
153
  }
148
154
 
149
155
  export interface ITextWordData {
@@ -209,6 +215,12 @@ export interface ILeaferInputData extends IGroupInputData {
209
215
  pixelRatio?: number
210
216
  }
211
217
 
218
+ export interface IAppData extends ILeaferData {
219
+
220
+ }
221
+ export interface IAppInputData extends ILeaferInputData {
222
+
223
+ }
212
224
 
213
225
  // Frame
214
226
  export interface IFrame extends IBox {
@@ -246,6 +258,7 @@ export interface IGroup extends IUI {
246
258
  addAt(child: IUI, index: number): void
247
259
  addAfter(child: IUI, after: IUI): void
248
260
  addBefore(child: IUI, before: IUI): void
261
+ addMany(...children: ILeaf[]): void
249
262
  remove(child?: IUI): void
250
263
  removeAll(): void
251
264
  }
@@ -255,22 +268,41 @@ export interface IGroupInputData extends IUIBaseInputData { }
255
268
  // UI
256
269
  export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
257
270
  __: IUIData
271
+
272
+ readonly app: ILeafer
273
+ leafer?: ILeafer
258
274
  parent?: IGroup
275
+ isFrame?: boolean
276
+
277
+ proxyData?: IUIInputData
278
+ __proxyData?: IUIInputData
259
279
 
260
- reset(_data?: IUIInputData): void
280
+ children?: IUI[]
281
+
282
+ reset(data?: IUIInputData): void
261
283
 
262
284
  set(data: IUIInputData): void
263
285
  toJSON(): IUIInputData
264
286
 
287
+ get(): IUIInputData
288
+ createProxyData(): IUIInputData
289
+
290
+ find(condition: number | string | IFindUIMethod, options?: any): IUI[]
291
+ findOne(condition: number | string | IFindUIMethod, options?: any): IUI
292
+
265
293
  getPath(curve?: boolean): IPathCommandData
266
294
  getPathString(curve?: boolean): IPathString
267
295
 
268
296
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
297
+ __drawPathByBox(drawer: IPathDrawer): void
269
298
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
270
299
 
271
300
  export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>
272
301
  clone(): IUI
302
+ }
273
303
 
304
+ export interface IFindUIMethod {
305
+ (leaf: IUI, options?: any): AnswerType
274
306
  }
275
307
 
276
308
  export interface IUIData extends IUIComputedData, ILeafData {
@@ -294,6 +326,10 @@ export interface IUIData extends IUIComputedData, ILeafData {
294
326
 
295
327
  __useEffect?: boolean
296
328
 
329
+ __autoWidth: boolean
330
+ __autoHeight: boolean
331
+ __autoBounds: boolean
332
+
297
333
  // path
298
334
  path?: IPathCommandData
299
335
  windingRule?: IWindingRule
@@ -317,7 +353,7 @@ export interface IUIComputedData extends IFillComputedData, IBorderComputedData,
317
353
  export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
318
354
  padding?: number | number[]
319
355
  locked?: boolean
320
- children?: IUIBaseInputData[]
356
+ children?: IUIInputData[]
321
357
  }
322
358
 
323
359
 
@@ -340,5 +376,5 @@ export type IUITag =
340
376
 
341
377
 
342
378
  export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
343
-
379
+ children?: IUIInputData[]
344
380
  }
@@ -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
- IUI, IUIBaseInputData, IUIData,
21
+ IAppInputData, IAppData,
22
+ IUI, IUIBaseInputData, IUIData, IFindUIMethod,
19
23
  IUITag, IUIInputData
20
24
  } from './IUI'
21
- export { IUnitData, IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow } from './type/IType'
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'
@@ -15,5 +15,6 @@ export interface IExportResultFunction {
15
15
 
16
16
 
17
17
  export interface IExportModule {
18
+ running?: boolean
18
19
  export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>
19
20
  }
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
@@ -102,6 +106,7 @@ export type IFontWeightString =
102
106
  | 'extra-bold'
103
107
  | 'black'
104
108
  export type ITextDecoration = 'none' | 'under' | 'delete'
109
+ export type ITextWrap = 'normal' | 'none' | 'break'
105
110
 
106
111
  // 路径
107
112
  export interface IVectorPath {
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, IPathDrawer, ILeafData, IPath2D, ILeafComputedData, ILeafInputData, IObject, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap } from '@leafer/interface';
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;
@@ -80,6 +83,7 @@ type IFontWeight = IFontWeightNumer | IFontWeightString;
80
83
  type IFontWeightNumer = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
81
84
  type IFontWeightString = 'thin' | 'extra-light' | 'light' | 'normal' | 'medium' | 'semi-bold' | 'bold' | 'extra-bold' | 'black';
82
85
  type ITextDecoration = 'none' | 'under' | 'delete';
86
+ type ITextWrap = 'normal' | 'none' | 'break';
83
87
  interface IVectorPath {
84
88
  rule?: IWindingRule;
85
89
  data: string | IPathCommandData;
@@ -158,10 +162,10 @@ interface ICornerRadiusComputedData {
158
162
  cornerSmoothing?: number;
159
163
  }
160
164
  interface IFillAttrData {
161
- fill: IPaint | IPaint[] | IPaintString;
165
+ fill: IFill;
162
166
  }
163
167
  interface IFillInputData {
164
- fill?: IPaint | IPaint[] | IPaintString;
168
+ fill?: IFill;
165
169
  }
166
170
  interface IFillComputedData {
167
171
  fill?: IColorString | ILeafPaint[];
@@ -171,7 +175,7 @@ interface IBorderComputedData {
171
175
  borderRadius?: number | number[];
172
176
  }
173
177
  interface IStrokeAttrData {
174
- stroke: IPaint | IPaint[] | IPaintString;
178
+ stroke: IStroke;
175
179
  strokeAlign: IStrokeAlign;
176
180
  strokeWidth: number | number[] | IStrokeWidthString;
177
181
  strokeCap: IStrokeCap;
@@ -181,7 +185,7 @@ interface IStrokeAttrData {
181
185
  miterLimit: number;
182
186
  }
183
187
  interface IStrokeInputData {
184
- stroke?: IPaint | IPaint[] | IPaintString;
188
+ stroke?: IStroke;
185
189
  strokeAlign?: IStrokeAlign;
186
190
  strokeWidth?: number | number[] | IStrokeWidthString;
187
191
  strokeCap?: IStrokeCap;
@@ -214,6 +218,7 @@ interface ITextStyleAttrData {
214
218
  paraSpacing: number;
215
219
  textAlign: ITextAlign;
216
220
  verticalAlign: IVerticalAlign;
221
+ textWrap: ITextWrap;
217
222
  textOverflow: IOverflow | string;
218
223
  }
219
224
  interface ITextStyleInputData {
@@ -229,6 +234,7 @@ interface ITextStyleInputData {
229
234
  paraSpacing?: number;
230
235
  textAlign?: ITextAlign;
231
236
  verticalAlign?: IVerticalAlign;
237
+ textWrap?: ITextWrap;
232
238
  textOverflow?: IOverflow | string;
233
239
  }
234
240
  interface ITextStyleComputedData {
@@ -244,7 +250,8 @@ interface ITextStyleComputedData {
244
250
  paraSpacing?: number;
245
251
  textAlign?: ITextAlign;
246
252
  verticalAlign?: IVerticalAlign;
247
- textOverflow?: IOverflow;
253
+ textWrap?: ITextWrap;
254
+ textOverflow?: IOverflow | string;
248
255
  }
249
256
  interface IEffectAttrData {
250
257
  shadow: IShadowEffect | IShadowEffect[] | IShadowString;
@@ -279,6 +286,7 @@ interface IExportResultFunction {
279
286
  (data: IExportResult): void;
280
287
  }
281
288
  interface IExportModule {
289
+ running?: boolean;
282
290
  export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
283
291
  }
284
292
 
@@ -288,13 +296,15 @@ interface ILine extends IUI {
288
296
  points: number[];
289
297
  curve: boolean | number;
290
298
  }
291
- interface ILineData extends IUIData {
292
- }
293
- interface ILineInputData extends IUIBaseInputData {
299
+ interface ILineAttrData {
294
300
  toPoint?: IPointData;
295
301
  points?: number[];
296
302
  curve?: boolean | number;
297
303
  }
304
+ interface ILineData extends ILineAttrData, IUIData {
305
+ }
306
+ interface ILineInputData extends ILineAttrData, IUIBaseInputData {
307
+ }
298
308
  interface IRect extends IUI {
299
309
  __: IRectData;
300
310
  }
@@ -381,6 +391,8 @@ interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
381
391
  __baseLine?: number;
382
392
  __lineHeight?: number;
383
393
  __letterSpacing?: number;
394
+ __clipText?: boolean;
395
+ __textBoxBounds?: IBoundsData;
384
396
  }
385
397
  interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
386
398
  }
@@ -397,6 +409,7 @@ interface ITextRowData {
397
409
  paraStart?: boolean;
398
410
  paraEnd?: boolean;
399
411
  isOverflow?: boolean;
412
+ textMode?: boolean;
400
413
  }
401
414
  interface ITextWordData {
402
415
  x?: number;
@@ -455,6 +468,10 @@ interface ILeaferData extends IGroupData {
455
468
  interface ILeaferInputData extends IGroupInputData {
456
469
  pixelRatio?: number;
457
470
  }
471
+ interface IAppData extends ILeaferData {
472
+ }
473
+ interface IAppInputData extends ILeaferInputData {
474
+ }
458
475
  interface IFrame extends IBox {
459
476
  __: IFrameData;
460
477
  }
@@ -482,6 +499,7 @@ interface IGroup extends IUI {
482
499
  addAt(child: IUI, index: number): void;
483
500
  addAfter(child: IUI, after: IUI): void;
484
501
  addBefore(child: IUI, before: IUI): void;
502
+ addMany(...children: ILeaf[]): void;
485
503
  remove(child?: IUI): void;
486
504
  removeAll(): void;
487
505
  }
@@ -491,17 +509,31 @@ interface IGroupInputData extends IUIBaseInputData {
491
509
  }
492
510
  interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
493
511
  __: IUIData;
512
+ readonly app: ILeafer;
513
+ leafer?: ILeafer;
494
514
  parent?: IGroup;
495
- reset(_data?: IUIInputData): void;
515
+ isFrame?: boolean;
516
+ proxyData?: IUIInputData;
517
+ __proxyData?: IUIInputData;
518
+ children?: IUI[];
519
+ reset(data?: IUIInputData): void;
496
520
  set(data: IUIInputData): void;
497
521
  toJSON(): IUIInputData;
522
+ get(): IUIInputData;
523
+ createProxyData(): IUIInputData;
524
+ find(condition: number | string | IFindUIMethod, options?: any): IUI[];
525
+ findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
498
526
  getPath(curve?: boolean): IPathCommandData;
499
527
  getPathString(curve?: boolean): IPathString;
500
528
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
529
+ __drawPathByBox(drawer: IPathDrawer): void;
501
530
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
502
531
  export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>;
503
532
  clone(): IUI;
504
533
  }
534
+ interface IFindUIMethod {
535
+ (leaf: IUI, options?: any): AnswerType;
536
+ }
505
537
  interface IUIData extends IUIComputedData, ILeafData {
506
538
  padding?: number | number[];
507
539
  locked?: boolean;
@@ -515,6 +547,9 @@ interface IUIData extends IUIComputedData, ILeafData {
515
547
  __isOverflow?: boolean;
516
548
  __blendLayer?: boolean;
517
549
  __useEffect?: boolean;
550
+ __autoWidth: boolean;
551
+ __autoHeight: boolean;
552
+ __autoBounds: boolean;
518
553
  path?: IPathCommandData;
519
554
  windingRule?: IWindingRule;
520
555
  __pathForRender?: IPathCommandData;
@@ -530,10 +565,96 @@ interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrok
530
565
  interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
531
566
  padding?: number | number[];
532
567
  locked?: boolean;
533
- children?: IUIBaseInputData[];
568
+ children?: IUIInputData[];
534
569
  }
535
570
  type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
536
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;
537
658
  }
538
659
 
539
660
  type IUIRenderModule = IUIRender & ThisType<IUI>;
@@ -598,4 +719,4 @@ interface IEffectModule {
598
719
  backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, renderOptions: IRenderOptions): void;
599
720
  }
600
721
 
601
- 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, 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 };