- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Project Structure
Kinexus is a "single-file application". All of its HTML, CSS, and JavaScript logic is contained within one .html file.
All application logic is encapsulated within a global JavaScript object named App. This object acts as a namespace for the entire application, preventing pollution of the global scope.
The App object is organized into several sub-objects, each with a distinct responsibility:
- 
App.state: Holds the application's current state, including the loadedstoryData, the ID of the currently selected scene (currentSceneId), and the handle to the project directory on the user's file system.
- 
App.io: Manages all Input/Output operations. This is where the File System Access API is used to open, save, and export projects. It also contains the crucialvalidateProjectDatafunction for migrating and cleaning up story data from older versions.
- 
App.tree&App.sceneList: These two objects control the rendering and logic for the left-hand navigation panel, handling both the hierarchical Tree View and the flat Scene List View.
- 
App.editor: The controller for the central Scene Editor panel. It manages loading scene data into the UI fields and saving it back to theApp.state.storyDataobject. It contains nested objects for managing choice UI and variables.
- 
App.player: Controls the in-app game player. It has its own lightweight game state and is responsible for rendering scenes for interactive testing.
- 
App.styles: Manages the Style Editor modal. It reads and writes to themeta.stylesobject in the story data and generates the final CSS for exported projects.
- 
App.assets: Handles all logic related to media assets (images, video, sound), including file selection, drag-and-drop, and the API calls to Pollinations.ai for content generation.
- 
App.batch: Implements the logic for the Batch Image Generation feature.
- 
App.modals: A simple utility for showing and hiding modal dialogs.
- 
App.debug: A hidden debug mode (toggled withCtrl+Alt+D) that provides more verbose logging to the console and an in-app log viewer.
The application contains an HTML <template id="player-template">. When exporting a standalone game, the App.io module injects the current storyData (as a JSON object) and custom styles into this template to create the final index.html file for the player. The player's JavaScript is self-contained and does not include any of the editor logic.