@leafer-ui/core 1.0.0-beta.12 → 1.0.0-beta.15

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/dist/core.cjs ADDED
@@ -0,0 +1,1848 @@
1
+ 'use strict';
2
+
3
+ var core = require('@leafer/core');
4
+
5
+ /******************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+ /* global Reflect, Promise, SuppressedError, Symbol */
20
+
21
+
22
+ function __decorate(decorators, target, key, desc) {
23
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
26
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
27
+ }
28
+
29
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
30
+ var e = new Error(message);
31
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
32
+ };
33
+
34
+ function draw(leafer) {
35
+ const { config } = leafer;
36
+ config.move.dragOut = false;
37
+ }
38
+
39
+ function design(leafer) {
40
+ if (leafer.isApp)
41
+ return;
42
+ leafer.__eventIds.push(leafer.on_(core.MoveEvent.BEFORE_MOVE, (e) => { core.LeafHelper.moveWorld(leafer.moveLayer, e.moveX, e.moveY); }), leafer.on_(core.ZoomEvent.BEFORE_ZOOM, (e) => {
43
+ const { scaleX } = leafer.zoomLayer.__, { min, max } = leafer.config.zoom;
44
+ let { scale } = e;
45
+ if (scale * Math.abs(scaleX) < min)
46
+ scale = min / scaleX;
47
+ else if (scale * Math.abs(scaleX) > max)
48
+ scale = max / scaleX;
49
+ if (scale !== 1)
50
+ core.LeafHelper.zoomOfWorld(leafer.zoomLayer, e, scale);
51
+ }));
52
+ }
53
+
54
+ const debug$2 = core.Debug.get('LeaferTypeCreator');
55
+ const LeaferTypeCreator = {
56
+ list: {},
57
+ register(name, fn) {
58
+ if (list[name]) {
59
+ debug$2.repeat(name);
60
+ }
61
+ else {
62
+ list[name] = fn;
63
+ }
64
+ },
65
+ run(name, leafer) {
66
+ const fn = LeaferTypeCreator.list[name];
67
+ if (fn) {
68
+ fn(leafer);
69
+ }
70
+ else {
71
+ debug$2.error('no', name);
72
+ }
73
+ }
74
+ };
75
+ const { list } = LeaferTypeCreator;
76
+ LeaferTypeCreator.register('draw', draw);
77
+ LeaferTypeCreator.register('user', draw);
78
+ LeaferTypeCreator.register('design', design);
79
+
80
+ const Effect = {};
81
+ const Paint = {};
82
+ const Animate = {};
83
+ const TextConvert = {};
84
+ const ColorConvert = {};
85
+ const Export = {};
86
+
87
+ const emptyPaint = {};
88
+ const debug$1 = core.Debug.get('UIData');
89
+ class UIData extends core.LeafData {
90
+ setVisible(value) {
91
+ if (this.__leaf.leafer)
92
+ this.__leaf.leafer.watcher.hasVisible = true;
93
+ this._visible = value;
94
+ }
95
+ setWidth(value) {
96
+ if (value < 0) {
97
+ this._width = -value;
98
+ this.__leaf.scaleX *= -1;
99
+ debug$1.warn('width < 0, instead -scaleX ', this);
100
+ }
101
+ else {
102
+ this._width = value;
103
+ }
104
+ }
105
+ setHeight(value) {
106
+ if (value < 0) {
107
+ this._height = -value;
108
+ this.__leaf.scaleY *= -1;
109
+ debug$1.warn('height < 0, instead -scaleY', this);
110
+ }
111
+ else {
112
+ this._height = value;
113
+ }
114
+ }
115
+ setFill(value) {
116
+ if (this.__naturalWidth)
117
+ this.__naturalWidth = this.__naturalHeight = undefined;
118
+ if (typeof value === 'string' || !value) {
119
+ if (this.__isFills) {
120
+ this.__removeInput('fill');
121
+ Paint.recycleImage(this, 'fill');
122
+ this.__isFills = false;
123
+ }
124
+ this._fill = value;
125
+ }
126
+ else if (typeof value === 'object') {
127
+ this.__setInput('fill', value);
128
+ this.__leaf.__layout.boxChanged || this.__leaf.__layout.boxChange();
129
+ this.__isFills = true;
130
+ this._fill || (this._fill = emptyPaint);
131
+ }
132
+ }
133
+ setStroke(value) {
134
+ if (typeof value === 'string' || !value) {
135
+ if (this.__isStrokes) {
136
+ this.__removeInput('stroke');
137
+ Paint.recycleImage(this, 'stroke');
138
+ this.__isStrokes = false;
139
+ }
140
+ this._stroke = value;
141
+ }
142
+ else if (typeof value === 'object') {
143
+ this.__setInput('stroke', value);
144
+ this.__leaf.__layout.boxChanged || this.__leaf.__layout.boxChange();
145
+ this.__isStrokes = true;
146
+ this._stroke || (this._stroke = emptyPaint);
147
+ }
148
+ }
149
+ setShadow(value) {
150
+ this.__setInput('shadow', value);
151
+ if (value instanceof Array) {
152
+ if (value.some((item) => item.visible === false))
153
+ value = value.filter((item) => item.visible !== false);
154
+ this._shadow = value.length ? value : null;
155
+ }
156
+ else if (value) {
157
+ this._shadow = value.visible === false ? null : [value];
158
+ }
159
+ else {
160
+ this._shadow = null;
161
+ }
162
+ }
163
+ setInnerShadow(value) {
164
+ this.__setInput('innerShadow', value);
165
+ if (value instanceof Array) {
166
+ if (value.some((item) => item.visible === false))
167
+ value = value.filter((item) => item.visible !== false);
168
+ this._innerShadow = value.length ? value : null;
169
+ }
170
+ else if (value) {
171
+ this._innerShadow = value.visible === false ? null : [value];
172
+ }
173
+ else {
174
+ this._innerShadow = null;
175
+ }
176
+ }
177
+ }
178
+ const UnitConvert = {
179
+ number(value, percentRefer) {
180
+ if (typeof value === 'object')
181
+ return value.type === 'percent' ? value.value / 100 * percentRefer : value.value;
182
+ return value;
183
+ }
184
+ };
185
+
186
+ class GroupData extends UIData {
187
+ }
188
+
189
+ class BoxData extends GroupData {
190
+ get __boxStroke() { return true; }
191
+ }
192
+
193
+ class LeaferData extends GroupData {
194
+ }
195
+
196
+ class FrameData extends BoxData {
197
+ }
198
+
199
+ class LineData extends UIData {
200
+ }
201
+
202
+ class RectData extends UIData {
203
+ get __boxStroke() { return true; }
204
+ }
205
+
206
+ class EllipseData extends UIData {
207
+ get __boxStroke() { return true; }
208
+ }
209
+
210
+ class PolygonData extends UIData {
211
+ }
212
+
213
+ class StarData extends UIData {
214
+ }
215
+
216
+ const { parse } = core.PathConvert;
217
+ class PathData extends UIData {
218
+ setPath(value) {
219
+ if (typeof value === 'string') {
220
+ this.__setInput('path', value);
221
+ this._path = parse(value);
222
+ }
223
+ else {
224
+ if (this.__input)
225
+ this.__removeInput('path');
226
+ this._path = value;
227
+ }
228
+ }
229
+ }
230
+
231
+ class PenData extends GroupData {
232
+ }
233
+
234
+ const fontWeightMap = {
235
+ 'thin': 100,
236
+ 'extra-light': 200,
237
+ 'light': 300,
238
+ 'normal': 400,
239
+ 'medium': 500,
240
+ 'semi-bold': 600,
241
+ 'bold': 700,
242
+ 'extra-bold': 800,
243
+ 'black': 900
244
+ };
245
+ class TextData extends UIData {
246
+ setFontWeight(value) {
247
+ if (typeof value === 'string') {
248
+ this.__setInput('fontWeight', value);
249
+ this._fontWeight = fontWeightMap[value] || 400;
250
+ }
251
+ else {
252
+ if (this.__input)
253
+ this.__removeInput('fontWeight');
254
+ this._fontWeight = value;
255
+ }
256
+ }
257
+ }
258
+
259
+ class ImageData extends RectData {
260
+ }
261
+
262
+ function effectType(defaultValue) {
263
+ return (target, key) => {
264
+ core.defineLeafAttr(target, key, defaultValue, {
265
+ set(value) {
266
+ this.__setAttr(key, value);
267
+ if (value)
268
+ this.__.__useEffect = true;
269
+ this.__layout.renderChanged || this.__layout.renderChange();
270
+ }
271
+ });
272
+ };
273
+ }
274
+ function resizeType(defaultValue) {
275
+ return (target, key) => {
276
+ core.defineLeafAttr(target, key, defaultValue, {
277
+ set(value) {
278
+ this.__setAttr(key, value);
279
+ this.__layout.boxChanged || this.__layout.boxChange();
280
+ this.__updateSize();
281
+ }
282
+ });
283
+ };
284
+ }
285
+
286
+ const UIBounds = {
287
+ __updateStrokeSpread() {
288
+ let width = 0, boxWidth = 0;
289
+ const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__;
290
+ if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
291
+ boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
292
+ if (!this.__.__boxStroke) {
293
+ const { miterLimit, strokeCap } = this.__;
294
+ const miterLimitAddWidth = this.__tag !== 'Line' ? 1 / Math.sin(miterLimit * core.OneRadian / 2) * Math.sqrt(strokeWidth) - width : 0;
295
+ const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
296
+ width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
297
+ }
298
+ }
299
+ this.__layout.strokeBoxSpread = boxWidth;
300
+ return width;
301
+ },
302
+ __updateRenderSpread() {
303
+ let width = 0;
304
+ const { shadow, innerShadow, blur, backgroundBlur } = this.__;
305
+ if (shadow)
306
+ shadow.forEach(item => {
307
+ width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
308
+ });
309
+ if (blur)
310
+ width = Math.max(width, blur);
311
+ let shapeWidth = width = Math.ceil(width);
312
+ if (innerShadow)
313
+ innerShadow.forEach(item => {
314
+ shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
315
+ });
316
+ if (backgroundBlur)
317
+ shapeWidth = Math.max(shapeWidth, backgroundBlur);
318
+ this.__layout.renderShapeSpread = shapeWidth;
319
+ return width;
320
+ }
321
+ };
322
+
323
+ const UIHit = {
324
+ __updateHitCanvas() {
325
+ if (!this.__hitCanvas)
326
+ this.__hitCanvas = this.leafer.hitCanvasManager.getPathType(this);
327
+ const h = this.__hitCanvas;
328
+ this.__drawHitPath(h);
329
+ h.setStrokeOptions(this.__);
330
+ },
331
+ __hit(inner) {
332
+ const { __hitCanvas: h } = this;
333
+ if (core.Platform.name === 'miniapp')
334
+ this.__drawHitPath(h);
335
+ const { fill, hitFill, windingRule } = this.__;
336
+ const needHitFill = (fill && hitFill === 'path') || hitFill === 'all';
337
+ const isHitFill = h.hitFill(inner, windingRule);
338
+ if (needHitFill && isHitFill)
339
+ return true;
340
+ const { stroke, hitStroke, strokeWidth, strokeAlign } = this.__;
341
+ const needHitStroke = (stroke && hitStroke === 'path') || hitStroke === 'all';
342
+ const radiusWidth = inner.radiusX * 2;
343
+ let hitWidth = radiusWidth;
344
+ if (needHitStroke) {
345
+ switch (strokeAlign) {
346
+ case 'inside':
347
+ hitWidth += strokeWidth * 2;
348
+ if (!needHitFill && (isHitFill && h.hitStroke(inner, hitWidth)))
349
+ return true;
350
+ hitWidth = radiusWidth;
351
+ break;
352
+ case 'center':
353
+ hitWidth += strokeWidth;
354
+ break;
355
+ case 'outside':
356
+ hitWidth += strokeWidth * 2;
357
+ if (!needHitFill) {
358
+ if (!isHitFill && h.hitStroke(inner, hitWidth))
359
+ return true;
360
+ hitWidth = radiusWidth;
361
+ }
362
+ break;
363
+ }
364
+ }
365
+ return hitWidth ? h.hitStroke(inner, hitWidth) : false;
366
+ }
367
+ };
368
+
369
+ const UIRender = {
370
+ __updateChange() {
371
+ const data = this.__;
372
+ if (data.__useEffect) {
373
+ const { shadow, innerShadow, blur, backgroundBlur } = this.__;
374
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
375
+ }
376
+ data.__checkSingle();
377
+ const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
378
+ if (complex) {
379
+ data.__complex = true;
380
+ }
381
+ else {
382
+ data.__complex && (data.__complex = false);
383
+ }
384
+ },
385
+ __drawFast(canvas, options) {
386
+ const { fill, stroke, __drawAfterFill } = this.__;
387
+ this.__drawRenderPath(canvas);
388
+ if (fill)
389
+ Paint.fill(this, canvas, fill);
390
+ if (__drawAfterFill)
391
+ this.__drawAfterFill(canvas, options);
392
+ if (stroke)
393
+ Paint.stroke(this, canvas, stroke);
394
+ },
395
+ __draw(canvas, options) {
396
+ if (this.__.__complex) {
397
+ const { fill, stroke, __drawAfterFill } = this.__;
398
+ this.__drawRenderPath(canvas);
399
+ if (this.__.__useEffect) {
400
+ const shape = Paint.shape(this, canvas, options);
401
+ const { shadow, innerShadow } = this.__;
402
+ if (shadow)
403
+ Effect.shadow(this, canvas, shape, options);
404
+ if (fill)
405
+ this.__.__isFills ? Paint.fills(this, canvas, fill) : Paint.fill(this, canvas, fill);
406
+ if (__drawAfterFill)
407
+ this.__drawAfterFill(canvas, options);
408
+ if (innerShadow)
409
+ Effect.innerShadow(this, canvas, shape, options);
410
+ if (stroke)
411
+ this.__.__isStrokes ? Paint.strokes(this, canvas, stroke) : Paint.stroke(this, canvas, stroke);
412
+ if (shape.worldCanvas)
413
+ shape.worldCanvas.recycle();
414
+ shape.canvas.recycle();
415
+ }
416
+ else {
417
+ if (fill)
418
+ this.__.__isFills ? Paint.fills(this, canvas, fill) : Paint.fill(this, canvas, fill);
419
+ if (__drawAfterFill)
420
+ this.__drawAfterFill(canvas, options);
421
+ if (stroke)
422
+ this.__.__isStrokes ? Paint.strokes(this, canvas, stroke) : Paint.stroke(this, canvas, stroke);
423
+ }
424
+ }
425
+ else {
426
+ this.__drawFast(canvas, options);
427
+ }
428
+ },
429
+ __renderShape(canvas, options) {
430
+ if (!this.__worldOpacity)
431
+ return;
432
+ canvas.setWorld(this.__world, options.matrix);
433
+ const { fill, stroke } = this.__;
434
+ this.__drawRenderPath(canvas);
435
+ if (fill)
436
+ Paint.fill(this, canvas, '#000000');
437
+ if (stroke)
438
+ Paint.stroke(this, canvas, '#000000');
439
+ }
440
+ };
441
+
442
+ const RectRender = {
443
+ __drawFast(canvas, options) {
444
+ const { width, height, fill, stroke, __drawAfterFill } = this.__;
445
+ if (fill) {
446
+ canvas.fillStyle = fill;
447
+ canvas.fillRect(0, 0, width, height);
448
+ }
449
+ if (__drawAfterFill)
450
+ this.__drawAfterFill(canvas, options);
451
+ if (stroke) {
452
+ const { strokeAlign, strokeWidth } = this.__;
453
+ canvas.setStroke(stroke, strokeWidth, this.__);
454
+ const half = strokeWidth / 2;
455
+ switch (strokeAlign) {
456
+ case 'center':
457
+ canvas.strokeRect(0, 0, width, height);
458
+ break;
459
+ case 'inside':
460
+ canvas.strokeRect(half, half, width - strokeWidth, height - strokeWidth);
461
+ break;
462
+ case 'outside':
463
+ canvas.strokeRect(-half, -half, width + strokeWidth, height + strokeWidth);
464
+ break;
465
+ }
466
+ }
467
+ }
468
+ };
469
+
470
+ var UI_1;
471
+ exports.UI = UI_1 = class UI extends core.Leaf {
472
+ set scale(value) {
473
+ if (typeof value === 'number') {
474
+ this.scaleX = this.scaleY = value;
475
+ }
476
+ else {
477
+ this.scaleX = value.x;
478
+ this.scaleY = value.y;
479
+ }
480
+ }
481
+ get scale() {
482
+ const { scaleX, scaleY } = this;
483
+ return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
484
+ }
485
+ constructor(data) {
486
+ super(data);
487
+ }
488
+ set(data) {
489
+ Object.assign(this, data);
490
+ }
491
+ get() {
492
+ return this.__.__getInputData();
493
+ }
494
+ getPath(curve) {
495
+ const path = this.__.path;
496
+ if (!path)
497
+ return [];
498
+ return curve ? core.PathConvert.toCanvasData(path, true) : path;
499
+ }
500
+ getPathString(curve) {
501
+ return core.PathConvert.stringify(this.getPath(curve));
502
+ }
503
+ __onUpdateSize() {
504
+ if (this.__.__input) {
505
+ const { fill, stroke } = this.__.__input;
506
+ if (fill)
507
+ Paint.compute(this, 'fill');
508
+ if (stroke)
509
+ Paint.compute(this, 'stroke');
510
+ }
511
+ }
512
+ __updateRenderPath() {
513
+ if (this.__.path) {
514
+ const { __: data } = this;
515
+ data.__pathForRender = data.cornerRadius ? core.PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
516
+ }
517
+ }
518
+ __drawRenderPath(canvas) {
519
+ canvas.beginPath();
520
+ this.__drawPathByData(canvas, this.__.__pathForRender);
521
+ }
522
+ __drawPath(canvas) {
523
+ canvas.beginPath();
524
+ this.__drawPathByData(canvas, this.__.path);
525
+ }
526
+ __drawPathByData(_drawer, _data) { }
527
+ export(filename, options) {
528
+ return Export.export(this, filename, options);
529
+ }
530
+ clone() {
531
+ return UI_1.one(this.toJSON());
532
+ }
533
+ static one(data, x, y, width, height) {
534
+ return core.UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
535
+ }
536
+ destroy() {
537
+ this.fill = this.stroke = null;
538
+ super.destroy();
539
+ }
540
+ };
541
+ __decorate([
542
+ core.dataProcessor(UIData)
543
+ ], exports.UI.prototype, "__", void 0);
544
+ __decorate([
545
+ core.dataType('')
546
+ ], exports.UI.prototype, "id", void 0);
547
+ __decorate([
548
+ core.dataType('')
549
+ ], exports.UI.prototype, "name", void 0);
550
+ __decorate([
551
+ core.dataType('')
552
+ ], exports.UI.prototype, "className", void 0);
553
+ __decorate([
554
+ core.surfaceType('pass-through')
555
+ ], exports.UI.prototype, "blendMode", void 0);
556
+ __decorate([
557
+ core.opacityType(1)
558
+ ], exports.UI.prototype, "opacity", void 0);
559
+ __decorate([
560
+ core.opacityType(true)
561
+ ], exports.UI.prototype, "visible", void 0);
562
+ __decorate([
563
+ core.maskType(false)
564
+ ], exports.UI.prototype, "isMask", void 0);
565
+ __decorate([
566
+ core.eraserType(false)
567
+ ], exports.UI.prototype, "isEraser", void 0);
568
+ __decorate([
569
+ core.sortType(0)
570
+ ], exports.UI.prototype, "zIndex", void 0);
571
+ __decorate([
572
+ core.dataType()
573
+ ], exports.UI.prototype, "locked", void 0);
574
+ __decorate([
575
+ core.positionType(0)
576
+ ], exports.UI.prototype, "x", void 0);
577
+ __decorate([
578
+ core.positionType(0)
579
+ ], exports.UI.prototype, "y", void 0);
580
+ __decorate([
581
+ core.boundsType(100)
582
+ ], exports.UI.prototype, "width", void 0);
583
+ __decorate([
584
+ core.boundsType(100)
585
+ ], exports.UI.prototype, "height", void 0);
586
+ __decorate([
587
+ core.scaleType(1)
588
+ ], exports.UI.prototype, "scaleX", void 0);
589
+ __decorate([
590
+ core.scaleType(1)
591
+ ], exports.UI.prototype, "scaleY", void 0);
592
+ __decorate([
593
+ core.rotationType(0)
594
+ ], exports.UI.prototype, "rotation", void 0);
595
+ __decorate([
596
+ core.rotationType(0)
597
+ ], exports.UI.prototype, "skewX", void 0);
598
+ __decorate([
599
+ core.rotationType(0)
600
+ ], exports.UI.prototype, "skewY", void 0);
601
+ __decorate([
602
+ core.positionType()
603
+ ], exports.UI.prototype, "around", void 0);
604
+ __decorate([
605
+ core.dataType(false)
606
+ ], exports.UI.prototype, "draggable", void 0);
607
+ __decorate([
608
+ core.hitType(true)
609
+ ], exports.UI.prototype, "hittable", void 0);
610
+ __decorate([
611
+ core.hitType('path')
612
+ ], exports.UI.prototype, "hitFill", void 0);
613
+ __decorate([
614
+ core.strokeType('path')
615
+ ], exports.UI.prototype, "hitStroke", void 0);
616
+ __decorate([
617
+ core.hitType(true)
618
+ ], exports.UI.prototype, "hitChildren", void 0);
619
+ __decorate([
620
+ core.hitType(true)
621
+ ], exports.UI.prototype, "hitSelf", void 0);
622
+ __decorate([
623
+ core.hitType()
624
+ ], exports.UI.prototype, "hitRadius", void 0);
625
+ __decorate([
626
+ core.cursorType('default')
627
+ ], exports.UI.prototype, "cursor", void 0);
628
+ __decorate([
629
+ core.surfaceType()
630
+ ], exports.UI.prototype, "fill", void 0);
631
+ __decorate([
632
+ core.strokeType()
633
+ ], exports.UI.prototype, "stroke", void 0);
634
+ __decorate([
635
+ core.strokeType('inside')
636
+ ], exports.UI.prototype, "strokeAlign", void 0);
637
+ __decorate([
638
+ core.strokeType(1)
639
+ ], exports.UI.prototype, "strokeWidth", void 0);
640
+ __decorate([
641
+ core.strokeType('none')
642
+ ], exports.UI.prototype, "strokeCap", void 0);
643
+ __decorate([
644
+ core.strokeType('miter')
645
+ ], exports.UI.prototype, "strokeJoin", void 0);
646
+ __decorate([
647
+ core.strokeType()
648
+ ], exports.UI.prototype, "dashPattern", void 0);
649
+ __decorate([
650
+ core.strokeType()
651
+ ], exports.UI.prototype, "dashOffset", void 0);
652
+ __decorate([
653
+ core.strokeType(10)
654
+ ], exports.UI.prototype, "miterLimit", void 0);
655
+ __decorate([
656
+ core.pathType()
657
+ ], exports.UI.prototype, "cornerRadius", void 0);
658
+ __decorate([
659
+ core.pathType()
660
+ ], exports.UI.prototype, "cornerSmoothing", void 0);
661
+ __decorate([
662
+ effectType()
663
+ ], exports.UI.prototype, "shadow", void 0);
664
+ __decorate([
665
+ effectType()
666
+ ], exports.UI.prototype, "innerShadow", void 0);
667
+ __decorate([
668
+ effectType()
669
+ ], exports.UI.prototype, "blur", void 0);
670
+ __decorate([
671
+ effectType()
672
+ ], exports.UI.prototype, "backgroundBlur", void 0);
673
+ __decorate([
674
+ effectType()
675
+ ], exports.UI.prototype, "grayscale", void 0);
676
+ __decorate([
677
+ core.rewrite(core.PathDrawer.drawPathByData)
678
+ ], exports.UI.prototype, "__drawPathByData", null);
679
+ exports.UI = UI_1 = __decorate([
680
+ core.useModule(UIBounds),
681
+ core.useModule(UIHit),
682
+ core.useModule(UIRender),
683
+ core.rewriteAble()
684
+ ], exports.UI);
685
+
686
+ exports.Group = class Group extends exports.UI {
687
+ get __tag() { return 'Group'; }
688
+ get resizeable() { return false; }
689
+ set mask(child) {
690
+ if (this.__hasMask)
691
+ this.__removeMask();
692
+ if (child) {
693
+ child.isMask = true;
694
+ this.addAt(child, 0);
695
+ }
696
+ }
697
+ get mask() {
698
+ return this.children.find(item => item.isMask);
699
+ }
700
+ constructor(data) {
701
+ super(data);
702
+ this.__setBranch();
703
+ }
704
+ __setBranch() {
705
+ this.isBranch = true;
706
+ if (!this.children)
707
+ this.children = [];
708
+ }
709
+ set(data) {
710
+ if (data.children) {
711
+ const { children } = data;
712
+ delete data.children;
713
+ if (!this.children)
714
+ this.__setBranch();
715
+ super.set(data);
716
+ let child;
717
+ children.forEach(childData => {
718
+ child = core.UICreator.get(childData.tag, childData);
719
+ this.add(child);
720
+ });
721
+ data.children = children;
722
+ }
723
+ else {
724
+ super.set(data);
725
+ }
726
+ }
727
+ toJSON() {
728
+ const data = super.toJSON();
729
+ data.children = this.children.map(child => child.toJSON());
730
+ return data;
731
+ }
732
+ addAt(child, index) {
733
+ this.add(child, index);
734
+ }
735
+ addAfter(child, after) {
736
+ this.add(child, this.children.indexOf(after) + 1);
737
+ }
738
+ addBefore(child, before) {
739
+ this.add(child, this.children.indexOf(before));
740
+ }
741
+ add(_child, _index) { }
742
+ addMany(..._children) { }
743
+ remove(_child, _destroy) { }
744
+ removeAll(_destroy) { }
745
+ };
746
+ __decorate([
747
+ core.dataProcessor(GroupData)
748
+ ], exports.Group.prototype, "__", void 0);
749
+ exports.Group = __decorate([
750
+ core.useModule(core.Branch),
751
+ core.registerUI()
752
+ ], exports.Group);
753
+
754
+ exports.Rect = class Rect extends exports.UI {
755
+ get __tag() { return 'Rect'; }
756
+ constructor(data) {
757
+ super(data);
758
+ }
759
+ __drawPathByData(drawer, _data) {
760
+ const { width, height, cornerRadius } = this.__;
761
+ if (cornerRadius) {
762
+ drawer.roundRect(0, 0, width, height, cornerRadius);
763
+ }
764
+ else {
765
+ drawer.rect(0, 0, width, height);
766
+ }
767
+ }
768
+ };
769
+ __decorate([
770
+ core.dataProcessor(RectData)
771
+ ], exports.Rect.prototype, "__", void 0);
772
+ exports.Rect = __decorate([
773
+ core.useModule(RectRender),
774
+ core.registerUI()
775
+ ], exports.Rect);
776
+
777
+ const rect = exports.Rect.prototype;
778
+ const group = exports.Group.prototype;
779
+ const bounds = {};
780
+ const { copy, add } = core.BoundsHelper;
781
+ exports.Box = class Box extends exports.Group {
782
+ get __tag() { return 'Box'; }
783
+ get resizeable() { return true; }
784
+ constructor(data) {
785
+ super(data);
786
+ this.isBranchLeaf = true;
787
+ this.__layout.renderChanged || this.__layout.renderChange();
788
+ }
789
+ __updateStrokeSpread() { return 0; }
790
+ __updateRectRenderSpread() { return 0; }
791
+ __updateRenderSpread() {
792
+ let width = this.__updateRectRenderSpread() || super.__updateRenderSpread();
793
+ this.__.__drawAfterFill = this.__.overflow === 'hide';
794
+ if (!width)
795
+ width = this.__.__drawAfterFill ? 0 : 1;
796
+ return width;
797
+ }
798
+ __updateBoxBounds() { }
799
+ __updateStrokeBounds() { }
800
+ __updateRenderBounds() {
801
+ this.__updateRectRenderBounds();
802
+ if (!this.__.__drawAfterFill) {
803
+ const { renderBounds } = this.__layout;
804
+ copy(bounds, renderBounds);
805
+ super.__updateRenderBounds();
806
+ add(renderBounds, bounds);
807
+ }
808
+ }
809
+ __updateRectRenderBounds() { }
810
+ __updateRectChange() { }
811
+ __updateChange() {
812
+ super.__updateChange();
813
+ this.__updateRectChange();
814
+ }
815
+ __drawPathByData(_drawer, _data) { }
816
+ __renderRect(_canvas, _options) { }
817
+ __renderGroup(_canvas, _options) { }
818
+ __render(canvas, options) {
819
+ if (this.__.__drawAfterFill) {
820
+ this.__renderRect(canvas, options);
821
+ }
822
+ else {
823
+ this.__renderRect(canvas, options);
824
+ this.__renderGroup(canvas, options);
825
+ }
826
+ }
827
+ __drawAfterFill(canvas, options) {
828
+ canvas.save();
829
+ canvas.clip();
830
+ this.__renderGroup(canvas, options);
831
+ canvas.restore();
832
+ if (this.__.stroke)
833
+ this.__drawRenderPath(canvas);
834
+ }
835
+ };
836
+ __decorate([
837
+ core.dataProcessor(BoxData)
838
+ ], exports.Box.prototype, "__", void 0);
839
+ __decorate([
840
+ core.affectRenderBoundsType('show')
841
+ ], exports.Box.prototype, "overflow", void 0);
842
+ __decorate([
843
+ core.rewrite(rect.__updateStrokeSpread)
844
+ ], exports.Box.prototype, "__updateStrokeSpread", null);
845
+ __decorate([
846
+ core.rewrite(rect.__updateRenderSpread)
847
+ ], exports.Box.prototype, "__updateRectRenderSpread", null);
848
+ __decorate([
849
+ core.rewrite(rect.__updateBoxBounds)
850
+ ], exports.Box.prototype, "__updateBoxBounds", null);
851
+ __decorate([
852
+ core.rewrite(rect.__updateStrokeBounds)
853
+ ], exports.Box.prototype, "__updateStrokeBounds", null);
854
+ __decorate([
855
+ core.rewrite(rect.__updateRenderBounds)
856
+ ], exports.Box.prototype, "__updateRectRenderBounds", null);
857
+ __decorate([
858
+ core.rewrite(rect.__updateChange)
859
+ ], exports.Box.prototype, "__updateRectChange", null);
860
+ __decorate([
861
+ core.rewrite(rect.__drawPathByData)
862
+ ], exports.Box.prototype, "__drawPathByData", null);
863
+ __decorate([
864
+ core.rewrite(rect.__render)
865
+ ], exports.Box.prototype, "__renderRect", null);
866
+ __decorate([
867
+ core.rewrite(group.__render)
868
+ ], exports.Box.prototype, "__renderGroup", null);
869
+ exports.Box = __decorate([
870
+ core.rewriteAble(),
871
+ core.registerUI()
872
+ ], exports.Box);
873
+
874
+ exports.Frame = class Frame extends exports.Box {
875
+ get __tag() { return 'Frame'; }
876
+ constructor(data) {
877
+ super(data);
878
+ if (!this.__.fill)
879
+ this.__.fill = '#FFFFFF';
880
+ }
881
+ };
882
+ __decorate([
883
+ core.dataProcessor(FrameData)
884
+ ], exports.Frame.prototype, "__", void 0);
885
+ __decorate([
886
+ core.affectRenderBoundsType('hide')
887
+ ], exports.Frame.prototype, "overflow", void 0);
888
+ exports.Frame = __decorate([
889
+ core.registerUI()
890
+ ], exports.Frame);
891
+
892
+ const { moveTo: moveTo$3, closePath: closePath$2, ellipse } = core.PathCommandDataHelper;
893
+ exports.Ellipse = class Ellipse extends exports.UI {
894
+ get __tag() { return 'Ellipse'; }
895
+ constructor(data) {
896
+ super(data);
897
+ }
898
+ __updatePath() {
899
+ const { width, height, innerRadius, startAngle, endAngle } = this.__;
900
+ const rx = width / 2, ry = height / 2;
901
+ const path = this.__.path = [];
902
+ if (innerRadius) {
903
+ if (startAngle || endAngle) {
904
+ if (innerRadius < 1)
905
+ ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
906
+ ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
907
+ if (innerRadius < 1)
908
+ closePath$2(path);
909
+ }
910
+ else {
911
+ if (innerRadius < 1) {
912
+ ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
913
+ moveTo$3(path, width, ry);
914
+ }
915
+ ellipse(path, rx, ry, rx, ry, 0, 0, 360, true);
916
+ }
917
+ }
918
+ else {
919
+ if (startAngle || endAngle) {
920
+ moveTo$3(path, rx, ry);
921
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
922
+ closePath$2(path);
923
+ }
924
+ else {
925
+ ellipse(path, rx, ry, rx, ry);
926
+ }
927
+ }
928
+ }
929
+ };
930
+ __decorate([
931
+ core.dataProcessor(EllipseData)
932
+ ], exports.Ellipse.prototype, "__", void 0);
933
+ __decorate([
934
+ core.pathType(0)
935
+ ], exports.Ellipse.prototype, "innerRadius", void 0);
936
+ __decorate([
937
+ core.pathType(0)
938
+ ], exports.Ellipse.prototype, "startAngle", void 0);
939
+ __decorate([
940
+ core.pathType(0)
941
+ ], exports.Ellipse.prototype, "endAngle", void 0);
942
+ exports.Ellipse = __decorate([
943
+ core.registerUI()
944
+ ], exports.Ellipse);
945
+
946
+ const { sin: sin$1, cos: cos$1, PI: PI$1 } = Math;
947
+ const { moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1 } = core.PathCommandDataHelper;
948
+ const { toBounds: toBounds$2 } = core.PathBounds;
949
+ exports.Polygon = class Polygon extends exports.UI {
950
+ get __tag() { return 'Polygon'; }
951
+ get resizeable() { return !this.points; }
952
+ constructor(data) {
953
+ super(data);
954
+ }
955
+ __updatePath() {
956
+ const path = this.__.path = [];
957
+ if (this.__.points) {
958
+ drawPoints$1(path, this.__.points, false, true);
959
+ }
960
+ else {
961
+ const { width, height, sides } = this.__;
962
+ const rx = width / 2, ry = height / 2;
963
+ moveTo$2(path, rx, 0);
964
+ for (let i = 1; i < sides; i++) {
965
+ lineTo$2(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
966
+ }
967
+ }
968
+ closePath$1(path);
969
+ }
970
+ __updateRenderPath() {
971
+ if (this.__.points && this.__.curve) {
972
+ drawPoints$1(this.__.__pathForRender = [], this.__.points, this.__.curve, true);
973
+ this.__updateNaturalSize();
974
+ }
975
+ else {
976
+ super.__updateRenderPath();
977
+ }
978
+ }
979
+ __updateBoxBounds() {
980
+ this.__.points ? toBounds$2(this.__.path, this.__layout.boxBounds) : super.__updateBoxBounds();
981
+ }
982
+ };
983
+ __decorate([
984
+ core.dataProcessor(PolygonData)
985
+ ], exports.Polygon.prototype, "__", void 0);
986
+ __decorate([
987
+ core.pathType(3)
988
+ ], exports.Polygon.prototype, "sides", void 0);
989
+ __decorate([
990
+ core.pathType()
991
+ ], exports.Polygon.prototype, "points", void 0);
992
+ __decorate([
993
+ core.pathType(0)
994
+ ], exports.Polygon.prototype, "curve", void 0);
995
+ exports.Polygon = __decorate([
996
+ core.registerUI()
997
+ ], exports.Polygon);
998
+
999
+ const { sin, cos, PI } = Math;
1000
+ const { moveTo: moveTo$1, lineTo: lineTo$1, closePath } = core.PathCommandDataHelper;
1001
+ exports.Star = class Star extends exports.UI {
1002
+ get __tag() { return 'Star'; }
1003
+ constructor(data) {
1004
+ super(data);
1005
+ }
1006
+ __updatePath() {
1007
+ const { width, height, corners, innerRadius } = this.__;
1008
+ const rx = width / 2, ry = height / 2;
1009
+ const path = this.__.path = [];
1010
+ moveTo$1(path, rx, 0);
1011
+ for (let i = 1; i < corners * 2; i++) {
1012
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin((i * PI) / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos((i * PI) / corners));
1013
+ }
1014
+ closePath(path);
1015
+ }
1016
+ };
1017
+ __decorate([
1018
+ core.dataProcessor(StarData)
1019
+ ], exports.Star.prototype, "__", void 0);
1020
+ __decorate([
1021
+ core.pathType(5)
1022
+ ], exports.Star.prototype, "corners", void 0);
1023
+ __decorate([
1024
+ core.pathType(0.382)
1025
+ ], exports.Star.prototype, "innerRadius", void 0);
1026
+ exports.Star = __decorate([
1027
+ core.registerUI()
1028
+ ], exports.Star);
1029
+
1030
+ const { moveTo, lineTo, drawPoints } = core.PathCommandDataHelper;
1031
+ const { rotate, getAngle, getDistance, defaultPoint } = core.PointHelper;
1032
+ const { toBounds: toBounds$1 } = core.PathBounds;
1033
+ exports.Line = class Line extends exports.UI {
1034
+ get __tag() { return 'Line'; }
1035
+ get resizeable() { return !this.points; }
1036
+ get toPoint() {
1037
+ const { width, rotation } = this.__;
1038
+ const to = { x: 0, y: 0 };
1039
+ if (width)
1040
+ to.x = width;
1041
+ if (rotation)
1042
+ rotate(to, rotation);
1043
+ return to;
1044
+ }
1045
+ set toPoint(value) {
1046
+ this.width = getDistance(defaultPoint, value);
1047
+ this.rotation = getAngle(defaultPoint, value);
1048
+ if (this.height)
1049
+ this.height = 0;
1050
+ }
1051
+ constructor(data) {
1052
+ super(data);
1053
+ }
1054
+ __updatePath() {
1055
+ const path = this.__.path = [];
1056
+ if (this.__.points) {
1057
+ drawPoints(path, this.__.points, false);
1058
+ }
1059
+ else {
1060
+ moveTo(path, 0, 0);
1061
+ lineTo(path, this.width, 0);
1062
+ }
1063
+ }
1064
+ __updateRenderPath() {
1065
+ if (this.__.points && this.__.curve) {
1066
+ drawPoints(this.__.__pathForRender = [], this.__.points, this.__.curve, false);
1067
+ }
1068
+ else {
1069
+ super.__updateRenderPath();
1070
+ }
1071
+ }
1072
+ __updateBoxBounds() {
1073
+ if (this.points) {
1074
+ toBounds$1(this.__.path, this.__layout.boxBounds);
1075
+ this.__updateNaturalSize();
1076
+ }
1077
+ else {
1078
+ super.__updateBoxBounds();
1079
+ }
1080
+ }
1081
+ };
1082
+ __decorate([
1083
+ core.dataProcessor(LineData)
1084
+ ], exports.Line.prototype, "__", void 0);
1085
+ __decorate([
1086
+ core.affectStrokeBoundsType('center')
1087
+ ], exports.Line.prototype, "strokeAlign", void 0);
1088
+ __decorate([
1089
+ core.boundsType(0)
1090
+ ], exports.Line.prototype, "height", void 0);
1091
+ __decorate([
1092
+ core.pathType()
1093
+ ], exports.Line.prototype, "points", void 0);
1094
+ __decorate([
1095
+ core.pathType(0)
1096
+ ], exports.Line.prototype, "curve", void 0);
1097
+ exports.Line = __decorate([
1098
+ core.registerUI()
1099
+ ], exports.Line);
1100
+
1101
+ exports.Image = class Image extends exports.Rect {
1102
+ get __tag() { return 'Image'; }
1103
+ get ready() { return this.image ? this.image.ready : false; }
1104
+ constructor(data) {
1105
+ super(data);
1106
+ }
1107
+ __updateBoxBounds() {
1108
+ let update;
1109
+ const { url } = this;
1110
+ const fill = this.fill;
1111
+ if (fill) {
1112
+ if (fill.url !== url)
1113
+ update = true;
1114
+ }
1115
+ else {
1116
+ if (url)
1117
+ update = true;
1118
+ }
1119
+ if (update) {
1120
+ if (this.image)
1121
+ this.image = null;
1122
+ this.fill = url ? { type: 'image', mode: 'strench', url } : undefined;
1123
+ this.once(core.ImageEvent.LOADED, (e) => this.image = e.image);
1124
+ }
1125
+ super.__updateBoxBounds();
1126
+ }
1127
+ destroy() {
1128
+ this.image = null;
1129
+ super.destroy();
1130
+ }
1131
+ };
1132
+ __decorate([
1133
+ core.dataProcessor(ImageData)
1134
+ ], exports.Image.prototype, "__", void 0);
1135
+ __decorate([
1136
+ core.boundsType('')
1137
+ ], exports.Image.prototype, "url", void 0);
1138
+ exports.Image = __decorate([
1139
+ core.registerUI()
1140
+ ], exports.Image);
1141
+
1142
+ exports.Canvas = class Canvas extends exports.Rect {
1143
+ get __tag() { return 'Canvas'; }
1144
+ constructor(data) {
1145
+ super(data);
1146
+ this.canvas = core.Creator.canvas(this.__);
1147
+ this.context = this.canvas.context;
1148
+ this.__.__drawAfterFill = true;
1149
+ }
1150
+ draw(ui, offset, scale, rotation) {
1151
+ ui.__layout.checkUpdate();
1152
+ const matrix = new core.Matrix(ui.__world);
1153
+ matrix.invert();
1154
+ const m = new core.Matrix();
1155
+ if (offset)
1156
+ m.translate(offset.x, offset.y);
1157
+ if (scale)
1158
+ typeof scale === 'number' ? m.scale(scale) : m.scale(scale.x, scale.y);
1159
+ if (rotation)
1160
+ m.rotate(rotation);
1161
+ matrix.preMultiply(m);
1162
+ ui.__render(this.canvas, { matrix });
1163
+ this.paint();
1164
+ }
1165
+ paint() {
1166
+ this.forceUpdate('fill');
1167
+ }
1168
+ __drawAfterFill(canvas, _options) {
1169
+ const origin = this.canvas.view;
1170
+ const { width, height } = this;
1171
+ if (this.__.cornerRadius) {
1172
+ canvas.save();
1173
+ canvas.clip();
1174
+ canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
1175
+ canvas.restore();
1176
+ }
1177
+ else {
1178
+ canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
1179
+ }
1180
+ }
1181
+ __updateSize() {
1182
+ const { canvas } = this;
1183
+ if (canvas) {
1184
+ const { smooth } = this.__;
1185
+ if (canvas.smooth !== smooth)
1186
+ canvas.smooth = smooth;
1187
+ canvas.resize(this.__);
1188
+ }
1189
+ }
1190
+ destroy() {
1191
+ if (this.canvas) {
1192
+ this.canvas.destroy();
1193
+ this.canvas = null;
1194
+ this.context = null;
1195
+ }
1196
+ super.destroy();
1197
+ }
1198
+ };
1199
+ __decorate([
1200
+ core.dataProcessor(ImageData)
1201
+ ], exports.Canvas.prototype, "__", void 0);
1202
+ __decorate([
1203
+ resizeType(100)
1204
+ ], exports.Canvas.prototype, "width", void 0);
1205
+ __decorate([
1206
+ resizeType(100)
1207
+ ], exports.Canvas.prototype, "height", void 0);
1208
+ __decorate([
1209
+ resizeType(core.Platform.devicePixelRatio)
1210
+ ], exports.Canvas.prototype, "pixelRatio", void 0);
1211
+ __decorate([
1212
+ resizeType(true)
1213
+ ], exports.Canvas.prototype, "smooth", void 0);
1214
+ __decorate([
1215
+ core.hitType('all')
1216
+ ], exports.Canvas.prototype, "hitFill", void 0);
1217
+ exports.Canvas = __decorate([
1218
+ core.registerUI()
1219
+ ], exports.Canvas);
1220
+
1221
+ const { copyAndSpread, includes, spread } = core.BoundsHelper;
1222
+ exports.Text = class Text extends exports.UI {
1223
+ get __tag() { return 'Text'; }
1224
+ get textDrawData() {
1225
+ this.__layout.checkUpdate();
1226
+ return this.__.__textDrawData;
1227
+ }
1228
+ constructor(data) {
1229
+ super(data);
1230
+ }
1231
+ __drawHitPath(canvas) {
1232
+ const { __lineHeight, __baseLine, __textDrawData: data } = this.__;
1233
+ canvas.beginPath();
1234
+ if (this.__.__letterSpacing < 0) {
1235
+ this.__drawPathByData(canvas);
1236
+ }
1237
+ else {
1238
+ data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight));
1239
+ }
1240
+ }
1241
+ __drawPathByData(drawer, _data) {
1242
+ const { x, y, width, height } = this.__layout.boxBounds;
1243
+ drawer.rect(x, y, width, height);
1244
+ }
1245
+ __drawRenderPath(canvas) {
1246
+ canvas.font = this.__.__font;
1247
+ }
1248
+ __updateTextDrawData() {
1249
+ const data = this.__;
1250
+ data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
1251
+ }
1252
+ __updateBoxBounds() {
1253
+ const data = this.__;
1254
+ const layout = this.__layout;
1255
+ const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase } = data;
1256
+ data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
1257
+ data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
1258
+ data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
1259
+ data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
1260
+ this.__updateTextDrawData();
1261
+ const { bounds } = data.__textDrawData;
1262
+ const b = layout.boxBounds;
1263
+ if (data.__lineHeight < fontSize)
1264
+ spread(bounds, fontSize / 2);
1265
+ const width = data.__getInput('width');
1266
+ const height = data.__getInput('height');
1267
+ if (width && height) {
1268
+ super.__updateBoxBounds();
1269
+ }
1270
+ else {
1271
+ b.x = width ? 0 : bounds.x;
1272
+ b.y = height ? 0 : bounds.y;
1273
+ b.width = width ? width : bounds.width;
1274
+ b.height = height ? height : bounds.height;
1275
+ this.__updateNaturalSize();
1276
+ }
1277
+ const contentBounds = includes(b, bounds) ? b : bounds;
1278
+ if (contentBounds !== layout.contentBounds) {
1279
+ layout.contentBounds = contentBounds;
1280
+ layout.renderChanged = true;
1281
+ }
1282
+ }
1283
+ __updateRenderSpread() {
1284
+ let width = super.__updateRenderSpread();
1285
+ if (!width)
1286
+ width = this.__layout.boxBounds === this.__layout.contentBounds ? 0 : 1;
1287
+ return width;
1288
+ }
1289
+ __updateRenderBounds() {
1290
+ copyAndSpread(this.__layout.renderBounds, this.__layout.contentBounds, this.__layout.renderSpread);
1291
+ }
1292
+ };
1293
+ __decorate([
1294
+ core.dataProcessor(TextData)
1295
+ ], exports.Text.prototype, "__", void 0);
1296
+ __decorate([
1297
+ core.boundsType(0)
1298
+ ], exports.Text.prototype, "width", void 0);
1299
+ __decorate([
1300
+ core.boundsType(0)
1301
+ ], exports.Text.prototype, "height", void 0);
1302
+ __decorate([
1303
+ core.boundsType(0)
1304
+ ], exports.Text.prototype, "padding", void 0);
1305
+ __decorate([
1306
+ core.affectStrokeBoundsType('outside')
1307
+ ], exports.Text.prototype, "strokeAlign", void 0);
1308
+ __decorate([
1309
+ core.boundsType('')
1310
+ ], exports.Text.prototype, "text", void 0);
1311
+ __decorate([
1312
+ core.boundsType('L')
1313
+ ], exports.Text.prototype, "fontFamily", void 0);
1314
+ __decorate([
1315
+ core.boundsType(12)
1316
+ ], exports.Text.prototype, "fontSize", void 0);
1317
+ __decorate([
1318
+ core.boundsType('normal')
1319
+ ], exports.Text.prototype, "fontWeight", void 0);
1320
+ __decorate([
1321
+ core.boundsType(false)
1322
+ ], exports.Text.prototype, "italic", void 0);
1323
+ __decorate([
1324
+ core.boundsType('none')
1325
+ ], exports.Text.prototype, "textCase", void 0);
1326
+ __decorate([
1327
+ core.boundsType('none')
1328
+ ], exports.Text.prototype, "textDecoration", void 0);
1329
+ __decorate([
1330
+ core.boundsType(0)
1331
+ ], exports.Text.prototype, "letterSpacing", void 0);
1332
+ __decorate([
1333
+ core.boundsType({ type: 'percent', value: 150 })
1334
+ ], exports.Text.prototype, "lineHeight", void 0);
1335
+ __decorate([
1336
+ core.boundsType(0)
1337
+ ], exports.Text.prototype, "paraIndent", void 0);
1338
+ __decorate([
1339
+ core.boundsType(0)
1340
+ ], exports.Text.prototype, "paraSpacing", void 0);
1341
+ __decorate([
1342
+ core.boundsType('left')
1343
+ ], exports.Text.prototype, "textAlign", void 0);
1344
+ __decorate([
1345
+ core.boundsType('top')
1346
+ ], exports.Text.prototype, "verticalAlign", void 0);
1347
+ __decorate([
1348
+ core.boundsType('show')
1349
+ ], exports.Text.prototype, "textOverflow", void 0);
1350
+ exports.Text = __decorate([
1351
+ core.registerUI()
1352
+ ], exports.Text);
1353
+
1354
+ const { toBounds } = core.PathBounds;
1355
+ exports.Path = class Path extends exports.UI {
1356
+ get __tag() { return 'Path'; }
1357
+ get resizeable() { return false; }
1358
+ constructor(data) {
1359
+ super(data);
1360
+ }
1361
+ __updateBoxBounds() {
1362
+ toBounds(this.__.path, this.__layout.boxBounds);
1363
+ this.__updateNaturalSize();
1364
+ }
1365
+ };
1366
+ __decorate([
1367
+ core.dataProcessor(PathData)
1368
+ ], exports.Path.prototype, "__", void 0);
1369
+ __decorate([
1370
+ core.pathType()
1371
+ ], exports.Path.prototype, "path", void 0);
1372
+ __decorate([
1373
+ core.pathType()
1374
+ ], exports.Path.prototype, "windingRule", void 0);
1375
+ __decorate([
1376
+ core.affectStrokeBoundsType('center')
1377
+ ], exports.Path.prototype, "strokeAlign", void 0);
1378
+ exports.Path = __decorate([
1379
+ core.registerUI()
1380
+ ], exports.Path);
1381
+
1382
+ exports.Pen = class Pen extends exports.Group {
1383
+ get __tag() { return 'Pen'; }
1384
+ constructor(data) {
1385
+ super(data);
1386
+ }
1387
+ setStyle(data) {
1388
+ const path = this.pathElement = new exports.Path(data);
1389
+ this.pathStyle = data;
1390
+ this.path = path.path || (path.path = []);
1391
+ this.add(path);
1392
+ return this;
1393
+ }
1394
+ beginPath() {
1395
+ this.path.length = 0;
1396
+ this.paint();
1397
+ return this;
1398
+ }
1399
+ moveTo(_x, _y) { return this; }
1400
+ lineTo(_x, _y) { return this; }
1401
+ bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
1402
+ quadraticCurveTo(_x1, _y1, _x, _y) { return this; }
1403
+ closePath() { return this; }
1404
+ rect(_x, _y, _width, _height) { return this; }
1405
+ roundRect(_x, _y, _width, _height, _cornerRadius) { return this; }
1406
+ ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { return this; }
1407
+ arc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) { return this; }
1408
+ arcTo(_x1, _y1, _x2, _y2, _radius) { return this; }
1409
+ drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { return this; }
1410
+ drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) { return this; }
1411
+ drawPoints(_points, _curve, _close) { return this; }
1412
+ paint() {
1413
+ this.pathElement.forceUpdate('path');
1414
+ }
1415
+ clear() {
1416
+ this.removeAll(true);
1417
+ }
1418
+ };
1419
+ __decorate([
1420
+ core.dataProcessor(PenData)
1421
+ ], exports.Pen.prototype, "__", void 0);
1422
+ exports.Pen = __decorate([
1423
+ core.useModule(core.PathCreator, ['beginPath']),
1424
+ core.registerUI()
1425
+ ], exports.Pen);
1426
+
1427
+ const debug = core.Debug.get('Leafer');
1428
+ exports.Leafer = class Leafer extends exports.Group {
1429
+ get __tag() { return 'Leafer'; }
1430
+ get isApp() { return false; }
1431
+ get app() { return this.parent || this; }
1432
+ constructor(userConfig, data) {
1433
+ super(data);
1434
+ this.zoomLayer = this;
1435
+ this.moveLayer = this;
1436
+ this.config = {
1437
+ type: 'design',
1438
+ start: true,
1439
+ hittable: true,
1440
+ smooth: true,
1441
+ zoom: {
1442
+ min: 0.02,
1443
+ max: 256
1444
+ },
1445
+ move: {
1446
+ holdSpaceKey: true,
1447
+ dragOut: true,
1448
+ autoDistance: 2
1449
+ }
1450
+ };
1451
+ this.__eventIds = [];
1452
+ this.__controllers = [];
1453
+ this.__readyWait = [];
1454
+ this.__viewReadyWait = [];
1455
+ this.__viewCompletedWait = [];
1456
+ this.__renderWait = [];
1457
+ this.userConfig = userConfig;
1458
+ if (userConfig && (userConfig.view || userConfig.width))
1459
+ this.init(userConfig);
1460
+ }
1461
+ init(userConfig, parentApp) {
1462
+ if (this.canvas)
1463
+ return;
1464
+ this.__setLeafer(this);
1465
+ if (userConfig)
1466
+ core.DataHelper.assign(this.config, userConfig);
1467
+ let start;
1468
+ const { config } = this;
1469
+ LeaferTypeCreator.run(config.type, this);
1470
+ this.canvas = core.Creator.canvas(config);
1471
+ this.__controllers.push(this.renderer = core.Creator.renderer(this, this.canvas, config), this.watcher = core.Creator.watcher(this, config), this.layouter = core.Creator.layouter(this, config));
1472
+ if (this.isApp)
1473
+ this.__setApp();
1474
+ this.__checkAutoLayout(config);
1475
+ this.view = this.canvas.view;
1476
+ if (parentApp) {
1477
+ this.__bindApp(parentApp);
1478
+ start = parentApp.running;
1479
+ }
1480
+ else {
1481
+ this.selector = core.Creator.selector(this);
1482
+ this.__controllers.unshift(this.interaction = core.Creator.interaction(this, this.canvas, this.selector, config));
1483
+ this.canvasManager = new core.CanvasManager();
1484
+ this.hitCanvasManager = new core.HitCanvasManager();
1485
+ start = config.start;
1486
+ }
1487
+ this.hittable = config.hittable;
1488
+ this.fill = config.fill;
1489
+ this.canvasManager.add(this.canvas);
1490
+ this.__listenEvents();
1491
+ if (start)
1492
+ this.__startTimer = setTimeout(this.start.bind(this));
1493
+ core.PluginManager.onLeafer(this);
1494
+ }
1495
+ set(data) {
1496
+ if (!this.children) {
1497
+ setTimeout(() => {
1498
+ super.set(data);
1499
+ });
1500
+ }
1501
+ else {
1502
+ super.set(data);
1503
+ }
1504
+ }
1505
+ start() {
1506
+ clearTimeout(this.__startTimer);
1507
+ if (!this.running && this.canvas) {
1508
+ this.ready ? this.emitLeafer(core.LeaferEvent.RESTART) : this.emitLeafer(core.LeaferEvent.START);
1509
+ this.__controllers.forEach(item => item.start());
1510
+ if (!this.isApp)
1511
+ this.renderer.render();
1512
+ this.running = true;
1513
+ }
1514
+ }
1515
+ stop() {
1516
+ clearTimeout(this.__startTimer);
1517
+ if (this.running && this.canvas) {
1518
+ this.__controllers.forEach(item => item.stop());
1519
+ this.running = false;
1520
+ this.emitLeafer(core.LeaferEvent.STOP);
1521
+ }
1522
+ }
1523
+ resize(size) {
1524
+ const data = core.DataHelper.copyAttrs({}, size, core.canvasSizeAttrs);
1525
+ Object.keys(data).forEach(key => this[key] = data[key]);
1526
+ }
1527
+ forceLayout() {
1528
+ this.__layout.checkUpdate(true);
1529
+ }
1530
+ forceFullRender() {
1531
+ this.renderer.addBlock(this.canvas.bounds);
1532
+ if (this.viewReady)
1533
+ this.renderer.update();
1534
+ }
1535
+ updateCursor() {
1536
+ if (this.interaction)
1537
+ this.interaction.updateCursor();
1538
+ }
1539
+ __doResize(size) {
1540
+ if (!this.canvas || this.canvas.isSameSize(size))
1541
+ return;
1542
+ const old = core.DataHelper.copyAttrs({}, this.canvas, core.canvasSizeAttrs);
1543
+ this.canvas.resize(size);
1544
+ this.__onResize(new core.ResizeEvent(size, old));
1545
+ }
1546
+ __onResize(event) {
1547
+ this.emitEvent(event);
1548
+ core.DataHelper.copyAttrs(this.__, event, core.canvasSizeAttrs);
1549
+ setTimeout(() => { if (this.canvasManager)
1550
+ this.canvasManager.clearRecycled(); }, 0);
1551
+ }
1552
+ __setApp() { }
1553
+ __bindApp(app) {
1554
+ this.selector = app.selector;
1555
+ this.interaction = app.interaction;
1556
+ this.canvasManager = app.canvasManager;
1557
+ this.hitCanvasManager = app.hitCanvasManager;
1558
+ }
1559
+ __setLeafer(leafer) {
1560
+ this.leafer = leafer;
1561
+ this.isLeafer = !!leafer;
1562
+ this.__level = 1;
1563
+ }
1564
+ setZoomLayer(zoomLayer, moveLayer) {
1565
+ this.zoomLayer = zoomLayer;
1566
+ this.moveLayer = moveLayer || zoomLayer;
1567
+ }
1568
+ __checkAutoLayout(config) {
1569
+ if (!config.width || !config.height) {
1570
+ this.autoLayout = new core.AutoBounds(config);
1571
+ this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
1572
+ }
1573
+ }
1574
+ __setAttr(attrName, newValue) {
1575
+ if (this.canvas) {
1576
+ if (core.canvasSizeAttrs.includes(attrName)) {
1577
+ this.__changeCanvasSize(attrName, newValue);
1578
+ }
1579
+ else if (attrName === 'fill') {
1580
+ this.__changeFill(newValue);
1581
+ }
1582
+ else if (attrName === 'hittable') {
1583
+ this.canvas.hittable = newValue;
1584
+ }
1585
+ }
1586
+ super.__setAttr(attrName, newValue);
1587
+ }
1588
+ __getAttr(attrName) {
1589
+ if (this.canvas && core.canvasSizeAttrs.includes(attrName))
1590
+ return this.canvas[attrName];
1591
+ return super.__getAttr(attrName);
1592
+ }
1593
+ __changeCanvasSize(attrName, newValue) {
1594
+ const data = core.DataHelper.copyAttrs({}, this.canvas, core.canvasSizeAttrs);
1595
+ data[attrName] = this.config[attrName] = newValue;
1596
+ if (newValue)
1597
+ this.canvas.stopAutoLayout();
1598
+ this.__doResize(data);
1599
+ }
1600
+ __changeFill(newValue) {
1601
+ this.config.fill = newValue;
1602
+ if (this.canvas.allowBackgroundColor) {
1603
+ this.canvas.backgroundColor = newValue;
1604
+ }
1605
+ else {
1606
+ this.forceFullRender();
1607
+ }
1608
+ }
1609
+ __onCreated() {
1610
+ this.created = true;
1611
+ }
1612
+ __onReady() {
1613
+ if (this.ready)
1614
+ return;
1615
+ this.ready = true;
1616
+ this.emitLeafer(core.LeaferEvent.BEFORE_READY);
1617
+ this.emitLeafer(core.LeaferEvent.READY);
1618
+ this.emitLeafer(core.LeaferEvent.AFTER_READY);
1619
+ core.WaitHelper.run(this.__readyWait);
1620
+ }
1621
+ __onViewReady() {
1622
+ if (this.viewReady)
1623
+ return;
1624
+ this.viewReady = true;
1625
+ this.emitLeafer(core.LeaferEvent.VIEW_READY);
1626
+ core.WaitHelper.run(this.__viewReadyWait);
1627
+ }
1628
+ __onRenderEnd(_e) {
1629
+ if (!this.viewReady)
1630
+ this.__onViewReady();
1631
+ const completed = this.__checkViewCompleted();
1632
+ if (completed)
1633
+ this.__onViewCompleted();
1634
+ this.viewCompleted = completed;
1635
+ core.WaitHelper.run(this.__renderWait);
1636
+ }
1637
+ __checkViewCompleted() {
1638
+ return this.viewReady && !this.watcher.changed && core.ImageManager.isComplete;
1639
+ }
1640
+ __onViewCompleted() {
1641
+ if (!this.viewCompleted) {
1642
+ this.emitLeafer(core.LeaferEvent.VIEW_COMPLETED);
1643
+ core.WaitHelper.run(this.__viewCompletedWait);
1644
+ }
1645
+ }
1646
+ __onWatchData() {
1647
+ if (this.watcher.childrenChanged && this.interaction) {
1648
+ this.waitRender(() => this.interaction.updateCursor());
1649
+ }
1650
+ }
1651
+ waitReady(item) {
1652
+ this.ready ? item() : this.__readyWait.push(item);
1653
+ }
1654
+ waitViewReady(item) {
1655
+ this.viewReady ? item() : this.__viewReadyWait.push(item);
1656
+ }
1657
+ waitViewCompleted(item) {
1658
+ if (this.viewCompleted) {
1659
+ item();
1660
+ }
1661
+ else {
1662
+ this.__viewCompletedWait.push(item);
1663
+ if (!this.running)
1664
+ this.start();
1665
+ }
1666
+ }
1667
+ waitRender(item) {
1668
+ if (this.watcher && !this.watcher.changed) {
1669
+ item();
1670
+ }
1671
+ else {
1672
+ this.__renderWait.push(item);
1673
+ }
1674
+ }
1675
+ __checkUpdateLayout() {
1676
+ this.__layout.checkUpdate();
1677
+ }
1678
+ emitLeafer(type) {
1679
+ this.emitEvent(new core.LeaferEvent(type, this));
1680
+ }
1681
+ __listenEvents() {
1682
+ const runId = core.Run.start('FirstCreate ' + this.innerName);
1683
+ this.once(core.LeaferEvent.START, () => core.Run.end(runId));
1684
+ this.once(core.LayoutEvent.END, () => this.__onReady());
1685
+ this.once(core.RenderEvent.START, () => this.__onCreated());
1686
+ this.__eventIds.push(this.on_(core.WatchEvent.DATA, this.__onWatchData, this), this.on_(core.RenderEvent.END, this.__onRenderEnd, this), this.on_(core.LayoutEvent.CHECK_UPDATE, this.__checkUpdateLayout, this));
1687
+ }
1688
+ __removeListenEvents() {
1689
+ this.off_(this.__eventIds);
1690
+ this.__eventIds.length = 0;
1691
+ }
1692
+ destroy() {
1693
+ setTimeout(() => {
1694
+ if (!this.destroyed) {
1695
+ try {
1696
+ this.stop();
1697
+ this.emitEvent(new core.LeaferEvent(core.LeaferEvent.END, this));
1698
+ this.__removeListenEvents();
1699
+ this.__controllers.forEach(item => {
1700
+ if (!(this.parent && item === this.interaction))
1701
+ item.destroy();
1702
+ });
1703
+ this.__controllers.length = 0;
1704
+ if (!this.parent) {
1705
+ this.selector.destroy();
1706
+ this.canvasManager.destroy();
1707
+ this.hitCanvasManager.destroy();
1708
+ }
1709
+ this.canvas.destroy();
1710
+ this.config.view = this.view = null;
1711
+ if (this.userConfig)
1712
+ this.userConfig.view = null;
1713
+ super.destroy();
1714
+ setTimeout(() => { core.ImageManager.clearRecycled(); }, 100);
1715
+ }
1716
+ catch (e) {
1717
+ debug.error(e);
1718
+ }
1719
+ }
1720
+ });
1721
+ }
1722
+ };
1723
+ __decorate([
1724
+ core.dataProcessor(LeaferData)
1725
+ ], exports.Leafer.prototype, "__", void 0);
1726
+ __decorate([
1727
+ core.boundsType()
1728
+ ], exports.Leafer.prototype, "pixelRatio", void 0);
1729
+ exports.Leafer = __decorate([
1730
+ core.registerUI()
1731
+ ], exports.Leafer);
1732
+
1733
+ exports.App = class App extends exports.Leafer {
1734
+ get __tag() { return 'App'; }
1735
+ get isApp() { return true; }
1736
+ __setApp() {
1737
+ const { canvas } = this;
1738
+ const { realCanvas, view } = this.config;
1739
+ if (realCanvas || view === this.canvas.view || !canvas.parentView) {
1740
+ this.realCanvas = true;
1741
+ }
1742
+ else {
1743
+ canvas.unrealCanvas();
1744
+ }
1745
+ this.leafer = this;
1746
+ this.watcher.disable();
1747
+ this.layouter.disable();
1748
+ this.__eventIds.push(this.on_(core.PropertyEvent.CHANGE, this.__onPropertyChange, this));
1749
+ }
1750
+ start() {
1751
+ super.start();
1752
+ this.children.forEach(leafer => { leafer.start(); });
1753
+ }
1754
+ stop() {
1755
+ this.children.forEach(leafer => { leafer.stop(); });
1756
+ super.stop();
1757
+ }
1758
+ addLeafer(merge) {
1759
+ const leafer = new exports.Leafer(merge);
1760
+ this.add(leafer);
1761
+ return leafer;
1762
+ }
1763
+ add(leafer) {
1764
+ if (!leafer.view) {
1765
+ if (this.realCanvas && !this.canvas.bounds) {
1766
+ setTimeout(() => this.add(leafer), 10);
1767
+ return;
1768
+ }
1769
+ leafer.init(this.__getChildConfig(leafer.userConfig), this);
1770
+ }
1771
+ super.add(leafer);
1772
+ this.__listenChildEvents(leafer);
1773
+ }
1774
+ __onPropertyChange() {
1775
+ if (core.Debug.showHitView)
1776
+ this.children.forEach(leafer => { leafer.forceUpdate('surface'); });
1777
+ }
1778
+ __onCreated() {
1779
+ this.created = this.children.every(child => child.created);
1780
+ }
1781
+ __onReady() {
1782
+ if (this.children.every(child => child.ready))
1783
+ super.__onReady();
1784
+ }
1785
+ __onViewReady() {
1786
+ if (this.children.every(child => child.viewReady))
1787
+ super.__onViewReady();
1788
+ }
1789
+ __checkViewCompleted() {
1790
+ return this.children.every(item => item.viewCompleted);
1791
+ }
1792
+ __onChildRenderEnd(e) {
1793
+ this.renderer.addBlock(e.renderBounds);
1794
+ if (this.viewReady)
1795
+ this.renderer.update();
1796
+ }
1797
+ __render(canvas, _options) {
1798
+ this.children.forEach(leafer => { canvas.copyWorld(leafer.canvas); });
1799
+ }
1800
+ __onResize(event) {
1801
+ this.children.forEach(leafer => { leafer.resize(event); });
1802
+ super.__onResize(event);
1803
+ }
1804
+ __checkUpdateLayout() {
1805
+ this.children.forEach(leafer => { leafer.__layout.checkUpdate(); });
1806
+ }
1807
+ __getChildConfig(userConfig) {
1808
+ let config = Object.assign({}, this.config);
1809
+ config.hittable = config.realCanvas = undefined;
1810
+ if (userConfig)
1811
+ core.DataHelper.assign(config, userConfig);
1812
+ if (this.autoLayout)
1813
+ core.DataHelper.copyAttrs(config, this, core.canvasSizeAttrs);
1814
+ config.view = this.realCanvas ? undefined : this.view;
1815
+ config.fill = undefined;
1816
+ return config;
1817
+ }
1818
+ __listenChildEvents(leafer) {
1819
+ leafer.once(core.LayoutEvent.END, () => this.__onReady());
1820
+ leafer.once(core.RenderEvent.START, () => this.__onCreated());
1821
+ leafer.once(core.RenderEvent.END, (e) => this.__onRenderEnd(e));
1822
+ if (this.realCanvas)
1823
+ this.__eventIds.push(leafer.on_(core.RenderEvent.END, this.__onChildRenderEnd, this));
1824
+ }
1825
+ };
1826
+ exports.App = __decorate([
1827
+ core.registerUI()
1828
+ ], exports.App);
1829
+
1830
+ exports.Animate = Animate;
1831
+ exports.ColorConvert = ColorConvert;
1832
+ exports.Effect = Effect;
1833
+ exports.Export = Export;
1834
+ exports.LeaferTypeCreator = LeaferTypeCreator;
1835
+ exports.Paint = Paint;
1836
+ exports.RectRender = RectRender;
1837
+ exports.TextConvert = TextConvert;
1838
+ exports.UIBounds = UIBounds;
1839
+ exports.UIHit = UIHit;
1840
+ exports.UIRender = UIRender;
1841
+ exports.effectType = effectType;
1842
+ exports.resizeType = resizeType;
1843
+ Object.keys(core).forEach(function (k) {
1844
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1845
+ enumerable: true,
1846
+ get: function () { return core[k]; }
1847
+ });
1848
+ });