Expose /jobs, /dedup, and /events routes backed by a new EventBus that broadcasts job lifecycle and per-job progress over SSE. Serve a static dashboard from front/ that lists pending and in-progress jobs, streams agent activity, and shows completed reviews. Also add migrate-apply/migrate-generate scripts that load .env, update the Containerfile to ship the front assets and use the apply script, and refresh the roadmap.
This commit is contained in:
1 parent
8c763786c1
commit
7493de6952
32 files changed
+1681
-61
No files matched your search
@@ -0,0 +1,78 @@
|
||||
// Accès aux routes exposées par le serveur axum et petits utilitaires partagés
|
||||
// par les web components du dashboard.
|
||||
|
||||
export const endpoints = {
|
||||
jobs: "/jobs",
|
||||
reviews: "/dedup",
|
||||
lifecycle: "/events",
|
||||
jobEvents: (id) => `/jobs/${id}/events`,
|
||||
};
|
||||
|
||||
async function getJson(url) {
|
||||
const response = await fetch(url, { headers: { accept: "application/json" } });
|
||||
if (!response.ok) {
|
||||
throw new Error(`${url} → ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
|
||||
export const fetchJobs = () => getJson(endpoints.jobs);
|
||||
export const fetchReviews = () => getJson(endpoints.reviews);
|
||||
|
||||
// Ouvre un flux SSE et route les évènements nommés vers les callbacks fournis.
|
||||
// Les évènements du serveur sont nommés (`lifecycle`, `progress`, `gap`), donc
|
||||
// `addEventListener("message")` ne suffit pas : il faut écouter par nom.
|
||||
export function subscribe(url, handlers = {}) {
|
||||
const source = new EventSource(url);
|
||||
|
||||
const onData = (name, handler) => {
|
||||
if (handler) {
|
||||
source.addEventListener(name, (event) => handler(JSON.parse(event.data)));
|
||||
}
|
||||
};
|
||||
|
||||
if (handlers.onOpen) source.addEventListener("open", () => handlers.onOpen());
|
||||
if (handlers.onError) source.addEventListener("error", () => handlers.onError());
|
||||
onData("lifecycle", handlers.onLifecycle);
|
||||
onData("progress", handlers.onProgress);
|
||||
if (handlers.onGap) {
|
||||
source.addEventListener("gap", (event) => handlers.onGap(Number(event.data)));
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
export function escapeHtml(value) {
|
||||
return String(value ?? "").replace(/[&<>"']/g, (char) => ({
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """,
|
||||
"'": "'",
|
||||
})[char]);
|
||||
}
|
||||
|
||||
// Horodatage relatif (« il y a 3 min »), tolérant sur les valeurs absentes.
|
||||
export function relativeTime(value) {
|
||||
if (!value) return "—";
|
||||
const then = Date.parse(value);
|
||||
if (Number.isNaN(then)) return "—";
|
||||
|
||||
const seconds = Math.round((then - Date.now()) / 1000);
|
||||
const steps = [
|
||||
["year", 60 * 60 * 24 * 365],
|
||||
["month", 60 * 60 * 24 * 30],
|
||||
["day", 60 * 60 * 24],
|
||||
["hour", 60 * 60],
|
||||
["minute", 60],
|
||||
["second", 1],
|
||||
];
|
||||
|
||||
const formatter = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
||||
for (const [unit, size] of steps) {
|
||||
if (Math.abs(seconds) >= size || unit === "second") {
|
||||
return formatter.format(Math.round(seconds / size), unit);
|
||||
}
|
||||
}
|
||||
return "—";
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
// <steep-dashboard> : assemble le tableau de bord.
|
||||
//
|
||||
// Au montage, il charge l'état initial via REST (`/jobs`, `/dedup`), puis
|
||||
// s'abonne au flux global `/events` pour tenir les listes à jour en direct.
|
||||
// La sélection d'un job ouvre son flux fin via <steep-job-detail>.
|
||||
|
||||
import {
|
||||
endpoints,
|
||||
escapeHtml,
|
||||
fetchJobs,
|
||||
fetchReviews,
|
||||
relativeTime,
|
||||
subscribe,
|
||||
} from "./api.js";
|
||||
import "./theme-toggle.js";
|
||||
import "./job-list.js";
|
||||
import "./job-detail.js";
|
||||
|
||||
class Dashboard extends HTMLElement {
|
||||
connectedCallback() {
|
||||
this._jobs = { pending: [], processing: [] };
|
||||
this._reviews = [];
|
||||
this._selectedId = null;
|
||||
|
||||
this.render();
|
||||
this.refresh();
|
||||
this.connect();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
this._source?.close();
|
||||
if (this._refreshTimer) clearTimeout(this._refreshTimer);
|
||||
}
|
||||
|
||||
// ---- Chargement et flux -------------------------------------------------
|
||||
|
||||
async refresh() {
|
||||
try {
|
||||
const [jobs, reviews] = await Promise.all([fetchJobs(), fetchReviews()]);
|
||||
this._jobs = {
|
||||
pending: jobs.pending ?? [],
|
||||
processing: jobs.processing ?? [],
|
||||
};
|
||||
this._reviews = reviews.reviews ?? [];
|
||||
this.update();
|
||||
} catch (error) {
|
||||
console.error("failed to refresh the dashboard", error);
|
||||
}
|
||||
}
|
||||
|
||||
connect() {
|
||||
this._source = subscribe(endpoints.lifecycle, {
|
||||
onLifecycle: (event) => this.applyLifecycle(event),
|
||||
// En cas de gap (évènements ratés), on recharge l'état depuis le REST.
|
||||
onGap: () => this.refresh(),
|
||||
});
|
||||
}
|
||||
|
||||
// Recharge la liste des reviews peu après une fin de job, pour récupérer les
|
||||
// champs que l'évènement ne porte pas (markdown, coût, modèle).
|
||||
scheduleRefresh() {
|
||||
if (this._refreshTimer) clearTimeout(this._refreshTimer);
|
||||
this._refreshTimer = setTimeout(() => this.refresh(), 400);
|
||||
}
|
||||
|
||||
applyLifecycle(event) {
|
||||
switch (event.type) {
|
||||
case "queued":
|
||||
if (!this._jobs.pending.some((job) => job.id === event.id)) {
|
||||
this._jobs.pending.push(this.jobFromEvent(event));
|
||||
}
|
||||
break;
|
||||
case "started": {
|
||||
// On garde le job déjà connu s'il existe, pour conserver les champs que
|
||||
// l'évènement `started` ne porte pas (event_id, created_at).
|
||||
const known = this._jobs.pending.find((job) => job.id === event.id);
|
||||
this.removeJob(event.id);
|
||||
this._jobs.processing.push(known ?? this.jobFromEvent(event));
|
||||
break;
|
||||
}
|
||||
case "review_done":
|
||||
case "failed":
|
||||
this.removeJob(event.id);
|
||||
this.scheduleRefresh();
|
||||
break;
|
||||
case "skipped":
|
||||
this.removeJob(event.id);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
this.update();
|
||||
}
|
||||
|
||||
removeJob(id) {
|
||||
this._jobs.pending = this._jobs.pending.filter((job) => job.id !== id);
|
||||
this._jobs.processing = this._jobs.processing.filter((job) => job.id !== id);
|
||||
}
|
||||
|
||||
// L'évènement de cycle de vie porte assez de champs pour l'affichage ; le
|
||||
// rafraîchissement REST fournira le reste (created_at, payload…).
|
||||
jobFromEvent(event) {
|
||||
return {
|
||||
id: event.id,
|
||||
event_id: event.event_id,
|
||||
repo: event.repo,
|
||||
pr: event.pr,
|
||||
created_at: event.created_at,
|
||||
};
|
||||
}
|
||||
|
||||
// ---- Rendu --------------------------------------------------------------
|
||||
|
||||
render() {
|
||||
this.innerHTML = `
|
||||
<section class="section">
|
||||
<div class="section-heading">
|
||||
<p class="eyebrow">Live operations</p>
|
||||
<h1>Review dashboard</h1>
|
||||
<p>Pending jobs, work in progress, and completed reviews — kept in sync over SSE.</p>
|
||||
</div>
|
||||
|
||||
<div class="toolbar">
|
||||
<button class="button button-secondary" id="refresh" type="button">Refresh</button>
|
||||
</div>
|
||||
|
||||
<div class="board">
|
||||
<section class="panel">
|
||||
<header class="panel-head"><h2>Pending</h2><span class="count" id="pending-count">0</span></header>
|
||||
<steep-job-list id="pending" empty="No pending job."></steep-job-list>
|
||||
</section>
|
||||
<section class="panel">
|
||||
<header class="panel-head"><h2>In progress</h2><span class="count" id="processing-count">0</span></header>
|
||||
<steep-job-list id="processing" empty="No job is running."></steep-job-list>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="panel detail-panel">
|
||||
<header class="panel-head"><h2>Activity</h2></header>
|
||||
<steep-job-detail id="detail"></steep-job-detail>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<header class="panel-head"><h2>Completed reviews</h2><span class="count" id="reviews-count">0</span></header>
|
||||
<div class="reviews" id="reviews"></div>
|
||||
</section>
|
||||
</section>`;
|
||||
|
||||
this._pending = this.querySelector("#pending");
|
||||
this._processing = this.querySelector("#processing");
|
||||
this._detail = this.querySelector("#detail");
|
||||
this._reviewsEl = this.querySelector("#reviews");
|
||||
|
||||
this.querySelector("#refresh").addEventListener("click", () => this.refresh());
|
||||
this.addEventListener("job-select", (event) => this.select(event.detail.id));
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
update() {
|
||||
this._pending.jobs = this._jobs.pending;
|
||||
this._pending.selected = this._selectedId;
|
||||
this._processing.jobs = this._jobs.processing;
|
||||
this._processing.selected = this._selectedId;
|
||||
|
||||
this.querySelector("#pending-count").textContent = String(this._jobs.pending.length);
|
||||
this.querySelector("#processing-count").textContent = String(this._jobs.processing.length);
|
||||
this.querySelector("#reviews-count").textContent = String(this._reviews.length);
|
||||
|
||||
this._reviewsEl.innerHTML = this.reviewsHtml();
|
||||
}
|
||||
|
||||
select(id) {
|
||||
this._selectedId = id;
|
||||
this._detail.jobId = id;
|
||||
this.update();
|
||||
this._detail.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
||||
}
|
||||
|
||||
reviewsHtml() {
|
||||
if (this._reviews.length === 0) {
|
||||
return `<p class="empty">No review completed yet.</p>`;
|
||||
}
|
||||
|
||||
const rows = [...this._reviews]
|
||||
.sort((a, b) => String(b.completed_at ?? "").localeCompare(String(a.completed_at ?? "")))
|
||||
.map(
|
||||
(review) => `
|
||||
<tr>
|
||||
<td><span class="pill ${review.ok ? "done" : "failed"}">${review.ok ? "done" : "failed"}</span></td>
|
||||
<td class="mono">${escapeHtml(review.repo)}#${review.pr}</td>
|
||||
<td>${review.comments}</td>
|
||||
<td>${review.duration_ms} ms</td>
|
||||
<td class="mono muted">${escapeHtml(review.model ?? "—")}</td>
|
||||
<td class="muted">${relativeTime(review.completed_at)}</td>
|
||||
</tr>`,
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `
|
||||
<table class="reviews-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Status</th><th>Pull request</th><th>Comments</th><th>Duration</th><th>Model</th><th>Completed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>${rows}</tbody>
|
||||
</table>`;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("steep-dashboard", Dashboard);
|
||||
@@ -0,0 +1,61 @@
|
||||
// Carte d'un job. Le détail (id, event, date) est replié par défaut ; le
|
||||
// bouton « Watch activity » remonte un évènement `job-select` que le dashboard
|
||||
// écoute pour ouvrir le flux d'activité du job.
|
||||
|
||||
import { escapeHtml, relativeTime } from "./api.js";
|
||||
|
||||
class JobCard extends HTMLElement {
|
||||
set job(value) {
|
||||
this._job = value;
|
||||
this.render();
|
||||
}
|
||||
|
||||
get job() {
|
||||
return this._job;
|
||||
}
|
||||
|
||||
set selected(value) {
|
||||
this._selected = Boolean(value);
|
||||
this.render();
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.render();
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this._job) return;
|
||||
const job = this._job;
|
||||
|
||||
// Préserve l'état replié/déplié à travers les re-rendus (mises à jour SSE).
|
||||
const open = this._details?.open ? " open" : "";
|
||||
|
||||
this.innerHTML = `
|
||||
<details class="job" data-selected="${this._selected ? "true" : "false"}"${open}>
|
||||
<summary class="job-head">
|
||||
<span class="chev" aria-hidden="true"></span>
|
||||
<span class="job-repo">${escapeHtml(job.repo)}</span>
|
||||
<span class="job-pr">#${job.pr}</span>
|
||||
</summary>
|
||||
<div class="job-info">
|
||||
<dl>
|
||||
<div><dt>Job</dt><dd>${job.id}</dd></div>
|
||||
${job.event_id != null ? `<div><dt>Event</dt><dd>${job.event_id}</dd></div>` : ""}
|
||||
<div><dt>Created</dt><dd>${escapeHtml(relativeTime(job.created_at))}</dd></div>
|
||||
</dl>
|
||||
<button class="button button-secondary job-watch" type="button">Watch activity</button>
|
||||
</div>
|
||||
</details>`;
|
||||
|
||||
this._details = this.querySelector("details");
|
||||
this.querySelector(".job-watch").addEventListener("click", () => this.select());
|
||||
}
|
||||
|
||||
select() {
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("job-select", { detail: { id: this._job.id }, bubbles: true }),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("steep-job-card", JobCard);
|
||||
@@ -0,0 +1,150 @@
|
||||
// Panneau d'activité d'un job : ouvre un flux SSE vers `/jobs/{id}/events`,
|
||||
// rejoue l'historique renvoyé par le serveur puis affiche le direct.
|
||||
|
||||
import { endpoints, escapeHtml, subscribe } from "./api.js";
|
||||
|
||||
class JobDetail extends HTMLElement {
|
||||
set jobId(value) {
|
||||
const id = value ?? null;
|
||||
if (this._jobId === id) return;
|
||||
this._jobId = id;
|
||||
this.open();
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
if (!this._jobId) this.renderPlaceholder();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this._source) {
|
||||
this._source.close();
|
||||
this._source = null;
|
||||
}
|
||||
}
|
||||
|
||||
open() {
|
||||
this.close();
|
||||
this._finished = false;
|
||||
|
||||
if (!this._jobId) {
|
||||
this.renderPlaceholder();
|
||||
return;
|
||||
}
|
||||
|
||||
this.innerHTML = `
|
||||
<div class="log" id="log" role="log" aria-live="polite"></div>`;
|
||||
this._log = this.querySelector("#log");
|
||||
|
||||
this._source = subscribe(endpoints.jobEvents(this._jobId), {
|
||||
onProgress: (event) => {
|
||||
this.append(event);
|
||||
if (event.type === "finished") {
|
||||
this._finished = true;
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
onGap: (skipped) =>
|
||||
this.append({ type: "gap", note: `missed ${skipped} events, refresh to resync` }),
|
||||
// Un `error` survient aussi quand le serveur ferme le flux (job terminé).
|
||||
// On ferme alors la source pour éviter la boucle de reconnexion (le job
|
||||
// n'est plus en cours, la route renverrait 404).
|
||||
onError: () => {
|
||||
if (this._finished) return;
|
||||
this.append({ type: "gap", note: "stream closed" });
|
||||
this.close();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
renderPlaceholder() {
|
||||
this.innerHTML = `<p class="empty">Select a job in progress to watch the agent work.</p>`;
|
||||
}
|
||||
|
||||
append(event) {
|
||||
if (!this._log) return;
|
||||
this._log.append(this.entry(event));
|
||||
this._log.scrollTop = this._log.scrollHeight;
|
||||
}
|
||||
|
||||
entry(event) {
|
||||
return event.type === "tool_result" ? this.resultEntry(event) : this.lineEntry(event);
|
||||
}
|
||||
|
||||
// Ligne simple : appel d'outil, fin de review, gap.
|
||||
lineEntry(event) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "log-entry";
|
||||
row.dataset.kind = event.type;
|
||||
|
||||
const { tag, body } = this.describe(event);
|
||||
|
||||
const tagEl = document.createElement("span");
|
||||
tagEl.className = "log-tag";
|
||||
tagEl.textContent = tag;
|
||||
|
||||
const bodyEl = document.createElement("span");
|
||||
bodyEl.className = "log-body";
|
||||
bodyEl.innerHTML = body;
|
||||
|
||||
row.append(tagEl, bodyEl);
|
||||
return row;
|
||||
}
|
||||
|
||||
// Résultat d'outil : replié par défaut, avec un aperçu sur une ligne.
|
||||
resultEntry(event) {
|
||||
const details = document.createElement("details");
|
||||
details.className = "log-result";
|
||||
|
||||
const summary = document.createElement("summary");
|
||||
const chev = document.createElement("span");
|
||||
chev.className = "chev";
|
||||
chev.setAttribute("aria-hidden", "true");
|
||||
const tag = document.createElement("span");
|
||||
tag.className = "log-tag";
|
||||
tag.textContent = "result";
|
||||
const preview = document.createElement("span");
|
||||
preview.className = "log-preview";
|
||||
preview.textContent = this.preview(event.output);
|
||||
summary.append(chev, tag, preview);
|
||||
|
||||
const body = document.createElement("div");
|
||||
body.className = "log-body";
|
||||
const truncated = event.truncated
|
||||
? ' <span class="log-truncated">(truncated)</span>'
|
||||
: "";
|
||||
body.innerHTML = `${escapeHtml(event.output)}${truncated}`;
|
||||
|
||||
details.append(summary, body);
|
||||
return details;
|
||||
}
|
||||
|
||||
preview(text) {
|
||||
const line = String(text ?? "").replace(/\s+/g, " ").trim();
|
||||
return line.length > 80 ? `${line.slice(0, 80)}…` : line;
|
||||
}
|
||||
|
||||
describe(event) {
|
||||
switch (event.type) {
|
||||
case "tool_call":
|
||||
return {
|
||||
tag: "call",
|
||||
body: `${escapeHtml(event.name)} <span class="log-args">${escapeHtml(event.arguments)}</span>`,
|
||||
};
|
||||
case "finished":
|
||||
return {
|
||||
tag: "done",
|
||||
body: event.ok ? "review finished" : "review failed",
|
||||
};
|
||||
case "gap":
|
||||
return { tag: "gap", body: escapeHtml(event.note ?? "gap") };
|
||||
default:
|
||||
return { tag: escapeHtml(event.type ?? "event"), body: "" };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("steep-job-detail", JobDetail);
|
||||
@@ -0,0 +1,58 @@
|
||||
// Liste de jobs (une colonne du tableau). Reçoit un tableau de jobs via la
|
||||
// propriété `jobs` et l'id sélectionné via `selected`.
|
||||
|
||||
import "./job-card.js";
|
||||
|
||||
class JobList extends HTMLElement {
|
||||
set jobs(value) {
|
||||
this._jobs = Array.isArray(value) ? value : [];
|
||||
this.render();
|
||||
}
|
||||
|
||||
get jobs() {
|
||||
return this._jobs ?? [];
|
||||
}
|
||||
|
||||
set selected(value) {
|
||||
this._selected = value;
|
||||
this.render();
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
if (this._mounted) return;
|
||||
this._mounted = true;
|
||||
this.render();
|
||||
}
|
||||
|
||||
render() {
|
||||
const jobs = this.jobs;
|
||||
|
||||
if (jobs.length === 0) {
|
||||
this.replaceChildren();
|
||||
const empty = document.createElement("p");
|
||||
empty.className = "empty";
|
||||
empty.textContent = this.getAttribute("empty") || "Nothing here.";
|
||||
this.append(empty);
|
||||
return;
|
||||
}
|
||||
|
||||
// Réconciliation par id : on réutilise les cartes existantes pour préserver
|
||||
// l'état replié/déplié de chacune à travers les mises à jour.
|
||||
const known = new Map();
|
||||
for (const card of this.querySelectorAll("steep-job-card")) {
|
||||
if (card.job) known.set(card.job.id, card);
|
||||
}
|
||||
|
||||
for (const job of jobs) {
|
||||
const card = known.get(job.id) ?? document.createElement("steep-job-card");
|
||||
known.delete(job.id);
|
||||
card.job = job;
|
||||
card.selected = job.id === this._selected;
|
||||
this.append(card);
|
||||
}
|
||||
|
||||
for (const card of known.values()) card.remove();
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("steep-job-list", JobList);
|
||||
@@ -0,0 +1,59 @@
|
||||
// Bascule de thème, identique à celle du site public (même clé localStorage,
|
||||
// même rendu), empaquetée en web component.
|
||||
|
||||
const STORAGE_KEY = "steep-theme";
|
||||
|
||||
export function currentTheme() {
|
||||
return document.documentElement.dataset.theme === "light" ? "light" : "dark";
|
||||
}
|
||||
|
||||
export function applyTheme(theme, persist = true) {
|
||||
document.documentElement.dataset.theme = theme;
|
||||
|
||||
const meta = document.querySelector('meta[name="theme-color"]');
|
||||
if (meta) meta.content = theme === "dark" ? "#0b1520" : "#f7f8f5";
|
||||
|
||||
if (persist) {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, theme);
|
||||
} catch (_) {
|
||||
// stockage indisponible : on garde juste le thème en mémoire.
|
||||
}
|
||||
}
|
||||
|
||||
window.dispatchEvent(new CustomEvent("steep:theme", { detail: theme }));
|
||||
}
|
||||
|
||||
class ThemeToggle extends HTMLElement {
|
||||
connectedCallback() {
|
||||
this.innerHTML = `
|
||||
<button class="theme-toggle" type="button" role="switch" aria-label="Toggle color theme">
|
||||
<span class="theme-icon" aria-hidden="true"></span><span class="theme-label"></span>
|
||||
</button>`;
|
||||
|
||||
this._button = this.querySelector("button");
|
||||
this._icon = this.querySelector(".theme-icon");
|
||||
this._label = this.querySelector(".theme-label");
|
||||
this._onTheme = () => this.render();
|
||||
|
||||
this._button.addEventListener("click", () => {
|
||||
applyTheme(currentTheme() === "dark" ? "light" : "dark");
|
||||
});
|
||||
window.addEventListener("steep:theme", this._onTheme);
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
window.removeEventListener("steep:theme", this._onTheme);
|
||||
}
|
||||
|
||||
render() {
|
||||
const theme = currentTheme();
|
||||
this._icon.textContent = theme === "dark" ? "☾" : "☀";
|
||||
this._label.textContent = theme === "dark" ? "Dark theme" : "Light theme";
|
||||
this._button.setAttribute("aria-checked", String(theme === "dark"));
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("steep-theme-toggle", ThemeToggle);
|
||||
Reference in new issue
Block a user