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