@leafer-ui/interface 1.0.0-rc.21 → 1.0.0-rc.23
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 +6 -6
- package/src/IUI.ts +21 -8
- package/src/editor/IEditor.ts +73 -7
- package/src/index.ts +3 -2
- package/src/module/IPaint.ts +4 -4
- package/src/type/IType.ts +5 -7
- package/types/index.d.ts +91 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interface",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.23",
|
|
4
4
|
"description": "@leafer-ui/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-rc.
|
|
25
|
+
"@leafer/interface": "1.0.0-rc.23"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/ICommonAttr.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { INumber, IBoolean, IString } from '@leafer/interface'
|
|
2
|
-
import { IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow,
|
|
1
|
+
import { INumber, IBoolean, IString, IFourNumber, IUnitData } from '@leafer/interface'
|
|
2
|
+
import { IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IStroke, IFill, IArrowType } from './type/IType'
|
|
3
3
|
import { ILeafStrokePaint, ILeafShadowEffect, ILeafPaint } from './type/IComputedType'
|
|
4
4
|
import { IDashPatternString, IShadowString, IColorString, IStrokeWidthString, ICornerRadiusString } from './type/IStringType'
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
// corner---
|
|
8
8
|
export interface ICornerRadiusAttrData {
|
|
9
|
-
cornerRadius:
|
|
9
|
+
cornerRadius: IFourNumber | ICornerRadiusString
|
|
10
10
|
cornerSmoothing: INumber
|
|
11
11
|
}
|
|
12
12
|
export interface ICornerRadiusInputData {
|
|
13
|
-
cornerRadius?:
|
|
13
|
+
cornerRadius?: IFourNumber | ICornerRadiusString
|
|
14
14
|
cornerSmoothing?: INumber
|
|
15
15
|
}
|
|
16
16
|
export interface ICornerRadiusComputedData {
|
|
@@ -40,7 +40,7 @@ export interface IStrokeAttrData {
|
|
|
40
40
|
stroke: IStroke
|
|
41
41
|
|
|
42
42
|
strokeAlign: IStrokeAlign
|
|
43
|
-
strokeWidth:
|
|
43
|
+
strokeWidth: IFourNumber | IStrokeWidthString
|
|
44
44
|
strokeWidthFixed: IBoolean
|
|
45
45
|
strokeCap: IStrokeCap
|
|
46
46
|
strokeJoin: IStrokeJoin
|
|
@@ -55,7 +55,7 @@ export interface IStrokeInputData {
|
|
|
55
55
|
stroke?: IStroke
|
|
56
56
|
|
|
57
57
|
strokeAlign?: IStrokeAlign
|
|
58
|
-
strokeWidth?:
|
|
58
|
+
strokeWidth?: IFourNumber | IStrokeWidthString
|
|
59
59
|
strokeWidthFixed?: IBoolean
|
|
60
60
|
strokeCap?: IStrokeCap
|
|
61
61
|
strokeJoin?: IStrokeJoin
|
package/src/IUI.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings } from '@leafer/interface'
|
|
1
|
+
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
IFillAttrData, IFillInputData, IFillComputedData,
|
|
@@ -40,6 +40,17 @@ interface IArrowAttrData {
|
|
|
40
40
|
export interface IArrowData extends IArrowAttrData, ILineData { }
|
|
41
41
|
export interface IArrowInputData extends IArrowAttrData, ILineInputData { }
|
|
42
42
|
|
|
43
|
+
// Flow
|
|
44
|
+
export interface IFlow extends IBox {
|
|
45
|
+
__: IFlowData
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface IFlowAttrData {
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
export interface IFlowData extends IFlowAttrData, IBoxData { }
|
|
52
|
+
export interface IFlowInputData extends IFlowAttrData, IBoxInputData { }
|
|
53
|
+
|
|
43
54
|
|
|
44
55
|
// Rect
|
|
45
56
|
export interface IRect extends IUI {
|
|
@@ -122,9 +133,11 @@ export interface IPenInputData extends IGroupInputData { }
|
|
|
122
133
|
export interface IText extends ITextStyleAttrData, IUI {
|
|
123
134
|
__: ITextData
|
|
124
135
|
text: string
|
|
136
|
+
padding: IFourNumber
|
|
125
137
|
}
|
|
126
138
|
interface ITextAttrData {
|
|
127
139
|
text?: string
|
|
140
|
+
padding?: IFourNumber
|
|
128
141
|
}
|
|
129
142
|
|
|
130
143
|
export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
@@ -293,7 +306,9 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
|
|
|
293
306
|
selectedStyle: IUIInputData
|
|
294
307
|
disabledStyle: IUIInputData
|
|
295
308
|
|
|
296
|
-
|
|
309
|
+
editConfig: IEditorConfig
|
|
310
|
+
editOuter: string
|
|
311
|
+
editInner: string
|
|
297
312
|
|
|
298
313
|
children?: IUI[]
|
|
299
314
|
|
|
@@ -305,8 +320,10 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
|
|
|
305
320
|
get(name?: string | string[] | IUIInputData): IUIInputData | IValue
|
|
306
321
|
createProxyData(): IUIInputData
|
|
307
322
|
|
|
308
|
-
find(condition: number | string | IFindUIMethod, options?: any): IUI[]
|
|
309
|
-
|
|
323
|
+
find(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI[]
|
|
324
|
+
findTag(tag: string | string[]): IUI[]
|
|
325
|
+
findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI
|
|
326
|
+
findId(id: number | string): IUI
|
|
310
327
|
|
|
311
328
|
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData
|
|
312
329
|
getPathString(curve?: boolean, pathForRender?: boolean): IPathString
|
|
@@ -334,8 +351,6 @@ export interface IUIData extends IUIComputedData, ILeafData {
|
|
|
334
351
|
selectedStyle?: IUIInputData
|
|
335
352
|
disabledStyle?: IUIInputData
|
|
336
353
|
|
|
337
|
-
editorStyle?: IEditorConfig
|
|
338
|
-
|
|
339
354
|
// 非数据属性, 自动计算的缓存数据
|
|
340
355
|
__isFills?: boolean
|
|
341
356
|
__isStrokes?: boolean
|
|
@@ -383,8 +398,6 @@ export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITex
|
|
|
383
398
|
selectedStyle?: IUIInputData
|
|
384
399
|
disabledStyle?: IUIInputData
|
|
385
400
|
|
|
386
|
-
editorStyle?: IEditorConfig
|
|
387
|
-
|
|
388
401
|
children?: IUIInputData[]
|
|
389
402
|
}
|
|
390
403
|
|
package/src/editor/IEditor.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { IGroup, IUI, IRectInputData, ISelectorProxy, IEditSize, ICursorType,
|
|
1
|
+
import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAlign, IUnitPointData, IDragEvent, IRotateEvent, IStroke, IFill, ILeaf, ILeafList, IObject, IBoxInputData, IGroupInputData, IImageCursor, IRect, IBoundsData, IKeyEvent, IUIInputData } from '@leafer-ui/interface'
|
|
2
2
|
|
|
3
3
|
export interface IEditorBase extends IGroup, ISelectorProxy {
|
|
4
4
|
config: IEditorConfig
|
|
5
|
+
mergeConfig: IEditorConfig // 实际使用,合并了选中元素上的editConfig
|
|
5
6
|
|
|
6
7
|
hoverTarget: IUI
|
|
7
8
|
target: IUI | IUI[]
|
|
8
9
|
|
|
9
10
|
readonly list: IUI[]
|
|
11
|
+
leafList: ILeafList
|
|
12
|
+
openedGroupList: ILeafList
|
|
13
|
+
|
|
14
|
+
readonly editing: boolean
|
|
15
|
+
innerEditing: boolean
|
|
16
|
+
readonly groupOpening: boolean
|
|
10
17
|
|
|
11
|
-
readonly hasTarget: boolean
|
|
12
18
|
readonly multiple: boolean
|
|
13
19
|
readonly single: boolean
|
|
14
20
|
|
|
@@ -18,8 +24,12 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
|
|
|
18
24
|
buttons: IGroup
|
|
19
25
|
|
|
20
26
|
selector: IGroup
|
|
21
|
-
editBox:
|
|
27
|
+
editBox: IEditBoxBase
|
|
22
28
|
editTool: IObject
|
|
29
|
+
innerEditor: IObject
|
|
30
|
+
|
|
31
|
+
select(target: IUI | IUI[]): void
|
|
32
|
+
cancel(): void
|
|
23
33
|
|
|
24
34
|
hasItem(item: IUI): boolean
|
|
25
35
|
shiftItem(item: IUI): void
|
|
@@ -38,6 +48,11 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
|
|
|
38
48
|
|
|
39
49
|
group(group?: IGroup | IGroupInputData): IGroup
|
|
40
50
|
ungroup(): IUI[]
|
|
51
|
+
openGroup(group: IGroup): void
|
|
52
|
+
closeGroup(group: IGroup): void
|
|
53
|
+
|
|
54
|
+
openInnerEditor(): void
|
|
55
|
+
closeInnerEditor(): void
|
|
41
56
|
|
|
42
57
|
lock(): void
|
|
43
58
|
unlock(): void
|
|
@@ -47,7 +62,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
|
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
export interface IEditorConfig {
|
|
50
|
-
editSize?:
|
|
65
|
+
editSize?: IEditSize
|
|
51
66
|
dualEvent?: boolean
|
|
52
67
|
keyEvent?: boolean
|
|
53
68
|
|
|
@@ -77,19 +92,70 @@ export interface IEditorConfig {
|
|
|
77
92
|
rotateCursor?: IImageCursor
|
|
78
93
|
skewCursor?: IImageCursor
|
|
79
94
|
|
|
80
|
-
around?:
|
|
95
|
+
around?: IAlign | IUnitPointData
|
|
81
96
|
lockRatio?: boolean | 'corner'
|
|
82
|
-
lockMove?: boolean | 'x' | 'y'
|
|
83
97
|
rotateGap?: number
|
|
84
98
|
|
|
85
99
|
selector?: boolean
|
|
86
100
|
hover?: boolean
|
|
101
|
+
hoverStyle?: IUIInputData
|
|
87
102
|
select?: 'press' | 'tap'
|
|
88
103
|
boxSelect?: boolean
|
|
89
104
|
continuousSelect?: boolean // 点击可以连续选择
|
|
105
|
+
openInner?: 'double' | 'long' // 双击/长按打开内部
|
|
90
106
|
|
|
91
107
|
moveable?: boolean
|
|
92
108
|
rotateable?: boolean
|
|
93
109
|
resizeable?: boolean
|
|
94
110
|
skewable?: boolean
|
|
95
|
-
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface IEditPoint extends IBox {
|
|
114
|
+
direction: number
|
|
115
|
+
pointType: IEditPointType
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type IEditPointType = 'rotate' | 'resize'
|
|
119
|
+
|
|
120
|
+
export interface IEditBoxBase extends IGroup {
|
|
121
|
+
editor: IEditorBase
|
|
122
|
+
dragging: boolean
|
|
123
|
+
moving: boolean
|
|
124
|
+
|
|
125
|
+
view: IGroup // 放置默认编辑工具控制点
|
|
126
|
+
|
|
127
|
+
circle: IEditPoint
|
|
128
|
+
rect: IRect
|
|
129
|
+
|
|
130
|
+
buttons: IGroup
|
|
131
|
+
|
|
132
|
+
resizePoints: IEditPoint[]
|
|
133
|
+
rotatePoints: IEditPoint[]
|
|
134
|
+
resizeLines: IEditPoint[]
|
|
135
|
+
|
|
136
|
+
readonly flipped: boolean
|
|
137
|
+
readonly flippedX: boolean
|
|
138
|
+
readonly flippedY: boolean
|
|
139
|
+
readonly flippedOne: boolean
|
|
140
|
+
|
|
141
|
+
enterPoint: IEditPoint
|
|
142
|
+
|
|
143
|
+
getPointStyle(userStyle?: IBoxInputData): IBoxInputData
|
|
144
|
+
getPointsStyle(): IBoxInputData[]
|
|
145
|
+
getMiddlePointsStyle(): IBoxInputData[]
|
|
146
|
+
|
|
147
|
+
load(): void
|
|
148
|
+
update(bounds: IBoundsData): void
|
|
149
|
+
unload(): void
|
|
150
|
+
|
|
151
|
+
onArrow(e: IKeyEvent): void
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface IEditorConfigFunction {
|
|
156
|
+
(ui: any): IEditorConfig
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface IEditToolFunction {
|
|
160
|
+
(ui: any): string
|
|
161
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export {
|
|
|
16
16
|
IImage, IImageInputData, IImageData,
|
|
17
17
|
ICanvas, ICanvasInputData, ICanvasData,
|
|
18
18
|
IFrame, IFrameInputData, IFrameData,
|
|
19
|
+
IFlow, IFlowInputData, IFlowData,
|
|
19
20
|
IBox, IBoxInputData, IBoxData,
|
|
20
21
|
IGroup, IGroupInputData, IGroupData,
|
|
21
22
|
ILeaferInputData, ILeaferData,
|
|
@@ -24,7 +25,7 @@ export {
|
|
|
24
25
|
IUITag, IUIInputData
|
|
25
26
|
} from './IUI'
|
|
26
27
|
|
|
27
|
-
export {
|
|
28
|
+
export { IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IPathDataArrow, IPathDataArrowMap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat } from './type/IType'
|
|
28
29
|
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString } from './type/IStringType'
|
|
29
30
|
export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
30
31
|
|
|
@@ -41,4 +42,4 @@ export { IPaintModule, IPaintImageModule, IPaintGradientModule } from './module/
|
|
|
41
42
|
export { IEffectModule } from './module/IEffect'
|
|
42
43
|
export { ICachedShape } from './ICachedShape'
|
|
43
44
|
|
|
44
|
-
export { IEditorBase, IEditorConfig } from './editor/IEditor'
|
|
45
|
+
export { IEditorBase, IEditorConfig, IEditBoxBase, IEditPoint, IEditPointType, IEditToolFunction, IEditorConfigFunction } from './editor/IEditor'
|
package/src/module/IPaint.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAround } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { ILeafPaint, ILeafPaintPatternData } from '../type/IComputedType'
|
|
4
4
|
import { IUI, IUIData } from '../IUI'
|
|
5
5
|
import { ICachedShape } from '../ICachedShape'
|
|
6
|
-
import { IGradientPaint, IImagePaint,
|
|
6
|
+
import { IGradientPaint, IImagePaint, IPaintAttr } from '../type/IType'
|
|
7
7
|
|
|
8
8
|
export interface IPaintModule {
|
|
9
9
|
compute(attrName: IPaintAttr, ui: IUI): void
|
|
@@ -30,9 +30,9 @@ export interface IPaintImageModule {
|
|
|
30
30
|
recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap
|
|
31
31
|
|
|
32
32
|
createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void
|
|
33
|
-
fillOrFitMode(data: ILeafPaintPatternData,
|
|
33
|
+
fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void
|
|
34
34
|
clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void
|
|
35
|
-
repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void
|
|
35
|
+
repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface IPaintGradientModule {
|
package/src/type/IType.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, ISizeData, IFourNumber } from '@leafer/interface'
|
|
1
|
+
import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, ISizeData, IFourNumber, IAlign } from '@leafer/interface'
|
|
2
2
|
import { IColorString, IPaintString } from './IStringType'
|
|
3
3
|
|
|
4
|
-
export interface IUnitData {
|
|
5
|
-
type: 'percent' | 'px'
|
|
6
|
-
value: number
|
|
7
|
-
}
|
|
8
|
-
|
|
9
4
|
export type IPaint = ISolidPaint | IGradientPaint | IImagePaint
|
|
10
5
|
|
|
11
6
|
export type IFill = IPaint | IPaint[] | IPaintString
|
|
@@ -72,7 +67,10 @@ export interface IImagePaint extends IPaintBase {
|
|
|
72
67
|
filters?: IImageFilters
|
|
73
68
|
|
|
74
69
|
padding?: IFourNumber
|
|
70
|
+
|
|
71
|
+
align?: IAlign
|
|
75
72
|
offset?: IPointData
|
|
73
|
+
|
|
76
74
|
size?: number | ISizeData
|
|
77
75
|
scale?: number | IPointData
|
|
78
76
|
rotation?: number
|
|
@@ -88,7 +86,7 @@ export interface IImageFilters {
|
|
|
88
86
|
highlights?: number // 高光
|
|
89
87
|
shadows?: number // 阴影
|
|
90
88
|
}
|
|
91
|
-
export type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat'
|
|
89
|
+
export type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat'
|
|
92
90
|
export type IRepeat = boolean | 'x' | 'y'
|
|
93
91
|
|
|
94
92
|
// 描边
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
|
1
|
+
import { IPointData, IExportFileType, IFourNumber, IAlign, ISizeData, IPathCommandData, IWindingRule, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, INumber, IBoolean, IString, IUnitData, IPathCreator, IBoundsData as IBoundsData$1, ILeaferImageConfig, ICanvasContext2DSettings, ILeaferCanvas, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, IObject as IObject$1, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, IStateStyleType, ICachedLeaf, IBooleanMap, IAround } 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,
|
|
3
|
+
import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, 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, IAlign as IAlign$1, IUnitPointData, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent } from '@leafer-ui/interface';
|
|
4
4
|
|
|
5
5
|
type IPercent = string;
|
|
6
6
|
type IColorString = string;
|
|
@@ -13,10 +13,6 @@ type IGradientPaintString = string;
|
|
|
13
13
|
type IImagePaintString = string;
|
|
14
14
|
type IShadowString = string;
|
|
15
15
|
|
|
16
|
-
interface IUnitData {
|
|
17
|
-
type: 'percent' | 'px';
|
|
18
|
-
value: number;
|
|
19
|
-
}
|
|
20
16
|
type IPaint = ISolidPaint | IGradientPaint | IImagePaint;
|
|
21
17
|
type IFill = IPaint | IPaint[] | IPaintString;
|
|
22
18
|
type IStroke = IPaint | IPaint[] | IPaintString;
|
|
@@ -61,6 +57,7 @@ interface IImagePaint extends IPaintBase {
|
|
|
61
57
|
format?: IExportFileType;
|
|
62
58
|
filters?: IImageFilters;
|
|
63
59
|
padding?: IFourNumber;
|
|
60
|
+
align?: IAlign;
|
|
64
61
|
offset?: IPointData;
|
|
65
62
|
size?: number | ISizeData;
|
|
66
63
|
scale?: number | IPointData;
|
|
@@ -76,7 +73,7 @@ interface IImageFilters {
|
|
|
76
73
|
highlights?: number;
|
|
77
74
|
shadows?: number;
|
|
78
75
|
}
|
|
79
|
-
type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
|
|
76
|
+
type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
|
|
80
77
|
type IRepeat = boolean | 'x' | 'y';
|
|
81
78
|
type IStrokeAlign = 'inside' | 'outside' | 'center';
|
|
82
79
|
type IStrokeCap = 'none' | 'round' | 'square';
|
|
@@ -170,11 +167,11 @@ interface ILeafShadowEffect {
|
|
|
170
167
|
}
|
|
171
168
|
|
|
172
169
|
interface ICornerRadiusAttrData {
|
|
173
|
-
cornerRadius:
|
|
170
|
+
cornerRadius: IFourNumber | ICornerRadiusString;
|
|
174
171
|
cornerSmoothing: INumber;
|
|
175
172
|
}
|
|
176
173
|
interface ICornerRadiusInputData {
|
|
177
|
-
cornerRadius?:
|
|
174
|
+
cornerRadius?: IFourNumber | ICornerRadiusString;
|
|
178
175
|
cornerSmoothing?: INumber;
|
|
179
176
|
}
|
|
180
177
|
interface ICornerRadiusComputedData {
|
|
@@ -197,7 +194,7 @@ interface IBorderComputedData {
|
|
|
197
194
|
interface IStrokeAttrData {
|
|
198
195
|
stroke: IStroke;
|
|
199
196
|
strokeAlign: IStrokeAlign;
|
|
200
|
-
strokeWidth:
|
|
197
|
+
strokeWidth: IFourNumber | IStrokeWidthString;
|
|
201
198
|
strokeWidthFixed: IBoolean;
|
|
202
199
|
strokeCap: IStrokeCap;
|
|
203
200
|
strokeJoin: IStrokeJoin;
|
|
@@ -210,7 +207,7 @@ interface IStrokeAttrData {
|
|
|
210
207
|
interface IStrokeInputData {
|
|
211
208
|
stroke?: IStroke;
|
|
212
209
|
strokeAlign?: IStrokeAlign;
|
|
213
|
-
strokeWidth?:
|
|
210
|
+
strokeWidth?: IFourNumber | IStrokeWidthString;
|
|
214
211
|
strokeWidthFixed?: IBoolean;
|
|
215
212
|
strokeCap?: IStrokeCap;
|
|
216
213
|
strokeJoin?: IStrokeJoin;
|
|
@@ -306,18 +303,26 @@ interface IEffectComputedData {
|
|
|
306
303
|
|
|
307
304
|
interface IEditorBase extends IGroup$1, ISelectorProxy {
|
|
308
305
|
config: IEditorConfig;
|
|
306
|
+
mergeConfig: IEditorConfig;
|
|
309
307
|
hoverTarget: IUI$1;
|
|
310
308
|
target: IUI$1 | IUI$1[];
|
|
311
309
|
readonly list: IUI$1[];
|
|
312
|
-
|
|
310
|
+
leafList: ILeafList;
|
|
311
|
+
openedGroupList: ILeafList;
|
|
312
|
+
readonly editing: boolean;
|
|
313
|
+
innerEditing: boolean;
|
|
314
|
+
readonly groupOpening: boolean;
|
|
313
315
|
readonly multiple: boolean;
|
|
314
316
|
readonly single: boolean;
|
|
315
317
|
readonly dragging: boolean;
|
|
316
318
|
element: IUI$1;
|
|
317
319
|
buttons: IGroup$1;
|
|
318
320
|
selector: IGroup$1;
|
|
319
|
-
editBox:
|
|
321
|
+
editBox: IEditBoxBase;
|
|
320
322
|
editTool: IObject;
|
|
323
|
+
innerEditor: IObject;
|
|
324
|
+
select(target: IUI$1 | IUI$1[]): void;
|
|
325
|
+
cancel(): void;
|
|
321
326
|
hasItem(item: IUI$1): boolean;
|
|
322
327
|
shiftItem(item: IUI$1): void;
|
|
323
328
|
addItem(item: IUI$1): void;
|
|
@@ -331,13 +336,17 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
|
|
|
331
336
|
onSkew(e: IDragEvent): void;
|
|
332
337
|
group(group?: IGroup$1 | IGroupInputData$1): IGroup$1;
|
|
333
338
|
ungroup(): IUI$1[];
|
|
339
|
+
openGroup(group: IGroup$1): void;
|
|
340
|
+
closeGroup(group: IGroup$1): void;
|
|
341
|
+
openInnerEditor(): void;
|
|
342
|
+
closeInnerEditor(): void;
|
|
334
343
|
lock(): void;
|
|
335
344
|
unlock(): void;
|
|
336
345
|
toTop(): void;
|
|
337
346
|
toBottom(): void;
|
|
338
347
|
}
|
|
339
348
|
interface IEditorConfig {
|
|
340
|
-
editSize?:
|
|
349
|
+
editSize?: IEditSize;
|
|
341
350
|
dualEvent?: boolean;
|
|
342
351
|
keyEvent?: boolean;
|
|
343
352
|
stroke?: IStroke$1;
|
|
@@ -359,20 +368,56 @@ interface IEditorConfig {
|
|
|
359
368
|
resizeCursor?: IImageCursor;
|
|
360
369
|
rotateCursor?: IImageCursor;
|
|
361
370
|
skewCursor?: IImageCursor;
|
|
362
|
-
around?:
|
|
371
|
+
around?: IAlign$1 | IUnitPointData;
|
|
363
372
|
lockRatio?: boolean | 'corner';
|
|
364
|
-
lockMove?: boolean | 'x' | 'y';
|
|
365
373
|
rotateGap?: number;
|
|
366
374
|
selector?: boolean;
|
|
367
375
|
hover?: boolean;
|
|
376
|
+
hoverStyle?: IUIInputData$1;
|
|
368
377
|
select?: 'press' | 'tap';
|
|
369
378
|
boxSelect?: boolean;
|
|
370
379
|
continuousSelect?: boolean;
|
|
380
|
+
openInner?: 'double' | 'long';
|
|
371
381
|
moveable?: boolean;
|
|
372
382
|
rotateable?: boolean;
|
|
373
383
|
resizeable?: boolean;
|
|
374
384
|
skewable?: boolean;
|
|
375
385
|
}
|
|
386
|
+
interface IEditPoint extends IBox$1 {
|
|
387
|
+
direction: number;
|
|
388
|
+
pointType: IEditPointType;
|
|
389
|
+
}
|
|
390
|
+
type IEditPointType = 'rotate' | 'resize';
|
|
391
|
+
interface IEditBoxBase extends IGroup$1 {
|
|
392
|
+
editor: IEditorBase;
|
|
393
|
+
dragging: boolean;
|
|
394
|
+
moving: boolean;
|
|
395
|
+
view: IGroup$1;
|
|
396
|
+
circle: IEditPoint;
|
|
397
|
+
rect: IRect$1;
|
|
398
|
+
buttons: IGroup$1;
|
|
399
|
+
resizePoints: IEditPoint[];
|
|
400
|
+
rotatePoints: IEditPoint[];
|
|
401
|
+
resizeLines: IEditPoint[];
|
|
402
|
+
readonly flipped: boolean;
|
|
403
|
+
readonly flippedX: boolean;
|
|
404
|
+
readonly flippedY: boolean;
|
|
405
|
+
readonly flippedOne: boolean;
|
|
406
|
+
enterPoint: IEditPoint;
|
|
407
|
+
getPointStyle(userStyle?: IBoxInputData$1): IBoxInputData$1;
|
|
408
|
+
getPointsStyle(): IBoxInputData$1[];
|
|
409
|
+
getMiddlePointsStyle(): IBoxInputData$1[];
|
|
410
|
+
load(): void;
|
|
411
|
+
update(bounds: IBoundsData): void;
|
|
412
|
+
unload(): void;
|
|
413
|
+
onArrow(e: IKeyEvent): void;
|
|
414
|
+
}
|
|
415
|
+
interface IEditorConfigFunction {
|
|
416
|
+
(ui: any): IEditorConfig;
|
|
417
|
+
}
|
|
418
|
+
interface IEditToolFunction {
|
|
419
|
+
(ui: any): string;
|
|
420
|
+
}
|
|
376
421
|
|
|
377
422
|
interface ILine extends IUI {
|
|
378
423
|
__: ILineData;
|
|
@@ -398,6 +443,15 @@ interface IArrowData extends IArrowAttrData, ILineData {
|
|
|
398
443
|
}
|
|
399
444
|
interface IArrowInputData extends IArrowAttrData, ILineInputData {
|
|
400
445
|
}
|
|
446
|
+
interface IFlow extends IBox {
|
|
447
|
+
__: IFlowData;
|
|
448
|
+
}
|
|
449
|
+
interface IFlowAttrData {
|
|
450
|
+
}
|
|
451
|
+
interface IFlowData extends IFlowAttrData, IBoxData {
|
|
452
|
+
}
|
|
453
|
+
interface IFlowInputData extends IFlowAttrData, IBoxInputData {
|
|
454
|
+
}
|
|
401
455
|
interface IRect extends IUI {
|
|
402
456
|
__: IRectData;
|
|
403
457
|
}
|
|
@@ -469,9 +523,11 @@ interface IPenInputData extends IGroupInputData {
|
|
|
469
523
|
interface IText extends ITextStyleAttrData, IUI {
|
|
470
524
|
__: ITextData;
|
|
471
525
|
text: string;
|
|
526
|
+
padding: IFourNumber;
|
|
472
527
|
}
|
|
473
528
|
interface ITextAttrData {
|
|
474
529
|
text?: string;
|
|
530
|
+
padding?: IFourNumber;
|
|
475
531
|
}
|
|
476
532
|
interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
477
533
|
__baseLine?: number;
|
|
@@ -479,7 +535,7 @@ interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
|
|
|
479
535
|
__letterSpacing?: number;
|
|
480
536
|
__padding?: number[];
|
|
481
537
|
__clipText?: boolean;
|
|
482
|
-
__textBoxBounds?: IBoundsData;
|
|
538
|
+
__textBoxBounds?: IBoundsData$1;
|
|
483
539
|
}
|
|
484
540
|
interface ITextInputData extends ITextAttrData, ITextStyleInputData, IUIBaseInputData {
|
|
485
541
|
}
|
|
@@ -513,7 +569,7 @@ interface ITextCharData {
|
|
|
513
569
|
char?: string;
|
|
514
570
|
}
|
|
515
571
|
interface ITextDrawData {
|
|
516
|
-
bounds: IBoundsData;
|
|
572
|
+
bounds: IBoundsData$1;
|
|
517
573
|
rows: ITextRowData[];
|
|
518
574
|
paraNumber: number;
|
|
519
575
|
font: string;
|
|
@@ -609,15 +665,19 @@ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEf
|
|
|
609
665
|
focusStyle: IUIInputData;
|
|
610
666
|
selectedStyle: IUIInputData;
|
|
611
667
|
disabledStyle: IUIInputData;
|
|
612
|
-
|
|
668
|
+
editConfig: IEditorConfig;
|
|
669
|
+
editOuter: string;
|
|
670
|
+
editInner: string;
|
|
613
671
|
children?: IUI[];
|
|
614
672
|
reset(data?: IUIInputData): void;
|
|
615
673
|
set(data: IUIInputData): void;
|
|
616
674
|
toJSON(): IUIInputData;
|
|
617
675
|
get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
|
|
618
676
|
createProxyData(): IUIInputData;
|
|
619
|
-
find(condition: number | string | IFindUIMethod, options?: any): IUI[];
|
|
620
|
-
|
|
677
|
+
find(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI[];
|
|
678
|
+
findTag(tag: string | string[]): IUI[];
|
|
679
|
+
findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI;
|
|
680
|
+
findId(id: number | string): IUI;
|
|
621
681
|
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
|
|
622
682
|
getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
|
|
623
683
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
@@ -637,7 +697,6 @@ interface IUIData extends IUIComputedData, ILeafData {
|
|
|
637
697
|
focusStyle?: IUIInputData;
|
|
638
698
|
selectedStyle?: IUIInputData;
|
|
639
699
|
disabledStyle?: IUIInputData;
|
|
640
|
-
editorStyle?: IEditorConfig;
|
|
641
700
|
__isFills?: boolean;
|
|
642
701
|
__isStrokes?: boolean;
|
|
643
702
|
readonly __strokeWidth: number;
|
|
@@ -670,7 +729,6 @@ interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleI
|
|
|
670
729
|
focusStyle?: IUIInputData;
|
|
671
730
|
selectedStyle?: IUIInputData;
|
|
672
731
|
disabledStyle?: IUIInputData;
|
|
673
|
-
editorStyle?: IEditorConfig;
|
|
674
732
|
children?: IUIInputData[];
|
|
675
733
|
}
|
|
676
734
|
type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
|
|
@@ -759,7 +817,7 @@ interface IStateModule {
|
|
|
759
817
|
|
|
760
818
|
interface ICachedShape extends ICachedLeaf {
|
|
761
819
|
worldCanvas?: ILeaferCanvas;
|
|
762
|
-
shapeBounds: IBoundsData;
|
|
820
|
+
shapeBounds: IBoundsData$1;
|
|
763
821
|
scaleX: number;
|
|
764
822
|
scaleY: number;
|
|
765
823
|
}
|
|
@@ -776,19 +834,19 @@ interface IPaintModule {
|
|
|
776
834
|
shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
|
|
777
835
|
}
|
|
778
836
|
interface IPaintImageModule {
|
|
779
|
-
image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint;
|
|
837
|
+
image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData$1, firstUse: boolean): ILeafPaint;
|
|
780
838
|
checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, allowPaint?: boolean): boolean;
|
|
781
839
|
createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean;
|
|
782
840
|
recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap;
|
|
783
|
-
createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void;
|
|
784
|
-
fillOrFitMode(data: ILeafPaintPatternData,
|
|
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;
|
|
841
|
+
createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData$1): void;
|
|
842
|
+
fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
|
|
843
|
+
clipMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
|
|
844
|
+
repeatMode(data: ILeafPaintPatternData, box: IBoundsData$1, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void;
|
|
787
845
|
}
|
|
788
846
|
interface IPaintGradientModule {
|
|
789
|
-
linearGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
790
|
-
radialGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
791
|
-
conicGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;
|
|
847
|
+
linearGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
|
|
848
|
+
radialGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
|
|
849
|
+
conicGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
|
|
792
850
|
}
|
|
793
851
|
|
|
794
852
|
interface IEffectModule {
|
|
@@ -798,4 +856,4 @@ interface IEffectModule {
|
|
|
798
856
|
backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
|
|
799
857
|
}
|
|
800
858
|
|
|
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,
|
|
859
|
+
export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, 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, IVectorPath, IVerticalAlign };
|