Commit 2f2968f
committed
refactor(ui): WebUI modernization PR5 — ES module split
Split the ~2.4k-line app.js IIFE into native ES modules under
cmd/odek/ui/js/ (no build step, no dependencies). app.js stays the
/app.js entry and now just imports ./js/main.js.
- js/state.js: single mutable state object S (all former module-level
globals) + session-token persistence helpers
- js/dom.js / js/net.js: import-free leaves (getElementById refs,
getWsToken/apiHeaders)
- js/utils.js / js/markdown.js: pure helpers and markdownToHtml
- js/render.js: streaming, thinking, tool blocks, sub-agents, session
history, collapse/copy, loading indicator; addMessage monkey-patch
dissolved into direct addCopyButton/checkCollapse calls
- js/approvals.js / js/sessions.js / js/input.js / js/ws.js / js/main.js:
approval queue, sidebar, prompt/attachments/@-completion, WebSocket
dispatch, init sequence
- All inline onclick/onchange handlers (index.html and generated HTML)
replaced with addEventListener / click delegation on #messages;
window.* exports removed
- serve.go handleStatic: sanitized /js/<file>.js route (rejects ..,
subdirs, non-.js) served from the embedded uiFS1 parent 7cee1d5 commit 2f2968f
15 files changed
Lines changed: 2556 additions & 2419 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1762 | 1762 | | |
1763 | 1763 | | |
1764 | 1764 | | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
1765 | 1776 | | |
1766 | 1777 | | |
1767 | 1778 | | |
| |||
0 commit comments