@vpmedia/phaser 1.94.0 → 1.95.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +5 -5
  3. package/pnpm-workspace.yaml +1 -1
  4. package/src/phaser/core/animation.js +18 -0
  5. package/src/phaser/core/animation_parser.js +2 -2
  6. package/src/phaser/core/dom.js +1 -1
  7. package/src/phaser/core/game.js +1 -1
  8. package/src/phaser/core/input_pointer.js +18 -0
  9. package/src/phaser/core/loader.js +2 -2
  10. package/src/phaser/core/scale_manager.js +3 -2
  11. package/src/phaser/core/time.js +24 -0
  12. package/src/phaser/core/timer.js +18 -0
  13. package/src/phaser/core/tween.js +16 -0
  14. package/src/phaser/core/tween_manager.js +3 -0
  15. package/src/phaser/display/bitmap_text.js +12 -1
  16. package/src/phaser/display/canvas/graphics.js +3 -3
  17. package/src/phaser/display/canvas/pool.js +4 -4
  18. package/src/phaser/display/canvas/renderer.js +1 -0
  19. package/src/phaser/display/canvas/util.js +8 -8
  20. package/src/phaser/display/graphics.js +17 -0
  21. package/src/phaser/display/group.js +13 -0
  22. package/src/phaser/display/image.js +15 -1
  23. package/src/phaser/display/text.js +8 -3
  24. package/src/phaser/display/webgl/base_texture.js +1 -1
  25. package/src/phaser/display/webgl/graphics.js +2 -2
  26. package/src/phaser/display/webgl/renderer.js +1 -0
  27. package/src/phaser/display/webgl/texture_util.js +4 -4
  28. package/src/phaser/geom/circle.js +5 -0
  29. package/src/phaser/geom/ellipse.js +5 -0
  30. package/src/phaser/geom/line.js +3 -0
  31. package/src/phaser/geom/matrix.js +7 -0
  32. package/src/phaser/geom/point.js +3 -0
  33. package/src/phaser/geom/polygon.js +5 -0
  34. package/src/phaser/geom/rectangle.js +5 -0
  35. package/src/phaser/geom/util/point.js +1 -1
  36. package/types/phaser/core/animation.d.ts +18 -0
  37. package/types/phaser/core/animation.d.ts.map +1 -1
  38. package/types/phaser/core/animation_parser.d.ts +3 -2
  39. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  40. package/types/phaser/core/dom.d.ts +10 -3
  41. package/types/phaser/core/dom.d.ts.map +1 -1
  42. package/types/phaser/core/game.d.ts +2 -2
  43. package/types/phaser/core/game.d.ts.map +1 -1
  44. package/types/phaser/core/input_pointer.d.ts +18 -0
  45. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  46. package/types/phaser/core/loader.d.ts +6 -3
  47. package/types/phaser/core/loader.d.ts.map +1 -1
  48. package/types/phaser/core/scale_manager.d.ts +6 -5
  49. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  50. package/types/phaser/core/time.d.ts +24 -0
  51. package/types/phaser/core/time.d.ts.map +1 -1
  52. package/types/phaser/core/timer.d.ts +18 -0
  53. package/types/phaser/core/timer.d.ts.map +1 -1
  54. package/types/phaser/core/tween.d.ts +16 -0
  55. package/types/phaser/core/tween.d.ts.map +1 -1
  56. package/types/phaser/core/tween_manager.d.ts +6 -43
  57. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  58. package/types/phaser/display/bitmap_text.d.ts +19 -3
  59. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  60. package/types/phaser/display/canvas/graphics.d.ts +3 -3
  61. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  62. package/types/phaser/display/canvas/pool.d.ts +6 -3
  63. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  64. package/types/phaser/display/canvas/renderer.d.ts +2 -1
  65. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  66. package/types/phaser/display/canvas/util.d.ts +6 -6
  67. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  68. package/types/phaser/display/graphics.d.ts +17 -1
  69. package/types/phaser/display/graphics.d.ts.map +1 -1
  70. package/types/phaser/display/group.d.ts +12 -0
  71. package/types/phaser/display/group.d.ts.map +1 -1
  72. package/types/phaser/display/image.d.ts +16 -5
  73. package/types/phaser/display/image.d.ts.map +1 -1
  74. package/types/phaser/display/text.d.ts +33 -7
  75. package/types/phaser/display/text.d.ts.map +1 -1
  76. package/types/phaser/display/webgl/base_texture.d.ts +2 -2
  77. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  78. package/types/phaser/display/webgl/graphics.d.ts +2 -2
  79. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  80. package/types/phaser/display/webgl/renderer.d.ts +1 -0
  81. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  82. package/types/phaser/display/webgl/texture_util.d.ts +4 -2
  83. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  84. package/types/phaser/geom/circle.d.ts +5 -0
  85. package/types/phaser/geom/circle.d.ts.map +1 -1
  86. package/types/phaser/geom/ellipse.d.ts +5 -0
  87. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  88. package/types/phaser/geom/line.d.ts +3 -0
  89. package/types/phaser/geom/line.d.ts.map +1 -1
  90. package/types/phaser/geom/matrix.d.ts +7 -0
  91. package/types/phaser/geom/matrix.d.ts.map +1 -1
  92. package/types/phaser/geom/point.d.ts +3 -0
  93. package/types/phaser/geom/point.d.ts.map +1 -1
  94. package/types/phaser/geom/polygon.d.ts +7 -1
  95. package/types/phaser/geom/polygon.d.ts.map +1 -1
  96. package/types/phaser/geom/rectangle.d.ts +5 -0
  97. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  98. package/types/phaser/geom/util/point.d.ts +1 -1
  99. package/types/phaser/geom/util/point.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [1.95.0] - 2025-12-16
2
+
3
+ ### 💼 Other
4
+
5
+ - *(deps)* Bump dependency versions
6
+ - *(deps)* Bump dependency versions
7
+
8
+ ### ⚙️ Miscellaneous Tasks
9
+
10
+ - Release
11
+ - Improve type checking
12
+ - *(release)* V1.95.0
1
13
  ## [1.94.0] - 2025-12-11
2
14
 
3
15
  ### ⚙️ Miscellaneous Tasks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.94.0",
3
+ "version": "1.95.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",
@@ -29,17 +29,17 @@
29
29
  "devDependencies": {
30
30
  "@commitlint/cli": "^20.2.0",
31
31
  "@commitlint/config-conventional": "^20.2.0",
32
- "@eslint/js": "^9.39.1",
33
- "@types/node": "^24.10.1",
32
+ "@eslint/js": "^9.39.2",
33
+ "@types/node": "^25.0.2",
34
34
  "@vitest/coverage-v8": "^4.0.15",
35
- "eslint": "^9.39.1",
35
+ "eslint": "^9.39.2",
36
36
  "eslint-plugin-jsdoc": "^61.5.0",
37
37
  "eslint-plugin-oxlint": "^1.32.0",
38
38
  "eslint-plugin-unicorn": "^62.0.0",
39
39
  "globals": "^16.5.0",
40
40
  "jsdom": "^27.3.0",
41
41
  "oxlint": "^1.32.0",
42
- "oxlint-tsgolint": "^0.8.4",
42
+ "oxlint-tsgolint": "^0.8.6",
43
43
  "prettier": "^3.7.4",
44
44
  "typescript": "^5.9.3",
45
45
  "typescript-eslint": "^8.49.0",
@@ -1,4 +1,4 @@
1
1
  onlyBuiltDependencies:
2
2
  - esbuild
3
3
  trustPolicy: no-downgrade
4
- minimumReleaseAge: 4320
4
+ minimumReleaseAge: 2880
@@ -12,27 +12,45 @@ export class Animation {
12
12
  * @param {boolean} loop - TBD.
13
13
  */
14
14
  constructor(game, parent, name, frameData, frames, frameRate, loop = false) {
15
+ /** @type {import('./game.js').Game} */
15
16
  this.game = game;
16
17
  this._parent = parent;
18
+ /** @type {import('./frame_data.js').FrameData} */
17
19
  this._frameData = frameData;
20
+ /** @type {string} */
18
21
  this.name = name;
19
22
  this._frames = [];
20
23
  this._frames = this._frames.concat(frames);
24
+ /** @type {number} */
21
25
  this.delay = 1000 / frameRate;
26
+ /** @type {boolean} */
22
27
  this.loop = loop;
28
+ /** @type {number} */
23
29
  this.loopCount = 0;
30
+ /** @type {boolean} */
24
31
  this.isFinished = false;
32
+ /** @type {boolean} */
25
33
  this.isPlaying = false;
34
+ /** @type {boolean} */
26
35
  this.isPaused = false;
36
+ /** @type {number} */
27
37
  this._pauseStartTime = 0;
38
+ /** @type {number} */
28
39
  this._frameIndex = 0;
40
+ /** @type {number} */
29
41
  this._frameDiff = 0;
42
+ /** @type {number} */
30
43
  this._frameSkip = 1;
31
44
  this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
45
+ /** @type {Signal} */
32
46
  this.onStart = new Signal();
47
+ /** @type {Signal} */
33
48
  this.onUpdate = null;
49
+ /** @type {Signal} */
34
50
  this.onComplete = new Signal();
51
+ /** @type {Signal} */
35
52
  this.onLoop = new Signal();
53
+ /** @type {boolean} */
36
54
  this.isReversed = false;
37
55
  // Set-up some event listeners
38
56
  this.game.onPause.add(this.onPause, this);
@@ -10,7 +10,7 @@ import { FrameData } from './frame_data.js';
10
10
  * @param {number} frameMax - TBD.
11
11
  * @param {number} margin - TBD.
12
12
  * @param {number} spacing - TBD.
13
- * @returns {object} TBD.
13
+ * @returns {FrameData} TBD.
14
14
  */
15
15
  export const spriteSheet = (game, key, frameWidth, frameHeight, frameMax, margin, spacing) => {
16
16
  let img = key;
@@ -60,7 +60,7 @@ export const spriteSheet = (game, key, frameWidth, frameHeight, frameMax, margin
60
60
  * TBD.
61
61
  * @param {import('./game.js').Game} game - TBD.
62
62
  * @param {object} json - TBD.
63
- * @returns {object} TBD.
63
+ * @returns {FrameData} TBD.
64
64
  */
65
65
  export const JSONDataHash = (game, json) => {
66
66
  if (!json.frames) {
@@ -234,7 +234,7 @@ export class DOM {
234
234
  * TBD.
235
235
  * @param {DOMRect} coords - TBD.
236
236
  * @param {number} cushion - TBD.
237
- * @returns {object} TBD.
237
+ * @returns {{width: number, height: number, left: number, right: number, top: number, bottom: number}} TBD.
238
238
  */
239
239
  calibrate(coords, cushion = 0) {
240
240
  const output = {
@@ -53,7 +53,7 @@ export class Game {
53
53
  this.logger = null;
54
54
  /** @type {HTMLCanvasElement} */
55
55
  this.canvas = null;
56
- /** @type {RenderingContext} */
56
+ /** @type {CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext} */
57
57
  this.context = null;
58
58
  this.onPause = new Signal();
59
59
  this.onResume = new Signal();
@@ -19,8 +19,10 @@ export class Pointer {
19
19
  constructor(game, id, pointerMode) {
20
20
  this.game = game;
21
21
  this.id = id;
22
+ /** @type {number} */
22
23
  this.type = POINTER;
23
24
  this.exists = true;
25
+ /** @type {number} */
24
26
  this.identifier = 0;
25
27
  this.pointerId = null;
26
28
  this.pointerMode = pointerMode || POINTER_CURSOR | POINTER_CONTACT;
@@ -28,27 +30,43 @@ export class Pointer {
28
30
  this.button = null;
29
31
  this._holdSent = false;
30
32
  this._history = [];
33
+ /** @type {number} */
31
34
  this._nextDrop = 0;
32
35
  this._stateReset = false;
33
36
  this.withinGame = false;
34
37
  this.clientX = -1;
38
+ /** @type {number} */
35
39
  this.clientY = -1;
40
+ /** @type {number} */
36
41
  this.pageX = -1;
42
+ /** @type {number} */
37
43
  this.pageY = -1;
44
+ /** @type {number} */
38
45
  this.screenX = -1;
46
+ /** @type {number} */
39
47
  this.screenY = -1;
48
+ /** @type {number} */
40
49
  this.rawMovementX = 0;
50
+ /** @type {number} */
41
51
  this.rawMovementY = 0;
52
+ /** @type {number} */
42
53
  this.movementX = 0;
54
+ /** @type {number} */
43
55
  this.movementY = 0;
56
+ /** @type {number} */
44
57
  this.x = -1;
58
+ /** @type {number} */
45
59
  this.y = -1;
46
60
  this.isMouse = id === 0;
47
61
  this.isDown = false;
48
62
  this.isUp = true;
63
+ /** @type {number} */
49
64
  this.timeDown = 0;
65
+ /** @type {number} */
50
66
  this.timeUp = 0;
67
+ /** @type {number} */
51
68
  this.previousTapTime = 0;
69
+ /** @type {number} */
52
70
  this.totalTouches = 0;
53
71
  this.msSinceLastClick = Number.MAX_VALUE;
54
72
  this.targetObject = null;
@@ -114,7 +114,7 @@ export class Loader {
114
114
  * TBD.
115
115
  * @param {string} type - TBD.
116
116
  * @param {string} key - TBD.
117
- * @returns {object} TBD.
117
+ * @returns {{index: number, file: object} | null} TBD.
118
118
  */
119
119
  getAsset(type, key) {
120
120
  const fileIndex = this.getAssetIndex(type, key);
@@ -623,7 +623,7 @@ export class Loader {
623
623
  * TBD.
624
624
  * @param {boolean} abnormal - TBD.
625
625
  */
626
- finishedLoading(abnormal) {
626
+ finishedLoading(abnormal = false) {
627
627
  if (this.hasLoaded) {
628
628
  return;
629
629
  }
@@ -49,6 +49,7 @@ export class ScaleManager {
49
49
  this.bounds = new Rectangle();
50
50
  this.aspectRatio = 0;
51
51
  this.sourceAspectRatio = 0;
52
+ /** @type {Event | null | undefined} */
52
53
  this.event = null;
53
54
  this.windowConstraints = {
54
55
  right: 'layout',
@@ -840,7 +841,7 @@ export class ScaleManager {
840
841
 
841
842
  /**
842
843
  * TBD.
843
- * @param {Event} event - TBD.
844
+ * @param {Event} [event] - TBD.
844
845
  */
845
846
  fullScreenError(event) {
846
847
  this.event = event;
@@ -870,7 +871,7 @@ export class ScaleManager {
870
871
 
871
872
  /**
872
873
  * TBD.
873
- * @returns {object} TBD.
874
+ * @returns {ParentNode | null} TBD.
874
875
  */
875
876
  get boundingParent() {
876
877
  if (this.parentIsWindow || (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)) {
@@ -7,30 +7,54 @@ export class Time {
7
7
  */
8
8
  constructor(game) {
9
9
  this.game = game;
10
+ /** @type {number} */
10
11
  this.time = 0;
12
+ /** @type {number} */
11
13
  this.prevTime = 0;
14
+ /** @type {number} */
12
15
  this.now = 0;
16
+ /** @type {number} */
13
17
  this.elapsed = 0;
18
+ /** @type {number} */
14
19
  this.elapsedMS = 0;
20
+ /** @type {number} */
15
21
  this.desiredFpsMult = 1 / 60;
22
+ /** @type {number} */
16
23
  this._desiredFps = 60;
24
+ /** @type {number} */
17
25
  this.suggestedFps = this.desiredFps;
26
+ /** @type {boolean} */
18
27
  this.advancedTiming = false;
28
+ /** @type {number} */
19
29
  this.frames = 0;
30
+ /** @type {number} */
20
31
  this.fps = 0;
32
+ /** @type {number} */
21
33
  this.fpsMin = 1000;
34
+ /** @type {number} */
22
35
  this.fpsMax = 0;
36
+ /** @type {number} */
23
37
  this.msMin = 1000;
38
+ /** @type {number} */
24
39
  this.msMax = 0;
40
+ /** @type {number} */
25
41
  this.pauseDuration = 0;
42
+ /** @type {number} */
26
43
  this.timeToCall = 0;
44
+ /** @type {number} */
27
45
  this.timeExpected = 0;
46
+ /** @type {Timer} */
28
47
  this.events = new Timer(this.game, false);
48
+ /** @type {number} */
29
49
  this._frameCount = 0;
50
+ /** @type {number} */
30
51
  this._elapsedAccumulator = 0;
31
52
  this._started = 0;
53
+ /** @type {number} */
32
54
  this._timeLastSecond = 0;
55
+ /** @type {number} */
33
56
  this._pauseStarted = 0;
57
+ /** @type {boolean} */
34
58
  this._justResumed = false;
35
59
  /** @type {Timer[]} */
36
60
  this._timers = [];
@@ -9,25 +9,43 @@ export class Timer {
9
9
  */
10
10
  constructor(game, autoDestroy = false) {
11
11
  this.game = game;
12
+ /** @type {boolean} */
12
13
  this.running = false;
14
+ /** @type {boolean} */
13
15
  this.autoDestroy = autoDestroy;
16
+ /** @type {boolean} */
14
17
  this.expired = false;
18
+ /** @type {number} */
15
19
  this.elapsed = 0;
16
20
  /** @type {TimerEvent[]} */
17
21
  this.events = [];
22
+ /** @type {Signal} */
18
23
  this.onComplete = new Signal();
24
+ /** @type {number} */
19
25
  this.nextTick = 0;
26
+ /** @type {number} */
20
27
  this.timeCap = 1000;
28
+ /** @type {boolean} */
21
29
  this.paused = false;
30
+ /** @type {boolean} */
22
31
  this._codePaused = false;
32
+ /** @type {number} */
23
33
  this._started = 0;
34
+ /** @type {number} */
24
35
  this._pauseStarted = 0;
36
+ /** @type {number} */
25
37
  this._pauseTotal = 0;
38
+ /** @type {number} */
26
39
  this._now = Date.now();
40
+ /** @type {number} */
27
41
  this._len = 0;
42
+ /** @type {number} */
28
43
  this._marked = 0;
44
+ /** @type {number} */
29
45
  this._i = 0;
46
+ /** @type {number} */
30
47
  this._diff = 0;
48
+ /** @type {number} */
31
49
  this._newTick = 0;
32
50
  }
33
51
 
@@ -13,27 +13,43 @@ export class Tween {
13
13
  constructor(target, game, manager) {
14
14
  this.game = game;
15
15
  this.target = target;
16
+ /** @type {import('./tween_manager.js').TweenManager} */
16
17
  this.manager = manager;
17
18
  /** @type {TweenData[]} */
18
19
  this.timeline = [];
20
+ /** @type {boolean} */
19
21
  this.reverse = false;
22
+ /** @type {number} */
20
23
  this.timeScale = 1;
24
+ /** @type {number} */
21
25
  this.repeatCounter = 0;
26
+ /** @type {boolean} */
22
27
  this.pendingDelete = false;
28
+ /** @type {Signal} */
23
29
  this.onStart = new Signal();
30
+ /** @type {Signal} */
24
31
  this.onLoop = new Signal();
32
+ /** @type {Signal} */
25
33
  this.onRepeat = new Signal();
34
+ /** @type {Signal} */
26
35
  this.onChildComplete = new Signal();
36
+ /** @type {Signal} */
27
37
  this.onComplete = new Signal();
38
+ /** @type {boolean} */
28
39
  this.isRunning = false;
40
+ /** @type {number} */
29
41
  this.current = 0;
30
42
  this.properties = {};
31
43
  this.chainedTween = null;
44
+ /** @type {boolean} */
32
45
  this.isPaused = false;
33
46
  this._onUpdateCallback = null;
34
47
  this._onUpdateCallbackContext = null;
48
+ /** @type {number} */
35
49
  this._pausedTime = 0;
50
+ /** @type {boolean} */
36
51
  this._codePaused = false;
52
+ /** @type {boolean} */
37
53
  this._hasStarted = false;
38
54
  }
39
55
 
@@ -41,8 +41,11 @@ export class TweenManager {
41
41
  */
42
42
  constructor(game) {
43
43
  this.game = game;
44
+ /** @type {Tween[]} */
44
45
  this._tweens = [];
46
+ /** @type {Tween[]} */
45
47
  this._add = [];
48
+ /** @type {{[key: string]: (k: number) => number}} */
46
49
  this.easeMap = {
47
50
  Linear: LinearNone,
48
51
  Quad: QuadraticOut,
@@ -16,20 +16,31 @@ export class BitmapText extends DisplayObject {
16
16
  */
17
17
  constructor(game, x = 0, y = 0, font = '', text = '', size = 32, align = 'left') {
18
18
  super(game);
19
+ /** @type {number} */
19
20
  this.type = BITMAP_TEXT;
20
21
  this.position.setTo(x, y);
22
+ /** @type {number} */
21
23
  this.textWidth = 0;
24
+ /** @type {number} */
22
25
  this.textHeight = 0;
26
+ /** @type {Point} */
23
27
  this._prevAnchor = new Point();
24
28
  this._glyphs = [];
29
+ /** @type {number} */
25
30
  this._maxWidth = 0;
31
+ /** @type {string} */
26
32
  this._text = text.toString() || '';
27
33
  this._data = game.cache.getBitmapFont(font);
34
+ /** @type {string} */
28
35
  this._font = font;
36
+ /** @type {number} */
29
37
  this._fontSize = size;
38
+ /** @type {string} */
30
39
  this._align = align;
40
+ /** @type {number} */
31
41
  this._tint = 0xffffff;
32
42
  this.updateText();
43
+ /** @type {boolean} */
33
44
  this.dirty = false;
34
45
  }
35
46
 
@@ -79,7 +90,7 @@ export class BitmapText extends DisplayObject {
79
90
  * @param {object} data - TBD.
80
91
  * @param {number} scale - TBD.
81
92
  * @param {string} text - TBD.
82
- * @returns {object} TBD.
93
+ * @returns {{width: number, text: string, end: boolean, chars: number[]}} TBD.
83
94
  */
84
95
  scanLine(data, scale, text) {
85
96
  let x = 0;
@@ -2,7 +2,7 @@ import { GEOM_CIRCLE, GEOM_ELLIPSE, GEOM_POLYGON, GEOM_RECTANGLE, GEOM_ROUNDED_R
2
2
 
3
3
  /**
4
4
  * TBD.
5
- * @param {object} graphics - TBD.
5
+ * @param {import('../graphics.js').Graphics} graphics - TBD.
6
6
  */
7
7
  export const updateGraphicsTint = (graphics) => {
8
8
  if (graphics.tint === 0xffffff) {
@@ -28,7 +28,7 @@ export const updateGraphicsTint = (graphics) => {
28
28
 
29
29
  /**
30
30
  * TBD.
31
- * @param {object} graphics - TBD.
31
+ * @param {import('../graphics.js').Graphics} graphics - TBD.
32
32
  * @param {object} context - TBD.
33
33
  */
34
34
  export const renderGraphics = (graphics, context) => {
@@ -157,7 +157,7 @@ export const renderGraphics = (graphics, context) => {
157
157
 
158
158
  /**
159
159
  * TBD.
160
- * @param {object} graphics - TBD.
160
+ * @param {import('../graphics.js').Graphics} graphics - TBD.
161
161
  * @param {object} context - TBD.
162
162
  */
163
163
  export const renderGraphicsMask = (graphics, context) => {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TBD.
3
- * @returns {object[]} TBD.
3
+ * @returns {{canvas: HTMLCanvasElement, parent: object}[]} TBD.
4
4
  */
5
5
  export const getPool = () => {
6
6
  if (!window.PhaserRegistry) {
@@ -14,7 +14,7 @@ export const getPool = () => {
14
14
 
15
15
  /**
16
16
  * TBD.
17
- * @returns {object} TBD.
17
+ * @returns {number} TBD.
18
18
  */
19
19
  export const getFirst = () => {
20
20
  const pool = getPool();
@@ -89,8 +89,8 @@ export const getFree = () => {
89
89
  /**
90
90
  * TBD.
91
91
  * @param {object} parent - TBD.
92
- * @param {number} width - TBD.
93
- * @param {number} height - TBD.
92
+ * @param {number} [width] - TBD.
93
+ * @param {number} [height] - TBD.
94
94
  * @param {boolean} skipPool - TBD.
95
95
  * @returns {HTMLCanvasElement} TBD.
96
96
  */
@@ -32,6 +32,7 @@ export class CanvasRenderer {
32
32
  */
33
33
  constructor(game) {
34
34
  detectCapabilities(game);
35
+ /** @type {number} */
35
36
  this.type = RENDER_CANVAS;
36
37
  this.resolution = game.config.resolution;
37
38
  this.clearBeforeRender = game.config.clearBeforeRender;
@@ -26,7 +26,7 @@ export const create = (parent, width, height, id, skipPool) => {
26
26
  * TBD.
27
27
  * @param {HTMLCanvasElement} canvas - TBD.
28
28
  * @param {string} color - TBD.
29
- * @returns {object} TBD.
29
+ * @returns {HTMLCanvasElement} TBD.
30
30
  */
31
31
  export const setBackgroundColor = (canvas, color) => {
32
32
  color = color || 'rgb(0,0,0)';
@@ -38,7 +38,7 @@ export const setBackgroundColor = (canvas, color) => {
38
38
  * TBD.
39
39
  * @param {HTMLCanvasElement} canvas - TBD.
40
40
  * @param {string} value - TBD.
41
- * @returns {object} TBD.
41
+ * @returns {HTMLCanvasElement} TBD.
42
42
  */
43
43
  export const setTouchAction = (canvas, value = 'none') => {
44
44
  value = value || 'none';
@@ -53,7 +53,7 @@ export const setTouchAction = (canvas, value = 'none') => {
53
53
  * TBD.
54
54
  * @param {HTMLCanvasElement} canvas - TBD.
55
55
  * @param {string} value - TBD.
56
- * @returns {object} TBD.
56
+ * @returns {HTMLCanvasElement} TBD.
57
57
  */
58
58
  export const setUserSelect = (canvas, value = 'none') => {
59
59
  value = value || 'none';
@@ -72,7 +72,7 @@ export const setUserSelect = (canvas, value = 'none') => {
72
72
  * @param {HTMLCanvasElement} canvas - TBD.
73
73
  * @param {object} parent - TBD.
74
74
  * @param {boolean} overflowHidden - TBD.
75
- * @returns {object} TBD.
75
+ * @returns {HTMLCanvasElement} TBD.
76
76
  */
77
77
  export const addToDOM = (canvas, parent, overflowHidden = true) => {
78
78
  let target;
@@ -108,14 +108,14 @@ export const removeFromDOM = (canvas) => {
108
108
 
109
109
  /**
110
110
  * TBD.
111
- * @param {object} context - TBD.
111
+ * @param {CanvasRenderingContext2D} context - TBD.
112
112
  * @param {number} translateX - TBD.
113
113
  * @param {number} translateY - TBD.
114
114
  * @param {number} scaleX - TBD.
115
115
  * @param {number} scaleY - TBD.
116
116
  * @param {number} skewX - TBD.
117
117
  * @param {number} skewY - TBD.
118
- * @returns {object} TBD.
118
+ * @returns {CanvasRenderingContext2D} TBD.
119
119
  */
120
120
  export const setTransform = (context, translateX, translateY, scaleX, scaleY, skewX, skewY) => {
121
121
  context.setTransform(scaleX, skewX, skewY, scaleY, translateX, translateY);
@@ -124,8 +124,8 @@ export const setTransform = (context, translateX, translateY, scaleX, scaleY, sk
124
124
 
125
125
  /**
126
126
  * TBD.
127
- * @param {object} context - TBD.
128
- * @returns {object} TBD.
127
+ * @param {CanvasRenderingContext2D} context - TBD.
128
+ * @returns {string | null} TBD.
129
129
  */
130
130
  export const getSmoothingPrefix = (context) => {
131
131
  const VENDORS = ['i', 'webkitI', 'msI', 'mozI', 'oI'];
@@ -33,24 +33,41 @@ export class Graphics extends DisplayObject {
33
33
  */
34
34
  constructor(game, x = 0, y = 0) {
35
35
  super(game);
36
+ /** @type {number} */
36
37
  this.type = GRAPHICS;
37
38
  this.position.setTo(x, y);
39
+ /** @type {boolean} */
38
40
  this.renderable = true;
41
+ /** @type {number} */
39
42
  this.fillAlpha = 1;
43
+ /** @type {number} */
40
44
  this.lineWidth = 0;
45
+ /** @type {number} */
41
46
  this.lineColor = 0;
42
47
  this.graphicsData = [];
48
+ /** @type {number} */
43
49
  this.tint = 0xffffff;
50
+ /** @type {number} */
44
51
  this.blendMode = BLEND_NORMAL;
52
+ /** @type {GraphicsData} */
45
53
  this.currentPath = null;
54
+ /** @type {object[]} */
46
55
  this._webGL = [];
56
+ /** @type {boolean} */
47
57
  this.isMask = false;
58
+ /** @type {number} */
48
59
  this.boundsPadding = 0;
60
+ /** @type {Rectangle} */
49
61
  this._localBounds = new Rectangle(0, 0, 1, 1);
62
+ /** @type {boolean} */
50
63
  this.dirty = true;
64
+ /** @type {boolean} */
51
65
  this._boundsDirty = false;
66
+ /** @type {boolean} */
52
67
  this._cacheAsBitmap = false;
68
+ /** @type {boolean} */
53
69
  this.webGLDirty = false;
70
+ /** @type {boolean} */
54
71
  this.cachedSpriteDirty = false;
55
72
  }
56
73
 
@@ -16,11 +16,14 @@ export class Group extends DisplayObject {
16
16
  */
17
17
  constructor(game, parent = null, name = null, addToStage = false) {
18
18
  super(game);
19
+ /** @type {number} */
19
20
  this.type = GROUP;
20
21
  if (!parent) {
21
22
  parent = game.world;
22
23
  }
24
+ /** @type {string} */
23
25
  this.name = name || 'group';
26
+ /** @type {number} */
24
27
  this.z = 0;
25
28
  if (addToStage) {
26
29
  this.game.stage.addChild(this);
@@ -29,17 +32,27 @@ export class Group extends DisplayObject {
29
32
  parent.addChild(this);
30
33
  this.z = parent.children.length;
31
34
  }
35
+ /** @type {boolean} */
32
36
  this.ignoreDestroy = false;
37
+ /** @type {boolean} */
33
38
  this.pendingDestroy = false;
34
39
  this.classType = Image;
35
40
  this.cursor = null;
41
+ /** @type {boolean} */
36
42
  this.inputEnableChildren = false;
43
+ /** @type {Signal} */
37
44
  this.onChildInputDown = new Signal();
45
+ /** @type {Signal} */
38
46
  this.onChildInputUp = new Signal();
47
+ /** @type {Signal} */
39
48
  this.onChildInputOver = new Signal();
49
+ /** @type {Signal} */
40
50
  this.onChildInputOut = new Signal();
51
+ /** @type {Signal} */
41
52
  this.onDestroy = new Signal();
53
+ /** @type {number} */
42
54
  this.cursorIndex = 0;
55
+ /** @type {string} */
43
56
  this._sortProperty = 'z';
44
57
  }
45
58