viewof error = {
const view = Inputs.input();
const notify = (event) => {
view.value = event.detail.error;
view.dispatchEvent(new Event("input", { bubbles: true }));
};
const processInspectorNode = (el) => {
el.addEventListener("error", notify);
};
[...document.querySelectorAll(".observablehq").values()].forEach(
processInspectorNode
);
const root = document.querySelector(".observablehq-root");
if (root) {
const observer = new MutationObserver((mutationList, observer) => {
for (const mutation of mutationList) {
[...mutation.addedNodes].forEach(processInspectorNode);
}
});
observer.observe(root, {
childList: true
});
invalidation.then(observer.disconnect);
}
return view;
}