viewof chosen = {
let div = html`<div></div>`;
div.value = sortedProcessed[0];
d3.select(div)
.selectAll("div.emoji")
.data(
sortedProcessed
.filter(d => d.topColors.length)
.sort((a, b) => c2h(a.topColors[0]) - c2h(b.topColors[0]))
)
.join("div")
.classed("emoji", true)
.style("font-size", `${treemapSize-8}px`)
.style("display", "inline-block")
.style("cursor", "pointer")
.attr("title", d => d["Unicode name"])
.each(function(d) {
this.appendChild(html`<span style="display:none;">${d.Emoji}</span>`);
this.appendChild(colorTreemap(d));
})
.on("click", (event, d) => {
div.value = d;
div.dispatchEvent(new CustomEvent("input", { bubbles: true }));
})
.on("mouseover", function(event, d) {
d3.select(this)
.select("span")
.style("width","40px")
.style("display", "block");
d3.select(this)
.select("svg")
.style("display", "none");
})
.on("mouseout", function(event, d) {
d3.select(this)
.select("span")
.style("display", "none");
d3.select(this)
.select("svg")
.style("display", "block");
});
return div;
}