@leafer-ui/display 2.1.3 → 2.1.5
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 -14
- package/src/Pen.ts +25 -36
- package/src/Text.ts +1 -1
- package/src/UI.ts +15 -13
- package/types/index.d.ts +29 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
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": "2.1.
|
|
26
|
-
"@leafer-ui/data": "2.1.
|
|
27
|
-
"@leafer-ui/display-module": "2.1.
|
|
28
|
-
"@leafer-ui/decorator": "2.1.
|
|
29
|
-
"@leafer-ui/external": "2.1.
|
|
25
|
+
"@leafer/core": "2.1.5",
|
|
26
|
+
"@leafer-ui/data": "2.1.5",
|
|
27
|
+
"@leafer-ui/display-module": "2.1.5",
|
|
28
|
+
"@leafer-ui/decorator": "2.1.5",
|
|
29
|
+
"@leafer-ui/external": "2.1.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "2.1.
|
|
33
|
-
"@leafer-ui/interface": "2.1.
|
|
32
|
+
"@leafer/interface": "2.1.5",
|
|
33
|
+
"@leafer-ui/interface": "2.1.5"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Group.ts
CHANGED
|
@@ -70,12 +70,6 @@ export class Group<TInputData = IGroupInputData> extends UI<TInputData> implemen
|
|
|
70
70
|
return data
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
// hit rewrite
|
|
75
|
-
|
|
76
|
-
public pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult { return undefined }
|
|
77
|
-
|
|
78
|
-
|
|
79
73
|
// add
|
|
80
74
|
|
|
81
75
|
public addAt(child: IUI | IUI[] | IUIInputData | IUIInputData[], index: number): void {
|
|
@@ -90,16 +84,18 @@ export class Group<TInputData = IGroupInputData> extends UI<TInputData> implemen
|
|
|
90
84
|
this.add(child, this.children.indexOf(before))
|
|
91
85
|
}
|
|
92
86
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
public add(_child: IUI | IUI[] | IUIInputData | IUIInputData[], _index?: number): void { }
|
|
96
|
-
|
|
97
|
-
public addMany(..._children: IUI[] | IUIInputData[]): void { }
|
|
87
|
+
}
|
|
98
88
|
|
|
99
|
-
|
|
89
|
+
export interface Group {
|
|
100
90
|
|
|
101
|
-
|
|
91
|
+
// hit rewrite
|
|
92
|
+
pick(hitPoint: IPointData, options?: IPickOptions): IPickResult
|
|
102
93
|
|
|
103
|
-
|
|
94
|
+
// Branch rewrite
|
|
95
|
+
add(child: IUI | IUI[] | IUIInputData | IUIInputData[], index?: number): void
|
|
96
|
+
addMany(...children: IUI[] | IUIInputData[]): void
|
|
97
|
+
remove(child?: IUI | number | string | IFindCondition | IFindUIMethod, destroy?: boolean): void
|
|
98
|
+
removeAll(_destroy?: boolean): void
|
|
99
|
+
clear(): void
|
|
104
100
|
|
|
105
101
|
}
|
package/src/Pen.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { PenData } from '@leafer-ui/data'
|
|
|
6
6
|
import { Group } from './Group'
|
|
7
7
|
import { Path } from './Path'
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
@useModule(PathCreator, ['set', 'path', 'paint'])
|
|
10
11
|
@registerUI()
|
|
11
12
|
export class Pen<TInputData = IPenInputData> extends Group<TInputData> implements IPen {
|
|
@@ -32,49 +33,37 @@ export class Pen<TInputData = IPenInputData> extends Group<TInputData> implement
|
|
|
32
33
|
return this
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
public moveTo(_x: number, _y: number): Pen { return this }
|
|
40
|
-
|
|
41
|
-
public lineTo(_x: number, _y: number): Pen { return this }
|
|
36
|
+
public paint(): void {
|
|
37
|
+
const { pathElement } = this
|
|
38
|
+
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate('path')
|
|
39
|
+
}
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
}
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
export interface Pen {
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
// PathCreator rewrite
|
|
48
46
|
|
|
47
|
+
// svg and canvas
|
|
48
|
+
beginPath(): Pen
|
|
49
|
+
moveTo(x: number, y: number): Pen
|
|
50
|
+
lineTo(x: number, y: number): Pen
|
|
51
|
+
bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): Pen
|
|
52
|
+
quadraticCurveTo(x1: number, y1: number, x: number, y: number): Pen
|
|
53
|
+
closePath(): Pen
|
|
49
54
|
|
|
50
55
|
// canvas
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
public ellipse(_x: number, _y: number, _radiusX: number, _radiusY: number, _rotation?: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen { return this }
|
|
57
|
-
|
|
58
|
-
public arc(_x: number, _y: number, _radius: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen { return this }
|
|
59
|
-
|
|
60
|
-
public arcTo(_x1: number, _y1: number, _x2: number, _y2: number, _radius: number): Pen { return this }
|
|
61
|
-
|
|
56
|
+
rect(x: number, y: number, width: number, height: number): Pen
|
|
57
|
+
roundRect(x: number, y: number, width: number, height: number, cornerRadius: number | number[]): Pen
|
|
58
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen
|
|
59
|
+
arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen
|
|
60
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Pen
|
|
62
61
|
|
|
63
62
|
// moveTo, then draw
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
public drawPoints(_points: number[] | IPointData[], _curve?: boolean | number, _close?: boolean): Pen { return this }
|
|
70
|
-
|
|
71
|
-
public clearPath(): Pen { return this } // = beginPath()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
public paint(): void {
|
|
75
|
-
const { pathElement } = this
|
|
76
|
-
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate('path')
|
|
77
|
-
}
|
|
63
|
+
drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen
|
|
64
|
+
drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen
|
|
65
|
+
drawPoints(points: number[] | IPointData[], curve?: boolean | number, close?: boolean): Pen
|
|
66
|
+
clearPath(): Pen // = beginPath()
|
|
78
67
|
|
|
79
68
|
}
|
|
80
69
|
|
|
@@ -84,4 +73,4 @@ function penPathType() {
|
|
|
84
73
|
get() { return this.__path }
|
|
85
74
|
})
|
|
86
75
|
}
|
|
87
|
-
}
|
|
76
|
+
}
|
package/src/Text.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { UI } from './UI'
|
|
|
12
12
|
const { copyAndSpread, includes, setList } = BoundsHelper, { stintSet } = DataHelper
|
|
13
13
|
|
|
14
14
|
@registerUI()
|
|
15
|
-
export class Text<
|
|
15
|
+
export class Text<TInputData = ITextInputData> extends UI<TInputData> implements IText {
|
|
16
16
|
|
|
17
17
|
public get __tag() { return 'Text' }
|
|
18
18
|
|
package/src/UI.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILeaferCanvas, IRenderOptions, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, 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, IScaleFixed, IDragBoundsType, IPathCommandNode } from '@leafer/interface'
|
|
2
|
-
import { Leaf, PathDrawer, surfaceType, dimType, dataType, positionType, scrollType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule,
|
|
2
|
+
import { Leaf, PathDrawer, surfaceType, dimType, dataType, positionType, scrollType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, 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, IArrowStyle, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString, IAnimateList, ILeafPaint, ILinker, IPathCommandDataWithRadius } from '@leafer-ui/interface'
|
|
5
5
|
import { effectType, zoomLayerType } from '@leafer-ui/decorator'
|
|
@@ -419,12 +419,6 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
|
|
422
|
-
// data
|
|
423
|
-
|
|
424
|
-
@rewrite(Leaf.prototype.reset)
|
|
425
|
-
public reset(_data?: IUIInputData): void { }
|
|
426
|
-
|
|
427
|
-
|
|
428
422
|
// @leafer-in/animate and @leafer-in/state will rewrite
|
|
429
423
|
|
|
430
424
|
public set(data: IUIInputData, _transition?: ITransition | 'temp'): void {
|
|
@@ -435,9 +429,6 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
435
429
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name as string[] | undefined)
|
|
436
430
|
}
|
|
437
431
|
|
|
438
|
-
public createProxyData(): IUIInputData { return undefined }
|
|
439
|
-
public clearProxyData(): void { }
|
|
440
|
-
|
|
441
432
|
|
|
442
433
|
// hit rewrite
|
|
443
434
|
|
|
@@ -478,6 +469,8 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
478
469
|
}
|
|
479
470
|
}
|
|
480
471
|
|
|
472
|
+
public __updatePath(): void { }
|
|
473
|
+
|
|
481
474
|
public __updateRenderPath(updateCache?: boolean): void {
|
|
482
475
|
const data = this.__
|
|
483
476
|
if (data.path) {
|
|
@@ -522,9 +515,6 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
522
515
|
return Plugin.need('animate')
|
|
523
516
|
}
|
|
524
517
|
|
|
525
|
-
public killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void { }
|
|
526
|
-
|
|
527
|
-
|
|
528
518
|
// create
|
|
529
519
|
|
|
530
520
|
// @leafer-in/export will rewrite
|
|
@@ -572,4 +562,16 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
572
562
|
super.destroy()
|
|
573
563
|
}
|
|
574
564
|
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export interface UI {
|
|
568
|
+
|
|
569
|
+
reset(data?: IUIInputData): void
|
|
570
|
+
|
|
571
|
+
createProxyData(): IUIInputData
|
|
572
|
+
clearProxyData(): void
|
|
573
|
+
|
|
574
|
+
// @leafer-in/animate rewrite
|
|
575
|
+
killAnimate(type?: IAnimateType, nextStyle?: IUIInputData): void
|
|
576
|
+
|
|
575
577
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -131,11 +131,8 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
|
|
|
131
131
|
__box?: IUI;
|
|
132
132
|
__animate?: IAnimate | IAnimateList;
|
|
133
133
|
get pen(): IPathCreator;
|
|
134
|
-
reset(_data?: IUIInputData): void;
|
|
135
134
|
set(data: IUIInputData, _transition?: ITransition | 'temp'): void;
|
|
136
135
|
get<K extends keyof this>(name?: K | K[] | IUIInputData): IUIInputData | this[K];
|
|
137
|
-
createProxyData(): IUIInputData;
|
|
138
|
-
clearProxyData(): void;
|
|
139
136
|
find(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI[];
|
|
140
137
|
findTag(tag: string | string[]): IUI[];
|
|
141
138
|
findOne(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI | undefined;
|
|
@@ -145,6 +142,7 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
|
|
|
145
142
|
asPath(curve?: boolean, pathForRender?: boolean): void;
|
|
146
143
|
load(): void;
|
|
147
144
|
__onUpdateSize(): void;
|
|
145
|
+
__updatePath(): void;
|
|
148
146
|
__updateRenderPath(updateCache?: boolean): void;
|
|
149
147
|
__drawRenderPath(canvas: ILeaferCanvas): void;
|
|
150
148
|
__drawPath(canvas: ILeaferCanvas): void;
|
|
@@ -152,7 +150,6 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
|
|
|
152
150
|
__drawPathByBox(drawer: IPathDrawer, ignoreCornerRadius?: boolean): void;
|
|
153
151
|
drawImagePlaceholder(_paint: ILeafPaint, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
|
|
154
152
|
animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
|
|
155
|
-
killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void;
|
|
156
153
|
export(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
157
154
|
syncExport(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): IExportResult;
|
|
158
155
|
clone(data?: IUIInputData): this;
|
|
@@ -164,6 +161,12 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
|
|
|
164
161
|
static setEditInner(_editorName: string | IEditToolFunction): void;
|
|
165
162
|
destroy(): void;
|
|
166
163
|
}
|
|
164
|
+
interface UI {
|
|
165
|
+
reset(data?: IUIInputData): void;
|
|
166
|
+
createProxyData(): IUIInputData;
|
|
167
|
+
clearProxyData(): void;
|
|
168
|
+
killAnimate(type?: IAnimateType, nextStyle?: IUIInputData): void;
|
|
169
|
+
}
|
|
167
170
|
|
|
168
171
|
declare class Group<TInputData = IGroupInputData> extends UI<TInputData> implements IGroup {
|
|
169
172
|
get __tag(): string;
|
|
@@ -178,13 +181,15 @@ declare class Group<TInputData = IGroupInputData> extends UI<TInputData> impleme
|
|
|
178
181
|
__setBranch(): void;
|
|
179
182
|
set(data: IUIInputData, transition?: ITransition | 'temp'): void;
|
|
180
183
|
toJSON(options?: IJSONOptions): IUIJSONData;
|
|
181
|
-
pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult;
|
|
182
184
|
addAt(child: IUI | IUI[] | IUIInputData | IUIInputData[], index: number): void;
|
|
183
185
|
addAfter(child: IUI | IUI[] | IUIInputData | IUIInputData[], after: IUI): void;
|
|
184
186
|
addBefore(child: IUI | IUI[] | IUIInputData | IUIInputData[], before: IUI): void;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
}
|
|
188
|
+
interface Group {
|
|
189
|
+
pick(hitPoint: IPointData, options?: IPickOptions): IPickResult;
|
|
190
|
+
add(child: IUI | IUI[] | IUIInputData | IUIInputData[], index?: number): void;
|
|
191
|
+
addMany(...children: IUI[] | IUIInputData[]): void;
|
|
192
|
+
remove(child?: IUI | number | string | IFindCondition$1 | IFindUIMethod, destroy?: boolean): void;
|
|
188
193
|
removeAll(_destroy?: boolean): void;
|
|
189
194
|
clear(): void;
|
|
190
195
|
}
|
|
@@ -403,7 +408,7 @@ declare class Canvas<TInputData = ICanvasInputData> extends Rect<TInputData> imp
|
|
|
403
408
|
destroy(): void;
|
|
404
409
|
}
|
|
405
410
|
|
|
406
|
-
declare class Text<
|
|
411
|
+
declare class Text<TInputData = ITextInputData> extends UI<TInputData> implements IText {
|
|
407
412
|
get __tag(): string;
|
|
408
413
|
__: ITextData;
|
|
409
414
|
width?: INumber;
|
|
@@ -459,22 +464,24 @@ declare class Pen<TInputData = IPenInputData> extends Group<TInputData> implemen
|
|
|
459
464
|
path: IPathCommandData$1;
|
|
460
465
|
__path: IPathCommandData$1;
|
|
461
466
|
setStyle(data: IPathInputData): Pen;
|
|
467
|
+
paint(): void;
|
|
468
|
+
}
|
|
469
|
+
interface Pen {
|
|
462
470
|
beginPath(): Pen;
|
|
463
|
-
moveTo(
|
|
464
|
-
lineTo(
|
|
465
|
-
bezierCurveTo(
|
|
466
|
-
quadraticCurveTo(
|
|
471
|
+
moveTo(x: number, y: number): Pen;
|
|
472
|
+
lineTo(x: number, y: number): Pen;
|
|
473
|
+
bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): Pen;
|
|
474
|
+
quadraticCurveTo(x1: number, y1: number, x: number, y: number): Pen;
|
|
467
475
|
closePath(): Pen;
|
|
468
|
-
rect(
|
|
469
|
-
roundRect(
|
|
470
|
-
ellipse(
|
|
471
|
-
arc(
|
|
472
|
-
arcTo(
|
|
473
|
-
drawEllipse(
|
|
474
|
-
drawArc(
|
|
475
|
-
drawPoints(
|
|
476
|
+
rect(x: number, y: number, width: number, height: number): Pen;
|
|
477
|
+
roundRect(x: number, y: number, width: number, height: number, cornerRadius: number | number[]): Pen;
|
|
478
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen;
|
|
479
|
+
arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen;
|
|
480
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Pen;
|
|
481
|
+
drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen;
|
|
482
|
+
drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): Pen;
|
|
483
|
+
drawPoints(points: number[] | IPointData$1[], curve?: boolean | number, close?: boolean): Pen;
|
|
476
484
|
clearPath(): Pen;
|
|
477
|
-
paint(): void;
|
|
478
485
|
}
|
|
479
486
|
|
|
480
487
|
export { Box, Canvas, Ellipse, Frame, Group, Image, Leafer, Line, MyImage, Path, Pen, Polygon, Rect, Star, Text, UI };
|