@auraindustry/aurajs 0.0.7 → 0.1.1

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 (334) hide show
  1. package/README.md +98 -2
  2. package/benchmarks/perf-thresholds.json +54 -0
  3. package/package.json +4 -7
  4. package/src/asset-pack.mjs +8 -1
  5. package/src/authored-project.mjs +1449 -0
  6. package/src/authored-runtime.mjs +2016 -0
  7. package/src/authoring/avatar-animation-graph.mjs +648 -0
  8. package/src/bin-integrity.mjs +272 -0
  9. package/src/build-contract/assets.mjs +130 -0
  10. package/src/build-contract/capabilities.mjs +116 -0
  11. package/src/build-contract/constants.mjs +6 -0
  12. package/src/build-contract/helpers.mjs +44 -0
  13. package/src/build-contract/web-templates.mjs +5993 -0
  14. package/src/build-contract.mjs +27 -2910
  15. package/src/bundler.mjs +188 -55
  16. package/src/cli.mjs +4840 -1512
  17. package/src/commands/project-authoring.mjs +454 -0
  18. package/src/config.mjs +44 -0
  19. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +3309 -0
  20. package/src/conformance/cases/core-runtime-cases.mjs +1431 -0
  21. package/src/conformance/cases/index.mjs +11 -0
  22. package/src/conformance/cases/scene3d-and-media-cases.mjs +2094 -0
  23. package/src/conformance/cases/systems-and-gameplay-cases.mjs +1776 -0
  24. package/src/conformance/shared.mjs +27 -0
  25. package/src/conformance-runner.mjs +25 -13
  26. package/src/conformance.mjs +619 -4020
  27. package/src/cutscene.mjs +362 -5
  28. package/src/dev-cli-action.mjs +249 -0
  29. package/src/dev-cli-inspect.mjs +92 -0
  30. package/src/dev-cli-state.mjs +80 -0
  31. package/src/external-asset-cache.mjs +587 -0
  32. package/src/external-asset-policy.mjs +217 -0
  33. package/src/external-package-surface.mjs +206 -0
  34. package/src/game-action-runtime.mjs +869 -0
  35. package/src/game-state-runtime.mjs +206 -6
  36. package/src/headless-action.mjs +186 -0
  37. package/src/headless-test/runtime-animation.mjs +1173 -0
  38. package/src/headless-test/runtime-coordinator.mjs +1514 -0
  39. package/src/headless-test/runtime-primitives.mjs +320 -0
  40. package/src/headless-test/runtime-world.mjs +2253 -0
  41. package/src/headless-test.mjs +392 -4298
  42. package/src/host-binary.mjs +342 -14
  43. package/src/icon-discovery.mjs +64 -0
  44. package/src/make-catalog.mjs +109 -0
  45. package/src/make.mjs +197 -0
  46. package/src/package-integrity.mjs +586 -0
  47. package/src/perf-benchmark.mjs +353 -0
  48. package/src/postinstall.mjs +5 -5
  49. package/src/prefabs/index.mjs +34 -0
  50. package/src/prefabs/scene-serialization.mjs +184 -0
  51. package/src/project-importer.mjs +620 -0
  52. package/src/project-registry.mjs +24 -0
  53. package/src/publish-command.mjs +195 -0
  54. package/src/publish-env-example.mjs +83 -0
  55. package/src/publish-validation.mjs +708 -0
  56. package/src/retro/assets/compile.mjs +232 -0
  57. package/src/retro/backend-gba/authoring.mjs +1029 -0
  58. package/src/retro/backend-gba/rom.mjs +363 -0
  59. package/src/retro/backend-gbc/rom.mjs +85 -0
  60. package/src/retro/build.mjs +278 -0
  61. package/src/retro/cli/commands.mjs +292 -0
  62. package/src/retro/cli/templates.mjs +84 -0
  63. package/src/retro/diagnostics/catalog.mjs +110 -0
  64. package/src/retro/diagnostics/emit.mjs +72 -0
  65. package/src/retro/emulator/case-overlay.mjs +64 -0
  66. package/src/retro/emulator/discovery.mjs +158 -0
  67. package/src/retro/emulator/macos-case-overlay.swift +220 -0
  68. package/src/retro/emulator/profiles.mjs +146 -0
  69. package/src/retro/emulator/runner.mjs +289 -0
  70. package/src/retro/frontend/load-project.mjs +98 -0
  71. package/src/retro/index.mjs +30 -0
  72. package/src/retro/ir/build-ir.mjs +108 -0
  73. package/src/retro/runtime-gba/contract.mjs +151 -0
  74. package/src/retro/runtime-gbc/contract.mjs +117 -0
  75. package/src/retro/shared/span.mjs +26 -0
  76. package/src/retro/shared/targets.mjs +64 -0
  77. package/src/retro/validator/check-project.mjs +114 -0
  78. package/src/runtime-hotspot-audit.mjs +707 -0
  79. package/src/scaffold/config.mjs +1000 -0
  80. package/src/scaffold/fs.mjs +56 -0
  81. package/src/scaffold/layout.mjs +318 -0
  82. package/src/scaffold/project-docs.mjs +439 -0
  83. package/src/scaffold.mjs +93 -596
  84. package/src/scene-composition/index.mjs +326 -0
  85. package/src/scene-composition/runtime.mjs +751 -0
  86. package/src/self-hosted-assets.mjs +604 -0
  87. package/src/session-client.mjs +750 -0
  88. package/src/session-native-launcher.mjs +74 -0
  89. package/src/session-protocol.mjs +75 -0
  90. package/src/session-runtime.mjs +321 -0
  91. package/src/session-server.mjs +360 -0
  92. package/src/shader-kits/index.mjs +773 -0
  93. package/src/starter-content-registry.mjs +292 -0
  94. package/src/state-artifacts.mjs +662 -24
  95. package/src/state-dev-reload.mjs +99 -2
  96. package/src/terminal-ui.mjs +245 -0
  97. package/src/web-conformance.mjs +219 -0
  98. package/templates/create/2d/config/gameplay/shooter.config.js +26 -0
  99. package/templates/create/2d/content/gameplay/waves.json +26 -0
  100. package/templates/create/2d/content/registries/.gitkeep +1 -0
  101. package/templates/create/2d/docs/design/.gitkeep +1 -0
  102. package/templates/create/2d/docs/design/loop.md +5 -0
  103. package/templates/create/2d/prefabs/enemies.prefab.js +90 -0
  104. package/templates/create/2d/prefabs/enemy-basic.prefab.js +18 -0
  105. package/templates/create/2d/prefabs/player.prefab.js +36 -0
  106. package/templates/create/2d/prefabs/projectiles.prefab.js +35 -0
  107. package/templates/create/2d/scenes/boot.scene.js +12 -0
  108. package/templates/create/2d/scenes/gameplay.scene.js +230 -0
  109. package/templates/create/2d/scenes/menu.scene.js +9 -0
  110. package/templates/create/2d/src/main.js +6 -185
  111. package/templates/create/2d/src/runtime/app.js +49 -0
  112. package/templates/create/2d/src/runtime/capabilities.js +35 -0
  113. package/templates/create/2d/ui/hud.screen.js +40 -0
  114. package/templates/create/2d/ui/pause.screen.js +149 -0
  115. package/templates/create/2d/ui/settings.screen.js +347 -0
  116. package/templates/create/2d/ui/title.screen.js +13 -0
  117. package/templates/create/2d-adventure/aura.config.json +28 -0
  118. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +14 -0
  119. package/templates/create/2d-adventure/content/gameplay/world.js +46 -0
  120. package/templates/create/2d-adventure/content/registries/.gitkeep +1 -0
  121. package/templates/create/2d-adventure/docs/design/loop.md +5 -0
  122. package/templates/create/2d-adventure/prefabs/player.prefab.js +54 -0
  123. package/templates/create/2d-adventure/prefabs/relic.prefab.js +38 -0
  124. package/templates/create/2d-adventure/prefabs/world.prefab.js +125 -0
  125. package/templates/create/2d-adventure/scenes/gameplay.scene.js +256 -0
  126. package/templates/create/2d-adventure/src/runtime/capabilities.js +34 -0
  127. package/templates/create/2d-adventure/ui/hud.screen.js +60 -0
  128. package/templates/create/2d-survivor/config/gameplay/survivor.config.js +33 -0
  129. package/templates/create/2d-survivor/content/gameplay/spawn-zones.json +29 -0
  130. package/templates/create/2d-survivor/content/registries/.gitkeep +1 -0
  131. package/templates/create/2d-survivor/docs/design/.gitkeep +1 -0
  132. package/templates/create/2d-survivor/docs/design/loop.md +5 -0
  133. package/templates/create/2d-survivor/prefabs/enemies.prefab.js +178 -0
  134. package/templates/create/2d-survivor/prefabs/enemy-swarm.prefab.js +18 -0
  135. package/templates/create/2d-survivor/prefabs/player.prefab.js +42 -0
  136. package/templates/create/2d-survivor/prefabs/projectiles.prefab.js +56 -0
  137. package/templates/create/2d-survivor/scenes/boot.scene.js +12 -0
  138. package/templates/create/2d-survivor/scenes/gameplay.scene.js +314 -0
  139. package/templates/create/2d-survivor/scenes/menu.scene.js +9 -0
  140. package/templates/create/2d-survivor/src/main.js +5 -332
  141. package/templates/create/2d-survivor/src/runtime/app.js +49 -0
  142. package/templates/create/2d-survivor/src/runtime/capabilities.js +35 -0
  143. package/templates/create/2d-survivor/ui/hud.screen.js +45 -0
  144. package/templates/create/2d-survivor/ui/title.screen.js +13 -0
  145. package/templates/create/3d/assets/models/starter-avatar.gltf +184 -0
  146. package/templates/create/3d/config/gameplay/.gitkeep +1 -0
  147. package/templates/create/3d/content/gameplay/checkpoints.json +33 -0
  148. package/templates/create/3d/content/gameplay/course.js +40 -0
  149. package/templates/create/3d/content/registries/.gitkeep +1 -0
  150. package/templates/create/3d/docs/design/.gitkeep +1 -0
  151. package/templates/create/3d/docs/design/loop.md +5 -0
  152. package/templates/create/3d/prefabs/checkpoint.prefab.js +15 -0
  153. package/templates/create/3d/prefabs/player.prefab.js +204 -0
  154. package/templates/create/3d/prefabs/world.prefab.js +112 -0
  155. package/templates/create/3d/scenes/boot.scene.js +12 -0
  156. package/templates/create/3d/scenes/checkpoint.scene.js +9 -0
  157. package/templates/create/3d/scenes/gameplay.scene.js +292 -0
  158. package/templates/create/3d/src/main.js +6 -295
  159. package/templates/create/3d/src/runtime/app.js +49 -0
  160. package/templates/create/3d/src/runtime/capabilities.js +53 -0
  161. package/templates/create/3d/src/runtime/materials.js +34 -0
  162. package/templates/create/3d/src/runtime/state.js +39 -0
  163. package/templates/create/3d/ui/hud.screen.js +75 -0
  164. package/templates/create/3d/ui/pause.screen.js +166 -0
  165. package/templates/create/3d/ui/settings.screen.js +387 -0
  166. package/templates/create/3d-adventure/assets/models/starter-avatar.gltf +184 -0
  167. package/templates/create/3d-adventure/aura.config.json +28 -0
  168. package/templates/create/3d-adventure/config/gameplay/adventure.config.js +9 -0
  169. package/templates/create/3d-adventure/content/gameplay/course.js +62 -0
  170. package/templates/create/3d-adventure/content/registries/.gitkeep +1 -0
  171. package/templates/create/3d-adventure/docs/design/loop.md +5 -0
  172. package/templates/create/3d-adventure/prefabs/player.prefab.js +168 -0
  173. package/templates/create/3d-adventure/prefabs/relic.prefab.js +35 -0
  174. package/templates/create/3d-adventure/prefabs/world.prefab.js +119 -0
  175. package/templates/create/3d-adventure/scenes/gameplay.scene.js +358 -0
  176. package/templates/create/3d-adventure/src/runtime/capabilities.js +56 -0
  177. package/templates/create/3d-adventure/src/runtime/materials.js +39 -0
  178. package/templates/create/3d-adventure/src/runtime/state.js +31 -0
  179. package/templates/create/3d-adventure/ui/hud.screen.js +70 -0
  180. package/templates/create/3d-adventure/ui/pause.screen.js +437 -0
  181. package/templates/create/3d-collectathon/assets/models/starter-avatar.gltf +184 -0
  182. package/templates/create/3d-collectathon/config/gameplay/.gitkeep +1 -0
  183. package/templates/create/3d-collectathon/content/gameplay/collectibles.json +26 -0
  184. package/templates/create/3d-collectathon/content/gameplay/course.js +46 -0
  185. package/templates/create/3d-collectathon/content/registries/.gitkeep +1 -0
  186. package/templates/create/3d-collectathon/docs/design/.gitkeep +1 -0
  187. package/templates/create/3d-collectathon/docs/design/loop.md +5 -0
  188. package/templates/create/3d-collectathon/prefabs/collectible.prefab.js +15 -0
  189. package/templates/create/3d-collectathon/prefabs/player.prefab.js +207 -0
  190. package/templates/create/3d-collectathon/prefabs/world.prefab.js +112 -0
  191. package/templates/create/3d-collectathon/scenes/boot.scene.js +12 -0
  192. package/templates/create/3d-collectathon/scenes/checkpoint.scene.js +9 -0
  193. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +200 -0
  194. package/templates/create/3d-collectathon/src/main.js +5 -355
  195. package/templates/create/3d-collectathon/src/runtime/app.js +49 -0
  196. package/templates/create/3d-collectathon/src/runtime/capabilities.js +53 -0
  197. package/templates/create/3d-collectathon/src/runtime/materials.js +34 -0
  198. package/templates/create/3d-collectathon/src/runtime/state.js +27 -0
  199. package/templates/create/3d-collectathon/ui/hud.screen.js +66 -0
  200. package/templates/create/3d-collectathon/ui/pause.screen.js +13 -0
  201. package/templates/create/blank/config/gameplay/.gitkeep +1 -0
  202. package/templates/create/blank/content/gameplay/.gitkeep +1 -0
  203. package/templates/create/blank/content/registries/.gitkeep +1 -0
  204. package/templates/create/blank/docs/design/.gitkeep +1 -0
  205. package/templates/create/blank/docs/design/loop.md +5 -0
  206. package/templates/create/blank/prefabs/.gitkeep +1 -0
  207. package/templates/create/blank/scenes/.gitkeep +1 -0
  208. package/templates/create/blank/src/runtime/.gitkeep +1 -0
  209. package/templates/create/blank/ui/.gitkeep +1 -0
  210. package/templates/create/deckbuilder-2d/assets/audio/.gitkeep +1 -0
  211. package/templates/create/deckbuilder-2d/assets/fonts/.gitkeep +1 -0
  212. package/templates/create/deckbuilder-2d/assets/sprites/.gitkeep +1 -0
  213. package/templates/create/deckbuilder-2d/assets/starter/README.md +11 -0
  214. package/templates/create/deckbuilder-2d/assets/ui/.gitkeep +1 -0
  215. package/templates/create/deckbuilder-2d/aura.config.json +28 -0
  216. package/templates/create/deckbuilder-2d/config/gameplay/deckbuilder.config.js +26 -0
  217. package/templates/create/deckbuilder-2d/content/cards/guard.card.js +19 -0
  218. package/templates/create/deckbuilder-2d/content/cards/spark.card.js +20 -0
  219. package/templates/create/deckbuilder-2d/content/cards/starter.deck.js +69 -0
  220. package/templates/create/deckbuilder-2d/content/cards/strike.card.js +19 -0
  221. package/templates/create/deckbuilder-2d/content/cards/survey.card.js +20 -0
  222. package/templates/create/deckbuilder-2d/content/encounters/training-battle.encounter.js +14 -0
  223. package/templates/create/deckbuilder-2d/content/encounters/training-battle.js +65 -0
  224. package/templates/create/deckbuilder-2d/content/enemies/training-automaton.enemy.js +48 -0
  225. package/templates/create/deckbuilder-2d/content/gameplay/.gitkeep +1 -0
  226. package/templates/create/deckbuilder-2d/content/registries/cards.registry.js +26 -0
  227. package/templates/create/deckbuilder-2d/content/registries/encounters.registry.js +20 -0
  228. package/templates/create/deckbuilder-2d/content/registries/enemies.registry.js +20 -0
  229. package/templates/create/deckbuilder-2d/content/registries/relics.registry.js +20 -0
  230. package/templates/create/deckbuilder-2d/content/relics/ember-charm.relic.js +18 -0
  231. package/templates/create/deckbuilder-2d/docs/design/loop.md +12 -0
  232. package/templates/create/deckbuilder-2d/prefabs/.gitkeep +1 -0
  233. package/templates/create/deckbuilder-2d/scenes/boot.scene.js +84 -0
  234. package/templates/create/deckbuilder-2d/scenes/gameplay.scene.js +641 -0
  235. package/templates/create/deckbuilder-2d/src/components/.gitkeep +1 -0
  236. package/templates/create/deckbuilder-2d/src/main.js +17 -0
  237. package/templates/create/deckbuilder-2d/src/runtime/capabilities.js +22 -0
  238. package/templates/create/deckbuilder-2d/src/shared/.gitkeep +1 -0
  239. package/templates/create/deckbuilder-2d/src/systems/.gitkeep +1 -0
  240. package/templates/create/deckbuilder-2d/tests/smoke/.gitkeep +1 -0
  241. package/templates/create/deckbuilder-2d/ui/hud.screen.js +80 -0
  242. package/templates/create/deckbuilder-2d/ui/pause.screen.js +146 -0
  243. package/templates/create/deckbuilder-2d/ui/settings.screen.js +342 -0
  244. package/templates/create/local-multiplayer/aura.config.json +41 -0
  245. package/templates/create/local-multiplayer/config/gameplay/local-multiplayer.config.js +26 -0
  246. package/templates/create/local-multiplayer/content/gameplay/room-layout.js +13 -0
  247. package/templates/create/local-multiplayer/content/registries/.gitkeep +1 -0
  248. package/templates/create/local-multiplayer/docs/design/loop.md +16 -0
  249. package/templates/create/local-multiplayer/prefabs/player.prefab.js +99 -0
  250. package/templates/create/local-multiplayer/scenes/boot.scene.js +12 -0
  251. package/templates/create/local-multiplayer/scenes/gameplay.scene.js +472 -0
  252. package/templates/create/local-multiplayer/src/main.js +17 -0
  253. package/templates/create/local-multiplayer/src/runtime/capabilities.js +28 -0
  254. package/templates/create/local-multiplayer/ui/hud.screen.js +65 -0
  255. package/templates/create/shared/src/runtime/project-inspector.js +105 -0
  256. package/templates/create/shared/src/runtime/scene-flow.js +290 -0
  257. package/templates/create/shared/src/runtime/screen-shell.js +222 -0
  258. package/templates/create/shared/src/runtime/ui-forms.js +209 -0
  259. package/templates/create/shared/src/runtime/ui-settings.js +237 -0
  260. package/templates/create/shared/src/runtime/ui-theme.js +352 -0
  261. package/templates/create/shared/src/starter-utils/adventure-objectives.js +102 -0
  262. package/templates/create/shared/src/starter-utils/animation-2d.js +337 -0
  263. package/templates/create/shared/src/starter-utils/avatar-3d.js +404 -0
  264. package/templates/create/shared/src/starter-utils/combat-feedback-2d.js +320 -0
  265. package/templates/create/shared/src/starter-utils/core.js +39 -3
  266. package/templates/create/shared/src/starter-utils/index.js +8 -2
  267. package/templates/create/shared/src/starter-utils/platformer-3d.js +34 -3
  268. package/templates/create/shared/src/starter-utils/triggers.js +662 -0
  269. package/templates/create/shared/src/starter-utils/tween-2d.js +615 -0
  270. package/templates/create/video-cutscene/assets/video/.gitkeep +0 -0
  271. package/templates/create/video-cutscene/aura.config.json +28 -0
  272. package/templates/create/video-cutscene/config/gameplay/.gitkeep +0 -0
  273. package/templates/create/video-cutscene/content/gameplay/.gitkeep +0 -0
  274. package/templates/create/video-cutscene/content/registries/.gitkeep +0 -0
  275. package/templates/create/video-cutscene/docs/design/loop.md +22 -0
  276. package/templates/create/video-cutscene/prefabs/.gitkeep +0 -0
  277. package/templates/create/video-cutscene/scenes/boot.scene.js +11 -0
  278. package/templates/create/video-cutscene/scenes/cutscene.scene.js +113 -0
  279. package/templates/create/video-cutscene/scenes/gameplay.scene.js +50 -0
  280. package/templates/create/video-cutscene/src/main.js +17 -0
  281. package/templates/create/video-cutscene/src/runtime/app.js +52 -0
  282. package/templates/create/video-cutscene/src/runtime/capabilities.js +35 -0
  283. package/templates/create/video-cutscene/src/runtime/state.js +13 -0
  284. package/templates/create/video-cutscene/ui/.gitkeep +0 -0
  285. package/templates/create-bin/play.js +1192 -0
  286. package/templates/make/README.md +46 -0
  287. package/templates/make/catalog.json +51 -0
  288. package/templates/make/component/files/{{MAKE_NAME}}.component.js +20 -0
  289. package/templates/make/component/manifest.json +9 -0
  290. package/templates/make/data/files/{{MAKE_NAME}}.json +14 -0
  291. package/templates/make/data/manifest.json +9 -0
  292. package/templates/make/material/files/{{MAKE_NAME}}.material.json +17 -0
  293. package/templates/make/material/manifest.json +9 -0
  294. package/templates/make/prefab/files/{{MAKE_NAME}}.prefab.js +20 -0
  295. package/templates/make/prefab/manifest.json +9 -0
  296. package/templates/make/scene/files/{{MAKE_NAME}}.scene.js +31 -0
  297. package/templates/make/scene/manifest.json +9 -0
  298. package/templates/make/shader/files/{{MAKE_NAME}}.shader.js +23 -0
  299. package/templates/make/shader/manifest.json +9 -0
  300. package/templates/make/system/files/{{MAKE_NAME}}.system.js +15 -0
  301. package/templates/make/system/manifest.json +9 -0
  302. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.js +16 -0
  303. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.json +23 -0
  304. package/templates/make/ui-screen/manifest.json +10 -0
  305. package/templates/make-starters/deckbuilder-2d/card/files/{{MAKE_NAME}}.card.js +22 -0
  306. package/templates/make-starters/deckbuilder-2d/card/manifest.json +9 -0
  307. package/templates/make-starters/deckbuilder-2d/catalog.json +34 -0
  308. package/templates/make-starters/deckbuilder-2d/encounter/files/{{MAKE_NAME}}.encounter.js +18 -0
  309. package/templates/make-starters/deckbuilder-2d/encounter/manifest.json +9 -0
  310. package/templates/make-starters/deckbuilder-2d/enemy/files/{{MAKE_NAME}}.enemy.js +28 -0
  311. package/templates/make-starters/deckbuilder-2d/enemy/manifest.json +9 -0
  312. package/templates/make-starters/deckbuilder-2d/relic/files/{{MAKE_NAME}}.relic.js +23 -0
  313. package/templates/make-starters/deckbuilder-2d/relic/manifest.json +9 -0
  314. package/templates/retro/platformer/README.md +10 -0
  315. package/templates/retro/platformer/assets/retro/assets.json +91 -0
  316. package/templates/retro/platformer/aura.config.json +7 -0
  317. package/templates/retro/platformer/package.json +5 -0
  318. package/templates/retro/platformer/src/main.js +40 -0
  319. package/templates/retro/puzzle-grid/README.md +10 -0
  320. package/templates/retro/puzzle-grid/assets/retro/assets.json +90 -0
  321. package/templates/retro/puzzle-grid/aura.config.json +7 -0
  322. package/templates/retro/puzzle-grid/package.json +5 -0
  323. package/templates/retro/puzzle-grid/src/main.js +29 -0
  324. package/templates/retro/tactics-grid/README.md +10 -0
  325. package/templates/retro/tactics-grid/assets/retro/assets.json +90 -0
  326. package/templates/retro/tactics-grid/aura.config.json +7 -0
  327. package/templates/retro/tactics-grid/package.json +5 -0
  328. package/templates/retro/tactics-grid/src/main.js +35 -0
  329. package/templates/retro/topdown-adventure/README.md +10 -0
  330. package/templates/retro/topdown-adventure/assets/retro/assets.json +95 -0
  331. package/templates/retro/topdown-adventure/aura.config.json +7 -0
  332. package/templates/retro/topdown-adventure/package.json +5 -0
  333. package/templates/retro/topdown-adventure/src/main.js +29 -0
  334. package/templates/skills/aurajs/SKILL.md +61 -5
@@ -0,0 +1,56 @@
1
+ function hasMethod(obj, method) {
2
+ return Boolean(obj) && typeof obj[method] === 'function';
3
+ }
4
+
5
+ function failWithReason(reasonCode, message) {
6
+ throw new Error(`[3d-adventure-template] ${message} [reason:${reasonCode}]`);
7
+ }
8
+
9
+ export function assertRuntimeCapabilities() {
10
+ const missing = [];
11
+ if (!hasMethod(aura.window, 'getSize')) missing.push('aura.window.getSize');
12
+ if (!hasMethod(aura.mesh, 'createBox')) missing.push('aura.mesh.createBox');
13
+ if (!hasMethod(aura.material, 'create')) missing.push('aura.material.create');
14
+ if (!hasMethod(aura.light, 'ambient')) missing.push('aura.light.ambient');
15
+ if (!hasMethod(aura.light, 'directional')) missing.push('aura.light.directional');
16
+ if (!hasMethod(aura.camera3d, 'perspective')) missing.push('aura.camera3d.perspective');
17
+ if (!hasMethod(aura.camera3d, 'setPosition')) missing.push('aura.camera3d.setPosition');
18
+ if (!hasMethod(aura.camera3d, 'lookAt')) missing.push('aura.camera3d.lookAt');
19
+ if (!hasMethod(aura.character3d, 'create')) missing.push('aura.character3d.create');
20
+ if (!hasMethod(aura.character3d, 'move')) missing.push('aura.character3d.move');
21
+ if (!hasMethod(aura.character3d, 'jump')) missing.push('aura.character3d.jump');
22
+ if (!hasMethod(aura.character3d, 'update')) missing.push('aura.character3d.update');
23
+ if (!hasMethod(aura.character3d, 'getState')) missing.push('aura.character3d.getState');
24
+ if (!hasMethod(aura.character3d, 'setPosition')) missing.push('aura.character3d.setPosition');
25
+ if (!hasMethod(aura.character3d, 'addObstacle')) missing.push('aura.character3d.addObstacle');
26
+ if (!hasMethod(aura.character3d, 'clearObstacles')) missing.push('aura.character3d.clearObstacles');
27
+ if (!hasMethod(aura.input, 'isKeyDown')) missing.push('aura.input.isKeyDown');
28
+ if (!hasMethod(aura.input, 'isKeyPressed')) missing.push('aura.input.isKeyPressed');
29
+ if (!hasMethod(aura.scene3d, 'loadGltfScene')) missing.push('aura.scene3d.loadGltfScene');
30
+ if (!hasMethod(aura.scene3d, 'getImportedScene')) missing.push('aura.scene3d.getImportedScene');
31
+ if (!hasMethod(aura.scene3d, 'playImportedAnimation')) missing.push('aura.scene3d.playImportedAnimation');
32
+ if (!hasMethod(aura.scene3d, 'setLocalTransform')) missing.push('aura.scene3d.setLocalTransform');
33
+ if (!hasMethod(aura.scene3d, 'updateClips')) missing.push('aura.scene3d.updateClips');
34
+ if (!hasMethod(aura.scene3d, 'submitRenderBindings')) missing.push('aura.scene3d.submitRenderBindings');
35
+ if (!hasMethod(aura.draw3d, 'clear3d')) missing.push('aura.draw3d.clear3d');
36
+ if (!hasMethod(aura.draw3d, 'drawMesh')) missing.push('aura.draw3d.drawMesh');
37
+ if (!hasMethod(aura.draw2d, 'rect')) missing.push('aura.draw2d.rect');
38
+ if (!hasMethod(aura.draw2d, 'text')) missing.push('aura.draw2d.text');
39
+ if (!hasMethod(aura.draw2d, 'measureText')) missing.push('aura.draw2d.measureText');
40
+ if (typeof aura.rgb !== 'function') missing.push('aura.rgb');
41
+ if (typeof aura.rgba !== 'function') missing.push('aura.rgba');
42
+ if (!aura.Color || !aura.Color.WHITE) missing.push('aura.Color.WHITE');
43
+
44
+ if (missing.length > 0) {
45
+ failWithReason('missing_runtime_api', `runtime missing required APIs: ${missing.join(', ')}`);
46
+ }
47
+
48
+ const small = aura.draw2d.measureText('Probe', { size: 8 });
49
+ const large = aura.draw2d.measureText('Probe', { size: 24 });
50
+ if (!Number.isFinite(Number(small?.width)) || !Number.isFinite(Number(large?.width)) || Number(large.width) <= Number(small.width)) {
51
+ failWithReason(
52
+ 'placeholder_runtime_behavior',
53
+ 'draw2d.measureText appears to be placeholder behavior (size does not affect width).',
54
+ );
55
+ }
56
+ }
@@ -0,0 +1,39 @@
1
+ export function createAdventureMaterials() {
2
+ return {
3
+ floor: aura.material.create({
4
+ color: { r: 0.16, g: 0.22, b: 0.18, a: 1.0 },
5
+ metallic: 0.06,
6
+ roughness: 0.92,
7
+ }),
8
+ platform: aura.material.create({
9
+ color: { r: 0.4, g: 0.52, b: 0.72, a: 1.0 },
10
+ metallic: 0.1,
11
+ roughness: 0.6,
12
+ }),
13
+ relic: aura.material.create({
14
+ color: { r: 0.98, g: 0.9, b: 0.38, a: 1.0 },
15
+ metallic: 0.7,
16
+ roughness: 0.24,
17
+ }),
18
+ beaconDormant: aura.material.create({
19
+ color: { r: 0.3, g: 0.44, b: 0.66, a: 1.0 },
20
+ metallic: 0.26,
21
+ roughness: 0.36,
22
+ }),
23
+ beaconLit: aura.material.create({
24
+ color: { r: 0.58, g: 1.0, b: 0.74, a: 1.0 },
25
+ metallic: 0.48,
26
+ roughness: 0.24,
27
+ }),
28
+ goalLocked: aura.material.create({
29
+ color: { r: 0.24, g: 0.28, b: 0.34, a: 1.0 },
30
+ metallic: 0.12,
31
+ roughness: 0.44,
32
+ }),
33
+ goalReady: aura.material.create({
34
+ color: { r: 0.72, g: 1.0, b: 0.82, a: 1.0 },
35
+ metallic: 0.34,
36
+ roughness: 0.28,
37
+ }),
38
+ };
39
+ }
@@ -0,0 +1,31 @@
1
+ import { createAdventureObjectives, createCheckpointSystem, createMovingPlatform3D } from '../starter-utils/index.js';
2
+ import { BEACON_SITES, CHECKPOINTS, MOVING_PLATFORM, PLAYER_SPAWN, RELIC_SPAWNS } from '../../content/gameplay/course.js';
3
+ import { createPlayerAvatar, resetPlayerAvatar } from '../../prefabs/player.prefab.js';
4
+
5
+ function buildBeacons() {
6
+ return BEACON_SITES.map((entry) => ({
7
+ id: entry.id,
8
+ label: entry.label,
9
+ x: entry.x,
10
+ y: entry.y,
11
+ z: entry.z,
12
+ radius: entry.radius,
13
+ requiredRelics: entry.requiredRelics,
14
+ lit: false,
15
+ }));
16
+ }
17
+
18
+ export function createAdventureRunState(existingPlayer = null) {
19
+ return {
20
+ player: existingPlayer ? resetPlayerAvatar(existingPlayer, PLAYER_SPAWN) : createPlayerAvatar(PLAYER_SPAWN),
21
+ relics: createAdventureObjectives(RELIC_SPAWNS, {
22
+ dimension: '3d',
23
+ defaultRadius: 0.42,
24
+ }),
25
+ beacons: buildBeacons(),
26
+ elapsed: 0,
27
+ runComplete: false,
28
+ checkpointSystem: createCheckpointSystem({ checkpoints: CHECKPOINTS }),
29
+ movingPlatform: createMovingPlatform3D(MOVING_PLATFORM),
30
+ };
31
+ }
@@ -0,0 +1,70 @@
1
+ const hudScreen = {
2
+ id: 'hud',
3
+ kind: 'ui-screen',
4
+ role: 'hud',
5
+ draw: drawAdventureHud,
6
+ notes: ['Keep HUD ownership here while the scene only manages route logic and shared state updates.'],
7
+ };
8
+
9
+ export function createHudScreen() {
10
+ return hudScreen;
11
+ }
12
+
13
+ export function drawAdventureHud(data = {}) {
14
+ let nextY = 12;
15
+
16
+ if (data.showControlsHint !== false) {
17
+ aura.draw2d.text('Move: Arrows/WASD Jump: Space Interact: E', 12, nextY, {
18
+ color: aura.Color.WHITE,
19
+ size: 14,
20
+ align: 'left',
21
+ });
22
+ nextY += 22;
23
+ }
24
+
25
+ aura.draw2d.text(`Relics ${data.relicCount ?? 0}/${data.relicTarget ?? 0}`, 12, nextY, {
26
+ color: aura.Color.WHITE,
27
+ size: 14,
28
+ align: 'left',
29
+ });
30
+ nextY += 22;
31
+ aura.draw2d.text(`Beacons ${data.beaconCount ?? 0}/${data.beaconTarget ?? 0}`, 12, nextY, {
32
+ color: aura.Color.WHITE,
33
+ size: 14,
34
+ align: 'left',
35
+ });
36
+ nextY += 22;
37
+
38
+ if (data.promptText) {
39
+ aura.draw2d.text(data.promptText, 12, nextY, {
40
+ color: aura.rgb(0.96, 0.86, 0.42),
41
+ size: 13,
42
+ align: 'left',
43
+ });
44
+ nextY += 22;
45
+ }
46
+
47
+ if (data.paused) {
48
+ aura.draw2d.text('Pause menu open. Press Esc to resume.', 12, nextY, {
49
+ color: aura.rgb(0.82, 0.9, 1.0),
50
+ size: 13,
51
+ align: 'left',
52
+ });
53
+ nextY += 24;
54
+ }
55
+
56
+ if (data.runComplete !== true) return;
57
+
58
+ aura.draw2d.text('ARCHWAY UNLOCKED', 12, nextY, {
59
+ color: aura.rgb(0.58, 1.0, 0.74),
60
+ size: 24,
61
+ align: 'left',
62
+ });
63
+ aura.draw2d.text('Press Enter to restart the route', 12, nextY + 28, {
64
+ color: aura.Color.WHITE,
65
+ size: 16,
66
+ align: 'left',
67
+ });
68
+ }
69
+
70
+ export default hudScreen;
@@ -0,0 +1,437 @@
1
+ import {
2
+ ensureUiPreferences,
3
+ inspectUiTheme,
4
+ resetUiPreferences,
5
+ updateUiPreferences,
6
+ } from '../src/runtime/ui-theme.js';
7
+ import {
8
+ listFocusVisibilitySegmentOptions,
9
+ listTextScaleSegmentOptions,
10
+ readBooleanViewValue,
11
+ renderActionStrip,
12
+ renderSegmentedControl,
13
+ } from '../src/runtime/ui-settings.js';
14
+ import { renderMenuList, renderTextFieldRow } from '../src/runtime/ui-forms.js';
15
+
16
+ const DEFAULT_PROFILE_NAME = 'Nova';
17
+ const MAX_PROFILE_NAME_LENGTH = 18;
18
+ const DEFAULT_SAVE_SLOTS = [
19
+ { id: 'slot-a', label: 'Forest Edge' },
20
+ { id: 'slot-b', label: 'Beacon Ridge' },
21
+ { id: 'slot-c', label: 'Signal Arch' },
22
+ ];
23
+
24
+ const pauseScreen = {
25
+ id: 'pause',
26
+ kind: 'ui-screen',
27
+ role: 'modal',
28
+ draw: drawPauseScreen,
29
+ notes: [
30
+ 'Stage 156 turns this pause modal into one retained profile, save-slot, and accessibility workflow.',
31
+ 'Durable values stay in appState.session.adventure3d and appState.ui.preferences while draft text and focus stay runtime-owned inside aura.ui.',
32
+ ],
33
+ };
34
+
35
+ function windowSize() {
36
+ return aura.window?.getSize?.() || { width: 1360, height: 820 };
37
+ }
38
+
39
+ function cloneDefaultSaveSlots() {
40
+ return DEFAULT_SAVE_SLOTS.map((entry) => ({ ...entry }));
41
+ }
42
+
43
+ function normalizeProfileName(value) {
44
+ const trimmed = typeof value === 'string' ? value.trim() : '';
45
+ return trimmed.length > 0 ? trimmed.slice(0, MAX_PROFILE_NAME_LENGTH) : DEFAULT_PROFILE_NAME;
46
+ }
47
+
48
+ function normalizeSaveSlots(value) {
49
+ const normalized = Array.isArray(value)
50
+ ? value
51
+ .filter((entry) => entry && typeof entry === 'object' && !Array.isArray(entry))
52
+ .map((entry, index) => {
53
+ const fallback = DEFAULT_SAVE_SLOTS[index] || DEFAULT_SAVE_SLOTS[0];
54
+ const id = typeof entry.id === 'string' && entry.id.trim().length > 0
55
+ ? entry.id.trim()
56
+ : fallback.id;
57
+ const label = typeof entry.label === 'string' && entry.label.trim().length > 0
58
+ ? entry.label.trim()
59
+ : fallback.label;
60
+ return { id, label };
61
+ })
62
+ .filter((entry) => entry.id.length > 0)
63
+ : [];
64
+ return normalized.length > 0 ? normalized : cloneDefaultSaveSlots();
65
+ }
66
+
67
+ function normalizeAdventureSession(session) {
68
+ const target = session && typeof session === 'object' && !Array.isArray(session) ? session : {};
69
+ target.profileName = normalizeProfileName(target.profileName);
70
+ target.lastSubmittedProfileName = normalizeProfileName(
71
+ typeof target.lastSubmittedProfileName === 'string' ? target.lastSubmittedProfileName : target.profileName,
72
+ );
73
+ target.saveSlots = normalizeSaveSlots(target.saveSlots);
74
+ const validSlotIds = new Set(target.saveSlots.map((entry) => entry.id));
75
+ target.activeSaveSlotId = validSlotIds.has(target.activeSaveSlotId)
76
+ ? target.activeSaveSlotId
77
+ : target.saveSlots[0].id;
78
+ return target;
79
+ }
80
+
81
+ function ensureAdventureSession(context, appState) {
82
+ if (typeof context.ensureSessionState === 'function') {
83
+ return normalizeAdventureSession(context.ensureSessionState('adventure3d', {
84
+ profileName: DEFAULT_PROFILE_NAME,
85
+ lastSubmittedProfileName: DEFAULT_PROFILE_NAME,
86
+ activeSaveSlotId: DEFAULT_SAVE_SLOTS[0].id,
87
+ saveSlots: cloneDefaultSaveSlots(),
88
+ }));
89
+ }
90
+ if (!appState.session || typeof appState.session !== 'object' || Array.isArray(appState.session)) {
91
+ appState.session = {};
92
+ }
93
+ if (!appState.session.adventure3d || typeof appState.session.adventure3d !== 'object' || Array.isArray(appState.session.adventure3d)) {
94
+ appState.session.adventure3d = {};
95
+ }
96
+ return normalizeAdventureSession(appState.session.adventure3d);
97
+ }
98
+
99
+ function ensurePauseView(context, appState) {
100
+ if (typeof context.ensureUiState === 'function') {
101
+ return context.ensureUiState('adventurePauseView', {
102
+ activeSection: 'overview',
103
+ });
104
+ }
105
+ if (!appState.ui || typeof appState.ui !== 'object' || Array.isArray(appState.ui)) {
106
+ appState.ui = {};
107
+ }
108
+ if (!appState.ui.adventurePauseView || typeof appState.ui.adventurePauseView !== 'object' || Array.isArray(appState.ui.adventurePauseView)) {
109
+ appState.ui.adventurePauseView = {
110
+ activeSection: 'overview',
111
+ };
112
+ }
113
+ return appState.ui.adventurePauseView;
114
+ }
115
+
116
+ function currentPreferences(context, appState) {
117
+ if (typeof context.getUiPreferences === 'function') {
118
+ return context.getUiPreferences();
119
+ }
120
+ return ensureUiPreferences(appState);
121
+ }
122
+
123
+ function currentThemeState(context, appState) {
124
+ if (typeof context.getUiThemeState === 'function') {
125
+ return context.getUiThemeState();
126
+ }
127
+ return inspectUiTheme(appState);
128
+ }
129
+
130
+ function updatePreferences(context, appState, patch) {
131
+ if (typeof context.updateUiPreferences === 'function') {
132
+ return context.updateUiPreferences(patch);
133
+ }
134
+ return updateUiPreferences(appState, patch);
135
+ }
136
+
137
+ function resetPreferences(context, appState) {
138
+ if (typeof context.resetUiPreferences === 'function') {
139
+ return context.resetUiPreferences();
140
+ }
141
+ return resetUiPreferences(appState);
142
+ }
143
+
144
+ function activeSaveSlot(session) {
145
+ return session.saveSlots.find((entry) => entry.id === session.activeSaveSlotId) || session.saveSlots[0] || null;
146
+ }
147
+
148
+ export function createPauseScreen() {
149
+ return pauseScreen;
150
+ }
151
+
152
+ export function drawPauseScreen(data = {}, context = {}) {
153
+ const appState = context.appState || {};
154
+ const adventureSession = ensureAdventureSession(context, appState);
155
+ const pauseView = ensurePauseView(context, appState);
156
+ const preferences = currentPreferences(context, appState);
157
+ const themeState = currentThemeState(context, appState);
158
+ const size = windowSize();
159
+ const panelWidth = Math.min(980, size.width - 72);
160
+ const panelHeight = Math.min(640, size.height - 88);
161
+ const panelX = Math.floor((size.width - panelWidth) * 0.5);
162
+ const panelY = Math.floor((size.height - panelHeight) * 0.5);
163
+ const currentSlot = activeSaveSlot(adventureSession);
164
+
165
+ aura.draw2d.rect(0, 0, size.width, size.height, aura.rgba(0.02, 0.03, 0.08, 0.82));
166
+
167
+ aura.ui.beginView({
168
+ id: 'adventure-pause-root',
169
+ x: panelX,
170
+ y: panelY,
171
+ width: panelWidth,
172
+ height: panelHeight,
173
+ gap: 14,
174
+ padding: 18,
175
+ clip: true,
176
+ background: '#08111b',
177
+ borderColor: '#32506c',
178
+ });
179
+
180
+ aura.ui.text('adventure-pause-eyebrow', {
181
+ text: 'PAUSE MENU',
182
+ size: 12,
183
+ color: '#86c1f5',
184
+ });
185
+ aura.ui.text('adventure-pause-title', {
186
+ text: 'Ruins survey paused',
187
+ size: 28,
188
+ color: '#f4f8ff',
189
+ });
190
+ aura.ui.text('adventure-pause-copy', {
191
+ text: 'This retained modal edits durable profile and save-slot values without custom key capture, while readability preferences stay shared in appState.ui.preferences.',
192
+ size: 14,
193
+ color: '#c9d9ea',
194
+ });
195
+
196
+ aura.ui.beginRow({
197
+ id: 'adventure-pause-shell',
198
+ gap: 16,
199
+ width: 'fill',
200
+ height: 'fill',
201
+ });
202
+
203
+ aura.ui.beginColumn({
204
+ id: 'adventure-pause-summary',
205
+ width: 250,
206
+ gap: 10,
207
+ padding: 14,
208
+ background: '#0d1826',
209
+ borderColor: '#21384d',
210
+ });
211
+ aura.ui.text('adventure-pause-summary-label', {
212
+ text: 'LIVE SNAPSHOT',
213
+ size: 11,
214
+ color: '#7fb7ea',
215
+ });
216
+ aura.ui.text('adventure-pause-summary-progress', {
217
+ text: `Relics ${data.relicCount ?? 0} · Beacons ${data.beaconCount ?? 0}`,
218
+ size: 16,
219
+ color: '#eef5ff',
220
+ });
221
+ aura.ui.text('adventure-pause-summary-profile', {
222
+ text: `Profile ${adventureSession.profileName}`,
223
+ size: 14,
224
+ color: '#d1dfef',
225
+ });
226
+ aura.ui.text('adventure-pause-summary-slot', {
227
+ text: `Save slot ${currentSlot?.label || 'Forest Edge'}`,
228
+ size: 14,
229
+ color: '#d1dfef',
230
+ });
231
+ aura.ui.text('adventure-pause-summary-theme', {
232
+ text: `Theme ${themeState?.presetLabel || 'Signal Dawn'} · Text ${preferences.textScale || 'normal'}`,
233
+ size: 14,
234
+ color: '#d1dfef',
235
+ });
236
+ aura.ui.text('adventure-pause-summary-focus', {
237
+ text: `Focus ${preferences.focusVisibility || 'standard'} · Motion ${preferences.reduceMotion ? 'Reduced' : 'Standard'}`,
238
+ size: 13,
239
+ color: '#f0cf79',
240
+ });
241
+ aura.ui.text('adventure-pause-summary-note', {
242
+ text: 'The selected section id lives in appState.ui.adventurePauseView. Draft text and caret state stay runtime-owned in aura.ui.',
243
+ size: 12,
244
+ color: '#9db2cb',
245
+ });
246
+ aura.ui.endColumn();
247
+
248
+ aura.ui.beginColumn({
249
+ id: 'adventure-pause-main',
250
+ width: 'fill',
251
+ gap: 12,
252
+ });
253
+
254
+ const sectionTabs = renderSegmentedControl({
255
+ id: 'adventure-pause-sections',
256
+ label: 'Section',
257
+ value: pauseView.activeSection || 'overview',
258
+ options: [
259
+ { id: 'overview', label: 'Overview' },
260
+ { id: 'profile', label: 'Profile' },
261
+ { id: 'accessibility', label: 'Accessibility' },
262
+ ],
263
+ });
264
+ if (sectionTabs.changed) {
265
+ pauseView.activeSection = sectionTabs.value;
266
+ }
267
+
268
+ aura.ui.beginColumn({
269
+ id: 'adventure-pause-card',
270
+ gap: 12,
271
+ width: 'fill',
272
+ padding: 14,
273
+ background: '#0d1826',
274
+ borderColor: '#21384d',
275
+ });
276
+
277
+ let profileField = {
278
+ editing: false,
279
+ submitted: false,
280
+ value: adventureSession.profileName,
281
+ };
282
+ let slotList = {
283
+ changed: false,
284
+ value: adventureSession.activeSaveSlotId,
285
+ };
286
+ let textScaleControl = {
287
+ changed: false,
288
+ value: preferences.textScale,
289
+ };
290
+ let focusControl = {
291
+ changed: false,
292
+ value: preferences.focusVisibility,
293
+ };
294
+
295
+ if ((pauseView.activeSection || 'overview') === 'overview') {
296
+ aura.ui.text('adventure-pause-overview-label', {
297
+ text: 'OVERVIEW',
298
+ size: 11,
299
+ color: '#7fb7ea',
300
+ });
301
+ aura.ui.text('adventure-pause-overview-line-1', {
302
+ text: 'Resume keeps the current route and screenShell mount intact. Restart resets the active scene without moving the durable profile or save-slot selection.',
303
+ size: 14,
304
+ color: '#d1dfef',
305
+ });
306
+ aura.ui.text('adventure-pause-overview-line-2', {
307
+ text: 'Open the Profile section to commit a player name with aura.ui.input and switch the active save slot through one retained menu list.',
308
+ size: 14,
309
+ color: '#d1dfef',
310
+ });
311
+ aura.ui.text('adventure-pause-overview-line-3', {
312
+ text: 'Open Accessibility to tune text scale, focus visibility, subtitles, and reduced motion through shared preferences.',
313
+ size: 14,
314
+ color: '#d1dfef',
315
+ });
316
+ } else if (pauseView.activeSection === 'profile') {
317
+ aura.ui.text('adventure-pause-profile-label', {
318
+ text: 'PROFILE',
319
+ size: 11,
320
+ color: '#7fb7ea',
321
+ });
322
+ profileField = renderTextFieldRow({
323
+ id: 'adventure-pause-profile-name',
324
+ label: 'Player name',
325
+ description: 'Submit to commit the durable appState.session.adventure3d.profileName value. Draft text stays runtime-owned in aura.ui.',
326
+ value: adventureSession.profileName,
327
+ placeholder: DEFAULT_PROFILE_NAME,
328
+ maxLength: MAX_PROFILE_NAME_LENGTH,
329
+ });
330
+ slotList = renderMenuList({
331
+ id: 'adventure-pause-save-slot',
332
+ label: 'Active save slot',
333
+ description: 'Choose the durable save-slot label without inventing starter-local focus bookkeeping.',
334
+ value: adventureSession.activeSaveSlotId,
335
+ options: adventureSession.saveSlots.map((entry) => ({
336
+ id: entry.id,
337
+ label: entry.label,
338
+ description: entry.id === adventureSession.activeSaveSlotId ? 'Current slot' : 'Activate this slot for the next checkpoint restore.',
339
+ })),
340
+ });
341
+ aura.ui.text('adventure-pause-profile-status', {
342
+ text: profileField.editing
343
+ ? 'Editing is currently owned by aura.ui. Press Enter to commit or Escape to cancel the draft.'
344
+ : `Last committed name ${adventureSession.lastSubmittedProfileName}`,
345
+ size: 13,
346
+ color: '#d1dfef',
347
+ });
348
+ } else {
349
+ aura.ui.text('adventure-pause-accessibility-label', {
350
+ text: 'ACCESSIBILITY',
351
+ size: 11,
352
+ color: '#7fb7ea',
353
+ });
354
+ textScaleControl = renderSegmentedControl({
355
+ id: 'adventure-pause-text-scale',
356
+ label: 'Text scale',
357
+ description: 'Readable retained UI text sizing shared through appState.ui.preferences.',
358
+ value: preferences.textScale,
359
+ options: listTextScaleSegmentOptions(),
360
+ });
361
+ focusControl = renderSegmentedControl({
362
+ id: 'adventure-pause-focus-visibility',
363
+ label: 'Focus visibility',
364
+ description: 'Stronger focus borders and active states for keyboard and gamepad navigation.',
365
+ value: preferences.focusVisibility,
366
+ options: listFocusVisibilitySegmentOptions(),
367
+ });
368
+ aura.ui.toggle('adventure-pause-subtitles', {
369
+ label: 'Subtitles',
370
+ value: preferences.subtitlesEnabled === true,
371
+ width: 'fill',
372
+ });
373
+ aura.ui.toggle('adventure-pause-reduce-motion', {
374
+ label: 'Reduce motion',
375
+ value: preferences.reduceMotion === true,
376
+ width: 'fill',
377
+ });
378
+ }
379
+
380
+ aura.ui.endColumn();
381
+
382
+ const subtitlesEnabled = readBooleanViewValue('adventure-pause-subtitles', preferences.subtitlesEnabled);
383
+ const reduceMotion = readBooleanViewValue('adventure-pause-reduce-motion', preferences.reduceMotion);
384
+ const preferencePatch = {};
385
+ if (textScaleControl.changed) preferencePatch.textScale = textScaleControl.value;
386
+ if (focusControl.changed) preferencePatch.focusVisibility = focusControl.value;
387
+ if (subtitlesEnabled !== preferences.subtitlesEnabled) preferencePatch.subtitlesEnabled = subtitlesEnabled;
388
+ if (reduceMotion !== preferences.reduceMotion) preferencePatch.reduceMotion = reduceMotion;
389
+ if (Object.keys(preferencePatch).length > 0) {
390
+ updatePreferences(context, appState, preferencePatch);
391
+ }
392
+
393
+ if (profileField.submitted) {
394
+ const committedName = normalizeProfileName(profileField.value);
395
+ adventureSession.profileName = committedName;
396
+ adventureSession.lastSubmittedProfileName = committedName;
397
+ }
398
+ if (slotList.changed) {
399
+ adventureSession.activeSaveSlotId = slotList.value;
400
+ }
401
+
402
+ const actions = renderActionStrip({
403
+ id: 'adventure-pause-actions',
404
+ actions: [
405
+ { id: 'resume', label: 'Resume' },
406
+ { id: 'restart', label: 'Restart Route' },
407
+ { id: 'restore-defaults', label: 'Restore Defaults' },
408
+ ],
409
+ });
410
+
411
+ aura.ui.text('adventure-pause-actions-note', {
412
+ text: 'Resume and restart stay in screenShell. Restore defaults resets shared UI preferences but keeps durable profile and save-slot values.',
413
+ size: 12,
414
+ color: '#9db2cb',
415
+ });
416
+
417
+ aura.ui.endColumn();
418
+ aura.ui.endRow();
419
+ aura.ui.endView();
420
+
421
+ if (!profileField.editing && aura.input.isKeyPressed('escape')) {
422
+ context.popModalScreen?.({ action: 'resume' });
423
+ return;
424
+ }
425
+
426
+ if (actions.actionId === 'resume') {
427
+ context.popModalScreen?.({ action: 'resume' });
428
+ } else if (actions.actionId === 'restart') {
429
+ context.popModalScreen?.({ action: 'restart' });
430
+ context.restartCurrentScene?.();
431
+ } else if (actions.actionId === 'restore-defaults') {
432
+ resetPreferences(context, appState);
433
+ pauseView.activeSection = 'accessibility';
434
+ }
435
+ }
436
+
437
+ export default pauseScreen;