@leafer/interface 1.6.1 → 1.6.2
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 +1 -1
- package/src/event/IProgress.ts +9 -0
- package/src/file/IExport.ts +1 -0
- package/src/image/ILeaferImage.ts +4 -0
- package/src/index.ts +2 -0
- package/src/platform/IPlatform.ts +4 -1
- package/types/index.d.ts +16 -2
package/package.json
CHANGED
package/src/file/IExport.ts
CHANGED
|
@@ -4,11 +4,13 @@ import { InnerId } from '../event/IEventer'
|
|
|
4
4
|
import { IExportFileType } from '../file/IFileType'
|
|
5
5
|
import { IMatrixData } from '../math/IMath'
|
|
6
6
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
7
|
+
import { IProgressData } from '../event/IProgress'
|
|
7
8
|
|
|
8
9
|
export interface ILeaferImageConfig {
|
|
9
10
|
url: string
|
|
10
11
|
thumb?: string
|
|
11
12
|
format?: IExportFileType
|
|
13
|
+
showProgress?: boolean // 是否显示进度
|
|
12
14
|
view?: IObject | ILeaferImage | ILeaferCanvas
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -44,6 +46,8 @@ export interface ILeaferImage {
|
|
|
44
46
|
ready: boolean
|
|
45
47
|
error: IObject
|
|
46
48
|
loading: boolean
|
|
49
|
+
isPlacehold?: boolean // 是否显示占位符,一般在加载100ms后自动判断
|
|
50
|
+
progress: IProgressData // 加载进度
|
|
47
51
|
|
|
48
52
|
use: number
|
|
49
53
|
config: ILeaferImageConfig
|
package/src/index.ts
CHANGED
|
@@ -48,6 +48,8 @@ export { IExportOptions, IJSONOptions, IExportResult, IExportResultFunction, IEx
|
|
|
48
48
|
export { InnerId, IEventer, IEventMap, IEventListener, IEventOption, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
49
49
|
export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, IMultiTouchData, IKeepTouchData } from './event/IEvent'
|
|
50
50
|
export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
|
|
51
|
+
export { IProgressData, IProgressFunction } from './event/IProgress'
|
|
52
|
+
|
|
51
53
|
export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/ICursor'
|
|
52
54
|
export { IInteraction, IInteractionCanvas, IInteractionConfig, IMoveConfig, ICursorConfig, IZoomConfig, IWheelConfig, ITouchConfig, IMultiTouchConfig, IPointerConfig } from './interaction/IInteraction'
|
|
53
55
|
export { ITransformer } from './interaction/ITransformer'
|
|
@@ -6,6 +6,8 @@ import { IBoundsData, ISizeData } from '../math/IMath'
|
|
|
6
6
|
import { IObject } from '../data/IData'
|
|
7
7
|
import { ICanvasType } from '../canvas/ISkiaCanvas'
|
|
8
8
|
import { ISelector } from '../selector/ISelector'
|
|
9
|
+
import { IProgressFunction } from '../event/IProgress'
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
export interface IPlatform {
|
|
11
13
|
name?: 'web' | 'node' | 'miniapp'
|
|
@@ -37,7 +39,8 @@ export interface IPlatform {
|
|
|
37
39
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
|
|
38
40
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
|
|
39
41
|
download(url: string, filename: string): Promise<void>
|
|
40
|
-
loadImage(url: string): Promise<any>
|
|
42
|
+
loadImage(url: string, progressFn?: IProgressFunction): Promise<any>
|
|
43
|
+
loadImageWithProgress?(url: string, progressFn?: IProgressFunction): Promise<any>
|
|
41
44
|
noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
|
|
42
45
|
Image?: any
|
|
43
46
|
PointerEvent?: any
|
package/types/index.d.ts
CHANGED
|
@@ -936,6 +936,7 @@ interface IExportOptions {
|
|
|
936
936
|
padding?: IFourNumber;
|
|
937
937
|
smooth?: boolean;
|
|
938
938
|
pixelRatio?: number;
|
|
939
|
+
clip?: IBoundsData;
|
|
939
940
|
slice?: boolean;
|
|
940
941
|
trim?: boolean;
|
|
941
942
|
fill?: string;
|
|
@@ -1758,10 +1759,20 @@ interface ILeafAttrDescriptorFn {
|
|
|
1758
1759
|
(key: string): ILeafAttrDescriptor;
|
|
1759
1760
|
}
|
|
1760
1761
|
|
|
1762
|
+
interface IProgressData {
|
|
1763
|
+
value: number;
|
|
1764
|
+
loaded: number;
|
|
1765
|
+
total: number;
|
|
1766
|
+
}
|
|
1767
|
+
interface IProgressFunction {
|
|
1768
|
+
(progress: IProgressData): void;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1761
1771
|
interface ILeaferImageConfig {
|
|
1762
1772
|
url: string;
|
|
1763
1773
|
thumb?: string;
|
|
1764
1774
|
format?: IExportFileType;
|
|
1775
|
+
showProgress?: boolean;
|
|
1765
1776
|
view?: IObject | ILeaferImage | ILeaferCanvas;
|
|
1766
1777
|
}
|
|
1767
1778
|
interface ILeaferImageOnLoaded {
|
|
@@ -1789,6 +1800,8 @@ interface ILeaferImage {
|
|
|
1789
1800
|
ready: boolean;
|
|
1790
1801
|
error: IObject;
|
|
1791
1802
|
loading: boolean;
|
|
1803
|
+
isPlacehold?: boolean;
|
|
1804
|
+
progress: IProgressData;
|
|
1792
1805
|
use: number;
|
|
1793
1806
|
config: ILeaferImageConfig;
|
|
1794
1807
|
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number;
|
|
@@ -2219,7 +2232,8 @@ interface IPlatform {
|
|
|
2219
2232
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>;
|
|
2220
2233
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>;
|
|
2221
2234
|
download(url: string, filename: string): Promise<void>;
|
|
2222
|
-
loadImage(url: string): Promise<any>;
|
|
2235
|
+
loadImage(url: string, progressFn?: IProgressFunction): Promise<any>;
|
|
2236
|
+
loadImageWithProgress?(url: string, progressFn?: IProgressFunction): Promise<any>;
|
|
2223
2237
|
noRepeat?: string;
|
|
2224
2238
|
Image?: any;
|
|
2225
2239
|
PointerEvent?: any;
|
|
@@ -2298,4 +2312,4 @@ interface ITransformer {
|
|
|
2298
2312
|
destroy(): void;
|
|
2299
2313
|
}
|
|
2300
2314
|
|
|
2301
|
-
export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|
|
2315
|
+
export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|