Split the monolithic 5393-line app.js into 32 focused ES modules under modules/ with a thin ~330-line orchestrator. No bundler required — runs in-browser via import maps. Module structure: core/ — scene, ticker, state, theme, audio data/ — gitea, weather, bitcoin, loaders terrain/ — stars, clouds, island effects/ — matrix-rain, energy-beam, lightning, shockwave, rune-ring, gravity-zones panels/ — heatmap, sigil, sovereignty, dual-brain, batcave, earth, agent-board, lora-panel portals/ — portal-system, commit-banners narrative/ — bookshelves, oath, chat utils/ — perlin All files pass node --check. No new dependencies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
849 B
JavaScript
36 lines
849 B
JavaScript
// modules/core/state.js — Shared reactive data bus
|
|
// All data modules write here, all visual modules read from here.
|
|
|
|
export const state = {
|
|
// Commit data (written by data/gitea.js)
|
|
zoneIntensity: {},
|
|
commits: [],
|
|
commitHashes: [],
|
|
|
|
// Agent status (written by data/gitea.js)
|
|
agentStatus: null,
|
|
activeAgentCount: 0,
|
|
|
|
// Weather (written by data/weather.js)
|
|
weather: null,
|
|
|
|
// Bitcoin (written by data/bitcoin.js)
|
|
blockHeight: 0,
|
|
lastBlockHeight: 0,
|
|
newBlockDetected: false,
|
|
|
|
// Portal data (written by data/loaders.js)
|
|
portals: [],
|
|
sovereignty: null,
|
|
soulMd: '',
|
|
|
|
// Star pulse (set by bitcoin module, read by stars)
|
|
starPulseIntensity: 0,
|
|
|
|
// Computed
|
|
totalActivity() {
|
|
const vals = Object.values(this.zoneIntensity);
|
|
return vals.reduce((s, v) => s + v, 0) / Math.max(vals.length, 1);
|
|
},
|
|
};
|