modern-canvas 0.8.8 → 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 +40 -19
- package/dist/index.d.cts +11 -6
- package/dist/index.d.mts +11 -6
- package/dist/index.d.ts +11 -6
- package/dist/index.js +29 -29
- package/dist/index.mjs +40 -19
- 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();
|
|
@@ -5977,6 +5980,19 @@ let Node = class extends CoreObject {
|
|
|
5977
5980
|
return false;
|
|
5978
5981
|
}
|
|
5979
5982
|
}
|
|
5983
|
+
canInput() {
|
|
5984
|
+
if (!this._tree)
|
|
5985
|
+
return false;
|
|
5986
|
+
switch (this.inputMode) {
|
|
5987
|
+
case "inherit":
|
|
5988
|
+
return this._parent?.canInput() ?? true;
|
|
5989
|
+
case "always":
|
|
5990
|
+
return true;
|
|
5991
|
+
case "disabled":
|
|
5992
|
+
default:
|
|
5993
|
+
return false;
|
|
5994
|
+
}
|
|
5995
|
+
}
|
|
5980
5996
|
canRender() {
|
|
5981
5997
|
if (!this._tree)
|
|
5982
5998
|
return false;
|
|
@@ -6087,10 +6103,12 @@ let Node = class extends CoreObject {
|
|
|
6087
6103
|
if (event.propagationStopped) {
|
|
6088
6104
|
return;
|
|
6089
6105
|
}
|
|
6090
|
-
this.
|
|
6106
|
+
if (this.canInput()) {
|
|
6107
|
+
this._input(event, key);
|
|
6108
|
+
}
|
|
6091
6109
|
}
|
|
6092
6110
|
getIndex() {
|
|
6093
|
-
return this._parent?.
|
|
6111
|
+
return this._parent?.getChildren(this.internalMode).indexOf(this) ?? 0;
|
|
6094
6112
|
}
|
|
6095
6113
|
getNode(path) {
|
|
6096
6114
|
return this._children.internal.find((child) => child.name === path);
|
|
@@ -6166,7 +6184,7 @@ let Node = class extends CoreObject {
|
|
|
6166
6184
|
this._children.front.push(node);
|
|
6167
6185
|
break;
|
|
6168
6186
|
case "default":
|
|
6169
|
-
this._children.push(node);
|
|
6187
|
+
this._children.default.push(node);
|
|
6170
6188
|
break;
|
|
6171
6189
|
case "back":
|
|
6172
6190
|
this._children.back.push(node);
|
|
@@ -6210,24 +6228,24 @@ let Node = class extends CoreObject {
|
|
|
6210
6228
|
removeChild(child) {
|
|
6211
6229
|
const index = child.getIndex();
|
|
6212
6230
|
if (this.equal(child.parent) && index > -1) {
|
|
6213
|
-
this.
|
|
6231
|
+
this.getChildren(child.internalMode).splice(index, 1);
|
|
6214
6232
|
child.setParent(void 0);
|
|
6215
6233
|
this.emit("removeChild", child, index);
|
|
6216
6234
|
}
|
|
6217
6235
|
return child;
|
|
6218
6236
|
}
|
|
6219
6237
|
removeChildren() {
|
|
6220
|
-
this.
|
|
6238
|
+
this.children.forEach((child) => this.removeChild(child));
|
|
6221
6239
|
}
|
|
6222
6240
|
remove() {
|
|
6223
6241
|
this._parent?.removeChild(this);
|
|
6224
6242
|
}
|
|
6225
6243
|
forEachChild(callbackfn) {
|
|
6226
|
-
this.
|
|
6244
|
+
this.children.forEach(callbackfn);
|
|
6227
6245
|
return this;
|
|
6228
6246
|
}
|
|
6229
6247
|
forEachDescendant(callbackfn) {
|
|
6230
|
-
this.
|
|
6248
|
+
this.children.forEach((child) => {
|
|
6231
6249
|
callbackfn(child);
|
|
6232
6250
|
child.forEachDescendant(callbackfn);
|
|
6233
6251
|
});
|
|
@@ -6274,7 +6292,7 @@ let Node = class extends CoreObject {
|
|
|
6274
6292
|
toJSON() {
|
|
6275
6293
|
return clearUndef({
|
|
6276
6294
|
...super.toJSON(),
|
|
6277
|
-
children: this.
|
|
6295
|
+
children: this.children.length ? [...this.children.map((child) => child.toJSON())] : void 0,
|
|
6278
6296
|
meta: {
|
|
6279
6297
|
...this.meta,
|
|
6280
6298
|
inCanvasIs: this.is
|
|
@@ -6311,6 +6329,9 @@ __decorateClass$S([
|
|
|
6311
6329
|
__decorateClass$S([
|
|
6312
6330
|
property({ protected: true, fallback: "inherit" })
|
|
6313
6331
|
], Node.prototype, "renderMode", 2);
|
|
6332
|
+
__decorateClass$S([
|
|
6333
|
+
property({ protected: true, fallback: "inherit" })
|
|
6334
|
+
], Node.prototype, "inputMode", 2);
|
|
6314
6335
|
__decorateClass$S([
|
|
6315
6336
|
property({ protected: true, fallback: "default" })
|
|
6316
6337
|
], Node.prototype, "internalMode", 2);
|
|
@@ -6869,7 +6890,7 @@ let Effect = class extends TimelineNode {
|
|
|
6869
6890
|
calls.splice(start, 0, renderStack.createCall(this));
|
|
6870
6891
|
}
|
|
6871
6892
|
_processChildren() {
|
|
6872
|
-
if (this.
|
|
6893
|
+
if (this.children.length) {
|
|
6873
6894
|
super.emit("process");
|
|
6874
6895
|
this._tree?.renderStack.push(this);
|
|
6875
6896
|
}
|