modern-canvas 0.3.0 → 0.3.2

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.mjs CHANGED
@@ -465,6 +465,9 @@ class CoreObject extends EventEmitter {
465
465
  _changedProperties = /* @__PURE__ */ new Set();
466
466
  _updatingPromise = Promise.resolve();
467
467
  _updating = false;
468
+ is(target) {
469
+ return Boolean(target && this.instanceId === target.instanceId);
470
+ }
468
471
  async _enqueueUpdate() {
469
472
  this._updating = true;
470
473
  try {
@@ -2224,7 +2227,7 @@ class MainLoop extends CoreObject {
2224
2227
  start(process) {
2225
2228
  if (!this._starting) {
2226
2229
  this._starting = true;
2227
- this.removeAllListeners();
2230
+ this.off("process");
2228
2231
  this.on("process", process);
2229
2232
  Ticker.on(this._onNextTick, { sort: 0 });
2230
2233
  }
@@ -5923,13 +5926,13 @@ let Node = class extends CoreObject {
5923
5926
  }
5924
5927
  setTree(tree) {
5925
5928
  const oldTree = this._tree;
5926
- if (tree !== oldTree) {
5929
+ if (!tree?.is(oldTree)) {
5930
+ if (oldTree) {
5931
+ this.emit("treeExit", oldTree);
5932
+ }
5933
+ this._tree = tree;
5927
5934
  if (tree) {
5928
- this._tree = tree;
5929
5935
  this.emit("treeEnter", tree);
5930
- } else if (oldTree) {
5931
- this.emit("treeExit", oldTree);
5932
- this._tree = tree;
5933
5936
  }
5934
5937
  for (let len = this._children.length, i = 0; i < len; i++) {
5935
5938
  const node = this._children[i];
@@ -6255,9 +6258,6 @@ let Node = class extends CoreObject {
6255
6258
  });
6256
6259
  return this;
6257
6260
  }
6258
- is(target) {
6259
- return Boolean(target && this.instanceId === target.instanceId);
6260
- }
6261
6261
  /** override */
6262
6262
  _ready() {
6263
6263
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.2",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",
@@ -71,25 +71,25 @@
71
71
  "earcut": "^3.0.1",
72
72
  "modern-font": "^0.4.0",
73
73
  "modern-idoc": "^0.1.5",
74
- "modern-path2d": "^1.2.6",
75
- "modern-text": "^1.2.2",
74
+ "modern-path2d": "^1.2.7",
75
+ "modern-text": "^1.2.3",
76
76
  "yoga-layout": "^3.2.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@antfu/eslint-config": "^3.12.2",
80
- "@types/earcut": "^2.1.4",
81
- "@types/node": "^22.10.5",
82
- "bumpp": "^9.9.3",
79
+ "@antfu/eslint-config": "^3.14.0",
80
+ "@types/earcut": "^3.0.0",
81
+ "@types/node": "^22.10.7",
82
+ "bumpp": "^9.10.1",
83
83
  "conventional-changelog-cli": "^5.0.0",
84
- "eslint": "^9.17.0",
85
- "lint-staged": "^15.3.0",
84
+ "eslint": "^9.18.0",
85
+ "lint-staged": "^15.4.1",
86
86
  "lottie-web": "^5.12.2",
87
87
  "modern-gif": "^2.0.4",
88
88
  "simple-git-hooks": "^2.11.1",
89
89
  "typescript": "^5.7.3",
90
- "unbuild": "^3.2.0",
91
- "vite": "^6.0.7",
92
- "vitest": "^2.1.8"
90
+ "unbuild": "^3.3.1",
91
+ "vite": "^6.0.8",
92
+ "vitest": "^3.0.2"
93
93
  },
94
94
  "simple-git-hooks": {
95
95
  "pre-commit": "pnpm lint-staged"