@leafer-ui/display 1.0.0-rc.28 → 1.0.0-rc.30

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.0-rc.28",
3
+ "version": "1.0.0-rc.30",
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.28",
26
- "@leafer-ui/data": "1.0.0-rc.28",
27
- "@leafer-ui/display-module": "1.0.0-rc.28",
28
- "@leafer-ui/decorator": "1.0.0-rc.28",
29
- "@leafer-ui/external": "1.0.0-rc.28"
25
+ "@leafer/core": "1.0.0-rc.30",
26
+ "@leafer-ui/data": "1.0.0-rc.30",
27
+ "@leafer-ui/display-module": "1.0.0-rc.30",
28
+ "@leafer-ui/decorator": "1.0.0-rc.30",
29
+ "@leafer-ui/external": "1.0.0-rc.30"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.0.0-rc.28",
33
- "@leafer-ui/interface": "1.0.0-rc.28"
32
+ "@leafer/interface": "1.0.0-rc.30",
33
+ "@leafer-ui/interface": "1.0.0-rc.30"
34
34
  }
35
35
  }
package/src/Box.ts CHANGED
@@ -24,10 +24,10 @@ export class Box extends Group implements IBox {
24
24
  declare public __: IBoxData
25
25
 
26
26
  @dataType(false)
27
- public resizeChildren: IBoolean
27
+ public resizeChildren?: IBoolean
28
28
 
29
29
  @affectRenderBoundsType('show')
30
- declare public overflow: IOverflow
30
+ declare public overflow?: IOverflow
31
31
 
32
32
  public isOverflow: boolean
33
33
 
package/src/Canvas.ts CHANGED
@@ -17,23 +17,23 @@ export class Canvas extends Rect implements ICanvas {
17
17
  declare public __: ICanvasData
18
18
 
19
19
  @resizeType(100)
20
- declare public width: INumber
20
+ declare public width?: INumber
21
21
 
22
22
  @resizeType(100)
23
- declare public height: INumber
23
+ declare public height?: INumber
24
24
 
25
25
  @resizeType(Platform.devicePixelRatio)
26
- declare public pixelRatio: INumber
26
+ declare public pixelRatio?: INumber
27
27
 
28
28
  @resizeType(true)
29
- public smooth: boolean
29
+ public smooth?: boolean
30
30
 
31
31
  @resizeType()
32
- public contextSettings: ICanvasContext2DSettings
32
+ public contextSettings?: ICanvasContext2DSettings
33
33
 
34
- public canvas: ILeaferCanvas
34
+ public canvas?: ILeaferCanvas
35
35
 
36
- public context: ICanvasContext2D
36
+ public context?: ICanvasContext2D
37
37
 
38
38
  constructor(data?: ICanvasInputData) {
39
39
  super(data)
package/src/Ellipse.ts CHANGED
@@ -18,13 +18,13 @@ export class Ellipse extends UI implements IEllipse {
18
18
  declare public __: IEllipseData
19
19
 
20
20
  @pathType(0)
21
- public innerRadius: INumber
21
+ public innerRadius?: INumber
22
22
 
23
23
  @pathType(0)
24
- public startAngle: INumber
24
+ public startAngle?: INumber
25
25
 
26
26
  @pathType(0)
27
- public endAngle: INumber
27
+ public endAngle?: INumber
28
28
 
29
29
  constructor(data?: IEllipseInputData) {
30
30
  super(data)
package/src/Frame.ts CHANGED
@@ -17,10 +17,10 @@ export class Frame extends Box implements IFrame {
17
17
  declare public __: IFrameData
18
18
 
19
19
  @surfaceType('#FFFFFF')
20
- declare public fill: IFill
20
+ declare public fill?: IFill
21
21
 
22
22
  @affectRenderBoundsType('hide')
23
- declare public overflow: IOverflow
23
+ declare public overflow?: IOverflow
24
24
 
25
25
  constructor(data?: IFrameInputData) {
26
26
  super(data)
package/src/Group.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { IPickOptions, IPickResult, IPointData } from '@leafer/interface'
1
+ import { IJSONOptions, IPickOptions, IPickResult, IPointData } from '@leafer/interface'
2
2
  import { Branch, useModule, dataProcessor, registerUI, UICreator } from '@leafer/core'
3
3
 
4
- import { IGroup, IGroupData, IGroupInputData, IUI, IUIInputData } from '@leafer-ui/interface'
4
+ import { IGroup, IGroupData, IGroupInputData, IUI, IUIInputData, IUIJSONData } from '@leafer-ui/interface'
5
5
  import { GroupData } from '@leafer-ui/data'
6
6
 
7
7
  import { UI } from './UI'
@@ -62,9 +62,9 @@ export class Group extends UI implements IGroup { // tip: rewrited Box
62
62
  }
63
63
  }
64
64
 
65
- public toJSON(): IUIInputData {
66
- const data = super.toJSON()
67
- data.children = this.children.map(child => child.toJSON())
65
+ public toJSON(options?: IJSONOptions): IUIJSONData {
66
+ const data = super.toJSON(options)
67
+ data.children = this.children.map(child => child.toJSON(options))
68
68
  return data
69
69
  }
70
70
 
package/src/Image.ts CHANGED
@@ -20,7 +20,7 @@ export class Image extends Rect implements IImage {
20
20
 
21
21
  public get ready(): boolean { return this.image ? this.image.ready : false }
22
22
 
23
- public image: ILeaferImage
23
+ public image?: ILeaferImage
24
24
 
25
25
  constructor(data?: IImageInputData) {
26
26
  super(data)
package/src/Leafer.ts CHANGED
@@ -20,7 +20,7 @@ export class Leafer extends Group implements ILeafer {
20
20
  declare public __: ILeaferData
21
21
 
22
22
  @boundsType()
23
- declare public pixelRatio: INumber
23
+ declare public pixelRatio?: INumber
24
24
 
25
25
  public get isApp(): boolean { return false }
26
26
  public get app(): ILeafer { return this.parent || this }
@@ -222,6 +222,7 @@ export class Leafer extends Group implements ILeafer {
222
222
  protected __onResize(event: IResizeEvent): void {
223
223
  this.emitEvent(event)
224
224
  DataHelper.copyAttrs(this.__, event, canvasSizeAttrs)
225
+ if (!event.width || !event.height) debug.warn('w = 0 or h = 0')
225
226
  setTimeout(() => { if (this.canvasManager) this.canvasManager.clearRecycled() }, 0)
226
227
  }
227
228
 
@@ -250,6 +251,7 @@ export class Leafer extends Group implements ILeafer {
250
251
  override __setAttr(attrName: string, newValue: IValue): boolean {
251
252
  if (this.canvas) {
252
253
  if (canvasSizeAttrs.includes(attrName)) {
254
+ if (!newValue) debug.warn(attrName + ' is 0')
253
255
  this.__changeCanvasSize(attrName, newValue as number)
254
256
  } else if (attrName === 'fill') {
255
257
  this.__changeFill(newValue as string)
package/src/Line.ts CHANGED
@@ -22,19 +22,19 @@ export class Line extends UI implements ILine { // tip: rewrited Polygon
22
22
  declare public __: ILineData
23
23
 
24
24
  @affectStrokeBoundsType('center')
25
- declare public strokeAlign: IStrokeAlign
25
+ declare public strokeAlign?: IStrokeAlign
26
26
 
27
27
  @boundsType(0)
28
- declare public height: INumber
28
+ declare public height?: INumber
29
29
 
30
30
  @pathType()
31
- public points: number[]
31
+ public points?: number[]
32
32
 
33
33
  @pathType(0)
34
- public curve: boolean | number
34
+ public curve?: boolean | number
35
35
 
36
36
  @pathType(false)
37
- declare public closed: boolean
37
+ declare public closed?: boolean
38
38
 
39
39
  public get toPoint(): IPointData {
40
40
  const { width, rotation } = this.__
package/src/Path.ts CHANGED
@@ -15,7 +15,7 @@ export class Path extends UI implements IPath {
15
15
  declare public __: IPathData
16
16
 
17
17
  @affectStrokeBoundsType('center')
18
- declare public strokeAlign: IStrokeAlign
18
+ declare public strokeAlign?: IStrokeAlign
19
19
 
20
20
  constructor(data?: IPathInputData) {
21
21
  super(data)
package/src/Polygon.ts CHANGED
@@ -22,13 +22,13 @@ export class Polygon extends UI implements IPolygon {
22
22
  declare public __: IPolygonData
23
23
 
24
24
  @pathType(3)
25
- sides: INumber
25
+ public sides?: INumber
26
26
 
27
27
  @pathType()
28
- points: number[]
28
+ public points?: number[]
29
29
 
30
30
  @pathType(0)
31
- curve: boolean | number
31
+ public curve?: boolean | number
32
32
 
33
33
  constructor(data?: IPolygonInputData) {
34
34
  super(data)
package/src/Star.ts CHANGED
@@ -20,10 +20,10 @@ export class Star extends UI implements IStar {
20
20
  declare public __: IStarData
21
21
 
22
22
  @pathType(5)
23
- public corners: INumber
23
+ public corners?: INumber
24
24
 
25
25
  @pathType(0.382)
26
- public innerRadius: INumber
26
+ public innerRadius?: INumber
27
27
 
28
28
  constructor(data?: IStarInputData) {
29
29
  super(data)
package/src/Text.ts CHANGED
@@ -21,67 +21,67 @@ export class Text extends UI implements IText {
21
21
 
22
22
  // size
23
23
  @boundsType(0)
24
- declare public width: INumber
24
+ declare public width?: INumber
25
25
 
26
26
  @boundsType(0)
27
- declare public height: INumber
27
+ declare public height?: INumber
28
28
 
29
29
  @dataType(false)
30
- public resizeFontSize: IBoolean
30
+ public resizeFontSize?: IBoolean
31
31
 
32
32
  @surfaceType('#000000')
33
- declare public fill: IFill
33
+ declare public fill?: IFill
34
34
 
35
35
  @affectStrokeBoundsType('outside')
36
- declare public strokeAlign: IStrokeAlign
36
+ declare public strokeAlign?: IStrokeAlign
37
37
 
38
38
  @hitType('all')
39
- declare public hitFill: IHitType
39
+ declare public hitFill?: IHitType
40
40
 
41
41
  @boundsType('')
42
- public text: IString
42
+ public text?: IString
43
43
 
44
44
  @boundsType('L')
45
- public fontFamily: IString
45
+ public fontFamily?: IString
46
46
 
47
47
  @boundsType(12)
48
- public fontSize: INumber
48
+ public fontSize?: INumber
49
49
 
50
50
  @boundsType('normal')
51
- public fontWeight: IFontWeight
51
+ public fontWeight?: IFontWeight
52
52
 
53
53
  @boundsType(false)
54
- public italic: IBoolean
54
+ public italic?: IBoolean
55
55
 
56
56
  @boundsType('none')
57
- public textCase: ITextCase
57
+ public textCase?: ITextCase
58
58
 
59
59
  @boundsType('none')
60
- public textDecoration: ITextDecoration
60
+ public textDecoration?: ITextDecoration
61
61
 
62
62
  @boundsType(0)
63
- public letterSpacing: INumber | IUnitData
63
+ public letterSpacing?: INumber | IUnitData
64
64
 
65
65
  @boundsType({ type: 'percent', value: 1.5 } as IUnitData)
66
- public lineHeight: INumber | IUnitData
66
+ public lineHeight?: INumber | IUnitData
67
67
 
68
68
  @boundsType(0)
69
- public paraIndent: INumber
69
+ public paraIndent?: INumber
70
70
 
71
71
  @boundsType(0)
72
- public paraSpacing: INumber
72
+ public paraSpacing?: INumber
73
73
 
74
74
  @boundsType('left')
75
- public textAlign: ITextAlign
75
+ public textAlign?: ITextAlign
76
76
 
77
77
  @boundsType('top')
78
- public verticalAlign: IVerticalAlign
78
+ public verticalAlign?: IVerticalAlign
79
79
 
80
80
  @boundsType('normal')
81
- public textWrap: ITextWrap
81
+ public textWrap?: ITextWrap
82
82
 
83
83
  @boundsType('show')
84
- public textOverflow: IOverflow | string
84
+ public textOverflow?: IOverflow | string
85
85
 
86
86
  public get editInner(): string { return 'TextEditor' }
87
87
 
package/src/UI.ts CHANGED
@@ -18,7 +18,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
18
18
  @dataProcessor(UIData)
19
19
  declare public __: IUIData
20
20
 
21
- declare public proxyData: IUIInputData // need rewrite getter
21
+ declare public proxyData?: IUIInputData // need rewrite getter
22
22
  declare public __proxyData?: IUIInputData
23
23
 
24
24
  public get app(): ILeafer { return this.leafer && this.leafer.app }
@@ -37,201 +37,201 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
37
37
 
38
38
  // id
39
39
  @dataType('')
40
- public id: IString
40
+ public id?: IString
41
41
 
42
42
  @dataType('')
43
- public name: IString
43
+ public name?: IString
44
44
 
45
45
  @dataType('')
46
- public className: IString
46
+ public className?: IString
47
47
 
48
48
 
49
49
  // layer
50
50
  @surfaceType('pass-through')
51
- public blendMode: IBlendMode
51
+ public blendMode?: IBlendMode
52
52
 
53
53
  @opacityType(1)
54
- public opacity: INumber
54
+ public opacity?: INumber
55
55
 
56
56
  @visibleType(true)
57
- public visible: IBoolean | 0
57
+ public visible?: IBoolean | 0
58
58
 
59
59
 
60
60
  @stateType(false)
61
- public selected: IBoolean
61
+ public selected?: IBoolean
62
62
 
63
63
  @stateType(false)
64
- public disabled: IBoolean
64
+ public disabled?: IBoolean
65
65
 
66
66
  @surfaceType(false)
67
- public locked: IBoolean
67
+ public locked?: IBoolean
68
68
 
69
69
 
70
70
  @sortType(0)
71
- public zIndex: INumber
71
+ public zIndex?: INumber
72
72
 
73
73
 
74
74
  @maskType(false)
75
- public mask: IBoolean | IMaskType
75
+ public mask?: IBoolean | IMaskType
76
76
 
77
77
  @eraserType(false)
78
- public eraser: IBoolean | IEraserType
78
+ public eraser?: IBoolean | IEraserType
79
79
 
80
80
 
81
81
  // position
82
82
  @positionType(0, true)
83
- public x: INumber
83
+ public x?: INumber
84
84
 
85
85
  @positionType(0, true)
86
- public y: INumber
86
+ public y?: INumber
87
87
 
88
88
  // size
89
89
  @boundsType(100, true)
90
- public width: INumber
90
+ public width?: INumber
91
91
 
92
92
  @boundsType(100, true)
93
- public height: INumber
93
+ public height?: INumber
94
94
 
95
95
  // scale
96
96
  @scaleType(1, true)
97
- public scaleX: INumber
97
+ public scaleX?: INumber
98
98
 
99
99
  @scaleType(1, true)
100
- public scaleY: INumber
100
+ public scaleY?: INumber
101
101
 
102
102
  // rotate
103
103
  @rotationType(0, true)
104
- public rotation: INumber
104
+ public rotation?: INumber
105
105
 
106
106
  // skew
107
107
  @rotationType(0, true)
108
- public skewX: INumber
108
+ public skewX?: INumber
109
109
 
110
110
  @rotationType(0, true)
111
- public skewY: INumber
111
+ public skewY?: INumber
112
112
 
113
113
 
114
114
  // offset
115
115
  @positionType(0, true)
116
- public offsetX: INumber
116
+ public offsetX?: INumber
117
117
 
118
118
  @positionType(0, true)
119
- public offsetY: INumber
119
+ public offsetY?: INumber
120
120
 
121
121
  // scroll
122
122
  @positionType(0, true)
123
- public scrollX: INumber
123
+ public scrollX?: INumber
124
124
 
125
125
  @positionType(0, true)
126
- public scrollY: INumber
126
+ public scrollY?: INumber
127
127
 
128
128
 
129
129
  // center
130
130
  @autoLayoutType()
131
- public origin: IAlign | IUnitPointData
131
+ public origin?: IAlign | IUnitPointData
132
132
 
133
133
  @autoLayoutType()
134
- public around: IAlign | IUnitPointData
134
+ public around?: IAlign | IUnitPointData
135
135
 
136
136
 
137
137
  // image
138
138
  @dataType(false)
139
- public lazy: IBoolean // load image / compute paint
139
+ public lazy?: IBoolean // load image / compute paint
140
140
 
141
141
  @naturalBoundsType(1)
142
- public pixelRatio: INumber
142
+ public pixelRatio?: INumber
143
143
 
144
144
 
145
145
  // path
146
146
  @pathInputType()
147
- public path: IPathCommandData | IPathString
147
+ public path?: IPathCommandData | IPathString
148
148
 
149
149
  @pathType()
150
- public windingRule: IWindingRule
150
+ public windingRule?: IWindingRule
151
151
 
152
152
  @pathType(true)
153
- public closed: boolean
153
+ public closed?: boolean
154
154
 
155
155
 
156
156
  // auto layout
157
157
  @autoLayoutType(false)
158
- public flow: IFlowType
158
+ public flow?: IFlowType
159
159
 
160
160
  @boundsType(0)
161
- public padding: IFourNumber
161
+ public padding?: IFourNumber
162
162
 
163
163
  @boundsType(0)
164
- public gap: IGap | IPointGap
164
+ public gap?: IGap | IPointGap
165
165
 
166
166
  @boundsType('top-left')
167
- public flowAlign: IFlowAlign | IFlowAxisAlign
167
+ public flowAlign?: IFlowAlign | IFlowAxisAlign
168
168
 
169
169
  @boundsType(false)
170
- public flowWrap: IFlowWrap
170
+ public flowWrap?: IFlowWrap
171
171
 
172
172
  @boundsType('box')
173
- public itemBox: IFlowBoxType
173
+ public itemBox?: IFlowBoxType
174
174
 
175
175
 
176
176
  @boundsType(true)
177
- public inFlow: IBoolean
177
+ public inFlow?: IBoolean
178
178
 
179
179
  @boundsType() // rewrite in flow
180
- public autoWidth: IAutoSize
180
+ public autoWidth?: IAutoSize
181
181
 
182
182
  @boundsType() // rewrite in flow
183
- public autoHeight: IAutoSize
183
+ public autoHeight?: IAutoSize
184
184
 
185
185
  @boundsType()
186
- public lockRatio: IBoolean
186
+ public lockRatio?: IBoolean
187
187
 
188
188
  @boundsType()
189
- public autoBox: IAutoBoxData | IConstraint
189
+ public autoBox?: IAutoBoxData | IConstraint
190
190
 
191
191
 
192
192
  @boundsType()
193
- public widthRange: IRangeSize
193
+ public widthRange?: IRangeSize
194
194
 
195
195
  @boundsType()
196
- public heightRange: IRangeSize
196
+ public heightRange?: IRangeSize
197
197
 
198
198
 
199
199
  // drag
200
200
  @dataType(false)
201
- public draggable: IBoolean | IAxis
201
+ public draggable?: IBoolean | IAxis
202
202
 
203
203
  @dataType()
204
204
  public dragBounds?: IBoundsData | 'parent'
205
205
 
206
206
 
207
207
  @dataType(false)
208
- public editable: IBoolean
208
+ public editable?: IBoolean
209
209
 
210
210
 
211
211
  // hit
212
212
  @hitType(true)
213
- public hittable: IBoolean
213
+ public hittable?: IBoolean
214
214
 
215
215
  @hitType('path')
216
- public hitFill: IHitType
216
+ public hitFill?: IHitType
217
217
 
218
218
  @strokeType('path')
219
- public hitStroke: IHitType
219
+ public hitStroke?: IHitType
220
220
 
221
221
  @hitType(false)
222
- public hitBox: IBoolean
222
+ public hitBox?: IBoolean
223
223
 
224
224
  @hitType(true)
225
- public hitChildren: IBoolean
225
+ public hitChildren?: IBoolean
226
226
 
227
227
  @hitType(true)
228
- public hitSelf: IBoolean
228
+ public hitSelf?: IBoolean
229
229
 
230
230
  @hitType()
231
- public hitRadius: INumber
231
+ public hitRadius?: INumber
232
232
 
233
233
  @cursorType('')
234
- public cursor: ICursorType | ICursorType[]
234
+ public cursor?: ICursorType | ICursorType[]
235
235
 
236
236
  // ---
237
237
 
@@ -239,91 +239,91 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
239
239
  // fill
240
240
 
241
241
  @surfaceType()
242
- public fill: IFill
242
+ public fill?: IFill
243
243
 
244
244
  // stroke
245
245
 
246
246
  @strokeType()
247
- public stroke: IStroke
247
+ public stroke?: IStroke
248
248
 
249
249
  @strokeType('inside')
250
- public strokeAlign: IStrokeAlign
250
+ public strokeAlign?: IStrokeAlign
251
251
 
252
252
  @strokeType(1)
253
- public strokeWidth: IFourNumber | IStrokeWidthString
253
+ public strokeWidth?: IFourNumber | IStrokeWidthString
254
254
 
255
255
  @strokeType(false)
256
- public strokeWidthFixed: IBoolean
256
+ public strokeWidthFixed?: IBoolean
257
257
 
258
258
  @strokeType('none')
259
- public strokeCap: IStrokeCap
259
+ public strokeCap?: IStrokeCap
260
260
 
261
261
  @strokeType('miter')
262
- public strokeJoin: IStrokeJoin
262
+ public strokeJoin?: IStrokeJoin
263
263
 
264
264
  @strokeType()
265
- public dashPattern: INumber[] | IDashPatternString
265
+ public dashPattern?: INumber[] | IDashPatternString
266
266
 
267
267
  @strokeType()
268
- public dashOffset: INumber
268
+ public dashOffset?: INumber
269
269
 
270
270
  @strokeType(10)
271
- public miterLimit: INumber
271
+ public miterLimit?: INumber
272
272
 
273
273
 
274
274
  // arrow
275
275
 
276
276
  @arrowType('none')
277
- public startArrow: IArrowType
277
+ public startArrow?: IArrowType
278
278
 
279
279
  @arrowType('none')
280
- public endArrow: IArrowType
280
+ public endArrow?: IArrowType
281
281
 
282
282
  // corner
283
283
 
284
284
  @pathType(0)
285
- public cornerRadius: IFourNumber | ICornerRadiusString
285
+ public cornerRadius?: IFourNumber | ICornerRadiusString
286
286
 
287
287
  @pathType()
288
- public cornerSmoothing: INumber
288
+ public cornerSmoothing?: INumber
289
289
 
290
290
  // effect
291
291
 
292
292
  @effectType()
293
- public shadow: IShadowEffect | IShadowEffect[] | IShadowString
293
+ public shadow?: IShadowEffect | IShadowEffect[] | IShadowString
294
294
 
295
295
  @effectType()
296
- public innerShadow: IShadowEffect | IShadowEffect[] | IShadowString
296
+ public innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString
297
297
 
298
298
  @effectType()
299
- public blur: INumber | IBlurEffect
299
+ public blur?: INumber | IBlurEffect
300
300
 
301
301
  @effectType()
302
- public backgroundBlur: INumber | IBlurEffect
302
+ public backgroundBlur?: INumber | IBlurEffect
303
303
 
304
304
  @effectType()
305
- public grayscale: INumber | IGrayscaleEffect
305
+ public grayscale?: INumber | IGrayscaleEffect
306
306
 
307
307
 
308
308
  // states
309
309
 
310
310
  @dataType()
311
- public normalStyle: IUIInputData // auto restore hover / press / focus / selected / disabled style
311
+ public normalStyle?: IUIInputData // auto restore hover / press / focus / selected / disabled style
312
312
 
313
313
  @dataType()
314
- public hoverStyle: IUIInputData
314
+ public hoverStyle?: IUIInputData
315
315
 
316
316
  @dataType()
317
- public pressStyle: IUIInputData
317
+ public pressStyle?: IUIInputData
318
318
 
319
319
  @dataType()
320
- public focusStyle: IUIInputData
320
+ public focusStyle?: IUIInputData
321
321
 
322
322
  @dataType()
323
- public selectedStyle: IUIInputData
323
+ public selectedStyle?: IUIInputData
324
324
 
325
325
  @dataType()
326
- public disabledStyle: IUIInputData
326
+ public disabledStyle?: IUIInputData
327
327
 
328
328
 
329
329
  // 预留给用户使用的数据对象
package/types/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D, IUnitData } from '@leafer/interface';
1
+ import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, 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, IUnitData } 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, 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, 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, IEditorConfig, IFindUIMethod, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, IUIJSONData, 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';
4
4
 
5
5
  declare class UI extends Leaf implements IUI {
6
6
  __: IUIData;
7
- proxyData: IUIInputData;
7
+ proxyData?: IUIInputData;
8
8
  __proxyData?: IUIInputData;
9
9
  get app(): ILeafer;
10
10
  leafer?: ILeafer;
@@ -12,87 +12,87 @@ declare class UI extends Leaf implements IUI {
12
12
  zoomLayer: IGroup;
13
13
  get isFrame(): boolean;
14
14
  children?: IUI[];
15
- id: IString;
16
- name: IString;
17
- className: IString;
18
- blendMode: IBlendMode;
19
- opacity: INumber;
20
- visible: IBoolean | 0;
21
- selected: IBoolean;
22
- disabled: IBoolean;
23
- locked: IBoolean;
24
- zIndex: INumber;
25
- mask: IBoolean | IMaskType;
26
- eraser: IBoolean | IEraserType;
27
- x: INumber;
28
- y: INumber;
29
- width: INumber;
30
- height: INumber;
31
- scaleX: INumber;
32
- scaleY: INumber;
33
- rotation: INumber;
34
- skewX: INumber;
35
- skewY: INumber;
36
- offsetX: INumber;
37
- offsetY: INumber;
38
- scrollX: INumber;
39
- scrollY: INumber;
40
- origin: IAlign | IUnitPointData;
41
- around: IAlign | IUnitPointData;
42
- lazy: IBoolean;
43
- pixelRatio: INumber;
44
- path: IPathCommandData | IPathString;
45
- windingRule: IWindingRule;
46
- closed: boolean;
47
- flow: IFlowType;
48
- padding: IFourNumber;
49
- gap: IGap | IPointGap;
50
- flowAlign: IFlowAlign | IFlowAxisAlign;
51
- flowWrap: IFlowWrap;
52
- itemBox: IFlowBoxType;
53
- inFlow: IBoolean;
54
- autoWidth: IAutoSize;
55
- autoHeight: IAutoSize;
56
- lockRatio: IBoolean;
57
- autoBox: IAutoBoxData | IConstraint;
58
- widthRange: IRangeSize;
59
- heightRange: IRangeSize;
60
- draggable: IBoolean | IAxis;
15
+ id?: IString;
16
+ name?: IString;
17
+ className?: IString;
18
+ blendMode?: IBlendMode;
19
+ opacity?: INumber;
20
+ visible?: IBoolean | 0;
21
+ selected?: IBoolean;
22
+ disabled?: IBoolean;
23
+ locked?: IBoolean;
24
+ zIndex?: INumber;
25
+ mask?: IBoolean | IMaskType;
26
+ eraser?: IBoolean | IEraserType;
27
+ x?: INumber;
28
+ y?: INumber;
29
+ width?: INumber;
30
+ height?: INumber;
31
+ scaleX?: INumber;
32
+ scaleY?: INumber;
33
+ rotation?: INumber;
34
+ skewX?: INumber;
35
+ skewY?: INumber;
36
+ offsetX?: INumber;
37
+ offsetY?: INumber;
38
+ scrollX?: INumber;
39
+ scrollY?: INumber;
40
+ origin?: IAlign | IUnitPointData;
41
+ around?: IAlign | IUnitPointData;
42
+ lazy?: IBoolean;
43
+ pixelRatio?: INumber;
44
+ path?: IPathCommandData | IPathString;
45
+ windingRule?: IWindingRule;
46
+ closed?: boolean;
47
+ flow?: IFlowType;
48
+ padding?: IFourNumber;
49
+ gap?: IGap | IPointGap;
50
+ flowAlign?: IFlowAlign | IFlowAxisAlign;
51
+ flowWrap?: IFlowWrap;
52
+ itemBox?: IFlowBoxType;
53
+ inFlow?: IBoolean;
54
+ autoWidth?: IAutoSize;
55
+ autoHeight?: IAutoSize;
56
+ lockRatio?: IBoolean;
57
+ autoBox?: IAutoBoxData | IConstraint;
58
+ widthRange?: IRangeSize;
59
+ heightRange?: IRangeSize;
60
+ draggable?: IBoolean | IAxis;
61
61
  dragBounds?: IBoundsData | 'parent';
62
- editable: IBoolean;
63
- hittable: IBoolean;
64
- hitFill: IHitType;
65
- hitStroke: IHitType;
66
- hitBox: IBoolean;
67
- hitChildren: IBoolean;
68
- hitSelf: IBoolean;
69
- hitRadius: INumber;
70
- cursor: ICursorType | ICursorType[];
71
- fill: IFill;
72
- stroke: IStroke;
73
- strokeAlign: IStrokeAlign;
74
- strokeWidth: IFourNumber | IStrokeWidthString;
75
- strokeWidthFixed: IBoolean;
76
- strokeCap: IStrokeCap;
77
- strokeJoin: IStrokeJoin;
78
- dashPattern: INumber[] | IDashPatternString;
79
- dashOffset: INumber;
80
- miterLimit: INumber;
81
- startArrow: IArrowType;
82
- endArrow: IArrowType;
83
- cornerRadius: IFourNumber | ICornerRadiusString;
84
- cornerSmoothing: INumber;
85
- shadow: IShadowEffect | IShadowEffect[] | IShadowString;
86
- innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
87
- blur: INumber | IBlurEffect;
88
- backgroundBlur: INumber | IBlurEffect;
89
- grayscale: INumber | IGrayscaleEffect;
90
- normalStyle: IUIInputData;
91
- hoverStyle: IUIInputData;
92
- pressStyle: IUIInputData;
93
- focusStyle: IUIInputData;
94
- selectedStyle: IUIInputData;
95
- disabledStyle: IUIInputData;
62
+ editable?: IBoolean;
63
+ hittable?: IBoolean;
64
+ hitFill?: IHitType;
65
+ hitStroke?: IHitType;
66
+ hitBox?: IBoolean;
67
+ hitChildren?: IBoolean;
68
+ hitSelf?: IBoolean;
69
+ hitRadius?: INumber;
70
+ cursor?: ICursorType | ICursorType[];
71
+ fill?: IFill;
72
+ stroke?: IStroke;
73
+ strokeAlign?: IStrokeAlign;
74
+ strokeWidth?: IFourNumber | IStrokeWidthString;
75
+ strokeWidthFixed?: IBoolean;
76
+ strokeCap?: IStrokeCap;
77
+ strokeJoin?: IStrokeJoin;
78
+ dashPattern?: INumber[] | IDashPatternString;
79
+ dashOffset?: INumber;
80
+ miterLimit?: INumber;
81
+ startArrow?: IArrowType;
82
+ endArrow?: IArrowType;
83
+ cornerRadius?: IFourNumber | ICornerRadiusString;
84
+ cornerSmoothing?: INumber;
85
+ shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
86
+ innerShadow?: IShadowEffect | IShadowEffect[] | IShadowString;
87
+ blur?: INumber | IBlurEffect;
88
+ backgroundBlur?: INumber | IBlurEffect;
89
+ grayscale?: INumber | IGrayscaleEffect;
90
+ normalStyle?: IUIInputData;
91
+ hoverStyle?: IUIInputData;
92
+ pressStyle?: IUIInputData;
93
+ focusStyle?: IUIInputData;
94
+ selectedStyle?: IUIInputData;
95
+ disabledStyle?: IUIInputData;
96
96
  data: IObject;
97
97
  set scale(value: INumber | IPointData);
98
98
  get scale(): INumber | IPointData;
@@ -138,7 +138,7 @@ declare class Group extends UI implements IGroup {
138
138
  reset(data?: IGroupInputData): void;
139
139
  __setBranch(): void;
140
140
  set(data: IUIInputData): void;
141
- toJSON(): IUIInputData;
141
+ toJSON(options?: IJSONOptions): IUIJSONData;
142
142
  pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult;
143
143
  addAt(child: IUI, index: number): void;
144
144
  addAfter(child: IUI, after: IUI): void;
@@ -154,7 +154,7 @@ declare class Leafer extends Group implements ILeafer {
154
154
  static list: LeafList;
155
155
  get __tag(): string;
156
156
  __: ILeaferData;
157
- pixelRatio: INumber;
157
+ pixelRatio?: INumber;
158
158
  get isApp(): boolean;
159
159
  get app(): ILeafer;
160
160
  get isLeafer(): boolean;
@@ -242,8 +242,8 @@ declare class Box extends Group implements IBox {
242
242
  get __tag(): string;
243
243
  get isBranchLeaf(): boolean;
244
244
  __: IBoxData;
245
- resizeChildren: IBoolean;
246
- overflow: IOverflow;
245
+ resizeChildren?: IBoolean;
246
+ overflow?: IOverflow;
247
247
  isOverflow: boolean;
248
248
  constructor(data?: IBoxInputData);
249
249
  __updateStrokeSpread(): number;
@@ -266,8 +266,8 @@ declare class Frame extends Box implements IFrame {
266
266
  get __tag(): string;
267
267
  get isFrame(): boolean;
268
268
  __: IFrameData;
269
- fill: IFill;
270
- overflow: IOverflow;
269
+ fill?: IFill;
270
+ overflow?: IOverflow;
271
271
  constructor(data?: IFrameInputData);
272
272
  }
273
273
 
@@ -280,9 +280,9 @@ declare class Rect extends UI implements IRect {
280
280
  declare class Ellipse extends UI implements IEllipse {
281
281
  get __tag(): string;
282
282
  __: IEllipseData;
283
- innerRadius: INumber;
284
- startAngle: INumber;
285
- endAngle: INumber;
283
+ innerRadius?: INumber;
284
+ startAngle?: INumber;
285
+ endAngle?: INumber;
286
286
  constructor(data?: IEllipseInputData);
287
287
  __updatePath(): void;
288
288
  }
@@ -290,9 +290,9 @@ declare class Ellipse extends UI implements IEllipse {
290
290
  declare class Polygon extends UI implements IPolygon {
291
291
  get __tag(): string;
292
292
  __: IPolygonData;
293
- sides: INumber;
294
- points: number[];
295
- curve: boolean | number;
293
+ sides?: INumber;
294
+ points?: number[];
295
+ curve?: boolean | number;
296
296
  constructor(data?: IPolygonInputData);
297
297
  __updatePath(): void;
298
298
  __updateRenderPath(): void;
@@ -302,8 +302,8 @@ declare class Polygon extends UI implements IPolygon {
302
302
  declare class Star extends UI implements IStar {
303
303
  get __tag(): string;
304
304
  __: IStarData;
305
- corners: INumber;
306
- innerRadius: INumber;
305
+ corners?: INumber;
306
+ innerRadius?: INumber;
307
307
  constructor(data?: IStarInputData);
308
308
  __updatePath(): void;
309
309
  }
@@ -311,11 +311,11 @@ declare class Star extends UI implements IStar {
311
311
  declare class Line extends UI implements ILine {
312
312
  get __tag(): string;
313
313
  __: ILineData;
314
- strokeAlign: IStrokeAlign;
315
- height: INumber;
316
- points: number[];
317
- curve: boolean | number;
318
- closed: boolean;
314
+ strokeAlign?: IStrokeAlign;
315
+ height?: INumber;
316
+ points?: number[];
317
+ curve?: boolean | number;
318
+ closed?: boolean;
319
319
  get toPoint(): IPointData;
320
320
  set toPoint(value: IPointData);
321
321
  constructor(data?: ILineInputData);
@@ -329,7 +329,7 @@ declare class Image extends Rect implements IImage {
329
329
  __: IImageData;
330
330
  url: IString;
331
331
  get ready(): boolean;
332
- image: ILeaferImage;
332
+ image?: ILeaferImage;
333
333
  constructor(data?: IImageInputData);
334
334
  destroy(): void;
335
335
  }
@@ -337,13 +337,13 @@ declare class Image extends Rect implements IImage {
337
337
  declare class Canvas extends Rect implements ICanvas {
338
338
  get __tag(): string;
339
339
  __: ICanvasData;
340
- width: INumber;
341
- height: INumber;
342
- pixelRatio: INumber;
343
- smooth: boolean;
344
- contextSettings: ICanvasContext2DSettings;
345
- canvas: ILeaferCanvas;
346
- context: ICanvasContext2D;
340
+ width?: INumber;
341
+ height?: INumber;
342
+ pixelRatio?: INumber;
343
+ smooth?: boolean;
344
+ contextSettings?: ICanvasContext2DSettings;
345
+ canvas?: ILeaferCanvas;
346
+ context?: ICanvasContext2D;
347
347
  constructor(data?: ICanvasInputData);
348
348
  draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void;
349
349
  paint(): void;
@@ -355,27 +355,27 @@ declare class Canvas extends Rect implements ICanvas {
355
355
  declare class Text extends UI implements IText {
356
356
  get __tag(): string;
357
357
  __: ITextData;
358
- width: INumber;
359
- height: INumber;
360
- resizeFontSize: IBoolean;
361
- fill: IFill;
362
- strokeAlign: IStrokeAlign;
363
- hitFill: IHitType$1;
364
- text: IString;
365
- fontFamily: IString;
366
- fontSize: INumber;
367
- fontWeight: IFontWeight;
368
- italic: IBoolean;
369
- textCase: ITextCase;
370
- textDecoration: ITextDecoration;
371
- letterSpacing: INumber | IUnitData;
372
- lineHeight: INumber | IUnitData;
373
- paraIndent: INumber;
374
- paraSpacing: INumber;
375
- textAlign: ITextAlign;
376
- verticalAlign: IVerticalAlign;
377
- textWrap: ITextWrap;
378
- textOverflow: IOverflow | string;
358
+ width?: INumber;
359
+ height?: INumber;
360
+ resizeFontSize?: IBoolean;
361
+ fill?: IFill;
362
+ strokeAlign?: IStrokeAlign;
363
+ hitFill?: IHitType$1;
364
+ text?: IString;
365
+ fontFamily?: IString;
366
+ fontSize?: INumber;
367
+ fontWeight?: IFontWeight;
368
+ italic?: IBoolean;
369
+ textCase?: ITextCase;
370
+ textDecoration?: ITextDecoration;
371
+ letterSpacing?: INumber | IUnitData;
372
+ lineHeight?: INumber | IUnitData;
373
+ paraIndent?: INumber;
374
+ paraSpacing?: INumber;
375
+ textAlign?: ITextAlign;
376
+ verticalAlign?: IVerticalAlign;
377
+ textWrap?: ITextWrap;
378
+ textOverflow?: IOverflow | string;
379
379
  get editInner(): string;
380
380
  get textDrawData(): ITextDrawData;
381
381
  constructor(data?: ITextInputData);
@@ -391,7 +391,7 @@ declare class Text extends UI implements IText {
391
391
  declare class Path extends UI implements IPath {
392
392
  get __tag(): string;
393
393
  __: IPathData;
394
- strokeAlign: IStrokeAlign;
394
+ strokeAlign?: IStrokeAlign;
395
395
  constructor(data?: IPathInputData);
396
396
  }
397
397