diff --git a/README.md b/README.md index d539882..5e92ca3 100644 --- a/README.md +++ b/README.md @@ -69,13 +69,19 @@ Legacy `chats` migration is handled during startup. New code only reads the sess ## Frontend Structure -The main browser entrypoint is still `public/script.js`, but shared API/bootstrap concerns are now split into `public/app/` modules: +The browser UI remains framework-free and uses native ES modules. Shared behavior lives under `public/app/`: -- `api.js`: JSON request helpers -- `constants.js`: theme and onboarding constants -- `dom.js`: cached DOM references +- `api.js`: JSON and streaming request helpers +- `constants.js`: theme and onboarding metadata +- `themeController.js`: validated theme/mode persistence and application +- `theme-bootstrap.js`: applies stored appearance before page initialization +- `personaForm.js`: shared persona form serialization +- `statusNotice.js`: shared status and error presentation +- `dom.js`: cached chat-page DOM references -This keeps the next round of UI extraction lower-risk without changing the app's behavior surface. +`public/style.css` is a self-contained design system rebuilt around semantic tokens, shared components, and deliberate responsive breakpoints. It contains the six visual identities and their dark variants without legacy imports or precedence layers. `public/legal.css` contains only the legal-page layout. + +Pure chat message, retry, memory, summary, and persona-state formatting lives in `src/services/chatMessageHelpers.js`; `chatService.js` remains responsible for orchestration and persistence. ## Legal diff --git a/public/app/chatDrawer.js b/public/app/chatDrawer.js index 836f70b..cb64a62 100644 --- a/public/app/chatDrawer.js +++ b/public/app/chatDrawer.js @@ -58,6 +58,20 @@ function toggleChatDrawer() { syncChatDrawerState(!isChatDrawerOpen()); } +function handleDisclosureToggle(event) { + const disclosure = event.target; + if (!(disclosure instanceof HTMLDetailsElement) || !chatDrawer?.contains(disclosure)) return; + if (disclosure.matches(".chat-drawer-more, .chat-drawer-danger")) { + const hint = disclosure.querySelector(":scope > summary .chat-drawer-row-hint"); + if (hint) hint.textContent = disclosure.open ? "Hide" : "Show"; + } + if (disclosure.open) { + chatDrawer.querySelectorAll("details[open]").forEach((other) => { + if (other !== disclosure) other.open = false; + }); + } +} + function handleDocumentClick(event) { if (!isChatDrawerOpen()) return; const target = event.target; @@ -103,6 +117,7 @@ if (chatDrawerCloseBtn) { document.addEventListener("click", handleDocumentClick); document.addEventListener("keydown", handleDocumentKeydown); +chatDrawer?.addEventListener("toggle", handleDisclosureToggle, true); export { closeChatDrawer, diff --git a/public/app/dom.js b/public/app/dom.js index 9406765..8a8737c 100644 --- a/public/app/dom.js +++ b/public/app/dom.js @@ -8,6 +8,8 @@ const messagesDiv = $("messages"); const modelSelect = $("model"); const modelPanel = $("modelPanel"); const modelBadgeName = $("modelBadgeName"); +const headerModelName = $("headerModelName"); +const headerPersonaName = $("headerPersonaName"); const modelCount = $("modelCount"); const modelHelpTitle = $("modelHelpTitle"); const modelHelpBadge = $("modelHelpBadge"); @@ -41,6 +43,7 @@ const exportChatBtn = $("exportChat"); const pinChatBtn = $("pinChat"); const moveChatFolderBtn = $("moveChatFolder"); const manageChatMemoryBtn = $("manageChatMemory"); +const managePersonaStateBtn = $("managePersonaState"); const archiveChatBtn = $("archiveChat"); const backupWorkspaceBtn = $("backupWorkspace"); const importWorkspaceBtn = $("importWorkspace"); @@ -139,6 +142,7 @@ export { pinChatBtn, moveChatFolderBtn, manageChatMemoryBtn, + managePersonaStateBtn, archiveChatBtn, backupWorkspaceBtn, importWorkspaceBtn, @@ -150,6 +154,8 @@ export { logoutButton, messagesDiv, modelBadgeName, + headerModelName, + headerPersonaName, modelCount, modelHelpBadge, modelHelpSummary, diff --git a/public/index.html b/public/index.html index a2b7469..494a56d 100644 --- a/public/index.html +++ b/public/index.html @@ -6,10 +6,11 @@ - + + -
+