diff --git a/app/src/App.css b/app/src/App.css
index a93f819f..bf7afe06 100644
--- a/app/src/App.css
+++ b/app/src/App.css
@@ -36,7 +36,7 @@
* switch to `bottom-right` should not silently inherit a top offset.
*/
html .mantine-Notifications-root[data-position^='top'] {
- top: calc(var(--navbar-height) + var(--mantine-spacing-md, 16px));
+ top: calc(var(--navbar-height) + var(--mantine-spacing-md, 1rem));
}
.wrolpi-navbar-right {
@@ -159,7 +159,7 @@ html .wrolpi-navbar .mantine-ActionIcon-root:hover {
}
.channel-edit {
- border-radius: 3px;
+ border-radius: 0.1875rem;
padding: 0.75em;
}
@@ -186,12 +186,12 @@ pre.wrap-text {
.duration-overlay {
position: absolute;
- top: 4px;
- right: 4px;
+ top: 0.25rem;
+ right: 0.25rem;
color: black;
background: #ffffff;
- padding: 0px 4px;
- border-radius: 3px;
+ padding: 0px 0.25rem;
+ border-radius: 0.1875rem;
}
.no-link-underscore {
@@ -219,8 +219,8 @@ div.inverted {
.toggle {
position: relative;
display: inline-block;
- width: 49px;
- height: 23px;
+ width: 3.0625rem;
+ height: 1.4375rem;
}
.toggle input {
@@ -239,14 +239,14 @@ div.inverted {
background-color: rgb(166, 166, 166);
-webkit-transition: .4s;
transition: .4s;
- border-radius: 34px;
+ border-radius: 2.125rem;
}
.slider:before {
position: absolute;
content: "";
- height: 22px;
- width: 22px;
+ height: 1.375rem;
+ width: 1.375rem;
left: 0;
bottom: 0;
background-color: white;
@@ -316,9 +316,9 @@ input:checked + .slider:before {
Use 100dvh so mobile browser chrome (URL bar) is accounted for. */
.preview-fit {
width: 100%;
- height: calc(100dvh - 300px);
- max-height: calc(100dvh - 300px);
- min-height: 240px;
+ height: calc(100dvh - 18.75rem);
+ max-height: calc(100dvh - 18.75rem);
+ min-height: 15rem;
overflow: hidden;
position: relative;
display: flex;
@@ -356,12 +356,12 @@ td.file-path > svg {
.ui-alerts {
position: fixed;
z-index: 2060;
- padding: 24px;
+ padding: 1.5rem;
}
.ui-alerts.top-right {
- top: 20px;
- right: 20px;
+ top: 1.25rem;
+ right: 1.25rem;
}
textarea.otp {
@@ -370,9 +370,9 @@ textarea.otp {
}
.card-icon {
- min-height: 163px;
+ min-height: 10.1875rem;
text-align: center;
- padding-top: 53px;
+ padding-top: 3.3125rem;
}
.card-icon.inverted {
@@ -426,11 +426,6 @@ textarea.otp {
box-shadow: none !important;
}
-/* Mobile-responsive Confirm modal */
-.ui.modal.themed-confirm {
- max-width: 95vw;
-}
-
.clickable {
cursor: pointer;
}
@@ -469,7 +464,7 @@ textarea.otp {
}
.search-clear {
- margin: 10px;
+ margin: 0.625rem;
}
.icon.divider {
@@ -524,40 +519,40 @@ table.ratio-table td.min-width {
}
.form-skeleton-label {
- height: 14px;
- width: 80px;
- margin-bottom: 8px;
+ height: 0.875rem;
+ width: 5rem;
+ margin-bottom: 0.5rem;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
- border-radius: 3px;
+ border-radius: 0.1875rem;
}
.form-skeleton-input {
- height: 38px;
+ height: 2.375rem;
width: 100%;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
- border-radius: 4px;
+ border-radius: 0.25rem;
}
.form-skeleton-textarea {
- height: 80px;
+ height: 5rem;
width: 100%;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
- border-radius: 4px;
+ border-radius: 0.25rem;
}
.form-skeleton-button {
- height: 42px;
- width: 100px;
+ height: 2.625rem;
+ width: 6.25rem;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
- border-radius: 4px;
+ border-radius: 0.25rem;
}
@keyframes skeleton-shimmer {
@@ -741,7 +736,7 @@ tr.drag-deselecting td {
.inventory-print th,
.inventory-print td {
border: 1px solid #999;
- padding: 4px 6px;
+ padding: 0.25rem 0.375rem;
text-align: left;
vertical-align: top;
}
diff --git a/app/src/components/Files.js b/app/src/components/Files.js
index 55338212..f5b455ea 100644
--- a/app/src/components/Files.js
+++ b/app/src/components/Files.js
@@ -987,8 +987,8 @@ function RefreshStepItem({phase, isActive, isCompleted, isDisabled, description}
-
{phase.title}
-
{isActive || isCompleted ? description : ''}
+
{phase.title}
+
{isActive || isCompleted ? description : ''}
}
diff --git a/app/src/components/Flasher.js b/app/src/components/Flasher.js
index a70d599e..9e6f1111 100644
--- a/app/src/components/Flasher.js
+++ b/app/src/components/Flasher.js
@@ -835,7 +835,7 @@ export function FlasherPage() {
{configuration.name}
-
+
{(configuration.files || []).length} file(s)
{configuration.erase_all ? ' — erases flash' : ''}
@@ -968,7 +968,7 @@ export function FlasherPage() {
-
Baud rate
+
Baud rate
({value: String(o.value), label: o.text}))}
value={String(baudrate)}
diff --git a/app/src/components/Map.js b/app/src/components/Map.js
index 815a2077..d3487bf7 100644
--- a/app/src/components/Map.js
+++ b/app/src/components/Map.js
@@ -577,7 +577,7 @@ function MapPins() {
{e.preventDefault(); handleNavigate(pin);}}>
{pin.label}
- {pin.lat.toFixed(4)}, {pin.lon.toFixed(4)}
+ {pin.lat.toFixed(4)}, {pin.lon.toFixed(4)}
Add Pin
- {lat.toFixed(4)}, {lon.toFixed(4)}
+ {lat.toFixed(4)}, {lon.toFixed(4)}
{showResults && results.length > 0 &&
{r.name}
- {resultSubtext(r) &&
{resultSubtext(r)}
}
+ {resultSubtext(r) &&
{resultSubtext(r)}
}
)}
}
;
@@ -936,11 +936,11 @@ export default function MapViewer() {
borderRadius: 6,
boxShadow: "0 2px 8px rgba(0,0,0,0.3)",
padding: "4px 0",
- fontSize: 13,
+ fontSize: '0.8125rem',
minWidth: 180,
}}
>
-
+
{(() => {
const map = mapRef.current;
const zoom = map ? map.getZoom() : 10;
diff --git a/app/src/components/ThemeSamplePage.js b/app/src/components/ThemeSamplePage.js
index 13303405..9a1e22f7 100644
--- a/app/src/components/ThemeSamplePage.js
+++ b/app/src/components/ThemeSamplePage.js
@@ -68,7 +68,7 @@ const samplePoster = (width, height) => `data:image/svg+xml,${encodeURIComponent
const Section = ({label, children}) =>
{label}
{children}
@@ -127,7 +127,7 @@ export const NavBarSample = ({color}) => {
{color}
@@ -157,8 +157,8 @@ export function ThemeSamplePage() {
const [page, setPage] = useState(3);
return
-
Component gallery
-
+
Component gallery
+
Every component in the WROLPi interface library, rendered in the {theme} theme.
Switch themes here or from the navigation bar.
@@ -166,7 +166,7 @@ export function ThemeSamplePage() {
-
+
The same picker the Settings page uses. The navigation bar has a compact
version; both read the same list of themes.
@@ -175,7 +175,7 @@ export function ThemeSamplePage() {
-
+
Every color the navigation bar can be set to (Settings → navbar
color), in the {theme} theme. The text and icons are not
a fixed color: each bar is measured, and drawn in whichever of this
@@ -199,7 +199,7 @@ export function ThemeSamplePage() {
*/}
-
+
Filtered
@@ -214,11 +214,11 @@ export function ThemeSamplePage() {
alt='The WROLPi logo, unfiltered' width={104} height={104}/>
:
setRealColors(true)}>Show }
-
+
Real colors
-
+
Images, video, PDFs, embedded pages, and the map canvas cannot read theme
tokens, so a monochrome theme remaps them with an SVG color matrix instead.
Night filters to red unless you turn it off; amber tints to match only if
@@ -237,7 +237,7 @@ export function ThemeSamplePage() {
*/}
-
+
MediaFilterToggle, the control the theme picker ends with.
It is per theme — turning it off for night leaves amber's alone — and it
renders nothing for a theme that offers no filter, so light and dark
@@ -262,7 +262,7 @@ export function ThemeSamplePage() {
}>
With a help icon beside it
-
+
The level picks the size, so the type scale stays a scale: call sites
choose a heading level for the document outline, never a font size.
@@ -332,11 +332,11 @@ export function ThemeSamplePage() {
)}
-
+
In night mode Delete drops its fill for a dashed red outline; dashed means
destructive or failed, and nothing else uses it.
-
+
An icon button is exactly as tall as a labelled one at every size, so a
group of them lines up. Mantine's own scale for icon buttons is unrelated
to its scale for buttons — sm is 22px against a button's 36px
@@ -415,7 +415,7 @@ export function ThemeSamplePage() {
clearToasts()}>Clear all
-
+
Top right, five at a time, five seconds each unless the caller says
otherwise. Check each type in all four themes: night has no second hue to
spend, so info, success, warning and error cannot be told apart by color
@@ -447,13 +447,13 @@ export function ThemeSamplePage() {
-
+
{role}
-
{meaning}
+
{meaning}
)}
-
+
Components ask for a meaning — danger — not a hue.
Light and dark spend a color on each. Night and amber have only one hue,
so a role is a step on a brightness ramp instead; that is why an error and
@@ -473,7 +473,7 @@ export function ThemeSamplePage() {
pending
failed
-
+
Four states drawn from four roles. Failure also carries weight, because
brightness is the first thing lost on a dim screen and it is all night has.
@@ -521,7 +521,7 @@ export function ThemeSamplePage() {
-
+
A bar is 22px so its label has room; at 16px the text filled the bar edge to
edge. Check the mid-range ones — 37% and 62% are where the label crosses the
boundary between fill and track, which is the case that has to work.
@@ -656,7 +656,7 @@ export function ThemeSamplePage() {
-
+
ColoredInput welds a Label to one edge of a field — the calculators' unit
markers. In night and amber the Label is an outline rather than a fill, so
the marker reads without a block of color.
@@ -695,7 +695,7 @@ export function ThemeSamplePage() {
clearable
placeholder='Search directory names…'
/>
-
+
Focus the field to see grouped suggestions. Arrow keys move, Enter takes the
highlighted one or submits what you typed, Escape closes the list without
clearing the text.
@@ -714,7 +714,7 @@ export function ThemeSamplePage() {
>{tab})}
-
+
Night and amber mark the current page with a heavier border rather than a
filled block, which would be a bright surface. The tab bar takes rendered
children, so routing stays with the caller.
@@ -757,7 +757,7 @@ export function ThemeSamplePage() {
style={{'--label-color': color, '--label-text': contrastingColor(color)}}
>{name})}
-
+
Every tag must be readable in all four themes. In night and amber the
user's color is discarded, so all tags look alike — that is the same
trade the labels above make, and it is deliberate.
@@ -775,7 +775,7 @@ export function ThemeSamplePage() {
-
+
Icons inherit currentColor, so they follow every theme.
@@ -798,7 +798,7 @@ export function ThemeSamplePage() {
style={{'--icon-stack-bg': 'var(--panel)'}}>
-
+
IconStack composes two glyphs into one symbol. The corner
glyph paints the surface behind itself so the two sets of strokes do not
cross, which means it has to be told what that surface is:{' '}
@@ -846,7 +846,7 @@ export function ThemeSamplePage() {
}
/>)}
-
+
A poster is capped on both axes — the card's width, and{' '}
--card-poster-max-height — and keeps its own ratio whichever
cap bites. Capping the width alone let a square thumbnail stand as tall as
@@ -872,13 +872,13 @@ export function ThemeSamplePage() {
: undefined}
/>)}
-
+
Titles are links but take the body color, not the link color — a grid of
results should read as titles. The meta line sits directly under the title;
actions are pushed to the foot, so a row lines its buttons up however many
lines each title took. A card with no actions simply ends.
-
+
The bottom edge carries the file type's color, so a grid of results is
scannable by kind before any title is read. It comes from a token, so night
and amber render the accent in their own single hue rather than four.
@@ -897,7 +897,7 @@ export function ThemeSamplePage() {
setModalOpen(true)}>Open a modal
-
+
Semantic's compound shape is kept — Modal.Header, Modal.Content,
Modal.Actions — so the 34 call sites written against it migrate by import.
@@ -919,8 +919,8 @@ export function ThemeSamplePage() {
- Danger zone
-
+
Danger zone
+
These actions are destructive and cannot be undone.
@@ -934,7 +934,7 @@ export function ThemeSamplePage() {
Delete tagged files
-
+
A confirmation is 380px wide, which suits a question. One that has to show
what it is about takes a size, in the same vocabulary as Modal.
diff --git a/app/src/components/Videos.js b/app/src/components/Videos.js
index eb22fafd..1ba05690 100644
--- a/app/src/components/Videos.js
+++ b/app/src/components/Videos.js
@@ -475,7 +475,7 @@ export function VideosSettingsPage() {
value={configForm.formData.sleep_requests ?? 0.75}
onChange={(value) => configForm.setValue('sleep_requests', parseFloat(value) || 0)}
placeholder='0.75'
- rightSection={sec }
+ rightSection={sec }
rightSectionWidth={36}
/>
diff --git a/app/src/components/calculators/DriveCalculator.js b/app/src/components/calculators/DriveCalculator.js
index c9ca3fbd..34112100 100644
--- a/app/src/components/calculators/DriveCalculator.js
+++ b/app/src/components/calculators/DriveCalculator.js
@@ -399,7 +399,7 @@ function fmtSpeed(speed) {
function WheelInput({hex, label, value, onChange, name, min, step}) {
return
{label}
{label}
+ // `padding` is the caller's, so it stays inline; the rest is in ui.css so it scales.
+ return
- {children &&
{children}
}
+ {children &&
{children}
}
}
/** Placeholder for content that has not arrived. Replaces Semantic's Placeholder. */
export function Placeholder({lines = 3, height = 12}: {lines?: number; height?: number}) {
- return
+ return
{Array.from({length: lines}, (_, index) =>
{label} : null;
- return
{labelNode && labelPosition === 'left' && labelNode}
diff --git a/app/src/components/ui/Overlays.tsx b/app/src/components/ui/Overlays.tsx
index c5b1d7a3..24202cf3 100644
--- a/app/src/components/ui/Overlays.tsx
+++ b/app/src/components/ui/Overlays.tsx
@@ -233,7 +233,9 @@ export function Confirm({
*/
return
onCancel?.()} title={title} size={size}>
{children}
-
+ {/* Its own class rather than `.wrolpi-modal-actions`: a confirmation's buttons sit
+ under its question with no hairline, where a Modal's are a separated footer. */}
+
{cancelLabel}
{confirmLabel}
diff --git a/app/src/components/ui/Surfaces.tsx b/app/src/components/ui/Surfaces.tsx
index 9f6f3616..99d2cd93 100644
--- a/app/src/components/ui/Surfaces.tsx
+++ b/app/src/components/ui/Surfaces.tsx
@@ -192,11 +192,12 @@ export function Card({media, title, meta, children, actions, onClick, color, cla
}}
>
{media && {media}
}
-
- {title &&
{title}
}
- {meta &&
{meta}
}
+ {/* Sizes live in ui.css, in rem: inline px would sit outside the interface scale. */}
+
+ {title &&
{title}
}
+ {meta &&
{meta}
}
{children}
- {actions &&
+ {actions &&
{actions}
}
@@ -216,9 +217,15 @@ export function CardGroup({children, minWidth = 200, className, style, ...props}
return
on Inventory and in the
* gallery, and a button carries the UA's own `buttonface` background -- rgb(239,239,239).
@@ -313,7 +313,7 @@ html[data-theme="amber"] .wrolpi-pagination button[data-active] {
* stay in lockstep: changing the padding alone would have pushed the clear button past
* the border, and changing the gap alone would have re-inset it.
*/
- --searchbox-inset: 8px;
+ --searchbox-inset: 0.5rem;
gap: var(--searchbox-inset);
background: var(--panel);
border: 1px solid var(--border);
@@ -337,13 +337,13 @@ html[data-theme="amber"] .wrolpi-searchbox-control:focus-within {
.wrolpi-searchbox-input {
flex: 1;
min-width: 0;
- padding: 8px 0;
+ padding: 0.5rem 0;
background: none;
border: none;
outline: none;
color: var(--text);
font: inherit;
- font-size: 13px;
+ font-size: 0.8125rem;
}
.wrolpi-searchbox-input::placeholder {
@@ -402,7 +402,7 @@ html .wrolpi-searchbox-clear {
* domains together run past 320px, and the last group was being clipped -- but
* still capped so a long list cannot cover the page.
*/
- max-height: min(60vh, 480px);
+ max-height: min(60vh, 30rem);
overflow-y: auto;
background: var(--panel);
border: 1px solid var(--border);
@@ -422,12 +422,12 @@ html .wrolpi-searchbox-clear {
*/
.wrolpi-search-modal .wrolpi-searchbox-results {
position: static;
- max-height: min(50vh, 420px);
+ max-height: min(50vh, 26.25rem);
}
.wrolpi-searchbox-group-name {
- padding: 6px 10px;
- font-size: 11px;
+ padding: 0.375rem 0.625rem;
+ font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
@@ -436,7 +436,7 @@ html .wrolpi-searchbox-clear {
}
.wrolpi-searchbox-result {
- padding: 7px 10px;
+ padding: 0.4375rem 0.625rem;
cursor: pointer;
border-top: 1px solid var(--border);
}
@@ -446,19 +446,19 @@ html .wrolpi-searchbox-clear {
}
.wrolpi-searchbox-result-title {
- font-size: 13px;
+ font-size: 0.8125rem;
color: var(--text);
overflow-wrap: anywhere;
}
.wrolpi-searchbox-result-description {
- font-size: 11px;
+ font-size: 0.6875rem;
color: var(--muted);
}
.wrolpi-searchbox-empty {
- padding: 10px;
- font-size: 12px;
+ padding: 0.625rem;
+ font-size: 0.75rem;
color: var(--muted);
}
@@ -472,19 +472,27 @@ html .wrolpi-searchbox-clear {
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
- gap: 10px;
+ gap: 0.625rem;
/* Bleed back out through the modal body's own padding so the rule spans the
full width; -1 * whatever Mantine padded the body with. */
- margin: 18px calc(var(--mantine-spacing-md) * -1) calc(var(--mantine-spacing-md) * -1);
- padding: 12px var(--mantine-spacing-md);
+ margin: 1.125rem calc(var(--mantine-spacing-md) * -1) calc(var(--mantine-spacing-md) * -1);
+ padding: 0.75rem var(--mantine-spacing-md);
border-top: 1px solid var(--border);
}
+/* A confirmation's buttons: under the question, no separating rule. See Confirm. */
+.wrolpi-confirm-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 0.625rem;
+ margin-top: 1.125rem;
+}
+
/* A stack of form rows, replacing Semantic's `ui stackable grid` in edit forms. */
.wrolpi-form-rows {
display: flex;
flex-direction: column;
- gap: 14px;
+ gap: 0.875rem;
}
/* ------------------------------------------------------------- Form fields */
@@ -509,12 +517,12 @@ html .wrolpi-searchbox-clear {
.wrolpi-form-field input {
width: 100%;
- padding: 7px 9px;
+ padding: 0.4375rem 0.5625rem;
background: var(--panel);
color: var(--text);
border: 1px solid var(--border);
font: inherit;
- font-size: 13px;
+ font-size: 0.8125rem;
}
.wrolpi-form-field input::placeholder {
@@ -552,8 +560,8 @@ html[data-theme="amber"] .wrolpi-form-field input:focus {
.wrolpi-path-input-label {
display: block;
font-weight: 600;
- font-size: 13px;
- margin-bottom: 4px;
+ font-size: 0.8125rem;
+ margin-bottom: 0.25rem;
}
.wrolpi-path-input-control {
@@ -598,11 +606,11 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
max-width: 50%;
overflow: hidden;
text-overflow: ellipsis;
- padding: 0 6px 0 9px;
+ padding: 0 0.375rem 0 0.5625rem;
background: var(--head);
border-right: 1px solid var(--border);
color: var(--muted);
- font-size: 12px;
+ font-size: 0.75rem;
white-space: nowrap;
user-select: none;
}
@@ -610,13 +618,13 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
.wrolpi-path-input-control input {
flex: 1;
min-width: 0;
- padding: 7px 9px;
+ padding: 0.4375rem 0.5625rem;
background: none;
border: none;
outline: none;
color: var(--text);
font: inherit;
- font-size: 13px;
+ font-size: 0.8125rem;
}
.wrolpi-path-input-control input::placeholder {
@@ -628,15 +636,15 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
}
.wrolpi-path-input-description {
- font-size: 12px;
+ font-size: 0.75rem;
color: var(--muted);
- margin-top: 3px;
+ margin-top: 0.1875rem;
}
.wrolpi-path-input-error {
- font-size: 12px;
+ font-size: 0.75rem;
color: var(--danger);
- margin-top: 3px;
+ margin-top: 0.1875rem;
}
/* ---------------------------------------------------------- Action inputs */
@@ -664,6 +672,37 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
flex: none;
}
+/* A colored label beside an input, unlike ActionInput's shared outline: they stay two
+ controls, so the gap between them is real and scales with the type. */
+.wrolpi-colored-input {
+ display: flex;
+ align-items: stretch;
+ gap: 0.375rem;
+}
+
+/* ------------------------------------------------- Loading & placeholders */
+/*
+ * A centered loader with a caption, and the skeleton stack that stands in for text.
+ * Both were inline px in Feedback.tsx, which put them outside the interface scale.
+ */
+.wrolpi-loading {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 0.625rem;
+}
+
+.wrolpi-loading-caption {
+ font-size: 0.8125rem;
+ color: var(--muted);
+}
+
+.wrolpi-placeholder {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+}
+
/* --------------------------------------------------------------- Switches */
/*
* Mantine's unchecked track is a gray from its own palette, which would put a
@@ -713,9 +752,9 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
.wrolpi-label {
display: inline-flex;
align-items: center;
- gap: 4px;
- padding: 5px 10px;
- font-size: 12.5px;
+ gap: 0.25rem;
+ padding: 0.3125rem 0.625rem;
+ font-size: 0.78125rem;
font-weight: 500;
line-height: 1.3;
background: var(--label-color);
@@ -747,16 +786,16 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
* Room for the point, which is drawn outside the body: half its diagonal (14.1px) plus
* the 1px it is nudged left, rounded up.
*/
- margin-left: 16px;
+ margin-left: 1rem;
/* Tags wrap, and a wrapped row was sitting on the row above it. */
- margin-bottom: 5px;
+ margin-bottom: 0.3125rem;
/*
* The point is centred on the left edge, so its inner half covers the body's first 10px
* -- 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.
*/
- padding-left: 13px;
+ padding-left: 0.8125rem;
}
.wrolpi-tag::before {
@@ -764,8 +803,8 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
position: absolute;
top: 50%;
right: 100%;
- width: 20px;
- height: 20px;
+ width: 1.25rem;
+ height: 1.25rem;
/*
* Nudged 1px left of where `right: 100%` puts it. That property positions against the
* containing block's *padding* box, and the body carries a 1px border, so a square centred
@@ -788,8 +827,8 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
position: absolute;
top: 50%;
left: -7px;
- width: 5px;
- height: 5px;
+ width: 0.3125rem;
+ height: 0.3125rem;
margin-top: -2.5px;
border-radius: 50%;
background: currentColor;
@@ -842,7 +881,7 @@ html[data-theme="night"] .wrolpi-tag::before {
/* ---------------------------------------------------------------- Headers */
.wrolpi-header {
- margin: 0 0 10px;
+ margin: 0 0 0.625rem;
}
/*
@@ -855,14 +894,14 @@ html[data-theme="night"] .wrolpi-tag::before {
* where it should be, and pushing it down would just dent the top of its own container.
*/
* + .wrolpi-header {
- margin-top: 22px;
+ margin-top: 1.375rem;
}
/* The heading and its trailing control share one row. */
.wrolpi-header-row {
display: flex;
align-items: center;
- gap: 8px;
+ gap: 0.5rem;
}
/*
@@ -880,19 +919,19 @@ html[data-theme="night"] .wrolpi-tag::before {
display: inline-flex;
align-items: center;
flex-shrink: 0;
- font-size: 13px;
+ font-size: 0.8125rem;
font-weight: 400;
}
.wrolpi-header-dividing {
border-bottom: 1px solid var(--border);
- padding-bottom: 6px;
+ padding-bottom: 0.375rem;
}
.wrolpi-header-text {
display: flex;
align-items: center;
- gap: 8px;
+ gap: 0.5rem;
margin: 0;
/*
* Stated explicitly because semantic.min.css sets `h1,h2,h3,h4,h5 { font-family:
@@ -909,30 +948,30 @@ html[data-theme="night"] .wrolpi-tag::before {
/* The scale lives here so no call site invents a size of its own. */
.wrolpi-header-h1 {
- font-size: 26px;
+ font-size: 1.625rem;
}
.wrolpi-header-h2 {
- font-size: 21px;
+ font-size: 1.3125rem;
}
.wrolpi-header-h3 {
- font-size: 17px;
+ font-size: 1.0625rem;
}
.wrolpi-header-h4 {
- font-size: 14px;
+ font-size: 0.875rem;
}
.wrolpi-header-h5 {
- font-size: 13px;
+ font-size: 0.8125rem;
letter-spacing: 0.02em;
}
.wrolpi-header-sub {
- font-size: 12px;
+ font-size: 0.75rem;
color: var(--muted);
- margin-top: 3px;
+ margin-top: 0.1875rem;
}
/*
@@ -1015,12 +1054,12 @@ html .mantine-Notification-closeButton:hover {
.wrolpi-message {
display: flex;
align-items: flex-start;
- gap: 10px;
+ gap: 0.625rem;
border: 1px solid var(--border);
border-left: 3px solid var(--message-color, var(--border));
background: var(--panel);
- padding: 10px 14px;
- font-size: 13px;
+ padding: 0.625rem 0.875rem;
+ font-size: 0.8125rem;
}
.wrolpi-message-content {
@@ -1044,7 +1083,7 @@ html .mantine-Notification-closeButton:hover {
display: flex;
/* Widen the tap target past the glyph without moving it. */
margin: -6px -6px -6px 0;
- padding: 6px;
+ padding: 0.375rem;
}
.wrolpi-message-dismiss:hover {
@@ -1058,7 +1097,7 @@ html .mantine-Notification-closeButton:hover {
.wrolpi-message-title {
font-weight: 600;
- margin-bottom: 2px;
+ margin-bottom: 0.125rem;
}
.wrolpi-message-body {
@@ -1088,8 +1127,8 @@ html .mantine-Notification-closeButton:hover {
*/
.wrolpi-progress {
position: relative;
- height: 22px;
- min-width: 120px;
+ height: 1.375rem;
+ min-width: 7.5rem;
overflow: hidden;
background: var(--bg);
border: 1px solid var(--border);
@@ -1105,7 +1144,7 @@ html .mantine-Notification-closeButton:hover {
* something, so an only-child bar in a column is untouched.
*/
* + .wrolpi-progress {
- margin-top: 8px;
+ margin-top: 0.5rem;
}
.wrolpi-progress-fill {
@@ -1155,7 +1194,7 @@ html .mantine-Notification-closeButton:hover {
align-items: center;
justify-content: center;
/* 12px rather than 11: these labels carry units and device names, not just a number. */
- font-size: 12px;
+ font-size: 0.75rem;
font-weight: 700;
color: var(--text);
font-variant-numeric: tabular-nums;
@@ -1166,7 +1205,7 @@ html .mantine-Notification-closeButton:hover {
* it; with a hard clip and no ellipsis, `Complete: very-long-archive-name.tar.gz`
* ends mid-glyph and reads as broken rather than truncated.
*/
- padding: 0 6px;
+ padding: 0 0.375rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
@@ -1204,7 +1243,7 @@ html[data-theme="amber"] .wrolpi-progress-fill {
.wrolpi-panel {
background: var(--panel);
border: 1px solid var(--border);
- padding: 14px 16px;
+ padding: 0.875rem 1rem;
}
/* Danger zones are dashed in every theme; it doubles as a colorblind-safe cue. */
@@ -1231,7 +1270,7 @@ html[data-theme="amber"] .wrolpi-progress-fill {
* whichever cap bites first, the other axis comes down with it and the ratio survives.
*/
:root {
- --card-poster-max-height: 200px;
+ --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. */
--disabled-opacity: 0.45;
@@ -1254,6 +1293,48 @@ html[data-theme="amber"] .wrolpi-progress-fill {
justify-content: center;
}
+/*
+ * The card's text block.
+ *
+ * These lived as inline px in Card's JSX, which put them outside the interface scale --
+ * `fontSize: 13` is 13px whatever the root font-size is, so a card's title would have
+ * stayed put while the prose around it grew. Rules now, for the same reason every other
+ * size is one: a single place to retune, and ui-scale.test.js can see them.
+ */
+.wrolpi-card-body {
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ flex: 1;
+ padding: 0.625rem 0.75rem 0.75rem;
+}
+
+.wrolpi-card-title {
+ font-size: 0.8125rem;
+ font-weight: 600;
+ line-height: 1.35;
+}
+
+.wrolpi-card-meta {
+ font-size: 0.75rem;
+ color: var(--muted);
+}
+
+/* The foot: `auto` pushes the actions down so a row of cards lines its buttons up
+ however tall the titles above them got. ui-layout.cy.js measures that. */
+.wrolpi-card-actions {
+ margin-top: auto;
+ padding-top: 0.5rem;
+}
+
+/* A grid of cards. The track width is the caller's `minWidth`, converted to rem in
+ CardGroup so a column scales with the type -- which is what returns a phone to one
+ card per row, as the pre-migration build had it. */
+.wrolpi-card-group {
+ display: grid;
+ gap: 0.875rem;
+}
+
.wrolpi-card-poster-frame {
position: relative;
display: block;
@@ -1273,7 +1354,7 @@ html[data-theme="amber"] .wrolpi-progress-fill {
display: flex;
align-items: center;
justify-content: center;
- min-height: 120px;
+ min-height: 7.5rem;
background: var(--head);
}
@@ -1282,7 +1363,7 @@ html[data-theme="amber"] .wrolpi-progress-fill {
top: 0;
left: 0;
display: flex;
- padding: 3px 4px;
+ padding: 0.1875rem 0.25rem;
background: var(--green);
color: var(--btn-text);
}
@@ -1308,7 +1389,7 @@ html[data-theme="amber"] .wrolpi-card-tag {
.wrolpi-statistic {
display: inline-block;
vertical-align: top;
- margin: 0 26px 10px 0;
+ margin: 0 1.625rem 0.625rem 0;
}
/*
@@ -1328,8 +1409,8 @@ html[data-theme="amber"] .wrolpi-card-tag {
*/
.wrolpi-statistic-group {
display: grid;
- grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
- gap: 18px 30px;
+ grid-template-columns: repeat(auto-fit, minmax(9.375rem, 1fr));
+ gap: 1.125rem 1.875rem;
}
/*
@@ -1341,7 +1422,7 @@ html[data-theme="amber"] .wrolpi-card-tag {
* while leaving the bottom where it was, so the whole panel read as lopsided.
*/
* + .wrolpi-statistic-group {
- margin-top: 18px;
+ margin-top: 1.125rem;
}
/*
@@ -1362,18 +1443,18 @@ html[data-theme="amber"] .wrolpi-card-tag {
}
.wrolpi-statistic-value {
- font-size: 24px;
+ font-size: 1.5rem;
font-weight: 600;
font-variant-numeric: tabular-nums;
line-height: 1.15;
}
.wrolpi-statistic-label {
- font-size: 11px;
+ font-size: 0.6875rem;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--muted);
- margin-top: 2px;
+ margin-top: 0.125rem;
}
/* ---------------------------------------------------------------- Status */
@@ -1383,11 +1464,11 @@ html[data-theme="amber"] .wrolpi-card-tag {
* replaced the three `html[data-theme="night"]` overrides that used to live below.
*/
.wrolpi-status {
- font-size: 12.5px;
+ font-size: 0.78125rem;
font-weight: 500;
display: inline-flex;
align-items: center;
- gap: 5px;
+ gap: 0.3125rem;
color: var(--status-color);
}
@@ -1451,7 +1532,7 @@ html .mantine-Table-table[data-with-table-border] {
.wrolpi-th-sort {
display: inline-flex;
align-items: center;
- gap: 5px;
+ gap: 0.3125rem;
background: none;
border: none;
padding: 0;
diff --git a/app/src/components/ui/ui.test.js b/app/src/components/ui/ui.test.js
index 68f5819a..201466b2 100644
--- a/app/src/components/ui/ui.test.js
+++ b/app/src/components/ui/ui.test.js
@@ -903,6 +903,12 @@ describe('Card', () => {
* card read buttons-then-domain. Which slot lands where is what this asserts; that
* the foot anchoring actually resolves is in ui-layout.cy.js, since `margin-top:
* auto` needs a layout engine.
+ *
+ * That division is why there is no `margin-top: auto` assertion here any more. There
+ * was one, reading the inline style, and it broke when the card's sizes moved into
+ * ui.css so the interface scale could reach them -- jsdom applies no stylesheet. It
+ * was asserting where the declaration was written rather than what it did, and the
+ * cypress test above measures the actual foot alignment either way.
*/
renderUI( {
expect([...body.children].map(child => child.textContent)).toEqual([
'Rainwater Harvesting', 'engineering775.com', 'body', 'Details',
]);
- expect(body.querySelector('.wrolpi-card-actions')).toHaveStyle({marginTop: 'auto'});
- expect(body.querySelector('.wrolpi-card-meta').style.marginTop).toBe('');
+ expect(body.querySelector('.wrolpi-card-actions')).not.toBeNull();
+ expect(body.querySelector('.wrolpi-card-meta')).not.toBeNull();
});
it('renders no actions row when a card has no actions', () => {
@@ -940,14 +946,20 @@ describe('CardGroup', () => {
expect(screen.getByText('Three')).toBeInTheDocument();
});
- it('lays cards out on a track no narrower than minWidth', () => {
- // The default suits file results; a group of wide cards raises it. If the value were
- // dropped the grid would fall back to one column, which is how a card wall becomes a
- // list on a desktop.
+ it('lays cards out on a track no narrower than minWidth, in rem so it scales', () => {
+ /*
+ * The default suits file results; a group of wide cards raises it. If the value were
+ * dropped the grid would fall back to one column, which is how a card wall becomes a
+ * list on a desktop.
+ *
+ * The px the caller names is converted to rem, which is the whole reason a phone shows
+ * one card per row again: as px, the track ignored the interface scale, and a 430px
+ * screen fitted two 200px cards where the pre-migration build fitted one 290px card.
+ */
const {container} = renderUI( );
expect(container.querySelector('.wrolpi-card-group'))
- .toHaveStyle({gridTemplateColumns: 'repeat(auto-fill, minmax(320px, 1fr))'});
+ .toHaveStyle({gridTemplateColumns: 'repeat(auto-fill, minmax(20rem, 1fr))'});
});
});
diff --git a/app/src/themes/tokens.css b/app/src/themes/tokens.css
index 83cdcc01..dbc503fb 100644
--- a/app/src/themes/tokens.css
+++ b/app/src/themes/tokens.css
@@ -242,8 +242,48 @@ html[data-theme="amber"] {
* None of it belonged to Semantic; it belongs here, expressed in tokens.
*/
+/* ------------------------------------------------------------------------- */
+/* Interface scale */
+/* ------------------------------------------------------------------------- */
+/*
+ * How large the interface is, overall.
+ *
+ * Measured against the pre-migration Semantic build at 1280px, the drift was not one
+ * number: its headings were h1 28 / h2 24 / h3 18 / h4 15 / h5 14 against our
+ * 26 / 21 / 17 / 14 / 13, and its video card a fixed 290px with an 18px title against
+ * our 238px with a 13px one -- while our BODY text and chrome went the other way,
+ * a 16px base against Semantic's 14 and 42px buttons against 36. No per-component
+ * nudge reproduces what a user comparing the two sees, which is the whole page.
+ *
+ * Ten percent is not a fudge factor: our heading scale times 1.1 is
+ * 28.6 / 23.1 / 18.7 / 15.4 / 14.3, which is Semantic's scale to within a pixel at
+ * every step.
+ *
+ * The lever is the root font-size, and everything that should grow with it is written
+ * in `rem`. That is Mantine's own mechanism -- its size declarations are
+ * `calc(Xrem * var(--mantine-scale))`, and `theme.scale` exists to CANCEL a customised
+ * root font-size, so it must stay at 1 here.
+ *
+ * A percentage rather than a px value, so a user who has set a larger default font in
+ * their browser keeps it, scaled, instead of having it silently overridden.
+ *
+ * `zoom: 1.1` on the root was tried first and rejected. It is one line and it works,
+ * but it scales at paint time: every 1px hairline becomes 1.1px and softens on a 1x
+ * display, and viewport units do not shrink to compensate, so `100vh` paints 110% of
+ * the screen -- a 95vw modal overflowed sideways and the CBZ viewer's fullscreen
+ * overflowed downwards. Rem scales real lengths, leaves borders crisp and leaves
+ * viewport units alone.
+ *
+ * Borders, outlines and shadows are deliberately NOT in rem. A hairline is a hairline
+ * at any text size; ui-scale.test.js enforces both halves of that.
+ */
+:root {
+ --ui-scale: 1.1;
+}
+
html {
box-sizing: border-box;
+ font-size: calc(100% * var(--ui-scale));
}
*,
diff --git a/app/src/themes/ui-scale.test.js b/app/src/themes/ui-scale.test.js
new file mode 100644
index 00000000..e29dddf2
--- /dev/null
+++ b/app/src/themes/ui-scale.test.js
@@ -0,0 +1,169 @@
+import fs from 'fs';
+import path from 'path';
+
+/*
+ * The size of the interface.
+ *
+ * Measured against the pre-migration Semantic build on the QA Pi at 1280px, the drift was not
+ * one number: its headings were h1 28 / h2 24 / h3 18 / h4 15 / h5 14 against our 26 / 21 / 17
+ * / 14 / 13, and its video card a fixed 290px with an 18px title against our 238px with a 13px
+ * one -- while our BODY text and chrome went the other way, 16px base against Semantic's 14 and
+ * 42px buttons against 36. So no per-component nudge reproduces what a user comparing the two
+ * actually sees, which is the whole page at once.
+ *
+ * Ten percent is not a fudge factor. Our heading scale multiplied by 1.1 is 28.6 / 23.1 / 18.7
+ * / 15.4 / 14.3 -- Semantic's numbers, to within a pixel at every step.
+ *
+ * The lever is the root font-size, and everything that should grow with it is written in `rem`.
+ * That is Mantine's own mechanism: its 644 size declarations are `calc(Xrem * var(--mantine-
+ * scale))`, and `theme.scale` exists specifically to CANCEL a customised root font-size, which
+ * is why it must stay at 1 here -- we want those sizes to grow.
+ *
+ * `zoom: 1.1` on the root was tried first and rejected. It works, and it is one line, but it
+ * scales at paint time: every 1px hairline becomes 1.1px and softens on a 1x display, and
+ * viewport units do not shrink to compensate, so `100vh` paints 110% of the screen -- a 95vw
+ * modal overflowed sideways and the CBZ viewer's fullscreen overflowed down. Rem scales real
+ * lengths instead, leaves borders crisp, leaves viewport units alone, and respects a user's own
+ * browser font-size setting rather than overriding it.
+ */
+
+const SRC = path.join(__dirname, '..');
+const tokens = fs.readFileSync(path.join(__dirname, 'tokens.css'), 'utf8');
+
+/** Our own stylesheets -- the ones the scale has to reach. */
+const STYLESHEETS = ['themes/tokens.css', 'App.css', 'index.css', 'components/ui/ui.css']
+ .map(file => [file, path.join(SRC, file)])
+ .filter(([, full]) => fs.existsSync(full));
+
+/** `source` with every comment blanked, keeping line numbers intact. */
+const stripComments = (source) => source
+ .replace(/\/\*[\s\S]*?\*\//g, block => block.replace(/[^\n]/g, ' '))
+ .replace(/(^|[^:])\/\/[^\n]*/g, (all, before) => before + ' '.repeat(all.length - before.length));
+
+/** Every source file under src/, excluding tests. */
+const sourceFiles = (dir = SRC) => fs.readdirSync(dir, {withFileTypes: true}).flatMap(entry => {
+ const full = path.join(dir, entry.name);
+ if (entry.isDirectory()) return entry.name === 'node_modules' ? [] : sourceFiles(full);
+ if (!/\.(js|jsx|ts|tsx|css)$/.test(entry.name)) return [];
+ if (/\.(test|cy)\.(js|jsx|ts|tsx)$/.test(entry.name)) return [];
+ return [full];
+});
+
+describe('--ui-scale', () => {
+ it('scales the interface from the root font-size', () => {
+ // A percentage of the browser's own default, not a px value: a user who has set a
+ // larger default font keeps it, scaled, instead of having it overridden.
+ expect(tokens).toMatch(/--ui-scale:\s*1\.1;/);
+ expect(tokens).toMatch(/\n\s*font-size:\s*calc\(100%\s*\*\s*var\(--ui-scale\)\)/);
+ });
+
+ it('leaves Mantine free to grow with it', () => {
+ /*
+ * `theme.scale` divides Mantine's rem lengths by itself, to undo a customised root
+ * font-size. Setting it to 1.1 alongside a 110% root would therefore cancel out
+ * exactly, leaving Mantine's half of the interface at its original size while ours
+ * grew -- buttons the old size beside 10% larger text.
+ */
+ const mantine = fs.readFileSync(path.join(__dirname, 'mantine.ts'), 'utf8');
+ expect(stripComments(mantine)).not.toMatch(/\bscale:\s*[\d.]/);
+ });
+
+ it('writes every scalable length in rem, so the scale reaches it', () => {
+ /*
+ * A px font-size does not grow with the root, so it would shrink RELATIVE to
+ * everything around it -- the failure is a 13px caption beside 14.3px prose, which
+ * reads as sloppy rather than broken and so never gets reported.
+ *
+ * Borders are exempt and must stay px: a hairline is a hairline at any text size, and
+ * scaling it is exactly what made `zoom` the wrong tool. Same for outlines, which are
+ * hairlines wearing a different name.
+ */
+ const SCALABLE = /^\s*(font-size|padding|padding-\w+|margin|margin-\w+|gap|row-gap|column-gap|width|min-width|max-width|height|min-height|max-height|border-radius|top|right|bottom|left)\s*:/;
+
+ const offenders = [];
+ let scanned = 0;
+ for (const [name, full] of STYLESHEETS) {
+ stripComments(fs.readFileSync(full, 'utf8')).split('\n').forEach((line, index) => {
+ if (!SCALABLE.test(line)) return;
+ scanned += 1;
+ // 0 has no unit to scale, and 1px in a scalable property is a hairline too.
+ const px = [...line.matchAll(/(? parseFloat(match[1]) > 1);
+ if (px.length) offenders.push(`${name}:${index + 1}: ${line.trim().slice(0, 64)}`);
+ });
+ }
+
+ // The premise: a regex that matched no declarations would report no offenders.
+ expect(scanned).toBeGreaterThan(100);
+ expect(offenders).toEqual([]);
+ });
+
+ it('keeps hairlines out of the scale', () => {
+ /*
+ * The inverse of the rule above, and the reason it is worth a test of its own: a bulk
+ * px-to-rem pass that also converted the borders would leave every rule in the app
+ * growing with the type, which is the defect `zoom` had. At least most borders must
+ * still be px.
+ */
+ /*
+ * Only the properties that carry a border's THICKNESS. `border-radius` is a
+ * scalable length -- a 10% larger control wants a proportionally larger corner --
+ * and an earlier version of this matched it, so it failed on the correct answer.
+ */
+ const THICKNESS = /^\s*(border|border-(top|right|bottom|left|inline|block)(-\w+)?|border-width|outline|outline-offset)\s*:/;
+
+ const borders = [];
+ for (const [, full] of STYLESHEETS) {
+ stripComments(fs.readFileSync(full, 'utf8')).split('\n').forEach(line => {
+ if (THICKNESS.test(line) && !/radius/.test(line)) borders.push(line);
+ });
+ }
+ const pxBorders = borders.filter(line => /\dpx/.test(line));
+ const remBorders = borders.filter(line => /\drem/.test(line));
+
+ expect(borders.length).toBeGreaterThan(30);
+ expect({rem: remBorders, someArePx: pxBorders.length > 20})
+ .toEqual({rem: [], someArePx: true});
+ });
+
+ it('writes no px font-size inline, anywhere', () => {
+ /*
+ * An inline size is part of the scale whether or not it looks like one: a bare number
+ * in `fontSize` is px by React's own rule, so `fontSize: 12` is a 12px caption that
+ * stays 12px while the prose beside it grows to 13.2. Nothing breaks -- it just reads
+ * as slightly sloppy, in 46 places, which is not a bug anyone reports.
+ *
+ * The whole of src is scanned, the gallery included. /theme-sample is linked from
+ * Settings and ships to users, so its annotations are interface text too.
+ */
+ const offenders = [];
+ for (const file of sourceFiles()) {
+ if (file.endsWith('.css')) continue;
+ stripComments(fs.readFileSync(file, 'utf8')).split('\n').forEach((line, index) => {
+ /*
+ * A bare number (px by React's rule) or an explicit px. Relative units are
+ * fine and are not offences: `em` resolves against the parent's font-size and
+ * `%` likewise, so both already grow with the scale. An earlier version
+ * allowed only `rem` and reported 21 perfectly good `0.85em` captions.
+ */
+ if (/fontSize:\s*(\d|['"][\d.]+px)/.test(line)) {
+ offenders.push(`${path.relative(SRC, file)}:${index + 1}: ${line.trim().slice(0, 60)}`);
+ }
+ });
+ }
+
+ /*
+ * The premise: `fontSize` in rem has to be found, or a codebase with no inline sizes
+ * at all would read identically to one that had converted them.
+ *
+ * Occurrences rather than files. Counting files gave 8 for the 46 conversions -- 32
+ * of them are in the gallery -- so a threshold set from the conversion count failed
+ * against the correct answer.
+ */
+ const remSizes = sourceFiles().flatMap(file =>
+ [...fs.readFileSync(file, 'utf8').matchAll(/fontSize:\s*['"][\d.]+rem/g)]);
+ expect(remSizes.length).toBeGreaterThan(40);
+
+ expect(offenders).toEqual([]);
+ });
+});