@leafer-ui/data 1.0.0-beta.12 → 1.0.0-beta.15

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,12 +1,15 @@
1
1
  {
2
2
  "name": "@leafer-ui/data",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "@leafer-ui/data",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
7
7
  "main": "src/index.ts",
8
+ "types": "types/index.d.ts",
8
9
  "files": [
9
- "src"
10
+ "src",
11
+ "types",
12
+ "dist"
10
13
  ],
11
14
  "repository": {
12
15
  "type": "git",
@@ -19,10 +22,11 @@
19
22
  "leaferjs"
20
23
  ],
21
24
  "dependencies": {
22
- "@leafer/core": "1.0.0-beta.12"
25
+ "@leafer/core": "1.0.0-beta.15",
26
+ "@leafer-ui/external": "1.0.0-beta.15"
23
27
  },
24
28
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-beta.12",
26
- "@leafer-ui/interface": "1.0.0-beta.12"
29
+ "@leafer/interface": "1.0.0-beta.15",
30
+ "@leafer-ui/interface": "1.0.0-beta.15"
27
31
  }
28
32
  }
package/src/UIData.ts CHANGED
@@ -1,20 +1,26 @@
1
- import { __Value } from '@leafer/interface'
2
- import { LeafData } from '@leafer/core'
1
+ import { __Number, __Value, __Boolean } from '@leafer/interface'
2
+ import { LeafData, Debug } from '@leafer/core'
3
3
 
4
4
  import { IShadowEffect, IUI, IUIData, IUnitData, ILeafPaint } from '@leafer-ui/interface'
5
5
  import { Paint } from '@leafer-ui/external'
6
6
 
7
7
 
8
8
  const emptyPaint: ILeafPaint = {}
9
+ const debug = Debug.get('UIData')
9
10
  export class UIData extends LeafData implements IUIData {
10
11
 
11
- public __leaf: IUI
12
+ declare public __leaf: IUI
12
13
 
13
14
  public __blendLayer?: boolean
14
15
 
15
16
  public __isFills?: boolean
16
17
  public __isStrokes?: boolean
17
18
 
19
+ protected _visible?: __Boolean
20
+
21
+ protected _width?: __Number
22
+ protected _height?: __Number
23
+
18
24
  protected _fill?: __Value
19
25
  protected _stroke?: __Value
20
26
 
@@ -22,6 +28,32 @@ export class UIData extends LeafData implements IUIData {
22
28
  protected _innerShadow?: __Value
23
29
 
24
30
 
31
+ protected setVisible(value: __Boolean) {
32
+ if (this.__leaf.leafer) this.__leaf.leafer.watcher.hasVisible = true
33
+ this._visible = value
34
+ }
35
+
36
+ protected setWidth(value: __Number) {
37
+ if (value < 0) {
38
+ this._width = -value
39
+ this.__leaf.scaleX *= -1
40
+ debug.warn('width < 0, instead -scaleX ', this)
41
+ } else {
42
+ this._width = value
43
+ }
44
+ }
45
+
46
+ protected setHeight(value: __Number) {
47
+ if (value < 0) {
48
+ this._height = -value
49
+ this.__leaf.scaleY *= -1
50
+ debug.warn('height < 0, instead -scaleY', this)
51
+ } else {
52
+ this._height = value
53
+ }
54
+ }
55
+
56
+
25
57
  protected setFill(value: __Value) {
26
58
  if (this.__naturalWidth) this.__naturalWidth = this.__naturalHeight = undefined
27
59
  if (typeof value === 'string' || !value) {
@@ -55,6 +87,7 @@ export class UIData extends LeafData implements IUIData {
55
87
  }
56
88
  }
57
89
 
90
+
58
91
  protected setShadow(value: __Value) {
59
92
  this.__setInput('shadow', value)
60
93
  if (value instanceof Array) {
@@ -0,0 +1,78 @@
1
+ import { __Boolean, __Number, __Value, IPathCommandData } from '@leafer/interface';
2
+ import { LeafData } from '@leafer/core';
3
+ import { IUIData, IUI, IUnitData, IGroupData, IBoxData, ILeaferData, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathString, IPenData, ITextData, IFontWeight, IImageData, ICanvasData } from '@leafer-ui/interface';
4
+
5
+ declare class UIData extends LeafData implements IUIData {
6
+ __leaf: IUI;
7
+ __blendLayer?: boolean;
8
+ __isFills?: boolean;
9
+ __isStrokes?: boolean;
10
+ protected _visible?: __Boolean;
11
+ protected _width?: __Number;
12
+ protected _height?: __Number;
13
+ protected _fill?: __Value;
14
+ protected _stroke?: __Value;
15
+ protected _shadow?: __Value;
16
+ protected _innerShadow?: __Value;
17
+ protected setVisible(value: __Boolean): void;
18
+ protected setWidth(value: __Number): void;
19
+ protected setHeight(value: __Number): void;
20
+ protected setFill(value: __Value): void;
21
+ protected setStroke(value: __Value): void;
22
+ protected setShadow(value: __Value): void;
23
+ protected setInnerShadow(value: __Value): void;
24
+ }
25
+ declare const UnitConvert: {
26
+ number(value: number | IUnitData, percentRefer?: number): number;
27
+ };
28
+
29
+ declare class GroupData extends UIData implements IGroupData {
30
+ }
31
+
32
+ declare class BoxData extends GroupData implements IBoxData {
33
+ get __boxStroke(): boolean;
34
+ }
35
+
36
+ declare class LeaferData extends GroupData implements ILeaferData {
37
+ }
38
+
39
+ declare class FrameData extends BoxData implements IFrameData {
40
+ }
41
+
42
+ declare class LineData extends UIData implements ILineData {
43
+ }
44
+
45
+ declare class RectData extends UIData implements IRectData {
46
+ get __boxStroke(): boolean;
47
+ }
48
+
49
+ declare class EllipseData extends UIData implements IEllipseData {
50
+ get __boxStroke(): boolean;
51
+ }
52
+
53
+ declare class PolygonData extends UIData implements IPolygonData {
54
+ }
55
+
56
+ declare class StarData extends UIData implements IStarData {
57
+ }
58
+
59
+ declare class PathData extends UIData {
60
+ protected _path: IPathCommandData;
61
+ protected setPath(value: IPathCommandData | IPathString): void;
62
+ }
63
+
64
+ declare class PenData extends GroupData implements IPenData {
65
+ }
66
+
67
+ declare class TextData extends UIData implements ITextData {
68
+ protected _fontWeight?: number;
69
+ setFontWeight(value: IFontWeight): void;
70
+ }
71
+
72
+ declare class ImageData extends RectData implements IImageData {
73
+ }
74
+
75
+ declare class CanvasData extends RectData implements ICanvasData {
76
+ }
77
+
78
+ export { BoxData, CanvasData, EllipseData, FrameData, GroupData, ImageData, LeaferData, LineData, PathData, PenData, PolygonData, RectData, StarData, TextData, UIData, UnitConvert };