@leafer-ui/interface 1.0.0-alpha.9 → 1.0.0-bate
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 +28 -12
- package/src/IUI.ts +165 -33
- package/src/index.ts +9 -4
- package/src/module/IPaint.ts +14 -1
- package/src/module/IUIRender.ts +19 -7
- package/src/type/IComputedType.ts +4 -4
- package/src/type/IType.ts +29 -38
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-bate",
|
|
4
4
|
"description": "@leafer-ui/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/interface": "1.0.0-
|
|
22
|
+
"@leafer/interface": "1.0.0-bate"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/src/ICommonAttr.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IPaint, IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect } from './type/IType'
|
|
1
|
+
import { IPaint, IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, IUnitData } from './type/IType'
|
|
2
2
|
import { ILeafStrokePaint, ILeafShadowEffect, ILeafPaint } from './type/IComputedType'
|
|
3
|
-
import { IPaintString, IDashPatternString,
|
|
3
|
+
import { IPaintString, IDashPatternString, IShadowString, IStringColor, IStrokeWidthString, ICornerRadiusString } from './type/IStringType'
|
|
4
4
|
|
|
5
5
|
// corner---
|
|
6
6
|
export interface ICornerRadiusAttrData {
|
|
@@ -77,10 +77,16 @@ export interface ITextStyleAttrData {
|
|
|
77
77
|
italic: boolean
|
|
78
78
|
textCase: ITextCase
|
|
79
79
|
textDecoration: ITextDecoration
|
|
80
|
-
letterSpacing: number |
|
|
81
|
-
lineHeight: number |
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
letterSpacing: number | IUnitData
|
|
81
|
+
lineHeight: number | IUnitData
|
|
82
|
+
|
|
83
|
+
paraIndent: number
|
|
84
|
+
paraSpacing: number
|
|
85
|
+
|
|
86
|
+
textAlign: ITextAlign
|
|
87
|
+
verticalAlign: IVerticalAlign
|
|
88
|
+
|
|
89
|
+
textOverflow: IOverflow | string
|
|
84
90
|
}
|
|
85
91
|
export interface ITextStyleInputData {
|
|
86
92
|
fontFamily?: string
|
|
@@ -89,10 +95,16 @@ export interface ITextStyleInputData {
|
|
|
89
95
|
italic?: boolean
|
|
90
96
|
textCase?: ITextCase
|
|
91
97
|
textDecoration?: ITextDecoration
|
|
92
|
-
letterSpacing?: number |
|
|
93
|
-
lineHeight?: number |
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
letterSpacing?: number | IUnitData
|
|
99
|
+
lineHeight?: number | IUnitData
|
|
100
|
+
|
|
101
|
+
paraIndent?: number
|
|
102
|
+
paraSpacing?: number
|
|
103
|
+
|
|
104
|
+
textAlign?: ITextAlign
|
|
105
|
+
verticalAlign?: IVerticalAlign
|
|
106
|
+
|
|
107
|
+
textOverflow?: IOverflow | string
|
|
96
108
|
}
|
|
97
109
|
export interface ITextStyleComputedData {
|
|
98
110
|
fontFamily?: string
|
|
@@ -104,8 +116,12 @@ export interface ITextStyleComputedData {
|
|
|
104
116
|
letterSpacing?: number
|
|
105
117
|
lineHeight?: number
|
|
106
118
|
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
paraIndent?: number
|
|
120
|
+
paraSpacing?: number
|
|
121
|
+
|
|
122
|
+
textAlign?: ITextAlign
|
|
123
|
+
verticalAlign?: IVerticalAlign
|
|
124
|
+
textOverflow?: IOverflow
|
|
109
125
|
}
|
|
110
126
|
|
|
111
127
|
// effect---
|
package/src/IUI.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule,
|
|
1
|
+
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, ILeaferImage } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { IPathString, IVectorPathString } from './type/IStringType'
|
|
4
|
-
import {
|
|
5
|
-
import { IVectorPath } from './type/IType'
|
|
4
|
+
import { IOverflow, IVectorPath } from './type/IType'
|
|
6
5
|
|
|
7
6
|
import {
|
|
8
7
|
IFillAttrData, IFillInputData, IFillComputedData,
|
|
@@ -20,7 +19,9 @@ export interface ILine extends IUI {
|
|
|
20
19
|
toPoint: IPointData
|
|
21
20
|
}
|
|
22
21
|
export interface ILineData extends IUIData { }
|
|
23
|
-
export interface ILineInputData extends IUIInputData {
|
|
22
|
+
export interface ILineInputData extends IUIInputData {
|
|
23
|
+
toPoint?: IPointData
|
|
24
|
+
}
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
// Rect
|
|
@@ -88,6 +89,33 @@ export interface IPathInputData extends IUIInputData {
|
|
|
88
89
|
windingRule?: IWindingRule
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
// Pen
|
|
93
|
+
|
|
94
|
+
export interface IPen extends IGroup {
|
|
95
|
+
__: IPenData
|
|
96
|
+
path: IPath
|
|
97
|
+
pathStyle: IPathInputData
|
|
98
|
+
pathData: IPathCommandData
|
|
99
|
+
|
|
100
|
+
moveTo(x: number, y: number): IPen
|
|
101
|
+
lineTo(x: number, y: number): IPen
|
|
102
|
+
bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): IPen
|
|
103
|
+
quadraticCurveTo(x1: number, y1: number, x: number, y: number): IPen
|
|
104
|
+
|
|
105
|
+
rect(x: number, y: number, width: number, height: number): IPen
|
|
106
|
+
roundRect(x: number, y: number, width: number, height: number, cornerRadius: number | number[]): IPen
|
|
107
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPen
|
|
108
|
+
arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPen
|
|
109
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPen
|
|
110
|
+
|
|
111
|
+
close(): IPen
|
|
112
|
+
clear(): IPen
|
|
113
|
+
|
|
114
|
+
paint(): void
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface IPenData extends IGroupData { }
|
|
118
|
+
export interface IPenInputData extends IGroupInputData { }
|
|
91
119
|
|
|
92
120
|
// Vector
|
|
93
121
|
export interface IVector extends IUI {
|
|
@@ -105,56 +133,131 @@ export interface IVectorInputData extends IUIInputData {
|
|
|
105
133
|
// Text
|
|
106
134
|
export interface IText extends ITextStyleAttrData, IUI {
|
|
107
135
|
__: ITextData
|
|
108
|
-
|
|
136
|
+
text: string
|
|
109
137
|
}
|
|
110
138
|
interface ITextAttrData {
|
|
111
|
-
|
|
139
|
+
text?: string
|
|
112
140
|
}
|
|
141
|
+
|
|
113
142
|
export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
114
|
-
|
|
143
|
+
__baseLine?: number
|
|
144
|
+
__lineHeight?: number
|
|
145
|
+
__letterSpacing?: number
|
|
115
146
|
}
|
|
116
147
|
export interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIInputData {
|
|
117
148
|
|
|
118
149
|
}
|
|
119
150
|
|
|
151
|
+
export interface ITextRowData {
|
|
152
|
+
x?: number
|
|
153
|
+
y?: number
|
|
154
|
+
width?: number
|
|
155
|
+
height?: number
|
|
156
|
+
text?: string
|
|
157
|
+
data?: ITextCharData[]
|
|
158
|
+
words?: ITextWordData[]
|
|
159
|
+
|
|
160
|
+
paraStart?: boolean // paragraph start
|
|
161
|
+
paraEnd?: boolean // paragraph end
|
|
162
|
+
isOverflow?: boolean
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface ITextWordData {
|
|
166
|
+
x?: number
|
|
167
|
+
y?: number
|
|
168
|
+
width?: number
|
|
169
|
+
height?: number
|
|
170
|
+
data?: ITextCharData[]
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface ITextCharData {
|
|
174
|
+
x?: number
|
|
175
|
+
y?: number
|
|
176
|
+
width?: number
|
|
177
|
+
height?: number
|
|
178
|
+
char?: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ITextDrawData {
|
|
182
|
+
bounds: IBoundsData
|
|
183
|
+
rows: ITextRowData[]
|
|
184
|
+
paraNumber: number
|
|
185
|
+
font: string
|
|
186
|
+
decorationY?: number
|
|
187
|
+
decorationHeight?: number
|
|
188
|
+
overflow?: number // overflowed row number, not index
|
|
189
|
+
}
|
|
120
190
|
|
|
121
191
|
// Image
|
|
122
192
|
export interface IImage extends IRect, ILeaferImageConfig {
|
|
123
193
|
__: IImageData
|
|
124
194
|
url: string
|
|
125
|
-
|
|
195
|
+
ready: boolean
|
|
196
|
+
image?: ILeaferImage
|
|
126
197
|
}
|
|
127
198
|
interface IImageAttrData {
|
|
128
199
|
url?: string
|
|
129
|
-
thumb?: string
|
|
130
200
|
}
|
|
131
201
|
export interface IImageData extends IImageAttrData, IRectData { }
|
|
132
202
|
export interface IImageInputData extends IImageAttrData, IUIInputData { }
|
|
133
203
|
|
|
204
|
+
export interface ICanvas extends IRect {
|
|
205
|
+
__: ICanvasData
|
|
206
|
+
pixelRatio: number
|
|
207
|
+
smooth: boolean
|
|
208
|
+
canvas: ILeaferCanvas
|
|
209
|
+
__updateSize(): void
|
|
210
|
+
}
|
|
211
|
+
interface ICanvasAttrData {
|
|
212
|
+
pixelRatio?: number
|
|
213
|
+
smooth?: boolean
|
|
214
|
+
}
|
|
215
|
+
export interface ICanvasData extends ICanvasAttrData, IRectData { }
|
|
216
|
+
export interface ICanvasInputData extends ICanvasAttrData, IUIInputData { }
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
// Leafer
|
|
220
|
+
export interface ILeaferData extends IGroupData {
|
|
221
|
+
pixelRatio?: number
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface ILeaferInputData extends IGroupInputData {
|
|
225
|
+
pixelRatio?: number
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
|
|
134
229
|
// Frame
|
|
135
|
-
export interface IFrame extends
|
|
230
|
+
export interface IFrame extends IBox {
|
|
136
231
|
__: IFrameData
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
232
|
+
}
|
|
233
|
+
export interface IFrameData extends IBoxData {
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
export interface IFrameInputData extends IBoxInputData {
|
|
237
|
+
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
// Box
|
|
242
|
+
export interface IBox extends IGroup {
|
|
243
|
+
__: IBoxData
|
|
244
|
+
overflow: IOverflow
|
|
140
245
|
__updateRectRenderBounds(): void
|
|
141
|
-
__renderRect(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
142
246
|
__renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
143
247
|
}
|
|
144
|
-
export interface
|
|
145
|
-
|
|
248
|
+
export interface IBoxData extends IGroupData {
|
|
249
|
+
overflow?: IOverflow
|
|
146
250
|
}
|
|
147
|
-
export interface
|
|
148
|
-
|
|
251
|
+
export interface IBoxInputData extends IGroupInputData {
|
|
252
|
+
overflow?: IOverflow
|
|
149
253
|
}
|
|
150
254
|
|
|
151
255
|
|
|
152
256
|
// Group
|
|
153
|
-
export interface IGroup extends
|
|
257
|
+
export interface IGroup extends IUI {
|
|
154
258
|
__: IGroupData
|
|
155
|
-
root?: IGroup
|
|
156
|
-
parent?: IGroup
|
|
157
259
|
children: IUI[]
|
|
260
|
+
mask?: IUI
|
|
158
261
|
add(child: IUI, index?: number): void
|
|
159
262
|
remove(child?: IUI): void
|
|
160
263
|
addAt(child: IUI, index: number): void
|
|
@@ -167,19 +270,29 @@ export interface IGroupInputData extends IUIInputData { }
|
|
|
167
270
|
// UI
|
|
168
271
|
export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
169
272
|
__: IUIData
|
|
170
|
-
root?: IGroup
|
|
171
273
|
parent?: IGroup
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
274
|
+
|
|
275
|
+
set(data: IUITagInputData): void
|
|
276
|
+
get(): IUITagInputData
|
|
277
|
+
|
|
278
|
+
getPath(curve?: boolean): IPathCommandData
|
|
279
|
+
getPathString(curve?: boolean): IPathString
|
|
280
|
+
|
|
176
281
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
|
|
282
|
+
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
177
283
|
}
|
|
178
284
|
|
|
179
285
|
export interface IUIData extends IUIComputedData, ILeafData {
|
|
286
|
+
|
|
287
|
+
padding?: number | number[]
|
|
288
|
+
locked?: boolean
|
|
289
|
+
|
|
180
290
|
// 非数据属性, 自动计算的缓存数据
|
|
181
291
|
__isFills?: boolean
|
|
182
292
|
__isStrokes?: boolean
|
|
293
|
+
__drawAfterFill?: boolean
|
|
294
|
+
__isOverflow?: boolean
|
|
295
|
+
__blendLayer?: boolean
|
|
183
296
|
|
|
184
297
|
__isTranslucentFill?: boolean // 半透明的
|
|
185
298
|
__isTranslucentStroke?: boolean
|
|
@@ -193,16 +306,35 @@ export interface IUIData extends IUIComputedData, ILeafData {
|
|
|
193
306
|
__pathForRender?: IPathCommandData
|
|
194
307
|
__path2DForRender?: IPath2D
|
|
195
308
|
|
|
196
|
-
|
|
309
|
+
// text
|
|
310
|
+
__font?: string
|
|
311
|
+
__textDrawData?: ITextDrawData
|
|
312
|
+
|
|
197
313
|
}
|
|
198
|
-
export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
199
|
-
|
|
200
|
-
mask?: boolean
|
|
314
|
+
export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
315
|
+
padding?: number | number[]
|
|
201
316
|
locked?: boolean
|
|
202
317
|
}
|
|
203
318
|
|
|
204
|
-
export interface IUIInputData extends IFillInputData, IStrokeInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
205
|
-
|
|
206
|
-
mask?: boolean
|
|
319
|
+
export interface IUIInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
320
|
+
padding?: number | number[]
|
|
207
321
|
locked?: boolean
|
|
208
322
|
}
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
export type IUITag =
|
|
326
|
+
| 'Rect'
|
|
327
|
+
| 'Ellipse'
|
|
328
|
+
| 'Polygon'
|
|
329
|
+
| 'Star'
|
|
330
|
+
| 'Line'
|
|
331
|
+
| 'Path'
|
|
332
|
+
| 'Text'
|
|
333
|
+
| 'Image'
|
|
334
|
+
| 'Group'
|
|
335
|
+
| 'Frame'
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
export interface IUITagInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IObject {
|
|
339
|
+
tagName?: IUITag
|
|
340
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,18 +7,23 @@ export {
|
|
|
7
7
|
IPolygon, IPolygonInputData, IPolygonData,
|
|
8
8
|
IStar, IStarInputData, IStarData,
|
|
9
9
|
IPath, IPathInputData, IPathData,
|
|
10
|
+
IPen, IPenInputData, IPenData,
|
|
10
11
|
IVector, IVectorInputData, IVectorData,
|
|
11
|
-
IText, ITextInputData, ITextData,
|
|
12
|
+
IText, ITextInputData, ITextData, ITextRowData, ITextWordData, ITextCharData, ITextDrawData,
|
|
12
13
|
IImage, IImageInputData, IImageData,
|
|
14
|
+
ICanvas, ICanvasInputData, ICanvasData,
|
|
13
15
|
IFrame, IFrameInputData, IFrameData,
|
|
16
|
+
IBox, IBoxInputData, IBoxData,
|
|
14
17
|
IGroup, IGroupInputData, IGroupData,
|
|
15
|
-
|
|
18
|
+
ILeaferInputData, ILeaferData,
|
|
19
|
+
IUI, IUIInputData, IUIData,
|
|
20
|
+
IUITag, IUITagInputData
|
|
16
21
|
} from './IUI'
|
|
17
|
-
export {
|
|
22
|
+
export { IUnitData, IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow } from './type/IType'
|
|
18
23
|
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IPathString, IVectorPathString, IStringColor } from './type/IStringType'
|
|
19
24
|
export { ILeafFill, ILeafPaint, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
20
25
|
|
|
21
|
-
export { IUIRenderModule, IRectRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
|
|
26
|
+
export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
|
|
22
27
|
export { IUIBoundsModule } from './module/IUIBounds'
|
|
23
28
|
export { IUIHitModule } from './module/IUIHit'
|
|
24
29
|
|
package/src/module/IPaint.ts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import { ILeaferCanvas } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IRenderOptions } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { ILeafPaint } from '../type/IComputedType'
|
|
4
4
|
import { IUI } from '../IUI'
|
|
5
|
+
import { ICachedShape } from '../ICachedShape'
|
|
5
6
|
|
|
6
7
|
export interface IPaintModule {
|
|
8
|
+
computeFill?(ui: IUI): void
|
|
9
|
+
computeStroke?(ui: IUI): void
|
|
10
|
+
|
|
7
11
|
fill?(ui: IUI, canvas: ILeaferCanvas, fill: string | object): void
|
|
8
12
|
fills?(ui: IUI, canvas: ILeaferCanvas, fills: ILeafPaint[]): void
|
|
9
13
|
|
|
14
|
+
drawText?(ui: IUI, canvas: ILeaferCanvas): void
|
|
15
|
+
|
|
10
16
|
stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string | object): void
|
|
11
17
|
strokes?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void
|
|
18
|
+
|
|
19
|
+
strokeText?(ui: IUI, canvas: ILeaferCanvas, stroke: string | object): void
|
|
20
|
+
strokesText?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void
|
|
21
|
+
|
|
22
|
+
drawTextStroke?(ui: IUI, canvas: ILeaferCanvas): void
|
|
23
|
+
|
|
24
|
+
shape?(ui: IUI, current: ILeaferCanvas, options: IRenderOptions): ICachedShape
|
|
12
25
|
}
|
package/src/module/IUIRender.ts
CHANGED
|
@@ -1,28 +1,40 @@
|
|
|
1
|
-
import { ILeafRender, ILeaferCanvas, IRenderOptions
|
|
1
|
+
import { ILeafRender, ILeaferCanvas, IRenderOptions } from '@leafer/interface'
|
|
2
2
|
|
|
3
|
-
import { IUI, IRect, IFrame, IGroup } from '../IUI'
|
|
3
|
+
import { IUI, IRect, IImage, IText, IFrame, IGroup } from '../IUI'
|
|
4
4
|
|
|
5
5
|
export type IUIRenderModule = IUIRender & ThisType<IUI>
|
|
6
6
|
|
|
7
|
-
interface IUIRender extends ILeafRender {
|
|
8
|
-
|
|
7
|
+
export interface IUIRender extends ILeafRender {
|
|
8
|
+
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export type IRectRenderModule = IRectRender & ThisType<IRect>
|
|
12
12
|
|
|
13
|
-
interface IRectRender extends IUIRender {
|
|
13
|
+
export interface IRectRender extends IUIRender {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type IImageRenderModule = IImageRender & ThisType<IImage>
|
|
18
|
+
|
|
19
|
+
export interface IImageRender extends IUIRender {
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ITextRenderModule = ITextRender & ThisType<IText>
|
|
24
|
+
|
|
25
|
+
export interface ITextRender extends IUIRender {
|
|
14
26
|
|
|
15
27
|
}
|
|
16
28
|
|
|
17
29
|
export type IGroupRenderModule = IGroupRender & ThisType<IGroup>
|
|
18
30
|
|
|
19
|
-
interface IGroupRender extends IUIRender {
|
|
31
|
+
export interface IGroupRender extends IUIRender {
|
|
20
32
|
|
|
21
33
|
}
|
|
22
34
|
|
|
23
35
|
export type IFrameRenderModule = IFrameRender & ThisType<IFrame>
|
|
24
36
|
|
|
25
|
-
interface IFrameRender extends IGroupRender {
|
|
37
|
+
export interface IFrameRender extends IGroupRender {
|
|
26
38
|
|
|
27
39
|
}
|
|
28
40
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBlendMode, IMatrixData } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { IStringColor } from './IStringType'
|
|
4
|
-
import {
|
|
4
|
+
import { IStrokeAlign, IStrokeJoin, IStrokeCap } from './IType'
|
|
5
5
|
import { IPaintType } from './IType'
|
|
6
6
|
|
|
7
7
|
export type ILeafPaintColor = IStringColor | CanvasGradient | CanvasPattern
|
|
@@ -9,7 +9,7 @@ export type ILeafPaintColor = IStringColor | CanvasGradient | CanvasPattern
|
|
|
9
9
|
export interface ILeafPaint {
|
|
10
10
|
type: IPaintType
|
|
11
11
|
style: ILeafPaintColor
|
|
12
|
-
|
|
12
|
+
transform?: IMatrixData
|
|
13
13
|
blendMode?: IBlendMode
|
|
14
14
|
opacity?: number
|
|
15
15
|
}
|
|
@@ -32,5 +32,5 @@ export interface ILeafShadowEffect {
|
|
|
32
32
|
spread?: number
|
|
33
33
|
color: IStringColor
|
|
34
34
|
blendMode?: IBlendMode
|
|
35
|
-
|
|
35
|
+
box?: boolean
|
|
36
36
|
}
|
package/src/type/IType.ts
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPointData, IPathCommandData, IWindingRule, IBlendMode } from '@leafer/interface'
|
|
2
2
|
import { IStringColor } from './IStringType'
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
| '
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
| 'screen'
|
|
9
|
-
| 'overlay'
|
|
10
|
-
| 'darken'
|
|
11
|
-
| 'lighten'
|
|
12
|
-
| 'color-dodge'
|
|
13
|
-
| 'color-burn'
|
|
14
|
-
| 'hard-light'
|
|
15
|
-
| 'soft-light'
|
|
16
|
-
| 'difference'
|
|
17
|
-
| 'exclusion'
|
|
18
|
-
| 'hue'
|
|
19
|
-
| 'saturation'
|
|
20
|
-
| 'color'
|
|
21
|
-
| 'luminosity'
|
|
22
|
-
|
|
4
|
+
export interface IUnitData {
|
|
5
|
+
type: 'percent' | 'px'
|
|
6
|
+
value: number
|
|
7
|
+
}
|
|
23
8
|
|
|
24
9
|
export type IPaint = ISolidPaint | IGradientPaint | IImagePaint
|
|
25
10
|
|
|
@@ -37,10 +22,9 @@ export type IPaintType =
|
|
|
37
22
|
| IGradientType
|
|
38
23
|
|
|
39
24
|
export type IGradientType =
|
|
40
|
-
| '
|
|
41
|
-
| '
|
|
42
|
-
| '
|
|
43
|
-
| 'gradient-diamond'
|
|
25
|
+
| 'linear'
|
|
26
|
+
| 'radial'
|
|
27
|
+
| 'angular'
|
|
44
28
|
|
|
45
29
|
// ---
|
|
46
30
|
export interface ISolidPaint extends IPaintBase {
|
|
@@ -48,11 +32,12 @@ export interface ISolidPaint extends IPaintBase {
|
|
|
48
32
|
color: IColor
|
|
49
33
|
}
|
|
50
34
|
|
|
51
|
-
export type IColor = IStringColor
|
|
35
|
+
export type IColor = IStringColor | IRGB | IRGBA
|
|
52
36
|
export interface IRGB {
|
|
53
37
|
r: number
|
|
54
38
|
g: number
|
|
55
39
|
b: number
|
|
40
|
+
a?: number
|
|
56
41
|
}
|
|
57
42
|
export interface IRGBA extends IRGB {
|
|
58
43
|
a: number
|
|
@@ -61,8 +46,8 @@ export interface IRGBA extends IRGB {
|
|
|
61
46
|
// ---
|
|
62
47
|
export interface IGradientPaint extends IPaintBase {
|
|
63
48
|
type: IGradientType
|
|
64
|
-
from
|
|
65
|
-
to
|
|
49
|
+
from?: IPointData
|
|
50
|
+
to?: IPointData
|
|
66
51
|
stretch?: number
|
|
67
52
|
stops: IColorStop[]
|
|
68
53
|
}
|
|
@@ -75,11 +60,13 @@ export interface IColorStop {
|
|
|
75
60
|
export interface IImagePaint extends IPaintBase {
|
|
76
61
|
type: "image"
|
|
77
62
|
url: string
|
|
78
|
-
mode
|
|
79
|
-
|
|
80
|
-
scale?: number
|
|
81
|
-
rotation?: number
|
|
63
|
+
mode?: IImagePaintMode
|
|
64
|
+
|
|
82
65
|
filters?: IImageFilters
|
|
66
|
+
|
|
67
|
+
offset?: IPointData
|
|
68
|
+
scale?: number | IPointData
|
|
69
|
+
rotation?: number
|
|
83
70
|
}
|
|
84
71
|
export interface IImageFilters {
|
|
85
72
|
exposure?: number // 曝光
|
|
@@ -90,7 +77,7 @@ export interface IImageFilters {
|
|
|
90
77
|
highlights?: number // 高光
|
|
91
78
|
shadows?: number // 阴影
|
|
92
79
|
}
|
|
93
|
-
export type IImagePaintMode = '
|
|
80
|
+
export type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat'
|
|
94
81
|
|
|
95
82
|
// 描边
|
|
96
83
|
export type IStrokeAlign = 'inside' | 'outside' | 'center'
|
|
@@ -98,9 +85,11 @@ export type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-eq
|
|
|
98
85
|
export type IStrokeJoin = 'bevel' | 'round' | 'miter'
|
|
99
86
|
|
|
100
87
|
// 文本
|
|
101
|
-
export type
|
|
102
|
-
export type
|
|
103
|
-
export type
|
|
88
|
+
export type ITextAlign = 'left' | 'center' | 'right' | 'justify'
|
|
89
|
+
export type IVerticalAlign = 'top' | 'middle' | 'bottom'
|
|
90
|
+
export type ITextCase = | 'upper' | 'lower' | 'title' | 'none' | 'small-caps'
|
|
91
|
+
export type IFontWeight = IFontWeightNumer | IFontWeightString
|
|
92
|
+
export type IFontWeightNumer = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
|
|
104
93
|
export type IFontWeightString =
|
|
105
94
|
| 'thin'
|
|
106
95
|
| 'extra-light'
|
|
@@ -111,7 +100,7 @@ export type IFontWeightString =
|
|
|
111
100
|
| 'bold'
|
|
112
101
|
| 'extra-bold'
|
|
113
102
|
| 'black'
|
|
114
|
-
export type ITextDecoration = 'none' | '
|
|
103
|
+
export type ITextDecoration = 'none' | 'under' | 'delete'
|
|
115
104
|
|
|
116
105
|
// 路径
|
|
117
106
|
export interface IVectorPath {
|
|
@@ -128,7 +117,7 @@ export interface IShadowEffect {
|
|
|
128
117
|
color: IStringColor | IColor
|
|
129
118
|
blendMode?: IBlendMode
|
|
130
119
|
visible?: boolean
|
|
131
|
-
|
|
120
|
+
box?: boolean
|
|
132
121
|
}
|
|
133
122
|
|
|
134
123
|
export interface IBlurEffect {
|
|
@@ -139,4 +128,6 @@ export interface IBlurEffect {
|
|
|
139
128
|
export interface IGrayscaleEffect {
|
|
140
129
|
grayscale: number
|
|
141
130
|
visible?: boolean
|
|
142
|
-
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type IOverflow = 'show' | 'hide'
|