@caperjs/core 0.2.4 → 0.3.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 (172) hide show
  1. package/build/index.mjs +3 -1
  2. package/build/internal/discovery.mjs +1 -1
  3. package/build/internal/manifest.mjs +8 -3
  4. package/build/internal/validate.mjs +3 -1
  5. package/build/plugins/assetTypes.mjs +4 -4
  6. package/build/plugins/caperConfig.mjs +12 -5
  7. package/build/plugins/lists.mjs +29 -9
  8. package/cli/create.mjs +57 -6
  9. package/cli/create.test.mjs +36 -0
  10. package/cli/update.mjs +1 -1
  11. package/lib/{CaptionsPlugin-WPAcfAkx.js → CaptionsPlugin-BLbLl3WB.js} +3 -3
  12. package/lib/{CaptionsPlugin-WPAcfAkx.js.map → CaptionsPlugin-BLbLl3WB.js.map} +1 -1
  13. package/lib/{DataAdapter-DS-twowe.js → DataAdapter-aHSNM_26.js} +12 -7
  14. package/lib/DataAdapter-aHSNM_26.js.map +1 -0
  15. package/lib/{DebugRenderer-D1ryrRYx.js → DebugRenderer-8LjHtBzA.js} +2 -2
  16. package/lib/{DebugRenderer-D1ryrRYx.js.map → DebugRenderer-8LjHtBzA.js.map} +1 -1
  17. package/lib/{DevToolsPlugin-DH7zX7HU.js → DevToolsPlugin-Vrk6aOtS.js} +2 -2
  18. package/lib/{DevToolsPlugin-DH7zX7HU.js.map → DevToolsPlugin-Vrk6aOtS.js.map} +1 -1
  19. package/lib/{GSAPPlugin-BBtRjUqe.js → GSAPPlugin-Hm3F4zdg.js} +3 -3
  20. package/lib/{GSAPPlugin-BBtRjUqe.js.map → GSAPPlugin-Hm3F4zdg.js.map} +1 -1
  21. package/lib/{LayoutPlugin-Co6vcoV4.js → LayoutPlugin-Dpgeawfw.js} +4 -4
  22. package/lib/{LayoutPlugin-Co6vcoV4.js.map → LayoutPlugin-Dpgeawfw.js.map} +1 -1
  23. package/lib/{SpinePlugin-uN641Hmk.js → SpinePlugin-B08yAw1S.js} +690 -793
  24. package/lib/SpinePlugin-B08yAw1S.js.map +1 -0
  25. package/lib/{StatsPlugin-vZQRm6wh.js → StatsPlugin-D2Xa5j97.js} +5 -2
  26. package/lib/StatsPlugin-D2Xa5j97.js.map +1 -0
  27. package/lib/{VoiceOverPlugin-KlZdGj1G.js → VoiceOverPlugin-qtFlqpRn.js} +6 -5
  28. package/lib/VoiceOverPlugin-qtFlqpRn.js.map +1 -0
  29. package/lib/caper.mjs +23 -10
  30. package/lib/caper.mjs.map +1 -1
  31. package/lib/core/Application.d.ts +8 -3
  32. package/lib/core/Application.d.ts.map +1 -1
  33. package/lib/core/Application.test.d.ts +2 -0
  34. package/lib/core/Application.test.d.ts.map +1 -0
  35. package/lib/core/config.d.ts +6 -1
  36. package/lib/core/config.d.ts.map +1 -1
  37. package/lib/core/config.test.d.ts +2 -0
  38. package/lib/core/config.test.d.ts.map +1 -0
  39. package/lib/core/interfaces/IApplication.d.ts +6 -6
  40. package/lib/core/interfaces/IApplication.d.ts.map +1 -1
  41. package/lib/core/interfaces/ICoreSignals.d.ts +2 -1
  42. package/lib/core/interfaces/ICoreSignals.d.ts.map +1 -1
  43. package/lib/display/Camera.test.d.ts +2 -0
  44. package/lib/display/Camera.test.d.ts.map +1 -0
  45. package/lib/display/Entity.d.ts +2 -2
  46. package/lib/display/SceneTransition.test.d.ts +1 -0
  47. package/lib/display/SceneTransition.test.d.ts.map +1 -0
  48. package/lib/display/SpineAnimation.d.ts +3 -3
  49. package/lib/mixins/factory/methods.d.ts.map +1 -1
  50. package/lib/plugins/AssetsPlugin.d.ts.map +1 -1
  51. package/lib/plugins/AssetsPlugin.test.d.ts +2 -0
  52. package/lib/plugins/AssetsPlugin.test.d.ts.map +1 -0
  53. package/lib/plugins/DataAdapter.d.ts.map +1 -1
  54. package/lib/plugins/DataAdapter.test.d.ts +2 -0
  55. package/lib/plugins/DataAdapter.test.d.ts.map +1 -0
  56. package/lib/plugins/FullScreenPlugin.d.ts.map +1 -1
  57. package/lib/plugins/FullScreenPlugin.test.d.ts +2 -0
  58. package/lib/plugins/FullScreenPlugin.test.d.ts.map +1 -0
  59. package/lib/plugins/GSAPPlugin.d.ts +0 -2
  60. package/lib/plugins/GSAPPlugin.d.ts.map +1 -1
  61. package/lib/plugins/GSAPPlugin.test.d.ts +2 -0
  62. package/lib/plugins/GSAPPlugin.test.d.ts.map +1 -0
  63. package/lib/plugins/LookupPlugin.d.ts +6 -1
  64. package/lib/plugins/LookupPlugin.d.ts.map +1 -1
  65. package/lib/plugins/LookupPlugin.test.d.ts +2 -0
  66. package/lib/plugins/LookupPlugin.test.d.ts.map +1 -0
  67. package/lib/plugins/PopupManagerPlugin.d.ts.map +1 -1
  68. package/lib/plugins/PopupManagerPlugin.test.d.ts +1 -0
  69. package/lib/plugins/PopupManagerPlugin.test.d.ts.map +1 -0
  70. package/lib/plugins/SceneManagerPlugin.d.ts +1 -0
  71. package/lib/plugins/SceneManagerPlugin.d.ts.map +1 -1
  72. package/lib/plugins/SceneManagerPlugin.test.d.ts +2 -0
  73. package/lib/plugins/SceneManagerPlugin.test.d.ts.map +1 -0
  74. package/lib/plugins/StatsPlugin.d.ts +1 -0
  75. package/lib/plugins/StatsPlugin.d.ts.map +1 -1
  76. package/lib/plugins/WebEventsPlugin.d.ts.map +1 -1
  77. package/lib/plugins/actions/ActionsPlugin.test.d.ts +2 -0
  78. package/lib/plugins/actions/ActionsPlugin.test.d.ts.map +1 -0
  79. package/lib/plugins/audio/AudioChannel.d.ts.map +1 -1
  80. package/lib/plugins/audio/AudioManagerPlugin.d.ts.map +1 -1
  81. package/lib/plugins/audio/AudioManagerPlugin.test.d.ts +2 -0
  82. package/lib/plugins/audio/AudioManagerPlugin.test.d.ts.map +1 -0
  83. package/lib/plugins/audio/VoiceOverPlugin.d.ts.map +1 -1
  84. package/lib/plugins/captions/CaptionsPlugin.test.d.ts +2 -0
  85. package/lib/plugins/captions/CaptionsPlugin.test.d.ts.map +1 -0
  86. package/lib/plugins/focus/FocusManagerPlugin.d.ts.map +1 -1
  87. package/lib/plugins/focus/FocusManagerPlugin.test.d.ts +2 -0
  88. package/lib/plugins/focus/FocusManagerPlugin.test.d.ts.map +1 -0
  89. package/lib/plugins/input/AbstractControls.d.ts +5 -0
  90. package/lib/plugins/input/AbstractControls.d.ts.map +1 -1
  91. package/lib/plugins/input/Controls.test.d.ts +2 -0
  92. package/lib/plugins/input/Controls.test.d.ts.map +1 -0
  93. package/lib/plugins/input/keyboard/KeyboardContols.d.ts +5 -0
  94. package/lib/plugins/input/keyboard/KeyboardContols.d.ts.map +1 -1
  95. package/lib/plugins/input/touch/VirtualControls.d.ts +6 -0
  96. package/lib/plugins/input/touch/VirtualControls.d.ts.map +1 -1
  97. package/lib/plugins/input/touch/VirtualControls.test.d.ts +2 -0
  98. package/lib/plugins/input/touch/VirtualControls.test.d.ts.map +1 -0
  99. package/lib/{registries-BLrxALZ0.js → registries-m2vKTIih.js} +156 -101
  100. package/lib/registries-m2vKTIih.js.map +1 -0
  101. package/lib/store/Store.d.ts.map +1 -1
  102. package/lib/ui/Button.d.ts.map +1 -1
  103. package/lib/ui/UICanvas.d.ts +10 -1
  104. package/lib/ui/UICanvas.d.ts.map +1 -1
  105. package/lib/ui/UICanvas.test.d.ts +0 -1
  106. package/lib/ui/UICanvas.test.d.ts.map +1 -1
  107. package/lib/utils/color.d.ts.map +1 -1
  108. package/lib/utils/color.test.d.ts +2 -0
  109. package/lib/utils/color.test.d.ts.map +1 -0
  110. package/package.json +1 -1
  111. package/src/core/Application.test.ts +168 -0
  112. package/src/core/Application.ts +37 -27
  113. package/src/core/config.test.ts +79 -0
  114. package/src/core/config.ts +28 -6
  115. package/src/core/interfaces/IApplication.ts +6 -6
  116. package/src/core/interfaces/ICoreSignals.ts +2 -0
  117. package/src/display/Camera.test.ts +40 -0
  118. package/src/display/Camera.ts +3 -3
  119. package/src/display/Entity.ts +2 -2
  120. package/src/display/SceneTransition.test.ts +58 -0
  121. package/src/display/SceneTransition.ts +1 -1
  122. package/src/display/SpineAnimation.ts +4 -4
  123. package/src/mixins/factory/methods.ts +0 -1
  124. package/src/plugins/AssetsPlugin.test.ts +48 -0
  125. package/src/plugins/AssetsPlugin.ts +3 -1
  126. package/src/plugins/DataAdapter.test.ts +32 -0
  127. package/src/plugins/DataAdapter.ts +5 -1
  128. package/src/plugins/FullScreenPlugin.test.ts +48 -0
  129. package/src/plugins/FullScreenPlugin.ts +5 -1
  130. package/src/plugins/GSAPPlugin.test.ts +31 -0
  131. package/src/plugins/GSAPPlugin.ts +1 -4
  132. package/src/plugins/LookupPlugin.test.ts +42 -0
  133. package/src/plugins/LookupPlugin.ts +15 -3
  134. package/src/plugins/PopupManagerPlugin.test.ts +53 -0
  135. package/src/plugins/PopupManagerPlugin.ts +5 -3
  136. package/src/plugins/SceneManagerPlugin.test.ts +76 -0
  137. package/src/plugins/SceneManagerPlugin.ts +21 -11
  138. package/src/plugins/StatsPlugin.ts +8 -0
  139. package/src/plugins/WebEventsPlugin.test.ts +32 -0
  140. package/src/plugins/WebEventsPlugin.ts +2 -0
  141. package/src/plugins/actions/ActionsPlugin.test.ts +68 -0
  142. package/src/plugins/actions/ActionsPlugin.ts +5 -5
  143. package/src/plugins/audio/AudioChannel.test.ts +19 -0
  144. package/src/plugins/audio/AudioChannel.ts +8 -1
  145. package/src/plugins/audio/AudioManagerPlugin.test.ts +41 -0
  146. package/src/plugins/audio/AudioManagerPlugin.ts +3 -2
  147. package/src/plugins/audio/VoiceOverPlugin.ts +1 -0
  148. package/src/plugins/captions/CaptionsPlugin.test.ts +40 -0
  149. package/src/plugins/captions/CaptionsPlugin.ts +1 -1
  150. package/src/plugins/focus/FocusManagerPlugin.test.ts +71 -0
  151. package/src/plugins/focus/FocusManagerPlugin.ts +7 -0
  152. package/src/plugins/input/AbstractControls.ts +6 -0
  153. package/src/plugins/input/Controls.test.ts +149 -0
  154. package/src/plugins/input/keyboard/KeyboardContols.ts +29 -5
  155. package/src/plugins/input/touch/VirtualControls.test.ts +38 -0
  156. package/src/plugins/input/touch/VirtualControls.ts +44 -10
  157. package/src/plugins/spine/SpinePlugin.ts +2 -2
  158. package/src/store/Store.test.ts +15 -0
  159. package/src/store/Store.ts +4 -1
  160. package/src/ui/Button.test.ts +12 -0
  161. package/src/ui/Button.ts +1 -0
  162. package/src/ui/UICanvas.test.ts +109 -6
  163. package/src/ui/UICanvas.ts +41 -3
  164. package/src/utils/color.test.ts +16 -0
  165. package/src/utils/color.ts +2 -1
  166. package/src/utils/platform.ts +1 -1
  167. package/src/version.ts +1 -1
  168. package/lib/DataAdapter-DS-twowe.js.map +0 -1
  169. package/lib/SpinePlugin-uN641Hmk.js.map +0 -1
  170. package/lib/StatsPlugin-vZQRm6wh.js.map +0 -1
  171. package/lib/VoiceOverPlugin-KlZdGj1G.js.map +0 -1
  172. package/lib/registries-BLrxALZ0.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Store.d.ts","sourceRoot":"","sources":["../../src/store/Store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,gBAAgB,EAAU,MAAM,UAAU,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,KAAK,UAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAE9C;;GAEG;AACH,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IAC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,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI;IAK1D,oBAAoB,CAAC,UAAU,EAAE,MAAM;IAKvC,UAAU,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY;IAY5D;;OAEG;IACH,SAAS,CAAC,iBAAiB;IAuB3B;;OAEG;IACH,SAAS,CAAC,gBAAgB;IAgB1B;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,CAAC,EAAE,cAAc;IA4B7C;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,cAAc;IAY3C,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,cAAc;IAwBxC;;OAEG;IACH,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,YAAY,GAAG,qBAAqB;IAaxE,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,sBAAsB;CAO/B"}
@@ -115,7 +115,7 @@ export declare class UICanvas extends _UICanvas {
115
115
  /**
116
116
  * Sets the index of the child in the container
117
117
  */
118
- setChildIndex: <U extends PIXIContainer>(child: U, index: number) => void;
118
+ setChildIndex: <U extends PIXIContainer>(_child: U, _index: number) => void;
119
119
  /**
120
120
  * Gets the index of a child in the container
121
121
  */
@@ -154,6 +154,15 @@ export declare class UICanvas extends _UICanvas {
154
154
  private _anchorRect;
155
155
  addElement<U extends PIXIContainer = PIXIContainer>(child: PIXIContainer, settings?: Partial<UICanvasChildProps>): U;
156
156
  removeElement(child: PIXIContainer): PIXIContainer;
157
+ /**
158
+ * Reorders an element within its region container, changing its position in
159
+ * the flex layout and paint order.
160
+ */
161
+ reorderElement<U extends PIXIContainer>(child: U, index: number): U;
162
+ /** Moves an element to the last index (painted/laid-out last) within its region. */
163
+ bringToFront<U extends PIXIContainer>(child: U): U;
164
+ /** Moves an element to the first index (painted/laid-out first) within its region. */
165
+ sendToBack<U extends PIXIContainer>(child: U): U;
157
166
  private _childAdded;
158
167
  private _childRemoved;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cAAc,GAAG,IAAI;IAY5F,wEAAwE;IACjE,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAUhD,OAAO,CAAC,eAAe;IAOvB;;mEAE+D;IAC/D,OAAO,CAAC,WAAW;IAeZ,UAAU,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EACvD,KAAK,EAAE,aAAa,EACpB,QAAQ,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACrC,CAAC;IA2BG,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa;IAkBzD;;;OAGG;IACI,cAAc,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;IAc1E,oFAAoF;IAC7E,YAAY,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;IAYzD,sFAAsF;IAC/E,UAAU,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;IAIvD,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,MAAM;IAKd,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,EAkBvB;IAED,OAAO,CAAC,SAAS;CA8HlB"}
@@ -1,2 +1 @@
1
- export {};
2
1
  //# sourceMappingURL=UICanvas.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UICanvas.test.d.ts","sourceRoot":"","sources":["../../src/ui/UICanvas.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"UICanvas.test.d.ts","sourceRoot":"","sources":["../../src/ui/UICanvas.test.ts"],"names":[],"mappings":"AAuBA,OAAO,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG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AE,KAAK,EAAE,MAAM,GAAG,KAAK;IAI7D;;;;;;OAMG;WACW,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAMnE;;;OAGG;IACI,KAAK,IAAI,MAAM;IAIf,WAAW,IAAI,MAAM;IAI5B;;;OAGG;IACI,OAAO,IAAI,MAAM,EAAE;CAG3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=color.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.test.d.ts","sourceRoot":"","sources":["../../src/utils/color.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caperjs/core",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "title": "Caper",
5
5
  "description": "An opinionated HTML game framework built on PixiJS v8",
6
6
  "bin": {
@@ -0,0 +1,168 @@
1
+ import { gsap } from 'gsap';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+
4
+ import { Application } from './Application';
5
+
6
+ /**
7
+ * `pause`/`resume`/`destroy` are plain instance methods that only touch a
8
+ * handful of fields (`_pauseConfig`, `audio`, `ticker`, `timers`, `_store`,
9
+ * `_plugins`, the pause/resume signals). Rather than boot a real Application
10
+ * (Pixi renderer, full plugin registry, asset pipeline), build a bare object
11
+ * on `Application.prototype` and populate just those fields — the real
12
+ * methods run unmodified against it.
13
+ */
14
+ function makeApp() {
15
+ const app = Object.create(Application.prototype) as any;
16
+ app._paused = false;
17
+ app._pauseConfig = {};
18
+ app._audioManager = { pause: vi.fn(), resume: vi.fn(), paused: false };
19
+ app._timerPlugin = { pauseAllTimers: vi.fn(), resumeAllTimers: vi.fn() };
20
+ app.ticker = { stop: vi.fn(), start: vi.fn(), started: true };
21
+ app.onPause = { emit: vi.fn() };
22
+ app.onResume = { emit: vi.fn() };
23
+ app._plugins = new Map();
24
+ return app;
25
+ }
26
+
27
+ describe('Application#pause / #resume', () => {
28
+ it('pause() with no args pauses everything (audio, animations, ticker, timers)', () => {
29
+ const app = makeApp();
30
+ const gsapPause = vi.spyOn(gsap.globalTimeline, 'pause');
31
+
32
+ app.pause();
33
+
34
+ expect(app._audioManager.pause).toHaveBeenCalledTimes(1);
35
+ expect(gsapPause).toHaveBeenCalledTimes(1);
36
+ expect(app.ticker.stop).toHaveBeenCalledTimes(1);
37
+ expect(app._timerPlugin.pauseAllTimers).toHaveBeenCalledTimes(1);
38
+ expect(app.paused).toBe(true);
39
+
40
+ gsapPause.mockRestore();
41
+ });
42
+
43
+ it('pause({ pauseAudio: true }) only pauses audio', () => {
44
+ const app = makeApp();
45
+ const gsapPause = vi.spyOn(gsap.globalTimeline, 'pause');
46
+
47
+ app.pause({ pauseAudio: true });
48
+
49
+ expect(app._audioManager.pause).toHaveBeenCalledTimes(1);
50
+ expect(gsapPause).not.toHaveBeenCalled();
51
+ expect(app.ticker.stop).not.toHaveBeenCalled();
52
+ expect(app._timerPlugin.pauseAllTimers).not.toHaveBeenCalled();
53
+
54
+ gsapPause.mockRestore();
55
+ });
56
+
57
+ it('resume() undoes exactly what pause() paused', () => {
58
+ const app = makeApp();
59
+ const gsapPause = vi.spyOn(gsap.globalTimeline, 'pause');
60
+ const gsapResume = vi.spyOn(gsap.globalTimeline, 'resume');
61
+ vi.spyOn(gsap.globalTimeline, 'paused').mockReturnValue(true);
62
+ app._audioManager.paused = true;
63
+ app.ticker.started = false;
64
+
65
+ app.pause();
66
+ app.resume();
67
+
68
+ expect(app._audioManager.resume).toHaveBeenCalledTimes(1);
69
+ expect(gsapResume).toHaveBeenCalledTimes(1);
70
+ expect(app.ticker.start).toHaveBeenCalledTimes(1);
71
+ expect(app._timerPlugin.resumeAllTimers).toHaveBeenCalledTimes(1);
72
+ expect(app.paused).toBe(false);
73
+
74
+ gsapPause.mockRestore();
75
+ gsapResume.mockRestore();
76
+ vi.restoreAllMocks();
77
+ });
78
+
79
+ it('resume() after pause({ pauseAudio: true }) only resumes audio', () => {
80
+ const app = makeApp();
81
+ app._audioManager.paused = true;
82
+
83
+ app.pause({ pauseAudio: true });
84
+ app.resume();
85
+
86
+ expect(app._audioManager.resume).toHaveBeenCalledTimes(1);
87
+ expect(app.ticker.start).not.toHaveBeenCalled();
88
+ expect(app._timerPlugin.resumeAllTimers).not.toHaveBeenCalled();
89
+ });
90
+ });
91
+
92
+ /**
93
+ * Same bare-prototype trick as `makeApp`, but populated for the private
94
+ * `_resize` path: a fake resizer, a settable `_center`, and stubbed scene /
95
+ * popup managers so the `views` getter has something to walk.
96
+ */
97
+ function makeResizeApp() {
98
+ const app = Object.create(Application.prototype) as any;
99
+ app.config = {};
100
+ app._plugins = new Map();
101
+ app._center = {
102
+ x: 0,
103
+ y: 0,
104
+ set(x: number, y: number) {
105
+ this.x = x;
106
+ this.y = y;
107
+ },
108
+ };
109
+ app._sceneManager = { view: makeView(), splash: {}, transition: null };
110
+ app._popupManager = { view: makeView() };
111
+ app._resizer = {
112
+ resize: () => Promise.resolve({ width: 100, height: 50 }),
113
+ size: { width: 100, height: 50 },
114
+ };
115
+ app.onResize = { emit: vi.fn() };
116
+ return app;
117
+ }
118
+
119
+ function makeView() {
120
+ return { position: { set: vi.fn() } };
121
+ }
122
+
123
+ describe('Application#views', () => {
124
+ it('re-centers a view created after the first resize', async () => {
125
+ const app = makeResizeApp();
126
+ await app._resize();
127
+
128
+ // e.g. a transition view built lazily on the first scene change, i.e.
129
+ // after the app has already resized once.
130
+ const late = makeView();
131
+ app._sceneManager.transition = late;
132
+
133
+ await app._resize();
134
+
135
+ expect(late.position.set).toHaveBeenCalledWith(50, 25);
136
+ });
137
+ });
138
+
139
+ describe('Application#isActionActive', () => {
140
+ function makeActionApp(held: string[]) {
141
+ const app = Object.create(Application.prototype) as any;
142
+ app._plugins = new Map();
143
+ app._input = { isActionActive: (action: string) => held.includes(action) };
144
+ // Both actions are *declared*; only what the input plugin reports counts.
145
+ app._actionsPlugin = { getActions: () => ({ jump: {}, run: {} }) };
146
+ return app;
147
+ }
148
+
149
+ it('returns false for a declared action that is not currently held', () => {
150
+ expect(makeActionApp([]).isActionActive('jump')).toBe(false);
151
+ });
152
+
153
+ it('returns true while the input plugin reports the action held', () => {
154
+ expect(makeActionApp(['jump']).isActionActive('jump')).toBe(true);
155
+ });
156
+ });
157
+
158
+ describe('Application#destroy', () => {
159
+ it('does not throw when the app was configured without a store (useStore: false)', () => {
160
+ const app = makeApp();
161
+ // No `_store` set — mirrors an app booted with `useStore: false`.
162
+ vi.spyOn(Object.getPrototypeOf(Application.prototype), 'destroy').mockImplementation(() => {});
163
+
164
+ expect(() => app.destroy()).not.toThrow();
165
+
166
+ vi.restoreAllMocks();
167
+ });
168
+ });
@@ -132,6 +132,13 @@ const defaultApplicationOptions: Partial<IApplicationOptions> = {
132
132
  };
133
133
 
134
134
  const defaultPauseConfig: PauseConfig = {
135
+ pauseAudio: true,
136
+ pauseAnimations: true,
137
+ pauseTicker: true,
138
+ pauseTimers: true,
139
+ };
140
+
141
+ const emptyPauseConfig: PauseConfig = {
135
142
  pauseAudio: false,
136
143
  pauseAnimations: false,
137
144
  pauseTicker: false,
@@ -206,7 +213,6 @@ export class Application extends PIXIPApplication implements IApplication {
206
213
  protected _voiceoverPlugin: IVoiceOverPlugin;
207
214
  protected _captionsPlugin: ICaptionsPlugin;
208
215
  protected _actions: ActionSignal;
209
- protected _isBooting: boolean = true;
210
216
 
211
217
  protected _env: Record<string, string> = (import.meta as any).env || {};
212
218
  protected _makeFactory: typeof defaultFactoryMethods;
@@ -257,21 +263,21 @@ export class Application extends PIXIPApplication implements IApplication {
257
263
 
258
264
  public pause(config?: Partial<PauseConfig>) {
259
265
  this._paused = true;
260
- this._pauseConfig = { ...defaultPauseConfig, ...config };
261
- if (config?.pauseAudio) {
266
+ this._pauseConfig = { ...(config ? emptyPauseConfig : defaultPauseConfig), ...config };
267
+ if (this._pauseConfig.pauseAudio) {
262
268
  this.audio.pause();
263
269
  }
264
- if (config?.pauseAnimations) {
270
+ if (this._pauseConfig.pauseAnimations) {
265
271
  gsap?.globalTimeline?.pause();
266
272
  }
267
- if (config?.pauseTicker) {
273
+ if (this._pauseConfig.pauseTicker) {
268
274
  this.ticker.stop();
269
275
  }
270
- if (config?.pauseTimers) {
276
+ if (this._pauseConfig.pauseTimers) {
271
277
  this.timers.pauseAllTimers();
272
278
  }
273
- if (config?.pauseOther) {
274
- config.pauseOther.forEach((thing) => {
279
+ if (this._pauseConfig.pauseOther) {
280
+ this._pauseConfig.pauseOther.forEach((thing) => {
275
281
  if (typeof thing?.pause === 'function') {
276
282
  thing.pause();
277
283
  }
@@ -639,23 +645,24 @@ export class Application extends PIXIPApplication implements IApplication {
639
645
  }
640
646
 
641
647
  // views
642
- protected _views: any[];
643
-
648
+ /**
649
+ * Computed fresh on every access — the splash, transition and captions views
650
+ * are created lazily, so a memoized list would permanently miss anything
651
+ * built after the first resize. Only read at resize cadence.
652
+ */
644
653
  public get views(): any[] {
645
- if (!this._views) {
646
- this._views = [this.scenes.view, this.popups.view];
647
- if (this.scenes.splash.view) {
648
- this._views.push(this.scenes.splash.view);
649
- }
650
- if (this.scenes.transition) {
651
- this._views.push(this.scenes.transition);
652
- }
653
- if (this.captions?.view) {
654
- this._views.push(this.captions.view);
655
- }
654
+ const views: any[] = [this.scenes.view, this.popups.view];
655
+ if (this.scenes.splash.view) {
656
+ views.push(this.scenes.splash.view);
657
+ }
658
+ if (this.scenes.transition) {
659
+ views.push(this.scenes.transition);
660
+ }
661
+ if (this.captions?.view) {
662
+ views.push(this.captions.view);
656
663
  }
657
664
 
658
- return this._views;
665
+ return views;
659
666
  }
660
667
 
661
668
  public static getInstance<T extends App = App>(): T {
@@ -676,7 +683,7 @@ export class Application extends PIXIPApplication implements IApplication {
676
683
  this._plugins.forEach((plugin) => {
677
684
  plugin.destroy();
678
685
  });
679
- this.store.destroy();
686
+ this.store?.destroy();
680
687
  super.destroy(rendererDestroyOptions, options);
681
688
  }
682
689
 
@@ -754,7 +761,6 @@ export class Application extends PIXIPApplication implements IApplication {
754
761
  this.config.container.classList.add('loaded');
755
762
  }
756
763
 
757
- this._isBooting = false;
758
764
  // return the Application instance to the create method, if needed
759
765
  return Application.instance as unknown as App;
760
766
  }
@@ -899,7 +905,9 @@ export class Application extends PIXIPApplication implements IApplication {
899
905
  }
900
906
 
901
907
  /**
902
- * Checks if an action is currently active
908
+ * Checks if an action is currently active, i.e. held right now on keyboard
909
+ * or touch controls. Whether an action is merely *declared* is a separate
910
+ * question — use `app.actionsPlugin.getActions()` for that.
903
911
  * @param {A} action - The action to check
904
912
  * @returns {boolean} True if the action is active, false otherwise
905
913
  * @example
@@ -909,7 +917,7 @@ export class Application extends PIXIPApplication implements IApplication {
909
917
  * }
910
918
  */
911
919
  public isActionActive(action: AppActions): boolean {
912
- return this.actionsPlugin.getActions()[action as string] !== undefined;
920
+ return this.input.isActionActive(action as string);
913
921
  }
914
922
 
915
923
  /**
@@ -1032,7 +1040,9 @@ export class Application extends PIXIPApplication implements IApplication {
1032
1040
  // bootstrap loudly on missing required plugins or dependency cycles —
1033
1041
  // see Plugin docs for the rationale (we want the config file to be
1034
1042
  // the single source of truth for active plugins, not auto-resolve).
1035
- const sorted = sortPluginsByRequires(this.plugins);
1043
+ // The already-registered built-ins are passed along so `requires: ['audio']`
1044
+ // and friends resolve instead of failing bootstrap.
1045
+ const sorted = sortPluginsByRequires(this.plugins, new Set(this._plugins.keys()));
1036
1046
 
1037
1047
  for (const p of sorted) {
1038
1048
  if (p.autoLoad) {
@@ -0,0 +1,79 @@
1
+ import { afterEach, describe, expect, it } from 'vitest';
2
+
3
+ import { generatePluginList, sortPluginsByRequires } from './config';
4
+
5
+ // `generatePluginList` reads `globalThis.Caper.get('pluginsList')` — normally
6
+ // populated by the caper-runtime virtual module the Vite plugin injects. In
7
+ // hand-written entries or unit tests, `Caper` doesn't exist at all, so the
8
+ // bare `Caper.get(...)` call must not throw.
9
+ describe('generatePluginList', () => {
10
+ afterEach(() => {
11
+ delete (globalThis as unknown as { Caper?: unknown }).Caper;
12
+ });
13
+
14
+ it('resolves to [] when there is no runtime-managed Caper global and no plugins configured', async () => {
15
+ expect((globalThis as unknown as { Caper?: unknown }).Caper).toBeUndefined();
16
+ await expect(generatePluginList([])).resolves.toEqual([]);
17
+ });
18
+
19
+ it('still resolves plugins when the Caper runtime global IS present', async () => {
20
+ (globalThis as unknown as { Caper: { get: (key: string) => unknown } }).Caper = {
21
+ get: (key: string) =>
22
+ key === 'pluginsList'
23
+ ? [{ id: 'audio', path: 'audio', module: () => Promise.resolve({}), requires: [] }]
24
+ : undefined,
25
+ };
26
+
27
+ const result = await generatePluginList(['audio' as never]);
28
+ expect(result).toEqual([
29
+ { id: 'audio', path: 'audio', module: expect.any(Function), requires: [], options: undefined, autoLoad: true },
30
+ ]);
31
+ });
32
+
33
+ // A bare string entry must match on the whole id. Indexing `plugin[0]` on a
34
+ // string yields its first character, so a discovered plugin whose id is that
35
+ // single character used to shadow the real match.
36
+ it('does not match a plugin whose id equals the first character of a string entry', async () => {
37
+ (globalThis as unknown as { Caper: { get: (key: string) => unknown } }).Caper = {
38
+ get: (key: string) =>
39
+ key === 'pluginsList'
40
+ ? [
41
+ { id: 'a', path: 'a', module: () => Promise.resolve({}), requires: [] },
42
+ { id: 'audio', path: 'audio', module: () => Promise.resolve({}), requires: [] },
43
+ ]
44
+ : undefined,
45
+ };
46
+
47
+ const result = await generatePluginList(['audio' as never]);
48
+ expect(result.map((p) => p.id)).toEqual(['audio']);
49
+ });
50
+ });
51
+
52
+ // Default plugins (`audio`, `input`, ...) are registered on the app before the
53
+ // config-listed ones, so they never appear in the list handed to the sorter.
54
+ // A `requires: ['audio']` must therefore be satisfiable from the already
55
+ // registered set rather than blowing up bootstrap.
56
+ describe('sortPluginsByRequires', () => {
57
+ const item = (id: string, requires: string[] = []) => ({
58
+ id,
59
+ path: id,
60
+ module: () => Promise.resolve({}),
61
+ requires,
62
+ options: undefined,
63
+ autoLoad: true,
64
+ });
65
+
66
+ it('treats a required id that is already registered on the app as satisfied', () => {
67
+ const items = [item('a', ['audio']), item('b')];
68
+ const registered = new Set(['audio']);
69
+
70
+ expect(() => sortPluginsByRequires(items, registered)).not.toThrow();
71
+ expect(sortPluginsByRequires(items, registered).map((i) => i.id)).toEqual(['a', 'b']);
72
+ });
73
+
74
+ it('still throws for a required id that is neither configured nor registered', () => {
75
+ const items = [item('a', ['nonsense']), item('b')];
76
+
77
+ expect(() => sortPluginsByRequires(items, new Set(['audio']))).toThrow(/nonsense/);
78
+ });
79
+ });
@@ -13,11 +13,18 @@ export type PluginConfig = PluginId | [PluginId, { autoLoad?: boolean; options?:
13
13
  * "storage adapter" — unified into a single list.
14
14
  */
15
15
  export async function generatePluginList<T extends IPlugin = IPlugin>(plugins: PluginConfig[]): Promise<ImportList<T>> {
16
- const pluginsList: PluginListItem[] = Caper.get('pluginsList') || [];
16
+ const pluginsList: PluginListItem[] =
17
+ ((globalThis as unknown as { Caper?: { get?: (key: string) => unknown } }).Caper?.get?.(
18
+ 'pluginsList',
19
+ ) as PluginListItem[] | undefined) ?? [];
17
20
 
18
21
  return plugins
19
22
  .map((plugin) => {
20
- const p = pluginsList.find((p) => p.id === plugin || p.id === plugin[0]);
23
+ // A bare string entry matches on the whole id indexing `[0]` into it
24
+ // would compare against its first character. Only tuple entries carry
25
+ // the id in slot 0.
26
+ const id = Array.isArray(plugin) ? plugin[0] : plugin;
27
+ const p = pluginsList.find((p) => p.id === id);
21
28
  if (!p) {
22
29
  Logger.warn(`Plugin ${plugin} not found`);
23
30
  return null;
@@ -53,24 +60,38 @@ export function defineConfig(config: Partial<AppConfig>) {
53
60
  * auto-register the missing dep — the config file is the single source
54
61
  * of truth for what plugins run, and silently inserting transitive
55
62
  * deps would make it stop being trustworthy.
63
+ * - If `B.requires = ['A']` and A is a built-in plugin already registered
64
+ * on the app (default plugins register before config plugins), the
65
+ * requirement is already satisfied — it is skipped rather than sorted,
66
+ * since A is not part of `items` and cannot be ordered against it. Pass
67
+ * the registered ids via `registeredIds`.
56
68
  * - If a cycle exists (A→B→A), throws with the cycle path printed.
57
69
  *
58
70
  * Stable order: items with no dependencies preserve their original
59
71
  * relative order from `caper.config.ts`. Only items participating in a
60
72
  * `requires` chain get reordered.
61
73
  */
62
- export function sortPluginsByRequires<T extends ImportList<IPlugin>[number]>(items: T[]): T[] {
74
+ export function sortPluginsByRequires<T extends ImportList<IPlugin>[number]>(
75
+ items: T[],
76
+ registeredIds?: ReadonlySet<string>,
77
+ ): T[] {
63
78
  if (items.length < 2) return items.slice();
64
79
 
65
80
  const byId = new Map<string, T>();
66
81
  for (const it of items) byId.set(it.id, it);
67
82
 
83
+ // Requirements pointing at plugins that aren't in `items` but are already
84
+ // registered on the app (the built-ins) are satisfied — drop them so they
85
+ // neither throw below nor contribute to the topo-sort.
86
+ const requiresOf = (it: T): string[] =>
87
+ (it.requires ?? []).filter((req) => byId.has(req) || !registeredIds?.has(req));
88
+
68
89
  // Verify every required id is present in the active set. Collect ALL
69
90
  // missing deps before throwing so the user can fix them in one pass
70
91
  // rather than play whack-a-mole.
71
92
  const missing: Array<{ from: string; required: string }> = [];
72
93
  for (const it of items) {
73
- for (const req of it.requires ?? []) {
94
+ for (const req of requiresOf(it)) {
74
95
  if (!byId.has(req)) missing.push({ from: it.id, required: req });
75
96
  }
76
97
  }
@@ -91,8 +112,9 @@ export function sortPluginsByRequires<T extends ImportList<IPlugin>[number]>(ite
91
112
  const inDegree = new Map<string, number>();
92
113
  const dependents = new Map<string, string[]>(); // id → [ids that require it]
93
114
  for (const it of items) {
94
- inDegree.set(it.id, (it.requires ?? []).length);
95
- for (const req of it.requires ?? []) {
115
+ const requires = requiresOf(it);
116
+ inDegree.set(it.id, requires.length);
117
+ for (const req of requires) {
96
118
  if (!dependents.has(req)) dependents.set(req, []);
97
119
  dependents.get(req)!.push(it.id);
98
120
  }
@@ -305,25 +305,25 @@ export interface IApplication extends PIXIPApplication {
305
305
  * A signal that emits when the application is paused.
306
306
  * @example
307
307
  * ```typescript
308
- * app.onPause.connect(() => {
309
- * console.log('Application paused');
308
+ * app.onPause.connect((config) => {
309
+ * console.log('Application paused', config);
310
310
  * // Stop game-specific timers or animations not handled by app.pause()
311
311
  * });
312
312
  * ```
313
313
  */
314
- onPause: Signal<() => void>;
314
+ onPause: Signal<(config: PauseConfig) => void>;
315
315
 
316
316
  /**
317
317
  * A signal that emits when the application is resumed from a paused state.
318
318
  * @example
319
319
  * ```typescript
320
- * app.onResume.connect(() => {
321
- * console.log('Application resumed');
320
+ * app.onResume.connect((config) => {
321
+ * console.log('Application resumed', config);
322
322
  * // Restart game-specific timers or animations
323
323
  * });
324
324
  * ```
325
325
  */
326
- onResume: Signal<() => void>;
326
+ onResume: Signal<(config: PauseConfig) => void>;
327
327
 
328
328
  /**
329
329
  * Pauses the application.
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ ActionDetail,
2
3
  BreakpointChangeDetail,
3
4
  ChannelMutedDetail,
4
5
  ChannelVolumeDetail,
@@ -42,6 +43,7 @@ export interface ICoreSignals {
42
43
  onLocaleChanged: Signal<(locale: string) => void>;
43
44
  // actionsPlugin;
44
45
  onActionContextChanged: Signal<(context: string | ActionContext) => void>;
46
+ onActionDispatched: Signal<(detail: ActionDetail) => void>;
45
47
  // InputManager;
46
48
  onGamepadConnected: Signal<(gamepad: Gamepad) => void>;
47
49
  onGamepadDisconnected: Signal<(gamepad: Gamepad) => void>;
@@ -0,0 +1,40 @@
1
+ import { Container as PixiContainer } from 'pixi.js';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+
4
+ // Camera transitively imports Application → Pixi display graph. Stub it.
5
+ vi.mock('../core', () => ({
6
+ coreFunctionRegistry: {},
7
+ coreSignalRegistry: {},
8
+ }));
9
+
10
+ const mocks = vi.hoisted(() => ({
11
+ app: {
12
+ size: { width: 800, height: 400 },
13
+ },
14
+ }));
15
+
16
+ vi.mock('../core/Application', () => ({
17
+ Application: { getInstance: () => mocks.app },
18
+ }));
19
+
20
+ import { Camera } from './Camera';
21
+
22
+ describe('Camera targetScale', () => {
23
+ it('reflects the target scale, not the target pivot', () => {
24
+ const camera = new Camera({ container: new PixiContainer(), viewportWidth: 200, viewportHeight: 100 });
25
+
26
+ camera.zoom(3);
27
+
28
+ expect(camera.targetScale.x).toBe(3);
29
+ expect(camera.targetScale.y).toBe(3);
30
+ expect(camera.targetScale).not.toBe(camera.targetPivot);
31
+ });
32
+ });
33
+
34
+ describe('Camera viewportHeight default', () => {
35
+ it('falls back to app.size.height, not app.size.width', () => {
36
+ const camera = new Camera({ container: new PixiContainer() });
37
+
38
+ expect(camera.viewportHeight).toBe(mocks.app.size.height);
39
+ });
40
+ });