@leafer-ui/interface 1.0.0-beta.11 → 1.0.0-beta.15
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 +5 -3
- package/src/index.ts +6 -4
- package/types/index.d.ts +595 -0
- package/src/ICachedShape.ts +0 -8
- package/src/ICommonAttr.ts +0 -148
- package/src/IUI.ts +0 -337
- package/src/module/IEffect.ts +0 -12
- package/src/module/IExport.ts +0 -19
- package/src/module/IPaint.ts +0 -24
- package/src/module/IUIBounds.ts +0 -8
- package/src/module/IUIHit.ts +0 -5
- package/src/module/IUIRender.ts +0 -40
- package/src/type/IComputedType.ts +0 -50
- package/src/type/IStringType.ts +0 -13
- package/src/type/IType.ts +0 -133
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interface",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.15",
|
|
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
|
-
"
|
|
10
|
+
"types",
|
|
11
|
+
"dist"
|
|
10
12
|
],
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
@@ -19,6 +21,6 @@
|
|
|
19
21
|
"leaferjs"
|
|
20
22
|
],
|
|
21
23
|
"dependencies": {
|
|
22
|
-
"@leafer/interface": "1.0.0-beta.
|
|
24
|
+
"@leafer/interface": "1.0.0-beta.15"
|
|
23
25
|
}
|
|
24
26
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,8 +15,8 @@ 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'
|
|
@@ -25,9 +25,11 @@ export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStr
|
|
|
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/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 };
|