推进 INI 面板 ui shell export

This commit is contained in:
2026-06-14 23:21:00 +08:00
parent 77d32a3f17
commit fc4fb54a20
6 changed files with 131 additions and 0 deletions

View File

@@ -1390,3 +1390,66 @@ host_wasm_opfs_browser_smokes=ok
controller/renderer 组合成一个更明确的 `ui-shell` 或 `panel-entry` 文档/API 入口,或者新增
一个 node smoke 验证 docs 中列出的入口与 manifest 完全一致;仍保持只读,不新增控制按钮,
不解析 G-code。
十七、2026-06-14 继续执行记录INI panel ui shell export
本轮按“加快实质性推进”新增统一 UI shell 导出,把 entry manifest、control page controller
和 control view renderer 收敛到单一入口模块,方便上层页面、文档和 smoke 共享。
完成内容:
- 新增 `wasm-port/runtime/ui/ini-panel/ui-shell.js`
- `ui-shell.js` 统一 re-export
- `INI_PANEL_ENTRIES`
- `getIniPanelEntryByHref()`
- `getIniPanelEntryManifest()`
- `createMachineSessionControlPageController()`
- `renderMachineSessionControlView()`
- 新增 `wasm-port/tests/ui/node/verify_ini_panel_ui_shell.mjs`
- 新增 `wasm-port/tests/ui/node/verify_ini_panel_ui_shell.sh`
- `wasm-port/tests/ui/node/verify_ui_node_smokes.sh` 纳入 ui shell node smoke
- `wasm-port/docs/ui-panel-state-summary.md` 补充 ui shell 说明;
- 未新增控制按钮;
- 未解析 G-code
- 未解释 canonical events
- 未改变 OPFS/session persistence、LinuxCNC interpreter、tool、parameter、planner 或
LinuxCNC-owned runtime semantics。
验证已通过:
```bash
git diff --check
wasm-port/tests/ui/node/verify_ini_panel_ui_shell.sh
wasm-port/tests/ui/node/verify_ui_node_smokes.sh
wasm-port/tests/browser/verify_ini_panel_browser.sh
wasm-port/tools/verify_vendor_sync.sh
wasm-port/tools/verify_no_standalone_cnc_semantics.sh
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_interp_wasm.sh
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh
wasm-port/tests/host/verify_host_smokes.sh
```
关键输出:
```text
ini_panel_ui_shell_node_smoke=ok
ui_node_smokes=ok
browser_ini_opfs_smoke=ok
browser_ini_control_page_smoke=ok
browser_ini_launch_smoke=ok
vendor sync up to date
standalone CNC semantics guard complete
interp_wasm_node_smoke=ok
sim_configs_wasm_node_inventory_executed=28
sim_configs_wasm_node_inventory_passed=28
sim_configs_wasm_node_inventory_skipped=131
sim_configs_wasm_node_inventory_unexpected_fail=0
host_wasm_opfs_browser_smokes=ok
```
下一步建议:
继续保持只读边界,下一批建议在 `docs/ui-panel-state-summary.md` 之外补一个更短的
`ui-shell.md` 或 `panel-entry.md`,只列出 `ui-shell.js`、`launch.html`、`control-page.html`
三者关系和最小用法,或者把 launcher 页面改成从 `ui-shell.js` 读取 manifest仍不新增控制
按钮,不解析 G-code。

View File

@@ -34,6 +34,8 @@ The page uses `createMachineSessionControlPageController(...)` from
reuse the same iframe/API polling contract.
For a light navigation entry, open `runtime/ui/ini-panel/launch.html`.
Its entry list is defined in `runtime/ui/ini-panel/entry-manifest.js`.
For a single shell-facing import, use `runtime/ui/ini-panel/ui-shell.js`, which
re-exports the entry manifest, control page controller, and control view renderer.
## `createIniPanelStateSummary(input)`

View File

@@ -0,0 +1,11 @@
export {
INI_PANEL_ENTRIES,
getIniPanelEntryByHref,
getIniPanelEntryManifest,
} from "./entry-manifest.js";
export {
createMachineSessionControlPageController,
} from "./control-page-controller.js";
export {
renderMachineSessionControlView,
} from "./control-view-renderer.js";

View File

@@ -0,0 +1,48 @@
import assert from "node:assert/strict";
import {
INI_PANEL_ENTRIES,
createMachineSessionControlPageController,
getIniPanelEntryByHref,
getIniPanelEntryManifest,
renderMachineSessionControlView,
} from "../../../runtime/ui/ini-panel/ui-shell.js";
assert.deepEqual(getIniPanelEntryManifest(), INI_PANEL_ENTRIES);
assert.equal(getIniPanelEntryByHref("./index.html")?.id, "edit-run");
assert.equal(typeof createMachineSessionControlPageController, "function");
assert.equal(typeof renderMachineSessionControlView, "function");
const panelFrame = {
contentWindow: {
linuxCncIniPanelApi: {
getMachineSessionControlView: () => ({
status: {
lastAction: "run-gcode",
runStatus: "ok",
error: null,
},
sections: [],
}),
},
},
addEventListener() {},
};
const statusNode = { textContent: "" };
const viewNode = { textContent: "" };
let renderedView = null;
const controller = createMachineSessionControlPageController({
panelFrame,
statusNode,
viewNode,
renderControlView: (_container, view) => {
renderedView = view;
return { rendered: true };
},
});
assert.deepEqual(controller.render(), { rendered: true });
assert.equal(statusNode.textContent, "run-gcode | ok | -");
assert.equal(renderedView.status.runStatus, "ok");
console.log("ini_panel_ui_shell_node_smoke=ok");

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
node "$ROOT_DIR/tests/ui/node/verify_ini_panel_ui_shell.mjs"

View File

@@ -11,5 +11,6 @@ ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_state_summary.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_control_page_controller.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_entry_manifest.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_ui_shell.sh"
echo "ui_node_smokes=ok"