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 CHANGED
@@ -5752,23 +5752,23 @@ class CanvasContext extends modernPath2d.Path2D {
5752
5752
  }
5753
5753
  }
5754
5754
 
5755
- class Children extends Array {
5755
+ class Children {
5756
5756
  front = [];
5757
+ default = [];
5757
5758
  back = [];
5758
5759
  get internal() {
5759
5760
  return [
5760
5761
  ...this.front,
5761
- ...this,
5762
+ ...this.default,
5762
5763
  ...this.back
5763
5764
  ];
5764
5765
  }
5765
5766
  constructor(...items) {
5766
- super();
5767
5767
  this.set(items);
5768
5768
  }
5769
5769
  set(items) {
5770
5770
  this.front.length = 0;
5771
- this.length = 0;
5771
+ this.default.length = 0;
5772
5772
  this.back.length = 0;
5773
5773
  items.forEach((item) => {
5774
5774
  switch (item.internalMode) {
@@ -5776,7 +5776,7 @@ class Children extends Array {
5776
5776
  this.front.push(item);
5777
5777
  break;
5778
5778
  case "default":
5779
- this.push(item);
5779
+ this.default.push(item);
5780
5780
  break;
5781
5781
  case "back":
5782
5782
  this.back.push(item);
@@ -5790,7 +5790,7 @@ class Children extends Array {
5790
5790
  case "front":
5791
5791
  return this.front;
5792
5792
  case "default":
5793
- return this;
5793
+ return this.default;
5794
5794
  case "back":
5795
5795
  return this.back;
5796
5796
  default:
@@ -5798,7 +5798,7 @@ class Children extends Array {
5798
5798
  }
5799
5799
  }
5800
5800
  toJSON() {
5801
- return [...this];
5801
+ return [...this.default];
5802
5802
  }
5803
5803
  }
5804
5804
 
@@ -5939,13 +5939,16 @@ exports.Node = class Node extends CoreObject {
5939
5939
  /** Children */
5940
5940
  _children = new Children();
5941
5941
  get children() {
5942
- return this._children;
5942
+ return this._children.default;
5943
5943
  }
5944
5944
  set children(value) {
5945
- value instanceof Children ? this._children = value : this._children.set(value);
5945
+ this._children.set(value);
5946
+ }
5947
+ getChildren(includeInternal) {
5948
+ return this._children.getInternal(includeInternal);
5946
5949
  }
5947
5950
  getChild(index = 0) {
5948
- return this._children[index];
5951
+ return this.children[index];
5949
5952
  }
5950
5953
  get siblingIndex() {
5951
5954
  return this.getIndex();
@@ -6111,7 +6114,7 @@ exports.Node = class Node extends CoreObject {
6111
6114
  }
6112
6115
  }
6113
6116
  getIndex() {
6114
- return this._parent?.children.getInternal(this.internalMode).indexOf(this) ?? 0;
6117
+ return this._parent?.getChildren(this.internalMode).indexOf(this) ?? 0;
6115
6118
  }
6116
6119
  getNode(path) {
6117
6120
  return this._children.internal.find((child) => child.name === path);
@@ -6187,7 +6190,7 @@ exports.Node = class Node extends CoreObject {
6187
6190
  this._children.front.push(node);
6188
6191
  break;
6189
6192
  case "default":
6190
- this._children.push(node);
6193
+ this._children.default.push(node);
6191
6194
  break;
6192
6195
  case "back":
6193
6196
  this._children.back.push(node);
@@ -6231,24 +6234,24 @@ exports.Node = class Node extends CoreObject {
6231
6234
  removeChild(child) {
6232
6235
  const index = child.getIndex();
6233
6236
  if (this.equal(child.parent) && index > -1) {
6234
- this._children.getInternal(child.internalMode).splice(index, 1);
6237
+ this.getChildren(child.internalMode).splice(index, 1);
6235
6238
  child.setParent(void 0);
6236
6239
  this.emit("removeChild", child, index);
6237
6240
  }
6238
6241
  return child;
6239
6242
  }
6240
6243
  removeChildren() {
6241
- this._children.forEach((child) => this.removeChild(child));
6244
+ this.children.forEach((child) => this.removeChild(child));
6242
6245
  }
6243
6246
  remove() {
6244
6247
  this._parent?.removeChild(this);
6245
6248
  }
6246
6249
  forEachChild(callbackfn) {
6247
- this._children.forEach(callbackfn);
6250
+ this.children.forEach(callbackfn);
6248
6251
  return this;
6249
6252
  }
6250
6253
  forEachDescendant(callbackfn) {
6251
- this._children.forEach((child) => {
6254
+ this.children.forEach((child) => {
6252
6255
  callbackfn(child);
6253
6256
  child.forEachDescendant(callbackfn);
6254
6257
  });
@@ -6295,7 +6298,7 @@ exports.Node = class Node extends CoreObject {
6295
6298
  toJSON() {
6296
6299
  return modernIdoc.clearUndef({
6297
6300
  ...super.toJSON(),
6298
- children: this._children.length ? [...this._children.map((child) => child.toJSON())] : void 0,
6301
+ children: this.children.length ? [...this.children.map((child) => child.toJSON())] : void 0,
6299
6302
  meta: {
6300
6303
  ...this.meta,
6301
6304
  inCanvasIs: this.is
@@ -6893,7 +6896,7 @@ exports.Effect = class Effect extends exports.TimelineNode {
6893
6896
  calls.splice(start, 0, renderStack.createCall(this));
6894
6897
  }
6895
6898
  _processChildren() {
6896
- if (this._children.length) {
6899
+ if (this.children.length) {
6897
6900
  super.emit("process");
6898
6901
  this._tree?.renderStack.push(this);
6899
6902
  }
package/dist/index.d.cts CHANGED
@@ -1643,9 +1643,10 @@ declare class SceneTree extends MainLoop {
1643
1643
  free(): void;
1644
1644
  }
1645
1645
 
1646
- declare class Children<T extends Node = Node> extends Array<T> {
1647
- readonly front: T[];
1648
- readonly back: T[];
1646
+ declare class Children<T extends Node = Node> {
1647
+ front: T[];
1648
+ default: T[];
1649
+ back: T[];
1649
1650
  get internal(): T[];
1650
1651
  constructor(...items: T[]);
1651
1652
  set(items: T[]): this;
@@ -1729,8 +1730,9 @@ declare class Node extends CoreObject {
1729
1730
  setParent<T extends Node = Node>(parent: T | undefined): this;
1730
1731
  /** Children */
1731
1732
  protected _children: Children<Node>;
1732
- get children(): Children;
1733
- set children(value: Node[] | Children);
1733
+ get children(): Node[];
1734
+ set children(value: Node[]);
1735
+ getChildren(includeInternal: InternalMode): Node[];
1734
1736
  getChild<T extends Node = Node>(index?: number): T | undefined;
1735
1737
  get siblingIndex(): number;
1736
1738
  set siblingIndex(toIndex: number);
package/dist/index.d.mts CHANGED
@@ -1643,9 +1643,10 @@ declare class SceneTree extends MainLoop {
1643
1643
  free(): void;
1644
1644
  }
1645
1645
 
1646
- declare class Children<T extends Node = Node> extends Array<T> {
1647
- readonly front: T[];
1648
- readonly back: T[];
1646
+ declare class Children<T extends Node = Node> {
1647
+ front: T[];
1648
+ default: T[];
1649
+ back: T[];
1649
1650
  get internal(): T[];
1650
1651
  constructor(...items: T[]);
1651
1652
  set(items: T[]): this;
@@ -1729,8 +1730,9 @@ declare class Node extends CoreObject {
1729
1730
  setParent<T extends Node = Node>(parent: T | undefined): this;
1730
1731
  /** Children */
1731
1732
  protected _children: Children<Node>;
1732
- get children(): Children;
1733
- set children(value: Node[] | Children);
1733
+ get children(): Node[];
1734
+ set children(value: Node[]);
1735
+ getChildren(includeInternal: InternalMode): Node[];
1734
1736
  getChild<T extends Node = Node>(index?: number): T | undefined;
1735
1737
  get siblingIndex(): number;
1736
1738
  set siblingIndex(toIndex: number);
package/dist/index.d.ts CHANGED
@@ -1643,9 +1643,10 @@ declare class SceneTree extends MainLoop {
1643
1643
  free(): void;
1644
1644
  }
1645
1645
 
1646
- declare class Children<T extends Node = Node> extends Array<T> {
1647
- readonly front: T[];
1648
- readonly back: T[];
1646
+ declare class Children<T extends Node = Node> {
1647
+ front: T[];
1648
+ default: T[];
1649
+ back: T[];
1649
1650
  get internal(): T[];
1650
1651
  constructor(...items: T[]);
1651
1652
  set(items: T[]): this;
@@ -1729,8 +1730,9 @@ declare class Node extends CoreObject {
1729
1730
  setParent<T extends Node = Node>(parent: T | undefined): this;
1730
1731
  /** Children */
1731
1732
  protected _children: Children<Node>;
1732
- get children(): Children;
1733
- set children(value: Node[] | Children);
1733
+ get children(): Node[];
1734
+ set children(value: Node[]);
1735
+ getChildren(includeInternal: InternalMode): Node[];
1734
1736
  getChild<T extends Node = Node>(index?: number): T | undefined;
1735
1737
  get siblingIndex(): number;
1736
1738
  set siblingIndex(toIndex: number);