modern-canvas 0.8.9 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -18
- package/dist/index.d.cts +7 -5
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +29 -29
- package/dist/index.mjs +21 -18
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5746,23 +5746,23 @@ class CanvasContext extends Path2D {
|
|
|
5746
5746
|
}
|
|
5747
5747
|
}
|
|
5748
5748
|
|
|
5749
|
-
class Children
|
|
5749
|
+
class Children {
|
|
5750
5750
|
front = [];
|
|
5751
|
+
default = [];
|
|
5751
5752
|
back = [];
|
|
5752
5753
|
get internal() {
|
|
5753
5754
|
return [
|
|
5754
5755
|
...this.front,
|
|
5755
|
-
...this,
|
|
5756
|
+
...this.default,
|
|
5756
5757
|
...this.back
|
|
5757
5758
|
];
|
|
5758
5759
|
}
|
|
5759
5760
|
constructor(...items) {
|
|
5760
|
-
super();
|
|
5761
5761
|
this.set(items);
|
|
5762
5762
|
}
|
|
5763
5763
|
set(items) {
|
|
5764
5764
|
this.front.length = 0;
|
|
5765
|
-
this.length = 0;
|
|
5765
|
+
this.default.length = 0;
|
|
5766
5766
|
this.back.length = 0;
|
|
5767
5767
|
items.forEach((item) => {
|
|
5768
5768
|
switch (item.internalMode) {
|
|
@@ -5770,7 +5770,7 @@ class Children extends Array {
|
|
|
5770
5770
|
this.front.push(item);
|
|
5771
5771
|
break;
|
|
5772
5772
|
case "default":
|
|
5773
|
-
this.push(item);
|
|
5773
|
+
this.default.push(item);
|
|
5774
5774
|
break;
|
|
5775
5775
|
case "back":
|
|
5776
5776
|
this.back.push(item);
|
|
@@ -5784,7 +5784,7 @@ class Children extends Array {
|
|
|
5784
5784
|
case "front":
|
|
5785
5785
|
return this.front;
|
|
5786
5786
|
case "default":
|
|
5787
|
-
return this;
|
|
5787
|
+
return this.default;
|
|
5788
5788
|
case "back":
|
|
5789
5789
|
return this.back;
|
|
5790
5790
|
default:
|
|
@@ -5792,7 +5792,7 @@ class Children extends Array {
|
|
|
5792
5792
|
}
|
|
5793
5793
|
}
|
|
5794
5794
|
toJSON() {
|
|
5795
|
-
return [...this];
|
|
5795
|
+
return [...this.default];
|
|
5796
5796
|
}
|
|
5797
5797
|
}
|
|
5798
5798
|
|
|
@@ -5933,13 +5933,16 @@ let Node = class extends CoreObject {
|
|
|
5933
5933
|
/** Children */
|
|
5934
5934
|
_children = new Children();
|
|
5935
5935
|
get children() {
|
|
5936
|
-
return this._children;
|
|
5936
|
+
return this._children.default;
|
|
5937
5937
|
}
|
|
5938
5938
|
set children(value) {
|
|
5939
|
-
|
|
5939
|
+
this._children.set(value);
|
|
5940
|
+
}
|
|
5941
|
+
getChildren(includeInternal) {
|
|
5942
|
+
return this._children.getInternal(includeInternal);
|
|
5940
5943
|
}
|
|
5941
5944
|
getChild(index = 0) {
|
|
5942
|
-
return this.
|
|
5945
|
+
return this.children[index];
|
|
5943
5946
|
}
|
|
5944
5947
|
get siblingIndex() {
|
|
5945
5948
|
return this.getIndex();
|
|
@@ -6105,7 +6108,7 @@ let Node = class extends CoreObject {
|
|
|
6105
6108
|
}
|
|
6106
6109
|
}
|
|
6107
6110
|
getIndex() {
|
|
6108
|
-
return this._parent?.
|
|
6111
|
+
return this._parent?.getChildren(this.internalMode).indexOf(this) ?? 0;
|
|
6109
6112
|
}
|
|
6110
6113
|
getNode(path) {
|
|
6111
6114
|
return this._children.internal.find((child) => child.name === path);
|
|
@@ -6181,7 +6184,7 @@ let Node = class extends CoreObject {
|
|
|
6181
6184
|
this._children.front.push(node);
|
|
6182
6185
|
break;
|
|
6183
6186
|
case "default":
|
|
6184
|
-
this._children.push(node);
|
|
6187
|
+
this._children.default.push(node);
|
|
6185
6188
|
break;
|
|
6186
6189
|
case "back":
|
|
6187
6190
|
this._children.back.push(node);
|
|
@@ -6225,24 +6228,24 @@ let Node = class extends CoreObject {
|
|
|
6225
6228
|
removeChild(child) {
|
|
6226
6229
|
const index = child.getIndex();
|
|
6227
6230
|
if (this.equal(child.parent) && index > -1) {
|
|
6228
|
-
this.
|
|
6231
|
+
this.getChildren(child.internalMode).splice(index, 1);
|
|
6229
6232
|
child.setParent(void 0);
|
|
6230
6233
|
this.emit("removeChild", child, index);
|
|
6231
6234
|
}
|
|
6232
6235
|
return child;
|
|
6233
6236
|
}
|
|
6234
6237
|
removeChildren() {
|
|
6235
|
-
this.
|
|
6238
|
+
this.children.forEach((child) => this.removeChild(child));
|
|
6236
6239
|
}
|
|
6237
6240
|
remove() {
|
|
6238
6241
|
this._parent?.removeChild(this);
|
|
6239
6242
|
}
|
|
6240
6243
|
forEachChild(callbackfn) {
|
|
6241
|
-
this.
|
|
6244
|
+
this.children.forEach(callbackfn);
|
|
6242
6245
|
return this;
|
|
6243
6246
|
}
|
|
6244
6247
|
forEachDescendant(callbackfn) {
|
|
6245
|
-
this.
|
|
6248
|
+
this.children.forEach((child) => {
|
|
6246
6249
|
callbackfn(child);
|
|
6247
6250
|
child.forEachDescendant(callbackfn);
|
|
6248
6251
|
});
|
|
@@ -6289,7 +6292,7 @@ let Node = class extends CoreObject {
|
|
|
6289
6292
|
toJSON() {
|
|
6290
6293
|
return clearUndef({
|
|
6291
6294
|
...super.toJSON(),
|
|
6292
|
-
children: this.
|
|
6295
|
+
children: this.children.length ? [...this.children.map((child) => child.toJSON())] : void 0,
|
|
6293
6296
|
meta: {
|
|
6294
6297
|
...this.meta,
|
|
6295
6298
|
inCanvasIs: this.is
|
|
@@ -6887,7 +6890,7 @@ let Effect = class extends TimelineNode {
|
|
|
6887
6890
|
calls.splice(start, 0, renderStack.createCall(this));
|
|
6888
6891
|
}
|
|
6889
6892
|
_processChildren() {
|
|
6890
|
-
if (this.
|
|
6893
|
+
if (this.children.length) {
|
|
6891
6894
|
super.emit("process");
|
|
6892
6895
|
this._tree?.renderStack.push(this);
|
|
6893
6896
|
}
|