diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 23aae3a669..3a8be5b0cb 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -50,7 +50,7 @@ never copied: | Kit class | Look | Rules | | --- | --- | --- | | `UiButton` `variant="ghost"` (default) | none: the caller's classes style it | — | -| `UiButton` `variant="action"` | the action surface (`gev-action-button`); `tone="danger"` hovers red, `size="compact"` is the shot-row footprint | `src/ui/styles/action-button.css` | +| `UiButton` `variant="action"` | the action surface (`gev-action-button`); `tone="danger"` hovers red, `size="compact"` is the shot-row footprint (on this variant only) | `src/ui/styles/action-button.css` | | `UiButton` `variant="primary"` | the action surface with a group's main-action accent | `src/ui/styles/action-button.css` | | `UiButton` `variant="icon"` | the 22px square glyph button of a panel's collapse toggle | `src/ui/styles/controls.css` | | `UiChip` | the read-only chip (a pill of uppercase mono text); `selected` takes the accent | `src/ui/styles/chip.css` | @@ -58,10 +58,15 @@ never copied: | `UiBadge` | the read-only badge (`gev-status-badge`) | `src/ui/styles/status-badge.css` | | `UiSegmented` | the segmented control (`gev-segmented`, `gev-segment`) | `src/ui/styles/segmented-control.css` | -A pressed action, primary or icon button looks as a hovered one does. Each -look's resting rule selects one kit class, in a skin loaded before the feature -stylesheets, so a feature class still wins; and a converted control keeps its own classes -beside the kit's. `src/ui/kit/kitStyles.test.mjs` pins these rules. +A pressed action, primary or icon button looks as a hovered regular one does +(a compact action's quieter hover is for an unpressed button), and a disabled +one dims and ignores hover and press. `tone` is `accent` or `danger`, and +`size` styles the action variant only. Each look's resting rule selects one +kit class; the button, chip and empty-state skins load before the feature +stylesheets that restyle them, so a feature class still wins. The badge and +segmented skins are the stylesheets their Core classes always used. A +converted control keeps its own classes beside the kit's. +`src/ui/kit/kitStyles.test.mjs` pins these rules. `UiPanel` takes a `title`, slots and `v-model:collapsed`, but its `collapsed` drives only the button and `ui-panel--collapsed`: the root's `collapsed` class, which hides the body, is drawn at once by `v-panel-state` @@ -91,8 +96,8 @@ gain) takes `hold`. Every select in the views is a `UiSelect`. density variants and colours stay caller classes, and it renders the CCTV source and calibration badges and the rail card badges. `UiEmpty` takes a `title` and `hint`, but Core's empty states are one line, so the title -is the text itself rather than a bold heading; the Scene shot list, mission -roster and imagery strip use it. The locale picker's and the mission tables' +is the text itself rather than a bold heading; the News feed, Scene shot +list, mission roster and imagery strip use it. The locale picker's and the mission tables' empty rows stay a paragraph and table cells. `UiSlider` keeps the native range input rather than drawing a `role="slider"` track, so Core's keyboard, form behaviour and styling stay; diff --git a/src/ui/kit/UiButton.vue b/src/ui/kit/UiButton.vue index a637574d94..11d43b0d5e 100644 --- a/src/ui/kit/UiButton.vue +++ b/src/ui/kit/UiButton.vue @@ -14,7 +14,10 @@ import { vClassToggle } from '../rail/classToggle.js'; // action (action-button.css). // - `icon` is the 22px square glyph button of a panel's collapse toggle // (controls.css). -// A pressed action, primary or icon button looks as a hovered one does. Each +// A pressed action, primary or icon button looks as a hovered regular one +// does (a compact action's quieter hover is for an unpressed button); a +// disabled one dims and ignores hover and press. `size` styles the action +// variant only. Each // resting rule selects one kit class, so a feature class loaded later still // wins. Core adds `pressedClass`, its class on a pressed button (most // toggles use `active`). The pressed classes toggle through `classList`, so @@ -31,7 +34,11 @@ const props = defineProps({ ['ghost', 'action', 'primary', 'icon'].includes(value), }, /** `accent`, or `danger` for an action that destroys or stops. */ - tone: { type: String, default: 'accent' }, + tone: { + type: String, + default: 'accent', + validator: (value) => ['accent', 'danger'].includes(value), + }, /** `compact` for an action's smaller footprint. */ size: { type: String, diff --git a/src/ui/kit/kitStyles.test.mjs b/src/ui/kit/kitStyles.test.mjs index 1841f3f731..adb966ca2f 100644 --- a/src/ui/kit/kitStyles.test.mjs +++ b/src/ui/kit/kitStyles.test.mjs @@ -17,7 +17,15 @@ function rules(source) { const prelude = match[1].split('}').pop().trim(); if (prelude.startsWith('@')) continue; out.push({ - selectors: prelude.split(',').map((s) => s.replace(/\s+/g, ' ').trim()), + selectors: prelude + .split(',') + .map((s) => + s + .replace(/\s+/g, ' ') + .replace(/\( /g, '(') + .replace(/ \)/g, ')') + .trim(), + ), body: match[2], }); } @@ -55,13 +63,21 @@ test('UiButton variants wear Core’s action and icon skins', () => { '.ui-button--primary:where(:not(:disabled))', '#scene-panel .scene-btn-primary:not(:disabled)', ); - shares('.ui-button--compact', '.gev-action-button--compact'); shares( - '.ui-button--compact.ui-button--danger:hover:not(:disabled)', + '.ui-button--compact:where(.ui-button--action)', + '.gev-action-button--compact', + ); + shares( + '.ui-button--compact:where(.ui-button--action):hover:not(:disabled):not(.ui-button--pressed)', + '.gev-action-button--compact:hover:not(:disabled)', + ); + shares( + '.ui-button--compact.ui-button--danger:where(.ui-button--action):hover:not(:disabled)', '.gev-action-button--compact.gev-action-button--danger:hover:not(:disabled)', ); shares('.ui-button--icon', '.panel-collapse-btn'); - shares('.ui-button--icon:hover', '.panel-collapse-btn:hover'); + shares('.ui-button--icon:hover:not(:disabled)', '.panel-collapse-btn:hover'); + assert.match(ruleWith('.ui-button--icon:disabled').body, /opacity:\s*0\.45/); }); test('a pressed styled button looks as a hovered one does', () => { @@ -77,13 +93,17 @@ test('a pressed styled button looks as a hovered one does', () => { '.ui-button--action.ui-button--danger.ui-button--pressed:not(:disabled)', '.gev-action-button--danger:hover:not(:disabled)', ); - shares('.ui-button--icon.ui-button--pressed', '.panel-collapse-btn:hover'); + shares( + '.ui-button--icon.ui-button--pressed:not(:disabled)', + '.panel-collapse-btn:hover', + ); }); -test('a ghost button and the tones alone carry no style', () => { +test('a ghost button, the tones and the size alone carry no style', () => { const kitButton = - /\.ui-button(?:--(?:ghost|accent|danger|alert|pressed))?(?![\w-])/; - const look = /\.ui-button--(?:action|primary|icon|compact)(?![\w-])/; + /\.ui-button(?:--(?:ghost|accent|danger|pressed|compact))?(?![\w-])/; + // size="compact" styles the action variant only. + const look = /\.ui-button--(?:action|primary|icon)(?![\w-])/; for (const rule of all) for (const selector of rule.selectors) assert.ok( @@ -133,3 +153,20 @@ test('the kit’s skins load before the feature stylesheets that restyle them', ); } }); + +test('feature rules over a kit skin keep the type they inherit', () => { + // The chip and empty skins set a font and colour; these feature surfaces + // inherit theirs from the card or strip around them. + for (const [selector, property] of [ + ['.gev-voice-card-chip', /font:\s*inherit/], + ['.scene-shot-empty', /font:\s*inherit/], + ['.recent-imagery-readout .ri-strip-empty', /font:\s*inherit/], + ['.recent-imagery-readout .ri-strip-empty', /color:\s*inherit/], + ]) + assert.ok( + all.some( + (rule) => rule.selectors.includes(selector) && property.test(rule.body), + ), + `${selector} keeps ${property}`, + ); +}); diff --git a/src/ui/styles/action-button.css b/src/ui/styles/action-button.css index da49a78137..3872c60f02 100644 --- a/src/ui/styles/action-button.css +++ b/src/ui/styles/action-button.css @@ -24,7 +24,8 @@ white-space: nowrap; } -/* A pressed kit action looks as a hovered one does. */ +/* A pressed kit action looks as a hovered regular one does (a compact one + too: its quieter hover below is for an unpressed button). */ .ui-button--action:hover:not(:disabled), .ui-button--primary:hover:not(:disabled), .ui-button--action.ui-button--pressed:not(:disabled), @@ -65,8 +66,9 @@ } /* Shot-row actions retain their smaller footprint and quieter hover treatment - (size="compact"). */ -.ui-button--compact, + (size="compact", on the action variant only: :where keeps the kit + selector at one class's weight). */ +.ui-button--compact:where(.ui-button--action), .gev-action-button--compact { border-radius: 6px; font-size: 8px; @@ -75,14 +77,18 @@ } /* A pressed compact action keeps its pressed look under the pointer. */ -.ui-button--compact:hover:not(:disabled):not(.ui-button--pressed), +.ui-button--compact:where(.ui-button--action):hover:not(:disabled):not( + .ui-button--pressed + ), .gev-action-button--compact:hover:not(:disabled) { color: var(--text-primary); border-color: var(--glass-border-hover); background: rgba(255, 255, 255, 0.05); } -.ui-button--compact.ui-button--danger:hover:not(:disabled), +.ui-button--compact.ui-button--danger:where(.ui-button--action):hover:not( + :disabled + ), .gev-action-button--compact.gev-action-button--danger:hover:not(:disabled) { color: #ff7e7e; border-color: #ff7e7e; diff --git a/src/ui/styles/controls.css b/src/ui/styles/controls.css index fc313192f4..fd9c3788cd 100644 --- a/src/ui/styles/controls.css +++ b/src/ui/styles/controls.css @@ -209,14 +209,19 @@ html:not([lang='en']):not(:lang(zh)):not(:lang(ja)) } /* A pressed kit icon button looks as a hovered one does. */ -.ui-button--icon:hover, -.ui-button--icon.ui-button--pressed, +.ui-button--icon:hover:not(:disabled), +.ui-button--icon.ui-button--pressed:not(:disabled), .panel-collapse-btn:hover { border-color: var(--glass-border-hover); color: var(--text-primary); background: rgba(255, 255, 255, 0.07); } +.ui-button--icon:disabled { + opacity: 0.45; + cursor: default; +} + /* A side panel answers the pointer as the command dock's trays do: a brighter edge and an accent title and toggle. Touch screens have no hover, so a tap must not leave a panel lit. */ diff --git a/src/ui/views/LayerPanelsView.vue b/src/ui/views/LayerPanelsView.vue index d310e5f8f9..f19e24a4db 100644 --- a/src/ui/views/LayerPanelsView.vue +++ b/src/ui/views/LayerPanelsView.vue @@ -78,7 +78,7 @@ async function importChosen(event) {
{{ t('NEW SCENE') }} - {{ t('DELETE') }} + {{ t('DELETE') }}

{{ t('SHOTS') }}

@@ -90,7 +90,7 @@ async function importChosen(event) {

{{ t('PREVIEW') }}

{{ scene?.playLabel ?? t('PLAY', { context: 'scene' }) }} - {{ t('STOP') }} + {{ t('STOP') }} {{ t('NEXT') }}

{{ t('SAVE & SHARE') }}

diff --git a/src/ui/views/SceneShotList.vue b/src/ui/views/SceneShotList.vue index ca80fae3cd..48d4db6387 100644 --- a/src/ui/views/SceneShotList.vue +++ b/src/ui/views/SceneShotList.vue @@ -161,7 +161,7 @@ function onRenameKey(shot, event) { > {{ t('DEL') }}