From e587de17789e06d664167d34bdbcd15a4fdf3e2a Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sat, 23 Nov 2024 00:59:58 +0100 Subject: [PATCH] fixing some lighthouse issues and bad coloring of icons --- depell/src/index.css | 4 ++++ depell/src/index.js | 15 ++++++++++----- depell/src/main.rs | 4 +++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/depell/src/index.css b/depell/src/index.css index 1e35f18..a52cd62 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 8b4fee3..2d33db5 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 cfa7192..fb89163 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" - +