@observablehq/notebook-kit 2.6.3 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unprefix(name: string, prefix: string): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unprefix } from "../lib/unprefix.js";
|
|
1
2
|
import { clear, display, observe } from "./display.js";
|
|
2
3
|
import { input } from "./stdlib/generators/index.js";
|
|
3
4
|
import { Mutator } from "./stdlib/mutable.js";
|
|
@@ -56,8 +57,3 @@ export function define(main, state, definition, observer = observe) {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
function unprefix(name, prefix) {
|
|
60
|
-
if (!name.startsWith(prefix))
|
|
61
|
-
throw new Error(`expected ${prefix}: ${name}`);
|
|
62
|
-
return name.slice(prefix.length);
|
|
63
|
-
}
|
|
@@ -10,7 +10,7 @@ export type DisplayState = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare function display(state: DisplayState, value: unknown, name?: string, mode?: DisplayMode): void;
|
|
12
12
|
export declare function clear(state: DisplayState): void;
|
|
13
|
-
export declare function observe(state: DisplayState, { autodisplay, assets, output: name, displayMode: mode }: Definition): {
|
|
13
|
+
export declare function observe(state: DisplayState, { autodisplay, assets, output: name, automutable, displayMode: mode }: Definition): {
|
|
14
14
|
_error: boolean;
|
|
15
15
|
_node: HTMLDivElement;
|
|
16
16
|
pending(): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unprefix } from "../lib/unprefix.js";
|
|
1
2
|
import { inspect, inspectError, getExpanded } from "./inspect.js";
|
|
2
3
|
import { mapAssets } from "./stdlib/assets.js";
|
|
3
4
|
export function display(state, value, name, mode) {
|
|
@@ -45,7 +46,9 @@ export function clear(state) {
|
|
|
45
46
|
while (state.root.lastChild)
|
|
46
47
|
state.root.lastChild.remove();
|
|
47
48
|
}
|
|
48
|
-
export function observe(state, { autodisplay, assets, output: name, displayMode: mode }) {
|
|
49
|
+
export function observe(state, { autodisplay, assets, output: name, automutable, displayMode: mode }) {
|
|
50
|
+
if (automutable && name)
|
|
51
|
+
name = unprefix(name, "initial ");
|
|
49
52
|
return {
|
|
50
53
|
_error: false,
|
|
51
54
|
_node: state.root, // _node for visibility promise
|