Convert toast.js to TypeScript (issue #17)

- Add ts/toast.ts: typed port of the Alpine toast store + window.toast +
  window.fetchWithHtmxTriggers. Toast / ToastStore / ToastMessage interfaces
  type the store and the show-toast CustomEvent detail; Alpine declared as a
  type-only ambient global
- Declare window.toast in ts/globals.d.ts
- Stays a classic (non-module) script — no import/export — so it keeps defining
  globals; layout.py now serves dist/toast.js

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 13:58:43 +02:00
parent 19e9fd1419
commit 1decf588c1
3 changed files with 80 additions and 44 deletions
+1
View File
@@ -3,6 +3,7 @@ export {};
declare global {
interface Window {
fetchWithHtmxTriggers(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
toast(message: string, type?: string): void;
readSearchSelect(form: HTMLElement): void;
applyFilterBar(event: Event): boolean;
clearFilterBar(formId: string, filterInputId: string): void;