@vpmedia/phaser 1.96.0 → 1.98.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/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## [1.98.0] - 2025-12-29
2
+
3
+ ### 💼 Other
4
+
5
+ - *(deps)* Bumped package versions
6
+
7
+ ### ⚙️ Miscellaneous Tasks
8
+
9
+ - Release
10
+ - *(release)* V1.98.0
11
+ ## [1.97.0] - 2025-12-29
12
+
13
+ ### 🚀 Features
14
+
15
+ - Added signal async support
16
+ - Added async wait to timer
17
+
18
+ ### 💼 Other
19
+
20
+ - *(deps)* Bump dependency versions
21
+ - *(deps)* Bump dependency versions
22
+ - *(deps)* Bump dependency versions
23
+ - *(deps)* Bump dependency versions
24
+ - *(deps)* Bump dependency versions
25
+ - *(deps)* Bump dependency versions
26
+ - *(deps)* Bump dependency versions
27
+
28
+ ### ⚙️ Miscellaneous Tasks
29
+
30
+ - Release
31
+ - Improve type checking
32
+ - *(release)* V1.97.0
1
33
  ## [1.96.0] - 2025-12-17
2
34
 
3
35
  ### 💼 Other
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.96.0",
3
+ "version": "1.98.0",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "types": "./types/index.d.ts",
24
24
  "type": "module",
25
25
  "dependencies": {
26
- "@vpmedia/simplify": "^1.52.0",
26
+ "@vpmedia/simplify": "^1.53.0",
27
27
  "uuid": "^13.0.0"
28
28
  },
29
29
  "devDependencies": {
@@ -34,15 +34,15 @@
34
34
  "@vitest/coverage-v8": "^4.0.16",
35
35
  "eslint": "^9.39.2",
36
36
  "eslint-plugin-jsdoc": "^61.5.0",
37
- "eslint-plugin-oxlint": "^1.33.0",
37
+ "eslint-plugin-oxlint": "^1.35.0",
38
38
  "eslint-plugin-unicorn": "^62.0.0",
39
39
  "globals": "^16.5.0",
40
- "jsdom": "^27.3.0",
41
- "oxlint": "^1.33.0",
42
- "oxlint-tsgolint": "^0.9.1",
40
+ "jsdom": "^27.4.0",
41
+ "oxlint": "^1.35.0",
42
+ "oxlint-tsgolint": "^0.10.0",
43
43
  "prettier": "^3.7.4",
44
44
  "typescript": "^5.9.3",
45
- "typescript-eslint": "^8.50.0",
45
+ "typescript-eslint": "^8.50.1",
46
46
  "vitest": "^4.0.16"
47
47
  },
48
48
  "browserslist": [
@@ -259,4 +259,16 @@ export class Signal {
259
259
  }
260
260
  return this._boundDispatch;
261
261
  }
262
+
263
+ /**
264
+ * Promisify the Signal.
265
+ * @returns {Promise<any>} The resolved result.
266
+ */
267
+ toPromise() {
268
+ return new Promise((resolve) => {
269
+ this.addOnce((...args) => {
270
+ resolve(args.length <= 1 ? args[0] : args);
271
+ }, this);
272
+ });
273
+ }
262
274
  }
@@ -0,0 +1,37 @@
1
+ import { expect } from 'vitest';
2
+ import { Signal } from './signal.js';
3
+
4
+ describe('Signal', () => {
5
+ describe('core', () => {
6
+ it('', () => {
7
+ const signal = new Signal();
8
+ const listener = (arg) => {
9
+ expect(arg).toBe(1);
10
+ };
11
+ const listenerOnce = (arg) => {
12
+ expect(arg).toBe(1);
13
+ };
14
+ signal.add(listener);
15
+ expect(signal.getNumListeners()).toBe(1);
16
+ signal.addOnce(listenerOnce);
17
+ expect(signal.getNumListeners()).toBe(2);
18
+ signal.dispatch(1);
19
+ expect(signal.getNumListeners()).toBe(1);
20
+ signal.remove(listener);
21
+ expect(signal.has(listener)).toBe(false);
22
+ expect(signal.getNumListeners()).toBe(0);
23
+ expect(signal.has(() => null)).toBe(false);
24
+ });
25
+
26
+ it('async', async () => {
27
+ const signal = new Signal();
28
+ const promise = signal.toPromise();
29
+ expect(signal.getNumListeners()).toBe(1);
30
+ setTimeout(() => {
31
+ signal.dispatch(1);
32
+ }, 10);
33
+ const result = await promise;
34
+ expect(result).toBe(1);
35
+ });
36
+ });
37
+ });
@@ -86,6 +86,21 @@ export class Timer {
86
86
  return this.create(delay, false, 0, callback, callbackContext, args);
87
87
  }
88
88
 
89
+ /**
90
+ * Creates a new async TimerEvent that runs once.
91
+ * @template T
92
+ * @param {number} delay - The delay in milliseconds before the promise resolves.
93
+ * @param {...T} args - Arguments to pass to the resolve function.
94
+ * @returns {Promise<T | T[]>} The created Promise.
95
+ */
96
+ wait(delay, ...args) {
97
+ return new Promise((resolve) => {
98
+ this.create(delay, false, 0, () => {
99
+ resolve(args.length <= 1 ? args[0] : args);
100
+ });
101
+ });
102
+ }
103
+
89
104
  /**
90
105
  * Creates a new TimerEvent that repeats a specified number of times.
91
106
  * @param {number} delay - The delay in milliseconds before the event fires.
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Circle } from './circle.js';
2
3
  import { Point } from './point.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Ellipse } from './ellipse.js';
2
3
 
3
4
  it('should create an ellipse with default values', () => {
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { degToRad } from '../util/math.js';
2
3
  import { Line } from './line.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Matrix } from './matrix.js';
2
3
  import { Point } from './point.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Point } from './point.js';
2
3
 
3
4
  describe('Point', () => {
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { TOP_LEFT } from '../core/const.js';
2
3
  import { Point } from './point.js';
3
4
  import { Rectangle } from './rectangle.js';
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { RoundedRectangle } from './rounded_rectangle.js';
2
3
 
3
4
  describe('RoundedRectangle Constructor', () => {
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Circle } from '../circle.js';
2
3
  import { clone, contains, equals, intersects } from './circle.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Ellipse } from '../ellipse.js';
2
3
  import { contains } from './ellipse.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Line } from '../line.js';
2
3
  import { clone } from './line.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Matrix } from '../matrix.js';
2
3
  import { clone, getIdentityMatrix, getTempMatrix } from './matrix.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Point } from '../point.js';
2
3
  import { clone } from './point.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Polygon } from '../polygon.js';
2
3
  import { clone } from './polygon.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Rectangle } from '../rectangle.js';
2
3
  import { clone } from './rectangle.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { RoundedRectangle } from '../rounded_rectangle.js';
2
3
  import { clone } from './rounded_rectangle.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import {
2
3
  between,
3
4
  DEG_TO_RAD,