@leafer-ui/interface 1.0.0-beta.9 → 1.0.0-rc.1
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 +6 -3
- package/src/IUI.ts +37 -38
- package/src/index.ts +7 -5
- package/src/module/IColorConvert.ts +5 -0
- package/src/module/IExport.ts +1 -1
- package/src/module/IPaint.ts +9 -8
- package/src/module/ITextConvert.ts +5 -0
- package/src/type/IComputedType.ts +18 -4
- package/src/type/IType.ts +2 -1
- package/types/index.d.ts +595 -0
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interface",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"description": "@leafer-ui/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
8
9
|
"files": [
|
|
9
|
-
"src"
|
|
10
|
+
"src",
|
|
11
|
+
"types",
|
|
12
|
+
"dist"
|
|
10
13
|
],
|
|
11
14
|
"repository": {
|
|
12
15
|
"type": "git",
|
|
@@ -19,6 +22,6 @@
|
|
|
19
22
|
"leaferjs"
|
|
20
23
|
],
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"@leafer/interface": "1.0.0-
|
|
25
|
+
"@leafer/interface": "1.0.0-rc.1"
|
|
23
26
|
}
|
|
24
27
|
}
|
package/src/IUI.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, IPathString, ILeaferImage, IBlob } from '@leafer/interface'
|
|
2
|
-
|
|
3
|
-
import { IOverflow } from './type/IType'
|
|
1
|
+
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, IPathString, ILeaferImage, IBlob, IPathCreator } from '@leafer/interface'
|
|
4
2
|
|
|
5
3
|
import {
|
|
6
4
|
IFillAttrData, IFillInputData, IFillComputedData,
|
|
@@ -10,6 +8,7 @@ import {
|
|
|
10
8
|
IEffectAttrData, IEffectInputData, IEffectComputedData,
|
|
11
9
|
ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData
|
|
12
10
|
} from './ICommonAttr'
|
|
11
|
+
import { IOverflow } from './type/IType'
|
|
13
12
|
import { IExportOptions } from './module/IExport'
|
|
14
13
|
|
|
15
14
|
|
|
@@ -17,10 +16,14 @@ import { IExportOptions } from './module/IExport'
|
|
|
17
16
|
export interface ILine extends IUI {
|
|
18
17
|
__: ILineData
|
|
19
18
|
toPoint: IPointData
|
|
19
|
+
points: number[]
|
|
20
|
+
curve: boolean | number
|
|
20
21
|
}
|
|
21
22
|
export interface ILineData extends IUIData { }
|
|
22
|
-
export interface ILineInputData extends
|
|
23
|
+
export interface ILineInputData extends IUIBaseInputData {
|
|
23
24
|
toPoint?: IPointData
|
|
25
|
+
points?: number[]
|
|
26
|
+
curve?: boolean | number
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
|
|
@@ -29,7 +32,7 @@ export interface IRect extends IUI {
|
|
|
29
32
|
__: IRectData
|
|
30
33
|
}
|
|
31
34
|
export interface IRectData extends IUIData { }
|
|
32
|
-
export interface IRectInputData extends
|
|
35
|
+
export interface IRectInputData extends IUIBaseInputData { }
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
// Ellipse
|
|
@@ -45,34 +48,38 @@ interface IEllipseAttrData {
|
|
|
45
48
|
innerRadius?: number
|
|
46
49
|
}
|
|
47
50
|
export interface IEllipseData extends IEllipseAttrData, IUIData { }
|
|
48
|
-
export interface IEllipseInputData extends IEllipseAttrData,
|
|
51
|
+
export interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData { }
|
|
49
52
|
|
|
50
53
|
|
|
51
54
|
// Polygon
|
|
52
55
|
export interface IPolygon extends IUI {
|
|
53
56
|
__: IPolygonData
|
|
54
57
|
sides: number
|
|
58
|
+
points: number[]
|
|
59
|
+
curve: boolean | number
|
|
55
60
|
}
|
|
56
61
|
interface IPolygonAttrData {
|
|
57
62
|
sides?: number
|
|
63
|
+
points?: number[]
|
|
64
|
+
curve?: boolean | number
|
|
58
65
|
}
|
|
59
66
|
export interface IPolygonData extends IPolygonAttrData, IUIData { }
|
|
60
|
-
export interface IPolygonInputData extends IPolygonAttrData,
|
|
67
|
+
export interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData { }
|
|
61
68
|
|
|
62
69
|
|
|
63
70
|
// Star
|
|
64
71
|
export interface IStar extends IUI {
|
|
65
72
|
__: IStarData
|
|
66
|
-
|
|
73
|
+
corners: number
|
|
67
74
|
innerRadius: number
|
|
68
75
|
}
|
|
69
76
|
interface IStarAttrData {
|
|
70
|
-
|
|
77
|
+
corners?: number
|
|
71
78
|
innerRadius?: number
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
export interface IStarData extends IStarAttrData, IUIData { }
|
|
75
|
-
export interface IStarInputData extends IStarAttrData,
|
|
82
|
+
export interface IStarInputData extends IStarAttrData, IUIBaseInputData { }
|
|
76
83
|
|
|
77
84
|
// Path
|
|
78
85
|
export interface IPath extends IUI {
|
|
@@ -84,34 +91,20 @@ export interface IPathData extends IUIData {
|
|
|
84
91
|
path?: IPathCommandData
|
|
85
92
|
windingRule?: IWindingRule
|
|
86
93
|
}
|
|
87
|
-
export interface IPathInputData extends
|
|
94
|
+
export interface IPathInputData extends IUIBaseInputData {
|
|
88
95
|
path?: IPathCommandData | IPathString
|
|
89
96
|
windingRule?: IWindingRule
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
// Pen
|
|
93
100
|
|
|
94
|
-
export interface IPen extends IGroup {
|
|
101
|
+
export interface IPen extends IGroup, IPathCreator {
|
|
95
102
|
__: IPenData
|
|
96
|
-
|
|
103
|
+
pathElement: IPath
|
|
97
104
|
pathStyle: IPathInputData
|
|
98
|
-
|
|
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
|
-
|
|
105
|
+
path: IPathCommandData
|
|
114
106
|
paint(): void
|
|
107
|
+
clear(): void
|
|
115
108
|
}
|
|
116
109
|
|
|
117
110
|
export interface IPenData extends IGroupData { }
|
|
@@ -132,7 +125,7 @@ export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIDat
|
|
|
132
125
|
__lineHeight?: number
|
|
133
126
|
__letterSpacing?: number
|
|
134
127
|
}
|
|
135
|
-
export interface ITextInputData extends ITextAttrData, ITextStyleInputData,
|
|
128
|
+
export interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
|
|
136
129
|
|
|
137
130
|
}
|
|
138
131
|
|
|
@@ -187,7 +180,7 @@ interface IImageAttrData {
|
|
|
187
180
|
url?: string
|
|
188
181
|
}
|
|
189
182
|
export interface IImageData extends IImageAttrData, IRectData { }
|
|
190
|
-
export interface IImageInputData extends IImageAttrData,
|
|
183
|
+
export interface IImageInputData extends IImageAttrData, IUIBaseInputData { }
|
|
191
184
|
|
|
192
185
|
export interface ICanvas extends IRect {
|
|
193
186
|
__: ICanvasData
|
|
@@ -201,7 +194,7 @@ interface ICanvasAttrData {
|
|
|
201
194
|
smooth?: boolean
|
|
202
195
|
}
|
|
203
196
|
export interface ICanvasData extends ICanvasAttrData, IRectData { }
|
|
204
|
-
export interface ICanvasInputData extends ICanvasAttrData,
|
|
197
|
+
export interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData { }
|
|
205
198
|
|
|
206
199
|
|
|
207
200
|
// Leafer
|
|
@@ -254,15 +247,15 @@ export interface IGroup extends IUI {
|
|
|
254
247
|
removeAll(): void
|
|
255
248
|
}
|
|
256
249
|
export interface IGroupData extends IUIData { }
|
|
257
|
-
export interface IGroupInputData extends
|
|
250
|
+
export interface IGroupInputData extends IUIBaseInputData { }
|
|
258
251
|
|
|
259
252
|
// UI
|
|
260
253
|
export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
261
254
|
__: IUIData
|
|
262
255
|
parent?: IGroup
|
|
263
256
|
|
|
264
|
-
set(data:
|
|
265
|
-
|
|
257
|
+
set(data: IUIInputData): void
|
|
258
|
+
toJSON(): IUIInputData
|
|
266
259
|
|
|
267
260
|
getPath(curve?: boolean): IPathCommandData
|
|
268
261
|
getPathString(curve?: boolean): IPathString
|
|
@@ -271,6 +264,8 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
|
|
|
271
264
|
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
272
265
|
|
|
273
266
|
export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>
|
|
267
|
+
clone(): IUI
|
|
268
|
+
|
|
274
269
|
}
|
|
275
270
|
|
|
276
271
|
export interface IUIData extends IUIComputedData, ILeafData {
|
|
@@ -306,16 +301,20 @@ export interface IUIData extends IUIComputedData, ILeafData {
|
|
|
306
301
|
}
|
|
307
302
|
export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
308
303
|
padding?: number | number[]
|
|
304
|
+
|
|
309
305
|
locked?: boolean
|
|
310
306
|
}
|
|
311
307
|
|
|
312
|
-
export interface
|
|
308
|
+
export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
313
309
|
padding?: number | number[]
|
|
314
310
|
locked?: boolean
|
|
311
|
+
children?: IUIBaseInputData[]
|
|
315
312
|
}
|
|
316
313
|
|
|
317
314
|
|
|
318
315
|
export type IUITag =
|
|
316
|
+
| 'App'
|
|
317
|
+
| 'Leafer'
|
|
319
318
|
| 'Rect'
|
|
320
319
|
| 'Ellipse'
|
|
321
320
|
| 'Polygon'
|
|
@@ -331,6 +330,6 @@ export type IUITag =
|
|
|
331
330
|
| 'Box'
|
|
332
331
|
|
|
333
332
|
|
|
334
|
-
export interface
|
|
335
|
-
|
|
333
|
+
export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
|
|
334
|
+
|
|
336
335
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,19 +15,21 @@ export {
|
|
|
15
15
|
IBox, IBoxInputData, IBoxData,
|
|
16
16
|
IGroup, IGroupInputData, IGroupData,
|
|
17
17
|
ILeaferInputData, ILeaferData,
|
|
18
|
-
IUI,
|
|
19
|
-
IUITag,
|
|
18
|
+
IUI, IUIBaseInputData, IUIData,
|
|
19
|
+
IUITag, IUIInputData
|
|
20
20
|
} from './IUI'
|
|
21
21
|
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'
|
|
22
22
|
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString as IStringColor } from './type/IStringType'
|
|
23
|
-
export { ILeafFill, ILeafPaint, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
23
|
+
export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
24
24
|
|
|
25
25
|
export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
|
|
26
26
|
export { IUIBoundsModule } from './module/IUIBounds'
|
|
27
27
|
export { IUIHitModule } from './module/IUIHit'
|
|
28
|
+
export { ITextConvertModule } from './module/ITextConvert'
|
|
29
|
+
export { IColorConvertModule } from './module/IColorConvert'
|
|
28
30
|
export { IExportModule, IExportOptions, IExportResult, IExportResultFunction } from './module/IExport'
|
|
29
31
|
|
|
32
|
+
|
|
30
33
|
export { IPaintModule } from './module/IPaint'
|
|
31
34
|
export { IEffectModule } from './module/IEffect'
|
|
32
|
-
export { ICachedShape } from './ICachedShape'
|
|
33
|
-
|
|
35
|
+
export { ICachedShape } from './ICachedShape'
|
package/src/module/IExport.ts
CHANGED
|
@@ -15,5 +15,5 @@ export interface IExportResultFunction {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
export interface IExportModule {
|
|
18
|
-
export(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>
|
|
18
|
+
export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>
|
|
19
19
|
}
|
package/src/module/IPaint.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { ILeaferCanvas, IRenderOptions } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IRenderOptions, IBooleanMap } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { ILeafPaint } from '../type/IComputedType'
|
|
4
|
-
import { IUI } from '../IUI'
|
|
4
|
+
import { IUI, IUIData } from '../IUI'
|
|
5
5
|
import { ICachedShape } from '../ICachedShape'
|
|
6
6
|
|
|
7
7
|
export interface IPaintModule {
|
|
8
|
-
|
|
9
|
-
computeStroke?(ui: IUI): void
|
|
8
|
+
compute?(ui: IUI, attrName: 'fill' | 'stroke'): void
|
|
10
9
|
|
|
11
|
-
fill?(ui: IUI, canvas: ILeaferCanvas, fill: string
|
|
10
|
+
fill?(ui: IUI, canvas: ILeaferCanvas, fill: string): void
|
|
12
11
|
fills?(ui: IUI, canvas: ILeaferCanvas, fills: ILeafPaint[]): void
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
fillText?(ui: IUI, canvas: ILeaferCanvas): void
|
|
15
14
|
|
|
16
|
-
stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string
|
|
15
|
+
stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void
|
|
17
16
|
strokes?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void
|
|
18
17
|
|
|
19
|
-
strokeText?(ui: IUI, canvas: ILeaferCanvas, stroke: string
|
|
18
|
+
strokeText?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void
|
|
20
19
|
strokesText?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void
|
|
21
20
|
|
|
22
21
|
drawTextStroke?(ui: IUI, canvas: ILeaferCanvas): void
|
|
23
22
|
|
|
24
23
|
shape?(ui: IUI, current: ILeaferCanvas, options: IRenderOptions): ICachedShape
|
|
24
|
+
|
|
25
|
+
recycleImage?(data: IUIData, attrName: string): IBooleanMap
|
|
25
26
|
}
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import { IBlendMode, IMatrixData } from '@leafer/interface'
|
|
1
|
+
import { IBlendMode, ILeaferImage, IMatrixData } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { IColorString } from './IStringType'
|
|
4
|
-
import { IStrokeAlign, IStrokeJoin, IStrokeCap } from './IType'
|
|
4
|
+
import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode } from './IType'
|
|
5
5
|
import { IPaintType } from './IType'
|
|
6
6
|
|
|
7
7
|
export type ILeafPaintColor = IColorString | CanvasGradient | CanvasPattern
|
|
8
8
|
|
|
9
9
|
export interface ILeafPaint {
|
|
10
|
-
type
|
|
11
|
-
style
|
|
10
|
+
type?: IPaintType
|
|
11
|
+
style?: ILeafPaintColor
|
|
12
12
|
transform?: IMatrixData
|
|
13
13
|
blendMode?: IBlendMode
|
|
14
14
|
opacity?: number
|
|
15
|
+
image?: ILeaferImage
|
|
16
|
+
loadId?: number
|
|
17
|
+
patternId?: string
|
|
18
|
+
data?: ILeafPaintPatternData
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ILeafPaintPatternData {
|
|
22
|
+
width?: number
|
|
23
|
+
height?: number
|
|
24
|
+
scaleX?: number
|
|
25
|
+
scaleY?: number
|
|
26
|
+
opacity?: number
|
|
27
|
+
transform?: IMatrixData
|
|
28
|
+
mode?: IImagePaintMode
|
|
15
29
|
}
|
|
16
30
|
|
|
17
31
|
export type ILeafFill = ILeafPaint
|
package/src/type/IType.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPointData, IPathCommandData, IWindingRule, IBlendMode } from '@leafer/interface'
|
|
1
|
+
import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType } from '@leafer/interface'
|
|
2
2
|
import { IColorString } from './IStringType'
|
|
3
3
|
|
|
4
4
|
export interface IUnitData {
|
|
@@ -61,6 +61,7 @@ export interface IImagePaint extends IPaintBase {
|
|
|
61
61
|
type: "image"
|
|
62
62
|
url: string
|
|
63
63
|
mode?: IImagePaintMode
|
|
64
|
+
format?: IExportFileType
|
|
64
65
|
|
|
65
66
|
filters?: IImageFilters
|
|
66
67
|
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import { IPointData, IExportFileType, IWindingRule, IPathCommandData, IBlendMode, IMatrixData, ILeaferImage, IBlob, ILeaf, IPathString, IPathCreator, IBoundsData, ILeaferImageConfig, ILeaferCanvas, IRenderOptions, IPathDrawer, ILeafData, IPath2D, ILeafComputedData, ILeafInputData, IObject, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap } from '@leafer/interface';
|
|
2
|
+
export * from '@leafer/interface';
|
|
3
|
+
|
|
4
|
+
type IPercent = string;
|
|
5
|
+
type IColorString = string;
|
|
6
|
+
type ICornerRadiusString = string;
|
|
7
|
+
type IStrokeWidthString = string;
|
|
8
|
+
type IDashPatternString = string;
|
|
9
|
+
type IPaintString = ISolidPaintString | IGradientPaintString | IImagePaintString;
|
|
10
|
+
type ISolidPaintString = string;
|
|
11
|
+
type IGradientPaintString = string;
|
|
12
|
+
type IImagePaintString = string;
|
|
13
|
+
type IShadowString = string;
|
|
14
|
+
|
|
15
|
+
interface IUnitData {
|
|
16
|
+
type: 'percent' | 'px';
|
|
17
|
+
value: number;
|
|
18
|
+
}
|
|
19
|
+
type IPaint = ISolidPaint | IGradientPaint | IImagePaint;
|
|
20
|
+
interface IPaintBase {
|
|
21
|
+
type: IPaintType;
|
|
22
|
+
blendMode?: IBlendMode;
|
|
23
|
+
visible?: boolean;
|
|
24
|
+
opacity?: number;
|
|
25
|
+
}
|
|
26
|
+
type IPaintType = 'image' | 'solid' | IGradientType;
|
|
27
|
+
type IGradientType = 'linear' | 'radial' | 'angular';
|
|
28
|
+
interface ISolidPaint extends IPaintBase {
|
|
29
|
+
type: 'solid';
|
|
30
|
+
color: IColor;
|
|
31
|
+
}
|
|
32
|
+
type IColor = IColorString | IRGB | IRGBA;
|
|
33
|
+
interface IRGB {
|
|
34
|
+
r: number;
|
|
35
|
+
g: number;
|
|
36
|
+
b: number;
|
|
37
|
+
a?: number;
|
|
38
|
+
}
|
|
39
|
+
interface IRGBA extends IRGB {
|
|
40
|
+
a: number;
|
|
41
|
+
}
|
|
42
|
+
interface IGradientPaint extends IPaintBase {
|
|
43
|
+
type: IGradientType;
|
|
44
|
+
from?: IPointData;
|
|
45
|
+
to?: IPointData;
|
|
46
|
+
stretch?: number;
|
|
47
|
+
stops: IColorStop[];
|
|
48
|
+
}
|
|
49
|
+
interface IColorStop {
|
|
50
|
+
offset: number;
|
|
51
|
+
color: IColor;
|
|
52
|
+
}
|
|
53
|
+
interface IImagePaint extends IPaintBase {
|
|
54
|
+
type: "image";
|
|
55
|
+
url: string;
|
|
56
|
+
mode?: IImagePaintMode;
|
|
57
|
+
format?: IExportFileType;
|
|
58
|
+
filters?: IImageFilters;
|
|
59
|
+
offset?: IPointData;
|
|
60
|
+
scale?: number | IPointData;
|
|
61
|
+
rotation?: number;
|
|
62
|
+
}
|
|
63
|
+
interface IImageFilters {
|
|
64
|
+
exposure?: number;
|
|
65
|
+
contrast?: number;
|
|
66
|
+
saturation?: number;
|
|
67
|
+
temperature?: number;
|
|
68
|
+
tint?: number;
|
|
69
|
+
highlights?: number;
|
|
70
|
+
shadows?: number;
|
|
71
|
+
}
|
|
72
|
+
type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
|
|
73
|
+
type IStrokeAlign = 'inside' | 'outside' | 'center';
|
|
74
|
+
type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-equilateral';
|
|
75
|
+
type IStrokeJoin = 'bevel' | 'round' | 'miter';
|
|
76
|
+
type ITextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
77
|
+
type IVerticalAlign = 'top' | 'middle' | 'bottom';
|
|
78
|
+
type ITextCase = 'upper' | 'lower' | 'title' | 'none' | 'small-caps';
|
|
79
|
+
type IFontWeight = IFontWeightNumer | IFontWeightString;
|
|
80
|
+
type IFontWeightNumer = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
81
|
+
type IFontWeightString = 'thin' | 'extra-light' | 'light' | 'normal' | 'medium' | 'semi-bold' | 'bold' | 'extra-bold' | 'black';
|
|
82
|
+
type ITextDecoration = 'none' | 'under' | 'delete';
|
|
83
|
+
interface IVectorPath {
|
|
84
|
+
rule?: IWindingRule;
|
|
85
|
+
data: string | IPathCommandData;
|
|
86
|
+
}
|
|
87
|
+
interface IShadowEffect {
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
blur: number;
|
|
91
|
+
spread?: number;
|
|
92
|
+
color: IColorString | IColor;
|
|
93
|
+
blendMode?: IBlendMode;
|
|
94
|
+
visible?: boolean;
|
|
95
|
+
box?: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface IBlurEffect {
|
|
98
|
+
blur: number;
|
|
99
|
+
visible?: boolean;
|
|
100
|
+
}
|
|
101
|
+
interface IGrayscaleEffect {
|
|
102
|
+
grayscale: number;
|
|
103
|
+
visible?: boolean;
|
|
104
|
+
}
|
|
105
|
+
type IOverflow = 'show' | 'hide';
|
|
106
|
+
|
|
107
|
+
type ILeafPaintColor = IColorString | CanvasGradient | CanvasPattern;
|
|
108
|
+
interface ILeafPaint {
|
|
109
|
+
type?: IPaintType;
|
|
110
|
+
style?: ILeafPaintColor;
|
|
111
|
+
transform?: IMatrixData;
|
|
112
|
+
blendMode?: IBlendMode;
|
|
113
|
+
opacity?: number;
|
|
114
|
+
image?: ILeaferImage;
|
|
115
|
+
loadId?: number;
|
|
116
|
+
patternId?: string;
|
|
117
|
+
data?: ILeafPaintPatternData;
|
|
118
|
+
}
|
|
119
|
+
interface ILeafPaintPatternData {
|
|
120
|
+
width?: number;
|
|
121
|
+
height?: number;
|
|
122
|
+
scaleX?: number;
|
|
123
|
+
scaleY?: number;
|
|
124
|
+
opacity?: number;
|
|
125
|
+
transform?: IMatrixData;
|
|
126
|
+
mode?: IImagePaintMode;
|
|
127
|
+
}
|
|
128
|
+
type ILeafFill = ILeafPaint;
|
|
129
|
+
interface ILeafStrokePaint extends ILeafPaint {
|
|
130
|
+
strokeAlign?: IStrokeAlign;
|
|
131
|
+
strokeWidth?: number;
|
|
132
|
+
strokeCap?: IStrokeCap;
|
|
133
|
+
strokeJoin?: IStrokeJoin;
|
|
134
|
+
dashPattern?: number[];
|
|
135
|
+
miterLimit?: number;
|
|
136
|
+
}
|
|
137
|
+
interface ILeafShadowEffect {
|
|
138
|
+
x: number;
|
|
139
|
+
y: number;
|
|
140
|
+
blur: number;
|
|
141
|
+
spread?: number;
|
|
142
|
+
color: IColorString;
|
|
143
|
+
blendMode?: IBlendMode;
|
|
144
|
+
box?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
interface ICornerRadiusAttrData {
|
|
148
|
+
cornerRadius: number | number[] | ICornerRadiusString;
|
|
149
|
+
cornerSmoothing: number;
|
|
150
|
+
}
|
|
151
|
+
interface ICornerRadiusInputData {
|
|
152
|
+
cornerRadius?: number | number[] | ICornerRadiusString;
|
|
153
|
+
cornerSmoothing?: number;
|
|
154
|
+
}
|
|
155
|
+
interface ICornerRadiusComputedData {
|
|
156
|
+
cornerRadius?: number;
|
|
157
|
+
cornerSmoothing?: number;
|
|
158
|
+
}
|
|
159
|
+
interface IFillAttrData {
|
|
160
|
+
fill: IPaint | IPaint[] | IPaintString;
|
|
161
|
+
}
|
|
162
|
+
interface IFillInputData {
|
|
163
|
+
fill?: IPaint | IPaint[] | IPaintString;
|
|
164
|
+
}
|
|
165
|
+
interface IFillComputedData {
|
|
166
|
+
fill?: IColorString | ILeafPaint[];
|
|
167
|
+
}
|
|
168
|
+
interface IBorderComputedData {
|
|
169
|
+
borderWidth?: number | number[];
|
|
170
|
+
borderRadius?: number | number[];
|
|
171
|
+
}
|
|
172
|
+
interface IStrokeAttrData {
|
|
173
|
+
stroke: IPaint | IPaint[] | IPaintString;
|
|
174
|
+
strokeAlign: IStrokeAlign;
|
|
175
|
+
strokeWidth: number | number[] | IStrokeWidthString;
|
|
176
|
+
strokeCap: IStrokeCap;
|
|
177
|
+
strokeJoin: IStrokeJoin;
|
|
178
|
+
dashPattern: number[] | IDashPatternString;
|
|
179
|
+
dashOffset: number;
|
|
180
|
+
miterLimit: number;
|
|
181
|
+
}
|
|
182
|
+
interface IStrokeInputData {
|
|
183
|
+
stroke?: IPaint | IPaint[] | IPaintString;
|
|
184
|
+
strokeAlign?: IStrokeAlign;
|
|
185
|
+
strokeWidth?: number | number[] | IStrokeWidthString;
|
|
186
|
+
strokeCap?: IStrokeCap;
|
|
187
|
+
strokeJoin?: IStrokeJoin;
|
|
188
|
+
dashPattern?: number[] | IDashPatternString;
|
|
189
|
+
dashOffset?: number;
|
|
190
|
+
miterLimit?: number;
|
|
191
|
+
}
|
|
192
|
+
interface IStrokeComputedData {
|
|
193
|
+
stroke?: IColorString | ILeafStrokePaint[];
|
|
194
|
+
strokeAlign?: IStrokeAlign;
|
|
195
|
+
strokeWidth?: number;
|
|
196
|
+
strokeWidths?: number[];
|
|
197
|
+
strokeCap?: IStrokeCap;
|
|
198
|
+
strokeJoin?: IStrokeJoin;
|
|
199
|
+
dashPattern?: number[];
|
|
200
|
+
dashOffset?: number;
|
|
201
|
+
miterLimit?: number;
|
|
202
|
+
}
|
|
203
|
+
interface ITextStyleAttrData {
|
|
204
|
+
fontFamily: string;
|
|
205
|
+
fontSize: number;
|
|
206
|
+
fontWeight: IFontWeight;
|
|
207
|
+
italic: boolean;
|
|
208
|
+
textCase: ITextCase;
|
|
209
|
+
textDecoration: ITextDecoration;
|
|
210
|
+
letterSpacing: number | IUnitData;
|
|
211
|
+
lineHeight: number | IUnitData;
|
|
212
|
+
paraIndent: number;
|
|
213
|
+
paraSpacing: number;
|
|
214
|
+
textAlign: ITextAlign;
|
|
215
|
+
verticalAlign: IVerticalAlign;
|
|
216
|
+
textOverflow: IOverflow | string;
|
|
217
|
+
}
|
|
218
|
+
interface ITextStyleInputData {
|
|
219
|
+
fontFamily?: string;
|
|
220
|
+
fontSize?: number;
|
|
221
|
+
fontWeight?: IFontWeight;
|
|
222
|
+
italic?: boolean;
|
|
223
|
+
textCase?: ITextCase;
|
|
224
|
+
textDecoration?: ITextDecoration;
|
|
225
|
+
letterSpacing?: number | IUnitData;
|
|
226
|
+
lineHeight?: number | IUnitData;
|
|
227
|
+
paraIndent?: number;
|
|
228
|
+
paraSpacing?: number;
|
|
229
|
+
textAlign?: ITextAlign;
|
|
230
|
+
verticalAlign?: IVerticalAlign;
|
|
231
|
+
textOverflow?: IOverflow | string;
|
|
232
|
+
}
|
|
233
|
+
interface ITextStyleComputedData {
|
|
234
|
+
fontFamily?: string;
|
|
235
|
+
fontSize?: number;
|
|
236
|
+
fontWeight?: IFontWeight;
|
|
237
|
+
italic?: boolean;
|
|
238
|
+
textCase?: ITextCase;
|
|
239
|
+
textDecoration?: ITextDecoration;
|
|
240
|
+
letterSpacing?: number;
|
|
241
|
+
lineHeight?: number;
|
|
242
|
+
paraIndent?: number;
|
|
243
|
+
paraSpacing?: number;
|
|
244
|
+
textAlign?: ITextAlign;
|
|
245
|
+
verticalAlign?: IVerticalAlign;
|
|
246
|
+
textOverflow?: IOverflow;
|
|
247
|
+
}
|
|
248
|
+
interface IEffectAttrData {
|
|
249
|
+
shadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
250
|
+
innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
251
|
+
blur: number | IBlurEffect;
|
|
252
|
+
backgroundBlur: number | IBlurEffect;
|
|
253
|
+
grayscale: number | IGrayscaleEffect;
|
|
254
|
+
}
|
|
255
|
+
interface IEffectInputData {
|
|
256
|
+
shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
257
|
+
innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
258
|
+
blur?: number | IBlurEffect;
|
|
259
|
+
backgroundBlur?: number | IBlurEffect;
|
|
260
|
+
grayscale?: number | IGrayscaleEffect;
|
|
261
|
+
}
|
|
262
|
+
interface IEffectComputedData {
|
|
263
|
+
shadow?: ILeafShadowEffect[];
|
|
264
|
+
innerShadow?: ILeafShadowEffect[];
|
|
265
|
+
blur?: number;
|
|
266
|
+
backgroundBlur?: number;
|
|
267
|
+
grayscale?: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface IExportOptions {
|
|
271
|
+
quality?: number;
|
|
272
|
+
blob?: boolean;
|
|
273
|
+
}
|
|
274
|
+
interface IExportResult {
|
|
275
|
+
data: IBlob | string | boolean;
|
|
276
|
+
}
|
|
277
|
+
interface IExportResultFunction {
|
|
278
|
+
(data: IExportResult): void;
|
|
279
|
+
}
|
|
280
|
+
interface IExportModule {
|
|
281
|
+
export?(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
interface ILine extends IUI {
|
|
285
|
+
__: ILineData;
|
|
286
|
+
toPoint: IPointData;
|
|
287
|
+
points: number[];
|
|
288
|
+
curve: boolean | number;
|
|
289
|
+
}
|
|
290
|
+
interface ILineData extends IUIData {
|
|
291
|
+
}
|
|
292
|
+
interface ILineInputData extends IUIBaseInputData {
|
|
293
|
+
toPoint?: IPointData;
|
|
294
|
+
points?: number[];
|
|
295
|
+
curve?: boolean | number;
|
|
296
|
+
}
|
|
297
|
+
interface IRect extends IUI {
|
|
298
|
+
__: IRectData;
|
|
299
|
+
}
|
|
300
|
+
interface IRectData extends IUIData {
|
|
301
|
+
}
|
|
302
|
+
interface IRectInputData extends IUIBaseInputData {
|
|
303
|
+
}
|
|
304
|
+
interface IEllipse extends IUI {
|
|
305
|
+
__: IEllipseData;
|
|
306
|
+
startAngle: number;
|
|
307
|
+
endAngle: number;
|
|
308
|
+
innerRadius: number;
|
|
309
|
+
}
|
|
310
|
+
interface IEllipseAttrData {
|
|
311
|
+
startAngle?: number;
|
|
312
|
+
endAngle?: number;
|
|
313
|
+
innerRadius?: number;
|
|
314
|
+
}
|
|
315
|
+
interface IEllipseData extends IEllipseAttrData, IUIData {
|
|
316
|
+
}
|
|
317
|
+
interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
|
|
318
|
+
}
|
|
319
|
+
interface IPolygon extends IUI {
|
|
320
|
+
__: IPolygonData;
|
|
321
|
+
sides: number;
|
|
322
|
+
points: number[];
|
|
323
|
+
curve: boolean | number;
|
|
324
|
+
}
|
|
325
|
+
interface IPolygonAttrData {
|
|
326
|
+
sides?: number;
|
|
327
|
+
points?: number[];
|
|
328
|
+
curve?: boolean | number;
|
|
329
|
+
}
|
|
330
|
+
interface IPolygonData extends IPolygonAttrData, IUIData {
|
|
331
|
+
}
|
|
332
|
+
interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
|
|
333
|
+
}
|
|
334
|
+
interface IStar extends IUI {
|
|
335
|
+
__: IStarData;
|
|
336
|
+
corners: number;
|
|
337
|
+
innerRadius: number;
|
|
338
|
+
}
|
|
339
|
+
interface IStarAttrData {
|
|
340
|
+
corners?: number;
|
|
341
|
+
innerRadius?: number;
|
|
342
|
+
}
|
|
343
|
+
interface IStarData extends IStarAttrData, IUIData {
|
|
344
|
+
}
|
|
345
|
+
interface IStarInputData extends IStarAttrData, IUIBaseInputData {
|
|
346
|
+
}
|
|
347
|
+
interface IPath extends IUI {
|
|
348
|
+
__: IPathData;
|
|
349
|
+
path: IPathCommandData | IPathString;
|
|
350
|
+
windingRule: IWindingRule;
|
|
351
|
+
}
|
|
352
|
+
interface IPathData extends IUIData {
|
|
353
|
+
path?: IPathCommandData;
|
|
354
|
+
windingRule?: IWindingRule;
|
|
355
|
+
}
|
|
356
|
+
interface IPathInputData extends IUIBaseInputData {
|
|
357
|
+
path?: IPathCommandData | IPathString;
|
|
358
|
+
windingRule?: IWindingRule;
|
|
359
|
+
}
|
|
360
|
+
interface IPen extends IGroup, IPathCreator {
|
|
361
|
+
__: IPenData;
|
|
362
|
+
pathElement: IPath;
|
|
363
|
+
pathStyle: IPathInputData;
|
|
364
|
+
path: IPathCommandData;
|
|
365
|
+
paint(): void;
|
|
366
|
+
clear(): void;
|
|
367
|
+
}
|
|
368
|
+
interface IPenData extends IGroupData {
|
|
369
|
+
}
|
|
370
|
+
interface IPenInputData extends IGroupInputData {
|
|
371
|
+
}
|
|
372
|
+
interface IText extends ITextStyleAttrData, IUI {
|
|
373
|
+
__: ITextData;
|
|
374
|
+
text: string;
|
|
375
|
+
}
|
|
376
|
+
interface ITextAttrData {
|
|
377
|
+
text?: string;
|
|
378
|
+
}
|
|
379
|
+
interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
380
|
+
__baseLine?: number;
|
|
381
|
+
__lineHeight?: number;
|
|
382
|
+
__letterSpacing?: number;
|
|
383
|
+
}
|
|
384
|
+
interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
|
|
385
|
+
}
|
|
386
|
+
interface ITextRowData {
|
|
387
|
+
x?: number;
|
|
388
|
+
y?: number;
|
|
389
|
+
width?: number;
|
|
390
|
+
height?: number;
|
|
391
|
+
text?: string;
|
|
392
|
+
data?: ITextCharData[];
|
|
393
|
+
words?: ITextWordData[];
|
|
394
|
+
paraStart?: boolean;
|
|
395
|
+
paraEnd?: boolean;
|
|
396
|
+
isOverflow?: boolean;
|
|
397
|
+
}
|
|
398
|
+
interface ITextWordData {
|
|
399
|
+
x?: number;
|
|
400
|
+
y?: number;
|
|
401
|
+
width?: number;
|
|
402
|
+
height?: number;
|
|
403
|
+
data?: ITextCharData[];
|
|
404
|
+
}
|
|
405
|
+
interface ITextCharData {
|
|
406
|
+
x?: number;
|
|
407
|
+
y?: number;
|
|
408
|
+
width?: number;
|
|
409
|
+
height?: number;
|
|
410
|
+
char?: string;
|
|
411
|
+
}
|
|
412
|
+
interface ITextDrawData {
|
|
413
|
+
bounds: IBoundsData;
|
|
414
|
+
rows: ITextRowData[];
|
|
415
|
+
paraNumber: number;
|
|
416
|
+
font: string;
|
|
417
|
+
decorationY?: number;
|
|
418
|
+
decorationHeight?: number;
|
|
419
|
+
overflow?: number;
|
|
420
|
+
}
|
|
421
|
+
interface IImage extends IRect, ILeaferImageConfig {
|
|
422
|
+
__: IImageData;
|
|
423
|
+
url: string;
|
|
424
|
+
ready: boolean;
|
|
425
|
+
image?: ILeaferImage;
|
|
426
|
+
}
|
|
427
|
+
interface IImageAttrData {
|
|
428
|
+
url?: string;
|
|
429
|
+
}
|
|
430
|
+
interface IImageData extends IImageAttrData, IRectData {
|
|
431
|
+
}
|
|
432
|
+
interface IImageInputData extends IImageAttrData, IUIBaseInputData {
|
|
433
|
+
}
|
|
434
|
+
interface ICanvas extends IRect {
|
|
435
|
+
__: ICanvasData;
|
|
436
|
+
pixelRatio: number;
|
|
437
|
+
smooth: boolean;
|
|
438
|
+
canvas: ILeaferCanvas;
|
|
439
|
+
__updateSize(): void;
|
|
440
|
+
}
|
|
441
|
+
interface ICanvasAttrData {
|
|
442
|
+
pixelRatio?: number;
|
|
443
|
+
smooth?: boolean;
|
|
444
|
+
}
|
|
445
|
+
interface ICanvasData extends ICanvasAttrData, IRectData {
|
|
446
|
+
}
|
|
447
|
+
interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData {
|
|
448
|
+
}
|
|
449
|
+
interface ILeaferData extends IGroupData {
|
|
450
|
+
pixelRatio?: number;
|
|
451
|
+
}
|
|
452
|
+
interface ILeaferInputData extends IGroupInputData {
|
|
453
|
+
pixelRatio?: number;
|
|
454
|
+
}
|
|
455
|
+
interface IFrame extends IBox {
|
|
456
|
+
__: IFrameData;
|
|
457
|
+
}
|
|
458
|
+
interface IFrameData extends IBoxData {
|
|
459
|
+
}
|
|
460
|
+
interface IFrameInputData extends IBoxInputData {
|
|
461
|
+
}
|
|
462
|
+
interface IBox extends IGroup {
|
|
463
|
+
__: IBoxData;
|
|
464
|
+
overflow: IOverflow;
|
|
465
|
+
__updateRectRenderBounds(): void;
|
|
466
|
+
__renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
467
|
+
}
|
|
468
|
+
interface IBoxData extends IGroupData {
|
|
469
|
+
overflow?: IOverflow;
|
|
470
|
+
}
|
|
471
|
+
interface IBoxInputData extends IGroupInputData {
|
|
472
|
+
overflow?: IOverflow;
|
|
473
|
+
}
|
|
474
|
+
interface IGroup extends IUI {
|
|
475
|
+
__: IGroupData;
|
|
476
|
+
children: IUI[];
|
|
477
|
+
mask?: IUI;
|
|
478
|
+
add(child: IUI, index?: number): void;
|
|
479
|
+
addAt(child: IUI, index: number): void;
|
|
480
|
+
addAfter(child: IUI, after: IUI): void;
|
|
481
|
+
addBefore(child: IUI, before: IUI): void;
|
|
482
|
+
remove(child?: IUI): void;
|
|
483
|
+
removeAll(): void;
|
|
484
|
+
}
|
|
485
|
+
interface IGroupData extends IUIData {
|
|
486
|
+
}
|
|
487
|
+
interface IGroupInputData extends IUIBaseInputData {
|
|
488
|
+
}
|
|
489
|
+
interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
490
|
+
__: IUIData;
|
|
491
|
+
parent?: IGroup;
|
|
492
|
+
set(data: IUIInputData): void;
|
|
493
|
+
toJSON(): IUIInputData;
|
|
494
|
+
getPath(curve?: boolean): IPathCommandData;
|
|
495
|
+
getPathString(curve?: boolean): IPathString;
|
|
496
|
+
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
497
|
+
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
498
|
+
export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>;
|
|
499
|
+
clone(): IUI;
|
|
500
|
+
}
|
|
501
|
+
interface IUIData extends IUIComputedData, ILeafData {
|
|
502
|
+
padding?: number | number[];
|
|
503
|
+
locked?: boolean;
|
|
504
|
+
__isFills?: boolean;
|
|
505
|
+
__isStrokes?: boolean;
|
|
506
|
+
__drawAfterFill?: boolean;
|
|
507
|
+
__isOverflow?: boolean;
|
|
508
|
+
__blendLayer?: boolean;
|
|
509
|
+
__isTranslucentFill?: boolean;
|
|
510
|
+
__isTranslucentStroke?: boolean;
|
|
511
|
+
__useEffect?: boolean;
|
|
512
|
+
path?: IPathCommandData;
|
|
513
|
+
windingRule?: IWindingRule;
|
|
514
|
+
__pathForRender?: IPathCommandData;
|
|
515
|
+
__path2DForRender?: IPath2D;
|
|
516
|
+
__boxStroke?: boolean;
|
|
517
|
+
__font?: string;
|
|
518
|
+
__textDrawData?: ITextDrawData;
|
|
519
|
+
}
|
|
520
|
+
interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
521
|
+
padding?: number | number[];
|
|
522
|
+
locked?: boolean;
|
|
523
|
+
}
|
|
524
|
+
interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
525
|
+
padding?: number | number[];
|
|
526
|
+
locked?: boolean;
|
|
527
|
+
children?: IUIBaseInputData[];
|
|
528
|
+
}
|
|
529
|
+
type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
|
|
530
|
+
interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
type IUIRenderModule = IUIRender & ThisType<IUI>;
|
|
534
|
+
interface IUIRender extends ILeafRender {
|
|
535
|
+
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
536
|
+
}
|
|
537
|
+
type IRectRenderModule = IRectRender & ThisType<IRect>;
|
|
538
|
+
interface IRectRender extends IUIRender {
|
|
539
|
+
}
|
|
540
|
+
type IImageRenderModule = IImageRender & ThisType<IImage>;
|
|
541
|
+
interface IImageRender extends IUIRender {
|
|
542
|
+
}
|
|
543
|
+
type ITextRenderModule = ITextRender & ThisType<IText>;
|
|
544
|
+
interface ITextRender extends IUIRender {
|
|
545
|
+
}
|
|
546
|
+
type IGroupRenderModule = IGroupRender & ThisType<IGroup>;
|
|
547
|
+
interface IGroupRender extends IUIRender {
|
|
548
|
+
}
|
|
549
|
+
type IFrameRenderModule = IFrameRender & ThisType<IFrame>;
|
|
550
|
+
interface IFrameRender extends IGroupRender {
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
type IUIBoundsModule = IUIBounds & ThisType<IUI>;
|
|
554
|
+
interface IUIBounds extends ILeafBounds {
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
type IUIHitModule = ILeafHit & ThisType<IUI>;
|
|
558
|
+
|
|
559
|
+
interface ITextConvertModule {
|
|
560
|
+
getDrawData?(content: string, style: ITextData): ITextDrawData;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
interface IColorConvertModule {
|
|
564
|
+
string?(color: IColor, opacity?: number): string;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
interface ICachedShape extends ICachedLeaf {
|
|
568
|
+
worldCanvas?: ILeaferCanvas;
|
|
569
|
+
shapeBounds: IBoundsData;
|
|
570
|
+
scaleX: number;
|
|
571
|
+
scaleY: number;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
interface IPaintModule {
|
|
575
|
+
compute?(ui: IUI, attrName: 'fill' | 'stroke'): void;
|
|
576
|
+
fill?(ui: IUI, canvas: ILeaferCanvas, fill: string): void;
|
|
577
|
+
fills?(ui: IUI, canvas: ILeaferCanvas, fills: ILeafPaint[]): void;
|
|
578
|
+
fillText?(ui: IUI, canvas: ILeaferCanvas): void;
|
|
579
|
+
stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void;
|
|
580
|
+
strokes?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void;
|
|
581
|
+
strokeText?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void;
|
|
582
|
+
strokesText?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void;
|
|
583
|
+
drawTextStroke?(ui: IUI, canvas: ILeaferCanvas): void;
|
|
584
|
+
shape?(ui: IUI, current: ILeaferCanvas, options: IRenderOptions): ICachedShape;
|
|
585
|
+
recycleImage?(data: IUIData, attrName: string): IBooleanMap;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
interface IEffectModule {
|
|
589
|
+
shadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void;
|
|
590
|
+
innerShadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void;
|
|
591
|
+
blur?(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas, options: IRenderOptions): void;
|
|
592
|
+
backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export type { IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, ICornerRadiusString, IDashPatternString, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IExportOptions, IExportResult, IExportResultFunction, IFontWeight, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGradientPaint, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintModule, IPaintString, IPath, IPathData, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IColorString as IStringColor, IStrokeAlign, IStrokeCap, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextWordData, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIRenderModule, IUITag, IUnitData, IVectorPath, IVerticalAlign };
|