Theme doctor: advice on imported themes, never a block
themeDoctor(theme) names the lighter mechanism for what a theme's CSS does (radius, bevel, hiding, literal colors, fonts), its performance costs (:has, universal selectors, blur, size) and accessibility costs (outline removed, unguarded motion, small post text, moved navigation), plus contrast fixes. Theme import adds the count and the first hint to its message. Tested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cd9917aad3
commit
7e7105b54c
5 changed files with 107 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ import { tabProfile } from '../profileModel.ts';
|
|||
import { Button, ColorField, Row, Section, Segmented, Select, Slider, Toggle, useSettingsQuery, type Option } from './controls.tsx';
|
||||
import { IconPackImport, IconPackReview } from './IconPackInstall.tsx';
|
||||
import type { IconPack } from '../../../runtime/src/themeIcons.ts';
|
||||
import { themeDoctor } from '../../../runtime/src/themeDoctor.ts';
|
||||
import { bytesLabel, defaultWeights, loadCatalog, weightsLabel } from './fonts/catalog.ts';
|
||||
import { FontRoles } from './fonts/FontRoles.tsx';
|
||||
import { CustomCssEditor } from './Plugins.tsx';
|
||||
|
|
@ -405,7 +406,9 @@ function ImportPanel({ onImport, onCancel }: { onImport(theme: ThemeSpec, warnin
|
|||
const run = (json: string) => {
|
||||
const parsed = parseThemeJson(json);
|
||||
if ('error' in parsed) { setError(parsed.error); return; }
|
||||
onImport(parsed.theme, parsed.warnings);
|
||||
// The theme doctor: advice only (never a block); contrast is already in the warnings.
|
||||
const hints = themeDoctor(parsed.theme).filter(advice => advice.kind !== 'contrast');
|
||||
onImport(parsed.theme, hints.length ? [...parsed.warnings, t('wb.appearance.doctorHints', { count: hints.length, hint: hints[0]!.text })] : parsed.warnings);
|
||||
};
|
||||
return <div className="bt-import">
|
||||
<div className="bt-import-drop" onDragOver={event => event.preventDefault()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue