@leafer-ui/interface 1.9.11 → 1.10.0

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.9.11",
3
+ "version": "1.10.0",
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.9.11"
25
+ "@leafer/interface": "1.10.0"
26
26
  }
27
27
  }
package/src/IUI.ts CHANGED
@@ -227,6 +227,7 @@ export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIDat
227
227
  __letterSpacing?: number
228
228
  __padding?: number[]
229
229
  __clipText?: boolean
230
+ __isCharMode?: boolean
230
231
  __isPlacehold?: boolean
231
232
  __textBoxBounds?: IBoundsData
232
233
  }
@@ -426,7 +427,7 @@ export interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICorne
426
427
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
427
428
  __drawContent?(canvas: ILeaferCanvas, options: IRenderOptions): void
428
429
 
429
- drawImagePlaceholder(canvas: ILeaferCanvas, image: ILeaferImage): void
430
+ drawImagePlaceholder(image: ILeaferImage, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
430
431
 
431
432
  animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate
432
433
  killAnimate(type?: IAnimateType, nextStyle?: IUIInputData): void
@@ -54,6 +54,8 @@ export interface IEditorBase extends IGroup, ISelectorProxy, ITransformTool {
54
54
 
55
55
  update(): void
56
56
  updateEditBox(): void
57
+
58
+ getEditTool(name: string): IObject
57
59
  updateEditTool(): void
58
60
  unloadEditTool(): void
59
61
 
@@ -64,6 +66,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy, ITransformTool {
64
66
  openGroup(group: IGroup): void
65
67
  closeGroup(group: IGroup): void
66
68
 
69
+ getInnerEditor(name: string): IObject
67
70
  openInnerEditor(target?: IUI, nameOrSelect?: string | boolean, select?: boolean): void
68
71
  closeInnerEditor(onlyInnerEditor?: boolean): void
69
72
 
@@ -105,7 +108,7 @@ export interface IEditorConfig extends IObject {
105
108
 
106
109
  point?: IEditPointInputData | IEditPointInputData[]
107
110
  middlePoint?: IEditPointInputData | IEditPointInputData[]
108
- resizeLine?: IEditPointInputData
111
+ resizeLine?: IEditPointInputData | IEditPointInputData[]
109
112
 
110
113
  rect?: IBoxInputData
111
114
  rectThrough?: boolean // 是否穿透rect(穿透后,可以拾取到rect下面的元素,默认单选元素时穿透)
@@ -1,6 +1,6 @@
1
- import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAlign, IPointData, IMatrixData } from '@leafer/interface'
1
+ import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAlign, IPointData, IMatrixData, IScaleData, IFunction, ITaskItem } from '@leafer/interface'
2
2
 
3
- import { ILeafPaint, ILeafPaintPatternData } from '../type/IComputedType'
3
+ import { ILeafPaint, ILeafStrokePaint, 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'
@@ -9,18 +9,19 @@ import { IGradientPaint, IImagePaint, IPaintAttr } from '../type/IType'
9
9
  export interface IPaintModule {
10
10
  compute(attrName: IPaintAttr, ui: IUI): void
11
11
 
12
- fill(fill: string, ui: IUI, canvas: ILeaferCanvas,): void
13
- fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void
12
+ fill(fill: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
13
+ fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
14
14
 
15
- fillPathOrText(ui: IUI, canvas: ILeaferCanvas): void
16
- fillText(ui: IUI, canvas: ILeaferCanvas): void
15
+ fillPathOrText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
16
+ fillText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
17
17
 
18
- stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void
19
- strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void
18
+ stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
19
+ strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
20
20
 
21
- strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void
22
- strokeArrow?(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void
23
- drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void
21
+ strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
22
+ strokeArrow?(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
23
+ drawStrokesStyle(strokes: ILeafStrokePaint[], strokeWidthScale: number, isText: boolean, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
24
+ drawTextStroke(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
24
25
 
25
26
  shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape
26
27
  }
@@ -28,10 +29,16 @@ export interface IPaintModule {
28
29
 
29
30
  export interface IPaintImageModule {
30
31
  image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint
31
- checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, allowPaint?: boolean): boolean // 返回true表示已进行了原生绘制
32
- createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean
32
+
33
+ checkImage(paint: ILeafPaint, allowDraw: boolean, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): boolean // 返回true表示已进行了原生绘制
34
+ drawImage(paint: ILeafPaint, imageScaleX: number, imageScaleY: number, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
35
+ getImageRenderScaleData(paint: ILeafPaint, ui: IUI, canvas?: ILeaferCanvas, renderOptions?: IRenderOptions): IScaleData // 当前图片渲染的比例数据,必须马上分解使用
33
36
  recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap
34
37
 
38
+ createPatternTask(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
39
+ createPattern(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions, resolve?: IFunction, task?: ITaskItem): void
40
+ getPatternFixScale(paint: ILeafPaint, imageScaleX: number, imageScaleY: number): number
41
+
35
42
  createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void
36
43
  getPatternData(paint: IImagePaint, box: IBoundsData, image: ILeaferImage): ILeafPaintPatternData
37
44
 
@@ -14,6 +14,7 @@ export interface ILeafPaint {
14
14
  transform?: IMatrixData // 存在时表示pattern自身不能应用transform
15
15
  blendMode?: IBlendMode
16
16
  image?: ILeaferImage
17
+ level?: number
17
18
  loadId?: number
18
19
  patternId?: string
19
20
  patternTask?: ITaskItem
@@ -26,8 +27,6 @@ export interface ILeafPaint {
26
27
  }
27
28
 
28
29
  export interface ILeafPaintPatternData {
29
- width?: number
30
- height?: number
31
30
  scaleX?: number
32
31
  scaleY?: number
33
32
  gap?: IPointData
package/src/type/IType.ts CHANGED
@@ -146,7 +146,15 @@ export interface IPathDataArrowOffset {
146
146
  }
147
147
 
148
148
  // 文本
149
- export type ITextAlign = 'left' | 'center' | 'right' | 'justify' | 'both'
149
+ export type ITextAlign =
150
+ | 'left'
151
+ | 'center'
152
+ | 'right'
153
+ | 'justify' // 两端对齐,最后一行不处理,适合段落文本,英文会均分单词
154
+ | 'justify-letter' // 字符级对齐
155
+ | 'both' // 所有行两端对齐,适合单行文本,英文会均分单词
156
+ | 'both-letter' // 字符级对齐
157
+
150
158
  export type IVerticalAlign = 'top' | 'middle' | 'bottom'
151
159
  export type ITextCase = | 'upper' | 'lower' | 'title' | 'none' | 'small-caps'
152
160
  export type IFontWeight = IFontWeightNumer | IFontWeightString
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed, IPathCommandData, IAxis, IAxisReverse, IDirection, IWindingRule, IFilter, IMatrixData, ILeaferImage, ITaskItem, INumber, IString, IBoolean, IUnitData, IAnimateOptions, IAnimateEasing, IEventer, IObject, IEventParamsMap, IAnimateEasingFunction, IAnimateEnding, ITransition, IPercentData, IBounds, ILeafInputData, ILeaf as ILeaf$1, ILeafComputedData, ILeafData, IBoundsData, IValue, IPathCreator, IJSONOptions, IFindCondition, IAnswer, IPathString, IPathDrawer, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPickOptions, IPickResult, ICanvasContext2DSettings, ICanvasContext2D, ILeaferAttrData, IControl, ILeaferType, ILeaferConfig, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IMatrixWithBoundsScaleData } from '@leafer/interface';
1
+ import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed, IPathCommandData, IAxis, IAxisReverse, IDirection, IWindingRule, IFilter, IMatrixData, ILeaferImage, ITaskItem, INumber, IString, IBoolean, IUnitData, IAnimateOptions, IAnimateEasing, IEventer, IObject, IEventParamsMap, IAnimateEasingFunction, IAnimateEnding, ITransition, IPercentData, IBounds, ILeafInputData, ILeaf as ILeaf$1, ILeafComputedData, ILeafData, IBoundsData, IValue, IPathCreator, IJSONOptions, IFindCondition, IAnswer, IPathString, IPathDrawer, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPickOptions, IPickResult, ICanvasContext2DSettings, ICanvasContext2D, ILeaferAttrData, IControl, ILeaferType, ILeaferConfig, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IScaleData as IScaleData$1, IBooleanMap, IFunction, IMatrixWithBoundsScaleData } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
3
  import { IObject as IObject$1, IEditSize, IStroke as IStroke$1, IFourNumber as IFourNumber$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, IShortcutKeysCheck, IShortcutKeys, IUI as IUI$1, IPointData as IPointData$1, IScaleData, ISkewData, IGroup as IGroup$1, ISelectorProxy, IBox as IBox$1, ILayoutBoundsData, IKeyEvent, IUIEvent, IDragEvent, IMoveEvent, IZoomEvent, IRotateEvent, ITransition as ITransition$1, ILeafList, ILeafer as ILeafer$1, ILeaf, 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
 
@@ -115,7 +115,7 @@ interface IPathDataArrowOffset {
115
115
  bevelJoin?: number;
116
116
  roundJoin?: number;
117
117
  }
118
- type ITextAlign = 'left' | 'center' | 'right' | 'justify' | 'both';
118
+ type ITextAlign = 'left' | 'center' | 'right' | 'justify' | 'justify-letter' | 'both' | 'both-letter';
119
119
  type IVerticalAlign = 'top' | 'middle' | 'bottom';
120
120
  type ITextCase = 'upper' | 'lower' | 'title' | 'none' | 'small-caps';
121
121
  type IFontWeight = IFontWeightNumer | IFontWeightString;
@@ -170,6 +170,7 @@ interface ILeafPaint {
170
170
  transform?: IMatrixData;
171
171
  blendMode?: IBlendMode;
172
172
  image?: ILeaferImage;
173
+ level?: number;
173
174
  loadId?: number;
174
175
  patternId?: string;
175
176
  patternTask?: ITaskItem;
@@ -181,8 +182,6 @@ interface ILeafPaint {
181
182
  scaleFixed?: IScaleFixed;
182
183
  }
183
184
  interface ILeafPaintPatternData {
184
- width?: number;
185
- height?: number;
186
185
  scaleX?: number;
187
186
  scaleY?: number;
188
187
  gap?: IPointData;
@@ -458,6 +457,7 @@ interface IEditorBase extends IGroup$1, ISelectorProxy, ITransformTool {
458
457
  setBright(value: boolean): void;
459
458
  update(): void;
460
459
  updateEditBox(): void;
460
+ getEditTool(name: string): IObject$1;
461
461
  updateEditTool(): void;
462
462
  unloadEditTool(): void;
463
463
  getEditSize(ui: ILeaf): IEditSize;
@@ -465,6 +465,7 @@ interface IEditorBase extends IGroup$1, ISelectorProxy, ITransformTool {
465
465
  ungroup(): IUI$1[];
466
466
  openGroup(group: IGroup$1): void;
467
467
  closeGroup(group: IGroup$1): void;
468
+ getInnerEditor(name: string): IObject$1;
468
469
  openInnerEditor(target?: IUI$1, nameOrSelect?: string | boolean, select?: boolean): void;
469
470
  closeInnerEditor(onlyInnerEditor?: boolean): void;
470
471
  lock(): void;
@@ -495,7 +496,7 @@ interface IEditorConfig extends IObject$1 {
495
496
  pointRadius?: number;
496
497
  point?: IEditPointInputData | IEditPointInputData[];
497
498
  middlePoint?: IEditPointInputData | IEditPointInputData[];
498
- resizeLine?: IEditPointInputData;
499
+ resizeLine?: IEditPointInputData | IEditPointInputData[];
499
500
  rect?: IBoxInputData$1;
500
501
  rectThrough?: boolean;
501
502
  area?: IRectInputData$1;
@@ -864,6 +865,7 @@ interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
864
865
  __letterSpacing?: number;
865
866
  __padding?: number[];
866
867
  __clipText?: boolean;
868
+ __isCharMode?: boolean;
867
869
  __isPlacehold?: boolean;
868
870
  __textBoxBounds?: IBoundsData;
869
871
  }
@@ -1023,7 +1025,7 @@ interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadius
1023
1025
  __drawPathByBox(drawer: IPathDrawer): void;
1024
1026
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1025
1027
  __drawContent?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1026
- drawImagePlaceholder(canvas: ILeaferCanvas, image: ILeaferImage): void;
1028
+ drawImagePlaceholder(image: ILeaferImage, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1027
1029
  animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate;
1028
1030
  killAnimate(type?: IAnimateType, nextStyle?: IUIInputData): void;
1029
1031
  export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
@@ -1225,22 +1227,27 @@ interface ICachedShape extends ICachedLeaf {
1225
1227
 
1226
1228
  interface IPaintModule {
1227
1229
  compute(attrName: IPaintAttr, ui: IUI): void;
1228
- fill(fill: string, ui: IUI, canvas: ILeaferCanvas): void;
1229
- fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
1230
- fillPathOrText(ui: IUI, canvas: ILeaferCanvas): void;
1231
- fillText(ui: IUI, canvas: ILeaferCanvas): void;
1232
- stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void;
1233
- strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
1234
- strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
1235
- strokeArrow?(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas): void;
1236
- drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void;
1230
+ fill(fill: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1231
+ fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1232
+ fillPathOrText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1233
+ fillText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1234
+ stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1235
+ strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1236
+ strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1237
+ strokeArrow?(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1238
+ drawStrokesStyle(strokes: ILeafStrokePaint[], strokeWidthScale: number, isText: boolean, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1239
+ drawTextStroke(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1237
1240
  shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
1238
1241
  }
1239
1242
  interface IPaintImageModule {
1240
1243
  image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint;
1241
- checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, allowPaint?: boolean): boolean;
1242
- createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean;
1244
+ checkImage(paint: ILeafPaint, allowDraw: boolean, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): boolean;
1245
+ drawImage(paint: ILeafPaint, imageScaleX: number, imageScaleY: number, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1246
+ getImageRenderScaleData(paint: ILeafPaint, ui: IUI, canvas?: ILeaferCanvas, renderOptions?: IRenderOptions): IScaleData$1;
1243
1247
  recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap;
1248
+ createPatternTask(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1249
+ createPattern(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions, resolve?: IFunction, task?: ITaskItem): void;
1250
+ getPatternFixScale(paint: ILeafPaint, imageScaleX: number, imageScaleY: number): number;
1244
1251
  createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void;
1245
1252
  getPatternData(paint: IImagePaint, box: IBoundsData, image: ILeaferImage): ILeafPaintPatternData;
1246
1253
  stretchMode(data: ILeafPaintPatternData, box: IBoundsData, scaleX: number, scaleY: number): void;