modern-canvas 0.8.9 → 0.9.0

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
@@ -484,7 +484,7 @@ const TOUCH_TO_POINTER = {
484
484
  touchmove: "pointermove",
485
485
  touchcancel: "pointercancel"
486
486
  };
487
- class Input extends modernIdoc.EventEmitter {
487
+ class Input extends modernIdoc.Observable {
488
488
  /**
489
489
  * Current event
490
490
  */
@@ -874,167 +874,14 @@ class Input extends modernIdoc.EventEmitter {
874
874
  }
875
875
 
876
876
  let IID = 0;
877
- class CoreObject extends modernIdoc.EventEmitter {
877
+ class CoreObject extends modernIdoc.Reactivable {
878
878
  instanceId = ++IID;
879
- _propertyAccessor;
880
- _properties = /* @__PURE__ */ new Map();
881
- _updatedProperties = /* @__PURE__ */ new Map();
882
- _changedProperties = /* @__PURE__ */ new Set();
883
- _updatingPromise = Promise.resolve();
884
- _updating = false;
885
- useCustomPropertyAccessor(accessor) {
886
- this._propertyAccessor = accessor;
887
- this.getPropertyDeclarations().forEach((declaration, key) => {
888
- const newValue = accessor.get(key, () => void 0);
889
- const oldValue = this._properties.get(key);
890
- if (newValue === void 0) {
891
- if (oldValue !== void 0) {
892
- accessor.set(key, oldValue);
893
- }
894
- } else if (newValue !== oldValue) {
895
- if (declaration.alias && declaration.alias !== key) {
896
- this.setProperty(key, newValue);
897
- } else {
898
- this._properties.set(key, newValue);
899
- }
900
- this._updateProperty(key, newValue, oldValue, declaration);
901
- this.emit("updateProperty", key, newValue, oldValue, declaration);
902
- }
903
- });
904
- return this;
905
- }
906
- getter(key, context) {
907
- if (context?.declaration.protected) {
908
- return this[context.internalKey];
909
- } else {
910
- return this._propertyAccessor ? this._propertyAccessor.get(key, () => this._properties.get(key)) : this._properties.get(key);
911
- }
912
- }
913
- setter(key, value, context) {
914
- if (context?.declaration.protected) {
915
- this[context.internalKey] = value;
916
- } else {
917
- if (this._propertyAccessor) {
918
- this._propertyAccessor.set(key, value);
919
- }
920
- this._properties.set(key, value);
921
- }
879
+ _nextTick() {
880
+ return nextTick();
922
881
  }
923
882
  equal(target) {
924
883
  return Boolean(target && this.instanceId === target.instanceId);
925
884
  }
926
- async _enqueueUpdate() {
927
- this._updating = true;
928
- try {
929
- await this._updatingPromise;
930
- } catch (e) {
931
- Promise.reject(e);
932
- }
933
- await nextTick();
934
- if (!this._updating)
935
- return;
936
- this.update();
937
- this._updating = false;
938
- }
939
- update() {
940
- this._update(this._updatedProperties);
941
- this._updatedProperties = /* @__PURE__ */ new Map();
942
- }
943
- // eslint-disable-next-line unused-imports/no-unused-vars
944
- _update(changed) {
945
- }
946
- // eslint-disable-next-line unused-imports/no-unused-vars
947
- _updateProperty(key, value, oldValue, declaration) {
948
- }
949
- isDirty(key) {
950
- return this._updatedProperties.has(key);
951
- }
952
- getPropertyDeclarations() {
953
- return modernIdoc.getDeclarations(this.constructor);
954
- }
955
- getPropertyDeclaration(key) {
956
- return this.getPropertyDeclarations().get(key);
957
- }
958
- getProperty(key) {
959
- return this[key];
960
- }
961
- setProperty(key, value) {
962
- this[key] = value;
963
- return this;
964
- }
965
- getProperties(keys) {
966
- const properties = {};
967
- for (const [name, property] of this.getPropertyDeclarations()) {
968
- if (!property.protected && !property.alias && (!keys || keys.includes(name))) {
969
- properties[name] = this.getProperty(name);
970
- }
971
- }
972
- return properties;
973
- }
974
- setProperties(properties) {
975
- if (properties && typeof properties === "object") {
976
- for (const [name] of this.getPropertyDeclarations()) {
977
- if (name in properties) {
978
- this.setProperty(name, properties[name]);
979
- }
980
- }
981
- }
982
- return this;
983
- }
984
- resetProperties() {
985
- for (const [name, property] of this.getPropertyDeclarations()) {
986
- this.setProperty(
987
- name,
988
- typeof property.fallback === "function" ? property.fallback() : property.fallback
989
- );
990
- }
991
- return this;
992
- }
993
- onUpdateProperty(key, newValue, oldValue, declaration) {
994
- this.requestUpdate(key, newValue, oldValue, declaration);
995
- }
996
- requestUpdate(key, newValue, oldValue, declaration) {
997
- if (key !== void 0) {
998
- if (!Object.is(newValue, oldValue)) {
999
- this._updatedProperties.set(key, oldValue);
1000
- this._changedProperties.add(key);
1001
- declaration ??= this.getPropertyDeclaration(key);
1002
- this._updateProperty(key, newValue, oldValue, declaration);
1003
- this.emit("updateProperty", key, newValue, oldValue, declaration);
1004
- } else {
1005
- return;
1006
- }
1007
- }
1008
- if (!this._updating) {
1009
- this._updatingPromise = this._enqueueUpdate();
1010
- }
1011
- }
1012
- toJSON() {
1013
- const json = {};
1014
- this._properties.forEach((value, key) => {
1015
- if (value === void 0) {
1016
- return;
1017
- }
1018
- if (value && typeof value === "object") {
1019
- if ("toJSON" in value && typeof value.toJSON === "function") {
1020
- json[key] = value.toJSON();
1021
- } else if (Array.isArray(value)) {
1022
- json[key] = [...value];
1023
- } else {
1024
- json[key] = { ...value };
1025
- }
1026
- } else {
1027
- json[key] = value;
1028
- }
1029
- });
1030
- return json;
1031
- }
1032
- clone() {
1033
- return new this.constructor(this.toJSON());
1034
- }
1035
- free() {
1036
- this.removeAllListeners();
1037
- }
1038
885
  }
1039
886
 
1040
887
  class RefCounted extends CoreObject {
@@ -1132,7 +979,7 @@ class Color {
1132
979
  }
1133
980
  }
1134
981
 
1135
- class Vector extends modernIdoc.EventEmitter {
982
+ class Vector extends modernIdoc.Observable {
1136
983
  constructor(dim) {
1137
984
  super();
1138
985
  this.dim = dim;
@@ -1284,7 +1131,7 @@ class Vector extends modernIdoc.EventEmitter {
1284
1131
  }
1285
1132
  }
1286
1133
 
1287
- class Matrix extends modernIdoc.EventEmitter {
1134
+ class Matrix extends modernIdoc.Observable {
1288
1135
  constructor(rows, cols, array) {
1289
1136
  super();
1290
1137
  this.rows = rows;
@@ -2251,6 +2098,7 @@ var __decorateClass$Z = (decorators, target, key, kind) => {
2251
2098
  class MainLoop extends CoreObject {
2252
2099
  _starting = false;
2253
2100
  _nextDeltaTime = 0;
2101
+ _startedProcess;
2254
2102
  get starting() {
2255
2103
  return this._starting;
2256
2104
  }
@@ -2264,7 +2112,10 @@ class MainLoop extends CoreObject {
2264
2112
  start(process) {
2265
2113
  if (!this._starting) {
2266
2114
  this._starting = true;
2267
- this.off("process");
2115
+ if (this._startedProcess) {
2116
+ this.off("process", this._startedProcess);
2117
+ }
2118
+ this._startedProcess = process;
2268
2119
  this.on("process", process);
2269
2120
  Ticker.on(this._onNextTick, { sort: 0 });
2270
2121
  }
@@ -2283,8 +2134,8 @@ class MainLoop extends CoreObject {
2283
2134
  this.emit("process", delta);
2284
2135
  }
2285
2136
  }
2286
- free() {
2287
- super.free();
2137
+ destroy() {
2138
+ super.destroy();
2288
2139
  this.stop();
2289
2140
  }
2290
2141
  }
@@ -2383,7 +2234,7 @@ class WebGLModule {
2383
2234
  }
2384
2235
  reset() {
2385
2236
  }
2386
- free() {
2237
+ destroy() {
2387
2238
  }
2388
2239
  }
2389
2240
 
@@ -3560,8 +3411,8 @@ ${gl.getShaderInfoLog(shader)}`);
3560
3411
  viewMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
3561
3412
  };
3562
3413
  }
3563
- free() {
3564
- super.free();
3414
+ destroy() {
3415
+ super.destroy();
3565
3416
  this.bind(null);
3566
3417
  }
3567
3418
  }
@@ -4335,8 +4186,8 @@ class WebGLRenderer extends Renderer {
4335
4186
  flush() {
4336
4187
  this._modules.forEach((module) => module.flush());
4337
4188
  }
4338
- free() {
4339
- this._modules.forEach((module) => module.free());
4189
+ destroy() {
4190
+ this._modules.forEach((module) => module.destroy());
4340
4191
  this.view?.removeEventListener("webglcontextlost", this._onContextLost, false);
4341
4192
  this.view?.removeEventListener("webglcontextrestored", this._onContextRestored, false);
4342
4193
  this.extensions.loseContext?.loseContext();
@@ -4493,8 +4344,8 @@ class IndexBuffer extends Resource {
4493
4344
  return renderer.buffer.create(this._glBufferOptions());
4494
4345
  });
4495
4346
  }
4496
- _updateProperty(key, value, oldValue, declaration) {
4497
- super._updateProperty(key, value, oldValue, declaration);
4347
+ _updateProperty(key, value, oldValue) {
4348
+ super._updateProperty(key, value, oldValue);
4498
4349
  switch (key) {
4499
4350
  case "data":
4500
4351
  case "dynamic":
@@ -4515,10 +4366,10 @@ class IndexBuffer extends Resource {
4515
4366
  }
4516
4367
  }
4517
4368
  __decorateClass$Y([
4518
- modernIdoc.property({ protected: true, default: null })
4369
+ modernIdoc.property({ internal: true, fallback: null })
4519
4370
  ], IndexBuffer.prototype, "data");
4520
4371
  __decorateClass$Y([
4521
- modernIdoc.property({ protected: true, fallback: false })
4372
+ modernIdoc.property({ internal: true, fallback: false })
4522
4373
  ], IndexBuffer.prototype, "dynamic");
4523
4374
 
4524
4375
  var __defProp$O = Object.defineProperty;
@@ -4550,8 +4401,8 @@ class VertexBuffer extends Resource {
4550
4401
  return renderer.buffer.create(this._glBufferOptions());
4551
4402
  });
4552
4403
  }
4553
- _updateProperty(key, value, oldValue, declaration) {
4554
- super._updateProperty(key, value, oldValue, declaration);
4404
+ _updateProperty(key, value, oldValue) {
4405
+ super._updateProperty(key, value, oldValue);
4555
4406
  switch (key) {
4556
4407
  case "data":
4557
4408
  case "dynamic":
@@ -4572,10 +4423,10 @@ class VertexBuffer extends Resource {
4572
4423
  }
4573
4424
  }
4574
4425
  __decorateClass$X([
4575
- modernIdoc.property({ protected: true, default: null })
4426
+ modernIdoc.property({ internal: true, default: null })
4576
4427
  ], VertexBuffer.prototype, "data");
4577
4428
  __decorateClass$X([
4578
- modernIdoc.property({ protected: true, fallback: false })
4429
+ modernIdoc.property({ internal: true, fallback: false })
4579
4430
  ], VertexBuffer.prototype, "dynamic");
4580
4431
 
4581
4432
  var __defProp$N = Object.defineProperty;
@@ -4596,8 +4447,8 @@ class VertexAttribute extends Resource {
4596
4447
  ...options
4597
4448
  });
4598
4449
  }
4599
- _updateProperty(key, value, oldValue, declaration) {
4600
- super._updateProperty(key, value, oldValue, declaration);
4450
+ _updateProperty(key, value, oldValue) {
4451
+ super._updateProperty(key, value, oldValue);
4601
4452
  switch (key) {
4602
4453
  case "buffer":
4603
4454
  case "size":
@@ -4945,8 +4796,8 @@ class Texture2D extends Resource {
4945
4796
  return renderer.texture.create(this._glTextureOptions(renderer, options));
4946
4797
  });
4947
4798
  }
4948
- _updateProperty(key, value, oldValue, declaration) {
4949
- super._updateProperty(key, value, oldValue, declaration);
4799
+ _updateProperty(key, value, oldValue) {
4800
+ super._updateProperty(key, value, oldValue);
4950
4801
  switch (key) {
4951
4802
  case "width":
4952
4803
  case "height":
@@ -5006,7 +4857,7 @@ class Texture2D extends Resource {
5006
4857
  inactivate(renderer) {
5007
4858
  renderer.texture.unbind(this._glTexture(renderer));
5008
4859
  }
5009
- free() {
4860
+ destroy() {
5010
4861
  if (SUPPORTS_IMAGE_BITMAP && this.source instanceof ImageBitmap) {
5011
4862
  this.source.close();
5012
4863
  }
@@ -5050,9 +4901,9 @@ class AnimatedTexture extends Resource {
5050
4901
  this.duration = this.frames.reduce((duration, frame) => frame.duration + duration, 0);
5051
4902
  return this;
5052
4903
  }
5053
- free() {
4904
+ destroy() {
5054
4905
  this.frames.forEach((frame) => {
5055
- frame.texture.free();
4906
+ frame.texture.destroy();
5056
4907
  });
5057
4908
  }
5058
4909
  }
@@ -5070,7 +4921,7 @@ class CanvasTexture extends Texture2D {
5070
4921
  constructor(source = document.createElement("canvas")) {
5071
4922
  super(source);
5072
4923
  }
5073
- _updateProperty(key, value, oldValue, declaration) {
4924
+ _updateProperty(key, value, oldValue) {
5074
4925
  switch (key) {
5075
4926
  case "width":
5076
4927
  this.source.width = Math.max(1, Math.ceil(value * this.pixelRatio));
@@ -5079,7 +4930,7 @@ class CanvasTexture extends Texture2D {
5079
4930
  this.source.height = Math.max(1, Math.ceil(value * this.pixelRatio));
5080
4931
  break;
5081
4932
  }
5082
- super._updateProperty(key, value, oldValue, declaration);
4933
+ super._updateProperty(key, value, oldValue);
5083
4934
  }
5084
4935
  }
5085
4936
  __decorateClass$U([
@@ -5287,7 +5138,7 @@ class PixelsTexture extends Texture2D {
5287
5138
  }
5288
5139
  super(source);
5289
5140
  }
5290
- _updateProperty(key, value, oldValue, declaration) {
5141
+ _updateProperty(key, value, oldValue) {
5291
5142
  switch (key) {
5292
5143
  case "width":
5293
5144
  this.source.width = Math.round(this.width * this.pixelRatio);
@@ -5300,7 +5151,7 @@ class PixelsTexture extends Texture2D {
5300
5151
  this.source.height = Math.round(this.height * this.pixelRatio);
5301
5152
  break;
5302
5153
  }
5303
- super._updateProperty(key, value, oldValue, declaration);
5154
+ super._updateProperty(key, value, oldValue);
5304
5155
  }
5305
5156
  }
5306
5157
 
@@ -5402,8 +5253,8 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5402
5253
  }
5403
5254
  this._setupAutoUpdate();
5404
5255
  }
5405
- _updateProperty(key, value, oldValue, declaration) {
5406
- super._updateProperty(key, value, oldValue, declaration);
5256
+ _updateProperty(key, value, oldValue) {
5257
+ super._updateProperty(key, value, oldValue);
5407
5258
  switch (key) {
5408
5259
  case "fps":
5409
5260
  this._spf = value ? Math.floor(1e3 / value) : 0;
@@ -5538,7 +5389,7 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5538
5389
  }
5539
5390
  return this._sourceLoad;
5540
5391
  }
5541
- free() {
5392
+ destroy() {
5542
5393
  this._setupAutoUpdate();
5543
5394
  const source = this.source;
5544
5395
  if (source) {
@@ -5555,10 +5406,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5555
5406
  }
5556
5407
  };
5557
5408
  __decorateClass$T([
5558
- modernIdoc.property({ protected: true, fallback: true })
5409
+ modernIdoc.property({ internal: true, fallback: true })
5559
5410
  ], _VideoTexture.prototype, "autoUpdate");
5560
5411
  __decorateClass$T([
5561
- modernIdoc.property({ protected: true, fallback: 0 })
5412
+ modernIdoc.property({ internal: true, fallback: 0 })
5562
5413
  ], _VideoTexture.prototype, "fps");
5563
5414
  let VideoTexture = _VideoTexture;
5564
5415
 
@@ -5752,23 +5603,19 @@ class CanvasContext extends modernPath2d.Path2D {
5752
5603
  }
5753
5604
  }
5754
5605
 
5755
- class Children extends Array {
5606
+ class Children {
5756
5607
  front = [];
5608
+ default = [];
5757
5609
  back = [];
5758
5610
  get internal() {
5759
- return [
5760
- ...this.front,
5761
- ...this,
5762
- ...this.back
5763
- ];
5611
+ return this.getInternal();
5764
5612
  }
5765
5613
  constructor(...items) {
5766
- super();
5767
5614
  this.set(items);
5768
5615
  }
5769
5616
  set(items) {
5770
5617
  this.front.length = 0;
5771
- this.length = 0;
5618
+ this.default.length = 0;
5772
5619
  this.back.length = 0;
5773
5620
  items.forEach((item) => {
5774
5621
  switch (item.internalMode) {
@@ -5776,7 +5623,7 @@ class Children extends Array {
5776
5623
  this.front.push(item);
5777
5624
  break;
5778
5625
  case "default":
5779
- this.push(item);
5626
+ this.default.push(item);
5780
5627
  break;
5781
5628
  case "back":
5782
5629
  this.back.push(item);
@@ -5786,19 +5633,27 @@ class Children extends Array {
5786
5633
  return this;
5787
5634
  }
5788
5635
  getInternal(includeInternal) {
5789
- switch (includeInternal) {
5790
- case "front":
5791
- return this.front;
5792
- case "default":
5793
- return this;
5794
- case "back":
5795
- return this.back;
5796
- default:
5797
- throw new Error(`Unknown internal mode: ${includeInternal}`);
5636
+ if (includeInternal) {
5637
+ switch (includeInternal) {
5638
+ case "front":
5639
+ return this.front;
5640
+ case "default":
5641
+ return this.default;
5642
+ case "back":
5643
+ return this.back;
5644
+ default:
5645
+ throw new Error(`Unknown internal mode: ${includeInternal}`);
5646
+ }
5647
+ } else {
5648
+ return [
5649
+ ...this.front,
5650
+ ...this.default,
5651
+ ...this.back
5652
+ ];
5798
5653
  }
5799
5654
  }
5800
5655
  toJSON() {
5801
- return [...this];
5656
+ return [...this.default];
5802
5657
  }
5803
5658
  }
5804
5659
 
@@ -5939,13 +5794,16 @@ exports.Node = class Node extends CoreObject {
5939
5794
  /** Children */
5940
5795
  _children = new Children();
5941
5796
  get children() {
5942
- return this._children;
5797
+ return this._children.default;
5943
5798
  }
5944
5799
  set children(value) {
5945
- value instanceof Children ? this._children = value : this._children.set(value);
5800
+ this._children.set(value);
5801
+ }
5802
+ getChildren(internalMode = "default") {
5803
+ return this._children.getInternal(internalMode === true ? void 0 : internalMode);
5946
5804
  }
5947
5805
  getChild(index = 0) {
5948
- return this._children[index];
5806
+ return this.children[index];
5949
5807
  }
5950
5808
  get siblingIndex() {
5951
5809
  return this.getIndex();
@@ -6009,9 +5867,6 @@ exports.Node = class Node extends CoreObject {
6009
5867
  return false;
6010
5868
  }
6011
5869
  }
6012
- _updateProperty(key, value, oldValue, declaration) {
6013
- super._updateProperty(key, value, oldValue, declaration);
6014
- }
6015
5870
  _onTreeEnter(tree) {
6016
5871
  this._treeEnter(tree);
6017
5872
  this.emit("treeEntered", tree);
@@ -6111,7 +5966,7 @@ exports.Node = class Node extends CoreObject {
6111
5966
  }
6112
5967
  }
6113
5968
  getIndex() {
6114
- return this._parent?.children.getInternal(this.internalMode).indexOf(this) ?? 0;
5969
+ return this._parent?.getChildren(this.internalMode).indexOf(this) ?? 0;
6115
5970
  }
6116
5971
  getNode(path) {
6117
5972
  return this._children.internal.find((child) => child.name === path);
@@ -6187,7 +6042,7 @@ exports.Node = class Node extends CoreObject {
6187
6042
  this._children.front.push(node);
6188
6043
  break;
6189
6044
  case "default":
6190
- this._children.push(node);
6045
+ this._children.default.push(node);
6191
6046
  break;
6192
6047
  case "back":
6193
6048
  this._children.back.push(node);
@@ -6231,24 +6086,24 @@ exports.Node = class Node extends CoreObject {
6231
6086
  removeChild(child) {
6232
6087
  const index = child.getIndex();
6233
6088
  if (this.equal(child.parent) && index > -1) {
6234
- this._children.getInternal(child.internalMode).splice(index, 1);
6089
+ this.getChildren(child.internalMode).splice(index, 1);
6235
6090
  child.setParent(void 0);
6236
6091
  this.emit("removeChild", child, index);
6237
6092
  }
6238
6093
  return child;
6239
6094
  }
6240
6095
  removeChildren() {
6241
- this._children.forEach((child) => this.removeChild(child));
6096
+ this.children.forEach((child) => this.removeChild(child));
6242
6097
  }
6243
6098
  remove() {
6244
6099
  this._parent?.removeChild(this);
6245
6100
  }
6246
6101
  forEachChild(callbackfn) {
6247
- this._children.forEach(callbackfn);
6102
+ this.children.forEach(callbackfn);
6248
6103
  return this;
6249
6104
  }
6250
6105
  forEachDescendant(callbackfn) {
6251
- this._children.forEach((child) => {
6106
+ this.children.forEach((child) => {
6252
6107
  callbackfn(child);
6253
6108
  child.forEachDescendant(callbackfn);
6254
6109
  });
@@ -6286,6 +6141,10 @@ exports.Node = class Node extends CoreObject {
6286
6141
  // eslint-disable-next-line unused-imports/no-unused-vars
6287
6142
  _render(renderer) {
6288
6143
  }
6144
+ destroy() {
6145
+ super.destroy();
6146
+ this._children.internal.forEach((node) => this.removeChild(node));
6147
+ }
6289
6148
  clone() {
6290
6149
  return new this.constructor(
6291
6150
  this.toJSON(),
@@ -6295,7 +6154,7 @@ exports.Node = class Node extends CoreObject {
6295
6154
  toJSON() {
6296
6155
  return modernIdoc.clearUndef({
6297
6156
  ...super.toJSON(),
6298
- children: this._children.length ? [...this._children.map((child) => child.toJSON())] : void 0,
6157
+ children: this.children.length ? [...this.children.map((child) => child.toJSON())] : void 0,
6299
6158
  meta: {
6300
6159
  ...this.meta,
6301
6160
  inCanvasIs: this.is
@@ -6324,19 +6183,19 @@ __decorateClass$S([
6324
6183
  modernIdoc.property({ default: () => ({}) })
6325
6184
  ], exports.Node.prototype, "meta", 2);
6326
6185
  __decorateClass$S([
6327
- modernIdoc.property({ protected: true, fallback: "inherit" })
6186
+ modernIdoc.property({ internal: true, fallback: "inherit" })
6328
6187
  ], exports.Node.prototype, "processMode", 2);
6329
6188
  __decorateClass$S([
6330
- modernIdoc.property({ protected: true, fallback: "default" })
6189
+ modernIdoc.property({ internal: true, fallback: "default" })
6331
6190
  ], exports.Node.prototype, "processSortMode", 2);
6332
6191
  __decorateClass$S([
6333
- modernIdoc.property({ protected: true, fallback: "inherit" })
6192
+ modernIdoc.property({ internal: true, fallback: "inherit" })
6334
6193
  ], exports.Node.prototype, "renderMode", 2);
6335
6194
  __decorateClass$S([
6336
- modernIdoc.property({ protected: true, fallback: "inherit" })
6195
+ modernIdoc.property({ internal: true, fallback: "inherit" })
6337
6196
  ], exports.Node.prototype, "inputMode", 2);
6338
6197
  __decorateClass$S([
6339
- modernIdoc.property({ protected: true, fallback: "default" })
6198
+ modernIdoc.property({ internal: true, fallback: "default" })
6340
6199
  ], exports.Node.prototype, "internalMode", 2);
6341
6200
  __decorateClass$S([
6342
6201
  modernIdoc.property({ protected: true })
@@ -6422,7 +6281,7 @@ __decorateClass$R([
6422
6281
  modernIdoc.property({ fallback: false })
6423
6282
  ], exports.TimelineNode.prototype, "paused", 2);
6424
6283
  __decorateClass$R([
6425
- modernIdoc.property({ protected: true, fallback: false })
6284
+ modernIdoc.property({ internal: true, fallback: false })
6426
6285
  ], exports.TimelineNode.prototype, "insideTimeRange", 2);
6427
6286
  exports.TimelineNode = __decorateClass$R([
6428
6287
  customNode("TimelineNode")
@@ -6463,8 +6322,8 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
6463
6322
  super();
6464
6323
  this.setProperties(properties).append(nodes);
6465
6324
  }
6466
- _updateProperty(key, value, oldValue, declaration) {
6467
- super._updateProperty(key, value, oldValue, declaration);
6325
+ _updateProperty(key, value, oldValue) {
6326
+ super._updateProperty(key, value, oldValue);
6468
6327
  switch (key) {
6469
6328
  case "modulate":
6470
6329
  this._modulate.value = value;
@@ -6594,10 +6453,10 @@ __decorateClass$Q([
6594
6453
  modernIdoc.property()
6595
6454
  ], exports.CanvasItem.prototype, "blendMode", 2);
6596
6455
  __decorateClass$Q([
6597
- modernIdoc.property({ protected: true, fallback: true })
6456
+ modernIdoc.property({ internal: true, fallback: true })
6598
6457
  ], exports.CanvasItem.prototype, "visible", 2);
6599
6458
  __decorateClass$Q([
6600
- modernIdoc.property({ protected: true, fallback: 1 })
6459
+ modernIdoc.property({ internal: true, fallback: 1 })
6601
6460
  ], exports.CanvasItem.prototype, "opacity", 2);
6602
6461
  exports.CanvasItem = __decorateClass$Q([
6603
6462
  customNode("CanvasItem")
@@ -6663,8 +6522,8 @@ exports.Viewport = class Viewport extends exports.Node {
6663
6522
  );
6664
6523
  });
6665
6524
  }
6666
- _updateProperty(key, value, oldValue, declaration) {
6667
- super._updateProperty(key, value, oldValue, declaration);
6525
+ _updateProperty(key, value, oldValue) {
6526
+ super._updateProperty(key, value, oldValue);
6668
6527
  switch (key) {
6669
6528
  case "x":
6670
6529
  case "y":
@@ -6803,8 +6662,8 @@ exports.Effect = class Effect extends exports.TimelineNode {
6803
6662
  this._onNodeProcessed = this._onNodeProcessed.bind(this);
6804
6663
  this.setProperties(properties).append(children);
6805
6664
  }
6806
- _updateProperty(key, value, oldValue, declaration) {
6807
- super._updateProperty(key, value, oldValue, declaration);
6665
+ _updateProperty(key, value, oldValue) {
6666
+ super._updateProperty(key, value, oldValue);
6808
6667
  switch (key) {
6809
6668
  case "glsl": {
6810
6669
  const material = new EffectMaterial(value);
@@ -6893,7 +6752,7 @@ exports.Effect = class Effect extends exports.TimelineNode {
6893
6752
  calls.splice(start, 0, renderStack.createCall(this));
6894
6753
  }
6895
6754
  _processChildren() {
6896
- if (this._children.length) {
6755
+ if (this.children.length) {
6897
6756
  super.emit("process");
6898
6757
  this._tree?.renderStack.push(this);
6899
6758
  }
@@ -7173,8 +7032,8 @@ class SceneTree extends MainLoop {
7173
7032
  super();
7174
7033
  this.timeline = timeline.setTree(this);
7175
7034
  }
7176
- _updateProperty(key, value, oldValue, declaration) {
7177
- super._updateProperty(key, value, oldValue, declaration);
7035
+ _updateProperty(key, value, oldValue) {
7036
+ super._updateProperty(key, value, oldValue);
7178
7037
  switch (key) {
7179
7038
  case "backgroundColor":
7180
7039
  this._backgroundColor.value = value;
@@ -7219,20 +7078,20 @@ class SceneTree extends MainLoop {
7219
7078
  QuadUvGeometry.draw(renderer);
7220
7079
  renderer.texture.unbind(texture);
7221
7080
  }
7222
- free() {
7223
- super.free();
7224
- this.root.children.internal.forEach((node) => this.root.removeChild(node));
7081
+ destroy() {
7082
+ super.destroy();
7083
+ this.root.destroy();
7225
7084
  this.input.removeEventListeners();
7226
7085
  }
7227
7086
  }
7228
7087
  __decorateClass$L([
7229
- modernIdoc.property({ protected: true, fallback: false })
7088
+ modernIdoc.property({ internal: true, fallback: false })
7230
7089
  ], SceneTree.prototype, "processPaused");
7231
7090
  __decorateClass$L([
7232
7091
  modernIdoc.property()
7233
7092
  ], SceneTree.prototype, "backgroundColor");
7234
7093
  __decorateClass$L([
7235
- modernIdoc.property({ protected: true, fallback: false })
7094
+ modernIdoc.property({ internal: true, fallback: false })
7236
7095
  ], SceneTree.prototype, "debug");
7237
7096
 
7238
7097
  var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
@@ -7281,8 +7140,8 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
7281
7140
  super();
7282
7141
  this.setProperties(properties).append(nodes);
7283
7142
  }
7284
- _updateProperty(key, value, oldValue, declaration) {
7285
- super._updateProperty(key, value, oldValue, declaration);
7143
+ _updateProperty(key, value, oldValue) {
7144
+ super._updateProperty(key, value, oldValue);
7286
7145
  switch (key) {
7287
7146
  case "rotation":
7288
7147
  this.updateGlobalTransform();
@@ -7369,10 +7228,10 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
7369
7228
  }
7370
7229
  };
7371
7230
  __decorateClass$J([
7372
- modernIdoc.property({ protected: true, fallback: 0 })
7231
+ modernIdoc.property({ internal: true, fallback: 0 })
7373
7232
  ], exports.Node2D.prototype, "rotation", 2);
7374
7233
  __decorateClass$J([
7375
- modernIdoc.property({ protected: true, fallback: 0 })
7234
+ modernIdoc.property({ internal: true, fallback: 0 })
7376
7235
  ], exports.Node2D.prototype, "globalRotation", 2);
7377
7236
  exports.Node2D = __decorateClass$J([
7378
7237
  customNode("Node2D")
@@ -7499,10 +7358,10 @@ exports.Camera2D = class Camera2D extends exports.Node2D {
7499
7358
  }
7500
7359
  };
7501
7360
  __decorateClass$I([
7502
- modernIdoc.property({ protected: true, fallback: false })
7361
+ modernIdoc.property({ internal: true, fallback: false })
7503
7362
  ], exports.Camera2D.prototype, "spaceKey", 2);
7504
7363
  __decorateClass$I([
7505
- modernIdoc.property({ protected: true, fallback: false })
7364
+ modernIdoc.property({ internal: true, fallback: false })
7506
7365
  ], exports.Camera2D.prototype, "grabbing", 2);
7507
7366
  exports.Camera2D = __decorateClass$I([
7508
7367
  customNode("Camera2D", {
@@ -8888,8 +8747,8 @@ void main() {
8888
8747
  this.setProperties(properties).append(children);
8889
8748
  this._generateKernels();
8890
8749
  }
8891
- _updateProperty(key, value, oldValue, declaration) {
8892
- super._updateProperty(key, value, oldValue, declaration);
8750
+ _updateProperty(key, value, oldValue) {
8751
+ super._updateProperty(key, value, oldValue);
8893
8752
  switch (key) {
8894
8753
  case "quality":
8895
8754
  case "strength":
@@ -8966,8 +8825,8 @@ exports.MaskEffect = class MaskEffect extends exports.Effect {
8966
8825
  this.texture = await assets.texture.load(this.src);
8967
8826
  }
8968
8827
  }
8969
- _updateProperty(key, value, oldValue, declaration) {
8970
- super._updateProperty(key, value, oldValue, declaration);
8828
+ _updateProperty(key, value, oldValue) {
8829
+ super._updateProperty(key, value, oldValue);
8971
8830
  switch (key) {
8972
8831
  case "src":
8973
8832
  this.load();
@@ -9444,8 +9303,8 @@ class BaseElement2DFill extends CoreObject {
9444
9303
  modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeFill(properties)
9445
9304
  );
9446
9305
  }
9447
- _updateProperty(key, value, oldValue, declaration) {
9448
- super._updateProperty(key, value, oldValue, declaration);
9306
+ _updateProperty(key, value, oldValue) {
9307
+ super._updateProperty(key, value, oldValue);
9449
9308
  switch (key) {
9450
9309
  case "color":
9451
9310
  case "cropRect":
@@ -9552,8 +9411,8 @@ class BaseElement2DBackground extends BaseElement2DFill {
9552
9411
  modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeBackground(properties)
9553
9412
  );
9554
9413
  }
9555
- _updateProperty(key, value, oldValue, declaration) {
9556
- super._updateProperty(key, value, oldValue, declaration);
9414
+ _updateProperty(key, value, oldValue) {
9415
+ super._updateProperty(key, value, oldValue);
9557
9416
  switch (key) {
9558
9417
  case "fillWithShape":
9559
9418
  this.parent.requestRedraw();
@@ -9580,8 +9439,8 @@ class BaseElement2DForeground extends BaseElement2DFill {
9580
9439
  modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeForeground(properties)
9581
9440
  );
9582
9441
  }
9583
- _updateProperty(key, value, oldValue, declaration) {
9584
- super._updateProperty(key, value, oldValue, declaration);
9442
+ _updateProperty(key, value, oldValue) {
9443
+ super._updateProperty(key, value, oldValue);
9585
9444
  switch (key) {
9586
9445
  case "fillWithShape":
9587
9446
  this.parent.requestRedraw();
@@ -9608,8 +9467,8 @@ class BaseElement2DOutline extends BaseElement2DFill {
9608
9467
  modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeOutline(properties)
9609
9468
  );
9610
9469
  }
9611
- _updateProperty(key, value, oldValue, declaration) {
9612
- super._updateProperty(key, value, oldValue, declaration);
9470
+ _updateProperty(key, value, oldValue) {
9471
+ super._updateProperty(key, value, oldValue);
9613
9472
  switch (key) {
9614
9473
  case "width":
9615
9474
  case "style":
@@ -9677,8 +9536,8 @@ class BaseElement2DShadow extends CoreObject {
9677
9536
  modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShadow(properties)
9678
9537
  );
9679
9538
  }
9680
- _updateProperty(key, value, oldValue, declaration) {
9681
- super._updateProperty(key, value, oldValue, declaration);
9539
+ _updateProperty(key, value, oldValue) {
9540
+ super._updateProperty(key, value, oldValue);
9682
9541
  switch (key) {
9683
9542
  case "color":
9684
9543
  case "blur":
@@ -9741,8 +9600,8 @@ class BaseElement2DShape extends CoreObject {
9741
9600
  modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShape(properties)
9742
9601
  );
9743
9602
  }
9744
- _updateProperty(key, value, oldValue, declaration) {
9745
- super._updateProperty(key, value, oldValue, declaration);
9603
+ _updateProperty(key, value, oldValue) {
9604
+ super._updateProperty(key, value, oldValue);
9746
9605
  switch (key) {
9747
9606
  case "svg":
9748
9607
  case "paths":
@@ -9848,7 +9707,7 @@ class BaseElement2DText extends CoreObject {
9848
9707
  case "effects":
9849
9708
  case "fill":
9850
9709
  case "outline":
9851
- this.setter(args[0], args[1]);
9710
+ this.setProperty(args[0], args[1]);
9852
9711
  break;
9853
9712
  }
9854
9713
  this._updateProperty(...args);
@@ -9862,8 +9721,8 @@ class BaseElement2DText extends CoreObject {
9862
9721
  modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeText(properties)
9863
9722
  );
9864
9723
  }
9865
- _updateProperty(key, value, oldValue, declaration) {
9866
- super._updateProperty(key, value, oldValue, declaration);
9724
+ _updateProperty(key, value, oldValue) {
9725
+ super._updateProperty(key, value, oldValue);
9867
9726
  switch (key) {
9868
9727
  case "enabled":
9869
9728
  case "effects":
@@ -10055,10 +9914,10 @@ __decorateClass$m([
10055
9914
  modernIdoc.property({ alias: "base.outline" })
10056
9915
  ], BaseElement2DText.prototype, "outline");
10057
9916
  __decorateClass$m([
10058
- modernIdoc.property({ protected: true, alias: "base.measureDom" })
9917
+ modernIdoc.property({ internal: true, alias: "base.measureDom" })
10059
9918
  ], BaseElement2DText.prototype, "measureDom");
10060
9919
  __decorateClass$m([
10061
- modernIdoc.property({ protected: true, alias: "base.fonts" })
9920
+ modernIdoc.property({ internal: true, alias: "base.fonts" })
10062
9921
  ], BaseElement2DText.prototype, "fonts");
10063
9922
 
10064
9923
  var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
@@ -10079,8 +9938,8 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
10079
9938
  }
10080
9939
  set style(style) {
10081
9940
  const cb = (...args) => {
10082
- this.emit("updateStyleProperty", ...args);
10083
- this._updateStyleProperty(args[0], args[1], args[2], args[3]);
9941
+ this.emit("updateStyleProperty", args[0], args[1], args[2]);
9942
+ this._updateStyleProperty(args[0], args[1], args[2]);
10084
9943
  };
10085
9944
  style.on("updateProperty", cb);
10086
9945
  this._style?.off("updateProperty", cb);
@@ -10166,7 +10025,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
10166
10025
  }
10167
10026
  return this;
10168
10027
  }
10169
- _updateStyleProperty(key, value, oldValue, _declaration) {
10028
+ _updateStyleProperty(key, value, oldValue) {
10170
10029
  switch (key) {
10171
10030
  case "rotate":
10172
10031
  this.rotation = this.style.rotate * DEG_TO_RAD;
@@ -10419,7 +10278,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
10419
10278
  return this.style.pointerEvents !== "none";
10420
10279
  }
10421
10280
  input(event, key) {
10422
- const array = this._children.internal;
10281
+ const array = this.getChildren(true);
10423
10282
  for (let i = array.length - 1; i >= 0; i--) {
10424
10283
  array[i].input(event, key);
10425
10284
  }
@@ -10516,8 +10375,8 @@ exports.Element2D = class Element2D extends exports.BaseElement2D {
10516
10375
  }
10517
10376
  set style(style) {
10518
10377
  const cb = (...args) => {
10519
- this.emit("updateStyleProperty", ...args);
10520
- this._updateStyleProperty(args[0], args[1], args[2], args[3]);
10378
+ this.emit("updateStyleProperty", args[0], args[1], args[2]);
10379
+ this._updateStyleProperty(args[0], args[1], args[2]);
10521
10380
  };
10522
10381
  style.on("updateProperty", cb);
10523
10382
  this._style?.off("updateProperty", cb);
@@ -10528,8 +10387,8 @@ exports.Element2D = class Element2D extends exports.BaseElement2D {
10528
10387
  this.style = new Element2DStyle();
10529
10388
  this.setProperties(properties).append(nodes);
10530
10389
  }
10531
- _updateStyleProperty(key, value, oldValue, declaration) {
10532
- super._updateStyleProperty(key, value, oldValue, declaration);
10390
+ _updateStyleProperty(key, value, oldValue) {
10391
+ super._updateStyleProperty(key, value, oldValue);
10533
10392
  switch (key) {
10534
10393
  case "left":
10535
10394
  this.position.x = Number(value);
@@ -10709,7 +10568,7 @@ class FlexLayout {
10709
10568
  return this._node.getComputedLayout();
10710
10569
  }
10711
10570
  // eslint-disable-next-line unused-imports/no-unused-vars
10712
- updateStyleProperty(key, value, oldValue, declaration) {
10571
+ updateStyleProperty(key, value, oldValue) {
10713
10572
  switch (key) {
10714
10573
  case "alignContent":
10715
10574
  this._node.setAlignContent(
@@ -10879,8 +10738,8 @@ exports.FlexElement2D = class FlexElement2D extends exports.BaseElement2D {
10879
10738
  }
10880
10739
  set style(style) {
10881
10740
  const cb = (...args) => {
10882
- this.emit("updateStyleProperty", ...args);
10883
- this._updateStyleProperty(args[0], args[1], args[2], args[3]);
10741
+ this.emit("updateStyleProperty", args[0], args[1], args[2]);
10742
+ this._updateStyleProperty(args[0], args[1], args[2]);
10884
10743
  };
10885
10744
  style.on("updateProperty", cb);
10886
10745
  this._style?.off("updateProperty", cb);
@@ -10919,9 +10778,9 @@ exports.FlexElement2D = class FlexElement2D extends exports.BaseElement2D {
10919
10778
  oldParent._layout._node.removeChild(this._layout._node);
10920
10779
  }
10921
10780
  }
10922
- _updateStyleProperty(key, value, oldValue, declaration) {
10923
- super._updateStyleProperty(key, value, oldValue, declaration);
10924
- this._layout.updateStyleProperty(key, value, oldValue, declaration);
10781
+ _updateStyleProperty(key, value, oldValue) {
10782
+ super._updateStyleProperty(key, value, oldValue);
10783
+ this._layout.updateStyleProperty(key, value, oldValue);
10925
10784
  if (this._layout._node.isDirty()) {
10926
10785
  this.requestRelayout();
10927
10786
  }
@@ -10983,8 +10842,8 @@ exports.Image2D = class Image2D extends exports.Element2D {
10983
10842
  this.setProperties(properties);
10984
10843
  this.append(children);
10985
10844
  }
10986
- _updateProperty(key, value, oldValue, declaration) {
10987
- super._updateProperty(key, value, oldValue, declaration);
10845
+ _updateProperty(key, value, oldValue) {
10846
+ super._updateProperty(key, value, oldValue);
10988
10847
  switch (key) {
10989
10848
  case "src":
10990
10849
  this._wait = this._load(value);
@@ -11145,8 +11004,8 @@ exports.Lottie2D = class Lottie2D extends TextureRect2D {
11145
11004
  this.setProperties(properties);
11146
11005
  this.append(children);
11147
11006
  }
11148
- _updateProperty(key, value, oldValue, declaration) {
11149
- super._updateProperty(key, value, oldValue, declaration);
11007
+ _updateProperty(key, value, oldValue) {
11008
+ super._updateProperty(key, value, oldValue);
11150
11009
  switch (key) {
11151
11010
  case "src":
11152
11011
  this._load();
@@ -11198,8 +11057,8 @@ class TransformRect2D extends exports.Element2D {
11198
11057
  super();
11199
11058
  this.setProperties(properties).append(nodes);
11200
11059
  }
11201
- _updateStyleProperty(key, value, oldValue, declaration) {
11202
- super._updateStyleProperty(key, value, oldValue, declaration);
11060
+ _updateStyleProperty(key, value, oldValue) {
11061
+ super._updateStyleProperty(key, value, oldValue);
11203
11062
  switch (key) {
11204
11063
  case "width":
11205
11064
  case "height":
@@ -11260,8 +11119,8 @@ exports.Video2D = class Video2D extends TextureRect2D {
11260
11119
  this.setProperties(properties);
11261
11120
  this.append(children);
11262
11121
  }
11263
- _updateProperty(key, value, oldValue, declaration) {
11264
- super._updateProperty(key, value, oldValue, declaration);
11122
+ _updateProperty(key, value, oldValue) {
11123
+ super._updateProperty(key, value, oldValue);
11265
11124
  switch (key) {
11266
11125
  case "src":
11267
11126
  this._wait = this._load(value);
@@ -11396,8 +11255,8 @@ exports.Animation = class Animation extends exports.TimelineNode {
11396
11255
  this.commitStyles();
11397
11256
  }
11398
11257
  }
11399
- _updateProperty(key, value, oldValue, declaration) {
11400
- super._updateProperty(key, value, oldValue, declaration);
11258
+ _updateProperty(key, value, oldValue) {
11259
+ super._updateProperty(key, value, oldValue);
11401
11260
  switch (key) {
11402
11261
  case "effectMode":
11403
11262
  case "keyframes":
@@ -11409,7 +11268,7 @@ exports.Animation = class Animation extends exports.TimelineNode {
11409
11268
  let targets;
11410
11269
  switch (this.effectMode) {
11411
11270
  case "sibling":
11412
- targets = this.getParent()?.children.internal.filter((val) => val instanceof exports.CanvasItem) ?? [];
11271
+ targets = this.getParent()?.getChildren(true).filter((val) => val instanceof exports.CanvasItem) ?? [];
11413
11272
  break;
11414
11273
  case "parent":
11415
11274
  default:
@@ -11654,7 +11513,7 @@ exports.Animation = __decorateClass$e([
11654
11513
  })
11655
11514
  ], exports.Animation);
11656
11515
 
11657
- class HTMLAudioContext extends modernIdoc.EventEmitter {
11516
+ class HTMLAudioContext extends modernIdoc.Observable {
11658
11517
  static _instance;
11659
11518
  static get instance() {
11660
11519
  if (!this._instance) {
@@ -11693,12 +11552,9 @@ class HTMLAudioContext extends modernIdoc.EventEmitter {
11693
11552
  this.refreshPaused();
11694
11553
  return this.paused;
11695
11554
  }
11696
- free() {
11697
- this.removeAllListeners();
11698
- }
11699
11555
  }
11700
11556
 
11701
- class HTMLSound extends modernIdoc.EventEmitter {
11557
+ class HTMLSound extends modernIdoc.Observable {
11702
11558
  static PADDING = 0.1;
11703
11559
  _source = null;
11704
11560
  _audio = null;
@@ -11904,9 +11760,9 @@ class HTMLSound extends modernIdoc.EventEmitter {
11904
11760
  this.emit("progress", 1, this._duration);
11905
11761
  this.emit("end", this);
11906
11762
  }
11907
- free() {
11763
+ destroy() {
11908
11764
  Ticker.off(this._onUpdate);
11909
- this.removeAllListeners();
11765
+ super.destroy();
11910
11766
  const source = this._source;
11911
11767
  if (source) {
11912
11768
  source.onended = null;
@@ -11969,7 +11825,7 @@ class HTMLAudio {
11969
11825
  }
11970
11826
  }
11971
11827
 
11972
- class AudioPipeline extends modernIdoc.EventEmitter {
11828
+ class AudioPipeline extends modernIdoc.Observable {
11973
11829
  constructor(_input, _output) {
11974
11830
  super();
11975
11831
  this._input = _input;
@@ -12193,7 +12049,7 @@ class WebAudioContext extends AudioPipeline {
12193
12049
  }
12194
12050
  }
12195
12051
 
12196
- class WebSound extends modernIdoc.EventEmitter {
12052
+ class WebSound extends modernIdoc.Observable {
12197
12053
  _audio = null;
12198
12054
  _sourceNode = null;
12199
12055
  _gain = null;
@@ -12425,8 +12281,8 @@ class WebSound extends modernIdoc.EventEmitter {
12425
12281
  Ticker.on(this._updateListener);
12426
12282
  }
12427
12283
  }
12428
- free() {
12429
- this.removeAllListeners();
12284
+ destroy() {
12285
+ super.destroy();
12430
12286
  this._stop();
12431
12287
  this._gain?.disconnect();
12432
12288
  this._gain = null;
@@ -12622,8 +12478,8 @@ exports.Audio = class Audio extends exports.TimelineNode {
12622
12478
  super();
12623
12479
  this.src = src;
12624
12480
  }
12625
- _updateProperty(key, value, oldValue, declaration) {
12626
- super._updateProperty(key, value, oldValue, declaration);
12481
+ _updateProperty(key, value, oldValue) {
12482
+ super._updateProperty(key, value, oldValue);
12627
12483
  switch (key) {
12628
12484
  case "paused":
12629
12485
  this.refreshPaused();
@@ -12710,7 +12566,7 @@ exports.Audio = class Audio extends exports.TimelineNode {
12710
12566
  this._recycleSound(sound);
12711
12567
  };
12712
12568
  _recycleSound(sound) {
12713
- sound.free();
12569
+ sound.destroy();
12714
12570
  if (!exports.Audio._soundPool.includes(sound)) {
12715
12571
  exports.Audio._soundPool.push(sound);
12716
12572
  }
@@ -12770,8 +12626,8 @@ exports.AudioWaveform = class AudioWaveform extends exports.Element2D {
12770
12626
  super();
12771
12627
  this.setProperties(options);
12772
12628
  }
12773
- _updateProperty(key, value, oldValue, declaration) {
12774
- super._updateProperty(key, value, oldValue, declaration);
12629
+ _updateProperty(key, value, oldValue) {
12630
+ super._updateProperty(key, value, oldValue);
12775
12631
  switch (key) {
12776
12632
  case "src":
12777
12633
  this._loadSrc(value);
@@ -12854,10 +12710,10 @@ __decorateClass$c([
12854
12710
  modernIdoc.property()
12855
12711
  ], exports.AudioWaveform.prototype, "src", 2);
12856
12712
  __decorateClass$c([
12857
- modernIdoc.property()
12713
+ modernIdoc.property({ fallback: 0 })
12858
12714
  ], exports.AudioWaveform.prototype, "gap", 2);
12859
12715
  __decorateClass$c([
12860
- modernIdoc.property()
12716
+ modernIdoc.property({ fallback: "#000000" })
12861
12717
  ], exports.AudioWaveform.prototype, "color", 2);
12862
12718
  exports.AudioWaveform = __decorateClass$c([
12863
12719
  customNode("AudioWaveform")
@@ -12897,8 +12753,8 @@ exports.Control = class Control extends exports.Element2D {
12897
12753
  super._input(event, key);
12898
12754
  this._guiInput(event, key);
12899
12755
  }
12900
- _updateStyleProperty(key, value, oldValue, declaration) {
12901
- super._updateStyleProperty(key, value, oldValue, declaration);
12756
+ _updateStyleProperty(key, value, oldValue) {
12757
+ super._updateStyleProperty(key, value, oldValue);
12902
12758
  switch (key) {
12903
12759
  case "width":
12904
12760
  case "height":
@@ -12931,8 +12787,8 @@ exports.Range = class Range extends exports.Control {
12931
12787
  super();
12932
12788
  this.setProperties(properties).append(children);
12933
12789
  }
12934
- _updateProperty(key, value, oldValue, declaration) {
12935
- super._updateProperty(key, value, oldValue, declaration);
12790
+ _updateProperty(key, value, oldValue) {
12791
+ super._updateProperty(key, value, oldValue);
12936
12792
  switch (key) {
12937
12793
  case "allowGreater":
12938
12794
  case "allowLesser":
@@ -12988,8 +12844,8 @@ exports.Ruler = class Ruler extends exports.Control {
12988
12844
  this.setProperties(properties);
12989
12845
  this.append(children);
12990
12846
  }
12991
- _updateProperty(key, value, oldValue, declaration) {
12992
- super._updateProperty(key, value, oldValue, declaration);
12847
+ _updateProperty(key, value, oldValue) {
12848
+ super._updateProperty(key, value, oldValue);
12993
12849
  switch (key) {
12994
12850
  case "offsetX":
12995
12851
  case "offsetY":
@@ -13004,8 +12860,8 @@ exports.Ruler = class Ruler extends exports.Control {
13004
12860
  break;
13005
12861
  }
13006
12862
  }
13007
- _updateStyleProperty(key, value, oldValue, declaration) {
13008
- super._updateStyleProperty(key, value, oldValue, declaration);
12863
+ _updateStyleProperty(key, value, oldValue) {
12864
+ super._updateStyleProperty(key, value, oldValue);
13009
12865
  switch (key) {
13010
12866
  case "width":
13011
12867
  case "height":
@@ -13172,8 +13028,8 @@ exports.ScrollBar = class ScrollBar extends exports.Range {
13172
13028
  super();
13173
13029
  this.setProperties(properties).append(children);
13174
13030
  }
13175
- _updateStyleProperty(key, value, oldValue, declaration) {
13176
- super._updateStyleProperty(key, value, oldValue, declaration);
13031
+ _updateStyleProperty(key, value, oldValue) {
13032
+ super._updateStyleProperty(key, value, oldValue);
13177
13033
  switch (key) {
13178
13034
  case "width":
13179
13035
  case "height":
@@ -13292,8 +13148,8 @@ exports.Scaler = class Scaler extends exports.Node {
13292
13148
  this.setProperties(properties);
13293
13149
  this.append(children);
13294
13150
  }
13295
- _updateProperty(key, value, oldValue, declaration) {
13296
- super._updateProperty(key, value, oldValue, declaration);
13151
+ _updateProperty(key, value, oldValue) {
13152
+ super._updateProperty(key, value, oldValue);
13297
13153
  switch (key) {
13298
13154
  case "translateY":
13299
13155
  case "translateX":
@@ -13941,8 +13797,8 @@ class Assets {
13941
13797
  _handled = /* @__PURE__ */ new Map();
13942
13798
  _gc = SUPPORTS_WEAK_REF ? new FinalizationRegistry((id) => {
13943
13799
  const ref = this.get(id);
13944
- if (ref && "free" in ref) {
13945
- ref.free();
13800
+ if (ref && "destroy" in ref) {
13801
+ ref.destroy();
13946
13802
  }
13947
13803
  this._handled.delete(id);
13948
13804
  }) : void 0;
@@ -14061,8 +13917,8 @@ class Assets {
14061
13917
  gc() {
14062
13918
  this._handled.forEach((_, id) => {
14063
13919
  const ref = this.get(id);
14064
- if (ref && "free" in ref) {
14065
- ref.free();
13920
+ if (ref && "destroy" in ref) {
13921
+ ref.destroy();
14066
13922
  }
14067
13923
  });
14068
13924
  this._handled.clear();
@@ -14159,8 +14015,8 @@ exports.CanvasItemEditor = class CanvasItemEditor extends exports.Control {
14159
14015
  this._onPointerup = this._onPointerup.bind(this);
14160
14016
  this.append(this.ruler);
14161
14017
  }
14162
- _updateStyleProperty(key, value, oldValue, declaration) {
14163
- super._updateStyleProperty(key, value, oldValue, declaration);
14018
+ _updateStyleProperty(key, value, oldValue) {
14019
+ super._updateStyleProperty(key, value, oldValue);
14164
14020
  switch (key) {
14165
14021
  case "width":
14166
14022
  this.drawboard.style.left = (this.size.width - this.drawboard.size.width) / 2;
@@ -14426,10 +14282,10 @@ class Engine extends SceneTree {
14426
14282
  this._render(this.renderer);
14427
14283
  });
14428
14284
  }
14429
- free() {
14430
- super.free();
14285
+ destroy() {
14286
+ super.destroy();
14431
14287
  this.enableAutoResize(false);
14432
- this.renderer.free();
14288
+ this.renderer.destroy();
14433
14289
  }
14434
14290
  toPixels() {
14435
14291
  return this.renderer.toPixels();