@vpmedia/phaser 1.108.0 → 1.110.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 (63) hide show
  1. package/dist/index.js +100 -166
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation_manager.d.ts +8 -7
  4. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  5. package/dist/phaser/core/cache.d.ts +23 -10
  6. package/dist/phaser/core/cache.d.ts.map +1 -1
  7. package/dist/phaser/core/device.d.ts +23 -23
  8. package/dist/phaser/core/device.d.ts.map +1 -1
  9. package/dist/phaser/core/dom.d.ts +1 -1
  10. package/dist/phaser/core/dom.d.ts.map +1 -1
  11. package/dist/phaser/core/factory.d.ts +13 -7
  12. package/dist/phaser/core/factory.d.ts.map +1 -1
  13. package/dist/phaser/core/input.d.ts +54 -45
  14. package/dist/phaser/core/input.d.ts.map +1 -1
  15. package/dist/phaser/core/input_handler.d.ts +70 -51
  16. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  17. package/dist/phaser/core/input_mouse.d.ts +15 -14
  18. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  19. package/dist/phaser/core/input_pointer.d.ts +40 -38
  20. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  21. package/dist/phaser/core/loader.d.ts +31 -28
  22. package/dist/phaser/core/loader.d.ts.map +1 -1
  23. package/dist/phaser/core/scale_manager.d.ts +57 -53
  24. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  25. package/dist/phaser/core/scene_manager.d.ts +7 -4
  26. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  27. package/dist/phaser/core/signal.d.ts +9 -9
  28. package/dist/phaser/core/signal.d.ts.map +1 -1
  29. package/dist/phaser/core/time.d.ts +31 -30
  30. package/dist/phaser/core/time.d.ts.map +1 -1
  31. package/dist/phaser/core/timer.d.ts +25 -23
  32. package/dist/phaser/core/timer.d.ts.map +1 -1
  33. package/dist/phaser/core/tween_manager.d.ts +1 -1
  34. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  35. package/dist/phaser/display/bitmap_text.d.ts +17 -15
  36. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  37. package/dist/phaser/display/display_object.d.ts +14 -13
  38. package/dist/phaser/display/display_object.d.ts.map +1 -1
  39. package/dist/phaser/display/group.d.ts +5 -4
  40. package/dist/phaser/display/group.d.ts.map +1 -1
  41. package/dist/phaser/display/text.d.ts +13 -12
  42. package/dist/phaser/display/text.d.ts.map +1 -1
  43. package/package.json +10 -10
  44. package/src/phaser/core/animation_manager.ts +5 -9
  45. package/src/phaser/core/cache.ts +41 -8
  46. package/src/phaser/core/device.ts +23 -83
  47. package/src/phaser/core/dom.ts +1 -1
  48. package/src/phaser/core/factory.ts +3 -2
  49. package/src/phaser/core/input.ts +51 -51
  50. package/src/phaser/core/input_handler.ts +57 -35
  51. package/src/phaser/core/input_mouse.ts +16 -14
  52. package/src/phaser/core/input_pointer.ts +35 -53
  53. package/src/phaser/core/loader.ts +34 -31
  54. package/src/phaser/core/scale_manager.ts +51 -49
  55. package/src/phaser/core/scene_manager.ts +6 -4
  56. package/src/phaser/core/signal.ts +8 -6
  57. package/src/phaser/core/time.ts +29 -53
  58. package/src/phaser/core/timer.ts +22 -40
  59. package/src/phaser/core/tween_manager.ts +2 -2
  60. package/src/phaser/display/bitmap_text.ts +18 -30
  61. package/src/phaser/display/display_object.ts +12 -11
  62. package/src/phaser/display/group.ts +7 -5
  63. package/src/phaser/display/text.ts +14 -14
@@ -1,65 +1,66 @@
1
1
  import { Point } from '../geom/point.js';
2
2
  import { Rectangle } from '../geom/rectangle.js';
3
3
  import { RENDER_CANVAS, SCALE_EXACT_FIT, SCALE_OFF, SCALE_RESIZE, SCALE_SHOW_ALL, SCALE_USER } from './const.js';
4
+ import type { Game } from './game.js';
4
5
  import { DOM } from './dom.js';
5
6
  import { Signal } from './signal.js';
6
7
 
7
8
  export class ScaleManager {
8
- game!: any;
9
- dom!: any;
10
- width!: any;
11
- height!: any;
12
- minWidth!: any;
13
- maxWidth!: any;
14
- minHeight!: any;
15
- maxHeight!: any;
16
- offset!: any;
17
- forceLandscape!: any;
18
- forcePortrait!: any;
19
- incorrectOrientation!: any;
20
- _pageAlignHorizontally!: any;
21
- _pageAlignVertically!: any;
22
- onOrientationChange!: any;
23
- enterIncorrectOrientation!: any;
24
- leaveIncorrectOrientation!: any;
25
- hasPhaserSetFullScreen!: any;
9
+ game!: Game;
10
+ dom!: DOM;
11
+ width!: number;
12
+ height!: number;
13
+ minWidth!: number | null;
14
+ maxWidth!: number | null;
15
+ minHeight!: number | null;
16
+ maxHeight!: number | null;
17
+ offset!: Point;
18
+ forceLandscape!: boolean;
19
+ forcePortrait!: boolean;
20
+ incorrectOrientation!: boolean;
21
+ _pageAlignHorizontally!: boolean;
22
+ _pageAlignVertically!: boolean;
23
+ onOrientationChange!: Signal;
24
+ enterIncorrectOrientation!: Signal;
25
+ leaveIncorrectOrientation!: Signal;
26
+ hasPhaserSetFullScreen!: boolean;
26
27
  fullScreenTarget!: any;
27
28
  _createdFullScreenTarget!: any;
28
- onFullScreenInit!: any;
29
- onFullScreenChange!: any;
30
- onFullScreenError!: any;
29
+ onFullScreenInit!: Signal;
30
+ onFullScreenChange!: Signal;
31
+ onFullScreenError!: Signal;
31
32
  screenOrientation!: any;
32
- scaleFactor!: any;
33
- scaleFactorInversed!: any;
33
+ scaleFactor!: Point;
34
+ scaleFactorInversed!: Point;
34
35
  margin!: any;
35
- bounds!: any;
36
- aspectRatio!: any;
37
- sourceAspectRatio!: any;
38
- event!: any;
36
+ bounds!: Rectangle;
37
+ aspectRatio!: number;
38
+ sourceAspectRatio!: number;
39
+ event!: Event | null | undefined;
39
40
  windowConstraints!: any;
40
41
  compatibility!: any;
41
- _scaleMode!: any;
42
- _fullScreenScaleMode!: any;
43
- parentIsWindow!: any;
42
+ _scaleMode!: number;
43
+ _fullScreenScaleMode!: number;
44
+ parentIsWindow!: boolean;
44
45
  parentNode!: any;
45
- parentScaleFactor!: any;
46
- trackParentInterval!: any;
47
- onSizeChange!: any;
46
+ parentScaleFactor!: Point;
47
+ trackParentInterval!: number;
48
+ onSizeChange!: Signal;
48
49
  onResize!: any;
49
50
  onResizeContext!: any;
50
51
  _pendingScaleMode!: any;
51
52
  _fullScreenRestore!: any;
52
- _gameSize!: any;
53
- _userScaleFactor!: any;
54
- _userScaleTrim!: any;
55
- _lastUpdate!: any;
56
- _updateThrottle!: any;
57
- _updateThrottleReset!: any;
58
- _parentBounds!: any;
59
- _tempBounds!: any;
60
- _lastReportedCanvasSize!: any;
61
- _lastReportedGameSize!: any;
62
- _booted!: any;
53
+ _gameSize!: Rectangle;
54
+ _userScaleFactor!: Point;
55
+ _userScaleTrim!: Point;
56
+ _lastUpdate!: number;
57
+ _updateThrottle!: number;
58
+ _updateThrottleReset!: number;
59
+ _parentBounds!: Rectangle;
60
+ _tempBounds!: Rectangle;
61
+ _lastReportedCanvasSize!: Rectangle;
62
+ _lastReportedGameSize!: Rectangle;
63
+ _booted!: boolean;
63
64
  _orientationChange!: (event: Event) => void;
64
65
  _windowResize!: (event: UIEvent) => void;
65
66
  _fullScreenChange!: (event: Event) => void;
@@ -70,7 +71,7 @@ export class ScaleManager {
70
71
  * @param {number} width - TBD.
71
72
  * @param {number} height - TBD.
72
73
  */
73
- constructor(game: import('./game.js').Game, width: number, height: number) {
74
+ constructor(game: Game, width: number, height: number) {
74
75
  this.game = game;
75
76
  this.dom = new DOM(game.device);
76
77
  this.width = 0;
@@ -108,7 +109,6 @@ export class ScaleManager {
108
109
  this.bounds = new Rectangle();
109
110
  this.aspectRatio = 0;
110
111
  this.sourceAspectRatio = 0;
111
- /** @type {Event | null | undefined} */
112
112
  this.event = null;
113
113
  this.windowConstraints = {
114
114
  right: 'layout',
@@ -334,7 +334,7 @@ export class ScaleManager {
334
334
  // Per StateManager#onResizeCallback, it only occurs when in RESIZE mode.
335
335
  if (this.currentScaleMode === SCALE_RESIZE) {
336
336
  this.game.state.resize(width, height);
337
- this.game.load.resize(width, height);
337
+ this.game.load.resize();
338
338
  }
339
339
  }
340
340
  }
@@ -806,7 +806,9 @@ export class ScaleManager {
806
806
  // (The target has to be added for the Fullscreen API to work.)
807
807
  const canvas = this.game.canvas;
808
808
  const parent = canvas.parentNode;
809
- parent.insertBefore(fsTarget, canvas);
809
+ if (parent) {
810
+ parent.insertBefore(fsTarget, canvas);
811
+ }
810
812
  fsTarget.appendChild(canvas);
811
813
  }
812
814
  if (this.game.device.fullscreenKeyboard) {
@@ -936,7 +938,7 @@ export class ScaleManager {
936
938
  if (this.parentIsWindow || (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)) {
937
939
  return null;
938
940
  }
939
- const parentNode = this.game.canvas && this.game.canvas.parentNode;
941
+ const parentNode = this.game.canvas ? (this.game.canvas.parentNode as HTMLElement | null) : null;
940
942
  return parentNode || null;
941
943
  }
942
944
 
@@ -1,3 +1,4 @@
1
+ import type { Game } from './game.js';
1
2
  import { Scene } from './scene.js';
2
3
 
3
4
  export class SceneManager {
@@ -8,7 +9,7 @@ export class SceneManager {
8
9
  _clearCache!: any;
9
10
  _created!: any;
10
11
  _args!: any;
11
- current!: any;
12
+ current!: string;
12
13
  onInitCallback!: any;
13
14
  onPreloadCallback!: any;
14
15
  onCreateCallback!: any;
@@ -22,7 +23,7 @@ export class SceneManager {
22
23
  * @param {import('./game.js').Game} game - The game instance this manager belongs to.
23
24
  * @param {string} pendingState - The state to load when the game boots.
24
25
  */
25
- constructor(game: import('./game.js').Game, pendingState: string) {
26
+ constructor(game: Game, pendingState: string) {
26
27
  this.game = game;
27
28
  this.states = {};
28
29
  this._pendingState = null;
@@ -250,9 +251,10 @@ export class SceneManager {
250
251
 
251
252
  /**
252
253
  * Get the current scene state.
253
- * @returns {Scene} The current scene state.
254
+ * @template T
255
+ * @returns {T} The current scene state.
254
256
  */
255
- getCurrentState() {
257
+ getCurrentState<T = Partial<Scene>>(): T {
256
258
  return this.states[this.current];
257
259
  }
258
260
 
@@ -1,12 +1,12 @@
1
1
  import { SignalBinding } from './signal_binding.js';
2
2
 
3
3
  export class Signal {
4
- _bindings: any;
5
- _prevParams: any;
4
+ _bindings: SignalBinding[] | null;
5
+ _prevParams: unknown[] | null;
6
6
  memorize: boolean;
7
7
  _shouldPropagate: boolean;
8
8
  active: boolean;
9
- _boundDispatch: any;
9
+ _boundDispatch: ((...args: unknown[]) => void) | null;
10
10
 
11
11
  /**
12
12
  * Creates a new Signal instance.
@@ -54,7 +54,7 @@ export class Signal {
54
54
  ) {
55
55
  const prevIndex = this._indexOfListener(listener, listenerContext);
56
56
  let binding;
57
- if (prevIndex !== -1) {
57
+ if (prevIndex !== -1 && this._bindings) {
58
58
  binding = this._bindings[prevIndex];
59
59
  if (binding.isOnce() !== isOnce) {
60
60
  throw new Error(
@@ -156,7 +156,7 @@ export class Signal {
156
156
  remove(listener: Function, context: any | null = null) {
157
157
  this.validateListener(listener, 'remove');
158
158
  const i = this._indexOfListener(listener, context);
159
- if (i !== -1) {
159
+ if (i !== -1 && this._bindings) {
160
160
  // no reason to a SignalBinding exist if it isn't attached to a signal
161
161
  this._bindings[i]._destroy();
162
162
  this._bindings.splice(i, 1);
@@ -268,7 +268,9 @@ export class Signal {
268
268
  get boundDispatch() {
269
269
  const _this = this;
270
270
  if (!this._boundDispatch) {
271
- this._boundDispatch = (...rest: unknown[]) => _this.dispatch(...rest);
271
+ this._boundDispatch = (...rest: unknown[]) => {
272
+ _this.dispatch(...rest);
273
+ };
272
274
  }
273
275
  return this._boundDispatch;
274
276
  }
@@ -1,89 +1,65 @@
1
+ import type { Game } from './game.js';
1
2
  import { Timer } from './timer.js';
2
3
 
3
4
  export class Time {
4
- game!: any;
5
- time!: any;
6
- prevTime!: any;
7
- now!: any;
8
- elapsed!: any;
9
- elapsedMS!: any;
10
- desiredFpsMult!: any;
11
- _desiredFps!: any;
12
- suggestedFps!: any;
13
- advancedTiming!: any;
14
- frames!: any;
15
- fps!: any;
16
- fpsMin!: any;
17
- fpsMax!: any;
18
- msMin!: any;
19
- msMax!: any;
20
- pauseDuration!: any;
21
- timeToCall!: any;
22
- timeExpected!: any;
23
- events!: any;
24
- _frameCount!: any;
25
- _elapsedAccumulator!: any;
26
- _started!: any;
27
- _timeLastSecond!: any;
28
- _pauseStarted!: any;
29
- _justResumed!: any;
30
- _timers!: any;
5
+ game!: Game;
6
+ time!: number;
7
+ prevTime!: number;
8
+ now!: number;
9
+ elapsed!: number;
10
+ elapsedMS!: number;
11
+ desiredFpsMult!: number;
12
+ _desiredFps!: number;
13
+ suggestedFps!: number;
14
+ advancedTiming!: boolean;
15
+ frames!: number;
16
+ fps!: number;
17
+ fpsMin!: number;
18
+ fpsMax!: number;
19
+ msMin!: number;
20
+ msMax!: number;
21
+ pauseDuration!: number;
22
+ timeToCall!: number;
23
+ timeExpected!: number;
24
+ events!: Timer;
25
+ _frameCount!: number;
26
+ _elapsedAccumulator!: number;
27
+ _started!: number;
28
+ _timeLastSecond!: number;
29
+ _pauseStarted!: number;
30
+ _justResumed!: boolean;
31
+ _timers!: Timer[];
31
32
  /**
32
33
  * Creates a new Time instance.
33
34
  * @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
34
35
  */
35
- constructor(game: import('./game.js').Game) {
36
+ constructor(game: Game) {
36
37
  this.game = game;
37
- /** @type {number} */
38
38
  this.time = 0;
39
- /** @type {number} */
40
39
  this.prevTime = 0;
41
- /** @type {number} */
42
40
  this.now = 0;
43
- /** @type {number} */
44
41
  this.elapsed = 0;
45
- /** @type {number} */
46
42
  this.elapsedMS = 0;
47
- /** @type {number} */
48
43
  this.desiredFpsMult = 1 / 60;
49
- /** @type {number} */
50
44
  this._desiredFps = 60;
51
- /** @type {number} */
52
45
  this.suggestedFps = this.desiredFps;
53
- /** @type {boolean} */
54
46
  this.advancedTiming = false;
55
- /** @type {number} */
56
47
  this.frames = 0;
57
- /** @type {number} */
58
48
  this.fps = 0;
59
- /** @type {number} */
60
49
  this.fpsMin = 1000;
61
- /** @type {number} */
62
50
  this.fpsMax = 0;
63
- /** @type {number} */
64
51
  this.msMin = 1000;
65
- /** @type {number} */
66
52
  this.msMax = 0;
67
- /** @type {number} */
68
53
  this.pauseDuration = 0;
69
- /** @type {number} */
70
54
  this.timeToCall = 0;
71
- /** @type {number} */
72
55
  this.timeExpected = 0;
73
- /** @type {Timer} */
74
56
  this.events = new Timer(this.game, false);
75
- /** @type {number} */
76
57
  this._frameCount = 0;
77
- /** @type {number} */
78
58
  this._elapsedAccumulator = 0;
79
59
  this._started = 0;
80
- /** @type {number} */
81
60
  this._timeLastSecond = 0;
82
- /** @type {number} */
83
61
  this._pauseStarted = 0;
84
- /** @type {boolean} */
85
62
  this._justResumed = false;
86
- /** @type {Timer[]} */
87
63
  this._timers = [];
88
64
  }
89
65
 
@@ -1,71 +1,53 @@
1
+ import type { Game } from './game.js';
1
2
  import { Signal } from './signal.js';
2
3
  import { TimerEvent } from './timer_event.js';
3
4
 
4
5
  export class Timer {
5
- game!: any;
6
- running!: any;
7
- autoDestroy!: any;
8
- expired!: any;
9
- elapsed!: any;
10
- events!: any;
11
- onComplete!: any;
12
- nextTick!: any;
13
- timeCap!: any;
14
- paused!: any;
15
- _codePaused!: any;
16
- _started!: any;
17
- _pauseStarted!: any;
18
- _pauseTotal!: any;
19
- _now!: any;
20
- _len!: any;
21
- _marked!: any;
22
- _i!: any;
23
- _diff!: any;
24
- _newTick!: any;
6
+ game!: Game;
7
+ running!: boolean;
8
+ autoDestroy!: boolean;
9
+ expired!: boolean;
10
+ elapsed!: number;
11
+ events!: TimerEvent[];
12
+ onComplete!: Signal;
13
+ nextTick!: number;
14
+ timeCap!: number;
15
+ paused!: boolean;
16
+ _codePaused!: boolean;
17
+ _started!: number;
18
+ _pauseStarted!: number;
19
+ _pauseTotal!: number;
20
+ _now!: number;
21
+ _len!: number;
22
+ _marked!: number;
23
+ _i!: number;
24
+ _diff!: number;
25
+ _newTick!: number;
25
26
  /**
26
27
  * Creates a new Timer instance.
27
28
  * @param {import('./game.js').Game} game - The game instance.
28
29
  * @param {boolean} autoDestroy - Whether to automatically destroy the timer when it completes.
29
30
  */
30
- constructor(game: import('./game.js').Game, autoDestroy: boolean = false) {
31
+ constructor(game: Game, autoDestroy: boolean = false) {
31
32
  this.game = game;
32
- /** @type {boolean} */
33
33
  this.running = false;
34
- /** @type {boolean} */
35
34
  this.autoDestroy = autoDestroy;
36
- /** @type {boolean} */
37
35
  this.expired = false;
38
- /** @type {number} */
39
36
  this.elapsed = 0;
40
- /** @type {TimerEvent[]} */
41
37
  this.events = [];
42
- /** @type {Signal} */
43
38
  this.onComplete = new Signal();
44
- /** @type {number} */
45
39
  this.nextTick = 0;
46
- /** @type {number} */
47
40
  this.timeCap = 1000;
48
- /** @type {boolean} */
49
41
  this.paused = false;
50
- /** @type {boolean} */
51
42
  this._codePaused = false;
52
- /** @type {number} */
53
43
  this._started = 0;
54
- /** @type {number} */
55
44
  this._pauseStarted = 0;
56
- /** @type {number} */
57
45
  this._pauseTotal = 0;
58
- /** @type {number} */
59
46
  this._now = Date.now();
60
- /** @type {number} */
61
47
  this._len = 0;
62
- /** @type {number} */
63
48
  this._marked = 0;
64
- /** @type {number} */
65
49
  this._i = 0;
66
- /** @type {number} */
67
50
  this._diff = 0;
68
- /** @type {number} */
69
51
  this._newTick = 0;
70
52
  }
71
53
 
@@ -213,8 +213,8 @@ export class TweenManager {
213
213
  * @param {object} object - The object to check.
214
214
  * @returns {boolean} True if the object is being tweened, false otherwise.
215
215
  */
216
- isTweening(object: any) {
217
- return this._tweens.some((tween: Tween) => tween.target === object);
216
+ isTweening(object: unknown): boolean {
217
+ return (this._tweens as Tween[]).some((tween: Tween) => tween.target === object);
218
218
  }
219
219
 
220
220
  /**
@@ -4,21 +4,21 @@ import { DisplayObject } from './display_object.js';
4
4
  import { Image } from './image.js';
5
5
 
6
6
  export class BitmapText extends DisplayObject {
7
- declare type: any;
8
- pendingDestroy!: any;
9
- declare renderOrderID: any;
10
- textWidth!: any;
11
- textHeight!: any;
12
- _prevAnchor!: any;
13
- _glyphs!: any;
14
- _maxWidth!: any;
15
- _text!: any;
7
+ declare type: number;
8
+ pendingDestroy!: boolean;
9
+ declare renderOrderID: number;
10
+ textWidth!: number;
11
+ textHeight!: number;
12
+ _prevAnchor!: Point;
13
+ _glyphs!: Image[];
14
+ _maxWidth!: number;
15
+ _text!: string;
16
16
  _data!: any;
17
- _font!: any;
18
- _fontSize!: any;
19
- _align!: any;
20
- _tint!: any;
21
- dirty!: any;
17
+ _font!: string;
18
+ _fontSize!: number;
19
+ _align!: string;
20
+ _tint!: number;
21
+ dirty!: boolean;
22
22
  /**
23
23
  * Creates a new BitmapText instance.
24
24
  * @param {import('../core/game.js').Game} game - The game instance this bitmap text belongs to.
@@ -39,31 +39,20 @@ export class BitmapText extends DisplayObject {
39
39
  align: string = 'left'
40
40
  ) {
41
41
  super(game);
42
- /** @type {number} */
43
42
  this.type = BITMAP_TEXT;
44
43
  this.position.setTo(x, y);
45
- /** @type {number} */
46
44
  this.textWidth = 0;
47
- /** @type {number} */
48
45
  this.textHeight = 0;
49
- /** @type {Point} */
50
46
  this._prevAnchor = new Point();
51
47
  this._glyphs = [];
52
- /** @type {number} */
53
48
  this._maxWidth = 0;
54
- /** @type {string} */
55
49
  this._text = text.toString() || '';
56
50
  this._data = game.cache.getBitmapFont(font);
57
- /** @type {string} */
58
51
  this._font = font;
59
- /** @type {number} */
60
52
  this._fontSize = size;
61
- /** @type {string} */
62
53
  this._align = align;
63
- /** @type {number} */
64
54
  this._tint = 0xffffff;
65
55
  this.updateText();
66
- /** @type {boolean} */
67
56
  this.dirty = false;
68
57
  }
69
58
 
@@ -71,9 +60,9 @@ export class BitmapText extends DisplayObject {
71
60
  * Destroys this bitmap text and cleans up resources.
72
61
  */
73
62
  override destroy() {
74
- this._prevAnchor = null;
75
- this._glyphs = null;
76
- this._text = null;
63
+ this._prevAnchor = null!;
64
+ this._glyphs = null!;
65
+ this._text = null!;
77
66
  this._data = null;
78
67
  super.destroy();
79
68
  }
@@ -289,7 +278,6 @@ export class BitmapText extends DisplayObject {
289
278
  kept.push(this._glyphs[i]);
290
279
  }
291
280
  }
292
- /** @type {Image[]} */
293
281
  this._glyphs = [];
294
282
  this._glyphs = kept;
295
283
  this.updateText();
@@ -430,7 +418,7 @@ export class BitmapText extends DisplayObject {
430
418
  * Gets the text content of this bitmap text.
431
419
  * @returns {string} The current text content.
432
420
  */
433
- get text() {
421
+ get text(): string {
434
422
  return this._text;
435
423
  }
436
424
 
@@ -36,23 +36,23 @@ export class DisplayObject {
36
36
  _mask: import('./graphics.js').Graphics | null = null;
37
37
  _filters: object[] | null = null;
38
38
  _filterBlock: object | null = null;
39
- children!: any[];
39
+ children!: DisplayObject[];
40
40
  /** @type {boolean} */
41
41
  ignoreChildInput = false;
42
42
  name: string | null = null;
43
- data: Record<string, any> | null = null;
43
+ data: any = null;
44
44
  game!: import('../core/game.js').Game;
45
45
  type!: number;
46
46
  _cachedSprite!: any;
47
- rotationCache!: any;
48
- worldRotation!: any;
47
+ rotationCache!: number;
48
+ worldRotation!: number;
49
49
  transformCallback!: any;
50
50
  transformCallbackContext!: any;
51
- _width!: any;
52
- _height!: any;
53
- z!: any;
51
+ _width!: number;
52
+ _height!: number;
53
+ z!: number;
54
54
  events!: any;
55
- renderOrderID!: any;
55
+ renderOrderID!: number;
56
56
  /**
57
57
  * Creates a new DisplayObject instance.
58
58
  * @param {import('../core/game.js').Game} game - The game instance this display object belongs to.
@@ -263,7 +263,7 @@ export class DisplayObject {
263
263
  removeChildAt(index: number) {
264
264
  const child = this.getChildAt(index);
265
265
  if (child) {
266
- child.parent = undefined;
266
+ child.parent = null;
267
267
  this.children.splice(index, 1);
268
268
  }
269
269
  return child;
@@ -288,7 +288,7 @@ export class DisplayObject {
288
288
  const removed = this.children.splice(beginIndex, range);
289
289
  for (let i = 0; i < removed.length; i += 1) {
290
290
  const child = removed[i];
291
- child.parent = undefined;
291
+ child.parent = null;
292
292
  }
293
293
  return removed;
294
294
  }
@@ -509,8 +509,9 @@ export class DisplayObject {
509
509
  /**
510
510
  * Renders this display object using WebGL.
511
511
  * @param {object} renderSession - The WebGL rendering session.
512
+ * @param {import('../geom/matrix.js').Matrix | null} _matrix - The transform matrix to render with.
512
513
  */
513
- renderWebGL(renderSession: any) {
514
+ renderWebGL(renderSession: any, _matrix: Matrix | null = null) {
514
515
  if (!this.visible || this.alpha <= 0) {
515
516
  return;
516
517
  }
@@ -100,12 +100,13 @@ export class Group extends DisplayObject {
100
100
 
101
101
  /**
102
102
  * Adds a child to this group.
103
- * @param {DisplayObject} child - The child to add.
103
+ * @template T
104
+ * @param {T} child - The child to add.
104
105
  * @param {boolean} silent - Whether to dispatch events.
105
106
  * @param {number} index - The index to add the child at.
106
- * @returns {DisplayObject} The added child.
107
+ * @returns {T} The added child.
107
108
  */
108
- add(child: any, silent: boolean = false, index: number = -1) {
109
+ add<T extends DisplayObject>(child: T, silent: boolean = false, index: number = -1): T {
109
110
  if (child.parent === this) {
110
111
  return child;
111
112
  }
@@ -116,8 +117,9 @@ export class Group extends DisplayObject {
116
117
  this.addChildAt(child, index);
117
118
  this.updateZ();
118
119
  }
119
- if (this.inputEnableChildren && (!child.input || child.inputEnabled)) {
120
- child.inputEnabled = true;
120
+ const inputChild = child as T & { input?: unknown; inputEnabled?: boolean };
121
+ if (this.inputEnableChildren && (!inputChild.input || inputChild.inputEnabled)) {
122
+ inputChild.inputEnabled = true;
121
123
  }
122
124
  if (!silent && child.events) {
123
125
  child.events.onAddedToGroup$dispatch(child, this);