@leafer-ui/interface 1.0.4 → 1.0.6

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.4",
3
+ "version": "1.0.6",
4
4
  "description": "@leafer-ui/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -13,15 +13,15 @@
13
13
  ],
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/leaferjs/ui.git"
16
+ "url": "https://github.com/leaferjs/leafer-ui.git"
17
17
  },
18
- "homepage": "https://github.com/leaferjs/ui/tree/main/packages/interface",
19
- "bugs": "https://github.com/leaferjs/ui/issues",
18
+ "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/interface",
19
+ "bugs": "https://github.com/leaferjs/leafer-ui/issues",
20
20
  "keywords": [
21
21
  "leafer-ui",
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/interface": "1.0.4"
25
+ "@leafer/interface": "1.0.6"
26
26
  }
27
27
  }
@@ -99,6 +99,7 @@ export interface ITextStyleAttrData {
99
99
 
100
100
  textAlign?: ITextAlign
101
101
  verticalAlign?: IVerticalAlign
102
+ autoSizeAlign?: IBoolean
102
103
 
103
104
  textWrap?: ITextWrap
104
105
  textOverflow?: IOverflow | string
@@ -118,6 +119,7 @@ export interface ITextStyleInputData {
118
119
 
119
120
  textAlign?: ITextAlign
120
121
  verticalAlign?: IVerticalAlign
122
+ autoSizeAlign?: IBoolean
121
123
 
122
124
  textWrap?: ITextWrap
123
125
  textOverflow?: IOverflow | string
@@ -137,6 +139,7 @@ export interface ITextStyleComputedData {
137
139
 
138
140
  textAlign?: ITextAlign
139
141
  verticalAlign?: IVerticalAlign
142
+ autoSizeAlign?: boolean // 自动宽高的文本,是否仍进行整体对齐操作
140
143
 
141
144
  textWrap?: ITextWrap
142
145
  textOverflow?: IOverflow | string
package/src/IUI.ts CHANGED
@@ -20,7 +20,7 @@ export interface ILine extends ILineAttrData, IUI {
20
20
 
21
21
  interface ILineAttrData {
22
22
  toPoint?: IPointData
23
- points?: number[]
23
+ points?: number[] | IPointData[]
24
24
  curve?: boolean | number
25
25
  }
26
26
  export interface ILineData extends ILineAttrData, IUIData { }
@@ -159,7 +159,7 @@ export interface IPolygon extends IPolygonAttrData, IUI {
159
159
  }
160
160
  interface IPolygonAttrData {
161
161
  sides?: number
162
- points?: number[]
162
+ points?: number[] | IPointData[]
163
163
  curve?: boolean | number
164
164
  }
165
165
  export interface IPolygonData extends IPolygonAttrData, IUIData { }
@@ -262,6 +262,7 @@ export interface ITextDrawData {
262
262
  rows: ITextRowData[]
263
263
  paraNumber: number
264
264
  font: string
265
+ maxWidth?: number // 获取最大的行宽,自动宽度 且非 autoSizeAlign 时才有值
265
266
  decorationY?: number
266
267
  decorationHeight?: number
267
268
  overflow?: number // overflowed row number, not index
@@ -334,6 +335,7 @@ export interface IBox extends IBoxAttrData, IGroup {
334
335
  interface IBoxAttrData {
335
336
  overflow?: IOverflow
336
337
  resizeChildren?: IBoolean
338
+ textBox?: IBoolean // 编辑器中,textBox双击会直接进入编辑文本状态,如便利贴文本
337
339
  }
338
340
  export interface IBoxData extends IBoxAttrData, IGroupData { }
339
341
  export interface IBoxInputData extends IBoxAttrData, IGroupInputData { }
@@ -344,12 +346,12 @@ export interface IGroup extends IUI {
344
346
  __: IGroupData
345
347
  children: IUI[]
346
348
  pick(hitPoint: IPointData, options?: IPickOptions): IPickResult
347
- add(child: IUI, index?: number): void
348
- addAt(child: IUI, index: number): void
349
- addAfter(child: IUI, after: IUI): void
350
- addBefore(child: IUI, before: IUI): void
351
- addMany(...children: ILeaf[]): void
352
- remove(child?: IUI): void
349
+ add(child: IUI | IUI[] | IUIInputData | IUIInputData[], index?: number): void
350
+ addAt(child: IUI | IUI[] | IUIInputData | IUIInputData[], index: number): void
351
+ addAfter(child: IUI | IUI[] | IUIInputData | IUIInputData[], after: IUI): void
352
+ addBefore(child: IUI | IUI[] | IUIInputData | IUIInputData[], before: IUI): void
353
+ addMany(...children: ILeaf[] | IUIInputData[]): void
354
+ remove(child?: IUI | number | string | IFindCondition | IFindUIMethod): void
353
355
  removeAll(): void
354
356
  clear(): void
355
357
  }
@@ -365,6 +367,7 @@ export interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICorne
365
367
  parent?: IGroup
366
368
  zoomLayer?: IGroup
367
369
  readonly isFrame?: boolean
370
+ isOverflow?: boolean
368
371
 
369
372
  proxyData?: IUIInputData
370
373
  __proxyData?: IUIInputData
@@ -403,6 +406,7 @@ export interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICorne
403
406
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void
404
407
  __drawPathByBox(drawer: IPathDrawer): void
405
408
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
409
+ __drawContent?(canvas: ILeaferCanvas, options: IRenderOptions): void
406
410
 
407
411
  animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation, options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate
408
412
  killAnimate(type?: IAnimateType): void
@@ -455,6 +459,8 @@ export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
455
459
  __isStrokes?: boolean
456
460
 
457
461
  readonly __strokeWidth: number
462
+ readonly __hasStroke: boolean
463
+
458
464
 
459
465
  __pixelFill?: boolean // png / svg / webp
460
466
  __pixelStroke?: boolean
@@ -466,16 +472,18 @@ export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
466
472
  __opacityStroke?: boolean
467
473
 
468
474
  __drawAfterFill?: boolean
475
+ readonly __clipAfterFill?: boolean
476
+
469
477
  __isOverflow?: boolean
470
478
  __blendLayer?: boolean
471
479
 
472
- __boxStroke?: boolean
480
+ __boxStroke?: boolean // box闭合描边,可不用计算miterLimit造成的渲染包围盒变化
473
481
 
474
482
  // text
475
483
  __font?: string
476
484
  __textDrawData?: ITextDrawData
477
485
 
478
- __needComputePaint: boolean
486
+ __needComputePaint?: boolean
479
487
  __computePaint(): void
480
488
  }
481
489
  export interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
@@ -20,6 +20,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
20
20
  readonly single: boolean
21
21
 
22
22
  readonly dragging: boolean
23
+ readonly moving: boolean
23
24
 
24
25
  element?: IUI
25
26
  buttons: IGroup
@@ -53,7 +54,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
53
54
  openGroup(group: IGroup): void
54
55
  closeGroup(group: IGroup): void
55
56
 
56
- openInnerEditor(target?: IUI): void
57
+ openInnerEditor(target?: IUI, select?: boolean): void
57
58
  closeInnerEditor(): void
58
59
 
59
60
  lock(): void
@@ -6,6 +6,7 @@ export type IUIRenderModule = IUIRender & ThisType<IUI>
6
6
 
7
7
  export interface IUIRender extends ILeafRender {
8
8
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void
9
+ __drawContent?(canvas: ILeaferCanvas, options: IRenderOptions): void
9
10
  }
10
11
 
11
12
  export type IRectRenderModule = IRectRender & ThisType<IRect>
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IObject, IEventer, IEventMap, IPercentData, IBoundsData as IBoundsData$1, IPathCreator, ILeaferCanvas, ICanvasContext2D, ICanvasContext2DSettings, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IJSONOptions, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
1
+ import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IObject, IEventer, IEventMap, IPercentData, IBoundsData as IBoundsData$1, IPathCreator, ILeaferCanvas, ICanvasContext2D, ICanvasContext2DSettings, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IFindCondition, IJSONOptions, IValue, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
3
  import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject as IObject$1, 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, IColorString as IColorString$1, IDirection4, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent, IStateName as IStateName$1, IString as IString$1, IBoolean as IBoolean$1, IStateStyle as IStateStyle$1 } from '@leafer-ui/interface';
4
4
 
@@ -246,6 +246,7 @@ interface ITextStyleAttrData {
246
246
  paraSpacing?: INumber;
247
247
  textAlign?: ITextAlign;
248
248
  verticalAlign?: IVerticalAlign;
249
+ autoSizeAlign?: IBoolean;
249
250
  textWrap?: ITextWrap;
250
251
  textOverflow?: IOverflow | string;
251
252
  }
@@ -262,6 +263,7 @@ interface ITextStyleInputData {
262
263
  paraSpacing?: INumber;
263
264
  textAlign?: ITextAlign;
264
265
  verticalAlign?: IVerticalAlign;
266
+ autoSizeAlign?: IBoolean;
265
267
  textWrap?: ITextWrap;
266
268
  textOverflow?: IOverflow | string;
267
269
  }
@@ -278,6 +280,7 @@ interface ITextStyleComputedData {
278
280
  paraSpacing?: number;
279
281
  textAlign?: ITextAlign;
280
282
  verticalAlign?: IVerticalAlign;
283
+ autoSizeAlign?: boolean;
281
284
  textWrap?: ITextWrap;
282
285
  textOverflow?: IOverflow | string;
283
286
  }
@@ -417,6 +420,7 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
417
420
  readonly multiple: boolean;
418
421
  readonly single: boolean;
419
422
  readonly dragging: boolean;
423
+ readonly moving: boolean;
420
424
  element?: IUI$1;
421
425
  buttons: IGroup$1;
422
426
  selector: IGroup$1;
@@ -441,7 +445,7 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
441
445
  ungroup(): IUI$1[];
442
446
  openGroup(group: IGroup$1): void;
443
447
  closeGroup(group: IGroup$1): void;
444
- openInnerEditor(target?: IUI$1): void;
448
+ openInnerEditor(target?: IUI$1, select?: boolean): void;
445
449
  closeInnerEditor(): void;
446
450
  lock(): void;
447
451
  unlock(): void;
@@ -536,7 +540,7 @@ interface ILine extends ILineAttrData, IUI {
536
540
  }
537
541
  interface ILineAttrData {
538
542
  toPoint?: IPointData;
539
- points?: number[];
543
+ points?: number[] | IPointData[];
540
544
  curve?: boolean | number;
541
545
  }
542
546
  interface ILineData extends ILineAttrData, IUIData {
@@ -649,7 +653,7 @@ interface IPolygon extends IPolygonAttrData, IUI {
649
653
  }
650
654
  interface IPolygonAttrData {
651
655
  sides?: number;
652
- points?: number[];
656
+ points?: number[] | IPointData[];
653
657
  curve?: boolean | number;
654
658
  }
655
659
  interface IPolygonData extends IPolygonAttrData, IUIData {
@@ -737,6 +741,7 @@ interface ITextDrawData {
737
741
  rows: ITextRowData[];
738
742
  paraNumber: number;
739
743
  font: string;
744
+ maxWidth?: number;
740
745
  decorationY?: number;
741
746
  decorationHeight?: number;
742
747
  overflow?: number;
@@ -792,6 +797,7 @@ interface IBox extends IBoxAttrData, IGroup {
792
797
  interface IBoxAttrData {
793
798
  overflow?: IOverflow;
794
799
  resizeChildren?: IBoolean;
800
+ textBox?: IBoolean;
795
801
  }
796
802
  interface IBoxData extends IBoxAttrData, IGroupData {
797
803
  }
@@ -801,12 +807,12 @@ interface IGroup extends IUI {
801
807
  __: IGroupData;
802
808
  children: IUI[];
803
809
  pick(hitPoint: IPointData, options?: IPickOptions): IPickResult;
804
- add(child: IUI, index?: number): void;
805
- addAt(child: IUI, index: number): void;
806
- addAfter(child: IUI, after: IUI): void;
807
- addBefore(child: IUI, before: IUI): void;
808
- addMany(...children: ILeaf$1[]): void;
809
- remove(child?: IUI): void;
810
+ add(child: IUI | IUI[] | IUIInputData | IUIInputData[], index?: number): void;
811
+ addAt(child: IUI | IUI[] | IUIInputData | IUIInputData[], index: number): void;
812
+ addAfter(child: IUI | IUI[] | IUIInputData | IUIInputData[], after: IUI): void;
813
+ addBefore(child: IUI | IUI[] | IUIInputData | IUIInputData[], before: IUI): void;
814
+ addMany(...children: ILeaf$1[] | IUIInputData[]): void;
815
+ remove(child?: IUI | number | string | IFindCondition | IFindUIMethod): void;
810
816
  removeAll(): void;
811
817
  clear(): void;
812
818
  }
@@ -821,6 +827,7 @@ interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadius
821
827
  parent?: IGroup;
822
828
  zoomLayer?: IGroup;
823
829
  readonly isFrame?: boolean;
830
+ isOverflow?: boolean;
824
831
  proxyData?: IUIInputData;
825
832
  __proxyData?: IUIInputData;
826
833
  animation?: IAnimation;
@@ -846,6 +853,7 @@ interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadius
846
853
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
847
854
  __drawPathByBox(drawer: IPathDrawer): void;
848
855
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
856
+ __drawContent?(canvas: ILeaferCanvas, options: IRenderOptions): void;
849
857
  animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation, options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate;
850
858
  killAnimate(type?: IAnimateType): void;
851
859
  export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
@@ -878,6 +886,7 @@ interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
878
886
  __isFills?: boolean;
879
887
  __isStrokes?: boolean;
880
888
  readonly __strokeWidth: number;
889
+ readonly __hasStroke: boolean;
881
890
  __pixelFill?: boolean;
882
891
  __pixelStroke?: boolean;
883
892
  __isHitPixel?: boolean;
@@ -885,12 +894,13 @@ interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
885
894
  __opacityFill?: boolean;
886
895
  __opacityStroke?: boolean;
887
896
  __drawAfterFill?: boolean;
897
+ readonly __clipAfterFill?: boolean;
888
898
  __isOverflow?: boolean;
889
899
  __blendLayer?: boolean;
890
900
  __boxStroke?: boolean;
891
901
  __font?: string;
892
902
  __textDrawData?: ITextDrawData;
893
- __needComputePaint: boolean;
903
+ __needComputePaint?: boolean;
894
904
  __computePaint(): void;
895
905
  }
896
906
  interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
@@ -935,6 +945,7 @@ interface IAppConfig extends ILeaferConfig {
935
945
  type IUIRenderModule = IUIRender & ThisType<IUI>;
936
946
  interface IUIRender extends ILeafRender {
937
947
  __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
948
+ __drawContent?(canvas: ILeaferCanvas, options: IRenderOptions): void;
938
949
  }
939
950
  type IRectRenderModule = IRectRender & ThisType<IRect>;
940
951
  interface IRectRender extends IUIRender {