viewof state = {
const width = 960;
const height = 500;
let value = null;
const projection = d3.geoCylindricalStereographic();
const path = d3.geoPath().projection(projection);
const svg = d3.select(DOM.svg(width, height))
.style("width", "100%")
.style("height", "auto");
const g = svg.append("g")
.attr("transform", "translate(0,40)");
svg.append("g")
.attr("fill", "#ccc")
.selectAll("path")
.data(topojson.feature(world, world.objects.countries).features)
.enter().append("path")
.attr("d", path)
.on("click", d => {
const node = svg.node();
node.value = value = value === d.id ? null : d.id;
node.dispatchEvent(new CustomEvent("input"));
outline.attr("d", value ? path(d) : null);
});
svg.append("path")
.datum(topojson.mesh(world, world.objects.countries, (a, b) => a !== b))
.attr("fill", "none")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("pointer-events", "none")
.attr("d", path);
const outline = svg.append("path")
.attr("fill", "none")
.attr("stroke", "black")
.attr("stroke-linejoin", "round")
.attr("pointer-events", "none");
return Object.assign(svg.node(), {value: null});
}