- Remove the `delete <ship_class_name>` button (and `deleteClass`,
`canDelete`, `.delete` CSS, `game.calculator.action.delete` i18n key)
from the calculator. Delete-class lives in the ship-classes table —
the broader rework will land under #53.
- Bombing and cargo-capacity rows now reserve a hidden lock-slot
placeholder so their value column lines up vertically with the
mass/speed/attack/defence rows (which carry a lock button).
Owner feedback round 2 on PR #61:
- Pad every read-only calculator value to three decimals: tech labels,
derived results (mass, speed, attack, defence, bombing, cargo
capacity), planet MAT, planet build-rate, modernization cost, and
the full-cargo capacity label all read as "1.000" instead of "1",
matching the goal-seek back-solved input and the report. Drops
thousands grouping so the same `fmt()` string also embeds cleanly
in the read-only `<input type="number">` cell.
- Switch label and input styling onto the existing `--font-mono`
token (right-aligned, tabular-nums) so columns line up vertically
across rows like a financial table.
- Refuse a fourth decimal as the user types in every calculator
number input (DWSC blocks, tech, MAT, custom load, lock value,
modernization target tech): the `oninput` truncates the input text
past three decimal digits and explicitly writes the truncated
value back through `bind:value`, so Svelte's later reactive flush
cannot undo the cap.
- Doc + tests follow the rule (five new vitest cases covering the
3-decimal label format, the input cap on each input class, and
the integer-padding rule for derived results).
Owner review on PR #61:
- п.9 (option B). Hide the native spinner on EVERY numeric input in
the calculator (DWSC blocks, armament, tech, planet MAT, custom
load, lock value, modernization target tech) and drive every step
through ArrowUp / ArrowDown. The column widths stay stable and the
inputs read consistently across the whole row. The ship blocks
keep the smart (0 ↔ 1) jump on ArrowUp/ArrowDown; armament steps
±1 with a JS handler instead of relying on the native spinner.
Other inputs step by their natural grain (±0.001 for tech / lock,
±0.01 for MAT / load).
- п.10. Tech-level labels (`tech-val`) and the planet MAT label
(`mat-val`) now read through the same `Ceil3` formatter as the
derived results, so plain-text numeric values share the report's
3-decimal tabular formatting. The design-area component receives
`formatNumber` as a prop; the resolved (goal-seek) cell uses the
same formatter, so the read-only computed value matches the rest
of the row.
- п.12. `computeCalculator` now validates the back-solved block
against the same DWSC rule the live validator enforces (`0` or
`≥ 1`). When the solver lands in the `(0, 1)` gap (e.g. attack
0.5 / weaponsTech 1.5 → weapons 0.333…) the lock is flagged
infeasible — the lock input flips red and the claimed block is
NOT back-solved into the invalid range, so the design preview
keeps reading the user's own typed values instead of silently
showing a sub-1 block.
- new. Selecting an existing ship class from the name datalist now
loads it immediately. `change` fires only on blur in Firefox,
which is why the previous behaviour looked delayed; switching the
load to `oninput` with an `InputEvent.inputType` check makes the
load synchronous everywhere (datalist replacement carries
`"insertReplacementText"` in Chromium / WebKit, `undefined` in
Firefox; keyboard typing always carries a typing `inputType`).
Before loading we compare the live blocks to the previously
loaded class (or to the empty defaults) and, if they differ, ask
through a `window.confirm`. On decline we revert the name field
and leave the design untouched.
Tests: calculator-tab and calc-model gain six cases (armament
step, tech/MAT formatter labels, lock infeasible on (0, 1) for
both attack→weapons and emptyMass→cargo, lock-value Arrow step,
dropdown immediate load + confirm-blocks-load + confirm-allows-load),
all 779 vitest tests green. docs/calculator-ux.md follows the new
behaviour.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- pkg/calc: DriveForSpeed treats restMass==0 as a valid ceiling-only
case (every positive drive solves it), so locking the displayed
speed of a D=1, W=A=S=C=0 ship is no longer a phantom "infeasible".
- ship-design-area: drive/weapons/shields/cargo inputs use a JS-driven
smart step on ArrowUp/ArrowDown (0↔1 jump, otherwise ±0.1) and hide
the native spinner so it cannot produce invalid (0, 1) values;
armament keeps its native step 1.
- Tech and planet MAT cells follow the same lock idiom as goal-seek
locks: open padlock (🔓) over the inherited value → click to open
an input with a closed padlock (🔒). The padlock slot is always
reserved, so the column width is stable.
- Tech overrides (design area and modernization target) are floored
at the player's current tech on this turn — a lower value is
flagged as invalid.
- custom load capped at cargo capacity (error when exceeded); full load shows the cargo capacity; zero cargo pins load to empty and disables the toggle
- per-input red border + tooltip for every invalid value (blocks, techs, load, MAT, modernization target); no value may be negative; locking a speed is disabled when drive is zero
- display every computed number (results + goal-seek back-solved input) rounded up to 3 decimals via a shared pkg/calc Ceil3 bridged to wasm; engine keeps its own round-to-nearest util.Fixed*
- modernization total upgrade cost spans two columns (single line)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move the calculator's inputs into a page-level calculatorState singleton so they survive the sidebar unmounting the tab on a tab switch (the inspector auto-opens on a planet click). ensureGame resets the design when the active game changes.
While on the calculator, a planet click no longer switches to the inspector — the calculator consumes the selection in its planet area / reach circles. Halve the reach-circle stroke width.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fuse the standalone ship-class designer (Phases 17/18) into a sidebar calculator: live mass/speed/attack/defence/bombing results, a planet build-rate readout, single-target goal-seek, a modernization-cost mode, and auto reach circles on the map for the selected planet.
pkg/calc becomes the single source for the new math (no mirroring): extract BombingPower from the engine model and the per-turn ship-production loop from controller.ProduceShip into pkg/calc (engine now delegates), and add inverse goal-seek solvers in pkg/calc/solve.go. Thin-bridge the combat, planet-build, and solver functions through ui/core/calc + ui/wasm and rebuild core.wasm.
Remove the standalone designer view/route; the ship-classes table and the view/bottom menus open the calculator via a shared request store.
Docs: rewrite ui/PLAN.md Phase 30, adjust Phase 34 (realistic forecast + CAP/COL ownership), add ui/docs/calculator-ux.md, extend calc-bridge.md, fix navigation.md; remove ui/CALCULATOR.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>