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

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, IDirection4, 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,139 @@ 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?: IEditPointInputData | IEditPointInputData[];
359
+ middlePoint?: IEditPointInputData | IEditPointInputData[];
360
+ rect?: IBoxInputData$1;
361
+ area?: IRectInputData$1;
362
+ mask?: boolean | IColorString$1;
363
+ circle?: IEditPointInputData;
364
+ circleDirection?: IDirection4;
365
+ circleMargin?: number;
366
+ rotatePoint?: IEditPointInputData;
367
+ buttonsDirection?: IDirection4;
368
+ buttonsFixed?: boolean | 'AABB' | 'OBB';
369
+ buttonsMargin?: number;
370
+ hideOnMove?: boolean;
371
+ hideOnSmall?: boolean | number;
372
+ moveCursor?: ICursorType;
373
+ resizeCursor?: IImageCursor;
374
+ rotateCursor?: IImageCursor;
375
+ skewCursor?: IImageCursor;
376
+ around?: IAlign$1 | IUnitPointData$1;
377
+ lockRatio?: boolean | 'corner';
378
+ rotateGap?: number;
379
+ selector?: boolean;
380
+ hover?: boolean;
381
+ hoverStyle?: IUIInputData$1;
382
+ select?: 'press' | 'tap';
383
+ boxSelect?: boolean;
384
+ continuousSelect?: boolean;
385
+ openInner?: 'double' | 'long';
386
+ moveable?: boolean | 'move';
387
+ resizeable?: boolean | 'zoom';
388
+ flipable?: boolean;
389
+ rotateable?: boolean | 'rotate';
390
+ skewable?: boolean;
293
391
  }
294
- interface IExportResultFunction {
295
- (data: IExportResult): void;
392
+ interface IEditPointInputData extends IBoxInputData$1 {
393
+ direction?: number;
394
+ pointType?: IEditPointType;
296
395
  }
297
- interface IExportModule {
298
- running?: boolean;
299
- export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
396
+ interface IEditPoint extends IBox$1 {
397
+ direction: number;
398
+ pointType: IEditPointType;
399
+ }
400
+ type IEditPointType = 'rotate' | 'resize' | 'button';
401
+ interface IEditBoxBase extends IGroup$1 {
402
+ editor: IEditorBase;
403
+ dragging: boolean;
404
+ moving: boolean;
405
+ view: IGroup$1;
406
+ circle: IEditPoint;
407
+ rect: IRect$1;
408
+ buttons: IGroup$1;
409
+ resizePoints: IEditPoint[];
410
+ rotatePoints: IEditPoint[];
411
+ resizeLines: IEditPoint[];
412
+ readonly flipped: boolean;
413
+ readonly flippedX: boolean;
414
+ readonly flippedY: boolean;
415
+ readonly flippedOne: boolean;
416
+ enterPoint: IEditPoint;
417
+ getPointStyle(userStyle?: IBoxInputData$1): IBoxInputData$1;
418
+ getPointsStyle(): IBoxInputData$1[];
419
+ getMiddlePointsStyle(): IBoxInputData$1[];
420
+ load(): void;
421
+ update(bounds: IBoundsData): void;
422
+ unload(): void;
423
+ onArrow(e: IKeyEvent): void;
424
+ }
425
+ interface IEditorConfigFunction {
426
+ (ui: any): IEditorConfig;
427
+ }
428
+ interface IEditToolFunction {
429
+ (ui: any): string;
300
430
  }
301
431
 
302
432
  interface ILine extends IUI {
303
433
  __: ILineData;
304
- toPoint: IPointData;
305
- points: number[];
306
- curve: boolean | number;
434
+ toPoint?: IPointData;
435
+ points?: number[];
436
+ curve?: boolean | number;
307
437
  }
308
438
  interface ILineAttrData {
309
439
  toPoint?: IPointData;
@@ -321,7 +451,16 @@ interface IArrowAttrData {
321
451
  }
322
452
  interface IArrowData extends IArrowAttrData, ILineData {
323
453
  }
324
- interface IArrowInputData extends IArrowAttrData, IUIBaseInputData {
454
+ interface IArrowInputData extends IArrowAttrData, ILineInputData {
455
+ }
456
+ interface IFlow extends IBox {
457
+ __: IFlowData;
458
+ }
459
+ interface IFlowAttrData {
460
+ }
461
+ interface IFlowData extends IFlowAttrData, IBoxData {
462
+ }
463
+ interface IFlowInputData extends IFlowAttrData, IBoxInputData {
325
464
  }
326
465
  interface IRect extends IUI {
327
466
  __: IRectData;
@@ -332,9 +471,9 @@ interface IRectInputData extends IUIBaseInputData {
332
471
  }
333
472
  interface IEllipse extends IUI {
334
473
  __: IEllipseData;
335
- startAngle: number;
336
- endAngle: number;
337
- innerRadius: number;
474
+ startAngle?: number;
475
+ endAngle?: number;
476
+ innerRadius?: number;
338
477
  }
339
478
  interface IEllipseAttrData {
340
479
  startAngle?: number;
@@ -347,9 +486,9 @@ interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
347
486
  }
348
487
  interface IPolygon extends IUI {
349
488
  __: IPolygonData;
350
- sides: number;
351
- points: number[];
352
- curve: boolean | number;
489
+ sides?: number;
490
+ points?: number[];
491
+ curve?: boolean | number;
353
492
  }
354
493
  interface IPolygonAttrData {
355
494
  sides?: number;
@@ -362,8 +501,8 @@ interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
362
501
  }
363
502
  interface IStar extends IUI {
364
503
  __: IStarData;
365
- corners: number;
366
- innerRadius: number;
504
+ corners?: number;
505
+ innerRadius?: number;
367
506
  }
368
507
  interface IStarAttrData {
369
508
  corners?: number;
@@ -375,16 +514,10 @@ interface IStarInputData extends IStarAttrData, IUIBaseInputData {
375
514
  }
376
515
  interface IPath extends IUI {
377
516
  __: IPathData;
378
- path: IPathCommandData | IPathString;
379
- windingRule: IWindingRule;
380
517
  }
381
518
  interface IPathData extends IUIData {
382
- path?: IPathCommandData;
383
- windingRule?: IWindingRule;
384
519
  }
385
520
  interface IPathInputData extends IUIBaseInputData {
386
- path?: IPathCommandData | IPathString;
387
- windingRule?: IWindingRule;
388
521
  }
389
522
  interface IPen extends IGroup, IPathCreator {
390
523
  __: IPenData;
@@ -392,7 +525,6 @@ interface IPen extends IGroup, IPathCreator {
392
525
  pathStyle: IPathInputData;
393
526
  path: IPathCommandData;
394
527
  paint(): void;
395
- clear(): void;
396
528
  }
397
529
  interface IPenData extends IGroupData {
398
530
  }
@@ -400,10 +532,14 @@ interface IPenInputData extends IGroupInputData {
400
532
  }
401
533
  interface IText extends ITextStyleAttrData, IUI {
402
534
  __: ITextData;
403
- text: string;
535
+ text?: string;
536
+ padding?: IFourNumber;
537
+ resizeFontSize?: IBoolean;
404
538
  }
405
539
  interface ITextAttrData {
406
540
  text?: string;
541
+ padding?: IFourNumber;
542
+ resizeFontSize?: boolean;
407
543
  }
408
544
  interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
409
545
  __baseLine?: number;
@@ -411,7 +547,7 @@ interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
411
547
  __letterSpacing?: number;
412
548
  __padding?: number[];
413
549
  __clipText?: boolean;
414
- __textBoxBounds?: IBoundsData;
550
+ __textBoxBounds?: IBoundsData$1;
415
551
  }
416
552
  interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
417
553
  }
@@ -445,7 +581,7 @@ interface ITextCharData {
445
581
  char?: string;
446
582
  }
447
583
  interface ITextDrawData {
448
- bounds: IBoundsData;
584
+ bounds: IBoundsData$1;
449
585
  rows: ITextRowData[];
450
586
  paraNumber: number;
451
587
  font: string;
@@ -469,24 +605,23 @@ interface IImageInputData extends IImageAttrData, IUIBaseInputData {
469
605
  }
470
606
  interface ICanvas extends IRect {
471
607
  __: ICanvasData;
472
- pixelRatio: number;
473
- smooth: boolean;
474
- canvas: ILeaferCanvas;
608
+ smooth?: boolean;
609
+ contextSettings?: ICanvasContext2DSettings;
610
+ canvas?: ILeaferCanvas;
611
+ context?: ICanvasContext2D;
475
612
  __updateSize(): void;
476
613
  }
477
614
  interface ICanvasAttrData {
478
- pixelRatio?: number;
479
615
  smooth?: boolean;
616
+ contextSettings?: ICanvasContext2DSettings;
480
617
  }
481
618
  interface ICanvasData extends ICanvasAttrData, IRectData {
482
619
  }
483
620
  interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData {
484
621
  }
485
622
  interface ILeaferData extends IGroupData {
486
- pixelRatio?: number;
487
623
  }
488
624
  interface ILeaferInputData extends IGroupInputData {
489
- pixelRatio?: number;
490
625
  }
491
626
  interface IAppData extends ILeaferData {
492
627
  }
@@ -501,157 +636,122 @@ interface IFrameInputData extends IBoxInputData {
501
636
  }
502
637
  interface IBox extends IGroup {
503
638
  __: IBoxData;
504
- overflow: IOverflow;
639
+ resizeChildren?: IBoolean;
640
+ overflow?: IOverflow;
505
641
  __updateRectRenderBounds(): void;
506
642
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
507
643
  }
508
644
  interface IBoxData extends IGroupData {
645
+ resizeChildren?: boolean;
509
646
  overflow?: IOverflow;
510
647
  }
511
648
  interface IBoxInputData extends IGroupInputData {
649
+ resizeChildren?: boolean;
512
650
  overflow?: IOverflow;
513
651
  }
514
652
  interface IGroup extends IUI {
515
653
  __: IGroupData;
516
654
  children: IUI[];
517
- mask?: IUI;
655
+ pick(hitPoint: IPointData, options?: IPickOptions): IPickResult;
518
656
  add(child: IUI, index?: number): void;
519
657
  addAt(child: IUI, index: number): void;
520
658
  addAfter(child: IUI, after: IUI): void;
521
659
  addBefore(child: IUI, before: IUI): void;
522
- addMany(...children: ILeaf[]): void;
660
+ addMany(...children: ILeaf$1[]): void;
523
661
  remove(child?: IUI): void;
524
662
  removeAll(): void;
663
+ clear(): void;
525
664
  }
526
665
  interface IGroupData extends IUIData {
527
666
  }
528
667
  interface IGroupInputData extends IUIBaseInputData {
529
668
  }
530
- interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
669
+ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
531
670
  __: IUIData;
532
671
  readonly app: ILeafer;
533
672
  leafer?: ILeafer;
534
673
  parent?: IGroup;
535
- isFrame?: boolean;
536
- proxyData: IUIInputData;
674
+ zoomLayer?: IGroup;
675
+ readonly isFrame?: boolean;
676
+ proxyData?: IUIInputData;
537
677
  __proxyData?: IUIInputData;
678
+ normalStyle?: IUIInputData;
679
+ hoverStyle?: IUIInputData;
680
+ pressStyle?: IUIInputData;
681
+ focusStyle?: IUIInputData;
682
+ selectedStyle?: IUIInputData;
683
+ disabledStyle?: IUIInputData;
684
+ editConfig?: IEditorConfig;
685
+ editOuter: string;
686
+ editInner: string;
538
687
  children?: IUI[];
688
+ readonly pen: IPathCreator;
539
689
  reset(data?: IUIInputData): void;
540
690
  set(data: IUIInputData): void;
541
- toJSON(): IUIInputData;
542
- get(): IUIInputData;
691
+ toJSON(options?: IJSONOptions): IUIJSONData;
692
+ get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
543
693
  createProxyData(): IUIInputData;
544
- find(condition: number | string | IFindUIMethod, options?: any): IUI[];
545
- findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
694
+ find(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI[];
695
+ findTag(tag: string | string[]): IUI[];
696
+ findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI | undefined;
697
+ findId(id: number | string): IUI | undefined;
546
698
  getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
547
699
  getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
700
+ load(): void;
548
701
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
549
702
  __drawPathByBox(drawer: IPathDrawer): void;
550
703
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
551
- export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>;
704
+ export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
552
705
  clone(): IUI;
553
706
  }
554
707
  interface IFindUIMethod {
555
- (leaf: IUI, options?: any): AnswerType;
708
+ (leaf: IUI, options?: any): IAnswer;
556
709
  }
557
710
  interface IUIData extends IUIComputedData, ILeafData {
558
711
  padding?: number | number[];
559
- locked?: boolean;
712
+ normalStyle?: IUIInputData;
713
+ hoverStyle?: IUIInputData;
714
+ pressStyle?: IUIInputData;
715
+ focusStyle?: IUIInputData;
716
+ selectedStyle?: IUIInputData;
717
+ disabledStyle?: IUIInputData;
560
718
  __isFills?: boolean;
561
719
  __isStrokes?: boolean;
720
+ readonly __strokeWidth: number;
562
721
  __pixelFill?: boolean;
563
722
  __pixelStroke?: boolean;
723
+ __isHitPixel?: boolean;
724
+ __isCanvas?: boolean;
564
725
  __opacityFill?: boolean;
565
726
  __opacityStroke?: boolean;
566
727
  __drawAfterFill?: boolean;
567
728
  __isOverflow?: boolean;
568
729
  __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
730
  __boxStroke?: boolean;
578
731
  __font?: string;
579
732
  __textDrawData?: ITextDrawData;
733
+ __needComputePaint: boolean;
734
+ __computePaint(): void;
580
735
  }
581
736
  interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
582
737
  padding?: number | number[];
583
- locked?: boolean;
584
738
  }
585
739
  interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
586
740
  padding?: number | number[];
587
- locked?: boolean;
741
+ normalStyle?: IUIInputData;
742
+ hoverStyle?: IUIInputData;
743
+ pressStyle?: IUIInputData;
744
+ focusStyle?: IUIInputData;
745
+ selectedStyle?: IUIInputData;
746
+ disabledStyle?: IUIInputData;
588
747
  children?: IUIInputData[];
589
748
  }
590
749
  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 {
750
+ interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject$1 {
592
751
  children?: IUIInputData[];
593
752
  }
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;
753
+ interface IUIJSONData extends IUIInputData {
754
+ matrix?: IMatrixData;
655
755
  }
656
756
 
657
757
  interface ILeafer extends IGroup, ILeaferAttrData, IControl {
@@ -664,6 +764,9 @@ interface ILeafer extends IGroup, ILeaferAttrData, IControl {
664
764
  tree?: ILeafer;
665
765
  sky?: ILeafer;
666
766
  userConfig?: ILeaferConfig;
767
+ onInit(): void;
768
+ initType(type: ILeaferType): void;
769
+ destroy(sync?: boolean): void;
667
770
  }
668
771
 
669
772
  interface IApp extends ILeafer {
@@ -703,40 +806,74 @@ interface IUIBounds extends ILeafBounds {
703
806
 
704
807
  type IUIHitModule = ILeafHit & ThisType<IUI>;
705
808
 
809
+ interface IPathArrowModule {
810
+ list: IPathDataArrowMap;
811
+ addArrows(ui: IUI, changeRenderPath?: boolean): void;
812
+ }
813
+
706
814
  interface ITextConvertModule {
707
- getDrawData?(content: string, style: ITextData): ITextDrawData;
815
+ getDrawData(content: string, style: ITextData): ITextDrawData;
708
816
  }
709
817
 
710
818
  interface IColorConvertModule {
711
- string?(color: IColor, opacity?: number): string;
819
+ string(color: IColor, opacity?: number): string;
820
+ }
821
+
822
+ interface IExportModule {
823
+ running?: boolean;
824
+ export(leaf: ILeaf$1, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
825
+ }
826
+
827
+ interface IStateModule {
828
+ isHover(leaf: ILeaf$1): boolean;
829
+ isPress(leaf: ILeaf$1): boolean;
830
+ isFocus(leaf: ILeaf$1): boolean;
831
+ isDrag(leaf: ILeaf$1): boolean;
832
+ setStyle(leaf: ILeaf$1, stateType: IStateStyleType, value: boolean): void;
833
+ updateEventStyle(leaf: ILeaf$1, eventType: string): void;
712
834
  }
713
835
 
714
836
  interface ICachedShape extends ICachedLeaf {
715
837
  worldCanvas?: ILeaferCanvas;
716
- shapeBounds: IBoundsData;
838
+ shapeBounds: IBoundsData$1;
717
839
  scaleX: number;
718
840
  scaleY: number;
719
841
  }
720
842
 
721
843
  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;
844
+ compute(attrName: IPaintAttr, ui: IUI): void;
845
+ fill(fill: string, ui: IUI, canvas: ILeaferCanvas): void;
846
+ fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
847
+ fillText(ui: IUI, canvas: ILeaferCanvas): void;
848
+ stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void;
849
+ strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
850
+ strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
851
+ drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void;
852
+ shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
853
+ }
854
+ interface IPaintImageModule {
855
+ image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData$1, firstUse: boolean): ILeafPaint;
856
+ checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, allowPaint?: boolean): boolean;
857
+ createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean;
858
+ recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap;
859
+ createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData$1): void;
860
+ getPatternData(paint: IImagePaint, box: IBoundsData$1, image: ILeaferImage): ILeafPaintPatternData;
861
+ fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
862
+ clipMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
863
+ repeatMode(data: ILeafPaintPatternData, box: IBoundsData$1, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void;
864
+ }
865
+ interface IPaintGradientModule {
866
+ linearGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
867
+ radialGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
868
+ conicGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
869
+ getTransform(box: IBoundsData$1, from: IPointData, to: IPointData, stretch: number, rotate90: boolean): IMatrixData;
733
870
  }
734
871
 
735
872
  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;
873
+ shadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
874
+ innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
875
+ blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void;
876
+ backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
740
877
  }
741
878
 
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 };
879
+ 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, IEditPointInputData, 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 };