@leafer-ui/interface 1.0.0-rc.2 → 1.0.0-rc.20
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 -39
- package/src/IUI.ts +115 -38
- package/src/app/IApp.ts +16 -0
- package/src/app/ILeafer.ts +22 -0
- package/src/editor/IEditor.ts +95 -0
- package/src/index.ts +16 -7
- 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 +29 -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 +34 -3
- package/types/index.d.ts +306 -100
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.20",
|
|
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.20"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/ICommonAttr.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INumber, IBoolean, IString } from '@leafer/interface'
|
|
2
|
+
import { IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, IUnitData, 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: INumber | INumber[] | ICornerRadiusString
|
|
10
|
+
cornerSmoothing: INumber
|
|
9
11
|
}
|
|
10
12
|
export interface ICornerRadiusInputData {
|
|
11
|
-
cornerRadius?:
|
|
12
|
-
cornerSmoothing?:
|
|
13
|
+
cornerRadius?: INumber | INumber[] | 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
42
|
strokeAlign: IStrokeAlign
|
|
41
|
-
strokeWidth:
|
|
43
|
+
strokeWidth: INumber | INumber[] | IStrokeWidthString
|
|
44
|
+
strokeWidthFixed: IBoolean
|
|
42
45
|
strokeCap: IStrokeCap
|
|
43
46
|
strokeJoin: IStrokeJoin
|
|
44
|
-
dashPattern:
|
|
45
|
-
dashOffset:
|
|
46
|
-
miterLimit:
|
|
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?: INumber | INumber[] | 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:
|
|
88
|
+
fontFamily: IString
|
|
89
|
+
fontSize: INumber
|
|
76
90
|
fontWeight: IFontWeight
|
|
77
|
-
italic:
|
|
91
|
+
italic: IBoolean
|
|
78
92
|
textCase: ITextCase
|
|
79
93
|
textDecoration: ITextDecoration
|
|
80
|
-
letterSpacing:
|
|
81
|
-
lineHeight:
|
|
94
|
+
letterSpacing: INumber | IUnitData
|
|
95
|
+
lineHeight: INumber | IUnitData
|
|
82
96
|
|
|
83
|
-
paraIndent:
|
|
84
|
-
paraSpacing:
|
|
97
|
+
paraIndent: INumber
|
|
98
|
+
paraSpacing: INumber
|
|
85
99
|
|
|
86
100
|
textAlign: ITextAlign
|
|
87
101
|
verticalAlign: IVerticalAlign
|
|
88
102
|
|
|
103
|
+
textWrap: ITextWrap
|
|
89
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
147
|
shadow: IShadowEffect | IShadowEffect[] | IShadowString
|
|
130
148
|
innerShadow: IShadowEffect | IShadowEffect[] | IShadowString
|
|
131
|
-
blur:
|
|
132
|
-
backgroundBlur:
|
|
133
|
-
grayscale:
|
|
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 } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
IFillAttrData, IFillInputData, IFillComputedData,
|
|
@@ -9,8 +9,8 @@ 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 {
|
|
@@ -19,12 +19,26 @@ export interface ILine extends IUI {
|
|
|
19
19
|
points: number[]
|
|
20
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 { }
|
|
28
42
|
|
|
29
43
|
|
|
30
44
|
// Rect
|
|
@@ -84,16 +98,10 @@ export interface IStarInputData extends IStarAttrData, IUIBaseInputData { }
|
|
|
84
98
|
// Path
|
|
85
99
|
export interface IPath extends IUI {
|
|
86
100
|
__: IPathData
|
|
87
|
-
path: IPathCommandData | IPathString
|
|
88
|
-
windingRule: IWindingRule
|
|
89
101
|
}
|
|
90
102
|
export interface IPathData extends IUIData {
|
|
91
|
-
path?: IPathCommandData
|
|
92
|
-
windingRule?: IWindingRule
|
|
93
103
|
}
|
|
94
104
|
export interface IPathInputData extends IUIBaseInputData {
|
|
95
|
-
path?: IPathCommandData | IPathString
|
|
96
|
-
windingRule?: IWindingRule
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
// Pen
|
|
@@ -104,7 +112,6 @@ export interface IPen extends IGroup, IPathCreator {
|
|
|
104
112
|
pathStyle: IPathInputData
|
|
105
113
|
path: IPathCommandData
|
|
106
114
|
paint(): void
|
|
107
|
-
clear(): void
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
export interface IPenData extends IGroupData { }
|
|
@@ -124,6 +131,9 @@ export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIDat
|
|
|
124
131
|
__baseLine?: number
|
|
125
132
|
__lineHeight?: number
|
|
126
133
|
__letterSpacing?: number
|
|
134
|
+
__padding?: number[]
|
|
135
|
+
__clipText?: boolean
|
|
136
|
+
__textBoxBounds?: IBoundsData
|
|
127
137
|
}
|
|
128
138
|
export interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
|
|
129
139
|
|
|
@@ -138,9 +148,13 @@ export interface ITextRowData {
|
|
|
138
148
|
data?: ITextCharData[]
|
|
139
149
|
words?: ITextWordData[]
|
|
140
150
|
|
|
151
|
+
startCharSize?: number
|
|
152
|
+
endCharSize?: number
|
|
153
|
+
|
|
141
154
|
paraStart?: boolean // paragraph start
|
|
142
155
|
paraEnd?: boolean // paragraph end
|
|
143
156
|
isOverflow?: boolean
|
|
157
|
+
textMode?: boolean
|
|
144
158
|
}
|
|
145
159
|
|
|
146
160
|
export interface ITextWordData {
|
|
@@ -179,19 +193,21 @@ export interface IImage extends IRect, ILeaferImageConfig {
|
|
|
179
193
|
interface IImageAttrData {
|
|
180
194
|
url?: string
|
|
181
195
|
}
|
|
182
|
-
export interface IImageData extends IImageAttrData, IRectData {
|
|
196
|
+
export interface IImageData extends IImageAttrData, IRectData {
|
|
197
|
+
__setImageFill(value: string): void
|
|
198
|
+
}
|
|
183
199
|
export interface IImageInputData extends IImageAttrData, IUIBaseInputData { }
|
|
184
200
|
|
|
185
201
|
export interface ICanvas extends IRect {
|
|
186
202
|
__: ICanvasData
|
|
187
|
-
pixelRatio: number
|
|
188
203
|
smooth: boolean
|
|
204
|
+
contextSettings: ICanvasContext2DSettings
|
|
189
205
|
canvas: ILeaferCanvas
|
|
190
206
|
__updateSize(): void
|
|
191
207
|
}
|
|
192
208
|
interface ICanvasAttrData {
|
|
193
|
-
pixelRatio?: number
|
|
194
209
|
smooth?: boolean
|
|
210
|
+
contextSettings?: ICanvasContext2DSettings
|
|
195
211
|
}
|
|
196
212
|
export interface ICanvasData extends ICanvasAttrData, IRectData { }
|
|
197
213
|
export interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData { }
|
|
@@ -199,13 +215,19 @@ export interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData { }
|
|
|
199
215
|
|
|
200
216
|
// Leafer
|
|
201
217
|
export interface ILeaferData extends IGroupData {
|
|
202
|
-
|
|
218
|
+
|
|
203
219
|
}
|
|
204
220
|
|
|
205
221
|
export interface ILeaferInputData extends IGroupInputData {
|
|
206
|
-
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface IAppData extends ILeaferData {
|
|
226
|
+
|
|
207
227
|
}
|
|
228
|
+
export interface IAppInputData extends ILeaferInputData {
|
|
208
229
|
|
|
230
|
+
}
|
|
209
231
|
|
|
210
232
|
// Frame
|
|
211
233
|
export interface IFrame extends IBox {
|
|
@@ -238,13 +260,15 @@ export interface IBoxInputData extends IGroupInputData {
|
|
|
238
260
|
export interface IGroup extends IUI {
|
|
239
261
|
__: IGroupData
|
|
240
262
|
children: IUI[]
|
|
241
|
-
|
|
263
|
+
pick(hitPoint: IPointData, options?: IPickOptions): IPickResult
|
|
242
264
|
add(child: IUI, index?: number): void
|
|
243
265
|
addAt(child: IUI, index: number): void
|
|
244
266
|
addAfter(child: IUI, after: IUI): void
|
|
245
267
|
addBefore(child: IUI, before: IUI): void
|
|
268
|
+
addMany(...children: ILeaf[]): void
|
|
246
269
|
remove(child?: IUI): void
|
|
247
270
|
removeAll(): void
|
|
271
|
+
clear(): void
|
|
248
272
|
}
|
|
249
273
|
export interface IGroupData extends IUIData { }
|
|
250
274
|
export interface IGroupInputData extends IUIBaseInputData { }
|
|
@@ -252,45 +276,88 @@ export interface IGroupInputData extends IUIBaseInputData { }
|
|
|
252
276
|
// UI
|
|
253
277
|
export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
254
278
|
__: IUIData
|
|
279
|
+
|
|
280
|
+
readonly app: ILeafer
|
|
281
|
+
leafer?: ILeafer
|
|
255
282
|
parent?: IGroup
|
|
283
|
+
zoomLayer?: IGroup
|
|
284
|
+
readonly isFrame?: boolean
|
|
285
|
+
|
|
286
|
+
proxyData: IUIInputData
|
|
287
|
+
__proxyData?: IUIInputData
|
|
288
|
+
|
|
289
|
+
normalStyle: IUIInputData
|
|
290
|
+
hoverStyle: IUIInputData
|
|
291
|
+
pressStyle: IUIInputData
|
|
292
|
+
focusStyle: IUIInputData
|
|
293
|
+
selectedStyle: IUIInputData
|
|
294
|
+
disabledStyle: IUIInputData
|
|
295
|
+
|
|
296
|
+
editorStyle: IEditorConfig
|
|
297
|
+
|
|
298
|
+
children?: IUI[]
|
|
299
|
+
|
|
300
|
+
reset(data?: IUIInputData): void
|
|
256
301
|
|
|
257
302
|
set(data: IUIInputData): void
|
|
258
303
|
toJSON(): IUIInputData
|
|
259
304
|
|
|
260
|
-
|
|
261
|
-
|
|
305
|
+
get(name?: string | string[] | IUIInputData): IUIInputData | IValue
|
|
306
|
+
createProxyData(): IUIInputData
|
|
307
|
+
|
|
308
|
+
find(condition: number | string | IFindUIMethod, options?: any): IUI[]
|
|
309
|
+
findOne(condition: number | string | IFindUIMethod, options?: any): IUI
|
|
310
|
+
|
|
311
|
+
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData
|
|
312
|
+
getPathString(curve?: boolean, pathForRender?: boolean): IPathString
|
|
262
313
|
|
|
263
314
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
|
|
315
|
+
__drawPathByBox(drawer: IPathDrawer): void
|
|
264
316
|
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
265
317
|
|
|
266
|
-
export(filename: string, options?: IExportOptions | number): Promise<
|
|
318
|
+
export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>
|
|
267
319
|
clone(): IUI
|
|
320
|
+
}
|
|
268
321
|
|
|
322
|
+
export interface IFindUIMethod {
|
|
323
|
+
(leaf: IUI, options?: any): IAnswer
|
|
269
324
|
}
|
|
270
325
|
|
|
271
326
|
export interface IUIData extends IUIComputedData, ILeafData {
|
|
272
327
|
|
|
273
328
|
padding?: number | number[]
|
|
274
|
-
|
|
329
|
+
|
|
330
|
+
normalStyle?: IUIInputData
|
|
331
|
+
hoverStyle?: IUIInputData
|
|
332
|
+
pressStyle?: IUIInputData
|
|
333
|
+
focusStyle?: IUIInputData
|
|
334
|
+
selectedStyle?: IUIInputData
|
|
335
|
+
disabledStyle?: IUIInputData
|
|
336
|
+
|
|
337
|
+
editorStyle?: IEditorConfig
|
|
275
338
|
|
|
276
339
|
// 非数据属性, 自动计算的缓存数据
|
|
277
340
|
__isFills?: boolean
|
|
278
341
|
__isStrokes?: boolean
|
|
279
|
-
__drawAfterFill?: boolean
|
|
280
|
-
__isOverflow?: boolean
|
|
281
|
-
__blendLayer?: boolean
|
|
282
342
|
|
|
283
|
-
|
|
284
|
-
__isTranslucentStroke?: boolean
|
|
343
|
+
readonly __strokeWidth: number
|
|
285
344
|
|
|
286
|
-
|
|
345
|
+
__pixelFill?: boolean // png / svg / webp
|
|
346
|
+
__pixelStroke?: boolean
|
|
287
347
|
|
|
288
|
-
|
|
289
|
-
path?: IPathCommandData
|
|
290
|
-
windingRule?: IWindingRule
|
|
348
|
+
__isHitPixel?: boolean
|
|
291
349
|
|
|
292
|
-
|
|
293
|
-
|
|
350
|
+
__opacityFill?: boolean // 半透明的
|
|
351
|
+
__opacityStroke?: boolean
|
|
352
|
+
|
|
353
|
+
__drawAfterFill?: boolean
|
|
354
|
+
__isOverflow?: boolean
|
|
355
|
+
__blendLayer?: boolean
|
|
356
|
+
|
|
357
|
+
readonly __autoWidth: boolean
|
|
358
|
+
readonly __autoHeight: boolean
|
|
359
|
+
readonly __autoSide: boolean
|
|
360
|
+
readonly __autoSize: boolean
|
|
294
361
|
|
|
295
362
|
__boxStroke?: boolean
|
|
296
363
|
|
|
@@ -298,17 +365,27 @@ export interface IUIData extends IUIComputedData, ILeafData {
|
|
|
298
365
|
__font?: string
|
|
299
366
|
__textDrawData?: ITextDrawData
|
|
300
367
|
|
|
368
|
+
__needComputePaint: boolean
|
|
369
|
+
__computePaint(): void
|
|
370
|
+
|
|
301
371
|
}
|
|
302
372
|
export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
303
373
|
padding?: number | number[]
|
|
304
|
-
|
|
305
|
-
locked?: boolean
|
|
306
374
|
}
|
|
307
375
|
|
|
308
376
|
export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
309
377
|
padding?: number | number[]
|
|
310
|
-
|
|
311
|
-
|
|
378
|
+
|
|
379
|
+
normalStyle?: IUIInputData
|
|
380
|
+
hoverStyle?: IUIInputData
|
|
381
|
+
pressStyle?: IUIInputData
|
|
382
|
+
focusStyle?: IUIInputData
|
|
383
|
+
selectedStyle?: IUIInputData
|
|
384
|
+
disabledStyle?: IUIInputData
|
|
385
|
+
|
|
386
|
+
editorStyle?: IEditorConfig
|
|
387
|
+
|
|
388
|
+
children?: IUIInputData[]
|
|
312
389
|
}
|
|
313
390
|
|
|
314
391
|
|
|
@@ -331,5 +408,5 @@ export type IUITag =
|
|
|
331
408
|
|
|
332
409
|
|
|
333
410
|
export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
|
|
334
|
-
|
|
411
|
+
children?: IUIInputData[]
|
|
335
412
|
}
|
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
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { IGroup, IUI, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAround, IDragEvent, IRotateEvent, IStroke, IFill, ILeaf, IObject, IBoxInputData, IGroupInputData, IImageCursor } from '@leafer-ui/interface'
|
|
2
|
+
|
|
3
|
+
export interface IEditorBase extends IGroup, ISelectorProxy {
|
|
4
|
+
config: IEditorConfig
|
|
5
|
+
|
|
6
|
+
hoverTarget: IUI
|
|
7
|
+
target: IUI | IUI[]
|
|
8
|
+
|
|
9
|
+
readonly list: IUI[]
|
|
10
|
+
|
|
11
|
+
readonly hasTarget: boolean
|
|
12
|
+
readonly multiple: boolean
|
|
13
|
+
readonly single: boolean
|
|
14
|
+
|
|
15
|
+
readonly dragging: boolean
|
|
16
|
+
|
|
17
|
+
element: IUI
|
|
18
|
+
buttons: IGroup
|
|
19
|
+
|
|
20
|
+
selector: IGroup
|
|
21
|
+
editBox: IGroup
|
|
22
|
+
editTool: IObject
|
|
23
|
+
|
|
24
|
+
hasItem(item: IUI): boolean
|
|
25
|
+
shiftItem(item: IUI): void
|
|
26
|
+
addItem(item: IUI): void
|
|
27
|
+
removeItem(item: IUI): void
|
|
28
|
+
|
|
29
|
+
update(): void
|
|
30
|
+
updateEditTool(): void
|
|
31
|
+
|
|
32
|
+
getEditSize(ui: ILeaf): IEditSize
|
|
33
|
+
|
|
34
|
+
onMove(e: IDragEvent): void
|
|
35
|
+
onScale(e: IDragEvent): void
|
|
36
|
+
onRotate(e: IDragEvent | IRotateEvent): void
|
|
37
|
+
onSkew(e: IDragEvent): void
|
|
38
|
+
|
|
39
|
+
group(group?: IGroup | IGroupInputData): IGroup
|
|
40
|
+
ungroup(): IUI[]
|
|
41
|
+
|
|
42
|
+
lock(): void
|
|
43
|
+
unlock(): void
|
|
44
|
+
|
|
45
|
+
toTop(): void
|
|
46
|
+
toBottom(): void
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IEditorConfig {
|
|
50
|
+
editSize?: 'auto' | IEditSize
|
|
51
|
+
dualEvent?: boolean
|
|
52
|
+
keyEvent?: boolean
|
|
53
|
+
|
|
54
|
+
stroke?: IStroke
|
|
55
|
+
strokeWidth?: number
|
|
56
|
+
|
|
57
|
+
pointFill?: IFill
|
|
58
|
+
pointSize?: number
|
|
59
|
+
pointRadius?: number
|
|
60
|
+
|
|
61
|
+
point?: IBoxInputData | IBoxInputData[]
|
|
62
|
+
middlePoint?: IBoxInputData | IBoxInputData[]
|
|
63
|
+
rotatePoint?: IBoxInputData
|
|
64
|
+
|
|
65
|
+
rect?: IBoxInputData
|
|
66
|
+
area?: IRectInputData
|
|
67
|
+
|
|
68
|
+
buttonsDirection?: 'top' | 'right' | 'bottom' | 'left'
|
|
69
|
+
buttonsFixed?: boolean
|
|
70
|
+
buttonsMargin?: number
|
|
71
|
+
|
|
72
|
+
hideOnMove?: boolean
|
|
73
|
+
hideOnSmall?: boolean | number
|
|
74
|
+
|
|
75
|
+
moveCursor?: ICursorType
|
|
76
|
+
resizeCursor?: IImageCursor
|
|
77
|
+
rotateCursor?: IImageCursor
|
|
78
|
+
skewCursor?: IImageCursor
|
|
79
|
+
|
|
80
|
+
around?: IAround
|
|
81
|
+
lockRatio?: boolean | 'corner'
|
|
82
|
+
lockMove?: boolean | 'x' | 'y'
|
|
83
|
+
rotateGap?: number
|
|
84
|
+
|
|
85
|
+
selector?: boolean
|
|
86
|
+
hover?: boolean
|
|
87
|
+
select?: 'press' | 'tap'
|
|
88
|
+
boxSelect?: boolean
|
|
89
|
+
continuousSelect?: boolean // 点击可以连续选择
|
|
90
|
+
|
|
91
|
+
moveable?: boolean
|
|
92
|
+
rotateable?: boolean
|
|
93
|
+
resizeable?: boolean
|
|
94
|
+
skewable?: boolean
|
|
95
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export * from '@leafer/interface'
|
|
2
2
|
|
|
3
|
+
export { IApp, IAppConfig } from './app/IApp'
|
|
4
|
+
export { ILeafer } from './app/ILeafer'
|
|
5
|
+
|
|
3
6
|
export {
|
|
4
7
|
ILine, ILineInputData, ILineData,
|
|
8
|
+
IArrow, IArrowInputData, IArrowData,
|
|
5
9
|
IRect, IRectInputData, IRectData,
|
|
6
10
|
IEllipse, IEllipseInputData, IEllipseData,
|
|
7
11
|
IPolygon, IPolygonInputData, IPolygonData,
|
|
@@ -15,21 +19,26 @@ export {
|
|
|
15
19
|
IBox, IBoxInputData, IBoxData,
|
|
16
20
|
IGroup, IGroupInputData, IGroupData,
|
|
17
21
|
ILeaferInputData, ILeaferData,
|
|
18
|
-
|
|
22
|
+
IAppInputData, IAppData,
|
|
23
|
+
IUI, IUIBaseInputData, IUIData, IFindUIMethod,
|
|
19
24
|
IUITag, IUIInputData
|
|
20
25
|
} from './IUI'
|
|
21
|
-
|
|
22
|
-
export {
|
|
26
|
+
|
|
27
|
+
export { IUnitData, IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IPathDataArrow, IPathDataArrowMap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat } from './type/IType'
|
|
28
|
+
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString } from './type/IStringType'
|
|
23
29
|
export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
24
30
|
|
|
25
31
|
export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
|
|
26
32
|
export { IUIBoundsModule } from './module/IUIBounds'
|
|
27
33
|
export { IUIHitModule } from './module/IUIHit'
|
|
34
|
+
export { IPathArrowModule } from './module/IPathArrow'
|
|
28
35
|
export { ITextConvertModule } from './module/ITextConvert'
|
|
29
36
|
export { IColorConvertModule } from './module/IColorConvert'
|
|
30
|
-
export { IExportModule
|
|
37
|
+
export { IExportModule } from './module/IExport'
|
|
38
|
+
export { IStateModule } from './module/IState'
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
export { IPaintModule } from './module/IPaint'
|
|
40
|
+
export { IPaintModule, IPaintImageModule, IPaintGradientModule } from './module/IPaint'
|
|
34
41
|
export { IEffectModule } from './module/IEffect'
|
|
35
|
-
export { ICachedShape } from './ICachedShape'
|
|
42
|
+
export { ICachedShape } from './ICachedShape'
|
|
43
|
+
|
|
44
|
+
export { IEditorBase, IEditorConfig } from './editor/IEditor'
|