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("display", "inline-block")
.style("cursor", "pointer")
.attr("title", d => d["Unicode name"])
.each(function(d) {
let span = html`<span style="display:none">${d.Emoji}</span>`;
d3.select(span)
.style("font-size", `${treemapSize}px`)
.style("line-height", `${treemapSize}px`)
.style("vertical-align", "super");
this.appendChild(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("display", "inline-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", "inline-block");
});
return div;
}