@leafer-ui/interface 1.0.0-rc.9 → 1.0.0

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,6 +1,6 @@
1
- import { IPointData, IExportFileType, ISizeData, 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';
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, 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
+ 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';
4
4
 
5
5
  type IPercent = string;
6
6
  type IColorString = string;
@@ -13,13 +13,10 @@ type IGradientPaintString = string;
13
13
  type IImagePaintString = string;
14
14
  type IShadowString = string;
15
15
 
16
- interface IUnitData {
17
- type: 'percent' | 'px';
18
- value: number;
19
- }
20
16
  type IPaint = ISolidPaint | IGradientPaint | IImagePaint;
21
17
  type IFill = IPaint | IPaint[] | IPaintString;
22
18
  type IStroke = IPaint | IPaint[] | IPaintString;
19
+ type IPaintAttr = 'fill' | 'stroke';
23
20
  interface IPaintBase {
24
21
  type: IPaintType;
25
22
  blendMode?: IBlendMode;
@@ -44,10 +41,10 @@ interface IRGBA extends IRGB {
44
41
  }
45
42
  interface IGradientPaint extends IPaintBase {
46
43
  type: IGradientType;
47
- from?: IPointData;
48
- to?: IPointData;
44
+ from?: IAlign | IUnitPointData;
45
+ to?: IAlign | IUnitPointData;
49
46
  stretch?: number;
50
- stops: IColorStop[];
47
+ stops: IColorStop[] | IColorString[];
51
48
  }
52
49
  interface IColorStop {
53
50
  offset: number;
@@ -59,6 +56,8 @@ interface IImagePaint extends IPaintBase {
59
56
  mode?: IImagePaintMode;
60
57
  format?: IExportFileType;
61
58
  filters?: IImageFilters;
59
+ padding?: IFourNumber;
60
+ align?: IAlign;
62
61
  offset?: IPointData;
63
62
  size?: number | ISizeData;
64
63
  scale?: number | IPointData;
@@ -74,12 +73,25 @@ interface IImageFilters {
74
73
  highlights?: number;
75
74
  shadows?: number;
76
75
  }
77
- type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
76
+ type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
78
77
  type IRepeat = boolean | 'x' | 'y';
79
78
  type IStrokeAlign = 'inside' | 'outside' | 'center';
80
- type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-equilateral';
79
+ type IStrokeCap = 'none' | 'round' | 'square';
81
80
  type IStrokeJoin = 'bevel' | 'round' | 'miter';
82
- type IArrowType = 'none' | 'line' | 'triangle' | 'circle';
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
+ }
83
95
  type ITextAlign = 'left' | 'center' | 'right' | 'justify';
84
96
  type IVerticalAlign = 'top' | 'middle' | 'bottom';
85
97
  type ITextCase = 'upper' | 'lower' | 'title' | 'none' | 'small-caps';
@@ -155,19 +167,19 @@ interface ILeafShadowEffect {
155
167
  }
156
168
 
157
169
  interface ICornerRadiusAttrData {
158
- cornerRadius: number | number[] | ICornerRadiusString;
159
- cornerSmoothing: number;
170
+ cornerRadius?: IFourNumber | ICornerRadiusString;
171
+ cornerSmoothing?: INumber;
160
172
  }
161
173
  interface ICornerRadiusInputData {
162
- cornerRadius?: number | number[] | ICornerRadiusString;
163
- cornerSmoothing?: number;
174
+ cornerRadius?: IFourNumber | ICornerRadiusString;
175
+ cornerSmoothing?: INumber;
164
176
  }
165
177
  interface ICornerRadiusComputedData {
166
178
  cornerRadius?: number;
167
179
  cornerSmoothing?: number;
168
180
  }
169
181
  interface IFillAttrData {
170
- fill: IFill;
182
+ fill?: IFill;
171
183
  }
172
184
  interface IFillInputData {
173
185
  fill?: IFill;
@@ -180,26 +192,28 @@ interface IBorderComputedData {
180
192
  borderRadius?: number | number[];
181
193
  }
182
194
  interface IStrokeAttrData {
183
- stroke: IStroke;
184
- strokeAlign: IStrokeAlign;
185
- strokeWidth: number | number[] | IStrokeWidthString;
186
- strokeCap: IStrokeCap;
187
- strokeJoin: IStrokeJoin;
188
- dashPattern: number[] | IDashPatternString;
189
- dashOffset: number;
190
- miterLimit: number;
191
- startArrow: IArrowType;
192
- endArrow: IArrowType;
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;
193
206
  }
194
207
  interface IStrokeInputData {
195
208
  stroke?: IStroke;
196
209
  strokeAlign?: IStrokeAlign;
197
- strokeWidth?: number | number[] | IStrokeWidthString;
210
+ strokeWidth?: IFourNumber | IStrokeWidthString;
211
+ strokeWidthFixed?: IBoolean;
198
212
  strokeCap?: IStrokeCap;
199
213
  strokeJoin?: IStrokeJoin;
200
- dashPattern?: number[] | IDashPatternString;
201
- dashOffset?: number;
202
- miterLimit?: number;
214
+ dashPattern?: INumber[] | IDashPatternString;
215
+ dashOffset?: INumber;
216
+ miterLimit?: INumber;
203
217
  startArrow?: IArrowType;
204
218
  endArrow?: IArrowType;
205
219
  }
@@ -208,39 +222,42 @@ interface IStrokeComputedData {
208
222
  strokeAlign?: IStrokeAlign;
209
223
  strokeWidth?: number;
210
224
  strokeWidths?: number[];
225
+ strokeWidthFixed?: boolean;
211
226
  strokeCap?: IStrokeCap;
212
227
  strokeJoin?: IStrokeJoin;
213
228
  dashPattern?: number[];
214
229
  dashOffset?: number;
215
230
  miterLimit?: number;
231
+ startArrow?: IArrowType;
232
+ endArrow?: IArrowType;
216
233
  }
217
234
  interface ITextStyleAttrData {
218
- fontFamily: string;
219
- fontSize: number;
220
- fontWeight: IFontWeight;
221
- italic: boolean;
222
- textCase: ITextCase;
223
- textDecoration: ITextDecoration;
224
- letterSpacing: number | IUnitData;
225
- lineHeight: number | IUnitData;
226
- paraIndent: number;
227
- paraSpacing: number;
228
- textAlign: ITextAlign;
229
- verticalAlign: IVerticalAlign;
230
- textWrap: ITextWrap;
231
- 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;
232
249
  }
233
250
  interface ITextStyleInputData {
234
- fontFamily?: string;
235
- fontSize?: number;
251
+ fontFamily?: IString;
252
+ fontSize?: INumber;
236
253
  fontWeight?: IFontWeight;
237
- italic?: boolean;
254
+ italic?: IBoolean;
238
255
  textCase?: ITextCase;
239
256
  textDecoration?: ITextDecoration;
240
- letterSpacing?: number | IUnitData;
241
- lineHeight?: number | IUnitData;
242
- paraIndent?: number;
243
- paraSpacing?: number;
257
+ letterSpacing?: INumber | IUnitData;
258
+ lineHeight?: INumber | IUnitData;
259
+ paraIndent?: INumber;
260
+ paraSpacing?: INumber;
244
261
  textAlign?: ITextAlign;
245
262
  verticalAlign?: IVerticalAlign;
246
263
  textWrap?: ITextWrap;
@@ -263,18 +280,18 @@ interface ITextStyleComputedData {
263
280
  textOverflow?: IOverflow | string;
264
281
  }
265
282
  interface IEffectAttrData {
266
- shadow: IShadowEffect | IShadowEffect[] | IShadowString;
267
- innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
268
- blur: number | IBlurEffect;
269
- backgroundBlur: number | IBlurEffect;
270
- 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;
271
288
  }
272
289
  interface IEffectInputData {
273
290
  shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
274
291
  innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString;
275
- blur?: number | IBlurEffect;
276
- backgroundBlur?: number | IBlurEffect;
277
- grayscale?: number | IGrayscaleEffect;
292
+ blur?: INumber | IBlurEffect;
293
+ backgroundBlur?: INumber | IBlurEffect;
294
+ grayscale?: INumber | IGrayscaleEffect;
278
295
  }
279
296
  interface IEffectComputedData {
280
297
  shadow?: ILeafShadowEffect[];
@@ -284,26 +301,131 @@ interface IEffectComputedData {
284
301
  grayscale?: number;
285
302
  }
286
303
 
287
- interface IExportOptions {
288
- quality?: number;
289
- blob?: boolean;
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;
290
348
  }
291
- interface IExportResult {
292
- data: IBlob | string | boolean;
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;
293
387
  }
294
- interface IExportResultFunction {
295
- (data: IExportResult): void;
388
+ interface IEditPoint extends IBox$1 {
389
+ direction: number;
390
+ pointType: IEditPointType;
296
391
  }
297
- interface IExportModule {
298
- running?: boolean;
299
- export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
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;
300
422
  }
301
423
 
302
424
  interface ILine extends IUI {
303
425
  __: ILineData;
304
- toPoint: IPointData;
305
- points: number[];
306
- curve: boolean | number;
426
+ toPoint?: IPointData;
427
+ points?: number[];
428
+ curve?: boolean | number;
307
429
  }
308
430
  interface ILineAttrData {
309
431
  toPoint?: IPointData;
@@ -321,7 +443,16 @@ interface IArrowAttrData {
321
443
  }
322
444
  interface IArrowData extends IArrowAttrData, ILineData {
323
445
  }
324
- interface IArrowInputData extends IArrowAttrData, IUIBaseInputData {
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 {
325
456
  }
326
457
  interface IRect extends IUI {
327
458
  __: IRectData;
@@ -332,9 +463,9 @@ interface IRectInputData extends IUIBaseInputData {
332
463
  }
333
464
  interface IEllipse extends IUI {
334
465
  __: IEllipseData;
335
- startAngle: number;
336
- endAngle: number;
337
- innerRadius: number;
466
+ startAngle?: number;
467
+ endAngle?: number;
468
+ innerRadius?: number;
338
469
  }
339
470
  interface IEllipseAttrData {
340
471
  startAngle?: number;
@@ -347,9 +478,9 @@ interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
347
478
  }
348
479
  interface IPolygon extends IUI {
349
480
  __: IPolygonData;
350
- sides: number;
351
- points: number[];
352
- curve: boolean | number;
481
+ sides?: number;
482
+ points?: number[];
483
+ curve?: boolean | number;
353
484
  }
354
485
  interface IPolygonAttrData {
355
486
  sides?: number;
@@ -362,8 +493,8 @@ interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
362
493
  }
363
494
  interface IStar extends IUI {
364
495
  __: IStarData;
365
- corners: number;
366
- innerRadius: number;
496
+ corners?: number;
497
+ innerRadius?: number;
367
498
  }
368
499
  interface IStarAttrData {
369
500
  corners?: number;
@@ -375,16 +506,10 @@ interface IStarInputData extends IStarAttrData, IUIBaseInputData {
375
506
  }
376
507
  interface IPath extends IUI {
377
508
  __: IPathData;
378
- path: IPathCommandData | IPathString;
379
- windingRule: IWindingRule;
380
509
  }
381
510
  interface IPathData extends IUIData {
382
- path?: IPathCommandData;
383
- windingRule?: IWindingRule;
384
511
  }
385
512
  interface IPathInputData extends IUIBaseInputData {
386
- path?: IPathCommandData | IPathString;
387
- windingRule?: IWindingRule;
388
513
  }
389
514
  interface IPen extends IGroup, IPathCreator {
390
515
  __: IPenData;
@@ -392,7 +517,6 @@ interface IPen extends IGroup, IPathCreator {
392
517
  pathStyle: IPathInputData;
393
518
  path: IPathCommandData;
394
519
  paint(): void;
395
- clear(): void;
396
520
  }
397
521
  interface IPenData extends IGroupData {
398
522
  }
@@ -400,10 +524,14 @@ interface IPenInputData extends IGroupInputData {
400
524
  }
401
525
  interface IText extends ITextStyleAttrData, IUI {
402
526
  __: ITextData;
403
- text: string;
527
+ text?: string;
528
+ padding?: IFourNumber;
529
+ resizeFontSize?: IBoolean;
404
530
  }
405
531
  interface ITextAttrData {
406
532
  text?: string;
533
+ padding?: IFourNumber;
534
+ resizeFontSize?: boolean;
407
535
  }
408
536
  interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
409
537
  __baseLine?: number;
@@ -411,7 +539,7 @@ interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
411
539
  __letterSpacing?: number;
412
540
  __padding?: number[];
413
541
  __clipText?: boolean;
414
- __textBoxBounds?: IBoundsData;
542
+ __textBoxBounds?: IBoundsData$1;
415
543
  }
416
544
  interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
417
545
  }
@@ -445,7 +573,7 @@ interface ITextCharData {
445
573
  char?: string;
446
574
  }
447
575
  interface ITextDrawData {
448
- bounds: IBoundsData;
576
+ bounds: IBoundsData$1;
449
577
  rows: ITextRowData[];
450
578
  paraNumber: number;
451
579
  font: string;
@@ -469,24 +597,23 @@ interface IImageInputData extends IImageAttrData, IUIBaseInputData {
469
597
  }
470
598
  interface ICanvas extends IRect {
471
599
  __: ICanvasData;
472
- pixelRatio: number;
473
- smooth: boolean;
474
- canvas: ILeaferCanvas;
600
+ smooth?: boolean;
601
+ contextSettings?: ICanvasContext2DSettings;
602
+ canvas?: ILeaferCanvas;
603
+ context?: ICanvasContext2D;
475
604
  __updateSize(): void;
476
605
  }
477
606
  interface ICanvasAttrData {
478
- pixelRatio?: number;
479
607
  smooth?: boolean;
608
+ contextSettings?: ICanvasContext2DSettings;
480
609
  }
481
610
  interface ICanvasData extends ICanvasAttrData, IRectData {
482
611
  }
483
612
  interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData {
484
613
  }
485
614
  interface ILeaferData extends IGroupData {
486
- pixelRatio?: number;
487
615
  }
488
616
  interface ILeaferInputData extends IGroupInputData {
489
- pixelRatio?: number;
490
617
  }
491
618
  interface IAppData extends ILeaferData {
492
619
  }
@@ -501,157 +628,122 @@ interface IFrameInputData extends IBoxInputData {
501
628
  }
502
629
  interface IBox extends IGroup {
503
630
  __: IBoxData;
504
- overflow: IOverflow;
631
+ resizeChildren?: IBoolean;
632
+ overflow?: IOverflow;
505
633
  __updateRectRenderBounds(): void;
506
634
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
507
635
  }
508
636
  interface IBoxData extends IGroupData {
637
+ resizeChildren?: boolean;
509
638
  overflow?: IOverflow;
510
639
  }
511
640
  interface IBoxInputData extends IGroupInputData {
641
+ resizeChildren?: boolean;
512
642
  overflow?: IOverflow;
513
643
  }
514
644
  interface IGroup extends IUI {
515
645
  __: IGroupData;
516
646
  children: IUI[];
517
- mask?: IUI;
647
+ pick(hitPoint: IPointData, options?: IPickOptions): IPickResult;
518
648
  add(child: IUI, index?: number): void;
519
649
  addAt(child: IUI, index: number): void;
520
650
  addAfter(child: IUI, after: IUI): void;
521
651
  addBefore(child: IUI, before: IUI): void;
522
- addMany(...children: ILeaf[]): void;
652
+ addMany(...children: ILeaf$1[]): void;
523
653
  remove(child?: IUI): void;
524
654
  removeAll(): void;
655
+ clear(): void;
525
656
  }
526
657
  interface IGroupData extends IUIData {
527
658
  }
528
659
  interface IGroupInputData extends IUIBaseInputData {
529
660
  }
530
- interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
661
+ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
531
662
  __: IUIData;
532
663
  readonly app: ILeafer;
533
664
  leafer?: ILeafer;
534
665
  parent?: IGroup;
535
- isFrame?: boolean;
536
- proxyData: IUIInputData;
666
+ zoomLayer?: IGroup;
667
+ readonly isFrame?: boolean;
668
+ proxyData?: IUIInputData;
537
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;
538
679
  children?: IUI[];
680
+ readonly pen: IPathCreator;
539
681
  reset(data?: IUIInputData): void;
540
682
  set(data: IUIInputData): void;
541
- toJSON(): IUIInputData;
542
- get(): IUIInputData;
683
+ toJSON(options?: IJSONOptions): IUIJSONData;
684
+ get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
543
685
  createProxyData(): IUIInputData;
544
- find(condition: number | string | IFindUIMethod, options?: any): IUI[];
545
- findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
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;
546
690
  getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
547
691
  getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
692
+ load(): void;
548
693
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
549
694
  __drawPathByBox(drawer: IPathDrawer): void;
550
695
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
551
- export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>;
696
+ export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
552
697
  clone(): IUI;
553
698
  }
554
699
  interface IFindUIMethod {
555
- (leaf: IUI, options?: any): AnswerType;
700
+ (leaf: IUI, options?: any): IAnswer;
556
701
  }
557
702
  interface IUIData extends IUIComputedData, ILeafData {
558
703
  padding?: number | number[];
559
- locked?: boolean;
704
+ normalStyle?: IUIInputData;
705
+ hoverStyle?: IUIInputData;
706
+ pressStyle?: IUIInputData;
707
+ focusStyle?: IUIInputData;
708
+ selectedStyle?: IUIInputData;
709
+ disabledStyle?: IUIInputData;
560
710
  __isFills?: boolean;
561
711
  __isStrokes?: boolean;
712
+ readonly __strokeWidth: number;
562
713
  __pixelFill?: boolean;
563
714
  __pixelStroke?: boolean;
715
+ __isHitPixel?: boolean;
716
+ __isCanvas?: boolean;
564
717
  __opacityFill?: boolean;
565
718
  __opacityStroke?: boolean;
566
719
  __drawAfterFill?: boolean;
567
720
  __isOverflow?: boolean;
568
721
  __blendLayer?: boolean;
569
- __useEffect?: boolean;
570
- __autoWidth: boolean;
571
- __autoHeight: boolean;
572
- __autoBounds: boolean;
573
- path?: IPathCommandData;
574
- windingRule?: IWindingRule;
575
- __pathForRender?: IPathCommandData;
576
- __path2DForRender?: IPath2D;
577
722
  __boxStroke?: boolean;
578
723
  __font?: string;
579
724
  __textDrawData?: ITextDrawData;
725
+ __needComputePaint: boolean;
726
+ __computePaint(): void;
580
727
  }
581
728
  interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
582
729
  padding?: number | number[];
583
- locked?: boolean;
584
730
  }
585
731
  interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
586
732
  padding?: number | number[];
587
- locked?: boolean;
733
+ normalStyle?: IUIInputData;
734
+ hoverStyle?: IUIInputData;
735
+ pressStyle?: IUIInputData;
736
+ focusStyle?: IUIInputData;
737
+ selectedStyle?: IUIInputData;
738
+ disabledStyle?: IUIInputData;
588
739
  children?: IUIInputData[];
589
740
  }
590
741
  type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
591
- 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 {
592
743
  children?: IUIInputData[];
593
744
  }
594
-
595
- interface IEditorBase extends IGroup$1, ISelectorProxy {
596
- config: IEditorConfig;
597
- hoverTarget: IUI$1;
598
- target: IUI$1 | IUI$1[];
599
- readonly list: IUI$1[];
600
- readonly hasTarget: boolean;
601
- readonly multiple: boolean;
602
- readonly single: boolean;
603
- readonly dragging: boolean;
604
- element: IUI$1;
605
- buttons: IGroup$1;
606
- selector: IGroup$1;
607
- editBox: IGroup$1;
608
- editTool: IObject$1;
609
- hasItem(item: IUI$1): boolean;
610
- shiftItem(item: IUI$1): void;
611
- addItem(item: IUI$1): void;
612
- removeItem(item: IUI$1): void;
613
- update(): void;
614
- updateEditTool(): void;
615
- getEditSize(ui: ILeaf$1): IEditSize;
616
- onMove(e: IDragEvent): void;
617
- onScale(e: IDragEvent): void;
618
- onRotate(e: IDragEvent | IRotateEvent): void;
619
- onSkew(e: IDragEvent): void;
620
- group(): void;
621
- ungroup(): void;
622
- lock(): void;
623
- unlock(): void;
624
- toTop(): void;
625
- toBottom(): void;
626
- }
627
- interface IEditorConfig {
628
- editSize?: 'auto' | IEditSize;
629
- stroke?: IStroke$1;
630
- strokeWidth?: number;
631
- pointFill?: IFill$1;
632
- pointSize?: number;
633
- pointRadius?: number;
634
- point?: IBoxInputData$1 | IBoxInputData$1[];
635
- middlePoint?: IBoxInputData$1 | IBoxInputData$1[];
636
- rotatePoint?: IBoxInputData$1;
637
- rect?: IBoxInputData$1;
638
- area?: IRectInputData$1;
639
- buttonsDirection?: 'top' | 'right' | 'bottom' | 'left';
640
- buttonsFixed?: boolean;
641
- buttonsMargin?: number;
642
- hideOnMove?: boolean;
643
- moveCursor?: ICursorType;
644
- resizeCursor?: ICursorType[];
645
- rotateCursor?: ICursorType[];
646
- around?: IAround;
647
- lockRatio?: boolean;
648
- rotateGap?: number;
649
- selector?: boolean;
650
- hover?: boolean;
651
- boxSelect?: boolean;
652
- rotateable?: boolean;
653
- resizeable?: boolean;
654
- skewable?: boolean;
745
+ interface IUIJSONData extends IUIInputData {
746
+ matrix?: IMatrixData;
655
747
  }
656
748
 
657
749
  interface ILeafer extends IGroup, ILeaferAttrData, IControl {
@@ -664,6 +756,9 @@ interface ILeafer extends IGroup, ILeaferAttrData, IControl {
664
756
  tree?: ILeafer;
665
757
  sky?: ILeafer;
666
758
  userConfig?: ILeaferConfig;
759
+ onInit(): void;
760
+ initType(type: ILeaferType): void;
761
+ destroy(sync?: boolean): void;
667
762
  }
668
763
 
669
764
  interface IApp extends ILeafer {
@@ -703,40 +798,74 @@ interface IUIBounds extends ILeafBounds {
703
798
 
704
799
  type IUIHitModule = ILeafHit & ThisType<IUI>;
705
800
 
801
+ interface IPathArrowModule {
802
+ list: IPathDataArrowMap;
803
+ addArrows(ui: IUI, changeRenderPath?: boolean): void;
804
+ }
805
+
706
806
  interface ITextConvertModule {
707
- getDrawData?(content: string, style: ITextData): ITextDrawData;
807
+ getDrawData(content: string, style: ITextData): ITextDrawData;
708
808
  }
709
809
 
710
810
  interface IColorConvertModule {
711
- 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;
712
826
  }
713
827
 
714
828
  interface ICachedShape extends ICachedLeaf {
715
829
  worldCanvas?: ILeaferCanvas;
716
- shapeBounds: IBoundsData;
830
+ shapeBounds: IBoundsData$1;
717
831
  scaleX: number;
718
832
  scaleY: number;
719
833
  }
720
834
 
721
835
  interface IPaintModule {
722
- compute?(attrName: 'fill' | 'stroke', ui: IUI): void;
723
- fill?(fill: string, ui: IUI, canvas: ILeaferCanvas): void;
724
- fills?(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
725
- fillText?(ui: IUI, canvas: ILeaferCanvas): void;
726
- stroke?(stroke: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
727
- strokes?(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
728
- strokeText?(stroke: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
729
- strokesText?(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
730
- drawTextStroke?(ui: IUI, canvas: ILeaferCanvas): void;
731
- shape?(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
732
- recycleImage?(attrName: 'fill' | 'stroke', data: IUIData): 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;
733
862
  }
734
863
 
735
864
  interface IEffectModule {
736
- shadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, renderOptions: IRenderOptions): void;
737
- innerShadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, renderOptions: IRenderOptions): void;
738
- blur?(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas, renderOptions: IRenderOptions): void;
739
- backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, renderOptions: 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;
740
869
  }
741
870
 
742
- export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, 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 };
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 };