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

@ -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