@leafer/interface 1.0.0-rc.16 → 1.0.0-rc.18

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.0.0-rc.16",
3
+ "version": "1.0.0-rc.18",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@ import { IAutoBounds, IBoundsData, IPointData, IScreenSizeData } from '../math/I
9
9
  import { ICanvasManager } from '../canvas/ICanvasManager'
10
10
  import { IHitCanvasManager } from '../canvas/IHitCanvasManager'
11
11
  import { IEventListenerId } from '../event/IEventer'
12
- import { IObject } from '../data/IData'
12
+ import { IFourNumber, IObject } from '../data/IData'
13
13
  import { IZoomView } from '../display/IView'
14
14
  import { IAppBase } from './IApp'
15
15
  import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
@@ -67,17 +67,21 @@ export interface ILeaferAttrData {
67
67
  unlockLayout(): void
68
68
  lockLayout(): void
69
69
 
70
- setZoomLayer(zoomLayer: ILeaf): void
71
70
  forceFullRender(): void
72
71
  forceRender(bounds?: IBoundsData): void
73
72
  updateCursor(cursor?: ICursorType): void
74
73
  resize(size: IScreenSizeData): void
75
74
 
76
- waitReady(item: IFunction): void
77
- waitViewReady(item: IFunction): void
78
- waitViewCompleted(item: IFunction): void
75
+ waitReady(item: IFunction, bind?: IObject): void
76
+ waitViewReady(item: IFunction, bind?: IObject): void
77
+ waitViewCompleted(item: IFunction, bind?: IObject): void
78
+
79
+ zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData
80
+ validScale(changeScale: number): number
79
81
  }
80
82
 
83
+ export type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData
84
+
81
85
  export interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
82
86
  readonly isApp: boolean
83
87
  readonly app: ILeaferBase
package/src/data/IData.ts CHANGED
@@ -6,6 +6,8 @@ export type ITimer = any
6
6
 
7
7
  export type IPathString = string
8
8
 
9
+ export type IFourNumber = number | number[]
10
+
9
11
  export interface IObject {
10
12
  [name: string]: any
11
13
  }
@@ -12,7 +12,7 @@ export interface IDataProcessor {
12
12
  __setInput(name: string, value: any): void
13
13
  __getInput(name: string): any
14
14
  __removeInput(name: string): void
15
- __getInputData(): IObject
15
+ __getInputData(names?: string[] | IObject): IObject
16
16
 
17
17
  __setMiddle(name: string, value: any): void
18
18
  __getMiddle(name: string): any
@@ -36,6 +36,8 @@ export interface ILeafAttrData {
36
36
  blendMode: IBlendMode
37
37
  opacity: INumber
38
38
  visible: IBoolean
39
+ selected: IBoolean
40
+ disabled: IBoolean
39
41
  locked: IBoolean
40
42
  zIndex: INumber
41
43
 
@@ -66,7 +68,7 @@ export interface ILeafAttrData {
66
68
  windingRule: IWindingRule
67
69
 
68
70
  editable: IBoolean
69
- editSize?: IEditSize
71
+ editSize: IEditSize
70
72
 
71
73
  hittable: IBoolean
72
74
  hitFill: IHitType
@@ -77,6 +79,13 @@ export interface ILeafAttrData {
77
79
  hitRadius: INumber
78
80
 
79
81
  cursor: ICursorType | ICursorType[]
82
+
83
+ normalStyle: ILeafInputData // restore hover / press / focus / selected / disabled style
84
+ hoverStyle: ILeafInputData
85
+ pressStyle: ILeafInputData
86
+ focusStyle: ILeafInputData
87
+ selectedStyle: ILeafInputData
88
+ disabledStyle: ILeafInputData
80
89
  }
81
90
 
82
91
  export type IHitType =
@@ -178,6 +187,12 @@ export type ICursorType =
178
187
  | 'zoom-in'
179
188
  | 'zoom-out'
180
189
 
190
+ export type IStateStyleType =
191
+ | 'hoverStyle'
192
+ | 'pressStyle'
193
+ | 'focusStyle'
194
+ | 'selectedStyle'
195
+ | 'disabledStyle'
181
196
 
182
197
  export interface ILeafInputData {
183
198
  tag?: string
@@ -190,6 +205,8 @@ export interface ILeafInputData {
190
205
  blendMode?: IBlendMode
191
206
  opacity?: INumber
192
207
  visible?: IBoolean
208
+ selected?: IBoolean
209
+ disabled?: IBoolean
193
210
  locked?: IBoolean
194
211
  zIndex?: INumber
195
212
 
@@ -232,6 +249,13 @@ export interface ILeafInputData {
232
249
 
233
250
  cursor?: ICursorType | ICursorType[]
234
251
 
252
+ normalStyle?: ILeafInputData
253
+ hoverStyle?: ILeafInputData
254
+ pressStyle?: ILeafInputData
255
+ focusStyle?: ILeafInputData
256
+ selectedStyle?: ILeafInputData
257
+ disabledStyle?: ILeafInputData
258
+
235
259
  children?: ILeafInputData[]
236
260
 
237
261
  // other
@@ -246,6 +270,8 @@ export interface ILeafComputedData {
246
270
  blendMode?: IBlendMode
247
271
  opacity?: number
248
272
  visible?: boolean
273
+ selected?: boolean
274
+ disabled?: boolean
249
275
  locked?: boolean
250
276
  zIndex?: number
251
277
 
@@ -287,6 +313,13 @@ export interface ILeafComputedData {
287
313
 
288
314
  cursor?: ICursorType | ICursorType[]
289
315
 
316
+ normalStyle?: ILeafInputData
317
+ hoverStyle?: ILeafInputData
318
+ pressStyle?: ILeafInputData
319
+ focusStyle?: ILeafInputData
320
+ selectedStyle?: ILeafInputData
321
+ disabledStyle?: ILeafInputData
322
+
290
323
  // other
291
324
  __childBranchNumber?: number // 存在子分支的个数
292
325
  __complex?: boolean // 外观是否复杂
@@ -313,6 +346,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
313
346
  readonly app?: ILeaferBase
314
347
  leafer?: ILeaferBase
315
348
  parent?: ILeaf
349
+ zoomLayer?: ILeaf
316
350
 
317
351
  readonly isApp?: boolean
318
352
  readonly isLeafer?: boolean
@@ -372,14 +406,15 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
372
406
  reset(data?: ILeafInputData): void
373
407
  resetCustom(): void
374
408
 
375
- waitParent(item: IFunction): void
376
- waitLeafer(item: IFunction): void
377
- nextRender(item: IFunction, off?: 'off'): void
409
+ waitParent(item: IFunction, bind?: IObject): void
410
+ waitLeafer(item: IFunction, bind?: IObject): void
411
+ nextRender(item: IFunction, bind?: IObject, off?: 'off'): void
412
+ removeNextRender(item: IFunction): void
378
413
 
379
414
  __bindLeafer(leafer: ILeaferBase | null): void
380
415
 
381
416
  set(data: IObject): void
382
- get(name?: string): ILeafInputData | IValue
417
+ get(name?: string | string[] | IObject): ILeafInputData | IValue
383
418
  toJSON(): IObject
384
419
  toString(): string
385
420
  toSVG?(): string
@@ -395,6 +430,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
395
430
  find(condition: number | string | IFindMethod, options?: any): ILeaf[]
396
431
  findOne(condition: number | string | IFindMethod, options?: any): ILeaf
397
432
 
433
+ focus(value?: boolean): void
398
434
  forceUpdate(attrName?: string): void
399
435
 
400
436
  updateLayout(): void
@@ -432,9 +468,13 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
432
468
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
433
469
 
434
470
  getWorld(attrName: ILayoutAttr): number // will remove
471
+ getTransform(relative?: ILocationType | ILeaf): IMatrixData
472
+
435
473
  getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
436
474
  getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
437
475
 
476
+ getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData
477
+
438
478
  worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
439
479
  localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
440
480
  worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
@@ -459,6 +499,12 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
459
499
  rotateOf(origin: IPointData, rotation: number): void
460
500
  skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
461
501
 
502
+ transformWorld(worldTransform?: IMatrixData, resize?: boolean): void
503
+ moveWorld(x: number, y?: number): void
504
+ scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
505
+ rotateOfWorld(worldOrigin: IPointData, rotation: number): void
506
+ skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
507
+
462
508
  scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
463
509
  __scaleResize(scaleX: number, scaleY: number): void
464
510
 
@@ -487,6 +533,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
487
533
  __updatePath(): void
488
534
  __updateRenderPath(): void
489
535
 
536
+ //
537
+
490
538
  // branch
491
539
  children?: ILeaf[]
492
540
 
@@ -1,7 +1,6 @@
1
1
  import { IBranch } from './IBranch'
2
- import { ILeaf } from './ILeaf'
2
+
3
3
 
4
4
  export interface IZoomView extends IBranch {
5
- zoomLayer?: ILeaf
6
- setZoomLayer(zoomLayer: ILeaf): void
5
+
7
6
  }
@@ -1,4 +1,5 @@
1
1
  import { IBlob, ILeaferCanvas } from '../canvas/ILeaferCanvas'
2
+ import { ILeaf } from '../display/ILeaf'
2
3
  import { ILocationType } from '../layout/ILeafLayout'
3
4
  import { IBoundsData } from '../math/IMath'
4
5
 
@@ -12,7 +13,7 @@ export interface IExportOptions {
12
13
  trim?: boolean
13
14
  fill?: string
14
15
  screenshot?: IBoundsData | boolean
15
- location?: ILocationType
16
+ relative?: ILocationType | ILeaf
16
17
  onCanvas?: IExportOnCanvasFunction
17
18
  }
18
19
 
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { IAppBase } from './app/IApp'
2
- export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
3
- export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IMaskType, IBlendMode, IEditSize, IImageCursor, ICursorType, IAround } from './display/ILeaf'
2
+ export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType } from './app/ILeafer'
3
+ export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IMaskType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IAround } from './display/ILeaf'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
@@ -50,7 +50,7 @@ export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/I
50
50
  export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
51
51
 
52
52
 
53
- export { INumber, IBoolean, IString, IValue, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
53
+ export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
54
54
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
55
55
  export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
56
56
  export { IFunction, IAttrDecorator } from './function/IFunction'
@@ -31,6 +31,7 @@ export interface IInteraction extends IControl {
31
31
  downData: IPointerEvent
32
32
  hoverData: IPointerEvent
33
33
  downTime: number
34
+ focusData: ILeaf
34
35
 
35
36
  receive(event: any): void
36
37
 
@@ -50,7 +51,13 @@ export interface IInteraction extends IControl {
50
51
  keyUp(data: IKeyEvent): void
51
52
 
52
53
  findPath(data: IPointerEvent, options?: IPickOptions): ILeafList
54
+
53
55
  isDrag(leaf: ILeaf): boolean
56
+ isPress(leaf: ILeaf): boolean
57
+ isHover(leaf: ILeaf): boolean
58
+ isFocus(leaf: ILeaf): boolean
59
+
60
+ cancelHover(): void
54
61
 
55
62
  updateDownData(data?: IPointerEvent, options?: IPickOptions): void
56
63
  updateHoverData(data: IPointerEvent): void
@@ -83,7 +90,9 @@ export interface IMoveConfig {
83
90
  holdSpaceKey?: boolean
84
91
  holdMiddleKey?: boolean
85
92
  holdRightKey?: boolean
93
+ scroll?: boolean
86
94
  drag?: boolean
95
+ dragAnimate?: boolean
87
96
  dragEmpty?: boolean
88
97
  dragOut?: boolean
89
98
  autoDistance?: number
@@ -1,7 +1,7 @@
1
1
  import { IBoundsData, IMatrixData, ILayoutBoundsData, IPointData } from '../math/IMath'
2
2
  import { ILeaf } from '../display/ILeaf'
3
3
 
4
- export type ILocationType = 'world' | 'local' | 'inner'
4
+ export type ILocationType = 'world' | 'page' | 'local' | 'inner'
5
5
  export type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render'
6
6
 
7
7
  export interface ILeafLayout {
package/src/math/IMath.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IObject } from '../data/IData'
1
+ import { IFourNumber, IObject } from '../data/IData'
2
2
 
3
3
  export interface IPointData {
4
4
  x: number
@@ -70,7 +70,8 @@ export interface IBounds extends IBoundsData, ITwoPointBoundsData {
70
70
  toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds
71
71
  getFitMatrix(put: IBoundsData): IMatrix
72
72
 
73
- spread(spreadX: number, spreadY?: number): IBounds
73
+ spread(fourNumber: IFourNumber, spreadY?: number): IBounds
74
+ shrink(fourNumber: IFourNumber): IBounds
74
75
  ceil(): IBounds
75
76
  unsign(): IBounds
76
77
  float(maxLength?: number): IBounds
@@ -28,9 +28,9 @@ export interface IPathCreator {
28
28
  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): IPathCreator
29
29
  closePath(): IPathCreator
30
30
 
31
- arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
31
+ arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
32
32
  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPathCreator
33
- ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
33
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
34
34
 
35
35
  rect(x: number, y: number, width: number, height: number): IPathCreator
36
36
  roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator
@@ -32,6 +32,7 @@ export interface IRenderer extends IControl {
32
32
 
33
33
  waitAgain: boolean
34
34
  changed: boolean
35
+ ignore: boolean
35
36
 
36
37
  config: IRendererConfig
37
38
 
package/types/index.d.ts CHANGED
@@ -6,6 +6,7 @@ type IString = string;
6
6
  type IValue = INumber | IBoolean | IString | IObject;
7
7
  type ITimer = any;
8
8
  type IPathString = string;
9
+ type IFourNumber = number | number[];
9
10
  interface IObject {
10
11
  [name: string]: any;
11
12
  }
@@ -144,7 +145,8 @@ interface IBounds extends IBoundsData, ITwoPointBoundsData {
144
145
  toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
145
146
  toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
146
147
  getFitMatrix(put: IBoundsData): IMatrix;
147
- spread(spreadX: number, spreadY?: number): IBounds;
148
+ spread(fourNumber: IFourNumber, spreadY?: number): IBounds;
149
+ shrink(fourNumber: IFourNumber): IBounds;
148
150
  ceil(): IBounds;
149
151
  unsign(): IBounds;
150
152
  float(maxLength?: number): IBounds;
@@ -746,9 +748,9 @@ interface IPathCreator {
746
748
  bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): IPathCreator;
747
749
  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): IPathCreator;
748
750
  closePath(): IPathCreator;
749
- arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator;
751
+ arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator;
750
752
  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPathCreator;
751
- ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator;
753
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator;
752
754
  rect(x: number, y: number, width: number, height: number): IPathCreator;
753
755
  roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator;
754
756
  drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator;
@@ -768,7 +770,7 @@ interface ICanvasManager {
768
770
  type IExportImageType = 'jpg' | 'png' | 'webp';
769
771
  type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
770
772
 
771
- type ILocationType = 'world' | 'local' | 'inner';
773
+ type ILocationType = 'world' | 'page' | 'local' | 'inner';
772
774
  type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
773
775
  interface ILeafLayout {
774
776
  leaf: ILeaf;
@@ -843,7 +845,7 @@ interface IExportOptions {
843
845
  trim?: boolean;
844
846
  fill?: string;
845
847
  screenshot?: IBoundsData | boolean;
846
- location?: ILocationType;
848
+ relative?: ILocationType | ILeaf;
847
849
  onCanvas?: IExportOnCanvasFunction;
848
850
  }
849
851
  interface IExportResult {
@@ -1023,6 +1025,7 @@ interface IRenderer extends IControl {
1023
1025
  rendering: boolean;
1024
1026
  waitAgain: boolean;
1025
1027
  changed: boolean;
1028
+ ignore: boolean;
1026
1029
  config: IRendererConfig;
1027
1030
  update(): void;
1028
1031
  requestLayout(): void;
@@ -1099,7 +1102,7 @@ interface IDataProcessor {
1099
1102
  __setInput(name: string, value: any): void;
1100
1103
  __getInput(name: string): any;
1101
1104
  __removeInput(name: string): void;
1102
- __getInputData(): IObject;
1105
+ __getInputData(names?: string[] | IObject): IObject;
1103
1106
  __setMiddle(name: string, value: any): void;
1104
1107
  __getMiddle(name: string): any;
1105
1108
  destroy(): void;
@@ -1171,6 +1174,8 @@ interface ILeafAttrData {
1171
1174
  blendMode: IBlendMode;
1172
1175
  opacity: INumber;
1173
1176
  visible: IBoolean;
1177
+ selected: IBoolean;
1178
+ disabled: IBoolean;
1174
1179
  locked: IBoolean;
1175
1180
  zIndex: INumber;
1176
1181
  mask: IBoolean;
@@ -1193,7 +1198,7 @@ interface ILeafAttrData {
1193
1198
  path: IPathCommandData | IPathString;
1194
1199
  windingRule: IWindingRule;
1195
1200
  editable: IBoolean;
1196
- editSize?: IEditSize;
1201
+ editSize: IEditSize;
1197
1202
  hittable: IBoolean;
1198
1203
  hitFill: IHitType;
1199
1204
  hitStroke: IHitType;
@@ -1202,6 +1207,12 @@ interface ILeafAttrData {
1202
1207
  hitSelf: IBoolean;
1203
1208
  hitRadius: INumber;
1204
1209
  cursor: ICursorType | ICursorType[];
1210
+ normalStyle: ILeafInputData;
1211
+ hoverStyle: ILeafInputData;
1212
+ pressStyle: ILeafInputData;
1213
+ focusStyle: ILeafInputData;
1214
+ selectedStyle: ILeafInputData;
1215
+ disabledStyle: ILeafInputData;
1205
1216
  }
1206
1217
  type IHitType = 'path' | 'pixel' | 'all' | 'none';
1207
1218
  type IMaskType = 'path' | 'pixel' | 'clipping';
@@ -1215,6 +1226,7 @@ interface IImageCursor {
1215
1226
  }
1216
1227
  type IAround = 'topLeft' | 'top' | 'topRight' | 'right' | 'bottomRight' | 'bottom' | 'bottomLeft' | 'left' | 'center' | IPointData;
1217
1228
  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';
1229
+ type IStateStyleType = 'hoverStyle' | 'pressStyle' | 'focusStyle' | 'selectedStyle' | 'disabledStyle';
1218
1230
  interface ILeafInputData {
1219
1231
  tag?: string;
1220
1232
  id?: IString;
@@ -1223,6 +1235,8 @@ interface ILeafInputData {
1223
1235
  blendMode?: IBlendMode;
1224
1236
  opacity?: INumber;
1225
1237
  visible?: IBoolean;
1238
+ selected?: IBoolean;
1239
+ disabled?: IBoolean;
1226
1240
  locked?: IBoolean;
1227
1241
  zIndex?: INumber;
1228
1242
  mask?: IBoolean;
@@ -1254,6 +1268,12 @@ interface ILeafInputData {
1254
1268
  hitSelf?: IBoolean;
1255
1269
  hitRadius?: INumber;
1256
1270
  cursor?: ICursorType | ICursorType[];
1271
+ normalStyle?: ILeafInputData;
1272
+ hoverStyle?: ILeafInputData;
1273
+ pressStyle?: ILeafInputData;
1274
+ focusStyle?: ILeafInputData;
1275
+ selectedStyle?: ILeafInputData;
1276
+ disabledStyle?: ILeafInputData;
1257
1277
  children?: ILeafInputData[];
1258
1278
  noBounds?: boolean;
1259
1279
  }
@@ -1264,6 +1284,8 @@ interface ILeafComputedData {
1264
1284
  blendMode?: IBlendMode;
1265
1285
  opacity?: number;
1266
1286
  visible?: boolean;
1287
+ selected?: boolean;
1288
+ disabled?: boolean;
1267
1289
  locked?: boolean;
1268
1290
  zIndex?: number;
1269
1291
  mask?: boolean;
@@ -1294,6 +1316,12 @@ interface ILeafComputedData {
1294
1316
  hitSelf?: boolean;
1295
1317
  hitRadius?: number;
1296
1318
  cursor?: ICursorType | ICursorType[];
1319
+ normalStyle?: ILeafInputData;
1320
+ hoverStyle?: ILeafInputData;
1321
+ pressStyle?: ILeafInputData;
1322
+ focusStyle?: ILeafInputData;
1323
+ selectedStyle?: ILeafInputData;
1324
+ disabledStyle?: ILeafInputData;
1297
1325
  __childBranchNumber?: number;
1298
1326
  __complex?: boolean;
1299
1327
  __naturalWidth?: number;
@@ -1314,6 +1342,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1314
1342
  readonly app?: ILeaferBase;
1315
1343
  leafer?: ILeaferBase;
1316
1344
  parent?: ILeaf;
1345
+ zoomLayer?: ILeaf;
1317
1346
  readonly isApp?: boolean;
1318
1347
  readonly isLeafer?: boolean;
1319
1348
  readonly isBranch?: boolean;
@@ -1353,12 +1382,13 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1353
1382
  destroyed: boolean;
1354
1383
  reset(data?: ILeafInputData): void;
1355
1384
  resetCustom(): void;
1356
- waitParent(item: IFunction): void;
1357
- waitLeafer(item: IFunction): void;
1358
- nextRender(item: IFunction, off?: 'off'): void;
1385
+ waitParent(item: IFunction, bind?: IObject): void;
1386
+ waitLeafer(item: IFunction, bind?: IObject): void;
1387
+ nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
1388
+ removeNextRender(item: IFunction): void;
1359
1389
  __bindLeafer(leafer: ILeaferBase | null): void;
1360
1390
  set(data: IObject): void;
1361
- get(name?: string): ILeafInputData | IValue;
1391
+ get(name?: string | string[] | IObject): ILeafInputData | IValue;
1362
1392
  toJSON(): IObject;
1363
1393
  toString(): string;
1364
1394
  toSVG?(): string;
@@ -1369,6 +1399,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1369
1399
  getProxyAttr(name: string): IValue;
1370
1400
  find(condition: number | string | IFindMethod, options?: any): ILeaf[];
1371
1401
  findOne(condition: number | string | IFindMethod, options?: any): ILeaf;
1402
+ focus(value?: boolean): void;
1372
1403
  forceUpdate(attrName?: string): void;
1373
1404
  updateLayout(): void;
1374
1405
  __updateWorldMatrix(): void;
@@ -1391,8 +1422,10 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1391
1422
  __renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void;
1392
1423
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
1393
1424
  getWorld(attrName: ILayoutAttr): number;
1425
+ getTransform(relative?: ILocationType | ILeaf): IMatrixData;
1394
1426
  getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
1395
1427
  getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
1428
+ getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData;
1396
1429
  worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1397
1430
  localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1398
1431
  worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
@@ -1411,6 +1444,11 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1411
1444
  scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
1412
1445
  rotateOf(origin: IPointData, rotation: number): void;
1413
1446
  skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
1447
+ transformWorld(worldTransform?: IMatrixData, resize?: boolean): void;
1448
+ moveWorld(x: number, y?: number): void;
1449
+ scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
1450
+ rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
1451
+ skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
1414
1452
  scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
1415
1453
  __scaleResize(scaleX: number, scaleY: number): void;
1416
1454
  __hitWorld(point: IRadiusPointData): boolean;
@@ -1558,6 +1596,7 @@ interface IInteraction extends IControl {
1558
1596
  downData: IPointerEvent;
1559
1597
  hoverData: IPointerEvent;
1560
1598
  downTime: number;
1599
+ focusData: ILeaf;
1561
1600
  receive(event: any): void;
1562
1601
  pointerDown(data?: IPointerEvent, defaultPath?: boolean): void;
1563
1602
  pointerMove(data?: IPointerEvent): void;
@@ -1572,6 +1611,10 @@ interface IInteraction extends IControl {
1572
1611
  keyUp(data: IKeyEvent): void;
1573
1612
  findPath(data: IPointerEvent, options?: IPickOptions): ILeafList;
1574
1613
  isDrag(leaf: ILeaf): boolean;
1614
+ isPress(leaf: ILeaf): boolean;
1615
+ isHover(leaf: ILeaf): boolean;
1616
+ isFocus(leaf: ILeaf): boolean;
1617
+ cancelHover(): void;
1575
1618
  updateDownData(data?: IPointerEvent, options?: IPickOptions): void;
1576
1619
  updateHoverData(data: IPointerEvent): void;
1577
1620
  updateCursor(hoverData?: IPointerEvent): void;
@@ -1596,7 +1639,9 @@ interface IMoveConfig {
1596
1639
  holdSpaceKey?: boolean;
1597
1640
  holdMiddleKey?: boolean;
1598
1641
  holdRightKey?: boolean;
1642
+ scroll?: boolean;
1599
1643
  drag?: boolean;
1644
+ dragAnimate?: boolean;
1600
1645
  dragEmpty?: boolean;
1601
1646
  dragOut?: boolean;
1602
1647
  autoDistance?: number;
@@ -1635,8 +1680,6 @@ interface IHitCanvasManager extends ICanvasManager {
1635
1680
  }
1636
1681
 
1637
1682
  interface IZoomView extends IBranch {
1638
- zoomLayer?: ILeaf;
1639
- setZoomLayer(zoomLayer: ILeaf): void;
1640
1683
  }
1641
1684
 
1642
1685
  type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart';
@@ -1674,15 +1717,17 @@ interface ILeaferAttrData {
1674
1717
  stop(): void;
1675
1718
  unlockLayout(): void;
1676
1719
  lockLayout(): void;
1677
- setZoomLayer(zoomLayer: ILeaf): void;
1678
1720
  forceFullRender(): void;
1679
1721
  forceRender(bounds?: IBoundsData): void;
1680
1722
  updateCursor(cursor?: ICursorType): void;
1681
1723
  resize(size: IScreenSizeData): void;
1682
- waitReady(item: IFunction): void;
1683
- waitViewReady(item: IFunction): void;
1684
- waitViewCompleted(item: IFunction): void;
1724
+ waitReady(item: IFunction, bind?: IObject): void;
1725
+ waitViewReady(item: IFunction, bind?: IObject): void;
1726
+ waitViewCompleted(item: IFunction, bind?: IObject): void;
1727
+ zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData;
1728
+ validScale(changeScale: number): number;
1685
1729
  }
1730
+ type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData;
1686
1731
  interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
1687
1732
  readonly isApp: boolean;
1688
1733
  readonly app: ILeaferBase;
@@ -1883,4 +1928,4 @@ interface ICursorRotateMap {
1883
1928
  [name: string]: ICursorRotate;
1884
1929
  }
1885
1930
 
1886
- export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEditSize, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindMethod, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, 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, IMoveEvent, IMultiTouchData, INumber, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IString, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
1931
+ export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEditSize, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindMethod, IFourNumber, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, 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, IMoveEvent, IMultiTouchData, INumber, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };