@leafer-ui/interface 1.0.0-rc.2 → 1.0.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/ICommonAttr.ts +57 -39
- package/src/IUI.ts +115 -38
- package/src/app/IApp.ts +16 -0
- package/src/app/ILeafer.ts +22 -0
- package/src/editor/IEditor.ts +95 -0
- package/src/index.ts +16 -7
- package/src/module/IColorConvert.ts +1 -1
- package/src/module/IEffect.ts +5 -5
- package/src/module/IExport.ts +3 -15
- package/src/module/IPaint.ts +29 -13
- package/src/module/IPathArrow.ts +8 -0
- package/src/module/IState.ts +11 -0
- package/src/module/ITextConvert.ts +1 -1
- package/src/type/IComputedType.ts +3 -1
- package/src/type/IType.ts +34 -3
- package/types/index.d.ts +306 -100
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IPointData, IExportFileType,
|
|
1
|
+
import { IPointData, IExportFileType, IFourNumber, ISizeData, IPathCommandData, IWindingRule, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, INumber, IBoolean, IString, IPathCreator, IBoundsData, ILeaferImageConfig, ICanvasContext2DSettings, ILeaferCanvas, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IValue, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, IObject as IObject$1, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, IStateStyleType, ICachedLeaf, IBooleanMap } from '@leafer/interface';
|
|
2
2
|
export * from '@leafer/interface';
|
|
3
|
+
import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, IObject, ILeaf, 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';
|
|
3
4
|
|
|
4
5
|
type IPercent = string;
|
|
5
6
|
type IColorString = string;
|
|
@@ -17,6 +18,9 @@ interface IUnitData {
|
|
|
17
18
|
value: number;
|
|
18
19
|
}
|
|
19
20
|
type IPaint = ISolidPaint | IGradientPaint | IImagePaint;
|
|
21
|
+
type IFill = IPaint | IPaint[] | IPaintString;
|
|
22
|
+
type IStroke = IPaint | IPaint[] | IPaintString;
|
|
23
|
+
type IPaintAttr = 'fill' | 'stroke';
|
|
20
24
|
interface IPaintBase {
|
|
21
25
|
type: IPaintType;
|
|
22
26
|
blendMode?: IBlendMode;
|
|
@@ -56,9 +60,12 @@ interface IImagePaint extends IPaintBase {
|
|
|
56
60
|
mode?: IImagePaintMode;
|
|
57
61
|
format?: IExportFileType;
|
|
58
62
|
filters?: IImageFilters;
|
|
63
|
+
padding?: IFourNumber;
|
|
59
64
|
offset?: IPointData;
|
|
65
|
+
size?: number | ISizeData;
|
|
60
66
|
scale?: number | IPointData;
|
|
61
67
|
rotation?: number;
|
|
68
|
+
repeat?: IRepeat;
|
|
62
69
|
}
|
|
63
70
|
interface IImageFilters {
|
|
64
71
|
exposure?: number;
|
|
@@ -70,9 +77,24 @@ interface IImageFilters {
|
|
|
70
77
|
shadows?: number;
|
|
71
78
|
}
|
|
72
79
|
type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
|
|
80
|
+
type IRepeat = boolean | 'x' | 'y';
|
|
73
81
|
type IStrokeAlign = 'inside' | 'outside' | 'center';
|
|
74
|
-
type IStrokeCap = 'none' | 'round' | 'square'
|
|
82
|
+
type IStrokeCap = 'none' | 'round' | 'square';
|
|
75
83
|
type IStrokeJoin = 'bevel' | 'round' | 'miter';
|
|
84
|
+
type IArrowType = IPathDataArrow | 'none' | 'angle' | 'angle-side' | 'arrow' | 'triangle' | 'triangle-flip' | 'circle' | 'circle-line' | 'square' | 'square-line' | 'diamond' | 'diamond-line' | 'mark';
|
|
85
|
+
interface IPathDataArrowMap {
|
|
86
|
+
[name: string]: IPathDataArrow;
|
|
87
|
+
}
|
|
88
|
+
interface IPathDataArrow {
|
|
89
|
+
connect?: IPathDataArrowOffset;
|
|
90
|
+
offset?: IPathDataArrowOffset;
|
|
91
|
+
path: IPathCommandData;
|
|
92
|
+
}
|
|
93
|
+
interface IPathDataArrowOffset {
|
|
94
|
+
x?: number;
|
|
95
|
+
bevelJoin?: number;
|
|
96
|
+
roundJoin?: number;
|
|
97
|
+
}
|
|
76
98
|
type ITextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
77
99
|
type IVerticalAlign = 'top' | 'middle' | 'bottom';
|
|
78
100
|
type ITextCase = 'upper' | 'lower' | 'title' | 'none' | 'small-caps';
|
|
@@ -80,6 +102,7 @@ type IFontWeight = IFontWeightNumer | IFontWeightString;
|
|
|
80
102
|
type IFontWeightNumer = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
81
103
|
type IFontWeightString = 'thin' | 'extra-light' | 'light' | 'normal' | 'medium' | 'semi-bold' | 'bold' | 'extra-bold' | 'black';
|
|
82
104
|
type ITextDecoration = 'none' | 'under' | 'delete';
|
|
105
|
+
type ITextWrap = 'normal' | 'none' | 'break';
|
|
83
106
|
interface IVectorPath {
|
|
84
107
|
rule?: IWindingRule;
|
|
85
108
|
data: string | IPathCommandData;
|
|
@@ -114,6 +137,7 @@ interface ILeafPaint {
|
|
|
114
137
|
image?: ILeaferImage;
|
|
115
138
|
loadId?: number;
|
|
116
139
|
patternId?: string;
|
|
140
|
+
patternTask?: ITaskItem;
|
|
117
141
|
data?: ILeafPaintPatternData;
|
|
118
142
|
}
|
|
119
143
|
interface ILeafPaintPatternData {
|
|
@@ -124,6 +148,7 @@ interface ILeafPaintPatternData {
|
|
|
124
148
|
opacity?: number;
|
|
125
149
|
transform?: IMatrixData;
|
|
126
150
|
mode?: IImagePaintMode;
|
|
151
|
+
repeat?: 'repeat' | 'repeat-x' | 'repeat-y';
|
|
127
152
|
}
|
|
128
153
|
type ILeafFill = ILeafPaint;
|
|
129
154
|
interface ILeafStrokePaint extends ILeafPaint {
|
|
@@ -145,22 +170,22 @@ interface ILeafShadowEffect {
|
|
|
145
170
|
}
|
|
146
171
|
|
|
147
172
|
interface ICornerRadiusAttrData {
|
|
148
|
-
cornerRadius:
|
|
149
|
-
cornerSmoothing:
|
|
173
|
+
cornerRadius: INumber | INumber[] | ICornerRadiusString;
|
|
174
|
+
cornerSmoothing: INumber;
|
|
150
175
|
}
|
|
151
176
|
interface ICornerRadiusInputData {
|
|
152
|
-
cornerRadius?:
|
|
153
|
-
cornerSmoothing?:
|
|
177
|
+
cornerRadius?: INumber | INumber[] | ICornerRadiusString;
|
|
178
|
+
cornerSmoothing?: INumber;
|
|
154
179
|
}
|
|
155
180
|
interface ICornerRadiusComputedData {
|
|
156
181
|
cornerRadius?: number;
|
|
157
182
|
cornerSmoothing?: number;
|
|
158
183
|
}
|
|
159
184
|
interface IFillAttrData {
|
|
160
|
-
fill:
|
|
185
|
+
fill: IFill;
|
|
161
186
|
}
|
|
162
187
|
interface IFillInputData {
|
|
163
|
-
fill?:
|
|
188
|
+
fill?: IFill;
|
|
164
189
|
}
|
|
165
190
|
interface IFillComputedData {
|
|
166
191
|
fill?: IColorString | ILeafPaint[];
|
|
@@ -170,64 +195,75 @@ interface IBorderComputedData {
|
|
|
170
195
|
borderRadius?: number | number[];
|
|
171
196
|
}
|
|
172
197
|
interface IStrokeAttrData {
|
|
173
|
-
stroke:
|
|
198
|
+
stroke: IStroke;
|
|
174
199
|
strokeAlign: IStrokeAlign;
|
|
175
|
-
strokeWidth:
|
|
200
|
+
strokeWidth: INumber | INumber[] | IStrokeWidthString;
|
|
201
|
+
strokeWidthFixed: IBoolean;
|
|
176
202
|
strokeCap: IStrokeCap;
|
|
177
203
|
strokeJoin: IStrokeJoin;
|
|
178
|
-
dashPattern:
|
|
179
|
-
dashOffset:
|
|
180
|
-
miterLimit:
|
|
204
|
+
dashPattern: INumber[] | IDashPatternString;
|
|
205
|
+
dashOffset: INumber;
|
|
206
|
+
miterLimit: INumber;
|
|
207
|
+
startArrow: IArrowType;
|
|
208
|
+
endArrow: IArrowType;
|
|
181
209
|
}
|
|
182
210
|
interface IStrokeInputData {
|
|
183
|
-
stroke?:
|
|
211
|
+
stroke?: IStroke;
|
|
184
212
|
strokeAlign?: IStrokeAlign;
|
|
185
|
-
strokeWidth?:
|
|
213
|
+
strokeWidth?: INumber | INumber[] | IStrokeWidthString;
|
|
214
|
+
strokeWidthFixed?: IBoolean;
|
|
186
215
|
strokeCap?: IStrokeCap;
|
|
187
216
|
strokeJoin?: IStrokeJoin;
|
|
188
|
-
dashPattern?:
|
|
189
|
-
dashOffset?:
|
|
190
|
-
miterLimit?:
|
|
217
|
+
dashPattern?: INumber[] | IDashPatternString;
|
|
218
|
+
dashOffset?: INumber;
|
|
219
|
+
miterLimit?: INumber;
|
|
220
|
+
startArrow?: IArrowType;
|
|
221
|
+
endArrow?: IArrowType;
|
|
191
222
|
}
|
|
192
223
|
interface IStrokeComputedData {
|
|
193
224
|
stroke?: IColorString | ILeafStrokePaint[];
|
|
194
225
|
strokeAlign?: IStrokeAlign;
|
|
195
226
|
strokeWidth?: number;
|
|
196
227
|
strokeWidths?: number[];
|
|
228
|
+
strokeWidthFixed?: boolean;
|
|
197
229
|
strokeCap?: IStrokeCap;
|
|
198
230
|
strokeJoin?: IStrokeJoin;
|
|
199
231
|
dashPattern?: number[];
|
|
200
232
|
dashOffset?: number;
|
|
201
233
|
miterLimit?: number;
|
|
234
|
+
startArrow?: IArrowType;
|
|
235
|
+
endArrow?: IArrowType;
|
|
202
236
|
}
|
|
203
237
|
interface ITextStyleAttrData {
|
|
204
|
-
fontFamily:
|
|
205
|
-
fontSize:
|
|
238
|
+
fontFamily: IString;
|
|
239
|
+
fontSize: INumber;
|
|
206
240
|
fontWeight: IFontWeight;
|
|
207
|
-
italic:
|
|
241
|
+
italic: IBoolean;
|
|
208
242
|
textCase: ITextCase;
|
|
209
243
|
textDecoration: ITextDecoration;
|
|
210
|
-
letterSpacing:
|
|
211
|
-
lineHeight:
|
|
212
|
-
paraIndent:
|
|
213
|
-
paraSpacing:
|
|
244
|
+
letterSpacing: INumber | IUnitData;
|
|
245
|
+
lineHeight: INumber | IUnitData;
|
|
246
|
+
paraIndent: INumber;
|
|
247
|
+
paraSpacing: INumber;
|
|
214
248
|
textAlign: ITextAlign;
|
|
215
249
|
verticalAlign: IVerticalAlign;
|
|
250
|
+
textWrap: ITextWrap;
|
|
216
251
|
textOverflow: IOverflow | string;
|
|
217
252
|
}
|
|
218
253
|
interface ITextStyleInputData {
|
|
219
|
-
fontFamily?:
|
|
220
|
-
fontSize?:
|
|
254
|
+
fontFamily?: IString;
|
|
255
|
+
fontSize?: INumber;
|
|
221
256
|
fontWeight?: IFontWeight;
|
|
222
|
-
italic?:
|
|
257
|
+
italic?: IBoolean;
|
|
223
258
|
textCase?: ITextCase;
|
|
224
259
|
textDecoration?: ITextDecoration;
|
|
225
|
-
letterSpacing?:
|
|
226
|
-
lineHeight?:
|
|
227
|
-
paraIndent?:
|
|
228
|
-
paraSpacing?:
|
|
260
|
+
letterSpacing?: INumber | IUnitData;
|
|
261
|
+
lineHeight?: INumber | IUnitData;
|
|
262
|
+
paraIndent?: INumber;
|
|
263
|
+
paraSpacing?: INumber;
|
|
229
264
|
textAlign?: ITextAlign;
|
|
230
265
|
verticalAlign?: IVerticalAlign;
|
|
266
|
+
textWrap?: ITextWrap;
|
|
231
267
|
textOverflow?: IOverflow | string;
|
|
232
268
|
}
|
|
233
269
|
interface ITextStyleComputedData {
|
|
@@ -243,21 +279,22 @@ interface ITextStyleComputedData {
|
|
|
243
279
|
paraSpacing?: number;
|
|
244
280
|
textAlign?: ITextAlign;
|
|
245
281
|
verticalAlign?: IVerticalAlign;
|
|
246
|
-
|
|
282
|
+
textWrap?: ITextWrap;
|
|
283
|
+
textOverflow?: IOverflow | string;
|
|
247
284
|
}
|
|
248
285
|
interface IEffectAttrData {
|
|
249
286
|
shadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
250
287
|
innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
251
|
-
blur:
|
|
252
|
-
backgroundBlur:
|
|
253
|
-
grayscale:
|
|
288
|
+
blur: INumber | IBlurEffect;
|
|
289
|
+
backgroundBlur: INumber | IBlurEffect;
|
|
290
|
+
grayscale: INumber | IGrayscaleEffect;
|
|
254
291
|
}
|
|
255
292
|
interface IEffectInputData {
|
|
256
293
|
shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
257
294
|
innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
258
|
-
blur?:
|
|
259
|
-
backgroundBlur?:
|
|
260
|
-
grayscale?:
|
|
295
|
+
blur?: INumber | IBlurEffect;
|
|
296
|
+
backgroundBlur?: INumber | IBlurEffect;
|
|
297
|
+
grayscale?: INumber | IGrayscaleEffect;
|
|
261
298
|
}
|
|
262
299
|
interface IEffectComputedData {
|
|
263
300
|
shadow?: ILeafShadowEffect[];
|
|
@@ -267,18 +304,74 @@ interface IEffectComputedData {
|
|
|
267
304
|
grayscale?: number;
|
|
268
305
|
}
|
|
269
306
|
|
|
270
|
-
interface
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
307
|
+
interface IEditorBase extends IGroup$1, ISelectorProxy {
|
|
308
|
+
config: IEditorConfig;
|
|
309
|
+
hoverTarget: IUI$1;
|
|
310
|
+
target: IUI$1 | IUI$1[];
|
|
311
|
+
readonly list: IUI$1[];
|
|
312
|
+
readonly hasTarget: boolean;
|
|
313
|
+
readonly multiple: boolean;
|
|
314
|
+
readonly single: boolean;
|
|
315
|
+
readonly dragging: boolean;
|
|
316
|
+
element: IUI$1;
|
|
317
|
+
buttons: IGroup$1;
|
|
318
|
+
selector: IGroup$1;
|
|
319
|
+
editBox: IGroup$1;
|
|
320
|
+
editTool: IObject;
|
|
321
|
+
hasItem(item: IUI$1): boolean;
|
|
322
|
+
shiftItem(item: IUI$1): void;
|
|
323
|
+
addItem(item: IUI$1): void;
|
|
324
|
+
removeItem(item: IUI$1): void;
|
|
325
|
+
update(): void;
|
|
326
|
+
updateEditTool(): void;
|
|
327
|
+
getEditSize(ui: ILeaf): IEditSize;
|
|
328
|
+
onMove(e: IDragEvent): void;
|
|
329
|
+
onScale(e: IDragEvent): void;
|
|
330
|
+
onRotate(e: IDragEvent | IRotateEvent): void;
|
|
331
|
+
onSkew(e: IDragEvent): void;
|
|
332
|
+
group(group?: IGroup$1 | IGroupInputData$1): IGroup$1;
|
|
333
|
+
ungroup(): IUI$1[];
|
|
334
|
+
lock(): void;
|
|
335
|
+
unlock(): void;
|
|
336
|
+
toTop(): void;
|
|
337
|
+
toBottom(): void;
|
|
338
|
+
}
|
|
339
|
+
interface IEditorConfig {
|
|
340
|
+
editSize?: 'auto' | IEditSize;
|
|
341
|
+
dualEvent?: boolean;
|
|
342
|
+
keyEvent?: boolean;
|
|
343
|
+
stroke?: IStroke$1;
|
|
344
|
+
strokeWidth?: number;
|
|
345
|
+
pointFill?: IFill$1;
|
|
346
|
+
pointSize?: number;
|
|
347
|
+
pointRadius?: number;
|
|
348
|
+
point?: IBoxInputData$1 | IBoxInputData$1[];
|
|
349
|
+
middlePoint?: IBoxInputData$1 | IBoxInputData$1[];
|
|
350
|
+
rotatePoint?: IBoxInputData$1;
|
|
351
|
+
rect?: IBoxInputData$1;
|
|
352
|
+
area?: IRectInputData$1;
|
|
353
|
+
buttonsDirection?: 'top' | 'right' | 'bottom' | 'left';
|
|
354
|
+
buttonsFixed?: boolean;
|
|
355
|
+
buttonsMargin?: number;
|
|
356
|
+
hideOnMove?: boolean;
|
|
357
|
+
hideOnSmall?: boolean | number;
|
|
358
|
+
moveCursor?: ICursorType;
|
|
359
|
+
resizeCursor?: IImageCursor;
|
|
360
|
+
rotateCursor?: IImageCursor;
|
|
361
|
+
skewCursor?: IImageCursor;
|
|
362
|
+
around?: IAround;
|
|
363
|
+
lockRatio?: boolean | 'corner';
|
|
364
|
+
lockMove?: boolean | 'x' | 'y';
|
|
365
|
+
rotateGap?: number;
|
|
366
|
+
selector?: boolean;
|
|
367
|
+
hover?: boolean;
|
|
368
|
+
select?: 'press' | 'tap';
|
|
369
|
+
boxSelect?: boolean;
|
|
370
|
+
continuousSelect?: boolean;
|
|
371
|
+
moveable?: boolean;
|
|
372
|
+
rotateable?: boolean;
|
|
373
|
+
resizeable?: boolean;
|
|
374
|
+
skewable?: boolean;
|
|
282
375
|
}
|
|
283
376
|
|
|
284
377
|
interface ILine extends IUI {
|
|
@@ -287,13 +380,24 @@ interface ILine extends IUI {
|
|
|
287
380
|
points: number[];
|
|
288
381
|
curve: boolean | number;
|
|
289
382
|
}
|
|
290
|
-
interface
|
|
291
|
-
}
|
|
292
|
-
interface ILineInputData extends IUIBaseInputData {
|
|
383
|
+
interface ILineAttrData {
|
|
293
384
|
toPoint?: IPointData;
|
|
294
385
|
points?: number[];
|
|
295
386
|
curve?: boolean | number;
|
|
296
387
|
}
|
|
388
|
+
interface ILineData extends ILineAttrData, IUIData {
|
|
389
|
+
}
|
|
390
|
+
interface ILineInputData extends ILineAttrData, IUIBaseInputData {
|
|
391
|
+
}
|
|
392
|
+
interface IArrow extends ILine {
|
|
393
|
+
__: IArrowData;
|
|
394
|
+
}
|
|
395
|
+
interface IArrowAttrData {
|
|
396
|
+
}
|
|
397
|
+
interface IArrowData extends IArrowAttrData, ILineData {
|
|
398
|
+
}
|
|
399
|
+
interface IArrowInputData extends IArrowAttrData, ILineInputData {
|
|
400
|
+
}
|
|
297
401
|
interface IRect extends IUI {
|
|
298
402
|
__: IRectData;
|
|
299
403
|
}
|
|
@@ -346,16 +450,10 @@ interface IStarInputData extends IStarAttrData, IUIBaseInputData {
|
|
|
346
450
|
}
|
|
347
451
|
interface IPath extends IUI {
|
|
348
452
|
__: IPathData;
|
|
349
|
-
path: IPathCommandData | IPathString;
|
|
350
|
-
windingRule: IWindingRule;
|
|
351
453
|
}
|
|
352
454
|
interface IPathData extends IUIData {
|
|
353
|
-
path?: IPathCommandData;
|
|
354
|
-
windingRule?: IWindingRule;
|
|
355
455
|
}
|
|
356
456
|
interface IPathInputData extends IUIBaseInputData {
|
|
357
|
-
path?: IPathCommandData | IPathString;
|
|
358
|
-
windingRule?: IWindingRule;
|
|
359
457
|
}
|
|
360
458
|
interface IPen extends IGroup, IPathCreator {
|
|
361
459
|
__: IPenData;
|
|
@@ -363,7 +461,6 @@ interface IPen extends IGroup, IPathCreator {
|
|
|
363
461
|
pathStyle: IPathInputData;
|
|
364
462
|
path: IPathCommandData;
|
|
365
463
|
paint(): void;
|
|
366
|
-
clear(): void;
|
|
367
464
|
}
|
|
368
465
|
interface IPenData extends IGroupData {
|
|
369
466
|
}
|
|
@@ -380,6 +477,9 @@ interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
|
380
477
|
__baseLine?: number;
|
|
381
478
|
__lineHeight?: number;
|
|
382
479
|
__letterSpacing?: number;
|
|
480
|
+
__padding?: number[];
|
|
481
|
+
__clipText?: boolean;
|
|
482
|
+
__textBoxBounds?: IBoundsData;
|
|
383
483
|
}
|
|
384
484
|
interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
|
|
385
485
|
}
|
|
@@ -391,9 +491,12 @@ interface ITextRowData {
|
|
|
391
491
|
text?: string;
|
|
392
492
|
data?: ITextCharData[];
|
|
393
493
|
words?: ITextWordData[];
|
|
494
|
+
startCharSize?: number;
|
|
495
|
+
endCharSize?: number;
|
|
394
496
|
paraStart?: boolean;
|
|
395
497
|
paraEnd?: boolean;
|
|
396
498
|
isOverflow?: boolean;
|
|
499
|
+
textMode?: boolean;
|
|
397
500
|
}
|
|
398
501
|
interface ITextWordData {
|
|
399
502
|
x?: number;
|
|
@@ -428,29 +531,32 @@ interface IImageAttrData {
|
|
|
428
531
|
url?: string;
|
|
429
532
|
}
|
|
430
533
|
interface IImageData extends IImageAttrData, IRectData {
|
|
534
|
+
__setImageFill(value: string): void;
|
|
431
535
|
}
|
|
432
536
|
interface IImageInputData extends IImageAttrData, IUIBaseInputData {
|
|
433
537
|
}
|
|
434
538
|
interface ICanvas extends IRect {
|
|
435
539
|
__: ICanvasData;
|
|
436
|
-
pixelRatio: number;
|
|
437
540
|
smooth: boolean;
|
|
541
|
+
contextSettings: ICanvasContext2DSettings;
|
|
438
542
|
canvas: ILeaferCanvas;
|
|
439
543
|
__updateSize(): void;
|
|
440
544
|
}
|
|
441
545
|
interface ICanvasAttrData {
|
|
442
|
-
pixelRatio?: number;
|
|
443
546
|
smooth?: boolean;
|
|
547
|
+
contextSettings?: ICanvasContext2DSettings;
|
|
444
548
|
}
|
|
445
549
|
interface ICanvasData extends ICanvasAttrData, IRectData {
|
|
446
550
|
}
|
|
447
551
|
interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData {
|
|
448
552
|
}
|
|
449
553
|
interface ILeaferData extends IGroupData {
|
|
450
|
-
pixelRatio?: number;
|
|
451
554
|
}
|
|
452
555
|
interface ILeaferInputData extends IGroupInputData {
|
|
453
|
-
|
|
556
|
+
}
|
|
557
|
+
interface IAppData extends ILeaferData {
|
|
558
|
+
}
|
|
559
|
+
interface IAppInputData extends ILeaferInputData {
|
|
454
560
|
}
|
|
455
561
|
interface IFrame extends IBox {
|
|
456
562
|
__: IFrameData;
|
|
@@ -474,60 +580,128 @@ interface IBoxInputData extends IGroupInputData {
|
|
|
474
580
|
interface IGroup extends IUI {
|
|
475
581
|
__: IGroupData;
|
|
476
582
|
children: IUI[];
|
|
477
|
-
|
|
583
|
+
pick(hitPoint: IPointData, options?: IPickOptions): IPickResult;
|
|
478
584
|
add(child: IUI, index?: number): void;
|
|
479
585
|
addAt(child: IUI, index: number): void;
|
|
480
586
|
addAfter(child: IUI, after: IUI): void;
|
|
481
587
|
addBefore(child: IUI, before: IUI): void;
|
|
588
|
+
addMany(...children: ILeaf$1[]): void;
|
|
482
589
|
remove(child?: IUI): void;
|
|
483
590
|
removeAll(): void;
|
|
591
|
+
clear(): void;
|
|
484
592
|
}
|
|
485
593
|
interface IGroupData extends IUIData {
|
|
486
594
|
}
|
|
487
595
|
interface IGroupInputData extends IUIBaseInputData {
|
|
488
596
|
}
|
|
489
|
-
interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
|
|
597
|
+
interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
|
|
490
598
|
__: IUIData;
|
|
599
|
+
readonly app: ILeafer;
|
|
600
|
+
leafer?: ILeafer;
|
|
491
601
|
parent?: IGroup;
|
|
602
|
+
zoomLayer?: IGroup;
|
|
603
|
+
readonly isFrame?: boolean;
|
|
604
|
+
proxyData: IUIInputData;
|
|
605
|
+
__proxyData?: IUIInputData;
|
|
606
|
+
normalStyle: IUIInputData;
|
|
607
|
+
hoverStyle: IUIInputData;
|
|
608
|
+
pressStyle: IUIInputData;
|
|
609
|
+
focusStyle: IUIInputData;
|
|
610
|
+
selectedStyle: IUIInputData;
|
|
611
|
+
disabledStyle: IUIInputData;
|
|
612
|
+
editorStyle: IEditorConfig;
|
|
613
|
+
children?: IUI[];
|
|
614
|
+
reset(data?: IUIInputData): void;
|
|
492
615
|
set(data: IUIInputData): void;
|
|
493
616
|
toJSON(): IUIInputData;
|
|
494
|
-
|
|
495
|
-
|
|
617
|
+
get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
|
|
618
|
+
createProxyData(): IUIInputData;
|
|
619
|
+
find(condition: number | string | IFindUIMethod, options?: any): IUI[];
|
|
620
|
+
findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
|
|
621
|
+
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
|
|
622
|
+
getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
|
|
496
623
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
624
|
+
__drawPathByBox(drawer: IPathDrawer): void;
|
|
497
625
|
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
498
|
-
export(filename: string, options?: IExportOptions | number): Promise<
|
|
626
|
+
export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
499
627
|
clone(): IUI;
|
|
500
628
|
}
|
|
629
|
+
interface IFindUIMethod {
|
|
630
|
+
(leaf: IUI, options?: any): IAnswer;
|
|
631
|
+
}
|
|
501
632
|
interface IUIData extends IUIComputedData, ILeafData {
|
|
502
633
|
padding?: number | number[];
|
|
503
|
-
|
|
634
|
+
normalStyle?: IUIInputData;
|
|
635
|
+
hoverStyle?: IUIInputData;
|
|
636
|
+
pressStyle?: IUIInputData;
|
|
637
|
+
focusStyle?: IUIInputData;
|
|
638
|
+
selectedStyle?: IUIInputData;
|
|
639
|
+
disabledStyle?: IUIInputData;
|
|
640
|
+
editorStyle?: IEditorConfig;
|
|
504
641
|
__isFills?: boolean;
|
|
505
642
|
__isStrokes?: boolean;
|
|
643
|
+
readonly __strokeWidth: number;
|
|
644
|
+
__pixelFill?: boolean;
|
|
645
|
+
__pixelStroke?: boolean;
|
|
646
|
+
__isHitPixel?: boolean;
|
|
647
|
+
__opacityFill?: boolean;
|
|
648
|
+
__opacityStroke?: boolean;
|
|
506
649
|
__drawAfterFill?: boolean;
|
|
507
650
|
__isOverflow?: boolean;
|
|
508
651
|
__blendLayer?: boolean;
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
windingRule?: IWindingRule;
|
|
514
|
-
__pathForRender?: IPathCommandData;
|
|
515
|
-
__path2DForRender?: IPath2D;
|
|
652
|
+
readonly __autoWidth: boolean;
|
|
653
|
+
readonly __autoHeight: boolean;
|
|
654
|
+
readonly __autoSide: boolean;
|
|
655
|
+
readonly __autoSize: boolean;
|
|
516
656
|
__boxStroke?: boolean;
|
|
517
657
|
__font?: string;
|
|
518
658
|
__textDrawData?: ITextDrawData;
|
|
659
|
+
__needComputePaint: boolean;
|
|
660
|
+
__computePaint(): void;
|
|
519
661
|
}
|
|
520
662
|
interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
521
663
|
padding?: number | number[];
|
|
522
|
-
locked?: boolean;
|
|
523
664
|
}
|
|
524
665
|
interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
|
|
525
666
|
padding?: number | number[];
|
|
526
|
-
|
|
527
|
-
|
|
667
|
+
normalStyle?: IUIInputData;
|
|
668
|
+
hoverStyle?: IUIInputData;
|
|
669
|
+
pressStyle?: IUIInputData;
|
|
670
|
+
focusStyle?: IUIInputData;
|
|
671
|
+
selectedStyle?: IUIInputData;
|
|
672
|
+
disabledStyle?: IUIInputData;
|
|
673
|
+
editorStyle?: IEditorConfig;
|
|
674
|
+
children?: IUIInputData[];
|
|
528
675
|
}
|
|
529
676
|
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 {
|
|
677
|
+
interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject$1 {
|
|
678
|
+
children?: IUIInputData[];
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
interface ILeafer extends IGroup, ILeaferAttrData, IControl {
|
|
682
|
+
readonly isApp: boolean;
|
|
683
|
+
readonly app: ILeafer;
|
|
684
|
+
parent?: IApp;
|
|
685
|
+
zoomLayer: IGroup;
|
|
686
|
+
editor: IEditorBase;
|
|
687
|
+
ground?: ILeafer;
|
|
688
|
+
tree?: ILeafer;
|
|
689
|
+
sky?: ILeafer;
|
|
690
|
+
userConfig?: ILeaferConfig;
|
|
691
|
+
onInit(): void;
|
|
692
|
+
initType(type: ILeaferType): void;
|
|
693
|
+
destroy(sync?: boolean): void;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
interface IApp extends ILeafer {
|
|
697
|
+
children: ILeafer[];
|
|
698
|
+
realCanvas: boolean;
|
|
699
|
+
}
|
|
700
|
+
interface IAppConfig extends ILeaferConfig {
|
|
701
|
+
ground?: ILeaferConfig;
|
|
702
|
+
tree?: ILeaferConfig;
|
|
703
|
+
sky?: ILeaferConfig;
|
|
704
|
+
editor?: IEditorConfig;
|
|
531
705
|
}
|
|
532
706
|
|
|
533
707
|
type IUIRenderModule = IUIRender & ThisType<IUI>;
|
|
@@ -556,12 +730,31 @@ interface IUIBounds extends ILeafBounds {
|
|
|
556
730
|
|
|
557
731
|
type IUIHitModule = ILeafHit & ThisType<IUI>;
|
|
558
732
|
|
|
733
|
+
interface IPathArrowModule {
|
|
734
|
+
list: IPathDataArrowMap;
|
|
735
|
+
addArrows(ui: IUI, changeRenderPath?: boolean): void;
|
|
736
|
+
}
|
|
737
|
+
|
|
559
738
|
interface ITextConvertModule {
|
|
560
|
-
getDrawData
|
|
739
|
+
getDrawData(content: string, style: ITextData): ITextDrawData;
|
|
561
740
|
}
|
|
562
741
|
|
|
563
742
|
interface IColorConvertModule {
|
|
564
|
-
string
|
|
743
|
+
string(color: IColor, opacity?: number): string;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
interface IExportModule {
|
|
747
|
+
running?: boolean;
|
|
748
|
+
export(leaf: ILeaf$1, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
interface IStateModule {
|
|
752
|
+
isHover(leaf: ILeaf$1): boolean;
|
|
753
|
+
isPress(leaf: ILeaf$1): boolean;
|
|
754
|
+
isFocus(leaf: ILeaf$1): boolean;
|
|
755
|
+
isDrag(leaf: ILeaf$1): boolean;
|
|
756
|
+
setStyle(leaf: ILeaf$1, stateType: IStateStyleType, value: boolean): void;
|
|
757
|
+
updateEventStyle(leaf: ILeaf$1, eventType: string): void;
|
|
565
758
|
}
|
|
566
759
|
|
|
567
760
|
interface ICachedShape extends ICachedLeaf {
|
|
@@ -572,24 +765,37 @@ interface ICachedShape extends ICachedLeaf {
|
|
|
572
765
|
}
|
|
573
766
|
|
|
574
767
|
interface IPaintModule {
|
|
575
|
-
compute
|
|
576
|
-
fill
|
|
577
|
-
fills
|
|
578
|
-
fillText
|
|
579
|
-
stroke
|
|
580
|
-
strokes
|
|
581
|
-
strokeText
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
768
|
+
compute(attrName: IPaintAttr, ui: IUI): void;
|
|
769
|
+
fill(fill: string, ui: IUI, canvas: ILeaferCanvas): void;
|
|
770
|
+
fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
|
|
771
|
+
fillText(ui: IUI, canvas: ILeaferCanvas): void;
|
|
772
|
+
stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void;
|
|
773
|
+
strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
|
|
774
|
+
strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
|
|
775
|
+
drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void;
|
|
776
|
+
shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
|
|
777
|
+
}
|
|
778
|
+
interface IPaintImageModule {
|
|
779
|
+
image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint;
|
|
780
|
+
checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, allowPaint?: boolean): boolean;
|
|
781
|
+
createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean;
|
|
782
|
+
recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap;
|
|
783
|
+
createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void;
|
|
784
|
+
fillOrFitMode(data: ILeafPaintPatternData, mode: IImagePaintMode, box: IBoundsData, width: number, height: number, rotation: number): void;
|
|
785
|
+
clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
|
|
786
|
+
repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
|
|
787
|
+
}
|
|
788
|
+
interface IPaintGradientModule {
|
|
789
|
+
linearGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
790
|
+
radialGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
791
|
+
conicGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
586
792
|
}
|
|
587
793
|
|
|
588
794
|
interface IEffectModule {
|
|
589
|
-
shadow
|
|
590
|
-
innerShadow
|
|
591
|
-
blur
|
|
592
|
-
backgroundBlur
|
|
795
|
+
shadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
|
|
796
|
+
innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
|
|
797
|
+
blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void;
|
|
798
|
+
backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
|
|
593
799
|
}
|
|
594
800
|
|
|
595
|
-
export type { IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, ICornerRadiusString, IDashPatternString, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule,
|
|
801
|
+
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, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IStateModule, 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 };
|