From 052ddcb4f08d20fb4bbe85085cc029671d817564 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sun, 17 May 2026 15:22:54 +0200 Subject: [PATCH] feat(files): scaffold files-overlay/core.js with helpers + action registry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step 1/12 of docs/superpowers/plans/2026-05-17-files-overlay-rewrite.md. Pure scaffolding — no behavior change. core.js is loaded with defer in overlay_detail.html before the existing files-overlay.js script tag (both with defer, so execution order follows document order). Both files run the same .files-manager guard, both attach document-level click listeners on the action selector. The legacy file's switch-case still owns dispatch; core.js's listener dispatches into an empty registry until Steps 2–4 populate handlers. window.__filesOverlay exposes: * manager / overlayId / baseUrl / treeRoot / csrfToken (manager- element-derived state, computed once) * helpers.{joinPath, parentOf, basename, escapeHtml, humanSize, fetchJson, postJson, postForm, refreshFolder, findRowByPath, cssEscape, scheduleRefresh} (duplicated from legacy file for the duration of Phase A; de-duplicates as feature modules migrate out) * registerHandler(op, fn) / handleAction(op, path, actionEl) — the action-dispatch registry that Steps 2–4 populate Per the canonical plan's errata commit (d76ee05), the script tag goes in overlay_detail.html (not base.html as the original plan said) and uses defer to match the existing pattern. Verified live on /overlays/2 in Chromium: both {% endif %} {% endblock %}