@leafer/interface 1.3.3 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/interface",
3
- "version": "1.3.3",
3
+ "version": "1.4.1",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -0,0 +1,86 @@
1
+ import { IObject } from '../data/IData'
2
+
3
+ export type ITransition = IAnimateOptions | IAnimateEasingName | number | boolean
4
+
5
+ export interface IAnimateOptions {
6
+ easing?: IAnimateEasing
7
+
8
+ delay?: number
9
+ duration?: number
10
+ ending?: IAnimateEnding
11
+
12
+ reverse?: boolean
13
+ swing?: boolean | number
14
+
15
+ loop?: boolean | number
16
+ loopDelay?: number
17
+
18
+ speed?: number
19
+
20
+ join?: boolean
21
+ autoplay?: boolean
22
+
23
+ attrs?: string[]
24
+ event?: IAnimateEvents
25
+ }
26
+
27
+
28
+ export interface IAnimateEasingFunction {
29
+ (t: number): number
30
+ }
31
+
32
+ export interface ICustomEasingFunction {
33
+ (...arg: any): IAnimateEasingFunction
34
+ }
35
+
36
+
37
+ export type IAnimateEasing =
38
+ | IAnimateEasingName
39
+ | ICubicBezierEasing
40
+ | IStepsEasing
41
+ | IObject
42
+
43
+ export interface ICubicBezierEasing {
44
+ name: 'cubic-bezier',
45
+ value: [number, number, number, number]
46
+ }
47
+
48
+ export interface IStepsEasing {
49
+ name: 'steps',
50
+ value: number | [number, 'floor' | 'round' | 'ceil']
51
+ }
52
+
53
+
54
+ export type IAnimateEasingName =
55
+ | 'linear'
56
+ | 'ease'
57
+ | 'ease-in' | 'ease-out' | 'ease-in-out'
58
+ | 'sine-in' | 'sine-out' | 'sine-in-out'
59
+ | 'quad-in' | 'quad-out' | 'quad-in-out'
60
+ | 'cubic-in' | 'cubic-out' | 'cubic-in-out'
61
+ | 'quart-in' | 'quart-out' | 'quart-in-out'
62
+ | 'quint-in' | 'quint-out' | 'quint-in-out'
63
+ | 'expo-in' | 'expo-out' | 'expo-in-out'
64
+ | 'circ-in' | 'circ-out' | 'circ-in-out'
65
+ | 'back-in' | 'back-out' | 'back-in-out'
66
+ | 'elastic-in' | 'elastic-out' | 'elastic-in-out'
67
+ | 'bounce-in' | 'bounce-out' | 'bounce-in-out'
68
+
69
+
70
+ export type IAnimateEnding = 'auto' | 'from' | 'to'
71
+
72
+ export interface IAnimateEvents {
73
+ created?: IAnimateEventFunction
74
+
75
+ play?: IAnimateEventFunction
76
+ pause?: IAnimateEventFunction
77
+ stop?: IAnimateEventFunction
78
+ seek?: IAnimateEventFunction
79
+
80
+ update?: IAnimateEventFunction
81
+ completed?: IAnimateEventFunction
82
+ }
83
+
84
+ export interface IAnimateEventFunction {
85
+ (animate?: any): any
86
+ }
@@ -15,6 +15,7 @@ import { IAppBase } from './IApp'
15
15
  import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
16
16
  import { IControl } from '../control/IControl'
17
17
  import { IFunction } from '../function/IFunction'
18
+ import { ITransition } from '../animate/ITransition'
18
19
 
19
20
 
20
21
  export type ILeaferType = 'draw' | 'block' | 'viewport' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom'
@@ -24,8 +25,6 @@ export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IIn
24
25
  mobile?: boolean
25
26
  realCanvas?: boolean
26
27
  grow?: boolean | 'box' | 'render'
27
- growWidth?: boolean
28
- growHeight?: boolean
29
28
  lazySpeard?: IFourNumber
30
29
  }
31
30
 
@@ -84,7 +83,7 @@ export interface ILeaferAttrData {
84
83
  waitViewReady(item: IFunction, bind?: IObject): void
85
84
  waitViewCompleted(item: IFunction, bind?: IObject): void
86
85
 
87
- zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData
86
+ zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean, transition?: ITransition): IBoundsData
88
87
  getValidMove(moveX: number, moveY: number): IPointData
89
88
  getValidScale(changeScale: number): number
90
89
 
@@ -20,6 +20,7 @@ import { IPathCommandObject, IPathCommandData } from '../path/IPathCommand'
20
20
  import { IWindingRule, IPath2D } from '../canvas/ICanvas'
21
21
  import { IJSONOptions } from '../file/IExport'
22
22
  import { IMotionPathData } from '../path/IPathData'
23
+ import { ITransition } from '../animate/ITransition'
23
24
 
24
25
 
25
26
  export interface ICachedLeaf {
@@ -205,7 +206,10 @@ export type IStateStyleType =
205
206
  | 'selectedStyle'
206
207
  | 'disabledStyle'
207
208
 
208
-
209
+ export interface IFilter extends IObject {
210
+ type: string
211
+ visible?: boolean
212
+ }
209
213
 
210
214
  export interface ILeafAttrData {
211
215
  // layer data
@@ -223,6 +227,7 @@ export interface ILeafAttrData {
223
227
 
224
228
  mask?: IBoolean | IMaskType
225
229
  eraser?: IBoolean | IEraserType
230
+ filter?: IFilter | IFilter[]
226
231
 
227
232
  // layout data
228
233
  x?: INumber
@@ -325,6 +330,7 @@ export interface ILeafComputedData {
325
330
 
326
331
  mask?: boolean | IMaskType
327
332
  eraser?: boolean | IEraserType
333
+ filter?: IFilter[]
328
334
 
329
335
  // layout data
330
336
  x?: number
@@ -515,7 +521,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
515
521
 
516
522
  __bindLeafer(leafer: ILeaferBase | null): void
517
523
 
518
- set(data: IObject, transition?: any): void
524
+ set(data: IObject, transition?: ITransition): void
519
525
  get(name?: string | string[] | IObject): ILeafInputData | IValue
520
526
  setAttr(name: string, value: any): void
521
527
  getAttr(name: string): any
@@ -613,22 +619,22 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
613
619
  getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
614
620
 
615
621
  // transform
616
- setTransform(transform?: IMatrixData, resize?: boolean): void
617
- transform(transform?: IMatrixData, resize?: boolean): void
618
- move(x: number | IPointData, y?: number, transition?: any): void
622
+ setTransform(transform?: IMatrixData, resize?: boolean, transition?: ITransition): void
623
+ transform(transform?: IMatrixData, resize?: boolean, transition?: ITransition): void
624
+ move(x: number | IPointData, y?: number, transition?: ITransition): void
619
625
 
620
- moveInner(x: number | IPointData, y?: number, transition?: any): void
621
- scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void
622
- rotateOf(origin: IPointData | IAlign, rotation: number): void
623
- skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void
626
+ moveInner(x: number | IPointData, y?: number, transition?: ITransition): void
627
+ scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void
628
+ rotateOf(origin: IPointData | IAlign, rotation: number, transition?: ITransition): void
629
+ skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void
624
630
 
625
- transformWorld(worldTransform?: IMatrixData, resize?: boolean): void
626
- moveWorld(x: number | IPointData, y?: number, transition?: any): void
627
- scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
628
- rotateOfWorld(worldOrigin: IPointData, rotation: number): void
629
- skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
631
+ transformWorld(worldTransform?: IMatrixData, resize?: boolean, transition?: ITransition): void
632
+ moveWorld(x: number | IPointData, y?: number, transition?: ITransition): void
633
+ scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void
634
+ rotateOfWorld(worldOrigin: IPointData, rotation: number, transition?: ITransition): void
635
+ skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void
630
636
 
631
- flip(axis: IAxis): void
637
+ flip(axis: IAxis, transition?: ITransition): void
632
638
 
633
639
  scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
634
640
  __scaleResize(scaleX: number, scaleY: number): void
@@ -648,7 +654,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
648
654
  // ILeafRender ->
649
655
  __render(canvas: ILeaferCanvas, options: IRenderOptions): void
650
656
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
651
- __draw(canvas: ILeaferCanvas, options: IRenderOptions): void
657
+ __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void
652
658
 
653
659
  __clip(canvas: ILeaferCanvas, options: IRenderOptions): void
654
660
  __renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
@@ -6,7 +6,7 @@ export type ILeafRenderModule = ILeafRender & ThisType<ILeaf>
6
6
 
7
7
  export interface ILeafRender {
8
8
  __render?(canvas: ILeaferCanvas, options: IRenderOptions): void
9
- __draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
9
+ __draw?(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void
10
10
  __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
11
11
 
12
12
  __clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void
@@ -0,0 +1,21 @@
1
+ import { ITaskProcessor } from '../task/ITaskProcessor'
2
+ import { ILeaferImage } from '../image/ILeaferImage'
3
+ import { IExportFileType } from './IFileType'
4
+ import { IObject } from '../data/IData'
5
+ import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
6
+
7
+
8
+ export interface IResource {
9
+ map: any,
10
+ tasker: ITaskProcessor
11
+ readonly isComplete: boolean
12
+
13
+ set(key: string, value: any): void
14
+ get(key: string): any
15
+ remove(key: string): void
16
+
17
+ setImage(key: string, value: string | IObject | ILeaferImage | ILeaferCanvas, format?: IExportFileType): ILeaferImage
18
+ loadImage(key: string, format?: IExportFileType): Promise<ILeaferImage>
19
+
20
+ destroy(): void
21
+ }
@@ -2,21 +2,17 @@ import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
2
2
  import { ITaskProcessor } from '../task/ITaskProcessor'
3
3
  import { IExportFileType } from '../file/IFileType'
4
4
 
5
- interface ILeaferImageMap {
6
- [name: string]: ILeaferImage
7
- }
8
5
 
9
6
  export interface IImageManager {
10
- map: ILeaferImageMap
11
- recycledList: ILeaferImage[]
12
- tasker: ITaskProcessor
13
7
  patternTasker: ITaskProcessor
14
8
  patternLocked?: boolean // 锁定pattern不更新, 一般用于创建碰撞位图 UIHit.ts
15
- readonly isComplete: boolean
9
+ recycledList: ILeaferImage[]
10
+
16
11
  get(config: ILeaferImageConfig): ILeaferImage
17
12
  recycle(image: ILeaferImage): void
18
13
  clearRecycled(): void
19
14
  hasOpacityPixel(config: ILeaferImageConfig): boolean // png / svg / webp
20
15
  isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean
16
+
21
17
  destroy(): void
22
18
  }
@@ -3,11 +3,13 @@ import { IObject } from '../data/IData'
3
3
  import { InnerId } from '../event/IEventer'
4
4
  import { IExportFileType } from '../file/IFileType'
5
5
  import { IMatrixData } from '../math/IMath'
6
+ import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
6
7
 
7
8
  export interface ILeaferImageConfig {
8
9
  url: string
9
10
  thumb?: string
10
11
  format?: IExportFileType
12
+ view?: IObject | ILeaferImage | ILeaferCanvas
11
13
  }
12
14
 
13
15
  export interface ILeaferImageOnLoaded {
@@ -31,7 +33,7 @@ export interface ILeaferImage {
31
33
  readonly innerId: InnerId
32
34
  readonly url: string
33
35
 
34
- view: unknown
36
+ view: any
35
37
  width: number
36
38
  height: number
37
39
 
@@ -48,7 +50,8 @@ export interface ILeaferImage {
48
50
 
49
51
  load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number
50
52
  unload(index: number, stopEvent?: boolean): void
51
- getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown
53
+ getFull(filters?: IObject): any
54
+ getCanvas(width: number, height: number, opacity?: number, filters?: IObject): any
52
55
  getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern
53
56
  destroy(): void
54
57
  }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { IAppBase } from './app/IApp'
2
2
  export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType } from './app/ILeafer'
3
- export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, ISide, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IFlowWrap, IAutoSize, IRangeSize, IPercentData, IUnitData, IConstraint, IConstraintType, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IDirection4, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
3
+ export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, ISide, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IFlowWrap, IAutoSize, IRangeSize, IPercentData, IUnitData, IConstraint, IConstraintType, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IDirection4, IAround, IFilter, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
@@ -41,6 +41,7 @@ export { IWindingRule, ICanvasContext2D, ICanvasContext2DSettings, ITextMetrics,
41
41
  export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData, MoveToCommandObject, LineToCommandObject, BezierCurveToCommandObject, QuadraticCurveToCommandObject, IPathCommandObject } from './path/IPathCommand'
42
42
 
43
43
  export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnError, ILeaferImageCacheCanvas, ILeaferImagePatternPaint } from './image/ILeaferImage'
44
+ export { IResource } from './file/IResource'
44
45
  export { IExportFileType, IExportImageType } from './file/IFileType'
45
46
  export { IExportOptions, IJSONOptions, IExportResult, IExportResultFunction, IExportOnCanvasFunction } from './file/IExport'
46
47
 
@@ -54,4 +55,6 @@ export { ITransformer } from './interaction/ITransformer'
54
55
  export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IFunctionMap, IPointDataMap, IDataTypeHandle } from './data/IData'
55
56
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
56
57
  export { IPoint, IPointData, IFromToData, IUnitPointData, IRotationPointData, IScrollPointData, IClientPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoxData, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
57
- export { IFunction, IStringFunction, INumberFunction, IObjectFunction, IPointDataFunction, IAttrDecorator } from './function/IFunction'
58
+ export { IFunction, IStringFunction, INumberFunction, IObjectFunction, IPointDataFunction, IAttrDecorator } from './function/IFunction'
59
+
60
+ export { ITransition, IAnimateEasing, ICubicBezierEasing, IStepsEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvents, IAnimateEventFunction, ICustomEasingFunction, IAnimateOptions } from './animate/ITransition'
package/types/index.d.ts CHANGED
@@ -1186,7 +1186,7 @@ interface ILeafHit {
1186
1186
  type ILeafRenderModule = ILeafRender & ThisType<ILeaf>;
1187
1187
  interface ILeafRender {
1188
1188
  __render?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1189
- __draw?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1189
+ __draw?(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
1190
1190
  __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1191
1191
  __clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
1192
1192
  __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void;
@@ -1291,6 +1291,52 @@ interface IMotionPathData {
1291
1291
  data: IPathCommandData;
1292
1292
  }
1293
1293
 
1294
+ type ITransition = IAnimateOptions | IAnimateEasingName | number | boolean;
1295
+ interface IAnimateOptions {
1296
+ easing?: IAnimateEasing;
1297
+ delay?: number;
1298
+ duration?: number;
1299
+ ending?: IAnimateEnding;
1300
+ reverse?: boolean;
1301
+ swing?: boolean | number;
1302
+ loop?: boolean | number;
1303
+ loopDelay?: number;
1304
+ speed?: number;
1305
+ join?: boolean;
1306
+ autoplay?: boolean;
1307
+ attrs?: string[];
1308
+ event?: IAnimateEvents;
1309
+ }
1310
+ interface IAnimateEasingFunction {
1311
+ (t: number): number;
1312
+ }
1313
+ interface ICustomEasingFunction {
1314
+ (...arg: any): IAnimateEasingFunction;
1315
+ }
1316
+ type IAnimateEasing = IAnimateEasingName | ICubicBezierEasing | IStepsEasing | IObject;
1317
+ interface ICubicBezierEasing {
1318
+ name: 'cubic-bezier';
1319
+ value: [number, number, number, number];
1320
+ }
1321
+ interface IStepsEasing {
1322
+ name: 'steps';
1323
+ value: number | [number, 'floor' | 'round' | 'ceil'];
1324
+ }
1325
+ 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';
1326
+ type IAnimateEnding = 'auto' | 'from' | 'to';
1327
+ interface IAnimateEvents {
1328
+ created?: IAnimateEventFunction;
1329
+ play?: IAnimateEventFunction;
1330
+ pause?: IAnimateEventFunction;
1331
+ stop?: IAnimateEventFunction;
1332
+ seek?: IAnimateEventFunction;
1333
+ update?: IAnimateEventFunction;
1334
+ completed?: IAnimateEventFunction;
1335
+ }
1336
+ interface IAnimateEventFunction {
1337
+ (animate?: any): any;
1338
+ }
1339
+
1294
1340
  interface ICachedLeaf {
1295
1341
  canvas: ILeaferCanvas;
1296
1342
  matrix?: IMatrix;
@@ -1349,6 +1395,10 @@ type IFlowAlign = IAlign | IBaseLineAlign;
1349
1395
  type IAround = IAlign | IUnitPointData;
1350
1396
  type ICursorType = IImageCursor | '' | 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
1351
1397
  type IStateStyleType = 'hoverStyle' | 'pressStyle' | 'focusStyle' | 'selectedStyle' | 'disabledStyle';
1398
+ interface IFilter extends IObject {
1399
+ type: string;
1400
+ visible?: boolean;
1401
+ }
1352
1402
  interface ILeafAttrData {
1353
1403
  id?: IString;
1354
1404
  name?: IString;
@@ -1362,6 +1412,7 @@ interface ILeafAttrData {
1362
1412
  zIndex?: INumber;
1363
1413
  mask?: IBoolean | IMaskType;
1364
1414
  eraser?: IBoolean | IEraserType;
1415
+ filter?: IFilter | IFilter[];
1365
1416
  x?: INumber;
1366
1417
  y?: INumber;
1367
1418
  width?: INumber;
@@ -1434,6 +1485,7 @@ interface ILeafComputedData {
1434
1485
  zIndex?: number;
1435
1486
  mask?: boolean | IMaskType;
1436
1487
  eraser?: boolean | IEraserType;
1488
+ filter?: IFilter[];
1437
1489
  x?: number;
1438
1490
  y?: number;
1439
1491
  width?: number;
@@ -1568,7 +1620,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1568
1620
  nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
1569
1621
  removeNextRender(item: IFunction): void;
1570
1622
  __bindLeafer(leafer: ILeaferBase | null): void;
1571
- set(data: IObject, transition?: any): void;
1623
+ set(data: IObject, transition?: ITransition): void;
1572
1624
  get(name?: string | string[] | IObject): ILeafInputData | IValue;
1573
1625
  setAttr(name: string, value: any): void;
1574
1626
  getAttr(name: string): any;
@@ -1637,19 +1689,19 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1637
1689
  getWorldPointByBox(box: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1638
1690
  getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1639
1691
  getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1640
- setTransform(transform?: IMatrixData, resize?: boolean): void;
1641
- transform(transform?: IMatrixData, resize?: boolean): void;
1642
- move(x: number | IPointData, y?: number, transition?: any): void;
1643
- moveInner(x: number | IPointData, y?: number, transition?: any): void;
1644
- scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void;
1645
- rotateOf(origin: IPointData | IAlign, rotation: number): void;
1646
- skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void;
1647
- transformWorld(worldTransform?: IMatrixData, resize?: boolean): void;
1648
- moveWorld(x: number | IPointData, y?: number, transition?: any): void;
1649
- scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
1650
- rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
1651
- skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
1652
- flip(axis: IAxis): void;
1692
+ setTransform(transform?: IMatrixData, resize?: boolean, transition?: ITransition): void;
1693
+ transform(transform?: IMatrixData, resize?: boolean, transition?: ITransition): void;
1694
+ move(x: number | IPointData, y?: number, transition?: ITransition): void;
1695
+ moveInner(x: number | IPointData, y?: number, transition?: ITransition): void;
1696
+ scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
1697
+ rotateOf(origin: IPointData | IAlign, rotation: number, transition?: ITransition): void;
1698
+ skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
1699
+ transformWorld(worldTransform?: IMatrixData, resize?: boolean, transition?: ITransition): void;
1700
+ moveWorld(x: number | IPointData, y?: number, transition?: ITransition): void;
1701
+ scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
1702
+ rotateOfWorld(worldOrigin: IPointData, rotation: number, transition?: ITransition): void;
1703
+ skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
1704
+ flip(axis: IAxis, transition?: ITransition): void;
1653
1705
  scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
1654
1706
  __scaleResize(scaleX: number, scaleY: number): void;
1655
1707
  resizeWidth(width: number): void;
@@ -1663,7 +1715,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1663
1715
  __updateHitCanvas(): void;
1664
1716
  __render(canvas: ILeaferCanvas, options: IRenderOptions): void;
1665
1717
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
1666
- __draw(canvas: ILeaferCanvas, options: IRenderOptions): void;
1718
+ __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
1667
1719
  __clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
1668
1720
  __renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void;
1669
1721
  __updateWorldOpacity(): void;
@@ -1693,6 +1745,7 @@ interface ILeaferImageConfig {
1693
1745
  url: string;
1694
1746
  thumb?: string;
1695
1747
  format?: IExportFileType;
1748
+ view?: IObject | ILeaferImage | ILeaferCanvas;
1696
1749
  }
1697
1750
  interface ILeaferImageOnLoaded {
1698
1751
  (image?: ILeaferImage): any;
@@ -1710,7 +1763,7 @@ interface ILeaferImagePatternPaint {
1710
1763
  interface ILeaferImage {
1711
1764
  readonly innerId: InnerId;
1712
1765
  readonly url: string;
1713
- view: unknown;
1766
+ view: any;
1714
1767
  width: number;
1715
1768
  height: number;
1716
1769
  isSVG: boolean;
@@ -1723,7 +1776,8 @@ interface ILeaferImage {
1723
1776
  config: ILeaferImageConfig;
1724
1777
  load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number;
1725
1778
  unload(index: number, stopEvent?: boolean): void;
1726
- getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown;
1779
+ getFull(filters?: IObject): any;
1780
+ getCanvas(width: number, height: number, opacity?: number, filters?: IObject): any;
1727
1781
  getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern;
1728
1782
  destroy(): void;
1729
1783
  }
@@ -1944,8 +1998,6 @@ interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteracti
1944
1998
  mobile?: boolean;
1945
1999
  realCanvas?: boolean;
1946
2000
  grow?: boolean | 'box' | 'render';
1947
- growWidth?: boolean;
1948
- growHeight?: boolean;
1949
2001
  lazySpeard?: IFourNumber;
1950
2002
  }
1951
2003
  interface ILeaferAttrData {
@@ -1986,7 +2038,7 @@ interface ILeaferAttrData {
1986
2038
  waitReady(item: IFunction, bind?: IObject): void;
1987
2039
  waitViewReady(item: IFunction, bind?: IObject): void;
1988
2040
  waitViewCompleted(item: IFunction, bind?: IObject): void;
1989
- zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData;
2041
+ zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean, transition?: ITransition): IBoundsData;
1990
2042
  getValidMove(moveX: number, moveY: number): IPointData;
1991
2043
  getValidScale(changeScale: number): number;
1992
2044
  getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
@@ -2080,16 +2132,10 @@ interface ITaskOptions {
2080
2132
  delay?: number;
2081
2133
  }
2082
2134
 
2083
- interface ILeaferImageMap {
2084
- [name: string]: ILeaferImage;
2085
- }
2086
2135
  interface IImageManager {
2087
- map: ILeaferImageMap;
2088
- recycledList: ILeaferImage[];
2089
- tasker: ITaskProcessor;
2090
2136
  patternTasker: ITaskProcessor;
2091
2137
  patternLocked?: boolean;
2092
- readonly isComplete: boolean;
2138
+ recycledList: ILeaferImage[];
2093
2139
  get(config: ILeaferImageConfig): ILeaferImage;
2094
2140
  recycle(image: ILeaferImage): void;
2095
2141
  clearRecycled(): void;
@@ -2198,6 +2244,18 @@ interface IPlugin extends IObject {
2198
2244
  onLeafer?(leafer: ILeaferBase): void;
2199
2245
  }
2200
2246
 
2247
+ interface IResource {
2248
+ map: any;
2249
+ tasker: ITaskProcessor;
2250
+ readonly isComplete: boolean;
2251
+ set(key: string, value: any): void;
2252
+ get(key: string): any;
2253
+ remove(key: string): void;
2254
+ setImage(key: string, value: string | IObject | ILeaferImage | ILeaferCanvas, format?: IExportFileType): ILeaferImage;
2255
+ loadImage(key: string, format?: IExportFileType): Promise<ILeaferImage>;
2256
+ destroy(): void;
2257
+ }
2258
+
2201
2259
  interface ICursorTypeMap {
2202
2260
  [name: string]: ICursorType | ICursorType[];
2203
2261
  }
@@ -2218,4 +2276,4 @@ interface ITransformer {
2218
2276
  destroy(): void;
2219
2277
  }
2220
2278
 
2221
- export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
2279
+ export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };