v0.3.8-pre.003

This commit is contained in:
2026-09-03 11:39:09 +02:00
parent 74890a6268
commit 9300dccbe2
22 changed files with 1109 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-store-desk/frontend/ts/main.ts
// version: 1
// version: 2
import DataTable from "datatables.net-bs5";
import "datatables.net-bs5/css/dataTables.bootstrap5.css";
@@ -130,13 +130,41 @@ function installInteractions(): void {
frontendDebug("main", "Store Desk diagnostics refresh button clicked");
void refreshDiagnostics();
});
document.querySelectorAll<HTMLButtonElement>("button").forEach(button => {
if (button.dataset.view || button.id === "refreshDiagnostics") {
document.addEventListener("click", event => {
const eventTarget = event.target;
if (!(eventTarget instanceof Element)) {
return;
}
button.addEventListener("click", () => frontendDebug("main", "Store Desk generic button clicked", { buttonId: button.id || "anonymous" }));
const control = eventTarget.closest<HTMLElement>("button, [role='tab'], [data-bs-toggle='tab']");
if (!control) {
return;
}
if (control instanceof HTMLButtonElement && (control.dataset.view || control.id === "refreshDiagnostics")) {
return;
}
const controlId = control.id || control.getAttribute("data-bs-target") || control.getAttribute("aria-controls") || "anonymous";
if (control.matches("[role='tab'], [data-bs-toggle='tab']")) {
frontendDebug("main", "Store Desk tab control clicked", { controlId });
return;
}
frontendDebug("main", "Store Desk generic button clicked", { buttonId: controlId });
});
frontendTrace("main", "Store Desk frontend interactions installed");
document.addEventListener("shown.bs.tab", event => {
const target = event.target;
const tabId = target instanceof HTMLElement ? target.id || target.getAttribute("data-bs-target") || target.textContent?.trim() || "anonymous" : "unknown";
frontendDebug("main", "Store Desk tab activated", { tabId });
});
document.addEventListener("change", event => {
const target = event.target;
if (!(target instanceof HTMLInputElement || target instanceof HTMLSelectElement || target instanceof HTMLTextAreaElement)) {
return;
}
frontendDebug("main", "Store Desk interactive control changed", {
controlId: target.id || target.getAttribute("name") || "anonymous",
controlType: target instanceof HTMLSelectElement ? "select" : target.type || "text",
});
});
frontendTrace("main", "Store Desk frontend interactions installed", { buttons: true, controls: true, tabs: true });
}
async function initializeMain(): Promise<void> {