@leafer-ui/interface 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/interface",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "@leafer-ui/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/interface": "1.0.1"
25
+ "@leafer/interface": "1.0.3"
26
26
  }
27
27
  }
@@ -0,0 +1,168 @@
1
+ import { IEventer, IEventMap, IObject, IPercentData } from '@leafer/interface'
2
+
3
+ import { IUIInputData, IUI } from './IUI'
4
+
5
+
6
+ export type IAnimation = IStyleAnimation | IKeyframesAnimation
7
+
8
+ export type ITransition = IAnimateOptions | IAnimateEasingName | number | boolean
9
+
10
+ export type IAnimateType = 'all' | 'animation' | 'transition' | 'animate'
11
+
12
+ export interface IStyleAnimation extends IAnimateOptions {
13
+ style: IUIInputData
14
+ }
15
+
16
+ export interface IKeyframesAnimation extends IAnimateOptions {
17
+ keyframes: IKeyframe[]
18
+ }
19
+
20
+ export interface IAnimateOptions {
21
+ easing?: IAnimateEasing
22
+
23
+ delay?: number
24
+ duration?: number
25
+ ending?: IAnimateEnding
26
+
27
+ reverse?: boolean
28
+ swing?: boolean
29
+
30
+ loop?: boolean | number
31
+ loopDelay?: number
32
+
33
+ speed?: number
34
+
35
+ join?: boolean
36
+ autoplay?: boolean
37
+
38
+ attrs?: string[]
39
+ event?: IAnimateEvents
40
+ }
41
+
42
+
43
+ export type IKeyframe = IUIInputData | IAnimateKeyframe
44
+
45
+ export type IKeyframeId = number
46
+
47
+ export interface IAnimateKeyframe {
48
+ style: IUIInputData
49
+
50
+ easing?: IAnimateEasing
51
+ delay?: number
52
+ duration?: number
53
+
54
+ autoDelay?: number
55
+ autoDuration?: number
56
+ }
57
+
58
+ export interface IComputedKeyframe {
59
+ style: IUIInputData
60
+ beforeStyle: IUIInputData
61
+ betweenStyle?: IUIInputData
62
+
63
+ easingFn?: IAnimateEasingFunction
64
+
65
+ delay?: number
66
+ duration?: number
67
+
68
+ autoDelay?: number
69
+ autoDuration?: number
70
+
71
+ totalTime?: number // 存在delay 时, 才会有这个属性
72
+ }
73
+
74
+ export interface IAnimateEasingFunction {
75
+ (t: number): number
76
+ }
77
+
78
+ export interface ICustomEasingFunction {
79
+ (...arg: any): IAnimateEasingFunction
80
+ }
81
+
82
+
83
+ export type IAnimateEasing =
84
+ | IAnimateEasingName
85
+ | ICubicBezierEasing
86
+ | IStepsEasing
87
+ | IObject
88
+
89
+ export interface ICubicBezierEasing {
90
+ name: 'cubic-bezier',
91
+ value: [number, number, number, number]
92
+ }
93
+
94
+ export interface IStepsEasing {
95
+ name: 'steps',
96
+ value: number | [number, 'floor' | 'round' | 'ceil']
97
+ }
98
+
99
+
100
+ export type IAnimateEasingName =
101
+ | 'linear'
102
+ | 'ease'
103
+ | 'ease-in' | 'ease-out' | 'ease-in-out'
104
+ | 'sine-in' | 'sine-out' | 'sine-in-out'
105
+ | 'quad-in' | 'quad-out' | 'quad-in-out'
106
+ | 'cubic-in' | 'cubic-out' | 'cubic-in-out'
107
+ | 'quart-in' | 'quart-out' | 'quart-in-out'
108
+ | 'quint-in' | 'quint-out' | 'quint-in-out'
109
+ | 'expo-in' | 'expo-out' | 'expo-in-out'
110
+ | 'circ-in' | 'circ-out' | 'circ-in-out'
111
+ | 'back-in' | 'back-out' | 'back-in-out'
112
+ | 'elastic-in' | 'elastic-out' | 'elastic-in-out'
113
+ | 'bounce-in' | 'bounce-out' | 'bounce-in-out'
114
+
115
+
116
+ export type IAnimateEnding = 'auto' | 'from' | 'to'
117
+
118
+ export interface IAnimateEvents {
119
+ created?: IAnimateEventFunction
120
+
121
+ play?: IAnimateEventFunction
122
+ pause?: IAnimateEventFunction
123
+ stop?: IAnimateEventFunction
124
+ seek?: IAnimateEventFunction
125
+
126
+ update?: IAnimateEventFunction
127
+ completed?: IAnimateEventFunction
128
+ }
129
+
130
+ export interface IAnimateEventFunction {
131
+ (animate?: IAnimate): any
132
+ }
133
+
134
+
135
+
136
+ export interface IAnimate extends IAnimateOptions, IEventer {
137
+ target: IUI
138
+
139
+ keyframes: IKeyframe[]
140
+ config?: IAnimateOptions
141
+ event?: IEventMap
142
+
143
+ readonly frames: IComputedKeyframe[]
144
+
145
+ readonly fromStyle: IUIInputData
146
+ readonly toStyle: IUIInputData
147
+ readonly endingStyle: IUIInputData
148
+
149
+ readonly started: boolean
150
+ readonly running: boolean
151
+ readonly completed: boolean
152
+ readonly destroyed: boolean
153
+
154
+ readonly time: number
155
+ readonly looped: number
156
+
157
+ readonly realEnding: IAnimateEnding
158
+
159
+ init(target: IUI, keyframe: IUIInputData | IKeyframe[], options?: ITransition, isTemp?: boolean): void
160
+
161
+ play(): void
162
+ pause(): void
163
+ stop(): void
164
+ seek(time: number | IPercentData): void
165
+ kill(): void
166
+
167
+ destroy(complete?: boolean): void
168
+ }
package/src/IUI.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition, IBoolean, ICanvasContext2D, IJSONOptions, IMatrixData } from '@leafer/interface'
1
+ import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition, IBoolean, ICanvasContext2D, IJSONOptions, IMatrixData, ISizeData } from '@leafer/interface'
2
2
 
3
3
  import {
4
4
  IFillAttrData, IFillInputData, IFillComputedData,
@@ -9,15 +9,13 @@ import {
9
9
  ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData
10
10
  } from './ICommonAttr'
11
11
  import { IOverflow } from './type/IType'
12
+ import { IAnimation, IAnimate, IKeyframe, IKeyframeId, ITransition, IAnimateType } from './IAnimation'
12
13
  import { ILeafer } from './app/ILeafer'
13
14
  import { IEditorConfig } from './editor/IEditor'
14
15
 
15
16
  // Line
16
- export interface ILine extends IUI {
17
+ export interface ILine extends ILineAttrData, IUI {
17
18
  __: ILineData
18
- toPoint?: IPointData
19
- points?: number[]
20
- curve?: boolean | number
21
19
  }
22
20
 
23
21
  interface ILineAttrData {
@@ -52,6 +50,88 @@ export interface IFlowData extends IFlowAttrData, IBoxData { }
52
50
  export interface IFlowInputData extends IFlowAttrData, IBoxInputData { }
53
51
 
54
52
 
53
+
54
+ // Video
55
+ export interface IVideo extends IPlayerMethods, IRect {
56
+ __: IVideoData
57
+ }
58
+
59
+ interface IPlayerMethods {
60
+ play(): void
61
+ pause(): void
62
+ stop(): void
63
+ }
64
+
65
+ interface IVideoAttrData {
66
+ url?: string
67
+ }
68
+ export interface IVideoData extends IVideoAttrData, IRectData { }
69
+ export interface IVideoInputData extends IVideoAttrData, IRectInputData { }
70
+
71
+
72
+
73
+ // GIF
74
+ export interface IGIF extends IPlayerMethods, IRect {
75
+ __: IGIFData
76
+ }
77
+
78
+ interface IGIFAttrData {
79
+ url?: string
80
+ }
81
+ export interface IGIFData extends IGIFAttrData, IRectData { }
82
+ export interface IGIFInputData extends IGIFAttrData, IRectInputData { }
83
+
84
+
85
+
86
+ // Robot
87
+ export interface IRobot extends IRobotAttrData, IPlayerMethods, IRect {
88
+ __: IRobotData
89
+ readonly running: boolean
90
+ readonly nowFrame?: IRobotComputedKeyframe
91
+ readonly robotFrames?: IRobotComputedKeyframe[]
92
+
93
+ __updateRobot(): void
94
+ __updateAction(): void
95
+ }
96
+
97
+ interface IRobotAttrData {
98
+ robot?: IRobotKeyframe | IRobotKeyframe[]
99
+ actions?: IRobotActions
100
+ action?: IRobotActionName
101
+ now?: number
102
+ FPS?: number
103
+ loop?: boolean
104
+ }
105
+
106
+ export interface IRobotActions {
107
+ [name: string]: IKeyframeId | IKeyframeId[] | IRobotAnimation
108
+ }
109
+
110
+ export interface IRobotAnimation {
111
+ keys: IKeyframeId[]
112
+ loop?: boolean | number
113
+ speed?: number
114
+ }
115
+
116
+ export type IRobotActionName = string
117
+
118
+ export interface IRobotKeyframe {
119
+ mode?: 'normal' | 'clip'
120
+ url: string
121
+
122
+ offset?: IPointData
123
+ size?: number | ISizeData
124
+ total?: number
125
+ }
126
+
127
+ export interface IRobotComputedKeyframe extends IBoundsData {
128
+ view: any
129
+ }
130
+
131
+ export interface IRobotData extends IRobotAttrData, IRectData { }
132
+ export interface IRobotInputData extends IRobotAttrData, IRectInputData { }
133
+
134
+
55
135
  // Rect
56
136
  export interface IRect extends IUI {
57
137
  __: IRectData
@@ -61,11 +141,8 @@ export interface IRectInputData extends IUIBaseInputData { }
61
141
 
62
142
 
63
143
  // Ellipse
64
- export interface IEllipse extends IUI {
144
+ export interface IEllipse extends IUI, IEllipseAttrData {
65
145
  __: IEllipseData
66
- startAngle?: number
67
- endAngle?: number
68
- innerRadius?: number
69
146
  }
70
147
  interface IEllipseAttrData {
71
148
  startAngle?: number
@@ -77,11 +154,8 @@ export interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
77
154
 
78
155
 
79
156
  // Polygon
80
- export interface IPolygon extends IUI {
157
+ export interface IPolygon extends IPolygonAttrData, IUI {
81
158
  __: IPolygonData
82
- sides?: number
83
- points?: number[]
84
- curve?: boolean | number
85
159
  }
86
160
  interface IPolygonAttrData {
87
161
  sides?: number
@@ -93,10 +167,8 @@ export interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
93
167
 
94
168
 
95
169
  // Star
96
- export interface IStar extends IUI {
170
+ export interface IStar extends IStarAttrData, IUI {
97
171
  __: IStarData
98
- corners?: number
99
- innerRadius?: number
100
172
  }
101
173
  interface IStarAttrData {
102
174
  corners?: number
@@ -130,11 +202,8 @@ export interface IPenInputData extends IGroupInputData { }
130
202
 
131
203
 
132
204
  // Text
133
- export interface IText extends ITextStyleAttrData, IUI {
205
+ export interface IText extends ITextAttrData, ITextStyleAttrData, IUI {
134
206
  __: ITextData
135
- text?: string
136
- padding?: IFourNumber
137
- resizeFontSize?: IBoolean
138
207
  }
139
208
  interface ITextAttrData {
140
209
  text?: string
@@ -199,9 +268,8 @@ export interface ITextDrawData {
199
268
  }
200
269
 
201
270
  // Image
202
- export interface IImage extends IRect, ILeaferImageConfig {
271
+ export interface IImage extends IImageAttrData, IRect {
203
272
  __: IImageData
204
- url: string
205
273
  ready: boolean
206
274
  image?: ILeaferImage
207
275
  }
@@ -213,10 +281,8 @@ export interface IImageData extends IImageAttrData, IRectData {
213
281
  }
214
282
  export interface IImageInputData extends IImageAttrData, IUIBaseInputData { }
215
283
 
216
- export interface ICanvas extends IRect {
284
+ export interface ICanvas extends ICanvasAttrData, IRect {
217
285
  __: ICanvasData
218
- smooth?: boolean
219
- contextSettings?: ICanvasContext2DSettings
220
286
  canvas?: ILeaferCanvas
221
287
  context?: ICanvasContext2D
222
288
  __updateSize(): void
@@ -224,6 +290,7 @@ export interface ICanvas extends IRect {
224
290
  interface ICanvasAttrData {
225
291
  smooth?: boolean
226
292
  contextSettings?: ICanvasContext2DSettings
293
+ url?: string
227
294
  }
228
295
  export interface ICanvasData extends ICanvasAttrData, IRectData { }
229
296
  export interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData { }
@@ -258,21 +325,18 @@ export interface IFrameInputData extends IBoxInputData {
258
325
 
259
326
 
260
327
  // Box
261
- export interface IBox extends IGroup {
328
+ export interface IBox extends IBoxAttrData, IGroup {
262
329
  __: IBoxData
263
- resizeChildren?: IBoolean
264
- overflow?: IOverflow
265
330
  __updateRectRenderBounds(): void
266
331
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void
267
332
  }
268
- export interface IBoxData extends IGroupData {
269
- resizeChildren?: boolean
270
- overflow?: IOverflow
271
- }
272
- export interface IBoxInputData extends IGroupInputData {
273
- resizeChildren?: boolean
333
+
334
+ interface IBoxAttrData {
274
335
  overflow?: IOverflow
336
+ resizeChildren?: IBoolean
275
337
  }
338
+ export interface IBoxData extends IBoxAttrData, IGroupData { }
339
+ export interface IBoxInputData extends IBoxAttrData, IGroupInputData { }
276
340
 
277
341
 
278
342
  // Group
@@ -293,7 +357,7 @@ export interface IGroupData extends IUIData { }
293
357
  export interface IGroupInputData extends IUIBaseInputData { }
294
358
 
295
359
  // UI
296
- export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
360
+ export interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
297
361
  __: IUIData
298
362
 
299
363
  readonly app: ILeafer
@@ -305,12 +369,8 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
305
369
  proxyData?: IUIInputData
306
370
  __proxyData?: IUIInputData
307
371
 
308
- normalStyle?: IUIInputData
309
- hoverStyle?: IUIInputData
310
- pressStyle?: IUIInputData
311
- focusStyle?: IUIInputData
312
- selectedStyle?: IUIInputData
313
- disabledStyle?: IUIInputData
372
+ animation?: IAnimation
373
+ animationOut?: IAnimation
314
374
 
315
375
  editConfig?: IEditorConfig
316
376
  editOuter: string
@@ -318,11 +378,13 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
318
378
 
319
379
  children?: IUI[]
320
380
 
381
+ __animate?: IAnimate
382
+
321
383
  readonly pen: IPathCreator
322
384
 
323
385
  reset(data?: IUIInputData): void
324
386
 
325
- set(data: IUIInputData): void
387
+ set(data: IUIInputData, isTemp?: boolean): void
326
388
  toJSON(options?: IJSONOptions): IUIJSONData
327
389
 
328
390
  get(name?: string | string[] | IUIInputData): IUIInputData | IValue
@@ -342,24 +404,51 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
342
404
  __drawPathByBox(drawer: IPathDrawer): void
343
405
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
344
406
 
407
+ animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation, options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate
408
+ killAnimate(type?: IAnimateType): void
409
+
345
410
  export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>
346
- clone(): IUI
411
+ clone(newData?: IUIInputData): IUI
412
+ }
413
+
414
+
415
+ export interface IStateStyle extends IUIInputData {
416
+
417
+ }
418
+
419
+ export interface IStates {
420
+ [name: string]: IStateStyle
421
+ }
422
+
423
+
424
+ export type IStateName = string
425
+
426
+
427
+
428
+ interface IUIAttrData {
429
+ animation?: IAnimation
430
+ animationOut?: IAnimation
431
+
432
+ transition?: ITransition
433
+ transitionOut?: ITransition
434
+
435
+ states?: IStates
436
+ state?: IStateName
437
+
438
+ hoverStyle?: IStateStyle
439
+ pressStyle?: IStateStyle
440
+ focusStyle?: IStateStyle
441
+ selectedStyle?: IStateStyle
442
+ disabledStyle?: IStateStyle
347
443
  }
348
444
 
349
445
  export interface IFindUIMethod {
350
446
  (leaf: IUI, options?: any): IAnswer
351
447
  }
352
448
 
353
- export interface IUIData extends IUIComputedData, ILeafData {
449
+ export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
354
450
 
355
- padding?: number | number[]
356
-
357
- normalStyle?: IUIInputData
358
- hoverStyle?: IUIInputData
359
- pressStyle?: IUIInputData
360
- focusStyle?: IUIInputData
361
- selectedStyle?: IUIInputData
362
- disabledStyle?: IUIInputData
451
+ readonly scale: number | IPointData
363
452
 
364
453
  // 非数据属性, 自动计算的缓存数据
365
454
  __isFills?: boolean
@@ -388,22 +477,12 @@ export interface IUIData extends IUIComputedData, ILeafData {
388
477
 
389
478
  __needComputePaint: boolean
390
479
  __computePaint(): void
391
-
392
- }
393
- export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
394
- padding?: number | number[]
395
480
  }
481
+ export interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
396
482
 
397
- export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
398
- padding?: number | number[]
399
-
400
- normalStyle?: IUIInputData
401
- hoverStyle?: IUIInputData
402
- pressStyle?: IUIInputData
403
- focusStyle?: IUIInputData
404
- selectedStyle?: IUIInputData
405
- disabledStyle?: IUIInputData
483
+ }
406
484
 
485
+ export interface IUIBaseInputData extends IUIAttrData, IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
407
486
  children?: IUIInputData[]
408
487
  }
409
488
 
@@ -424,9 +503,13 @@ export type IUITag =
424
503
  | 'Group'
425
504
  | 'Frame'
426
505
  | 'Box'
506
+ | 'Arrow'
507
+ | 'Robot'
508
+ | 'GIF'
509
+ | 'Video'
427
510
 
428
511
 
429
- export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
512
+ export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IArrowInputData, IGIFInputData, IVideoInputData, IRobotInputData, IUIBaseInputData, IObject {
430
513
  children?: IUIInputData[]
431
514
  }
432
515
 
@@ -14,6 +14,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
14
14
  readonly editing: boolean
15
15
  innerEditing: boolean
16
16
  readonly groupOpening: boolean
17
+ resizeDirection?: number
17
18
 
18
19
  readonly multiple: boolean
19
20
  readonly single: boolean
package/src/index.ts CHANGED
@@ -17,23 +17,29 @@ export {
17
17
  ICanvas, ICanvasInputData, ICanvasData,
18
18
  IFrame, IFrameInputData, IFrameData,
19
19
  IFlow, IFlowInputData, IFlowData,
20
+ IVideo, IVideoInputData, IVideoData,
21
+ IGIF, IGIFInputData, IGIFData,
22
+ IRobot, IRobotInputData, IRobotData, IRobotActions, IRobotActionName, IRobotKeyframe, IRobotComputedKeyframe, IRobotAnimation,
20
23
  IBox, IBoxInputData, IBoxData,
21
24
  IGroup, IGroupInputData, IGroupData,
22
25
  ILeaferInputData, ILeaferData,
23
26
  IAppInputData, IAppData,
24
27
  IUI, IUIBaseInputData, IUIData, IFindUIMethod,
25
- IUITag, IUIInputData, IUIJSONData
28
+ IUITag, IUIInputData, IUIJSONData, IStateStyle, IStates, IStateName
26
29
  } from './IUI'
27
30
 
28
- export { IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IPathDataArrow, IPathDataArrowMap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat } from './type/IType'
31
+ export { IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IPathDataArrow, IPathDataArrowMap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, IFontWeightNumer, IFontWeightString, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat, IGradientType, IPaintType, IImageFilters, IPathDataArrowOffset, ISolidPaint, IPaintBase } from './type/IType'
29
32
  export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString } from './type/IStringType'
30
33
  export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
31
34
  export { IStrokeAttrData, IStrokeInputData, IStrokeComputedData, ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData, IEffectAttrData, IEffectInputData, IEffectComputedData } from './ICommonAttr'
32
35
 
36
+ export { IAnimation, ITransition, IAnimate, IAnimateType, IKeyframe, IKeyframeId, IAnimateEasing, ICubicBezierEasing, IStepsEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvents, IAnimateEventFunction, ICustomEasingFunction, IAnimateKeyframe, IComputedKeyframe, IStyleAnimation, IKeyframesAnimation, IAnimateOptions } from './IAnimation'
37
+
33
38
  export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
34
39
  export { IUIBoundsModule } from './module/IUIBounds'
35
40
  export { IUIHitModule } from './module/IUIHit'
36
41
  export { IPathArrowModule } from './module/IPathArrow'
42
+ export { ITransitionModule, ITransitionMap, ITransitionFunction } from './module/ITransition'
37
43
  export { ITextConvertModule } from './module/ITextConvert'
38
44
  export { IColorConvertModule } from './module/IColorConvert'
39
45
  export { IExportModule } from './module/IExport'
@@ -1,5 +1,6 @@
1
- import { IColor } from '../type/IType'
1
+ import { IColor, IRGBA } from '../type/IType'
2
2
 
3
3
  export interface IColorConvertModule {
4
4
  string(color: IColor, opacity?: number): string
5
+ object(color: IColor, opacity?: number): IRGBA
5
6
  }
@@ -1,11 +1,25 @@
1
- import { ILeaf, IStateStyleType } from '@leafer/interface'
1
+ import { ILeaf, IBoolean, IString, IObject, IStateName, IStateStyle } from '@leafer-ui/interface'
2
2
 
3
3
  export interface IStateModule {
4
- isHover(leaf: ILeaf): boolean
5
- isPress(leaf: ILeaf): boolean
6
- isFocus(leaf: ILeaf): boolean
7
- isDrag(leaf: ILeaf): boolean
8
4
 
9
- setStyle(leaf: ILeaf, stateType: IStateStyleType, value: boolean): void
5
+ canAnimate: boolean
6
+ animateExcludes: IObject // 动画中排除的状态属性
7
+
8
+ isState(state: IStateName, leaf: ILeaf, button?: ILeaf | boolean): boolean
9
+ isSelected(leaf: ILeaf, button?: ILeaf | boolean): boolean
10
+ isDisabled(leaf: ILeaf, button?: ILeaf | boolean): boolean
11
+
12
+ isFocus(leaf: ILeaf, button?: ILeaf | boolean): boolean
13
+ isHover(leaf: ILeaf, button?: ILeaf | boolean): boolean
14
+ isPress(leaf: ILeaf, button?: ILeaf | boolean): boolean
15
+
16
+ isDrag(leaf: ILeaf, button?: boolean | ILeaf): boolean
17
+
18
+ setStyleName(leaf: ILeaf, styleName: IString, value: IBoolean): void
19
+ set(leaf: ILeaf, stateName: IString): void
20
+
21
+ getStyle(leaf: ILeaf): IStateStyle
22
+
23
+ updateStyle(leaf: ILeaf, style?: IStateStyle, type?: 'in' | 'out'): void
10
24
  updateEventStyle(leaf: ILeaf, eventType: string): void
11
25
  }
@@ -0,0 +1,21 @@
1
+ import { IObject } from '@leafer/interface'
2
+ import { IColor, IGradientPaint } from '../type/IType'
3
+
4
+ export interface ITransitionModule {
5
+ list: ITransitionMap
6
+ register(attrName: string, fn: ITransitionFunction): void
7
+ get(attrName: string): ITransitionFunction
8
+
9
+ value(from: any, to: any, t: number, target?: IObject): any
10
+ number(from: number, to: number, t: number, roundValue?: number): number
11
+ color(from: IColor, to: IColor, t: number): string
12
+ gradient(from: IGradientPaint, to: IGradientPaint, t: number, target: IObject): IGradientPaint
13
+ }
14
+
15
+ export interface ITransitionMap {
16
+ [name: string]: ITransitionFunction
17
+ }
18
+
19
+ export interface ITransitionFunction {
20
+ (from: any, to: any, t: number, target?: any): any
21
+ }
@@ -16,6 +16,7 @@ export interface ILeafPaint {
16
16
  loadId?: number
17
17
  patternId?: string
18
18
  patternTask?: ITaskItem
19
+ sync?: boolean // 同步显示图片,不走任务列表生成图案
19
20
  data?: ILeafPaintPatternData
20
21
  }
21
22
 
package/src/type/IType.ts CHANGED
@@ -14,7 +14,6 @@ export interface IPaintBase {
14
14
  blendMode?: IBlendMode
15
15
  visible?: boolean
16
16
  opacity?: number
17
-
18
17
  }
19
18
 
20
19
  export type IPaintType =
@@ -76,6 +75,7 @@ export interface IImagePaint extends IPaintBase {
76
75
  rotation?: number
77
76
 
78
77
  repeat?: IRepeat
78
+ sync?: boolean // 同步显示,不走任务列表生成图案
79
79
  }
80
80
  export interface IImageFilters {
81
81
  exposure?: number // 曝光
@@ -86,7 +86,7 @@ export interface IImageFilters {
86
86
  highlights?: number // 高光
87
87
  shadows?: number // 阴影
88
88
  }
89
- export type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat'
89
+ export type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'stretch' | 'clip' | 'repeat'
90
90
  export type IRepeat = boolean | 'x' | 'y'
91
91
 
92
92
  // 描边
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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';
1
+ import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IObject, IEventer, IEventMap, IPercentData, IBoundsData as IBoundsData$1, IPathCreator, ILeaferCanvas, ICanvasContext2D, ICanvasContext2DSettings, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IJSONOptions, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
- import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject, ILeaf, IEditSize, IDragEvent, IZoomEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, 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';
3
+ import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject as IObject$1, 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, IStateName as IStateName$1, IString as IString$1, IBoolean as IBoolean$1, IStateStyle as IStateStyle$1 } from '@leafer-ui/interface';
4
4
 
5
5
  type IPercent = string;
6
6
  type IColorString = string;
@@ -63,6 +63,7 @@ interface IImagePaint extends IPaintBase {
63
63
  scale?: number | IPointData;
64
64
  rotation?: number;
65
65
  repeat?: IRepeat;
66
+ sync?: boolean;
66
67
  }
67
68
  interface IImageFilters {
68
69
  exposure?: number;
@@ -73,7 +74,7 @@ interface IImageFilters {
73
74
  highlights?: number;
74
75
  shadows?: number;
75
76
  }
76
- type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
77
+ type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'stretch' | 'clip' | 'repeat';
77
78
  type IRepeat = boolean | 'x' | 'y';
78
79
  type IStrokeAlign = 'inside' | 'outside' | 'center';
79
80
  type IStrokeCap = 'none' | 'round' | 'square';
@@ -135,6 +136,7 @@ interface ILeafPaint {
135
136
  loadId?: number;
136
137
  patternId?: string;
137
138
  patternTask?: ITaskItem;
139
+ sync?: boolean;
138
140
  data?: ILeafPaintPatternData;
139
141
  }
140
142
  interface ILeafPaintPatternData {
@@ -301,6 +303,105 @@ interface IEffectComputedData {
301
303
  grayscale?: number;
302
304
  }
303
305
 
306
+ type IAnimation = IStyleAnimation | IKeyframesAnimation;
307
+ type ITransition = IAnimateOptions | IAnimateEasingName | number | boolean;
308
+ type IAnimateType = 'all' | 'animation' | 'transition' | 'animate';
309
+ interface IStyleAnimation extends IAnimateOptions {
310
+ style: IUIInputData;
311
+ }
312
+ interface IKeyframesAnimation extends IAnimateOptions {
313
+ keyframes: IKeyframe[];
314
+ }
315
+ interface IAnimateOptions {
316
+ easing?: IAnimateEasing;
317
+ delay?: number;
318
+ duration?: number;
319
+ ending?: IAnimateEnding;
320
+ reverse?: boolean;
321
+ swing?: boolean;
322
+ loop?: boolean | number;
323
+ loopDelay?: number;
324
+ speed?: number;
325
+ join?: boolean;
326
+ autoplay?: boolean;
327
+ attrs?: string[];
328
+ event?: IAnimateEvents;
329
+ }
330
+ type IKeyframe = IUIInputData | IAnimateKeyframe;
331
+ type IKeyframeId = number;
332
+ interface IAnimateKeyframe {
333
+ style: IUIInputData;
334
+ easing?: IAnimateEasing;
335
+ delay?: number;
336
+ duration?: number;
337
+ autoDelay?: number;
338
+ autoDuration?: number;
339
+ }
340
+ interface IComputedKeyframe {
341
+ style: IUIInputData;
342
+ beforeStyle: IUIInputData;
343
+ betweenStyle?: IUIInputData;
344
+ easingFn?: IAnimateEasingFunction;
345
+ delay?: number;
346
+ duration?: number;
347
+ autoDelay?: number;
348
+ autoDuration?: number;
349
+ totalTime?: number;
350
+ }
351
+ interface IAnimateEasingFunction {
352
+ (t: number): number;
353
+ }
354
+ interface ICustomEasingFunction {
355
+ (...arg: any): IAnimateEasingFunction;
356
+ }
357
+ type IAnimateEasing = IAnimateEasingName | ICubicBezierEasing | IStepsEasing | IObject;
358
+ interface ICubicBezierEasing {
359
+ name: 'cubic-bezier';
360
+ value: [number, number, number, number];
361
+ }
362
+ interface IStepsEasing {
363
+ name: 'steps';
364
+ value: number | [number, 'floor' | 'round' | 'ceil'];
365
+ }
366
+ type IAnimateEasingName = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'sine-in' | 'sine-out' | 'sine-in-out' | 'quad-in' | 'quad-out' | 'quad-in-out' | 'cubic-in' | 'cubic-out' | 'cubic-in-out' | 'quart-in' | 'quart-out' | 'quart-in-out' | 'quint-in' | 'quint-out' | 'quint-in-out' | 'expo-in' | 'expo-out' | 'expo-in-out' | 'circ-in' | 'circ-out' | 'circ-in-out' | 'back-in' | 'back-out' | 'back-in-out' | 'elastic-in' | 'elastic-out' | 'elastic-in-out' | 'bounce-in' | 'bounce-out' | 'bounce-in-out';
367
+ type IAnimateEnding = 'auto' | 'from' | 'to';
368
+ interface IAnimateEvents {
369
+ created?: IAnimateEventFunction;
370
+ play?: IAnimateEventFunction;
371
+ pause?: IAnimateEventFunction;
372
+ stop?: IAnimateEventFunction;
373
+ seek?: IAnimateEventFunction;
374
+ update?: IAnimateEventFunction;
375
+ completed?: IAnimateEventFunction;
376
+ }
377
+ interface IAnimateEventFunction {
378
+ (animate?: IAnimate): any;
379
+ }
380
+ interface IAnimate extends IAnimateOptions, IEventer {
381
+ target: IUI;
382
+ keyframes: IKeyframe[];
383
+ config?: IAnimateOptions;
384
+ event?: IEventMap;
385
+ readonly frames: IComputedKeyframe[];
386
+ readonly fromStyle: IUIInputData;
387
+ readonly toStyle: IUIInputData;
388
+ readonly endingStyle: IUIInputData;
389
+ readonly started: boolean;
390
+ readonly running: boolean;
391
+ readonly completed: boolean;
392
+ readonly destroyed: boolean;
393
+ readonly time: number;
394
+ readonly looped: number;
395
+ readonly realEnding: IAnimateEnding;
396
+ init(target: IUI, keyframe: IUIInputData | IKeyframe[], options?: ITransition, isTemp?: boolean): void;
397
+ play(): void;
398
+ pause(): void;
399
+ stop(): void;
400
+ seek(time: number | IPercentData): void;
401
+ kill(): void;
402
+ destroy(complete?: boolean): void;
403
+ }
404
+
304
405
  interface IEditorBase extends IGroup$1, ISelectorProxy {
305
406
  config: IEditorConfig;
306
407
  readonly mergeConfig: IEditorConfig;
@@ -312,6 +413,7 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
312
413
  readonly editing: boolean;
313
414
  innerEditing: boolean;
314
415
  readonly groupOpening: boolean;
416
+ resizeDirection?: number;
315
417
  readonly multiple: boolean;
316
418
  readonly single: boolean;
317
419
  readonly dragging: boolean;
@@ -319,8 +421,8 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
319
421
  buttons: IGroup$1;
320
422
  selector: IGroup$1;
321
423
  editBox: IEditBoxBase;
322
- editTool?: IObject;
323
- innerEditor?: IObject;
424
+ editTool?: IObject$1;
425
+ innerEditor?: IObject$1;
324
426
  select(target: IUI$1 | IUI$1[]): void;
325
427
  cancel(): void;
326
428
  hasItem(item: IUI$1): boolean;
@@ -429,11 +531,8 @@ interface IEditToolFunction {
429
531
  (ui: any): string;
430
532
  }
431
533
 
432
- interface ILine extends IUI {
534
+ interface ILine extends ILineAttrData, IUI {
433
535
  __: ILineData;
434
- toPoint?: IPointData;
435
- points?: number[];
436
- curve?: boolean | number;
437
536
  }
438
537
  interface ILineAttrData {
439
538
  toPoint?: IPointData;
@@ -462,6 +561,70 @@ interface IFlowData extends IFlowAttrData, IBoxData {
462
561
  }
463
562
  interface IFlowInputData extends IFlowAttrData, IBoxInputData {
464
563
  }
564
+ interface IVideo extends IPlayerMethods, IRect {
565
+ __: IVideoData;
566
+ }
567
+ interface IPlayerMethods {
568
+ play(): void;
569
+ pause(): void;
570
+ stop(): void;
571
+ }
572
+ interface IVideoAttrData {
573
+ url?: string;
574
+ }
575
+ interface IVideoData extends IVideoAttrData, IRectData {
576
+ }
577
+ interface IVideoInputData extends IVideoAttrData, IRectInputData {
578
+ }
579
+ interface IGIF extends IPlayerMethods, IRect {
580
+ __: IGIFData;
581
+ }
582
+ interface IGIFAttrData {
583
+ url?: string;
584
+ }
585
+ interface IGIFData extends IGIFAttrData, IRectData {
586
+ }
587
+ interface IGIFInputData extends IGIFAttrData, IRectInputData {
588
+ }
589
+ interface IRobot extends IRobotAttrData, IPlayerMethods, IRect {
590
+ __: IRobotData;
591
+ readonly running: boolean;
592
+ readonly nowFrame?: IRobotComputedKeyframe;
593
+ readonly robotFrames?: IRobotComputedKeyframe[];
594
+ __updateRobot(): void;
595
+ __updateAction(): void;
596
+ }
597
+ interface IRobotAttrData {
598
+ robot?: IRobotKeyframe | IRobotKeyframe[];
599
+ actions?: IRobotActions;
600
+ action?: IRobotActionName;
601
+ now?: number;
602
+ FPS?: number;
603
+ loop?: boolean;
604
+ }
605
+ interface IRobotActions {
606
+ [name: string]: IKeyframeId | IKeyframeId[] | IRobotAnimation;
607
+ }
608
+ interface IRobotAnimation {
609
+ keys: IKeyframeId[];
610
+ loop?: boolean | number;
611
+ speed?: number;
612
+ }
613
+ type IRobotActionName = string;
614
+ interface IRobotKeyframe {
615
+ mode?: 'normal' | 'clip';
616
+ url: string;
617
+ offset?: IPointData;
618
+ size?: number | ISizeData;
619
+ total?: number;
620
+ }
621
+ interface IRobotComputedKeyframe extends IBoundsData$1 {
622
+ view: any;
623
+ }
624
+ interface IRobotData extends IRobotAttrData, IRectData {
625
+ }
626
+ interface IRobotInputData extends IRobotAttrData, IRectInputData {
627
+ }
465
628
  interface IRect extends IUI {
466
629
  __: IRectData;
467
630
  }
@@ -469,11 +632,8 @@ interface IRectData extends IUIData {
469
632
  }
470
633
  interface IRectInputData extends IUIBaseInputData {
471
634
  }
472
- interface IEllipse extends IUI {
635
+ interface IEllipse extends IUI, IEllipseAttrData {
473
636
  __: IEllipseData;
474
- startAngle?: number;
475
- endAngle?: number;
476
- innerRadius?: number;
477
637
  }
478
638
  interface IEllipseAttrData {
479
639
  startAngle?: number;
@@ -484,11 +644,8 @@ interface IEllipseData extends IEllipseAttrData, IUIData {
484
644
  }
485
645
  interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
486
646
  }
487
- interface IPolygon extends IUI {
647
+ interface IPolygon extends IPolygonAttrData, IUI {
488
648
  __: IPolygonData;
489
- sides?: number;
490
- points?: number[];
491
- curve?: boolean | number;
492
649
  }
493
650
  interface IPolygonAttrData {
494
651
  sides?: number;
@@ -499,10 +656,8 @@ interface IPolygonData extends IPolygonAttrData, IUIData {
499
656
  }
500
657
  interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
501
658
  }
502
- interface IStar extends IUI {
659
+ interface IStar extends IStarAttrData, IUI {
503
660
  __: IStarData;
504
- corners?: number;
505
- innerRadius?: number;
506
661
  }
507
662
  interface IStarAttrData {
508
663
  corners?: number;
@@ -530,11 +685,8 @@ interface IPenData extends IGroupData {
530
685
  }
531
686
  interface IPenInputData extends IGroupInputData {
532
687
  }
533
- interface IText extends ITextStyleAttrData, IUI {
688
+ interface IText extends ITextAttrData, ITextStyleAttrData, IUI {
534
689
  __: ITextData;
535
- text?: string;
536
- padding?: IFourNumber;
537
- resizeFontSize?: IBoolean;
538
690
  }
539
691
  interface ITextAttrData {
540
692
  text?: string;
@@ -589,9 +741,8 @@ interface ITextDrawData {
589
741
  decorationHeight?: number;
590
742
  overflow?: number;
591
743
  }
592
- interface IImage extends IRect, ILeaferImageConfig {
744
+ interface IImage extends IImageAttrData, IRect {
593
745
  __: IImageData;
594
- url: string;
595
746
  ready: boolean;
596
747
  image?: ILeaferImage;
597
748
  }
@@ -603,10 +754,8 @@ interface IImageData extends IImageAttrData, IRectData {
603
754
  }
604
755
  interface IImageInputData extends IImageAttrData, IUIBaseInputData {
605
756
  }
606
- interface ICanvas extends IRect {
757
+ interface ICanvas extends ICanvasAttrData, IRect {
607
758
  __: ICanvasData;
608
- smooth?: boolean;
609
- contextSettings?: ICanvasContext2DSettings;
610
759
  canvas?: ILeaferCanvas;
611
760
  context?: ICanvasContext2D;
612
761
  __updateSize(): void;
@@ -614,6 +763,7 @@ interface ICanvas extends IRect {
614
763
  interface ICanvasAttrData {
615
764
  smooth?: boolean;
616
765
  contextSettings?: ICanvasContext2DSettings;
766
+ url?: string;
617
767
  }
618
768
  interface ICanvasData extends ICanvasAttrData, IRectData {
619
769
  }
@@ -634,20 +784,18 @@ interface IFrameData extends IBoxData {
634
784
  }
635
785
  interface IFrameInputData extends IBoxInputData {
636
786
  }
637
- interface IBox extends IGroup {
787
+ interface IBox extends IBoxAttrData, IGroup {
638
788
  __: IBoxData;
639
- resizeChildren?: IBoolean;
640
- overflow?: IOverflow;
641
789
  __updateRectRenderBounds(): void;
642
790
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
643
791
  }
644
- interface IBoxData extends IGroupData {
645
- resizeChildren?: boolean;
792
+ interface IBoxAttrData {
646
793
  overflow?: IOverflow;
794
+ resizeChildren?: IBoolean;
647
795
  }
648
- interface IBoxInputData extends IGroupInputData {
649
- resizeChildren?: boolean;
650
- overflow?: IOverflow;
796
+ interface IBoxData extends IBoxAttrData, IGroupData {
797
+ }
798
+ interface IBoxInputData extends IBoxAttrData, IGroupInputData {
651
799
  }
652
800
  interface IGroup extends IUI {
653
801
  __: IGroupData;
@@ -666,7 +814,7 @@ interface IGroupData extends IUIData {
666
814
  }
667
815
  interface IGroupInputData extends IUIBaseInputData {
668
816
  }
669
- interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
817
+ interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
670
818
  __: IUIData;
671
819
  readonly app: ILeafer;
672
820
  leafer?: ILeafer;
@@ -675,19 +823,16 @@ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEf
675
823
  readonly isFrame?: boolean;
676
824
  proxyData?: IUIInputData;
677
825
  __proxyData?: IUIInputData;
678
- normalStyle?: IUIInputData;
679
- hoverStyle?: IUIInputData;
680
- pressStyle?: IUIInputData;
681
- focusStyle?: IUIInputData;
682
- selectedStyle?: IUIInputData;
683
- disabledStyle?: IUIInputData;
826
+ animation?: IAnimation;
827
+ animationOut?: IAnimation;
684
828
  editConfig?: IEditorConfig;
685
829
  editOuter: string;
686
830
  editInner: string;
687
831
  children?: IUI[];
832
+ __animate?: IAnimate;
688
833
  readonly pen: IPathCreator;
689
834
  reset(data?: IUIInputData): void;
690
- set(data: IUIInputData): void;
835
+ set(data: IUIInputData, isTemp?: boolean): void;
691
836
  toJSON(options?: IJSONOptions): IUIJSONData;
692
837
  get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
693
838
  createProxyData(): IUIInputData;
@@ -701,20 +846,35 @@ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEf
701
846
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
702
847
  __drawPathByBox(drawer: IPathDrawer): void;
703
848
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
849
+ animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation, options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate;
850
+ killAnimate(type?: IAnimateType): void;
704
851
  export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
705
- clone(): IUI;
852
+ clone(newData?: IUIInputData): IUI;
853
+ }
854
+ interface IStateStyle extends IUIInputData {
855
+ }
856
+ interface IStates {
857
+ [name: string]: IStateStyle;
858
+ }
859
+ type IStateName = string;
860
+ interface IUIAttrData {
861
+ animation?: IAnimation;
862
+ animationOut?: IAnimation;
863
+ transition?: ITransition;
864
+ transitionOut?: ITransition;
865
+ states?: IStates;
866
+ state?: IStateName;
867
+ hoverStyle?: IStateStyle;
868
+ pressStyle?: IStateStyle;
869
+ focusStyle?: IStateStyle;
870
+ selectedStyle?: IStateStyle;
871
+ disabledStyle?: IStateStyle;
706
872
  }
707
873
  interface IFindUIMethod {
708
874
  (leaf: IUI, options?: any): IAnswer;
709
875
  }
710
- interface IUIData extends IUIComputedData, ILeafData {
711
- padding?: number | number[];
712
- normalStyle?: IUIInputData;
713
- hoverStyle?: IUIInputData;
714
- pressStyle?: IUIInputData;
715
- focusStyle?: IUIInputData;
716
- selectedStyle?: IUIInputData;
717
- disabledStyle?: IUIInputData;
876
+ interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
877
+ readonly scale: number | IPointData;
718
878
  __isFills?: boolean;
719
879
  __isStrokes?: boolean;
720
880
  readonly __strokeWidth: number;
@@ -733,21 +893,13 @@ interface IUIData extends IUIComputedData, ILeafData {
733
893
  __needComputePaint: boolean;
734
894
  __computePaint(): void;
735
895
  }
736
- interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
737
- padding?: number | number[];
738
- }
739
- interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
740
- padding?: number | number[];
741
- normalStyle?: IUIInputData;
742
- hoverStyle?: IUIInputData;
743
- pressStyle?: IUIInputData;
744
- focusStyle?: IUIInputData;
745
- selectedStyle?: IUIInputData;
746
- disabledStyle?: IUIInputData;
896
+ interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
897
+ }
898
+ interface IUIBaseInputData extends IUIAttrData, IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
747
899
  children?: IUIInputData[];
748
900
  }
749
- type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
750
- interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject$1 {
901
+ type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box' | 'Arrow' | 'Robot' | 'GIF' | 'Video';
902
+ interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IArrowInputData, IGIFInputData, IVideoInputData, IRobotInputData, IUIBaseInputData, IObject {
751
903
  children?: IUIInputData[];
752
904
  }
753
905
  interface IUIJSONData extends IUIInputData {
@@ -811,12 +963,29 @@ interface IPathArrowModule {
811
963
  addArrows(ui: IUI, changeRenderPath?: boolean): void;
812
964
  }
813
965
 
966
+ interface ITransitionModule {
967
+ list: ITransitionMap;
968
+ register(attrName: string, fn: ITransitionFunction): void;
969
+ get(attrName: string): ITransitionFunction;
970
+ value(from: any, to: any, t: number, target?: IObject): any;
971
+ number(from: number, to: number, t: number, roundValue?: number): number;
972
+ color(from: IColor, to: IColor, t: number): string;
973
+ gradient(from: IGradientPaint, to: IGradientPaint, t: number, target: IObject): IGradientPaint;
974
+ }
975
+ interface ITransitionMap {
976
+ [name: string]: ITransitionFunction;
977
+ }
978
+ interface ITransitionFunction {
979
+ (from: any, to: any, t: number, target?: any): any;
980
+ }
981
+
814
982
  interface ITextConvertModule {
815
983
  getDrawData(content: string, style: ITextData): ITextDrawData;
816
984
  }
817
985
 
818
986
  interface IColorConvertModule {
819
987
  string(color: IColor, opacity?: number): string;
988
+ object(color: IColor, opacity?: number): IRGBA;
820
989
  }
821
990
 
822
991
  interface IExportModule {
@@ -825,12 +994,20 @@ interface IExportModule {
825
994
  }
826
995
 
827
996
  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;
997
+ canAnimate: boolean;
998
+ animateExcludes: IObject$1;
999
+ isState(state: IStateName$1, leaf: ILeaf, button?: ILeaf | boolean): boolean;
1000
+ isSelected(leaf: ILeaf, button?: ILeaf | boolean): boolean;
1001
+ isDisabled(leaf: ILeaf, button?: ILeaf | boolean): boolean;
1002
+ isFocus(leaf: ILeaf, button?: ILeaf | boolean): boolean;
1003
+ isHover(leaf: ILeaf, button?: ILeaf | boolean): boolean;
1004
+ isPress(leaf: ILeaf, button?: ILeaf | boolean): boolean;
1005
+ isDrag(leaf: ILeaf, button?: boolean | ILeaf): boolean;
1006
+ setStyleName(leaf: ILeaf, styleName: IString$1, value: IBoolean$1): void;
1007
+ set(leaf: ILeaf, stateName: IString$1): void;
1008
+ getStyle(leaf: ILeaf): IStateStyle$1;
1009
+ updateStyle(leaf: ILeaf, style?: IStateStyle$1, type?: 'in' | 'out'): void;
1010
+ updateEventStyle(leaf: ILeaf, eventType: string): void;
834
1011
  }
835
1012
 
836
1013
  interface ICachedShape extends ICachedLeaf {
@@ -876,4 +1053,4 @@ interface IEffectModule {
876
1053
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
877
1054
  }
878
1055
 
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 };
1056
+ export type { IAnimate, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEventFunction, IAnimateEvents, IAnimateKeyframe, IAnimateOptions, IAnimateType, IAnimation, IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, IComputedKeyframe, ICornerRadiusString, ICubicBezierEasing, ICustomEasingFunction, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFontWeightNumer, IFontWeightString, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGIF, IGIFData, IGIFInputData, IGradientPaint, IGradientType, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageFilters, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, IKeyframe, IKeyframeId, IKeyframesAnimation, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintBase, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPaintType, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathDataArrowOffset, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IRobot, IRobotActionName, IRobotActions, IRobotAnimation, IRobotComputedKeyframe, IRobotData, IRobotInputData, IRobotKeyframe, IShadowEffect, IShadowString, ISolidPaint, IStar, IStarData, IStarInputData, IStateModule, IStateName, IStateStyle, IStates, IStepsEasing, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IStyleAnimation, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, ITransition, ITransitionFunction, ITransitionMap, ITransitionModule, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign, IVideo, IVideoData, IVideoInputData };