phantasmal-world/web
2025-03-21 13:17:19 +01:00
..
assembly-worker All code now compiles with Kotlin 2.1.20, all tests pass, development builds work and production builds work. 2025-03-21 13:17:19 +01:00
assets-generation All code now compiles with Kotlin 2.0.0 and all tests pass. 2024-07-18 18:24:10 +02:00
shared Upgraded Kotlin from 1.5.21 to 1.5.30. Also upgraded kotlinx.coroutines and kotlin logging. Now using languageSettings.optIn everywhere instead of compiler options. 2021-09-06 14:17:20 +02:00
src All code now compiles with Kotlin 2.1.20, all tests pass, development builds work and production builds work. 2025-03-21 13:17:19 +01:00
webpack.config.d Made basic quest properties editable and added the entity detail widget. 2020-11-15 20:41:30 +01:00
build.gradle.kts All code now compiles with Kotlin 2.1.20, all tests pass, development builds work and production builds work. 2025-03-21 13:17:19 +01:00
README.md Removed Observable from observable project and renamed observable project to cell. Cell is now the most basic interface for users. 2022-06-04 21:33:29 +02:00

web

This is the main Phantasmal World web application. It consists of several tools, each in their own package. Beside these packages there's also an application, core and externals package.

Main Packages

application

The application package contains the main application view that provides navigation between the different tools. The application view lazily loads and initializes the necessary tools.

core

Contains code that is reused throughout the web project.

externals

External declarations for NPM dependencies.

huntOptimizer, questEditor, viewer

One main package per tool. Each tool is encapsulated in a PwTool implementation.

Common Structure

The main packages all follow the same structure except for the externals package.

widgets

The widgets package contains views with minimal logic. They simply display the models their controller provides and forward user input to their controller. Their only dependency is the DOM and a single controller.

Keeping logic out of the views makes the UI easier to test. We don't really need to have unit tests for the views as they don't contain complex code, just having unit tests from controller layer down and manually smoke testing the GUI layer gives us enough confidence that everything works.

controllers

The controllers package contains the controllers on which views depend. Usually the view-controller relationship is one-to-one, sometimes it's many-to-one (e.g. when a view has many subviews that work with the same data). A controller usually extracts data from a shared store and transforms it into a format which the view can easily consume. A controller has no knowledge of the GUI layer.

models

The models package contains observable model objects. Models expose read-only cell properties and allow their properties to be changed via setters which validate their inputs.

stores

The stores package contains shared data stores. Stores ensure that data is loaded when necessary and that the data is deduplicated. Stores also contain ephemeral shared state such as the currently selected entity in the quest editor.

Subprojects

web:assembly-worker

Does analysis of the script assembly code and runs in a worker thread.

web:assets-generation

This code is manually run to generate various assets used by web such as item lists, drop tables, quest lists, etc.

web:shared

Contains code used by web, web:assembly-worker and web:assets-generation.