@leafer-ui/interface 1.0.0-rc.6 → 1.0.0-rc.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/interface",
3
- "version": "1.0.0-rc.6",
3
+ "version": "1.0.0-rc.8",
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.6"
25
+ "@leafer/interface": "1.0.0-rc.8"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
- import { IPaint, IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, IUnitData, ITextWrap } 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
package/src/IUI.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, IPathString, ILeaferImage, IBlob, IPathCreator, IFindMethod } 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,7 @@ export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIDat
124
127
  __baseLine?: number
125
128
  __lineHeight?: number
126
129
  __letterSpacing?: number
130
+ __padding?: number[]
127
131
  __clipText?: boolean
128
132
  __textBoxBounds?: IBoundsData
129
133
  }
@@ -212,6 +216,12 @@ export interface ILeaferInputData extends IGroupInputData {
212
216
  pixelRatio?: number
213
217
  }
214
218
 
219
+ export interface IAppData extends ILeaferData {
220
+
221
+ }
222
+ export interface IAppInputData extends ILeaferInputData {
223
+
224
+ }
215
225
 
216
226
  // Frame
217
227
  export interface IFrame extends IBox {
@@ -249,6 +259,7 @@ export interface IGroup extends IUI {
249
259
  addAt(child: IUI, index: number): void
250
260
  addAfter(child: IUI, after: IUI): void
251
261
  addBefore(child: IUI, before: IUI): void
262
+ addMany(...children: ILeaf[]): void
252
263
  remove(child?: IUI): void
253
264
  removeAll(): void
254
265
  }
@@ -258,30 +269,41 @@ export interface IGroupInputData extends IUIBaseInputData { }
258
269
  // UI
259
270
  export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
260
271
  __: IUIData
272
+
273
+ readonly app: ILeafer
274
+ leafer?: ILeafer
261
275
  parent?: IGroup
276
+ isFrame?: boolean
277
+
278
+ proxyData: IUIInputData
279
+ __proxyData?: IUIInputData
262
280
 
263
- proxyData?: IUIInputData
281
+ children?: IUI[]
264
282
 
265
- reset(_data?: IUIInputData): void
283
+ reset(data?: IUIInputData): void
266
284
 
267
285
  set(data: IUIInputData): void
268
286
  toJSON(): IUIInputData
269
287
 
270
- get(options?: ILeafDataOptions): IUIInputData
271
- getProxyData(): IUIInputData
288
+ get(): IUIInputData
289
+ createProxyData(): IUIInputData
272
290
 
273
- find(condition: number | string | IFindMethod): IUI[]
274
- findOne(condition: number | string | IFindMethod): IUI
291
+ find(condition: number | string | IFindUIMethod, options?: any): IUI[]
292
+ findOne(condition: number | string | IFindUIMethod, options?: any): IUI
275
293
 
276
294
  getPath(curve?: boolean): IPathCommandData
277
295
  getPathString(curve?: boolean): IPathString
278
296
 
279
297
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
298
+ __drawPathByBox(drawer: IPathDrawer): void
280
299
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
281
300
 
282
301
  export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>
283
302
  clone(): IUI
303
+ }
284
304
 
305
+ export interface IFindUIMethod {
306
+ (leaf: IUI, options?: any): AnswerType
285
307
  }
286
308
 
287
309
  export interface IUIData extends IUIComputedData, ILeafData {
@@ -305,6 +327,10 @@ export interface IUIData extends IUIComputedData, ILeafData {
305
327
 
306
328
  __useEffect?: boolean
307
329
 
330
+ __autoWidth: boolean
331
+ __autoHeight: boolean
332
+ __autoBounds: boolean
333
+
308
334
  // path
309
335
  path?: IPathCommandData
310
336
  windingRule?: IWindingRule
@@ -328,7 +354,7 @@ export interface IUIComputedData extends IFillComputedData, IBorderComputedData,
328
354
  export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
329
355
  padding?: number | number[]
330
356
  locked?: boolean
331
- children?: IUIBaseInputData[]
357
+ children?: IUIInputData[]
332
358
  }
333
359
 
334
360
 
@@ -351,5 +377,5 @@ export type IUITag =
351
377
 
352
378
 
353
379
  export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
354
-
380
+ children?: IUIInputData[]
355
381
  }
@@ -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, 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[]
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,11 +18,13 @@ 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, ITextWrap } from './type/IType'
22
- export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString as IStringColor } from './type/IStringType'
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, IRepeat } from './type/IType'
27
+ export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString } from './type/IStringType'
23
28
  export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
24
29
 
25
30
  export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
@@ -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
  }
@@ -27,6 +27,7 @@ export interface ILeafPaintPatternData {
27
27
  opacity?: number
28
28
  transform?: IMatrixData
29
29
  mode?: IImagePaintMode
30
+ repeat?: 'repeat' | 'repeat-x' | 'repeat-y'
30
31
  }
31
32
 
32
33
  export type ILeafFill = ILeafPaint
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
@@ -68,6 +72,8 @@ export interface IImagePaint extends IPaintBase {
68
72
  offset?: IPointData
69
73
  scale?: number | IPointData
70
74
  rotation?: number
75
+
76
+ repeat?: IRepeat
71
77
  }
72
78
  export interface IImageFilters {
73
79
  exposure?: number // 曝光
@@ -79,6 +85,7 @@ export interface IImageFilters {
79
85
  shadows?: number // 阴影
80
86
  }
81
87
  export type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat'
88
+ export type IRepeat = boolean | 'x' | 'y'
82
89
 
83
90
  // 描边
84
91
  export type IStrokeAlign = 'inside' | 'outside' | 'center'
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, ILeafDataOptions, IFindMethod, 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, 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;
@@ -59,6 +62,7 @@ interface IImagePaint extends IPaintBase {
59
62
  offset?: IPointData;
60
63
  scale?: number | IPointData;
61
64
  rotation?: number;
65
+ repeat?: IRepeat;
62
66
  }
63
67
  interface IImageFilters {
64
68
  exposure?: number;
@@ -70,6 +74,7 @@ interface IImageFilters {
70
74
  shadows?: number;
71
75
  }
72
76
  type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
77
+ type IRepeat = boolean | 'x' | 'y';
73
78
  type IStrokeAlign = 'inside' | 'outside' | 'center';
74
79
  type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-equilateral';
75
80
  type IStrokeJoin = 'bevel' | 'round' | 'miter';
@@ -126,6 +131,7 @@ interface ILeafPaintPatternData {
126
131
  opacity?: number;
127
132
  transform?: IMatrixData;
128
133
  mode?: IImagePaintMode;
134
+ repeat?: 'repeat' | 'repeat-x' | 'repeat-y';
129
135
  }
130
136
  type ILeafFill = ILeafPaint;
131
137
  interface ILeafStrokePaint extends ILeafPaint {
@@ -159,10 +165,10 @@ interface ICornerRadiusComputedData {
159
165
  cornerSmoothing?: number;
160
166
  }
161
167
  interface IFillAttrData {
162
- fill: IPaint | IPaint[] | IPaintString;
168
+ fill: IFill;
163
169
  }
164
170
  interface IFillInputData {
165
- fill?: IPaint | IPaint[] | IPaintString;
171
+ fill?: IFill;
166
172
  }
167
173
  interface IFillComputedData {
168
174
  fill?: IColorString | ILeafPaint[];
@@ -172,7 +178,7 @@ interface IBorderComputedData {
172
178
  borderRadius?: number | number[];
173
179
  }
174
180
  interface IStrokeAttrData {
175
- stroke: IPaint | IPaint[] | IPaintString;
181
+ stroke: IStroke;
176
182
  strokeAlign: IStrokeAlign;
177
183
  strokeWidth: number | number[] | IStrokeWidthString;
178
184
  strokeCap: IStrokeCap;
@@ -182,7 +188,7 @@ interface IStrokeAttrData {
182
188
  miterLimit: number;
183
189
  }
184
190
  interface IStrokeInputData {
185
- stroke?: IPaint | IPaint[] | IPaintString;
191
+ stroke?: IStroke;
186
192
  strokeAlign?: IStrokeAlign;
187
193
  strokeWidth?: number | number[] | IStrokeWidthString;
188
194
  strokeCap?: IStrokeCap;
@@ -283,6 +289,7 @@ interface IExportResultFunction {
283
289
  (data: IExportResult): void;
284
290
  }
285
291
  interface IExportModule {
292
+ running?: boolean;
286
293
  export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
287
294
  }
288
295
 
@@ -292,13 +299,15 @@ interface ILine extends IUI {
292
299
  points: number[];
293
300
  curve: boolean | number;
294
301
  }
295
- interface ILineData extends IUIData {
296
- }
297
- interface ILineInputData extends IUIBaseInputData {
302
+ interface ILineAttrData {
298
303
  toPoint?: IPointData;
299
304
  points?: number[];
300
305
  curve?: boolean | number;
301
306
  }
307
+ interface ILineData extends ILineAttrData, IUIData {
308
+ }
309
+ interface ILineInputData extends ILineAttrData, IUIBaseInputData {
310
+ }
302
311
  interface IRect extends IUI {
303
312
  __: IRectData;
304
313
  }
@@ -385,6 +394,7 @@ interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
385
394
  __baseLine?: number;
386
395
  __lineHeight?: number;
387
396
  __letterSpacing?: number;
397
+ __padding?: number[];
388
398
  __clipText?: boolean;
389
399
  __textBoxBounds?: IBoundsData;
390
400
  }
@@ -462,6 +472,10 @@ interface ILeaferData extends IGroupData {
462
472
  interface ILeaferInputData extends IGroupInputData {
463
473
  pixelRatio?: number;
464
474
  }
475
+ interface IAppData extends ILeaferData {
476
+ }
477
+ interface IAppInputData extends ILeaferInputData {
478
+ }
465
479
  interface IFrame extends IBox {
466
480
  __: IFrameData;
467
481
  }
@@ -489,6 +503,7 @@ interface IGroup extends IUI {
489
503
  addAt(child: IUI, index: number): void;
490
504
  addAfter(child: IUI, after: IUI): void;
491
505
  addBefore(child: IUI, before: IUI): void;
506
+ addMany(...children: ILeaf[]): void;
492
507
  remove(child?: IUI): void;
493
508
  removeAll(): void;
494
509
  }
@@ -498,22 +513,31 @@ interface IGroupInputData extends IUIBaseInputData {
498
513
  }
499
514
  interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
500
515
  __: IUIData;
516
+ readonly app: ILeafer;
517
+ leafer?: ILeafer;
501
518
  parent?: IGroup;
502
- proxyData?: IUIInputData;
503
- reset(_data?: IUIInputData): void;
519
+ isFrame?: boolean;
520
+ proxyData: IUIInputData;
521
+ __proxyData?: IUIInputData;
522
+ children?: IUI[];
523
+ reset(data?: IUIInputData): void;
504
524
  set(data: IUIInputData): void;
505
525
  toJSON(): IUIInputData;
506
- get(options?: ILeafDataOptions): IUIInputData;
507
- getProxyData(): IUIInputData;
508
- find(condition: number | string | IFindMethod): IUI[];
509
- findOne(condition: number | string | IFindMethod): IUI;
526
+ get(): IUIInputData;
527
+ createProxyData(): IUIInputData;
528
+ find(condition: number | string | IFindUIMethod, options?: any): IUI[];
529
+ findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
510
530
  getPath(curve?: boolean): IPathCommandData;
511
531
  getPathString(curve?: boolean): IPathString;
512
532
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
533
+ __drawPathByBox(drawer: IPathDrawer): void;
513
534
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
514
535
  export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>;
515
536
  clone(): IUI;
516
537
  }
538
+ interface IFindUIMethod {
539
+ (leaf: IUI, options?: any): AnswerType;
540
+ }
517
541
  interface IUIData extends IUIComputedData, ILeafData {
518
542
  padding?: number | number[];
519
543
  locked?: boolean;
@@ -527,6 +551,9 @@ interface IUIData extends IUIComputedData, ILeafData {
527
551
  __isOverflow?: boolean;
528
552
  __blendLayer?: boolean;
529
553
  __useEffect?: boolean;
554
+ __autoWidth: boolean;
555
+ __autoHeight: boolean;
556
+ __autoBounds: boolean;
530
557
  path?: IPathCommandData;
531
558
  windingRule?: IWindingRule;
532
559
  __pathForRender?: IPathCommandData;
@@ -542,10 +569,96 @@ interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrok
542
569
  interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
543
570
  padding?: number | number[];
544
571
  locked?: boolean;
545
- children?: IUIBaseInputData[];
572
+ children?: IUIInputData[];
546
573
  }
547
574
  type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
548
575
  interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
576
+ children?: IUIInputData[];
577
+ }
578
+
579
+ interface IEditorBase extends IGroup$1, ISelectorProxy {
580
+ config: IEditorConfig;
581
+ hoverTarget: IUI$1;
582
+ target: IUI$1 | IUI$1[];
583
+ readonly list: IUI$1[];
584
+ readonly hasTarget: boolean;
585
+ readonly multiple: boolean;
586
+ readonly single: boolean;
587
+ readonly dragging: boolean;
588
+ element: IUI$1;
589
+ buttons: IGroup$1;
590
+ selector: IGroup$1;
591
+ editBox: IGroup$1;
592
+ editTool: IObject$1;
593
+ hasItem(item: IUI$1): boolean;
594
+ shiftItem(item: IUI$1): void;
595
+ addItem(item: IUI$1): void;
596
+ removeItem(item: IUI$1): void;
597
+ update(): void;
598
+ updateEditTool(): void;
599
+ getEditSize(ui: ILeaf$1): IEditSize;
600
+ onMove(e: IDragEvent): void;
601
+ onScale(e: IDragEvent): void;
602
+ onRotate(e: IDragEvent | IRotateEvent): void;
603
+ onSkew(e: IDragEvent): void;
604
+ group(): void;
605
+ ungroup(): void;
606
+ lock(): void;
607
+ unlock(): void;
608
+ toTop(): void;
609
+ toBottom(): void;
610
+ }
611
+ interface IEditorConfig {
612
+ editSize?: 'auto' | IEditSize;
613
+ stroke?: IStroke$1;
614
+ strokeWidth?: number;
615
+ pointFill?: IFill$1;
616
+ pointSize?: number;
617
+ pointRadius?: number;
618
+ point?: IBoxInputData$1 | IBoxInputData$1[];
619
+ middlePoint?: IBoxInputData$1 | IBoxInputData$1[];
620
+ rotatePoint?: IBoxInputData$1;
621
+ rect?: IBoxInputData$1;
622
+ area?: IRectInputData$1;
623
+ buttonsDirection?: 'top' | 'right' | 'bottom' | 'left';
624
+ buttonsFixed?: boolean;
625
+ buttonsMargin?: number;
626
+ hideOnMove?: boolean;
627
+ moveCursor?: ICursorType;
628
+ resizeCursor?: ICursorType[];
629
+ rotateCursor?: ICursorType[];
630
+ around?: IAround;
631
+ lockRatio?: boolean;
632
+ rotateGap?: number;
633
+ selector?: boolean;
634
+ hover?: boolean;
635
+ boxSelect?: boolean;
636
+ rotateable?: boolean;
637
+ resizeable?: boolean;
638
+ skewable?: boolean;
639
+ }
640
+
641
+ interface ILeafer extends IGroup, ILeaferAttrData, IControl {
642
+ readonly isApp: boolean;
643
+ readonly app: ILeafer;
644
+ parent?: IApp;
645
+ zoomLayer: IGroup;
646
+ editor: IEditorBase;
647
+ ground?: ILeafer;
648
+ tree?: ILeafer;
649
+ sky?: ILeafer;
650
+ userConfig?: ILeaferConfig;
651
+ }
652
+
653
+ interface IApp extends ILeafer {
654
+ children: ILeafer[];
655
+ realCanvas: boolean;
656
+ }
657
+ interface IAppConfig extends ILeaferConfig {
658
+ ground?: ILeaferConfig;
659
+ tree?: ILeaferConfig;
660
+ sky?: ILeaferConfig;
661
+ editor?: IEditorConfig;
549
662
  }
550
663
 
551
664
  type IUIRenderModule = IUIRender & ThisType<IUI>;
@@ -610,4 +723,4 @@ interface IEffectModule {
610
723
  backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, renderOptions: IRenderOptions): void;
611
724
  }
612
725
 
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 };
726
+ export type { IApp, IAppConfig, IAppData, IAppInputData, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, 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, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, 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 };