@leafer/interface 1.0.6 → 1.0.8

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/interface",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -120,7 +120,7 @@ export interface ICreator {
120
120
  watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher
121
121
  layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter
122
122
  renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer
123
- selector?(target: ILeaf, options?: ISelectorConfig): ISelector
123
+ selector?(target?: ILeaf, options?: ISelectorConfig): ISelector
124
124
 
125
125
  interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
126
126
 
package/src/index.ts CHANGED
@@ -48,7 +48,7 @@ export { InnerId, IEventer, IEventMap, IEventListener, IEventOption, IEventListe
48
48
  export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, IMultiTouchData, IKeepTouchData } from './event/IEvent'
49
49
  export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
50
50
  export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/ICursor'
51
- export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, ITouchConfig, IMultiTouchConfig, IPointerConfig } from './interaction/IInteraction'
51
+ export { IInteraction, IInteractionCanvas, IInteractionConfig, IMoveConfig, ICursorConfig, IZoomConfig, IWheelConfig, ITouchConfig, IMultiTouchConfig, IPointerConfig } from './interaction/IInteraction'
52
52
 
53
53
 
54
54
  export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IFunctionMap, IPointDataMap, IDataTypeHandle } from './data/IData'
@@ -5,24 +5,32 @@ import { IExportFileType, IExportImageType } from '../file/IFileType'
5
5
  import { IBoundsData, ISizeData } from '../math/IMath'
6
6
  import { IObject } from '../data/IData'
7
7
  import { ICanvasType } from '../canvas/ISkiaCanvas'
8
+ import { ISelector } from '../selector/ISelector'
8
9
 
9
10
  export interface IPlatform {
10
11
  name?: 'web' | 'node' | 'miniapp'
11
12
  os?: 'Mac' | 'Windows' | 'Linux'
12
13
  toURL(text: string, fileType?: 'text' | 'svg'): string
14
+
13
15
  requestRender?(render: IFunction): void
14
16
  canvas?: ILeaferCanvas
15
17
  renderCanvas?: ILeaferCanvas
16
18
  canvasType?: ICanvasType
19
+
17
20
  isWorker?: boolean
18
21
  isMobile?: boolean
22
+
19
23
  readonly devicePixelRatio?: number
24
+
20
25
  intWheelDeltaY?: boolean // firefox / Windows need
21
26
  conicGradientSupport?: boolean
22
27
  conicGradientRotate90?: boolean // firefox need rotate
23
28
  fullImageShadow?: boolean // safari need
24
29
  syncDomFont?: boolean // firefox need
30
+
31
+ selector?: ISelector // 公共查找选择器
25
32
  layout?(target: ILeaf): void
33
+
26
34
  origin?: {
27
35
  createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any
28
36
  canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>
@@ -32,14 +40,18 @@ export interface IPlatform {
32
40
  loadImage(url: string): Promise<any>
33
41
  noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
34
42
  },
43
+
35
44
  roundRectPatch?: boolean // fix: skia-canvas roundRect
36
45
  ellipseToCurve?: boolean, // fix: skia 绘制圆环和椭圆弧
46
+
37
47
  event?: {
38
48
  stopDefault(origin: IObject): void
39
49
  stopNow(origin: IObject): void
40
50
  stop(origin: IObject): void
41
51
  },
52
+
42
53
  miniapp?: IMiniapp
54
+
43
55
  image: {
44
56
  hitCanvasSize: number // 图片生成碰撞画布的最大尺寸(单边)
45
57
  maxCacheSize: number // 最大等级缓存,一般取当前屏幕大小,默认2k: 2560 * 1600
@@ -47,7 +47,7 @@ export interface ISelectorProxy {
47
47
  }
48
48
 
49
49
  export interface ISelector {
50
- target: ILeaf
50
+ target?: ILeaf
51
51
 
52
52
  proxy?: ISelectorProxy
53
53
 
package/types/index.d.ts CHANGED
@@ -1259,7 +1259,7 @@ interface ISelectorProxy {
1259
1259
  dragHoverExclude: ILeaf[];
1260
1260
  }
1261
1261
  interface ISelector {
1262
- target: ILeaf;
1262
+ target?: ILeaf;
1263
1263
  proxy?: ISelectorProxy;
1264
1264
  config: ISelectorConfig;
1265
1265
  getByPoint(hitPoint: IPointData, hitRadius: number, options?: IPickOptions): IPickResult;
@@ -1899,6 +1899,9 @@ interface ITouchConfig {
1899
1899
  interface IMultiTouchConfig {
1900
1900
  disabled?: boolean;
1901
1901
  }
1902
+ interface ICursorConfig {
1903
+ stop?: boolean;
1904
+ }
1902
1905
 
1903
1906
  interface IHitCanvasManager extends ICanvasManager {
1904
1907
  maxTotal: number;
@@ -1986,7 +1989,7 @@ interface ICreator {
1986
1989
  watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher;
1987
1990
  layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter;
1988
1991
  renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer;
1989
- selector?(target: ILeaf, options?: ISelectorConfig): ISelector;
1992
+ selector?(target?: ILeaf, options?: ISelectorConfig): ISelector;
1990
1993
  interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction;
1991
1994
  editor?(options?: IObject): ILeaf;
1992
1995
  }
@@ -2108,6 +2111,7 @@ interface IPlatform {
2108
2111
  conicGradientRotate90?: boolean;
2109
2112
  fullImageShadow?: boolean;
2110
2113
  syncDomFont?: boolean;
2114
+ selector?: ISelector;
2111
2115
  layout?(target: ILeaf): void;
2112
2116
  origin?: {
2113
2117
  createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
@@ -2169,4 +2173,4 @@ interface ICursorRotateMap {
2169
2173
  [name: string]: ICursorRotate;
2170
2174
  }
2171
2175
 
2172
- export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, 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, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, 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, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
2176
+ export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, 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, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, 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, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };