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