@leafer-ui/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.
- package/package.json +2 -2
- package/src/ICommonAttr.ts +68 -50
- package/src/IUI.ts +150 -53
- package/src/app/IApp.ts +16 -0
- package/src/app/ILeafer.ts +22 -0
- package/src/editor/IEditor.ts +163 -0
- package/src/index.ts +19 -8
- package/src/module/IColorConvert.ts +1 -1
- package/src/module/IEffect.ts +5 -5
- package/src/module/IExport.ts +3 -15
- package/src/module/IPaint.ts +32 -13
- package/src/module/IPathArrow.ts +8 -0
- package/src/module/IState.ts +11 -0
- package/src/module/ITextConvert.ts +1 -1
- package/src/type/IComputedType.ts +3 -1
- package/src/type/IType.ts +41 -12
- package/types/index.d.ts +411 -137
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interface",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.30",
|
|
4
4
|
"description": "@leafer-ui/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-rc.
|
|
25
|
+
"@leafer/interface": "1.0.0-rc.30"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/ICommonAttr.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INumber, IBoolean, IString, IFourNumber, IUnitData } from '@leafer/interface'
|
|
2
|
+
import { IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IStroke, IFill, IArrowType } from './type/IType'
|
|
2
3
|
import { ILeafStrokePaint, ILeafShadowEffect, ILeafPaint } from './type/IComputedType'
|
|
3
|
-
import {
|
|
4
|
+
import { IDashPatternString, IShadowString, IColorString, IStrokeWidthString, ICornerRadiusString } from './type/IStringType'
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
// corner---
|
|
6
8
|
export interface ICornerRadiusAttrData {
|
|
7
|
-
cornerRadius
|
|
8
|
-
cornerSmoothing
|
|
9
|
+
cornerRadius?: IFourNumber | ICornerRadiusString
|
|
10
|
+
cornerSmoothing?: INumber
|
|
9
11
|
}
|
|
10
12
|
export interface ICornerRadiusInputData {
|
|
11
|
-
cornerRadius?:
|
|
12
|
-
cornerSmoothing?:
|
|
13
|
+
cornerRadius?: IFourNumber | ICornerRadiusString
|
|
14
|
+
cornerSmoothing?: INumber
|
|
13
15
|
}
|
|
14
16
|
export interface ICornerRadiusComputedData {
|
|
15
17
|
cornerRadius?: number
|
|
@@ -18,10 +20,10 @@ export interface ICornerRadiusComputedData {
|
|
|
18
20
|
|
|
19
21
|
// fill---
|
|
20
22
|
export interface IFillAttrData {
|
|
21
|
-
fill
|
|
23
|
+
fill?: IFill
|
|
22
24
|
}
|
|
23
25
|
export interface IFillInputData {
|
|
24
|
-
fill?:
|
|
26
|
+
fill?: IFill
|
|
25
27
|
}
|
|
26
28
|
export interface IFillComputedData {
|
|
27
29
|
fill?: IColorString | ILeafPaint[]
|
|
@@ -35,26 +37,34 @@ export interface IBorderComputedData {
|
|
|
35
37
|
|
|
36
38
|
// stroke---
|
|
37
39
|
export interface IStrokeAttrData {
|
|
38
|
-
stroke
|
|
40
|
+
stroke?: IStroke
|
|
39
41
|
|
|
40
|
-
strokeAlign
|
|
41
|
-
strokeWidth
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
strokeAlign?: IStrokeAlign
|
|
43
|
+
strokeWidth?: IFourNumber | IStrokeWidthString
|
|
44
|
+
strokeWidthFixed?: IBoolean
|
|
45
|
+
strokeCap?: IStrokeCap
|
|
46
|
+
strokeJoin?: IStrokeJoin
|
|
47
|
+
dashPattern?: INumber[] | IDashPatternString
|
|
48
|
+
dashOffset?: INumber
|
|
49
|
+
miterLimit?: INumber
|
|
50
|
+
|
|
51
|
+
startArrow?: IArrowType
|
|
52
|
+
endArrow?: IArrowType
|
|
47
53
|
}
|
|
48
54
|
export interface IStrokeInputData {
|
|
49
|
-
stroke?:
|
|
55
|
+
stroke?: IStroke
|
|
50
56
|
|
|
51
57
|
strokeAlign?: IStrokeAlign
|
|
52
|
-
strokeWidth?:
|
|
58
|
+
strokeWidth?: IFourNumber | IStrokeWidthString
|
|
59
|
+
strokeWidthFixed?: IBoolean
|
|
53
60
|
strokeCap?: IStrokeCap
|
|
54
61
|
strokeJoin?: IStrokeJoin
|
|
55
|
-
dashPattern?:
|
|
56
|
-
dashOffset?:
|
|
57
|
-
miterLimit?:
|
|
62
|
+
dashPattern?: INumber[] | IDashPatternString
|
|
63
|
+
dashOffset?: INumber
|
|
64
|
+
miterLimit?: INumber
|
|
65
|
+
|
|
66
|
+
startArrow?: IArrowType
|
|
67
|
+
endArrow?: IArrowType
|
|
58
68
|
}
|
|
59
69
|
export interface IStrokeComputedData {
|
|
60
70
|
stroke?: IColorString | ILeafStrokePaint[]
|
|
@@ -62,48 +72,54 @@ export interface IStrokeComputedData {
|
|
|
62
72
|
strokeAlign?: IStrokeAlign
|
|
63
73
|
strokeWidth?: number
|
|
64
74
|
strokeWidths?: number[]
|
|
75
|
+
strokeWidthFixed?: boolean
|
|
65
76
|
strokeCap?: IStrokeCap
|
|
66
77
|
strokeJoin?: IStrokeJoin
|
|
67
78
|
dashPattern?: number[]
|
|
68
79
|
dashOffset?: number
|
|
69
80
|
miterLimit?: number
|
|
81
|
+
|
|
82
|
+
startArrow?: IArrowType
|
|
83
|
+
endArrow?: IArrowType
|
|
70
84
|
}
|
|
71
85
|
|
|
72
86
|
// text---
|
|
73
87
|
export interface ITextStyleAttrData {
|
|
74
|
-
fontFamily
|
|
75
|
-
fontSize
|
|
76
|
-
fontWeight
|
|
77
|
-
italic
|
|
78
|
-
textCase
|
|
79
|
-
textDecoration
|
|
80
|
-
letterSpacing
|
|
81
|
-
lineHeight
|
|
88
|
+
fontFamily?: IString
|
|
89
|
+
fontSize?: INumber
|
|
90
|
+
fontWeight?: IFontWeight
|
|
91
|
+
italic?: IBoolean
|
|
92
|
+
textCase?: ITextCase
|
|
93
|
+
textDecoration?: ITextDecoration
|
|
94
|
+
letterSpacing?: INumber | IUnitData
|
|
95
|
+
lineHeight?: INumber | IUnitData
|
|
82
96
|
|
|
83
|
-
paraIndent
|
|
84
|
-
paraSpacing
|
|
97
|
+
paraIndent?: INumber
|
|
98
|
+
paraSpacing?: INumber
|
|
85
99
|
|
|
86
|
-
textAlign
|
|
87
|
-
verticalAlign
|
|
100
|
+
textAlign?: ITextAlign
|
|
101
|
+
verticalAlign?: IVerticalAlign
|
|
88
102
|
|
|
89
|
-
|
|
103
|
+
textWrap?: ITextWrap
|
|
104
|
+
textOverflow?: IOverflow | string
|
|
90
105
|
}
|
|
91
106
|
export interface ITextStyleInputData {
|
|
92
|
-
fontFamily?:
|
|
93
|
-
fontSize?:
|
|
107
|
+
fontFamily?: IString
|
|
108
|
+
fontSize?: INumber
|
|
94
109
|
fontWeight?: IFontWeight
|
|
95
|
-
italic?:
|
|
110
|
+
italic?: IBoolean
|
|
96
111
|
textCase?: ITextCase
|
|
97
112
|
textDecoration?: ITextDecoration
|
|
98
|
-
letterSpacing?:
|
|
99
|
-
lineHeight?:
|
|
113
|
+
letterSpacing?: INumber | IUnitData
|
|
114
|
+
lineHeight?: INumber | IUnitData
|
|
100
115
|
|
|
101
|
-
paraIndent?:
|
|
102
|
-
paraSpacing?:
|
|
116
|
+
paraIndent?: INumber
|
|
117
|
+
paraSpacing?: INumber
|
|
103
118
|
|
|
104
119
|
textAlign?: ITextAlign
|
|
105
120
|
verticalAlign?: IVerticalAlign
|
|
106
121
|
|
|
122
|
+
textWrap?: ITextWrap
|
|
107
123
|
textOverflow?: IOverflow | string
|
|
108
124
|
}
|
|
109
125
|
export interface ITextStyleComputedData {
|
|
@@ -121,23 +137,25 @@ export interface ITextStyleComputedData {
|
|
|
121
137
|
|
|
122
138
|
textAlign?: ITextAlign
|
|
123
139
|
verticalAlign?: IVerticalAlign
|
|
124
|
-
|
|
140
|
+
|
|
141
|
+
textWrap?: ITextWrap
|
|
142
|
+
textOverflow?: IOverflow | string
|
|
125
143
|
}
|
|
126
144
|
|
|
127
145
|
// effect---
|
|
128
146
|
export interface IEffectAttrData {
|
|
129
|
-
shadow
|
|
130
|
-
innerShadow
|
|
131
|
-
blur
|
|
132
|
-
backgroundBlur
|
|
133
|
-
grayscale
|
|
147
|
+
shadow?: IShadowEffect | IShadowEffect[] | IShadowString
|
|
148
|
+
innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString
|
|
149
|
+
blur?: INumber | IBlurEffect
|
|
150
|
+
backgroundBlur?: INumber | IBlurEffect
|
|
151
|
+
grayscale?: INumber | IGrayscaleEffect
|
|
134
152
|
}
|
|
135
153
|
export interface IEffectInputData {
|
|
136
154
|
shadow?: IShadowEffect | IShadowEffect[] | IShadowString
|
|
137
155
|
innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString
|
|
138
|
-
blur?:
|
|
139
|
-
backgroundBlur?:
|
|
140
|
-
grayscale?:
|
|
156
|
+
blur?: INumber | IBlurEffect
|
|
157
|
+
backgroundBlur?: INumber | IBlurEffect
|
|
158
|
+
grayscale?: INumber | IGrayscaleEffect
|
|
141
159
|
}
|
|
142
160
|
export interface IEffectComputedData {
|
|
143
161
|
shadow?: ILeafShadowEffect[]
|
package/src/IUI.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions,
|
|
1
|
+
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition, IBoolean, ICanvasContext2D, IJSONOptions, IMatrixData } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
IFillAttrData, IFillInputData, IFillComputedData,
|
|
@@ -9,22 +9,47 @@ import {
|
|
|
9
9
|
ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData
|
|
10
10
|
} from './ICommonAttr'
|
|
11
11
|
import { IOverflow } from './type/IType'
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import { ILeafer } from './app/ILeafer'
|
|
13
|
+
import { IEditorConfig } from './editor/IEditor'
|
|
14
14
|
|
|
15
15
|
// Line
|
|
16
16
|
export interface ILine extends IUI {
|
|
17
17
|
__: ILineData
|
|
18
|
-
toPoint
|
|
19
|
-
points
|
|
20
|
-
curve
|
|
18
|
+
toPoint?: IPointData
|
|
19
|
+
points?: number[]
|
|
20
|
+
curve?: boolean | number
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
interface ILineAttrData {
|
|
24
24
|
toPoint?: IPointData
|
|
25
25
|
points?: number[]
|
|
26
26
|
curve?: boolean | number
|
|
27
27
|
}
|
|
28
|
+
export interface ILineData extends ILineAttrData, IUIData { }
|
|
29
|
+
export interface ILineInputData extends ILineAttrData, IUIBaseInputData { }
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// Arrow
|
|
33
|
+
export interface IArrow extends ILine {
|
|
34
|
+
__: IArrowData
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface IArrowAttrData {
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
export interface IArrowData extends IArrowAttrData, ILineData { }
|
|
41
|
+
export interface IArrowInputData extends IArrowAttrData, ILineInputData { }
|
|
42
|
+
|
|
43
|
+
// Flow
|
|
44
|
+
export interface IFlow extends IBox {
|
|
45
|
+
__: IFlowData
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface IFlowAttrData {
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
export interface IFlowData extends IFlowAttrData, IBoxData { }
|
|
52
|
+
export interface IFlowInputData extends IFlowAttrData, IBoxInputData { }
|
|
28
53
|
|
|
29
54
|
|
|
30
55
|
// Rect
|
|
@@ -38,9 +63,9 @@ export interface IRectInputData extends IUIBaseInputData { }
|
|
|
38
63
|
// Ellipse
|
|
39
64
|
export interface IEllipse extends IUI {
|
|
40
65
|
__: IEllipseData
|
|
41
|
-
startAngle
|
|
42
|
-
endAngle
|
|
43
|
-
innerRadius
|
|
66
|
+
startAngle?: number
|
|
67
|
+
endAngle?: number
|
|
68
|
+
innerRadius?: number
|
|
44
69
|
}
|
|
45
70
|
interface IEllipseAttrData {
|
|
46
71
|
startAngle?: number
|
|
@@ -54,9 +79,9 @@ export interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
|
|
|
54
79
|
// Polygon
|
|
55
80
|
export interface IPolygon extends IUI {
|
|
56
81
|
__: IPolygonData
|
|
57
|
-
sides
|
|
58
|
-
points
|
|
59
|
-
curve
|
|
82
|
+
sides?: number
|
|
83
|
+
points?: number[]
|
|
84
|
+
curve?: boolean | number
|
|
60
85
|
}
|
|
61
86
|
interface IPolygonAttrData {
|
|
62
87
|
sides?: number
|
|
@@ -70,8 +95,8 @@ export interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
|
|
|
70
95
|
// Star
|
|
71
96
|
export interface IStar extends IUI {
|
|
72
97
|
__: IStarData
|
|
73
|
-
corners
|
|
74
|
-
innerRadius
|
|
98
|
+
corners?: number
|
|
99
|
+
innerRadius?: number
|
|
75
100
|
}
|
|
76
101
|
interface IStarAttrData {
|
|
77
102
|
corners?: number
|
|
@@ -84,16 +109,10 @@ export interface IStarInputData extends IStarAttrData, IUIBaseInputData { }
|
|
|
84
109
|
// Path
|
|
85
110
|
export interface IPath extends IUI {
|
|
86
111
|
__: IPathData
|
|
87
|
-
path: IPathCommandData | IPathString
|
|
88
|
-
windingRule: IWindingRule
|
|
89
112
|
}
|
|
90
113
|
export interface IPathData extends IUIData {
|
|
91
|
-
path?: IPathCommandData
|
|
92
|
-
windingRule?: IWindingRule
|
|
93
114
|
}
|
|
94
115
|
export interface IPathInputData extends IUIBaseInputData {
|
|
95
|
-
path?: IPathCommandData | IPathString
|
|
96
|
-
windingRule?: IWindingRule
|
|
97
116
|
}
|
|
98
117
|
|
|
99
118
|
// Pen
|
|
@@ -104,7 +123,6 @@ export interface IPen extends IGroup, IPathCreator {
|
|
|
104
123
|
pathStyle: IPathInputData
|
|
105
124
|
path: IPathCommandData
|
|
106
125
|
paint(): void
|
|
107
|
-
clear(): void
|
|
108
126
|
}
|
|
109
127
|
|
|
110
128
|
export interface IPenData extends IGroupData { }
|
|
@@ -114,16 +132,23 @@ export interface IPenInputData extends IGroupInputData { }
|
|
|
114
132
|
// Text
|
|
115
133
|
export interface IText extends ITextStyleAttrData, IUI {
|
|
116
134
|
__: ITextData
|
|
117
|
-
text
|
|
135
|
+
text?: string
|
|
136
|
+
padding?: IFourNumber
|
|
137
|
+
resizeFontSize?: IBoolean
|
|
118
138
|
}
|
|
119
139
|
interface ITextAttrData {
|
|
120
140
|
text?: string
|
|
141
|
+
padding?: IFourNumber
|
|
142
|
+
resizeFontSize?: boolean
|
|
121
143
|
}
|
|
122
144
|
|
|
123
145
|
export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
124
146
|
__baseLine?: number
|
|
125
147
|
__lineHeight?: number
|
|
126
148
|
__letterSpacing?: number
|
|
149
|
+
__padding?: number[]
|
|
150
|
+
__clipText?: boolean
|
|
151
|
+
__textBoxBounds?: IBoundsData
|
|
127
152
|
}
|
|
128
153
|
export interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
|
|
129
154
|
|
|
@@ -144,6 +169,7 @@ export interface ITextRowData {
|
|
|
144
169
|
paraStart?: boolean // paragraph start
|
|
145
170
|
paraEnd?: boolean // paragraph end
|
|
146
171
|
isOverflow?: boolean
|
|
172
|
+
textMode?: boolean
|
|
147
173
|
}
|
|
148
174
|
|
|
149
175
|
export interface ITextWordData {
|
|
@@ -182,19 +208,22 @@ export interface IImage extends IRect, ILeaferImageConfig {
|
|
|
182
208
|
interface IImageAttrData {
|
|
183
209
|
url?: string
|
|
184
210
|
}
|
|
185
|
-
export interface IImageData extends IImageAttrData, IRectData {
|
|
211
|
+
export interface IImageData extends IImageAttrData, IRectData {
|
|
212
|
+
__setImageFill(value: string): void
|
|
213
|
+
}
|
|
186
214
|
export interface IImageInputData extends IImageAttrData, IUIBaseInputData { }
|
|
187
215
|
|
|
188
216
|
export interface ICanvas extends IRect {
|
|
189
217
|
__: ICanvasData
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
canvas
|
|
218
|
+
smooth?: boolean
|
|
219
|
+
contextSettings?: ICanvasContext2DSettings
|
|
220
|
+
canvas?: ILeaferCanvas
|
|
221
|
+
context?: ICanvasContext2D
|
|
193
222
|
__updateSize(): void
|
|
194
223
|
}
|
|
195
224
|
interface ICanvasAttrData {
|
|
196
|
-
pixelRatio?: number
|
|
197
225
|
smooth?: boolean
|
|
226
|
+
contextSettings?: ICanvasContext2DSettings
|
|
198
227
|
}
|
|
199
228
|
export interface ICanvasData extends ICanvasAttrData, IRectData { }
|
|
200
229
|
export interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData { }
|
|
@@ -202,13 +231,19 @@ export interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData { }
|
|
|
202
231
|
|
|
203
232
|
// Leafer
|
|
204
233
|
export interface ILeaferData extends IGroupData {
|
|
205
|
-
|
|
234
|
+
|
|
206
235
|
}
|
|
207
236
|
|
|
208
237
|
export interface ILeaferInputData extends IGroupInputData {
|
|
209
|
-
|
|
238
|
+
|
|
210
239
|
}
|
|
211
240
|
|
|
241
|
+
export interface IAppData extends ILeaferData {
|
|
242
|
+
|
|
243
|
+
}
|
|
244
|
+
export interface IAppInputData extends ILeaferInputData {
|
|
245
|
+
|
|
246
|
+
}
|
|
212
247
|
|
|
213
248
|
// Frame
|
|
214
249
|
export interface IFrame extends IBox {
|
|
@@ -225,14 +260,17 @@ export interface IFrameInputData extends IBoxInputData {
|
|
|
225
260
|
// Box
|
|
226
261
|
export interface IBox extends IGroup {
|
|
227
262
|
__: IBoxData
|
|
228
|
-
|
|
263
|
+
resizeChildren?: IBoolean
|
|
264
|
+
overflow?: IOverflow
|
|
229
265
|
__updateRectRenderBounds(): void
|
|
230
266
|
__renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
231
267
|
}
|
|
232
268
|
export interface IBoxData extends IGroupData {
|
|
269
|
+
resizeChildren?: boolean
|
|
233
270
|
overflow?: IOverflow
|
|
234
271
|
}
|
|
235
272
|
export interface IBoxInputData extends IGroupInputData {
|
|
273
|
+
resizeChildren?: boolean
|
|
236
274
|
overflow?: IOverflow
|
|
237
275
|
}
|
|
238
276
|
|
|
@@ -241,13 +279,15 @@ export interface IBoxInputData extends IGroupInputData {
|
|
|
241
279
|
export interface IGroup extends IUI {
|
|
242
280
|
__: IGroupData
|
|
243
281
|
children: IUI[]
|
|
244
|
-
|
|
282
|
+
pick(hitPoint: IPointData, options?: IPickOptions): IPickResult
|
|
245
283
|
add(child: IUI, index?: number): void
|
|
246
284
|
addAt(child: IUI, index: number): void
|
|
247
285
|
addAfter(child: IUI, after: IUI): void
|
|
248
286
|
addBefore(child: IUI, before: IUI): void
|
|
287
|
+
addMany(...children: ILeaf[]): void
|
|
249
288
|
remove(child?: IUI): void
|
|
250
289
|
removeAll(): void
|
|
290
|
+
clear(): void
|
|
251
291
|
}
|
|
252
292
|
export interface IGroupData extends IUIData { }
|
|
253
293
|
export interface IGroupInputData extends IUIBaseInputData { }
|
|
@@ -255,45 +295,90 @@ export interface IGroupInputData extends IUIBaseInputData { }
|
|
|
255
295
|
// UI
|
|
256
296
|
export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
257
297
|
__: IUIData
|
|
298
|
+
|
|
299
|
+
readonly app: ILeafer
|
|
300
|
+
leafer?: ILeafer
|
|
258
301
|
parent?: IGroup
|
|
302
|
+
zoomLayer?: IGroup
|
|
303
|
+
readonly isFrame?: boolean
|
|
304
|
+
|
|
305
|
+
proxyData?: IUIInputData
|
|
306
|
+
__proxyData?: IUIInputData
|
|
307
|
+
|
|
308
|
+
normalStyle?: IUIInputData
|
|
309
|
+
hoverStyle?: IUIInputData
|
|
310
|
+
pressStyle?: IUIInputData
|
|
311
|
+
focusStyle?: IUIInputData
|
|
312
|
+
selectedStyle?: IUIInputData
|
|
313
|
+
disabledStyle?: IUIInputData
|
|
314
|
+
|
|
315
|
+
editConfig?: IEditorConfig
|
|
316
|
+
editOuter: string
|
|
317
|
+
editInner: string
|
|
318
|
+
|
|
319
|
+
children?: IUI[]
|
|
320
|
+
|
|
321
|
+
readonly pen: IPathCreator
|
|
322
|
+
|
|
323
|
+
reset(data?: IUIInputData): void
|
|
259
324
|
|
|
260
325
|
set(data: IUIInputData): void
|
|
261
|
-
toJSON():
|
|
326
|
+
toJSON(options?: IJSONOptions): IUIJSONData
|
|
327
|
+
|
|
328
|
+
get(name?: string | string[] | IUIInputData): IUIInputData | IValue
|
|
329
|
+
createProxyData(): IUIInputData
|
|
330
|
+
|
|
331
|
+
find(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI[]
|
|
332
|
+
findTag(tag: string | string[]): IUI[]
|
|
333
|
+
findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI | undefined
|
|
334
|
+
findId(id: number | string): IUI | undefined
|
|
262
335
|
|
|
263
|
-
getPath(curve?: boolean): IPathCommandData
|
|
264
|
-
getPathString(curve?: boolean): IPathString
|
|
336
|
+
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData
|
|
337
|
+
getPathString(curve?: boolean, pathForRender?: boolean): IPathString
|
|
338
|
+
|
|
339
|
+
load(): void
|
|
265
340
|
|
|
266
341
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
|
|
342
|
+
__drawPathByBox(drawer: IPathDrawer): void
|
|
267
343
|
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
268
344
|
|
|
269
|
-
export(filename: string, options?: IExportOptions | number): Promise<
|
|
345
|
+
export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>
|
|
270
346
|
clone(): IUI
|
|
347
|
+
}
|
|
271
348
|
|
|
349
|
+
export interface IFindUIMethod {
|
|
350
|
+
(leaf: IUI, options?: any): IAnswer
|
|
272
351
|
}
|
|
273
352
|
|
|
274
353
|
export interface IUIData extends IUIComputedData, ILeafData {
|
|
275
354
|
|
|
276
355
|
padding?: number | number[]
|
|
277
|
-
|
|
356
|
+
|
|
357
|
+
normalStyle?: IUIInputData
|
|
358
|
+
hoverStyle?: IUIInputData
|
|
359
|
+
pressStyle?: IUIInputData
|
|
360
|
+
focusStyle?: IUIInputData
|
|
361
|
+
selectedStyle?: IUIInputData
|
|
362
|
+
disabledStyle?: IUIInputData
|
|
278
363
|
|
|
279
364
|
// 非数据属性, 自动计算的缓存数据
|
|
280
365
|
__isFills?: boolean
|
|
281
366
|
__isStrokes?: boolean
|
|
282
|
-
__drawAfterFill?: boolean
|
|
283
|
-
__isOverflow?: boolean
|
|
284
|
-
__blendLayer?: boolean
|
|
285
367
|
|
|
286
|
-
|
|
287
|
-
__isTranslucentStroke?: boolean
|
|
368
|
+
readonly __strokeWidth: number
|
|
288
369
|
|
|
289
|
-
|
|
370
|
+
__pixelFill?: boolean // png / svg / webp
|
|
371
|
+
__pixelStroke?: boolean
|
|
290
372
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
windingRule?: IWindingRule
|
|
373
|
+
__isHitPixel?: boolean
|
|
374
|
+
__isCanvas?: boolean // canvas 等需单独绘制的元素
|
|
294
375
|
|
|
295
|
-
|
|
296
|
-
|
|
376
|
+
__opacityFill?: boolean // 半透明的
|
|
377
|
+
__opacityStroke?: boolean
|
|
378
|
+
|
|
379
|
+
__drawAfterFill?: boolean
|
|
380
|
+
__isOverflow?: boolean
|
|
381
|
+
__blendLayer?: boolean
|
|
297
382
|
|
|
298
383
|
__boxStroke?: boolean
|
|
299
384
|
|
|
@@ -301,17 +386,25 @@ export interface IUIData extends IUIComputedData, ILeafData {
|
|
|
301
386
|
__font?: string
|
|
302
387
|
__textDrawData?: ITextDrawData
|
|
303
388
|
|
|
389
|
+
__needComputePaint: boolean
|
|
390
|
+
__computePaint(): void
|
|
391
|
+
|
|
304
392
|
}
|
|
305
393
|
export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
306
394
|
padding?: number | number[]
|
|
307
|
-
|
|
308
|
-
locked?: boolean
|
|
309
395
|
}
|
|
310
396
|
|
|
311
397
|
export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
312
398
|
padding?: number | number[]
|
|
313
|
-
|
|
314
|
-
|
|
399
|
+
|
|
400
|
+
normalStyle?: IUIInputData
|
|
401
|
+
hoverStyle?: IUIInputData
|
|
402
|
+
pressStyle?: IUIInputData
|
|
403
|
+
focusStyle?: IUIInputData
|
|
404
|
+
selectedStyle?: IUIInputData
|
|
405
|
+
disabledStyle?: IUIInputData
|
|
406
|
+
|
|
407
|
+
children?: IUIInputData[]
|
|
315
408
|
}
|
|
316
409
|
|
|
317
410
|
|
|
@@ -334,5 +427,9 @@ export type IUITag =
|
|
|
334
427
|
|
|
335
428
|
|
|
336
429
|
export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
|
|
430
|
+
children?: IUIInputData[]
|
|
431
|
+
}
|
|
337
432
|
|
|
433
|
+
export interface IUIJSONData extends IUIInputData {
|
|
434
|
+
matrix?: IMatrixData
|
|
338
435
|
}
|
package/src/app/IApp.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ILeaferConfig } from '@leafer/interface'
|
|
2
|
+
|
|
3
|
+
import { ILeafer } from './ILeafer'
|
|
4
|
+
import { IEditorConfig } from '../editor/IEditor'
|
|
5
|
+
|
|
6
|
+
export interface IApp extends ILeafer {
|
|
7
|
+
children: ILeafer[]
|
|
8
|
+
realCanvas: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IAppConfig extends ILeaferConfig {
|
|
12
|
+
ground?: ILeaferConfig
|
|
13
|
+
tree?: ILeaferConfig
|
|
14
|
+
sky?: ILeaferConfig
|
|
15
|
+
editor?: IEditorConfig
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IControl, ILeaferAttrData, ILeaferConfig, ILeaferType } from '@leafer/interface'
|
|
2
|
+
import { IApp } from './IApp'
|
|
3
|
+
import { IGroup } from '../IUI'
|
|
4
|
+
import { IEditorBase } from '../editor/IEditor'
|
|
5
|
+
|
|
6
|
+
export interface ILeafer extends IGroup, ILeaferAttrData, IControl {
|
|
7
|
+
readonly isApp: boolean
|
|
8
|
+
readonly app: ILeafer
|
|
9
|
+
parent?: IApp
|
|
10
|
+
zoomLayer: IGroup
|
|
11
|
+
editor: IEditorBase
|
|
12
|
+
|
|
13
|
+
ground?: ILeafer
|
|
14
|
+
tree?: ILeafer
|
|
15
|
+
sky?: ILeafer
|
|
16
|
+
|
|
17
|
+
userConfig?: ILeaferConfig
|
|
18
|
+
|
|
19
|
+
onInit(): void
|
|
20
|
+
initType(type: ILeaferType): void
|
|
21
|
+
destroy(sync?: boolean): void
|
|
22
|
+
}
|