refactor(motor): P1 拆分 main.js + 收敛连接/总线状态机

R4 外提 scope/ota/seq/conn-poll;R5 waitVersion/queryNodeIdParam 下沉
transport;R6 ecat-bus 单点 bootstrap;R7 toast-stack + utils 去重。
main.js 4647→~1894 行。?v= 已 bump 20260924a。
This commit is contained in:
cbb
2026-09-21 02:26:39 +08:00
parent b70f5ed0d6
commit 261caf50b7
14 changed files with 3470 additions and 3523 deletions
+27
View File
@@ -0,0 +1,27 @@
/**
* toast-stack.js — 电机控制台堆叠 toast(#toastContainer)
*
* motor 页不用 common/toast.js 的单 toast 条,而是左下角堆叠条。
* setQuietMode 从 utils.js re-export,保证全仓只有一份实现。
*/
"use strict";
import { setQuietMode } from "./utils.js";
export { setQuietMode };
/** @description 创建电机页 toast 工厂。默认容器 #toastContainer。 */
export function createToastStack(containerSelector = "#toastContainer") {
const $ = (s) => document.querySelector(s);
return function toast(msg, type = "ok") {
const host = $(containerSelector);
if (!host) return;
const el = document.createElement("div");
el.className = `toast ${type}`;
const ledCls = type === "ok" ? "led-on" : type === "warn" ? "led-warn" : "led-err";
el.innerHTML = `<span class="led ${ledCls}" style="width:7px;height:7px"></span><span></span>`;
el.lastElementChild.textContent = msg;
host.appendChild(el);
setTimeout(() => { el.classList.add("out"); setTimeout(() => el.remove(), 220); }, 3000);
};
}