@leafer-ui/interface 1.0.0-beta → 1.0.0-beta.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/interface",
3
- "version": "1.0.0-beta",
3
+ "version": "1.0.0-beta.11",
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-beta"
22
+ "@leafer/interface": "1.0.0-beta.11"
23
23
  }
24
24
  }
package/src/IUI.ts CHANGED
@@ -1,6 +1,4 @@
1
- import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, __Number, IPathString, ILeaferImage } from '@leafer/interface'
2
-
3
- import { IOverflow } 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'
4
2
 
5
3
  import {
6
4
  IFillAttrData, IFillInputData, IFillComputedData,
@@ -10,6 +8,8 @@ import {
10
8
  IEffectAttrData, IEffectInputData, IEffectComputedData,
11
9
  ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData
12
10
  } from './ICommonAttr'
11
+ import { IOverflow } from './type/IType'
12
+ import { IExportOptions } from './module/IExport'
13
13
 
14
14
 
15
15
  // Line
@@ -246,10 +246,11 @@ export interface IGroup extends IUI {
246
246
  children: IUI[]
247
247
  mask?: IUI
248
248
  add(child: IUI, index?: number): void
249
- remove(child?: IUI): void
250
249
  addAt(child: IUI, index: number): void
251
250
  addAfter(child: IUI, after: IUI): void
252
251
  addBefore(child: IUI, before: IUI): void
252
+ remove(child?: IUI): void
253
+ removeAll(): void
253
254
  }
254
255
  export interface IGroupData extends IUIData { }
255
256
  export interface IGroupInputData extends IUIInputData { }
@@ -267,6 +268,8 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
267
268
 
268
269
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
269
270
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
271
+
272
+ export(filename: string, options?: IExportOptions | number): Promise<IBlob | string | boolean>
270
273
  }
271
274
 
272
275
  export interface IUIData extends IUIComputedData, ILeafData {
@@ -299,6 +302,8 @@ export interface IUIData extends IUIComputedData, ILeafData {
299
302
  __font?: string
300
303
  __textDrawData?: ITextDrawData
301
304
 
305
+ __recycleImage(attrName: string): IBooleanMap
306
+
302
307
  }
303
308
  export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
304
309
  padding?: number | number[]
package/src/index.ts CHANGED
@@ -20,11 +20,12 @@ export {
20
20
  } from './IUI'
21
21
  export { IUnitData, IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow } from './type/IType'
22
22
  export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString as IStringColor } from './type/IStringType'
23
- export { ILeafFill, ILeafPaint, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
23
+ export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
24
24
 
25
25
  export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
26
26
  export { IUIBoundsModule } from './module/IUIBounds'
27
27
  export { IUIHitModule } from './module/IUIHit'
28
+ export { IExportModule, IExportOptions, IExportResult, IExportResultFunction } from './module/IExport'
28
29
 
29
30
  export { IPaintModule } from './module/IPaint'
30
31
  export { IEffectModule } from './module/IEffect'
@@ -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
+ }
@@ -5,18 +5,17 @@ import { IUI } from '../IUI'
5
5
  import { ICachedShape } from '../ICachedShape'
6
6
 
7
7
  export interface IPaintModule {
8
- computeFill?(ui: IUI): void
9
- computeStroke?(ui: IUI): void
8
+ compute?(ui: IUI, attrName: 'fill' | 'stroke'): void
10
9
 
11
- fill?(ui: IUI, canvas: ILeaferCanvas, fill: string | object): void
10
+ fill?(ui: IUI, canvas: ILeaferCanvas, fill: string): void
12
11
  fills?(ui: IUI, canvas: ILeaferCanvas, fills: ILeafPaint[]): void
13
12
 
14
- drawText?(ui: IUI, canvas: ILeaferCanvas): void
13
+ fillText?(ui: IUI, canvas: ILeaferCanvas): void
15
14
 
16
- stroke?(ui: IUI, canvas: ILeaferCanvas, stroke: string | object): void
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 | object): void
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
3
  import { IColorString } from './IStringType'
4
- import { IStrokeAlign, IStrokeJoin, IStrokeCap } from './IType'
4
+ import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode } from './IType'
5
5
  import { IPaintType } from './IType'
6
6
 
7
7
  export type ILeafPaintColor = IColorString | CanvasGradient | CanvasPattern
8
8
 
9
9
  export interface ILeafPaint {
10
- type: IPaintType
11
- style: ILeafPaintColor
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