@leafer-ui/draw 1.9.12 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/draw.cjs +29 -28
- package/lib/draw.esm.js +29 -28
- package/lib/draw.esm.min.js +1 -1
- package/lib/draw.esm.min.js.map +1 -1
- package/lib/draw.min.cjs +1 -1
- package/lib/draw.min.cjs.map +1 -1
- package/package.json +6 -6
package/lib/draw.cjs
CHANGED
|
@@ -125,7 +125,7 @@ const Transition = {
|
|
|
125
125
|
|
|
126
126
|
const {parse: parse, objectToCanvasData: objectToCanvasData} = core.PathConvert;
|
|
127
127
|
|
|
128
|
-
const {stintSet: stintSet$
|
|
128
|
+
const {stintSet: stintSet$2} = core.DataHelper, {hasTransparent: hasTransparent} = ColorConvert;
|
|
129
129
|
|
|
130
130
|
const emptyPaint = {};
|
|
131
131
|
|
|
@@ -192,7 +192,7 @@ class UIData extends core.LeafData {
|
|
|
192
192
|
setFill(value) {
|
|
193
193
|
if (this.__naturalWidth) this.__removeNaturalSize();
|
|
194
194
|
if (core.isString(value) || !value) {
|
|
195
|
-
stintSet$
|
|
195
|
+
stintSet$2(this, "__isTransparentFill", hasTransparent(value));
|
|
196
196
|
this.__isFills && this.__removePaint("fill", true);
|
|
197
197
|
this._fill = value;
|
|
198
198
|
} else if (core.isObject(value)) {
|
|
@@ -201,7 +201,7 @@ class UIData extends core.LeafData {
|
|
|
201
201
|
}
|
|
202
202
|
setStroke(value) {
|
|
203
203
|
if (core.isString(value) || !value) {
|
|
204
|
-
stintSet$
|
|
204
|
+
stintSet$2(this, "__isTransparentStroke", hasTransparent(value));
|
|
205
205
|
this.__isStrokes && this.__removePaint("stroke", true);
|
|
206
206
|
this._stroke = value;
|
|
207
207
|
} else if (core.isObject(value)) {
|
|
@@ -259,11 +259,11 @@ class UIData extends core.LeafData {
|
|
|
259
259
|
if (removeInput) this.__removeInput(attrName);
|
|
260
260
|
PaintImage.recycleImage(attrName, this);
|
|
261
261
|
if (attrName === "fill") {
|
|
262
|
-
stintSet$
|
|
262
|
+
stintSet$2(this, "__isAlphaPixelFill", undefined);
|
|
263
263
|
this._fill = this.__isFills = undefined;
|
|
264
264
|
} else {
|
|
265
|
-
stintSet$
|
|
266
|
-
stintSet$
|
|
265
|
+
stintSet$2(this, "__isAlphaPixelStroke", undefined);
|
|
266
|
+
stintSet$2(this, "__hasMultiStrokeStyle", undefined);
|
|
267
267
|
this._stroke = this.__isStrokes = undefined;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
@@ -450,23 +450,23 @@ const UIBounds = {
|
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
452
|
|
|
453
|
-
const {stintSet: stintSet} = core.DataHelper;
|
|
453
|
+
const {stintSet: stintSet$1} = core.DataHelper;
|
|
454
454
|
|
|
455
455
|
const UIRender = {
|
|
456
456
|
__updateChange() {
|
|
457
457
|
const data = this.__;
|
|
458
458
|
if (data.__useStroke) {
|
|
459
459
|
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
460
|
-
stintSet(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
|
|
461
|
-
stintSet(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
|
|
460
|
+
stintSet$1(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
|
|
461
|
+
stintSet$1(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
|
|
462
462
|
}
|
|
463
463
|
if (data.__useEffect) {
|
|
464
464
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
465
|
-
stintSet(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(core.isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
465
|
+
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(core.isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
466
466
|
data.__useEffect = !!(shadow || otherEffect);
|
|
467
467
|
}
|
|
468
468
|
data.__checkSingle();
|
|
469
|
-
stintSet(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
469
|
+
stintSet$1(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
470
470
|
},
|
|
471
471
|
__drawFast(canvas, options) {
|
|
472
472
|
drawFast(this, canvas, options);
|
|
@@ -482,24 +482,24 @@ const UIRender = {
|
|
|
482
482
|
this.__nowWorld = this.__getNowWorld(options);
|
|
483
483
|
const {shadow: shadow, innerShadow: innerShadow, filter: filter} = data;
|
|
484
484
|
if (shadow) Effect.shadow(this, canvas, shape);
|
|
485
|
-
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
486
|
-
if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
485
|
+
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
486
|
+
if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
|
|
487
487
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options);
|
|
488
488
|
if (innerShadow) Effect.innerShadow(this, canvas, shape);
|
|
489
|
-
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
489
|
+
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
490
490
|
if (filter) Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
491
491
|
if (shape.worldCanvas) shape.worldCanvas.recycle();
|
|
492
492
|
shape.canvas.recycle();
|
|
493
493
|
} else {
|
|
494
|
-
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
494
|
+
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
495
495
|
if (__isFastShadow) {
|
|
496
496
|
const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
|
|
497
497
|
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
498
498
|
}
|
|
499
|
-
if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
499
|
+
if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
|
|
500
500
|
if (__isFastShadow) canvas.restore();
|
|
501
501
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options);
|
|
502
|
-
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
502
|
+
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
503
503
|
}
|
|
504
504
|
} else {
|
|
505
505
|
if (data.__pathInputed) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
|
|
@@ -508,9 +508,9 @@ const UIRender = {
|
|
|
508
508
|
__drawShape(canvas, options) {
|
|
509
509
|
this.__drawRenderPath(canvas);
|
|
510
510
|
const data = this.__, {fill: fill, stroke: stroke} = data;
|
|
511
|
-
if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill("#000000", this, canvas);
|
|
511
|
+
if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas, options) : Paint.fill("#000000", this, canvas, options);
|
|
512
512
|
if (data.__isCanvas) this.__drawAfterFill(canvas, options);
|
|
513
|
-
if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke("#000000", this, canvas);
|
|
513
|
+
if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke("#000000", this, canvas, options);
|
|
514
514
|
},
|
|
515
515
|
__drawAfterFill(canvas, options) {
|
|
516
516
|
if (this.__.__clipAfterFill) {
|
|
@@ -525,10 +525,10 @@ const UIRender = {
|
|
|
525
525
|
function drawFast(ui, canvas, options) {
|
|
526
526
|
const {fill: fill, stroke: stroke, __drawAfterFill: __drawAfterFill, __fillAfterStroke: __fillAfterStroke} = ui.__;
|
|
527
527
|
ui.__drawRenderPath(canvas);
|
|
528
|
-
if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
|
|
529
|
-
if (fill) Paint.fill(fill, ui, canvas);
|
|
528
|
+
if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
|
|
529
|
+
if (fill) Paint.fill(fill, ui, canvas, options);
|
|
530
530
|
if (__drawAfterFill) ui.__drawAfterFill(canvas, options);
|
|
531
|
-
if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
|
|
531
|
+
if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
const RectRender = {
|
|
@@ -666,8 +666,8 @@ exports.UI = UI_1 = class UI extends core.Leaf {
|
|
|
666
666
|
drawer.roundRect(x, y, width, height, core.isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
|
|
667
667
|
} else drawer.rect(x, y, width, height);
|
|
668
668
|
}
|
|
669
|
-
drawImagePlaceholder(canvas,
|
|
670
|
-
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
669
|
+
drawImagePlaceholder(_image, canvas, renderOptions) {
|
|
670
|
+
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
|
|
671
671
|
}
|
|
672
672
|
animate(keyframe, _options, _type, _isTemp) {
|
|
673
673
|
this.set(keyframe);
|
|
@@ -1689,7 +1689,7 @@ __decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0
|
|
|
1689
1689
|
|
|
1690
1690
|
exports.Canvas = __decorate([ core.registerUI() ], exports.Canvas);
|
|
1691
1691
|
|
|
1692
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = core.BoundsHelper;
|
|
1692
|
+
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = core.BoundsHelper, {stintSet: stintSet} = core.DataHelper;
|
|
1693
1693
|
|
|
1694
1694
|
exports.Text = class Text extends exports.UI {
|
|
1695
1695
|
get __tag() {
|
|
@@ -1701,13 +1701,14 @@ exports.Text = class Text extends exports.UI {
|
|
|
1701
1701
|
}
|
|
1702
1702
|
__updateTextDrawData() {
|
|
1703
1703
|
const data = this.__;
|
|
1704
|
-
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
1704
|
+
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding, width: width, height: height} = data;
|
|
1705
1705
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
1706
1706
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
1707
|
-
data.__padding = padding ? core.MathHelper.fourNumber(padding) : undefined;
|
|
1708
1707
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
1709
1708
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
1710
|
-
data
|
|
1709
|
+
stintSet(data, "__padding", padding && core.MathHelper.fourNumber(padding));
|
|
1710
|
+
stintSet(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
1711
|
+
stintSet(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
1711
1712
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
1712
1713
|
}
|
|
1713
1714
|
__updateBoxBounds() {
|
package/lib/draw.esm.js
CHANGED
|
@@ -125,7 +125,7 @@ const Transition = {
|
|
|
125
125
|
|
|
126
126
|
const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
|
|
127
127
|
|
|
128
|
-
const {stintSet: stintSet$
|
|
128
|
+
const {stintSet: stintSet$2} = DataHelper, {hasTransparent: hasTransparent} = ColorConvert;
|
|
129
129
|
|
|
130
130
|
const emptyPaint = {};
|
|
131
131
|
|
|
@@ -192,7 +192,7 @@ class UIData extends LeafData {
|
|
|
192
192
|
setFill(value) {
|
|
193
193
|
if (this.__naturalWidth) this.__removeNaturalSize();
|
|
194
194
|
if (isString(value) || !value) {
|
|
195
|
-
stintSet$
|
|
195
|
+
stintSet$2(this, "__isTransparentFill", hasTransparent(value));
|
|
196
196
|
this.__isFills && this.__removePaint("fill", true);
|
|
197
197
|
this._fill = value;
|
|
198
198
|
} else if (isObject(value)) {
|
|
@@ -201,7 +201,7 @@ class UIData extends LeafData {
|
|
|
201
201
|
}
|
|
202
202
|
setStroke(value) {
|
|
203
203
|
if (isString(value) || !value) {
|
|
204
|
-
stintSet$
|
|
204
|
+
stintSet$2(this, "__isTransparentStroke", hasTransparent(value));
|
|
205
205
|
this.__isStrokes && this.__removePaint("stroke", true);
|
|
206
206
|
this._stroke = value;
|
|
207
207
|
} else if (isObject(value)) {
|
|
@@ -259,11 +259,11 @@ class UIData extends LeafData {
|
|
|
259
259
|
if (removeInput) this.__removeInput(attrName);
|
|
260
260
|
PaintImage.recycleImage(attrName, this);
|
|
261
261
|
if (attrName === "fill") {
|
|
262
|
-
stintSet$
|
|
262
|
+
stintSet$2(this, "__isAlphaPixelFill", undefined);
|
|
263
263
|
this._fill = this.__isFills = undefined;
|
|
264
264
|
} else {
|
|
265
|
-
stintSet$
|
|
266
|
-
stintSet$
|
|
265
|
+
stintSet$2(this, "__isAlphaPixelStroke", undefined);
|
|
266
|
+
stintSet$2(this, "__hasMultiStrokeStyle", undefined);
|
|
267
267
|
this._stroke = this.__isStrokes = undefined;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
@@ -450,23 +450,23 @@ const UIBounds = {
|
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
452
|
|
|
453
|
-
const {stintSet: stintSet} = DataHelper;
|
|
453
|
+
const {stintSet: stintSet$1} = DataHelper;
|
|
454
454
|
|
|
455
455
|
const UIRender = {
|
|
456
456
|
__updateChange() {
|
|
457
457
|
const data = this.__;
|
|
458
458
|
if (data.__useStroke) {
|
|
459
459
|
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
460
|
-
stintSet(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
|
|
461
|
-
stintSet(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
|
|
460
|
+
stintSet$1(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
|
|
461
|
+
stintSet$1(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
|
|
462
462
|
}
|
|
463
463
|
if (data.__useEffect) {
|
|
464
464
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
465
|
-
stintSet(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
465
|
+
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
466
466
|
data.__useEffect = !!(shadow || otherEffect);
|
|
467
467
|
}
|
|
468
468
|
data.__checkSingle();
|
|
469
|
-
stintSet(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
469
|
+
stintSet$1(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
470
470
|
},
|
|
471
471
|
__drawFast(canvas, options) {
|
|
472
472
|
drawFast(this, canvas, options);
|
|
@@ -482,24 +482,24 @@ const UIRender = {
|
|
|
482
482
|
this.__nowWorld = this.__getNowWorld(options);
|
|
483
483
|
const {shadow: shadow, innerShadow: innerShadow, filter: filter} = data;
|
|
484
484
|
if (shadow) Effect.shadow(this, canvas, shape);
|
|
485
|
-
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
486
|
-
if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
485
|
+
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
486
|
+
if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
|
|
487
487
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options);
|
|
488
488
|
if (innerShadow) Effect.innerShadow(this, canvas, shape);
|
|
489
|
-
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
489
|
+
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
490
490
|
if (filter) Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
491
491
|
if (shape.worldCanvas) shape.worldCanvas.recycle();
|
|
492
492
|
shape.canvas.recycle();
|
|
493
493
|
} else {
|
|
494
|
-
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
494
|
+
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
495
495
|
if (__isFastShadow) {
|
|
496
496
|
const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
|
|
497
497
|
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
498
498
|
}
|
|
499
|
-
if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
499
|
+
if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
|
|
500
500
|
if (__isFastShadow) canvas.restore();
|
|
501
501
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options);
|
|
502
|
-
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
502
|
+
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
503
503
|
}
|
|
504
504
|
} else {
|
|
505
505
|
if (data.__pathInputed) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
|
|
@@ -508,9 +508,9 @@ const UIRender = {
|
|
|
508
508
|
__drawShape(canvas, options) {
|
|
509
509
|
this.__drawRenderPath(canvas);
|
|
510
510
|
const data = this.__, {fill: fill, stroke: stroke} = data;
|
|
511
|
-
if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill("#000000", this, canvas);
|
|
511
|
+
if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas, options) : Paint.fill("#000000", this, canvas, options);
|
|
512
512
|
if (data.__isCanvas) this.__drawAfterFill(canvas, options);
|
|
513
|
-
if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke("#000000", this, canvas);
|
|
513
|
+
if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke("#000000", this, canvas, options);
|
|
514
514
|
},
|
|
515
515
|
__drawAfterFill(canvas, options) {
|
|
516
516
|
if (this.__.__clipAfterFill) {
|
|
@@ -525,10 +525,10 @@ const UIRender = {
|
|
|
525
525
|
function drawFast(ui, canvas, options) {
|
|
526
526
|
const {fill: fill, stroke: stroke, __drawAfterFill: __drawAfterFill, __fillAfterStroke: __fillAfterStroke} = ui.__;
|
|
527
527
|
ui.__drawRenderPath(canvas);
|
|
528
|
-
if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
|
|
529
|
-
if (fill) Paint.fill(fill, ui, canvas);
|
|
528
|
+
if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
|
|
529
|
+
if (fill) Paint.fill(fill, ui, canvas, options);
|
|
530
530
|
if (__drawAfterFill) ui.__drawAfterFill(canvas, options);
|
|
531
|
-
if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
|
|
531
|
+
if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
const RectRender = {
|
|
@@ -666,8 +666,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
666
666
|
drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
|
|
667
667
|
} else drawer.rect(x, y, width, height);
|
|
668
668
|
}
|
|
669
|
-
drawImagePlaceholder(canvas,
|
|
670
|
-
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
669
|
+
drawImagePlaceholder(_image, canvas, renderOptions) {
|
|
670
|
+
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
|
|
671
671
|
}
|
|
672
672
|
animate(keyframe, _options, _type, _isTemp) {
|
|
673
673
|
this.set(keyframe);
|
|
@@ -1689,7 +1689,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
|
|
|
1689
1689
|
|
|
1690
1690
|
Canvas = __decorate([ registerUI() ], Canvas);
|
|
1691
1691
|
|
|
1692
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
1692
|
+
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet} = DataHelper;
|
|
1693
1693
|
|
|
1694
1694
|
let Text = class Text extends UI {
|
|
1695
1695
|
get __tag() {
|
|
@@ -1701,13 +1701,14 @@ let Text = class Text extends UI {
|
|
|
1701
1701
|
}
|
|
1702
1702
|
__updateTextDrawData() {
|
|
1703
1703
|
const data = this.__;
|
|
1704
|
-
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
1704
|
+
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding, width: width, height: height} = data;
|
|
1705
1705
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
1706
1706
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
1707
|
-
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
1708
1707
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
1709
1708
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
1710
|
-
data
|
|
1709
|
+
stintSet(data, "__padding", padding && MathHelper.fourNumber(padding));
|
|
1710
|
+
stintSet(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
1711
|
+
stintSet(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
1711
1712
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
1712
1713
|
}
|
|
1713
1714
|
__updateBoxBounds() {
|
package/lib/draw.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,isObject as r,PathConvert as a,DataHelper as n,Debug as _,LeafData as h,isString as d,isUndefined as l,isArray as p,canvasSizeAttrs as u,UICreator as c,FourNumberHelper as g,dataProcessor as y,dataType as v,surfaceType as f,opacityType as w,visibleType as x,dimType as S,sortType as m,maskType as R,eraserType as k,positionType as B,boundsType as A,scaleType as b,rotationType as C,scrollType as P,autoLayoutType as F,naturalBoundsType as W,affectRenderBoundsType as T,pathInputType as E,pathType as I,hitType as D,strokeType as L,cursorType as z,rewrite as M,Leaf as O,useModule as N,rewriteAble as V,MathHelper as H,pen as Y,PathCorner as U,PathDrawer as X,isNumber as j,registerUI as J,Branch as q,LeafList as G,Resource as $,getBoundsData as K,Creator as Q,CanvasManager as Z,WaitHelper as tt,LeaferEvent as et,Bounds as it,ResizeEvent as st,AutoBounds as ot,Run as rt,LayoutEvent as at,RenderEvent as nt,WatchEvent as _t,ImageManager as ht,BoundsHelper as dt,PathCommandDataHelper as lt,Platform as pt,PointHelper as ut,affectStrokeBoundsType as ct,getPointData as gt,LeaferImage as yt,ImageEvent as vt,Matrix as ft,PathCreator as wt}from"@leafer/core";export*from"@leafer/core";function xt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function St(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function mt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Rt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function kt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Bt={},At={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},bt={number:(t,e)=>r(t)?"percent"===t.type?t.value*e:t.value:t},Ct={},Pt={},Ft={},Wt={},Tt={},Et={apply(){o.need("filter")}},It={},Dt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Lt={list:{},register(t,e){Lt.list[t]=e},get:t=>Lt.list[t]},{parse:zt,objectToCanvasData:Mt}=a,{stintSet:Ot}=n,{hasTransparent:Nt}=At,Vt={},Ht=_.get("UIData");class Yt extends h{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Ht.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Ht.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Ot(this,"__isTransparentFill",Nt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Ot(this,"__isTransparentStroke",Nt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):r(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&r(t[0])?(this.__setInput("path",t),this._path=e?zt(t):Mt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Ut(this,"shadow",t)}setInnerShadow(t){Ut(this,"innerShadow",t)}setFilter(t){Ut(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Pt.compute("fill",this.__leaf),e&&Pt.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),l(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Vt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Vt))}__removePaint(t,e){e&&this.__removeInput(t),Ft.recycleImage(t,this),"fill"===t?(Ot(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ot(this,"__isAlphaPixelStroke",void 0),Ot(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Ut(t,e,i){t.__setInput(e,i),p(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Xt extends Yt{}class jt extends Xt{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Jt extends Xt{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class qt extends jt{}class Gt extends Yt{get __usePathBox(){return this.points||this.__pathInputed}}class $t extends Yt{get __boxStroke(){return!this.__pathInputed}}class Kt extends Yt{get __boxStroke(){return!this.__pathInputed}}class Qt extends Gt{}class Zt extends Yt{}class te extends Yt{get __pathInputed(){return 2}}class ee extends Xt{}const ie={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class se extends Yt{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=ie[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=c.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class oe extends $t{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class re extends $t{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:ae,add:ne}=g,_e={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=ae(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__,{strokeSpread:n}=this.__layout,_=this.__box;e&&(t=Tt.getShadowRenderSpread(this,e)),s&&(t=ae(t,s)),r&&(t=ne(t,Et.getSpread(r))),a&&(t=ne(t,a)),n&&(t=ne(t,n));let h=t;return i&&(h=ae(h,Tt.getInnerShadowSpread(this,i))),o&&(h=ae(h,o)),this.__layout.renderShapeSpread=h,_?ae(_.__updateRenderSpread(),t):t}},{stintSet:he}=n,de={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);he(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),he(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;he(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Tt.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),he(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){le(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:r,__drawAfterFill:a,__fillAfterStroke:n,__isFastShadow:_}=s;if(this.__drawRenderPath(t),s.__useEffect&&!_){const _=Pt.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Tt.shadow(this,t,_),n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t)),o&&(s.__isFills?Pt.fills(o,this,t):Pt.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Tt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t)),l&&Et.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,At.string(e.color))}o&&(s.__isFills?Pt.fills(o,this,t):Pt.fill(o,this,t)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t))}}else s.__pathInputed?le(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Pt.fills(s,this,t):Pt.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Pt.strokes(o,this,t):Pt.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function le(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Pt.stroke(o,t,e),s&&Pt.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&Pt.stroke(o,t,e)}const pe={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:_}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),_&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:_}=this.__;if(!_)return;t.setStroke(n,_,this.__);const h=_/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=_,r-=_,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+h,s+h,o,r),t.restore()):t.strokeRect(i+h,s+h,o,r);break;case"outside":t.strokeRect(i-h,s-h,o+_,r+_)}}}};var ue;let ce=ue=class extends O{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){H.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Y.set(this.path=t||[]),t||this.__drawPathByBox(Y),Y}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return o.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return o.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Y.set(i=[]),this.__drawPathByBox(Y)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||It.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?U.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ct.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?X.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,o,j(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Pt.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),o.need("animate")}killAnimate(t,e){}export(t,e){return o.need("export")}syncExport(t,e){return o.need("export")}clone(t){const e=n.clone(this.toJSON());return t&&Object.assign(e,t),ue.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){J()(this)}static registerData(t){y(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};xt([y(Yt)],ce.prototype,"__",void 0),xt([Rt()],ce.prototype,"zoomLayer",void 0),xt([v("")],ce.prototype,"id",void 0),xt([v("")],ce.prototype,"name",void 0),xt([v("")],ce.prototype,"className",void 0),xt([f("pass-through")],ce.prototype,"blendMode",void 0),xt([w(1)],ce.prototype,"opacity",void 0),xt([x(!0)],ce.prototype,"visible",void 0),xt([f(!1)],ce.prototype,"locked",void 0),xt([S(!1)],ce.prototype,"dim",void 0),xt([S(!1)],ce.prototype,"dimskip",void 0),xt([m(0)],ce.prototype,"zIndex",void 0),xt([R(!1)],ce.prototype,"mask",void 0),xt([k(!1)],ce.prototype,"eraser",void 0),xt([B(0,!0)],ce.prototype,"x",void 0),xt([B(0,!0)],ce.prototype,"y",void 0),xt([A(100,!0)],ce.prototype,"width",void 0),xt([A(100,!0)],ce.prototype,"height",void 0),xt([b(1,!0)],ce.prototype,"scaleX",void 0),xt([b(1,!0)],ce.prototype,"scaleY",void 0),xt([C(0,!0)],ce.prototype,"rotation",void 0),xt([C(0,!0)],ce.prototype,"skewX",void 0),xt([C(0,!0)],ce.prototype,"skewY",void 0),xt([B(0,!0)],ce.prototype,"offsetX",void 0),xt([B(0,!0)],ce.prototype,"offsetY",void 0),xt([P(0,!0)],ce.prototype,"scrollX",void 0),xt([P(0,!0)],ce.prototype,"scrollY",void 0),xt([F()],ce.prototype,"origin",void 0),xt([F()],ce.prototype,"around",void 0),xt([v(!1)],ce.prototype,"lazy",void 0),xt([W(1)],ce.prototype,"pixelRatio",void 0),xt([T(0)],ce.prototype,"renderSpread",void 0),xt([E()],ce.prototype,"path",void 0),xt([I()],ce.prototype,"windingRule",void 0),xt([I(!0)],ce.prototype,"closed",void 0),xt([A(0)],ce.prototype,"padding",void 0),xt([A(!1)],ce.prototype,"lockRatio",void 0),xt([A()],ce.prototype,"widthRange",void 0),xt([A()],ce.prototype,"heightRange",void 0),xt([v(!1)],ce.prototype,"draggable",void 0),xt([v()],ce.prototype,"dragBounds",void 0),xt([v("auto")],ce.prototype,"dragBoundsType",void 0),xt([v(!1)],ce.prototype,"editable",void 0),xt([D(!0)],ce.prototype,"hittable",void 0),xt([D("path")],ce.prototype,"hitFill",void 0),xt([L("path")],ce.prototype,"hitStroke",void 0),xt([D(!1)],ce.prototype,"hitBox",void 0),xt([D(!0)],ce.prototype,"hitChildren",void 0),xt([D(!0)],ce.prototype,"hitSelf",void 0),xt([D()],ce.prototype,"hitRadius",void 0),xt([z("")],ce.prototype,"cursor",void 0),xt([f()],ce.prototype,"fill",void 0),xt([L(void 0,!0)],ce.prototype,"stroke",void 0),xt([L("inside")],ce.prototype,"strokeAlign",void 0),xt([L(1,!0)],ce.prototype,"strokeWidth",void 0),xt([L(!1)],ce.prototype,"strokeWidthFixed",void 0),xt([L("none")],ce.prototype,"strokeCap",void 0),xt([L("miter")],ce.prototype,"strokeJoin",void 0),xt([L()],ce.prototype,"dashPattern",void 0),xt([L(0)],ce.prototype,"dashOffset",void 0),xt([L(10)],ce.prototype,"miterLimit",void 0),xt([I(0)],ce.prototype,"cornerRadius",void 0),xt([I()],ce.prototype,"cornerSmoothing",void 0),xt([St()],ce.prototype,"shadow",void 0),xt([St()],ce.prototype,"innerShadow",void 0),xt([St()],ce.prototype,"blur",void 0),xt([St()],ce.prototype,"backgroundBlur",void 0),xt([St()],ce.prototype,"grayscale",void 0),xt([St()],ce.prototype,"filter",void 0),xt([f()],ce.prototype,"placeholderColor",void 0),xt([v(100)],ce.prototype,"placeholderDelay",void 0),xt([v({})],ce.prototype,"data",void 0),xt([M(O.prototype.reset)],ce.prototype,"reset",null),ce=ue=xt([N(_e),N(de),V()],ce);let ge=class extends ce{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var ye;xt([y(Xt)],ge.prototype,"__",void 0),xt([A(0)],ge.prototype,"width",void 0),xt([A(0)],ge.prototype,"height",void 0),ge=xt([N(q),J()],ge);const ve=_.get("Leafer");let fe=ye=class extends ge{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&$.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||K()}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),ye.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,n.assign(s,t));const o=this.canvas=Q.canvas(s);this.__controllers.push(this.renderer=Q.renderer(this,o,s),this.watcher=Q.watcher(this,s),this.layouter=Q.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=Q.selector(this),this.interaction=Q.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Q.hitCanvasManager()),this.canvasManager=new Z,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),tt.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(et.RESTART):this.emitLeafer(et.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(et.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,u);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new it(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=n.copyAttrs({},this.canvas,u);e.resize(t),this.updateLazyBounds(),this.__onResize(new st(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,u),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new ot(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(u.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(et.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,u);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(et.BEFORE_READY),this.emitLeafer(et.READY),this.emitLeafer(et.AFTER_READY),tt.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(et.VIEW_READY),tt.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:r}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(o=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:o,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){tt.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(et.VIEW_COMPLETED),tt.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return o.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new et(t,this))}__listenEvents(){const t=rt.start("FirstCreate "+this.innerName);this.once([[et.START,()=>rt.end(t)],[at.START,this.updateLazyBounds,this],[nt.START,this.__onCreated,this],[nt.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[_t.DATA,this.__onWatchData,this],[at.END,this.__onLayoutEnd,this],[nt.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ye.list.remove(this);try{this.stop(),this.emitLeafer(et.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ht.clearRecycled()},100)}catch(t){ve.error(t)}}};t?e():setTimeout(e)}};fe.list=new G,xt([y(Jt)],fe.prototype,"__",void 0),xt([A()],fe.prototype,"pixelRatio",void 0),xt([v("normal")],fe.prototype,"mode",void 0),fe=ye=xt([J()],fe);let we=class extends ce{get __tag(){return"Rect"}};xt([y($t)],we.prototype,"__",void 0),we=xt([N(pe),V(),J()],we);const{add:xe,includes:Se,scroll:me}=dt,Re=we.prototype,ke=ge.prototype;let Be=class extends ge{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=K());super.__updateRenderBounds(n),(e=a.includes("scroll"))&&(xe(n,r),me(n,i)),this.__updateRectRenderBounds(),t=!Se(r,n),t&&"show"===a&&xe(o,n)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};xt([y(jt)],Be.prototype,"__",void 0),xt([A(100)],Be.prototype,"width",void 0),xt([A(100)],Be.prototype,"height",void 0),xt([v(!1)],Be.prototype,"resizeChildren",void 0),xt([T("show")],Be.prototype,"overflow",void 0),xt([M(Re.__updateStrokeSpread)],Be.prototype,"__updateStrokeSpread",null),xt([M(Re.__updateRenderSpread)],Be.prototype,"__updateRectRenderSpread",null),xt([M(Re.__updateBoxBounds)],Be.prototype,"__updateRectBoxBounds",null),xt([M(Re.__updateStrokeBounds)],Be.prototype,"__updateStrokeBounds",null),xt([M(Re.__updateRenderBounds)],Be.prototype,"__updateRectRenderBounds",null),xt([M(Re.__updateChange)],Be.prototype,"__updateRectChange",null),xt([M(Re.__render)],Be.prototype,"__renderRect",null),xt([M(ke.__render)],Be.prototype,"__renderGroup",null),Be=xt([V(),J()],Be);let Ae=class extends Be{get __tag(){return"Frame"}get isFrame(){return!0}};xt([y(qt)],Ae.prototype,"__",void 0),xt([f("#FFFFFF")],Ae.prototype,"fill",void 0),xt([T("hide")],Ae.prototype,"overflow",void 0),Ae=xt([J()],Ae);const{moveTo:be,closePath:Ce,ellipse:Pe}=lt;let Fe=class extends ce{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];i?(s||o?(i<1&&Pe(n,r,a,r*i,a*i,0,s,o,!1),Pe(n,r,a,r,a,0,o,s,!0),i<1&&Ce(n)):(i<1&&(Pe(n,r,a,r*i,a*i),be(n,t,a)),Pe(n,r,a,r,a,0,360,0,!0)),pt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(be(n,r,a),Pe(n,r,a,r,a,0,s,o,!1),Ce(n)):Pe(n,r,a,r,a)}};xt([y(Kt)],Fe.prototype,"__",void 0),xt([I(0)],Fe.prototype,"innerRadius",void 0),xt([I(0)],Fe.prototype,"startAngle",void 0),xt([I(0)],Fe.prototype,"endAngle",void 0),Fe=xt([J()],Fe);const{sin:We,cos:Te,PI:Ee}=Math,{moveTo:Ie,lineTo:De,closePath:Le,drawPoints:ze}=lt;let Me=class extends ce{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ze(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,r=i/2,a=s/2;Ie(e,r,0);for(let t=1;t<o;t++)De(e,r+r*We(2*t*Ee/o),a-a*Te(2*t*Ee/o));Le(e)}}};xt([y(Qt)],Me.prototype,"__",void 0),xt([I(3)],Me.prototype,"sides",void 0),xt([I()],Me.prototype,"points",void 0),xt([I(0)],Me.prototype,"curve",void 0),Me=xt([V(),J()],Me);const{sin:Oe,cos:Ne,PI:Ve}=Math,{moveTo:He,lineTo:Ye,closePath:Ue}=lt;let Xe=class extends ce{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];He(a,o,0);for(let t=1;t<2*i;t++)Ye(a,o+(t%2==0?o:o*s)*Oe(t*Ve/i),r-(t%2==0?r:r*s)*Ne(t*Ve/i));Ue(a)}};xt([y(Zt)],Xe.prototype,"__",void 0),xt([I(5)],Xe.prototype,"corners",void 0),xt([I(.382)],Xe.prototype,"innerRadius",void 0),Xe=xt([J()],Xe);const{moveTo:je,lineTo:Je,drawPoints:qe}=lt,{rotate:Ge,getAngle:$e,getDistance:Ke,defaultPoint:Qe}=ut;let Ze=class extends ce{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=gt();return t&&(i.x=t),e&&Ge(i,e),i}set toPoint(t){this.width=Ke(Qe,t),this.rotation=$e(Qe,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?qe(e,t.points,t.curve,t.closed):(je(e,0,0),Je(e,this.width,0))}};xt([y(Gt)],Ze.prototype,"__",void 0),xt([ct("center")],Ze.prototype,"strokeAlign",void 0),xt([A(0)],Ze.prototype,"height",void 0),xt([I()],Ze.prototype,"points",void 0),xt([I(0)],Ze.prototype,"curve",void 0),xt([I(!1)],Ze.prototype,"closed",void 0),Ze=xt([J()],Ze);let ti=class extends we{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}};xt([y(oe)],ti.prototype,"__",void 0),xt([A("")],ti.prototype,"url",void 0),ti=xt([J()],ti);const ei=ti;let ii=class extends we{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Q.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new yt({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new vt(vt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new ft(t.worldTransform).invert(),r=new ft;e&&r.translate(e.x,e.y),i&&(j(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};xt([y(re)],ii.prototype,"__",void 0),xt([mt(100)],ii.prototype,"width",void 0),xt([mt(100)],ii.prototype,"height",void 0),xt([mt(1)],ii.prototype,"pixelRatio",void 0),xt([mt(!0)],ii.prototype,"smooth",void 0),xt([v(!1)],ii.prototype,"safeResize",void 0),xt([mt()],ii.prototype,"contextSettings",void 0),ii=xt([J()],ii);const{copyAndSpread:si,includes:oi,spread:ri,setList:ai}=dt;let ni=class extends ce{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h}=t;t.__lineHeight=bt.number(e,o),t.__letterSpacing=bt.number(i,o),t.__padding=h?H.fourNumber(h):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o||12}px ${s||"caption"}`,t.__clipText="show"!==_&&!t.__autoSize,t.__textDrawData=Bt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&ri(_,i/2),r||a){if(h.x=r?_.x:0,h.y=a?_.y:0,h.width=r?_.width:t.width,h.height=a?_.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(h.x-=o,h.width+=i+o),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),n.stintSet(this,"isOverflow",!oi(h,_)),this.isOverflow?(ai(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;si(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};xt([y(se)],ni.prototype,"__",void 0),xt([A(0)],ni.prototype,"width",void 0),xt([A(0)],ni.prototype,"height",void 0),xt([f()],ni.prototype,"boxStyle",void 0),xt([v(!1)],ni.prototype,"resizeFontSize",void 0),xt([f("#000000")],ni.prototype,"fill",void 0),xt([ct("outside")],ni.prototype,"strokeAlign",void 0),xt([D("all")],ni.prototype,"hitFill",void 0),xt([A("")],ni.prototype,"text",void 0),xt([A("")],ni.prototype,"placeholder",void 0),xt([A("caption")],ni.prototype,"fontFamily",void 0),xt([A(12)],ni.prototype,"fontSize",void 0),xt([A("normal")],ni.prototype,"fontWeight",void 0),xt([A(!1)],ni.prototype,"italic",void 0),xt([A("none")],ni.prototype,"textCase",void 0),xt([A("none")],ni.prototype,"textDecoration",void 0),xt([A(0)],ni.prototype,"letterSpacing",void 0),xt([A({type:"percent",value:1.5})],ni.prototype,"lineHeight",void 0),xt([A(0)],ni.prototype,"paraIndent",void 0),xt([A(0)],ni.prototype,"paraSpacing",void 0),xt([A("x")],ni.prototype,"writingMode",void 0),xt([A("left")],ni.prototype,"textAlign",void 0),xt([A("top")],ni.prototype,"verticalAlign",void 0),xt([A(!0)],ni.prototype,"autoSizeAlign",void 0),xt([A("normal")],ni.prototype,"textWrap",void 0),xt([A("show")],ni.prototype,"textOverflow",void 0),xt([f(!1)],ni.prototype,"textEditing",void 0),ni=xt([J()],ni);let _i=class extends ce{get __tag(){return"Path"}};xt([y(te)],_i.prototype,"__",void 0),xt([ct("center")],_i.prototype,"strokeAlign",void 0),_i=xt([J()],_i);let hi=class extends ge{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new _i(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};xt([y(ee)],hi.prototype,"__",void 0),xt([(e,i)=>{t(e,i,{get(){return this.__path}})}],hi.prototype,"path",void 0),hi=xt([N(wt,["set","path","paint"]),J()],hi);export{Be as Box,jt as BoxData,ii as Canvas,re as CanvasData,At as ColorConvert,Tt as Effect,Fe as Ellipse,Kt as EllipseData,It as Export,Et as Filter,Ae as Frame,qt as FrameData,ge as Group,Xt as GroupData,ti as Image,oe as ImageData,fe as Leafer,Jt as LeaferData,Ze as Line,Gt as LineData,ei as MyImage,Pt as Paint,Wt as PaintGradient,Ft as PaintImage,_i as Path,Ct as PathArrow,te as PathData,hi as Pen,ee as PenData,Me as Polygon,Qt as PolygonData,we as Rect,$t as RectData,pe as RectRender,Xe as Star,Zt as StarData,Dt as State,ni as Text,Bt as TextConvert,se as TextData,Lt as Transition,ce as UI,_e as UIBounds,Yt as UIData,de as UIRender,bt as UnitConvert,kt as createAttr,St as effectType,mt as resizeType,Rt as zoomLayerType};
|
|
1
|
+
import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,isObject as r,PathConvert as a,DataHelper as n,Debug as _,LeafData as h,isString as d,isUndefined as l,isArray as p,canvasSizeAttrs as u,UICreator as c,FourNumberHelper as g,dataProcessor as y,dataType as v,surfaceType as f,opacityType as w,visibleType as x,dimType as S,sortType as m,maskType as R,eraserType as k,positionType as B,boundsType as A,scaleType as b,rotationType as C,scrollType as P,autoLayoutType as F,naturalBoundsType as W,affectRenderBoundsType as T,pathInputType as E,pathType as I,hitType as D,strokeType as L,cursorType as z,rewrite as M,Leaf as O,useModule as N,rewriteAble as V,MathHelper as H,pen as Y,PathCorner as U,PathDrawer as X,isNumber as j,registerUI as J,Branch as q,LeafList as G,Resource as $,getBoundsData as K,Creator as Q,CanvasManager as Z,WaitHelper as tt,LeaferEvent as et,Bounds as it,ResizeEvent as st,AutoBounds as ot,Run as rt,LayoutEvent as at,RenderEvent as nt,WatchEvent as _t,ImageManager as ht,BoundsHelper as dt,PathCommandDataHelper as lt,Platform as pt,PointHelper as ut,affectStrokeBoundsType as ct,getPointData as gt,LeaferImage as yt,ImageEvent as vt,Matrix as ft,PathCreator as wt}from"@leafer/core";export*from"@leafer/core";function xt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function St(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function mt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Rt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function kt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Bt={},At={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},bt={number:(t,e)=>r(t)?"percent"===t.type?t.value*e:t.value:t},Ct={},Pt={},Ft={},Wt={},Tt={},Et={apply(){o.need("filter")}},It={},Dt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Lt={list:{},register(t,e){Lt.list[t]=e},get:t=>Lt.list[t]},{parse:zt,objectToCanvasData:Mt}=a,{stintSet:Ot}=n,{hasTransparent:Nt}=At,Vt={},Ht=_.get("UIData");class Yt extends h{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Ht.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Ht.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Ot(this,"__isTransparentFill",Nt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Ot(this,"__isTransparentStroke",Nt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):r(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&r(t[0])?(this.__setInput("path",t),this._path=e?zt(t):Mt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Ut(this,"shadow",t)}setInnerShadow(t){Ut(this,"innerShadow",t)}setFilter(t){Ut(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Pt.compute("fill",this.__leaf),e&&Pt.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),l(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Vt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Vt))}__removePaint(t,e){e&&this.__removeInput(t),Ft.recycleImage(t,this),"fill"===t?(Ot(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ot(this,"__isAlphaPixelStroke",void 0),Ot(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Ut(t,e,i){t.__setInput(e,i),p(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Xt extends Yt{}class jt extends Xt{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Jt extends Xt{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class qt extends jt{}class Gt extends Yt{get __usePathBox(){return this.points||this.__pathInputed}}class $t extends Yt{get __boxStroke(){return!this.__pathInputed}}class Kt extends Yt{get __boxStroke(){return!this.__pathInputed}}class Qt extends Gt{}class Zt extends Yt{}class te extends Yt{get __pathInputed(){return 2}}class ee extends Xt{}const ie={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class se extends Yt{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=ie[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=c.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class oe extends $t{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class re extends $t{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:ae,add:ne}=g,_e={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=ae(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__,{strokeSpread:n}=this.__layout,_=this.__box;e&&(t=Tt.getShadowRenderSpread(this,e)),s&&(t=ae(t,s)),r&&(t=ne(t,Et.getSpread(r))),a&&(t=ne(t,a)),n&&(t=ne(t,n));let h=t;return i&&(h=ae(h,Tt.getInnerShadowSpread(this,i))),o&&(h=ae(h,o)),this.__layout.renderShapeSpread=h,_?ae(_.__updateRenderSpread(),t):t}},{stintSet:he}=n,de={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);he(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),he(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;he(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Tt.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),he(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){le(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:r,__drawAfterFill:a,__fillAfterStroke:n,__isFastShadow:_}=s;if(this.__drawRenderPath(t),s.__useEffect&&!_){const _=Pt.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Tt.shadow(this,t,_),n&&(s.__isStrokes?Pt.strokes(r,this,t,e):Pt.stroke(r,this,t,e)),o&&(s.__isFills?Pt.fills(o,this,t,e):Pt.fill(o,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Tt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Pt.strokes(r,this,t,e):Pt.stroke(r,this,t,e)),l&&Et.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Pt.strokes(r,this,t,e):Pt.stroke(r,this,t,e)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,At.string(e.color))}o&&(s.__isFills?Pt.fills(o,this,t,e):Pt.fill(o,this,t,e)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Pt.strokes(r,this,t,e):Pt.stroke(r,this,t,e))}}else s.__pathInputed?le(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Pt.fills(s,this,t,e):Pt.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Pt.strokes(o,this,t,e):Pt.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function le(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Pt.stroke(o,t,e,i),s&&Pt.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),o&&!a&&Pt.stroke(o,t,e,i)}const pe={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:_}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),_&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:_}=this.__;if(!_)return;t.setStroke(n,_,this.__);const h=_/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=_,r-=_,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+h,s+h,o,r),t.restore()):t.strokeRect(i+h,s+h,o,r);break;case"outside":t.strokeRect(i-h,s-h,o+_,r+_)}}}};var ue;let ce=ue=class extends O{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){H.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Y.set(this.path=t||[]),t||this.__drawPathByBox(Y),Y}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return o.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return o.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Y.set(i=[]),this.__drawPathByBox(Y)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||It.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?U.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ct.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?X.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,o,j(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e,i){Pt.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),o.need("animate")}killAnimate(t,e){}export(t,e){return o.need("export")}syncExport(t,e){return o.need("export")}clone(t){const e=n.clone(this.toJSON());return t&&Object.assign(e,t),ue.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){J()(this)}static registerData(t){y(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};xt([y(Yt)],ce.prototype,"__",void 0),xt([Rt()],ce.prototype,"zoomLayer",void 0),xt([v("")],ce.prototype,"id",void 0),xt([v("")],ce.prototype,"name",void 0),xt([v("")],ce.prototype,"className",void 0),xt([f("pass-through")],ce.prototype,"blendMode",void 0),xt([w(1)],ce.prototype,"opacity",void 0),xt([x(!0)],ce.prototype,"visible",void 0),xt([f(!1)],ce.prototype,"locked",void 0),xt([S(!1)],ce.prototype,"dim",void 0),xt([S(!1)],ce.prototype,"dimskip",void 0),xt([m(0)],ce.prototype,"zIndex",void 0),xt([R(!1)],ce.prototype,"mask",void 0),xt([k(!1)],ce.prototype,"eraser",void 0),xt([B(0,!0)],ce.prototype,"x",void 0),xt([B(0,!0)],ce.prototype,"y",void 0),xt([A(100,!0)],ce.prototype,"width",void 0),xt([A(100,!0)],ce.prototype,"height",void 0),xt([b(1,!0)],ce.prototype,"scaleX",void 0),xt([b(1,!0)],ce.prototype,"scaleY",void 0),xt([C(0,!0)],ce.prototype,"rotation",void 0),xt([C(0,!0)],ce.prototype,"skewX",void 0),xt([C(0,!0)],ce.prototype,"skewY",void 0),xt([B(0,!0)],ce.prototype,"offsetX",void 0),xt([B(0,!0)],ce.prototype,"offsetY",void 0),xt([P(0,!0)],ce.prototype,"scrollX",void 0),xt([P(0,!0)],ce.prototype,"scrollY",void 0),xt([F()],ce.prototype,"origin",void 0),xt([F()],ce.prototype,"around",void 0),xt([v(!1)],ce.prototype,"lazy",void 0),xt([W(1)],ce.prototype,"pixelRatio",void 0),xt([T(0)],ce.prototype,"renderSpread",void 0),xt([E()],ce.prototype,"path",void 0),xt([I()],ce.prototype,"windingRule",void 0),xt([I(!0)],ce.prototype,"closed",void 0),xt([A(0)],ce.prototype,"padding",void 0),xt([A(!1)],ce.prototype,"lockRatio",void 0),xt([A()],ce.prototype,"widthRange",void 0),xt([A()],ce.prototype,"heightRange",void 0),xt([v(!1)],ce.prototype,"draggable",void 0),xt([v()],ce.prototype,"dragBounds",void 0),xt([v("auto")],ce.prototype,"dragBoundsType",void 0),xt([v(!1)],ce.prototype,"editable",void 0),xt([D(!0)],ce.prototype,"hittable",void 0),xt([D("path")],ce.prototype,"hitFill",void 0),xt([L("path")],ce.prototype,"hitStroke",void 0),xt([D(!1)],ce.prototype,"hitBox",void 0),xt([D(!0)],ce.prototype,"hitChildren",void 0),xt([D(!0)],ce.prototype,"hitSelf",void 0),xt([D()],ce.prototype,"hitRadius",void 0),xt([z("")],ce.prototype,"cursor",void 0),xt([f()],ce.prototype,"fill",void 0),xt([L(void 0,!0)],ce.prototype,"stroke",void 0),xt([L("inside")],ce.prototype,"strokeAlign",void 0),xt([L(1,!0)],ce.prototype,"strokeWidth",void 0),xt([L(!1)],ce.prototype,"strokeWidthFixed",void 0),xt([L("none")],ce.prototype,"strokeCap",void 0),xt([L("miter")],ce.prototype,"strokeJoin",void 0),xt([L()],ce.prototype,"dashPattern",void 0),xt([L(0)],ce.prototype,"dashOffset",void 0),xt([L(10)],ce.prototype,"miterLimit",void 0),xt([I(0)],ce.prototype,"cornerRadius",void 0),xt([I()],ce.prototype,"cornerSmoothing",void 0),xt([St()],ce.prototype,"shadow",void 0),xt([St()],ce.prototype,"innerShadow",void 0),xt([St()],ce.prototype,"blur",void 0),xt([St()],ce.prototype,"backgroundBlur",void 0),xt([St()],ce.prototype,"grayscale",void 0),xt([St()],ce.prototype,"filter",void 0),xt([f()],ce.prototype,"placeholderColor",void 0),xt([v(100)],ce.prototype,"placeholderDelay",void 0),xt([v({})],ce.prototype,"data",void 0),xt([M(O.prototype.reset)],ce.prototype,"reset",null),ce=ue=xt([N(_e),N(de),V()],ce);let ge=class extends ce{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var ye;xt([y(Xt)],ge.prototype,"__",void 0),xt([A(0)],ge.prototype,"width",void 0),xt([A(0)],ge.prototype,"height",void 0),ge=xt([N(q),J()],ge);const ve=_.get("Leafer");let fe=ye=class extends ge{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&$.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||K()}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),ye.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,n.assign(s,t));const o=this.canvas=Q.canvas(s);this.__controllers.push(this.renderer=Q.renderer(this,o,s),this.watcher=Q.watcher(this,s),this.layouter=Q.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=Q.selector(this),this.interaction=Q.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Q.hitCanvasManager()),this.canvasManager=new Z,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),tt.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(et.RESTART):this.emitLeafer(et.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(et.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,u);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new it(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=n.copyAttrs({},this.canvas,u);e.resize(t),this.updateLazyBounds(),this.__onResize(new st(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,u),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new ot(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(u.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(et.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,u);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(et.BEFORE_READY),this.emitLeafer(et.READY),this.emitLeafer(et.AFTER_READY),tt.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(et.VIEW_READY),tt.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:r}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(o=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:o,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){tt.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(et.VIEW_COMPLETED),tt.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return o.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new et(t,this))}__listenEvents(){const t=rt.start("FirstCreate "+this.innerName);this.once([[et.START,()=>rt.end(t)],[at.START,this.updateLazyBounds,this],[nt.START,this.__onCreated,this],[nt.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[_t.DATA,this.__onWatchData,this],[at.END,this.__onLayoutEnd,this],[nt.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ye.list.remove(this);try{this.stop(),this.emitLeafer(et.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ht.clearRecycled()},100)}catch(t){ve.error(t)}}};t?e():setTimeout(e)}};fe.list=new G,xt([y(Jt)],fe.prototype,"__",void 0),xt([A()],fe.prototype,"pixelRatio",void 0),xt([v("normal")],fe.prototype,"mode",void 0),fe=ye=xt([J()],fe);let we=class extends ce{get __tag(){return"Rect"}};xt([y($t)],we.prototype,"__",void 0),we=xt([N(pe),V(),J()],we);const{add:xe,includes:Se,scroll:me}=dt,Re=we.prototype,ke=ge.prototype;let Be=class extends ge{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=K());super.__updateRenderBounds(n),(e=a.includes("scroll"))&&(xe(n,r),me(n,i)),this.__updateRectRenderBounds(),t=!Se(r,n),t&&"show"===a&&xe(o,n)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};xt([y(jt)],Be.prototype,"__",void 0),xt([A(100)],Be.prototype,"width",void 0),xt([A(100)],Be.prototype,"height",void 0),xt([v(!1)],Be.prototype,"resizeChildren",void 0),xt([T("show")],Be.prototype,"overflow",void 0),xt([M(Re.__updateStrokeSpread)],Be.prototype,"__updateStrokeSpread",null),xt([M(Re.__updateRenderSpread)],Be.prototype,"__updateRectRenderSpread",null),xt([M(Re.__updateBoxBounds)],Be.prototype,"__updateRectBoxBounds",null),xt([M(Re.__updateStrokeBounds)],Be.prototype,"__updateStrokeBounds",null),xt([M(Re.__updateRenderBounds)],Be.prototype,"__updateRectRenderBounds",null),xt([M(Re.__updateChange)],Be.prototype,"__updateRectChange",null),xt([M(Re.__render)],Be.prototype,"__renderRect",null),xt([M(ke.__render)],Be.prototype,"__renderGroup",null),Be=xt([V(),J()],Be);let Ae=class extends Be{get __tag(){return"Frame"}get isFrame(){return!0}};xt([y(qt)],Ae.prototype,"__",void 0),xt([f("#FFFFFF")],Ae.prototype,"fill",void 0),xt([T("hide")],Ae.prototype,"overflow",void 0),Ae=xt([J()],Ae);const{moveTo:be,closePath:Ce,ellipse:Pe}=lt;let Fe=class extends ce{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];i?(s||o?(i<1&&Pe(n,r,a,r*i,a*i,0,s,o,!1),Pe(n,r,a,r,a,0,o,s,!0),i<1&&Ce(n)):(i<1&&(Pe(n,r,a,r*i,a*i),be(n,t,a)),Pe(n,r,a,r,a,0,360,0,!0)),pt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(be(n,r,a),Pe(n,r,a,r,a,0,s,o,!1),Ce(n)):Pe(n,r,a,r,a)}};xt([y(Kt)],Fe.prototype,"__",void 0),xt([I(0)],Fe.prototype,"innerRadius",void 0),xt([I(0)],Fe.prototype,"startAngle",void 0),xt([I(0)],Fe.prototype,"endAngle",void 0),Fe=xt([J()],Fe);const{sin:We,cos:Te,PI:Ee}=Math,{moveTo:Ie,lineTo:De,closePath:Le,drawPoints:ze}=lt;let Me=class extends ce{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ze(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,r=i/2,a=s/2;Ie(e,r,0);for(let t=1;t<o;t++)De(e,r+r*We(2*t*Ee/o),a-a*Te(2*t*Ee/o));Le(e)}}};xt([y(Qt)],Me.prototype,"__",void 0),xt([I(3)],Me.prototype,"sides",void 0),xt([I()],Me.prototype,"points",void 0),xt([I(0)],Me.prototype,"curve",void 0),Me=xt([V(),J()],Me);const{sin:Oe,cos:Ne,PI:Ve}=Math,{moveTo:He,lineTo:Ye,closePath:Ue}=lt;let Xe=class extends ce{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];He(a,o,0);for(let t=1;t<2*i;t++)Ye(a,o+(t%2==0?o:o*s)*Oe(t*Ve/i),r-(t%2==0?r:r*s)*Ne(t*Ve/i));Ue(a)}};xt([y(Zt)],Xe.prototype,"__",void 0),xt([I(5)],Xe.prototype,"corners",void 0),xt([I(.382)],Xe.prototype,"innerRadius",void 0),Xe=xt([J()],Xe);const{moveTo:je,lineTo:Je,drawPoints:qe}=lt,{rotate:Ge,getAngle:$e,getDistance:Ke,defaultPoint:Qe}=ut;let Ze=class extends ce{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=gt();return t&&(i.x=t),e&&Ge(i,e),i}set toPoint(t){this.width=Ke(Qe,t),this.rotation=$e(Qe,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?qe(e,t.points,t.curve,t.closed):(je(e,0,0),Je(e,this.width,0))}};xt([y(Gt)],Ze.prototype,"__",void 0),xt([ct("center")],Ze.prototype,"strokeAlign",void 0),xt([A(0)],Ze.prototype,"height",void 0),xt([I()],Ze.prototype,"points",void 0),xt([I(0)],Ze.prototype,"curve",void 0),xt([I(!1)],Ze.prototype,"closed",void 0),Ze=xt([J()],Ze);let ti=class extends we{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}};xt([y(oe)],ti.prototype,"__",void 0),xt([A("")],ti.prototype,"url",void 0),ti=xt([J()],ti);const ei=ti;let ii=class extends we{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Q.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new yt({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new vt(vt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new ft(t.worldTransform).invert(),r=new ft;e&&r.translate(e.x,e.y),i&&(j(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};xt([y(re)],ii.prototype,"__",void 0),xt([mt(100)],ii.prototype,"width",void 0),xt([mt(100)],ii.prototype,"height",void 0),xt([mt(1)],ii.prototype,"pixelRatio",void 0),xt([mt(!0)],ii.prototype,"smooth",void 0),xt([v(!1)],ii.prototype,"safeResize",void 0),xt([mt()],ii.prototype,"contextSettings",void 0),ii=xt([J()],ii);const{copyAndSpread:si,includes:oi,spread:ri,setList:ai}=dt,{stintSet:ni}=n;let _i=class extends ce{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h,width:d,height:l}=t;t.__lineHeight=bt.number(e,o),t.__letterSpacing=bt.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o||12}px ${s||"caption"}`,ni(t,"__padding",h&&H.fourNumber(h)),ni(t,"__clipText","show"!==_&&!t.__autoSize),ni(t,"__isCharMode",d||l||t.__letterSpacing||"none"!==n),t.__textDrawData=Bt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&ri(_,i/2),r||a){if(h.x=r?_.x:0,h.y=a?_.y:0,h.width=r?_.width:t.width,h.height=a?_.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(h.x-=o,h.width+=i+o),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),n.stintSet(this,"isOverflow",!oi(h,_)),this.isOverflow?(ai(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;si(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};xt([y(se)],_i.prototype,"__",void 0),xt([A(0)],_i.prototype,"width",void 0),xt([A(0)],_i.prototype,"height",void 0),xt([f()],_i.prototype,"boxStyle",void 0),xt([v(!1)],_i.prototype,"resizeFontSize",void 0),xt([f("#000000")],_i.prototype,"fill",void 0),xt([ct("outside")],_i.prototype,"strokeAlign",void 0),xt([D("all")],_i.prototype,"hitFill",void 0),xt([A("")],_i.prototype,"text",void 0),xt([A("")],_i.prototype,"placeholder",void 0),xt([A("caption")],_i.prototype,"fontFamily",void 0),xt([A(12)],_i.prototype,"fontSize",void 0),xt([A("normal")],_i.prototype,"fontWeight",void 0),xt([A(!1)],_i.prototype,"italic",void 0),xt([A("none")],_i.prototype,"textCase",void 0),xt([A("none")],_i.prototype,"textDecoration",void 0),xt([A(0)],_i.prototype,"letterSpacing",void 0),xt([A({type:"percent",value:1.5})],_i.prototype,"lineHeight",void 0),xt([A(0)],_i.prototype,"paraIndent",void 0),xt([A(0)],_i.prototype,"paraSpacing",void 0),xt([A("x")],_i.prototype,"writingMode",void 0),xt([A("left")],_i.prototype,"textAlign",void 0),xt([A("top")],_i.prototype,"verticalAlign",void 0),xt([A(!0)],_i.prototype,"autoSizeAlign",void 0),xt([A("normal")],_i.prototype,"textWrap",void 0),xt([A("show")],_i.prototype,"textOverflow",void 0),xt([f(!1)],_i.prototype,"textEditing",void 0),_i=xt([J()],_i);let hi=class extends ce{get __tag(){return"Path"}};xt([y(te)],hi.prototype,"__",void 0),xt([ct("center")],hi.prototype,"strokeAlign",void 0),hi=xt([J()],hi);let di=class extends ge{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new hi(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};xt([y(ee)],di.prototype,"__",void 0),xt([(e,i)=>{t(e,i,{get(){return this.__path}})}],di.prototype,"path",void 0),di=xt([N(wt,["set","path","paint"]),J()],di);export{Be as Box,jt as BoxData,ii as Canvas,re as CanvasData,At as ColorConvert,Tt as Effect,Fe as Ellipse,Kt as EllipseData,It as Export,Et as Filter,Ae as Frame,qt as FrameData,ge as Group,Xt as GroupData,ti as Image,oe as ImageData,fe as Leafer,Jt as LeaferData,Ze as Line,Gt as LineData,ei as MyImage,Pt as Paint,Wt as PaintGradient,Ft as PaintImage,hi as Path,Ct as PathArrow,te as PathData,di as Pen,ee as PenData,Me as Polygon,Qt as PolygonData,we as Rect,$t as RectData,pe as RectRender,Xe as Star,Zt as StarData,Dt as State,_i as Text,Bt as TextConvert,se as TextData,Lt as Transition,ce as UI,_e as UIBounds,Yt as UIData,de as UIRender,bt as UnitConvert,kt as createAttr,St as effectType,mt as resizeType,Rt as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=draw.esm.min.js.map
|