idlerpg.sh 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 +171 -0
- package/dist/affix/AffixRegistry.d.ts +68 -0
- package/dist/affix/AffixRegistry.d.ts.map +1 -0
- package/dist/affix/AffixRegistry.js +245 -0
- package/dist/affix/AffixRegistry.js.map +1 -0
- package/dist/affix/PluginLoader.d.ts +66 -0
- package/dist/affix/PluginLoader.d.ts.map +1 -0
- package/dist/affix/PluginLoader.js +321 -0
- package/dist/affix/PluginLoader.js.map +1 -0
- package/dist/affix/builtin.d.ts +6 -0
- package/dist/affix/builtin.d.ts.map +1 -0
- package/dist/affix/builtin.js +311 -0
- package/dist/affix/builtin.js.map +1 -0
- package/dist/affix/index.d.ts +8 -0
- package/dist/affix/index.d.ts.map +1 -0
- package/dist/affix/index.js +11 -0
- package/dist/affix/index.js.map +1 -0
- package/dist/affix/types.d.ts +152 -0
- package/dist/affix/types.d.ts.map +1 -0
- package/dist/affix/types.js +8 -0
- package/dist/affix/types.js.map +1 -0
- package/dist/ai/PlayKitClient.d.ts +208 -0
- package/dist/ai/PlayKitClient.d.ts.map +1 -0
- package/dist/ai/PlayKitClient.js +721 -0
- package/dist/ai/PlayKitClient.js.map +1 -0
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +8 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/app/App.d.ts +85 -0
- package/dist/app/App.d.ts.map +1 -0
- package/dist/app/App.js +296 -0
- package/dist/app/App.js.map +1 -0
- package/dist/app/EventBus.d.ts +222 -0
- package/dist/app/EventBus.d.ts.map +1 -0
- package/dist/app/EventBus.js +88 -0
- package/dist/app/EventBus.js.map +1 -0
- package/dist/app/Keybind.d.ts +83 -0
- package/dist/app/Keybind.d.ts.map +1 -0
- package/dist/app/Keybind.js +184 -0
- package/dist/app/Keybind.js.map +1 -0
- package/dist/app/Router.d.ts +123 -0
- package/dist/app/Router.d.ts.map +1 -0
- package/dist/app/Router.js +142 -0
- package/dist/app/Router.js.map +1 -0
- package/dist/app/ScreenManager.d.ts +97 -0
- package/dist/app/ScreenManager.d.ts.map +1 -0
- package/dist/app/ScreenManager.js +216 -0
- package/dist/app/ScreenManager.js.map +1 -0
- package/dist/app/index.d.ts +14 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +19 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/screens/BaseScreen.d.ts +101 -0
- package/dist/app/screens/BaseScreen.d.ts.map +1 -0
- package/dist/app/screens/BaseScreen.js +132 -0
- package/dist/app/screens/BaseScreen.js.map +1 -0
- package/dist/app/screens/CharacterCreationScreen.d.ts +42 -0
- package/dist/app/screens/CharacterCreationScreen.d.ts.map +1 -0
- package/dist/app/screens/CharacterCreationScreen.js +467 -0
- package/dist/app/screens/CharacterCreationScreen.js.map +1 -0
- package/dist/app/screens/CombatScreen.d.ts +30 -0
- package/dist/app/screens/CombatScreen.d.ts.map +1 -0
- package/dist/app/screens/CombatScreen.js +309 -0
- package/dist/app/screens/CombatScreen.js.map +1 -0
- package/dist/app/screens/DialogScreen.d.ts +29 -0
- package/dist/app/screens/DialogScreen.d.ts.map +1 -0
- package/dist/app/screens/DialogScreen.js +295 -0
- package/dist/app/screens/DialogScreen.js.map +1 -0
- package/dist/app/screens/ExploreScreen.d.ts +50 -0
- package/dist/app/screens/ExploreScreen.d.ts.map +1 -0
- package/dist/app/screens/ExploreScreen.js +308 -0
- package/dist/app/screens/ExploreScreen.js.map +1 -0
- package/dist/app/screens/HelpScreen.d.ts +12 -0
- package/dist/app/screens/HelpScreen.d.ts.map +1 -0
- package/dist/app/screens/HelpScreen.js +155 -0
- package/dist/app/screens/HelpScreen.js.map +1 -0
- package/dist/app/screens/InventoryScreen.d.ts +27 -0
- package/dist/app/screens/InventoryScreen.d.ts.map +1 -0
- package/dist/app/screens/InventoryScreen.js +326 -0
- package/dist/app/screens/InventoryScreen.js.map +1 -0
- package/dist/app/screens/PrologueScreen.d.ts +24 -0
- package/dist/app/screens/PrologueScreen.d.ts.map +1 -0
- package/dist/app/screens/PrologueScreen.js +176 -0
- package/dist/app/screens/PrologueScreen.js.map +1 -0
- package/dist/app/screens/TitleScreen.d.ts +42 -0
- package/dist/app/screens/TitleScreen.d.ts.map +1 -0
- package/dist/app/screens/TitleScreen.js +380 -0
- package/dist/app/screens/TitleScreen.js.map +1 -0
- package/dist/app/screens/TravelScreen.d.ts +22 -0
- package/dist/app/screens/TravelScreen.d.ts.map +1 -0
- package/dist/app/screens/TravelScreen.js +122 -0
- package/dist/app/screens/TravelScreen.js.map +1 -0
- package/dist/app/screens/index.d.ts +14 -0
- package/dist/app/screens/index.d.ts.map +1 -0
- package/dist/app/screens/index.js +17 -0
- package/dist/app/screens/index.js.map +1 -0
- package/dist/commands/CommandRegistry.d.ts +91 -0
- package/dist/commands/CommandRegistry.d.ts.map +1 -0
- package/dist/commands/CommandRegistry.js +159 -0
- package/dist/commands/CommandRegistry.js.map +1 -0
- package/dist/commands/index.d.ts +7 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +10 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/core/Actor.d.ts +103 -0
- package/dist/core/Actor.d.ts.map +1 -0
- package/dist/core/Actor.js +409 -0
- package/dist/core/Actor.js.map +1 -0
- package/dist/core/Combat.d.ts +37 -0
- package/dist/core/Combat.d.ts.map +1 -0
- package/dist/core/Combat.js +294 -0
- package/dist/core/Combat.js.map +1 -0
- package/dist/core/DungeonRunner.d.ts +169 -0
- package/dist/core/DungeonRunner.d.ts.map +1 -0
- package/dist/core/DungeonRunner.js +627 -0
- package/dist/core/DungeonRunner.js.map +1 -0
- package/dist/core/Game.d.ts +133 -0
- package/dist/core/Game.d.ts.map +1 -0
- package/dist/core/Game.js +644 -0
- package/dist/core/Game.js.map +1 -0
- package/dist/core/IdleCombat.d.ts +61 -0
- package/dist/core/IdleCombat.d.ts.map +1 -0
- package/dist/core/IdleCombat.js +461 -0
- package/dist/core/IdleCombat.js.map +1 -0
- package/dist/core/IdleGameManager.d.ts +198 -0
- package/dist/core/IdleGameManager.d.ts.map +1 -0
- package/dist/core/IdleGameManager.js +688 -0
- package/dist/core/IdleGameManager.js.map +1 -0
- package/dist/core/IdleSaveManager.d.ts +109 -0
- package/dist/core/IdleSaveManager.d.ts.map +1 -0
- package/dist/core/IdleSaveManager.js +296 -0
- package/dist/core/IdleSaveManager.js.map +1 -0
- package/dist/core/NewGameFlowManager.d.ts +64 -0
- package/dist/core/NewGameFlowManager.d.ts.map +1 -0
- package/dist/core/NewGameFlowManager.js +153 -0
- package/dist/core/NewGameFlowManager.js.map +1 -0
- package/dist/core/Player.d.ts +65 -0
- package/dist/core/Player.d.ts.map +1 -0
- package/dist/core/Player.js +261 -0
- package/dist/core/Player.js.map +1 -0
- package/dist/core/RoomHandlers.d.ts +75 -0
- package/dist/core/RoomHandlers.d.ts.map +1 -0
- package/dist/core/RoomHandlers.js +383 -0
- package/dist/core/RoomHandlers.js.map +1 -0
- package/dist/core/SaveManager.d.ts +84 -0
- package/dist/core/SaveManager.d.ts.map +1 -0
- package/dist/core/SaveManager.js +281 -0
- package/dist/core/SaveManager.js.map +1 -0
- package/dist/core/SaveMigration.d.ts +69 -0
- package/dist/core/SaveMigration.d.ts.map +1 -0
- package/dist/core/SaveMigration.js +408 -0
- package/dist/core/SaveMigration.js.map +1 -0
- package/dist/core/StateAdapter.d.ts +79 -0
- package/dist/core/StateAdapter.d.ts.map +1 -0
- package/dist/core/StateAdapter.js +397 -0
- package/dist/core/StateAdapter.js.map +1 -0
- package/dist/core/Team.d.ts +145 -0
- package/dist/core/Team.d.ts.map +1 -0
- package/dist/core/Team.js +371 -0
- package/dist/core/Team.js.map +1 -0
- package/dist/core/TeamCombat.d.ts +88 -0
- package/dist/core/TeamCombat.d.ts.map +1 -0
- package/dist/core/TeamCombat.js +405 -0
- package/dist/core/TeamCombat.js.map +1 -0
- package/dist/core/TeamDungeonRunner.d.ts +186 -0
- package/dist/core/TeamDungeonRunner.d.ts.map +1 -0
- package/dist/core/TeamDungeonRunner.js +758 -0
- package/dist/core/TeamDungeonRunner.js.map +1 -0
- package/dist/core/TimeManager.d.ts +114 -0
- package/dist/core/TimeManager.d.ts.map +1 -0
- package/dist/core/TimeManager.js +318 -0
- package/dist/core/TimeManager.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/timeConstants.d.ts +135 -0
- package/dist/core/timeConstants.d.ts.map +1 -0
- package/dist/core/timeConstants.js +157 -0
- package/dist/core/timeConstants.js.map +1 -0
- package/dist/core/types.d.ts +780 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +16 -0
- package/dist/core/types.js.map +1 -0
- package/dist/data/continents/index.d.ts +163 -0
- package/dist/data/continents/index.d.ts.map +1 -0
- package/dist/data/continents/index.js +31 -0
- package/dist/data/continents/index.js.map +1 -0
- package/dist/data/continents/verdantia.d.ts +294 -0
- package/dist/data/continents/verdantia.d.ts.map +1 -0
- package/dist/data/continents/verdantia.js +327 -0
- package/dist/data/continents/verdantia.js.map +1 -0
- package/dist/handlers/DialogHandler.d.ts +95 -0
- package/dist/handlers/DialogHandler.d.ts.map +1 -0
- package/dist/handlers/DialogHandler.js +450 -0
- package/dist/handlers/DialogHandler.js.map +1 -0
- package/dist/handlers/SaveLoadHandler.d.ts +60 -0
- package/dist/handlers/SaveLoadHandler.d.ts.map +1 -0
- package/dist/handlers/SaveLoadHandler.js +187 -0
- package/dist/handlers/SaveLoadHandler.js.map +1 -0
- package/dist/handlers/TitleScreenHandler.d.ts +43 -0
- package/dist/handlers/TitleScreenHandler.d.ts.map +1 -0
- package/dist/handlers/TitleScreenHandler.js +508 -0
- package/dist/handlers/TitleScreenHandler.js.map +1 -0
- package/dist/handlers/WorkshopHandler.d.ts +75 -0
- package/dist/handlers/WorkshopHandler.d.ts.map +1 -0
- package/dist/handlers/WorkshopHandler.js +401 -0
- package/dist/handlers/WorkshopHandler.js.map +1 -0
- package/dist/handlers/index.d.ts +12 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +14 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/types.d.ts +34 -0
- package/dist/handlers/types.d.ts.map +1 -0
- package/dist/handlers/types.js +8 -0
- package/dist/handlers/types.js.map +1 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +130 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +40 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +105 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/types.d.ts +133 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +8 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/i18n/zh.d.ts +3 -0
- package/dist/i18n/zh.d.ts.map +1 -0
- package/dist/i18n/zh.js +130 -0
- package/dist/i18n/zh.js.map +1 -0
- package/dist/instrument.d.ts +8 -0
- package/dist/instrument.d.ts.map +1 -0
- package/dist/instrument.js +33 -0
- package/dist/instrument.js.map +1 -0
- package/dist/main-new.d.ts +12 -0
- package/dist/main-new.d.ts.map +1 -0
- package/dist/main-new.js +32 -0
- package/dist/main-new.js.map +1 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +2816 -0
- package/dist/main.js.map +1 -0
- package/dist/map/ContinentManager.d.ts +88 -0
- package/dist/map/ContinentManager.d.ts.map +1 -0
- package/dist/map/ContinentManager.js +241 -0
- package/dist/map/ContinentManager.js.map +1 -0
- package/dist/map/DungeonGenerator.d.ts +32 -0
- package/dist/map/DungeonGenerator.d.ts.map +1 -0
- package/dist/map/DungeonGenerator.js +615 -0
- package/dist/map/DungeonGenerator.js.map +1 -0
- package/dist/map/MapGenerator.d.ts +27 -0
- package/dist/map/MapGenerator.d.ts.map +1 -0
- package/dist/map/MapGenerator.js +485 -0
- package/dist/map/MapGenerator.js.map +1 -0
- package/dist/map/index.d.ts +5 -0
- package/dist/map/index.d.ts.map +1 -0
- package/dist/map/index.js +8 -0
- package/dist/map/index.js.map +1 -0
- package/dist/npc/NPCGenerator.d.ts +68 -0
- package/dist/npc/NPCGenerator.d.ts.map +1 -0
- package/dist/npc/NPCGenerator.js +468 -0
- package/dist/npc/NPCGenerator.js.map +1 -0
- package/dist/npc/NPCManager.d.ts +86 -0
- package/dist/npc/NPCManager.d.ts.map +1 -0
- package/dist/npc/NPCManager.js +217 -0
- package/dist/npc/NPCManager.js.map +1 -0
- package/dist/npc/fixedNPCs.d.ts +7 -0
- package/dist/npc/fixedNPCs.d.ts.map +1 -0
- package/dist/npc/fixedNPCs.js +196 -0
- package/dist/npc/fixedNPCs.js.map +1 -0
- package/dist/npc/index.d.ts +9 -0
- package/dist/npc/index.d.ts.map +1 -0
- package/dist/npc/index.js +12 -0
- package/dist/npc/index.js.map +1 -0
- package/dist/npc/traits.d.ts +33 -0
- package/dist/npc/traits.d.ts.map +1 -0
- package/dist/npc/traits.js +795 -0
- package/dist/npc/traits.js.map +1 -0
- package/dist/npc/types.d.ts +193 -0
- package/dist/npc/types.d.ts.map +1 -0
- package/dist/npc/types.js +9 -0
- package/dist/npc/types.js.map +1 -0
- package/dist/quest/QuestManager.d.ts +79 -0
- package/dist/quest/QuestManager.d.ts.map +1 -0
- package/dist/quest/QuestManager.js +273 -0
- package/dist/quest/QuestManager.js.map +1 -0
- package/dist/quest/index.d.ts +6 -0
- package/dist/quest/index.d.ts.map +1 -0
- package/dist/quest/index.js +9 -0
- package/dist/quest/index.js.map +1 -0
- package/dist/quest/types.d.ts +81 -0
- package/dist/quest/types.d.ts.map +1 -0
- package/dist/quest/types.js +8 -0
- package/dist/quest/types.js.map +1 -0
- package/dist/strategy/StrategyExecutor.d.ts +159 -0
- package/dist/strategy/StrategyExecutor.d.ts.map +1 -0
- package/dist/strategy/StrategyExecutor.js +479 -0
- package/dist/strategy/StrategyExecutor.js.map +1 -0
- package/dist/strategy/StrategyParser.d.ts +48 -0
- package/dist/strategy/StrategyParser.d.ts.map +1 -0
- package/dist/strategy/StrategyParser.js +321 -0
- package/dist/strategy/StrategyParser.js.map +1 -0
- package/dist/strategy/defaultStrategy.d.ts +40 -0
- package/dist/strategy/defaultStrategy.d.ts.map +1 -0
- package/dist/strategy/defaultStrategy.js +254 -0
- package/dist/strategy/defaultStrategy.js.map +1 -0
- package/dist/strategy/index.d.ts +8 -0
- package/dist/strategy/index.d.ts.map +1 -0
- package/dist/strategy/index.js +14 -0
- package/dist/strategy/index.js.map +1 -0
- package/dist/tui/ExploreMenu.d.ts +106 -0
- package/dist/tui/ExploreMenu.d.ts.map +1 -0
- package/dist/tui/ExploreMenu.js +282 -0
- package/dist/tui/ExploreMenu.js.map +1 -0
- package/dist/tui/GameUI.d.ts +313 -0
- package/dist/tui/GameUI.d.ts.map +1 -0
- package/dist/tui/GameUI.js +2116 -0
- package/dist/tui/GameUI.js.map +1 -0
- package/dist/tui/GameUIAdapter.d.ts +207 -0
- package/dist/tui/GameUIAdapter.d.ts.map +1 -0
- package/dist/tui/GameUIAdapter.js +1342 -0
- package/dist/tui/GameUIAdapter.js.map +1 -0
- package/dist/tui/Input.d.ts +139 -0
- package/dist/tui/Input.d.ts.map +1 -0
- package/dist/tui/Input.js +278 -0
- package/dist/tui/Input.js.map +1 -0
- package/dist/tui/Menu.d.ts +110 -0
- package/dist/tui/Menu.d.ts.map +1 -0
- package/dist/tui/Menu.js +365 -0
- package/dist/tui/Menu.js.map +1 -0
- package/dist/tui/Screen.d.ts +228 -0
- package/dist/tui/Screen.d.ts.map +1 -0
- package/dist/tui/Screen.js +502 -0
- package/dist/tui/Screen.js.map +1 -0
- package/dist/tui/components/Box.d.ts +36 -0
- package/dist/tui/components/Box.d.ts.map +1 -0
- package/dist/tui/components/Box.js +43 -0
- package/dist/tui/components/Box.js.map +1 -0
- package/dist/tui/components/List.d.ts +69 -0
- package/dist/tui/components/List.d.ts.map +1 -0
- package/dist/tui/components/List.js +136 -0
- package/dist/tui/components/List.js.map +1 -0
- package/dist/tui/components/ProgressBar.d.ts +42 -0
- package/dist/tui/components/ProgressBar.d.ts.map +1 -0
- package/dist/tui/components/ProgressBar.js +75 -0
- package/dist/tui/components/ProgressBar.js.map +1 -0
- package/dist/tui/components/index.d.ts +8 -0
- package/dist/tui/components/index.d.ts.map +1 -0
- package/dist/tui/components/index.js +11 -0
- package/dist/tui/components/index.js.map +1 -0
- package/dist/tui/core/BaseSection.d.ts +98 -0
- package/dist/tui/core/BaseSection.d.ts.map +1 -0
- package/dist/tui/core/BaseSection.js +174 -0
- package/dist/tui/core/BaseSection.js.map +1 -0
- package/dist/tui/core/Component.d.ts +61 -0
- package/dist/tui/core/Component.d.ts.map +1 -0
- package/dist/tui/core/Component.js +32 -0
- package/dist/tui/core/Component.js.map +1 -0
- package/dist/tui/core/Section.d.ts +101 -0
- package/dist/tui/core/Section.d.ts.map +1 -0
- package/dist/tui/core/Section.js +24 -0
- package/dist/tui/core/Section.js.map +1 -0
- package/dist/tui/core/SectionManager.d.ts +108 -0
- package/dist/tui/core/SectionManager.d.ts.map +1 -0
- package/dist/tui/core/SectionManager.js +258 -0
- package/dist/tui/core/SectionManager.js.map +1 -0
- package/dist/tui/core/index.d.ts +9 -0
- package/dist/tui/core/index.d.ts.map +1 -0
- package/dist/tui/core/index.js +12 -0
- package/dist/tui/core/index.js.map +1 -0
- package/dist/tui/index.d.ts +15 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +23 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/screens/BaseScreen.d.ts +62 -0
- package/dist/tui/screens/BaseScreen.d.ts.map +1 -0
- package/dist/tui/screens/BaseScreen.js +55 -0
- package/dist/tui/screens/BaseScreen.js.map +1 -0
- package/dist/tui/screens/CombatScreen.d.ts +43 -0
- package/dist/tui/screens/CombatScreen.d.ts.map +1 -0
- package/dist/tui/screens/CombatScreen.js +125 -0
- package/dist/tui/screens/CombatScreen.js.map +1 -0
- package/dist/tui/screens/DialogScreen.d.ts +53 -0
- package/dist/tui/screens/DialogScreen.d.ts.map +1 -0
- package/dist/tui/screens/DialogScreen.js +90 -0
- package/dist/tui/screens/DialogScreen.js.map +1 -0
- package/dist/tui/screens/DungeonScreen.d.ts +80 -0
- package/dist/tui/screens/DungeonScreen.d.ts.map +1 -0
- package/dist/tui/screens/DungeonScreen.js +317 -0
- package/dist/tui/screens/DungeonScreen.js.map +1 -0
- package/dist/tui/screens/ExploreScreen.d.ts +69 -0
- package/dist/tui/screens/ExploreScreen.d.ts.map +1 -0
- package/dist/tui/screens/ExploreScreen.js +224 -0
- package/dist/tui/screens/ExploreScreen.js.map +1 -0
- package/dist/tui/screens/SectionScreen.d.ts +84 -0
- package/dist/tui/screens/SectionScreen.d.ts.map +1 -0
- package/dist/tui/screens/SectionScreen.js +156 -0
- package/dist/tui/screens/SectionScreen.js.map +1 -0
- package/dist/tui/screens/TitleScreen.d.ts +40 -0
- package/dist/tui/screens/TitleScreen.d.ts.map +1 -0
- package/dist/tui/screens/TitleScreen.js +253 -0
- package/dist/tui/screens/TitleScreen.js.map +1 -0
- package/dist/tui/screens/TownScreen.d.ts +98 -0
- package/dist/tui/screens/TownScreen.d.ts.map +1 -0
- package/dist/tui/screens/TownScreen.js +370 -0
- package/dist/tui/screens/TownScreen.js.map +1 -0
- package/dist/tui/screens/TravelScreen.d.ts +67 -0
- package/dist/tui/screens/TravelScreen.d.ts.map +1 -0
- package/dist/tui/screens/TravelScreen.js +286 -0
- package/dist/tui/screens/TravelScreen.js.map +1 -0
- package/dist/tui/screens/index.d.ts +8 -0
- package/dist/tui/screens/index.d.ts.map +1 -0
- package/dist/tui/screens/index.js +17 -0
- package/dist/tui/screens/index.js.map +1 -0
- package/dist/tui/sections/ActionsSection.d.ts +71 -0
- package/dist/tui/sections/ActionsSection.d.ts.map +1 -0
- package/dist/tui/sections/ActionsSection.js +184 -0
- package/dist/tui/sections/ActionsSection.js.map +1 -0
- package/dist/tui/sections/DungeonSection.d.ts +65 -0
- package/dist/tui/sections/DungeonSection.d.ts.map +1 -0
- package/dist/tui/sections/DungeonSection.js +144 -0
- package/dist/tui/sections/DungeonSection.js.map +1 -0
- package/dist/tui/sections/EventsSection.d.ts +50 -0
- package/dist/tui/sections/EventsSection.d.ts.map +1 -0
- package/dist/tui/sections/EventsSection.js +134 -0
- package/dist/tui/sections/EventsSection.js.map +1 -0
- package/dist/tui/sections/MapSection.d.ts +66 -0
- package/dist/tui/sections/MapSection.d.ts.map +1 -0
- package/dist/tui/sections/MapSection.js +669 -0
- package/dist/tui/sections/MapSection.js.map +1 -0
- package/dist/tui/sections/StatusSection.d.ts +47 -0
- package/dist/tui/sections/StatusSection.d.ts.map +1 -0
- package/dist/tui/sections/StatusSection.js +133 -0
- package/dist/tui/sections/StatusSection.js.map +1 -0
- package/dist/tui/sections/TeamSection.d.ts +71 -0
- package/dist/tui/sections/TeamSection.d.ts.map +1 -0
- package/dist/tui/sections/TeamSection.js +224 -0
- package/dist/tui/sections/TeamSection.js.map +1 -0
- package/dist/tui/sections/TravelingSection.d.ts +51 -0
- package/dist/tui/sections/TravelingSection.d.ts.map +1 -0
- package/dist/tui/sections/TravelingSection.js +106 -0
- package/dist/tui/sections/TravelingSection.js.map +1 -0
- package/dist/tui/sections/index.d.ts +9 -0
- package/dist/tui/sections/index.d.ts.map +1 -0
- package/dist/tui/sections/index.js +12 -0
- package/dist/tui/sections/index.js.map +1 -0
- package/dist/ui/Terminal.d.ts +68 -0
- package/dist/ui/Terminal.d.ts.map +1 -0
- package/dist/ui/Terminal.js +297 -0
- package/dist/ui/Terminal.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +8 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/utils/configMigration.d.ts +14 -0
- package/dist/utils/configMigration.d.ts.map +1 -0
- package/dist/utils/configMigration.js +92 -0
- package/dist/utils/configMigration.js.map +1 -0
- package/dist/utils/errorHandler.d.ts +86 -0
- package/dist/utils/errorHandler.d.ts.map +1 -0
- package/dist/utils/errorHandler.js +224 -0
- package/dist/utils/errorHandler.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +43 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/weapon/WeaponFactory.d.ts +32 -0
- package/dist/weapon/WeaponFactory.d.ts.map +1 -0
- package/dist/weapon/WeaponFactory.js +216 -0
- package/dist/weapon/WeaponFactory.js.map +1 -0
- package/dist/weapon/index.d.ts +5 -0
- package/dist/weapon/index.d.ts.map +1 -0
- package/dist/weapon/index.js +8 -0
- package/dist/weapon/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseSection.js","sources":["tui/core/BaseSection.ts"],"sourceRoot":"/","sourcesContent":["/**\r\n * Base Section - Abstract implementation of ISection\r\n * Provides common functionality for all sections\r\n */\r\n\r\nimport type { Rect, RenderContext } from './Component.js';\r\nimport type { ISection, SectionState, SectionHints } from './Section.js';\r\nimport { createSectionState, createSectionHints } from './Section.js';\r\nimport type { KeyEvent } from '../Input.js';\r\nimport { ANSI } from '../Screen.js';\r\n\r\n/**\r\n * Base section configuration\r\n */\r\nexport interface BaseSectionConfig {\r\n id: string;\r\n title: string;\r\n canEnter?: boolean;\r\n hints?: Partial<SectionHints>;\r\n}\r\n\r\n/**\r\n * Abstract base class for sections\r\n * Handles common behavior: focus styling, navigation, state management\r\n */\r\nexport abstract class BaseSection implements ISection {\r\n readonly id: string;\r\n readonly title: string;\r\n readonly canEnter: boolean;\r\n\r\n focused: boolean = false;\r\n state: SectionState;\r\n hints: SectionHints;\r\n bounds: Rect = { x: 0, y: 0, width: 0, height: 0 };\r\n\r\n constructor(config: BaseSectionConfig) {\r\n this.id = config.id;\r\n this.title = config.title;\r\n this.canEnter = config.canEnter ?? true;\r\n this.state = createSectionState();\r\n this.hints = createSectionHints(\r\n config.hints?.focused,\r\n config.hints?.entered\r\n );\r\n if (config.hints?.unfocused) {\r\n this.hints.unfocused = config.hints.unfocused;\r\n }\r\n }\r\n\r\n /**\r\n * Render the section\r\n * Template method: calls renderBox, then renderContent\r\n */\r\n render(ctx: RenderContext): void {\r\n this.bounds = ctx.bounds;\r\n this.renderBox(ctx);\r\n this.renderContent(ctx);\r\n this.renderHint(ctx);\r\n }\r\n\r\n /**\r\n * Render the section box with appropriate styling\r\n */\r\n protected renderBox(ctx: RenderContext): void {\r\n const { screen, bounds } = ctx;\r\n const { x, y, width, height } = bounds;\r\n\r\n // Determine title text and styling based on state\r\n const displayTitle = this.state.entered ? `[ ${this.title} ]` : this.title;\r\n const titleFg = this.focused ? ANSI.fg.black : ANSI.fg.cyan;\r\n const titleBg = this.focused ? ANSI.bg.cyan : undefined;\r\n\r\n // Draw the box\r\n screen.drawBox(x, y, width, height, displayTitle, false, titleFg, titleBg);\r\n\r\n // Draw focus indicator ('+') when focused but not entered\r\n if (this.focused && !this.state.entered) {\r\n screen.write(x, y, '+', ANSI.fg.yellow);\r\n }\r\n }\r\n\r\n /**\r\n * Render section-specific content\r\n * Must be implemented by subclasses\r\n */\r\n protected abstract renderContent(ctx: RenderContext): void;\r\n\r\n /**\r\n * Render hint at the bottom of the section\r\n */\r\n protected renderHint(ctx: RenderContext): void {\r\n const hint = this.getCurrentHint();\r\n if (hint) {\r\n const { screen, bounds } = ctx;\r\n screen.write(\r\n bounds.x + 2,\r\n bounds.y + bounds.height - 1,\r\n hint.slice(0, bounds.width - 4),\r\n ANSI.fg.gray\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Handle key input\r\n * Default implementation handles basic up/down/enter/escape\r\n */\r\n handleKey(key: KeyEvent): boolean {\r\n if (!this.state.entered) {\r\n return false;\r\n }\r\n\r\n switch (key.name) {\r\n case 'escape':\r\n this.exit();\r\n return true;\r\n\r\n case 'up':\r\n case 'k':\r\n this.moveSelection(-1);\r\n return true;\r\n\r\n case 'down':\r\n case 'j':\r\n this.moveSelection(1);\r\n return true;\r\n\r\n case 'return':\r\n case 'space':\r\n return this.activateItem();\r\n\r\n default:\r\n return this.handleCustomKey(key);\r\n }\r\n }\r\n\r\n /**\r\n * Handle section-specific key input\r\n * Override in subclasses for custom key handling\r\n */\r\n protected handleCustomKey(key: KeyEvent): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Enter the section\r\n */\r\n enter(): void {\r\n if (!this.canEnter) return;\r\n this.state.entered = true;\r\n this.state.selectedIndex = 0;\r\n this.state.scrollOffset = 0;\r\n }\r\n\r\n /**\r\n * Exit the section\r\n */\r\n exit(): void {\r\n this.state.entered = false;\r\n }\r\n\r\n /**\r\n * Get the number of selectable items\r\n * Must be implemented by subclasses\r\n */\r\n abstract getItemCount(): number;\r\n\r\n /**\r\n * Activate the currently selected item\r\n * Must be implemented by subclasses\r\n */\r\n abstract activateItem(): boolean;\r\n\r\n /**\r\n * Get current hint based on state\r\n */\r\n getCurrentHint(): string {\r\n if (this.state.entered) {\r\n return this.hints.entered;\r\n }\r\n if (this.focused) {\r\n return this.hints.focused;\r\n }\r\n return this.hints.unfocused || '';\r\n }\r\n\r\n /**\r\n * Move selection by delta\r\n */\r\n protected moveSelection(delta: number): void {\r\n const count = this.getItemCount();\r\n if (count === 0) return;\r\n\r\n this.state.selectedIndex = Math.max(\r\n 0,\r\n Math.min(count - 1, this.state.selectedIndex + delta)\r\n );\r\n this.ensureVisible();\r\n }\r\n\r\n /**\r\n * Ensure the selected item is visible (handle scrolling)\r\n */\r\n protected ensureVisible(): void {\r\n const maxVisible = this.getMaxVisibleItems();\r\n if (this.state.selectedIndex < this.state.scrollOffset) {\r\n this.state.scrollOffset = this.state.selectedIndex;\r\n } else if (this.state.selectedIndex >= this.state.scrollOffset + maxVisible) {\r\n this.state.scrollOffset = this.state.selectedIndex - maxVisible + 1;\r\n }\r\n }\r\n\r\n /**\r\n * Get maximum visible items based on bounds\r\n * Override in subclasses if needed\r\n */\r\n protected getMaxVisibleItems(): number {\r\n // Default: height minus 2 for border, 1 for hint\r\n return Math.max(1, this.bounds.height - 3);\r\n }\r\n\r\n /**\r\n * Render a list item with selection indicator\r\n */\r\n protected renderListItem(\r\n ctx: RenderContext,\r\n index: number,\r\n text: string,\r\n y: number,\r\n customFg?: string\r\n ): void {\r\n const { screen, bounds } = ctx;\r\n const isSelected = this.state.entered && index === this.state.selectedIndex;\r\n const fg = isSelected ? ANSI.fg.black : (customFg || ANSI.fg.white);\r\n const bg = isSelected ? ANSI.bg.cyan : undefined;\r\n const indicator = isSelected ? '>' : ' ';\r\n\r\n screen.write(bounds.x + 1, y, indicator, ANSI.fg.yellow);\r\n screen.write(\r\n bounds.x + 3,\r\n y,\r\n text.slice(0, bounds.width - 5).padEnd(bounds.width - 5),\r\n fg,\r\n bg\r\n );\r\n }\r\n}\r\n"],"names":[],"mappings":"AAAA;;;GAGG;;;AAIH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAYpC;;;GAGG;AACH,MAAM,OAAgB,WAAW;IACtB,EAAE,CAAS;IACX,KAAK,CAAS;IACd,QAAQ,CAAU;IAE3B,OAAO,GAAY,KAAK,CAAC;IACzB,KAAK,CAAe;IACpB,KAAK,CAAe;IACpB,MAAM,GAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAEnD,YAAY,MAAyB;QACnC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,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,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACjD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAEzC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QACzD,MAAM,CAAC,KAAK,CACV,MAAM,CAAC,CAAC,GAAG,CAAC,EACZ,CAAC,EACD,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,EACxD,EAAE,EACF,EAAE,CACH,CAAC;IACJ,CAAC;CACF","debug_id":"9222b139-6e88-557b-bdc4-0f103d007207"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Component Types and Interfaces
|
|
3
|
+
* Base building blocks for TUI components
|
|
4
|
+
*/
|
|
5
|
+
import type { Screen } from '../Screen.js';
|
|
6
|
+
/**
|
|
7
|
+
* Rectangle bounds for positioning components
|
|
8
|
+
*/
|
|
9
|
+
export interface Rect {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Component render context
|
|
17
|
+
*/
|
|
18
|
+
export interface RenderContext {
|
|
19
|
+
screen: Screen;
|
|
20
|
+
bounds: Rect;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Base component interface
|
|
24
|
+
* All TUI components implement this interface
|
|
25
|
+
*/
|
|
26
|
+
export interface IComponent {
|
|
27
|
+
/** Unique identifier for the component */
|
|
28
|
+
readonly id: string;
|
|
29
|
+
/** Whether the component is visible */
|
|
30
|
+
visible: boolean;
|
|
31
|
+
/** Render the component to screen */
|
|
32
|
+
render(ctx: RenderContext): void;
|
|
33
|
+
/** Handle key input, returns true if consumed */
|
|
34
|
+
handleKey?(key: import('../Input.js').KeyEvent): boolean;
|
|
35
|
+
/** Called when component is mounted */
|
|
36
|
+
onMount?(): void;
|
|
37
|
+
/** Called when component is unmounted */
|
|
38
|
+
onUnmount?(): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Component with children
|
|
42
|
+
*/
|
|
43
|
+
export interface IContainer extends IComponent {
|
|
44
|
+
children: IComponent[];
|
|
45
|
+
addChild(child: IComponent): void;
|
|
46
|
+
removeChild(childId: string): void;
|
|
47
|
+
getChild(childId: string): IComponent | undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Helper to create a Rect
|
|
51
|
+
*/
|
|
52
|
+
export declare function rect(x: number, y: number, width: number, height: number): Rect;
|
|
53
|
+
/**
|
|
54
|
+
* Check if a point is inside a rect
|
|
55
|
+
*/
|
|
56
|
+
export declare function pointInRect(px: number, py: number, rect: Rect): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Get inner bounds (with padding)
|
|
59
|
+
*/
|
|
60
|
+
export declare function innerRect(r: Rect, padding?: number): Rect;
|
|
61
|
+
//# sourceMappingURL=Component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"/","sources":["tui/core/Component.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,IAAI,CAAC;CACd;AAED;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+
|
|
9
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="291dd835-0c59-56f7-922b-5e8a8c0b2db7")}catch(e){}}();
|
|
10
|
+
export function rect(x, y, width, height) {
|
|
11
|
+
return { x, y, width, height };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Check if a point is inside a rect
|
|
15
|
+
*/
|
|
16
|
+
export function pointInRect(px, py, rect) {
|
|
17
|
+
return px >= rect.x && px < rect.x + rect.width &&
|
|
18
|
+
py >= rect.y && py < rect.y + rect.height;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get inner bounds (with padding)
|
|
22
|
+
*/
|
|
23
|
+
export function innerRect(r, padding = 1) {
|
|
24
|
+
return {
|
|
25
|
+
x: r.x + padding,
|
|
26
|
+
y: r.y + padding,
|
|
27
|
+
width: Math.max(0, r.width - padding * 2),
|
|
28
|
+
height: Math.max(0, r.height - padding * 2),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Component.js.map
|
|
32
|
+
//# debugId=291dd835-0c59-56f7-922b-5e8a8c0b2db7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["tui/core/Component.ts"],"sourceRoot":"/","sourcesContent":["/**\r\n * Core Component Types and Interfaces\r\n * Base building blocks for TUI components\r\n */\r\n\r\nimport type { Screen } from '../Screen.js';\r\n\r\n/**\r\n * Rectangle bounds for positioning components\r\n */\r\nexport interface Rect {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n}\r\n\r\n/**\r\n * Component render context\r\n */\r\nexport interface RenderContext {\r\n screen: Screen;\r\n bounds: Rect;\r\n}\r\n\r\n/**\r\n * Base component interface\r\n * All TUI components implement this interface\r\n */\r\nexport interface IComponent {\r\n /** Unique identifier for the component */\r\n readonly id: string;\r\n\r\n /** Whether the component is visible */\r\n visible: boolean;\r\n\r\n /** Render the component to screen */\r\n render(ctx: RenderContext): void;\r\n\r\n /** Handle key input, returns true if consumed */\r\n handleKey?(key: import('../Input.js').KeyEvent): boolean;\r\n\r\n /** Called when component is mounted */\r\n onMount?(): void;\r\n\r\n /** Called when component is unmounted */\r\n onUnmount?(): void;\r\n}\r\n\r\n/**\r\n * Component with children\r\n */\r\nexport interface IContainer extends IComponent {\r\n children: IComponent[];\r\n\r\n addChild(child: IComponent): void;\r\n removeChild(childId: string): void;\r\n getChild(childId: string): IComponent | undefined;\r\n}\r\n\r\n/**\r\n * Helper to create a Rect\r\n */\r\nexport function rect(x: number, y: number, width: number, height: number): Rect {\r\n return { x, y, width, height };\r\n}\r\n\r\n/**\r\n * Check if a point is inside a rect\r\n */\r\nexport function pointInRect(px: number, py: number, rect: Rect): boolean {\r\n return px >= rect.x && px < rect.x + rect.width &&\r\n py >= rect.y && py < rect.y + rect.height;\r\n}\r\n\r\n/**\r\n * Get inner bounds (with padding)\r\n */\r\nexport function innerRect(r: Rect, padding: number = 1): Rect {\r\n return {\r\n x: r.x + padding,\r\n y: r.y + padding,\r\n width: Math.max(0, r.width - padding * 2),\r\n height: Math.max(0, r.height - padding * 2),\r\n };\r\n}\r\n"],"names":[],"mappings":"AAAA;;;GAGG;AAyDH;;GAEG;;;AACH,MAAM,UAAU,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,KAAa,EAAE,MAAc;IACtE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,EAAU,EAAE,IAAU;IAC5D,OAAO,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK;QACxC,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,CAAO,EAAE,UAAkB,CAAC;IACpD,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO;QAChB,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO;QAChB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,OAAO,GAAG,CAAC,CAAC;QACzC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC;KAC5C,CAAC;AACJ,CAAC","debug_id":"291dd835-0c59-56f7-922b-5e8a8c0b2db7"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section Interface and State Types
|
|
3
|
+
* Defines the contract for interactive UI sections
|
|
4
|
+
*/
|
|
5
|
+
import type { Rect, RenderContext } from './Component.js';
|
|
6
|
+
import type { KeyEvent } from '../Input.js';
|
|
7
|
+
/**
|
|
8
|
+
* Section interaction state
|
|
9
|
+
*/
|
|
10
|
+
export interface SectionState {
|
|
11
|
+
/** Currently selected item index */
|
|
12
|
+
selectedIndex: number;
|
|
13
|
+
/** Scroll offset for long lists */
|
|
14
|
+
scrollOffset: number;
|
|
15
|
+
/** Whether user has "entered" the section for direct interaction */
|
|
16
|
+
entered: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Hint text configuration for different states
|
|
20
|
+
*/
|
|
21
|
+
export interface SectionHints {
|
|
22
|
+
/** Hint shown when section is focused but not entered */
|
|
23
|
+
focused: string;
|
|
24
|
+
/** Hint shown when section is entered */
|
|
25
|
+
entered: string;
|
|
26
|
+
/** Hint shown when section is not focused (optional) */
|
|
27
|
+
unfocused?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Section title rendering mode
|
|
31
|
+
*/
|
|
32
|
+
export type TitleMode = 'normal' | 'focused' | 'entered';
|
|
33
|
+
/**
|
|
34
|
+
* Section interface - defines interactive UI panels
|
|
35
|
+
*
|
|
36
|
+
* Interaction states:
|
|
37
|
+
* - Normal: Not focused, no special styling
|
|
38
|
+
* - Focused: Has focus, title highlighted, shows `+` indicator
|
|
39
|
+
* - Entered: User is inside the section, title wrapped in `[ ]`
|
|
40
|
+
*/
|
|
41
|
+
export interface ISection {
|
|
42
|
+
/** Unique section identifier */
|
|
43
|
+
readonly id: string;
|
|
44
|
+
/** Section display title */
|
|
45
|
+
readonly title: string;
|
|
46
|
+
/** Whether this section can be entered (some are read-only) */
|
|
47
|
+
readonly canEnter: boolean;
|
|
48
|
+
/** Whether the section currently has focus */
|
|
49
|
+
focused: boolean;
|
|
50
|
+
/** Interaction state */
|
|
51
|
+
state: SectionState;
|
|
52
|
+
/** Hint text for different states */
|
|
53
|
+
hints: SectionHints;
|
|
54
|
+
/** Bounds for this section */
|
|
55
|
+
bounds: Rect;
|
|
56
|
+
/**
|
|
57
|
+
* Render the section
|
|
58
|
+
* @param ctx Render context with screen and bounds
|
|
59
|
+
*/
|
|
60
|
+
render(ctx: RenderContext): void;
|
|
61
|
+
/**
|
|
62
|
+
* Handle key input when entered
|
|
63
|
+
* @param key Key event
|
|
64
|
+
* @returns true if key was consumed
|
|
65
|
+
*/
|
|
66
|
+
handleKey(key: KeyEvent): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Called when user enters the section (presses Enter on focused section)
|
|
69
|
+
*/
|
|
70
|
+
enter(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Called when user exits the section (presses Escape while entered)
|
|
73
|
+
*/
|
|
74
|
+
exit(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get the number of selectable items in this section
|
|
77
|
+
*/
|
|
78
|
+
getItemCount(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Activate the currently selected item
|
|
81
|
+
* @returns true if activation was handled
|
|
82
|
+
*/
|
|
83
|
+
activateItem(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Get the current hint text based on state
|
|
86
|
+
*/
|
|
87
|
+
getCurrentHint(): string;
|
|
88
|
+
/**
|
|
89
|
+
* Update section data (called before render)
|
|
90
|
+
*/
|
|
91
|
+
update?(data: unknown): void;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create default section state
|
|
95
|
+
*/
|
|
96
|
+
export declare function createSectionState(): SectionState;
|
|
97
|
+
/**
|
|
98
|
+
* Create default section hints
|
|
99
|
+
*/
|
|
100
|
+
export declare function createSectionHints(focused?: string, entered?: string): SectionHints;
|
|
101
|
+
//# sourceMappingURL=Section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.d.ts","sourceRoot":"/","sources":["tui/core/Section.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IAEjB,wBAAwB;IACxB,KAAK,EAAE,YAAY,CAAC;IAEpB,qCAAqC;IACrC,KAAK,EAAE,YAAY,CAAC;IAEpB,8BAA8B;IAC9B,MAAM,EAAE,IAAI,CAAC;IAEb;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;IAEjC;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC;IAElC;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;;OAGG;IACH,YAAY,IAAI,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAMjD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,MAAuB,EAChC,OAAO,GAAE,MAAqD,GAC7D,YAAY,CAEd"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section Interface and State Types
|
|
3
|
+
* Defines the contract for interactive UI sections
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Create default section state
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3e9af7bc-25b7-5590-b4e8-9c1949ca1ea8")}catch(e){}}();
|
|
10
|
+
export function createSectionState() {
|
|
11
|
+
return {
|
|
12
|
+
selectedIndex: 0,
|
|
13
|
+
scrollOffset: 0,
|
|
14
|
+
entered: false,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create default section hints
|
|
19
|
+
*/
|
|
20
|
+
export function createSectionHints(focused = 'Enter: enter', entered = 'Up/Down: select Enter: confirm Esc: exit') {
|
|
21
|
+
return { focused, entered };
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Section.js.map
|
|
24
|
+
//# debugId=3e9af7bc-25b7-5590-b4e8-9c1949ca1ea8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.js","sources":["tui/core/Section.ts"],"sourceRoot":"/","sourcesContent":["/**\r\n * Section Interface and State Types\r\n * Defines the contract for interactive UI sections\r\n */\r\n\r\nimport type { Rect, RenderContext } from './Component.js';\r\nimport type { KeyEvent } from '../Input.js';\r\n\r\n/**\r\n * Section interaction state\r\n */\r\nexport interface SectionState {\r\n /** Currently selected item index */\r\n selectedIndex: number;\r\n /** Scroll offset for long lists */\r\n scrollOffset: number;\r\n /** Whether user has \"entered\" the section for direct interaction */\r\n entered: boolean;\r\n}\r\n\r\n/**\r\n * Hint text configuration for different states\r\n */\r\nexport interface SectionHints {\r\n /** Hint shown when section is focused but not entered */\r\n focused: string;\r\n /** Hint shown when section is entered */\r\n entered: string;\r\n /** Hint shown when section is not focused (optional) */\r\n unfocused?: string;\r\n}\r\n\r\n/**\r\n * Section title rendering mode\r\n */\r\nexport type TitleMode = 'normal' | 'focused' | 'entered';\r\n\r\n/**\r\n * Section interface - defines interactive UI panels\r\n *\r\n * Interaction states:\r\n * - Normal: Not focused, no special styling\r\n * - Focused: Has focus, title highlighted, shows `+` indicator\r\n * - Entered: User is inside the section, title wrapped in `[ ]`\r\n */\r\nexport interface ISection {\r\n /** Unique section identifier */\r\n readonly id: string;\r\n\r\n /** Section display title */\r\n readonly title: string;\r\n\r\n /** Whether this section can be entered (some are read-only) */\r\n readonly canEnter: boolean;\r\n\r\n /** Whether the section currently has focus */\r\n focused: boolean;\r\n\r\n /** Interaction state */\r\n state: SectionState;\r\n\r\n /** Hint text for different states */\r\n hints: SectionHints;\r\n\r\n /** Bounds for this section */\r\n bounds: Rect;\r\n\r\n /**\r\n * Render the section\r\n * @param ctx Render context with screen and bounds\r\n */\r\n render(ctx: RenderContext): void;\r\n\r\n /**\r\n * Handle key input when entered\r\n * @param key Key event\r\n * @returns true if key was consumed\r\n */\r\n handleKey(key: KeyEvent): boolean;\r\n\r\n /**\r\n * Called when user enters the section (presses Enter on focused section)\r\n */\r\n enter(): void;\r\n\r\n /**\r\n * Called when user exits the section (presses Escape while entered)\r\n */\r\n exit(): void;\r\n\r\n /**\r\n * Get the number of selectable items in this section\r\n */\r\n getItemCount(): number;\r\n\r\n /**\r\n * Activate the currently selected item\r\n * @returns true if activation was handled\r\n */\r\n activateItem(): boolean;\r\n\r\n /**\r\n * Get the current hint text based on state\r\n */\r\n getCurrentHint(): string;\r\n\r\n /**\r\n * Update section data (called before render)\r\n */\r\n update?(data: unknown): void;\r\n}\r\n\r\n/**\r\n * Create default section state\r\n */\r\nexport function createSectionState(): SectionState {\r\n return {\r\n selectedIndex: 0,\r\n scrollOffset: 0,\r\n entered: false,\r\n };\r\n}\r\n\r\n/**\r\n * Create default section hints\r\n */\r\nexport function createSectionHints(\r\n focused: string = 'Enter: enter',\r\n entered: string = 'Up/Down: select Enter: confirm Esc: exit'\r\n): SectionHints {\r\n return { focused, entered };\r\n}\r\n"],"names":[],"mappings":"AAAA;;;GAGG;AA6GH;;GAEG;;;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAkB,cAAc,EAChC,UAAkB,4CAA4C;IAE9D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC","debug_id":"3e9af7bc-25b7-5590-b4e8-9c1949ca1ea8"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section Manager - Handles focus and navigation between sections
|
|
3
|
+
*/
|
|
4
|
+
import type { ISection } from './Section.js';
|
|
5
|
+
import type { KeyEvent } from '../Input.js';
|
|
6
|
+
/**
|
|
7
|
+
* Navigation direction
|
|
8
|
+
*/
|
|
9
|
+
export type Direction = 'up' | 'down' | 'left' | 'right';
|
|
10
|
+
/**
|
|
11
|
+
* Section layout configuration
|
|
12
|
+
* Maps directions to adjacent section IDs
|
|
13
|
+
*/
|
|
14
|
+
export interface SectionLayoutNode {
|
|
15
|
+
up?: string;
|
|
16
|
+
down?: string;
|
|
17
|
+
left?: string;
|
|
18
|
+
right?: string;
|
|
19
|
+
}
|
|
20
|
+
export type SectionLayout = Map<string, SectionLayoutNode>;
|
|
21
|
+
/**
|
|
22
|
+
* Section Manager - Manages multiple sections and their focus states
|
|
23
|
+
*/
|
|
24
|
+
export declare class SectionManager {
|
|
25
|
+
private sections;
|
|
26
|
+
private layout;
|
|
27
|
+
private focusedId;
|
|
28
|
+
private defaultFocusId;
|
|
29
|
+
/**
|
|
30
|
+
* Register a section with the manager
|
|
31
|
+
*/
|
|
32
|
+
register(section: ISection): void;
|
|
33
|
+
/**
|
|
34
|
+
* Unregister a section
|
|
35
|
+
*/
|
|
36
|
+
unregister(sectionId: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get a section by ID
|
|
39
|
+
*/
|
|
40
|
+
get(sectionId: string): ISection | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get all sections
|
|
43
|
+
*/
|
|
44
|
+
getAll(): ISection[];
|
|
45
|
+
/**
|
|
46
|
+
* Set the navigation layout
|
|
47
|
+
*/
|
|
48
|
+
setLayout(layout: SectionLayout): void;
|
|
49
|
+
/**
|
|
50
|
+
* Configure layout node for a section
|
|
51
|
+
*/
|
|
52
|
+
setLayoutNode(sectionId: string, node: SectionLayoutNode): void;
|
|
53
|
+
/**
|
|
54
|
+
* Set the default focus section
|
|
55
|
+
*/
|
|
56
|
+
setDefaultFocus(sectionId: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get the currently focused section
|
|
59
|
+
*/
|
|
60
|
+
getFocused(): ISection | null;
|
|
61
|
+
/**
|
|
62
|
+
* Get the ID of the focused section
|
|
63
|
+
*/
|
|
64
|
+
getFocusedId(): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Focus a specific section
|
|
67
|
+
*/
|
|
68
|
+
focus(sectionId: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Focus the default section
|
|
71
|
+
*/
|
|
72
|
+
focusDefault(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Navigate focus in a direction
|
|
75
|
+
*/
|
|
76
|
+
navigate(direction: Direction): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Enter the focused section
|
|
79
|
+
*/
|
|
80
|
+
enterFocused(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Exit the entered section
|
|
83
|
+
*/
|
|
84
|
+
exitEntered(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Check if any section is currently entered
|
|
87
|
+
*/
|
|
88
|
+
isAnyEntered(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Handle key input for navigation
|
|
91
|
+
* Returns true if the key was consumed
|
|
92
|
+
*/
|
|
93
|
+
handleKey(key: KeyEvent): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Get the current hint text (from focused section)
|
|
96
|
+
*/
|
|
97
|
+
getCurrentHint(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Clear all sections
|
|
100
|
+
*/
|
|
101
|
+
clear(): void;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a grid layout for sections
|
|
105
|
+
* @param grid 2D array of section IDs (rows x columns)
|
|
106
|
+
*/
|
|
107
|
+
export declare function createGridLayout(grid: (string | null)[][]): SectionLayout;
|
|
108
|
+
//# sourceMappingURL=SectionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionManager.d.ts","sourceRoot":"/","sources":["tui/core/SectionManager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAE3D;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,cAAc,CAAuB;IAE7C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI;IAOjC;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAQnC;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAI5C;;OAEG;IACH,MAAM,IAAI,QAAQ,EAAE;IAIpB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAItC;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAI/D;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,UAAU,IAAI,QAAQ,GAAG,IAAI;IAK7B;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI;IAI7B;;OAEG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAqBjC;;OAEG;IACH,YAAY,IAAI,OAAO;IAYvB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAcvC;;OAEG;IACH,YAAY,IAAI,OAAO;IAQvB;;OAEG;IACH,WAAW,IAAI,OAAO;IAQtB;;OAEG;IACH,YAAY,IAAI,OAAO;IAKvB;;;OAGG;IACH,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO;IAwCjC;;OAEG;IACH,cAAc,IAAI,MAAM;IAKxB;;OAEG;IACH,KAAK,IAAI,IAAI;CAMd;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,aAAa,CA+CzE"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section Manager - Handles focus and navigation between sections
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Section Manager - Manages multiple sections and their focus states
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7d5b724d-a3d1-55a3-8d49-3223ea74b5ff")}catch(e){}}();
|
|
9
|
+
export class SectionManager {
|
|
10
|
+
sections = new Map();
|
|
11
|
+
layout = new Map();
|
|
12
|
+
focusedId = null;
|
|
13
|
+
defaultFocusId = null;
|
|
14
|
+
/**
|
|
15
|
+
* Register a section with the manager
|
|
16
|
+
*/
|
|
17
|
+
register(section) {
|
|
18
|
+
this.sections.set(section.id, section);
|
|
19
|
+
if (this.defaultFocusId === null) {
|
|
20
|
+
this.defaultFocusId = section.id;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Unregister a section
|
|
25
|
+
*/
|
|
26
|
+
unregister(sectionId) {
|
|
27
|
+
this.sections.delete(sectionId);
|
|
28
|
+
this.layout.delete(sectionId);
|
|
29
|
+
if (this.focusedId === sectionId) {
|
|
30
|
+
this.focusedId = null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get a section by ID
|
|
35
|
+
*/
|
|
36
|
+
get(sectionId) {
|
|
37
|
+
return this.sections.get(sectionId);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get all sections
|
|
41
|
+
*/
|
|
42
|
+
getAll() {
|
|
43
|
+
return Array.from(this.sections.values());
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Set the navigation layout
|
|
47
|
+
*/
|
|
48
|
+
setLayout(layout) {
|
|
49
|
+
this.layout = layout;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Configure layout node for a section
|
|
53
|
+
*/
|
|
54
|
+
setLayoutNode(sectionId, node) {
|
|
55
|
+
this.layout.set(sectionId, node);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Set the default focus section
|
|
59
|
+
*/
|
|
60
|
+
setDefaultFocus(sectionId) {
|
|
61
|
+
this.defaultFocusId = sectionId;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the currently focused section
|
|
65
|
+
*/
|
|
66
|
+
getFocused() {
|
|
67
|
+
if (!this.focusedId)
|
|
68
|
+
return null;
|
|
69
|
+
return this.sections.get(this.focusedId) || null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get the ID of the focused section
|
|
73
|
+
*/
|
|
74
|
+
getFocusedId() {
|
|
75
|
+
return this.focusedId;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Focus a specific section
|
|
79
|
+
*/
|
|
80
|
+
focus(sectionId) {
|
|
81
|
+
const section = this.sections.get(sectionId);
|
|
82
|
+
if (!section)
|
|
83
|
+
return false;
|
|
84
|
+
// Unfocus current
|
|
85
|
+
if (this.focusedId) {
|
|
86
|
+
const current = this.sections.get(this.focusedId);
|
|
87
|
+
if (current) {
|
|
88
|
+
current.focused = false;
|
|
89
|
+
if (current.state.entered) {
|
|
90
|
+
current.exit();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Focus new
|
|
95
|
+
section.focused = true;
|
|
96
|
+
this.focusedId = sectionId;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Focus the default section
|
|
101
|
+
*/
|
|
102
|
+
focusDefault() {
|
|
103
|
+
if (this.defaultFocusId) {
|
|
104
|
+
return this.focus(this.defaultFocusId);
|
|
105
|
+
}
|
|
106
|
+
// Focus first registered section
|
|
107
|
+
const first = this.sections.keys().next().value;
|
|
108
|
+
if (first) {
|
|
109
|
+
return this.focus(first);
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Navigate focus in a direction
|
|
115
|
+
*/
|
|
116
|
+
navigate(direction) {
|
|
117
|
+
if (!this.focusedId) {
|
|
118
|
+
return this.focusDefault();
|
|
119
|
+
}
|
|
120
|
+
const layoutNode = this.layout.get(this.focusedId);
|
|
121
|
+
if (!layoutNode)
|
|
122
|
+
return false;
|
|
123
|
+
const targetId = layoutNode[direction];
|
|
124
|
+
if (!targetId)
|
|
125
|
+
return false;
|
|
126
|
+
return this.focus(targetId);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Enter the focused section
|
|
130
|
+
*/
|
|
131
|
+
enterFocused() {
|
|
132
|
+
const focused = this.getFocused();
|
|
133
|
+
if (!focused || !focused.canEnter)
|
|
134
|
+
return false;
|
|
135
|
+
focused.enter();
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Exit the entered section
|
|
140
|
+
*/
|
|
141
|
+
exitEntered() {
|
|
142
|
+
const focused = this.getFocused();
|
|
143
|
+
if (!focused || !focused.state.entered)
|
|
144
|
+
return false;
|
|
145
|
+
focused.exit();
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Check if any section is currently entered
|
|
150
|
+
*/
|
|
151
|
+
isAnyEntered() {
|
|
152
|
+
const focused = this.getFocused();
|
|
153
|
+
return focused?.state.entered ?? false;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Handle key input for navigation
|
|
157
|
+
* Returns true if the key was consumed
|
|
158
|
+
*/
|
|
159
|
+
handleKey(key) {
|
|
160
|
+
const focused = this.getFocused();
|
|
161
|
+
// If a section is entered, delegate to it first
|
|
162
|
+
if (focused?.state.entered) {
|
|
163
|
+
if (focused.handleKey(key)) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
// Section didn't consume the key - allow left/right navigation even when entered
|
|
167
|
+
if (key.name === 'left' || key.name === 'h') {
|
|
168
|
+
return this.navigate('left');
|
|
169
|
+
}
|
|
170
|
+
if (key.name === 'right' || key.name === 'l') {
|
|
171
|
+
return this.navigate('right');
|
|
172
|
+
}
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
// Handle navigation between sections (when not entered)
|
|
176
|
+
switch (key.name) {
|
|
177
|
+
case 'up':
|
|
178
|
+
case 'k':
|
|
179
|
+
return this.navigate('up');
|
|
180
|
+
case 'down':
|
|
181
|
+
case 'j':
|
|
182
|
+
return this.navigate('down');
|
|
183
|
+
case 'left':
|
|
184
|
+
case 'h':
|
|
185
|
+
return this.navigate('left');
|
|
186
|
+
case 'right':
|
|
187
|
+
case 'l':
|
|
188
|
+
return this.navigate('right');
|
|
189
|
+
case 'return':
|
|
190
|
+
case 'space':
|
|
191
|
+
return this.enterFocused();
|
|
192
|
+
}
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get the current hint text (from focused section)
|
|
197
|
+
*/
|
|
198
|
+
getCurrentHint() {
|
|
199
|
+
const focused = this.getFocused();
|
|
200
|
+
return focused?.getCurrentHint() || '';
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Clear all sections
|
|
204
|
+
*/
|
|
205
|
+
clear() {
|
|
206
|
+
this.sections.clear();
|
|
207
|
+
this.layout.clear();
|
|
208
|
+
this.focusedId = null;
|
|
209
|
+
this.defaultFocusId = null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Create a grid layout for sections
|
|
214
|
+
* @param grid 2D array of section IDs (rows x columns)
|
|
215
|
+
*/
|
|
216
|
+
export function createGridLayout(grid) {
|
|
217
|
+
const layout = new Map();
|
|
218
|
+
for (let row = 0; row < grid.length; row++) {
|
|
219
|
+
for (let col = 0; col < grid[row].length; col++) {
|
|
220
|
+
const id = grid[row][col];
|
|
221
|
+
if (!id)
|
|
222
|
+
continue;
|
|
223
|
+
const node = {};
|
|
224
|
+
// Up
|
|
225
|
+
for (let r = row - 1; r >= 0; r--) {
|
|
226
|
+
if (grid[r][col]) {
|
|
227
|
+
node.up = grid[r][col];
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Down
|
|
232
|
+
for (let r = row + 1; r < grid.length; r++) {
|
|
233
|
+
if (grid[r][col]) {
|
|
234
|
+
node.down = grid[r][col];
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
// Left
|
|
239
|
+
for (let c = col - 1; c >= 0; c--) {
|
|
240
|
+
if (grid[row][c]) {
|
|
241
|
+
node.left = grid[row][c];
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Right
|
|
246
|
+
for (let c = col + 1; c < grid[row].length; c++) {
|
|
247
|
+
if (grid[row][c]) {
|
|
248
|
+
node.right = grid[row][c];
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
layout.set(id, node);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return layout;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=SectionManager.js.map
|
|
258
|
+
//# debugId=7d5b724d-a3d1-55a3-8d49-3223ea74b5ff
|