@leafer/interface 2.0.2 → 2.0.4

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": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -18,6 +18,7 @@ import { ILeaferVideo, ILeaferVideoConfig } from '../image/ILeaferVideo'
18
18
  import { IControl } from '../control/IControl'
19
19
  import { IFunction } from '../function/IFunction'
20
20
  import { ITransition } from '../animate/ITransition'
21
+ import { ILeafMap } from '../data/IList'
21
22
 
22
23
 
23
24
  export type ILeaferType = 'draw' | 'block' | 'viewport' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom' // 应用场景类型
@@ -66,6 +67,12 @@ export interface ILeaferAttrData {
66
67
  config: ILeaferConfig
67
68
  userConfig?: ILeaferConfig
68
69
 
70
+ // @leafer-in/find
71
+ cacheId?: boolean
72
+ cacheInnerId?: boolean
73
+ innerIdMap?: ILeafMap
74
+ idMap?: ILeafMap
75
+
69
76
  readonly cursorPoint: IPointData
70
77
  readonly clientBounds: IBoundsData
71
78
  leafs: number
@@ -147,7 +154,7 @@ export interface ICreator {
147
154
  layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter
148
155
  renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer
149
156
  selector?(target?: ILeaf, options?: ISelectorConfig): ISelector
150
- finder?(target?: ILeaf): IFinder
157
+ finder?(target?: ILeaf, options?: ISelectorConfig): IFinder
151
158
 
152
159
  interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
153
160
 
@@ -29,6 +29,7 @@ export interface ILeafDataOptions {
29
29
  export interface ILeafData extends IDataProcessor, ILeafComputedData {
30
30
  __single?: boolean
31
31
  readonly __hasMultiPaint?: boolean // fill 、stroke 、shadow 等同时存在两次以上外观绘制的情况
32
+ __willDestroy?: boolean
32
33
  __checkSingle(): void
33
34
  __removeNaturalSize(): void
34
35
  }
@@ -21,14 +21,7 @@ import { IWindingRule, IPath2D } from '../canvas/ICanvas'
21
21
  import { IJSONOptions } from '../file/IExport'
22
22
  import { IMotionPathData } from '../path/IPathData'
23
23
  import { ITransition } from '../animate/ITransition'
24
-
25
-
26
- export interface ICachedLeaf {
27
- canvas: ILeaferCanvas, // 完整的元素缓存画布
28
- matrix?: IMatrix, // 包含导出时附加的 options.matrix
29
- fitMatrix?: IMatrix, // 不包含导出时附加的 options.matrix
30
- bounds: IBoundsData
31
- }
24
+ import { ITaskItem } from '../task/ITaskProcessor'
32
25
 
33
26
 
34
27
  export type ISide = 'width' | 'height'
@@ -434,6 +427,7 @@ export interface ILeafComputedData {
434
427
  // other
435
428
  __childBranchNumber?: number // 存在子分支的个数
436
429
  __complex?: boolean // 外观是否复杂
430
+ __complexData?: ILeafComplexCachedData // 复杂元素的缓存图
437
431
 
438
432
  __naturalWidth?: number
439
433
  __naturalHeight?: number
@@ -456,12 +450,19 @@ export interface ILeafComputedData {
456
450
  __pathInputed?: number // 是否为输入path, 0:否,1:是,2:永远是(不自动检测)
457
451
  __pathForRender?: IPathCommandData
458
452
  __path2DForRender?: IPath2D
459
- __pathForArrow?: IPathCommandData
453
+
454
+ __startArrowPath?: IArrowPathData
455
+ __endArrowPath?: IArrowPathData
460
456
  __pathForMotion?: IMotionPathData
461
457
 
462
458
  __clipAfterFill?: boolean // 一般用于判断是否裁剪 Box
463
459
  }
464
460
 
461
+ export interface IArrowPathData {
462
+ data: IPathCommandData
463
+ fill?: boolean
464
+ }
465
+
465
466
  export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
466
467
  tag: string
467
468
  readonly __tag: string
@@ -532,6 +533,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
532
533
 
533
534
  __hasAutoLayout?: boolean
534
535
  __hasMotionPath?: boolean
536
+ __hasComplex?: boolean
535
537
 
536
538
  __hasMask?: boolean
537
539
  __hasEraser?: boolean
@@ -635,7 +637,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
635
637
  // convert
636
638
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
637
639
  getClampRenderScale(): number // 获取当前渲染元素的缩放比例,限制最小为1
638
- getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData // 当前渲染的比例数据,必须马上分解使用
640
+ getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed, unscale?: boolean): IScaleData // 当前渲染的比例数据,必须马上分解使用
639
641
 
640
642
  getTransform(relative?: ILocationType | ILeaf): IMatrixData
641
643
 
@@ -699,7 +701,6 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
699
701
 
700
702
  // ILeafRender ->
701
703
  __render(canvas: ILeaferCanvas, options: IRenderOptions): void
702
- __renderComplex(canvas: ILeaferCanvas, options: IRenderOptions): void
703
704
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
704
705
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void
705
706
 
@@ -714,7 +715,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
714
715
  __drawPath(canvas: ILeaferCanvas): void
715
716
  __drawRenderPath(canvas: ILeaferCanvas): void
716
717
  __updatePath(): void
717
- __updateRenderPath(): void
718
+ __updateRenderPath(updateCache?: boolean): void
718
719
 
719
720
  // motion path
720
721
  getMotionPathData(): IMotionPathData
@@ -742,3 +743,19 @@ export type ILeafAttrDescriptor = IObject & ThisType<ILeaf>
742
743
  export interface ILeafAttrDescriptorFn {
743
744
  (key: string): ILeafAttrDescriptor
744
745
  }
746
+
747
+ export interface ICachedLeaf {
748
+ canvas: ILeaferCanvas, // 完整的元素缓存画布
749
+ matrix?: IMatrix, // 包含导出时附加的 options.matrix
750
+ fitMatrix?: IMatrix, // 不包含导出时附加的 options.matrix
751
+ bounds: IBoundsData
752
+ }
753
+
754
+ export interface ILeafComplexCachedData { // 复杂元素缓存对象
755
+ canvas?: ILeaferCanvas
756
+ scaleX?: number
757
+ scaleY?: number
758
+ changed?: boolean
759
+ task?: ITaskItem
760
+ destroy(): void
761
+ }
@@ -1,7 +1,7 @@
1
1
  import { ICanvasPattern } from '../canvas/ICanvas'
2
2
  import { IObject } from '../data/IData'
3
3
  import { InnerId } from '../event/IEventer'
4
- import { IExportFileType } from '../file/IFileType'
4
+ import { IExportFileType, IFilmFileType, IVideoFileType } from '../file/IFileType'
5
5
  import { IBoundsData, IMatrixData, IPointData, ISizeData } from '../math/IMath'
6
6
  import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
7
7
  import { IProgressData } from '../event/IProgress'
@@ -13,7 +13,7 @@ import { IFunction } from '../function/IFunction'
13
13
  export interface ILeaferImageConfig {
14
14
  url: string
15
15
  lod?: IImageLOD
16
- format?: IExportFileType
16
+ format?: IExportFileType | IFilmFileType | IVideoFileType
17
17
  crossOrigin?: IImageCrossOrigin
18
18
  showProgress?: boolean | string // 是否显示进度
19
19
  view?: IObject | ILeaferImage | ILeaferCanvas
@@ -102,6 +102,14 @@ export interface ILeaferImage {
102
102
 
103
103
  isPlacehold?: boolean // 是否显示占位符,一般在加载100ms后自动判断
104
104
 
105
+ // filter
106
+ parent?: ILeaferImage
107
+ childrenMap?: ILeaferImageMap
108
+
109
+ filter?: any[]
110
+ filterKey?: string
111
+
112
+ // lod
105
113
  largeThumb?: ILeaferImageLevel
106
114
  thumb?: ILeaferImageLevel
107
115
  levels?: ILeaferImageLevel[]
@@ -130,7 +138,12 @@ export interface ILeaferImage {
130
138
  getLevelData(level: number, width?: number, height?: number): ILeaferImageLevel
131
139
  clearLevels(checkUse?: boolean): void
132
140
 
141
+ destroyFilter(): void // parent and childrenMap
133
142
  destroy(): void
134
143
  }
135
144
 
145
+ export interface ILeaferImageMap {
146
+ [name: string]: ILeaferImage
147
+ }
148
+
136
149
  export type IImageStatus = 'wait' | 'thumb-loading' | 'thumb-success' | 'thumb-error' | 'loading' | 'success' | 'error'
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { IAppBase } from './app/IApp'
2
2
  export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferMode, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType, IZoomOptions } 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, IInterlace, IPercentData, IUnitData, IConstraint, IConstraintType, IScaleFixed, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IDragBoundsType, IImageCursor, ICursorType, IStateStyleType, IDirection, IDirection4, IAround, IFilter, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
3
+ export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, ILeafComplexCachedData, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, ISide, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IFlowWrap, IAutoSize, IRangeSize, IInterlace, IPercentData, IUnitData, IConstraint, IConstraintType, IScaleFixed, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IDragBoundsType, IImageCursor, ICursorType, IStateStyleType, IDirection, IDirection4, IAround, IFilter, ILeafAttrDescriptor, ILeafAttrDescriptorFn, IArrowPathData } from './display/ILeaf'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
@@ -40,7 +40,7 @@ export { IMotionPathData } from './path/IPathData'
40
40
  export { IWindingRule, ICanvasContext2D, ICanvasContext2DSettings, ITextMetrics, IPath2D, ICanvasPattern } from './canvas/ICanvas'
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, IPathCommandNodeBase, MoveToCommandNode, LineToCommandNode, BezierCurveToCommandNode, ClosePathCommandNode, IPathCommandNode, PathNodeHandleType, PathNodeHandleName, IPathNodeBase } from './path/IPathCommand'
42
42
 
43
- export { ILeaferImage, ILeaferImageConfig, IImageLOD, IImageTileLOD, ILeaferImageSliceData, ILeaferImageSlice, ILeaferImageLevel, ILeaferImageOnLoaded, ILeaferImageOnError, ILeaferImageCacheCanvas, ILeaferImagePatternPaint } from './image/ILeaferImage'
43
+ export { ILeaferImage, ILeaferImageMap, ILeaferImageConfig, IImageLOD, IImageTileLOD, ILeaferImageSliceData, ILeaferImageSlice, ILeaferImageLevel, ILeaferImageOnLoaded, ILeaferImageOnError, ILeaferImageCacheCanvas, ILeaferImagePatternPaint } from './image/ILeaferImage'
44
44
  export { ILeaferFilm, ILeaferFilmConfig, IFilmDecoder, IFilmFrame, IFilmOptions, IFilmPlayOptions } from './image/ILeaferFilm'
45
45
  export { ILeaferVideo, ILeaferVideoConfig } from './image/ILeaferVideo'
46
46
  export { IResource } from './file/IResource'
@@ -79,6 +79,7 @@ export interface IInteraction extends IControl {
79
79
  cancelHover(): void
80
80
  stopDragAnimate(): void
81
81
 
82
+ replaceDownTarget(target: ILeaf): void
82
83
  updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void
83
84
  updateHoverData(data: IPointerEvent): void
84
85
 
@@ -104,6 +105,7 @@ export interface IInteractionConfig {
104
105
  eventer?: IObject
105
106
  cursor?: boolean
106
107
  keyEvent?: boolean
108
+ shadowDOM?: boolean
107
109
  }
108
110
 
109
111
  export interface IZoomConfig {
@@ -24,6 +24,7 @@ export interface ILeafLayout {
24
24
  // localBoxBounds: IBoundsData // use leaf.__localBoxBounds
25
25
  localStrokeBounds: IBoundsData
26
26
  localRenderBounds: IBoundsData
27
+ localOuterBounds?: IBoundsData // | renderBounds * (1 / scaleFixed) |
27
28
 
28
29
  // world
29
30
 
@@ -57,13 +58,14 @@ export interface ILeafLayout {
57
58
  localBoxChanged: boolean // position
58
59
 
59
60
  // face changed
60
- surfaceChanged: boolean
61
+ surfaceChanged: boolean // 不能包含透明度变化
61
62
  opacityChanged: boolean
62
63
 
63
64
  hitCanvasChanged: boolean
64
65
 
65
66
  childrenSortChanged?: boolean
66
67
  stateStyleChanged?: boolean // hoverStyle ...
68
+ linkerChanged?: boolean
67
69
 
68
70
  // config changed
69
71
  scrollConfigChanged?: boolean
@@ -79,6 +81,10 @@ export interface ILeafLayout {
79
81
  renderSpread: IFourNumber // -1 表示需监视变化,不影响实际renderBounds,目前用在Box上
80
82
  renderShapeSpread: IFourNumber
81
83
 
84
+ // scale fixed
85
+ scaleFixed?: number
86
+ outerScale?: number // localOuterBounds: scaleFixed < 1
87
+
82
88
  // temp local
83
89
  a: number
84
90
  b: number
@@ -48,6 +48,8 @@ export interface ILayouter extends IControl {
48
48
 
49
49
  config: ILayouterConfig
50
50
 
51
+ __updatedList: ILeafList
52
+
51
53
  disable(): void
52
54
 
53
55
  layout(): void
package/src/math/IMath.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IFourNumber, IObject } from '../data/IData'
2
- import { IAlign, ISide } from '../display/ILeaf'
2
+ import { IAlign, ISide, IAround } from '../display/ILeaf'
3
3
 
4
4
  export interface IPointData {
5
5
  x: number
@@ -56,6 +56,8 @@ export interface IPoint extends IPointData {
56
56
  getAngle(to: IPointData): number
57
57
  getAtan2(to: IPointData): number
58
58
 
59
+ isSame(point: IPointData, quick?: boolean): boolean
60
+
59
61
  reset(): IPoint
60
62
  }
61
63
 
@@ -126,6 +128,7 @@ export interface IBounds extends IBoundsData, ITwoPointBoundsData {
126
128
  setPoints(points: IPointData[]): IBounds
127
129
  addPoint(point: IPointData): IBounds
128
130
  getPoints(): IPointData[] // topLeft, topRight, bottomRight, bottomLeft
131
+ getPoint(around: IAround, onlyBoxSize?: boolean, to?: IPointData): IPointData
129
132
 
130
133
  hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean
131
134
  hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean
@@ -81,6 +81,7 @@ export interface IPlatform {
81
81
  resize(image: any, width: number, height: number, xGap?: number, yGap?: number, clip?: IBoundsData, smooth?: boolean, opacity?: number, filters?: IObject, interlace?: IInterlace): any
82
82
  canUse(image: any): boolean
83
83
  setPatternTransform(pattern: ICanvasPattern, transform?: IMatrixData, paint?: IObject): void
84
+ applyFilter?(canvas: any, image: any, filter: any[]): void
84
85
  },
85
86
 
86
87
  canCreateImageBitmap?: boolean // 是否能使用 createImageBitmap
@@ -25,6 +25,9 @@ export interface IRenderOptions {
25
25
  ignoreFill?: boolean, // 绘制外形时忽略fill
26
26
  ignoreStroke?: boolean // 绘制外形时忽略stroke
27
27
 
28
+ ignoreOpacity?: boolean // 绘制时忽略元素的opacity
29
+
30
+
28
31
  cellList?: ILeafList
29
32
  }
30
33
 
package/types/index.d.ts CHANGED
@@ -43,6 +43,7 @@ interface IPoint extends IPointData {
43
43
  getDistancePoint(to: IPointData, distance: number, changeTo?: boolean): IPoint;
44
44
  getAngle(to: IPointData): number;
45
45
  getAtan2(to: IPointData): number;
46
+ isSame(point: IPointData, quick?: boolean): boolean;
46
47
  reset(): IPoint;
47
48
  }
48
49
  interface IRadiusPointData extends IPointData {
@@ -99,6 +100,7 @@ interface IBounds extends IBoundsData, ITwoPointBoundsData {
99
100
  setPoints(points: IPointData[]): IBounds;
100
101
  addPoint(point: IPointData): IBounds;
101
102
  getPoints(): IPointData[];
103
+ getPoint(around: IAround, onlyBoxSize?: boolean, to?: IPointData): IPointData;
102
104
  hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean;
103
105
  hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean;
104
106
  hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean;
@@ -338,6 +340,7 @@ interface ILayouter extends IControl {
338
340
  layouting: boolean;
339
341
  waitAgain: boolean;
340
342
  config: ILayouterConfig;
343
+ __updatedList: ILeafList;
341
344
  disable(): void;
342
345
  layout(): void;
343
346
  layoutAgain(): void;
@@ -934,6 +937,7 @@ interface ILeafLayout {
934
937
  localContentBounds: IBoundsData;
935
938
  localStrokeBounds: IBoundsData;
936
939
  localRenderBounds: IBoundsData;
940
+ localOuterBounds?: IBoundsData;
937
941
  worldContentBounds: IBoundsData;
938
942
  worldBoxBounds: IBoundsData;
939
943
  worldStrokeBounds: IBoundsData;
@@ -955,6 +959,7 @@ interface ILeafLayout {
955
959
  hitCanvasChanged: boolean;
956
960
  childrenSortChanged?: boolean;
957
961
  stateStyleChanged?: boolean;
962
+ linkerChanged?: boolean;
958
963
  scrollConfigChanged?: boolean;
959
964
  editConfigChanged?: boolean;
960
965
  affectScaleOrRotation: boolean;
@@ -964,6 +969,8 @@ interface ILeafLayout {
964
969
  strokeBoxSpread: number;
965
970
  renderSpread: IFourNumber;
966
971
  renderShapeSpread: IFourNumber;
972
+ scaleFixed?: number;
973
+ outerScale?: number;
967
974
  a: number;
968
975
  b: number;
969
976
  c: number;
@@ -1206,6 +1213,7 @@ interface IRenderOptions {
1206
1213
  shape?: boolean;
1207
1214
  ignoreFill?: boolean;
1208
1215
  ignoreStroke?: boolean;
1216
+ ignoreOpacity?: boolean;
1209
1217
  cellList?: ILeafList;
1210
1218
  }
1211
1219
  interface IRendererConfig {
@@ -1319,6 +1327,7 @@ interface ILeafDataOptions {
1319
1327
  interface ILeafData extends IDataProcessor, ILeafComputedData {
1320
1328
  __single?: boolean;
1321
1329
  readonly __hasMultiPaint?: boolean;
1330
+ __willDestroy?: boolean;
1322
1331
  __checkSingle(): void;
1323
1332
  __removeNaturalSize(): void;
1324
1333
  }
@@ -1444,12 +1453,49 @@ interface IAnimateEventFunction {
1444
1453
  (animate?: any): any;
1445
1454
  }
1446
1455
 
1447
- interface ICachedLeaf {
1448
- canvas: ILeaferCanvas;
1449
- matrix?: IMatrix;
1450
- fitMatrix?: IMatrix;
1451
- bounds: IBoundsData;
1456
+ interface ITaskProcessorConfig {
1457
+ onComplete?: IFunction;
1458
+ onTask?: IFunction;
1459
+ onError?: IFunction;
1460
+ parallel?: number;
1461
+ }
1462
+ interface ITaskProcessor {
1463
+ config: ITaskProcessorConfig;
1464
+ running: boolean;
1465
+ isComplete: boolean;
1466
+ percent: number;
1467
+ total: number;
1468
+ index: number;
1469
+ finishedIndex: number;
1470
+ remain: number;
1471
+ start(): void;
1472
+ pause(): void;
1473
+ resume(): void;
1474
+ skip(): void;
1475
+ stop(): void;
1476
+ add(taskCallback: IFunction, options?: ITaskOptions | number, canUse?: IFunction): ITaskItem;
1477
+ destroy(): void;
1452
1478
  }
1479
+ interface ITaskItem {
1480
+ parent: ITaskProcessor;
1481
+ parallel: boolean;
1482
+ isComplete: boolean;
1483
+ isCancel: boolean;
1484
+ time: number;
1485
+ task?: IFunction;
1486
+ canUse?: IFunction;
1487
+ run(): Promise<void>;
1488
+ complete(): void;
1489
+ cancel(): void;
1490
+ }
1491
+ interface ITaskOptions {
1492
+ start?: boolean;
1493
+ time?: number;
1494
+ parallel?: boolean;
1495
+ delay?: number;
1496
+ canUse?: IFunction;
1497
+ }
1498
+
1453
1499
  type ISide = 'width' | 'height';
1454
1500
  type IAxis = 'x' | 'y';
1455
1501
  type IAxisReverse = 'x-reverse' | 'y-reverse';
@@ -1666,6 +1712,7 @@ interface ILeafComputedData {
1666
1712
  data?: IObject;
1667
1713
  __childBranchNumber?: number;
1668
1714
  __complex?: boolean;
1715
+ __complexData?: ILeafComplexCachedData;
1669
1716
  __naturalWidth?: number;
1670
1717
  __naturalHeight?: number;
1671
1718
  readonly __autoWidth?: boolean;
@@ -1683,10 +1730,15 @@ interface ILeafComputedData {
1683
1730
  __pathInputed?: number;
1684
1731
  __pathForRender?: IPathCommandData;
1685
1732
  __path2DForRender?: IPath2D;
1686
- __pathForArrow?: IPathCommandData;
1733
+ __startArrowPath?: IArrowPathData;
1734
+ __endArrowPath?: IArrowPathData;
1687
1735
  __pathForMotion?: IMotionPathData;
1688
1736
  __clipAfterFill?: boolean;
1689
1737
  }
1738
+ interface IArrowPathData {
1739
+ data: IPathCommandData;
1740
+ fill?: boolean;
1741
+ }
1690
1742
  interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
1691
1743
  tag: string;
1692
1744
  readonly __tag: string;
@@ -1736,6 +1788,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1736
1788
  animationOut?: IObject | IObject[];
1737
1789
  __hasAutoLayout?: boolean;
1738
1790
  __hasMotionPath?: boolean;
1791
+ __hasComplex?: boolean;
1739
1792
  __hasMask?: boolean;
1740
1793
  __hasEraser?: boolean;
1741
1794
  __hitCanvas?: IHitCanvas;
@@ -1807,7 +1860,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1807
1860
  __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
1808
1861
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
1809
1862
  getClampRenderScale(): number;
1810
- getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData;
1863
+ getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed, unscale?: boolean): IScaleData;
1811
1864
  getTransform(relative?: ILocationType | ILeaf): IMatrixData;
1812
1865
  getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
1813
1866
  getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
@@ -1855,7 +1908,6 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1855
1908
  __drawHitPath(canvas: ILeaferCanvas): void;
1856
1909
  __updateHitCanvas(): void;
1857
1910
  __render(canvas: ILeaferCanvas, options: IRenderOptions): void;
1858
- __renderComplex(canvas: ILeaferCanvas, options: IRenderOptions): void;
1859
1911
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
1860
1912
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
1861
1913
  __clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
@@ -1866,7 +1918,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1866
1918
  __drawPath(canvas: ILeaferCanvas): void;
1867
1919
  __drawRenderPath(canvas: ILeaferCanvas): void;
1868
1920
  __updatePath(): void;
1869
- __updateRenderPath(): void;
1921
+ __updateRenderPath(updateCache?: boolean): void;
1870
1922
  getMotionPathData(): IMotionPathData;
1871
1923
  getMotionPoint(motionDistance: number | IUnitData): IRotationPointData;
1872
1924
  getMotionTotal(): number;
@@ -1884,6 +1936,20 @@ type ILeafAttrDescriptor = IObject & ThisType<ILeaf>;
1884
1936
  interface ILeafAttrDescriptorFn {
1885
1937
  (key: string): ILeafAttrDescriptor;
1886
1938
  }
1939
+ interface ICachedLeaf {
1940
+ canvas: ILeaferCanvas;
1941
+ matrix?: IMatrix;
1942
+ fitMatrix?: IMatrix;
1943
+ bounds: IBoundsData;
1944
+ }
1945
+ interface ILeafComplexCachedData {
1946
+ canvas?: ILeaferCanvas;
1947
+ scaleX?: number;
1948
+ scaleY?: number;
1949
+ changed?: boolean;
1950
+ task?: ITaskItem;
1951
+ destroy(): void;
1952
+ }
1887
1953
 
1888
1954
  interface IProgressData {
1889
1955
  value: number;
@@ -2031,6 +2097,7 @@ interface IPlatform {
2031
2097
  resize(image: any, width: number, height: number, xGap?: number, yGap?: number, clip?: IBoundsData, smooth?: boolean, opacity?: number, filters?: IObject, interlace?: IInterlace): any;
2032
2098
  canUse(image: any): boolean;
2033
2099
  setPatternTransform(pattern: ICanvasPattern, transform?: IMatrixData, paint?: IObject): void;
2100
+ applyFilter?(canvas: any, image: any, filter: any[]): void;
2034
2101
  };
2035
2102
  canCreateImageBitmap?: boolean;
2036
2103
  canClipImageBitmap?: boolean;
@@ -2050,53 +2117,10 @@ interface IMiniapp {
2050
2117
  saveToAlbum(path: string): Promise<any>;
2051
2118
  }
2052
2119
 
2053
- interface ITaskProcessorConfig {
2054
- onComplete?: IFunction;
2055
- onTask?: IFunction;
2056
- onError?: IFunction;
2057
- parallel?: number;
2058
- }
2059
- interface ITaskProcessor {
2060
- config: ITaskProcessorConfig;
2061
- running: boolean;
2062
- isComplete: boolean;
2063
- percent: number;
2064
- total: number;
2065
- index: number;
2066
- finishedIndex: number;
2067
- remain: number;
2068
- start(): void;
2069
- pause(): void;
2070
- resume(): void;
2071
- skip(): void;
2072
- stop(): void;
2073
- add(taskCallback: IFunction, options?: ITaskOptions | number, canUse?: IFunction): ITaskItem;
2074
- destroy(): void;
2075
- }
2076
- interface ITaskItem {
2077
- parent: ITaskProcessor;
2078
- parallel: boolean;
2079
- isComplete: boolean;
2080
- isCancel: boolean;
2081
- time: number;
2082
- task?: IFunction;
2083
- canUse?: IFunction;
2084
- run(): Promise<void>;
2085
- complete(): void;
2086
- cancel(): void;
2087
- }
2088
- interface ITaskOptions {
2089
- start?: boolean;
2090
- time?: number;
2091
- parallel?: boolean;
2092
- delay?: number;
2093
- canUse?: IFunction;
2094
- }
2095
-
2096
2120
  interface ILeaferImageConfig {
2097
2121
  url: string;
2098
2122
  lod?: IImageLOD;
2099
- format?: IExportFileType;
2123
+ format?: IExportFileType | IFilmFileType | IVideoFileType;
2100
2124
  crossOrigin?: IImageCrossOrigin;
2101
2125
  showProgress?: boolean | string;
2102
2126
  view?: IObject | ILeaferImage | ILeaferCanvas;
@@ -2167,6 +2191,10 @@ interface ILeaferImage {
2167
2191
  error: IObject;
2168
2192
  loading: boolean;
2169
2193
  isPlacehold?: boolean;
2194
+ parent?: ILeaferImage;
2195
+ childrenMap?: ILeaferImageMap;
2196
+ filter?: any[];
2197
+ filterKey?: string;
2170
2198
  largeThumb?: ILeaferImageLevel;
2171
2199
  thumb?: ILeaferImageLevel;
2172
2200
  levels?: ILeaferImageLevel[];
@@ -2188,8 +2216,12 @@ interface ILeaferImage {
2188
2216
  getMinLevel(): number;
2189
2217
  getLevelData(level: number, width?: number, height?: number): ILeaferImageLevel;
2190
2218
  clearLevels(checkUse?: boolean): void;
2219
+ destroyFilter(): void;
2191
2220
  destroy(): void;
2192
2221
  }
2222
+ interface ILeaferImageMap {
2223
+ [name: string]: ILeaferImage;
2224
+ }
2193
2225
 
2194
2226
  interface IUIEvent extends IEvent {
2195
2227
  x: number;
@@ -2334,6 +2366,7 @@ interface IInteraction extends IControl {
2334
2366
  isFocus(leaf: ILeaf): boolean;
2335
2367
  cancelHover(): void;
2336
2368
  stopDragAnimate(): void;
2369
+ replaceDownTarget(target: ILeaf): void;
2337
2370
  updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void;
2338
2371
  updateHoverData(data: IPointerEvent): void;
2339
2372
  updateCursor(hoverData?: IPointerEvent): void;
@@ -2353,6 +2386,7 @@ interface IInteractionConfig {
2353
2386
  eventer?: IObject;
2354
2387
  cursor?: boolean;
2355
2388
  keyEvent?: boolean;
2389
+ shadowDOM?: boolean;
2356
2390
  }
2357
2391
  interface IZoomConfig {
2358
2392
  disabled?: boolean;
@@ -2464,6 +2498,10 @@ interface ILeaferAttrData {
2464
2498
  lazyBounds: IBounds;
2465
2499
  config: ILeaferConfig;
2466
2500
  userConfig?: ILeaferConfig;
2501
+ cacheId?: boolean;
2502
+ cacheInnerId?: boolean;
2503
+ innerIdMap?: ILeafMap;
2504
+ idMap?: ILeafMap;
2467
2505
  readonly cursorPoint: IPointData;
2468
2506
  readonly clientBounds: IBoundsData;
2469
2507
  leafs: number;
@@ -2526,7 +2564,7 @@ interface ICreator {
2526
2564
  layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter;
2527
2565
  renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer;
2528
2566
  selector?(target?: ILeaf, options?: ISelectorConfig): ISelector;
2529
- finder?(target?: ILeaf): IFinder;
2567
+ finder?(target?: ILeaf, options?: ISelectorConfig): IFinder;
2530
2568
  interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction;
2531
2569
  editor?(options?: IObject, app?: IAppBase): ILeaf;
2532
2570
  }
@@ -2607,4 +2645,4 @@ interface ITransformer {
2607
2645
  }
2608
2646
 
2609
2647
  export { PathNodeHandleType };
2610
- export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandNode, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, ClosePathCommandNode, 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, IBoundsDataWithOptionRotation, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasSizeAttr, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragBoundsType, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilmDecoder, IFilmFileType, IFilmFrame, IFilmOptions, IFilmPlayOptions, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IGestureType, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCrossOrigin, IImageCursor, IImageEvent, IImageLOD, IImageManager, IImageTileLOD, IInteraction, IInteractionCanvas, IInteractionConfig, IInterlace, IJSONOptions, IKeepTouchData, IKeyCodes, 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, ILeaferFilm, ILeaferFilmConfig, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageLevel, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferImageSlice, ILeaferImageSliceData, ILeaferMode, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferVideo, ILeaferVideoConfig, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, IMultimediaType, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionPointData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandNode, IPathCommandNodeBase, IPathCommandObject, IPathCreator, IPathDrawer, IPathNodeBase, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IResponseType, IRotateEvent, IRotationPointData, IScaleData, IScaleFixed, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, IShortcutKeyCodes, IShortcutKeys, IShortcutKeysCheck, ISide, ISingleGestureConfig, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITouchEvent, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IVideoFileType, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomOptions, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandNode, LineToCommandObject, MCommandData, MoveToCommandNode, MoveToCommandObject, PathNodeHandleName, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
2648
+ export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandNode, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, ClosePathCommandNode, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IArrowPathData, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsDataWithOptionRotation, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasSizeAttr, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragBoundsType, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilmDecoder, IFilmFileType, IFilmFrame, IFilmOptions, IFilmPlayOptions, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IGestureType, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCrossOrigin, IImageCursor, IImageEvent, IImageLOD, IImageManager, IImageTileLOD, IInteraction, IInteractionCanvas, IInteractionConfig, IInterlace, IJSONOptions, IKeepTouchData, IKeyCodes, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComplexCachedData, 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, ILeaferFilm, ILeaferFilmConfig, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageLevel, ILeaferImageMap, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferImageSlice, ILeaferImageSliceData, ILeaferMode, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferVideo, ILeaferVideoConfig, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, IMultimediaType, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionPointData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandNode, IPathCommandNodeBase, IPathCommandObject, IPathCreator, IPathDrawer, IPathNodeBase, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IResponseType, IRotateEvent, IRotationPointData, IScaleData, IScaleFixed, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, IShortcutKeyCodes, IShortcutKeys, IShortcutKeysCheck, ISide, ISingleGestureConfig, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITouchEvent, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IVideoFileType, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomOptions, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandNode, LineToCommandObject, MCommandData, MoveToCommandNode, MoveToCommandObject, PathNodeHandleName, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };