@leafer-ui/draw 1.9.0 → 1.9.2
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 +58 -19
- package/lib/draw.esm.js +58 -21
- 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
|
@@ -290,7 +290,7 @@ class BoxData extends GroupData {
|
|
|
290
290
|
}
|
|
291
291
|
get __clipAfterFill() {
|
|
292
292
|
const t = this;
|
|
293
|
-
return t.overflow
|
|
293
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -446,6 +446,41 @@ const UIBounds = {
|
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
448
|
|
|
449
|
+
const DragBoundsHelper = {
|
|
450
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
451
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
452
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
453
|
+
if (!change) move = Object.assign({}, move);
|
|
454
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
455
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
456
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
457
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
458
|
+
} else {
|
|
459
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
460
|
+
}
|
|
461
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
462
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
463
|
+
} else {
|
|
464
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
465
|
+
}
|
|
466
|
+
move.x = core.MathHelper.float(move.x);
|
|
467
|
+
move.y = core.MathHelper.float(move.y);
|
|
468
|
+
return move;
|
|
469
|
+
},
|
|
470
|
+
axisMove(leaf, move) {
|
|
471
|
+
const {draggable: draggable} = leaf;
|
|
472
|
+
if (draggable === "x") move.y = 0;
|
|
473
|
+
if (draggable === "y") move.x = 0;
|
|
474
|
+
},
|
|
475
|
+
limitMove(leaf, move) {
|
|
476
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
477
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
478
|
+
D.axisMove(leaf, move);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
const D = DragBoundsHelper;
|
|
483
|
+
|
|
449
484
|
const {stintSet: stintSet} = core.DataHelper;
|
|
450
485
|
|
|
451
486
|
const UIRender = {
|
|
@@ -760,9 +795,9 @@ __decorate([ core.positionType(0, true) ], exports.UI.prototype, "offsetX", void
|
|
|
760
795
|
|
|
761
796
|
__decorate([ core.positionType(0, true) ], exports.UI.prototype, "offsetY", void 0);
|
|
762
797
|
|
|
763
|
-
__decorate([ core.
|
|
798
|
+
__decorate([ core.scrollType(0, true) ], exports.UI.prototype, "scrollX", void 0);
|
|
764
799
|
|
|
765
|
-
__decorate([ core.
|
|
800
|
+
__decorate([ core.scrollType(0, true) ], exports.UI.prototype, "scrollY", void 0);
|
|
766
801
|
|
|
767
802
|
__decorate([ core.autoLayoutType() ], exports.UI.prototype, "origin", void 0);
|
|
768
803
|
|
|
@@ -792,6 +827,8 @@ __decorate([ core.dataType(false) ], exports.UI.prototype, "draggable", void 0);
|
|
|
792
827
|
|
|
793
828
|
__decorate([ core.dataType() ], exports.UI.prototype, "dragBounds", void 0);
|
|
794
829
|
|
|
830
|
+
__decorate([ core.dataType("auto") ], exports.UI.prototype, "dragBoundsType", void 0);
|
|
831
|
+
|
|
795
832
|
__decorate([ core.dataType(false) ], exports.UI.prototype, "editable", void 0);
|
|
796
833
|
|
|
797
834
|
__decorate([ core.hitType(true) ], exports.UI.prototype, "hittable", void 0);
|
|
@@ -1214,7 +1251,7 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
|
1214
1251
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
1215
1252
|
return core.Plugin.need("view");
|
|
1216
1253
|
}
|
|
1217
|
-
getValidMove(moveX, moveY) {
|
|
1254
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
1218
1255
|
return {
|
|
1219
1256
|
x: moveX,
|
|
1220
1257
|
y: moveY
|
|
@@ -1303,12 +1340,10 @@ __decorate([ core.dataProcessor(RectData) ], exports.Rect.prototype, "__", void
|
|
|
1303
1340
|
|
|
1304
1341
|
exports.Rect = __decorate([ core.useModule(RectRender), core.rewriteAble(), core.registerUI() ], exports.Rect);
|
|
1305
1342
|
|
|
1306
|
-
const {
|
|
1343
|
+
const {add: add, includes: includes$1, scroll: scroll} = core.BoundsHelper;
|
|
1307
1344
|
|
|
1308
1345
|
const rect = exports.Rect.prototype, group = exports.Group.prototype;
|
|
1309
1346
|
|
|
1310
|
-
const childrenRenderBounds = {};
|
|
1311
|
-
|
|
1312
1347
|
exports.Box = class Box extends exports.Group {
|
|
1313
1348
|
get __tag() {
|
|
1314
1349
|
return "Box";
|
|
@@ -1354,22 +1389,24 @@ exports.Box = class Box extends exports.Group {
|
|
|
1354
1389
|
__updateRenderBounds() {
|
|
1355
1390
|
let isOverflow;
|
|
1356
1391
|
if (this.children.length) {
|
|
1357
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
1358
|
-
|
|
1359
|
-
|
|
1392
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
1393
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = core.getBoundsData());
|
|
1394
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
1395
|
+
scroll(childrenRenderBounds, data);
|
|
1360
1396
|
this.__updateRectRenderBounds();
|
|
1361
|
-
if (data.scrollY || data.scrollX) {
|
|
1362
|
-
childrenRenderBounds.x += data.scrollX;
|
|
1363
|
-
childrenRenderBounds.y += data.scrollY;
|
|
1364
|
-
}
|
|
1365
1397
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
1366
|
-
if (isOverflow && data.overflow
|
|
1398
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
1367
1399
|
} else this.__updateRectRenderBounds();
|
|
1368
1400
|
core.DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
1369
|
-
this.
|
|
1401
|
+
this.__checkScroll();
|
|
1370
1402
|
}
|
|
1371
1403
|
__updateRectRenderBounds() {}
|
|
1372
|
-
|
|
1404
|
+
__updateWorldBounds() {
|
|
1405
|
+
if (this.hasScroller) this.__updateScroll();
|
|
1406
|
+
super.__updateWorldBounds();
|
|
1407
|
+
}
|
|
1408
|
+
__checkScroll() {}
|
|
1409
|
+
__updateScroll() {}
|
|
1373
1410
|
__updateRectChange() {}
|
|
1374
1411
|
__updateChange() {
|
|
1375
1412
|
super.__updateChange();
|
|
@@ -1384,7 +1421,7 @@ exports.Box = class Box extends exports.Group {
|
|
|
1384
1421
|
this.__renderRect(canvas, options);
|
|
1385
1422
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
1386
1423
|
}
|
|
1387
|
-
if (this.
|
|
1424
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
1388
1425
|
}
|
|
1389
1426
|
__drawContent(canvas, options) {
|
|
1390
1427
|
this.__renderGroup(canvas, options);
|
|
@@ -1754,7 +1791,7 @@ exports.Text = class Text extends exports.UI {
|
|
|
1754
1791
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
1755
1792
|
data.__padding = padding ? core.MathHelper.fourNumber(padding) : undefined;
|
|
1756
1793
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
1757
|
-
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize}px ${fontFamily}`;
|
|
1794
|
+
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
1758
1795
|
data.__clipText = textOverflow !== "show" && !data.__autoSize;
|
|
1759
1796
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
1760
1797
|
}
|
|
@@ -1976,6 +2013,8 @@ exports.CanvasData = CanvasData;
|
|
|
1976
2013
|
|
|
1977
2014
|
exports.ColorConvert = ColorConvert;
|
|
1978
2015
|
|
|
2016
|
+
exports.DragBoundsHelper = DragBoundsHelper;
|
|
2017
|
+
|
|
1979
2018
|
exports.Effect = Effect;
|
|
1980
2019
|
|
|
1981
2020
|
exports.EllipseData = EllipseData;
|
package/lib/draw.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, isObject, PathConvert, DataHelper, Debug, LeafData, isString, isUndefined, isArray, canvasSizeAttrs, UICreator, dataProcessor, dataType, surfaceType, opacityType, visibleType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, rewrite, Leaf, useModule, rewriteAble,
|
|
1
|
+
import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, isObject, PathConvert, DataHelper, Debug, LeafData, isString, isUndefined, isArray, canvasSizeAttrs, UICreator, MathHelper, dataProcessor, dataType, surfaceType, opacityType, visibleType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, scrollType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, rewrite, Leaf, useModule, rewriteAble, pen, PathCorner, PathDrawer, isNumber, registerUI, Branch, LeafList, Resource, getBoundsData, Creator, CanvasManager, WaitHelper, LeaferEvent, Bounds, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, ImageManager, BoundsHelper, PathCommandDataHelper, Platform, PointHelper, PathBounds, affectStrokeBoundsType, getPointData, LeaferImage, ImageEvent, Matrix, PathCreator } from "@leafer/core";
|
|
2
2
|
|
|
3
3
|
export * from "@leafer/core";
|
|
4
4
|
|
|
@@ -290,7 +290,7 @@ class BoxData extends GroupData {
|
|
|
290
290
|
}
|
|
291
291
|
get __clipAfterFill() {
|
|
292
292
|
const t = this;
|
|
293
|
-
return t.overflow
|
|
293
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -446,6 +446,41 @@ const UIBounds = {
|
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
448
|
|
|
449
|
+
const DragBoundsHelper = {
|
|
450
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
451
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
452
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
453
|
+
if (!change) move = Object.assign({}, move);
|
|
454
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
455
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
456
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
457
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
458
|
+
} else {
|
|
459
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
460
|
+
}
|
|
461
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
462
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
463
|
+
} else {
|
|
464
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
465
|
+
}
|
|
466
|
+
move.x = MathHelper.float(move.x);
|
|
467
|
+
move.y = MathHelper.float(move.y);
|
|
468
|
+
return move;
|
|
469
|
+
},
|
|
470
|
+
axisMove(leaf, move) {
|
|
471
|
+
const {draggable: draggable} = leaf;
|
|
472
|
+
if (draggable === "x") move.y = 0;
|
|
473
|
+
if (draggable === "y") move.x = 0;
|
|
474
|
+
},
|
|
475
|
+
limitMove(leaf, move) {
|
|
476
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
477
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
478
|
+
D.axisMove(leaf, move);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
const D = DragBoundsHelper;
|
|
483
|
+
|
|
449
484
|
const {stintSet: stintSet} = DataHelper;
|
|
450
485
|
|
|
451
486
|
const UIRender = {
|
|
@@ -760,9 +795,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
|
|
|
760
795
|
|
|
761
796
|
__decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
|
|
762
797
|
|
|
763
|
-
__decorate([
|
|
798
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
|
|
764
799
|
|
|
765
|
-
__decorate([
|
|
800
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
|
|
766
801
|
|
|
767
802
|
__decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
|
|
768
803
|
|
|
@@ -792,6 +827,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
|
|
|
792
827
|
|
|
793
828
|
__decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
|
|
794
829
|
|
|
830
|
+
__decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
|
|
831
|
+
|
|
795
832
|
__decorate([ dataType(false) ], UI.prototype, "editable", void 0);
|
|
796
833
|
|
|
797
834
|
__decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
|
|
@@ -1214,7 +1251,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1214
1251
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
1215
1252
|
return Plugin.need("view");
|
|
1216
1253
|
}
|
|
1217
|
-
getValidMove(moveX, moveY) {
|
|
1254
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
1218
1255
|
return {
|
|
1219
1256
|
x: moveX,
|
|
1220
1257
|
y: moveY
|
|
@@ -1303,12 +1340,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
|
1303
1340
|
|
|
1304
1341
|
Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
|
|
1305
1342
|
|
|
1306
|
-
const {
|
|
1343
|
+
const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
|
|
1307
1344
|
|
|
1308
1345
|
const rect = Rect.prototype, group = Group.prototype;
|
|
1309
1346
|
|
|
1310
|
-
const childrenRenderBounds = {};
|
|
1311
|
-
|
|
1312
1347
|
let Box = class Box extends Group {
|
|
1313
1348
|
get __tag() {
|
|
1314
1349
|
return "Box";
|
|
@@ -1354,22 +1389,24 @@ let Box = class Box extends Group {
|
|
|
1354
1389
|
__updateRenderBounds() {
|
|
1355
1390
|
let isOverflow;
|
|
1356
1391
|
if (this.children.length) {
|
|
1357
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
1358
|
-
|
|
1359
|
-
|
|
1392
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
1393
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
1394
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
1395
|
+
scroll(childrenRenderBounds, data);
|
|
1360
1396
|
this.__updateRectRenderBounds();
|
|
1361
|
-
if (data.scrollY || data.scrollX) {
|
|
1362
|
-
childrenRenderBounds.x += data.scrollX;
|
|
1363
|
-
childrenRenderBounds.y += data.scrollY;
|
|
1364
|
-
}
|
|
1365
1397
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
1366
|
-
if (isOverflow && data.overflow
|
|
1398
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
1367
1399
|
} else this.__updateRectRenderBounds();
|
|
1368
1400
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
1369
|
-
this.
|
|
1401
|
+
this.__checkScroll();
|
|
1370
1402
|
}
|
|
1371
1403
|
__updateRectRenderBounds() {}
|
|
1372
|
-
|
|
1404
|
+
__updateWorldBounds() {
|
|
1405
|
+
if (this.hasScroller) this.__updateScroll();
|
|
1406
|
+
super.__updateWorldBounds();
|
|
1407
|
+
}
|
|
1408
|
+
__checkScroll() {}
|
|
1409
|
+
__updateScroll() {}
|
|
1373
1410
|
__updateRectChange() {}
|
|
1374
1411
|
__updateChange() {
|
|
1375
1412
|
super.__updateChange();
|
|
@@ -1384,7 +1421,7 @@ let Box = class Box extends Group {
|
|
|
1384
1421
|
this.__renderRect(canvas, options);
|
|
1385
1422
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
1386
1423
|
}
|
|
1387
|
-
if (this.
|
|
1424
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
1388
1425
|
}
|
|
1389
1426
|
__drawContent(canvas, options) {
|
|
1390
1427
|
this.__renderGroup(canvas, options);
|
|
@@ -1754,7 +1791,7 @@ let Text = class Text extends UI {
|
|
|
1754
1791
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
1755
1792
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
1756
1793
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
1757
|
-
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize}px ${fontFamily}`;
|
|
1794
|
+
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
1758
1795
|
data.__clipText = textOverflow !== "show" && !data.__autoSize;
|
|
1759
1796
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
1760
1797
|
}
|
|
@@ -1970,4 +2007,4 @@ function penPathType() {
|
|
|
1970
2007
|
};
|
|
1971
2008
|
}
|
|
1972
2009
|
|
|
1973
|
-
export { Box, BoxData, Canvas, CanvasData, ColorConvert, Effect, Ellipse, EllipseData, Export, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, Leafer, LeaferData, Line, LineData, MyImage, Paint, PaintGradient, PaintImage, Path, PathArrow, PathData, Pen, PenData, Polygon, PolygonData, Rect, RectData, RectRender, Star, StarData, State, Text, TextConvert, TextData, Transition, UI, UIBounds, UIData, UIRender, UnitConvert, createAttr, effectType, resizeType, zoomLayerType };
|
|
2010
|
+
export { Box, BoxData, Canvas, CanvasData, ColorConvert, DragBoundsHelper, Effect, Ellipse, EllipseData, Export, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, Leafer, LeaferData, Line, LineData, MyImage, Paint, PaintGradient, PaintImage, Path, PathArrow, PathData, Pen, PenData, Polygon, PolygonData, Rect, RectData, RectRender, Star, StarData, State, Text, TextConvert, TextData, Transition, UI, UIBounds, UIData, UIRender, UnitConvert, createAttr, effectType, resizeType, zoomLayerType };
|
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,dataProcessor as y,dataType as g,surfaceType as v,opacityType as f,visibleType as w,sortType as x,maskType as S,eraserType as m,positionType as R,boundsType as k,scaleType as B,rotationType as b,autoLayoutType as A,naturalBoundsType as C,affectRenderBoundsType as P,pathInputType as F,pathType as W,hitType as E,strokeType as I,cursorType as T,rewrite as D,Leaf as z,useModule as L,rewriteAble as M,MathHelper as O,pen as N,PathCorner as Y,PathDrawer as V,isNumber as H,registerUI as U,Branch as X,LeafList as j,Resource as J,getBoundsData as q,Creator as G,CanvasManager as $,WaitHelper as K,LeaferEvent as Q,Bounds as Z,ResizeEvent as tt,AutoBounds as et,Run as it,LayoutEvent as st,RenderEvent as ot,WatchEvent as rt,ImageManager as at,BoundsHelper as nt,PathCommandDataHelper as _t,Platform as ht,PointHelper as dt,PathBounds as lt,affectStrokeBoundsType as pt,getPointData as ut,LeaferImage as ct,ImageEvent as yt,Matrix as gt,PathCreator as vt}from"@leafer/core";export*from"@leafer/core";function ft(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 wt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function xt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function St(){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 mt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Rt={},kt={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},bt={},At={},Ct={},Pt={},Ft={},Wt={apply(){o.need("filter")}},Et={},It={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Tt={list:{},register(t,e){Tt.list[t]=e},get:t=>Tt.list[t]},{parse:Dt,objectToCanvasData:zt}=a,{stintSet:Lt}=n,{hasTransparent:Mt}=kt,Ot={},Nt=_.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,Nt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Nt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Lt(this,"__isTransparentFill",Mt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Lt(this,"__isTransparentStroke",Mt(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?Dt(t):zt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Vt(this,"shadow",t)}setInnerShadow(t){Vt(this,"innerShadow",t)}setFilter(t){Vt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&At.compute("fill",this.__leaf),e&&At.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=Ot)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ot))}__removePaint(t,e){e&&this.__removeInput(t),Ct.recycleImage(t,this),"fill"===t?(Lt(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Lt(this,"__isAlphaPixelStroke",void 0),Lt(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Vt(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 Ht extends Yt{}class Ut extends Ht{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"hide"===t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Xt extends Ht{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class jt extends Ut{}class Jt extends Yt{}class qt extends Yt{get __boxStroke(){return!this.__pathInputed}}class Gt extends Yt{get __boxStroke(){return!this.__pathInputed}}class $t extends Yt{}class Kt extends Yt{}class Qt extends Yt{get __pathInputed(){return 2}}class Zt extends Ht{}const te={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ee extends Yt{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=te[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(),r.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class ie extends qt{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 delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class se extends qt{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 oe={__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=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),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.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),r&&(t+=Wt.getSpread(r)),a&&(t+=a);let n=t=Math.ceil(t);return i&&i.forEach(t=>n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),o&&(n=Math.max(n,o)),this.__layout.renderShapeSpread=n,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:re}=n,ae={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);re(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),re(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;re(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),re(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){ne(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 _=At.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Ft.shadow(this,t,_),n&&(s.__isStrokes?At.strokes(r,this,t):At.stroke(r,this,t)),o&&(s.__isFills?At.fills(o,this,t):At.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Ft.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?At.strokes(r,this,t):At.stroke(r,this,t)),l&&Wt.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?At.strokes(r,this,t):At.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,kt.string(e.color))}o&&(s.__isFills?At.fills(o,this,t):At.fill(o,this,t)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?At.strokes(r,this,t):At.stroke(r,this,t))}}else s.__pathInputed?ne(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?At.fills(s,this,t):At.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?At.strokes(o,this,t):At.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 ne(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&At.stroke(o,t,e),s&&At.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&At.stroke(o,t,e)}const _e={__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 he;let de=he=class extends z{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){O.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 N.set(this.path=t||[]),t||this.__drawPathByBox(N),N}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):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||(N.set(i=[]),this.__drawPathByBox(N)),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||Et.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Y.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&bt.addArrows(this,!t.cornerRadius)):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?V.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,H(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){At.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return 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),he.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){U()(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()}};ft([y(Yt)],de.prototype,"__",void 0),ft([St()],de.prototype,"zoomLayer",void 0),ft([g("")],de.prototype,"id",void 0),ft([g("")],de.prototype,"name",void 0),ft([g("")],de.prototype,"className",void 0),ft([v("pass-through")],de.prototype,"blendMode",void 0),ft([f(1)],de.prototype,"opacity",void 0),ft([w(!0)],de.prototype,"visible",void 0),ft([v(!1)],de.prototype,"locked",void 0),ft([v(!1)],de.prototype,"dim",void 0),ft([v(!1)],de.prototype,"dimskip",void 0),ft([x(0)],de.prototype,"zIndex",void 0),ft([S(!1)],de.prototype,"mask",void 0),ft([m(!1)],de.prototype,"eraser",void 0),ft([R(0,!0)],de.prototype,"x",void 0),ft([R(0,!0)],de.prototype,"y",void 0),ft([k(100,!0)],de.prototype,"width",void 0),ft([k(100,!0)],de.prototype,"height",void 0),ft([B(1,!0)],de.prototype,"scaleX",void 0),ft([B(1,!0)],de.prototype,"scaleY",void 0),ft([b(0,!0)],de.prototype,"rotation",void 0),ft([b(0,!0)],de.prototype,"skewX",void 0),ft([b(0,!0)],de.prototype,"skewY",void 0),ft([R(0,!0)],de.prototype,"offsetX",void 0),ft([R(0,!0)],de.prototype,"offsetY",void 0),ft([R(0,!0)],de.prototype,"scrollX",void 0),ft([R(0,!0)],de.prototype,"scrollY",void 0),ft([A()],de.prototype,"origin",void 0),ft([A()],de.prototype,"around",void 0),ft([g(!1)],de.prototype,"lazy",void 0),ft([C(1)],de.prototype,"pixelRatio",void 0),ft([P(0)],de.prototype,"renderSpread",void 0),ft([F()],de.prototype,"path",void 0),ft([W()],de.prototype,"windingRule",void 0),ft([W(!0)],de.prototype,"closed",void 0),ft([k(0)],de.prototype,"padding",void 0),ft([k(!1)],de.prototype,"lockRatio",void 0),ft([k()],de.prototype,"widthRange",void 0),ft([k()],de.prototype,"heightRange",void 0),ft([g(!1)],de.prototype,"draggable",void 0),ft([g()],de.prototype,"dragBounds",void 0),ft([g(!1)],de.prototype,"editable",void 0),ft([E(!0)],de.prototype,"hittable",void 0),ft([E("path")],de.prototype,"hitFill",void 0),ft([I("path")],de.prototype,"hitStroke",void 0),ft([E(!1)],de.prototype,"hitBox",void 0),ft([E(!0)],de.prototype,"hitChildren",void 0),ft([E(!0)],de.prototype,"hitSelf",void 0),ft([E()],de.prototype,"hitRadius",void 0),ft([T("")],de.prototype,"cursor",void 0),ft([v()],de.prototype,"fill",void 0),ft([I(void 0,!0)],de.prototype,"stroke",void 0),ft([I("inside")],de.prototype,"strokeAlign",void 0),ft([I(1,!0)],de.prototype,"strokeWidth",void 0),ft([I(!1)],de.prototype,"strokeWidthFixed",void 0),ft([I("none")],de.prototype,"strokeCap",void 0),ft([I("miter")],de.prototype,"strokeJoin",void 0),ft([I()],de.prototype,"dashPattern",void 0),ft([I(0)],de.prototype,"dashOffset",void 0),ft([I(10)],de.prototype,"miterLimit",void 0),ft([W(0)],de.prototype,"cornerRadius",void 0),ft([W()],de.prototype,"cornerSmoothing",void 0),ft([wt()],de.prototype,"shadow",void 0),ft([wt()],de.prototype,"innerShadow",void 0),ft([wt()],de.prototype,"blur",void 0),ft([wt()],de.prototype,"backgroundBlur",void 0),ft([wt()],de.prototype,"grayscale",void 0),ft([wt()],de.prototype,"filter",void 0),ft([v()],de.prototype,"placeholderColor",void 0),ft([g(100)],de.prototype,"placeholderDelay",void 0),ft([g({})],de.prototype,"data",void 0),ft([D(z.prototype.reset)],de.prototype,"reset",null),de=he=ft([L(oe),L(ae),M()],de);let le=class extends de{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}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 pe;ft([y(Ht)],le.prototype,"__",void 0),ft([k(0)],le.prototype,"width",void 0),ft([k(0)],le.prototype,"height",void 0),le=ft([L(X),U()],le);const ue=_.get("Leafer");let ce=pe=class extends le{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&J.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)||q()}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),pe.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=G.canvas(s);this.__controllers.push(this.renderer=G.renderer(this,o,s),this.watcher=G.watcher(this,s),this.layouter=G.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=G.selector(this),this.interaction=G.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=G.hitCanvasManager()),this.canvasManager=new $,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))),K.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(Q.RESTART):this.emitLeafer(Q.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(Q.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 Z(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 tt(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(t,e){e||(t.width&&t.height||(this.autoLayout=new et(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()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=n.copyAttrs({},this.canvas,u);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__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(Q.BEFORE_READY),this.emitLeafer(Q.READY),this.emitLeafer(Q.AFTER_READY),K.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Q.VIEW_READY),K.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){K.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(Q.VIEW_COMPLETED),K.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){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 Q(t,this))}__listenEvents(){const t=it.start("FirstCreate "+this.innerName);this.once([[Q.START,()=>it.end(t)],[st.START,this.updateLazyBounds,this],[ot.START,this.__onCreated,this],[ot.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[rt.DATA,this.__onWatchData,this],[st.END,this.__onLayoutEnd,this],[ot.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){pe.list.remove(this);try{this.stop(),this.emitLeafer(Q.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.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{at.clearRecycled()},100)}catch(t){ue.error(t)}}};t?e():setTimeout(e)}};ce.list=new j,ft([y(Xt)],ce.prototype,"__",void 0),ft([k()],ce.prototype,"pixelRatio",void 0),ce=pe=ft([U()],ce);let ye=class extends de{get __tag(){return"Rect"}constructor(t){super(t)}};ft([y(qt)],ye.prototype,"__",void 0),ye=ft([L(_e),M(),U()],ye);const{copy:ge,add:ve,includes:fe}=nt,we=ye.prototype,xe=le.prototype,Se={};let me=class extends le{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;if(this.children.length){const e=this.__,{renderBounds:i,boxBounds:s}=this.__layout;super.__updateRenderBounds(),ge(Se,i),this.__updateRectRenderBounds(),(e.scrollY||e.scrollX)&&(Se.x+=e.scrollX,Se.y+=e.scrollY),t=!fe(s,Se),t&&"hide"!==e.overflow&&ve(i,Se)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__updateScrollBar()}__updateRectRenderBounds(){}__updateScrollBar(){}__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.scrollBar&&this.scrollBar.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};ft([y(Ut)],me.prototype,"__",void 0),ft([k(100)],me.prototype,"width",void 0),ft([k(100)],me.prototype,"height",void 0),ft([g(!1)],me.prototype,"resizeChildren",void 0),ft([P("show")],me.prototype,"overflow",void 0),ft([D(we.__updateStrokeSpread)],me.prototype,"__updateStrokeSpread",null),ft([D(we.__updateRenderSpread)],me.prototype,"__updateRectRenderSpread",null),ft([D(we.__updateBoxBounds)],me.prototype,"__updateRectBoxBounds",null),ft([D(we.__updateStrokeBounds)],me.prototype,"__updateStrokeBounds",null),ft([D(we.__updateRenderBounds)],me.prototype,"__updateRectRenderBounds",null),ft([D(we.__updateChange)],me.prototype,"__updateRectChange",null),ft([D(we.__render)],me.prototype,"__renderRect",null),ft([D(xe.__render)],me.prototype,"__renderGroup",null),me=ft([M(),U()],me);let Re=class extends me{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};ft([y(jt)],Re.prototype,"__",void 0),ft([v("#FFFFFF")],Re.prototype,"fill",void 0),ft([P("hide")],Re.prototype,"overflow",void 0),Re=ft([U()],Re);const{moveTo:ke,closePath:Be,ellipse:be}=_t;let Ae=class extends de{get __tag(){return"Ellipse"}constructor(t){super(t)}__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&&be(n,r,a,r*i,a*i,0,s,o,!1),be(n,r,a,r,a,0,o,s,!0),i<1&&Be(n)):(i<1&&(be(n,r,a,r*i,a*i),ke(n,t,a)),be(n,r,a,r,a,0,360,0,!0)),ht.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(ke(n,r,a),be(n,r,a,r,a,0,s,o,!1),Be(n)):be(n,r,a,r,a)}};ft([y(Gt)],Ae.prototype,"__",void 0),ft([W(0)],Ae.prototype,"innerRadius",void 0),ft([W(0)],Ae.prototype,"startAngle",void 0),ft([W(0)],Ae.prototype,"endAngle",void 0),Ae=ft([U()],Ae);const{moveTo:Ce,lineTo:Pe,drawPoints:Fe}=_t,{rotate:We,getAngle:Ee,getDistance:Ie,defaultPoint:Te}=dt,{toBounds:De}=lt;let ze=class extends de{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=ut();return t&&(i.x=t),e&&We(i,e),i}set toPoint(t){this.width=Ie(Te,t),this.rotation=Ee(Te,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Fe(e,t.points,!1,t.closed):(Ce(e,0,0),Pe(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Fe(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&bt.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?De(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};ft([y(Jt)],ze.prototype,"__",void 0),ft([pt("center")],ze.prototype,"strokeAlign",void 0),ft([k(0)],ze.prototype,"height",void 0),ft([W()],ze.prototype,"points",void 0),ft([W(0)],ze.prototype,"curve",void 0),ft([W(!1)],ze.prototype,"closed",void 0),ze=ft([U()],ze);const{sin:Le,cos:Me,PI:Oe}=Math,{moveTo:Ne,lineTo:Ye,closePath:Ve,drawPoints:He}=_t,Ue=ze.prototype;let Xe=class extends de{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)He(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,r=i/2;Ne(t,o,0);for(let e=1;e<s;e++)Ye(t,o+o*Le(2*e*Oe/s),r-r*Me(2*e*Oe/s));Ve(t)}}__updateRenderPath(){}__updateBoxBounds(){}};ft([y($t)],Xe.prototype,"__",void 0),ft([W(3)],Xe.prototype,"sides",void 0),ft([W()],Xe.prototype,"points",void 0),ft([W(0)],Xe.prototype,"curve",void 0),ft([D(Ue.__updateRenderPath)],Xe.prototype,"__updateRenderPath",null),ft([D(Ue.__updateBoxBounds)],Xe.prototype,"__updateBoxBounds",null),Xe=ft([M(),U()],Xe);const{sin:je,cos:Je,PI:qe}=Math,{moveTo:Ge,lineTo:$e,closePath:Ke}=_t;let Qe=class extends de{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];Ge(a,o,0);for(let t=1;t<2*i;t++)$e(a,o+(t%2==0?o:o*s)*je(t*qe/i),r-(t%2==0?r:r*s)*Je(t*qe/i));Ke(a)}};ft([y(Kt)],Qe.prototype,"__",void 0),ft([W(5)],Qe.prototype,"corners",void 0),ft([W(.382)],Qe.prototype,"innerRadius",void 0),Qe=ft([U()],Qe);let Ze=class extends ye{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}constructor(t){super(t)}};ft([y(ie)],Ze.prototype,"__",void 0),ft([k("")],Ze.prototype,"url",void 0),Ze=ft([U()],Ze);const ti=Ze;let ei=class extends ye{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=G.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ct({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new yt(yt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new gt(t.worldTransform).invert(),r=new gt;e&&r.translate(e.x,e.y),i&&(H(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()}};ft([y(se)],ei.prototype,"__",void 0),ft([xt(100)],ei.prototype,"width",void 0),ft([xt(100)],ei.prototype,"height",void 0),ft([xt(1)],ei.prototype,"pixelRatio",void 0),ft([xt(!0)],ei.prototype,"smooth",void 0),ft([g(!1)],ei.prototype,"safeResize",void 0),ft([xt()],ei.prototype,"contextSettings",void 0),ei=ft([U()],ei);const{copyAndSpread:ii,includes:si,spread:oi,setList:ri}=nt;let ai=class extends de{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__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?O.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}px ${s}`,t.__clipText="show"!==_&&!t.__autoSize,t.__textDrawData=Rt.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&&oi(_,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",!si(h,_)),this.isOverflow?(ri(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;ii(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__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()}};ft([y(ee)],ai.prototype,"__",void 0),ft([k(0)],ai.prototype,"width",void 0),ft([k(0)],ai.prototype,"height",void 0),ft([v()],ai.prototype,"boxStyle",void 0),ft([g(!1)],ai.prototype,"resizeFontSize",void 0),ft([v("#000000")],ai.prototype,"fill",void 0),ft([pt("outside")],ai.prototype,"strokeAlign",void 0),ft([E("all")],ai.prototype,"hitFill",void 0),ft([k("")],ai.prototype,"text",void 0),ft([k("")],ai.prototype,"placeholder",void 0),ft([k("caption")],ai.prototype,"fontFamily",void 0),ft([k(12)],ai.prototype,"fontSize",void 0),ft([k("normal")],ai.prototype,"fontWeight",void 0),ft([k(!1)],ai.prototype,"italic",void 0),ft([k("none")],ai.prototype,"textCase",void 0),ft([k("none")],ai.prototype,"textDecoration",void 0),ft([k(0)],ai.prototype,"letterSpacing",void 0),ft([k({type:"percent",value:1.5})],ai.prototype,"lineHeight",void 0),ft([k(0)],ai.prototype,"paraIndent",void 0),ft([k(0)],ai.prototype,"paraSpacing",void 0),ft([k("x")],ai.prototype,"writingMode",void 0),ft([k("left")],ai.prototype,"textAlign",void 0),ft([k("top")],ai.prototype,"verticalAlign",void 0),ft([k(!0)],ai.prototype,"autoSizeAlign",void 0),ft([k("normal")],ai.prototype,"textWrap",void 0),ft([k("show")],ai.prototype,"textOverflow",void 0),ft([v(!1)],ai.prototype,"textEditing",void 0),ai=ft([U()],ai);let ni=class extends de{get __tag(){return"Path"}constructor(t){super(t)}};ft([y(Qt)],ni.prototype,"__",void 0),ft([pt("center")],ni.prototype,"strokeAlign",void 0),ni=ft([U()],ni);let _i=class extends le{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new ni(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")}};ft([y(Zt)],_i.prototype,"__",void 0),ft([(e,i)=>{t(e,i,{get(){return this.__path}})}],_i.prototype,"path",void 0),_i=ft([L(vt,["set","path","paint"]),U()],_i);export{me as Box,Ut as BoxData,ei as Canvas,se as CanvasData,kt as ColorConvert,Ft as Effect,Ae as Ellipse,Gt as EllipseData,Et as Export,Wt as Filter,Re as Frame,jt as FrameData,le as Group,Ht as GroupData,Ze as Image,ie as ImageData,ce as Leafer,Xt as LeaferData,ze as Line,Jt as LineData,ti as MyImage,At as Paint,Pt as PaintGradient,Ct as PaintImage,ni as Path,bt as PathArrow,Qt as PathData,_i as Pen,Zt as PenData,Xe as Polygon,$t as PolygonData,ye as Rect,qt as RectData,_e as RectRender,Qe as Star,Kt as StarData,It as State,ai as Text,Rt as TextConvert,ee as TextData,Tt as Transition,de as UI,oe as UIBounds,Yt as UIData,ae as UIRender,Bt as UnitConvert,mt as createAttr,wt as effectType,xt as resizeType,St 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,MathHelper as y,dataProcessor as g,dataType as v,surfaceType as f,opacityType as w,visibleType as x,sortType as S,maskType as m,eraserType as R,positionType as k,boundsType as B,scaleType as b,rotationType as A,scrollType as C,autoLayoutType as P,naturalBoundsType as F,affectRenderBoundsType as W,pathInputType as E,pathType as T,hitType as I,strokeType as D,cursorType as z,rewrite as L,Leaf as M,useModule as O,rewriteAble as N,pen as V,PathCorner as H,PathDrawer as Y,isNumber as U,registerUI as j,Branch as X,LeafList as J,Resource as q,getBoundsData as G,Creator as $,CanvasManager as K,WaitHelper as Q,LeaferEvent as Z,Bounds as tt,ResizeEvent as et,AutoBounds as it,Run as st,LayoutEvent as ot,RenderEvent as rt,WatchEvent as at,ImageManager as nt,BoundsHelper as _t,PathCommandDataHelper as ht,Platform as dt,PointHelper as lt,PathBounds as pt,affectStrokeBoundsType as ut,getPointData as ct,LeaferImage as yt,ImageEvent as gt,Matrix as vt,PathCreator as ft}from"@leafer/core";export*from"@leafer/core";function wt(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 xt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function St(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function mt(){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 Rt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const kt={},Bt={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},At={},Ct={},Pt={},Ft={},Wt={},Et={apply(){o.need("filter")}},Tt={},It={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Dt={list:{},register(t,e){Dt.list[t]=e},get:t=>Dt.list[t]},{parse:zt,objectToCanvasData:Lt}=a,{stintSet:Mt}=n,{hasTransparent:Ot}=Bt,Nt={},Vt=_.get("UIData");class Ht 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,Vt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Vt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Mt(this,"__isTransparentFill",Ot(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Mt(this,"__isTransparentStroke",Ot(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):Lt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Yt(this,"shadow",t)}setInnerShadow(t){Yt(this,"innerShadow",t)}setFilter(t){Yt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ct.compute("fill",this.__leaf),e&&Ct.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=Nt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Nt))}__removePaint(t,e){e&&this.__removeInput(t),Pt.recycleImage(t,this),"fill"===t?(Mt(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Mt(this,"__isAlphaPixelStroke",void 0),Mt(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Yt(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 Ut extends Ht{}class jt extends Ut{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 Xt extends Ut{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class Jt extends jt{}class qt extends Ht{}class Gt extends Ht{get __boxStroke(){return!this.__pathInputed}}class $t extends Ht{get __boxStroke(){return!this.__pathInputed}}class Kt extends Ht{}class Qt extends Ht{}class Zt extends Ht{get __pathInputed(){return 2}}class te extends Ut{}const ee={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ie extends Ht{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=ee[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(),r.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class se extends Gt{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 delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class oe extends Gt{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 re={__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=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),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.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),r&&(t+=Et.getSpread(r)),a&&(t+=a);let n=t=Math.ceil(t);return i&&i.forEach(t=>n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),o&&(n=Math.max(n,o)),this.__layout.renderShapeSpread=n,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},ae={getValidMove(t,e,i,s,o){const r=t.x+s.x,a=t.y+s.y,n=r+t.width,_=a+t.height,h=e.x+e.width,d=e.y+e.height;o||(s=Object.assign({},s));const l=t.width>e.width,p=t.height>e.height;return l&&"outer"!==i?r>e.x?s.x+=e.x-r:n<h&&(s.x+=h-n):r<e.x?s.x+=e.x-r:n>h&&(s.x+=h-n),p&&"outer"!==i?a>e.y?s.y+=e.y-a:_<d&&(s.y+=d-_):a<e.y?s.y+=e.y-a:_>d&&(s.y+=d-_),s.x=y.float(s.x),s.y=y.float(s.y),s},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ne.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),ne.axisMove(t,e)}},ne=ae,{stintSet:_e}=n,he={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);_e(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),_e(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;_e(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),_e(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){de(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 _=Ct.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Wt.shadow(this,t,_),n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Wt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),l&&Et.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.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,Bt.string(e.color))}o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t))}}else s.__pathInputed?de(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?Ct.fills(s,this,t):Ct.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ct.strokes(o,this,t):Ct.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 de(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Ct.stroke(o,t,e),s&&Ct.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&Ct.stroke(o,t,e)}const le={__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 pe;let ue=pe=class extends M{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){y.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 V.set(this.path=t||[]),t||this.__drawPathByBox(V),V}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):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||(V.set(i=[]),this.__drawPathByBox(V)),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||Tt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?H.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&At.addArrows(this,!t.cornerRadius)):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?Y.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,U(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Ct.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return 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),pe.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){g(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};wt([g(Ht)],ue.prototype,"__",void 0),wt([mt()],ue.prototype,"zoomLayer",void 0),wt([v("")],ue.prototype,"id",void 0),wt([v("")],ue.prototype,"name",void 0),wt([v("")],ue.prototype,"className",void 0),wt([f("pass-through")],ue.prototype,"blendMode",void 0),wt([w(1)],ue.prototype,"opacity",void 0),wt([x(!0)],ue.prototype,"visible",void 0),wt([f(!1)],ue.prototype,"locked",void 0),wt([f(!1)],ue.prototype,"dim",void 0),wt([f(!1)],ue.prototype,"dimskip",void 0),wt([S(0)],ue.prototype,"zIndex",void 0),wt([m(!1)],ue.prototype,"mask",void 0),wt([R(!1)],ue.prototype,"eraser",void 0),wt([k(0,!0)],ue.prototype,"x",void 0),wt([k(0,!0)],ue.prototype,"y",void 0),wt([B(100,!0)],ue.prototype,"width",void 0),wt([B(100,!0)],ue.prototype,"height",void 0),wt([b(1,!0)],ue.prototype,"scaleX",void 0),wt([b(1,!0)],ue.prototype,"scaleY",void 0),wt([A(0,!0)],ue.prototype,"rotation",void 0),wt([A(0,!0)],ue.prototype,"skewX",void 0),wt([A(0,!0)],ue.prototype,"skewY",void 0),wt([k(0,!0)],ue.prototype,"offsetX",void 0),wt([k(0,!0)],ue.prototype,"offsetY",void 0),wt([C(0,!0)],ue.prototype,"scrollX",void 0),wt([C(0,!0)],ue.prototype,"scrollY",void 0),wt([P()],ue.prototype,"origin",void 0),wt([P()],ue.prototype,"around",void 0),wt([v(!1)],ue.prototype,"lazy",void 0),wt([F(1)],ue.prototype,"pixelRatio",void 0),wt([W(0)],ue.prototype,"renderSpread",void 0),wt([E()],ue.prototype,"path",void 0),wt([T()],ue.prototype,"windingRule",void 0),wt([T(!0)],ue.prototype,"closed",void 0),wt([B(0)],ue.prototype,"padding",void 0),wt([B(!1)],ue.prototype,"lockRatio",void 0),wt([B()],ue.prototype,"widthRange",void 0),wt([B()],ue.prototype,"heightRange",void 0),wt([v(!1)],ue.prototype,"draggable",void 0),wt([v()],ue.prototype,"dragBounds",void 0),wt([v("auto")],ue.prototype,"dragBoundsType",void 0),wt([v(!1)],ue.prototype,"editable",void 0),wt([I(!0)],ue.prototype,"hittable",void 0),wt([I("path")],ue.prototype,"hitFill",void 0),wt([D("path")],ue.prototype,"hitStroke",void 0),wt([I(!1)],ue.prototype,"hitBox",void 0),wt([I(!0)],ue.prototype,"hitChildren",void 0),wt([I(!0)],ue.prototype,"hitSelf",void 0),wt([I()],ue.prototype,"hitRadius",void 0),wt([z("")],ue.prototype,"cursor",void 0),wt([f()],ue.prototype,"fill",void 0),wt([D(void 0,!0)],ue.prototype,"stroke",void 0),wt([D("inside")],ue.prototype,"strokeAlign",void 0),wt([D(1,!0)],ue.prototype,"strokeWidth",void 0),wt([D(!1)],ue.prototype,"strokeWidthFixed",void 0),wt([D("none")],ue.prototype,"strokeCap",void 0),wt([D("miter")],ue.prototype,"strokeJoin",void 0),wt([D()],ue.prototype,"dashPattern",void 0),wt([D(0)],ue.prototype,"dashOffset",void 0),wt([D(10)],ue.prototype,"miterLimit",void 0),wt([T(0)],ue.prototype,"cornerRadius",void 0),wt([T()],ue.prototype,"cornerSmoothing",void 0),wt([xt()],ue.prototype,"shadow",void 0),wt([xt()],ue.prototype,"innerShadow",void 0),wt([xt()],ue.prototype,"blur",void 0),wt([xt()],ue.prototype,"backgroundBlur",void 0),wt([xt()],ue.prototype,"grayscale",void 0),wt([xt()],ue.prototype,"filter",void 0),wt([f()],ue.prototype,"placeholderColor",void 0),wt([v(100)],ue.prototype,"placeholderDelay",void 0),wt([v({})],ue.prototype,"data",void 0),wt([L(M.prototype.reset)],ue.prototype,"reset",null),ue=pe=wt([O(re),O(he),N()],ue);let ce=class extends ue{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}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;wt([g(Ut)],ce.prototype,"__",void 0),wt([B(0)],ce.prototype,"width",void 0),wt([B(0)],ce.prototype,"height",void 0),ce=wt([O(X),j()],ce);const ge=_.get("Leafer");let ve=ye=class extends ce{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&q.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)||G()}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=$.canvas(s);this.__controllers.push(this.renderer=$.renderer(this,o,s),this.watcher=$.watcher(this,s),this.layouter=$.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=$.selector(this),this.interaction=$.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=$.hitCanvasManager()),this.canvasManager=new K,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))),Q.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(Z.RESTART):this.emitLeafer(Z.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(Z.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 tt(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 et(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(t,e){e||(t.width&&t.height||(this.autoLayout=new it(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()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=n.copyAttrs({},this.canvas,u);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__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(Z.BEFORE_READY),this.emitLeafer(Z.READY),this.emitLeafer(Z.AFTER_READY),Q.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Z.VIEW_READY),Q.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){Q.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(Z.VIEW_COMPLETED),Q.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 Z(t,this))}__listenEvents(){const t=st.start("FirstCreate "+this.innerName);this.once([[Z.START,()=>st.end(t)],[ot.START,this.updateLazyBounds,this],[rt.START,this.__onCreated,this],[rt.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[at.DATA,this.__onWatchData,this],[ot.END,this.__onLayoutEnd,this],[rt.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(Z.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.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{nt.clearRecycled()},100)}catch(t){ge.error(t)}}};t?e():setTimeout(e)}};ve.list=new J,wt([g(Xt)],ve.prototype,"__",void 0),wt([B()],ve.prototype,"pixelRatio",void 0),ve=ye=wt([j()],ve);let fe=class extends ue{get __tag(){return"Rect"}constructor(t){super(t)}};wt([g(Gt)],fe.prototype,"__",void 0),fe=wt([O(le),N(),j()],fe);const{add:we,includes:xe,scroll:Se}=_t,me=fe.prototype,Re=ce.prototype;let ke=class extends ce{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;if(this.children.length){const e=this.__,i=this.__layout,{renderBounds:s,boxBounds:o}=i,r=i.childrenRenderBounds||(i.childrenRenderBounds=G());super.__updateRenderBounds(r),Se(r,e),this.__updateRectRenderBounds(),t=!xe(o,r),t&&"show"===e.overflow&&we(s,r)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__checkScroll()}__updateRectRenderBounds(){}__updateWorldBounds(){this.hasScroller&&this.__updateScroll(),super.__updateWorldBounds()}__checkScroll(){}__updateScroll(){}__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))}};wt([g(jt)],ke.prototype,"__",void 0),wt([B(100)],ke.prototype,"width",void 0),wt([B(100)],ke.prototype,"height",void 0),wt([v(!1)],ke.prototype,"resizeChildren",void 0),wt([W("show")],ke.prototype,"overflow",void 0),wt([L(me.__updateStrokeSpread)],ke.prototype,"__updateStrokeSpread",null),wt([L(me.__updateRenderSpread)],ke.prototype,"__updateRectRenderSpread",null),wt([L(me.__updateBoxBounds)],ke.prototype,"__updateRectBoxBounds",null),wt([L(me.__updateStrokeBounds)],ke.prototype,"__updateStrokeBounds",null),wt([L(me.__updateRenderBounds)],ke.prototype,"__updateRectRenderBounds",null),wt([L(me.__updateChange)],ke.prototype,"__updateRectChange",null),wt([L(me.__render)],ke.prototype,"__renderRect",null),wt([L(Re.__render)],ke.prototype,"__renderGroup",null),ke=wt([N(),j()],ke);let Be=class extends ke{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};wt([g(Jt)],Be.prototype,"__",void 0),wt([f("#FFFFFF")],Be.prototype,"fill",void 0),wt([W("hide")],Be.prototype,"overflow",void 0),Be=wt([j()],Be);const{moveTo:be,closePath:Ae,ellipse:Ce}=ht;let Pe=class extends ue{get __tag(){return"Ellipse"}constructor(t){super(t)}__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&&Ce(n,r,a,r*i,a*i,0,s,o,!1),Ce(n,r,a,r,a,0,o,s,!0),i<1&&Ae(n)):(i<1&&(Ce(n,r,a,r*i,a*i),be(n,t,a)),Ce(n,r,a,r,a,0,360,0,!0)),dt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(be(n,r,a),Ce(n,r,a,r,a,0,s,o,!1),Ae(n)):Ce(n,r,a,r,a)}};wt([g($t)],Pe.prototype,"__",void 0),wt([T(0)],Pe.prototype,"innerRadius",void 0),wt([T(0)],Pe.prototype,"startAngle",void 0),wt([T(0)],Pe.prototype,"endAngle",void 0),Pe=wt([j()],Pe);const{moveTo:Fe,lineTo:We,drawPoints:Ee}=ht,{rotate:Te,getAngle:Ie,getDistance:De,defaultPoint:ze}=lt,{toBounds:Le}=pt;let Me=class extends ue{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=ct();return t&&(i.x=t),e&&Te(i,e),i}set toPoint(t){this.width=De(ze,t),this.rotation=Ie(ze,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ee(e,t.points,!1,t.closed):(Fe(e,0,0),We(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Ee(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&At.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Le(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};wt([g(qt)],Me.prototype,"__",void 0),wt([ut("center")],Me.prototype,"strokeAlign",void 0),wt([B(0)],Me.prototype,"height",void 0),wt([T()],Me.prototype,"points",void 0),wt([T(0)],Me.prototype,"curve",void 0),wt([T(!1)],Me.prototype,"closed",void 0),Me=wt([j()],Me);const{sin:Oe,cos:Ne,PI:Ve}=Math,{moveTo:He,lineTo:Ye,closePath:Ue,drawPoints:je}=ht,Xe=Me.prototype;let Je=class extends ue{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)je(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,r=i/2;He(t,o,0);for(let e=1;e<s;e++)Ye(t,o+o*Oe(2*e*Ve/s),r-r*Ne(2*e*Ve/s));Ue(t)}}__updateRenderPath(){}__updateBoxBounds(){}};wt([g(Kt)],Je.prototype,"__",void 0),wt([T(3)],Je.prototype,"sides",void 0),wt([T()],Je.prototype,"points",void 0),wt([T(0)],Je.prototype,"curve",void 0),wt([L(Xe.__updateRenderPath)],Je.prototype,"__updateRenderPath",null),wt([L(Xe.__updateBoxBounds)],Je.prototype,"__updateBoxBounds",null),Je=wt([N(),j()],Je);const{sin:qe,cos:Ge,PI:$e}=Math,{moveTo:Ke,lineTo:Qe,closePath:Ze}=ht;let ti=class extends ue{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];Ke(a,o,0);for(let t=1;t<2*i;t++)Qe(a,o+(t%2==0?o:o*s)*qe(t*$e/i),r-(t%2==0?r:r*s)*Ge(t*$e/i));Ze(a)}};wt([g(Qt)],ti.prototype,"__",void 0),wt([T(5)],ti.prototype,"corners",void 0),wt([T(.382)],ti.prototype,"innerRadius",void 0),ti=wt([j()],ti);let ei=class extends fe{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}constructor(t){super(t)}};wt([g(se)],ei.prototype,"__",void 0),wt([B("")],ei.prototype,"url",void 0),ei=wt([j()],ei);const ii=ei;let si=class extends fe{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=$.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 gt(gt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new vt(t.worldTransform).invert(),r=new vt;e&&r.translate(e.x,e.y),i&&(U(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()}};wt([g(oe)],si.prototype,"__",void 0),wt([St(100)],si.prototype,"width",void 0),wt([St(100)],si.prototype,"height",void 0),wt([St(1)],si.prototype,"pixelRatio",void 0),wt([St(!0)],si.prototype,"smooth",void 0),wt([v(!1)],si.prototype,"safeResize",void 0),wt([St()],si.prototype,"contextSettings",void 0),si=wt([j()],si);const{copyAndSpread:oi,includes:ri,spread:ai,setList:ni}=_t;let _i=class extends ue{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__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?y.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=kt.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&&ai(_,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",!ri(h,_)),this.isOverflow?(ni(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;oi(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__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()}};wt([g(ie)],_i.prototype,"__",void 0),wt([B(0)],_i.prototype,"width",void 0),wt([B(0)],_i.prototype,"height",void 0),wt([f()],_i.prototype,"boxStyle",void 0),wt([v(!1)],_i.prototype,"resizeFontSize",void 0),wt([f("#000000")],_i.prototype,"fill",void 0),wt([ut("outside")],_i.prototype,"strokeAlign",void 0),wt([I("all")],_i.prototype,"hitFill",void 0),wt([B("")],_i.prototype,"text",void 0),wt([B("")],_i.prototype,"placeholder",void 0),wt([B("caption")],_i.prototype,"fontFamily",void 0),wt([B(12)],_i.prototype,"fontSize",void 0),wt([B("normal")],_i.prototype,"fontWeight",void 0),wt([B(!1)],_i.prototype,"italic",void 0),wt([B("none")],_i.prototype,"textCase",void 0),wt([B("none")],_i.prototype,"textDecoration",void 0),wt([B(0)],_i.prototype,"letterSpacing",void 0),wt([B({type:"percent",value:1.5})],_i.prototype,"lineHeight",void 0),wt([B(0)],_i.prototype,"paraIndent",void 0),wt([B(0)],_i.prototype,"paraSpacing",void 0),wt([B("x")],_i.prototype,"writingMode",void 0),wt([B("left")],_i.prototype,"textAlign",void 0),wt([B("top")],_i.prototype,"verticalAlign",void 0),wt([B(!0)],_i.prototype,"autoSizeAlign",void 0),wt([B("normal")],_i.prototype,"textWrap",void 0),wt([B("show")],_i.prototype,"textOverflow",void 0),wt([f(!1)],_i.prototype,"textEditing",void 0),_i=wt([j()],_i);let hi=class extends ue{get __tag(){return"Path"}constructor(t){super(t)}};wt([g(Zt)],hi.prototype,"__",void 0),wt([ut("center")],hi.prototype,"strokeAlign",void 0),hi=wt([j()],hi);let di=class extends ce{get __tag(){return"Pen"}constructor(t){super(t)}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")}};wt([g(te)],di.prototype,"__",void 0),wt([(e,i)=>{t(e,i,{get(){return this.__path}})}],di.prototype,"path",void 0),di=wt([O(ft,["set","path","paint"]),j()],di);export{ke as Box,jt as BoxData,si as Canvas,oe as CanvasData,Bt as ColorConvert,ae as DragBoundsHelper,Wt as Effect,Pe as Ellipse,$t as EllipseData,Tt as Export,Et as Filter,Be as Frame,Jt as FrameData,ce as Group,Ut as GroupData,ei as Image,se as ImageData,ve as Leafer,Xt as LeaferData,Me as Line,qt as LineData,ii as MyImage,Ct as Paint,Ft as PaintGradient,Pt as PaintImage,hi as Path,At as PathArrow,Zt as PathData,di as Pen,te as PenData,Je as Polygon,Kt as PolygonData,fe as Rect,Gt as RectData,le as RectRender,ti as Star,Qt as StarData,It as State,_i as Text,kt as TextConvert,ie as TextData,Dt as Transition,ue as UI,re as UIBounds,Ht as UIData,he as UIRender,bt as UnitConvert,Rt as createAttr,xt as effectType,St as resizeType,mt as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=draw.esm.min.js.map
|