fixing some lighthouse issues and bad coloring of icons

This commit is contained in:
Jakub Doka 2024-11-23 00:59:58 +01:00
parent b12579ff65
commit e587de1778
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
3 changed files with 17 additions and 6 deletions

View file

@ -51,6 +51,10 @@ div.preview {
margin: var(--small-gap) 0px; margin: var(--small-gap) 0px;
} }
svg {
fill: black;
}
form { form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View file

@ -352,11 +352,16 @@ async function fmt(target) {
} }
/** @param {HTMLElement} target */ /** @param {HTMLElement} target */
async function execApply(target) { function execApply(target) {
const proises = [];
for (const elem of target.querySelectorAll('[apply]')) { for (const elem of target.querySelectorAll('[apply]')) {
if (!(elem instanceof HTMLElement)) continue; if (!(elem instanceof HTMLElement)) continue;
const funcname = elem.getAttribute('apply') ?? never(); 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] */ /** @param {string} [path] */
function updaetTab(path) { function updateTab(path) {
for (const elem of document.querySelectorAll("button[hx-push-url]")) { for (const elem of document.querySelectorAll("button[hx-push-url]")) {
if (elem instanceof HTMLButtonElement) if (elem instanceof HTMLButtonElement)
elem.disabled = elem.getAttribute("hx-push-url") === (path ?? window.location.pathname); 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(); if (!(ev.target instanceof HTMLElement)) never();
wireUp(ev.target); wireUp(ev.target);
if (ev.target.tagName == "MAIN" || ev.target.tagName == "BODY") if (ev.target.tagName == "MAIN" || ev.target.tagName == "BODY")
updaetTab(ev['detail'].pathInfo.finalRequestPath); updateTab(ev['detail'].pathInfo.finalRequestPath);
console.log(ev); console.log(ev);
}); });
@ -502,6 +507,6 @@ getFmtInstance().then(inst => {
Object.assign(window, { filterCodeDeps }); Object.assign(window, { filterCodeDeps });
}); });
updaetTab(); updateTab();
wireUp(document.body); wireUp(document.body);

View file

@ -622,9 +622,11 @@ fn base(body: impl FnOnce(&mut String), session: Option<&Session>) -> Html<Strin
<head> <head>
<meta name="charset" content="UTF-8"> <meta name="charset" content="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="code dependency hell socila media hblang">
<link rel="stylesheet" href="/index.css"> <link rel="stylesheet" href="/index.css">
<title>"depell"</title>
</head> </head>
<body> <body hidden>
<nav> <nav>
<button "hx-push-url"="/" "hx-get"="/index-view" "hx-target"="main" "hx-swap"="innerHTML">"depell"</button> <button "hx-push-url"="/" "hx-get"="/index-view" "hx-target"="main" "hx-swap"="innerHTML">"depell"</button>
<section> <section>