@leafer-ui/display 1.0.0-rc.11 → 1.0.0-rc.16

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-ui/display",
3
- "version": "1.0.0-rc.11",
3
+ "version": "1.0.0-rc.16",
4
4
  "description": "@leafer-ui/display",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,14 +22,14 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.0.0-rc.11",
26
- "@leafer-ui/data": "1.0.0-rc.11",
27
- "@leafer-ui/display-module": "1.0.0-rc.11",
28
- "@leafer-ui/decorator": "1.0.0-rc.11",
29
- "@leafer-ui/external": "1.0.0-rc.11"
25
+ "@leafer/core": "1.0.0-rc.16",
26
+ "@leafer-ui/data": "1.0.0-rc.16",
27
+ "@leafer-ui/display-module": "1.0.0-rc.16",
28
+ "@leafer-ui/decorator": "1.0.0-rc.16",
29
+ "@leafer-ui/external": "1.0.0-rc.16"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.0.0-rc.11",
33
- "@leafer-ui/interface": "1.0.0-rc.11"
32
+ "@leafer/interface": "1.0.0-rc.16",
33
+ "@leafer-ui/interface": "1.0.0-rc.16"
34
34
  }
35
35
  }
package/src/Box.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, IRenderOptions, IPathDrawer, IBoundsData, IPathCommandData } from '@leafer/interface'
1
+ import { ILeaferCanvas, IRenderOptions, IBoundsData } from '@leafer/interface'
2
2
  import { rewrite, rewriteAble, registerUI, BoundsHelper, dataProcessor, affectRenderBoundsType } from '@leafer/core'
3
3
 
4
4
  import { IBox, IBoxData, IBoxInputData, IOverflow } from '@leafer-ui/interface'
@@ -18,6 +18,8 @@ export class Box extends Group implements IBox {
18
18
 
19
19
  public get __tag() { return 'Box' }
20
20
 
21
+ public get isBranchLeaf(): boolean { return true }
22
+
21
23
  @dataProcessor(BoxData)
22
24
  declare public __: IBoxData
23
25
 
@@ -26,7 +28,6 @@ export class Box extends Group implements IBox {
26
28
 
27
29
  constructor(data?: IBoxInputData) {
28
30
  super(data)
29
- this.isBranchLeaf = true
30
31
  this.__layout.renderChanged || this.__layout.renderChange()
31
32
  }
32
33
 
@@ -48,8 +49,15 @@ export class Box extends Group implements IBox {
48
49
  public __updateRectBoxBounds(): void { }
49
50
 
50
51
  public __updateBoxBounds(): void {
51
- if (this.__.__autoBounds && this.children.length) {
52
+ const data = this.__
53
+ if (data.__autoSide && this.children.length) {
54
+ if (this.leafer) this.leafer.layouter.addExtra(this)
52
55
  super.__updateBoxBounds()
56
+ if (!data.__autoSize) {
57
+ const b = this.__layout.boxBounds
58
+ if (!data.__autoWidth) b.x = 0, b.width = data.width
59
+ if (!data.__autoHeight) b.y = 0, b.height = data.height
60
+ }
53
61
  } else {
54
62
  this.__updateRectBoxBounds()
55
63
  }
@@ -68,7 +76,6 @@ export class Box extends Group implements IBox {
68
76
  }
69
77
  }
70
78
 
71
-
72
79
  @rewrite(rect.__updateRenderBounds)
73
80
  public __updateRectRenderBounds(): void { }
74
81
 
@@ -81,10 +88,6 @@ export class Box extends Group implements IBox {
81
88
  }
82
89
 
83
90
 
84
- @rewrite(rect.__drawPathByData)
85
- public __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void { }
86
-
87
-
88
91
  @rewrite(rect.__render)
89
92
  public __renderRect(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
90
93
 
package/src/Canvas.ts CHANGED
@@ -2,7 +2,7 @@ import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData
2
2
  import { Creator, Matrix, Platform, dataProcessor, registerUI, hitType } from '@leafer/core'
3
3
 
4
4
  import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
5
- import { ImageData } from '@leafer-ui/data'
5
+ import { CanvasData } from '@leafer-ui/data'
6
6
 
7
7
  import { Rect } from './Rect'
8
8
  import { resizeType } from '@leafer-ui/decorator'
@@ -13,7 +13,7 @@ export class Canvas extends Rect implements ICanvas {
13
13
 
14
14
  public get __tag() { return 'Canvas' }
15
15
 
16
- @dataProcessor(ImageData)
16
+ @dataProcessor(CanvasData)
17
17
  declare public __: ICanvasData
18
18
 
19
19
  @resizeType(100)
@@ -23,7 +23,7 @@ export class Canvas extends Rect implements ICanvas {
23
23
  declare public height: INumber
24
24
 
25
25
  @resizeType(Platform.devicePixelRatio)
26
- public pixelRatio: INumber
26
+ declare public pixelRatio: INumber
27
27
 
28
28
  @resizeType(true)
29
29
  public smooth: boolean
package/src/Frame.ts CHANGED
@@ -11,6 +11,8 @@ export class Frame extends Box implements IFrame {
11
11
 
12
12
  public get __tag() { return 'Frame' }
13
13
 
14
+ public get isFrame(): boolean { return true }
15
+
14
16
  @dataProcessor(FrameData)
15
17
  declare public __: IFrameData
16
18
 
@@ -22,6 +24,5 @@ export class Frame extends Box implements IFrame {
22
24
 
23
25
  constructor(data?: IFrameInputData) {
24
26
  super(data)
25
- this.isFrame = true
26
27
  }
27
28
  }
package/src/Group.ts CHANGED
@@ -13,6 +13,8 @@ export class Group extends UI implements IGroup {
13
13
 
14
14
  public get __tag() { return 'Group' }
15
15
 
16
+ public get isBranch(): boolean { return true }
17
+
16
18
  @dataProcessor(GroupData)
17
19
  declare public __: IGroupData
18
20
 
@@ -20,14 +22,18 @@ export class Group extends UI implements IGroup {
20
22
 
21
23
  constructor(data?: IGroupInputData) {
22
24
  super(data)
25
+ }
26
+
27
+ public reset(data?: IGroupInputData): void {
23
28
  this.__setBranch()
29
+ super.reset(data)
24
30
  }
25
31
 
26
32
  public __setBranch(): void {
27
- this.isBranch = true
28
33
  if (!this.children) this.children = []
29
34
  }
30
35
 
36
+
31
37
  // data
32
38
 
33
39
  public set(data: IUIInputData): void {
@@ -38,7 +44,7 @@ export class Group extends UI implements IGroup {
38
44
  if (!this.children) {
39
45
  this.__setBranch()
40
46
  } else {
41
- this.removeAll(true)
47
+ this.clear()
42
48
  }
43
49
 
44
50
  super.set(data)
package/src/Leafer.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher, IInteraction, ILeaferConfig, ICanvasManager, IHitCanvasManager, IAutoBounds, IScreenSizeData, IResizeEvent, ILeaf, IEventListenerId, ITimer, IValue, IObject, IControl, IPointData, ILeaferType, ICursorType, IBoundsData } from '@leafer/interface'
1
+ import { ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher, IInteraction, ILeaferConfig, ICanvasManager, IHitCanvasManager, IAutoBounds, IScreenSizeData, IResizeEvent, ILeaf, IEventListenerId, ITimer, IValue, IObject, IControl, IPointData, ILeaferType, ICursorType, IBoundsData, INumber } from '@leafer/interface'
2
2
  import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds } from '@leafer/core'
3
3
 
4
4
  import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IGroup, IApp, IEditorBase } from '@leafer-ui/interface'
@@ -17,11 +17,13 @@ export class Leafer extends Group implements ILeafer {
17
17
  declare public __: ILeaferData
18
18
 
19
19
  @boundsType()
20
- public pixelRatio: number
20
+ declare public pixelRatio: INumber
21
21
 
22
22
  public get isApp(): boolean { return false }
23
23
  public get app(): ILeafer { return this.parent || this }
24
24
 
25
+ public get isLeafer(): boolean { return true }
26
+
25
27
  declare public parent?: IApp
26
28
 
27
29
  public running: boolean
@@ -197,7 +199,7 @@ export class Leafer extends Group implements ILeafer {
197
199
  }
198
200
 
199
201
  public forceRender(bounds?: IBoundsData): void {
200
- this.renderer.addBlock(new Bounds(bounds) || this.canvas.bounds)
202
+ this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds)
201
203
  if (this.viewReady) this.renderer.update()
202
204
  }
203
205
 
@@ -231,7 +233,6 @@ export class Leafer extends Group implements ILeafer {
231
233
 
232
234
  public __setLeafer(leafer: ILeafer): void {
233
235
  this.leafer = leafer
234
- this.isLeafer = !!leafer
235
236
  this.__level = 1
236
237
  }
237
238
 
package/src/Line.ts CHANGED
@@ -5,6 +5,7 @@ import { ILine, ILineData, ILineInputData, IStrokeAlign } from '@leafer-ui/inter
5
5
  import { LineData } from '@leafer-ui/data'
6
6
 
7
7
  import { UI } from './UI'
8
+ import { PathArrow } from '@leafer-ui/external'
8
9
 
9
10
 
10
11
  const { moveTo, lineTo, drawPoints } = PathCommandDataHelper
@@ -70,8 +71,10 @@ export class Line extends UI implements ILine {
70
71
  }
71
72
 
72
73
  public __updateRenderPath(): void {
73
- if (this.__.points && this.__.curve) {
74
- drawPoints(this.__.__pathForRender = [], this.__.points, this.__.curve, this.__tag !== 'Line')
74
+ const data = this.__
75
+ if (!this.pathInputed && data.points && data.curve) {
76
+ drawPoints(data.__pathForRender = [], data.points, data.curve, this.pathClosed)
77
+ if (data.__useArrow) PathArrow.addArrows(this, false)
75
78
  } else {
76
79
  super.__updateRenderPath()
77
80
  }
package/src/Path.ts CHANGED
@@ -1,14 +1,11 @@
1
- import { IPathCommandData, IWindingRule } from '@leafer/interface'
2
- import { PathBounds, dataProcessor, pathType, affectStrokeBoundsType, registerUI } from '@leafer/core'
1
+ import { dataProcessor, affectStrokeBoundsType, registerUI } from '@leafer/core'
3
2
 
4
- import { IPath, IPathData, IPathInputData, IPathString, IStrokeAlign } from '@leafer-ui/interface'
3
+ import { IPath, IPathData, IPathInputData, IStrokeAlign } from '@leafer-ui/interface'
5
4
  import { PathData } from '@leafer-ui/data'
6
5
 
7
6
  import { UI } from './UI'
8
7
 
9
8
 
10
- const { toBounds } = PathBounds
11
-
12
9
  @registerUI()
13
10
  export class Path extends UI implements IPath {
14
11
 
@@ -17,21 +14,12 @@ export class Path extends UI implements IPath {
17
14
  @dataProcessor(PathData)
18
15
  declare public __: IPathData
19
16
 
20
- @pathType()
21
- public path: IPathCommandData | IPathString
22
-
23
- @pathType()
24
- public windingRule: IWindingRule
25
-
26
17
  @affectStrokeBoundsType('center')
27
18
  declare public strokeAlign: IStrokeAlign
28
19
 
29
20
  constructor(data?: IPathInputData) {
30
21
  super(data)
31
- }
32
-
33
- public __updateBoxBounds(): void {
34
- toBounds(this.__.path, this.__layout.boxBounds)
22
+ this.__.__pathInputed = 2
35
23
  }
36
24
 
37
25
  }
package/src/Pen.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PathCreator, dataProcessor, registerUI, useModule } from '@leafer/core'
1
+ import { PathCreator, dataProcessor, defineKey, registerUI, useModule } from '@leafer/core'
2
2
 
3
3
  import { IPenData, IPenInputData, IPathInputData, IPathCommandData, IPath, IPen } from '@leafer-ui/interface'
4
4
  import { PenData } from '@leafer-ui/data'
@@ -7,7 +7,7 @@ import { Group } from './Group'
7
7
  import { Path } from './Path'
8
8
 
9
9
 
10
- @useModule(PathCreator, ['beginPath'])
10
+ @useModule(PathCreator, ['beginPath', 'path'])
11
11
  @registerUI()
12
12
  export class Pen extends Group implements IPen {
13
13
 
@@ -18,7 +18,11 @@ export class Pen extends Group implements IPen {
18
18
 
19
19
  public pathElement: IPath
20
20
  public pathStyle: IPathInputData
21
- public path: IPathCommandData
21
+
22
+ @penPathType()
23
+ public path: IPathCommandData // use __path, readonly
24
+
25
+ public __path: IPathCommandData
22
26
 
23
27
  constructor(data?: IPenInputData) {
24
28
  super(data)
@@ -27,13 +31,13 @@ export class Pen extends Group implements IPen {
27
31
  public setStyle(data: IPathInputData): Pen {
28
32
  const path = this.pathElement = new Path(data)
29
33
  this.pathStyle = data
30
- this.path = path.path as IPathCommandData || (path.path = [])
34
+ this.__path = path.path as IPathCommandData || (path.path = [])
31
35
  this.add(path)
32
36
  return this
33
37
  }
34
38
 
35
39
  public beginPath(): Pen {
36
- this.path.length = 0
40
+ this.__path.length = 0
37
41
  this.paint()
38
42
  return this
39
43
  }
@@ -77,4 +81,12 @@ export class Pen extends Group implements IPen {
77
81
  this.pathElement.forceUpdate('path')
78
82
  }
79
83
 
84
+ }
85
+
86
+ function penPathType() {
87
+ return (target: IPen, key: string) => {
88
+ defineKey(target, key, {
89
+ get() { return this.__path }
90
+ })
91
+ }
80
92
  }
package/src/Polygon.ts CHANGED
@@ -32,6 +32,7 @@ export class Polygon extends UI implements IPolygon {
32
32
 
33
33
  constructor(data?: IPolygonInputData) {
34
34
  super(data)
35
+ this.pathClosed = true
35
36
  }
36
37
 
37
38
  public __updatePath(): void {
package/src/Rect.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { IPathDrawer, IPathCommandData } from '@leafer/interface'
2
- import { dataProcessor, registerUI, rewrite, rewriteAble, useModule } from '@leafer/core'
1
+ import { dataProcessor, registerUI, rewriteAble, useModule } from '@leafer/core'
3
2
 
4
3
  import { IRect, IRectInputData, IRectData } from '@leafer-ui/interface'
5
4
  import { RectData } from '@leafer-ui/data'
@@ -22,7 +21,4 @@ export class Rect extends UI implements IRect {
22
21
  super(data)
23
22
  }
24
23
 
25
- @rewrite(UI.prototype.__drawPathByBox)
26
- public __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void { }
27
-
28
24
  }
package/src/Text.ts CHANGED
@@ -135,7 +135,7 @@ export class Text extends UI implements IText {
135
135
  data.__padding = padding ? MathHelper.fourNumber(padding) : undefined
136
136
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2
137
137
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`
138
- data.__clipText = textOverflow !== 'show' && !data.__autoBounds
138
+ data.__clipText = textOverflow !== 'show' && !data.__autoSize
139
139
 
140
140
  this.__updateTextDrawData()
141
141
 
package/src/UI.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IAround } from '@leafer/interface'
2
- import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, PathCreator } from '@leafer/core'
1
+ import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IAround, IValue, IWindingRule } from '@leafer/interface'
2
+ import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, PathCreator, naturalBoundsType, pathInputType } from '@leafer/core'
3
3
 
4
4
  import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowType, IFindUIMethod, IEditSize, ILeafer } from '@leafer-ui/interface'
5
- import { effectType } from '@leafer-ui/decorator'
5
+ import { arrowType, effectType } from '@leafer-ui/decorator'
6
6
 
7
7
  import { UIData } from '@leafer-ui/data'
8
8
  import { UIBounds, UIRender } from '@leafer-ui/display-module'
9
9
 
10
- import { Export } from '@leafer-ui/external'
10
+ import { Export, PathArrow } from '@leafer-ui/external'
11
11
 
12
12
 
13
13
  @useModule(UIBounds)
@@ -26,7 +26,7 @@ export class UI extends Leaf implements IUI {
26
26
  declare public leafer?: ILeafer
27
27
  declare public parent?: IGroup
28
28
 
29
- public isFrame?: boolean
29
+ public get isFrame(): boolean { return false }
30
30
 
31
31
  declare public children?: IUI[]
32
32
 
@@ -180,17 +180,29 @@ export class UI extends Leaf implements IUI {
180
180
  @strokeType(10)
181
181
  public miterLimit: INumber
182
182
 
183
- // load
183
+ // image
184
184
 
185
185
  @dataType(false)
186
186
  public lazy: IBoolean // load image / compute paint
187
187
 
188
+ @naturalBoundsType(1)
189
+ public pixelRatio: INumber
190
+
191
+ // path
192
+
193
+ @pathInputType()
194
+ public path: IPathCommandData | IPathString
195
+
196
+ @pathType()
197
+ public windingRule: IWindingRule
198
+
199
+
188
200
  // arrow
189
201
 
190
- @strokeType('none')
202
+ @arrowType('none')
191
203
  public startArrow: IArrowType
192
204
 
193
- @strokeType('none')
205
+ @arrowType('none')
194
206
  public endArrow: IArrowType
195
207
 
196
208
  // corner
@@ -249,8 +261,8 @@ export class UI extends Leaf implements IUI {
249
261
  Object.assign(this, data)
250
262
  }
251
263
 
252
- public get(): IUIInputData {
253
- return this.__.__getInputData()
264
+ public get(name?: string): IUIInputData | IValue {
265
+ return name ? this.__.__getInput(name) : this.__.__getInputData()
254
266
  }
255
267
 
256
268
  public createProxyData(): IUIInputData { return undefined }
@@ -294,6 +306,7 @@ export class UI extends Leaf implements IUI {
294
306
  if (this.__.path) {
295
307
  const data = this.__
296
308
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path
309
+ if (data.__useArrow) PathArrow.addArrows(this, !data.cornerRadius)
297
310
  }
298
311
  }
299
312
 
@@ -307,8 +320,13 @@ export class UI extends Leaf implements IUI {
307
320
  this.__drawPathByData(canvas, this.__.path)
308
321
  }
309
322
 
310
- @rewrite(PathDrawer.drawPathByData)
311
- public __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void { }
323
+ public __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void {
324
+ if (data) {
325
+ PathDrawer.drawPathByData(drawer, data)
326
+ } else {
327
+ this.__drawPathByBox(drawer)
328
+ }
329
+ }
312
330
 
313
331
  public __drawPathByBox(drawer: IPathDrawer): void {
314
332
  const { x, y, width, height } = this.__layout.boxBounds
@@ -334,6 +352,13 @@ export class UI extends Leaf implements IUI {
334
352
  return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height) as IUI
335
353
  }
336
354
 
355
+ static registerUI(): void {
356
+ registerUI()(this)
357
+ }
358
+
359
+ static registerData(data: IUIData): void {
360
+ dataProcessor(data)(this.prototype)
361
+ }
337
362
 
338
363
  public destroy(): void {
339
364
  this.fill = this.stroke = null
package/src/Arrow.ts DELETED
@@ -1,27 +0,0 @@
1
- import { registerUI, strokeType, dataProcessor } from '@leafer/core'
2
-
3
- import { IArrow, IArrowData, IArrowInputData, IArrowType } from '@leafer-ui/interface'
4
- import { ArrowData } from '@leafer-ui/data'
5
-
6
- import { Line } from './Line'
7
-
8
-
9
- @registerUI()
10
- export class Arrow extends Line implements IArrow {
11
-
12
- public get __tag() { return 'Arrow' }
13
-
14
- @dataProcessor(ArrowData)
15
- declare public __: IArrowData
16
-
17
- @strokeType('none')
18
- declare public startArrow: IArrowType
19
-
20
- @strokeType('lines')
21
- declare public endArrow: IArrowType
22
-
23
- constructor(data?: IArrowInputData) {
24
- super(data)
25
- }
26
-
27
- }
package/types/index.d.ts DELETED
@@ -1,368 +0,0 @@
1
- import { IString, INumber, IBoolean, IMaskType, IAround, IHitType, ICursorType, IPointData, IPathCommandData, IPathString, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IBoundsData, IResizeEvent, ILeaf, IValue, IRenderOptions, ILeaferImage, ICanvasContext2D, IWindingRule } from '@leafer/interface';
2
- import { Leaf } from '@leafer/core';
3
- import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IEditSize, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IFindUIMethod, IExportOptions, IExportResult, IGroupData, IGroupInputData, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBox, IBoxData, IOverflow, IBoxInputData, IFrame, IFrameData, IFrameInputData, IRect, IRectData, IRectInputData, IEllipse, IEllipseData, IEllipseInputData, IPolygon, IPolygonData, IPolygonInputData, IStar, IStarData, IStarInputData, ILine, ILineData, ILineInputData, IImage, IImageData, IImageInputData, ICanvas, ICanvasData, ICanvasInputData, IText, ITextData, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IUnitData, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathString as IPathString$1, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
4
-
5
- declare class UI extends Leaf implements IUI {
6
- __: IUIData;
7
- proxyData: IUIInputData;
8
- __proxyData?: IUIInputData;
9
- get app(): ILeafer;
10
- leafer?: ILeafer;
11
- parent?: IGroup;
12
- isFrame?: boolean;
13
- children?: IUI[];
14
- id: IString;
15
- name: IString;
16
- className: IString;
17
- blendMode: IBlendMode;
18
- opacity: INumber;
19
- visible: IBoolean;
20
- locked: IBoolean;
21
- zIndex: INumber;
22
- mask: IBoolean;
23
- maskType: IMaskType;
24
- eraser: IBoolean;
25
- x: INumber;
26
- y: INumber;
27
- width: INumber;
28
- height: INumber;
29
- scaleX: INumber;
30
- scaleY: INumber;
31
- rotation: INumber;
32
- skewX: INumber;
33
- skewY: INumber;
34
- around: IAround;
35
- draggable: IBoolean;
36
- editable: IBoolean;
37
- editSize?: IEditSize;
38
- hittable: IBoolean;
39
- hitFill: IHitType;
40
- hitStroke: IHitType;
41
- hitBox: IBoolean;
42
- hitChildren: IBoolean;
43
- hitSelf: IBoolean;
44
- hitRadius: INumber;
45
- cursor: ICursorType | ICursorType[];
46
- fill: IFill;
47
- stroke: IStroke;
48
- strokeAlign: IStrokeAlign;
49
- strokeWidth: INumber | INumber[] | IStrokeWidthString;
50
- strokeWidthFixed: IBoolean;
51
- strokeCap: IStrokeCap;
52
- strokeJoin: IStrokeJoin;
53
- dashPattern: INumber[] | IDashPatternString;
54
- dashOffset: INumber;
55
- miterLimit: INumber;
56
- lazy: IBoolean;
57
- startArrow: IArrowType;
58
- endArrow: IArrowType;
59
- cornerRadius: number | number[] | ICornerRadiusString;
60
- cornerSmoothing: INumber;
61
- shadow: IShadowEffect | IShadowEffect[] | IShadowString;
62
- innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
63
- blur: INumber | IBlurEffect;
64
- backgroundBlur: INumber | IBlurEffect;
65
- grayscale: INumber | IGrayscaleEffect;
66
- set scale(value: INumber | IPointData);
67
- get scale(): INumber | IPointData;
68
- constructor(data?: IUIInputData);
69
- reset(_data?: IUIInputData): void;
70
- set(data: IUIInputData): void;
71
- get(): IUIInputData;
72
- createProxyData(): IUIInputData;
73
- find(_condition: number | string | IFindUIMethod, _options?: any): IUI[];
74
- findOne(_condition: number | string | IFindUIMethod, _options?: any): IUI;
75
- getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
76
- getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
77
- __onUpdateSize(): void;
78
- __updateRenderPath(): void;
79
- __drawRenderPath(canvas: ILeaferCanvas): void;
80
- __drawPath(canvas: ILeaferCanvas): void;
81
- __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void;
82
- __drawPathByBox(drawer: IPathDrawer): void;
83
- export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
84
- clone(): IUI;
85
- static one(data: IUIInputData, x?: number, y?: number, width?: number, height?: number): IUI;
86
- destroy(): void;
87
- }
88
-
89
- declare class Group extends UI implements IGroup {
90
- get __tag(): string;
91
- __: IGroupData;
92
- children: IUI[];
93
- constructor(data?: IGroupInputData);
94
- __setBranch(): void;
95
- set(data: IUIInputData): void;
96
- toJSON(): IUIInputData;
97
- pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult;
98
- addAt(child: IUI, index: number): void;
99
- addAfter(child: IUI, after: IUI): void;
100
- addBefore(child: UI, before: IUI): void;
101
- add(_child: IUI, _index?: number): void;
102
- addMany(..._children: IUI[]): void;
103
- remove(_child?: IUI, _destroy?: boolean): void;
104
- removeAll(_destroy?: boolean): void;
105
- clear(): void;
106
- }
107
-
108
- declare class Leafer extends Group implements ILeafer {
109
- get __tag(): string;
110
- __: ILeaferData;
111
- pixelRatio: number;
112
- get isApp(): boolean;
113
- get app(): ILeafer;
114
- parent?: IApp;
115
- running: boolean;
116
- created: boolean;
117
- ready: boolean;
118
- viewReady: boolean;
119
- viewCompleted: boolean;
120
- get imageReady(): boolean;
121
- get layoutLocked(): boolean;
122
- transforming: boolean;
123
- view: unknown;
124
- canvas: ILeaferCanvas;
125
- renderer: IRenderer;
126
- watcher: IWatcher;
127
- layouter: ILayouter;
128
- selector?: ISelector;
129
- interaction?: IInteraction;
130
- canvasManager: ICanvasManager;
131
- hitCanvasManager?: IHitCanvasManager;
132
- editor: IEditorBase;
133
- zoomLayer: IGroup;
134
- userConfig: ILeaferConfig;
135
- config: ILeaferConfig;
136
- autoLayout?: IAutoBounds;
137
- get cursorPoint(): IPointData;
138
- leafs: number;
139
- __eventIds: IEventListenerId[];
140
- protected __startTimer: ITimer;
141
- protected __controllers: IControl[];
142
- protected __readyWait: IFunction[];
143
- protected __viewReadyWait: IFunction[];
144
- protected __viewCompletedWait: IFunction[];
145
- __nextRenderWait: IFunction[];
146
- constructor(userConfig?: ILeaferConfig, data?: ILeaferInputData);
147
- init(userConfig?: ILeaferConfig, parentApp?: IApp): void;
148
- onInit(): void;
149
- initType(_type: ILeaferType): void;
150
- set(data: IUIInputData): void;
151
- start(): void;
152
- stop(): void;
153
- unlockLayout(): void;
154
- lockLayout(): void;
155
- resize(size: IScreenSizeData): void;
156
- forceFullRender(): void;
157
- forceRender(bounds?: IBoundsData): void;
158
- updateCursor(cursor?: ICursorType): void;
159
- protected __doResize(size: IScreenSizeData): void;
160
- protected __onResize(event: IResizeEvent): void;
161
- protected __setApp(): void;
162
- protected __bindApp(app: IApp): void;
163
- __setLeafer(leafer: ILeafer): void;
164
- setZoomLayer(zoomLayer: ILeaf): void;
165
- protected __checkAutoLayout(config: ILeaferConfig): void;
166
- __setAttr(attrName: string, newValue: IValue): void;
167
- __getAttr(attrName: string): IValue;
168
- protected __changeCanvasSize(attrName: string, newValue: number): void;
169
- protected __changeFill(newValue: string): void;
170
- protected __onCreated(): void;
171
- protected __onReady(): void;
172
- protected __onViewReady(): void;
173
- protected __onNextRender(): void;
174
- protected __checkViewCompleted(emit?: boolean): void;
175
- protected __onWatchData(): void;
176
- waitReady(item: IFunction): void;
177
- waitViewReady(item: IFunction): void;
178
- waitViewCompleted(item: IFunction): void;
179
- nextRender(item: IFunction, off?: 'off'): void;
180
- protected __checkUpdateLayout(): void;
181
- protected emitLeafer(type: string): void;
182
- protected __listenEvents(): void;
183
- protected __removeListenEvents(): void;
184
- destroy(): void;
185
- }
186
-
187
- declare class Box extends Group implements IBox {
188
- get __tag(): string;
189
- __: IBoxData;
190
- overflow: IOverflow;
191
- constructor(data?: IBoxInputData);
192
- __updateStrokeSpread(): number;
193
- __updateRectRenderSpread(): number;
194
- __updateRenderSpread(): number;
195
- __updateRectBoxBounds(): void;
196
- __updateBoxBounds(): void;
197
- __updateStrokeBounds(): void;
198
- __updateRenderBounds(): void;
199
- __updateRectRenderBounds(): void;
200
- __updateRectChange(): void;
201
- __updateChange(): void;
202
- __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void;
203
- __renderRect(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
204
- __renderGroup(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
205
- __render(canvas: ILeaferCanvas, options: IRenderOptions): void;
206
- __drawAfterFill(canvas: ILeaferCanvas, options: IRenderOptions): void;
207
- }
208
-
209
- declare class Frame extends Box implements IFrame {
210
- get __tag(): string;
211
- __: IFrameData;
212
- fill: IFill;
213
- overflow: IOverflow;
214
- constructor(data?: IFrameInputData);
215
- }
216
-
217
- declare class Rect extends UI implements IRect {
218
- get __tag(): string;
219
- __: IRectData;
220
- constructor(data?: IRectInputData);
221
- __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void;
222
- }
223
-
224
- declare class Ellipse extends UI implements IEllipse {
225
- get __tag(): string;
226
- __: IEllipseData;
227
- innerRadius: INumber;
228
- startAngle: INumber;
229
- endAngle: INumber;
230
- constructor(data?: IEllipseInputData);
231
- __updatePath(): void;
232
- }
233
-
234
- declare class Polygon extends UI implements IPolygon {
235
- get __tag(): string;
236
- __: IPolygonData;
237
- sides: INumber;
238
- points: number[];
239
- curve: boolean | number;
240
- constructor(data?: IPolygonInputData);
241
- __updatePath(): void;
242
- __updateRenderPath(): void;
243
- __updateBoxBounds(): void;
244
- }
245
-
246
- declare class Star extends UI implements IStar {
247
- get __tag(): string;
248
- __: IStarData;
249
- corners: INumber;
250
- innerRadius: INumber;
251
- constructor(data?: IStarInputData);
252
- __updatePath(): void;
253
- }
254
-
255
- declare class Line extends UI implements ILine {
256
- get __tag(): string;
257
- __: ILineData;
258
- strokeAlign: IStrokeAlign;
259
- height: INumber;
260
- points: number[];
261
- curve: boolean | number;
262
- get toPoint(): IPointData;
263
- set toPoint(value: IPointData);
264
- constructor(data?: ILineInputData);
265
- __updatePath(): void;
266
- __updateRenderPath(): void;
267
- __updateBoxBounds(): void;
268
- }
269
-
270
- declare class Image extends Rect implements IImage {
271
- get __tag(): string;
272
- __: IImageData;
273
- url: IString;
274
- get ready(): boolean;
275
- image: ILeaferImage;
276
- constructor(data?: IImageInputData);
277
- destroy(): void;
278
- }
279
-
280
- declare class Canvas extends Rect implements ICanvas {
281
- get __tag(): string;
282
- __: ICanvasData;
283
- width: INumber;
284
- height: INumber;
285
- pixelRatio: INumber;
286
- smooth: boolean;
287
- hitFill: IHitType;
288
- canvas: ILeaferCanvas;
289
- context: ICanvasContext2D;
290
- constructor(data?: ICanvasInputData);
291
- draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void;
292
- paint(): void;
293
- __drawAfterFill(canvas: ILeaferCanvas, _options: IRenderOptions): void;
294
- __updateSize(): void;
295
- destroy(): void;
296
- }
297
-
298
- declare class Text extends UI implements IText {
299
- get __tag(): string;
300
- __: ITextData;
301
- width: INumber;
302
- height: INumber;
303
- padding: number | number[];
304
- fill: IFill;
305
- strokeAlign: IStrokeAlign;
306
- hitFill: IHitType$1;
307
- text: IString;
308
- fontFamily: IString;
309
- fontSize: INumber;
310
- fontWeight: IFontWeight;
311
- italic: IBoolean;
312
- textCase: ITextCase;
313
- textDecoration: ITextDecoration;
314
- letterSpacing: INumber | IUnitData;
315
- lineHeight: INumber | IUnitData;
316
- paraIndent: INumber;
317
- paraSpacing: INumber;
318
- textAlign: ITextAlign;
319
- verticalAlign: IVerticalAlign;
320
- textWrap: ITextWrap;
321
- textOverflow: IOverflow | string;
322
- get textDrawData(): ITextDrawData;
323
- constructor(data?: ITextInputData);
324
- __drawHitPath(canvas: ILeaferCanvas): void;
325
- __drawPathByData(drawer: IPathDrawer, _data?: IPathCommandData): void;
326
- __drawRenderPath(canvas: ILeaferCanvas): void;
327
- __updateTextDrawData(): void;
328
- __updateBoxBounds(): void;
329
- __updateRenderSpread(): number;
330
- __updateRenderBounds(): void;
331
- }
332
-
333
- declare class Path extends UI implements IPath {
334
- get __tag(): string;
335
- __: IPathData;
336
- path: IPathCommandData | IPathString$1;
337
- windingRule: IWindingRule;
338
- strokeAlign: IStrokeAlign;
339
- constructor(data?: IPathInputData);
340
- __updateBoxBounds(): void;
341
- }
342
-
343
- declare class Pen extends Group implements IPen {
344
- get __tag(): string;
345
- __: IPenData;
346
- pathElement: IPath;
347
- pathStyle: IPathInputData;
348
- path: IPathCommandData$1;
349
- constructor(data?: IPenInputData);
350
- setStyle(data: IPathInputData): Pen;
351
- beginPath(): Pen;
352
- moveTo(_x: number, _y: number): Pen;
353
- lineTo(_x: number, _y: number): Pen;
354
- bezierCurveTo(_x1: number, _y1: number, _x2: number, _y2: number, _x: number, _y: number): Pen;
355
- quadraticCurveTo(_x1: number, _y1: number, _x: number, _y: number): Pen;
356
- closePath(): Pen;
357
- rect(_x: number, _y: number, _width: number, _height: number): Pen;
358
- roundRect(_x: number, _y: number, _width: number, _height: number, _cornerRadius: number | number[]): Pen;
359
- ellipse(_x: number, _y: number, _radiusX: number, _radiusY: number, _rotation?: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
360
- arc(_x: number, _y: number, _radius: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
361
- arcTo(_x1: number, _y1: number, _x2: number, _y2: number, _radius: number): Pen;
362
- drawEllipse(_x: number, _y: number, _radiusX: number, _radiusY: number, _rotation?: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
363
- drawArc(_x: number, _y: number, _radius: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
364
- drawPoints(_points: number[], _curve?: boolean | number, _close?: boolean): Pen;
365
- paint(): void;
366
- }
367
-
368
- export { Box, Canvas, Ellipse, Frame, Group, Image, Leafer, Line, Path, Pen, Polygon, Rect, Star, Text, UI };