@leafer-ui/interface 1.0.0-rc.3 → 1.0.0-rc.30

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/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { IPointData, IExportFileType, IWindingRule, IPathCommandData, IBlendMode, IMatrixData, ILeaferImage, IBlob, ILeaf, IPathString, IPathCreator, IBoundsData, ILeaferImageConfig, ILeaferCanvas, IRenderOptions, IPathDrawer, ILeafData, IPath2D, ILeafComputedData, ILeafInputData, IObject, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap } from '@leafer/interface';
1
+ import { IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IPathCreator, IBoundsData as IBoundsData$1, ILeaferImageConfig, ICanvasContext2DSettings, ILeaferCanvas, ICanvasContext2D, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IJSONOptions, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, IObject as IObject$1, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, IStateStyleType, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
+ import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject, ILeaf, IEditSize, IDragEvent, IZoomEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent } from '@leafer-ui/interface';
3
4
 
4
5
  type IPercent = string;
5
6
  type IColorString = string;
@@ -12,11 +13,10 @@ type IGradientPaintString = string;
12
13
  type IImagePaintString = string;
13
14
  type IShadowString = string;
14
15
 
15
- interface IUnitData {
16
- type: 'percent' | 'px';
17
- value: number;
18
- }
19
16
  type IPaint = ISolidPaint | IGradientPaint | IImagePaint;
17
+ type IFill = IPaint | IPaint[] | IPaintString;
18
+ type IStroke = IPaint | IPaint[] | IPaintString;
19
+ type IPaintAttr = 'fill' | 'stroke';
20
20
  interface IPaintBase {
21
21
  type: IPaintType;
22
22
  blendMode?: IBlendMode;
@@ -41,10 +41,10 @@ interface IRGBA extends IRGB {
41
41
  }
42
42
  interface IGradientPaint extends IPaintBase {
43
43
  type: IGradientType;
44
- from?: IPointData;
45
- to?: IPointData;
44
+ from?: IAlign | IUnitPointData;
45
+ to?: IAlign | IUnitPointData;
46
46
  stretch?: number;
47
- stops: IColorStop[];
47
+ stops: IColorStop[] | IColorString[];
48
48
  }
49
49
  interface IColorStop {
50
50
  offset: number;
@@ -56,9 +56,13 @@ interface IImagePaint extends IPaintBase {
56
56
  mode?: IImagePaintMode;
57
57
  format?: IExportFileType;
58
58
  filters?: IImageFilters;
59
+ padding?: IFourNumber;
60
+ align?: IAlign;
59
61
  offset?: IPointData;
62
+ size?: number | ISizeData;
60
63
  scale?: number | IPointData;
61
64
  rotation?: number;
65
+ repeat?: IRepeat;
62
66
  }
63
67
  interface IImageFilters {
64
68
  exposure?: number;
@@ -69,10 +73,25 @@ interface IImageFilters {
69
73
  highlights?: number;
70
74
  shadows?: number;
71
75
  }
72
- type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
76
+ type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
77
+ type IRepeat = boolean | 'x' | 'y';
73
78
  type IStrokeAlign = 'inside' | 'outside' | 'center';
74
- type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-equilateral';
79
+ type IStrokeCap = 'none' | 'round' | 'square';
75
80
  type IStrokeJoin = 'bevel' | 'round' | 'miter';
81
+ type IArrowType = IPathDataArrow | 'none' | 'angle' | 'angle-side' | 'arrow' | 'triangle' | 'triangle-flip' | 'circle' | 'circle-line' | 'square' | 'square-line' | 'diamond' | 'diamond-line' | 'mark';
82
+ interface IPathDataArrowMap {
83
+ [name: string]: IPathDataArrow;
84
+ }
85
+ interface IPathDataArrow {
86
+ connect?: IPathDataArrowOffset;
87
+ offset?: IPathDataArrowOffset;
88
+ path: IPathCommandData;
89
+ }
90
+ interface IPathDataArrowOffset {
91
+ x?: number;
92
+ bevelJoin?: number;
93
+ roundJoin?: number;
94
+ }
76
95
  type ITextAlign = 'left' | 'center' | 'right' | 'justify';
77
96
  type IVerticalAlign = 'top' | 'middle' | 'bottom';
78
97
  type ITextCase = 'upper' | 'lower' | 'title' | 'none' | 'small-caps';
@@ -80,6 +99,7 @@ type IFontWeight = IFontWeightNumer | IFontWeightString;
80
99
  type IFontWeightNumer = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
81
100
  type IFontWeightString = 'thin' | 'extra-light' | 'light' | 'normal' | 'medium' | 'semi-bold' | 'bold' | 'extra-bold' | 'black';
82
101
  type ITextDecoration = 'none' | 'under' | 'delete';
102
+ type ITextWrap = 'normal' | 'none' | 'break';
83
103
  interface IVectorPath {
84
104
  rule?: IWindingRule;
85
105
  data: string | IPathCommandData;
@@ -114,6 +134,7 @@ interface ILeafPaint {
114
134
  image?: ILeaferImage;
115
135
  loadId?: number;
116
136
  patternId?: string;
137
+ patternTask?: ITaskItem;
117
138
  data?: ILeafPaintPatternData;
118
139
  }
119
140
  interface ILeafPaintPatternData {
@@ -124,6 +145,7 @@ interface ILeafPaintPatternData {
124
145
  opacity?: number;
125
146
  transform?: IMatrixData;
126
147
  mode?: IImagePaintMode;
148
+ repeat?: 'repeat' | 'repeat-x' | 'repeat-y';
127
149
  }
128
150
  type ILeafFill = ILeafPaint;
129
151
  interface ILeafStrokePaint extends ILeafPaint {
@@ -145,22 +167,22 @@ interface ILeafShadowEffect {
145
167
  }
146
168
 
147
169
  interface ICornerRadiusAttrData {
148
- cornerRadius: number | number[] | ICornerRadiusString;
149
- cornerSmoothing: number;
170
+ cornerRadius?: IFourNumber | ICornerRadiusString;
171
+ cornerSmoothing?: INumber;
150
172
  }
151
173
  interface ICornerRadiusInputData {
152
- cornerRadius?: number | number[] | ICornerRadiusString;
153
- cornerSmoothing?: number;
174
+ cornerRadius?: IFourNumber | ICornerRadiusString;
175
+ cornerSmoothing?: INumber;
154
176
  }
155
177
  interface ICornerRadiusComputedData {
156
178
  cornerRadius?: number;
157
179
  cornerSmoothing?: number;
158
180
  }
159
181
  interface IFillAttrData {
160
- fill: IPaint | IPaint[] | IPaintString;
182
+ fill?: IFill;
161
183
  }
162
184
  interface IFillInputData {
163
- fill?: IPaint | IPaint[] | IPaintString;
185
+ fill?: IFill;
164
186
  }
165
187
  interface IFillComputedData {
166
188
  fill?: IColorString | ILeafPaint[];
@@ -170,64 +192,75 @@ interface IBorderComputedData {
170
192
  borderRadius?: number | number[];
171
193
  }
172
194
  interface IStrokeAttrData {
173
- stroke: IPaint | IPaint[] | IPaintString;
174
- strokeAlign: IStrokeAlign;
175
- strokeWidth: number | number[] | IStrokeWidthString;
176
- strokeCap: IStrokeCap;
177
- strokeJoin: IStrokeJoin;
178
- dashPattern: number[] | IDashPatternString;
179
- dashOffset: number;
180
- miterLimit: number;
195
+ stroke?: IStroke;
196
+ strokeAlign?: IStrokeAlign;
197
+ strokeWidth?: IFourNumber | IStrokeWidthString;
198
+ strokeWidthFixed?: IBoolean;
199
+ strokeCap?: IStrokeCap;
200
+ strokeJoin?: IStrokeJoin;
201
+ dashPattern?: INumber[] | IDashPatternString;
202
+ dashOffset?: INumber;
203
+ miterLimit?: INumber;
204
+ startArrow?: IArrowType;
205
+ endArrow?: IArrowType;
181
206
  }
182
207
  interface IStrokeInputData {
183
- stroke?: IPaint | IPaint[] | IPaintString;
208
+ stroke?: IStroke;
184
209
  strokeAlign?: IStrokeAlign;
185
- strokeWidth?: number | number[] | IStrokeWidthString;
210
+ strokeWidth?: IFourNumber | IStrokeWidthString;
211
+ strokeWidthFixed?: IBoolean;
186
212
  strokeCap?: IStrokeCap;
187
213
  strokeJoin?: IStrokeJoin;
188
- dashPattern?: number[] | IDashPatternString;
189
- dashOffset?: number;
190
- miterLimit?: number;
214
+ dashPattern?: INumber[] | IDashPatternString;
215
+ dashOffset?: INumber;
216
+ miterLimit?: INumber;
217
+ startArrow?: IArrowType;
218
+ endArrow?: IArrowType;
191
219
  }
192
220
  interface IStrokeComputedData {
193
221
  stroke?: IColorString | ILeafStrokePaint[];
194
222
  strokeAlign?: IStrokeAlign;
195
223
  strokeWidth?: number;
196
224
  strokeWidths?: number[];
225
+ strokeWidthFixed?: boolean;
197
226
  strokeCap?: IStrokeCap;
198
227
  strokeJoin?: IStrokeJoin;
199
228
  dashPattern?: number[];
200
229
  dashOffset?: number;
201
230
  miterLimit?: number;
231
+ startArrow?: IArrowType;
232
+ endArrow?: IArrowType;
202
233
  }
203
234
  interface ITextStyleAttrData {
204
- fontFamily: string;
205
- fontSize: number;
206
- fontWeight: IFontWeight;
207
- italic: boolean;
208
- textCase: ITextCase;
209
- textDecoration: ITextDecoration;
210
- letterSpacing: number | IUnitData;
211
- lineHeight: number | IUnitData;
212
- paraIndent: number;
213
- paraSpacing: number;
214
- textAlign: ITextAlign;
215
- verticalAlign: IVerticalAlign;
216
- textOverflow: IOverflow | string;
235
+ fontFamily?: IString;
236
+ fontSize?: INumber;
237
+ fontWeight?: IFontWeight;
238
+ italic?: IBoolean;
239
+ textCase?: ITextCase;
240
+ textDecoration?: ITextDecoration;
241
+ letterSpacing?: INumber | IUnitData;
242
+ lineHeight?: INumber | IUnitData;
243
+ paraIndent?: INumber;
244
+ paraSpacing?: INumber;
245
+ textAlign?: ITextAlign;
246
+ verticalAlign?: IVerticalAlign;
247
+ textWrap?: ITextWrap;
248
+ textOverflow?: IOverflow | string;
217
249
  }
218
250
  interface ITextStyleInputData {
219
- fontFamily?: string;
220
- fontSize?: number;
251
+ fontFamily?: IString;
252
+ fontSize?: INumber;
221
253
  fontWeight?: IFontWeight;
222
- italic?: boolean;
254
+ italic?: IBoolean;
223
255
  textCase?: ITextCase;
224
256
  textDecoration?: ITextDecoration;
225
- letterSpacing?: number | IUnitData;
226
- lineHeight?: number | IUnitData;
227
- paraIndent?: number;
228
- paraSpacing?: number;
257
+ letterSpacing?: INumber | IUnitData;
258
+ lineHeight?: INumber | IUnitData;
259
+ paraIndent?: INumber;
260
+ paraSpacing?: INumber;
229
261
  textAlign?: ITextAlign;
230
262
  verticalAlign?: IVerticalAlign;
263
+ textWrap?: ITextWrap;
231
264
  textOverflow?: IOverflow | string;
232
265
  }
233
266
  interface ITextStyleComputedData {
@@ -243,21 +276,22 @@ interface ITextStyleComputedData {
243
276
  paraSpacing?: number;
244
277
  textAlign?: ITextAlign;
245
278
  verticalAlign?: IVerticalAlign;
246
- textOverflow?: IOverflow;
279
+ textWrap?: ITextWrap;
280
+ textOverflow?: IOverflow | string;
247
281
  }
248
282
  interface IEffectAttrData {
249
- shadow: IShadowEffect | IShadowEffect[] | IShadowString;
250
- innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
251
- blur: number | IBlurEffect;
252
- backgroundBlur: number | IBlurEffect;
253
- grayscale: number | IGrayscaleEffect;
283
+ shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
284
+ innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString;
285
+ blur?: INumber | IBlurEffect;
286
+ backgroundBlur?: INumber | IBlurEffect;
287
+ grayscale?: INumber | IGrayscaleEffect;
254
288
  }
255
289
  interface IEffectInputData {
256
290
  shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
257
291
  innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString;
258
- blur?: number | IBlurEffect;
259
- backgroundBlur?: number | IBlurEffect;
260
- grayscale?: number | IGrayscaleEffect;
292
+ blur?: INumber | IBlurEffect;
293
+ backgroundBlur?: INumber | IBlurEffect;
294
+ grayscale?: INumber | IGrayscaleEffect;
261
295
  }
262
296
  interface IEffectComputedData {
263
297
  shadow?: ILeafShadowEffect[];
@@ -267,33 +301,159 @@ interface IEffectComputedData {
267
301
  grayscale?: number;
268
302
  }
269
303
 
270
- interface IExportOptions {
271
- quality?: number;
272
- blob?: boolean;
273
- }
274
- interface IExportResult {
275
- data: IBlob | string | boolean;
276
- }
277
- interface IExportResultFunction {
278
- (data: IExportResult): void;
279
- }
280
- interface IExportModule {
281
- export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
304
+ interface IEditorBase extends IGroup$1, ISelectorProxy {
305
+ config: IEditorConfig;
306
+ readonly mergeConfig: IEditorConfig;
307
+ hoverTarget?: IUI$1;
308
+ target?: IUI$1 | IUI$1[];
309
+ readonly list: IUI$1[];
310
+ leafList: ILeafList;
311
+ openedGroupList: ILeafList;
312
+ readonly editing: boolean;
313
+ innerEditing: boolean;
314
+ readonly groupOpening: boolean;
315
+ readonly multiple: boolean;
316
+ readonly single: boolean;
317
+ readonly dragging: boolean;
318
+ element?: IUI$1;
319
+ buttons: IGroup$1;
320
+ selector: IGroup$1;
321
+ editBox: IEditBoxBase;
322
+ editTool?: IObject;
323
+ innerEditor?: IObject;
324
+ select(target: IUI$1 | IUI$1[]): void;
325
+ cancel(): void;
326
+ hasItem(item: IUI$1): boolean;
327
+ shiftItem(item: IUI$1): void;
328
+ addItem(item: IUI$1): void;
329
+ removeItem(item: IUI$1): void;
330
+ update(): void;
331
+ updateEditBox(): void;
332
+ updateEditTool(): void;
333
+ getEditSize(ui: ILeaf): IEditSize;
334
+ onMove(e: IDragEvent): void;
335
+ onScale(e: IDragEvent | IZoomEvent): void;
336
+ onRotate(e: IDragEvent | IRotateEvent): void;
337
+ onSkew(e: IDragEvent): void;
338
+ group(group?: IGroup$1 | IGroupInputData$1): IGroup$1;
339
+ ungroup(): IUI$1[];
340
+ openGroup(group: IGroup$1): void;
341
+ closeGroup(group: IGroup$1): void;
342
+ openInnerEditor(target?: IUI$1): void;
343
+ closeInnerEditor(): void;
344
+ lock(): void;
345
+ unlock(): void;
346
+ toTop(): void;
347
+ toBottom(): void;
348
+ }
349
+ interface IEditorConfig {
350
+ editSize?: IEditSize;
351
+ dualEvent?: boolean;
352
+ keyEvent?: boolean;
353
+ stroke?: IStroke$1;
354
+ strokeWidth?: number;
355
+ pointFill?: IFill$1;
356
+ pointSize?: number;
357
+ pointRadius?: number;
358
+ point?: IBoxInputData$1 | IBoxInputData$1[];
359
+ middlePoint?: IBoxInputData$1 | IBoxInputData$1[];
360
+ rotatePoint?: IBoxInputData$1;
361
+ rect?: IBoxInputData$1;
362
+ area?: IRectInputData$1;
363
+ mask?: IColorString$1;
364
+ buttonsDirection?: 'top' | 'right' | 'bottom' | 'left';
365
+ buttonsFixed?: boolean;
366
+ buttonsMargin?: number;
367
+ hideOnMove?: boolean;
368
+ hideOnSmall?: boolean | number;
369
+ moveCursor?: ICursorType;
370
+ resizeCursor?: IImageCursor;
371
+ rotateCursor?: IImageCursor;
372
+ skewCursor?: IImageCursor;
373
+ around?: IAlign$1 | IUnitPointData$1;
374
+ lockRatio?: boolean | 'corner';
375
+ rotateGap?: number;
376
+ selector?: boolean;
377
+ hover?: boolean;
378
+ hoverStyle?: IUIInputData$1;
379
+ select?: 'press' | 'tap';
380
+ boxSelect?: boolean;
381
+ continuousSelect?: boolean;
382
+ openInner?: 'double' | 'long';
383
+ moveable?: boolean;
384
+ rotateable?: boolean | 'rotate';
385
+ resizeable?: boolean | 'zoom';
386
+ skewable?: boolean;
387
+ }
388
+ interface IEditPoint extends IBox$1 {
389
+ direction: number;
390
+ pointType: IEditPointType;
391
+ }
392
+ type IEditPointType = 'rotate' | 'resize';
393
+ interface IEditBoxBase extends IGroup$1 {
394
+ editor: IEditorBase;
395
+ dragging: boolean;
396
+ moving: boolean;
397
+ view: IGroup$1;
398
+ circle: IEditPoint;
399
+ rect: IRect$1;
400
+ buttons: IGroup$1;
401
+ resizePoints: IEditPoint[];
402
+ rotatePoints: IEditPoint[];
403
+ resizeLines: IEditPoint[];
404
+ readonly flipped: boolean;
405
+ readonly flippedX: boolean;
406
+ readonly flippedY: boolean;
407
+ readonly flippedOne: boolean;
408
+ enterPoint: IEditPoint;
409
+ getPointStyle(userStyle?: IBoxInputData$1): IBoxInputData$1;
410
+ getPointsStyle(): IBoxInputData$1[];
411
+ getMiddlePointsStyle(): IBoxInputData$1[];
412
+ load(): void;
413
+ update(bounds: IBoundsData): void;
414
+ unload(): void;
415
+ onArrow(e: IKeyEvent): void;
416
+ }
417
+ interface IEditorConfigFunction {
418
+ (ui: any): IEditorConfig;
419
+ }
420
+ interface IEditToolFunction {
421
+ (ui: any): string;
282
422
  }
283
423
 
284
424
  interface ILine extends IUI {
285
425
  __: ILineData;
286
- toPoint: IPointData;
287
- points: number[];
288
- curve: boolean | number;
289
- }
290
- interface ILineData extends IUIData {
426
+ toPoint?: IPointData;
427
+ points?: number[];
428
+ curve?: boolean | number;
291
429
  }
292
- interface ILineInputData extends IUIBaseInputData {
430
+ interface ILineAttrData {
293
431
  toPoint?: IPointData;
294
432
  points?: number[];
295
433
  curve?: boolean | number;
296
434
  }
435
+ interface ILineData extends ILineAttrData, IUIData {
436
+ }
437
+ interface ILineInputData extends ILineAttrData, IUIBaseInputData {
438
+ }
439
+ interface IArrow extends ILine {
440
+ __: IArrowData;
441
+ }
442
+ interface IArrowAttrData {
443
+ }
444
+ interface IArrowData extends IArrowAttrData, ILineData {
445
+ }
446
+ interface IArrowInputData extends IArrowAttrData, ILineInputData {
447
+ }
448
+ interface IFlow extends IBox {
449
+ __: IFlowData;
450
+ }
451
+ interface IFlowAttrData {
452
+ }
453
+ interface IFlowData extends IFlowAttrData, IBoxData {
454
+ }
455
+ interface IFlowInputData extends IFlowAttrData, IBoxInputData {
456
+ }
297
457
  interface IRect extends IUI {
298
458
  __: IRectData;
299
459
  }
@@ -303,9 +463,9 @@ interface IRectInputData extends IUIBaseInputData {
303
463
  }
304
464
  interface IEllipse extends IUI {
305
465
  __: IEllipseData;
306
- startAngle: number;
307
- endAngle: number;
308
- innerRadius: number;
466
+ startAngle?: number;
467
+ endAngle?: number;
468
+ innerRadius?: number;
309
469
  }
310
470
  interface IEllipseAttrData {
311
471
  startAngle?: number;
@@ -318,9 +478,9 @@ interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
318
478
  }
319
479
  interface IPolygon extends IUI {
320
480
  __: IPolygonData;
321
- sides: number;
322
- points: number[];
323
- curve: boolean | number;
481
+ sides?: number;
482
+ points?: number[];
483
+ curve?: boolean | number;
324
484
  }
325
485
  interface IPolygonAttrData {
326
486
  sides?: number;
@@ -333,8 +493,8 @@ interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
333
493
  }
334
494
  interface IStar extends IUI {
335
495
  __: IStarData;
336
- corners: number;
337
- innerRadius: number;
496
+ corners?: number;
497
+ innerRadius?: number;
338
498
  }
339
499
  interface IStarAttrData {
340
500
  corners?: number;
@@ -346,16 +506,10 @@ interface IStarInputData extends IStarAttrData, IUIBaseInputData {
346
506
  }
347
507
  interface IPath extends IUI {
348
508
  __: IPathData;
349
- path: IPathCommandData | IPathString;
350
- windingRule: IWindingRule;
351
509
  }
352
510
  interface IPathData extends IUIData {
353
- path?: IPathCommandData;
354
- windingRule?: IWindingRule;
355
511
  }
356
512
  interface IPathInputData extends IUIBaseInputData {
357
- path?: IPathCommandData | IPathString;
358
- windingRule?: IWindingRule;
359
513
  }
360
514
  interface IPen extends IGroup, IPathCreator {
361
515
  __: IPenData;
@@ -363,7 +517,6 @@ interface IPen extends IGroup, IPathCreator {
363
517
  pathStyle: IPathInputData;
364
518
  path: IPathCommandData;
365
519
  paint(): void;
366
- clear(): void;
367
520
  }
368
521
  interface IPenData extends IGroupData {
369
522
  }
@@ -371,15 +524,22 @@ interface IPenInputData extends IGroupInputData {
371
524
  }
372
525
  interface IText extends ITextStyleAttrData, IUI {
373
526
  __: ITextData;
374
- text: string;
527
+ text?: string;
528
+ padding?: IFourNumber;
529
+ resizeFontSize?: IBoolean;
375
530
  }
376
531
  interface ITextAttrData {
377
532
  text?: string;
533
+ padding?: IFourNumber;
534
+ resizeFontSize?: boolean;
378
535
  }
379
536
  interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
380
537
  __baseLine?: number;
381
538
  __lineHeight?: number;
382
539
  __letterSpacing?: number;
540
+ __padding?: number[];
541
+ __clipText?: boolean;
542
+ __textBoxBounds?: IBoundsData$1;
383
543
  }
384
544
  interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
385
545
  }
@@ -396,6 +556,7 @@ interface ITextRowData {
396
556
  paraStart?: boolean;
397
557
  paraEnd?: boolean;
398
558
  isOverflow?: boolean;
559
+ textMode?: boolean;
399
560
  }
400
561
  interface ITextWordData {
401
562
  x?: number;
@@ -412,7 +573,7 @@ interface ITextCharData {
412
573
  char?: string;
413
574
  }
414
575
  interface ITextDrawData {
415
- bounds: IBoundsData;
576
+ bounds: IBoundsData$1;
416
577
  rows: ITextRowData[];
417
578
  paraNumber: number;
418
579
  font: string;
@@ -430,29 +591,33 @@ interface IImageAttrData {
430
591
  url?: string;
431
592
  }
432
593
  interface IImageData extends IImageAttrData, IRectData {
594
+ __setImageFill(value: string): void;
433
595
  }
434
596
  interface IImageInputData extends IImageAttrData, IUIBaseInputData {
435
597
  }
436
598
  interface ICanvas extends IRect {
437
599
  __: ICanvasData;
438
- pixelRatio: number;
439
- smooth: boolean;
440
- canvas: ILeaferCanvas;
600
+ smooth?: boolean;
601
+ contextSettings?: ICanvasContext2DSettings;
602
+ canvas?: ILeaferCanvas;
603
+ context?: ICanvasContext2D;
441
604
  __updateSize(): void;
442
605
  }
443
606
  interface ICanvasAttrData {
444
- pixelRatio?: number;
445
607
  smooth?: boolean;
608
+ contextSettings?: ICanvasContext2DSettings;
446
609
  }
447
610
  interface ICanvasData extends ICanvasAttrData, IRectData {
448
611
  }
449
612
  interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData {
450
613
  }
451
614
  interface ILeaferData extends IGroupData {
452
- pixelRatio?: number;
453
615
  }
454
616
  interface ILeaferInputData extends IGroupInputData {
455
- pixelRatio?: number;
617
+ }
618
+ interface IAppData extends ILeaferData {
619
+ }
620
+ interface IAppInputData extends ILeaferInputData {
456
621
  }
457
622
  interface IFrame extends IBox {
458
623
  __: IFrameData;
@@ -463,73 +628,148 @@ interface IFrameInputData extends IBoxInputData {
463
628
  }
464
629
  interface IBox extends IGroup {
465
630
  __: IBoxData;
466
- overflow: IOverflow;
631
+ resizeChildren?: IBoolean;
632
+ overflow?: IOverflow;
467
633
  __updateRectRenderBounds(): void;
468
634
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
469
635
  }
470
636
  interface IBoxData extends IGroupData {
637
+ resizeChildren?: boolean;
471
638
  overflow?: IOverflow;
472
639
  }
473
640
  interface IBoxInputData extends IGroupInputData {
641
+ resizeChildren?: boolean;
474
642
  overflow?: IOverflow;
475
643
  }
476
644
  interface IGroup extends IUI {
477
645
  __: IGroupData;
478
646
  children: IUI[];
479
- mask?: IUI;
647
+ pick(hitPoint: IPointData, options?: IPickOptions): IPickResult;
480
648
  add(child: IUI, index?: number): void;
481
649
  addAt(child: IUI, index: number): void;
482
650
  addAfter(child: IUI, after: IUI): void;
483
651
  addBefore(child: IUI, before: IUI): void;
652
+ addMany(...children: ILeaf$1[]): void;
484
653
  remove(child?: IUI): void;
485
654
  removeAll(): void;
655
+ clear(): void;
486
656
  }
487
657
  interface IGroupData extends IUIData {
488
658
  }
489
659
  interface IGroupInputData extends IUIBaseInputData {
490
660
  }
491
- interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
661
+ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
492
662
  __: IUIData;
663
+ readonly app: ILeafer;
664
+ leafer?: ILeafer;
493
665
  parent?: IGroup;
666
+ zoomLayer?: IGroup;
667
+ readonly isFrame?: boolean;
668
+ proxyData?: IUIInputData;
669
+ __proxyData?: IUIInputData;
670
+ normalStyle?: IUIInputData;
671
+ hoverStyle?: IUIInputData;
672
+ pressStyle?: IUIInputData;
673
+ focusStyle?: IUIInputData;
674
+ selectedStyle?: IUIInputData;
675
+ disabledStyle?: IUIInputData;
676
+ editConfig?: IEditorConfig;
677
+ editOuter: string;
678
+ editInner: string;
679
+ children?: IUI[];
680
+ readonly pen: IPathCreator;
681
+ reset(data?: IUIInputData): void;
494
682
  set(data: IUIInputData): void;
495
- toJSON(): IUIInputData;
496
- getPath(curve?: boolean): IPathCommandData;
497
- getPathString(curve?: boolean): IPathString;
683
+ toJSON(options?: IJSONOptions): IUIJSONData;
684
+ get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
685
+ createProxyData(): IUIInputData;
686
+ find(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI[];
687
+ findTag(tag: string | string[]): IUI[];
688
+ findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI | undefined;
689
+ findId(id: number | string): IUI | undefined;
690
+ getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
691
+ getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
692
+ load(): void;
498
693
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
694
+ __drawPathByBox(drawer: IPathDrawer): void;
499
695
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
500
- export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>;
696
+ export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
501
697
  clone(): IUI;
502
698
  }
699
+ interface IFindUIMethod {
700
+ (leaf: IUI, options?: any): IAnswer;
701
+ }
503
702
  interface IUIData extends IUIComputedData, ILeafData {
504
703
  padding?: number | number[];
505
- locked?: boolean;
704
+ normalStyle?: IUIInputData;
705
+ hoverStyle?: IUIInputData;
706
+ pressStyle?: IUIInputData;
707
+ focusStyle?: IUIInputData;
708
+ selectedStyle?: IUIInputData;
709
+ disabledStyle?: IUIInputData;
506
710
  __isFills?: boolean;
507
711
  __isStrokes?: boolean;
712
+ readonly __strokeWidth: number;
713
+ __pixelFill?: boolean;
714
+ __pixelStroke?: boolean;
715
+ __isHitPixel?: boolean;
716
+ __isCanvas?: boolean;
717
+ __opacityFill?: boolean;
718
+ __opacityStroke?: boolean;
508
719
  __drawAfterFill?: boolean;
509
720
  __isOverflow?: boolean;
510
721
  __blendLayer?: boolean;
511
- __isTranslucentFill?: boolean;
512
- __isTranslucentStroke?: boolean;
513
- __useEffect?: boolean;
514
- path?: IPathCommandData;
515
- windingRule?: IWindingRule;
516
- __pathForRender?: IPathCommandData;
517
- __path2DForRender?: IPath2D;
518
722
  __boxStroke?: boolean;
519
723
  __font?: string;
520
724
  __textDrawData?: ITextDrawData;
725
+ __needComputePaint: boolean;
726
+ __computePaint(): void;
521
727
  }
522
728
  interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
523
729
  padding?: number | number[];
524
- locked?: boolean;
525
730
  }
526
731
  interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
527
732
  padding?: number | number[];
528
- locked?: boolean;
529
- children?: IUIBaseInputData[];
733
+ normalStyle?: IUIInputData;
734
+ hoverStyle?: IUIInputData;
735
+ pressStyle?: IUIInputData;
736
+ focusStyle?: IUIInputData;
737
+ selectedStyle?: IUIInputData;
738
+ disabledStyle?: IUIInputData;
739
+ children?: IUIInputData[];
530
740
  }
531
741
  type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
532
- interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
742
+ interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject$1 {
743
+ children?: IUIInputData[];
744
+ }
745
+ interface IUIJSONData extends IUIInputData {
746
+ matrix?: IMatrixData;
747
+ }
748
+
749
+ interface ILeafer extends IGroup, ILeaferAttrData, IControl {
750
+ readonly isApp: boolean;
751
+ readonly app: ILeafer;
752
+ parent?: IApp;
753
+ zoomLayer: IGroup;
754
+ editor: IEditorBase;
755
+ ground?: ILeafer;
756
+ tree?: ILeafer;
757
+ sky?: ILeafer;
758
+ userConfig?: ILeaferConfig;
759
+ onInit(): void;
760
+ initType(type: ILeaferType): void;
761
+ destroy(sync?: boolean): void;
762
+ }
763
+
764
+ interface IApp extends ILeafer {
765
+ children: ILeafer[];
766
+ realCanvas: boolean;
767
+ }
768
+ interface IAppConfig extends ILeaferConfig {
769
+ ground?: ILeaferConfig;
770
+ tree?: ILeaferConfig;
771
+ sky?: ILeaferConfig;
772
+ editor?: IEditorConfig;
533
773
  }
534
774
 
535
775
  type IUIRenderModule = IUIRender & ThisType<IUI>;
@@ -558,40 +798,74 @@ interface IUIBounds extends ILeafBounds {
558
798
 
559
799
  type IUIHitModule = ILeafHit & ThisType<IUI>;
560
800
 
801
+ interface IPathArrowModule {
802
+ list: IPathDataArrowMap;
803
+ addArrows(ui: IUI, changeRenderPath?: boolean): void;
804
+ }
805
+
561
806
  interface ITextConvertModule {
562
- getDrawData?(content: string, style: ITextData): ITextDrawData;
807
+ getDrawData(content: string, style: ITextData): ITextDrawData;
563
808
  }
564
809
 
565
810
  interface IColorConvertModule {
566
- string?(color: IColor, opacity?: number): string;
811
+ string(color: IColor, opacity?: number): string;
812
+ }
813
+
814
+ interface IExportModule {
815
+ running?: boolean;
816
+ export(leaf: ILeaf$1, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
817
+ }
818
+
819
+ interface IStateModule {
820
+ isHover(leaf: ILeaf$1): boolean;
821
+ isPress(leaf: ILeaf$1): boolean;
822
+ isFocus(leaf: ILeaf$1): boolean;
823
+ isDrag(leaf: ILeaf$1): boolean;
824
+ setStyle(leaf: ILeaf$1, stateType: IStateStyleType, value: boolean): void;
825
+ updateEventStyle(leaf: ILeaf$1, eventType: string): void;
567
826
  }
568
827
 
569
828
  interface ICachedShape extends ICachedLeaf {
570
829
  worldCanvas?: ILeaferCanvas;
571
- shapeBounds: IBoundsData;
830
+ shapeBounds: IBoundsData$1;
572
831
  scaleX: number;
573
832
  scaleY: number;
574
833
  }
575
834
 
576
835
  interface IPaintModule {
577
- compute?(ui: IUI, attrName: 'fill' | 'stroke'): void;
578
- fill?(ui: IUI, canvas: ILeaferCanvas, fill: string): void;
579
- fills?(ui: IUI, canvas: ILeaferCanvas, fills: ILeafPaint[]): void;
580
- fillText?(ui: IUI, canvas: ILeaferCanvas): void;
581
- stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void;
582
- strokes?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void;
583
- strokeText?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void;
584
- strokesText?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void;
585
- drawTextStroke?(ui: IUI, canvas: ILeaferCanvas): void;
586
- shape?(ui: IUI, current: ILeaferCanvas, options: IRenderOptions): ICachedShape;
587
- recycleImage?(data: IUIData, attrName: string): IBooleanMap;
836
+ compute(attrName: IPaintAttr, ui: IUI): void;
837
+ fill(fill: string, ui: IUI, canvas: ILeaferCanvas): void;
838
+ fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
839
+ fillText(ui: IUI, canvas: ILeaferCanvas): void;
840
+ stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void;
841
+ strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
842
+ strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
843
+ drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void;
844
+ shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
845
+ }
846
+ interface IPaintImageModule {
847
+ image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData$1, firstUse: boolean): ILeafPaint;
848
+ checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, allowPaint?: boolean): boolean;
849
+ createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean;
850
+ recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap;
851
+ createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData$1): void;
852
+ getPatternData(paint: IImagePaint, box: IBoundsData$1, image: ILeaferImage): ILeafPaintPatternData;
853
+ fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
854
+ clipMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
855
+ repeatMode(data: ILeafPaintPatternData, box: IBoundsData$1, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void;
856
+ }
857
+ interface IPaintGradientModule {
858
+ linearGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
859
+ radialGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
860
+ conicGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
861
+ getTransform(box: IBoundsData$1, from: IPointData, to: IPointData, stretch: number, rotate90: boolean): IMatrixData;
588
862
  }
589
863
 
590
864
  interface IEffectModule {
591
- shadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void;
592
- innerShadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void;
593
- blur?(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas, options: IRenderOptions): void;
594
- backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void;
865
+ shadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
866
+ innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
867
+ blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void;
868
+ backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
595
869
  }
596
870
 
597
- 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 };
871
+ export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, 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, IPaintAttr, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IStateModule, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign };