modern-canvas 0.4.42 → 0.4.44

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
@@ -543,6 +543,12 @@ class CoreObject extends EventEmitter {
543
543
  }
544
544
  return this;
545
545
  }
546
+ resetProperties() {
547
+ for (const [name, property] of this.getPropertyDeclarations()) {
548
+ this.setProperty(name, property.default);
549
+ }
550
+ return this;
551
+ }
546
552
  requestUpdate(key, oldValue, declaration) {
547
553
  if (key !== void 0) {
548
554
  const newValue = this[key];
@@ -565,8 +571,12 @@ class CoreObject extends EventEmitter {
565
571
  const properties = this.getProperties(Array.from(this._changedProperties));
566
572
  for (const key in properties) {
567
573
  const value = properties[key];
568
- if (value && typeof value === "object" && "toJSON" in value && typeof value.toJSON === "function") {
569
- json[key] = value.toJSON();
574
+ if (value && typeof value === "object") {
575
+ if ("toJSON" in value && typeof value.toJSON === "function") {
576
+ json[key] = value.toJSON();
577
+ } else {
578
+ json[key] = { ...value };
579
+ }
570
580
  } else {
571
581
  json[key] = value;
572
582
  }
@@ -5161,7 +5171,8 @@ class GradientTexture extends Texture2D {
5161
5171
  if (!ctx) {
5162
5172
  throw new Error("Failed to parse linear gradient, get canvas context is null.");
5163
5173
  }
5164
- const { angle, stops } = linearGradient;
5174
+ let { angle, stops } = linearGradient;
5175
+ angle -= Math.PI / 2;
5165
5176
  const halfWidth = width / 2;
5166
5177
  const halfHeight = height / 2;
5167
5178
  const length = Math.sqrt(width * width + height * height) / 2;
@@ -5598,6 +5609,56 @@ class ViewportTexture extends PixelsTexture {
5598
5609
  //
5599
5610
  }
5600
5611
 
5612
+ class Children extends Array {
5613
+ front = [];
5614
+ back = [];
5615
+ get internal() {
5616
+ return [
5617
+ ...this.front,
5618
+ ...this,
5619
+ ...this.back
5620
+ ];
5621
+ }
5622
+ constructor(...items) {
5623
+ super();
5624
+ this.set(items);
5625
+ }
5626
+ set(items) {
5627
+ this.front.length = 0;
5628
+ this.length = 0;
5629
+ this.back.length = 0;
5630
+ items.forEach((item) => {
5631
+ switch (item.internalMode) {
5632
+ case "front":
5633
+ this.front.push(item);
5634
+ break;
5635
+ case "default":
5636
+ this.push(item);
5637
+ break;
5638
+ case "back":
5639
+ this.back.push(item);
5640
+ break;
5641
+ }
5642
+ });
5643
+ return this;
5644
+ }
5645
+ getInternal(includeInternal) {
5646
+ switch (includeInternal) {
5647
+ case "front":
5648
+ return this.front;
5649
+ case "default":
5650
+ return this;
5651
+ case "back":
5652
+ return this.back;
5653
+ default:
5654
+ throw new Error(`Unknown internal mode: ${includeInternal}`);
5655
+ }
5656
+ }
5657
+ toJSON() {
5658
+ return [...this];
5659
+ }
5660
+ }
5661
+
5601
5662
  var __defProp$J = Object.defineProperty;
5602
5663
  var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
5603
5664
  var __decorateClass$R = (decorators, target, key, kind) => {
@@ -5639,7 +5700,7 @@ exports.Node = class Node extends CoreObject {
5639
5700
  } = properties;
5640
5701
  if (meta) {
5641
5702
  for (const key in meta) {
5642
- this.setMeta(key, meta[key]);
5703
+ this.meta[key] = meta[key];
5643
5704
  }
5644
5705
  }
5645
5706
  super.setProperties(restProperties);
@@ -5684,8 +5745,9 @@ exports.Node = class Node extends CoreObject {
5684
5745
  if (tree) {
5685
5746
  this.emit("treeEnter", tree);
5686
5747
  }
5687
- for (let len = this._children.length, i = 0; i < len; i++) {
5688
- const node = this._children[i];
5748
+ const children = this._children.internal;
5749
+ for (let len = children.length, i = 0; i < len; i++) {
5750
+ const node = children[i];
5689
5751
  !tree && this.emit("childExitingTree", node);
5690
5752
  node.setTree(tree);
5691
5753
  tree && this.emit("childEnteredTree", node);
@@ -5709,7 +5771,7 @@ exports.Node = class Node extends CoreObject {
5709
5771
  this.setParent(parent);
5710
5772
  }
5711
5773
  hasParent() {
5712
- return !!this._parent;
5774
+ return Boolean(this._parent);
5713
5775
  }
5714
5776
  getParent() {
5715
5777
  return this._parent;
@@ -5729,7 +5791,13 @@ exports.Node = class Node extends CoreObject {
5729
5791
  return this;
5730
5792
  }
5731
5793
  /** Children */
5732
- _children = [];
5794
+ _children = new Children();
5795
+ get children() {
5796
+ return this._children;
5797
+ }
5798
+ set children(value) {
5799
+ value instanceof Children ? this._children = value : this._children.set(value);
5800
+ }
5733
5801
  get siblingIndex() {
5734
5802
  return this.getIndex();
5735
5803
  }
@@ -5737,35 +5805,18 @@ exports.Node = class Node extends CoreObject {
5737
5805
  this._parent?.moveChild(this, toIndex);
5738
5806
  }
5739
5807
  get previousSibling() {
5740
- return this._parent?.getChildren()[this.getIndex() - 1];
5808
+ return this._parent?.children[this.getIndex() - 1];
5741
5809
  }
5742
5810
  get nextSibling() {
5743
- return this._parent?.getChildren()[this.getIndex() + 1];
5811
+ return this._parent?.children[this.getIndex() + 1];
5744
5812
  }
5745
5813
  get firstSibling() {
5746
- return this._parent?.getChildren()[0];
5814
+ return this._parent?.children[0];
5747
5815
  }
5748
5816
  get lastSibling() {
5749
- const children = this._parent?.getChildren();
5817
+ const children = this._parent?.children;
5750
5818
  return children ? children[children.length - 1] : void 0;
5751
5819
  }
5752
- /** Meta */
5753
- _meta = /* @__PURE__ */ new Map();
5754
- hasMeta(name) {
5755
- return this._meta.has(name);
5756
- }
5757
- getMeta(name, defaultVal) {
5758
- return this._meta.get(name) ?? defaultVal;
5759
- }
5760
- setMeta(name, value) {
5761
- this._meta.set(name, value);
5762
- }
5763
- deleteMeta(name) {
5764
- this._meta.delete(name);
5765
- }
5766
- clearMeta() {
5767
- this._meta.clear();
5768
- }
5769
5820
  canProcess() {
5770
5821
  if (!this._tree)
5771
5822
  return false;
@@ -5826,8 +5877,7 @@ exports.Node = class Node extends CoreObject {
5826
5877
  const canProcess = this.canProcess();
5827
5878
  const childrenInBefore = [];
5828
5879
  const childrenInAfter = [];
5829
- for (let len = this._children.length, i = 0; i < len; i++) {
5830
- const child = this._children[i];
5880
+ this._children.internal.forEach((child) => {
5831
5881
  switch (child.processSortMode) {
5832
5882
  case "default":
5833
5883
  childrenInAfter.push(child);
@@ -5836,7 +5886,7 @@ exports.Node = class Node extends CoreObject {
5836
5886
  childrenInBefore.push(child);
5837
5887
  break;
5838
5888
  }
5839
- }
5889
+ });
5840
5890
  childrenInBefore.forEach((child) => {
5841
5891
  child.emit("process", delta);
5842
5892
  });
@@ -5887,27 +5937,14 @@ exports.Node = class Node extends CoreObject {
5887
5937
  }
5888
5938
  }
5889
5939
  input(event, key) {
5890
- for (let i = this._children.length - 1; i >= 0; i--) {
5891
- this._children[i].input(event, key);
5892
- }
5940
+ this._children.internal.forEach((child) => child.input(event, key));
5893
5941
  this._input(event, key);
5894
5942
  }
5895
- /** Children */
5896
- getChildren(includeInternal = false) {
5897
- switch (includeInternal) {
5898
- case true:
5899
- return this._children;
5900
- case false:
5901
- return this._children.filter((child) => child.internalMode === "default");
5902
- default:
5903
- return this._children.filter((child) => child.internalMode === includeInternal);
5904
- }
5905
- }
5906
- getIndex(includeInternal = false) {
5907
- return this._parent?.getChildren(includeInternal).indexOf(this) ?? 0;
5943
+ getIndex() {
5944
+ return this._parent?.children.getInternal(this.internalMode).indexOf(this) ?? 0;
5908
5945
  }
5909
5946
  getNode(path) {
5910
- return this._children.find((child) => child.name === path);
5947
+ return this._children.internal.find((child) => child.name === path);
5911
5948
  }
5912
5949
  removeNode(path) {
5913
5950
  this.getNode(path)?.remove();
@@ -5917,7 +5954,7 @@ exports.Node = class Node extends CoreObject {
5917
5954
  return this;
5918
5955
  }
5919
5956
  sibling.internalMode = this.internalMode;
5920
- this._parent.moveChild(sibling, this.getIndex(true) + 1);
5957
+ this._parent.moveChild(sibling, this.getIndex() + 1);
5921
5958
  return this;
5922
5959
  }
5923
5960
  prepend(...nodes) {
@@ -5950,7 +5987,7 @@ exports.Node = class Node extends CoreObject {
5950
5987
  _nodes = nodes;
5951
5988
  }
5952
5989
  _nodes.forEach((node) => {
5953
- this._parent?.moveChild(node, this.getIndex(true));
5990
+ this._parent?.moveChild(node, this.getIndex());
5954
5991
  });
5955
5992
  }
5956
5993
  after(...nodes) {
@@ -5961,128 +5998,83 @@ exports.Node = class Node extends CoreObject {
5961
5998
  _nodes = nodes;
5962
5999
  }
5963
6000
  _nodes.forEach((node) => {
5964
- this._parent?.moveChild(node, this.getIndex(true) + 1);
6001
+ this._parent?.moveChild(node, this.getIndex() + 1);
5965
6002
  });
5966
6003
  }
5967
6004
  insertBefore(node, child) {
5968
6005
  if (!child.hasParent() || !this.is(child.parent)) {
5969
6006
  return node;
5970
6007
  }
5971
- this.moveChild(node, child.getIndex(true));
6008
+ this.moveChild(node, child.getIndex());
5972
6009
  return node;
5973
6010
  }
5974
6011
  appendChild(node, internalMode = node.internalMode) {
5975
6012
  if (this.is(node) || node.hasParent()) {
5976
6013
  return node;
5977
6014
  }
5978
- let index = -1;
5979
6015
  switch (internalMode) {
5980
- case "default":
5981
- index = this._children.findLastIndex((node2) => node2.internalMode === "default");
5982
- if (index > -1) {
5983
- index += 1;
5984
- } else {
5985
- index = this._children.findIndex((node2) => node2.internalMode === "back");
5986
- }
6016
+ case "front":
6017
+ this._children.front.push(node);
5987
6018
  break;
5988
- case "front": {
5989
- index = this._children.findLastIndex((node2) => node2.internalMode === "front");
5990
- if (index > -1) {
5991
- index += 1;
5992
- } else {
5993
- index = this._children.findIndex((node2) => node2.internalMode === "default");
5994
- }
5995
- if (index > -1) {
5996
- index += 1;
5997
- } else {
5998
- index = this._children.findIndex((node2) => node2.internalMode === "back");
5999
- }
6019
+ case "default":
6020
+ this._children.push(node);
6000
6021
  break;
6001
- }
6002
6022
  case "back":
6003
- this._children.push(node);
6023
+ this._children.back.push(node);
6004
6024
  break;
6005
6025
  }
6006
- if (index > -1) {
6007
- this._children.splice(index, 0, node);
6008
- } else {
6009
- this._children.push(node);
6010
- }
6011
6026
  node.internalMode = internalMode;
6012
6027
  node.setParent(this);
6013
6028
  this.emit("appendChild", node);
6014
6029
  return node;
6015
6030
  }
6016
- moveChild(child, toIndex, internalMode = child.internalMode) {
6017
- if (this.is(child) || child.hasParent() && !this.is(child.parent)) {
6031
+ moveChild(node, toIndex, internalMode = node.internalMode) {
6032
+ if (this.is(node) || node.hasParent() && !this.is(node.parent)) {
6018
6033
  return this;
6019
6034
  }
6020
- child.internalMode = internalMode;
6021
- const oldIndex = this._children.indexOf(child);
6022
- let minIndex = this._children.findIndex((_child) => {
6023
- switch (internalMode) {
6024
- case "default":
6025
- return _child.internalMode !== "front";
6026
- case "back":
6027
- return _child.internalMode === "back";
6028
- case "front":
6029
- default:
6030
- return true;
6031
- }
6032
- });
6033
- minIndex = minIndex > -1 ? minIndex : Math.max(0, this._children.length - 1);
6034
- let maxIndex = this._children.slice(minIndex).findIndex((_child) => {
6035
- switch (internalMode) {
6036
- case "front":
6037
- return _child.internalMode !== "front";
6038
- case "default":
6039
- return _child.internalMode === "back";
6040
- case "back":
6041
- default:
6042
- return false;
6035
+ const fromArray = this._children.getInternal(node.internalMode);
6036
+ const fromIndex = fromArray.indexOf(node);
6037
+ const toArray = this._children.getInternal(internalMode);
6038
+ if (node.internalMode !== internalMode || toIndex !== fromIndex) {
6039
+ if (fromIndex > -1) {
6040
+ fromArray.splice(fromIndex, 1);
6043
6041
  }
6044
- });
6045
- maxIndex = maxIndex > -1 ? minIndex + maxIndex : Math.max(0, this._children.length);
6046
- const newIndex = clamp(minIndex, toIndex > -1 ? toIndex : maxIndex, maxIndex);
6047
- if (newIndex !== oldIndex) {
6048
- if (oldIndex > -1) {
6049
- this._children.splice(oldIndex, 1);
6050
- }
6051
- child.setParent(this);
6052
- if (newIndex > -1 && newIndex < this._children.length) {
6053
- this._children.splice(newIndex, 0, child);
6042
+ node.setParent(this);
6043
+ if (toIndex > -1 && toIndex < toArray.length) {
6044
+ toArray.splice(toIndex, 0, node);
6054
6045
  } else {
6055
- this._children.push(child);
6046
+ toArray.push(node);
6056
6047
  }
6057
- if (oldIndex > -1) {
6058
- this.emit("moveChild", child, newIndex, oldIndex);
6048
+ if (fromIndex > -1) {
6049
+ this.emit("moveChild", node, toIndex, fromIndex);
6059
6050
  } else {
6060
- this.emit("appendChild", child);
6051
+ this.emit("appendChild", node);
6061
6052
  }
6062
6053
  }
6054
+ node.internalMode = internalMode;
6063
6055
  return this;
6064
6056
  }
6065
6057
  removeChild(child) {
6066
- const index = child.getIndex(true);
6058
+ const index = child.getIndex();
6067
6059
  if (this.is(child.parent) && index > -1) {
6068
- this._children.splice(index, 1);
6060
+ this._children.internal.splice(index, 1);
6069
6061
  child.setParent(void 0);
6070
6062
  this.emit("removeChild", child, index);
6071
6063
  }
6072
6064
  return child;
6073
6065
  }
6074
6066
  removeChildren() {
6075
- this.getChildren().forEach((child) => this.removeChild(child));
6067
+ this._children.forEach((child) => this.removeChild(child));
6076
6068
  }
6077
6069
  remove() {
6078
6070
  this._parent?.removeChild(this);
6079
6071
  }
6080
6072
  forEachChild(callbackfn) {
6081
- this.getChildren().forEach(callbackfn);
6073
+ this._children.forEach(callbackfn);
6082
6074
  return this;
6083
6075
  }
6084
6076
  forEachDescendant(callbackfn) {
6085
- this.getChildren().forEach((child) => {
6077
+ this._children.forEach((child) => {
6086
6078
  callbackfn(child);
6087
6079
  child.forEachDescendant(callbackfn);
6088
6080
  });
@@ -6115,18 +6107,14 @@ exports.Node = class Node extends CoreObject {
6115
6107
  clone() {
6116
6108
  return new this.constructor(
6117
6109
  this.toJSON().props,
6118
- this.getChildren(true)
6110
+ this._children.internal
6119
6111
  );
6120
6112
  }
6121
6113
  toJSON() {
6122
6114
  return {
6123
6115
  tag: this.tag,
6124
- props: {
6125
- name: this.name,
6126
- ...super.toJSON()
6127
- },
6128
- meta: Object.fromEntries(this._meta.entries()),
6129
- children: this.getChildren().map((child) => child.toJSON())
6116
+ props: super.toJSON(),
6117
+ children: [...this._children.map((child) => child.toJSON())]
6130
6118
  };
6131
6119
  }
6132
6120
  static parse(JSON) {
@@ -6141,7 +6129,7 @@ exports.Node = class Node extends CoreObject {
6141
6129
  }
6142
6130
  };
6143
6131
  __decorateClass$R([
6144
- protectedProperty()
6132
+ property()
6145
6133
  ], exports.Node.prototype, "name", 2);
6146
6134
  __decorateClass$R([
6147
6135
  property()
@@ -6158,6 +6146,9 @@ __decorateClass$R([
6158
6146
  __decorateClass$R([
6159
6147
  property({ default: "default" })
6160
6148
  ], exports.Node.prototype, "internalMode", 2);
6149
+ __decorateClass$R([
6150
+ property({ default: {} })
6151
+ ], exports.Node.prototype, "meta", 2);
6161
6152
  exports.Node = __decorateClass$R([
6162
6153
  customNode("Node")
6163
6154
  ], exports.Node);
@@ -7673,7 +7664,7 @@ class SceneTree extends MainLoop {
7673
7664
  }
7674
7665
  free() {
7675
7666
  super.free();
7676
- this.root.getChildren(true).forEach((node) => this.root.removeChild(node));
7667
+ this.root.children.internal.forEach((node) => this.root.removeChild(node));
7677
7668
  this.input.removeEventListeners();
7678
7669
  }
7679
7670
  }
@@ -8974,7 +8965,9 @@ class BaseElement2DFill extends CoreObject {
8974
8965
  return super.setProperties(properties);
8975
8966
  }
8976
8967
  setProperties(properties) {
8977
- return this._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeFill(properties));
8968
+ return this._setProperties(
8969
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeFill(properties)
8970
+ );
8978
8971
  }
8979
8972
  _updateProperty(key, value, oldValue, declaration) {
8980
8973
  super._updateProperty(key, value, oldValue, declaration);
@@ -9018,51 +9011,40 @@ class BaseElement2DFill extends CoreObject {
9018
9011
  );
9019
9012
  }
9020
9013
  _getDrawOptions() {
9021
- let textureTransform;
9022
9014
  let disableWrapMode = false;
9023
- if (this._texture && this._texture.source instanceof ImageBitmap) {
9024
- textureTransform = new Transform2D();
9025
- const { width: imageWidth, height: imageHeight } = this._texture;
9026
- const { width, height } = this.parent.size;
9027
- if (this.cropRect) {
9028
- const {
9029
- left = 0,
9030
- top = 0,
9031
- right = 0,
9032
- bottom = 0
9033
- } = this.cropRect;
9034
- const w = Math.abs(1 + (left + right)) * width;
9035
- const h = Math.abs(1 + (top + bottom)) * height;
9036
- const sx = 1 / w;
9037
- const sy = 1 / h;
9038
- const tx = left * width * sx;
9039
- const ty = top * height * sy;
9040
- textureTransform.scale(sx, sy).translate(tx, ty);
9041
- }
9042
- if (this.tile) {
9043
- const {
9044
- translateX = 0,
9045
- translateY = 0,
9046
- scaleX = 1,
9047
- scaleY = 1
9048
- // flip, TODO
9049
- // alignment, TODO
9050
- } = this.tile;
9051
- textureTransform.scale(1 / imageWidth, 1 / imageHeight).scale(1 / scaleX, 1 / scaleY).translate(-translateX / imageWidth, -translateY / imageHeight);
9052
- disableWrapMode = true;
9053
- } else if (this.stretchRect) {
9054
- const { left = 0, top = 0, right = 0, bottom = 0 } = this.stretchRect;
9055
- const w = Math.abs(1 + (-left + -right)) * width;
9056
- const h = Math.abs(1 + (-top + -bottom)) * height;
9057
- const scaleX = 1 / w;
9058
- const scaleY = 1 / h;
9059
- const translateX = -left * width * scaleX;
9060
- const translateY = -top * height * scaleY;
9061
- textureTransform.scale(scaleX, scaleY).translate(translateX, translateY);
9062
- disableWrapMode = true;
9063
- } else {
9064
- textureTransform.scale(1 / width, 1 / height);
9065
- }
9015
+ const { width, height } = this.parent.size;
9016
+ const textureTransform = new Transform2D().scale(1 / width, 1 / height);
9017
+ if (this.cropRect) {
9018
+ const {
9019
+ left = 0,
9020
+ top = 0,
9021
+ right = 0,
9022
+ bottom = 0
9023
+ } = this.cropRect;
9024
+ textureTransform.scale(
9025
+ Math.abs(1 - (left + right)),
9026
+ Math.abs(1 - (top + bottom))
9027
+ ).translate(left, top);
9028
+ disableWrapMode = true;
9029
+ }
9030
+ if (this.tile) {
9031
+ const {
9032
+ translateX = 0,
9033
+ translateY = 0,
9034
+ scaleX = 1,
9035
+ scaleY = 1
9036
+ // flip, TODO
9037
+ // alignment, TODO
9038
+ } = this.tile;
9039
+ textureTransform.translate(-translateX / width, -translateY / height).scale(1 / scaleX, 1 / scaleY);
9040
+ disableWrapMode = true;
9041
+ } else if (this.stretchRect) {
9042
+ const { left = 0, top = 0, right = 0, bottom = 0 } = this.stretchRect;
9043
+ textureTransform.scale(
9044
+ Math.abs(1 - (-left + -right)),
9045
+ Math.abs(1 - (-top + -bottom))
9046
+ ).translate(-left, -top);
9047
+ disableWrapMode = true;
9066
9048
  }
9067
9049
  return { disableWrapMode, textureTransform };
9068
9050
  }
@@ -9116,7 +9098,9 @@ var __decorateClass$t = (decorators, target, key, kind) => {
9116
9098
  };
9117
9099
  class BaseElement2DBackground extends BaseElement2DFill {
9118
9100
  setProperties(properties) {
9119
- return super._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeBackground(properties));
9101
+ return super._setProperties(
9102
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeBackground(properties)
9103
+ );
9120
9104
  }
9121
9105
  }
9122
9106
  __decorateClass$t([
@@ -9134,7 +9118,9 @@ var __decorateClass$s = (decorators, target, key, kind) => {
9134
9118
  };
9135
9119
  class BaseElement2DForeground extends BaseElement2DFill {
9136
9120
  setProperties(properties) {
9137
- return super._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeForeground(properties));
9121
+ return super._setProperties(
9122
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeForeground(properties)
9123
+ );
9138
9124
  }
9139
9125
  }
9140
9126
  __decorateClass$s([
@@ -9152,7 +9138,9 @@ var __decorateClass$r = (decorators, target, key, kind) => {
9152
9138
  };
9153
9139
  class BaseElement2DOutline extends BaseElement2DFill {
9154
9140
  setProperties(properties) {
9155
- return super._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeOutline(properties));
9141
+ return super._setProperties(
9142
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeOutline(properties)
9143
+ );
9156
9144
  }
9157
9145
  _updateProperty(key, value, oldValue, declaration) {
9158
9146
  super._updateProperty(key, value, oldValue, declaration);
@@ -9202,7 +9190,9 @@ class BaseElement2DShadow extends CoreObject {
9202
9190
  this.parent = parent;
9203
9191
  }
9204
9192
  setProperties(properties) {
9205
- return super.setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShadow(properties));
9193
+ return super.setProperties(
9194
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShadow(properties)
9195
+ );
9206
9196
  }
9207
9197
  _updateProperty(key, value, oldValue, declaration) {
9208
9198
  super._updateProperty(key, value, oldValue, declaration);
@@ -9261,7 +9251,9 @@ class BaseElement2DShape extends CoreObject {
9261
9251
  }
9262
9252
  _path2DSet = new modernPath2d.Path2DSet();
9263
9253
  setProperties(properties) {
9264
- return super.setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShape(properties));
9254
+ return super.setProperties(
9255
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShape(properties)
9256
+ );
9265
9257
  }
9266
9258
  _updateProperty(key, value, oldValue, declaration) {
9267
9259
  super._updateProperty(key, value, oldValue, declaration);
@@ -9370,7 +9362,9 @@ class BaseElement2DText extends CoreObject {
9370
9362
  baseText = new modernText.Text();
9371
9363
  measureResult;
9372
9364
  setProperties(properties) {
9373
- return super.setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeText(properties));
9365
+ return super.setProperties(
9366
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeText(properties)
9367
+ );
9374
9368
  }
9375
9369
  _updateProperty(key, value, oldValue, declaration) {
9376
9370
  super._updateProperty(key, value, oldValue, declaration);
@@ -9555,49 +9549,49 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9555
9549
  return this._background;
9556
9550
  }
9557
9551
  set background(value) {
9558
- this._background.setProperties(value);
9552
+ this._background.resetProperties().setProperties(value);
9559
9553
  }
9560
9554
  _shape = new BaseElement2DShape(this);
9561
9555
  get shape() {
9562
9556
  return this._shape;
9563
9557
  }
9564
9558
  set shape(value) {
9565
- this._shape.setProperties(value);
9559
+ this._shape.resetProperties().setProperties(value);
9566
9560
  }
9567
9561
  _fill = new BaseElement2DFill(this);
9568
9562
  get fill() {
9569
9563
  return this._fill;
9570
9564
  }
9571
9565
  set fill(value) {
9572
- this._fill.setProperties(value);
9566
+ this._fill.resetProperties().setProperties(value);
9573
9567
  }
9574
9568
  _outline = new BaseElement2DOutline(this);
9575
9569
  get outline() {
9576
9570
  return this._outline;
9577
9571
  }
9578
9572
  set outline(value) {
9579
- this._outline.setProperties(value);
9573
+ this._outline.resetProperties().setProperties(value);
9580
9574
  }
9581
9575
  _foreground = new BaseElement2DForeground(this);
9582
9576
  get foreground() {
9583
9577
  return this._foreground;
9584
9578
  }
9585
9579
  set foreground(value) {
9586
- this._foreground.setProperties(value);
9580
+ this._foreground.resetProperties().setProperties(value);
9587
9581
  }
9588
9582
  _text = new BaseElement2DText(this);
9589
9583
  get text() {
9590
9584
  return this._text;
9591
9585
  }
9592
9586
  set text(value) {
9593
- this._text.setProperties(value);
9587
+ this._text.resetProperties().setProperties(value);
9594
9588
  }
9595
9589
  _shadow = new BaseElement2DShadow(this);
9596
9590
  get shadow() {
9597
9591
  return this._shadow;
9598
9592
  }
9599
9593
  set shadow(value) {
9600
- this._shadow.setProperties(value);
9594
+ this._shadow.resetProperties().setProperties(value);
9601
9595
  }
9602
9596
  constructor(properties, nodes = []) {
9603
9597
  super();
@@ -10707,7 +10701,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10707
10701
  }
10708
10702
  }
10709
10703
  _getSubTexts() {
10710
- return this.getChildren("front").filter((node) => node instanceof exports.Text2D);
10704
+ return this.children.front.filter((node) => node instanceof exports.Text2D);
10711
10705
  }
10712
10706
  _updateSubTexts() {
10713
10707
  const subTexts = this._getSubTexts();
@@ -10743,7 +10737,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10743
10737
  }
10744
10738
  _updateSplit() {
10745
10739
  if (this._subTextsCount) {
10746
- this.getChildren("front").forEach((child) => this.removeChild(child));
10740
+ this.children.front.forEach((child) => this.removeChild(child));
10747
10741
  this._subTextsCount = 0;
10748
10742
  }
10749
10743
  if (this.split) {
@@ -10777,7 +10771,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10777
10771
  }
10778
10772
  _drawContent() {
10779
10773
  if (!this.split) {
10780
- const onText2DRender = this.getChildren()?.find((child) => "onText2DRender" in child)?.onText2DRender;
10774
+ const onText2DRender = this.children?.find((child) => "onText2DRender" in child)?.onText2DRender;
10781
10775
  if (onText2DRender) {
10782
10776
  onText2DRender();
10783
10777
  } else {
@@ -11036,7 +11030,7 @@ exports.Animation = class Animation extends exports.TimelineNode {
11036
11030
  let targets;
11037
11031
  switch (this.effectMode) {
11038
11032
  case "sibling":
11039
- targets = this.getParent()?.getChildren(true).filter((val) => val instanceof exports.CanvasItem) ?? [];
11033
+ targets = this.getParent()?.children.internal.filter((val) => val instanceof exports.CanvasItem) ?? [];
11040
11034
  break;
11041
11035
  case "parent":
11042
11036
  default: