ui: the last of Semantic UI, in name and in dead CSS

The library has been uninstalled for some time, but the codebase still read as
though it were there: identifiers named after it, rules written against its
class names, and about 180 comments explaining a rule in terms of a thing that
is no longer installed.

Renamed, keeping the vocabulary the app actually uses: semanticUIColorMap ->
navColorHexMap, semanticColorNames -> paletteColorNames, semanticNames ->
iconNameAliases, semanticSizes -> sizeAliases, and SemanticUIColors ->
NavColors in wrolpi/schema.py, which is what validates nav_color on the way in.
ColorToSemanticHexColor had no callers at all and is gone.

The baseline ratchet has done its job -- the list reached zero, so the JSON is
deleted and the guard keeps only the checks with teeth: no package, no import,
no `className="ui "`, no toast library.  Its Theme.tsx check went with the
wrappers it was watching for.  It also asserts its own walk found files, so a
clean result cannot mean it scanned nothing.

Deleted from App.css: every rule requiring `.ui`, `.inverted`, `.segment` or
`.modal`, none of which any component has set since the stylesheet stopped
loading, plus the form skeletons, ui-alerts and progress-text rules that
nothing renders.  Two of them were doing harm rather than nothing: the drag
tints had a dark-theme variant under `.inverted` that stopped applying, leaving
15% of a fixed blue over a dark row, and now mix a token instead.

Two selectors naming markup that no longer exists were live bugs.  The file
browser's filter had `.ui.input.file-browser-filter`, so it rendered at the
browser default width on a bar laid out to give it 34em -- now qualified by its
container, because `.wrolpi-action-input` sets `width: 100%` at the same
specificity and is loaded later.  And SearchBox takes named props rather than a
rest spread, so the `id` DestinationForm hands it was dropped in silence and
the label it renders pointed at nothing; the download forms' Destination field
has had no associated label since the migration.

"Semantic roles" survives in four places, where it means what it says.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-05 19:15:57 -06:00
parent 72228ed67f
commit e00f0439da
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
58 changed files with 387 additions and 618 deletions

View file

@ -709,10 +709,8 @@ export function DomainEditPage() {
appliedTagName={domain?.tag_name}
>
{/*
* CollectionEditForm still wraps its children in a `ui stackable grid` div (Semantic's
* grid CSS, not a component) because it is shared with unmigrated callers (Channels.js,
* Playlists.js). Plain "row"/"column" divs are that CSS's own class names, not a
* semantic-ui-react import.
* CollectionEditForm lays its children out as a grid, and "row"/"column" are that
* grid's own class names -- plain divs, not components.
*/}
<div className="row">
<div className="column">

View file

@ -18,7 +18,7 @@ import {VinDecoderCalculator} from "./calculators/VinDecoderCalculator";
// `group` matching one of these names; any calculator whose group is missing/unknown falls
// into a trailing "Other" section so a new calculator can never silently disappear.
//
// `color` is a Semantic UI named color (colorblind-friendly palette) used to tint the group's
// `color` is one of the named palette colors (see `paletteColorNames`) used to tint the group's
// buttons. Violet is intentionally avoided — it is the default navbar color and would blend in.
export const CALCULATOR_GROUPS = [
{name: 'Preparedness & Storage', color: 'red'},

View file

@ -492,7 +492,7 @@ export function SearchResultsInput({
const localHandleResultSelect = (result) => {
if (handleResultSelect) {
// Semantic handed its callers `{result}`, and they destructure it -- passing the
// Callers destructure `{result}` from this -- passing the
// bare result silently broke navigation from the search suggestions. The shape
// stays until the call sites are ready to change together.
handleResultSelect({result});
@ -1626,7 +1626,7 @@ export const TAG_TEXT_LIGHT = '#dddddd';
* Dark or light text, whichever a user's chosen tag color actually reads better against.
*
* Measures both instead of comparing a brightness figure to a threshold. The threshold
* version put light text on Semantic's blue (`#2185d0`) at 2.9:1 when dark text on the same
* version put light text on the palette blue (`#2185d0`) at 2.9:1 when dark text on the same
* fill gives 5.3:1 -- it had picked the worse of the only two options. Every mid-tone blue,
* teal and purple a user might choose sat in that band.
*/
@ -1823,7 +1823,7 @@ export function useAPIButton(
}
}
// `color` was a Semantic color name; a role carries the meaning instead, and a
// `color` was a bare color name; a role carries the meaning instead, and a
// caller that really wants a color can still pass one through `props`.
const buttonArgs = {
onClick: localOnClick, disabled, loading, type, size,
@ -2118,7 +2118,7 @@ export function Breadcrumbs({crumbs, size = undefined}) {
return <span key={index}>{text}</span>
}
// The separator is a chevron rather than Semantic's slash, matching the icon set.
// The separator is a chevron rather than a slash, matching the icon set.
return <UIBreadcrumbs separator={<Icon name='chevron right' size={14}/>}>
{crumbs.map(getSection)}
</UIBreadcrumbs>

View file

@ -110,7 +110,7 @@ describe('DirectorySearch', () => {
it('renders the dropdown without crashing when directoryName is null', async () => {
// An unset form field (e.g. the new Channel page) passes a null value. With
// isDir=false a "New Directory" result is built from directoryName; if that title is
// null, Semantic UI's Search crashes reading null.length when the menu opens.
// null, the old Search crashed reading null.length when the menu opened.
setMockHookState({
directories: [],
channelDirectories: [],
@ -135,7 +135,7 @@ describe('DirectorySearch', () => {
<DirectorySearch onSelect={mockOnSelect} value="" required/>
);
// Unlike Semantic UI's Search, the SearchBox forwards `required` straight
// Unlike the old Search, the SearchBox forwards `required` straight
// onto the input.
const input = screen.getByPlaceholderText(/search directory names/i);
expect(input).toBeRequired();
@ -495,7 +495,7 @@ describe('contrastingColor', () => {
*/
it('picks whichever of the two options actually reads better', () => {
// Semantic's blue. The old threshold check chose light text here, at 2.9:1, when dark
// The palette blue. The old threshold check chose light text here, at 2.9:1, when dark
// text on the same fill gives 5.3:1 -- the worse of the only two available answers.
// Every mid-tone blue, teal and purple a user might choose sat in that band.
const blue = '#2185d0';
@ -781,7 +781,7 @@ describe('PageContainer', () => {
describe('a row of buttons', () => {
/*
* Semantic's Button brought `margin: 0 .25em .25em 0` with it, so a page could list buttons as
* Buttons used to bring `margin: 0 .25em .25em 0` with them, so a page could list buttons as
* bare siblings and they arrived both spaced and, when the row wrapped, separated. Nothing
* replaced that margin. The archive page's six actions shared edges, and two of them carried
* `marginTop: 0.5em` -- put there to keep a wrapped row from touching vertically, which instead

View file

@ -95,7 +95,7 @@ describe('DomainEditPage', () => {
render(<DomainEditPage/>);
// Should show Semantic UI Loader with text
// Should show the Loading component with text
expect(screen.getByText(/loading domain/i)).toBeInTheDocument();
// Form should not be visible during initial load

View file

@ -37,11 +37,11 @@ import {
} from "./Vars";
/*
* Download.js was built around Semantic UI's <Form> family (Form.Input,
* Download.js was built around the old <Form> family (Form.Input,
* FormDropdown, TextArea) via `hooks/useForm.js`'s JSX helpers (InputForm,
* NumberInputForm, ToggleForm, UrlInput, UrlsTextarea). `hooks/useForm.js` is
* off-limits for this migration and its JSX helpers still render through
* `./Theme` (Semantic UI). Rather than use those helpers, the field
* `./Theme`. Rather than use those helpers, the field
* components below call `useForm`'s plain data getters (getInputProps,
* getSelectionProps, getCustomProps) directly and render our own markup with
* the token-driven `./ui` library. See the migration report for what this
@ -110,7 +110,7 @@ function NumberField({
</div>
}
/** A single-select field. `options` are Semantic-shaped ({key, text, value}); Mantine's Select
/** A single-select field. `options` are {key, text, value}; Mantine's Select
* requires string data values, so values are stringified for display and mapped back on change. */
function SelectField({form, name, path, label, options, required = false, placeholder, disabled = false, afterChange}) {
const [inputProps] = form.getSelectionProps({name, path, required, afterChange});
@ -1547,7 +1547,7 @@ export function EditScrapeFilesDownloadForm({download, onDelete, onCancel, onSuc
/>
}
/** URL field for a single URL (Semantic's `UrlInput`). */
/** URL field for a single URL. */
function UrlField({form, required = true, name = 'url', path = 'url', disabled = false}) {
const validator = (i) => validURL(i) ? null : 'Invalid URL';
return <TextField
@ -1562,7 +1562,7 @@ function UrlField({form, required = true, name = 'url', path = 'url', disabled =
/>
}
/** Multiline URLs field (Semantic's `UrlsTextarea`). */
/** Multiline URLs field: one URL per line. */
function UrlsField({name = 'urls', required, form}) {
required = required !== undefined;

View file

@ -984,7 +984,7 @@ const REFRESH_PHASES = [
{key: 5, icon: 'check circle', title: 'Cleanup', description: 'Finalizing'},
];
// Replaces Semantic's Step.Group/Step: a row of phase markers, brightness/weight (via the active
// A row of phase markers, brightness/weight (via the active
// border) carrying the current stage rather than a bespoke component from the shared library.
function RefreshStepItem({phase, isActive, isCompleted, isDisabled, description}) {
return <div style={{

View file

@ -69,7 +69,7 @@ function SearchModal({open, onClose}) {
*
* `autoFocus` on the input below is what actually does it: the modal mounts its
* content on a later tick, so this effect runs while `inputRef.current` is still
* null. Semantic's modal mounted synchronously, which is why focusing here used
* null. The modal this replaced mounted synchronously, which is why focusing here used
* to be enough. The ref call is kept for the case where the modal is already
* mounted and merely re-opened.
*/

View file

@ -17,14 +17,14 @@ import {
} from "../hooks/customHooks";
import {useReorganizationStatus} from "../contexts/FileWorkerStatusContext";
import {SearchIconButton} from "./Search";
import {HELP_VIEWER_URI, NAME, semanticUIColorMap} from "./Vars";
import {HELP_VIEWER_URI, NAME, navColorHexMap} from "./Vars";
import {useOverflowNav} from "../hooks/useOverflowNav";
import {defaultNavColor, navBarStyle, useNavColors} from "../themes/navColors";
import _ from "lodash";
function updateFavicon(colorName) {
// Fall back to violet if invalid color
const safeColor = colorName in semanticUIColorMap ? colorName : 'violet';
const safeColor = colorName in navColorHexMap ? colorName : 'violet';
const faviconPath = `/favicon-${safeColor}.svg`;
// Update all favicon links
@ -40,7 +40,7 @@ function updateFavicon(colorName) {
if (icon16) icon16.href = faviconPath;
// Update theme-color meta tag for iOS/Android status bar
const hexColor = semanticUIColorMap[safeColor];
const hexColor = navColorHexMap[safeColor];
const themeColorMeta = document.querySelector('meta[name="theme-color"]');
if (themeColorMeta) themeColorMeta.content = hexColor;
}
@ -88,8 +88,8 @@ function DropdownMenuItem({link}) {
// "More" overflow menu.
if (link.links) {
// Mantine's Menu does not nest submenus without extra plumbing; a labelled,
// indented group stands in for Semantic's nested Dropdown. No current data
// uses this path (no allLinks entry has its own `links`).
// indented group stands in for one. No current data uses this path (no
// allLinks entry has its own `links`).
return <React.Fragment>
<Menu.Label>{link.text}</Menu.Label>
{link.links.map(l => <DropdownMenuItem key={l.key} link={l}/>)}
@ -158,8 +158,8 @@ function MobileMenu({links}) {
/*
* One status indicator's slot in the right-hand corner.
*
* This used to carry `marginTop: 0.8em`, a nudge left over from Semantic's menu. The corner
* centres its children, and a top margin is part of the margin box being centred, so the
* This used to carry `marginTop: 0.8em`, a nudge inherited from the bar this replaced. The
* corner centres its children, and a top margin is part of the margin box being centred, so the
* nudge pushed every indicator down by half of it -- about 6px.
*
* That read as an error on some and not others, which is why it survived: the bare-icon

View file

@ -247,7 +247,7 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames, anyTag)
const noResults = [{title: 'No results'}];
const normalizeSuggestionsResults = (newSuggestions) => {
// Convert the suggestions from the Backend to what the Semantic <Search> expects.
// Convert the suggestions from the Backend to what SearchBox expects.
const lowerSearchStr = searchStr ? searchStr.toLowerCase() : '';
let results = {};
@ -516,8 +516,8 @@ export function SearchIconButton() {
/*
* A single button which opens the search modal via keyboard shortcuts context.
*
* `wrolpi-navbar-link`, not Semantic's leftover `item`, which carried no rules at all
* once Semantic was removed: no pointer cursor, no hover highlight, and a hit area of
* `wrolpi-navbar-link`, not the leftover `item` class, which carries no rules at all
* now that the stylesheet defining it is gone: no pointer cursor, no hover highlight, and a hit area of
* whatever the 18px glyph occupied rather than the height of the bar. It is the same
* kind of thing as Help and Admin and now has the same affordance.
*/

View file

@ -226,15 +226,12 @@ export function ThemeProvider({children, ...props}: ThemeProviderProps) {
</ThemeContext.Provider>
}
/*
* The Semantic UI wrappers that used to live below this line are gone.
* This module is the theme provider and nothing else: it resolves the chosen theme, stamps
* `data-theme` and `data-media-filter` on <html>, persists both, and hands Mantine our
* tokens.
*
* They existed so call sites could get a themed Button, Segment, Modal and so on while
* the app still rendered Semantic components; every one of those call sites now imports
* from `src/components/ui` instead. The dark-mode compatibility props they consumed --
* `i`, `s`, `t`, `inverted` -- went with them: those carried hardcoded greys, which is
* precisely what the token themes replaced.
*
* What remains is the part that was never about Semantic: the provider that resolves the
* chosen theme, stamps `data-theme` and `data-media-filter` on <html>, persists both, and
* hands Mantine our tokens.
* It used to re-export a set of themed component wrappers as well, along with the
* dark-mode compatibility props they consumed (`i`, `s`, `t`, `inverted`). Those carried
* hardcoded greys, which is precisely what the token themes replaced; components come from
* `src/components/ui` instead.
*/

View file

@ -41,7 +41,7 @@ import {
clearToasts,
toast,
} from './ui';
import {semanticColorNames} from '../themes/mantine';
import {paletteColorNames} from '../themes/mantine';
import {contrastingColor} from './Common';
import {navBarStyle, navColorNames, useNavColors} from '../themes/navColors';
import {IconMenu2} from '@tabler/icons-react';
@ -315,7 +315,7 @@ export function ThemeSamplePage() {
<IconButton icon='search' label='Search'/>
<IconButton icon='trash' role='danger' label='Delete'
onClick={() => setConfirmOpen(true)}/>
<Tooltip label='Tooltips replace Semantic popups'>
<Tooltip label='A tooltip, on hover or focus'>
<Button role='cancel'>Hover me</Button>
</Tooltip>
<Button role='cancel' onClick={() => toast({
@ -351,11 +351,10 @@ export function ThemeSamplePage() {
destructive or failed, and nothing else uses it.
</p>
<p style={{fontSize: '0.75rem', color: 'var(--muted)', marginBottom: 0}}>
Buttons in a row are spaced by the row, never by margins of their own. Semantic's
Button brought its own margin and nothing replaced it, so pages that listed
buttons as bare siblings had them sharing edges — and the ones that answered with
<code>margin-top</code> got a button sitting lower than its neighbours instead,
because <code>vertical-align: middle</code> is measured on the margin box.
Buttons in a row are spaced by the row, never by margins of their own. A button
that carries its own <code>margin-top</code> sits lower than its neighbours,
because <code>vertical-align: middle</code> is measured on the margin box —
which is why the spacing belongs to the row and not to the buttons in it.
</p>
<p style={{fontSize: '0.75rem', color: 'var(--muted)', marginBottom: 0}}>
An icon button is exactly as tall as a labelled one at every size, so a
@ -368,9 +367,8 @@ export function ThemeSamplePage() {
<Section label='Two choices of equal weight'>
<Panel>
{/* Semantic's `Segment placeholder` with a vertical Divider, which is what the
dashboard's Download/Upload panel is. The halves are a grid so they stay equal
whatever the labels say, and the rule falls at the panel's true middle. */}
{/* The dashboard's Download/Upload panel. The halves are a grid so they stay
equal whatever the labels say, and the rule falls at the panel's true middle. */}
<div className='wrolpi-or-split'>
<div><Button role='primary' icon='download'>Download</Button></div>
<div><Button role='save' icon='upload'>Upload</Button></div>
@ -389,7 +387,7 @@ export function ThemeSamplePage() {
<Panel>
{/*
* `toast` has thirteen call sites and no test, and it has already failed once
* app-wide: App.js dropped Semantic's toast container while seven pages were
* app-wide: App.js dropped the old toast container while seven pages were
* still importing the old helper, and every notification silently vanished.
* A toast is also the one component you cannot see by loading a page -- it has
* to be provoked -- which is why it needs buttons here rather than a sample.
@ -464,7 +462,7 @@ export function ThemeSamplePage() {
</Panel>
</Section>
<Section label='Semantic roles'>
<Section label='Roles'>
<Panel>
{/*
The roles side by side, which is the only way to see the thing that
@ -765,7 +763,7 @@ export function ThemeSamplePage() {
<Section label='Labels'>
<Panel>
<Row>
{semanticColorNames.map(color => <Label key={color} color={color}>{color}</Label>)}
{paletteColorNames.map(color => <Label key={color} color={color}>{color}</Label>)}
<Label color='black'>black</Label>
<Label color='white'>white</Label>
<Label color='blue' icon='tag'>tagged</Label>
@ -938,8 +936,8 @@ export function ThemeSamplePage() {
<Button role='cancel' icon='eye' onClick={() => setModalOpen(true)}>Open a modal</Button>
</Row>
<p style={{fontSize: '0.75rem', color: 'var(--muted)', marginBottom: 0, marginTop: 10}}>
Semantic's compound shape is kept — Modal.Header, Modal.Content,
Modal.Actions — so the 34 call sites written against it migrate by import.
A modal is compound — Modal.Header, Modal.Content, Modal.Actions — so the
markup at a call site reads the way the dialog is laid out.
</p>
<Modal open={modalOpen} onClose={() => setModalOpen(false)} size='small'>
<Modal.Header>Restore Backup: channels.yaml</Modal.Header>

View file

@ -77,7 +77,18 @@ export const allFrequencyOptions = {
[days180Option.value]: days180Option,
};
export const semanticUIColorMap = {
/*
* The named colors a user can pick for the navigation bar, and the fixed hex each one is.
*
* Fixed, and deliberately not tokens: these are the colors of the favicon files in
* `public/favicon-<color>.svg`, which `scripts/generate-favicons.js` writes from this very
* object, and of the `theme-color` meta tag the mobile browser paints its own chrome with.
* Neither can read a CSS variable, so both need a literal that cannot drift from the bar.
*
* The palette is a colorblind-friendly one and is shared with `themes/navColors.ts`, which
* measures a legible foreground against each.
*/
export const navColorHexMap = {
red: '#db2828',
orange: '#f2711c',
yellow: '#fbbd08',
@ -92,10 +103,6 @@ export const semanticUIColorMap = {
grey: '#767676',
}
export const ColorToSemanticHexColor = (color) => {
return semanticUIColorMap[color] || null;
}
export const validUrlRegex = /^(http|https):\/\/[^ "]+$/;
export const downloadOrderOptions = [

View file

@ -129,7 +129,7 @@ const NoComments = ({video}) => {
}
}
// Semantic's <Comment>/<CommentGroup> have no equivalent in the token library -- this is a nested
// The token library has no comment-thread component -- this is a nested
// comment thread, not a reusable widget, so it is built here from plain elements and tokens.
const VideoComment = ({comment, children}) => {
const {is_favorited, like_count, author, timestamp, text, author_is_uploader} = comment;

View file

@ -214,7 +214,7 @@ describe('ControllerPage', () => {
});
expect(screen.getByText('Hotspot Protocol')).toBeInTheDocument();
// The saved protocol is selected; WPA3 is offered because the device supports it.
// Semantic UI renders the selected value as both the dropdown text and an option.
// The select renders its chosen value as both the field's text and an option.
await waitFor(() => {
expect(screen.getAllByText('WPA2 (most compatible)').length).toBeGreaterThan(0);
expect(screen.getAllByText('WPA3').length).toBeGreaterThan(0);

View file

@ -56,7 +56,7 @@ describe('ExtensionPage', () => {
it('shows the not-yet-installed warning when no binaries are available', async () => {
// This test exists specifically to render the <Message warning> block,
// which catches missing imports from the Theme/Semantic-UI module.
// which catches missing imports from the component library.
setUserAgent(CHROME_UA);
global.fetch = mockFetch({
files: {

View file

@ -14,7 +14,7 @@ import {
} from "../Common";
import {useConfigs, useDockerized} from "../../hooks/customHooks";
import {ConfigsTable} from "./Configs";
import {semanticUIColorMap} from "../Vars";
import {navColorHexMap} from "../Vars";
import {Link} from "react-router";
import {
Button,
@ -506,7 +506,7 @@ export function SettingsPage() {
{value: tz, label: tz}
));
const navColorOptions = Object.keys(semanticUIColorMap).map(i => {
const navColorOptions = Object.keys(navColorHexMap).map(i => {
return {value: i, label: i.charAt(0).toUpperCase() + i.slice(1)}
});

View file

@ -46,12 +46,7 @@ export function CollectionEditForm({
</Message>}
<form onSubmit={handleSubmit} autoComplete="off">
{/*
Every caller now passes library components rather than Semantic Grid rows, so
this is a plain flex column instead of the `ui stackable grid` bridge it used
to be. That bridge was the last thing in the app depending on Semantic's
stylesheet.
*/}
{/* Every caller passes library components, so this is a plain flex column. */}
<div
className='wrolpi-form-rows'
style={form.loading ? {opacity: 0.6, pointerEvents: 'none'} : undefined}

View file

@ -46,7 +46,7 @@ function getCollectionSearchLink(collection, routes, primaryKey) {
}
/**
* Convert a Semantic-style relative column width (1-16) into a CSS percentage.
* Convert a relative column width (1-16, sixteenths) into a CSS percentage.
* @param {number} width - Relative width, 1-16
* @returns {Object|undefined} A style object, or undefined when no width is configured
*/

View file

@ -32,7 +32,7 @@ export function FieldCell({field, value, unitValue, onChange, onUnitChange, onEn
return;
}
// Our inputs forward their ref straight to the underlying <input> DOM node, so focus + select work
// directly on it (unlike Semantic's Input, which wrapped the node behind `.inputRef`).
// directly on it (the old Input wrapped the node behind `.inputRef`).
const node = localRef.current;
if (node && node.focus) {
node.focus();

View file

@ -128,7 +128,7 @@ export function InventoryTable({slug, fields, items, locations, catalog, search,
const visibleItems = useMemo(() => filterItems(displayItems, fields, search), [displayItems, fields, search]);
const focusFirst = () => {
// Our inputs forward their ref straight to the underlying <input> DOM node (unlike Semantic's Input,
// Our inputs forward their ref straight to the underlying <input> DOM node (unlike the old Input,
// which wrapped it behind `.inputRef`).
const node = firstInputRef.current;
if (node && node.focus) {

View file

@ -5,10 +5,9 @@ import {Icon} from './Icon';
/*
* Buttons.
*
* Roles carry meaning (Semantic UI heritage): blue = primary/download,
* green = save/confirm, red = destructive, amber = retry/warning, neutral
* outline = cancel. Prefer `role` over naming a color, so a theme that remaps
* a color keeps the meaning.
* Roles carry meaning: blue = primary/download, green = save/confirm,
* red = destructive, amber = retry/warning, neutral outline = cancel. Prefer
* `role` over naming a color, so a theme that remaps a color keeps the meaning.
*/
export type ButtonRole = 'primary' | 'save' | 'retry' | 'danger' | 'cancel';
@ -25,7 +24,7 @@ const roleProps: Record<ButtonRole, {color?: string; variant: string; className?
export interface ButtonProps extends Omit<MButtonProps, 'leftSection' | 'rightSection'> {
role?: ButtonRole;
/** Semantic icon name or a Tabler component, rendered before the label. */
/** An icon name (see Icon.tsx) or a Tabler component, rendered before the label. */
icon?: string | React.ComponentType<any>;
iconAfter?: string | React.ComponentType<any>;
onClick?: React.MouseEventHandler<HTMLButtonElement>;
@ -41,14 +40,15 @@ const renderIcon = (icon?: string | React.ComponentType<any>) => {
}
/*
* Semantic's size names, mapped onto Mantine's scale.
* WROLPi's size names, mapped onto Mantine's scale.
*
* Unmigrated call sites still pass `size='tiny'`, and Mantine silently ignores a
* size it does not know — the button renders at the default size and nobody sees
* a warning. Translating here keeps those call sites looking right until they
* migrate, and costs nothing once they have.
* Call sites across the app say `size='tiny'` or `size='huge'`, and Mantine silently
* ignores a size it does not know — the button renders at the default size, with no
* warning and nothing on screen to say a size was asked for at all. One table here
* is cheaper and safer than rewriting the size on several hundred call sites, and it
* keeps the vocabulary the rest of the app already reads in.
*/
const semanticSizes: Record<string, string> = {
const sizeAliases: Record<string, string> = {
mini: 'xs',
tiny: 'xs',
small: 'sm',
@ -60,9 +60,9 @@ const semanticSizes: Record<string, string> = {
};
// Generic so it passes each component's own size type straight through; only a
// string that Semantic knew about is rewritten.
// string in the table above is rewritten.
export const resolveSize = <T, >(size: T): T =>
typeof size === 'string' ? ((semanticSizes[size] ?? size) as T) : size;
typeof size === 'string' ? ((sizeAliases[size] ?? size) as T) : size;
export const Button = forwardRef<HTMLButtonElement, ButtonProps>((
{role, icon, iconAfter, className, children, ...props}, ref
@ -105,9 +105,8 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>((
ref={ref}
/*
* An `href` makes this an anchor. Mantine needs `component='a'` to render one, and
* without it the href is accepted and silently dropped — the control looks like a
* link and navigates nowhere. Semantic used `as='a'` for this, so every migrated
* call site that carried `href` alone was quietly broken.
* without it the href is accepted and silently dropped, so a call site carrying
* `href` alone renders a control that looks like a link and navigates nowhere.
*/
component={props.component ?? (props.href ? 'a' : undefined)}
// An explicit color/variant still wins, so a call site can deviate when it must.

View file

@ -15,8 +15,8 @@ import {Icon} from './Icon';
* Wide tables scroll in their own container so the page body never scrolls
* sideways.
*
* The compound names mirror Semantic's (Header/Body/Row/Cell/HeaderCell/Footer)
* so migrating a call site is a rename, not a rewrite.
* Compound: Table.Header / Body / Row / Cell / HeaderCell / Footer, so the markup at
* a call site reads the way the rendered table is structured.
*/
export interface TableProps extends MTableProps {

View file

@ -2,7 +2,7 @@ import React from 'react';
import {Loader as MLoader, Skeleton} from '@mantine/core';
import {Icon} from './Icon';
import {pxToRem} from './scale';
import {RoleName, SemanticColorName} from '../../themes/mantine';
import {RoleName, PaletteColorName} from '../../themes/mantine';
/*
* Feedback: messages, labels, progress, status text, loaders.
@ -33,7 +33,7 @@ export interface MessageProps {
kind?: MessageKind;
title?: React.ReactNode;
children?: React.ReactNode;
/** Semantic icon name or a Tabler component, shown to the left of the text. */
/** An icon name (see Icon.tsx) or a Tabler component, shown to the left of the text. */
icon?: string | React.ComponentType<any>;
/** Renders a dismiss button. Omit for messages the user cannot clear. */
onDismiss?: () => void;
@ -69,7 +69,7 @@ export function Message({kind = 'info', title, children, icon, onDismiss, classN
// -------------------------------------------------------------------- Labels
export interface LabelProps {
color?: SemanticColorName | RoleName | 'black' | 'white';
color?: PaletteColorName | RoleName | 'black' | 'white';
icon?: string | React.ComponentType<any>;
/**
* Draw it as a physical tag — pointed left edge and an eyelet — rather than a plain
@ -108,7 +108,7 @@ export interface ProgressProps {
indeterminate?: boolean;
/** Show the percentage inside the bar. */
showPercent?: boolean;
color?: SemanticColorName | RoleName;
color?: PaletteColorName | RoleName;
/** Replaces the percentage with arbitrary text (e.g. "2.1 GB / 5.3 GB"). */
label?: React.ReactNode;
className?: string;
@ -208,8 +208,8 @@ export interface LoadingProps {
/**
* A centered loader with a caption, for a region that has nothing to show yet.
* Replaces Semantic's `<Loader active inline='centered'>`, which 19 call sites
* used with their own wrapper div.
* A centred spinner with optional text under it. The wrapper is the component's,
* so the 19 call sites that show one do not each roll their own.
*/
export function Loading({children, size = 'sm', padding = '2em'}: LoadingProps) {
// `padding` is the caller's, so it stays inline; the rest is in ui.css so it scales.
@ -219,7 +219,7 @@ export function Loading({children, size = 'sm', padding = '2em'}: LoadingProps)
</div>
}
/** Placeholder for content that has not arrived. Replaces Semantic's Placeholder. */
/** Placeholder for content that has not arrived: a few skeleton lines. */
export function Placeholder({lines = 3, height = 12}: {lines?: number; height?: number}) {
return <div className='wrolpi-placeholder'>
{Array.from({length: lines}, (_, index) => <Skeleton

View file

@ -4,8 +4,9 @@ import * as Tabler from '@tabler/icons-react';
/*
* Icons.
*
* Semantic UI shipped an icon font; we use Tabler's bundled SVG components, which
* are tree-shaken at build time and need nothing from the network.
* Tabler's bundled SVG components, which are tree-shaken at build time and need
* nothing from the network -- an icon font would have to be fetched, and WROLPi
* has to draw its interface with no connection at all.
*
* Icons never name a color. They stroke with `currentColor`, inheriting from the
* button or text that wraps them, so status color and every theme come for free.
@ -17,13 +18,14 @@ export type IconSize = 'small' | 'medium' | 'large';
const sizes: Record<IconSize, number> = {small: 16, medium: 20, large: 24};
/**
* Semantic icon name -> Tabler component name.
* WROLPi's icon names -> Tabler component names.
*
* Covers every name the app renders today so call sites can migrate without also
* choosing new icons. New code should import the Tabler component directly and
* pass it as `component`; this map exists for the migration, not forever.
* The app names an icon by what it is for -- `icon='book'`, `icon='arrow left'` --
* rather than by which component draws it, so hundreds of call sites are not coupled
* to the icon set. Swapping Tabler for something else is then this table and nothing
* else. New code may pass a Tabler component directly as `component` instead.
*/
const semanticNames: Record<string, keyof typeof Tabler> = {
const iconNameAliases: Record<string, keyof typeof Tabler> = {
'add': 'IconPlus',
'apple': 'IconBrandApple',
'archive': 'IconArchive',
@ -178,7 +180,7 @@ export interface IconStackProps {
/**
* Two icons composed into one symbol — a wifi glyph with a question mark on it,
* say. Replaces Semantic's IconGroup.
* say.
*
* The corner glyph gets a background matching the surface so it stays legible
* over the icon beneath it; see `--icon-stack-bg` in ui.css.
@ -196,7 +198,7 @@ export function IconStack({children, corner, label, style, className}: IconStack
}
export interface IconProps extends Omit<React.SVGProps<SVGSVGElement>, 'name' | 'ref'> {
/** A Semantic UI icon name, for migrated call sites. */
/** One of the icon names in `iconNameAliases`. */
name?: string;
/** A Tabler component, for new code. */
component?: React.ComponentType<any>;
@ -207,9 +209,9 @@ export interface IconProps extends Omit<React.SVGProps<SVGSVGElement>, 'name' |
label?: string;
}
/** Resolve a Semantic icon name to its Tabler component, or undefined if unmapped. */
/** Resolve an icon name to its Tabler component, or undefined if unmapped. */
export const resolveIconName = (name: string): React.ComponentType<any> | undefined => {
const taberName = semanticNames[name.trim().toLowerCase()];
const taberName = iconNameAliases[name.trim().toLowerCase()];
return taberName ? (Tabler[taberName] as React.ComponentType<any>) : undefined;
}
@ -219,7 +221,7 @@ export function Icon({name, component, size = 'small', loading, label, ...props}
Component = resolveIconName(name);
if (!Component) {
// Loud on purpose: a silently missing icon leaves a hole in the interface.
console.error(`No icon for Semantic name "${name}"; pass a Tabler component instead.`);
console.error(`No icon named "${name}"; add it to iconNameAliases, or pass a Tabler component.`);
Component = Tabler.IconHelpCircle;
}
}

View file

@ -49,7 +49,7 @@ export function Checkbox({style, ...props}: CheckboxProps) {
export type ToggleProps = React.ComponentProps<typeof MSwitch>;
/** An on/off switch. Replaces Semantic's `Radio toggle`. */
/** An on/off switch. */
export function Toggle({style, className, ...props}: ToggleProps) {
return <MSwitch
className={['wrolpi-switch', className].filter(Boolean).join(' ')}
@ -146,8 +146,8 @@ export interface ActionInputProps extends React.ComponentProps<typeof MTextInput
}
/**
* A text input with a button joined to its right edge. Replaces Semantic's
* `<Input action={...}/>`.
* A text input with a button joined to its right edge -- a search field and its
* clear control, a path field and its browse control.
*
* The two share one outline rather than sitting side by side, so the pair reads
* as a single control — the input's own right border is dropped and the button

View file

@ -25,10 +25,8 @@ export interface PaginationProps {
}
/**
* Page controls. Replaces Semantic's Pagination, keeping its prop names
* (`activePage`, `totalPages`, `onPageChange`) so call sites migrate as a
* rename — but `onPageChange` receives the page number directly rather than
* Semantic's `(event, data)` pair.
* Page controls: `activePage`, `totalPages`, `onPageChange`. `onPageChange` receives
* the page number directly.
*/
export function Pagination({
activePage,

View file

@ -9,10 +9,9 @@ import {Button} from './Button';
/*
* Modals.
*
* Semantic's compound shape (`Modal.Header` / `Modal.Content` / `Modal.Actions`)
* is kept because 34 call sites are written against it. The subcomponents are
* markers: Modal reads them out of its children and places each in the right
* slot, so the children stay in source order at the call site.
* Compound: `Modal.Header` / `Modal.Content` / `Modal.Actions`. The subcomponents are
* markers -- Modal reads them out of its children and places each in the right slot, so
* the children stay in source order at the call site.
*/
const ModalHeader = ({children}: {children?: React.ReactNode}) => <>{children}</>;
@ -24,7 +23,7 @@ ModalContent.displayName = 'Modal.Content';
const ModalActions = ({children}: {children?: React.ReactNode}) => <>{children}</>;
ModalActions.displayName = 'Modal.Actions';
// Semantic's size names, mapped onto Mantine's scale.
// WROLPi's size names, mapped onto Mantine's scale. See `sizeAliases` in Button.tsx.
const modalSizes: Record<string, string> = {
mini: 'xs',
tiny: 'sm',
@ -34,12 +33,12 @@ const modalSizes: Record<string, string> = {
};
export interface ModalProps extends Omit<React.ComponentProps<typeof MModal>, 'opened' | 'size'> {
/** Semantic's name for `opened`. Either works. */
/** An alias for `opened`. Either works. */
open?: boolean;
opened?: boolean;
/** A title given directly, instead of a `Modal.Header` child. */
title?: React.ReactNode;
/** Semantic size name (mini/tiny/small/large/fullscreen) or a Mantine size. */
/** A size name (mini/tiny/small/large/fullscreen) or a Mantine size. */
size?: string | number;
/** Accepted and ignored: the close button is always shown. */
closeIcon?: boolean;
@ -52,8 +51,7 @@ export interface ModalProps extends Omit<React.ComponentProps<typeof MModal>, 'o
* modal is open -- there is no check for whether it is the one the user is looking at. Two
* modals open meant two listeners, so a single Escape closed BOTH: opening the search modal
* over the dashboard's download modal and pressing Escape once left you on the dashboard.
* Semantic handled this; the migration lost it.
*
* Mantine's own answer is `Modal.Stack` with a `stackId` per modal, which is the only thing
* that gates `closeOnEscape`. It is not used here for two reasons: it requires every call
* site to be rewritten to hoist its modal into a stack, and it sets `__hidden` on everything
@ -246,7 +244,7 @@ export function Confirm({
export type TooltipProps = React.ComponentProps<typeof MTooltip>;
/** Replaces Semantic's Popup. */
/** A hover/focus tooltip. */
export function Tooltip(props: TooltipProps) {
return <MTooltip withArrow={false} openDelay={200} {...props}/>
}

View file

@ -6,9 +6,9 @@ import {Loader} from './Feedback';
/*
* The search box, with optional grouped suggestions.
*
* Replaces Semantic's `<Search category>`, and deliberately keeps its `results`
* shape — `{groupKey: {name, results: [{title, description}]}}` — because four
* call sites already build that structure from the API.
* Grouped search suggestions. `results` is
* `{groupKey: {name, results: [{title, description}]}}`, which is the shape four call
* sites already build from the API.
*
* Suggestions are a combobox: the input keeps focus and owns the keyboard, while
* `aria-activedescendant` points at the highlighted option. Arrow keys move,
@ -64,6 +64,16 @@ export interface SearchBoxProps {
className?: string;
autoFocus?: boolean;
name?: string;
/**
* Set on the input, not the wrapper, so a caller's own `<label htmlFor>` reaches it.
*
* SearchBox takes named props rather than spreading a rest object, so an `id` handed
* to it used to be dropped in silence. `DestinationForm` passes one and renders a
* label pointing at it: the download forms' Destination field has therefore had a
* label associated with nothing at all, which a pointer user never notices and a
* screen reader user gets nothing from.
*/
id?: string;
}
/** Flatten the groups into the order they are displayed, for keyboard movement. */
@ -90,6 +100,7 @@ export function SearchBox({
className,
autoFocus,
name,
id,
}: SearchBoxProps) {
const [open, setOpen] = useState(false);
const [highlighted, setHighlighted] = useState(-1);
@ -179,6 +190,7 @@ export function SearchBox({
<input
ref={inputRef}
type='text'
id={id}
name={name}
className='wrolpi-searchbox-input'
placeholder={placeholder}

View file

@ -16,7 +16,7 @@ export type HeaderLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
export interface HeaderProps extends Omit<React.HTMLAttributes<HTMLHeadingElement>, 'color'> {
/** Heading level. Also the visual size — pick it for the outline, not the look. */
as?: HeaderLevel;
/** Semantic icon name or a Tabler component, shown before the text. */
/** An icon name (see Icon.tsx) or a Tabler component, shown before the text. */
icon?: string | React.ComponentType<any>;
/** Secondary line below, in muted text. */
subheader?: React.ReactNode;
@ -42,8 +42,8 @@ export interface HeaderProps extends Omit<React.HTMLAttributes<HTMLHeadingElemen
}
/**
* A section heading. Named and shaped like Semantic's Header (`as`, `icon`,
* `subheader`, `dividing`) so the app's 47 call sites migrate by import.
* A section heading: `as` picks the level, with optional `icon`, `subheader` and a
* `dividing` rule underneath.
*
* Sizes come from ui.css, keyed on the level, rather than each call site
* choosing — that is what keeps the type scale a scale.
@ -96,7 +96,7 @@ export interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {
danger?: boolean;
}
/** A bordered surface. Replaces Semantic's Segment. */
/** A bordered surface: the panel most of the app's content sits on. */
export function Panel({danger, className, children, ...props}: PanelProps) {
return <div
className={['wrolpi-panel', danger ? 'wrolpi-panel-danger' : '', className]

View file

@ -1,7 +1,7 @@
/*
* The WROLPi component library: token-driven components built on Mantine.
*
* Import from here, not from `@mantine/core` or `semantic-ui-react`:
* Import from here, not from `@mantine/core` directly:
* import {Button, Table, Message} from '../components/ui';
*
* Everything resolves its colors through theme tokens, so no component branches

View file

@ -11,7 +11,7 @@ import {clearToasts, toast} from './toast';
* Tests for toasts.
*
* `toast` has thirteen call sites and had no test at all, having already failed once in the
* way that is hardest to notice: App.js dropped Semantic's toast container while seven pages
* way that is hardest to notice: App.js dropped the old toast container while seven pages
* were still importing the old helper, so every notification in the app silently went
* nowhere. Nothing threw, and nothing looked wrong until somebody expected a message.
*
@ -175,7 +175,7 @@ describe('toast', () => {
describe('a toast that can be clicked', () => {
/*
* Semantic's toast took an `onClick` in its options and made the whole toast activate it.
* The old toast took an `onClick` in its options and made the whole toast activate it.
* `Events.js` still passes one -- it did before the migration and was never changed -- for
* three events that each open a URL: a shared page pushed from the browser extension, a
* finished archive upload, and a generated screenshot. The migrated helper destructured
@ -314,7 +314,7 @@ describe('how long a toast stays up', () => {
it('stays until dismissed when the caller asks for time 0', async () => {
/*
* Semantic treated `time: 0` as "stay up". Mantine wants `autoClose: false`: its
* Callers spell "stay up" as `time: 0`. Mantine wants `autoClose: false`: its
* `getAutoClose` returns any number as given, and the container then calls
* `setTimeout(hide, 0)` -- so passing the 0 straight through dismisses the toast on the
* next tick. Call sites use 0 for errors the user must actually see, so getting this

View file

@ -5,9 +5,8 @@ import {RoleName} from '../../themes/mantine';
/*
* Toasts.
*
* Keeps the react-semantic-toasts-2 call signature so the ~19 call sites migrate
* by changing their import, not their code. The container is mounted by
* ThemeProvider.
* One call signature for the ~19 places that raise a toast. The container is mounted
* by ThemeProvider, so a caller only says what happened.
*/
/* `error` is the original spelling and stays; `danger` is the token's name for it. */
@ -20,9 +19,9 @@ export interface ToastOptions {
/** Milliseconds before auto-dismiss. 0 keeps it until dismissed. */
time?: number;
/**
* Makes the whole toast activate this — Semantic's behaviour, which `Events.js` still
* relies on for the three events that carry a URL: a page shared from the browser
* extension, a finished archive upload, and a generated screenshot.
* Makes the whole toast activate this. `Events.js` relies on it for the three events
* that carry a URL: a page shared from the browser extension, a finished archive
* upload, and a generated screenshot.
*/
onClick?: () => void;
}
@ -74,7 +73,7 @@ export function toast({type = 'info', title, description, time = 5000, onClick}:
title,
message: description,
color: toastRoles[type],
// Semantic treated 0 as "stay up"; Mantine wants false for that. Its `getAutoClose`
// Callers spell "stay up" as `time: 0`; Mantine wants `false`. Its `getAutoClose`
// returns any number as given and the container then calls `setTimeout(hide, 0)`, so
// passing the 0 through dismisses the toast on the next tick.
autoClose: time === 0 ? false : time,

View file

@ -365,9 +365,8 @@ html[data-theme="amber"] .wrolpi-searchbox-control:focus-within {
*
* The control is a bordered box with `padding: 0 8px`, so the button sat 9px short of the
* right edge and 2px short of the full height -- reading as a glyph dropped inside the input
* rather than as a control of its own. Semantic rendered this as an action button welded to
* the field: measured on the QA Pi, zero gap to the input, zero to the outer edge, and the
* full 44px height.
* rather than as a control of its own. It should read as an action button welded to the
* field: zero gap to the input, zero to the outer edge, and the field's full height.
*
* A negative right margin rather than removing the control's padding: the padding is what
* holds the search icon and the text off the border, and only this one child should escape
@ -503,7 +502,7 @@ html .wrolpi-searchbox-clear {
margin-top: 1.125rem;
}
/* A stack of form rows, replacing Semantic's `ui stackable grid` in edit forms. */
/* A stack of form rows: the layout of every edit form. */
.wrolpi-form-rows {
display: flex;
flex-direction: column;
@ -525,9 +524,9 @@ html .wrolpi-searchbox-clear {
}
/*
* `hooks/useForm.js` renders its own <label> and native <input> — it always did, with
* Semantic's Form.Input only wrapping them for field styling. These rules supply that
* styling from tokens instead, so a native input matches the library's own controls.
* `hooks/useForm.js` renders its own <label> and native <input> rather than a library
* control. These rules dress a native input from the tokens, so one of those fields
* matches the library's own controls beside it.
*/
.wrolpi-form-field input {
@ -725,11 +724,10 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
* checked track keeps coming from the `color` prop.
*/
/*
* Semantic's inverted stylesheet colors *every* descendant of `.ui.inverted.segment`
* (rgba(255,255,255,.9), and #dddddd on labels). Our components are mounted inside
* unmigrated pages that still use those wrappers, so an inherited color puts white
* pixels on screen in night mode. Restating from tokens is the fix; the rule can go
* when the last Semantic wrapper does.
* A switch's label and description are body text, stated from the tokens rather than
* inherited. Mantine draws the description from its own gray palette, which is a
* non-red pixel in night mode; and an inherited color is only ever as good as whatever
* the switch happens to be mounted inside.
*/
.wrolpi-switch .mantine-Switch-label {
color: var(--text);
@ -760,9 +758,9 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
/* ----------------------------------------------------------------- Labels */
/*
* Sized to Semantic's label (12px text, ~7px of vertical padding), which these replaced.
* The first pass came out at 11.5px with 3px of padding and read as noticeably smaller than
* what users had before -- a tag is a hit target as well as a word.
* 12px text with ~7px of vertical padding. The first pass came out at 11.5px with 3px of
* padding and read as noticeably smaller than what users had before -- a tag is a hit
* target as well as a word, and a phone is where it is hardest to hit.
*/
.wrolpi-label {
display: inline-flex;
@ -818,8 +816,8 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
/*
* The point is centred on the left edge, so its inner half covers the body's first 10.5px
* -- and a positioned pseudo-element paints above the parent's text, not behind it, so
* without this the first letter is hidden under the point. Semantic's tag label carried
* the same asymmetry (`padding-left: 1.5em`) for the same reason.
* without this the first letter is hidden under the point. The asymmetry is the point's
* width, not a nudge.
*/
padding-left: 0.8125rem;
}
@ -970,10 +968,10 @@ html[data-theme="night"] .wrolpi-tag::before {
gap: 0.5rem;
margin: 0;
/*
* Stated explicitly because semantic.min.css sets `h1,h2,h3,h4,h5 { font-family:
* Lato }` and loads after Mantine's element rule, so headings would ignore the
* theme's body face — visible in amber, where the body is mono and headings were
* not. A class outranks the element selector. Can go once Semantic is gone.
* The face is stated here rather than left to inheritance or to Mantine's heading
* config, so a heading cannot quietly diverge from the theme's body face. Amber is
* where that shows: its body is mono, and a heading that misses the token renders in
* a proportional face beside it.
*/
font-family: var(--font-body);
font-weight: 600;
@ -1203,9 +1201,8 @@ html .mantine-Notification-closeButton:hover {
}
/*
* Indeterminate: a sliding band, for work whose size is not known yet. Semantic called
* this `indicating`; without it an upload that has not reported its size sits at 0% and
* reads as stalled.
* Indeterminate: a sliding band, for work whose size is not known yet. Without it an
* upload that has not reported its size sits at 0% and reads as stalled.
*/
.wrolpi-progress-indeterminate .wrolpi-progress-fill {
width: 35%;
@ -1327,10 +1324,10 @@ html[data-theme="amber"] .wrolpi-progress-fill {
/*
* The same idea along the other axis: a row of buttons, spaced by the row.
*
* Semantic's Button carried `margin: 0 .25em .25em 0`, so a page could list buttons as bare
* Buttons used to carry `margin: 0 .25em .25em 0` of their own, so a page could list them as bare
* siblings and they arrived both spaced and, when the row ran out of width, separated from the line
* below. Nothing replaced that margin -- the archive page's six actions shared edges, and the
* downloads table's two icon buttons did too.
* below. Once that margin went nothing replaced it -- the archive page's six actions shared edges,
* and the downloads table's two icon buttons did too.
*
* Two of the archive page's six had `marginTop: 0.5em` instead, which is where the "Update sits
* lower than the rest" came from: a Button is `display: inline-flex; vertical-align: middle`, and
@ -1380,10 +1377,9 @@ html[data-theme="amber"] .wrolpi-progress-fill {
/* ------------------------------------------------------------- Or divider */
/*
* Two choices of equal weight, split down the middle -- Semantic's `Segment placeholder` with a
* vertical `Divider`, which the dashboard's Download/Upload panel was built as.
* Two choices of equal weight, split down the middle: the dashboard's Download/Upload panel.
*
* The migrated version was a `Group` with a divider between two buttons, so the halves were sized
* An earlier version was a flex row with a divider between two buttons, so the halves were sized
* to their buttons rather than to the panel: the pair huddled in the centre with the rule wherever
* they left it, instead of two equal fields with the rule at the true middle.
*
@ -1501,8 +1497,8 @@ html[data-theme="amber"] .wrolpi-progress-fill {
*/
:root {
--card-poster-max-height: 12.5rem;
/* How far a disabled control fades. Semantic used 0.45 and it reads correctly against
every theme's panel; the tests read this rather than repeating the number. */
/* How far a disabled control fades. 0.45 reads correctly against every theme's panel;
the tests read this rather than repeating the number. */
--disabled-opacity: 0.45;
}
@ -1641,9 +1637,8 @@ html[data-theme="amber"] .wrolpi-card-tag {
/*
* A statistic carries its own spacing rather than relying on a parent to supply
* it, so that one dropped on a page by itself still sits clear of its
* neighbours. Semantic's `Statistic.Group` only spaced elements carrying
* Semantic's own classes, so without this the labels ran together into one
* unreadable line.
* neighbours. Without it the labels run together into one unreadable line
* wherever a statistic is used outside a group.
*/
.wrolpi-statistic {
@ -1846,9 +1841,9 @@ html[data-theme="amber"] .wrolpi-th-sort:focus-visible {
* A disabled button keeps its own color.
*
* Mantine repaints one flat grey -- background, text and border all replaced with
* `--mantine-color-disabled`. Semantic kept the color and dropped the whole control to
* `opacity: 0.45`, and that is the better signal: it says "not available" without also
* saying "no longer the delete button".
* `--mantine-color-disabled`. Keeping the color and dropping the whole control to
* `opacity: 0.45` is the better signal: it says "not available" without also saying
* "no longer the delete button".
*
* The file browser is where the difference shows. Its footer is eight buttons, six of them
* disabled until something is selected, so the toolbar a user meets on arriving at /files was

View file

@ -6,7 +6,7 @@ import userEvent from '@testing-library/user-event';
import {MantineProvider} from '@mantine/core';
import {IconMoodSmile} from '@tabler/icons-react';
import {ThemeContext} from '../../contexts/contexts';
import {cssVariablesResolver, mantineTheme, semanticColorNames} from '../../themes/mantine';
import {cssVariablesResolver, mantineTheme, paletteColorNames} from '../../themes/mantine';
import {themeChoices} from '../../themes/names';
import {
ActionInput,
@ -49,7 +49,7 @@ const renderUI = (ui) => render(
);
describe('Icon', () => {
it('renders a Semantic name as an SVG', () => {
it('renders a named icon as an SVG', () => {
const {container} = renderUI(<Icon name='trash'/>);
expect(container.querySelector('svg')).toBeInTheDocument();
@ -61,7 +61,7 @@ describe('Icon', () => {
expect(container.querySelector('svg')).toBeInTheDocument();
});
it('maps every Semantic icon name the app uses', () => {
it('maps every icon name the app uses', () => {
// A name that falls through renders a fallback glyph, leaving a hole in the UI.
const names = ['trash', 'warning sign', 'download', 'refresh', 'plus', 'edit', 'wifi',
'search', 'lock', 'check', 'upload', 'play', 'folder', 'filter', 'file text',
@ -212,7 +212,7 @@ describe('Button', () => {
expect(screen.getByRole('button', {name: 'Save'})).toBeInTheDocument();
});
it('translates Semantic size names, which Mantine would otherwise ignore', () => {
it('translates our size names, which Mantine would otherwise ignore', () => {
// Unmigrated call sites still pass size='tiny'. Mantine drops a size it does not
// recognise without warning, so the button quietly renders at the default size.
renderUI(<><Button size='tiny'>Old</Button><Button size='sm'>New</Button></>);
@ -225,7 +225,7 @@ describe('Button', () => {
it('renders an anchor when given an href, without being told twice', () => {
/*
* Mantine drops `href` unless it also gets `component='a'`, so a button carrying
* only an href looked like a link and navigated nowhere. Semantic spelled this
* only an href looked like a link and navigated nowhere. The old library spelled this
* `as='a'`, so every migrated call site that kept just the href was silently
* broken — a download button that downloads nothing.
*/
@ -242,7 +242,7 @@ describe('Button', () => {
it('forwards a ref to the underlying DOM element', () => {
/*
* Ported from the old Theme.test.js, which caught a real crash: Semantic's Button
* Ported from the old Theme.test.js, which caught a real crash: the old Button
* was a class component, so a forwarded ref resolved to the class instance, and
* anything that called `node.contains(...)` on the trigger -- a Modal or Popup
* portal checking whether a click landed inside -- threw "contains is not a
@ -621,7 +621,7 @@ describe('Progress', () => {
it('keeps its percent text readable on every bar color', () => {
/*
* Ported from Theme.test.js, which asserted Semantic's `inverted-progress-text`
* Ported from Theme.test.js, which asserted the old `inverted-progress-text`
* class across all fourteen colors and both modes. That class is gone; the
* mechanism now is that the text always takes `--text` while light mode lightens
* the fill beneath it, because the text sits across both the filled and unfilled
@ -649,7 +649,7 @@ describe('Progress', () => {
});
it('reports no value when the size is unknown', () => {
// Semantic called this `indicating`. An upload that has not reported its size
// An upload that has not reported its size
// would otherwise sit at 0% and read as stalled, and `aria-valuenow=0` would tell
// a screen reader the same wrong thing.
renderUI(<Progress indeterminate label='Uploading…'/>);
@ -676,12 +676,12 @@ describe('Status', () => {
});
describe('Label', () => {
it('supports every Semantic color', () => {
it('supports every palette color', () => {
const {container} = renderUI(<>
{semanticColorNames.map(color => <Label key={color} color={color}>{color}</Label>)}
{paletteColorNames.map(color => <Label key={color} color={color}>{color}</Label>)}
</>);
expect(container.querySelectorAll('.wrolpi-label')).toHaveLength(semanticColorNames.length);
expect(container.querySelectorAll('.wrolpi-label')).toHaveLength(paletteColorNames.length);
});
});
@ -802,7 +802,7 @@ describe('nothing paints a label\'s text with an inline color', () => {
});
describe('Table', () => {
it('renders a Semantic-shaped compound table', () => {
it('renders a compound table', () => {
renderUI(<Table>
<Table.Header>
<Table.Row><Table.HeaderCell>URL</Table.HeaderCell></Table.Row>
@ -882,7 +882,7 @@ describe('Table', () => {
describe('Card', () => {
it('draws a mimetype accent from a token, not a hex', () => {
// File cards carry the mimetype's color on their top edge so a grid of results is
// scannable by kind. Semantic did this with `<Card color='violet'>`; two migrated
// scannable by kind. The old card did this with `<Card color='violet'>`; two migrated
// files had dropped the accent because our Card had no equivalent.
const {container} = renderUI(<Card title='Water Storage.pdf' color='red'/>);
@ -1520,7 +1520,7 @@ describe('modal sizes', () => {
/*
* The size table is the single thing that halved every modal in the migration.
*
* Semantic's names were measured on the pre-migration build: mini 360, tiny 540, small
* The names were measured on the build users had before: mini 360, tiny 540, small
* 720, large 1080, fullscreen 95%. They are mapped onto Mantine's much smaller scale, so
* a modal that said `small` went from 720px to 440px and one that said nothing at all
* went from 900px to 440px. That is deliberate now -- the sizes were audited call site
@ -1543,7 +1543,7 @@ describe('modal sizes', () => {
});
});
it('maps every Semantic name onto that scale', () => {
it('maps every size name onto that scale', () => {
// The mapping the call sites are written against. `fullscreen` is the one that did
// not shrink, and the one several audited modals were moved TO.
const source = fs.readFileSync(path.join(__dirname, 'Overlays.tsx'), 'utf8');
@ -1595,7 +1595,7 @@ describe('modal sizes', () => {
/*
* Two different hazards, and neither announces itself.
*
* A misspelled SEMANTIC name is not in the table, so it passes through untranslated,
* A misspelled name is not in the table, so it passes through untranslated,
* Mantine does not recognise it either, and the modal silently renders at the default
* 440px. A raw MANTINE name -- `sm`, `md` -- is recognised and honoured: it works,
* so nothing ever complains, and the call site quietly sits outside the vocabulary