john-okeefe
149d14f5eb
refactor(ts): Add ES module exports to core utilities
...
Phase 0/1 of ESBuild migration: Add ES exports to all utility modules
while maintaining Alpine.js registration for template compatibility.
Core utility modules now support both:
- ES module imports for TypeScript→TypeScript dependencies
- Alpine.js global namespace for template onclick handlers
Modules updated:
- api.ts: Export apiGet, apiPost, apiPut, apiDelete, apiPatch, and handlers
- toast.ts: Export showToast function (Alpine namespace already present)
- storage.ts: Export localStorage helpers (already had exports)
- dom.ts: Export DOM manipulation helpers (already had exports)
- events.ts: Export event delegation helpers
- theme.ts: Export theme management functions
- woodPaneling.ts: Export wood paneling functions
Pattern: Each module now has dual exports
- ES module exports for internal TS dependencies
- Alpine.global() registration for template access
- Removed direct window exports where Alpine registration exists
This enables Phase 1 (converting internal window reads to imports) while
maintaining template functionality through Alpine.
Migration progress: Phase 0 complete, Phase 1 in progress
Next: Convert 193+ internal window reads across consumer modules
2026-03-08 01:14:20 -05:00
john-okeefe
ea5ad7a41b
feat(web): update frontend TypeScript modules and API types
...
This commit updates the web frontend TypeScript modules:
Core modules:
- admin.ts: Admin panel functionality and user management
- analytics.ts: Analytics dashboard and data visualization
- api-explorer.ts: Interactive API documentation explorer
- api.ts: Core API client with request/response handling
- collections.ts: Book collection management UI
- conflicts.ts: Sync conflict resolution interface
- custom-section-builder.ts: Dynamic section builder for UI
- docs.ts: Documentation viewer and navigation
- dom.ts: DOM manipulation utilities and helpers
- header.ts: Application header with navigation
- library.ts: Library view and book grid management
- linking.ts: Device-book linking interface
- password_validation.ts: Client-side password strength validation
- queue.ts: Device sync queue management UI
- search.ts: Full-text search with Lunr integration
- storage.ts: Local storage and cache management
- theme.ts: Theme management and CSS variable updates
- themeDropdown.ts: Theme selector dropdown component
- toast.ts: Toast notification system
- woodPaneling.ts: Visual theme effects
- woodPanelingInit.ts: Visual effects initialization
Type definitions:
- api.d.ts: Updated TypeScript definitions for API responses
These updates enhance the frontend with improved functionality
for book management, device synchronization, and user experience.
2026-02-27 17:06:48 -05:00
john-okeefe
c333c82c6b
fix(frontend): add data parameter support to apiDelete
...
- Add optional data parameter to apiDelete() with generic type safety
- Enables DELETE requests with request bodies (needed for folder deletion)
- 100% backward compatible (optional parameter)
- Supports type-safe request body passing
Part of: Issue 1
2026-02-23 17:02:35 -05:00
john-okeefe
f39cf3904d
fix(frontend): Remove ES6 exports from api.ts
...
Remove ES6 export statement from api.ts that was causing CommonJS
compilation in browsers, breaking window.api initialization.
Issue: TypeScript compiled 'export { ... }' to CommonJS format
(exports.apiGet = ...), which browsers don't support.
Fix: Remove export statement, rely on existing window.api assignment.
This produces browser-compatible JavaScript.
Before: export { getAuthHeader, apiGet, ... } → CommonJS exports
After: (window as any).api = { ... } → browser global
Resolves: 'Uncaught ReferenceError: exports is not defined'
Resolves: 'Uncaught TypeError: window.api is undefined'
2026-02-22 21:06:47 -05:00
john-okeefe
60c5a093b5
feat(typescript): add core infrastructure modules
...
- Add centralized API type definitions (types/api.d.ts)
- Interfaces for all API responses matching Go handler JSON
- Snake_case field names matching actual API responses
- Source file references in comments for verification
- Add API client module (api.ts)
- Procedural get/post/put/delete functions
- Automatic auth header injection
- Exported to window for cross-module access
- Add DOM utilities (dom.ts)
- escapeHtml for safe HTML rendering
- querySelector wrappers with null checks
- Element creation helpers
- Add event delegation helpers (events.ts)
- Reusable event delegation pattern
- Data attribute selectors for dynamic content
- Add localStorage wrapper (storage.ts)
- Type-safe token management
- Theme persistence helpers
2026-02-18 16:40:29 -05:00