feat: add three-way theme toggle to popup#129
Merged
zhongnansu merged 8 commits intomainfrom Apr 1, 2026
Merged
Conversation
📦 PR Preview — Ask AI ExtensionVersion: PermissionsNo permission changes detected. ✅ Preview ChecklistBefore merging, manually test with the artifact above:
Updated by PR Preview Bot — workflow run |
📊 Code Coverage Report
Threshold: 80% ✅ Coverage meets the minimum threshold. Updated by Code Coverage workflow |
Add segmented control between autosuggest toggle and settings link. Reads theme from chrome.storage.local on load (default: Auto), persists selection on click, and updates active button styling. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
detectTheme() now checks chrome.storage.local for an explicit 'light'/'dark' preference before falling back to OS matchMedia. initBubble/showBubble/showBubbleWithPresets and createToolbar/ showTrigger/createTriggerButton updated to await detectTheme. Adds chrome.storage.onChanged listener in createBubbleHost for live theme updates, cleaned up in hideBubble. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- helpers.js: add chrome.storage.onChanged mock - bubble.test.js: await showBubble/detectTheme, make callbacks async - popup.test.js: add theme segment DOM, add 6 theme toggle tests - toolbar.test.js: mock detectTheme as Promise, await showTrigger - trigger.test.js: mock detectTheme as Promise, await async calls, flush microtasks after fake timer advance Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r, add aria-pressed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Log errors instead of silently swallowing in showBubble .catch() - Add live theme update listener to toolbar via storage.onChanged - Clean up toolbar storage listener in hideTrigger() - Fix showBubble mock to return Promise for .catch() chain Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add .catch() to fire-and-forget showTrigger calls in selection.js - Fix dark mode border color for .theme-row in popup - Sync package-lock.json version to 1.1.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
299861b to
147700c
Compare
Add a creation lock to showTrigger() to prevent concurrent createToolbar() calls when multiple selection events fire before the first async toolbar creation resolves. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chrome.storage.local— defaults to Auto (OS preference)detectTheme()is now async: checks storage first, falls back to OS preferencechrome.storage.onChangedawaitthe async functionsFiles Changed
popup.html— segmented control UI with dark mode supportsrc/popup.js— read/write theme preferencesrc/content/bubble/core.js— asyncdetectTheme(), live theme listener + cleanupsrc/content/trigger/button.js— asynccreateToolbar/showTrigger/launchActionsrc/content/index.js—awaitonshowBubble/showBubbleWithPresetscallssrc/content/trigger/screenshot.js—awaitonshowBubbleWithPresetstests/— 6 new tests, all existing tests updated for async (577 total, 0 failures)Test plan
npm run build)npx vitest run)aria-pressedon toggle buttons🤖 Generated with Claude Code