@observablehq/inspector@5.0.1

also see @observablehq/inspector

This notebook ports a notebook by Tom Larkworthy [@tomlarkworthy] called [@observablehq/inspector@5.0.1](https://observablehq.com/@observablehq/htl). All mistakes and deviations from the original are my own.

+--------------------------------------------------------------+ | — The following text/narrative is from the original — | +--------------------------------------------------------------+

~~~js
    import {inspect, Inspector} from '@tomlarkworthy/inspector'
~~~
import {require as d3require} from "npm:d3-require";
display(d3require)
const unzip = async (attachment) => {
  const response = await new Response(
    (await attachment.stream()).pipeThrough(new DecompressionStream("gzip"))
  );

  return response.blob();
};
display(unzip)
const src = unzip(FileAttachment("/components/inspector-5@1.0.1.js.gz"));
display(unzip)
function inspect(value) {
  const root = document.createElement("DIV");
  new Inspector(root).fulfilled(value);
  const element = root.firstChild;
  element.remove();
  element.value = value; // for viewof
  return element;
};
display(inspect)
const Inspector = (await (async () => {
  const objectURL = URL.createObjectURL(
    new Blob([src], { type: "application/javascript" })
  );
  try {
    return (await d3require(objectURL)).Inspector;
  } finally {
    URL.revokeObjectURL(objectURL);
  }
})());
display(Inspector)