@leafer-ui/interface 1.9.5 → 1.9.7

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.5",
3
+ "version": "1.9.7",
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.5"
25
+ "@leafer/interface": "1.9.7"
26
26
  }
27
27
  }
@@ -1,12 +1,13 @@
1
- import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAlign, IUnitPointData, IDragEvent, IMoveEvent, IRotateEvent, IStroke, IFill, ILeaf, ILeafList, IObject, IBoxInputData, IGroupInputData, IImageCursor, IRect, IKeyEvent, IUIInputData, IZoomEvent, IColorString, IDirection4, IPointData, IScaleData, ISkewData, ILayoutBoundsData, ITransition, IFourNumber, IShortcutKeys, IShortcutKeysCheck, IUIEvent, ILeafer } from '@leafer-ui/interface'
1
+ import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAlign, IUnitPointData, IDragEvent, IMoveEvent, IRotateEvent, IStroke, IFill, ILeaf, ILeafList, IObject, IBoxInputData, IGroupInputData, IImageCursor, IKeyEvent, IUIInputData, IZoomEvent, IColorString, IDirection4, IPointData, IScaleData, ISkewData, ILayoutBoundsData, ITransition, IFourNumber, IShortcutKeys, IShortcutKeysCheck, IUIEvent, ILeafer } from '@leafer-ui/interface'
2
2
 
3
3
  export interface IEditorBase extends IGroup, ISelectorProxy, ITransformTool {
4
4
  config: IEditorConfig
5
5
  readonly mergeConfig: IEditorConfig // 实际使用,合并了选中元素、默认editBox上的editConfig,频繁访问会消耗性能
6
6
  readonly mergedConfig: IEditorConfig // 合并之后的缓存配置
7
7
 
8
- hoverTarget?: IUI
9
8
  target?: IUI | IUI[]
9
+ hoverTarget?: IUI
10
+ dimTarget?: IGroup | IGroup[] // 需要淡化的容器
10
11
 
11
12
  readonly list: IUI[]
12
13
  leafList: ILeafList
@@ -48,6 +49,9 @@ export interface IEditorBase extends IGroup, ISelectorProxy, ITransformTool {
48
49
  addItem(item: IUI): void
49
50
  removeItem(item: IUI): void
50
51
 
52
+ setDimOthers(value: boolean | number): void
53
+ setBright(value: boolean): void
54
+
51
55
  update(): void
52
56
  updateEditBox(): void
53
57
  updateEditTool(): void
@@ -101,10 +105,14 @@ export interface IEditorConfig extends IObject {
101
105
 
102
106
  point?: IEditPointInputData | IEditPointInputData[]
103
107
  middlePoint?: IEditPointInputData | IEditPointInputData[]
108
+ resizeLine?: IEditPointInputData
104
109
 
105
110
  rect?: IBoxInputData
106
111
  area?: IRectInputData
112
+
107
113
  mask?: boolean | IColorString
114
+ dimOthers?: boolean | number // 是否弱化其他内容,突出显示选中元素
115
+ bright?: boolean // 仅突出显示选中元素
108
116
 
109
117
  circle?: IEditPointInputData
110
118
  circleDirection?: IDirection4
@@ -236,7 +244,7 @@ export interface IEditPoint extends IBox {
236
244
  pointType: IEditPointType
237
245
  }
238
246
 
239
- export type IEditPointType = 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button'
247
+ export type IEditPointType = 'move' | 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button'
240
248
 
241
249
  export interface IEditBoxBase extends IGroup {
242
250
 
@@ -253,7 +261,7 @@ export interface IEditBoxBase extends IGroup {
253
261
  view: IGroup // 放置默认编辑工具控制点
254
262
 
255
263
  circle: IEditPoint
256
- rect: IRect
264
+ rect: IEditPoint
257
265
 
258
266
  buttons: IGroup
259
267
 
@@ -1,7 +1,8 @@
1
- import { ILeaferCanvas } from '@leafer/interface'
1
+ import { ILeaferCanvas, IBoundsData } from '@leafer/interface'
2
2
 
3
3
  import { IUI } from '../IUI'
4
4
  import { ICachedShape } from '../ICachedShape'
5
+ import { ILeafShadowEffect } from '../type/IComputedType'
5
6
 
6
7
 
7
8
  export interface IEffectModule {
@@ -9,4 +10,9 @@ export interface IEffectModule {
9
10
  innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void
10
11
  blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void
11
12
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void
13
+
14
+ // shadow
15
+ getShadowSpread(ui: IUI, shadow: ILeafShadowEffect[]): number
16
+ isTransformShadow(shadow: ILeafShadowEffect): boolean
17
+ renderTransformShadow?(ui: IUI, current: ILeaferCanvas, fromCanvas: ILeaferCanvas, fromWorld: IBoundsData, shadow: ILeafShadowEffect): void
12
18
  }
@@ -1,4 +1,4 @@
1
- import { IBlendMode, ILeaferImage, IMatrixData, IPointData, IScaleFixed, ITaskItem } from '@leafer/interface'
1
+ import { IBlendMode, IDirection, ILeaferImage, IMatrixData, IPointData, IScaleFixed, ITaskItem } from '@leafer/interface'
2
2
 
3
3
  import { IColorString } from './IStringType'
4
4
  import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode, IImageFilters } from './IType'
@@ -59,6 +59,9 @@ export interface ILeafShadowEffect {
59
59
  box?: boolean
60
60
  scaleFixed?: IScaleFixed
61
61
 
62
- skew?: IPointData // 倾斜阴影
63
- rotation?: number // 旋转阴影
62
+ // 斜切、旋转阴影
63
+ skewX?: number
64
+ skewY?: number
65
+ rotation?: number
66
+ origin?: IDirection // 斜切、旋转原点方位,相对元素的box包围盒,默认为 bottom
64
67
  }
package/src/type/IType.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, IFourNumber, IAlign, IUnitPointData, IAxis, IAxisReverse, IFilter, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed } from '@leafer/interface'
1
+ import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, IFourNumber, IAlign, IUnitPointData, IAxis, IAxisReverse, IFilter, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed, IDirection } from '@leafer/interface'
2
2
  import { IColorString, IPaintString } from './IStringType'
3
3
  import { IStrokeStyle } from '../ICommonAttr'
4
4
 
@@ -167,6 +167,7 @@ export type ITextDecorationType = 'none' | 'under' | 'delete' | 'under-delete'
167
167
  export interface ITextDecorationData {
168
168
  type: ITextDecorationType
169
169
  color: IColor
170
+ offset?: number
170
171
  }
171
172
 
172
173
  export type ITextWrap = 'normal' | 'none' | 'break'
@@ -190,8 +191,11 @@ export interface IShadowEffect {
190
191
  box?: boolean
191
192
  scaleFixed?: IScaleFixed
192
193
 
193
- skew?: IPointData // 倾斜阴影
194
- rotation?: number // 旋转阴影
194
+ // 斜切、旋转阴影
195
+ skewX?: number
196
+ skewY?: number
197
+ rotation?: number
198
+ origin?: IDirection // 斜切、旋转原点方位,相对元素的box包围盒,默认为 bottom
195
199
  }
196
200
 
197
201
  export interface IBlurEffect {
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed, IPathCommandData, IAxis, IAxisReverse, 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, IBooleanMap, IMatrixWithBoundsScaleData } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
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, IRect as IRect$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';
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
 
5
5
  type IPercent = string;
6
6
  type IColorString = string;
@@ -126,6 +126,7 @@ type ITextDecorationType = 'none' | 'under' | 'delete' | 'under-delete';
126
126
  interface ITextDecorationData {
127
127
  type: ITextDecorationType;
128
128
  color: IColor;
129
+ offset?: number;
129
130
  }
130
131
  type ITextWrap = 'normal' | 'none' | 'break';
131
132
  type IWritingMode = IAxis | IAxisReverse;
@@ -143,8 +144,10 @@ interface IShadowEffect {
143
144
  visible?: boolean;
144
145
  box?: boolean;
145
146
  scaleFixed?: IScaleFixed;
146
- skew?: IPointData;
147
+ skewX?: number;
148
+ skewY?: number;
147
149
  rotation?: number;
150
+ origin?: IDirection;
148
151
  }
149
152
  interface IBlurEffect {
150
153
  blur: number;
@@ -207,8 +210,10 @@ interface ILeafShadowEffect {
207
210
  blendMode?: IBlendMode;
208
211
  box?: boolean;
209
212
  scaleFixed?: IScaleFixed;
210
- skew?: IPointData;
213
+ skewX?: number;
214
+ skewY?: number;
211
215
  rotation?: number;
216
+ origin?: IDirection;
212
217
  }
213
218
 
214
219
  interface ICornerRadiusAttrData {
@@ -417,8 +422,9 @@ interface IEditorBase extends IGroup$1, ISelectorProxy, ITransformTool {
417
422
  config: IEditorConfig;
418
423
  readonly mergeConfig: IEditorConfig;
419
424
  readonly mergedConfig: IEditorConfig;
420
- hoverTarget?: IUI$1;
421
425
  target?: IUI$1 | IUI$1[];
426
+ hoverTarget?: IUI$1;
427
+ dimTarget?: IGroup$1 | IGroup$1[];
422
428
  readonly list: IUI$1[];
423
429
  leafList: ILeafList;
424
430
  openedGroupList: ILeafList;
@@ -448,6 +454,8 @@ interface IEditorBase extends IGroup$1, ISelectorProxy, ITransformTool {
448
454
  shiftItem(item: IUI$1): void;
449
455
  addItem(item: IUI$1): void;
450
456
  removeItem(item: IUI$1): void;
457
+ setDimOthers(value: boolean | number): void;
458
+ setBright(value: boolean): void;
451
459
  update(): void;
452
460
  updateEditBox(): void;
453
461
  updateEditTool(): void;
@@ -487,9 +495,12 @@ interface IEditorConfig extends IObject$1 {
487
495
  pointRadius?: number;
488
496
  point?: IEditPointInputData | IEditPointInputData[];
489
497
  middlePoint?: IEditPointInputData | IEditPointInputData[];
498
+ resizeLine?: IEditPointInputData;
490
499
  rect?: IBoxInputData$1;
491
500
  area?: IRectInputData$1;
492
501
  mask?: boolean | IColorString$1;
502
+ dimOthers?: boolean | number;
503
+ bright?: boolean;
493
504
  circle?: IEditPointInputData;
494
505
  circleDirection?: IDirection4;
495
506
  circleMargin?: number;
@@ -591,7 +602,7 @@ interface IEditPoint extends IBox$1 {
591
602
  direction: number;
592
603
  pointType: IEditPointType;
593
604
  }
594
- type IEditPointType = 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button';
605
+ type IEditPointType = 'move' | 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button';
595
606
  interface IEditBoxBase extends IGroup$1 {
596
607
  editor: IEditorBase;
597
608
  dragging: boolean;
@@ -602,7 +613,7 @@ interface IEditBoxBase extends IGroup$1 {
602
613
  skewing: boolean;
603
614
  view: IGroup$1;
604
615
  circle: IEditPoint;
605
- rect: IRect$1;
616
+ rect: IEditPoint;
606
617
  buttons: IGroup$1;
607
618
  resizePoints: IEditPoint[];
608
619
  rotatePoints: IEditPoint[];
@@ -1241,6 +1252,9 @@ interface IEffectModule {
1241
1252
  innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
1242
1253
  blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void;
1243
1254
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
1255
+ getShadowSpread(ui: IUI, shadow: ILeafShadowEffect[]): number;
1256
+ isTransformShadow(shadow: ILeafShadowEffect): boolean;
1257
+ renderTransformShadow?(ui: IUI, current: ILeaferCanvas, fromCanvas: ILeaferCanvas, fromWorld: IBoundsData, shadow: ILeafShadowEffect): void;
1244
1258
  }
1245
1259
 
1246
1260
  interface IFilterModule {