@leafer-ui/display 1.0.9 → 1.1.0

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.0.9",
3
+ "version": "1.1.0",
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.0.9",
26
- "@leafer-ui/data": "1.0.9",
27
- "@leafer-ui/display-module": "1.0.9",
28
- "@leafer-ui/decorator": "1.0.9",
29
- "@leafer-ui/external": "1.0.9"
25
+ "@leafer/core": "1.1.0",
26
+ "@leafer-ui/data": "1.1.0",
27
+ "@leafer-ui/display-module": "1.1.0",
28
+ "@leafer-ui/decorator": "1.1.0",
29
+ "@leafer-ui/external": "1.1.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.0.9",
33
- "@leafer-ui/interface": "1.0.9"
32
+ "@leafer/interface": "1.1.0",
33
+ "@leafer-ui/interface": "1.1.0"
34
34
  }
35
35
  }
package/src/Box.ts CHANGED
@@ -26,7 +26,7 @@ export class Box extends Group implements IBox {
26
26
  @dataType(false)
27
27
  public resizeChildren?: IBoolean
28
28
 
29
- @dataType(false)
29
+ // @leafer-in/editor rewrite
30
30
  public textBox?: IBoolean
31
31
 
32
32
  @affectRenderBoundsType('show')
package/src/Group.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IJSONOptions, IPickOptions, IPickResult, IPointData } from '@leafer/interface'
2
2
  import { Branch, useModule, dataProcessor, registerUI } from '@leafer/core'
3
3
 
4
- import { IGroup, IGroupData, IGroupInputData, IUI, IUIInputData, IUIJSONData, IFindCondition, IFindUIMethod } from '@leafer-ui/interface'
4
+ import { IGroup, IGroupData, IGroupInputData, IUI, IUIInputData, IUIJSONData, ITransition, IFindCondition, IFindUIMethod } from '@leafer-ui/interface'
5
5
  import { GroupData } from '@leafer-ui/data'
6
6
 
7
7
  import { UI } from './UI'
@@ -36,19 +36,19 @@ export class Group extends UI implements IGroup { // tip: rewrited Box
36
36
 
37
37
  // data
38
38
 
39
- public set(data: IUIInputData, isTemp?: boolean): void {
39
+ public set(data: IUIInputData, transition?: ITransition | 'temp'): void {
40
40
  if (data.children) {
41
41
  const { children } = data
42
42
 
43
43
  delete data.children
44
44
  this.children ? this.clear() : this.__setBranch()
45
45
 
46
- super.set(data, isTemp)
46
+ super.set(data, transition)
47
47
 
48
48
  children.forEach(child => this.add(child))
49
49
  data.children = children
50
50
 
51
- } else super.set(data, isTemp)
51
+ } else super.set(data, transition)
52
52
  }
53
53
 
54
54
  public toJSON(options?: IJSONOptions): IUIJSONData {
package/src/Leafer.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher, IInteraction, ILeaferConfig, ICanvasManager, IHitCanvasManager, IAutoBounds, IScreenSizeData, IResizeEvent, IEventListenerId, ITimer, IValue, IObject, IControl, IPointData, ILeaferType, ICursorType, IBoundsData, INumber, IZoomType, IFourNumber, IBounds, IClientPointData } from '@leafer/interface'
2
2
  import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds, LeafList, needPlugin } from '@leafer/core'
3
3
 
4
- import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
4
+ import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ITransition, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
5
5
  import { LeaferData } from '@leafer-ui/data'
6
6
 
7
7
  import { Group } from './Group'
@@ -159,8 +159,8 @@ export class Leafer extends Group implements ILeafer {
159
159
 
160
160
  public initType(_type: ILeaferType): void { } // rewrite in @leafer-ui/type
161
161
 
162
- public set(data: IUIInputData): void {
163
- this.waitInit(() => { super.set(data) })
162
+ public set(data: IUIInputData, transition?: ITransition | 'temp'): void {
163
+ this.waitInit(() => { super.set(data, transition) })
164
164
  }
165
165
 
166
166
  public start(): void {
@@ -223,7 +223,6 @@ export class Leafer extends Group implements ILeafer {
223
223
  protected __onResize(event: IResizeEvent): void {
224
224
  this.emitEvent(event)
225
225
  DataHelper.copyAttrs(this.__, event, canvasSizeAttrs)
226
- if (!event.width || !event.height) debug.warn('w = 0 or h = 0')
227
226
  setTimeout(() => { if (this.canvasManager) this.canvasManager.clearRecycled() }, 0)
228
227
  }
229
228
 
package/src/Text.ts CHANGED
@@ -39,7 +39,7 @@ export class Text extends UI implements IText {
39
39
  declare public hitFill?: IHitType
40
40
 
41
41
  @boundsType('')
42
- public text?: IString
42
+ public text?: IString | INumber
43
43
 
44
44
  @boundsType('L')
45
45
  public fontFamily?: IString
package/src/UI.ts CHANGED
@@ -169,12 +169,15 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
169
169
 
170
170
  public autoHeight?: IAutoSize
171
171
 
172
+ @boundsType(false)
172
173
  public lockRatio?: IBoolean
173
174
 
174
175
  public autoBox?: IAutoBoxData | IConstraint
175
176
 
177
+ @boundsType()
176
178
  public widthRange?: IRangeSize
177
179
 
180
+ @boundsType()
178
181
  public heightRange?: IRangeSize
179
182
 
180
183
 
@@ -303,6 +306,9 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
303
306
 
304
307
  public motionPath?: boolean
305
308
 
309
+ public motionPrecision?: INumber
310
+
311
+
306
312
  public motion?: INumber | IUnitData
307
313
 
308
314
  public motionRotation?: INumber | IBoolean
@@ -374,11 +380,13 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
374
380
  public reset(_data?: IUIInputData): void { }
375
381
 
376
382
 
377
- public set(data: IUIInputData, isTemp?: boolean): void {
378
- if (isTemp) {
379
- this.lockNormalStyle = true
380
- Object.assign(this, data)
381
- this.lockNormalStyle = false
383
+ public set(data: IUIInputData, transition?: ITransition | 'temp'): void {
384
+ if (transition) {
385
+ if (transition === 'temp') {
386
+ this.lockNormalStyle = true
387
+ Object.assign(this, data)
388
+ this.lockNormalStyle = false
389
+ } else this.animate(data, transition)
382
390
  } else Object.assign(this, data)
383
391
  }
384
392
 
package/types/index.d.ts CHANGED
@@ -91,6 +91,7 @@ declare class UI extends Leaf implements IUI {
91
91
  transition?: ITransition;
92
92
  transitionOut?: ITransition;
93
93
  motionPath?: boolean;
94
+ motionPrecision?: INumber;
94
95
  motion?: INumber | IUnitData;
95
96
  motionRotation?: INumber | IBoolean;
96
97
  states?: IStates;
@@ -114,7 +115,7 @@ declare class UI extends Leaf implements IUI {
114
115
  get editInner(): string;
115
116
  constructor(data?: IUIInputData);
116
117
  reset(_data?: IUIInputData): void;
117
- set(data: IUIInputData, isTemp?: boolean): void;
118
+ set(data: IUIInputData, transition?: ITransition | 'temp'): void;
118
119
  get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
119
120
  createProxyData(): IUIInputData;
120
121
  find(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI[];
@@ -151,7 +152,7 @@ declare class Group extends UI implements IGroup {
151
152
  constructor(data?: IGroupInputData);
152
153
  reset(data?: IGroupInputData): void;
153
154
  __setBranch(): void;
154
- set(data: IUIInputData, isTemp?: boolean): void;
155
+ set(data: IUIInputData, transition?: ITransition | 'temp'): void;
155
156
  toJSON(options?: IJSONOptions): IUIJSONData;
156
157
  pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult;
157
158
  addAt(child: IUI | IUI[] | IUIInputData | IUIInputData[], index: number): void;
@@ -211,7 +212,7 @@ declare class Leafer extends Group implements ILeafer {
211
212
  init(userConfig?: ILeaferConfig, parentApp?: IApp): void;
212
213
  onInit(): void;
213
214
  initType(_type: ILeaferType): void;
214
- set(data: IUIInputData): void;
215
+ set(data: IUIInputData, transition?: ITransition | 'temp'): void;
215
216
  start(): void;
216
217
  stop(): void;
217
218
  unlockLayout(): void;
@@ -383,7 +384,7 @@ declare class Text extends UI implements IText {
383
384
  fill?: IFill;
384
385
  strokeAlign?: IStrokeAlign;
385
386
  hitFill?: IHitType$1;
386
- text?: IString;
387
+ text?: IString | INumber;
387
388
  fontFamily?: IString;
388
389
  fontSize?: INumber;
389
390
  fontWeight?: IFontWeight;