@leafer-ui/interface 1.0.0-rc.24 → 1.0.0-rc.26

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-rc.24",
3
+ "version": "1.0.0-rc.26",
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.0.0-rc.24"
25
+ "@leafer/interface": "1.0.0-rc.26"
26
26
  }
27
27
  }
package/src/IUI.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition } from '@leafer/interface'
1
+ import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition, IBoolean } from '@leafer/interface'
2
2
 
3
3
  import {
4
4
  IFillAttrData, IFillInputData, IFillComputedData,
@@ -134,10 +134,12 @@ export interface IText extends ITextStyleAttrData, IUI {
134
134
  __: ITextData
135
135
  text: string
136
136
  padding: IFourNumber
137
+ resizeFontSize: IBoolean
137
138
  }
138
139
  interface ITextAttrData {
139
140
  text?: string
140
141
  padding?: IFourNumber
142
+ resizeFontSize?: boolean
141
143
  }
142
144
 
143
145
  export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
@@ -257,14 +259,17 @@ export interface IFrameInputData extends IBoxInputData {
257
259
  // Box
258
260
  export interface IBox extends IGroup {
259
261
  __: IBoxData
262
+ resizeChildren: IBoolean
260
263
  overflow: IOverflow
261
264
  __updateRectRenderBounds(): void
262
265
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void
263
266
  }
264
267
  export interface IBoxData extends IGroupData {
268
+ resizeChildren?: boolean
265
269
  overflow?: IOverflow
266
270
  }
267
271
  export interface IBoxInputData extends IGroupInputData {
272
+ resizeChildren?: boolean
268
273
  overflow?: IOverflow
269
274
  }
270
275
 
@@ -324,8 +329,8 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
324
329
 
325
330
  find(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI[]
326
331
  findTag(tag: string | string[]): IUI[]
327
- findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI
328
- findId(id: number | string): IUI
332
+ findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI | undefined
333
+ findId(id: number | string): IUI | undefined
329
334
 
330
335
  getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData
331
336
  getPathString(curve?: boolean, pathForRender?: boolean): IPathString
@@ -1,4 +1,4 @@
1
- import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAlign, IUnitPointData, IDragEvent, IRotateEvent, IStroke, IFill, ILeaf, ILeafList, IObject, IBoxInputData, IGroupInputData, IImageCursor, IRect, IBoundsData, IKeyEvent, IUIInputData } from '@leafer-ui/interface'
1
+ import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAlign, IUnitPointData, IDragEvent, IRotateEvent, IStroke, IFill, ILeaf, ILeafList, IObject, IBoxInputData, IGroupInputData, IImageCursor, IRect, IBoundsData, IKeyEvent, IUIInputData, IZoomEvent } from '@leafer-ui/interface'
2
2
 
3
3
  export interface IEditorBase extends IGroup, ISelectorProxy {
4
4
  config: IEditorConfig
@@ -42,7 +42,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
42
42
  getEditSize(ui: ILeaf): IEditSize
43
43
 
44
44
  onMove(e: IDragEvent): void
45
- onScale(e: IDragEvent): void
45
+ onScale(e: IDragEvent | IZoomEvent): void
46
46
  onRotate(e: IDragEvent | IRotateEvent): void
47
47
  onSkew(e: IDragEvent): void
48
48
 
@@ -51,7 +51,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
51
51
  openGroup(group: IGroup): void
52
52
  closeGroup(group: IGroup): void
53
53
 
54
- openInnerEditor(): void
54
+ openInnerEditor(target?: IUI): void
55
55
  closeInnerEditor(): void
56
56
 
57
57
  lock(): void
@@ -105,8 +105,8 @@ export interface IEditorConfig {
105
105
  openInner?: 'double' | 'long' // 双击/长按打开内部
106
106
 
107
107
  moveable?: boolean
108
- rotateable?: boolean
109
- resizeable?: boolean
108
+ rotateable?: boolean | 'rotate'
109
+ resizeable?: boolean | 'zoom'
110
110
  skewable?: boolean
111
111
  }
112
112
 
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ export {
28
28
  export { IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IPathDataArrow, IPathDataArrowMap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat } from './type/IType'
29
29
  export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString } from './type/IStringType'
30
30
  export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
31
+ export { IStrokeAttrData, IStrokeInputData, IStrokeComputedData, ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData, IEffectAttrData, IEffectInputData, IEffectComputedData } from './ICommonAttr'
31
32
 
32
33
  export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
33
34
  export { IUIBoundsModule } from './module/IUIBounds'
@@ -1,10 +1,11 @@
1
- import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAround } from '@leafer/interface'
1
+ import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAround, IPointData, IMatrixData } from '@leafer/interface'
2
2
 
3
3
  import { ILeafPaint, ILeafPaintPatternData } from '../type/IComputedType'
4
4
  import { IUI, IUIData } from '../IUI'
5
5
  import { ICachedShape } from '../ICachedShape'
6
6
  import { IGradientPaint, IImagePaint, IPaintAttr } from '../type/IType'
7
7
 
8
+
8
9
  export interface IPaintModule {
9
10
  compute(attrName: IPaintAttr, ui: IUI): void
10
11
 
@@ -30,6 +31,7 @@ export interface IPaintImageModule {
30
31
  recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap
31
32
 
32
33
  createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void
34
+ getPatternData(paint: IImagePaint, box: IBoundsData, image: ILeaferImage): ILeafPaintPatternData
33
35
  fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void
34
36
  clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void
35
37
  repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void
@@ -39,4 +41,5 @@ export interface IPaintGradientModule {
39
41
  linearGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint
40
42
  radialGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint
41
43
  conicGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint
44
+ getTransform(box: IBoundsData, from: IPointData, to: IPointData, stretch: number, rotate90: boolean): IMatrixData
42
45
  }
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, INumber, IBoolean, IString, IUnitData, IPathCreator, IBoundsData as IBoundsData$1, ILeaferImageConfig, ICanvasContext2DSettings, ILeaferCanvas, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, IObject as IObject$1, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, IStateStyleType, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
1
+ import { IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IPathCreator, IBoundsData as IBoundsData$1, ILeaferImageConfig, ICanvasContext2DSettings, ILeaferCanvas, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, IObject as IObject$1, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, IStateStyleType, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
- import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject, ILeaf, IEditSize, IDragEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent } from '@leafer-ui/interface';
3
+ import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject, 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, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent } from '@leafer-ui/interface';
4
4
 
5
5
  type IPercent = string;
6
6
  type IColorString = string;
@@ -331,14 +331,14 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
331
331
  updateEditTool(): void;
332
332
  getEditSize(ui: ILeaf): IEditSize;
333
333
  onMove(e: IDragEvent): void;
334
- onScale(e: IDragEvent): void;
334
+ onScale(e: IDragEvent | IZoomEvent): void;
335
335
  onRotate(e: IDragEvent | IRotateEvent): void;
336
336
  onSkew(e: IDragEvent): void;
337
337
  group(group?: IGroup$1 | IGroupInputData$1): IGroup$1;
338
338
  ungroup(): IUI$1[];
339
339
  openGroup(group: IGroup$1): void;
340
340
  closeGroup(group: IGroup$1): void;
341
- openInnerEditor(): void;
341
+ openInnerEditor(target?: IUI$1): void;
342
342
  closeInnerEditor(): void;
343
343
  lock(): void;
344
344
  unlock(): void;
@@ -379,8 +379,8 @@ interface IEditorConfig {
379
379
  continuousSelect?: boolean;
380
380
  openInner?: 'double' | 'long';
381
381
  moveable?: boolean;
382
- rotateable?: boolean;
383
- resizeable?: boolean;
382
+ rotateable?: boolean | 'rotate';
383
+ resizeable?: boolean | 'zoom';
384
384
  skewable?: boolean;
385
385
  }
386
386
  interface IEditPoint extends IBox$1 {
@@ -524,10 +524,12 @@ interface IText extends ITextStyleAttrData, IUI {
524
524
  __: ITextData;
525
525
  text: string;
526
526
  padding: IFourNumber;
527
+ resizeFontSize: IBoolean;
527
528
  }
528
529
  interface ITextAttrData {
529
530
  text?: string;
530
531
  padding?: IFourNumber;
532
+ resizeFontSize?: boolean;
531
533
  }
532
534
  interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
533
535
  __baseLine?: number;
@@ -623,14 +625,17 @@ interface IFrameInputData extends IBoxInputData {
623
625
  }
624
626
  interface IBox extends IGroup {
625
627
  __: IBoxData;
628
+ resizeChildren: IBoolean;
626
629
  overflow: IOverflow;
627
630
  __updateRectRenderBounds(): void;
628
631
  __renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
629
632
  }
630
633
  interface IBoxData extends IGroupData {
634
+ resizeChildren?: boolean;
631
635
  overflow?: IOverflow;
632
636
  }
633
637
  interface IBoxInputData extends IGroupInputData {
638
+ resizeChildren?: boolean;
634
639
  overflow?: IOverflow;
635
640
  }
636
641
  interface IGroup extends IUI {
@@ -677,8 +682,8 @@ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEf
677
682
  createProxyData(): IUIInputData;
678
683
  find(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI[];
679
684
  findTag(tag: string | string[]): IUI[];
680
- findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI;
681
- findId(id: number | string): IUI;
685
+ findOne(condition: number | string | IFindCondition | IFindUIMethod, options?: any): IUI | undefined;
686
+ findId(id: number | string): IUI | undefined;
682
687
  getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
683
688
  getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
684
689
  load(): void;
@@ -837,6 +842,7 @@ interface IPaintImageModule {
837
842
  createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean;
838
843
  recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap;
839
844
  createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData$1): void;
845
+ getPatternData(paint: IImagePaint, box: IBoundsData$1, image: ILeaferImage): ILeafPaintPatternData;
840
846
  fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
841
847
  clipMode(data: ILeafPaintPatternData, box: IBoundsData$1, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
842
848
  repeatMode(data: ILeafPaintPatternData, box: IBoundsData$1, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void;
@@ -845,6 +851,7 @@ interface IPaintGradientModule {
845
851
  linearGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
846
852
  radialGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
847
853
  conicGradient(paint: IGradientPaint, box: IBoundsData$1): ILeafPaint;
854
+ getTransform(box: IBoundsData$1, from: IPointData, to: IPointData, stretch: number, rotate90: boolean): IMatrixData;
848
855
  }
849
856
 
850
857
  interface IEffectModule {
@@ -854,4 +861,4 @@ interface IEffectModule {
854
861
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
855
862
  }
856
863
 
857
- export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGradientPaint, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IStateModule, IStroke, IStrokeAlign, IStrokeCap, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextWordData, ITextWrap, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign };
864
+ export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGradientPaint, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IStateModule, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign };