@leafer-ui/interface 1.5.3 → 1.6.1

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.5.3",
3
+ "version": "1.6.1",
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.5.3"
25
+ "@leafer/interface": "1.6.1"
26
26
  }
27
27
  }
package/src/IUI.ts CHANGED
@@ -209,6 +209,12 @@ interface ITextAttrData {
209
209
  text?: string | number
210
210
  padding?: IFourNumber
211
211
  resizeFontSize?: boolean
212
+ boxStyle?: IBackgroundBoxStyle
213
+ textEditing?: boolean
214
+ }
215
+
216
+ export interface IBackgroundBoxStyle extends IRectInputData {
217
+
212
218
  }
213
219
 
214
220
  export interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
@@ -379,6 +385,7 @@ export interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICorne
379
385
 
380
386
  children?: IUI[]
381
387
 
388
+ __box?: IUI // 背景box, 一般用于文本背景框
382
389
  __animate?: IAnimate
383
390
 
384
391
  readonly pen: IPathCreator
@@ -464,6 +471,7 @@ export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
464
471
 
465
472
  readonly __strokeWidth: number
466
473
  readonly __hasStroke: boolean
474
+ readonly __hasHalf: number // 是否存在半逻辑像素渲染(奇数线宽的居中线条),可以半像素为起点绘制,防止模糊
467
475
 
468
476
 
469
477
  __pixelFill?: boolean // png / svg / webp
@@ -479,7 +487,6 @@ export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
479
487
  readonly __clipAfterFill?: boolean
480
488
  readonly __hasSurface?: boolean
481
489
 
482
- __isOverflow?: boolean
483
490
  __blendLayer?: boolean
484
491
 
485
492
  __boxStroke?: boolean // box闭合描边,可不用计算miterLimit造成的渲染包围盒变化
package/src/app/IApp.ts CHANGED
@@ -6,6 +6,7 @@ import { IEditorConfig } from '../editor/IEditor'
6
6
  export interface IApp extends ILeafer {
7
7
  children: ILeafer[]
8
8
  realCanvas: boolean
9
+ forEach(fn: IAppForEachFn): void
9
10
  }
10
11
 
11
12
  export interface IAppConfig extends ILeaferConfig {
@@ -13,4 +14,8 @@ export interface IAppConfig extends ILeaferConfig {
13
14
  tree?: ILeaferConfig
14
15
  sky?: ILeaferConfig
15
16
  editor?: IEditorConfig
17
+ }
18
+
19
+ export interface IAppForEachFn {
20
+ (value: ILeafer, index: number, array: ILeafer[]): void
16
21
  }
@@ -2,7 +2,8 @@ import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorTy
2
2
 
3
3
  export interface IEditorBase extends IGroup, ISelectorProxy {
4
4
  config: IEditorConfig
5
- readonly mergeConfig: IEditorConfig // 实际使用,合并了选中元素上的editConfig
5
+ readonly mergeConfig: IEditorConfig // 实际使用,合并了选中元素上的editConfig,频繁访问会消耗性能
6
+ readonly mergedConfig: IEditorConfig // 合并之后的缓存配置
6
7
 
7
8
  hoverTarget?: IUI
8
9
  target?: IUI | IUI[]
@@ -29,6 +30,7 @@ export interface IEditorBase extends IGroup, ISelectorProxy {
29
30
  editBox: IEditBoxBase
30
31
  editTool?: IObject
31
32
  innerEditor?: IObject
33
+ editMask: IUI
32
34
 
33
35
  select(target: IUI | IUI[]): void
34
36
  cancel(): void
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from '@leafer/interface'
2
2
 
3
- export { IApp, IAppConfig } from './app/IApp'
3
+ export { IApp, IAppConfig, IAppForEachFn } from './app/IApp'
4
4
  export { ILeafer } from './app/ILeafer'
5
5
 
6
6
  export {
@@ -12,7 +12,7 @@ export {
12
12
  IStar, IStarInputData, IStarData,
13
13
  IPath, IPathInputData, IPathData,
14
14
  IPen, IPenInputData, IPenData,
15
- IText, ITextInputData, ITextData, ITextRowData, ITextWordData, ITextCharData, ITextDrawData,
15
+ IText, ITextInputData, ITextData, ITextRowData, ITextWordData, ITextCharData, ITextDrawData, IBackgroundBoxStyle,
16
16
  IImage, IImageInputData, IImageData,
17
17
  ICanvas, ICanvasInputData, ICanvasData,
18
18
  IFrame, IFrameInputData, IFrameData,
@@ -6,6 +6,8 @@ export interface ITransitionModule {
6
6
  register(attrName: string, fn: ITransitionFunction): void
7
7
  get(attrName: string): ITransitionFunction
8
8
 
9
+ setBetweenStyle(betweenStyle: IObject, fromStyle: IObject, toStyle: IObject, bothStyle: IObject, t: number, target: any, attrs?: IObject): void
10
+
9
11
  value(from: any, to: any, t: number, target?: IObject): any
10
12
  number(from: number, to: number, t: number, roundValue?: number): number
11
13
  color(from: IColor, to: IColor, t: number): string
@@ -15,6 +15,7 @@ export interface ILeafPaint {
15
15
  loadId?: number
16
16
  patternId?: string
17
17
  patternTask?: ITaskItem
18
+ changeful?: boolean // 会频繁变化,不生成图案(有特殊性能优化,一般用于游戏精灵、动图场景)
18
19
  sync?: boolean // 同步显示图片,不走任务列表生成图案
19
20
  data?: ILeafPaintPatternData
20
21
  }
package/src/type/IType.ts CHANGED
@@ -78,7 +78,7 @@ export interface IImagePaint extends IPaintBase {
78
78
 
79
79
  repeat?: IRepeat
80
80
 
81
- changeful?: boolean // 会频繁变化 url(有特殊性能优化,一般用于游戏精灵、动图场景)
81
+ changeful?: boolean // 会频繁变化,不生成图案(有特殊性能优化,一般用于游戏精灵、动图场景)
82
82
  sync?: boolean // 同步显示,不走任务列表生成图案
83
83
  }
84
84
  export interface IImageFilters {
package/types/index.d.ts CHANGED
@@ -145,6 +145,7 @@ interface ILeafPaint {
145
145
  loadId?: number;
146
146
  patternId?: string;
147
147
  patternTask?: ITaskItem;
148
+ changeful?: boolean;
148
149
  sync?: boolean;
149
150
  data?: ILeafPaintPatternData;
150
151
  }
@@ -385,6 +386,7 @@ interface IAnimateList extends IAnimate {
385
386
  interface IEditorBase extends IGroup$1, ISelectorProxy {
386
387
  config: IEditorConfig;
387
388
  readonly mergeConfig: IEditorConfig;
389
+ readonly mergedConfig: IEditorConfig;
388
390
  hoverTarget?: IUI$1;
389
391
  target?: IUI$1 | IUI$1[];
390
392
  readonly list: IUI$1[];
@@ -404,6 +406,7 @@ interface IEditorBase extends IGroup$1, ISelectorProxy {
404
406
  editBox: IEditBoxBase;
405
407
  editTool?: IObject$1;
406
408
  innerEditor?: IObject$1;
409
+ editMask: IUI$1;
407
410
  select(target: IUI$1 | IUI$1[]): void;
408
411
  cancel(): void;
409
412
  hasItem(item: IUI$1): boolean;
@@ -725,6 +728,10 @@ interface ITextAttrData {
725
728
  text?: string | number;
726
729
  padding?: IFourNumber;
727
730
  resizeFontSize?: boolean;
731
+ boxStyle?: IBackgroundBoxStyle;
732
+ textEditing?: boolean;
733
+ }
734
+ interface IBackgroundBoxStyle extends IRectInputData {
728
735
  }
729
736
  interface ITextData extends ITextAttrData, ITextStyleComputedData, IUIData {
730
737
  __baseLine?: number;
@@ -864,6 +871,7 @@ interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadius
864
871
  animation?: IAnimation | IAnimation[];
865
872
  animationOut?: IAnimation | IAnimation[];
866
873
  children?: IUI[];
874
+ __box?: IUI;
867
875
  __animate?: IAnimate;
868
876
  readonly pen: IPathCreator;
869
877
  reset(data?: IUIInputData): void;
@@ -920,6 +928,7 @@ interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
920
928
  __isStrokes?: boolean;
921
929
  readonly __strokeWidth: number;
922
930
  readonly __hasStroke: boolean;
931
+ readonly __hasHalf: number;
923
932
  __pixelFill?: boolean;
924
933
  __pixelStroke?: boolean;
925
934
  __isHitPixel?: boolean;
@@ -929,7 +938,6 @@ interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
929
938
  __drawAfterFill?: boolean;
930
939
  readonly __clipAfterFill?: boolean;
931
940
  readonly __hasSurface?: boolean;
932
- __isOverflow?: boolean;
933
941
  __blendLayer?: boolean;
934
942
  __boxStroke?: boolean;
935
943
  __font?: string;
@@ -968,6 +976,7 @@ interface ILeafer extends IGroup, ILeaferAttrData, IControl {
968
976
  interface IApp extends ILeafer {
969
977
  children: ILeafer[];
970
978
  realCanvas: boolean;
979
+ forEach(fn: IAppForEachFn): void;
971
980
  }
972
981
  interface IAppConfig extends ILeaferConfig {
973
982
  ground?: ILeaferConfig;
@@ -975,6 +984,9 @@ interface IAppConfig extends ILeaferConfig {
975
984
  sky?: ILeaferConfig;
976
985
  editor?: IEditorConfig;
977
986
  }
987
+ interface IAppForEachFn {
988
+ (value: ILeafer, index: number, array: ILeafer[]): void;
989
+ }
978
990
 
979
991
  type IUIRenderModule = IUIRender & ThisType<IUI>;
980
992
  interface IUIRender extends ILeafRender {
@@ -1012,6 +1024,7 @@ interface ITransitionModule {
1012
1024
  list: ITransitionMap;
1013
1025
  register(attrName: string, fn: ITransitionFunction): void;
1014
1026
  get(attrName: string): ITransitionFunction;
1027
+ setBetweenStyle(betweenStyle: IObject, fromStyle: IObject, toStyle: IObject, bothStyle: IObject, t: number, target: any, attrs?: IObject): void;
1015
1028
  value(from: any, to: any, t: number, target?: IObject): any;
1016
1029
  number(from: number, to: number, t: number, roundValue?: number): number;
1017
1030
  color(from: IColor, to: IColor, t: number): string;
@@ -1116,4 +1129,4 @@ interface IFilterFunction {
1116
1129
  (filter: IFilter, ui: IUI, bounds: IMatrixWithBoundsScaleData, currentCanvas: ILeaferCanvas, originCanvas: ILeaferCanvas, shape: ICachedShape): void;
1117
1130
  }
1118
1131
 
1119
- export type { IAnimate, IAnimateKeyframe, IAnimateList, IAnimateType, IAnimation, IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, IComputedKeyframe, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorBase, IEditorBeforeMove, IEditorBeforeRotate, IEditorBeforeScale, IEditorBeforeSelect, IEditorBeforeSkew, IEditorConfig, IEditorConfigFunction, IEditorDragStartData, IEditorMoveData, IEditorRotationData, IEditorScaleData, IEditorSelectData, IEditorSkewData, IEffect, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFilterFunction, IFilterModule, IFilterProcessor, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFontWeightNumer, IFontWeightString, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGIF, IGIFData, IGIFInputData, IGradientPaint, IGradientType, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageFilters, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, IKeyframe, IKeyframeId, IKeyframesAnimation, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintBase, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPaintType, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathDataArrowOffset, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IRobot, IRobotActionName, IRobotActions, IRobotAnimation, IRobotComputedKeyframe, IRobotData, IRobotInputData, IRobotKeyframe, IShadowEffect, IShadowString, ISolidPaint, IStar, IStarData, IStarInputData, IStateModule, IStateName, IStateStyle, IStates, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IStyleAnimation, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDecorationData, ITextDecorationType, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, ITransitionFunction, ITransitionMap, ITransitionModule, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign, IVideo, IVideoData, IVideoInputData, IWritingMode };
1132
+ export type { IAnimate, IAnimateKeyframe, IAnimateList, IAnimateType, IAnimation, IApp, IAppConfig, IAppData, IAppForEachFn, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBackgroundBoxStyle, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, IComputedKeyframe, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorBase, IEditorBeforeMove, IEditorBeforeRotate, IEditorBeforeScale, IEditorBeforeSelect, IEditorBeforeSkew, IEditorConfig, IEditorConfigFunction, IEditorDragStartData, IEditorMoveData, IEditorRotationData, IEditorScaleData, IEditorSelectData, IEditorSkewData, IEffect, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFilterFunction, IFilterModule, IFilterProcessor, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFontWeightNumer, IFontWeightString, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGIF, IGIFData, IGIFInputData, IGradientPaint, IGradientType, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageFilters, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, IKeyframe, IKeyframeId, IKeyframesAnimation, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintBase, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPaintType, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathDataArrowOffset, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IRobot, IRobotActionName, IRobotActions, IRobotAnimation, IRobotComputedKeyframe, IRobotData, IRobotInputData, IRobotKeyframe, IShadowEffect, IShadowString, ISolidPaint, IStar, IStarData, IStarInputData, IStateModule, IStateName, IStateStyle, IStates, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IStyleAnimation, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDecorationData, ITextDecorationType, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, ITransitionFunction, ITransitionMap, ITransitionModule, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign, IVideo, IVideoData, IVideoInputData, IWritingMode };