@leafer-ui/display 1.8.0 → 1.9.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/display",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "@leafer-ui/display",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,14 +22,14 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.8.0",
26
- "@leafer-ui/data": "1.8.0",
27
- "@leafer-ui/display-module": "1.8.0",
28
- "@leafer-ui/decorator": "1.8.0",
29
- "@leafer-ui/external": "1.8.0"
25
+ "@leafer/core": "1.9.1",
26
+ "@leafer-ui/data": "1.9.1",
27
+ "@leafer-ui/display-module": "1.9.1",
28
+ "@leafer-ui/decorator": "1.9.1",
29
+ "@leafer-ui/external": "1.9.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.8.0",
33
- "@leafer-ui/interface": "1.8.0"
32
+ "@leafer/interface": "1.9.1",
33
+ "@leafer-ui/interface": "1.9.1"
34
34
  }
35
35
  }
package/src/Canvas.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, ICanvasContext2DSettings, IScreenSizeData } from '@leafer/interface'
2
- import { Creator, ImageEvent, LeaferImage, Matrix, dataProcessor, dataType, registerUI } from '@leafer/core'
2
+ import { Creator, ImageEvent, LeaferImage, Matrix, dataProcessor, dataType, registerUI, isNumber } from '@leafer/core'
3
3
 
4
4
  import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
5
5
  import { CanvasData } from '@leafer-ui/data'
@@ -62,7 +62,7 @@ export class Canvas extends Rect implements ICanvas {
62
62
 
63
63
  const m = new Matrix()
64
64
  if (offset) m.translate(offset.x, offset.y)
65
- if (scale) typeof scale === 'number' ? m.scale(scale) : m.scale(scale.x, scale.y)
65
+ if (scale) isNumber(scale) ? m.scale(scale) : m.scale(scale.x, scale.y)
66
66
  if (rotation) m.rotate(rotation)
67
67
  matrix.multiplyParent(m)
68
68
 
package/src/Image.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ILeaferImage, IString } from '@leafer/interface'
2
- import { boundsType, dataProcessor, registerUI } from '@leafer/core'
2
+ import { boundsType, dataProcessor, registerUI, isArray } from '@leafer/core'
3
3
 
4
4
  import { IImage, IImageInputData, IImageData } from '@leafer-ui/interface'
5
5
  import { ImageData } from '@leafer-ui/data'
@@ -20,7 +20,7 @@ export class Image extends Rect implements IImage {
20
20
 
21
21
  public get ready(): boolean { const { image } = this; return image && image.ready }
22
22
 
23
- public get image(): ILeaferImage { const { fill } = this.__; return fill instanceof Array && fill[0].image }
23
+ public get image(): ILeaferImage { const { fill } = this.__; return isArray(fill) && fill[0].image }
24
24
 
25
25
  constructor(data?: IImageInputData) {
26
26
  super(data)
package/src/Text.ts CHANGED
@@ -115,7 +115,7 @@ export class Text extends UI implements IText {
115
115
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize)
116
116
  data.__padding = padding ? MathHelper.fourNumber(padding) : undefined
117
117
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2 // 基线位置
118
- data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`
118
+ data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize || 12}px ${fontFamily || 'caption'}`
119
119
  data.__clipText = textOverflow !== 'show' && !data.__autoSize
120
120
 
121
121
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__)
package/src/UI.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter, ILeaferImage } from '@leafer/interface'
2
- import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType, MathHelper, Plugin, DataHelper, affectRenderBoundsType } from '@leafer/core'
1
+ import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter, ILeaferImage, IScaleFixed } from '@leafer/interface'
2
+ import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType, MathHelper, Plugin, DataHelper, affectRenderBoundsType, isString, isNumber } from '@leafer/core'
3
3
 
4
4
  import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowType, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString, IAnimateList } from '@leafer-ui/interface'
5
5
  import { effectType, zoomLayerType } from '@leafer-ui/decorator'
@@ -249,7 +249,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
249
249
  public strokeWidth?: IFourNumber | IStrokeWidthString
250
250
 
251
251
  @strokeType(false)
252
- public strokeWidthFixed?: IBoolean
252
+ public strokeWidthFixed?: IScaleFixed
253
253
 
254
254
  @strokeType('none')
255
255
  public strokeCap?: IStrokeCap
@@ -420,7 +420,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
420
420
  }
421
421
 
422
422
  public get(name?: string | string[] | IUIInputData): IUIInputData | IValue {
423
- return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name)
423
+ return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name)
424
424
  }
425
425
 
426
426
  public createProxyData(): IUIInputData { return undefined }
@@ -488,7 +488,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
488
488
  const { x, y, width, height } = this.__layout.boxBounds
489
489
  if (this.__.cornerRadius) {
490
490
  const { cornerRadius } = this.__
491
- drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius) // 修复微信浏览器bug, 后续需进一步优化
491
+ drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [cornerRadius] : cornerRadius) // 修复微信浏览器bug, 后续需进一步优化
492
492
  } else drawer.rect(x, y, width, height)
493
493
  }
494
494
 
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IZoomOptions, IClientPointData, IRenderOptions, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
1
+ import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IScaleFixed, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IZoomOptions, IClientPointData, IRenderOptions, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
2
2
  import { Leaf, LeafList } from '@leafer/core';
3
3
  import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IEditorConfig, IAnimate, IAnimateList, IFindUIMethod, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, IUIJSONData, IFindCondition as IFindCondition$1, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBox, IBoxData, IOverflow, IBoxInputData, IFrame, IFrameData, IFrameInputData, IRect, IRectData, IRectInputData, IEllipse, IEllipseData, IEllipseInputData, IPolygon, IPolygonData, IPolygonInputData, IStar, IStarData, IStarInputData, ILine, ILineData, ILineInputData, IImage, IImageData, IImageInputData, ICanvas, ICanvasData, ICanvasInputData, IText, ITextData, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData, IPointData as IPointData$1 } from '@leafer-ui/interface';
4
4
 
@@ -73,7 +73,7 @@ declare class UI extends Leaf implements IUI {
73
73
  stroke?: IStroke;
74
74
  strokeAlign?: IStrokeAlign;
75
75
  strokeWidth?: IFourNumber | IStrokeWidthString;
76
- strokeWidthFixed?: IBoolean;
76
+ strokeWidthFixed?: IScaleFixed;
77
77
  strokeCap?: IStrokeCap;
78
78
  strokeJoin?: IStrokeJoin;
79
79
  dashPattern?: INumber[] | IDashPatternString;