Merge branch 'main' into german/hal-721-provider-labels

This commit is contained in:
German Khokhlov authored and GitHub committed 2026-11-05 21:02:35 +04:00
commit e9e7ed4c1a
61 files changed
+3346 -439

No files matched your search

+15
View File
@@ -117,3 +117,18 @@ test('a radio group moves from the focused option, an arrows group from the sele
assert.deepEqual(arrows.emitted('update:modelValue'), [['a']]);
arrows.unmount();
});
test("an option's own tip wins; an icon option without one is titled by its label", () => {
const wrapper = mountGroup({
options: [
{ value: 'a', label: 'Alpha', attrs: { title: 'Alpha tip' } },
{ value: 'b', label: 'Beta', icon: 'star' },
{ value: 'c', label: 'Gamma' },
],
});
const titles = wrapper
.findAll('button')
.map((b) => b.attributes('title') ?? null);
assert.deepEqual(titles, ['Alpha tip', 'Beta', null]);
wrapper.unmount();
});
+3 -2
View File
@@ -8,7 +8,8 @@ import { computed } from 'vue';
// End). Each option may carry `attrs` (an id, data attributes, a tip), and
// Core's classes sit beside the kit's: `gev-segmented`, `gev-segment` and the
// selected option's `activeClass`. An option with an `icon` shows the glyph,
// and its label becomes the button's accessible name and tooltip.
// and its label becomes the button's accessible name and tooltip, unless its
// `attrs` carry a tip of their own.
const props = defineProps({
modelValue: { type: String, default: undefined },
/** `{value, label, icon?, disabled?, attrs?}`, labels already translated. */
@@ -119,7 +120,7 @@ function onKey(event) {
]"
:aria-checked="String(option.value === props.modelValue)"
:aria-label="option.icon ? option.label : undefined"
:title="option.icon ? option.label : undefined"
:title="option.attrs?.title ?? (option.icon ? option.label : undefined)"
:disabled="optionOff(option)"
:tabindex="tabindex(index)"
@click="choose(index)"
+6
View File
@@ -141,6 +141,12 @@ export class LayerBindings {
});
this._weatherShellModules.push(layer);
}
// Active Fires drapes its far-zoom heatmap on the same imagery host.
const fires = this._dataManager?.layers?.get('local-firms')?.module;
if (typeof fires?.attachShellServices === 'function') {
fires.attachShellServices({ imageryHost: this.services.imageryHost });
this._weatherShellModules.push(fires);
}
}
_persistAwarenessSelection(event, cleared = false) {
+35 -5
View File
@@ -442,6 +442,8 @@ export class LayerPanel {
this._selectChip(layerId, chipId, generation),
onListItem: (layerId, itemId) =>
this._selectListItem(layerId, itemId, generation),
onSlider: (layerId, sliderId, value) =>
this._moveSlider(layerId, sliderId, value, generation),
}),
id === null ? this._toggleContainer : this._groupContainers.get(id),
);
@@ -471,7 +473,8 @@ export class LayerPanel {
}
/**
* A layer's row chips, color legend, info line and ordered list. The block
* A layer's row chips, one-of-many switch, slider, color legend, info line
* and ordered list. The block
* is hidden while the layer is off (or while a dependency owner has
* surrendered it), so a quiet row stays quiet. Chips and list items are
* keyed, so the refresh a chip's own click triggers keeps keyboard focus.
@@ -495,11 +498,20 @@ export class LayerPanel {
: `${item.label} ${formatCount(item.count)}`,
}));
const infoText = controls?.info ? String(controls.info) : '';
const segmented = controls?.segmented || null;
const slider = controls?.slider || null;
// The info line, once shown, stays in place and hides when empty.
if (infoText) row.info = true;
return {
hidden: chips.length === 0 && legend.length === 0 && !infoText,
hidden:
chips.length === 0 &&
legend.length === 0 &&
!infoText &&
!segmented &&
!slider,
chips,
segmented,
slider,
legend,
info: row.info
? { text: infoText, title: controls?.infoTitle || '' }
@@ -537,15 +549,33 @@ export class LayerPanel {
// listeners, so a click from a released generation is dropped.
_selectChip(id, chipId, generation = this._generation) {
if (this._destroyed || this._generation !== generation) return;
const chip = this._rowControlsFor(id)?.chips?.find(
(entry) => entry.id === chipId,
);
// A switch option carries the same fields as a chip.
const live = this._rowControlsFor(id);
const chip = [
...(live?.chips || []),
...(live?.segmented?.options || []),
].find((entry) => entry.id === chipId);
if (!chip || chip.disabled || !this.isEnabled(id)) return;
if (typeof chip.onClick === 'function') chip.onClick();
else if (chip.params)
this.setLayerParams(id, chip.params, { origin: 'user' });
}
// A row slider (e.g. the Active Fires minimum-FRP filter) maps its position
// to params through the live descriptor on every tick.
_moveSlider(id, sliderId, value, generation = this._generation) {
if (this._destroyed || this._generation !== generation) return;
const slider = this._rowControlsFor(id)?.slider;
if (
!slider ||
slider.id !== sliderId ||
typeof slider.params !== 'function' ||
!this.isEnabled(id)
)
return;
this.setLayerParams(id, slider.params(value), { origin: 'user' });
}
_selectListItem(id, itemId, generation = this._generation) {
if (this._destroyed || this._generation !== generation) return;
const item = this._rowControlsFor(id)?.list?.items?.find(
+13
View File
@@ -1,6 +1,8 @@
<script setup>
import RailChips from '../rail/RailChips.vue';
import RailRowList from '../rail/RailRowList.vue';
import RowSlider from './RowSlider.vue';
import RowSwitch from './RowSwitch.vue';
import RowText from './RowText.vue';
import { vClassToggle } from '../rail/classToggle.js';
@@ -12,6 +14,7 @@ defineProps({
onToggle: { type: Function, default: () => {} },
onChip: { type: Function, default: () => {} },
onListItem: { type: Function, default: () => {} },
onSlider: { type: Function, default: () => {} },
});
</script>
@@ -55,6 +58,16 @@ defineProps({
><RailChips
:chips="item.controls.chips"
:on-select="(chip) => onChip(item.id, chip.id)"
/><RowSwitch
v-if="item.controls.segmented"
:segmented="item.controls.segmented"
:on-select="(optionId) => onChip(item.id, optionId)"
/><RowSlider
v-if="item.controls.slider"
:slider="item.controls.slider"
:on-input="
(value) => onSlider(item.id, item.controls.slider.id, value)
"
/><span
v-for="(entry, index) in item.controls.legend"
:key="index"
+44
View File
@@ -0,0 +1,44 @@
<script setup>
import UiSlider from '../kit/UiSlider.js';
// A row's quantitative slider (e.g. the Active Fires minimum-FRP filter).
// `track` is a CSS background painting the runnable track, so a color ramp
// doubles as the legend; each tick sits at `at` (0..1) along it. The input
// holds its position while focused, so a refresh from its own tick never
// moves the thumb under the pointer.
defineProps({
slider: { type: Object, required: true },
onInput: { type: Function, default: () => {} },
});
</script>
<template>
<div class="data-toggle-slider" :data-slider-id="slider.id"
><div class="data-toggle-slider-head"
><span class="data-toggle-slider-label">{{ slider.label }}</span
><span class="data-toggle-slider-value gev-slider-value">{{
slider.valueText
}}</span></div
><UiSlider
class="data-toggle-slider-input"
:data-slider-id="slider.id"
:min="slider.min"
:max="slider.max"
:step="slider.step ?? 1"
:model-value="slider.value"
hold
:aria-label="slider.ariaLabel || undefined"
:aria-valuetext="slider.valueText || undefined"
:style="slider.track ? { '--slider-track': slider.track } : undefined"
@update:model-value="onInput"
/><div class="data-toggle-slider-ticks"
><span
v-for="tick in slider.ticks || []"
:key="tick.at"
class="data-toggle-slider-tick"
:style="{ '--at': `${(tick.at * 100).toFixed(2)}%` }"
>{{ tick.label }}</span
></div
></div
>
</template>
+38
View File
@@ -0,0 +1,38 @@
<script setup>
import UiSegmented from '../kit/UiSegmented.vue';
// A row's one-of-many switch (e.g. Active Fires confidence). Options carry
// the same fields as chips, so the owner resolves a choice the way it
// resolves a chip; `label` is an optional caption beside the group.
defineProps({
segmented: { type: Object, required: true },
onSelect: { type: Function, default: () => {} },
});
const options = (segmented) =>
(segmented.options || []).map((option) => ({
value: option.id,
label: option.label,
disabled: Boolean(option.disabled),
attrs: { 'data-chip-id': option.id, title: option.title || undefined },
}));
const activeId = (segmented) =>
(segmented.options || []).find((option) => option.active)?.id;
</script>
<template>
<span
v-if="segmented.label"
class="data-toggle-segmented-label"
:data-segmented-caption-for="segmented.id"
>{{ segmented.label }}</span
><UiSegmented
class="data-toggle-segmented"
:data-segmented-id="segmented.id"
:model-value="activeId(segmented)"
:options="options(segmented)"
:label="segmented.ariaLabel || segmented.label || ''"
item-class="data-toggle-segment"
@update:model-value="onSelect"
/>
</template>
+116 -1
View File
@@ -39,8 +39,123 @@ test('the count-line class toggles without dropping the voice highlight', () =>
assert.equal(element.classList.contains('gev-voice-focus'), true);
render(h(LayerRows, { items: [row(false)] }), container);
assert.equal(element.classList.contains('data-toggle-row--count-line'), false);
assert.equal(
element.classList.contains('data-toggle-row--count-line'),
false,
);
assert.equal(element.classList.contains('gev-voice-focus'), true);
assert.equal(element.classList.contains('data-toggle-row'), true);
render(null, container);
});
const fireRow = (value, active = 'all') => ({
...row(false),
key: 'fires',
id: 'fires',
controls: {
hidden: false,
chips: [],
segmented: {
id: 'confidence',
label: 'Confidence',
ariaLabel: 'Detection confidence',
options: ['all', 'high'].map((mode) => ({
id: `confidence-${mode}`,
label: mode.toUpperCase(),
title: `${mode} title`,
active: mode === active,
})),
},
slider: {
id: 'min-frp',
label: 'Fire intensity (FRP)',
ariaLabel: 'Minimum fire radiative power, megawatts',
valueText: value ? `≥ ${value} MW` : 'All',
min: 0,
max: 1000,
step: 1,
value,
track: 'linear-gradient(90deg, #9e2a1b, #fff3b0)',
ticks: [
{ at: 0, label: '0' },
{ at: 0.5, label: '30' },
],
},
legend: [],
info: null,
list: null,
},
});
test('a row switch and slider render their markup and report choices', () => {
document.body.replaceChildren();
const container = document.body.appendChild(document.createElement('div'));
const chips = [];
const moves = [];
const props = {
onChip: (id, chipId) => chips.push([id, chipId]),
onSlider: (id, sliderId, value) => moves.push([id, sliderId, value]),
};
render(h(LayerRows, { items: [fireRow(0)], ...props }), container);
const caption = container.querySelector('.data-toggle-segmented-label');
assert.equal(caption.textContent, 'Confidence');
const group = container.querySelector('.gev-segmented.data-toggle-segmented');
assert.equal(group.getAttribute('role'), 'radiogroup');
assert.equal(group.getAttribute('aria-label'), 'Detection confidence');
const segments = [
...group.querySelectorAll('.gev-segment.data-toggle-segment'),
];
assert.deepEqual(
segments.map((button) => button.dataset.chipId),
['confidence-all', 'confidence-high'],
);
assert.equal(segments[0].classList.contains('active'), true);
assert.equal(segments[1].title, 'high title');
segments[1].click();
assert.deepEqual(chips, [['fires', 'confidence-high']]);
const block = container.querySelector('.data-toggle-slider');
assert.equal(block.dataset.sliderId, 'min-frp');
assert.equal(
block.querySelector('.data-toggle-slider-label').textContent,
'Fire intensity (FRP)',
);
assert.equal(
block.querySelector('.data-toggle-slider-value').textContent,
'All',
);
const input = block.querySelector('input.data-toggle-slider-input');
assert.equal(input.classList.contains('gev-quantitative-slider'), true);
assert.equal(input.type, 'range');
assert.equal(input.max, '1000');
assert.equal(
input.getAttribute('aria-label'),
'Minimum fire radiative power, megawatts',
);
assert.equal(input.getAttribute('aria-valuetext'), 'All');
assert.match(
input.style.getPropertyValue('--slider-track'),
/^linear-gradient/,
);
const ticks = [...block.querySelectorAll('.data-toggle-slider-tick')];
assert.deepEqual(
ticks.map((tick) => tick.textContent),
['0', '30'],
);
assert.equal(ticks[1].style.getPropertyValue('--at'), '50.00%');
input.value = '120';
input.dispatchEvent(new Event('input', { bubbles: true }));
assert.deepEqual(moves, [['fires', 'min-frp', 120]]);
// The refresh that tick triggers keeps the same nodes and updates the text.
render(h(LayerRows, { items: [fireRow(120, 'high')], ...props }), container);
assert.equal(
container.querySelector('input.data-toggle-slider-input'),
input,
);
assert.equal(input.getAttribute('aria-valuetext'), '≥ 120 MW');
assert.equal(segments[1].classList.contains('active'), true);
render(null, container);
});
+112
View File
@@ -1042,6 +1042,118 @@ html:not([lang='en']) .data-row-list-text {
padding-top: 3px;
overflow-wrap: anywhere;
}
/* Optional per-layer one-of-many switch (Active Fires confidence). The shared
.gev-segmented surface, sized to the chip row. */
.data-toggle-controls .data-toggle-segmented {
flex-basis: 100%;
max-width: 220px;
}
.data-toggle-segmented-label {
flex-basis: 100%;
padding-top: 2px;
font-family: var(--font-mono);
font-size: 8px;
letter-spacing: 1.2px;
color: var(--text-dim);
text-transform: uppercase;
}
.data-toggle-controls .data-toggle-segment {
min-height: 20px;
padding: 3px 6px;
font-size: 8px;
letter-spacing: 0.8px;
}
/* Optional per-layer quantitative slider (Active Fires minimum FRP). The
track is painted by the layer (`--slider-track`, a stepped color ramp), so
the slider doubles as the marker legend; ticks sit under their thresholds. */
.data-toggle-slider {
flex-basis: 100%;
display: grid;
gap: 2px;
padding-top: 2px;
}
.data-toggle-slider-head {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 8px;
font-family: var(--font-mono);
font-size: 8px;
letter-spacing: 1.2px;
color: var(--text-dim);
text-transform: uppercase;
}
.data-toggle-slider-value {
min-width: 0;
font-size: 9px;
letter-spacing: 0.5px;
text-transform: none;
}
.data-toggle-slider-input {
height: 14px;
}
.data-toggle-slider-input::-webkit-slider-runnable-track {
height: 5px;
border-radius: 3px;
background: var(--slider-track, rgba(255, 255, 255, 0.08));
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.data-toggle-slider-input::-moz-range-track,
.data-toggle-slider-input::-moz-range-progress {
height: 5px;
border-radius: 3px;
background: var(--slider-track, rgba(255, 255, 255, 0.08));
}
.data-toggle-slider-input::-webkit-slider-thumb {
width: 11px;
height: 11px;
margin-top: -3px;
background: var(--text-primary);
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.6),
0 0 6px rgba(255, 255, 255, 0.35);
}
.data-toggle-slider-input::-moz-range-thumb {
width: 11px;
height: 11px;
background: var(--text-primary);
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.6),
0 0 6px rgba(255, 255, 255, 0.35);
}
.data-toggle-slider-ticks {
position: relative;
height: 10px;
margin: 0 5px;
font-family: var(--font-mono);
font-size: 7px;
letter-spacing: 0.4px;
color: var(--text-dim);
}
.data-toggle-slider-tick {
position: absolute;
top: 0;
left: var(--at);
transform: translateX(-50%);
white-space: nowrap;
}
.data-toggle-slider-tick:first-child {
transform: none;
}
/* ── Local RTL-SDR card (FM + Local ADS-B receiver) ── */
.sdr-radio-card {
display: grid;