@leafer-ui/interface 1.0.0-beta.9 → 1.0.0-rc.10
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/ICommonAttr.ts +54 -39
- package/src/IUI.ts +112 -49
- package/src/app/IApp.ts +16 -0
- package/src/app/ILeafer.ts +21 -0
- package/src/editor/IEditor.ts +88 -0
- package/src/index.ts +16 -7
- package/src/module/IColorConvert.ts +5 -0
- package/src/module/IEffect.ts +5 -5
- package/src/module/IExport.ts +2 -14
- package/src/module/IPaint.ts +31 -14
- package/src/module/ITextConvert.ts +5 -0
- package/src/type/IComputedType.ts +20 -4
- package/src/type/IType.ts +17 -2
- package/types/index.d.ts +756 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
import { IPointData, IExportFileType, ISizeData, IWindingRule, IPathCommandData, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, INumber, IBoolean, IString, IPathString, IPathCreator, IBoundsData, ILeaferImageConfig, ILeaferCanvas, IRenderOptions, IPickOptions, IPickResult, ILeaf, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, IPath2D, ILeafComputedData, ILeafInputData, IObject, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap } from '@leafer/interface';
|
|
2
|
+
export * from '@leafer/interface';
|
|
3
|
+
import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, IObject as IObject$1, ILeaf as ILeaf$1, IEditSize, IDragEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, ICursorType, IImageCursor, IAround } from '@leafer-ui/interface';
|
|
4
|
+
|
|
5
|
+
type IPercent = string;
|
|
6
|
+
type IColorString = string;
|
|
7
|
+
type ICornerRadiusString = string;
|
|
8
|
+
type IStrokeWidthString = string;
|
|
9
|
+
type IDashPatternString = string;
|
|
10
|
+
type IPaintString = ISolidPaintString | IGradientPaintString | IImagePaintString;
|
|
11
|
+
type ISolidPaintString = string;
|
|
12
|
+
type IGradientPaintString = string;
|
|
13
|
+
type IImagePaintString = string;
|
|
14
|
+
type IShadowString = string;
|
|
15
|
+
|
|
16
|
+
interface IUnitData {
|
|
17
|
+
type: 'percent' | 'px';
|
|
18
|
+
value: number;
|
|
19
|
+
}
|
|
20
|
+
type IPaint = ISolidPaint | IGradientPaint | IImagePaint;
|
|
21
|
+
type IFill = IPaint | IPaint[] | IPaintString;
|
|
22
|
+
type IStroke = IPaint | IPaint[] | IPaintString;
|
|
23
|
+
type IPaintAttr = 'fill' | 'stroke';
|
|
24
|
+
interface IPaintBase {
|
|
25
|
+
type: IPaintType;
|
|
26
|
+
blendMode?: IBlendMode;
|
|
27
|
+
visible?: boolean;
|
|
28
|
+
opacity?: number;
|
|
29
|
+
}
|
|
30
|
+
type IPaintType = 'image' | 'solid' | IGradientType;
|
|
31
|
+
type IGradientType = 'linear' | 'radial' | 'angular';
|
|
32
|
+
interface ISolidPaint extends IPaintBase {
|
|
33
|
+
type: 'solid';
|
|
34
|
+
color: IColor;
|
|
35
|
+
}
|
|
36
|
+
type IColor = IColorString | IRGB | IRGBA;
|
|
37
|
+
interface IRGB {
|
|
38
|
+
r: number;
|
|
39
|
+
g: number;
|
|
40
|
+
b: number;
|
|
41
|
+
a?: number;
|
|
42
|
+
}
|
|
43
|
+
interface IRGBA extends IRGB {
|
|
44
|
+
a: number;
|
|
45
|
+
}
|
|
46
|
+
interface IGradientPaint extends IPaintBase {
|
|
47
|
+
type: IGradientType;
|
|
48
|
+
from?: IPointData;
|
|
49
|
+
to?: IPointData;
|
|
50
|
+
stretch?: number;
|
|
51
|
+
stops: IColorStop[];
|
|
52
|
+
}
|
|
53
|
+
interface IColorStop {
|
|
54
|
+
offset: number;
|
|
55
|
+
color: IColor;
|
|
56
|
+
}
|
|
57
|
+
interface IImagePaint extends IPaintBase {
|
|
58
|
+
type: "image";
|
|
59
|
+
url: string;
|
|
60
|
+
mode?: IImagePaintMode;
|
|
61
|
+
format?: IExportFileType;
|
|
62
|
+
filters?: IImageFilters;
|
|
63
|
+
offset?: IPointData;
|
|
64
|
+
size?: number | ISizeData;
|
|
65
|
+
scale?: number | IPointData;
|
|
66
|
+
rotation?: number;
|
|
67
|
+
repeat?: IRepeat;
|
|
68
|
+
}
|
|
69
|
+
interface IImageFilters {
|
|
70
|
+
exposure?: number;
|
|
71
|
+
contrast?: number;
|
|
72
|
+
saturation?: number;
|
|
73
|
+
temperature?: number;
|
|
74
|
+
tint?: number;
|
|
75
|
+
highlights?: number;
|
|
76
|
+
shadows?: number;
|
|
77
|
+
}
|
|
78
|
+
type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
|
|
79
|
+
type IRepeat = boolean | 'x' | 'y';
|
|
80
|
+
type IStrokeAlign = 'inside' | 'outside' | 'center';
|
|
81
|
+
type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-equilateral';
|
|
82
|
+
type IStrokeJoin = 'bevel' | 'round' | 'miter';
|
|
83
|
+
type IArrowType = 'none' | 'line' | 'triangle' | 'circle';
|
|
84
|
+
type ITextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
85
|
+
type IVerticalAlign = 'top' | 'middle' | 'bottom';
|
|
86
|
+
type ITextCase = 'upper' | 'lower' | 'title' | 'none' | 'small-caps';
|
|
87
|
+
type IFontWeight = IFontWeightNumer | IFontWeightString;
|
|
88
|
+
type IFontWeightNumer = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
89
|
+
type IFontWeightString = 'thin' | 'extra-light' | 'light' | 'normal' | 'medium' | 'semi-bold' | 'bold' | 'extra-bold' | 'black';
|
|
90
|
+
type ITextDecoration = 'none' | 'under' | 'delete';
|
|
91
|
+
type ITextWrap = 'normal' | 'none' | 'break';
|
|
92
|
+
interface IVectorPath {
|
|
93
|
+
rule?: IWindingRule;
|
|
94
|
+
data: string | IPathCommandData;
|
|
95
|
+
}
|
|
96
|
+
interface IShadowEffect {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
blur: number;
|
|
100
|
+
spread?: number;
|
|
101
|
+
color: IColorString | IColor;
|
|
102
|
+
blendMode?: IBlendMode;
|
|
103
|
+
visible?: boolean;
|
|
104
|
+
box?: boolean;
|
|
105
|
+
}
|
|
106
|
+
interface IBlurEffect {
|
|
107
|
+
blur: number;
|
|
108
|
+
visible?: boolean;
|
|
109
|
+
}
|
|
110
|
+
interface IGrayscaleEffect {
|
|
111
|
+
grayscale: number;
|
|
112
|
+
visible?: boolean;
|
|
113
|
+
}
|
|
114
|
+
type IOverflow = 'show' | 'hide';
|
|
115
|
+
|
|
116
|
+
type ILeafPaintColor = IColorString | CanvasGradient | CanvasPattern;
|
|
117
|
+
interface ILeafPaint {
|
|
118
|
+
type?: IPaintType;
|
|
119
|
+
style?: ILeafPaintColor;
|
|
120
|
+
transform?: IMatrixData;
|
|
121
|
+
blendMode?: IBlendMode;
|
|
122
|
+
opacity?: number;
|
|
123
|
+
image?: ILeaferImage;
|
|
124
|
+
loadId?: number;
|
|
125
|
+
patternId?: string;
|
|
126
|
+
patternTask?: ITaskItem;
|
|
127
|
+
data?: ILeafPaintPatternData;
|
|
128
|
+
}
|
|
129
|
+
interface ILeafPaintPatternData {
|
|
130
|
+
width?: number;
|
|
131
|
+
height?: number;
|
|
132
|
+
scaleX?: number;
|
|
133
|
+
scaleY?: number;
|
|
134
|
+
opacity?: number;
|
|
135
|
+
transform?: IMatrixData;
|
|
136
|
+
mode?: IImagePaintMode;
|
|
137
|
+
repeat?: 'repeat' | 'repeat-x' | 'repeat-y';
|
|
138
|
+
}
|
|
139
|
+
type ILeafFill = ILeafPaint;
|
|
140
|
+
interface ILeafStrokePaint extends ILeafPaint {
|
|
141
|
+
strokeAlign?: IStrokeAlign;
|
|
142
|
+
strokeWidth?: number;
|
|
143
|
+
strokeCap?: IStrokeCap;
|
|
144
|
+
strokeJoin?: IStrokeJoin;
|
|
145
|
+
dashPattern?: number[];
|
|
146
|
+
miterLimit?: number;
|
|
147
|
+
}
|
|
148
|
+
interface ILeafShadowEffect {
|
|
149
|
+
x: number;
|
|
150
|
+
y: number;
|
|
151
|
+
blur: number;
|
|
152
|
+
spread?: number;
|
|
153
|
+
color: IColorString;
|
|
154
|
+
blendMode?: IBlendMode;
|
|
155
|
+
box?: boolean;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface ICornerRadiusAttrData {
|
|
159
|
+
cornerRadius: INumber | INumber[] | ICornerRadiusString;
|
|
160
|
+
cornerSmoothing: INumber;
|
|
161
|
+
}
|
|
162
|
+
interface ICornerRadiusInputData {
|
|
163
|
+
cornerRadius?: INumber | INumber[] | ICornerRadiusString;
|
|
164
|
+
cornerSmoothing?: INumber;
|
|
165
|
+
}
|
|
166
|
+
interface ICornerRadiusComputedData {
|
|
167
|
+
cornerRadius?: number;
|
|
168
|
+
cornerSmoothing?: number;
|
|
169
|
+
}
|
|
170
|
+
interface IFillAttrData {
|
|
171
|
+
fill: IFill;
|
|
172
|
+
}
|
|
173
|
+
interface IFillInputData {
|
|
174
|
+
fill?: IFill;
|
|
175
|
+
}
|
|
176
|
+
interface IFillComputedData {
|
|
177
|
+
fill?: IColorString | ILeafPaint[];
|
|
178
|
+
}
|
|
179
|
+
interface IBorderComputedData {
|
|
180
|
+
borderWidth?: number | number[];
|
|
181
|
+
borderRadius?: number | number[];
|
|
182
|
+
}
|
|
183
|
+
interface IStrokeAttrData {
|
|
184
|
+
stroke: IStroke;
|
|
185
|
+
strokeAlign: IStrokeAlign;
|
|
186
|
+
strokeWidth: INumber | INumber[] | IStrokeWidthString;
|
|
187
|
+
strokeWidthFixed: IBoolean;
|
|
188
|
+
strokeCap: IStrokeCap;
|
|
189
|
+
strokeJoin: IStrokeJoin;
|
|
190
|
+
dashPattern: INumber[] | IDashPatternString;
|
|
191
|
+
dashOffset: INumber;
|
|
192
|
+
miterLimit: INumber;
|
|
193
|
+
startArrow: IArrowType;
|
|
194
|
+
endArrow: IArrowType;
|
|
195
|
+
}
|
|
196
|
+
interface IStrokeInputData {
|
|
197
|
+
stroke?: IStroke;
|
|
198
|
+
strokeAlign?: IStrokeAlign;
|
|
199
|
+
strokeWidth?: INumber | INumber[] | IStrokeWidthString;
|
|
200
|
+
strokeWidthFixed?: IBoolean;
|
|
201
|
+
strokeCap?: IStrokeCap;
|
|
202
|
+
strokeJoin?: IStrokeJoin;
|
|
203
|
+
dashPattern?: INumber[] | IDashPatternString;
|
|
204
|
+
dashOffset?: INumber;
|
|
205
|
+
miterLimit?: INumber;
|
|
206
|
+
startArrow?: IArrowType;
|
|
207
|
+
endArrow?: IArrowType;
|
|
208
|
+
}
|
|
209
|
+
interface IStrokeComputedData {
|
|
210
|
+
stroke?: IColorString | ILeafStrokePaint[];
|
|
211
|
+
strokeAlign?: IStrokeAlign;
|
|
212
|
+
strokeWidth?: number;
|
|
213
|
+
strokeWidths?: number[];
|
|
214
|
+
strokeWidthFixed?: boolean;
|
|
215
|
+
strokeCap?: IStrokeCap;
|
|
216
|
+
strokeJoin?: IStrokeJoin;
|
|
217
|
+
dashPattern?: number[];
|
|
218
|
+
dashOffset?: number;
|
|
219
|
+
miterLimit?: number;
|
|
220
|
+
}
|
|
221
|
+
interface ITextStyleAttrData {
|
|
222
|
+
fontFamily: IString;
|
|
223
|
+
fontSize: INumber;
|
|
224
|
+
fontWeight: IFontWeight;
|
|
225
|
+
italic: IBoolean;
|
|
226
|
+
textCase: ITextCase;
|
|
227
|
+
textDecoration: ITextDecoration;
|
|
228
|
+
letterSpacing: INumber | IUnitData;
|
|
229
|
+
lineHeight: INumber | IUnitData;
|
|
230
|
+
paraIndent: INumber;
|
|
231
|
+
paraSpacing: INumber;
|
|
232
|
+
textAlign: ITextAlign;
|
|
233
|
+
verticalAlign: IVerticalAlign;
|
|
234
|
+
textWrap: ITextWrap;
|
|
235
|
+
textOverflow: IOverflow | string;
|
|
236
|
+
}
|
|
237
|
+
interface ITextStyleInputData {
|
|
238
|
+
fontFamily?: IString;
|
|
239
|
+
fontSize?: INumber;
|
|
240
|
+
fontWeight?: IFontWeight;
|
|
241
|
+
italic?: IBoolean;
|
|
242
|
+
textCase?: ITextCase;
|
|
243
|
+
textDecoration?: ITextDecoration;
|
|
244
|
+
letterSpacing?: INumber | IUnitData;
|
|
245
|
+
lineHeight?: INumber | IUnitData;
|
|
246
|
+
paraIndent?: INumber;
|
|
247
|
+
paraSpacing?: INumber;
|
|
248
|
+
textAlign?: ITextAlign;
|
|
249
|
+
verticalAlign?: IVerticalAlign;
|
|
250
|
+
textWrap?: ITextWrap;
|
|
251
|
+
textOverflow?: IOverflow | string;
|
|
252
|
+
}
|
|
253
|
+
interface ITextStyleComputedData {
|
|
254
|
+
fontFamily?: string;
|
|
255
|
+
fontSize?: number;
|
|
256
|
+
fontWeight?: IFontWeight;
|
|
257
|
+
italic?: boolean;
|
|
258
|
+
textCase?: ITextCase;
|
|
259
|
+
textDecoration?: ITextDecoration;
|
|
260
|
+
letterSpacing?: number;
|
|
261
|
+
lineHeight?: number;
|
|
262
|
+
paraIndent?: number;
|
|
263
|
+
paraSpacing?: number;
|
|
264
|
+
textAlign?: ITextAlign;
|
|
265
|
+
verticalAlign?: IVerticalAlign;
|
|
266
|
+
textWrap?: ITextWrap;
|
|
267
|
+
textOverflow?: IOverflow | string;
|
|
268
|
+
}
|
|
269
|
+
interface IEffectAttrData {
|
|
270
|
+
shadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
271
|
+
innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
272
|
+
blur: INumber | IBlurEffect;
|
|
273
|
+
backgroundBlur: INumber | IBlurEffect;
|
|
274
|
+
grayscale: INumber | IGrayscaleEffect;
|
|
275
|
+
}
|
|
276
|
+
interface IEffectInputData {
|
|
277
|
+
shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
278
|
+
innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
279
|
+
blur?: INumber | IBlurEffect;
|
|
280
|
+
backgroundBlur?: INumber | IBlurEffect;
|
|
281
|
+
grayscale?: INumber | IGrayscaleEffect;
|
|
282
|
+
}
|
|
283
|
+
interface IEffectComputedData {
|
|
284
|
+
shadow?: ILeafShadowEffect[];
|
|
285
|
+
innerShadow?: ILeafShadowEffect[];
|
|
286
|
+
blur?: number;
|
|
287
|
+
backgroundBlur?: number;
|
|
288
|
+
grayscale?: number;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
interface ILine extends IUI {
|
|
292
|
+
__: ILineData;
|
|
293
|
+
toPoint: IPointData;
|
|
294
|
+
points: number[];
|
|
295
|
+
curve: boolean | number;
|
|
296
|
+
}
|
|
297
|
+
interface ILineAttrData {
|
|
298
|
+
toPoint?: IPointData;
|
|
299
|
+
points?: number[];
|
|
300
|
+
curve?: boolean | number;
|
|
301
|
+
}
|
|
302
|
+
interface ILineData extends ILineAttrData, IUIData {
|
|
303
|
+
}
|
|
304
|
+
interface ILineInputData extends ILineAttrData, IUIBaseInputData {
|
|
305
|
+
}
|
|
306
|
+
interface IArrow extends ILine {
|
|
307
|
+
__: IArrowData;
|
|
308
|
+
}
|
|
309
|
+
interface IArrowAttrData {
|
|
310
|
+
}
|
|
311
|
+
interface IArrowData extends IArrowAttrData, ILineData {
|
|
312
|
+
}
|
|
313
|
+
interface IArrowInputData extends IArrowAttrData, IUIBaseInputData {
|
|
314
|
+
}
|
|
315
|
+
interface IRect extends IUI {
|
|
316
|
+
__: IRectData;
|
|
317
|
+
}
|
|
318
|
+
interface IRectData extends IUIData {
|
|
319
|
+
}
|
|
320
|
+
interface IRectInputData extends IUIBaseInputData {
|
|
321
|
+
}
|
|
322
|
+
interface IEllipse extends IUI {
|
|
323
|
+
__: IEllipseData;
|
|
324
|
+
startAngle: number;
|
|
325
|
+
endAngle: number;
|
|
326
|
+
innerRadius: number;
|
|
327
|
+
}
|
|
328
|
+
interface IEllipseAttrData {
|
|
329
|
+
startAngle?: number;
|
|
330
|
+
endAngle?: number;
|
|
331
|
+
innerRadius?: number;
|
|
332
|
+
}
|
|
333
|
+
interface IEllipseData extends IEllipseAttrData, IUIData {
|
|
334
|
+
}
|
|
335
|
+
interface IEllipseInputData extends IEllipseAttrData, IUIBaseInputData {
|
|
336
|
+
}
|
|
337
|
+
interface IPolygon extends IUI {
|
|
338
|
+
__: IPolygonData;
|
|
339
|
+
sides: number;
|
|
340
|
+
points: number[];
|
|
341
|
+
curve: boolean | number;
|
|
342
|
+
}
|
|
343
|
+
interface IPolygonAttrData {
|
|
344
|
+
sides?: number;
|
|
345
|
+
points?: number[];
|
|
346
|
+
curve?: boolean | number;
|
|
347
|
+
}
|
|
348
|
+
interface IPolygonData extends IPolygonAttrData, IUIData {
|
|
349
|
+
}
|
|
350
|
+
interface IPolygonInputData extends IPolygonAttrData, IUIBaseInputData {
|
|
351
|
+
}
|
|
352
|
+
interface IStar extends IUI {
|
|
353
|
+
__: IStarData;
|
|
354
|
+
corners: number;
|
|
355
|
+
innerRadius: number;
|
|
356
|
+
}
|
|
357
|
+
interface IStarAttrData {
|
|
358
|
+
corners?: number;
|
|
359
|
+
innerRadius?: number;
|
|
360
|
+
}
|
|
361
|
+
interface IStarData extends IStarAttrData, IUIData {
|
|
362
|
+
}
|
|
363
|
+
interface IStarInputData extends IStarAttrData, IUIBaseInputData {
|
|
364
|
+
}
|
|
365
|
+
interface IPath extends IUI {
|
|
366
|
+
__: IPathData;
|
|
367
|
+
path: IPathCommandData | IPathString;
|
|
368
|
+
windingRule: IWindingRule;
|
|
369
|
+
}
|
|
370
|
+
interface IPathData extends IUIData {
|
|
371
|
+
path?: IPathCommandData;
|
|
372
|
+
windingRule?: IWindingRule;
|
|
373
|
+
}
|
|
374
|
+
interface IPathInputData extends IUIBaseInputData {
|
|
375
|
+
path?: IPathCommandData | IPathString;
|
|
376
|
+
windingRule?: IWindingRule;
|
|
377
|
+
}
|
|
378
|
+
interface IPen extends IGroup, IPathCreator {
|
|
379
|
+
__: IPenData;
|
|
380
|
+
pathElement: IPath;
|
|
381
|
+
pathStyle: IPathInputData;
|
|
382
|
+
path: IPathCommandData;
|
|
383
|
+
paint(): void;
|
|
384
|
+
clear(): void;
|
|
385
|
+
}
|
|
386
|
+
interface IPenData extends IGroupData {
|
|
387
|
+
}
|
|
388
|
+
interface IPenInputData extends IGroupInputData {
|
|
389
|
+
}
|
|
390
|
+
interface IText extends ITextStyleAttrData, IUI {
|
|
391
|
+
__: ITextData;
|
|
392
|
+
text: string;
|
|
393
|
+
}
|
|
394
|
+
interface ITextAttrData {
|
|
395
|
+
text?: string;
|
|
396
|
+
}
|
|
397
|
+
interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
398
|
+
__baseLine?: number;
|
|
399
|
+
__lineHeight?: number;
|
|
400
|
+
__letterSpacing?: number;
|
|
401
|
+
__padding?: number[];
|
|
402
|
+
__clipText?: boolean;
|
|
403
|
+
__textBoxBounds?: IBoundsData;
|
|
404
|
+
}
|
|
405
|
+
interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
|
|
406
|
+
}
|
|
407
|
+
interface ITextRowData {
|
|
408
|
+
x?: number;
|
|
409
|
+
y?: number;
|
|
410
|
+
width?: number;
|
|
411
|
+
height?: number;
|
|
412
|
+
text?: string;
|
|
413
|
+
data?: ITextCharData[];
|
|
414
|
+
words?: ITextWordData[];
|
|
415
|
+
startCharSize?: number;
|
|
416
|
+
endCharSize?: number;
|
|
417
|
+
paraStart?: boolean;
|
|
418
|
+
paraEnd?: boolean;
|
|
419
|
+
isOverflow?: boolean;
|
|
420
|
+
textMode?: boolean;
|
|
421
|
+
}
|
|
422
|
+
interface ITextWordData {
|
|
423
|
+
x?: number;
|
|
424
|
+
y?: number;
|
|
425
|
+
width?: number;
|
|
426
|
+
height?: number;
|
|
427
|
+
data?: ITextCharData[];
|
|
428
|
+
}
|
|
429
|
+
interface ITextCharData {
|
|
430
|
+
x?: number;
|
|
431
|
+
y?: number;
|
|
432
|
+
width?: number;
|
|
433
|
+
height?: number;
|
|
434
|
+
char?: string;
|
|
435
|
+
}
|
|
436
|
+
interface ITextDrawData {
|
|
437
|
+
bounds: IBoundsData;
|
|
438
|
+
rows: ITextRowData[];
|
|
439
|
+
paraNumber: number;
|
|
440
|
+
font: string;
|
|
441
|
+
decorationY?: number;
|
|
442
|
+
decorationHeight?: number;
|
|
443
|
+
overflow?: number;
|
|
444
|
+
}
|
|
445
|
+
interface IImage extends IRect, ILeaferImageConfig {
|
|
446
|
+
__: IImageData;
|
|
447
|
+
url: string;
|
|
448
|
+
ready: boolean;
|
|
449
|
+
image?: ILeaferImage;
|
|
450
|
+
}
|
|
451
|
+
interface IImageAttrData {
|
|
452
|
+
url?: string;
|
|
453
|
+
}
|
|
454
|
+
interface IImageData extends IImageAttrData, IRectData {
|
|
455
|
+
__setImageFill(value: string): void;
|
|
456
|
+
}
|
|
457
|
+
interface IImageInputData extends IImageAttrData, IUIBaseInputData {
|
|
458
|
+
}
|
|
459
|
+
interface ICanvas extends IRect {
|
|
460
|
+
__: ICanvasData;
|
|
461
|
+
pixelRatio: number;
|
|
462
|
+
smooth: boolean;
|
|
463
|
+
canvas: ILeaferCanvas;
|
|
464
|
+
__updateSize(): void;
|
|
465
|
+
}
|
|
466
|
+
interface ICanvasAttrData {
|
|
467
|
+
pixelRatio?: number;
|
|
468
|
+
smooth?: boolean;
|
|
469
|
+
}
|
|
470
|
+
interface ICanvasData extends ICanvasAttrData, IRectData {
|
|
471
|
+
}
|
|
472
|
+
interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData {
|
|
473
|
+
}
|
|
474
|
+
interface ILeaferData extends IGroupData {
|
|
475
|
+
pixelRatio?: number;
|
|
476
|
+
}
|
|
477
|
+
interface ILeaferInputData extends IGroupInputData {
|
|
478
|
+
pixelRatio?: number;
|
|
479
|
+
}
|
|
480
|
+
interface IAppData extends ILeaferData {
|
|
481
|
+
}
|
|
482
|
+
interface IAppInputData extends ILeaferInputData {
|
|
483
|
+
}
|
|
484
|
+
interface IFrame extends IBox {
|
|
485
|
+
__: IFrameData;
|
|
486
|
+
}
|
|
487
|
+
interface IFrameData extends IBoxData {
|
|
488
|
+
}
|
|
489
|
+
interface IFrameInputData extends IBoxInputData {
|
|
490
|
+
}
|
|
491
|
+
interface IBox extends IGroup {
|
|
492
|
+
__: IBoxData;
|
|
493
|
+
overflow: IOverflow;
|
|
494
|
+
__updateRectRenderBounds(): void;
|
|
495
|
+
__renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
496
|
+
}
|
|
497
|
+
interface IBoxData extends IGroupData {
|
|
498
|
+
overflow?: IOverflow;
|
|
499
|
+
}
|
|
500
|
+
interface IBoxInputData extends IGroupInputData {
|
|
501
|
+
overflow?: IOverflow;
|
|
502
|
+
}
|
|
503
|
+
interface IGroup extends IUI {
|
|
504
|
+
__: IGroupData;
|
|
505
|
+
children: IUI[];
|
|
506
|
+
pick(hitPoint: IPointData, options?: IPickOptions): IPickResult;
|
|
507
|
+
add(child: IUI, index?: number): void;
|
|
508
|
+
addAt(child: IUI, index: number): void;
|
|
509
|
+
addAfter(child: IUI, after: IUI): void;
|
|
510
|
+
addBefore(child: IUI, before: IUI): void;
|
|
511
|
+
addMany(...children: ILeaf[]): void;
|
|
512
|
+
remove(child?: IUI): void;
|
|
513
|
+
removeAll(): void;
|
|
514
|
+
clear(): void;
|
|
515
|
+
}
|
|
516
|
+
interface IGroupData extends IUIData {
|
|
517
|
+
}
|
|
518
|
+
interface IGroupInputData extends IUIBaseInputData {
|
|
519
|
+
}
|
|
520
|
+
interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
521
|
+
__: IUIData;
|
|
522
|
+
readonly app: ILeafer;
|
|
523
|
+
leafer?: ILeafer;
|
|
524
|
+
parent?: IGroup;
|
|
525
|
+
isFrame?: boolean;
|
|
526
|
+
proxyData: IUIInputData;
|
|
527
|
+
__proxyData?: IUIInputData;
|
|
528
|
+
children?: IUI[];
|
|
529
|
+
reset(data?: IUIInputData): void;
|
|
530
|
+
set(data: IUIInputData): void;
|
|
531
|
+
toJSON(): IUIInputData;
|
|
532
|
+
get(): IUIInputData;
|
|
533
|
+
createProxyData(): IUIInputData;
|
|
534
|
+
find(condition: number | string | IFindUIMethod, options?: any): IUI[];
|
|
535
|
+
findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
|
|
536
|
+
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
|
|
537
|
+
getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
|
|
538
|
+
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
539
|
+
__drawPathByBox(drawer: IPathDrawer): void;
|
|
540
|
+
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
541
|
+
export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
542
|
+
clone(): IUI;
|
|
543
|
+
}
|
|
544
|
+
interface IFindUIMethod {
|
|
545
|
+
(leaf: IUI, options?: any): IAnswer;
|
|
546
|
+
}
|
|
547
|
+
interface IUIData extends IUIComputedData, ILeafData {
|
|
548
|
+
padding?: number | number[];
|
|
549
|
+
locked?: boolean;
|
|
550
|
+
__isFills?: boolean;
|
|
551
|
+
__isStrokes?: boolean;
|
|
552
|
+
readonly __strokeWidth: number;
|
|
553
|
+
__pixelFill?: boolean;
|
|
554
|
+
__pixelStroke?: boolean;
|
|
555
|
+
__opacityFill?: boolean;
|
|
556
|
+
__opacityStroke?: boolean;
|
|
557
|
+
__drawAfterFill?: boolean;
|
|
558
|
+
__isOverflow?: boolean;
|
|
559
|
+
__blendLayer?: boolean;
|
|
560
|
+
__useEffect?: boolean;
|
|
561
|
+
__autoWidth: boolean;
|
|
562
|
+
__autoHeight: boolean;
|
|
563
|
+
__autoBounds: boolean;
|
|
564
|
+
path?: IPathCommandData;
|
|
565
|
+
windingRule?: IWindingRule;
|
|
566
|
+
__pathForRender?: IPathCommandData;
|
|
567
|
+
__path2DForRender?: IPath2D;
|
|
568
|
+
__boxStroke?: boolean;
|
|
569
|
+
__font?: string;
|
|
570
|
+
__textDrawData?: ITextDrawData;
|
|
571
|
+
__needComputePaint: boolean;
|
|
572
|
+
__computePaint(): void;
|
|
573
|
+
}
|
|
574
|
+
interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
575
|
+
padding?: number | number[];
|
|
576
|
+
locked?: boolean;
|
|
577
|
+
}
|
|
578
|
+
interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
579
|
+
padding?: number | number[];
|
|
580
|
+
locked?: boolean;
|
|
581
|
+
children?: IUIInputData[];
|
|
582
|
+
}
|
|
583
|
+
type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
|
|
584
|
+
interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
|
|
585
|
+
children?: IUIInputData[];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
interface IEditorBase extends IGroup$1, ISelectorProxy {
|
|
589
|
+
config: IEditorConfig;
|
|
590
|
+
hoverTarget: IUI$1;
|
|
591
|
+
target: IUI$1 | IUI$1[];
|
|
592
|
+
readonly list: IUI$1[];
|
|
593
|
+
readonly hasTarget: boolean;
|
|
594
|
+
readonly multiple: boolean;
|
|
595
|
+
readonly single: boolean;
|
|
596
|
+
readonly dragging: boolean;
|
|
597
|
+
element: IUI$1;
|
|
598
|
+
buttons: IGroup$1;
|
|
599
|
+
selector: IGroup$1;
|
|
600
|
+
editBox: IGroup$1;
|
|
601
|
+
editTool: IObject$1;
|
|
602
|
+
hasItem(item: IUI$1): boolean;
|
|
603
|
+
shiftItem(item: IUI$1): void;
|
|
604
|
+
addItem(item: IUI$1): void;
|
|
605
|
+
removeItem(item: IUI$1): void;
|
|
606
|
+
update(): void;
|
|
607
|
+
updateEditTool(): void;
|
|
608
|
+
getEditSize(ui: ILeaf$1): IEditSize;
|
|
609
|
+
onMove(e: IDragEvent): void;
|
|
610
|
+
onScale(e: IDragEvent): void;
|
|
611
|
+
onRotate(e: IDragEvent | IRotateEvent): void;
|
|
612
|
+
onSkew(e: IDragEvent): void;
|
|
613
|
+
group(group?: IGroup$1 | IGroupInputData$1): IGroup$1;
|
|
614
|
+
ungroup(): IUI$1[];
|
|
615
|
+
lock(): void;
|
|
616
|
+
unlock(): void;
|
|
617
|
+
toTop(): void;
|
|
618
|
+
toBottom(): void;
|
|
619
|
+
}
|
|
620
|
+
interface IEditorConfig {
|
|
621
|
+
editSize?: 'auto' | IEditSize;
|
|
622
|
+
stroke?: IStroke$1;
|
|
623
|
+
strokeWidth?: number;
|
|
624
|
+
pointFill?: IFill$1;
|
|
625
|
+
pointSize?: number;
|
|
626
|
+
pointRadius?: number;
|
|
627
|
+
point?: IBoxInputData$1 | IBoxInputData$1[];
|
|
628
|
+
middlePoint?: IBoxInputData$1 | IBoxInputData$1[];
|
|
629
|
+
rotatePoint?: IBoxInputData$1;
|
|
630
|
+
rect?: IBoxInputData$1;
|
|
631
|
+
area?: IRectInputData$1;
|
|
632
|
+
buttonsDirection?: 'top' | 'right' | 'bottom' | 'left';
|
|
633
|
+
buttonsFixed?: boolean;
|
|
634
|
+
buttonsMargin?: number;
|
|
635
|
+
hideOnMove?: boolean;
|
|
636
|
+
moveCursor?: ICursorType;
|
|
637
|
+
resizeCursor?: IImageCursor;
|
|
638
|
+
rotateCursor?: IImageCursor;
|
|
639
|
+
skewCursor?: IImageCursor;
|
|
640
|
+
around?: IAround;
|
|
641
|
+
lockRatio?: boolean;
|
|
642
|
+
rotateGap?: number;
|
|
643
|
+
selector?: boolean;
|
|
644
|
+
hover?: boolean;
|
|
645
|
+
boxSelect?: boolean;
|
|
646
|
+
rotateable?: boolean;
|
|
647
|
+
resizeable?: boolean;
|
|
648
|
+
skewable?: boolean;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
interface ILeafer extends IGroup, ILeaferAttrData, IControl {
|
|
652
|
+
readonly isApp: boolean;
|
|
653
|
+
readonly app: ILeafer;
|
|
654
|
+
parent?: IApp;
|
|
655
|
+
zoomLayer: IGroup;
|
|
656
|
+
editor: IEditorBase;
|
|
657
|
+
ground?: ILeafer;
|
|
658
|
+
tree?: ILeafer;
|
|
659
|
+
sky?: ILeafer;
|
|
660
|
+
userConfig?: ILeaferConfig;
|
|
661
|
+
onInit(): void;
|
|
662
|
+
initType(type: ILeaferType): void;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
interface IApp extends ILeafer {
|
|
666
|
+
children: ILeafer[];
|
|
667
|
+
realCanvas: boolean;
|
|
668
|
+
}
|
|
669
|
+
interface IAppConfig extends ILeaferConfig {
|
|
670
|
+
ground?: ILeaferConfig;
|
|
671
|
+
tree?: ILeaferConfig;
|
|
672
|
+
sky?: ILeaferConfig;
|
|
673
|
+
editor?: IEditorConfig;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
type IUIRenderModule = IUIRender & ThisType<IUI>;
|
|
677
|
+
interface IUIRender extends ILeafRender {
|
|
678
|
+
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
679
|
+
}
|
|
680
|
+
type IRectRenderModule = IRectRender & ThisType<IRect>;
|
|
681
|
+
interface IRectRender extends IUIRender {
|
|
682
|
+
}
|
|
683
|
+
type IImageRenderModule = IImageRender & ThisType<IImage>;
|
|
684
|
+
interface IImageRender extends IUIRender {
|
|
685
|
+
}
|
|
686
|
+
type ITextRenderModule = ITextRender & ThisType<IText>;
|
|
687
|
+
interface ITextRender extends IUIRender {
|
|
688
|
+
}
|
|
689
|
+
type IGroupRenderModule = IGroupRender & ThisType<IGroup>;
|
|
690
|
+
interface IGroupRender extends IUIRender {
|
|
691
|
+
}
|
|
692
|
+
type IFrameRenderModule = IFrameRender & ThisType<IFrame>;
|
|
693
|
+
interface IFrameRender extends IGroupRender {
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
type IUIBoundsModule = IUIBounds & ThisType<IUI>;
|
|
697
|
+
interface IUIBounds extends ILeafBounds {
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
type IUIHitModule = ILeafHit & ThisType<IUI>;
|
|
701
|
+
|
|
702
|
+
interface ITextConvertModule {
|
|
703
|
+
getDrawData(content: string, style: ITextData): ITextDrawData;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
interface IColorConvertModule {
|
|
707
|
+
string(color: IColor, opacity?: number): string;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
interface IExportModule {
|
|
711
|
+
running?: boolean;
|
|
712
|
+
export(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
interface ICachedShape extends ICachedLeaf {
|
|
716
|
+
worldCanvas?: ILeaferCanvas;
|
|
717
|
+
shapeBounds: IBoundsData;
|
|
718
|
+
scaleX: number;
|
|
719
|
+
scaleY: number;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
interface IPaintModule {
|
|
723
|
+
compute(attrName: IPaintAttr, ui: IUI): void;
|
|
724
|
+
fill(fill: string, ui: IUI, canvas: ILeaferCanvas): void;
|
|
725
|
+
fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
|
|
726
|
+
fillText(ui: IUI, canvas: ILeaferCanvas): void;
|
|
727
|
+
stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void;
|
|
728
|
+
strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
|
|
729
|
+
strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
|
|
730
|
+
drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void;
|
|
731
|
+
shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
|
|
732
|
+
}
|
|
733
|
+
interface IPaintImageModule {
|
|
734
|
+
image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint;
|
|
735
|
+
checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, allowPaint?: boolean): boolean;
|
|
736
|
+
createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean;
|
|
737
|
+
recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap;
|
|
738
|
+
createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void;
|
|
739
|
+
fillOrFitMode(data: ILeafPaintPatternData, mode: IImagePaintMode, box: IBoundsData, width: number, height: number, rotation: number): void;
|
|
740
|
+
clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
|
|
741
|
+
repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
|
|
742
|
+
}
|
|
743
|
+
interface IPaintGradientModule {
|
|
744
|
+
linearGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
745
|
+
radialGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
746
|
+
conicGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
interface IEffectModule {
|
|
750
|
+
shadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
|
|
751
|
+
innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
|
|
752
|
+
blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void;
|
|
753
|
+
backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditorBase, IEditorConfig, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFontWeight, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGradientPaint, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPath, IPathData, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IStroke, IStrokeAlign, IStrokeCap, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextWordData, ITextWrap, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIRenderModule, IUITag, IUnitData, IVectorPath, IVerticalAlign };
|