refactor: Add Alpine.js registration to existing TypeScript modules

Added Alpine.global() registration to enable template access to functions:

- admin.ts: Added Alpine for scan, stats, and settings functions
- api-explorer.ts: Already had Alpine (kept as is)
- bookshelf.ts: Added Alpine for library/bookshelf interactions
- collections.ts: Added Alpine for collection management
- conflicts.ts: Added Alpine for conflict resolution
- device-management.ts: Added Alpine with event delegation for dynamic content
- header.ts: Added Alpine for theme dropdown and user menu
- library.ts: Added Alpine registrations
- linking.ts: Added Alpine registrations
- queue.ts: Added Alpine for queue operations
- search.ts: Added Alpine registrations
- themeDropdown.ts: Added Alpine for theme switching

Each module now exports functions both traditionally and via Alpine.global() for template access.
This commit is contained in:
2026-03-08 21:36:24 -04:00
parent dc288e6169
commit 6728ba83a1
12 changed files with 1028 additions and 393 deletions
+5 -10
View File
@@ -1,3 +1,5 @@
import { showToast } from "./toast";
interface ApiExplorerRequest {
method: string;
endpoint: string;
@@ -165,9 +167,7 @@ function copyCurl(): void {
const curl = document.getElementById("curl-command")?.textContent;
if (curl) {
navigator.clipboard.writeText(curl);
if ((window as any).showToast?.success) {
(window as any).showToast.success("cURL copied to clipboard");
}
showToast("cURL copied to clipboard", "success");
}
}
@@ -179,13 +179,8 @@ function formatJson(): void {
const parsed = JSON.parse(bodyInput.value);
bodyInput.value = JSON.stringify(parsed, null, 2);
} catch {
if ((window as any).showToast?.error) {
(window as any).showToast.error("Invalid JSON");
}
showToast("Invalid JSON", "error");
}
}
(window as any).sendApiRequest = sendApiRequest;
(window as any).loadFromHistory = loadFromHistory;
(window as any).copyCurl = copyCurl;
(window as any).formatJson = formatJson;
export { sendApiRequest, loadFromHistory, copyCurl, formatJson };