@leafer-ui/interface 1.0.2 → 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.2",
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.2"
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
@@ -259,21 +325,18 @@ export interface IFrameInputData extends IBoxInputData {
259
325
 
260
326
 
261
327
  // Box
262
- export interface IBox extends IGroup {
328
+ export interface IBox extends IBoxAttrData, IGroup {
263
329
  __: IBoxData
264
- resizeChildren?: IBoolean
265
- overflow?: IOverflow
266
330
  __updateRectRenderBounds(): void
267
331
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void
268
332
  }
269
- export interface IBoxData extends IGroupData {
270
- resizeChildren?: boolean
271
- overflow?: IOverflow
272
- }
273
- export interface IBoxInputData extends IGroupInputData {
274
- resizeChildren?: boolean
333
+
334
+ interface IBoxAttrData {
275
335
  overflow?: IOverflow
336
+ resizeChildren?: IBoolean
276
337
  }
338
+ export interface IBoxData extends IBoxAttrData, IGroupData { }
339
+ export interface IBoxInputData extends IBoxAttrData, IGroupInputData { }
277
340
 
278
341
 
279
342
  // Group
@@ -294,7 +357,7 @@ export interface IGroupData extends IUIData { }
294
357
  export interface IGroupInputData extends IUIBaseInputData { }
295
358
 
296
359
  // UI
297
- export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
360
+ export interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
298
361
  __: IUIData
299
362
 
300
363
  readonly app: ILeafer
@@ -306,12 +369,8 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
306
369
  proxyData?: IUIInputData
307
370
  __proxyData?: IUIInputData
308
371
 
309
- normalStyle?: IUIInputData
310
- hoverStyle?: IUIInputData
311
- pressStyle?: IUIInputData
312
- focusStyle?: IUIInputData
313
- selectedStyle?: IUIInputData
314
- disabledStyle?: IUIInputData
372
+ animation?: IAnimation
373
+ animationOut?: IAnimation
315
374
 
316
375
  editConfig?: IEditorConfig
317
376
  editOuter: string
@@ -319,11 +378,13 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
319
378
 
320
379
  children?: IUI[]
321
380
 
381
+ __animate?: IAnimate
382
+
322
383
  readonly pen: IPathCreator
323
384
 
324
385
  reset(data?: IUIInputData): void
325
386
 
326
- set(data: IUIInputData): void
387
+ set(data: IUIInputData, isTemp?: boolean): void
327
388
  toJSON(options?: IJSONOptions): IUIJSONData
328
389
 
329
390
  get(name?: string | string[] | IUIInputData): IUIInputData | IValue
@@ -343,24 +404,51 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
343
404
  __drawPathByBox(drawer: IPathDrawer): void
344
405
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
345
406
 
407
+ animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation, options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate
408
+ killAnimate(type?: IAnimateType): void
409
+
346
410
  export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>
347
- 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
348
443
  }
349
444
 
350
445
  export interface IFindUIMethod {
351
446
  (leaf: IUI, options?: any): IAnswer
352
447
  }
353
448
 
354
- export interface IUIData extends IUIComputedData, ILeafData {
355
-
356
- padding?: number | number[]
449
+ export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
357
450
 
358
- normalStyle?: IUIInputData
359
- hoverStyle?: IUIInputData
360
- pressStyle?: IUIInputData
361
- focusStyle?: IUIInputData
362
- selectedStyle?: IUIInputData
363
- disabledStyle?: IUIInputData
451
+ readonly scale: number | IPointData
364
452
 
365
453
  // 非数据属性, 自动计算的缓存数据
366
454
  __isFills?: boolean
@@ -389,22 +477,12 @@ export interface IUIData extends IUIComputedData, ILeafData {
389
477
 
390
478
  __needComputePaint: boolean
391
479
  __computePaint(): void
392
-
393
- }
394
- export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
395
- padding?: number | number[]
396
480
  }
481
+ export interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
397
482
 
398
- export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
399
- padding?: number | number[]
400
-
401
- normalStyle?: IUIInputData
402
- hoverStyle?: IUIInputData
403
- pressStyle?: IUIInputData
404
- focusStyle?: IUIInputData
405
- selectedStyle?: IUIInputData
406
- disabledStyle?: IUIInputData
483
+ }
407
484
 
485
+ export interface IUIBaseInputData extends IUIAttrData, IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
408
486
  children?: IUIInputData[]
409
487
  }
410
488
 
@@ -425,9 +503,13 @@ export type IUITag =
425
503
  | 'Group'
426
504
  | 'Frame'
427
505
  | 'Box'
506
+ | 'Arrow'
507
+ | 'Robot'
508
+ | 'GIF'
509
+ | 'Video'
428
510
 
429
511
 
430
- 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 {
431
513
  children?: IUIInputData[]
432
514
  }
433
515
 
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
+ }
package/src/type/IType.ts CHANGED
@@ -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;
@@ -74,7 +74,7 @@ interface IImageFilters {
74
74
  highlights?: number;
75
75
  shadows?: number;
76
76
  }
77
- type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
77
+ type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'stretch' | 'clip' | 'repeat';
78
78
  type IRepeat = boolean | 'x' | 'y';
79
79
  type IStrokeAlign = 'inside' | 'outside' | 'center';
80
80
  type IStrokeCap = 'none' | 'round' | 'square';
@@ -303,6 +303,105 @@ interface IEffectComputedData {
303
303
  grayscale?: number;
304
304
  }
305
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
+
306
405
  interface IEditorBase extends IGroup$1, ISelectorProxy {
307
406
  config: IEditorConfig;
308
407
  readonly mergeConfig: IEditorConfig;
@@ -322,8 +421,8 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
322
421
  buttons: IGroup$1;
323
422
  selector: IGroup$1;
324
423
  editBox: IEditBoxBase;
325
- editTool?: IObject;
326
- innerEditor?: IObject;
424
+ editTool?: IObject$1;
425
+ innerEditor?: IObject$1;
327
426
  select(target: IUI$1 | IUI$1[]): void;
328
427
  cancel(): void;
329
428
  hasItem(item: IUI$1): boolean;
@@ -432,11 +531,8 @@ interface IEditToolFunction {
432
531
  (ui: any): string;
433
532
  }
434
533
 
435
- interface ILine extends IUI {
534
+ interface ILine extends ILineAttrData, IUI {
436
535
  __: ILineData;
437
- toPoint?: IPointData;
438
- points?: number[];
439
- curve?: boolean | number;
440
536
  }
441
537
  interface ILineAttrData {
442
538
  toPoint?: IPointData;
@@ -465,6 +561,70 @@ interface IFlowData extends IFlowAttrData, IBoxData {
465
561
  }
466
562
  interface IFlowInputData extends IFlowAttrData, IBoxInputData {
467
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
+ }
468
628
  interface IRect extends IUI {
469
629
  __: IRectData;
470
630
  }
@@ -472,11 +632,8 @@ interface IRectData extends IUIData {
472
632
  }
473
633
  interface IRectInputData extends IUIBaseInputData {
474
634
  }
475
- interface IEllipse extends IUI {
635
+ interface IEllipse extends IUI, IEllipseAttrData {
476
636
  __: IEllipseData;
477
- startAngle?: number;
478
- endAngle?: number;
479
- innerRadius?: number;
480
637
  }
481
638
  interface IEllipseAttrData {
482
639
  startAngle?: number;
@@ -487,11 +644,8 @@ interface IEllipseData extends IEllipseAttrData, IUIData {
487
644
  }
488
645
  interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
489
646
  }
490
- interface IPolygon extends IUI {
647
+ interface IPolygon extends IPolygonAttrData, IUI {
491
648
  __: IPolygonData;
492
- sides?: number;
493
- points?: number[];
494
- curve?: boolean | number;
495
649
  }
496
650
  interface IPolygonAttrData {
497
651
  sides?: number;
@@ -502,10 +656,8 @@ interface IPolygonData extends IPolygonAttrData, IUIData {
502
656
  }
503
657
  interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
504
658
  }
505
- interface IStar extends IUI {
659
+ interface IStar extends IStarAttrData, IUI {
506
660
  __: IStarData;
507
- corners?: number;
508
- innerRadius?: number;
509
661
  }
510
662
  interface IStarAttrData {
511
663
  corners?: number;
@@ -533,11 +685,8 @@ interface IPenData extends IGroupData {
533
685
  }
534
686
  interface IPenInputData extends IGroupInputData {
535
687
  }
536
- interface IText extends ITextStyleAttrData, IUI {
688
+ interface IText extends ITextAttrData, ITextStyleAttrData, IUI {
537
689
  __: ITextData;
538
- text?: string;
539
- padding?: IFourNumber;
540
- resizeFontSize?: IBoolean;
541
690
  }
542
691
  interface ITextAttrData {
543
692
  text?: string;
@@ -592,9 +741,8 @@ interface ITextDrawData {
592
741
  decorationHeight?: number;
593
742
  overflow?: number;
594
743
  }
595
- interface IImage extends IRect, ILeaferImageConfig {
744
+ interface IImage extends IImageAttrData, IRect {
596
745
  __: IImageData;
597
- url: string;
598
746
  ready: boolean;
599
747
  image?: ILeaferImage;
600
748
  }
@@ -606,10 +754,8 @@ interface IImageData extends IImageAttrData, IRectData {
606
754
  }
607
755
  interface IImageInputData extends IImageAttrData, IUIBaseInputData {
608
756
  }
609
- interface ICanvas extends IRect {
757
+ interface ICanvas extends ICanvasAttrData, IRect {
610
758
  __: ICanvasData;
611
- smooth?: boolean;
612
- contextSettings?: ICanvasContext2DSettings;
613
759
  canvas?: ILeaferCanvas;
614
760
  context?: ICanvasContext2D;
615
761
  __updateSize(): void;
@@ -638,20 +784,18 @@ interface IFrameData extends IBoxData {
638
784
  }
639
785
  interface IFrameInputData extends IBoxInputData {
640
786
  }
641
- interface IBox extends IGroup {
787
+ interface IBox extends IBoxAttrData, IGroup {
642
788
  __: IBoxData;
643
- resizeChildren?: IBoolean;
644
- overflow?: IOverflow;
645
789
  __updateRectRenderBounds(): void;
646
790
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
647
791
  }
648
- interface IBoxData extends IGroupData {
649
- resizeChildren?: boolean;
792
+ interface IBoxAttrData {
650
793
  overflow?: IOverflow;
794
+ resizeChildren?: IBoolean;
651
795
  }
652
- interface IBoxInputData extends IGroupInputData {
653
- resizeChildren?: boolean;
654
- overflow?: IOverflow;
796
+ interface IBoxData extends IBoxAttrData, IGroupData {
797
+ }
798
+ interface IBoxInputData extends IBoxAttrData, IGroupInputData {
655
799
  }
656
800
  interface IGroup extends IUI {
657
801
  __: IGroupData;
@@ -670,7 +814,7 @@ interface IGroupData extends IUIData {
670
814
  }
671
815
  interface IGroupInputData extends IUIBaseInputData {
672
816
  }
673
- interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
817
+ interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
674
818
  __: IUIData;
675
819
  readonly app: ILeafer;
676
820
  leafer?: ILeafer;
@@ -679,19 +823,16 @@ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEf
679
823
  readonly isFrame?: boolean;
680
824
  proxyData?: IUIInputData;
681
825
  __proxyData?: IUIInputData;
682
- normalStyle?: IUIInputData;
683
- hoverStyle?: IUIInputData;
684
- pressStyle?: IUIInputData;
685
- focusStyle?: IUIInputData;
686
- selectedStyle?: IUIInputData;
687
- disabledStyle?: IUIInputData;
826
+ animation?: IAnimation;
827
+ animationOut?: IAnimation;
688
828
  editConfig?: IEditorConfig;
689
829
  editOuter: string;
690
830
  editInner: string;
691
831
  children?: IUI[];
832
+ __animate?: IAnimate;
692
833
  readonly pen: IPathCreator;
693
834
  reset(data?: IUIInputData): void;
694
- set(data: IUIInputData): void;
835
+ set(data: IUIInputData, isTemp?: boolean): void;
695
836
  toJSON(options?: IJSONOptions): IUIJSONData;
696
837
  get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
697
838
  createProxyData(): IUIInputData;
@@ -705,20 +846,35 @@ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEf
705
846
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
706
847
  __drawPathByBox(drawer: IPathDrawer): void;
707
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;
708
851
  export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
709
- 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;
710
872
  }
711
873
  interface IFindUIMethod {
712
874
  (leaf: IUI, options?: any): IAnswer;
713
875
  }
714
- interface IUIData extends IUIComputedData, ILeafData {
715
- padding?: number | number[];
716
- normalStyle?: IUIInputData;
717
- hoverStyle?: IUIInputData;
718
- pressStyle?: IUIInputData;
719
- focusStyle?: IUIInputData;
720
- selectedStyle?: IUIInputData;
721
- disabledStyle?: IUIInputData;
876
+ interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
877
+ readonly scale: number | IPointData;
722
878
  __isFills?: boolean;
723
879
  __isStrokes?: boolean;
724
880
  readonly __strokeWidth: number;
@@ -737,21 +893,13 @@ interface IUIData extends IUIComputedData, ILeafData {
737
893
  __needComputePaint: boolean;
738
894
  __computePaint(): void;
739
895
  }
740
- interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
741
- padding?: number | number[];
742
- }
743
- interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
744
- padding?: number | number[];
745
- normalStyle?: IUIInputData;
746
- hoverStyle?: IUIInputData;
747
- pressStyle?: IUIInputData;
748
- focusStyle?: IUIInputData;
749
- selectedStyle?: IUIInputData;
750
- 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 {
751
899
  children?: IUIInputData[];
752
900
  }
753
- type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
754
- 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 {
755
903
  children?: IUIInputData[];
756
904
  }
757
905
  interface IUIJSONData extends IUIInputData {
@@ -815,12 +963,29 @@ interface IPathArrowModule {
815
963
  addArrows(ui: IUI, changeRenderPath?: boolean): void;
816
964
  }
817
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
+
818
982
  interface ITextConvertModule {
819
983
  getDrawData(content: string, style: ITextData): ITextDrawData;
820
984
  }
821
985
 
822
986
  interface IColorConvertModule {
823
987
  string(color: IColor, opacity?: number): string;
988
+ object(color: IColor, opacity?: number): IRGBA;
824
989
  }
825
990
 
826
991
  interface IExportModule {
@@ -829,12 +994,20 @@ interface IExportModule {
829
994
  }
830
995
 
831
996
  interface IStateModule {
832
- isHover(leaf: ILeaf$1): boolean;
833
- isPress(leaf: ILeaf$1): boolean;
834
- isFocus(leaf: ILeaf$1): boolean;
835
- isDrag(leaf: ILeaf$1): boolean;
836
- setStyle(leaf: ILeaf$1, stateType: IStateStyleType, value: boolean): void;
837
- 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;
838
1011
  }
839
1012
 
840
1013
  interface ICachedShape extends ICachedLeaf {
@@ -880,4 +1053,4 @@ interface IEffectModule {
880
1053
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
881
1054
  }
882
1055
 
883
- 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 };