@leafer-ui/display 1.0.0-rc.20 → 1.0.0-rc.22
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/Leafer.ts +1 -4
- package/src/Text.ts +5 -2
- package/src/UI.ts +29 -10
- package/types/index.d.ts +14 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.22",
|
|
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.0-rc.
|
|
26
|
-
"@leafer-ui/data": "1.0.0-rc.
|
|
27
|
-
"@leafer-ui/display-module": "1.0.0-rc.
|
|
28
|
-
"@leafer-ui/decorator": "1.0.0-rc.
|
|
29
|
-
"@leafer-ui/external": "1.0.0-rc.
|
|
25
|
+
"@leafer/core": "1.0.0-rc.22",
|
|
26
|
+
"@leafer-ui/data": "1.0.0-rc.22",
|
|
27
|
+
"@leafer-ui/display-module": "1.0.0-rc.22",
|
|
28
|
+
"@leafer-ui/decorator": "1.0.0-rc.22",
|
|
29
|
+
"@leafer-ui/external": "1.0.0-rc.22"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.0.0-rc.
|
|
33
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
32
|
+
"@leafer/interface": "1.0.0-rc.22",
|
|
33
|
+
"@leafer-ui/interface": "1.0.0-rc.22"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Leafer.ts
CHANGED
|
@@ -11,9 +11,6 @@ const debug = Debug.get('Leafer')
|
|
|
11
11
|
@registerUI()
|
|
12
12
|
export class Leafer extends Group implements ILeafer {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
static get version() { return '1.0.0-rc.20' }
|
|
16
|
-
|
|
17
14
|
static list = new LeafList() // 所有leafer实例
|
|
18
15
|
|
|
19
16
|
|
|
@@ -123,7 +120,6 @@ export class Leafer extends Group implements ILeafer {
|
|
|
123
120
|
|
|
124
121
|
if (this.isApp) this.__setApp()
|
|
125
122
|
this.__checkAutoLayout(config)
|
|
126
|
-
this.updateLazyBounds()
|
|
127
123
|
this.view = canvas.view
|
|
128
124
|
|
|
129
125
|
// interaction / manager
|
|
@@ -390,6 +386,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
390
386
|
protected __listenEvents(): void {
|
|
391
387
|
const runId = Run.start('FirstCreate ' + this.innerName)
|
|
392
388
|
this.once(LeaferEvent.START, () => Run.end(runId))
|
|
389
|
+
this.once(LayoutEvent.START, () => this.updateLazyBounds())
|
|
393
390
|
this.once(LayoutEvent.END, () => this.__onReady())
|
|
394
391
|
this.once(RenderEvent.START, () => this.__onCreated())
|
|
395
392
|
this.once(RenderEvent.END, () => this.__onViewReady())
|
package/src/Text.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IBoolean, INumber, IString, IBoundsData } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IBoolean, INumber, IString, IBoundsData, IFourNumber } from '@leafer/interface'
|
|
2
2
|
import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, hitType, MathHelper } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IUnitData, IStrokeAlign, IHitType, ITextWrap } from '@leafer-ui/interface'
|
|
@@ -27,7 +27,7 @@ export class Text extends UI implements IText {
|
|
|
27
27
|
declare public height: INumber
|
|
28
28
|
|
|
29
29
|
@boundsType(0)
|
|
30
|
-
public padding:
|
|
30
|
+
public padding: IFourNumber
|
|
31
31
|
|
|
32
32
|
@surfaceType('#000000')
|
|
33
33
|
declare public fill: IFill
|
|
@@ -83,11 +83,14 @@ export class Text extends UI implements IText {
|
|
|
83
83
|
@boundsType('show')
|
|
84
84
|
public textOverflow: IOverflow | string
|
|
85
85
|
|
|
86
|
+
public get editInner(): string { return 'TextEditor' }
|
|
87
|
+
|
|
86
88
|
public get textDrawData(): ITextDrawData {
|
|
87
89
|
this.__layout.update()
|
|
88
90
|
return this.__.__textDrawData
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
|
|
91
94
|
constructor(data?: ITextInputData) {
|
|
92
95
|
super(data)
|
|
93
96
|
}
|
package/src/UI.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IAround, IValue, IWindingRule, IPathCreator } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IAround, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData } from '@leafer/interface'
|
|
2
2
|
import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowType, IFindUIMethod, IEditSize, ILeafer, IEditorConfig } from '@leafer-ui/interface'
|
|
4
|
+
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowType, IFindUIMethod, IEditSize, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction } from '@leafer-ui/interface'
|
|
5
5
|
import { arrowType, effectType, stateType, zoomLayerType } from '@leafer-ui/decorator'
|
|
6
6
|
|
|
7
7
|
import { UIData } from '@leafer-ui/data'
|
|
@@ -119,7 +119,10 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
@dataType(false)
|
|
122
|
-
public draggable: IBoolean
|
|
122
|
+
public draggable: IBoolean | 'x' | 'y'
|
|
123
|
+
|
|
124
|
+
@dataType()
|
|
125
|
+
public dragBounds?: IBoundsData | 'parent'
|
|
123
126
|
|
|
124
127
|
|
|
125
128
|
@dataType(false)
|
|
@@ -128,9 +131,6 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
128
131
|
@dataType('size')
|
|
129
132
|
public editSize?: IEditSize
|
|
130
133
|
|
|
131
|
-
@dataType()
|
|
132
|
-
public editorStyle: IEditorConfig
|
|
133
|
-
|
|
134
134
|
|
|
135
135
|
// hit
|
|
136
136
|
@hitType(true)
|
|
@@ -174,7 +174,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
174
174
|
public strokeAlign: IStrokeAlign
|
|
175
175
|
|
|
176
176
|
@strokeType(1)
|
|
177
|
-
public strokeWidth:
|
|
177
|
+
public strokeWidth: IFourNumber | IStrokeWidthString
|
|
178
178
|
|
|
179
179
|
@strokeType(false)
|
|
180
180
|
public strokeWidthFixed: IBoolean
|
|
@@ -225,7 +225,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
225
225
|
// corner
|
|
226
226
|
|
|
227
227
|
@pathType(0)
|
|
228
|
-
public cornerRadius:
|
|
228
|
+
public cornerRadius: IFourNumber | ICornerRadiusString
|
|
229
229
|
|
|
230
230
|
@pathType()
|
|
231
231
|
public cornerSmoothing: INumber
|
|
@@ -283,13 +283,21 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
283
283
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
|
|
287
286
|
public get pen(): IPathCreator {
|
|
288
287
|
pen.set(this.path = this.__.path || [])
|
|
289
288
|
return pen
|
|
290
289
|
}
|
|
291
290
|
|
|
292
291
|
|
|
292
|
+
// editor
|
|
293
|
+
|
|
294
|
+
public get editConfig(): IEditorConfig { return undefined }
|
|
295
|
+
|
|
296
|
+
public get editOuter(): string { return 'EditTool' }
|
|
297
|
+
|
|
298
|
+
public get editInner(): string { return 'PathEditor' }
|
|
299
|
+
|
|
300
|
+
|
|
293
301
|
constructor(data?: IUIInputData) {
|
|
294
302
|
super(data)
|
|
295
303
|
}
|
|
@@ -375,7 +383,8 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
375
383
|
public __drawPathByBox(drawer: IPathDrawer): void {
|
|
376
384
|
const { x, y, width, height } = this.__layout.boxBounds
|
|
377
385
|
if (this.__.cornerRadius) {
|
|
378
|
-
|
|
386
|
+
const { cornerRadius } = this.__
|
|
387
|
+
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius) // 修复微信浏览器bug, 后续需进一步优化
|
|
379
388
|
} else {
|
|
380
389
|
drawer.rect(x, y, width, height)
|
|
381
390
|
}
|
|
@@ -404,6 +413,16 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
404
413
|
dataProcessor(data)(this.prototype)
|
|
405
414
|
}
|
|
406
415
|
|
|
416
|
+
|
|
417
|
+
// @leafer-in/editor rewrite
|
|
418
|
+
|
|
419
|
+
static setEditConfig(_config: IEditorConfig | IEditorConfigFunction): void { }
|
|
420
|
+
|
|
421
|
+
static setEditOuter(_toolName: string | IEditToolFunction): void { }
|
|
422
|
+
|
|
423
|
+
static setEditInner(_editorName: string | IEditToolFunction): void { }
|
|
424
|
+
|
|
425
|
+
|
|
407
426
|
public destroy(): void {
|
|
408
427
|
this.fill = this.stroke = null
|
|
409
428
|
super.destroy()
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IString, INumber, IBoolean, IMaskType, IAround, IHitType, ICursorType, IPathCommandData, IPathString, IWindingRule, IPointData, IPathCreator, IValue, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData,
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IAround, IBoundsData, IHitType, ICursorType, IFourNumber, IPathCommandData, IPathString, IWindingRule, IPointData, IPathCreator, IValue, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IObject, IZoomType, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
|
-
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IEditSize,
|
|
3
|
+
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IEditSize, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IEditorConfig, IFindUIMethod, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, 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, IUnitData, 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;
|
|
@@ -35,10 +35,10 @@ declare class UI extends Leaf implements IUI {
|
|
|
35
35
|
skewX: INumber;
|
|
36
36
|
skewY: INumber;
|
|
37
37
|
around: IAround;
|
|
38
|
-
draggable: IBoolean;
|
|
38
|
+
draggable: IBoolean | 'x' | 'y';
|
|
39
|
+
dragBounds?: IBoundsData | 'parent';
|
|
39
40
|
editable: IBoolean;
|
|
40
41
|
editSize?: IEditSize;
|
|
41
|
-
editorStyle: IEditorConfig;
|
|
42
42
|
hittable: IBoolean;
|
|
43
43
|
hitFill: IHitType;
|
|
44
44
|
hitStroke: IHitType;
|
|
@@ -50,7 +50,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
50
50
|
fill: IFill;
|
|
51
51
|
stroke: IStroke;
|
|
52
52
|
strokeAlign: IStrokeAlign;
|
|
53
|
-
strokeWidth:
|
|
53
|
+
strokeWidth: IFourNumber | IStrokeWidthString;
|
|
54
54
|
strokeWidthFixed: IBoolean;
|
|
55
55
|
strokeCap: IStrokeCap;
|
|
56
56
|
strokeJoin: IStrokeJoin;
|
|
@@ -64,7 +64,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
64
64
|
closed: boolean;
|
|
65
65
|
startArrow: IArrowType;
|
|
66
66
|
endArrow: IArrowType;
|
|
67
|
-
cornerRadius:
|
|
67
|
+
cornerRadius: IFourNumber | ICornerRadiusString;
|
|
68
68
|
cornerSmoothing: INumber;
|
|
69
69
|
shadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
70
70
|
innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
@@ -80,6 +80,9 @@ declare class UI extends Leaf implements IUI {
|
|
|
80
80
|
set scale(value: INumber | IPointData);
|
|
81
81
|
get scale(): INumber | IPointData;
|
|
82
82
|
get pen(): IPathCreator;
|
|
83
|
+
get editConfig(): IEditorConfig;
|
|
84
|
+
get editOuter(): string;
|
|
85
|
+
get editInner(): string;
|
|
83
86
|
constructor(data?: IUIInputData);
|
|
84
87
|
reset(_data?: IUIInputData): void;
|
|
85
88
|
set(data: IUIInputData): void;
|
|
@@ -100,6 +103,9 @@ declare class UI extends Leaf implements IUI {
|
|
|
100
103
|
static one(data: IUIInputData, x?: number, y?: number, width?: number, height?: number): IUI;
|
|
101
104
|
static registerUI(): void;
|
|
102
105
|
static registerData(data: IUIData): void;
|
|
106
|
+
static setEditConfig(_config: IEditorConfig | IEditorConfigFunction): void;
|
|
107
|
+
static setEditOuter(_toolName: string | IEditToolFunction): void;
|
|
108
|
+
static setEditInner(_editorName: string | IEditToolFunction): void;
|
|
103
109
|
destroy(): void;
|
|
104
110
|
}
|
|
105
111
|
|
|
@@ -125,7 +131,6 @@ declare class Group extends UI implements IGroup {
|
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
declare class Leafer extends Group implements ILeafer {
|
|
128
|
-
static get version(): string;
|
|
129
134
|
static list: LeafList;
|
|
130
135
|
get __tag(): string;
|
|
131
136
|
__: ILeaferData;
|
|
@@ -330,7 +335,7 @@ declare class Text extends UI implements IText {
|
|
|
330
335
|
__: ITextData;
|
|
331
336
|
width: INumber;
|
|
332
337
|
height: INumber;
|
|
333
|
-
padding:
|
|
338
|
+
padding: IFourNumber;
|
|
334
339
|
fill: IFill;
|
|
335
340
|
strokeAlign: IStrokeAlign;
|
|
336
341
|
hitFill: IHitType$1;
|
|
@@ -349,6 +354,7 @@ declare class Text extends UI implements IText {
|
|
|
349
354
|
verticalAlign: IVerticalAlign;
|
|
350
355
|
textWrap: ITextWrap;
|
|
351
356
|
textOverflow: IOverflow | string;
|
|
357
|
+
get editInner(): string;
|
|
352
358
|
get textDrawData(): ITextDrawData;
|
|
353
359
|
constructor(data?: ITextInputData);
|
|
354
360
|
__drawHitPath(canvas: ILeaferCanvas): void;
|