@leafer-ui/interface 1.4.0 → 1.4.1

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.4.0",
3
+ "version": "1.4.1",
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.4.0"
25
+ "@leafer/interface": "1.4.1"
26
26
  }
27
27
  }
package/src/index.ts CHANGED
@@ -47,6 +47,7 @@ export { IStateModule } from './module/IState'
47
47
 
48
48
  export { IPaintModule, IPaintImageModule, IPaintGradientModule } from './module/IPaint'
49
49
  export { IEffectModule } from './module/IEffect'
50
+ export { IFilterModule, IFilterProcessor, IFilterFunction } from './module/IFilter'
50
51
  export { ICachedShape } from './ICachedShape'
51
52
 
52
53
  export { IEditorBase, IEditorConfig, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorConfigFunction } from './editor/IEditor'
@@ -0,0 +1,25 @@
1
+ import { IMatrixWithBoundsScaleData, ILeaferCanvas, IFilter } from '@leafer/interface'
2
+
3
+ import { IUI } from '../IUI'
4
+ import { ICachedShape } from '../ICachedShape'
5
+
6
+
7
+ export interface IFilterModule {
8
+ list: IFilterProcessorMap
9
+ register(name: string, filterProcessor: IFilterProcessor): void
10
+ apply(filters: IFilter[], ui: IUI, bounds: IMatrixWithBoundsScaleData, currentCanvas: ILeaferCanvas, originCanvas: ILeaferCanvas, shape: ICachedShape): void
11
+ getSpread(filters: IFilter[]): number
12
+ }
13
+
14
+ interface IFilterProcessorMap {
15
+ [name: string]: IFilterProcessor
16
+ }
17
+
18
+ export interface IFilterProcessor {
19
+ apply: IFilterFunction,
20
+ getSpread(filter: IFilter): number
21
+ }
22
+
23
+ export interface IFilterFunction {
24
+ (filter: IFilter, ui: IUI, bounds: IMatrixWithBoundsScaleData, currentCanvas: ILeaferCanvas, originCanvas: ILeaferCanvas, shape: ICachedShape): void
25
+ }
@@ -1,7 +1,7 @@
1
1
  import { IBlendMode, ILeaferImage, IMatrixData, ITaskItem } from '@leafer/interface'
2
2
 
3
3
  import { IColorString } from './IStringType'
4
- import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode } from './IType'
4
+ import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode, IImageFilters } from './IType'
5
5
  import { IPaintType } from './IType'
6
6
 
7
7
  export type ILeafPaintColor = IColorString | CanvasGradient | CanvasPattern
@@ -11,7 +11,6 @@ export interface ILeafPaint {
11
11
  style?: ILeafPaintColor
12
12
  transform?: IMatrixData
13
13
  blendMode?: IBlendMode
14
- opacity?: number
15
14
  image?: ILeaferImage
16
15
  loadId?: number
17
16
  patternId?: string
@@ -27,6 +26,7 @@ export interface ILeafPaintPatternData {
27
26
  scaleY?: number
28
27
  opacity?: number
29
28
  transform?: IMatrixData
29
+ filters?: IImageFilters
30
30
  mode?: IImagePaintMode
31
31
  repeat?: 'repeat' | 'repeat-x' | 'repeat-y'
32
32
  }
package/src/type/IType.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, ISizeData, IFourNumber, IAlign, IUnitPointData, IObject, IAxis, IAxisReverse } from '@leafer/interface'
1
+ import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, ISizeData, IFourNumber, IAlign, IUnitPointData, IAxis, IAxisReverse, IFilter } from '@leafer/interface'
2
2
  import { IColorString, IPaintString } from './IStringType'
3
3
 
4
4
  export type IPaint = ISolidPaint | IGradientPaint | IImagePaint
@@ -59,7 +59,9 @@ export interface IColorStop {
59
59
  // ---
60
60
  export interface IImagePaint extends IPaintBase {
61
61
  type: "image"
62
+
62
63
  url: string
64
+
63
65
  mode?: IImagePaintMode
64
66
  format?: IExportFileType
65
67
 
@@ -162,6 +164,8 @@ export interface IGrayscaleEffect {
162
164
  visible?: boolean
163
165
  }
164
166
 
165
- export type IEffect = IObject
167
+ export interface IEffect extends IFilter {
168
+
169
+ }
166
170
 
167
171
  export type IOverflow = 'show' | 'hide'
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IAxis, IAxisReverse, IWindingRule, IObject, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IAnimateOptions, IAnimateEasing, IAnimateEasingFunction, IEventer, IEventMap, IAnimateEnding, ITransition, IPercentData, IBoundsData as IBoundsData$1, IPathCreator, ILeaferCanvas, ICanvasContext2D, ICanvasContext2DSettings, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IFindCondition, IJSONOptions, IValue, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, ILeaferAttrData, IControl, ILeaferType, ILeaferConfig, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
1
+ import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IAxis, IAxisReverse, IWindingRule, IFilter, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IAnimateOptions, IAnimateEasing, IEventer, IObject, IEventMap, IAnimateEasingFunction, IAnimateEnding, ITransition, IPercentData, ILeafInputData, ILeaf as ILeaf$1, ILeafComputedData, ILeafData, IBoundsData as IBoundsData$1, IPathCreator, IJSONOptions, IValue, IFindCondition, IAnswer, IPathString, IPathDrawer, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPickOptions, IPickResult, ICanvasContext2DSettings, ICanvasContext2D, ILeaferAttrData, IControl, ILeaferType, ILeaferConfig, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IAround, IMatrixWithBoundsScaleData } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
- import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject as IObject$1, ILeaf, IEditSize, IDragEvent, IZoomEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, IDirection4, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent, IStateName as IStateName$1, IString as IString$1, IBoolean as IBoolean$1, IStateStyle as IStateStyle$1 } from '@leafer-ui/interface';
3
+ import { IObject as IObject$1, IEditSize, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, IDirection4, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent, ILeaf, IDragEvent, IZoomEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStateName as IStateName$1, IString as IString$1, IBoolean as IBoolean$1, IStateStyle as IStateStyle$1 } from '@leafer-ui/interface';
4
4
 
5
5
  type IPercent = string;
6
6
  type IColorString = string;
@@ -125,7 +125,8 @@ interface IGrayscaleEffect {
125
125
  grayscale: number;
126
126
  visible?: boolean;
127
127
  }
128
- type IEffect = IObject;
128
+ interface IEffect extends IFilter {
129
+ }
129
130
  type IOverflow = 'show' | 'hide';
130
131
 
131
132
  type ILeafPaintColor = IColorString | CanvasGradient | CanvasPattern;
@@ -134,7 +135,6 @@ interface ILeafPaint {
134
135
  style?: ILeafPaintColor;
135
136
  transform?: IMatrixData;
136
137
  blendMode?: IBlendMode;
137
- opacity?: number;
138
138
  image?: ILeaferImage;
139
139
  loadId?: number;
140
140
  patternId?: string;
@@ -149,6 +149,7 @@ interface ILeafPaintPatternData {
149
149
  scaleY?: number;
150
150
  opacity?: number;
151
151
  transform?: IMatrixData;
152
+ filters?: IImageFilters;
152
153
  mode?: IImagePaintMode;
153
154
  repeat?: 'repeat' | 'repeat-x' | 'repeat-y';
154
155
  }
@@ -1039,4 +1040,21 @@ interface IEffectModule {
1039
1040
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
1040
1041
  }
1041
1042
 
1042
- export type { IAnimate, IAnimateKeyframe, IAnimateList, IAnimateType, IAnimation, IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, IComputedKeyframe, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffect, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFontWeightNumer, IFontWeightString, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGIF, IGIFData, IGIFInputData, IGradientPaint, IGradientType, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageFilters, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, IKeyframe, IKeyframeId, IKeyframesAnimation, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintBase, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPaintType, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathDataArrowOffset, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IRobot, IRobotActionName, IRobotActions, IRobotAnimation, IRobotComputedKeyframe, IRobotData, IRobotInputData, IRobotKeyframe, IShadowEffect, IShadowString, ISolidPaint, IStar, IStarData, IStarInputData, IStateModule, IStateName, IStateStyle, IStates, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IStyleAnimation, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, ITransitionFunction, ITransitionMap, ITransitionModule, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign, IVideo, IVideoData, IVideoInputData, IWritingMode };
1043
+ interface IFilterModule {
1044
+ list: IFilterProcessorMap;
1045
+ register(name: string, filterProcessor: IFilterProcessor): void;
1046
+ apply(filters: IFilter[], ui: IUI, bounds: IMatrixWithBoundsScaleData, currentCanvas: ILeaferCanvas, originCanvas: ILeaferCanvas, shape: ICachedShape): void;
1047
+ getSpread(filters: IFilter[]): number;
1048
+ }
1049
+ interface IFilterProcessorMap {
1050
+ [name: string]: IFilterProcessor;
1051
+ }
1052
+ interface IFilterProcessor {
1053
+ apply: IFilterFunction;
1054
+ getSpread(filter: IFilter): number;
1055
+ }
1056
+ interface IFilterFunction {
1057
+ (filter: IFilter, ui: IUI, bounds: IMatrixWithBoundsScaleData, currentCanvas: ILeaferCanvas, originCanvas: ILeaferCanvas, shape: ICachedShape): void;
1058
+ }
1059
+
1060
+ export type { IAnimate, IAnimateKeyframe, IAnimateList, IAnimateType, IAnimation, IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, IComputedKeyframe, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffect, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFilterFunction, IFilterModule, IFilterProcessor, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFontWeightNumer, IFontWeightString, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGIF, IGIFData, IGIFInputData, IGradientPaint, IGradientType, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageFilters, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, IKeyframe, IKeyframeId, IKeyframesAnimation, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintBase, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPaintType, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathDataArrowOffset, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IRobot, IRobotActionName, IRobotActions, IRobotAnimation, IRobotComputedKeyframe, IRobotData, IRobotInputData, IRobotKeyframe, IShadowEffect, IShadowString, ISolidPaint, IStar, IStarData, IStarInputData, IStateModule, IStateName, IStateStyle, IStates, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IStyleAnimation, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, ITransitionFunction, ITransitionMap, ITransitionModule, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign, IVideo, IVideoData, IVideoInputData, IWritingMode };