Vue kit: compact styles the action variant only, tone is accent or danger, a disabled icon button dims; pin the inherited type

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 23:51:16 -08:00
1 parent 4114ea1a05
commit 0d3c3325d4
7 files changed
+87 -27

No files matched your search

+9 -2
View File
@@ -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,
+45 -8
View File
@@ -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}`,
);
});
+11 -5
View File
@@ -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;
+7 -2
View File
@@ -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. */
+2 -2
View File
@@ -78,7 +78,7 @@ async function importChosen(event) {
<div class="scene-controls">
<UiSelect class="gev-field" id="scene-select" :aria-label="t('Scene')" :disabled="off('select')" @update:model-value="scenes.act('selectScene', $event)"><SceneOptions /></UiSelect>
<UiButton id="scene-new-btn" type="button" :disabled="off('new')" @click="scenes.act('create')" class="gev-action-button scene-btn" :title="t('Start a new, empty scene')">{{ t('NEW SCENE') }}</UiButton>
<UiButton tone="alert" id="scene-delete-btn" type="button" :disabled="off('delete')" @click="scenes.act('deleteScene')" class="gev-action-button gev-action-button--danger scene-btn scene-btn-danger" :title="t('Delete this scene and all of its shots')">{{ t('DELETE') }}</UiButton>
<UiButton tone="danger" id="scene-delete-btn" type="button" :disabled="off('delete')" @click="scenes.act('deleteScene')" class="gev-action-button gev-action-button--danger scene-btn scene-btn-danger" :title="t('Delete this scene and all of its shots')">{{ t('DELETE') }}</UiButton>
</div>
<p class="scene-step-heading">{{ t('SHOTS') }}</p>
<div class="scene-controls">
@@ -90,7 +90,7 @@ async function importChosen(event) {
<p class="scene-step-heading">{{ t('PREVIEW') }}</p>
<div class="scene-controls">
<UiButton variant="primary" id="scene-start-btn" type="button" class="gev-action-button scene-btn scene-btn-primary" :title="t('Play from this scene through the rest of the project')" :disabled="off('start')" @click="scenes.act('start')">{{ scene?.playLabel ?? t('PLAY', { context: 'scene' }) }}</UiButton>
<UiButton tone="alert" id="scene-stop-btn" type="button" :disabled="off('stop')" @click="scenes.act('stop')" class="gev-action-button gev-action-button--danger scene-btn scene-btn-danger" :title="t('Stop playback (Esc)')">{{ t('STOP') }}</UiButton>
<UiButton tone="danger" id="scene-stop-btn" type="button" :disabled="off('stop')" @click="scenes.act('stop')" class="gev-action-button gev-action-button--danger scene-btn scene-btn-danger" :title="t('Stop playback (Esc)')">{{ t('STOP') }}</UiButton>
<UiButton id="scene-next-btn" type="button" :disabled="off('next')" @click="scenes.act('next')" class="gev-action-button scene-btn" :title="t('Play the shot after the selected one, moving on to the next scene when needed')">{{ t('NEXT') }}</UiButton>
</div>
<p class="scene-step-heading">{{ t('SAVE & SHARE') }}</p>
+1 -1
View File
@@ -161,7 +161,7 @@ function onRenameKey(shot, event) {
><UiIcon name="arrow_downward" :size="12"
/></UiButton>
<UiButton
tone="alert"
tone="danger"
class="gev-action-button gev-action-button--danger gev-action-button--compact scene-shot-btn scene-shot-danger"
@click="act('remove', shot)"
>{{ t('DEL') }}</UiButton