@leafer/interface 1.0.0-rc.6 → 1.0.0-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { IFunction as IFunction$1, IObject as IObject$1, IEvent as IEvent$1, ILeaferCanvas as ILeaferCanvas$1, IScreenSizeData as IScreenSizeData$1 } from '@leafer/interface';
1
+ import { ILeaferCanvas as ILeaferCanvas$1, IScreenSizeData as IScreenSizeData$1 } from '@leafer/interface';
2
2
 
3
- type __Number = number;
4
- type __Boolean = boolean;
5
- type __String = string;
6
- type __Object = IObject;
7
- type __Value = __Number | __Boolean | __String | __Object;
3
+ type INumber = number;
4
+ type IBoolean = boolean;
5
+ type IString = string;
6
+ type IValue = INumber | IBoolean | IString | IObject;
8
7
  type ITimer = any;
9
8
  type IPathString = string;
10
9
  interface IObject {
@@ -37,13 +36,14 @@ interface ILeafList {
37
36
  has(leaf: ILeaf): boolean;
38
37
  indexAt(index: number): ILeaf;
39
38
  indexOf(leaf: ILeaf): number;
40
- unshift(leaf: ILeaf): void;
41
- pushList(list: ILeaf[]): void;
42
- push(leaf: ILeaf): void;
43
- sort(reverse?: boolean): void;
39
+ add(leaf: ILeaf): void;
40
+ addAt(leaf: ILeaf, index: number): void;
41
+ addList(list: ILeaf[]): void;
44
42
  remove(leaf: ILeaf): void;
45
43
  forEach(itemCallback: ILeafListItemCallback): void;
44
+ sort(reverse?: boolean): void;
46
45
  clone(): ILeafList;
46
+ update(): void;
47
47
  reset(): void;
48
48
  destroy(): void;
49
49
  }
@@ -55,8 +55,8 @@ interface ILeafLevelList {
55
55
  has(leaf: ILeaf): boolean;
56
56
  without(leaf: ILeaf): boolean;
57
57
  sort(reverse?: boolean): void;
58
- pushList(list: ILeaf[]): void;
59
- push(leaf: ILeaf): void;
58
+ addList(list: ILeaf[]): void;
59
+ add(leaf: ILeaf): void;
60
60
  forEach(itemCallback: ILeafListItemCallback): void;
61
61
  reset(): void;
62
62
  destroy(): void;
@@ -94,17 +94,20 @@ interface IPointData {
94
94
  y: number;
95
95
  }
96
96
  interface IPoint extends IPointData {
97
- set(x?: number, y?: number): void;
98
- copy(point: IPointData): IPoint;
97
+ set(x?: number | IPointData, y?: number): IPoint;
98
+ get(): IPointData;
99
99
  clone(): IPoint;
100
- rotate(angle: number, center?: IPointData): IPoint;
100
+ rotate(rotation: number, origin?: IPointData): IPoint;
101
+ rotateOf(origin: IPointData, rotation: number): IPoint;
102
+ getRotation(origin: IPointData, to: IPointData, toOrigin?: IPointData): number;
101
103
  toInnerOf(matrix: IMatrixData, to?: IPointData): IPoint;
102
104
  toOuterOf(matrix: IMatrixData, to?: IPointData): IPoint;
103
- getCenter(to: IPointData): IPointData;
105
+ getCenter(to: IPointData): IPoint;
104
106
  getDistance(to: IPointData): number;
107
+ getDistancePoint(to: IPointData, distance: number): IPoint;
105
108
  getAngle(to: IPointData): number;
106
109
  getAtan2(to: IPointData): number;
107
- reset(): void;
110
+ reset(): IPoint;
108
111
  }
109
112
  interface IRadiusPointData extends IPointData {
110
113
  radiusX: number;
@@ -125,12 +128,12 @@ interface IOffsetBoundsData extends IBoundsData {
125
128
  offsetX: number;
126
129
  offsetY: number;
127
130
  }
128
- interface IBoundsDataHandle {
131
+ interface IBoundsDataFn {
129
132
  (target: any): IBoundsData;
130
133
  }
131
- interface IBounds extends IBoundsData {
132
- set(x?: number, y?: number, width?: number, height?: number): void;
133
- copy(bounds: IBoundsData): IBounds;
134
+ interface IBounds extends IBoundsData, ITwoPointBoundsData {
135
+ set(x?: number | IBoundsData, y?: number, width?: number, height?: number): IBounds;
136
+ get(): IBoundsData;
134
137
  clone(): IBounds;
135
138
  scale(scaleX: number, scaleY?: number): IBounds;
136
139
  scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds;
@@ -140,11 +143,12 @@ interface IBounds extends IBoundsData {
140
143
  ceil(): IBounds;
141
144
  unsign(): IBounds;
142
145
  add(bounds: IBoundsData): IBounds;
143
- addList(boundsList: IBounds[]): IBounds;
144
- setByList(boundsList: IBounds[], addMode?: boolean): IBounds;
145
- addListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle): IBounds;
146
- setByListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle, addMode: boolean): IBounds;
147
- setByPoints(points: IPointData[]): IBounds;
146
+ addList(boundsList: IBoundsData[]): IBounds;
147
+ setList(boundsList: IBoundsData[]): IBounds;
148
+ addListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
149
+ setListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
150
+ setPoints(points: IPointData[]): IBounds;
151
+ getPoints(): IPointData[];
148
152
  hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean;
149
153
  hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean;
150
154
  hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean;
@@ -161,11 +165,6 @@ interface ITwoPointBoundsData {
161
165
  maxX: number;
162
166
  maxY: number;
163
167
  }
164
- interface ITwoPointBounds extends ITwoPointBoundsData {
165
- addPoint(x: number, y: number): void;
166
- addBounds(x: number, y: number, width: number, height: number): void;
167
- add(pointBounds: ITwoPointBoundsData): void;
168
- }
169
168
  interface IAutoBoundsData {
170
169
  top?: number;
171
170
  right?: number;
@@ -187,19 +186,25 @@ interface IMatrixData {
187
186
  e: number;
188
187
  f: number;
189
188
  }
190
- interface IMatrixDecompositionData {
191
- x: number;
192
- y: number;
189
+ interface IScaleData {
193
190
  scaleX: number;
194
191
  scaleY: number;
192
+ }
193
+ interface IScaleRotationData extends IScaleData {
195
194
  rotation: number;
195
+ }
196
+ interface ISkewData {
196
197
  skewX: number;
197
198
  skewY: number;
198
199
  }
199
- type IMatrixDecompositionAttr = 'x' | 'y' | 'scaleX' | 'scaleY' | 'rotation' | 'skewX' | 'skewY';
200
+ interface ILayoutData extends IScaleRotationData, ISkewData, IPointData {
201
+ }
202
+ type ILayoutAttr = 'x' | 'y' | 'scaleX' | 'scaleY' | 'rotation' | 'skewX' | 'skewY';
203
+ interface ILayoutBoundsData extends ILayoutData, IBoundsData {
204
+ }
200
205
  interface IMatrix extends IMatrixData {
201
- set(a: number, b: number, c: number, d: number, e: number, f: number): void;
202
- copy(matrix: IMatrixData): IMatrix;
206
+ set(a: number | IMatrixData, b: number, c: number, d: number, e: number, f: number): IMatrix;
207
+ get(): IMatrixData;
203
208
  clone(): IMatrix;
204
209
  translate(x: number, y: number): IMatrix;
205
210
  translateInner(x: number, y: number): IMatrix;
@@ -212,18 +217,22 @@ interface IMatrix extends IMatrixData {
212
217
  skew(x: number, y?: number): IMatrix;
213
218
  skewOfOuter(origin: IPointData, x: number, y?: number): IMatrix;
214
219
  skewOfInner(origin: IPointData, x: number, y?: number): IMatrix;
215
- multiply(matrix: IMatrixData): IMatrix;
216
- divide(matrix: IMatrixData): IMatrix;
217
- preMultiply(matrix: IMatrixData): IMatrix;
220
+ multiply(child: IMatrixData): IMatrix;
221
+ multiplyParent(parent: IMatrixData): IMatrix;
222
+ divide(child: IMatrixData): IMatrix;
223
+ divideParent(parent: IMatrixData): IMatrix;
218
224
  invert(): IMatrix;
219
225
  toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void;
220
226
  toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void;
221
- decompose(): IMatrixDecompositionData;
227
+ setLayout(data: ILayoutData, origin?: IPointData): IMatrix;
228
+ getLayout(origin?: IPointData, firstSkewY?: boolean): ILayoutData;
222
229
  reset(): void;
223
230
  }
224
231
  interface IMatrixWithBoundsData extends IMatrixData, IBoundsData {
225
232
  }
226
- interface IMatrixWithLayoutData extends IMatrixData, IMatrixDecompositionData, IBoundsData {
233
+ interface IMatrixWithScaleData extends IMatrixData, IScaleData {
234
+ }
235
+ interface IMatrixWithLayoutData extends IMatrixData, ILayoutBoundsData {
227
236
  }
228
237
 
229
238
  interface ILayoutChangedData {
@@ -251,6 +260,7 @@ interface ILayouterConfig {
251
260
  interface ILayouter extends IControl {
252
261
  target: ILeaf;
253
262
  layoutedBlocks: ILayoutBlockData[];
263
+ extraBlock: ILayoutBlockData;
254
264
  totalTimes: number;
255
265
  times: number;
256
266
  disabled: boolean;
@@ -264,6 +274,7 @@ interface ILayouter extends IControl {
264
274
  layoutOnce(): void;
265
275
  partLayout(): void;
266
276
  fullLayout(): void;
277
+ addExtra(leaf: ILeaf): void;
267
278
  createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData;
268
279
  getBlocks(list: ILeafList): ILayoutBlockData[];
269
280
  addBlocks(current: ILayoutBlockData[]): void;
@@ -344,7 +355,23 @@ interface ILeafEventer {
344
355
  hasEvent?(type: string, capture?: boolean): boolean;
345
356
  }
346
357
 
347
- type IEventListener = IFunction$1;
358
+ interface IFunction {
359
+ (...arg: any): any;
360
+ }
361
+ interface INumberFunction {
362
+ (...arg: any): number;
363
+ }
364
+ interface IPointDataFunction {
365
+ (...arg: any): IPointData;
366
+ }
367
+ interface IAttrDecorator {
368
+ (...arg: any): IAttrDecoratorInner;
369
+ }
370
+ interface IAttrDecoratorInner {
371
+ (target: any, key: string): any;
372
+ }
373
+
374
+ type IEventListener = IFunction;
348
375
  interface IEventListenerOptions {
349
376
  capture?: boolean;
350
377
  once?: boolean;
@@ -357,6 +384,7 @@ interface IEventListenerMap {
357
384
  }
358
385
  interface IEventListenerId {
359
386
  type: string | string[];
387
+ current: ILeaf;
360
388
  listener: IEventListener;
361
389
  options?: IEventListenerOptions | boolean;
362
390
  }
@@ -367,11 +395,11 @@ interface IEventer extends ILeafEventer {
367
395
  __bubbleMap?: IEventListenerMap;
368
396
  on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
369
397
  off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
370
- on_(type: string | string[], listener: IEventListener, bind?: IObject$1, options?: IEventListenerOptions | boolean): IEventListenerId;
398
+ on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
371
399
  off_(id: IEventListenerId | IEventListenerId[]): void;
372
400
  once(type: string | string[], listener: IEventListener): void;
373
- emit(type: string, event?: IEvent$1 | IObject$1, capture?: boolean): void;
374
- emitEvent(event?: IEvent$1, capture?: boolean): void;
401
+ emit(type: string, event?: IEvent | IObject, capture?: boolean): void;
402
+ emitEvent(event?: IEvent, capture?: boolean): void;
375
403
  hasEvent(type: string, capture?: boolean): boolean;
376
404
  destroy(): void;
377
405
  }
@@ -844,7 +872,7 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
844
872
  updateClientBounds(): void;
845
873
  setCursor(cursor: ICursorType | ICursorType[]): void;
846
874
  isSameSize(options: ILeaferCanvasConfig): boolean;
847
- getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas;
875
+ getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas;
848
876
  getBiggerCanvas(addWidth: number, addHeight: number): ILeaferCanvas;
849
877
  recycle(): void;
850
878
  updateRender(): void;
@@ -858,16 +886,6 @@ interface IBlobFunction {
858
886
  }
859
887
  type IBlob = any;
860
888
 
861
- interface IFunction {
862
- (...arg: any): any;
863
- }
864
- interface INumberFunction {
865
- (...arg: any): number;
866
- }
867
- interface IPointDataFunction {
868
- (...arg: any): IPointData;
869
- }
870
-
871
889
  interface IRenderOptions {
872
890
  includes?: boolean;
873
891
  bounds?: IBounds;
@@ -908,10 +926,10 @@ interface IRenderer extends IControl {
908
926
 
909
927
  type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
910
928
  interface ILeafDataProxy {
911
- __setAttr?(name: string, newValue: __Value): void;
912
- __getAttr?(name: string): __Value;
913
- setProxyAttr?(name: string, newValue: __Value): void;
914
- getProxyAttr?(name: string): __Value;
929
+ __setAttr?(name: string, newValue: IValue): void;
930
+ __getAttr?(name: string): IValue;
931
+ setProxyAttr?(name: string, newValue: IValue): void;
932
+ getProxyAttr?(name: string): IValue;
915
933
  }
916
934
 
917
935
  type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>;
@@ -923,20 +941,22 @@ interface ILeafMatrix {
923
941
  type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>;
924
942
  interface ILeafBounds {
925
943
  __updateWorldBounds?(): void;
944
+ __updateLocalBounds?(): void;
926
945
  __updateLocalBoxBounds?(): void;
927
946
  __updateLocalStrokeBounds?(): void;
928
947
  __updateLocalRenderBounds?(): void;
929
948
  __updateBoxBounds?(): void;
930
949
  __updateStrokeBounds?(): void;
931
950
  __updateRenderBounds?(): void;
951
+ __updateAutoLayout?(): void;
932
952
  __updateNaturalSize?(): void;
933
953
  __updateStrokeSpread?(): number;
934
954
  __updateRenderSpread?(): number;
935
955
  __onUpdateSize?(): void;
936
956
  }
937
957
 
938
- type ILayoutLocationType = 'world' | 'local' | 'inner';
939
- type ILayoutBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
958
+ type ILocationType = 'world' | 'local' | 'inner';
959
+ type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
940
960
  interface ILeafLayout {
941
961
  leaf: ILeaf;
942
962
  proxyZoom: boolean;
@@ -945,8 +965,10 @@ interface ILeafLayout {
945
965
  renderBounds: IBoundsData;
946
966
  marginBounds: IBoundsData;
947
967
  contentBounds: IBoundsData;
948
- localStrokeBounds: IBoundsData;
949
- localRenderBounds: IBoundsData;
968
+ localStrokeBounds?: IBoundsData;
969
+ localRenderBounds?: IBoundsData;
970
+ resized: boolean;
971
+ waitAutoLayout: boolean;
950
972
  matrixChanged: boolean;
951
973
  scaleChanged: boolean;
952
974
  rotationChanged: boolean;
@@ -966,9 +988,17 @@ interface ILeafLayout {
966
988
  renderSpread: number;
967
989
  strokeBoxSpread: number;
968
990
  renderShapeSpread: number;
969
- checkUpdate(force?: boolean): void;
970
- getTransform(locationType: ILayoutLocationType): IMatrixData;
971
- getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData;
991
+ a: number;
992
+ b: number;
993
+ c: number;
994
+ d: number;
995
+ e: number;
996
+ f: number;
997
+ update(): void;
998
+ getTransform(relative?: ILocationType | ILeaf): IMatrixData;
999
+ getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
1000
+ getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
1001
+ getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
972
1002
  spreadStroke(): void;
973
1003
  spreadRender(): void;
974
1004
  spreadStrokeCancel(): void;
@@ -1012,17 +1042,18 @@ interface ILeafMask {
1012
1042
  __removeMask?(child?: ILeaf): void;
1013
1043
  }
1014
1044
 
1015
- interface IDataProcessor extends IObject {
1045
+ interface IDataProcessor {
1016
1046
  __leaf: ILeaf;
1017
1047
  __input: IObject;
1018
1048
  __middle: IObject;
1019
1049
  __single: boolean;
1020
1050
  __checkSingle(): void;
1021
1051
  __get(name: string): any;
1052
+ __getData(): IObject;
1022
1053
  __setInput(name: string, value: any): void;
1023
1054
  __getInput(name: string): any;
1024
1055
  __removeInput(name: string): void;
1025
- __getInputData(options?: ILeafDataOptions): IObject;
1056
+ __getInputData(): IObject;
1026
1057
  __setMiddle(name: string, value: any): void;
1027
1058
  __getMiddle(name: string): any;
1028
1059
  destroy(): void;
@@ -1047,12 +1078,21 @@ interface ISelectPathOptions {
1047
1078
  }
1048
1079
  interface ISelectorConfig {
1049
1080
  }
1081
+ declare enum AnswerType {
1082
+ No = 0,
1083
+ Yes = 1,
1084
+ NoAndSkip = 2,
1085
+ YesAndSkip = 3
1086
+ }
1050
1087
  interface IFindMethod {
1051
- (leaf: ILeaf, options?: any): any;
1088
+ (leaf: ILeaf, options?: any): AnswerType;
1089
+ }
1090
+ interface ISelectorProxy {
1091
+ list: ILeaf[];
1052
1092
  }
1053
1093
  interface ISelector {
1054
1094
  target: ILeaf;
1055
- list: ILeafList;
1095
+ proxy?: ISelectorProxy;
1056
1096
  config: ISelectorConfig;
1057
1097
  getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
1058
1098
  getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
@@ -1070,81 +1110,88 @@ interface ICachedLeaf {
1070
1110
  bounds: IBoundsData;
1071
1111
  }
1072
1112
  interface ILeafAttrData {
1073
- id: __String;
1074
- name: __String;
1075
- className: __String;
1113
+ id: IString;
1114
+ name: IString;
1115
+ className: IString;
1076
1116
  blendMode: IBlendMode;
1077
- opacity: __Number;
1078
- visible: __Boolean;
1079
- isMask: __Boolean;
1080
- isEraser: __Boolean;
1081
- zIndex: __Number;
1082
- x: __Number;
1083
- y: __Number;
1084
- width: __Number;
1085
- height: __Number;
1086
- scaleX: __Number;
1087
- scaleY: __Number;
1088
- rotation: __Number;
1089
- skewX: __Number;
1090
- skewY: __Number;
1091
- scale: __Number | IPointData;
1092
- around: 'center' | IPointData;
1093
- draggable: __Boolean;
1094
- hittable: __Boolean;
1117
+ opacity: INumber;
1118
+ visible: IBoolean;
1119
+ isMask: IBoolean;
1120
+ isEraser: IBoolean;
1121
+ locked: IBoolean;
1122
+ zIndex: INumber;
1123
+ x: INumber;
1124
+ y: INumber;
1125
+ width: INumber;
1126
+ height: INumber;
1127
+ scaleX: INumber;
1128
+ scaleY: INumber;
1129
+ rotation: INumber;
1130
+ skewX: INumber;
1131
+ skewY: INumber;
1132
+ scale: INumber | IPointData;
1133
+ around: IAround;
1134
+ draggable: IBoolean;
1135
+ editable: IBoolean;
1136
+ editSize?: IEditSize;
1137
+ hittable: IBoolean;
1095
1138
  hitFill: IHitType;
1096
1139
  hitStroke: IHitType;
1097
- hitBox: __Boolean;
1098
- hitChildren: __Boolean;
1099
- hitSelf: __Boolean;
1100
- hitRadius: __Number;
1140
+ hitBox: IBoolean;
1141
+ hitChildren: IBoolean;
1142
+ hitSelf: IBoolean;
1143
+ hitRadius: INumber;
1101
1144
  cursor: ICursorType | ICursorType[];
1102
1145
  }
1103
1146
  type IHitType = 'path' | 'pixel' | 'all' | 'none';
1104
1147
  type IBlendMode = 'pass-through' | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'xor';
1105
- type IResizeType = 'size' | 'scale';
1148
+ type IEditSize = 'size' | 'scale';
1106
1149
  interface IImageCursor {
1107
1150
  url: string;
1108
1151
  x?: number;
1109
1152
  y?: number;
1110
1153
  }
1111
- type IAround = 'center' | IPointData;
1154
+ type IAround = 'topLeft' | 'top' | 'topRight' | 'right' | 'bottomRight' | 'bottom' | 'bottomLeft' | 'left' | 'center' | IPointData;
1112
1155
  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';
1113
1156
  interface ICursorTypeMap {
1114
1157
  [name: string]: ICursorType | ICursorType[];
1115
1158
  }
1116
- interface ILeafInputData extends IObject {
1159
+ interface ILeafInputData {
1117
1160
  tag?: string;
1118
- id?: __String;
1119
- name?: __String;
1120
- className?: __String;
1161
+ id?: IString;
1162
+ name?: IString;
1163
+ className?: IString;
1121
1164
  blendMode?: IBlendMode;
1122
- opacity?: __Number;
1123
- visible?: __Boolean;
1124
- isMask?: __Boolean;
1125
- isEraser?: __Boolean;
1126
- zIndex?: __Number;
1127
- x?: __Number;
1128
- y?: __Number;
1129
- width?: __Number;
1130
- height?: __Number;
1131
- scaleX?: __Number;
1132
- scaleY?: __Number;
1133
- rotation?: __Number;
1134
- skewX?: __Number;
1135
- skewY?: __Number;
1136
- scale?: __Number | IPointData;
1165
+ opacity?: INumber;
1166
+ visible?: IBoolean;
1167
+ isMask?: IBoolean;
1168
+ isEraser?: IBoolean;
1169
+ locked?: IBoolean;
1170
+ zIndex?: INumber;
1171
+ x?: INumber;
1172
+ y?: INumber;
1173
+ width?: INumber;
1174
+ height?: INumber;
1175
+ scaleX?: INumber;
1176
+ scaleY?: INumber;
1177
+ rotation?: INumber;
1178
+ skewX?: INumber;
1179
+ skewY?: INumber;
1180
+ scale?: INumber | IPointData;
1137
1181
  around?: IAround;
1138
- draggable?: __Boolean;
1139
- hittable?: __Boolean;
1182
+ draggable?: IBoolean;
1183
+ editable?: IBoolean;
1184
+ editSize?: IEditSize;
1185
+ hittable?: IBoolean;
1140
1186
  hitFill?: IHitType;
1141
1187
  hitStroke?: IHitType;
1142
- hitBox?: __Boolean;
1143
- hitChildren?: __Boolean;
1144
- hitSelf?: __Boolean;
1145
- hitRadius?: __Number;
1188
+ hitBox?: IBoolean;
1189
+ hitChildren?: IBoolean;
1190
+ hitSelf?: IBoolean;
1191
+ hitRadius?: INumber;
1146
1192
  cursor?: ICursorType | ICursorType[];
1147
1193
  children?: ILeafInputData[];
1194
+ noBounds?: boolean;
1148
1195
  }
1149
1196
  interface ILeafComputedData {
1150
1197
  id?: string;
@@ -1155,6 +1202,7 @@ interface ILeafComputedData {
1155
1202
  visible?: boolean;
1156
1203
  isMask?: boolean;
1157
1204
  isEraser?: boolean;
1205
+ locked?: boolean;
1158
1206
  zIndex?: number;
1159
1207
  x?: number;
1160
1208
  y?: number;
@@ -1167,6 +1215,8 @@ interface ILeafComputedData {
1167
1215
  skewY?: number;
1168
1216
  around?: IAround;
1169
1217
  draggable?: boolean;
1218
+ editable?: boolean;
1219
+ editSize?: IEditSize;
1170
1220
  hittable?: boolean;
1171
1221
  hitFill?: IHitType;
1172
1222
  hitStroke?: IHitType;
@@ -1186,7 +1236,8 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1186
1236
  readonly innerName: string;
1187
1237
  readonly __DataProcessor: IObject;
1188
1238
  readonly __LayoutProcessor: IObject;
1189
- leafer?: ILeafer;
1239
+ readonly app?: ILeaferBase;
1240
+ leafer?: ILeaferBase;
1190
1241
  parent?: ILeaf;
1191
1242
  readonly isApp?: boolean;
1192
1243
  isLeafer?: boolean;
@@ -1194,9 +1245,12 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1194
1245
  isBranchLeaf?: boolean;
1195
1246
  __: ILeafData;
1196
1247
  proxyData?: ILeafInputData;
1248
+ __proxyData?: ILeafInputData;
1197
1249
  __layout: ILeafLayout;
1198
1250
  __world: IMatrixWithLayoutData;
1199
- __local: IMatrixWithBoundsData;
1251
+ __local?: IMatrixWithBoundsData;
1252
+ readonly __localMatrix: IMatrixData;
1253
+ readonly __localBounds: IBoundsData;
1200
1254
  __worldOpacity: number;
1201
1255
  readonly worldTransform: IMatrixWithLayoutData;
1202
1256
  readonly localTransform: IMatrixWithBoundsData;
@@ -1207,8 +1261,8 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1207
1261
  readonly worldOpacity: number;
1208
1262
  __level: number;
1209
1263
  __tempNumber?: number;
1210
- readonly resizeable: boolean;
1211
- readonly __hasMirror: boolean;
1264
+ readonly __worldFlipped: boolean;
1265
+ __hasAutoLayout?: boolean;
1212
1266
  __hasMask?: boolean;
1213
1267
  __hasEraser?: boolean;
1214
1268
  __hitCanvas?: IHitCanvas;
@@ -1222,27 +1276,30 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1222
1276
  waitParent(item: IFunction): void;
1223
1277
  waitLeafer(item: IFunction): void;
1224
1278
  nextRender(item: IFunction): void;
1225
- __bindLeafer(leafer: ILeafer | null): void;
1279
+ __bindLeafer(leafer: ILeaferBase | null): void;
1226
1280
  set(data: IObject): void;
1227
- get(options?: ILeafDataOptions): ILeafInputData;
1281
+ get(): ILeafInputData;
1228
1282
  toJSON(): IObject;
1229
1283
  toString(): string;
1230
- __setAttr(attrName: string, newValue: __Value): void;
1231
- __getAttr(attrName: string): __Value;
1232
- setProxyAttr(name: string, newValue: __Value): void;
1233
- getProxyAttr(name: string): __Value;
1234
- find(condition: number | string | IFindMethod): ILeaf[];
1235
- findOne(condition: number | string | IFindMethod): ILeaf;
1284
+ __setAttr(attrName: string, newValue: IValue): void;
1285
+ __getAttr(attrName: string): IValue;
1286
+ setProxyAttr(name: string, newValue: IValue): void;
1287
+ getProxyAttr(name: string): IValue;
1288
+ find(condition: number | string | IFindMethod, options?: any): ILeaf[];
1289
+ findOne(condition: number | string | IFindMethod, options?: any): ILeaf;
1236
1290
  forceUpdate(attrName?: string): void;
1291
+ updateLayout(): void;
1237
1292
  __updateWorldMatrix(): void;
1238
1293
  __updateLocalMatrix(): void;
1239
1294
  __updateWorldBounds(): void;
1295
+ __updateLocalBounds(): void;
1240
1296
  __updateLocalBoxBounds(): void;
1241
1297
  __updateLocalStrokeBounds(): void;
1242
1298
  __updateLocalRenderBounds(): void;
1243
1299
  __updateBoxBounds(): void;
1244
1300
  __updateStrokeBounds(): void;
1245
1301
  __updateRenderBounds(): void;
1302
+ __updateAutoLayout(): void;
1246
1303
  __updateNaturalSize(): void;
1247
1304
  __updateStrokeSpread(): number;
1248
1305
  __updateRenderSpread(): number;
@@ -1251,8 +1308,9 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1251
1308
  __updateMask(value?: boolean): void;
1252
1309
  __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
1253
1310
  __removeMask(child?: ILeaf): void;
1254
- getWorld(attrName: IMatrixDecompositionAttr): number;
1255
- getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData;
1311
+ getWorld(attrName: ILayoutAttr): number;
1312
+ getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
1313
+ getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
1256
1314
  worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1257
1315
  localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1258
1316
  worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
@@ -1263,10 +1321,14 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1263
1321
  getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1264
1322
  getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1265
1323
  getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1324
+ setTransform(transform?: IMatrixData, resize?: boolean): void;
1325
+ transform(transform?: IMatrixData, resize?: boolean): void;
1266
1326
  move(x: number, y?: number): void;
1267
- scaleOf(origin: IPointData, x: number, y?: number): void;
1327
+ scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
1268
1328
  rotateOf(origin: IPointData, rotation: number): void;
1269
- skewOf(origin: IPointData, x: number, y: number): void;
1329
+ skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
1330
+ scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
1331
+ __scaleResize(scaleX: number, scaleY: number): void;
1270
1332
  __hitWorld(point: IRadiusPointData): boolean;
1271
1333
  __hit(local: IRadiusPointData): boolean;
1272
1334
  __drawHitPath(canvas: ILeaferCanvas): void;
@@ -1285,6 +1347,7 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1285
1347
  __updateSortChildren(): void;
1286
1348
  add(child: ILeaf, index?: number): void;
1287
1349
  remove(child?: ILeaf, destroy?: boolean): void;
1350
+ dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
1288
1351
  }
1289
1352
 
1290
1353
  type IExportImageType = 'jpg' | 'png' | 'webp';
@@ -1389,6 +1452,7 @@ interface IInteraction extends IControl {
1389
1452
  selector: ISelector;
1390
1453
  running: boolean;
1391
1454
  readonly dragging: boolean;
1455
+ readonly isDragEmpty: boolean;
1392
1456
  readonly moveMode: boolean;
1393
1457
  config: IInteractionConfig;
1394
1458
  cursor: ICursorType | ICursorType[];
@@ -1432,6 +1496,7 @@ interface IZoomConfig {
1432
1496
  }
1433
1497
  interface IMoveConfig {
1434
1498
  holdSpaceKey?: boolean;
1499
+ drag?: boolean;
1435
1500
  dragEmpty?: boolean;
1436
1501
  dragOut?: boolean;
1437
1502
  autoDistance?: number;
@@ -1486,15 +1551,14 @@ interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteracti
1486
1551
  type?: ILeaferType;
1487
1552
  realCanvas?: boolean;
1488
1553
  }
1489
- interface ILeafer extends IZoomView, IControl {
1490
- readonly isApp: boolean;
1491
- readonly app: ILeafer;
1492
- parent?: IApp;
1554
+ interface ILeaferAttrData {
1493
1555
  running: boolean;
1494
1556
  created: boolean;
1495
1557
  ready: boolean;
1496
1558
  viewReady: boolean;
1559
+ imageReady: boolean;
1497
1560
  viewCompleted: boolean;
1561
+ layoutLocked: boolean;
1498
1562
  pixelRatio: number;
1499
1563
  view: unknown;
1500
1564
  canvas: ILeaferCanvas;
@@ -1511,7 +1575,11 @@ interface ILeafer extends IZoomView, IControl {
1511
1575
  leafs: number;
1512
1576
  __eventIds: IEventListenerId[];
1513
1577
  __nextRenderWait: IFunction[];
1514
- init(userConfig?: ILeaferConfig, parentApp?: IApp): void;
1578
+ init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void;
1579
+ start(): void;
1580
+ stop(): void;
1581
+ unlockLayout(): void;
1582
+ lockLayout(): void;
1515
1583
  setZoomLayer(zoomLayer: ILeaf): void;
1516
1584
  forceFullRender(): void;
1517
1585
  updateCursor(): void;
@@ -1520,13 +1588,18 @@ interface ILeafer extends IZoomView, IControl {
1520
1588
  waitViewReady(item: IFunction): void;
1521
1589
  waitViewCompleted(item: IFunction): void;
1522
1590
  }
1591
+ interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
1592
+ readonly isApp: boolean;
1593
+ readonly app: ILeaferBase;
1594
+ parent?: IAppBase;
1595
+ }
1523
1596
  interface ILeaferTypeCreator {
1524
1597
  list: ILeaferTypeList;
1525
1598
  register(name: string, fn: ILeaferTypeFunction): void;
1526
- run(name: string, leafer: ILeafer): void;
1599
+ run(name: string, leafer: ILeaferBase): void;
1527
1600
  }
1528
1601
  interface ILeaferTypeFunction {
1529
- (leafer: ILeafer): void;
1602
+ (leafer: ILeaferBase): void;
1530
1603
  }
1531
1604
  interface ILeaferTypeList {
1532
1605
  [key: string]: ILeaferTypeFunction;
@@ -1540,14 +1613,15 @@ interface ICreator {
1540
1613
  renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer;
1541
1614
  selector?(target: ILeaf, options?: ISelectorConfig): ISelector;
1542
1615
  interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction;
1616
+ editor?(options?: IObject): ILeaf;
1543
1617
  }
1544
1618
  interface IUICreator {
1545
1619
  register(UI: IObject): void;
1546
1620
  get(tag: string, data: IObject): IObject;
1547
1621
  }
1548
1622
 
1549
- interface IApp extends ILeafer {
1550
- children: ILeafer[];
1623
+ interface IAppBase extends ILeaferBase {
1624
+ children: ILeaferBase[];
1551
1625
  realCanvas: boolean;
1552
1626
  }
1553
1627
 
@@ -1657,7 +1731,6 @@ interface IPlatform {
1657
1731
  fullImageShadow?: boolean;
1658
1732
  syncDomFont?: boolean;
1659
1733
  layout?(target: ILeaf): void;
1660
- realtimeLayout?: boolean;
1661
1734
  origin?: {
1662
1735
  createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
1663
1736
  canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
@@ -1674,7 +1747,11 @@ interface IPlatform {
1674
1747
  stop(origin: IObject): void;
1675
1748
  };
1676
1749
  miniapp?: IMiniapp;
1677
- imageSuffix?: string;
1750
+ image: {
1751
+ maxCacheSize: number;
1752
+ maxPatternSize: number;
1753
+ suffix: string;
1754
+ };
1678
1755
  }
1679
1756
  interface IMiniappSelect extends IObject {
1680
1757
  }
@@ -1695,7 +1772,7 @@ interface IPlugin extends IObject {
1695
1772
  importVersion: string;
1696
1773
  import: string[];
1697
1774
  run(LeaferUI: IObject, config: IObject): void;
1698
- onLeafer?(leafer: ILeafer): void;
1775
+ onLeafer?(leafer: ILeaferBase): void;
1699
1776
  }
1700
1777
 
1701
- export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IApp, IAround, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBooleanMap, IBounds, IBoundsData, IBoundsDataHandle, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasContext2D, ICanvasManager, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IFindMethod, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutBlockData, ILayoutBoundsType, ILayoutChangedData, ILayoutEvent, ILayoutLocationType, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMask, ILeafMaskModule, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeafer, ILeaferCanvas, ILeaferCanvasConfig, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, IMatrix, IMatrixData, IMatrixDecompositionAttr, IMatrixDecompositionData, IMatrixWithBoundsData, IMatrixWithLayoutData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResizeType, IRotateEvent, IScreenSizeData, ISelectPathOptions, ISelectPathResult, ISelector, ISelectorConfig, ISize, ISizeData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBounds, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData, __Boolean, __Number, __Object, __String, __Value };
1778
+ export { type ACommandData, AnswerType, type ArcCommandData, type ArcToCommandData, type CCommandData, type CanvasPathCommand, type EllipseCommandData, type HCommandData, type IAnimateEvent, type IAppBase, type IAround, type IAttrDecorator, type IAutoBounds, type IAutoBoundsData, type IBlendMode, type IBlob, type IBlobFunction, type IBoolean, type IBooleanMap, type IBounds, type IBoundsData, type IBoundsDataFn, type IBoundsType, type IBranch, type IBranchRender, type IBranchRenderModule, type ICachedLeaf, type ICanvasAttr, type ICanvasContext2D, type ICanvasManager, type ICanvasStrokeOptions, type ICanvasType, type IChildEvent, type IControl, type ICreator, type ICursorType, type ICursorTypeMap, type IDataProcessor, type IDataTypeHandle, type IDragEvent, type IDropEvent, type IEditSize, type IEvent, type IEventListener, type IEventListenerId, type IEventListenerItem, type IEventListenerMap, type IEventListenerOptions, type IEventTarget, type IEventer, type IExportFileType, type IExportImageType, type IFindMethod, type IFunction, type IHitCanvas, type IHitCanvasConfig, type IHitCanvasManager, type IHitType, type IImageEvent, type IImageManager, type IInteraction, type IInteractionCanvas, type IInteractionConfig, type IKeepTouchData, type IKeyEvent, type ILayoutAttr, type ILayoutBlockData, type ILayoutBoundsData, type ILayoutChangedData, type ILayoutData, type ILayoutEvent, type ILayouter, type ILayouterConfig, type ILeaf, type ILeafArrayMap, type ILeafAttrData, type ILeafBounds, type ILeafBoundsModule, type ILeafComputedData, type ILeafData, type ILeafDataOptions, type ILeafDataProxy, type ILeafDataProxyModule, type ILeafEventer, type ILeafEventerModule, type ILeafHit, type ILeafHitModule, type ILeafInputData, type ILeafLayout, type ILeafLevelList, type ILeafList, type ILeafListItemCallback, type ILeafMap, type ILeafMask, type ILeafMaskModule, type ILeafMatrix, type ILeafMatrixModule, type ILeafRender, type ILeafRenderModule, type ILeaferAttrData, type ILeaferBase, type ILeaferCanvas, type ILeaferCanvasConfig, type ILeaferConfig, type ILeaferEvent, type ILeaferImage, type ILeaferImageConfig, type ILeaferImageOnError, type ILeaferImageOnLoaded, type ILeaferType, type ILeaferTypeCreator, type ILeaferTypeFunction, type ILeaferTypeList, type ILocationType, type IMatrix, type IMatrixData, type IMatrixWithBoundsData, type IMatrixWithLayoutData, type IMatrixWithScaleData, type IMiniapp, type IMiniappSelect, type IMiniappSizeView, type IMoveEvent, type IMultiTouchData, type INumber, type INumberMap, type IObject, type IOffsetBoundsData, type IPartLayoutConfig, type IPath2D, type IPathCommandData, type IPathCreator, type IPathDrawer, type IPathString, type IPlatform, type IPlugin, type IPoint, type IPointData, type IPointerConfig, type IPointerEvent, type IPropertyEvent, type IRadiusPointData, type IRenderEvent, type IRenderOptions, type IRenderer, type IRendererConfig, type IResizeEvent, type IResizeEventListener, type IRotateEvent, type IScaleData, type IScaleRotationData, type IScreenSizeData, type ISelectPathOptions, type ISelectPathResult, type ISelector, type ISelectorConfig, type ISelectorProxy, type ISize, type ISizeData, type ISkewData, type ISkiaCanvas, type ISkiaCanvasExportConfig, type ISkiaNAPICanvas, type IString, type IStringMap, type ISwipeEvent, type ITaskItem, type ITaskOptions, type ITaskProcessor, type ITaskProcessorConfig, type ITextMetrics, type ITimer, type ITwoPointBoundsData, type IUICreator, type IUIEvent, type IUpdateEvent, type IValue, type IWatchEvent, type IWatchEventData, type IWatcher, type IWatcherConfig, type IWheelConfig, type IWindingRule, type IZoomEvent, type IZoomView, type InnerId, type LCommandData, type MCommandData, type PointerType, type QCommandData, type RectCommandData, type RoundRectCommandData, type SCommandData, type TCommandData, type VCommandData, type ZCommandData };