推进 INI 面板状态汇总 helper

This commit is contained in:
2026-06-14 20:59:50 +08:00
parent 405cc0b011
commit b85444b858
7 changed files with 232 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
# UI Panel State Summary
## Purpose
`runtime/ui/ini-panel/panel-state-summary.js` contains a pure helper for
bundling the already-observed host/runtime boundary state of the INI panel into
a single machine-readable snapshot.
The helper does not implement CNC behavior. It only packages the summary
objects produced by the run/session/machine-file helpers and the visible badge
state so browser tests or future UI consumers can compare panel state without
reading ad hoc DOM text.
## `createIniPanelStateSummary(input)`
`input` may contain:
```js
{
badges: { ini: "INI WASM: ready", interp: "Interpreter WASM: ready", opfs: "OPFS: ready" },
machine: { machine: "xyzab-tdr", kinematics: "trivkins" },
machineFiles: { iniOpfsPath: "...", toolTableOpfsPath: "...", parameterOpfsPath: "...", gcodeOpfsPath: "..." },
sessionSnapshot: { snapshotLabel: "...", workflow: "save-session-snapshot" },
sessionLoad: { iniOpfsPath: "...", iniWasmPath: "..." },
run: { runStatus: "ok", programSource: "snapshot" },
fiveaxisRemap: "ok"
}
```
The returned snapshot preserves those nested objects and normalizes missing
badge entries to `null`.
## Boundary Rules
- Do not parse G-code text in this helper.
- Do not infer CNC semantics from the nested summaries.
- Keep the helper as a bundling layer over already-observed UI boundary state.
## Validation
The helper is covered by:
```bash
wasm-port/tests/ui/node/verify_ini_panel_state_summary.sh
wasm-port/tests/ui/node/verify_ui_node_smokes.sh
```