@leafer-ui/interface 1.0.0-bate → 1.0.0-beta.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 +2 -2
- package/src/ICommonAttr.ts +3 -3
- package/src/IUI.ts +14 -17
- package/src/index.ts +3 -3
- package/src/module/IEffect.ts +5 -5
- package/src/module/IExport.ts +19 -0
- package/src/module/IPaint.ts +5 -6
- package/src/type/IComputedType.ts +21 -7
- package/src/type/IStringType.ts +1 -4
- package/src/type/IType.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interface",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "@leafer-ui/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/interface": "1.0.0-
|
|
22
|
+
"@leafer/interface": "1.0.0-beta.10"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/src/ICommonAttr.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IPaint, IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, IUnitData } from './type/IType'
|
|
2
2
|
import { ILeafStrokePaint, ILeafShadowEffect, ILeafPaint } from './type/IComputedType'
|
|
3
|
-
import { IPaintString, IDashPatternString, IShadowString,
|
|
3
|
+
import { IPaintString, IDashPatternString, IShadowString, IColorString, IStrokeWidthString, ICornerRadiusString } from './type/IStringType'
|
|
4
4
|
|
|
5
5
|
// corner---
|
|
6
6
|
export interface ICornerRadiusAttrData {
|
|
@@ -24,7 +24,7 @@ export interface IFillInputData {
|
|
|
24
24
|
fill?: IPaint | IPaint[] | IPaintString
|
|
25
25
|
}
|
|
26
26
|
export interface IFillComputedData {
|
|
27
|
-
fill?:
|
|
27
|
+
fill?: IColorString | ILeafPaint[]
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// border
|
|
@@ -57,7 +57,7 @@ export interface IStrokeInputData {
|
|
|
57
57
|
miterLimit?: number
|
|
58
58
|
}
|
|
59
59
|
export interface IStrokeComputedData {
|
|
60
|
-
stroke?:
|
|
60
|
+
stroke?: IColorString | ILeafStrokePaint[]
|
|
61
61
|
|
|
62
62
|
strokeAlign?: IStrokeAlign
|
|
63
63
|
strokeWidth?: number
|
package/src/IUI.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, ILeaferImage } from '@leafer/interface'
|
|
2
|
-
|
|
3
|
-
import { IPathString, IVectorPathString } from './type/IStringType'
|
|
4
|
-
import { IOverflow, IVectorPath } from './type/IType'
|
|
1
|
+
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, IPathString, ILeaferImage, IBlob, IBooleanMap } from '@leafer/interface'
|
|
5
2
|
|
|
6
3
|
import {
|
|
7
4
|
IFillAttrData, IFillInputData, IFillComputedData,
|
|
@@ -11,6 +8,8 @@ import {
|
|
|
11
8
|
IEffectAttrData, IEffectInputData, IEffectComputedData,
|
|
12
9
|
ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData
|
|
13
10
|
} from './ICommonAttr'
|
|
11
|
+
import { IOverflow } from './type/IType'
|
|
12
|
+
import { IExportOptions } from './module/IExport'
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
// Line
|
|
@@ -117,18 +116,6 @@ export interface IPen extends IGroup {
|
|
|
117
116
|
export interface IPenData extends IGroupData { }
|
|
118
117
|
export interface IPenInputData extends IGroupInputData { }
|
|
119
118
|
|
|
120
|
-
// Vector
|
|
121
|
-
export interface IVector extends IUI {
|
|
122
|
-
__: IVectorData
|
|
123
|
-
paths: IVectorPath[] | IVectorPathString
|
|
124
|
-
}
|
|
125
|
-
export interface IVectorData extends IUIData {
|
|
126
|
-
paths?: IVectorPath[]
|
|
127
|
-
}
|
|
128
|
-
export interface IVectorInputData extends IUIInputData {
|
|
129
|
-
paths?: IVectorPath[] | IVectorPathString
|
|
130
|
-
}
|
|
131
|
-
|
|
132
119
|
|
|
133
120
|
// Text
|
|
134
121
|
export interface IText extends ITextStyleAttrData, IUI {
|
|
@@ -259,10 +246,11 @@ export interface IGroup extends IUI {
|
|
|
259
246
|
children: IUI[]
|
|
260
247
|
mask?: IUI
|
|
261
248
|
add(child: IUI, index?: number): void
|
|
262
|
-
remove(child?: IUI): void
|
|
263
249
|
addAt(child: IUI, index: number): void
|
|
264
250
|
addAfter(child: IUI, after: IUI): void
|
|
265
251
|
addBefore(child: IUI, before: IUI): void
|
|
252
|
+
remove(child?: IUI): void
|
|
253
|
+
removeAll(): void
|
|
266
254
|
}
|
|
267
255
|
export interface IGroupData extends IUIData { }
|
|
268
256
|
export interface IGroupInputData extends IUIInputData { }
|
|
@@ -280,6 +268,8 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
|
|
|
280
268
|
|
|
281
269
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
|
|
282
270
|
__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
271
|
+
|
|
272
|
+
export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>
|
|
283
273
|
}
|
|
284
274
|
|
|
285
275
|
export interface IUIData extends IUIComputedData, ILeafData {
|
|
@@ -306,10 +296,14 @@ export interface IUIData extends IUIComputedData, ILeafData {
|
|
|
306
296
|
__pathForRender?: IPathCommandData
|
|
307
297
|
__path2DForRender?: IPath2D
|
|
308
298
|
|
|
299
|
+
__boxStroke?: boolean
|
|
300
|
+
|
|
309
301
|
// text
|
|
310
302
|
__font?: string
|
|
311
303
|
__textDrawData?: ITextDrawData
|
|
312
304
|
|
|
305
|
+
__recycleImage(attrName: string): IBooleanMap
|
|
306
|
+
|
|
313
307
|
}
|
|
314
308
|
export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
|
|
315
309
|
padding?: number | number[]
|
|
@@ -329,10 +323,13 @@ export type IUITag =
|
|
|
329
323
|
| 'Star'
|
|
330
324
|
| 'Line'
|
|
331
325
|
| 'Path'
|
|
326
|
+
| 'Pen'
|
|
332
327
|
| 'Text'
|
|
333
328
|
| 'Image'
|
|
329
|
+
| 'Canvas'
|
|
334
330
|
| 'Group'
|
|
335
331
|
| 'Frame'
|
|
332
|
+
| 'Box'
|
|
336
333
|
|
|
337
334
|
|
|
338
335
|
export interface IUITagInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IObject {
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ export {
|
|
|
8
8
|
IStar, IStarInputData, IStarData,
|
|
9
9
|
IPath, IPathInputData, IPathData,
|
|
10
10
|
IPen, IPenInputData, IPenData,
|
|
11
|
-
IVector, IVectorInputData, IVectorData,
|
|
12
11
|
IText, ITextInputData, ITextData, ITextRowData, ITextWordData, ITextCharData, ITextDrawData,
|
|
13
12
|
IImage, IImageInputData, IImageData,
|
|
14
13
|
ICanvas, ICanvasInputData, ICanvasData,
|
|
@@ -20,12 +19,13 @@ export {
|
|
|
20
19
|
IUITag, IUITagInputData
|
|
21
20
|
} from './IUI'
|
|
22
21
|
export { IUnitData, IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow } from './type/IType'
|
|
23
|
-
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString,
|
|
24
|
-
export { ILeafFill, ILeafPaint, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
22
|
+
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString as IStringColor } from './type/IStringType'
|
|
23
|
+
export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
|
|
25
24
|
|
|
26
25
|
export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
|
|
27
26
|
export { IUIBoundsModule } from './module/IUIBounds'
|
|
28
27
|
export { IUIHitModule } from './module/IUIHit'
|
|
28
|
+
export { IExportModule, IExportOptions, IExportResult, IExportResultFunction } from './module/IExport'
|
|
29
29
|
|
|
30
30
|
export { IPaintModule } from './module/IPaint'
|
|
31
31
|
export { IEffectModule } from './module/IEffect'
|
package/src/module/IEffect.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ILeaferCanvas } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IRenderOptions } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { IUI } from '../IUI'
|
|
4
4
|
import { ICachedShape } from '../ICachedShape'
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export interface IEffectModule {
|
|
8
|
-
shadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void
|
|
9
|
-
innerShadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void
|
|
10
|
-
blur?(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void
|
|
11
|
-
backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void
|
|
8
|
+
shadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void
|
|
9
|
+
innerShadow?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void
|
|
10
|
+
blur?(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas, options: IRenderOptions): void
|
|
11
|
+
backgroundBlur?(ui: IUI, current: ILeaferCanvas, shape: ICachedShape, options: IRenderOptions): void
|
|
12
12
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ILeaf, IExportFileType, IBlob } from '@leafer/interface'
|
|
2
|
+
|
|
3
|
+
export interface IExportOptions {
|
|
4
|
+
quality?: number
|
|
5
|
+
blob?: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IExportResult {
|
|
9
|
+
data: IBlob | string | boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IExportResultFunction {
|
|
13
|
+
(data: IExportResult): void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export interface IExportModule {
|
|
18
|
+
export(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>
|
|
19
|
+
}
|
package/src/module/IPaint.ts
CHANGED
|
@@ -5,18 +5,17 @@ import { IUI } from '../IUI'
|
|
|
5
5
|
import { ICachedShape } from '../ICachedShape'
|
|
6
6
|
|
|
7
7
|
export interface IPaintModule {
|
|
8
|
-
|
|
9
|
-
computeStroke?(ui: IUI): void
|
|
8
|
+
compute?(ui: IUI, attrName: 'fill' | 'stroke'): void
|
|
10
9
|
|
|
11
|
-
fill?(ui: IUI, canvas: ILeaferCanvas, fill: string
|
|
10
|
+
fill?(ui: IUI, canvas: ILeaferCanvas, fill: string): void
|
|
12
11
|
fills?(ui: IUI, canvas: ILeaferCanvas, fills: ILeafPaint[]): void
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
fillText?(ui: IUI, canvas: ILeaferCanvas): void
|
|
15
14
|
|
|
16
|
-
stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string
|
|
15
|
+
stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void
|
|
17
16
|
strokes?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void
|
|
18
17
|
|
|
19
|
-
strokeText?(ui: IUI, canvas: ILeaferCanvas, stroke: string
|
|
18
|
+
strokeText?(ui: IUI, canvas: ILeaferCanvas, stroke: string): void
|
|
20
19
|
strokesText?(ui: IUI, canvas: ILeaferCanvas, strokes: ILeafPaint[]): void
|
|
21
20
|
|
|
22
21
|
drawTextStroke?(ui: IUI, canvas: ILeaferCanvas): void
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import { IBlendMode, IMatrixData } from '@leafer/interface'
|
|
1
|
+
import { IBlendMode, ILeaferImage, IMatrixData } from '@leafer/interface'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { IStrokeAlign, IStrokeJoin, IStrokeCap } from './IType'
|
|
3
|
+
import { IColorString } from './IStringType'
|
|
4
|
+
import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode } from './IType'
|
|
5
5
|
import { IPaintType } from './IType'
|
|
6
6
|
|
|
7
|
-
export type ILeafPaintColor =
|
|
7
|
+
export type ILeafPaintColor = IColorString | CanvasGradient | CanvasPattern
|
|
8
8
|
|
|
9
9
|
export interface ILeafPaint {
|
|
10
|
-
type
|
|
11
|
-
style
|
|
10
|
+
type?: IPaintType
|
|
11
|
+
style?: ILeafPaintColor
|
|
12
12
|
transform?: IMatrixData
|
|
13
13
|
blendMode?: IBlendMode
|
|
14
14
|
opacity?: number
|
|
15
|
+
image?: ILeaferImage
|
|
16
|
+
loadId?: number
|
|
17
|
+
patternId?: number
|
|
18
|
+
data?: ILeafPaintPatternData
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ILeafPaintPatternData {
|
|
22
|
+
width?: number
|
|
23
|
+
height?: number
|
|
24
|
+
scaleX?: number
|
|
25
|
+
scaleY?: number
|
|
26
|
+
opacity?: number
|
|
27
|
+
transform?: IMatrixData
|
|
28
|
+
mode?: IImagePaintMode
|
|
15
29
|
}
|
|
16
30
|
|
|
17
31
|
export type ILeafFill = ILeafPaint
|
|
@@ -30,7 +44,7 @@ export interface ILeafShadowEffect {
|
|
|
30
44
|
y: number
|
|
31
45
|
blur: number
|
|
32
46
|
spread?: number
|
|
33
|
-
color:
|
|
47
|
+
color: IColorString
|
|
34
48
|
blendMode?: IBlendMode
|
|
35
49
|
box?: boolean
|
|
36
50
|
}
|
package/src/type/IStringType.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
export type IPercent = string
|
|
2
|
-
|
|
3
|
-
export type IStringColor = string
|
|
2
|
+
export type IColorString = string
|
|
4
3
|
|
|
5
4
|
export type ICornerRadiusString = string
|
|
6
5
|
export type IStrokeWidthString = string
|
|
7
6
|
export type IDashPatternString = string
|
|
8
|
-
export type IVectorPathString = string
|
|
9
|
-
export type IPathString = string
|
|
10
7
|
|
|
11
8
|
export type IPaintString = ISolidPaintString | IGradientPaintString | IImagePaintString
|
|
12
9
|
export type ISolidPaintString = string
|
package/src/type/IType.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IPointData, IPathCommandData, IWindingRule, IBlendMode } from '@leafer/interface'
|
|
2
|
-
import {
|
|
2
|
+
import { IColorString } from './IStringType'
|
|
3
3
|
|
|
4
4
|
export interface IUnitData {
|
|
5
5
|
type: 'percent' | 'px'
|
|
@@ -32,7 +32,7 @@ export interface ISolidPaint extends IPaintBase {
|
|
|
32
32
|
color: IColor
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export type IColor =
|
|
35
|
+
export type IColor = IColorString | IRGB | IRGBA
|
|
36
36
|
export interface IRGB {
|
|
37
37
|
r: number
|
|
38
38
|
g: number
|
|
@@ -114,7 +114,7 @@ export interface IShadowEffect {
|
|
|
114
114
|
y: number
|
|
115
115
|
blur: number
|
|
116
116
|
spread?: number
|
|
117
|
-
color:
|
|
117
|
+
color: IColorString | IColor
|
|
118
118
|
blendMode?: IBlendMode
|
|
119
119
|
visible?: boolean
|
|
120
120
|
box?: boolean
|