@leafer-ui/display 1.2.2 → 1.3.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 +8 -8
- package/src/Group.ts +10 -8
- package/src/Leafer.ts +0 -6
- package/src/Text.ts +4 -1
- package/src/UI.ts +18 -15
- package/types/index.d.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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.
|
|
26
|
-
"@leafer-ui/data": "1.
|
|
27
|
-
"@leafer-ui/display-module": "1.
|
|
28
|
-
"@leafer-ui/decorator": "1.
|
|
29
|
-
"@leafer-ui/external": "1.
|
|
25
|
+
"@leafer/core": "1.3.0",
|
|
26
|
+
"@leafer-ui/data": "1.3.0",
|
|
27
|
+
"@leafer-ui/display-module": "1.3.0",
|
|
28
|
+
"@leafer-ui/decorator": "1.3.0",
|
|
29
|
+
"@leafer-ui/external": "1.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.
|
|
33
|
-
"@leafer-ui/interface": "1.
|
|
32
|
+
"@leafer/interface": "1.3.0",
|
|
33
|
+
"@leafer-ui/interface": "1.3.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Group.ts
CHANGED
|
@@ -37,18 +37,20 @@ export class Group extends UI implements IGroup { // tip: rewrited Box
|
|
|
37
37
|
// data
|
|
38
38
|
|
|
39
39
|
public set(data: IUIInputData, transition?: ITransition | 'temp'): void {
|
|
40
|
-
if (data
|
|
41
|
-
|
|
40
|
+
if (data) {
|
|
41
|
+
if (data.children) {
|
|
42
|
+
const { children } = data
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
delete data.children
|
|
45
|
+
this.children ? this.clear() : this.__setBranch()
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
super.set(data, transition)
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
children.forEach(child => this.add(child))
|
|
50
|
+
data.children = children
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
} else super.set(data, transition)
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
public toJSON(options?: IJSONOptions): IUIJSONData {
|
package/src/Leafer.ts
CHANGED
|
@@ -397,11 +397,6 @@ export class Leafer extends Group implements ILeafer {
|
|
|
397
397
|
// miniapp rewrite
|
|
398
398
|
public receiveEvent(_event: any): void { }
|
|
399
399
|
|
|
400
|
-
|
|
401
|
-
protected __checkUpdateLayout(): void {
|
|
402
|
-
this.__layout.update()
|
|
403
|
-
}
|
|
404
|
-
|
|
405
400
|
protected emitLeafer(type: string): void {
|
|
406
401
|
this.emitEvent(new LeaferEvent(type, this))
|
|
407
402
|
}
|
|
@@ -416,7 +411,6 @@ export class Leafer extends Group implements ILeafer {
|
|
|
416
411
|
this.__eventIds.push(
|
|
417
412
|
this.on_(WatchEvent.DATA, this.__onWatchData, this),
|
|
418
413
|
this.on_(RenderEvent.NEXT, this.__onNextRender, this),
|
|
419
|
-
this.on_(LayoutEvent.CHECK_UPDATE, this.__checkUpdateLayout, this)
|
|
420
414
|
)
|
|
421
415
|
}
|
|
422
416
|
|
package/src/Text.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IBoolean, INumber, IString, IBoundsData, IUnitData } from '@leafer/interface'
|
|
2
2
|
import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, dataType, hitType, MathHelper } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IStrokeAlign, IHitType, ITextWrap } from '@leafer-ui/interface'
|
|
4
|
+
import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IStrokeAlign, IHitType, ITextWrap, IWritingMode } from '@leafer-ui/interface'
|
|
5
5
|
import { TextData } from '@leafer-ui/data'
|
|
6
6
|
|
|
7
7
|
import { TextConvert, UnitConvert } from '@leafer-ui/external'
|
|
@@ -71,6 +71,9 @@ export class Text extends UI implements IText {
|
|
|
71
71
|
@boundsType(0)
|
|
72
72
|
public paraSpacing?: INumber
|
|
73
73
|
|
|
74
|
+
@boundsType('x')
|
|
75
|
+
public writingMode?: IWritingMode
|
|
76
|
+
|
|
74
77
|
@boundsType('left')
|
|
75
78
|
public textAlign?: ITextAlign
|
|
76
79
|
|
package/src/UI.ts
CHANGED
|
@@ -292,9 +292,9 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
292
292
|
|
|
293
293
|
// @leafer-in/animate rewrite
|
|
294
294
|
|
|
295
|
-
public animation?: IAnimation
|
|
295
|
+
public animation?: IAnimation | IAnimation[]
|
|
296
296
|
|
|
297
|
-
public animationOut?: IAnimation
|
|
297
|
+
public animationOut?: IAnimation | IAnimation[]
|
|
298
298
|
|
|
299
299
|
|
|
300
300
|
public transition?: ITransition
|
|
@@ -381,13 +381,15 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
381
381
|
|
|
382
382
|
|
|
383
383
|
public set(data: IUIInputData, transition?: ITransition | 'temp'): void {
|
|
384
|
-
if (
|
|
385
|
-
if (transition
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
384
|
+
if (data) {
|
|
385
|
+
if (transition) {
|
|
386
|
+
if (transition === 'temp') {
|
|
387
|
+
this.lockNormalStyle = true
|
|
388
|
+
Object.assign(this, data)
|
|
389
|
+
this.lockNormalStyle = false
|
|
390
|
+
} else this.animate(data, transition)
|
|
391
|
+
} else Object.assign(this, data)
|
|
392
|
+
}
|
|
391
393
|
}
|
|
392
394
|
|
|
393
395
|
public get(name?: string | string[] | IUIInputData): IUIInputData | IValue {
|
|
@@ -399,11 +401,11 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
399
401
|
|
|
400
402
|
// hit rewrite
|
|
401
403
|
|
|
402
|
-
public find(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI[] { return
|
|
404
|
+
public find(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI[] { return Plugin.need('find') }
|
|
403
405
|
|
|
404
406
|
public findTag(tag: string | string[]): IUI[] { return this.find({ tag }) }
|
|
405
407
|
|
|
406
|
-
public findOne(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI | undefined { return
|
|
408
|
+
public findOne(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI | undefined { return Plugin.need('find') }
|
|
407
409
|
|
|
408
410
|
public findId(id: number | string): IUI | undefined { return this.findOne({ id }) }
|
|
409
411
|
|
|
@@ -465,17 +467,18 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
465
467
|
|
|
466
468
|
// @leafer-in/animate rewrite
|
|
467
469
|
|
|
468
|
-
public animate(_keyframe?: IUIInputData | IKeyframe[] | IAnimation, _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate {
|
|
470
|
+
public animate(_keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate {
|
|
469
471
|
return Plugin.need('animate')
|
|
470
472
|
}
|
|
471
473
|
|
|
472
|
-
public killAnimate(_type?: IAnimateType): void { }
|
|
474
|
+
public killAnimate(_type?: IAnimateType, _killStyle?: IUIInputData): void { }
|
|
473
475
|
|
|
474
476
|
|
|
475
477
|
// create
|
|
476
478
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
+
// @leafer-in/export will rewrite
|
|
480
|
+
public export(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): Promise<IExportResult> {
|
|
481
|
+
return Plugin.need('export')
|
|
479
482
|
}
|
|
480
483
|
|
|
481
484
|
public clone(data?: IUIInputData): IUI {
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
|
-
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IEffect, IAnimation, ITransition, IStates, IStateName, IAnimate, IEditorConfig, 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, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
|
|
3
|
+
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IEffect, IAnimation, ITransition, IStates, IStateName, IAnimate, IEditorConfig, 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, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
|
|
4
4
|
|
|
5
5
|
declare class UI extends Leaf implements IUI {
|
|
6
6
|
__: IUIData;
|
|
@@ -86,8 +86,8 @@ declare class UI extends Leaf implements IUI {
|
|
|
86
86
|
backgroundBlur?: INumber | IBlurEffect;
|
|
87
87
|
grayscale?: INumber | IGrayscaleEffect;
|
|
88
88
|
filter?: IEffect | IEffect[];
|
|
89
|
-
animation?: IAnimation;
|
|
90
|
-
animationOut?: IAnimation;
|
|
89
|
+
animation?: IAnimation | IAnimation[];
|
|
90
|
+
animationOut?: IAnimation | IAnimation[];
|
|
91
91
|
transition?: ITransition;
|
|
92
92
|
transitionOut?: ITransition;
|
|
93
93
|
motionPath?: boolean;
|
|
@@ -131,9 +131,9 @@ declare class UI extends Leaf implements IUI {
|
|
|
131
131
|
__drawPath(canvas: ILeaferCanvas): void;
|
|
132
132
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
133
133
|
__drawPathByBox(drawer: IPathDrawer): void;
|
|
134
|
-
animate(_keyframe?: IUIInputData | IKeyframe[] | IAnimation, _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
|
|
135
|
-
killAnimate(_type?: IAnimateType): void;
|
|
136
|
-
export(
|
|
134
|
+
animate(_keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
|
|
135
|
+
killAnimate(_type?: IAnimateType, _killStyle?: IUIInputData): void;
|
|
136
|
+
export(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
137
137
|
clone(data?: IUIInputData): IUI;
|
|
138
138
|
static one(data: IUIInputData, x?: number, y?: number, width?: number, height?: number): IUI;
|
|
139
139
|
static registerUI(): void;
|
|
@@ -251,7 +251,6 @@ declare class Leafer extends Group implements ILeafer {
|
|
|
251
251
|
getPagePointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
|
|
252
252
|
updateClientBounds(): void;
|
|
253
253
|
receiveEvent(_event: any): void;
|
|
254
|
-
protected __checkUpdateLayout(): void;
|
|
255
254
|
protected emitLeafer(type: string): void;
|
|
256
255
|
protected __listenEvents(): void;
|
|
257
256
|
protected __removeListenEvents(): void;
|
|
@@ -398,6 +397,7 @@ declare class Text extends UI implements IText {
|
|
|
398
397
|
lineHeight?: INumber | IUnitData;
|
|
399
398
|
paraIndent?: INumber;
|
|
400
399
|
paraSpacing?: INumber;
|
|
400
|
+
writingMode?: IWritingMode;
|
|
401
401
|
textAlign?: ITextAlign;
|
|
402
402
|
verticalAlign?: IVerticalAlign;
|
|
403
403
|
autoSizeAlign?: IBoolean;
|