@auraindustry/aurajs 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -2
- package/benchmarks/perf-thresholds.json +54 -0
- package/package.json +4 -7
- package/src/asset-pack.mjs +5 -1
- package/src/authored-project.mjs +1449 -0
- package/src/authored-runtime.mjs +2016 -0
- package/src/authoring/avatar-animation-graph.mjs +648 -0
- package/src/bin-integrity.mjs +272 -0
- package/src/build-contract/assets.mjs +130 -0
- package/src/build-contract/capabilities.mjs +116 -0
- package/src/build-contract/constants.mjs +6 -0
- package/src/build-contract/helpers.mjs +44 -0
- package/src/build-contract/web-templates.mjs +5993 -0
- package/src/build-contract.mjs +27 -2910
- package/src/bundler.mjs +188 -55
- package/src/cli.mjs +4825 -1512
- package/src/commands/project-authoring.mjs +434 -0
- package/src/config.mjs +27 -0
- package/src/conformance/cases/app-and-ui-runtime-cases.mjs +3309 -0
- package/src/conformance/cases/core-runtime-cases.mjs +1431 -0
- package/src/conformance/cases/index.mjs +11 -0
- package/src/conformance/cases/scene3d-and-media-cases.mjs +2094 -0
- package/src/conformance/cases/systems-and-gameplay-cases.mjs +1776 -0
- package/src/conformance/shared.mjs +27 -0
- package/src/conformance-runner.mjs +25 -13
- package/src/conformance.mjs +619 -4020
- package/src/cutscene.mjs +362 -5
- package/src/dev-cli-action.mjs +249 -0
- package/src/dev-cli-inspect.mjs +92 -0
- package/src/dev-cli-state.mjs +80 -0
- package/src/external-asset-cache.mjs +587 -0
- package/src/external-asset-policy.mjs +217 -0
- package/src/external-package-surface.mjs +206 -0
- package/src/game-action-runtime.mjs +869 -0
- package/src/game-state-runtime.mjs +206 -6
- package/src/headless-action.mjs +186 -0
- package/src/headless-test/runtime-animation.mjs +1173 -0
- package/src/headless-test/runtime-coordinator.mjs +1514 -0
- package/src/headless-test/runtime-primitives.mjs +320 -0
- package/src/headless-test/runtime-world.mjs +2253 -0
- package/src/headless-test.mjs +392 -4298
- package/src/host-binary.mjs +342 -14
- package/src/icon-discovery.mjs +64 -0
- package/src/make-catalog.mjs +109 -0
- package/src/make.mjs +197 -0
- package/src/package-integrity.mjs +586 -0
- package/src/perf-benchmark.mjs +353 -0
- package/src/postinstall.mjs +5 -5
- package/src/prefabs/index.mjs +34 -0
- package/src/prefabs/scene-serialization.mjs +184 -0
- package/src/project-importer.mjs +620 -0
- package/src/project-registry.mjs +24 -0
- package/src/publish-command.mjs +195 -0
- package/src/publish-env-example.mjs +83 -0
- package/src/publish-validation.mjs +708 -0
- package/src/retro/assets/compile.mjs +232 -0
- package/src/retro/backend-gba/authoring.mjs +1029 -0
- package/src/retro/backend-gba/rom.mjs +363 -0
- package/src/retro/backend-gbc/rom.mjs +85 -0
- package/src/retro/build.mjs +278 -0
- package/src/retro/cli/commands.mjs +292 -0
- package/src/retro/cli/templates.mjs +84 -0
- package/src/retro/diagnostics/catalog.mjs +110 -0
- package/src/retro/diagnostics/emit.mjs +72 -0
- package/src/retro/emulator/case-overlay.mjs +64 -0
- package/src/retro/emulator/discovery.mjs +158 -0
- package/src/retro/emulator/macos-case-overlay.swift +220 -0
- package/src/retro/emulator/profiles.mjs +146 -0
- package/src/retro/emulator/runner.mjs +289 -0
- package/src/retro/frontend/load-project.mjs +98 -0
- package/src/retro/index.mjs +30 -0
- package/src/retro/ir/build-ir.mjs +108 -0
- package/src/retro/runtime-gba/contract.mjs +151 -0
- package/src/retro/runtime-gbc/contract.mjs +117 -0
- package/src/retro/shared/span.mjs +26 -0
- package/src/retro/shared/targets.mjs +64 -0
- package/src/retro/validator/check-project.mjs +114 -0
- package/src/runtime-hotspot-audit.mjs +707 -0
- package/src/scaffold/config.mjs +1000 -0
- package/src/scaffold/fs.mjs +56 -0
- package/src/scaffold/layout.mjs +318 -0
- package/src/scaffold/project-docs.mjs +438 -0
- package/src/scaffold.mjs +93 -596
- package/src/scene-composition/index.mjs +326 -0
- package/src/scene-composition/runtime.mjs +751 -0
- package/src/self-hosted-assets.mjs +604 -0
- package/src/session-client.mjs +750 -0
- package/src/session-native-launcher.mjs +74 -0
- package/src/session-protocol.mjs +75 -0
- package/src/session-runtime.mjs +321 -0
- package/src/session-server.mjs +360 -0
- package/src/shader-kits/index.mjs +773 -0
- package/src/starter-content-registry.mjs +292 -0
- package/src/state-artifacts.mjs +662 -24
- package/src/state-dev-reload.mjs +99 -2
- package/src/terminal-ui.mjs +245 -0
- package/src/web-conformance.mjs +219 -0
- package/templates/create/2d/config/gameplay/shooter.config.js +26 -0
- package/templates/create/2d/content/gameplay/waves.json +26 -0
- package/templates/create/2d/content/registries/.gitkeep +1 -0
- package/templates/create/2d/docs/design/.gitkeep +1 -0
- package/templates/create/2d/docs/design/loop.md +5 -0
- package/templates/create/2d/prefabs/enemies.prefab.js +90 -0
- package/templates/create/2d/prefabs/enemy-basic.prefab.js +18 -0
- package/templates/create/2d/prefabs/player.prefab.js +36 -0
- package/templates/create/2d/prefabs/projectiles.prefab.js +35 -0
- package/templates/create/2d/scenes/boot.scene.js +12 -0
- package/templates/create/2d/scenes/gameplay.scene.js +230 -0
- package/templates/create/2d/scenes/menu.scene.js +9 -0
- package/templates/create/2d/src/main.js +6 -185
- package/templates/create/2d/src/runtime/app.js +49 -0
- package/templates/create/2d/src/runtime/capabilities.js +35 -0
- package/templates/create/2d/ui/hud.screen.js +40 -0
- package/templates/create/2d/ui/pause.screen.js +149 -0
- package/templates/create/2d/ui/settings.screen.js +347 -0
- package/templates/create/2d/ui/title.screen.js +13 -0
- package/templates/create/2d-adventure/aura.config.json +28 -0
- package/templates/create/2d-adventure/config/gameplay/adventure.config.js +14 -0
- package/templates/create/2d-adventure/content/gameplay/world.js +46 -0
- package/templates/create/2d-adventure/content/registries/.gitkeep +1 -0
- package/templates/create/2d-adventure/docs/design/loop.md +5 -0
- package/templates/create/2d-adventure/prefabs/player.prefab.js +54 -0
- package/templates/create/2d-adventure/prefabs/relic.prefab.js +38 -0
- package/templates/create/2d-adventure/prefabs/world.prefab.js +125 -0
- package/templates/create/2d-adventure/scenes/gameplay.scene.js +256 -0
- package/templates/create/2d-adventure/src/runtime/capabilities.js +34 -0
- package/templates/create/2d-adventure/ui/hud.screen.js +60 -0
- package/templates/create/2d-survivor/config/gameplay/survivor.config.js +33 -0
- package/templates/create/2d-survivor/content/gameplay/spawn-zones.json +29 -0
- package/templates/create/2d-survivor/content/registries/.gitkeep +1 -0
- package/templates/create/2d-survivor/docs/design/.gitkeep +1 -0
- package/templates/create/2d-survivor/docs/design/loop.md +5 -0
- package/templates/create/2d-survivor/prefabs/enemies.prefab.js +178 -0
- package/templates/create/2d-survivor/prefabs/enemy-swarm.prefab.js +18 -0
- package/templates/create/2d-survivor/prefabs/player.prefab.js +42 -0
- package/templates/create/2d-survivor/prefabs/projectiles.prefab.js +56 -0
- package/templates/create/2d-survivor/scenes/boot.scene.js +12 -0
- package/templates/create/2d-survivor/scenes/gameplay.scene.js +314 -0
- package/templates/create/2d-survivor/scenes/menu.scene.js +9 -0
- package/templates/create/2d-survivor/src/main.js +5 -332
- package/templates/create/2d-survivor/src/runtime/app.js +49 -0
- package/templates/create/2d-survivor/src/runtime/capabilities.js +35 -0
- package/templates/create/2d-survivor/ui/hud.screen.js +45 -0
- package/templates/create/2d-survivor/ui/title.screen.js +13 -0
- package/templates/create/3d/assets/models/starter-avatar.gltf +184 -0
- package/templates/create/3d/config/gameplay/.gitkeep +1 -0
- package/templates/create/3d/content/gameplay/checkpoints.json +33 -0
- package/templates/create/3d/content/gameplay/course.js +40 -0
- package/templates/create/3d/content/registries/.gitkeep +1 -0
- package/templates/create/3d/docs/design/.gitkeep +1 -0
- package/templates/create/3d/docs/design/loop.md +5 -0
- package/templates/create/3d/prefabs/checkpoint.prefab.js +15 -0
- package/templates/create/3d/prefabs/player.prefab.js +204 -0
- package/templates/create/3d/prefabs/world.prefab.js +112 -0
- package/templates/create/3d/scenes/boot.scene.js +12 -0
- package/templates/create/3d/scenes/checkpoint.scene.js +9 -0
- package/templates/create/3d/scenes/gameplay.scene.js +292 -0
- package/templates/create/3d/src/main.js +6 -295
- package/templates/create/3d/src/runtime/app.js +49 -0
- package/templates/create/3d/src/runtime/capabilities.js +53 -0
- package/templates/create/3d/src/runtime/materials.js +34 -0
- package/templates/create/3d/src/runtime/state.js +39 -0
- package/templates/create/3d/ui/hud.screen.js +75 -0
- package/templates/create/3d/ui/pause.screen.js +166 -0
- package/templates/create/3d/ui/settings.screen.js +387 -0
- package/templates/create/3d-adventure/assets/models/starter-avatar.gltf +184 -0
- package/templates/create/3d-adventure/aura.config.json +28 -0
- package/templates/create/3d-adventure/config/gameplay/adventure.config.js +9 -0
- package/templates/create/3d-adventure/content/gameplay/course.js +62 -0
- package/templates/create/3d-adventure/content/registries/.gitkeep +1 -0
- package/templates/create/3d-adventure/docs/design/loop.md +5 -0
- package/templates/create/3d-adventure/prefabs/player.prefab.js +168 -0
- package/templates/create/3d-adventure/prefabs/relic.prefab.js +35 -0
- package/templates/create/3d-adventure/prefabs/world.prefab.js +119 -0
- package/templates/create/3d-adventure/scenes/gameplay.scene.js +358 -0
- package/templates/create/3d-adventure/src/runtime/capabilities.js +56 -0
- package/templates/create/3d-adventure/src/runtime/materials.js +39 -0
- package/templates/create/3d-adventure/src/runtime/state.js +31 -0
- package/templates/create/3d-adventure/ui/hud.screen.js +70 -0
- package/templates/create/3d-adventure/ui/pause.screen.js +437 -0
- package/templates/create/3d-collectathon/assets/models/starter-avatar.gltf +184 -0
- package/templates/create/3d-collectathon/config/gameplay/.gitkeep +1 -0
- package/templates/create/3d-collectathon/content/gameplay/collectibles.json +26 -0
- package/templates/create/3d-collectathon/content/gameplay/course.js +46 -0
- package/templates/create/3d-collectathon/content/registries/.gitkeep +1 -0
- package/templates/create/3d-collectathon/docs/design/.gitkeep +1 -0
- package/templates/create/3d-collectathon/docs/design/loop.md +5 -0
- package/templates/create/3d-collectathon/prefabs/collectible.prefab.js +15 -0
- package/templates/create/3d-collectathon/prefabs/player.prefab.js +207 -0
- package/templates/create/3d-collectathon/prefabs/world.prefab.js +112 -0
- package/templates/create/3d-collectathon/scenes/boot.scene.js +12 -0
- package/templates/create/3d-collectathon/scenes/checkpoint.scene.js +9 -0
- package/templates/create/3d-collectathon/scenes/gameplay.scene.js +200 -0
- package/templates/create/3d-collectathon/src/main.js +5 -355
- package/templates/create/3d-collectathon/src/runtime/app.js +49 -0
- package/templates/create/3d-collectathon/src/runtime/capabilities.js +53 -0
- package/templates/create/3d-collectathon/src/runtime/materials.js +34 -0
- package/templates/create/3d-collectathon/src/runtime/state.js +27 -0
- package/templates/create/3d-collectathon/ui/hud.screen.js +66 -0
- package/templates/create/3d-collectathon/ui/pause.screen.js +13 -0
- package/templates/create/blank/config/gameplay/.gitkeep +1 -0
- package/templates/create/blank/content/gameplay/.gitkeep +1 -0
- package/templates/create/blank/content/registries/.gitkeep +1 -0
- package/templates/create/blank/docs/design/.gitkeep +1 -0
- package/templates/create/blank/docs/design/loop.md +5 -0
- package/templates/create/blank/prefabs/.gitkeep +1 -0
- package/templates/create/blank/scenes/.gitkeep +1 -0
- package/templates/create/blank/src/runtime/.gitkeep +1 -0
- package/templates/create/blank/ui/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/assets/audio/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/assets/fonts/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/assets/sprites/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/assets/starter/README.md +11 -0
- package/templates/create/deckbuilder-2d/assets/ui/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/aura.config.json +28 -0
- package/templates/create/deckbuilder-2d/config/gameplay/deckbuilder.config.js +26 -0
- package/templates/create/deckbuilder-2d/content/cards/guard.card.js +19 -0
- package/templates/create/deckbuilder-2d/content/cards/spark.card.js +20 -0
- package/templates/create/deckbuilder-2d/content/cards/starter.deck.js +69 -0
- package/templates/create/deckbuilder-2d/content/cards/strike.card.js +19 -0
- package/templates/create/deckbuilder-2d/content/cards/survey.card.js +20 -0
- package/templates/create/deckbuilder-2d/content/encounters/training-battle.encounter.js +14 -0
- package/templates/create/deckbuilder-2d/content/encounters/training-battle.js +65 -0
- package/templates/create/deckbuilder-2d/content/enemies/training-automaton.enemy.js +48 -0
- package/templates/create/deckbuilder-2d/content/gameplay/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/content/registries/cards.registry.js +26 -0
- package/templates/create/deckbuilder-2d/content/registries/encounters.registry.js +20 -0
- package/templates/create/deckbuilder-2d/content/registries/enemies.registry.js +20 -0
- package/templates/create/deckbuilder-2d/content/registries/relics.registry.js +20 -0
- package/templates/create/deckbuilder-2d/content/relics/ember-charm.relic.js +18 -0
- package/templates/create/deckbuilder-2d/docs/design/loop.md +12 -0
- package/templates/create/deckbuilder-2d/prefabs/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/scenes/boot.scene.js +84 -0
- package/templates/create/deckbuilder-2d/scenes/gameplay.scene.js +641 -0
- package/templates/create/deckbuilder-2d/src/components/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/src/main.js +17 -0
- package/templates/create/deckbuilder-2d/src/runtime/capabilities.js +22 -0
- package/templates/create/deckbuilder-2d/src/shared/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/src/systems/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/tests/smoke/.gitkeep +1 -0
- package/templates/create/deckbuilder-2d/ui/hud.screen.js +80 -0
- package/templates/create/deckbuilder-2d/ui/pause.screen.js +146 -0
- package/templates/create/deckbuilder-2d/ui/settings.screen.js +342 -0
- package/templates/create/local-multiplayer/aura.config.json +40 -0
- package/templates/create/local-multiplayer/config/gameplay/local-multiplayer.config.js +26 -0
- package/templates/create/local-multiplayer/content/gameplay/room-layout.js +13 -0
- package/templates/create/local-multiplayer/content/registries/.gitkeep +1 -0
- package/templates/create/local-multiplayer/docs/design/loop.md +14 -0
- package/templates/create/local-multiplayer/prefabs/player.prefab.js +99 -0
- package/templates/create/local-multiplayer/scenes/boot.scene.js +12 -0
- package/templates/create/local-multiplayer/scenes/gameplay.scene.js +443 -0
- package/templates/create/local-multiplayer/src/main.js +17 -0
- package/templates/create/local-multiplayer/src/runtime/capabilities.js +28 -0
- package/templates/create/local-multiplayer/ui/hud.screen.js +60 -0
- package/templates/create/shared/src/runtime/project-inspector.js +105 -0
- package/templates/create/shared/src/runtime/scene-flow.js +290 -0
- package/templates/create/shared/src/runtime/screen-shell.js +222 -0
- package/templates/create/shared/src/runtime/ui-forms.js +209 -0
- package/templates/create/shared/src/runtime/ui-settings.js +237 -0
- package/templates/create/shared/src/runtime/ui-theme.js +352 -0
- package/templates/create/shared/src/starter-utils/adventure-objectives.js +102 -0
- package/templates/create/shared/src/starter-utils/animation-2d.js +337 -0
- package/templates/create/shared/src/starter-utils/avatar-3d.js +404 -0
- package/templates/create/shared/src/starter-utils/combat-feedback-2d.js +320 -0
- package/templates/create/shared/src/starter-utils/core.js +39 -3
- package/templates/create/shared/src/starter-utils/index.js +8 -2
- package/templates/create/shared/src/starter-utils/platformer-3d.js +34 -3
- package/templates/create/shared/src/starter-utils/triggers.js +662 -0
- package/templates/create/shared/src/starter-utils/tween-2d.js +615 -0
- package/templates/create/video-cutscene/assets/video/.gitkeep +0 -0
- package/templates/create/video-cutscene/aura.config.json +28 -0
- package/templates/create/video-cutscene/config/gameplay/.gitkeep +0 -0
- package/templates/create/video-cutscene/content/gameplay/.gitkeep +0 -0
- package/templates/create/video-cutscene/content/registries/.gitkeep +0 -0
- package/templates/create/video-cutscene/docs/design/loop.md +22 -0
- package/templates/create/video-cutscene/prefabs/.gitkeep +0 -0
- package/templates/create/video-cutscene/scenes/boot.scene.js +11 -0
- package/templates/create/video-cutscene/scenes/cutscene.scene.js +113 -0
- package/templates/create/video-cutscene/scenes/gameplay.scene.js +50 -0
- package/templates/create/video-cutscene/src/main.js +17 -0
- package/templates/create/video-cutscene/src/runtime/app.js +52 -0
- package/templates/create/video-cutscene/src/runtime/capabilities.js +35 -0
- package/templates/create/video-cutscene/src/runtime/state.js +13 -0
- package/templates/create/video-cutscene/ui/.gitkeep +0 -0
- package/templates/create-bin/play.js +1187 -0
- package/templates/make/README.md +46 -0
- package/templates/make/catalog.json +51 -0
- package/templates/make/component/files/{{MAKE_NAME}}.component.js +20 -0
- package/templates/make/component/manifest.json +9 -0
- package/templates/make/data/files/{{MAKE_NAME}}.json +14 -0
- package/templates/make/data/manifest.json +9 -0
- package/templates/make/material/files/{{MAKE_NAME}}.material.json +17 -0
- package/templates/make/material/manifest.json +9 -0
- package/templates/make/prefab/files/{{MAKE_NAME}}.prefab.js +20 -0
- package/templates/make/prefab/manifest.json +9 -0
- package/templates/make/scene/files/{{MAKE_NAME}}.scene.js +31 -0
- package/templates/make/scene/manifest.json +9 -0
- package/templates/make/shader/files/{{MAKE_NAME}}.shader.js +23 -0
- package/templates/make/shader/manifest.json +9 -0
- package/templates/make/system/files/{{MAKE_NAME}}.system.js +15 -0
- package/templates/make/system/manifest.json +9 -0
- package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.js +16 -0
- package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.json +23 -0
- package/templates/make/ui-screen/manifest.json +10 -0
- package/templates/make-starters/deckbuilder-2d/card/files/{{MAKE_NAME}}.card.js +22 -0
- package/templates/make-starters/deckbuilder-2d/card/manifest.json +9 -0
- package/templates/make-starters/deckbuilder-2d/catalog.json +34 -0
- package/templates/make-starters/deckbuilder-2d/encounter/files/{{MAKE_NAME}}.encounter.js +18 -0
- package/templates/make-starters/deckbuilder-2d/encounter/manifest.json +9 -0
- package/templates/make-starters/deckbuilder-2d/enemy/files/{{MAKE_NAME}}.enemy.js +28 -0
- package/templates/make-starters/deckbuilder-2d/enemy/manifest.json +9 -0
- package/templates/make-starters/deckbuilder-2d/relic/files/{{MAKE_NAME}}.relic.js +23 -0
- package/templates/make-starters/deckbuilder-2d/relic/manifest.json +9 -0
- package/templates/retro/platformer/README.md +10 -0
- package/templates/retro/platformer/assets/retro/assets.json +91 -0
- package/templates/retro/platformer/aura.config.json +7 -0
- package/templates/retro/platformer/package.json +5 -0
- package/templates/retro/platformer/src/main.js +40 -0
- package/templates/retro/puzzle-grid/README.md +10 -0
- package/templates/retro/puzzle-grid/assets/retro/assets.json +90 -0
- package/templates/retro/puzzle-grid/aura.config.json +7 -0
- package/templates/retro/puzzle-grid/package.json +5 -0
- package/templates/retro/puzzle-grid/src/main.js +29 -0
- package/templates/retro/tactics-grid/README.md +10 -0
- package/templates/retro/tactics-grid/assets/retro/assets.json +90 -0
- package/templates/retro/tactics-grid/aura.config.json +7 -0
- package/templates/retro/tactics-grid/package.json +5 -0
- package/templates/retro/tactics-grid/src/main.js +35 -0
- package/templates/retro/topdown-adventure/README.md +10 -0
- package/templates/retro/topdown-adventure/assets/retro/assets.json +95 -0
- package/templates/retro/topdown-adventure/aura.config.json +7 -0
- package/templates/retro/topdown-adventure/package.json +5 -0
- package/templates/retro/topdown-adventure/src/main.js +29 -0
- package/templates/skills/aurajs/SKILL.md +61 -5
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
export const UI_THEME_SCHEMA = 'aurajs.ui-theme.v1';
|
|
2
|
+
export const UI_PREFERENCES_SCHEMA = 'aurajs.ui-preferences.v1';
|
|
3
|
+
|
|
4
|
+
const UI_THEME_PRESETS = Object.freeze({
|
|
5
|
+
'signal-dawn': Object.freeze({
|
|
6
|
+
id: 'signal-dawn',
|
|
7
|
+
label: 'Signal Dawn',
|
|
8
|
+
description: 'Warm amber callouts over slate control panels.',
|
|
9
|
+
theme: Object.freeze({
|
|
10
|
+
gap: 10,
|
|
11
|
+
padding: 12,
|
|
12
|
+
fontSize: 16,
|
|
13
|
+
lineHeight: 20,
|
|
14
|
+
buttonHeight: 38,
|
|
15
|
+
borderWidth: 1,
|
|
16
|
+
textColor: '#eef5ff',
|
|
17
|
+
mutedTextColor: '#9db2cb',
|
|
18
|
+
panelColor: '#0d1622',
|
|
19
|
+
panelBorderColor: '#314e68',
|
|
20
|
+
buttonColor: '#132132',
|
|
21
|
+
buttonHoverColor: '#203853',
|
|
22
|
+
buttonFocusColor: '#1e5b97',
|
|
23
|
+
buttonActiveColor: '#2183d6',
|
|
24
|
+
buttonTextColor: '#ffffff',
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
'midnight-arcade': Object.freeze({
|
|
28
|
+
id: 'midnight-arcade',
|
|
29
|
+
label: 'Midnight Arcade',
|
|
30
|
+
description: 'Neon cyan and magenta over a darker cabinet shell.',
|
|
31
|
+
theme: Object.freeze({
|
|
32
|
+
gap: 10,
|
|
33
|
+
padding: 12,
|
|
34
|
+
fontSize: 16,
|
|
35
|
+
lineHeight: 20,
|
|
36
|
+
buttonHeight: 38,
|
|
37
|
+
borderWidth: 1,
|
|
38
|
+
textColor: '#f5f8ff',
|
|
39
|
+
mutedTextColor: '#a9b4de',
|
|
40
|
+
panelColor: '#090d18',
|
|
41
|
+
panelBorderColor: '#4d3f82',
|
|
42
|
+
buttonColor: '#101728',
|
|
43
|
+
buttonHoverColor: '#21304f',
|
|
44
|
+
buttonFocusColor: '#7a49ff',
|
|
45
|
+
buttonActiveColor: '#f062d0',
|
|
46
|
+
buttonTextColor: '#ffffff',
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
'pine-night': Object.freeze({
|
|
50
|
+
id: 'pine-night',
|
|
51
|
+
label: 'Pine Night',
|
|
52
|
+
description: 'Forest greens and bright mint accents for readable HUDs.',
|
|
53
|
+
theme: Object.freeze({
|
|
54
|
+
gap: 10,
|
|
55
|
+
padding: 12,
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
lineHeight: 20,
|
|
58
|
+
buttonHeight: 38,
|
|
59
|
+
borderWidth: 1,
|
|
60
|
+
textColor: '#eef7f2',
|
|
61
|
+
mutedTextColor: '#adc8bb',
|
|
62
|
+
panelColor: '#0b1713',
|
|
63
|
+
panelBorderColor: '#35584b',
|
|
64
|
+
buttonColor: '#13241e',
|
|
65
|
+
buttonHoverColor: '#1e3a31',
|
|
66
|
+
buttonFocusColor: '#2d7b63',
|
|
67
|
+
buttonActiveColor: '#4fb98c',
|
|
68
|
+
buttonTextColor: '#ffffff',
|
|
69
|
+
}),
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const UI_DENSITY_CHOICES = Object.freeze([
|
|
74
|
+
Object.freeze({ id: 'compact', label: 'Compact', description: 'Tighter gaps and shorter controls.' }),
|
|
75
|
+
Object.freeze({ id: 'cozy', label: 'Cozy', description: 'A roomier default for game settings screens.' }),
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
const UI_CONTRAST_CHOICES = Object.freeze([
|
|
79
|
+
Object.freeze({ id: 'standard', label: 'Standard', description: 'Default contrast and chrome.' }),
|
|
80
|
+
Object.freeze({ id: 'high', label: 'High', description: 'Brighter text and stronger borders.' }),
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
const UI_TEXT_SCALE_CHOICES = Object.freeze([
|
|
84
|
+
Object.freeze({ id: 'normal', label: 'Normal', description: 'Default retained UI text scale.' }),
|
|
85
|
+
Object.freeze({ id: 'large', label: 'Large', description: 'Increase retained UI text and control readability.' }),
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
const UI_FOCUS_VISIBILITY_CHOICES = Object.freeze([
|
|
89
|
+
Object.freeze({ id: 'standard', label: 'Standard', description: 'Default focus emphasis.' }),
|
|
90
|
+
Object.freeze({ id: 'high', label: 'High', description: 'Stronger focus contrast and borders.' }),
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
const DEFAULT_UI_PREFERENCES = Object.freeze({
|
|
94
|
+
schema: UI_PREFERENCES_SCHEMA,
|
|
95
|
+
themeId: 'signal-dawn',
|
|
96
|
+
density: 'cozy',
|
|
97
|
+
contrast: 'standard',
|
|
98
|
+
textScale: 'normal',
|
|
99
|
+
focusVisibility: 'standard',
|
|
100
|
+
musicEnabled: true,
|
|
101
|
+
subtitlesEnabled: false,
|
|
102
|
+
masterVolume: 8,
|
|
103
|
+
reduceMotion: false,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
function cloneUiValue(value) {
|
|
107
|
+
if (Array.isArray(value)) {
|
|
108
|
+
return value.map((entry) => cloneUiValue(entry));
|
|
109
|
+
}
|
|
110
|
+
if (value && typeof value === 'object') {
|
|
111
|
+
const output = {};
|
|
112
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
113
|
+
output[key] = cloneUiValue(entry);
|
|
114
|
+
}
|
|
115
|
+
return output;
|
|
116
|
+
}
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function clampNumber(value, min, max, fallback) {
|
|
121
|
+
const numeric = Number(value);
|
|
122
|
+
if (!Number.isFinite(numeric)) return fallback;
|
|
123
|
+
return Math.max(min, Math.min(max, numeric));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function normalizeChoice(value, choices, fallback) {
|
|
127
|
+
const normalized = typeof value === 'string' ? value.trim() : '';
|
|
128
|
+
if (!normalized) return fallback;
|
|
129
|
+
return choices.some((entry) => entry.id === normalized) ? normalized : fallback;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function normalizeBoolean(value, fallback) {
|
|
133
|
+
if (value === true) return true;
|
|
134
|
+
if (value === false) return false;
|
|
135
|
+
return fallback;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function ensureUiBucket(appState) {
|
|
139
|
+
if (!appState || typeof appState !== 'object' || Array.isArray(appState)) {
|
|
140
|
+
throw new Error('Expected appState to be a mutable object.');
|
|
141
|
+
}
|
|
142
|
+
if (!appState.ui || typeof appState.ui !== 'object' || Array.isArray(appState.ui)) {
|
|
143
|
+
appState.ui = {};
|
|
144
|
+
}
|
|
145
|
+
return appState.ui;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function densityThemePatch(density) {
|
|
149
|
+
if (density === 'compact') {
|
|
150
|
+
return {
|
|
151
|
+
gap: 8,
|
|
152
|
+
padding: 10,
|
|
153
|
+
fontSize: 15,
|
|
154
|
+
lineHeight: 18,
|
|
155
|
+
buttonHeight: 34,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
gap: 12,
|
|
160
|
+
padding: 14,
|
|
161
|
+
fontSize: 16,
|
|
162
|
+
lineHeight: 20,
|
|
163
|
+
buttonHeight: 40,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function contrastThemePatch(contrast) {
|
|
168
|
+
if (contrast === 'high') {
|
|
169
|
+
return {
|
|
170
|
+
textColor: '#ffffff',
|
|
171
|
+
mutedTextColor: '#d4e1ff',
|
|
172
|
+
panelBorderColor: '#ffffff',
|
|
173
|
+
buttonFocusColor: '#ffffff',
|
|
174
|
+
buttonTextColor: '#08111b',
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
return {};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function textScaleThemePatch(textScale) {
|
|
181
|
+
if (textScale === 'large') {
|
|
182
|
+
return {
|
|
183
|
+
fontSize: 18,
|
|
184
|
+
lineHeight: 22,
|
|
185
|
+
buttonHeight: 44,
|
|
186
|
+
padding: 16,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return {};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function focusVisibilityThemePatch(focusVisibility) {
|
|
193
|
+
if (focusVisibility === 'high') {
|
|
194
|
+
return {
|
|
195
|
+
borderWidth: 2,
|
|
196
|
+
panelBorderColor: '#f4f8ff',
|
|
197
|
+
buttonFocusColor: '#f4f8ff',
|
|
198
|
+
buttonActiveColor: '#ffd166',
|
|
199
|
+
buttonTextColor: '#08111b',
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return {};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function listUiThemeChoices() {
|
|
206
|
+
return Object.values(UI_THEME_PRESETS).map((entry) => ({
|
|
207
|
+
id: entry.id,
|
|
208
|
+
label: entry.label,
|
|
209
|
+
description: entry.description,
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function listUiDensityChoices() {
|
|
214
|
+
return UI_DENSITY_CHOICES.map((entry) => ({ ...entry }));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function listUiContrastChoices() {
|
|
218
|
+
return UI_CONTRAST_CHOICES.map((entry) => ({ ...entry }));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function listUiTextScaleChoices() {
|
|
222
|
+
return UI_TEXT_SCALE_CHOICES.map((entry) => ({ ...entry }));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function listUiFocusVisibilityChoices() {
|
|
226
|
+
return UI_FOCUS_VISIBILITY_CHOICES.map((entry) => ({ ...entry }));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function createUiPreferencesSeed(overrides = {}) {
|
|
230
|
+
const source = overrides && typeof overrides === 'object' && !Array.isArray(overrides)
|
|
231
|
+
? overrides
|
|
232
|
+
: {};
|
|
233
|
+
return {
|
|
234
|
+
schema: UI_PREFERENCES_SCHEMA,
|
|
235
|
+
themeId: normalizeChoice(source.themeId, listUiThemeChoices(), DEFAULT_UI_PREFERENCES.themeId),
|
|
236
|
+
density: normalizeChoice(source.density, UI_DENSITY_CHOICES, DEFAULT_UI_PREFERENCES.density),
|
|
237
|
+
contrast: normalizeChoice(source.contrast, UI_CONTRAST_CHOICES, DEFAULT_UI_PREFERENCES.contrast),
|
|
238
|
+
textScale: normalizeChoice(source.textScale, UI_TEXT_SCALE_CHOICES, DEFAULT_UI_PREFERENCES.textScale),
|
|
239
|
+
focusVisibility: normalizeChoice(
|
|
240
|
+
source.focusVisibility,
|
|
241
|
+
UI_FOCUS_VISIBILITY_CHOICES,
|
|
242
|
+
DEFAULT_UI_PREFERENCES.focusVisibility,
|
|
243
|
+
),
|
|
244
|
+
musicEnabled: normalizeBoolean(source.musicEnabled, DEFAULT_UI_PREFERENCES.musicEnabled),
|
|
245
|
+
subtitlesEnabled: normalizeBoolean(source.subtitlesEnabled, DEFAULT_UI_PREFERENCES.subtitlesEnabled),
|
|
246
|
+
masterVolume: Math.round(clampNumber(source.masterVolume, 0, 10, DEFAULT_UI_PREFERENCES.masterVolume)),
|
|
247
|
+
reduceMotion: normalizeBoolean(source.reduceMotion, DEFAULT_UI_PREFERENCES.reduceMotion),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function normalizeUiPreferences(source = null) {
|
|
252
|
+
const merged = source && typeof source === 'object' && !Array.isArray(source)
|
|
253
|
+
? { ...DEFAULT_UI_PREFERENCES, ...source }
|
|
254
|
+
: { ...DEFAULT_UI_PREFERENCES };
|
|
255
|
+
return createUiPreferencesSeed(merged);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export function ensureUiPreferences(appState, seed = null) {
|
|
259
|
+
const ui = ensureUiBucket(appState);
|
|
260
|
+
const fallback = createUiPreferencesSeed(seed || {});
|
|
261
|
+
if (!ui.preferences || typeof ui.preferences !== 'object' || Array.isArray(ui.preferences)) {
|
|
262
|
+
ui.preferences = fallback;
|
|
263
|
+
return ui.preferences;
|
|
264
|
+
}
|
|
265
|
+
ui.preferences = normalizeUiPreferences({
|
|
266
|
+
...fallback,
|
|
267
|
+
...ui.preferences,
|
|
268
|
+
});
|
|
269
|
+
return ui.preferences;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function updateUiPreferences(appState, patch = {}) {
|
|
273
|
+
const current = ensureUiPreferences(appState);
|
|
274
|
+
const next = normalizeUiPreferences({
|
|
275
|
+
...current,
|
|
276
|
+
...(patch && typeof patch === 'object' && !Array.isArray(patch) ? patch : {}),
|
|
277
|
+
});
|
|
278
|
+
const changedKeys = Object.keys(next).filter((key) => JSON.stringify(current[key]) !== JSON.stringify(next[key]));
|
|
279
|
+
ensureUiBucket(appState).preferences = next;
|
|
280
|
+
return {
|
|
281
|
+
ok: true,
|
|
282
|
+
reasonCode: changedKeys.length > 0 ? 'ui_preferences_updated' : 'ui_preferences_unchanged',
|
|
283
|
+
changedKeys,
|
|
284
|
+
preferences: cloneUiValue(next),
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function resetUiPreferences(appState, seed = null) {
|
|
289
|
+
const next = createUiPreferencesSeed(seed || {});
|
|
290
|
+
ensureUiBucket(appState).preferences = next;
|
|
291
|
+
return {
|
|
292
|
+
ok: true,
|
|
293
|
+
reasonCode: 'ui_preferences_reset',
|
|
294
|
+
preferences: cloneUiValue(next),
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function resolveUiTheme(preferences = null) {
|
|
299
|
+
const normalized = normalizeUiPreferences(preferences);
|
|
300
|
+
const preset = UI_THEME_PRESETS[normalized.themeId] || UI_THEME_PRESETS[DEFAULT_UI_PREFERENCES.themeId];
|
|
301
|
+
const theme = {
|
|
302
|
+
...cloneUiValue(preset.theme),
|
|
303
|
+
...densityThemePatch(normalized.density),
|
|
304
|
+
...contrastThemePatch(normalized.contrast),
|
|
305
|
+
...textScaleThemePatch(normalized.textScale),
|
|
306
|
+
...focusVisibilityThemePatch(normalized.focusVisibility),
|
|
307
|
+
};
|
|
308
|
+
return {
|
|
309
|
+
schema: UI_THEME_SCHEMA,
|
|
310
|
+
reasonCode: 'ui_theme_ready',
|
|
311
|
+
presetId: preset.id,
|
|
312
|
+
presetLabel: preset.label,
|
|
313
|
+
density: normalized.density,
|
|
314
|
+
contrast: normalized.contrast,
|
|
315
|
+
textScale: normalized.textScale,
|
|
316
|
+
focusVisibility: normalized.focusVisibility,
|
|
317
|
+
preferences: cloneUiValue(normalized),
|
|
318
|
+
theme,
|
|
319
|
+
availableThemeIds: Object.keys(UI_THEME_PRESETS),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export function inspectUiTheme(appState) {
|
|
324
|
+
return resolveUiTheme(ensureUiPreferences(appState));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export function applyUiTheme(appState, { preferences = null } = {}) {
|
|
328
|
+
const themeState = preferences
|
|
329
|
+
? resolveUiTheme(preferences)
|
|
330
|
+
: inspectUiTheme(appState);
|
|
331
|
+
const runtime = globalThis.aura;
|
|
332
|
+
if (!runtime?.ui || typeof runtime.ui.setTheme !== 'function') {
|
|
333
|
+
return {
|
|
334
|
+
ok: false,
|
|
335
|
+
reasonCode: 'ui_theme_runtime_unavailable',
|
|
336
|
+
themeState,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
const result = runtime.ui.setTheme(themeState.theme);
|
|
340
|
+
if (result?.ok === false) {
|
|
341
|
+
return {
|
|
342
|
+
ok: false,
|
|
343
|
+
reasonCode: result.reasonCode || 'ui_theme_apply_failed',
|
|
344
|
+
themeState,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
ok: true,
|
|
349
|
+
reasonCode: result?.reasonCode || 'ui_theme_updated',
|
|
350
|
+
themeState,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { distanceSquared2D, distanceSquared3D } from './core.js';
|
|
2
|
+
|
|
3
|
+
function finite(value, fallback = 0) {
|
|
4
|
+
const numeric = Number(value);
|
|
5
|
+
return Number.isFinite(numeric) ? numeric : fallback;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function normalizeId(value, fallback) {
|
|
9
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
10
|
+
return value.trim();
|
|
11
|
+
}
|
|
12
|
+
return fallback;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function normalizeLabel(value, fallback) {
|
|
16
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
17
|
+
return value.trim();
|
|
18
|
+
}
|
|
19
|
+
return fallback;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function normalizeObjectiveEntry(entry, index, options = {}) {
|
|
23
|
+
const dimension = options.dimension === '3d' ? '3d' : '2d';
|
|
24
|
+
const fallbackId = `objective-${index + 1}`;
|
|
25
|
+
const fallbackLabel = `Objective ${index + 1}`;
|
|
26
|
+
return {
|
|
27
|
+
id: normalizeId(entry?.id, fallbackId),
|
|
28
|
+
label: normalizeLabel(entry?.label ?? entry?.name, fallbackLabel),
|
|
29
|
+
x: finite(entry?.x),
|
|
30
|
+
y: finite(entry?.y),
|
|
31
|
+
z: dimension === '3d' ? finite(entry?.z) : 0,
|
|
32
|
+
radius: Math.max(0.1, finite(entry?.radius, finite(options.defaultRadius, 1))),
|
|
33
|
+
value: Math.max(1, Math.round(finite(entry?.value, 1))),
|
|
34
|
+
collected: entry?.collected === true,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function createAdventureObjectives(entries = [], options = {}) {
|
|
39
|
+
return (Array.isArray(entries) ? entries : []).map((entry, index) => normalizeObjectiveEntry(entry, index, options));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function resetAdventureObjectives(objectives) {
|
|
43
|
+
for (const objective of Array.isArray(objectives) ? objectives : []) {
|
|
44
|
+
objective.collected = false;
|
|
45
|
+
}
|
|
46
|
+
return objectives;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function countCompletedObjectives(objectives) {
|
|
50
|
+
return (Array.isArray(objectives) ? objectives : []).reduce(
|
|
51
|
+
(total, objective) => total + (objective?.collected === true ? 1 : 0),
|
|
52
|
+
0,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function objectivesComplete(objectives, requiredCount = null) {
|
|
57
|
+
const totalObjectives = Array.isArray(objectives) ? objectives.length : 0;
|
|
58
|
+
const threshold = Number.isFinite(Number(requiredCount))
|
|
59
|
+
? Math.max(0, Math.min(totalObjectives, Number(requiredCount)))
|
|
60
|
+
: totalObjectives;
|
|
61
|
+
return countCompletedObjectives(objectives) >= threshold;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function firstPendingObjective(objectives) {
|
|
65
|
+
return (Array.isArray(objectives) ? objectives : []).find((objective) => objective?.collected !== true) || null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function collectAdventureObjectives(subject, objectives, pickupRadius, measureDistanceSquared) {
|
|
69
|
+
const collected = [];
|
|
70
|
+
const extraRadius = Math.max(0, finite(pickupRadius, 0));
|
|
71
|
+
let scoreDelta = 0;
|
|
72
|
+
|
|
73
|
+
for (const objective of Array.isArray(objectives) ? objectives : []) {
|
|
74
|
+
if (!objective || objective.collected === true) continue;
|
|
75
|
+
const threshold = objective.radius + extraRadius;
|
|
76
|
+
if (measureDistanceSquared(subject, objective) > (threshold * threshold)) continue;
|
|
77
|
+
objective.collected = true;
|
|
78
|
+
scoreDelta += objective.value;
|
|
79
|
+
collected.push({
|
|
80
|
+
id: objective.id,
|
|
81
|
+
label: objective.label,
|
|
82
|
+
value: objective.value,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
changed: collected.length > 0,
|
|
88
|
+
collected,
|
|
89
|
+
collectedCount: collected.length,
|
|
90
|
+
scoreDelta,
|
|
91
|
+
completedObjectives: countCompletedObjectives(objectives),
|
|
92
|
+
totalObjectives: Array.isArray(objectives) ? objectives.length : 0,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function collectAdventureObjectives2D(subject, objectives, pickupRadius = 0) {
|
|
97
|
+
return collectAdventureObjectives(subject, objectives, pickupRadius, distanceSquared2D);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function collectAdventureObjectives3D(subject, objectives, pickupRadius = 0) {
|
|
101
|
+
return collectAdventureObjectives(subject, objectives, pickupRadius, distanceSquared3D);
|
|
102
|
+
}
|