From e07db5a042edb4836e3650d0c98c40abfb4f5613 Mon Sep 17 00:00:00 2001
From: Miguel Palhas
Date: Wed, 11 Nov 2026 17:40:50 +0000
Subject: [PATCH] refactor(web): controls, toggles and segments as utilities
look.ts builds each control's class list from its whole state, so no
two utilities fight over a property. The contextual overrides from rows,
trays, page heads and the removal panel become props.
Refs #280
Co-Authored-By: Claude Opus 5.5 (1M context)
---
web/scripts/check-tokens.mjs | 3 +-
web/src/App.tsx | 8 +-
web/src/components.css | 355 +----------------------------------
web/src/detail.tsx | 13 +-
web/src/icons.tsx | 18 +-
web/src/look.ts | 145 ++++++++++++++
web/src/style.css | 5 +
web/src/subs-panel.tsx | 9 +-
web/src/ui.tsx | 81 +++++---
web/src/views/Library.tsx | 7 +-
web/src/views/Movie.tsx | 8 +-
web/src/views/Search.tsx | 10 +-
web/src/views/Series.tsx | 12 +-
web/src/views/Settings.tsx | 6 +-
web/src/views/TvDeck.tsx | 5 +-
15 files changed, 277 insertions(+), 408 deletions(-)
create mode 100644 web/src/look.ts
diff --git a/web/scripts/check-tokens.mjs b/web/scripts/check-tokens.mjs
index 63e184a..1ebd785 100644
--- a/web/scripts/check-tokens.mjs
+++ b/web/scripts/check-tokens.mjs
@@ -40,7 +40,8 @@ function walk(dir, out = []) {
}
const COLOR_LITERAL = /#[0-9a-fA-F]{3,8}\b|\b(?:oklch|oklab|lab|lch|rgba?|hsla?|hwb|color)\(/;
-const RELATIVE_FROM_TOKEN = /\b(?:oklch|oklab|lab|lch|rgb|hsl|hwb|color)\(\s*from\s+var\(--/g;
+// `_` is a space inside a Tailwind arbitrary value
+const RELATIVE_FROM_TOKEN = /\b(?:oklch|oklab|lab|lch|rgb|hsl|hwb|color)\([\s_]*from[\s_]+var\(--/g;
const SPACING_PROP = /^(?:margin|padding|gap|row-gap|column-gap|inset)(?:-[a-z-]+)?$/;
const SPACING_VALUE = /^(?:var\(--[\w-]+\)|0|auto|-?[\d.]+%)$/;
const FONT_SIZE_VALUE = /^var\(--text-[\w-]+\)$/;
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 345e93c..59c798b 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -16,6 +16,7 @@ import { LAYER, LiveContext, type Nav, NavContext, type TvDeckRequest, useEscape
import { type Download, fetchDownloads } from "./downloads";
import { type Probe, probeHealth } from "./health";
import { Icon, type IconName } from "./icons";
+import { control, cx } from "./look";
import { two } from "./parts";
import {
currentRoute,
@@ -586,7 +587,7 @@ export function App() {
+ {/* armed: the confirm turns caution amber with the rest of the panel */}
remove and delete files
-
+
keep
diff --git a/web/src/icons.tsx b/web/src/icons.tsx
index 4f30f82..52d5187 100644
--- a/web/src/icons.tsx
+++ b/web/src/icons.tsx
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
+import { control, microControl } from "./look";
// The shared icon-only control block (#230), consumed by the title pages,
// decks and readouts, the settings rows (#231) and the subtitle chips and
@@ -64,9 +65,14 @@ const ICON_PATHS = {
export type IconName = keyof typeof ICON_PATHS;
/** Stroke glyph on the shared 16-grid; the control's aria-label carries the meaning. */
-export function Icon({ name }: { name: IconName }) {
+export function Icon({ name, className }: { name: IconName; className?: string }) {
return (
-