- Modular block files: split into blocks-algo, blocks-data, blocks-proc - New modules: sections.js (labelled canvas areas), proc-browser.js (procedure tree modal), lib-loader.js (lazy library loading), templates.js (project templates), errno-data.js (errno table) - Test infrastructure: browser test suite (28 tests) and Node pure-function tests (75 tests) - Warning system: unified .block-warn for disconnected inputs, unconnected error hooks, and zero-exit-in-error-path - Error path highlighting: red flow paths and block borders for error-only subgraphs - Input hooks: hidden by default, shown during linking; outputs always at bottom - Block editor modal: pencil icon, colour picker for accent, compact field labels - Doc generation: standalone node script extracts JSDoc -> docs/API.md (124 declarations) - Persistence: save/restore sections, errno selection, block colours - Fixes: _segmentsIntersect bug, WCEnd crash from closest(this), drawpath guard on detached elements
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
// ── Error modal ───────────────────────────────────────────────────────────────
|
|
//
|
|
// A simple overlay modal that displays -ACK! with a custom message.
|
|
// Depends on: dom.js ($)
|
|
//
|
|
|
|
/**
|
|
* Shows the error modal with the given message.
|
|
* The overlay is absolutely positioned and blocks all interaction until dismissed.
|
|
* @param {string} msg - message to display inside the error box
|
|
*/
|
|
function showError(msg) {
|
|
const el = $("#error-overlay");
|
|
if (!el) { console.error("ACK: " + msg); return; }
|
|
const msgEl = el.querySelector(".error-msg");
|
|
if (msgEl) msgEl.textContent = msg;
|
|
el.classList.add("active");
|
|
}
|
|
|
|
/**
|
|
* Hides the error modal. Triggered by clicking the × button,
|
|
* the overlay backdrop, or called programmatically.
|
|
* @param {MouseEvent} [ev] - event to check target matching
|
|
*/
|
|
function closeError(ev) {
|
|
const el = $("#error-overlay");
|
|
if (!el) return;
|
|
if (
|
|
!ev ||
|
|
ev.target === ev.currentTarget ||
|
|
ev.target.classList.contains("error-close")
|
|
) {
|
|
el.classList.remove("active");
|
|
}
|
|
}
|