diff --git a/depell/src/index.css b/depell/src/index.css index 1e35f182..a52cd62e 100644 --- a/depell/src/index.css +++ b/depell/src/index.css @@ -51,6 +51,10 @@ div.preview { margin: var(--small-gap) 0px; } +svg { + fill: black; +} + form { display: flex; flex-direction: column; diff --git a/depell/src/index.js b/depell/src/index.js index 8b4fee3d..2d33db5f 100644 --- a/depell/src/index.js +++ b/depell/src/index.js @@ -352,11 +352,16 @@ async function fmt(target) { } /** @param {HTMLElement} target */ -async function execApply(target) { +function execApply(target) { + const proises = []; for (const elem of target.querySelectorAll('[apply]')) { if (!(elem instanceof HTMLElement)) continue; const funcname = elem.getAttribute('apply') ?? never(); - applyFns[funcname](elem); + const vl = applyFns[funcname](elem); + if (vl instanceof Promise) proises.push(vl); + } + if (target === document.body) { + Promise.all(proises).then(() => document.body.hidden = false); } } @@ -411,7 +416,7 @@ function cacheInputs(target) { } /** @param {string} [path] */ -function updaetTab(path) { +function updateTab(path) { for (const elem of document.querySelectorAll("button[hx-push-url]")) { if (elem instanceof HTMLButtonElement) elem.disabled = elem.getAttribute("hx-push-url") === (path ?? window.location.pathname); @@ -450,7 +455,7 @@ document.body.addEventListener('htmx:afterSwap', (ev) => { if (!(ev.target instanceof HTMLElement)) never(); wireUp(ev.target); if (ev.target.tagName == "MAIN" || ev.target.tagName == "BODY") - updaetTab(ev['detail'].pathInfo.finalRequestPath); + updateTab(ev['detail'].pathInfo.finalRequestPath); console.log(ev); }); @@ -502,6 +507,6 @@ getFmtInstance().then(inst => { Object.assign(window, { filterCodeDeps }); }); -updaetTab(); +updateTab(); wireUp(document.body); diff --git a/depell/src/main.rs b/depell/src/main.rs index cfa71920..fb891637 100644 --- a/depell/src/main.rs +++ b/depell/src/main.rs @@ -622,9 +622,11 @@ fn base(body: impl FnOnce(&mut String), session: Option<&Session>) -> Html + + "depell" - +