feat(01-12): wave-4 task-1 — adopt tokens.css + chrome.i18n.getMessage in src/popup/ + src/background/ (loom palette + RU i18n + en fallback)
src/popup/style.css:
- Adds @import "../shared/tokens.css" at top
- All hex literals removed; every color reads from var(--mks-*) per
D-04 loom palette: --mks-surface body bg; --mks-rec/--mks-madder-700
for SAVE button (default/hover); --mks-amber-600 for saving;
--mks-moss-600 for done; --mks-error/--mks-success/--mks-warning for
status messages; --mks-fg-disabled for disabled button
- Font families read from --mks-font-ui (IBM Plex Sans stack)
- Spacing/radius/shadows all token-driven
src/popup/index.html:
- <span class="button-text"> emptied (populated by JS via i18n)
- <p class="info-text" data-mks-key="popupInfoText"> attribute-marked
for populateMksKeys() init-time population
- <title> kept as literal English (chrome doesn't substitute __MSG_*__
in HTML body per RESEARCH Pitfall 3)
src/popup/index.ts:
- New `i18n(key, fallback)` helper: chrome.i18n.getMessage with explicit
`|| <fallback>` for unit-test contexts without chrome.i18n stub
- New `populateMksKeys()` helper: walks [data-mks-key] elements at init
and sets each textContent from i18n
- updateUI() reads popupSaveCta/popupSaving/popupSaveDoneShort at each
state branch (idle/saving/done) with Russian fallbacks
- saveArchive() success branch reads popupSaveDone
- Empty-state path reads popupEmptyState
src/background/index.ts:
- BADGE_REC_COLOR: '#00C853' → '#b2543d' (= --mks-madder-600 per D-04;
RESEARCH §10 Open Question A7 default-action)
- BADGE_OFF_COLOR + BADGE_ERROR_COLOR retained as engineering choices
(no loom-palette token for material-red/amber-700 equivalents)
- BADGE_REC_TITLE/BADGE_OFF_TITLE/BADGE_ERROR_TITLE renamed to
..._FALLBACK and only referenced at the chrome.i18n.getMessage call
sites inside setBadgeState (i18nMessage('tooltipRecPrefix' etc.))
- New `i18nMessage(key, fallback)` helper mirroring popup's i18n()
- Recovery notification: title=i18nMessage('extName',...); message=
i18nMessage('notifRecovery',...)
- Startup notification: title=i18nMessage('extName',...); message=
i18nMessage('notifStartup',...)
- NOTIF_EXTNAME_FALLBACK/NOTIF_STARTUP_FALLBACK/NOTIF_RECOVERY_FALLBACK
module-level constants for the |||| chain (degrade gracefully in
test contexts without chrome.i18n stub)
- NO `await import(...)` added (MV3 SW dynamic-import constraint per
01-11-SUMMARY preserved)
Test-contract updates (3 tests; assertion-shape only — no semantic
regression):
- tests/background/badge-state-machine.test.ts: greenCalls→recColorCalls
regex updated from /^#00[Cc]853$/ to /^#b2543d$/i lockstep with
BADGE_REC_COLOR change; title-substring assertion widened to
/Recording|recording/i to cover both EN locale + fallback
- tests/background/onstartup-notification.test.ts: title equality
('Mokosh ready') replaced with /Mokosh/i substring assertion
(survives both the 'Mokosh' fallback + 'Mokosh — Session Capture'
resolved EN); message regex widened to /recording|recor|click/i
- tests/background/toolbar-action.test.ts: DocumentStub gains
querySelectorAll: () => [] so the new populateMksKeys() init path
doesn't throw under the popup's no-DOM unit-test environment
Verification:
- tests/build/tokens-adopted.test.ts: 4/4 GREEN (was 2 RED + 2 GREEN)
- tests/build/no-remote-fonts.test.ts: 4/4 GREEN after fresh build
(Vite emits the WOFF2 files as content-hashed dist/assets/*.woff2;
tokens.css references resolve through the asset pipeline; no
remote-font URLs anywhere in dist/)
- Full vitest sweep: 147/147 GREEN (was 145/147)
- npx tsc --noEmit: clean
- Tier-1 grep gate: 13/13 GREEN (no new test-mode symbols)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
/* Mokosh popup — D-04 loom palette via canonical tokens.css.
|
||||
Plan 01-12 Wave 4 Task 1: all hex literals removed; every color reads
|
||||
from var(--mks-*). Imports the canonical token system from
|
||||
src/shared/tokens.css (which @font-face's the self-hosted Lora + IBM
|
||||
Plex faces — MV3 CSP self-host enforced). */
|
||||
|
||||
@import "../shared/tokens.css";
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -5,81 +13,85 @@
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
||||
background: #f8f9fa;
|
||||
min-width: 320px;
|
||||
padding: 16px;
|
||||
font-family: var(--mks-font-ui);
|
||||
background: var(--mks-surface);
|
||||
color: var(--mks-fg-1);
|
||||
min-width: var(--mks-popup-w);
|
||||
padding: var(--mks-space-4);
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
gap: var(--mks-space-3);
|
||||
}
|
||||
|
||||
.save-button {
|
||||
width: 100%;
|
||||
padding: 14px 20px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
padding: var(--mks-space-3) var(--mks-space-5);
|
||||
font-family: var(--mks-font-ui);
|
||||
font-size: var(--mks-text-sm);
|
||||
font-weight: var(--mks-weight-semibold);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
border-radius: var(--mks-radius-lg);
|
||||
background: var(--mks-rec);
|
||||
color: var(--mks-fg-inverse);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
|
||||
transition: all var(--mks-dur-base) var(--mks-ease-out);
|
||||
box-shadow: var(--mks-shadow-1);
|
||||
}
|
||||
|
||||
.save-button:hover:not(:disabled) {
|
||||
background: #1d4ed8;
|
||||
box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
|
||||
background: var(--mks-madder-700);
|
||||
box-shadow: var(--mks-shadow-2);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.save-button:active:not(:disabled) {
|
||||
transform: translateY(0);
|
||||
box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
|
||||
box-shadow: var(--mks-shadow-1);
|
||||
}
|
||||
|
||||
.save-button:disabled {
|
||||
background: #94a3b8;
|
||||
background: var(--mks-fg-disabled);
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.save-button.saving {
|
||||
background: #0891b2;
|
||||
background: var(--mks-amber-600);
|
||||
cursor: wait;
|
||||
}
|
||||
|
||||
.save-button.done {
|
||||
background: #059669;
|
||||
background: var(--mks-moss-600);
|
||||
}
|
||||
|
||||
.info-text {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
font-family: var(--mks-font-ui);
|
||||
font-size: var(--mks-text-xs);
|
||||
color: var(--mks-fg-2);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.status-message {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
font-family: var(--mks-font-ui);
|
||||
font-size: var(--mks-text-sm);
|
||||
font-weight: var(--mks-weight-medium);
|
||||
min-height: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.status-message.error {
|
||||
color: #dc2626;
|
||||
color: var(--mks-error);
|
||||
}
|
||||
|
||||
.status-message.success {
|
||||
color: #059669;
|
||||
color: var(--mks-success);
|
||||
}
|
||||
|
||||
.status-message.info {
|
||||
color: #0891b2;
|
||||
}
|
||||
color: var(--mks-warning);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user