Vaihe 1/1: users-moduuli, kirjautuminen ja käyttäjähallinta
- shared-moduuli: DomainError, EmailAddress, UnitOfWork, tapahtumat, TimestampedModel, daisyUI-lomakerenderöinti ja yhteiset pohjat - users-moduuli Clean Architecture -kerroksin: oma käyttäjämalli (AUTH_USER_MODEL), roolit ja oikeudet, harjoittelija-, vastuuhenkilö- ja viimeisen pääkäyttäjän säännöt - kirjautuminen sähköpostilla, yritysten rajoitus, "muista minut", istunnon katkaisu kun tunnus poistetaan käytöstä tai harjoittelu päättyy - kertakäyttöiset salasanalinkit (72 h / 60 min, uusi mitätöi vanhan), salasanasääntö ja create_admin-komento - käyttäjähallinta: lista (HTMX-haku), lomakkeet ja kopioitava linkki - Tailwind 4 + daisyUI 5 + HTMX + Alpine npm-buildilla, suomennokset - testit: domain, application (fakeilla), integraatio ja selaintestit (axe, vaalea/tumma, 1920/320 px); ruff, mypy ja import-linter - dokumentit päivitetty toteutuksen mukaisiksi Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
@import "tailwindcss";
|
||||
@plugin "daisyui" {
|
||||
themes: light --default, dark --prefersdark;
|
||||
}
|
||||
|
||||
@source "../../apps";
|
||||
@source "../../templates";
|
||||
|
||||
/* Visible focus for all interactive elements (WCAG 2.4.7 / 2.4.11). */
|
||||
:focus-visible {
|
||||
outline: 3px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
[x-cloak] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* WCAG AA: daisyUI soft variants colour their text with the variant colour,
|
||||
which is too light on the tinted background. Keep the tint, use body text colour. */
|
||||
.alert-soft,
|
||||
.badge-soft {
|
||||
color: var(--color-base-content);
|
||||
}
|
||||
|
||||
.menu-title {
|
||||
color: var(--color-base-content);
|
||||
}
|
||||
|
||||
/* Status colours used as text must reach 4.5:1 on the light background. */
|
||||
@plugin "daisyui/theme" {
|
||||
name: "light";
|
||||
default: true;
|
||||
--color-error: oklch(50% 0.19 25);
|
||||
--color-error-content: oklch(100% 0 0);
|
||||
--color-success: oklch(48% 0.12 155);
|
||||
--color-success-content: oklch(100% 0 0);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Shared client behaviour: theme toggle and focus management after HTMX swaps.
|
||||
(function () {
|
||||
const THEME_KEY = "theme";
|
||||
|
||||
window.setTheme = function (theme) {
|
||||
document.documentElement.setAttribute("data-theme", theme);
|
||||
localStorage.setItem(THEME_KEY, theme);
|
||||
};
|
||||
|
||||
document.addEventListener("htmx:afterSettle", function (event) {
|
||||
const target = event.detail.target;
|
||||
if (!target) return;
|
||||
const focusable = target.querySelector("[data-autofocus]");
|
||||
if (focusable) {
|
||||
focusable.focus();
|
||||
}
|
||||
});
|
||||
|
||||
// Announce HX-Trigger "notify" events in the live region and as a toast.
|
||||
document.body.addEventListener("notify", function (event) {
|
||||
window.notify(event.detail.value || event.detail.message || "");
|
||||
});
|
||||
|
||||
window.notify = function (message) {
|
||||
const live = document.getElementById("live-region");
|
||||
if (live) {
|
||||
live.textContent = "";
|
||||
window.setTimeout(function () { live.textContent = message; }, 50);
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user