Is the source code for the new standard library available? It doesn’t seem to be here: GitHub - observablehq/stdlib: The Observable standard library. · GitHub , unless I’m just missing it.
Given that the documentation is a work in progress, it would be nice to be able to look at the code to better understand how a function like display works.
Thanks,
Adam
Try here: notebook-kit/src/runtime/stdlib at main · observablehq/notebook-kit · GitHub
Here’s display() for example:
import {unprefix} from "../lib/unprefix.js";
import type {Definition} from "./define.js";
import {inspect, inspectError, getExpanded} from "./inspect.js";
import {mapAssets} from "./stdlib/assets.js";
export type DisplayMode = "table" | "default";
export type DisplayState = {
/** the HTML element in which to render this cell’s display */
root: HTMLDivElement;
/** whether to clear on fulfilled */
autoclear?: boolean;
/** for inspected values, any expanded paths; see getExpanded */
expanded: (number[][] | undefined)[];
};
export function display(
state: DisplayState,
value: unknown,
name?: string,
This file has been truncated. show original
We should add a link from the old standard library to the new one… Thanks for the reminder.