@leafer-ui/interface 1.0.0-rc.11 → 1.0.0-rc.16

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.11",
3
+ "version": "1.0.0-rc.16",
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.11"
25
+ "@leafer/interface": "1.0.0-rc.16"
26
26
  }
27
27
  }
@@ -78,6 +78,9 @@ export interface IStrokeComputedData {
78
78
  dashPattern?: number[]
79
79
  dashOffset?: number
80
80
  miterLimit?: number
81
+
82
+ startArrow?: IArrowType
83
+ endArrow?: IArrowType
81
84
  }
82
85
 
83
86
  // text---
package/src/IUI.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult } 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 } from '@leafer/interface'
2
2
 
3
3
  import {
4
4
  IFillAttrData, IFillInputData, IFillComputedData,
@@ -37,7 +37,7 @@ interface IArrowAttrData {
37
37
 
38
38
  }
39
39
  export interface IArrowData extends IArrowAttrData, ILineData { }
40
- export interface IArrowInputData extends IArrowAttrData, IUIBaseInputData { }
40
+ export interface IArrowInputData extends IArrowAttrData, ILineInputData { }
41
41
 
42
42
 
43
43
  // Rect
@@ -97,16 +97,10 @@ export interface IStarInputData extends IStarAttrData, IUIBaseInputData { }
97
97
  // Path
98
98
  export interface IPath extends IUI {
99
99
  __: IPathData
100
- path: IPathCommandData | IPathString
101
- windingRule: IWindingRule
102
100
  }
103
101
  export interface IPathData extends IUIData {
104
- path?: IPathCommandData
105
- windingRule?: IWindingRule
106
102
  }
107
103
  export interface IPathInputData extends IUIBaseInputData {
108
- path?: IPathCommandData | IPathString
109
- windingRule?: IWindingRule
110
104
  }
111
105
 
112
106
  // Pen
@@ -206,13 +200,11 @@ export interface IImageInputData extends IImageAttrData, IUIBaseInputData { }
206
200
 
207
201
  export interface ICanvas extends IRect {
208
202
  __: ICanvasData
209
- pixelRatio: number
210
203
  smooth: boolean
211
204
  canvas: ILeaferCanvas
212
205
  __updateSize(): void
213
206
  }
214
207
  interface ICanvasAttrData {
215
- pixelRatio?: number
216
208
  smooth?: boolean
217
209
  }
218
210
  export interface ICanvasData extends ICanvasAttrData, IRectData { }
@@ -221,11 +213,11 @@ export interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData { }
221
213
 
222
214
  // Leafer
223
215
  export interface ILeaferData extends IGroupData {
224
- pixelRatio?: number
216
+
225
217
  }
226
218
 
227
219
  export interface ILeaferInputData extends IGroupInputData {
228
- pixelRatio?: number
220
+
229
221
  }
230
222
 
231
223
  export interface IAppData extends ILeaferData {
@@ -286,7 +278,7 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
286
278
  readonly app: ILeafer
287
279
  leafer?: ILeafer
288
280
  parent?: IGroup
289
- isFrame?: boolean
281
+ readonly isFrame?: boolean
290
282
 
291
283
  proxyData: IUIInputData
292
284
  __proxyData?: IUIInputData
@@ -298,7 +290,7 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
298
290
  set(data: IUIInputData): void
299
291
  toJSON(): IUIInputData
300
292
 
301
- get(): IUIInputData
293
+ get(name?: string): IUIInputData | IValue
302
294
  createProxyData(): IUIInputData
303
295
 
304
296
  find(condition: number | string | IFindUIMethod, options?: any): IUI[]
@@ -340,18 +332,10 @@ export interface IUIData extends IUIComputedData, ILeafData {
340
332
  __isOverflow?: boolean
341
333
  __blendLayer?: boolean
342
334
 
343
- __useEffect?: boolean
344
-
345
- __autoWidth: boolean
346
- __autoHeight: boolean
347
- __autoBounds: boolean
348
-
349
- // path
350
- path?: IPathCommandData
351
- windingRule?: IWindingRule
352
-
353
- __pathForRender?: IPathCommandData
354
- __path2DForRender?: IPath2D
335
+ readonly __autoWidth: boolean
336
+ readonly __autoHeight: boolean
337
+ readonly __autoSide: boolean
338
+ readonly __autoSize: boolean
355
339
 
356
340
  __boxStroke?: boolean
357
341
 
package/src/index.ts CHANGED
@@ -24,13 +24,14 @@ export {
24
24
  IUITag, IUIInputData
25
25
  } from './IUI'
26
26
 
27
- export { IUnitData, IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat } from './type/IType'
27
+ export { IUnitData, 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'
28
28
  export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString } from './type/IStringType'
29
29
  export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'
30
30
 
31
31
  export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'
32
32
  export { IUIBoundsModule } from './module/IUIBounds'
33
33
  export { IUIHitModule } from './module/IUIHit'
34
+ export { IPathArrowModule } from './module/IPathArrow'
34
35
  export { ITextConvertModule } from './module/ITextConvert'
35
36
  export { IColorConvertModule } from './module/IColorConvert'
36
37
  export { IExportModule } from './module/IExport'
@@ -0,0 +1,8 @@
1
+ import { IPathDataArrowMap } from '../type/IType'
2
+ import { IUI } from '../IUI'
3
+
4
+
5
+ export interface IPathArrowModule {
6
+ list: IPathDataArrowMap
7
+ addArrows(ui: IUI, changeRenderPath?: boolean): void
8
+ }
package/src/type/IType.ts CHANGED
@@ -92,11 +92,27 @@ export type IRepeat = boolean | 'x' | 'y'
92
92
 
93
93
  // 描边
94
94
  export type IStrokeAlign = 'inside' | 'outside' | 'center'
95
- export type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-equilateral'
95
+ export type IStrokeCap = 'none' | 'round' | 'square'
96
96
  export type IStrokeJoin = 'bevel' | 'round' | 'miter'
97
97
 
98
98
  // 箭头
99
- export type IArrowType = 'none' | 'line' | 'triangle' | 'circle'
99
+ export type IArrowType = IPathDataArrow | 'none' | 'angle' | 'angle-side' | 'arrow' | 'triangle' | 'triangle-flip' | 'circle' | 'circle-line' | 'square' | 'square-line' | 'diamond' | 'diamond-line' | 'mark'
100
+
101
+ export interface IPathDataArrowMap {
102
+ [name: string]: IPathDataArrow
103
+ }
104
+
105
+ export interface IPathDataArrow {
106
+ connect?: IPathDataArrowOffset // 箭头与线条的连接点位置
107
+ offset?: IPathDataArrowOffset // 箭头偏移距离,与末端对齐
108
+ path: IPathCommandData
109
+ }
110
+
111
+ export interface IPathDataArrowOffset {
112
+ x?: number // 偏移距离(x轴)
113
+ bevelJoin?: number // strokeJoin 为 bevel 时增加的偏移距离(x轴)
114
+ roundJoin?: number // strokeJoin 为 round 时增加的偏移距离(x轴)
115
+ }
100
116
 
101
117
  // 文本
102
118
  export type ITextAlign = 'left' | 'center' | 'right' | 'justify'
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IPointData, IExportFileType, ISizeData, IWindingRule, IPathCommandData, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, INumber, IBoolean, IString, IPathString, IPathCreator, IBoundsData, ILeaferImageConfig, ILeaferCanvas, IRenderOptions, IPickOptions, IPickResult, ILeaf, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, IPath2D, ILeafComputedData, ILeafInputData, IObject, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap } from '@leafer/interface';
1
+ import { IPointData, IExportFileType, ISizeData, IPathCommandData, IWindingRule, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, INumber, IBoolean, IString, IPathCreator, IBoundsData, ILeaferImageConfig, ILeaferCanvas, IRenderOptions, IPickOptions, IPickResult, ILeaf, IValue, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, IObject, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
3
  import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, IObject as IObject$1, ILeaf as ILeaf$1, 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, IAround } from '@leafer-ui/interface';
4
4
 
@@ -78,9 +78,22 @@ interface IImageFilters {
78
78
  type IImagePaintMode = 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
79
79
  type IRepeat = boolean | 'x' | 'y';
80
80
  type IStrokeAlign = 'inside' | 'outside' | 'center';
81
- type IStrokeCap = 'none' | 'round' | 'square' | 'arrow-lines' | 'arrow-equilateral';
81
+ type IStrokeCap = 'none' | 'round' | 'square';
82
82
  type IStrokeJoin = 'bevel' | 'round' | 'miter';
83
- type IArrowType = 'none' | 'line' | 'triangle' | 'circle';
83
+ type IArrowType = IPathDataArrow | 'none' | 'angle' | 'angle-side' | 'arrow' | 'triangle' | 'triangle-flip' | 'circle' | 'circle-line' | 'square' | 'square-line' | 'diamond' | 'diamond-line' | 'mark';
84
+ interface IPathDataArrowMap {
85
+ [name: string]: IPathDataArrow;
86
+ }
87
+ interface IPathDataArrow {
88
+ connect?: IPathDataArrowOffset;
89
+ offset?: IPathDataArrowOffset;
90
+ path: IPathCommandData;
91
+ }
92
+ interface IPathDataArrowOffset {
93
+ x?: number;
94
+ bevelJoin?: number;
95
+ roundJoin?: number;
96
+ }
84
97
  type ITextAlign = 'left' | 'center' | 'right' | 'justify';
85
98
  type IVerticalAlign = 'top' | 'middle' | 'bottom';
86
99
  type ITextCase = 'upper' | 'lower' | 'title' | 'none' | 'small-caps';
@@ -217,6 +230,8 @@ interface IStrokeComputedData {
217
230
  dashPattern?: number[];
218
231
  dashOffset?: number;
219
232
  miterLimit?: number;
233
+ startArrow?: IArrowType;
234
+ endArrow?: IArrowType;
220
235
  }
221
236
  interface ITextStyleAttrData {
222
237
  fontFamily: IString;
@@ -310,7 +325,7 @@ interface IArrowAttrData {
310
325
  }
311
326
  interface IArrowData extends IArrowAttrData, ILineData {
312
327
  }
313
- interface IArrowInputData extends IArrowAttrData, IUIBaseInputData {
328
+ interface IArrowInputData extends IArrowAttrData, ILineInputData {
314
329
  }
315
330
  interface IRect extends IUI {
316
331
  __: IRectData;
@@ -364,16 +379,10 @@ interface IStarInputData extends IStarAttrData, IUIBaseInputData {
364
379
  }
365
380
  interface IPath extends IUI {
366
381
  __: IPathData;
367
- path: IPathCommandData | IPathString;
368
- windingRule: IWindingRule;
369
382
  }
370
383
  interface IPathData extends IUIData {
371
- path?: IPathCommandData;
372
- windingRule?: IWindingRule;
373
384
  }
374
385
  interface IPathInputData extends IUIBaseInputData {
375
- path?: IPathCommandData | IPathString;
376
- windingRule?: IWindingRule;
377
386
  }
378
387
  interface IPen extends IGroup, IPathCreator {
379
388
  __: IPenData;
@@ -458,13 +467,11 @@ interface IImageInputData extends IImageAttrData, IUIBaseInputData {
458
467
  }
459
468
  interface ICanvas extends IRect {
460
469
  __: ICanvasData;
461
- pixelRatio: number;
462
470
  smooth: boolean;
463
471
  canvas: ILeaferCanvas;
464
472
  __updateSize(): void;
465
473
  }
466
474
  interface ICanvasAttrData {
467
- pixelRatio?: number;
468
475
  smooth?: boolean;
469
476
  }
470
477
  interface ICanvasData extends ICanvasAttrData, IRectData {
@@ -472,10 +479,8 @@ interface ICanvasData extends ICanvasAttrData, IRectData {
472
479
  interface ICanvasInputData extends ICanvasAttrData, IUIBaseInputData {
473
480
  }
474
481
  interface ILeaferData extends IGroupData {
475
- pixelRatio?: number;
476
482
  }
477
483
  interface ILeaferInputData extends IGroupInputData {
478
- pixelRatio?: number;
479
484
  }
480
485
  interface IAppData extends ILeaferData {
481
486
  }
@@ -522,14 +527,14 @@ interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEf
522
527
  readonly app: ILeafer;
523
528
  leafer?: ILeafer;
524
529
  parent?: IGroup;
525
- isFrame?: boolean;
530
+ readonly isFrame?: boolean;
526
531
  proxyData: IUIInputData;
527
532
  __proxyData?: IUIInputData;
528
533
  children?: IUI[];
529
534
  reset(data?: IUIInputData): void;
530
535
  set(data: IUIInputData): void;
531
536
  toJSON(): IUIInputData;
532
- get(): IUIInputData;
537
+ get(name?: string): IUIInputData | IValue;
533
538
  createProxyData(): IUIInputData;
534
539
  find(condition: number | string | IFindUIMethod, options?: any): IUI[];
535
540
  findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
@@ -557,14 +562,10 @@ interface IUIData extends IUIComputedData, ILeafData {
557
562
  __drawAfterFill?: boolean;
558
563
  __isOverflow?: boolean;
559
564
  __blendLayer?: boolean;
560
- __useEffect?: boolean;
561
- __autoWidth: boolean;
562
- __autoHeight: boolean;
563
- __autoBounds: boolean;
564
- path?: IPathCommandData;
565
- windingRule?: IWindingRule;
566
- __pathForRender?: IPathCommandData;
567
- __path2DForRender?: IPath2D;
565
+ readonly __autoWidth: boolean;
566
+ readonly __autoHeight: boolean;
567
+ readonly __autoSide: boolean;
568
+ readonly __autoSize: boolean;
568
569
  __boxStroke?: boolean;
569
570
  __font?: string;
570
571
  __textDrawData?: ITextDrawData;
@@ -699,6 +700,11 @@ interface IUIBounds extends ILeafBounds {
699
700
 
700
701
  type IUIHitModule = ILeafHit & ThisType<IUI>;
701
702
 
703
+ interface IPathArrowModule {
704
+ list: IPathDataArrowMap;
705
+ addArrows(ui: IUI, changeRenderPath?: boolean): void;
706
+ }
707
+
702
708
  interface ITextConvertModule {
703
709
  getDrawData(content: string, style: ITextData): ITextDrawData;
704
710
  }
@@ -753,4 +759,4 @@ interface IEffectModule {
753
759
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
754
760
  }
755
761
 
756
- export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditorBase, IEditorConfig, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, 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, IPathData, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, 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, IUnitData, IVectorPath, IVerticalAlign };
762
+ export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditorBase, IEditorConfig, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, 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, 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, IUnitData, IVectorPath, IVerticalAlign };