@leafer/interface 1.0.0-rc.3 → 1.0.0-rc.30

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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/app/IApp.ts +3 -3
  3. package/src/app/ILeafer.ts +46 -21
  4. package/src/canvas/ICanvas.ts +7 -2
  5. package/src/canvas/IHitCanvasManager.ts +3 -3
  6. package/src/canvas/ILeaferCanvas.ts +23 -11
  7. package/src/canvas/ISkiaCanvas.ts +20 -1
  8. package/src/data/IData.ts +12 -5
  9. package/src/data/ILeafData.ts +12 -6
  10. package/src/data/IList.ts +9 -6
  11. package/src/display/IBranch.ts +2 -1
  12. package/src/display/ILeaf.ts +452 -108
  13. package/src/display/IView.ts +2 -6
  14. package/src/display/module/IBranchRender.ts +2 -2
  15. package/src/display/module/ILeafBounds.ts +3 -0
  16. package/src/display/module/ILeafDataProxy.ts +5 -3
  17. package/src/display/module/ILeafEventer.ts +1 -1
  18. package/src/display/module/ILeafHit.ts +4 -1
  19. package/src/display/module/ILeafRender.ts +2 -1
  20. package/src/event/IEvent.ts +3 -23
  21. package/src/event/IEventer.ts +7 -2
  22. package/src/event/IUIEvent.ts +14 -9
  23. package/src/file/IExport.ts +41 -0
  24. package/src/file/IFileType.ts +1 -1
  25. package/src/function/IFunction.ts +18 -0
  26. package/src/image/IImageManager.ts +4 -0
  27. package/src/image/ILeaferImage.ts +13 -0
  28. package/src/index.ts +16 -15
  29. package/src/interaction/ICursor.ts +16 -0
  30. package/src/interaction/IInteraction.ts +40 -5
  31. package/src/layout/ILeafLayout.ts +41 -18
  32. package/src/layouter/ILayouter.ts +3 -0
  33. package/src/math/IMath.ts +98 -37
  34. package/src/path/IPathDrawer.ts +6 -3
  35. package/src/platform/IPlatform.ts +22 -4
  36. package/src/plugin/IPlugin.ts +2 -2
  37. package/src/renderer/IRenderer.ts +4 -2
  38. package/src/selector/ISelector.ts +38 -9
  39. package/types/index.d.ts +884 -418
  40. package/src/display/module/ILeafMask.ts +0 -12
@@ -1,21 +1,24 @@
1
- import { ILeafer } from '../app/ILeafer'
1
+ import { ILeaferBase } from '../app/ILeafer'
2
2
  import { IEventer } from '../event/IEventer'
3
3
 
4
4
  import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
5
5
  import { IRenderOptions } from '../renderer/IRenderer'
6
6
 
7
- import { IObject, __Number, __Boolean, __Value, __String } from '../data/IData'
8
- import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, IMatrixDecompositionAttr, IMatrixWithLayoutData } from '../math/IMath'
7
+ import { IObject, INumber, IBoolean, IValue, IString, IPathString, IFourNumber } from '../data/IData'
8
+ import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAutoBoxData, IUnitPointData } from '../math/IMath'
9
9
  import { IFunction } from '../function/IFunction'
10
10
 
11
11
  import { ILeafDataProxy } from './module/ILeafDataProxy'
12
12
  import { ILeafMatrix } from './module/ILeafMatrix'
13
13
  import { ILeafBounds } from './module/ILeafBounds'
14
- import { ILeafLayout, ILayoutBoundsType, ILayoutLocationType } from '../layout/ILeafLayout'
14
+ import { ILeafLayout, IBoundsType, ILocationType } from '../layout/ILeafLayout'
15
15
  import { ILeafHit } from './module/ILeafHit'
16
16
  import { ILeafRender } from './module/ILeafRender'
17
- import { ILeafMask } from './module/ILeafMask'
18
17
  import { ILeafData } from '../data/ILeafData'
18
+ import { IFindMethod } from '../selector/ISelector'
19
+ import { IPathCommandData } from '../path/IPathCommand'
20
+ import { IWindingRule, IPath2D } from '../canvas/ICanvas'
21
+ import { IJSONOptions } from '../file/IExport'
19
22
 
20
23
 
21
24
  export interface ICachedLeaf {
@@ -27,49 +30,150 @@ export interface ICachedLeaf {
27
30
 
28
31
  export interface ILeafAttrData {
29
32
  // layer data
30
- id: __String
31
- name: __String
32
- className: __String
33
+ id?: IString
34
+ name?: IString
35
+ className?: IString
33
36
 
34
- blendMode: IBlendMode
35
- opacity: __Number
36
- visible: __Boolean
37
- isMask: __Boolean
38
- isEraser: __Boolean
39
- zIndex: __Number
37
+ blendMode?: IBlendMode
38
+ opacity?: INumber
39
+ visible?: IBoolean | 0 // 0 = display: none
40
+ selected?: IBoolean
41
+ disabled?: IBoolean
42
+ locked?: IBoolean
43
+ zIndex?: INumber
44
+
45
+ mask?: IBoolean | IMaskType
46
+ eraser?: IBoolean | IEraserType
40
47
 
41
48
  // layout data
42
- x: __Number
43
- y: __Number
44
- width: __Number
45
- height: __Number
46
- scaleX: __Number
47
- scaleY: __Number
48
- rotation: __Number
49
- skewX: __Number
50
- skewY: __Number
51
-
52
- scale: __Number | IPointData // helper
53
- around: 'center' | IPointData
54
-
55
- draggable: __Boolean
56
-
57
- hittable: __Boolean
58
- hitFill: IHitType
59
- hitStroke: IHitType
60
- hitChildren: __Boolean
61
- hitSelf: __Boolean
62
- hitRadius: __Number
63
-
64
- cursor: ICursorType | ICursorType[]
49
+ x?: INumber
50
+ y?: INumber
51
+ width?: INumber
52
+ height?: INumber
53
+ scaleX?: INumber
54
+ scaleY?: INumber
55
+ rotation?: INumber
56
+ skewX?: INumber
57
+ skewY?: INumber
58
+
59
+ scale?: INumber | IPointData // helper
60
+
61
+ offsetX?: INumber
62
+ offsetY?: INumber
63
+ scrollX?: INumber
64
+ scrollY?: INumber
65
+
66
+ origin?: IAlign | IUnitPointData
67
+ around?: IAlign | IUnitPointData
68
+
69
+ lazy?: IBoolean
70
+ pixelRatio?: INumber
71
+
72
+ path?: IPathCommandData | IPathString
73
+ windingRule?: IWindingRule
74
+ closed?: IBoolean
75
+
76
+ // auto layout
77
+ flow?: IFlowType
78
+ padding?: IFourNumber
79
+ gap?: IGap | IPointGap
80
+ flowAlign?: IFlowAlign | IFlowAxisAlign
81
+ flowWrap?: IFlowWrap
82
+ itemBox?: IFlowBoxType
83
+
84
+ inFlow?: IBoolean
85
+ autoWidth?: IAutoSize
86
+ autoHeight?: IAutoSize
87
+ lockRatio?: IBoolean
88
+ autoBox?: IAutoBoxData | IConstraint
89
+
90
+ widthRange?: IRangeSize
91
+ heightRange?: IRangeSize
92
+
93
+ // interactive
94
+ draggable?: IBoolean | IAxis
95
+ dragBounds?: IBoundsData | 'parent'
96
+
97
+ editable?: IBoolean
98
+
99
+ hittable?: IBoolean
100
+ hitFill?: IHitType
101
+ hitStroke?: IHitType
102
+ hitBox?: IBoolean
103
+ hitChildren?: IBoolean
104
+ hitSelf?: IBoolean
105
+ hitRadius?: INumber
106
+
107
+ cursor?: ICursorType | ICursorType[]
108
+
109
+ normalStyle?: ILeafInputData // restore hover / press / focus / selected / disabled style
110
+ hoverStyle?: ILeafInputData
111
+ pressStyle?: ILeafInputData
112
+ focusStyle?: ILeafInputData
113
+ selectedStyle?: ILeafInputData
114
+ disabledStyle?: ILeafInputData
115
+
116
+ // 预留给用户使用的数据对象
117
+ data: IObject
118
+ }
119
+
120
+
121
+ export type IAxis = 'x' | 'y'
122
+
123
+ export type IAxisReverse = 'x-reverse' | 'y-reverse'
124
+
125
+ export type IFlowType = boolean | IAxis | IAxisReverse
126
+
127
+ export type IFlowBoxType = 'box' | 'stroke'
128
+
129
+ export type IGap = INumber | 'auto' | 'fit'
130
+
131
+ export interface IPointGap { x?: IGap, y?: IGap }
132
+
133
+ export type IAxisAlign = 'from' | 'center' | 'to'
134
+
135
+ export interface IFlowAxisAlign { content?: IFlowAlign, x?: IAxisAlign, y?: IAxisAlign }
136
+
137
+ export type IFlowWrap = boolean | 'reverse'
138
+
139
+ export type IAutoSize = IBoolean | INumber | IPercentData
140
+
141
+ export interface IRangeSize {
142
+ min?: number
143
+ max?: number
144
+ }
145
+
146
+ export interface IUnitData {
147
+ type: 'percent' | 'px'
148
+ value: number
65
149
  }
66
150
 
151
+ export interface IPercentData extends IUnitData {
152
+ type: 'percent'
153
+ }
154
+
155
+ export interface IConstraint {
156
+ x: IConstraintType
157
+ y: IConstraintType
158
+ }
159
+
160
+ export type IConstraintType = 'from' | 'center' | 'to' | 'from-to' | 'scale'
161
+
67
162
  export type IHitType =
68
163
  | 'path'
69
164
  | 'pixel'
70
165
  | 'all'
71
166
  | 'none'
72
167
 
168
+ export type IMaskType =
169
+ | 'path'
170
+ | 'pixel'
171
+ | 'clipping'
172
+
173
+ export type IEraserType =
174
+ | 'path'
175
+ | 'pixel'
176
+
73
177
  export type IBlendMode =
74
178
  | 'pass-through'
75
179
  | 'normal'
@@ -96,18 +200,46 @@ export type IBlendMode =
96
200
  | 'destination-in'
97
201
  | 'destination-out'
98
202
  | 'destination-atop'
203
+ | 'xor'
99
204
 
100
- export type IResizeType = 'size' | 'scale'
205
+ export type IEditSize = 'size' | 'font-size' | 'scale'
101
206
  export interface IImageCursor {
102
207
  url: string
103
208
  x?: number
104
209
  y?: number
210
+ rotation?: number
105
211
  }
106
212
 
107
- export type IAround = 'center' | IPointData
213
+ export type IDirection =
214
+ | 'top-left'
215
+ | 'top'
216
+ | 'top-right'
217
+ | 'right'
218
+ | 'bottom-right'
219
+ | 'bottom'
220
+ | 'bottom-left'
221
+ | 'left'
222
+ | 'center'
223
+
224
+ export type IAlign = IDirection
225
+
226
+ export type IBaseLineAlign =
227
+ | 'baseline-left'
228
+ | 'baseline-center'
229
+ | 'baseline-right'
230
+
231
+ export type IFlowAlign =
232
+ | IAlign
233
+ | IBaseLineAlign
234
+
235
+
236
+ export type IAround =
237
+ | IAlign
238
+ | IUnitPointData
108
239
 
109
240
  export type ICursorType =
110
241
  | IImageCursor
242
+ | ''
111
243
  | 'auto'
112
244
  | 'default'
113
245
  | 'none'
@@ -142,53 +274,110 @@ export type ICursorType =
142
274
  | 'col-resize'
143
275
  | 'row-resize'
144
276
  | 'all-scroll'
145
- | 'zoom -in'
277
+ | 'zoom-in'
146
278
  | 'zoom-out'
147
279
 
148
- export interface ICursorTypeMap {
149
- [name: string]: ICursorType | ICursorType[]
150
- }
151
- export interface ILeafInputData extends IObject {
280
+ export type IStateStyleType =
281
+ | 'hoverStyle'
282
+ | 'pressStyle'
283
+ | 'focusStyle'
284
+ | 'selectedStyle'
285
+ | 'disabledStyle'
286
+
287
+ export interface ILeafInputData {
152
288
  tag?: string
153
289
 
154
290
  // layer data
155
- id?: __String
156
- name?: __String
157
- className?: __String
291
+ id?: IString
292
+ name?: IString
293
+ className?: IString
158
294
 
159
295
  blendMode?: IBlendMode
160
- opacity?: __Number
161
- visible?: __Boolean
162
- isMask?: __Boolean
163
- isEraser?: __Boolean
164
- zIndex?: __Number
296
+ opacity?: INumber
297
+ visible?: IBoolean | 0
298
+ selected?: IBoolean
299
+ disabled?: IBoolean
300
+ locked?: IBoolean
301
+ zIndex?: INumber
302
+
303
+ mask?: IBoolean | IMaskType
304
+ eraser?: IBoolean | IEraserType
165
305
 
166
306
  // layout data
167
- x?: __Number
168
- y?: __Number
169
- width?: __Number
170
- height?: __Number
171
- scaleX?: __Number
172
- scaleY?: __Number
173
- rotation?: __Number
174
- skewX?: __Number
175
- skewY?: __Number
176
-
177
- scale?: __Number | IPointData // helper
178
- around?: IAround
179
-
180
- draggable?: __Boolean
181
-
182
- hittable?: __Boolean
307
+ x?: INumber
308
+ y?: INumber
309
+ width?: INumber
310
+ height?: INumber
311
+ scaleX?: INumber
312
+ scaleY?: INumber
313
+ rotation?: INumber
314
+ skewX?: INumber
315
+ skewY?: INumber
316
+
317
+ scale?: INumber | IPointData // helper
318
+
319
+ offsetX?: INumber
320
+ offsetY?: INumber
321
+ scrollX?: INumber
322
+ scrollY?: INumber
323
+
324
+ origin?: IAlign | IUnitPointData
325
+ around?: IAlign | IUnitPointData
326
+
327
+ lazy?: IBoolean
328
+ pixelRatio?: INumber
329
+
330
+ path?: IPathCommandData | IPathString
331
+ windingRule?: IWindingRule
332
+ closed?: IBoolean
333
+
334
+ // auto layout
335
+ flow?: IFlowType
336
+ padding?: IFourNumber
337
+ gap?: IGap | IPointGap
338
+ flowAlign?: IFlowAlign | IFlowAxisAlign
339
+ flowWrap?: IFlowWrap
340
+ itemBox?: IFlowBoxType
341
+
342
+ inFlow?: IBoolean
343
+ autoWidth?: IAutoSize
344
+ autoHeight?: IAutoSize
345
+ lockRatio?: IBoolean
346
+ autoBox?: IAutoBoxData | IConstraint
347
+
348
+ widthRange?: IRangeSize
349
+ heightRange?: IRangeSize
350
+
351
+ // interactive
352
+ draggable?: IBoolean | IAxis
353
+ dragBounds?: IBoundsData | 'parent'
354
+
355
+ editable?: IBoolean
356
+
357
+ hittable?: IBoolean
183
358
  hitFill?: IHitType
184
359
  hitStroke?: IHitType
185
- hitChildren?: __Boolean
186
- hitSelf?: __Boolean
187
- hitRadius?: __Number
360
+ hitBox?: IBoolean
361
+ hitChildren?: IBoolean
362
+ hitSelf?: IBoolean
363
+ hitRadius?: INumber
188
364
 
189
365
  cursor?: ICursorType | ICursorType[]
190
366
 
367
+ normalStyle?: ILeafInputData
368
+ hoverStyle?: ILeafInputData
369
+ pressStyle?: ILeafInputData
370
+ focusStyle?: ILeafInputData
371
+ selectedStyle?: ILeafInputData
372
+ disabledStyle?: ILeafInputData
373
+
374
+ // 预留给用户使用的数据对象
375
+ data?: IObject
376
+
191
377
  children?: ILeafInputData[]
378
+
379
+ // other
380
+ noBounds?: boolean
192
381
  }
193
382
  export interface ILeafComputedData {
194
383
  // layer data
@@ -198,11 +387,15 @@ export interface ILeafComputedData {
198
387
 
199
388
  blendMode?: IBlendMode
200
389
  opacity?: number
201
- visible?: boolean
202
- isMask?: boolean
203
- isEraser?: boolean
390
+ visible?: boolean | 0
391
+ selected?: boolean
392
+ disabled?: boolean
393
+ locked?: boolean
204
394
  zIndex?: number
205
395
 
396
+ mask?: boolean | IMaskType
397
+ eraser?: boolean | IEraserType
398
+
206
399
  // layout data
207
400
  x?: number
208
401
  y?: number
@@ -214,27 +407,90 @@ export interface ILeafComputedData {
214
407
  skewX?: number
215
408
  skewY?: number
216
409
 
217
- around?: IAround
410
+ offsetX?: number
411
+ offsetY?: number
412
+ scrollX?: number
413
+ scrollY?: number
414
+
415
+ origin?: IAlign | IUnitPointData
416
+ around?: IAlign | IUnitPointData
417
+
418
+ lazy?: boolean
419
+ pixelRatio?: number
420
+
421
+ path?: IPathCommandData
422
+ windingRule?: IWindingRule
423
+ closed?: boolean
218
424
 
219
- draggable?: boolean
425
+ // auto layout
426
+ flow?: IFlowType
427
+ padding?: IFourNumber
428
+ gap?: IGap | IPointGap
429
+ flowAlign?: IFlowAlign | IFlowAxisAlign
430
+ flowWrap?: IFlowWrap
431
+ itemBox?: IFlowBoxType
432
+
433
+ inFlow?: boolean
434
+ autoWidth?: IAutoSize
435
+ autoHeight?: IAutoSize
436
+ lockRatio?: boolean
437
+ autoBox?: IAutoBoxData | IConstraint
438
+
439
+ widthRange?: IRangeSize
440
+ heightRange?: IRangeSize
441
+
442
+ // interactive
443
+ draggable?: boolean | IAxis
444
+ dragBounds?: IBoundsData | 'parent'
445
+
446
+ editable?: boolean
220
447
 
221
448
  hittable?: boolean
222
449
  hitFill?: IHitType
223
450
  hitStroke?: IHitType
451
+ hitBox?: boolean
224
452
  hitChildren?: boolean
225
453
  hitSelf?: boolean
226
454
  hitRadius?: number
227
455
 
228
456
  cursor?: ICursorType | ICursorType[]
229
457
 
458
+ normalStyle?: ILeafInputData
459
+ hoverStyle?: ILeafInputData
460
+ pressStyle?: ILeafInputData
461
+ focusStyle?: ILeafInputData
462
+ selectedStyle?: ILeafInputData
463
+ disabledStyle?: ILeafInputData
464
+
465
+
466
+ // 预留给用户使用的数据对象
467
+ data?: IObject
468
+
230
469
  // other
231
470
  __childBranchNumber?: number // 存在子分支的个数
232
471
  __complex?: boolean // 外观是否复杂
472
+
233
473
  __naturalWidth?: number
234
474
  __naturalHeight?: number
475
+
476
+ readonly __autoWidth?: boolean
477
+ readonly __autoHeight?: boolean
478
+ readonly __autoSide?: boolean
479
+ readonly __autoSize?: boolean
480
+
481
+ readonly __useNaturalRatio: boolean // 宽高存在一个值时,另一个自动值是否采用natural尺寸比例
482
+ readonly __isLinePath: boolean
483
+ readonly __blendMode: string
484
+
485
+ __useArrow?: boolean
486
+ __useEffect?: boolean
487
+
488
+ __pathInputed?: number // 是否为输入path, 0:否,1:是,2:永远是(不自动检测)
489
+ __pathForRender?: IPathCommandData
490
+ __path2DForRender?: IPath2D
235
491
  }
236
492
 
237
- export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
493
+ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
238
494
  tag: string
239
495
  readonly __tag: string
240
496
  readonly innerName: string
@@ -242,68 +498,113 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
242
498
  readonly __DataProcessor: IObject // IDataProcessor
243
499
  readonly __LayoutProcessor: IObject // ILeafLayout
244
500
 
245
- leafer?: ILeafer
501
+ readonly app?: ILeaferBase
502
+ leafer?: ILeaferBase
246
503
  parent?: ILeaf
504
+ zoomLayer?: ILeaf
247
505
 
248
506
  readonly isApp?: boolean
249
- isLeafer?: boolean
250
- isBranch?: boolean
251
- isBranchLeaf?: boolean
507
+ readonly isLeafer?: boolean
508
+ readonly isBranch?: boolean
509
+ readonly isBranchLeaf?: boolean
510
+ readonly isOutside?: boolean // scrollBar ...
252
511
 
253
512
  __: ILeafData
513
+
514
+ proxyData?: ILeafInputData
515
+ __proxyData?: ILeafInputData
516
+
517
+ syncEventer?: ILeaf // 同步触发一样事件的元素
518
+
254
519
  __layout: ILeafLayout
255
520
 
256
- __world: IMatrixWithLayoutData
257
- __local: IMatrixWithBoundsData
521
+ __world: IMatrixWithBoundsScaleData
522
+ __local?: IMatrixWithBoundsData
523
+
524
+ __nowWorld?: IMatrixWithBoundsScaleData // use __world or __cameraWorld render
525
+ __cameraWorld?: IMatrixWithBoundsScaleData // use camera matrix render
526
+
527
+ readonly __localMatrix: IMatrixData
528
+ readonly __localBoxBounds: IBoundsData
258
529
 
259
530
  __worldOpacity: number
260
531
 
261
- readonly worldTransform: IMatrixWithLayoutData
262
- readonly localTransform: IMatrixWithBoundsData
532
+ readonly worldTransform: IMatrixWithScaleData
533
+ readonly localTransform: IMatrixData
263
534
 
264
535
  readonly boxBounds: IBoundsData
536
+ readonly renderBounds: IBoundsData
265
537
  readonly worldBoxBounds: IBoundsData
266
538
  readonly worldStrokeBounds: IBoundsData
267
539
  readonly worldRenderBounds: IBoundsData
268
540
 
269
541
  readonly worldOpacity: number
270
542
 
271
- __renderTime?: number // μs 1000微秒 = 1毫秒
272
-
273
543
  __level: number // 图层级别 root(1) -> hight
274
544
  __tempNumber?: number // 用于临时运算储存状态
275
545
 
276
- readonly resizeable: boolean
277
-
278
- readonly __hasMirror: boolean
546
+ readonly __worldFlipped: boolean
279
547
 
548
+ __hasAutoLayout?: boolean
280
549
  __hasMask?: boolean
281
550
  __hasEraser?: boolean
282
551
  __hitCanvas?: IHitCanvas
283
552
 
553
+ __flowBounds?: IBoundsData // localBoxBounds or localStrokeBounds
554
+ __widthGrow?: number
555
+ __heightGrow?: number
556
+ __hasGrow?: boolean
557
+
284
558
  readonly __onlyHitMask: boolean
285
559
  readonly __ignoreHitWorld: boolean
560
+ readonly __inLazyBounds: boolean
561
+
562
+ readonly pathInputed: boolean
286
563
 
287
564
  __parentWait?: IFunction[]
288
565
  __leaferWait?: IFunction[]
289
566
 
290
567
  destroyed: boolean
291
568
 
292
- waitParent(item: IFunction): void
293
- waitLeafer(item: IFunction): void
294
- nextRender(item: IFunction): void
569
+ reset(data?: ILeafInputData): void
570
+ resetCustom(): void
571
+
572
+ waitParent(item: IFunction, bind?: IObject): void
573
+ waitLeafer(item: IFunction, bind?: IObject): void
574
+ nextRender(item: IFunction, bind?: IObject, off?: 'off'): void
575
+ removeNextRender(item: IFunction): void
295
576
 
296
- __bindLeafer(leafer: ILeafer | null): void
577
+ __bindLeafer(leafer: ILeaferBase | null): void
297
578
 
298
579
  set(data: IObject): void
299
- toJSON(): IObject
300
- toString(): string
580
+ get(name?: string | string[] | IObject): ILeafInputData | IValue
581
+ setAttr(name: string, value: any): void
582
+ getAttr(name: string): any
583
+ getComputedAttr(name: string): any
584
+
585
+ toJSON(options?: IJSONOptions): IObject
586
+ toString(options?: IJSONOptions): string
587
+ toSVG(): string
588
+ __SVG(data: IObject): void
589
+ toHTML(): string
301
590
 
302
591
  // ILeafData ->
303
- __setAttr(attrName: string, newValue: __Value): void
304
- __getAttr(attrName: string): __Value
592
+ __setAttr(attrName: string, newValue: IValue, checkFiniteNumber?: boolean): boolean
593
+ __getAttr(attrName: string): IValue
594
+ setProxyAttr(name: string, newValue: IValue): void
595
+ getProxyAttr(name: string): IValue
596
+
597
+ // find
598
+ find(condition: number | string | IFindMethod, options?: any): ILeaf[]
599
+ findTag(tag: string | string[]): ILeaf[]
600
+ findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined
601
+ findId(id: number | string): ILeaf | undefined
602
+
603
+ focus(value?: boolean): void
305
604
 
605
+ updateLayout(): void
306
606
  forceUpdate(attrName?: string): void
607
+ forceRender(_bounds?: IBoundsData): void
307
608
 
308
609
  // ILeafMatrix ->
309
610
  __updateWorldMatrix(): void
@@ -311,15 +612,19 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
311
612
 
312
613
  // ILeafBounds ->
313
614
  __updateWorldBounds(): void
615
+ __updateLocalBounds(): void
314
616
 
315
617
  __updateLocalBoxBounds(): void
316
618
  __updateLocalStrokeBounds(): void
317
619
  __updateLocalRenderBounds(): void
318
620
 
621
+ __updateContentBounds(): void
319
622
  __updateBoxBounds(): void
320
623
  __updateStrokeBounds(): void
321
624
  __updateRenderBounds(): void
322
625
 
626
+ __updateAutoLayout(): void
627
+ __updateFlowLayout(): void
323
628
  __updateNaturalSize(): void
324
629
 
325
630
  __updateStrokeSpread(): number
@@ -330,12 +635,19 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
330
635
  // IBranchMask ->
331
636
  __updateEraser(value?: boolean): void
332
637
  __updateMask(value?: boolean): void
333
- __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
334
- __removeMask(child?: ILeaf): void
638
+ __renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void
639
+ __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void
335
640
 
336
641
  // convert
337
- getWorld(attrName: IMatrixDecompositionAttr): number
338
- getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
642
+ __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
643
+
644
+ getTransform(relative?: ILocationType | ILeaf): IMatrixData
645
+
646
+ getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
647
+ getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
648
+ getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[]
649
+
650
+ getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData
339
651
 
340
652
  worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
341
653
  localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
@@ -348,15 +660,37 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
348
660
  getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
349
661
  getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
350
662
  getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
663
+ getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
664
+ getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
665
+
666
+
667
+ // transform
668
+ setTransform(transform?: IMatrixData, resize?: boolean): void
669
+ transform(transform?: IMatrixData, resize?: boolean): void
670
+
671
+ move(x: number | IPointData, y?: number): void
672
+ scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void
673
+ rotateOf(origin: IPointData | IAlign, rotation: number): void
674
+ skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void
675
+
676
+ transformWorld(worldTransform?: IMatrixData, resize?: boolean): void
677
+ moveWorld(x: number | IPointData, y?: number): void
678
+ scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
679
+ rotateOfWorld(worldOrigin: IPointData, rotation: number): void
680
+ skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
681
+
682
+ scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
683
+ __scaleResize(scaleX: number, scaleY: number): void
351
684
 
352
- move(x: number, y?: number): void
353
- scaleOf(origin: IPointData, x: number, y?: number): void
354
- rotateOf(origin: IPointData, rotation: number): void
355
- skewOf(origin: IPointData, x: number, y: number): void
685
+ resizeWidth(width: number): void
686
+ resizeHeight(height: number): void
356
687
 
357
688
  // ILeafHit ->
358
689
  __hitWorld(point: IRadiusPointData): boolean
359
690
  __hit(local: IRadiusPointData): boolean
691
+ __hitFill(inner: IRadiusPointData): boolean
692
+ __hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean
693
+ __hitPixel(inner: IRadiusPointData): boolean
360
694
  __drawHitPath(canvas: ILeaferCanvas): void
361
695
  __updateHitCanvas(): void
362
696
 
@@ -365,7 +699,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
365
699
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
366
700
  __draw(canvas: ILeaferCanvas, options: IRenderOptions): void
367
701
 
368
- __renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
702
+ __clip(canvas: ILeaferCanvas, options: IRenderOptions): void
703
+ __renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
369
704
 
370
705
  __updateWorldOpacity(): void
371
706
  __updateChange(): void
@@ -376,10 +711,19 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
376
711
  __updatePath(): void
377
712
  __updateRenderPath(): void
378
713
 
714
+ //
715
+
379
716
  // branch
380
717
  children?: ILeaf[]
381
718
 
382
719
  __updateSortChildren(): void
383
720
  add(child: ILeaf, index?: number): void
384
721
  remove(child?: ILeaf, destroy?: boolean): void
385
- }
722
+ dropTo(parent: ILeaf, index?: number, resize?: boolean): void
723
+ }
724
+
725
+ export type ILeafAttrDescriptor = IObject & ThisType<ILeaf>
726
+
727
+ export interface ILeafAttrDescriptorFn {
728
+ (key: string): ILeafAttrDescriptor
729
+ }