Public
Edited
Dec 11, 2023
Importers
Insert cell
Insert cell
Insert cell
makeCl = (prefix) => {
const registry = {};

const cl = (name) => {
const identifier = `zhstat-${prefix}-${name}`;
if (typeof registry[identifier] === "undefined") {
registry[identifier] = DOM.uid(identifier);
}

return registry[identifier].id;
};

return cl;
}
Insert cell
Insert cell
litRender = function (
template,
element = document.createElement("span"),
options,
lit
) {
lit.render(template, element, options);
return element;
}
Insert cell
Insert cell
setValue = (value, input) => {
if (input.value !== value) {
input.value = value;
input.dispatchEvent(new Event("input", { bubbles: true }));
}
}
Insert cell
Insert cell
getPointerPosition = (e, element) => {
// If it is a TouchEvent just get the position of the first touch
const { clientX, clientY } = e.touches ? e.touches[0] : e;
const rect = element.getBoundingClientRect();
const x = clientX - rect.left;
const y = clientY - rect.top;

return [x, y];
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more