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