Study - New Outline stage (hierarchical I./A./1. points, linked to chunks, in all exports); the chunk stage is now "Chunks" - Home cards: passages shown as ranges, tags capped with "+N more" Reader - Side-by-side translations and a Compare tab per verse - Typeface, line spacing, verse-number settings; text and column scale with the screen - Highlights/bookmarks sheet with named colours (synced); BSB footnote spacing fix - Cmd-K palette (passages, studies, notes, marks), keyboard shortcuts and "?" help Flow and safety - Toasts with Undo replace most confirm()/alert() - Back/Forward move between pages - Server refuses saves over a newer copy (409); keep-mine / use-other banner; opening a study no longer re-stamps it - Latest chapter request wins when flipping quickly Offline and data - Save books, plan days or a whole BSB/NET for offline - Service worker fixes: helloao /api/ URLs were skipped and responses cloned too late - Settings: download/restore a full backup Accessibility - Sheets trap focus and close on Escape, skip link, focus ring, reduced motion, theme contrast raised to 4.5:1 (with a test) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
import { describe, expect, test } from 'vitest';
|
|
import { READER_THEMES } from './readerThemes.js';
|
|
|
|
// WCAG relative luminance and contrast ratio
|
|
const luminance = (hex) => {
|
|
const [r, g, b] = [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255)
|
|
.map((c) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4));
|
|
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
};
|
|
const contrast = (a, b) => {
|
|
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
return (hi + 0.05) / (lo + 0.05);
|
|
};
|
|
|
|
// Small text needs 4.5:1. These are the pairings the app actually draws.
|
|
describe.each(Object.entries(READER_THEMES))('%s theme contrast', (_id, { vars }) => {
|
|
const v = (name) => vars[`--r-${name}`];
|
|
test.each([
|
|
['text', 'bg'], ['text', 'bar'], ['text', 'hl'],
|
|
['sub', 'bg'], ['sub', 'bar'], ['sub', 'hl'],
|
|
['accent', 'bg'], ['accent', 'bar'],
|
|
['danger', 'bg'], ['danger', 'bar'],
|
|
['on', 'accent'],
|
|
])('%s on %s is at least 4.5:1', (fg, bg) => {
|
|
expect(contrast(v(fg), v(bg))).toBeGreaterThanOrEqual(4.5);
|
|
});
|
|
});
|