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) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
288d4b26ad
commit
e07db5a042
+1
-354
@@ -314,111 +314,7 @@ body {
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
/* ---- controls ------------------------------------------------------------- */
|
||||
|
||||
/* primary: cyan word on a raised plate — one per header or panel */
|
||||
.control {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-2);
|
||||
min-height: var(--control-h);
|
||||
padding: 0 var(--space-4);
|
||||
font-family: var(--font-readout);
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
white-space: nowrap;
|
||||
text-decoration: none;
|
||||
color: var(--accent);
|
||||
background: var(--panel-raised);
|
||||
border: 1px solid var(--line-strong);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: inset 0 1px var(--highlight);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color 150ms var(--ease-out),
|
||||
color 150ms var(--ease-out),
|
||||
background 150ms var(--ease-out);
|
||||
}
|
||||
|
||||
.control:hover:not(:disabled) {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-bright);
|
||||
}
|
||||
|
||||
.control:active:not(:disabled) {
|
||||
box-shadow: inset 0 1px var(--lowlight);
|
||||
}
|
||||
|
||||
.control:disabled {
|
||||
color: var(--ink-faint);
|
||||
border-color: var(--line);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.control[data-busy] {
|
||||
color: var(--ink-faint);
|
||||
border-style: dashed;
|
||||
cursor: progress;
|
||||
}
|
||||
|
||||
.control[data-done] {
|
||||
color: var(--signal-ok);
|
||||
border-color: oklch(from var(--signal-ok) l c h / 55%);
|
||||
}
|
||||
|
||||
.control[data-failed] {
|
||||
color: var(--signal-fault);
|
||||
border-color: oklch(from var(--signal-fault) l c h / 55%);
|
||||
}
|
||||
|
||||
/* quiet: secondary actions — cancel, add, back, retry. Never a toggle. */
|
||||
.control-quiet {
|
||||
color: var(--ink);
|
||||
background: transparent;
|
||||
border-color: var(--line);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* a word control whose label changes keeps one width */
|
||||
.control-fixed {
|
||||
min-width: var(--word-w);
|
||||
}
|
||||
|
||||
/* icon: a square glyph, the accessible name carries the meaning */
|
||||
.control-icon {
|
||||
width: var(--control-h);
|
||||
min-width: var(--control-h);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.control[aria-expanded="true"] {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-bright);
|
||||
}
|
||||
|
||||
/* destructive rests red, so delete never reads like the glyph beside it */
|
||||
.control[data-kind="delete"]:not(:disabled) {
|
||||
color: var(--signal-fault);
|
||||
}
|
||||
|
||||
.control[data-kind="delete"]:hover:not(:disabled),
|
||||
.control[data-kind="delete"]:focus-visible:not(:disabled) {
|
||||
border-color: var(--signal-fault);
|
||||
color: var(--signal-fault);
|
||||
}
|
||||
|
||||
/* armed: the same square, now an amber check — the next tap fires */
|
||||
.control[data-armed="true"]:not(:disabled),
|
||||
.control[data-armed="true"]:hover:not(:disabled) {
|
||||
color: var(--ground);
|
||||
background: var(--signal-warn);
|
||||
border-color: var(--signal-warn);
|
||||
}
|
||||
/* ---- glyphs ---------------------------------------------------------------- */
|
||||
|
||||
.icon {
|
||||
display: block;
|
||||
@@ -459,189 +355,6 @@ body {
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
/* the chip-scale delete (#251): no plate, the armed glyph does the word's job */
|
||||
.control-micro {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
padding: 0;
|
||||
margin-inline-start: var(--space-1);
|
||||
color: var(--ink-faint);
|
||||
background: none;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.control-micro .icon {
|
||||
width: 0.75rem;
|
||||
height: 0.75rem;
|
||||
}
|
||||
|
||||
.control-micro:hover:not(:disabled),
|
||||
.control-micro:focus-visible {
|
||||
color: var(--signal-fault);
|
||||
background: oklch(from var(--signal-fault) l c h / 15%);
|
||||
}
|
||||
|
||||
.control-micro[data-armed="true"] {
|
||||
color: var(--ground);
|
||||
background: var(--signal-warn);
|
||||
}
|
||||
|
||||
.control-micro:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* disclosure: full control height, the chevron turns, the plate holds its width */
|
||||
.disclose {
|
||||
justify-content: space-between;
|
||||
min-width: 9rem;
|
||||
}
|
||||
|
||||
.disclose .icon {
|
||||
transition: transform 200ms var(--ease-out);
|
||||
}
|
||||
|
||||
.disclose[aria-expanded="true"] .icon {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* lamp toggle: a rule that is on or off, lamp plus word */
|
||||
.toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
min-height: var(--control-h);
|
||||
padding: 0 var(--space-3);
|
||||
font-family: var(--font-readout);
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
white-space: nowrap;
|
||||
color: var(--ink-muted);
|
||||
background: transparent;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color 150ms var(--ease-out),
|
||||
color 150ms var(--ease-out);
|
||||
}
|
||||
|
||||
.toggle:hover:not(:disabled) {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.toggle:disabled {
|
||||
cursor: progress;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.toggle-lamp {
|
||||
width: 0.5rem;
|
||||
height: 0.5rem;
|
||||
flex: none;
|
||||
border-radius: 50%;
|
||||
background: var(--lamp-off);
|
||||
transition:
|
||||
background 300ms var(--ease-out),
|
||||
box-shadow 300ms var(--ease-out);
|
||||
}
|
||||
|
||||
.toggle-state {
|
||||
min-width: 3ch;
|
||||
margin-left: auto;
|
||||
text-align: left;
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
.toggle[aria-pressed="true"] {
|
||||
color: var(--ink);
|
||||
border-color: var(--line-strong);
|
||||
}
|
||||
|
||||
.toggle[aria-pressed="true"] .toggle-lamp {
|
||||
background: var(--accent);
|
||||
box-shadow: 0 0 6px oklch(from var(--accent) l c h / 60%);
|
||||
}
|
||||
|
||||
.toggle[aria-pressed="true"] .toggle-state {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
/* segmented: one choice of a few, the engaged side lit */
|
||||
.segmented {
|
||||
display: inline-flex;
|
||||
flex: none;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.seg {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-2);
|
||||
min-height: var(--control-h);
|
||||
padding: 0 var(--space-3);
|
||||
font-family: var(--font-readout);
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--ink-muted);
|
||||
background: transparent;
|
||||
border: 1px solid var(--line);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color 150ms var(--ease-out),
|
||||
color 150ms var(--ease-out);
|
||||
}
|
||||
|
||||
.seg:first-child {
|
||||
border-radius: var(--radius) 0 0 var(--radius);
|
||||
}
|
||||
|
||||
.seg:last-child {
|
||||
border-radius: 0 var(--radius) var(--radius) 0;
|
||||
}
|
||||
|
||||
.seg + .seg {
|
||||
border-left-width: 0;
|
||||
}
|
||||
|
||||
.seg-icon {
|
||||
width: var(--control-h);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.seg:hover {
|
||||
color: var(--accent-bright);
|
||||
}
|
||||
|
||||
/* the lit edge is drawn inside, so the joined borders never double */
|
||||
.seg[aria-pressed="true"] {
|
||||
color: var(--accent-bright);
|
||||
background: var(--panel-raised);
|
||||
box-shadow: inset 0 0 0 1px var(--accent);
|
||||
}
|
||||
|
||||
.filter-count {
|
||||
color: var(--ink-faint);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.seg[aria-pressed="true"] .filter-count {
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
/* ---- chips ---------------------------------------------------------------- */
|
||||
|
||||
/* a label, not a target: shorter than a control, one line always */
|
||||
@@ -948,18 +661,10 @@ button.chip {
|
||||
width: var(--toggle-w);
|
||||
}
|
||||
|
||||
.r-slot[data-width="toggle"] > .toggle {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.r-slot[data-width="word"] {
|
||||
min-width: var(--word-w);
|
||||
}
|
||||
|
||||
.r-slot[data-width="word"] > .control {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.r-slot[data-wide] {
|
||||
display: none;
|
||||
}
|
||||
@@ -1044,16 +749,6 @@ button.chip {
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.r-morepanel .control,
|
||||
.r-morepanel .toggle {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.r-morepanel .control .icon {
|
||||
margin-right: var(--space-1);
|
||||
}
|
||||
|
||||
.r-empty {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -1141,13 +836,6 @@ button.chip {
|
||||
}
|
||||
|
||||
/* season disclosure: the lead of a season row */
|
||||
.r-lead .disclose-lead {
|
||||
border-color: var(--line);
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
.disclose-lead .icon {
|
||||
transition: transform 200ms var(--ease-out);
|
||||
}
|
||||
@@ -1514,13 +1202,6 @@ button.chip {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
.page-head > .control-icon {
|
||||
flex: none;
|
||||
border-color: transparent;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.page-id {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
@@ -1658,14 +1339,6 @@ button.chip {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.actionbar > .control-icon:last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.trailer-link .control-word {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.more-panel {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
@@ -1692,12 +1365,6 @@ button.chip {
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.more-toggles .toggle,
|
||||
.more-panel > .control {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.more-field {
|
||||
display: grid;
|
||||
}
|
||||
@@ -1726,15 +1393,6 @@ button.chip {
|
||||
font-size: var(--text-xl);
|
||||
}
|
||||
|
||||
.trailer-link .control-word {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.trailer-link {
|
||||
width: auto;
|
||||
padding: 0 var(--space-4);
|
||||
}
|
||||
|
||||
.more-panel {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
align-items: end;
|
||||
@@ -1805,11 +1463,6 @@ button.chip {
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.remove-body[data-armed="true"] .remove-actions .control:first-child:not(:disabled) {
|
||||
color: var(--signal-warn);
|
||||
border-color: oklch(from var(--signal-warn) l c h / 55%);
|
||||
}
|
||||
|
||||
/* ---- release deck (§9.3) ------------------------------------------------- */
|
||||
|
||||
.buckets {
|
||||
@@ -1943,12 +1596,6 @@ button.chip {
|
||||
padding-top: var(--space-3);
|
||||
}
|
||||
|
||||
.subs-langs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.subs-field {
|
||||
flex: 1 1 12rem;
|
||||
min-width: 9rem;
|
||||
|
||||
Reference in New Issue
Block a user