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。
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
/**
|
||
* 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);
|
||
};
|
||
}
|