mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Merge pull request #1842 from bilawalsidhu/samehkhamis/kit-checkbox
Vue kit: UiCheckbox for the Visual, voice, Data Library and welcome checkboxes
This commit is contained in:
19 files changed
+389
-41
No files matched your search
@@ -0,0 +1,4 @@
|
||||
- The Visual panel's toggles, the voice settings, the Data Library's
|
||||
"available only" box and the welcome screen's "Don't show this again" are
|
||||
now one kit component, `UiCheckbox`, with the same look and behaviour as
|
||||
before (manjunath22466, samehkhamis, #1842).
|
||||
+17
-1
@@ -38,7 +38,7 @@ one-panel rule too. Share links continue to record which panels are open.
|
||||
|
||||
`src/ui/kit/` holds the generic components: `UiRail`, `UiTooltip`, `UiIcon`,
|
||||
`UiButton`, `UiCloseButton`, `UiPanel`, `UiSegmented`, `UiSlider`, `UiChip`,
|
||||
`UiSelect`, `UiSearchField`, `UiBadge` and `UiEmpty` so far, with more
|
||||
`UiSelect`, `UiSearchField`, `UiCheckbox`, `UiBadge` and `UiEmpty` so far, with more
|
||||
joining as the controls they serve are converted. One component
|
||||
serves every use of a control, with props for the differences (`UiPanel`'s
|
||||
`sideways`, `glow`, `scroll`), rather than a copy per panel. The components
|
||||
@@ -55,6 +55,7 @@ never copied:
|
||||
| `UiButton` `variant="icon"` | the 22px square glyph button of a panel's collapse toggle | `src/ui/styles/controls.css` |
|
||||
| `UiCloseButton` | a close, dismiss or clear button: a bare glyph (× with `glyph="times"`, the Material `close` symbol with `glyph="icon"`) with no padding, border or background of its own and a pointer; the site's feature class sets size, colour, hover and any surface, and `bare` leaves the look off for a skin that sets its own padding and border | `src/ui/styles/close-button.css` |
|
||||
| `UiSearchField` | a search field: the Material `search` glyph and a search input in a flex row, the input bare (no border or background, free to shrink); the site's feature classes set the frame's size, surface and focus ring and the input's type and outline, and the browser's own cancel button is left to each skin | `src/ui/styles/search-field.css` |
|
||||
| `UiCheckbox` | a checkbox: a label wrapping a native box and its words in a centred flex row; the box keeps each site's size, margin and accent colour, and the site's feature class sets the row's gap, direction and colour | `src/ui/styles/checkbox.css` |
|
||||
| `UiChip` | the read-only chip (a pill of uppercase mono text); `selected` takes the accent | `src/ui/styles/chip.css` |
|
||||
| `UiEmpty` | the one-line empty state (dim mono text), its hint on a line below | `src/ui/styles/empty-state.css` |
|
||||
| `UiBadge` | the read-only badge (`gev-status-badge`) | `src/ui/styles/status-badge.css` |
|
||||
@@ -120,6 +121,21 @@ focuses the input. The Context search and the Layer Finder's are
|
||||
`UiSearchField`s; the locale picker's combobox, the Omnibar's location
|
||||
field and the Data Library's labelled search are other controls. Its kit rules hold the declarations both search
|
||||
skins had in common, moved rather than copied, and load before them.
|
||||
`UiCheckbox` is a `<label>` wrapping a native `<input type="checkbox">` and
|
||||
its default slot; `trailing` puts the box after the words, as the Visual
|
||||
panel's rows have it. It takes `v-model` (the change emits the checked state)
|
||||
and emits `change` with its event; without a `modelValue` the box is the
|
||||
browser's own, as the welcome card's "Don't show this again" is, whose
|
||||
owner puts a refused save back itself. `restore` puts the box back to
|
||||
`modelValue` once a change has rendered without the owner taking it, so the
|
||||
voice panel's quick commands and Voice Preview show the applied value after
|
||||
a refused change. Attributes and classes go to the label; `inputId` and
|
||||
`inputAttrs` (such as `aria-describedby` or a data hook) to the box. The
|
||||
Visual panel's Scope, sky and application toggles, the voice and chat
|
||||
preferences, the Data Library's filter and the welcome card's box are
|
||||
`UiCheckbox`es (`src/ui/kit/checkboxes.test.mjs` pins it); Story Explore's
|
||||
filters are not converted yet. Its kit rule holds the centred row the
|
||||
checkbox-only labels drew, moved rather than copied.
|
||||
`UiSlider` keeps the native range input rather than drawing a
|
||||
`role="slider"` track, so Core's keyboard, form behaviour and styling stay;
|
||||
it takes `v-model`, `min`, `max`, `step` and `disabled`, emits a
|
||||
|
||||
@@ -1336,6 +1336,10 @@
|
||||
"src/ui/kit/UiSearchField.vue",
|
||||
"src/ui/kit/UiSearchField.test.mjs",
|
||||
"src/ui/styles/search-field.css",
|
||||
"src/ui/kit/UiCheckbox.vue",
|
||||
"src/ui/kit/UiCheckbox.test.mjs",
|
||||
"src/ui/kit/checkboxes.test.mjs",
|
||||
"src/ui/styles/checkbox.css",
|
||||
"src/ui/styles/chip.css",
|
||||
"src/ui/styles/empty-state.css",
|
||||
"src/ui/rail/RailChips.vue",
|
||||
|
||||
@@ -243,6 +243,7 @@
|
||||
"src/ui/kit/UiBadge.vue",
|
||||
"src/ui/kit/UiCloseButton.vue",
|
||||
"src/ui/kit/UiSearchField.vue",
|
||||
"src/ui/kit/UiCheckbox.vue",
|
||||
"src/ui/stores/globeActions.js",
|
||||
"src/ui/views/panels/GlobeActions.vue",
|
||||
"src/ui/views/panels/RenderFailure.vue",
|
||||
|
||||
@@ -454,10 +454,10 @@ const MUTATIONS = [
|
||||
to: '<button type="button" data-first-run-start="zzz-environmental"',
|
||||
},
|
||||
{
|
||||
defect: 'the "don\'t show again" checkbox is removed',
|
||||
defect: 'the "don\'t show again" checkbox loses its hook',
|
||||
file: 'html',
|
||||
from: '<input type="checkbox" data-first-run-suppress @change="onSuppress" />',
|
||||
to: '<span data-first-run-suppress-removed></span>',
|
||||
from: '<UiCheckbox class="first-run-suppress" :input-attrs="suppressBoxAttrs" @change="onSuppress">',
|
||||
to: '<UiCheckbox class="first-run-suppress" @change="onSuppress">',
|
||||
},
|
||||
{
|
||||
defect: 'the status line stops being a polite live region',
|
||||
|
||||
@@ -768,7 +768,10 @@ test('markup, startup ordering and accessibility remain pinned', async () => {
|
||||
html,
|
||||
/data-first-run-status[^>]*role="status"[^>]*aria-live="polite"/,
|
||||
);
|
||||
assert.match(html, /<input type="checkbox" data-first-run-suppress\s*\/?>/);
|
||||
assert.match(
|
||||
html,
|
||||
/<input type="checkbox" class="ui-checkbox__input" data-first-run-suppress\s*\/?>/,
|
||||
);
|
||||
|
||||
assert.match(startup, /styleManager\.initialRestorePromise/);
|
||||
assert.ok(
|
||||
|
||||
@@ -24,7 +24,8 @@ test('HUD sliders and location search have descriptive explicit names', () => {
|
||||
test('the first-run checkbox keeps its native visible label', () => {
|
||||
// The span may carry a data-i18n extraction attribute; the native wrapping
|
||||
// label contract is what this guards.
|
||||
assert.match(html, /<label\b[^>]*class="first-run-suppress"[^>]*>\s*<input type="checkbox" data-first-run-suppress\s*\/?>\s*<span\b[^>]*>Don't show this again<\/span>\s*<\/label>/);
|
||||
// UiCheckbox leaves Vue's placeholder comment where its unused slot would be.
|
||||
assert.match(html, /<label\b[^>]*class="ui-checkbox first-run-suppress"[^>]*>(?:\s*<!--v-if-->)?\s*<input type="checkbox" class="ui-checkbox__input" data-first-run-suppress\s*\/?>\s*<span\b[^>]*>Don't show this again<\/span>(?:\s*<!--v-if-->)?\s*<\/label>/);
|
||||
});
|
||||
|
||||
test('generated style sliders use the visible parameter label as their name', () => {
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
import { after, before, test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { installVueDom } from '../../testSupport/vueDom.mjs';
|
||||
|
||||
let mount;
|
||||
let nextTick;
|
||||
let UiCheckbox;
|
||||
let uninstall;
|
||||
before(async () => {
|
||||
uninstall = installVueDom();
|
||||
({ mount } = await import('@vue/test-utils'));
|
||||
({ nextTick } = await import('vue'));
|
||||
UiCheckbox = (await import('./UiCheckbox.vue')).default;
|
||||
});
|
||||
after(() => uninstall());
|
||||
|
||||
/** A checkbox whose v-model writes back into its props, as a parent's would. */
|
||||
function bound(props = {}, attrs = {}) {
|
||||
const wrapper = mount(UiCheckbox, {
|
||||
attachTo: document.body,
|
||||
props: {
|
||||
modelValue: false,
|
||||
...props,
|
||||
'onUpdate:modelValue': (value) => wrapper.setProps({ modelValue: value }),
|
||||
},
|
||||
attrs,
|
||||
slots: { default: '<span class="words">Scope</span>' },
|
||||
});
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/** Tick the box as a person does: flip it, then the change event. */
|
||||
async function tick(input) {
|
||||
input.element.checked = !input.element.checked;
|
||||
await input.trigger('change');
|
||||
}
|
||||
|
||||
test('a checkbox is a label wrapping a native box, then its words', () => {
|
||||
const wrapper = bound();
|
||||
const root = wrapper.get('label');
|
||||
assert.ok(root.classes().includes('ui-checkbox'));
|
||||
const input = wrapper.get('input');
|
||||
assert.equal(input.attributes('type'), 'checkbox');
|
||||
assert.ok(input.classes().includes('ui-checkbox__input'));
|
||||
assert.equal(input.attributes('id'), undefined);
|
||||
const elements = [...root.element.children];
|
||||
assert.deepEqual(
|
||||
elements.map((el) => el.tagName),
|
||||
['INPUT', 'SPAN'],
|
||||
);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('trailing puts the box after its words', () => {
|
||||
const wrapper = bound({ trailing: true });
|
||||
assert.deepEqual(
|
||||
[...wrapper.get('label').element.children].map((el) => el.tagName),
|
||||
['SPAN', 'INPUT'],
|
||||
);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('attributes and classes go to the label; inputId and inputAttrs to the box', () => {
|
||||
const wrapper = bound(
|
||||
{
|
||||
inputId: 'scope-toggle',
|
||||
inputAttrs: { 'aria-describedby': 'note', 'data-hook': '' },
|
||||
},
|
||||
{ class: 'pp-scope-toggle', title: 'Scope', id: 'scope-row' },
|
||||
);
|
||||
const root = wrapper.get('label');
|
||||
assert.ok(root.classes().includes('pp-scope-toggle'));
|
||||
assert.equal(root.attributes('title'), 'Scope');
|
||||
assert.equal(root.attributes('id'), 'scope-row');
|
||||
const input = wrapper.get('input');
|
||||
assert.equal(input.attributes('id'), 'scope-toggle');
|
||||
assert.equal(input.attributes('aria-describedby'), 'note');
|
||||
assert.equal(input.attributes('data-hook'), '');
|
||||
assert.equal(input.attributes('title'), undefined);
|
||||
assert.ok(!input.classes().includes('pp-scope-toggle'));
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('v-model shows the value and reports each change', async () => {
|
||||
const wrapper = bound({ modelValue: true });
|
||||
const input = wrapper.get('input');
|
||||
assert.equal(input.element.checked, true);
|
||||
await tick(input);
|
||||
assert.deepEqual(wrapper.emitted('update:modelValue').at(-1), [false]);
|
||||
assert.equal(wrapper.emitted('change').at(-1)[0].target, input.element);
|
||||
assert.equal(input.element.checked, false);
|
||||
await tick(input);
|
||||
assert.deepEqual(wrapper.emitted('update:modelValue').at(-1), [true]);
|
||||
// A parent that resets its value resets the box.
|
||||
await wrapper.setProps({ modelValue: false });
|
||||
assert.equal(input.element.checked, false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('without restore a change the owner ignores stays ticked, as :checked did', async () => {
|
||||
const wrapper = mount(UiCheckbox, { props: { modelValue: false } });
|
||||
const input = wrapper.get('input');
|
||||
await tick(input);
|
||||
await nextTick();
|
||||
assert.deepEqual(wrapper.emitted('update:modelValue'), [[true]]);
|
||||
assert.equal(input.element.checked, true);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('restore puts a refused change back and keeps an accepted one', async () => {
|
||||
// Refused: the owner keeps its value.
|
||||
const refused = mount(UiCheckbox, {
|
||||
props: { modelValue: true, restore: true },
|
||||
});
|
||||
const box = refused.get('input');
|
||||
await tick(box);
|
||||
assert.deepEqual(refused.emitted('update:modelValue'), [[false]]);
|
||||
await nextTick();
|
||||
assert.equal(box.element.checked, true);
|
||||
refused.unmount();
|
||||
// Accepted: the owner takes the change before the box is checked again.
|
||||
const accepted = bound({ modelValue: true, restore: true });
|
||||
const input = accepted.get('input');
|
||||
await tick(input);
|
||||
await nextTick();
|
||||
assert.equal(input.element.checked, false);
|
||||
assert.equal(accepted.props('modelValue'), false);
|
||||
accepted.unmount();
|
||||
});
|
||||
|
||||
test('without a modelValue the box is the browser’s own', async () => {
|
||||
const wrapper = mount(UiCheckbox, {
|
||||
props: { inputAttrs: { 'data-first-run-suppress': '' } },
|
||||
});
|
||||
const input = wrapper.get('input');
|
||||
assert.equal(input.element.checked, false);
|
||||
await tick(input);
|
||||
assert.equal(input.element.checked, true);
|
||||
assert.equal(wrapper.emitted('change').length, 1);
|
||||
// Rendering again leaves what was ticked alone.
|
||||
await wrapper.setProps({ inputId: 'suppress' });
|
||||
assert.equal(input.attributes('id'), 'suppress');
|
||||
assert.equal(input.element.checked, true);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('a change listener sees the box as the event’s current target', async () => {
|
||||
let seen = null;
|
||||
const wrapper = mount(UiCheckbox, {
|
||||
attrs: {
|
||||
onChange: (event) => {
|
||||
seen = event.currentTarget;
|
||||
},
|
||||
},
|
||||
});
|
||||
const input = wrapper.get('input');
|
||||
await tick(input);
|
||||
assert.equal(seen, input.element);
|
||||
// The label itself does not hear the box's change a second time.
|
||||
assert.equal(wrapper.emitted('change').length, 1);
|
||||
wrapper.unmount();
|
||||
});
|
||||
@@ -0,0 +1,57 @@
|
||||
<script setup>
|
||||
import { nextTick, ref } from 'vue';
|
||||
|
||||
// Core's checkbox: a `<label>` wrapping a native `<input type="checkbox">`
|
||||
// and the default slot, which names it. The box comes first, or after the
|
||||
// slot with `trailing`. Attributes and classes pass through to the label, so
|
||||
// each site keeps its feature class and tip; the input takes `inputId` and
|
||||
// `inputAttrs` (other attributes it needs, such as aria-describedby or a
|
||||
// data hook). With v-model the box shows `modelValue` and a change emits the
|
||||
// checked state; `change` is emitted with the event too. Without a
|
||||
// modelValue the box is the browser's own and keeps whatever is ticked.
|
||||
// `restore` puts the box back to `modelValue` after a change its owner did
|
||||
// not take, so a refused preference shows the applied value again. The kit
|
||||
// classes `ui-checkbox` and `ui-checkbox__input` (checkbox.css) are the
|
||||
// label's centred flex row and the box, which keeps each skin's look.
|
||||
const props = defineProps({
|
||||
modelValue: { type: Boolean, default: undefined },
|
||||
inputId: { type: String, default: undefined },
|
||||
inputAttrs: { type: Object, default: undefined },
|
||||
trailing: { type: Boolean, default: false },
|
||||
restore: { type: Boolean, default: false },
|
||||
});
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
const input = ref(null);
|
||||
|
||||
function onChange(event) {
|
||||
emit('update:modelValue', event.target.checked);
|
||||
emit('change', event);
|
||||
if (!props.restore) return;
|
||||
// The owner has answered once the update it caused has rendered.
|
||||
nextTick(() => {
|
||||
const box = input.value;
|
||||
if (
|
||||
box &&
|
||||
props.modelValue !== undefined &&
|
||||
box.checked !== props.modelValue
|
||||
)
|
||||
box.checked = props.modelValue;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<label class="ui-checkbox">
|
||||
<slot v-if="props.trailing" />
|
||||
<input
|
||||
ref="input"
|
||||
type="checkbox"
|
||||
:id="props.inputId"
|
||||
class="ui-checkbox__input"
|
||||
v-bind="props.inputAttrs"
|
||||
:checked="props.modelValue"
|
||||
@change="onChange"
|
||||
/>
|
||||
<slot v-if="!props.trailing" />
|
||||
</label>
|
||||
</template>
|
||||
@@ -0,0 +1,70 @@
|
||||
// Every checkbox in a Vue view is a UiCheckbox: no SFC template hand-writes
|
||||
// `<input type="checkbox">`. Story Explore's filters are not converted yet.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
|
||||
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
|
||||
const NOT_YET = new Set([
|
||||
'src/ui/kit/UiCheckbox.vue',
|
||||
'src/ui/views/stories/ExploreScreen.vue',
|
||||
]);
|
||||
|
||||
/** Every SFC under src. */
|
||||
function sfcFiles(directory = SRC_ROOT) {
|
||||
const files = [];
|
||||
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
||||
const absolute = path.join(directory, entry.name);
|
||||
if (entry.isDirectory()) files.push(...sfcFiles(absolute));
|
||||
else if (entry.isFile() && entry.name.endsWith('.vue'))
|
||||
files.push(absolute);
|
||||
}
|
||||
return files.sort();
|
||||
}
|
||||
|
||||
/** The template block: everything outside script and style. */
|
||||
function template(source) {
|
||||
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
}
|
||||
|
||||
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
|
||||
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
|
||||
const HAND_WRITTEN_CHECKBOX = new RegExp(
|
||||
String.raw`<input\b${ATTRS}\btype="checkbox"${ATTRS}>`,
|
||||
'gi',
|
||||
);
|
||||
|
||||
/** Hand-written checkboxes in an SFC's template. */
|
||||
function handWrittenCheckboxes(source) {
|
||||
return [...template(source).matchAll(HAND_WRITTEN_CHECKBOX)].map((m) =>
|
||||
m[0].replace(/\s+/g, ' '),
|
||||
);
|
||||
}
|
||||
|
||||
test('the scan finds each hand-written checkbox', () => {
|
||||
for (const markup of [
|
||||
'<template><input type="checkbox" id="x" @change="on" /></template>',
|
||||
'<template><input\n :checked="a > b"\n type="checkbox"\n/></template>',
|
||||
])
|
||||
assert.equal(handWrittenCheckboxes(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiCheckbox input-id="x" v-model="on">On</UiCheckbox></template>',
|
||||
'<template><input type="search" /></template>',
|
||||
'<script>const html = \'<input type="checkbox">\';</script><template><p /></template>',
|
||||
])
|
||||
assert.equal(handWrittenCheckboxes(markup).length, 0, markup);
|
||||
});
|
||||
|
||||
test('no SFC hand-writes a checkbox; each is a UiCheckbox', () => {
|
||||
const found = [];
|
||||
for (const file of sfcFiles()) {
|
||||
const relative = path.relative(REPO_ROOT, file).split(path.sep).join('/');
|
||||
if (NOT_YET.has(relative)) continue;
|
||||
for (const markup of handWrittenCheckboxes(readFileSync(file, 'utf8')))
|
||||
found.push(`${relative}: ${markup}`);
|
||||
}
|
||||
assert.deepEqual(found, []);
|
||||
});
|
||||
@@ -188,6 +188,31 @@ test('UiSearchField owns the row and bare input both search skins drew', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('UiCheckbox owns the centred row the checkbox-only labels drew', () => {
|
||||
const label = ruleWith('.ui-checkbox');
|
||||
assert.deepEqual(label.selectors, ['.ui-checkbox']);
|
||||
assert.match(label.body, /display:\s*flex;/);
|
||||
assert.match(label.body, /align-items:\s*center;/);
|
||||
// The box keeps each skin's size, margin and accent colour.
|
||||
assert.ok(
|
||||
!all.some((rule) =>
|
||||
rule.selectors.some((s) => s.startsWith('.ui-checkbox__input')),
|
||||
),
|
||||
);
|
||||
// Labels that hold only a checkbox leave the row to the kit; the Visual
|
||||
// and voice rows share their classes with buttons and other labels, so
|
||||
// theirs stay.
|
||||
for (const selector of ['.first-run-suppress', '.data-library-check']) {
|
||||
const feature = ruleWith(selector);
|
||||
for (const property of ['display', 'align-items'])
|
||||
assert.doesNotMatch(
|
||||
feature.body,
|
||||
new RegExp(`(^|[\\s;])${property}:`),
|
||||
`${selector} leaves ${property} to the kit`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('the kit’s skins load before the feature stylesheets that restyle them', () => {
|
||||
const at = (selector) => css.indexOf(selector);
|
||||
for (const [kit, feature] of [
|
||||
@@ -211,6 +236,10 @@ test('the kit’s skins load before the feature stylesheets that restyle them',
|
||||
['.ui-search-field {', '.layer-finder__field {'],
|
||||
['.ui-search-field__input {', '.context-search__input {'],
|
||||
['.ui-search-field__input {', '.layer-finder__field input {'],
|
||||
['.ui-checkbox {', '.pp-toggle-btn {'],
|
||||
['.ui-checkbox {', '.gev-voice-preference {'],
|
||||
['.ui-checkbox {', '.data-library-check {'],
|
||||
['.ui-checkbox {', '.first-run-suppress {'],
|
||||
]) {
|
||||
assert.ok(
|
||||
at(kit) >= 0 && at(feature) > at(kit),
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/* Core's checkboxes are a label wrapping the box and its words, laid out in
|
||||
* a centred flex row: the kit's UiCheckbox wears it as .ui-checkbox. The rule
|
||||
* selects one class and loads before the feature stylesheets, so a feature
|
||||
* rule still sets the row's gap, direction, size and colour. The box,
|
||||
* .ui-checkbox__input, keeps each skin's size, margin and accent colour. */
|
||||
.ui-checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -1576,8 +1576,6 @@ a.first-run-link-card:focus-visible .first-run-link-badge {
|
||||
}
|
||||
|
||||
.first-run-suppress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
color: rgba(199, 225, 231, 0.66);
|
||||
text-transform: none;
|
||||
|
||||
@@ -133,8 +133,6 @@
|
||||
|
||||
.data-library-check {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { msg, t } from '../../i18n/index.js';
|
||||
import { FIRST_RUN_LINKS, environmentalLabel } from '../../firstRunCopy.js';
|
||||
import UiCheckbox from '../kit/UiCheckbox.vue';
|
||||
import { useFirstRunStore } from '../stores/firstRun.js';
|
||||
import { useStoriesStore } from '../stores/stories.js';
|
||||
|
||||
@@ -24,6 +25,9 @@ function selectStart(choice) {
|
||||
|
||||
// Three short steps instead of one dense card: mode, where to start, then the
|
||||
// three things worth knowing. Back and Next move between them; Skip closes.
|
||||
// The suppress box's hook, as one object, so the box is not rendered again
|
||||
// with every render of the welcome.
|
||||
const suppressBoxAttrs = { 'data-first-run-suppress': '' };
|
||||
const STEPS = 3;
|
||||
const step = ref(1);
|
||||
const direction = ref('forward');
|
||||
@@ -291,10 +295,9 @@ function onSuppress(event) {
|
||||
</Transition>
|
||||
</div>
|
||||
<div class="first-run-footer">
|
||||
<label class="first-run-suppress">
|
||||
<input type="checkbox" data-first-run-suppress @change="onSuppress" />
|
||||
<UiCheckbox class="first-run-suppress" :input-attrs="suppressBoxAttrs" @change="onSuppress">
|
||||
<span>{{ t('Don\'t show this again') }}</span>
|
||||
</label>
|
||||
</UiCheckbox>
|
||||
<!-- The status line: empty until a mission reports progress or an
|
||||
error. It sits in the footer row, so it never changes the card's
|
||||
height. -->
|
||||
|
||||
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
|
||||
import { computed, nextTick, useTemplateRef, watch } from 'vue';
|
||||
import { formatNumber, t, tn } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCheckbox from '../../kit/UiCheckbox.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
import {
|
||||
@@ -153,14 +154,13 @@ const onDialogClick = (event) => {
|
||||
@update:model-value="controls?.setFamily($event)"
|
||||
/>
|
||||
</label>
|
||||
<label class="data-library-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="view.filter.availableOnly"
|
||||
@change="controls?.setAvailableOnly($event.target.checked)"
|
||||
/>
|
||||
<UiCheckbox
|
||||
class="data-library-check"
|
||||
:model-value="view.filter.availableOnly"
|
||||
@update:model-value="controls?.setAvailableOnly($event)"
|
||||
>
|
||||
<span>{{ t('Only what this instance serves') }}</span>
|
||||
</label>
|
||||
</UiCheckbox>
|
||||
</div>
|
||||
<div class="data-library-toolbar">
|
||||
<p class="data-library-status" role="status" aria-live="polite">
|
||||
|
||||
@@ -11,6 +11,7 @@ import UiSegmented from '../../kit/UiSegmented.vue';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCheckbox from '../../kit/UiCheckbox.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
import { StyleParameterRows } from '../../styleParameters.js';
|
||||
import VisualPresets from './VisualPresets.vue';
|
||||
@@ -182,11 +183,10 @@ const allocationOptions = computed(() => [
|
||||
</div>
|
||||
</Teleport>
|
||||
<div class="pp-toggle-group">
|
||||
<label class="pp-toggle-btn pp-scope-toggle" :title="t('Scope — the circular viewport mask')">
|
||||
<UiCheckbox class="pp-toggle-btn pp-scope-toggle" :title="t('Scope — the circular viewport mask')" input-id="scope-toggle" trailing :model-value="scopeOn" @update:model-value="act('setScopeEnabled', $event)">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">adjust</span>
|
||||
<span class="pp-label">{{ t('Scope') }}</span>
|
||||
<input type="checkbox" id="scope-toggle" @change="act('setScopeEnabled', $event.target.checked)" :checked="scopeOn" />
|
||||
</label>
|
||||
</UiCheckbox>
|
||||
<div class="pp-slider-row visible" id="scope-slider-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Feather') }}</span>
|
||||
<UiSlider class="pp-slider" id="scope-feather-slider" @update:model-value="act('setScopeFeather', $event)" min="0" max="200" :model-value="scopeFeather" :disabled="!scopeOn" :aria-label="t('Scope edge feather')" :title="t('Scope edge feather as a percentage of the keyhole radius')" />
|
||||
@@ -211,11 +211,10 @@ const allocationOptions = computed(() => [
|
||||
</div>
|
||||
<!-- Sky: only where the renderer has a sky to set. -->
|
||||
<div v-if="sky" class="pp-toggle-group" id="sky-group">
|
||||
<label v-for="row in skyRows" :key="row.key" class="pp-toggle-btn pp-scope-toggle" :id="`sky-${row.key}-row`">
|
||||
<UiCheckbox v-for="row in skyRows" :key="row.key" class="pp-toggle-btn pp-scope-toggle" :id="`sky-${row.key}-row`" :input-id="`sky-${row.key}-toggle`" trailing :model-value="sky.switches[row.key]" @update:model-value="act('setSkySwitch', row.key, $event)">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
|
||||
<span class="pp-label">{{ row.label }}</span>
|
||||
<input type="checkbox" :id="`sky-${row.key}-toggle`" @change="act('setSkySwitch', row.key, $event.target.checked)" :checked="sky.switches[row.key]" />
|
||||
</label>
|
||||
</UiCheckbox>
|
||||
<div class="pp-slider-row visible" id="sky-milkyway-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Milky Way') }}</span>
|
||||
<UiSlider class="pp-slider" id="sky-milkyway-slider" @update:model-value="act('setSkyMilkyWay', $event)" min="0" max="100" :model-value="sky.milkyWay" :aria-label="t('Milky Way')" />
|
||||
@@ -225,11 +224,10 @@ const allocationOptions = computed(() => [
|
||||
<!-- Groups the application adds (store `publishGroup`). -->
|
||||
<div v-for="group in groups" :key="group.id" class="pp-toggle-group" :id="`${group.id}-group`">
|
||||
<template v-for="row in group.rows" :key="row.id">
|
||||
<label v-if="row.kind === 'toggle'" class="pp-toggle-btn pp-scope-toggle" :title="row.title">
|
||||
<UiCheckbox v-if="row.kind === 'toggle'" class="pp-toggle-btn pp-scope-toggle" :title="row.title" :input-id="`${group.id}-${row.id}-toggle`" trailing :model-value="row.checked" @update:model-value="row.onChange?.($event)">
|
||||
<span v-if="row.icon" class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
|
||||
<span class="pp-label">{{ row.label }}</span>
|
||||
<input type="checkbox" :id="`${group.id}-${row.id}-toggle`" @change="row.onChange?.($event.target.checked)" :checked="row.checked" />
|
||||
</label>
|
||||
</UiCheckbox>
|
||||
<div v-else-if="row.kind === 'note'" class="pp-slider-row visible" :id="`${group.id}-${row.id}`">
|
||||
<span class="pp-slider-mini-label">{{ row.text }}</span>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ import VoiceVisualizer from './VoiceVisualizer.vue';
|
||||
import ChatPanel from './ChatPanel.vue';
|
||||
import PanelLayoutButtons from './PanelLayoutButtons.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCheckbox from '../../kit/UiCheckbox.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
@@ -19,16 +20,9 @@ defineProps({ view: { type: Object, required: true } });
|
||||
const { controls } = storeToRefs(useVoiceStore());
|
||||
const emit = (name, ...args) => controls.value?.emit(name, ...args);
|
||||
|
||||
// A value the owner may restore after a refused change; written on every
|
||||
// render, as the owner's own writes were.
|
||||
const vChecked = {
|
||||
mounted(el, { value }) {
|
||||
el.checked = value;
|
||||
},
|
||||
updated(el, { value }) {
|
||||
if (el.checked !== value) el.checked = value;
|
||||
},
|
||||
};
|
||||
// The Voice Preview box's note, as one object, so the panel's other renders
|
||||
// do not render the box again.
|
||||
const previewBoxAttrs = { 'aria-describedby': 'gev-voice-preview-note' };
|
||||
// The minutes field holds a draft until it changes: write it only when its
|
||||
// owner does, not on every render (the waveform renders each frame).
|
||||
const vOwnedValue = {
|
||||
@@ -127,11 +121,11 @@ const frameStyle = (panel) => ({
|
||||
</label>
|
||||
<p class="gev-voice-settings-note">{{ t('The selected AI provider is shared by voice and chat.') }}</p>
|
||||
<div id="gev-settings-chat">
|
||||
<label class="gev-voice-preference gev-voice-preference-toggle"><input id="gev-chat-quick" type="checkbox" v-checked="view.chat.quickChecked" @change="emit('chat-quick-change', $event.target.checked)" /><span>{{ t('Show quick commands') }}</span></label>
|
||||
<UiCheckbox class="gev-voice-preference gev-voice-preference-toggle" input-id="gev-chat-quick" restore :model-value="view.chat.quickChecked" @update:model-value="emit('chat-quick-change', $event)"><span>{{ t('Show quick commands') }}</span></UiCheckbox>
|
||||
<p>{{ t('Chat replies are silent. No microphone access is needed.') }}</p>
|
||||
</div>
|
||||
<div id="gev-settings-voice">
|
||||
<label class="gev-voice-preference gev-voice-preference-toggle"><input id="gev-voice-preview-enabled" type="checkbox" aria-describedby="gev-voice-preview-note" v-checked="view.preferences.previewChecked" @change="emit('preview-change', $event.target.checked)" /><span>{{ t('Show Voice Preview') }}</span></label>
|
||||
<UiCheckbox class="gev-voice-preference gev-voice-preference-toggle" input-id="gev-voice-preview-enabled" :input-attrs="previewBoxAttrs" restore :model-value="view.preferences.previewChecked" @update:model-value="emit('preview-change', $event)"><span>{{ t('Show Voice Preview') }}</span></UiCheckbox>
|
||||
<p id="gev-voice-preview-note" class="gev-voice-settings-note">{{ view.preferences.previewNote }}</p>
|
||||
<div class="gev-voice-timeout-group">
|
||||
<label class="gev-voice-preference gev-voice-setting-title" for="gev-voice-timeout-select">{{ t('Voice inactivity timeout') }}</label>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
@import './src/ui/styles/action-button.css';
|
||||
@import './src/ui/styles/close-button.css';
|
||||
@import './src/ui/styles/search-field.css';
|
||||
@import './src/ui/styles/checkbox.css';
|
||||
@import './src/ui/styles/form-field.css';
|
||||
@import './src/ui/styles/status-badge.css';
|
||||
@import './src/ui/styles/chip.css';
|
||||
|
||||
Reference in new issue
Block a user