filterLegend = (domain, range) => {
const value = new Map(domain.map(d => [d, true]));
const _set = () => set(node, [...value].filter(d => d[1]).map(d => d[0]));
const oninput = e => (value.set(e.target.id, e.target.checked), _set());
const node = htl.html`<div style="font-family: var(--sans-serif); font-size: calc(8px + 0.45vw); display: flex; flex-wrap: wrap; min-height: 33px; align-items: center;">
${domain.map((d, i) => htl.html`<div style="display: flex; padding-right:10px">
<input type="checkbox" id="${d}" name="${d}" checked style="accent-color: ${range[i]}" oninput=${oninput}>
<label for="${d}">${d}</label>
</div>`)}
</div>`;
_set();
return node;
}