ui/phase-18: ship-class calc bridge with live designer preview

Wires pkg/calc/ship.go into the WASM Core boundary as seven thin
wrappers (DriveEffective, EmptyMass, WeaponsBlockMass, FullMass,
Speed, CargoCapacity, CarryingMass). The ship-class designer reads
Core through a new CORE_CONTEXT_KEY populated by the in-game layout
and renders a five-row preview pane (mass, full-load mass, max
speed, range at full load, cargo capacity) that updates reactively
on every form edit and on the player's localPlayer{Drive,Weapons,
Shields,Cargo} tech levels — three of which are now decoded from
the report's Player block alongside the existing localPlayerDrive.

CarryingMass is the seventh wrapper added to the original six-function
list so that "full-load mass" composes through pkg/calc/ functions
without putting math in TypeScript.
This commit is contained in:
Ilia Denisov
2026-05-09 23:14:40 +02:00
parent 721fa2172d
commit e4dc0ce029
25 changed files with 1056 additions and 64 deletions
+19
View File
@@ -39,6 +39,8 @@ parity and round-trip sign/verify are exercised by
```text
ui/core/
├── go.mod module galaxy/core (Go 1.26.0)
├── calc/ ship-math wrappers over `pkg/calc/ship.go`
│ └── ship.go Phase 18 designer preview bridge
├── canon/ canonical-bytes builders and verifiers
│ ├── canon.go length-prefix helpers
│ ├── request.go galaxy-request-v1 fields and signing input
@@ -88,6 +90,23 @@ ui/core/
- Sentinel errors: `ErrInvalidPrivateKey`, `ErrInvalidPublicKey`,
`ErrInvalidPublicKeyEncoding`.
### `galaxy/core/calc`
Thin Go bridge over `pkg/calc/ship.go`, surfaced via WASM to the
Phase 18 ship-class designer preview. Each function is a one-line
passthrough — no math lives here.
- `DriveEffective(drive, driveTech float64) float64`
- `EmptyMass(drive, weapons float64, armament uint, shields, cargo float64) (float64, bool)`
- `WeaponsBlockMass(weapons float64, armament uint) (float64, bool)`
- `FullMass(emptyMass, carryingMass float64) float64`
- `Speed(driveEffective, fullMass float64) float64`
- `CargoCapacity(cargo, cargoTech float64) float64`
- `CarryingMass(load, cargoTech float64) float64`
The full audit trail (which UI feature uses what, what is still
deferred) lives in [`ui/docs/calc-bridge.md`](../docs/calc-bridge.md).
### `galaxy/core/types`
- `RequestEnvelope`, `ResponseEnvelope`, `EventEnvelope` — full Go