@myst-theme/jupyter 0.3.7 → 0.4.0
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/cjs/BinderBadge.js +1 -1
- package/dist/cjs/ErrorTray.d.ts +4 -4
- package/dist/cjs/ErrorTray.d.ts.map +1 -1
- package/dist/cjs/ErrorTray.js +11 -3
- package/dist/cjs/decoration.d.ts +11 -0
- package/dist/cjs/decoration.d.ts.map +1 -0
- package/dist/cjs/decoration.js +39 -0
- package/dist/cjs/embed.d.ts +3 -2
- package/dist/cjs/embed.d.ts.map +1 -1
- package/dist/cjs/embed.js +8 -18
- package/dist/cjs/execute/actions.d.ts +1 -1
- package/dist/cjs/execute/actions.d.ts.map +1 -1
- package/dist/cjs/execute/busy.d.ts +24 -2
- package/dist/cjs/execute/busy.d.ts.map +1 -1
- package/dist/cjs/execute/busy.js +86 -9
- package/dist/cjs/execute/hooks.d.ts +5 -2
- package/dist/cjs/execute/hooks.d.ts.map +1 -1
- package/dist/cjs/execute/hooks.js +19 -10
- package/dist/cjs/execute/provider.d.ts +7 -2
- package/dist/cjs/execute/provider.d.ts.map +1 -1
- package/dist/cjs/execute/provider.js +5 -3
- package/dist/cjs/execute/reducer.js +2 -2
- package/dist/cjs/execute/selectors.d.ts +0 -1
- package/dist/cjs/execute/selectors.d.ts.map +1 -1
- package/dist/cjs/execute/selectors.js +9 -14
- package/dist/cjs/execute/types.d.ts +1 -1
- package/dist/cjs/execute/types.d.ts.map +1 -1
- package/dist/cjs/execute/utils.d.ts.map +1 -1
- package/dist/cjs/execute/utils.js +9 -8
- package/dist/cjs/figure.d.ts +5 -0
- package/dist/cjs/figure.d.ts.map +1 -0
- package/dist/cjs/figure.js +20 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/jupyter.d.ts.map +1 -1
- package/dist/cjs/jupyter.js +20 -6
- package/dist/cjs/output.d.ts +9 -1
- package/dist/cjs/output.d.ts.map +1 -1
- package/dist/cjs/output.js +17 -9
- package/dist/cjs/providers.d.ts +7 -2
- package/dist/cjs/providers.d.ts.map +1 -1
- package/dist/cjs/providers.js +8 -3
- package/dist/cjs/utils.js +2 -2
- package/dist/esm/BinderBadge.js +1 -1
- package/dist/esm/ErrorTray.d.ts +4 -4
- package/dist/esm/ErrorTray.d.ts.map +1 -1
- package/dist/esm/ErrorTray.js +11 -3
- package/dist/esm/decoration.d.ts +11 -0
- package/dist/esm/decoration.d.ts.map +1 -0
- package/dist/esm/decoration.js +31 -0
- package/dist/esm/embed.d.ts +3 -2
- package/dist/esm/embed.d.ts.map +1 -1
- package/dist/esm/embed.js +9 -19
- package/dist/esm/execute/actions.d.ts +1 -1
- package/dist/esm/execute/actions.d.ts.map +1 -1
- package/dist/esm/execute/busy.d.ts +24 -2
- package/dist/esm/execute/busy.d.ts.map +1 -1
- package/dist/esm/execute/busy.js +84 -8
- package/dist/esm/execute/hooks.d.ts +5 -2
- package/dist/esm/execute/hooks.d.ts.map +1 -1
- package/dist/esm/execute/hooks.js +18 -9
- package/dist/esm/execute/provider.d.ts +7 -2
- package/dist/esm/execute/provider.d.ts.map +1 -1
- package/dist/esm/execute/provider.js +4 -2
- package/dist/esm/execute/reducer.js +1 -1
- package/dist/esm/execute/selectors.d.ts +0 -1
- package/dist/esm/execute/selectors.d.ts.map +1 -1
- package/dist/esm/execute/selectors.js +7 -11
- package/dist/esm/execute/types.d.ts +1 -1
- package/dist/esm/execute/types.d.ts.map +1 -1
- package/dist/esm/execute/utils.d.ts.map +1 -1
- package/dist/esm/execute/utils.js +9 -8
- package/dist/esm/figure.d.ts +5 -0
- package/dist/esm/figure.d.ts.map +1 -0
- package/dist/esm/figure.js +16 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/jupyter.d.ts.map +1 -1
- package/dist/esm/jupyter.js +16 -5
- package/dist/esm/output.d.ts +9 -1
- package/dist/esm/output.d.ts.map +1 -1
- package/dist/esm/output.js +15 -8
- package/dist/esm/providers.d.ts +7 -2
- package/dist/esm/providers.d.ts.map +1 -1
- package/dist/esm/providers.js +6 -2
- package/dist/esm/utils.js +2 -2
- package/dist/types/ErrorTray.d.ts +4 -4
- package/dist/types/ErrorTray.d.ts.map +1 -1
- package/dist/types/decoration.d.ts +11 -0
- package/dist/types/decoration.d.ts.map +1 -0
- package/dist/types/embed.d.ts +3 -2
- package/dist/types/embed.d.ts.map +1 -1
- package/dist/types/execute/actions.d.ts +1 -1
- package/dist/types/execute/actions.d.ts.map +1 -1
- package/dist/types/execute/busy.d.ts +24 -2
- package/dist/types/execute/busy.d.ts.map +1 -1
- package/dist/types/execute/hooks.d.ts +5 -2
- package/dist/types/execute/hooks.d.ts.map +1 -1
- package/dist/types/execute/provider.d.ts +7 -2
- package/dist/types/execute/provider.d.ts.map +1 -1
- package/dist/types/execute/selectors.d.ts +0 -1
- package/dist/types/execute/selectors.d.ts.map +1 -1
- package/dist/types/execute/types.d.ts +1 -1
- package/dist/types/execute/types.d.ts.map +1 -1
- package/dist/types/execute/utils.d.ts.map +1 -1
- package/dist/types/figure.d.ts +5 -0
- package/dist/types/figure.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/jupyter.d.ts.map +1 -1
- package/dist/types/output.d.ts +9 -1
- package/dist/types/output.d.ts.map +1 -1
- package/dist/types/providers.d.ts +7 -2
- package/dist/types/providers.d.ts.map +1 -1
- package/package.json +11 -9
package/dist/esm/embed.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function EmbedWithControls({ outputKey, children, title = 'Jupyter Notebook', url, }) {
|
|
9
|
-
const { kind } = useCellExecution(outputKey);
|
|
10
|
-
const Link = useLinkProvider();
|
|
11
|
-
const baseurl = useBaseurl();
|
|
12
|
-
const showControls = kind === SourceFileKind.Article;
|
|
13
|
-
return (_jsxs("div", { className: "shadow", children: [showControls && (_jsx("div", { className: "sticky top-[60px] z-[2] w-full bg-gray-100/80 backdrop-blur dark:bg-neutral-800/80 py-1 px-2", children: _jsxs("div", { className: "flex items-center", children: [_jsxs("div", { className: "flex items-center", children: [_jsx(JupyterIcon, { className: "inline-block w-5 h-5" }), _jsx("span", { className: "ml-2", children: "Source:" }), url && (_jsx(Link, { to: withBaseurl(url, baseurl), className: "ml-2 no-underline text-normal hover:underline", children: title }))] }), _jsx("div", { className: "flex-grow" }), _jsx(ArticleStatusBadge, { id: outputKey }), _jsx(ArticleRunNotebook, { id: outputKey }), _jsx(ArticleResetNotebook, { id: outputKey })] }) })), _jsx("div", { className: "mt-2", children: children })] }));
|
|
14
|
-
}
|
|
15
|
-
export function Embed(node, children) {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
const output = select('output', node);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { JupyterOutput } from './output';
|
|
3
|
+
import { OutputDecoration } from './decoration';
|
|
4
|
+
import { MyST } from 'myst-to-react';
|
|
5
|
+
export function Embed({ node }) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
const output = (_a = node.children) === null || _a === void 0 ? void 0 : _a.find((child) => child.type === 'output');
|
|
18
8
|
if (!output)
|
|
19
|
-
return _jsx(
|
|
20
|
-
return (_jsx(
|
|
9
|
+
return _jsx(MyST, { ast: node.children });
|
|
10
|
+
return (_jsx(OutputDecoration, { outputId: output.id, title: (_b = node.source) === null || _b === void 0 ? void 0 : _b.title, url: (_c = node.source) === null || _c === void 0 ? void 0 : _c.url, children: _jsx(JupyterOutput, { outputId: output.id, identifier: output.identifier, align: node.align, data: node.data }) }, node.key));
|
|
21
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SourceFileKind, Dependency } from 'myst-spec-ext';
|
|
2
2
|
import type { Root } from 'mdast';
|
|
3
3
|
import type { BuildStatus, Computable } from './types';
|
|
4
4
|
import type { IRenderMimeRegistry, ThebeNotebook, ThebeSession } from 'thebe-core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/execute/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/execute/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAQ9E;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;IACZ,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,WAAW,CAEtE;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,iBAAiB,CAGlF;AAED,UAAU,iBAAiB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,o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eNotebookError } from 'thebe-react';
|
|
2
3
|
export type BusyKind = 'execute' | 'reset';
|
|
3
4
|
export interface BusyScopeState {
|
|
4
5
|
execute: {
|
|
@@ -15,6 +16,11 @@ export interface BusyScopeState {
|
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
18
|
};
|
|
19
|
+
error: {
|
|
20
|
+
[pageSlug: string]: {
|
|
21
|
+
[notebookSlug: string]: IThebeNotebookError[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
18
24
|
}
|
|
19
25
|
export interface BusyScopeContext {
|
|
20
26
|
state: BusyScopeState;
|
|
@@ -37,9 +43,14 @@ export interface NotebookPayload {
|
|
|
37
43
|
cellIds: string[];
|
|
38
44
|
kind: BusyKind;
|
|
39
45
|
}
|
|
46
|
+
export interface ErrorPayload {
|
|
47
|
+
pageSlug: string;
|
|
48
|
+
notebookSlug: string;
|
|
49
|
+
errors?: IThebeNotebookError[];
|
|
50
|
+
}
|
|
40
51
|
type BusyScopeAction = {
|
|
41
|
-
type: 'SET_CELL_BUSY' | 'CLEAR_CELL_BUSY' | 'SET_NOTEBOOK_BUSY' | 'CLEAR_NOTEBOOK_BUSY';
|
|
42
|
-
payload: SlugPayload | CellPayload | NotebookPayload;
|
|
52
|
+
type: 'SET_CELL_BUSY' | 'CLEAR_CELL_BUSY' | 'SET_NOTEBOOK_BUSY' | 'CLEAR_NOTEBOOK_BUSY' | 'SET_ERROR' | 'CLEAR_ERROR';
|
|
53
|
+
payload: SlugPayload | CellPayload | NotebookPayload | ErrorPayload;
|
|
43
54
|
};
|
|
44
55
|
export declare function reducer(state: BusyScopeState, action: BusyScopeAction): BusyScopeState;
|
|
45
56
|
export declare function BusyScopeProvider({ children }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
@@ -51,6 +62,17 @@ export declare function useBusyScope(): {
|
|
|
51
62
|
clearCell: (pageSlug: string, notebookSlug: string, cellId: string, kind: BusyKind) => void;
|
|
52
63
|
setNotebook: (pageSlug: string, notebookSlug: string, cellIds: string[], kind: BusyKind) => void;
|
|
53
64
|
clearNotebook: (pageSlug: string, notebookSlug: string, kind: BusyKind) => void;
|
|
65
|
+
setError: (pageSlug: string, notebookSlug: string, errors: IThebeNotebookError[]) => void;
|
|
66
|
+
clearError: (pageSlug: string, notebookSlug: string) => void;
|
|
67
|
+
};
|
|
68
|
+
interface ErrorItem {
|
|
69
|
+
pageSlug: string;
|
|
70
|
+
notebookSlug: string;
|
|
71
|
+
errors: IThebeNotebookError[];
|
|
72
|
+
}
|
|
73
|
+
export declare function useBusyErrors(pageSlug: string): {
|
|
74
|
+
items: ErrorItem[] | undefined;
|
|
75
|
+
clearErrors: () => void;
|
|
54
76
|
};
|
|
55
77
|
export declare function selectCellIsBusy(state: BusyScopeState, pageSlug: string, notebookSlug: string, cellId: string, kind: BusyKind): boolean;
|
|
56
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"busy.d.ts","sourceRoot":"","sources":["../../../src/execute/busy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE;QACP,CAAC,QAAQ,EAAE,MAAM,GAAG;YAClB,CAAC,YAAY,EAAE,MAAM,GAAG;gBACtB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;aAC3B,CAAC;SACH,CAAC;KACH,CAAC;IACF,KAAK,EAAE;QACL,CAAC,QAAQ,EAAE,MAAM,GAAG;YAClB,CAAC,YAAY,EAAE,MAAM,GAAG;gBACtB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;aAC3B,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;CAC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AU,MAAM,QAAQ,QAAQ;0BAO5D,MAAM,gBAAgB,MAAM,UAAU,MAAM,QAAQ,QAAQ;4BAM5D,MAAM,gBAAgB,MAAM,WAAW,MAAM,EAAE,QAAQ,QAAQ;8BAM/D,MAAM,gBAAgB,MAAM,QAAQ,QAAQ;yBAM5C,MAAM,gBAAgB,MAAM,UAAU,mBAAmB,EAAE;2BAM3D,MAAM,gBAAgB,MAAM;EAgB1C;AAED,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM;;;EAwB7C;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,WAGf;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,QAAQ,WAGf;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,WAEvF"}
|
package/dist/esm/execute/busy.js
CHANGED
|
@@ -28,8 +28,16 @@ function isNotebookPayload(payload) {
|
|
|
28
28
|
payload.cellIds.every((id) => typeof id === 'string') &&
|
|
29
29
|
typeof payload.kind === 'string');
|
|
30
30
|
}
|
|
31
|
+
function isErrorPayload(payload) {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
return ((typeof payload.pageSlug === 'string' &&
|
|
34
|
+
typeof payload.notebookSlug === 'string' &&
|
|
35
|
+
payload.errors === undefined) ||
|
|
36
|
+
((_b = (Array.isArray(payload.errors) &&
|
|
37
|
+
((_a = payload.errors) === null || _a === void 0 ? void 0 : _a.every((error) => typeof error === 'object')))) !== null && _b !== void 0 ? _b : false));
|
|
38
|
+
}
|
|
31
39
|
export function reducer(state, action) {
|
|
32
|
-
var _a, _b, _c, _d, _e;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
33
41
|
switch (action.type) {
|
|
34
42
|
case 'SET_CELL_BUSY': {
|
|
35
43
|
if (!isCellPayload(action.payload)) {
|
|
@@ -47,16 +55,16 @@ export function reducer(state, action) {
|
|
|
47
55
|
return state;
|
|
48
56
|
}
|
|
49
57
|
const { pageSlug, notebookSlug, cellId, kind } = action.payload;
|
|
50
|
-
const
|
|
58
|
+
const _h = state[kind], _j = pageSlug, renderBusy = _h[_j], otherRenders = __rest(_h, [typeof _j === "symbol" ? _j : _j + ""]);
|
|
51
59
|
if (!renderBusy)
|
|
52
60
|
return state;
|
|
53
|
-
const
|
|
61
|
+
const _k = renderBusy, _l = notebookSlug, notebookBusy = _k[_l], otherNotebooks = __rest(_k, [typeof _l === "symbol" ? _l : _l + ""]);
|
|
54
62
|
if (!notebookBusy)
|
|
55
63
|
return state;
|
|
56
64
|
if (!notebookBusy[cellId])
|
|
57
65
|
return state;
|
|
58
66
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
59
|
-
const
|
|
67
|
+
const _m = notebookBusy, _o = cellId, cellBusy = _m[_o], otherCells = __rest(_m, [typeof _o === "symbol" ? _o : _o + ""]);
|
|
60
68
|
// remove the render if it's empty
|
|
61
69
|
if (Object.keys(otherCells).length === 0 && Object.keys(otherNotebooks).length === 0) {
|
|
62
70
|
return Object.assign(Object.assign({}, state), { [kind]: otherRenders });
|
|
@@ -86,19 +94,54 @@ export function reducer(state, action) {
|
|
|
86
94
|
if (!((_e = state[kind][pageSlug]) === null || _e === void 0 ? void 0 : _e[notebookSlug]))
|
|
87
95
|
return state;
|
|
88
96
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
|
-
const
|
|
97
|
+
const _p = state[kind][pageSlug], _q = notebookSlug, notebookBusy = _p[_q], otherNotebooks = __rest(_p, [typeof _q === "symbol" ? _q : _q + ""]);
|
|
90
98
|
if (Object.keys(otherNotebooks).length === 0) {
|
|
91
99
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
92
|
-
const
|
|
100
|
+
const _r = state[kind], _s = pageSlug, renderBusy = _r[_s], otherRenders = __rest(_r, [typeof _s === "symbol" ? _s : _s + ""]);
|
|
93
101
|
return Object.assign(Object.assign({}, state), { [kind]: otherRenders });
|
|
94
102
|
}
|
|
95
103
|
return Object.assign(Object.assign({}, state), { [kind]: Object.assign(Object.assign({}, state[kind]), { [pageSlug]: Object.assign({}, otherNotebooks) }) });
|
|
96
104
|
}
|
|
105
|
+
case 'SET_ERROR': {
|
|
106
|
+
if (!isErrorPayload(action.payload)) {
|
|
107
|
+
console.error('SET_ERROR payload must be an error payload', action.payload);
|
|
108
|
+
return state;
|
|
109
|
+
}
|
|
110
|
+
const { pageSlug, notebookSlug, errors } = action.payload;
|
|
111
|
+
if (!errors) {
|
|
112
|
+
console.error('SET_ERROR payload must have errors', action.payload);
|
|
113
|
+
return state;
|
|
114
|
+
}
|
|
115
|
+
if (state.error[pageSlug])
|
|
116
|
+
return state;
|
|
117
|
+
if ((_f = state.error[pageSlug]) === null || _f === void 0 ? void 0 : _f[notebookSlug])
|
|
118
|
+
return state;
|
|
119
|
+
return Object.assign(Object.assign({}, state), { error: Object.assign(Object.assign({}, state.error), { [pageSlug]: Object.assign(Object.assign({}, state.error[pageSlug]), { [notebookSlug]: errors }) }) });
|
|
120
|
+
}
|
|
121
|
+
case 'CLEAR_ERROR': {
|
|
122
|
+
if (!isErrorPayload(action.payload)) {
|
|
123
|
+
console.error('CLEAR_ERROR payload must be a error payload', action.payload);
|
|
124
|
+
return state;
|
|
125
|
+
}
|
|
126
|
+
const { pageSlug, notebookSlug } = action.payload;
|
|
127
|
+
if (!state.error[pageSlug])
|
|
128
|
+
return state;
|
|
129
|
+
if (!((_g = state.error[pageSlug]) === null || _g === void 0 ? void 0 : _g[notebookSlug]))
|
|
130
|
+
return state;
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
+
const _t = state.error[pageSlug], _u = notebookSlug, notebookErrors = _t[_u], otherNotebooks = __rest(_t, [typeof _u === "symbol" ? _u : _u + ""]);
|
|
133
|
+
if (Object.keys(otherNotebooks).length > 0) {
|
|
134
|
+
return Object.assign(Object.assign({}, state), { error: Object.assign(Object.assign({}, state.error), { [pageSlug]: Object.assign({}, otherNotebooks) }) });
|
|
135
|
+
}
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
137
|
+
const _v = state.error, _w = pageSlug, renderErrors = _v[_w], otherRenders = __rest(_v, [typeof _w === "symbol" ? _w : _w + ""]);
|
|
138
|
+
return Object.assign(Object.assign({}, state), { error: otherRenders });
|
|
139
|
+
}
|
|
97
140
|
}
|
|
98
141
|
return state;
|
|
99
142
|
}
|
|
100
143
|
export function BusyScopeProvider({ children }) {
|
|
101
|
-
const [state, dispatch] = useReducer(reducer, { execute: {}, reset: {} });
|
|
144
|
+
const [state, dispatch] = useReducer(reducer, { execute: {}, reset: {}, error: {} });
|
|
102
145
|
const memo = React.useMemo(() => ({ state, dispatch }), [state]);
|
|
103
146
|
if (typeof window !== 'undefined') {
|
|
104
147
|
window.busyScopeState = memo.state;
|
|
@@ -120,7 +163,40 @@ export function useBusyScope() {
|
|
|
120
163
|
const clearCell = useCallback((pageSlug, notebookSlug, cellId, kind) => dispatch({ type: 'CLEAR_CELL_BUSY', payload: { pageSlug, notebookSlug, cellId, kind } }), [dispatch]);
|
|
121
164
|
const setNotebook = useCallback((pageSlug, notebookSlug, cellIds, kind) => dispatch({ type: 'SET_NOTEBOOK_BUSY', payload: { pageSlug, notebookSlug, cellIds, kind } }), [dispatch]);
|
|
122
165
|
const clearNotebook = useCallback((pageSlug, notebookSlug, kind) => dispatch({ type: 'CLEAR_NOTEBOOK_BUSY', payload: { pageSlug, notebookSlug, kind } }), [dispatch]);
|
|
123
|
-
|
|
166
|
+
const setError = useCallback((pageSlug, notebookSlug, errors) => dispatch({ type: 'SET_ERROR', payload: { pageSlug, notebookSlug, errors } }), [dispatch]);
|
|
167
|
+
const clearError = useCallback((pageSlug, notebookSlug) => dispatch({ type: 'CLEAR_ERROR', payload: { pageSlug, notebookSlug } }), [dispatch]);
|
|
168
|
+
return {
|
|
169
|
+
cell,
|
|
170
|
+
notebook,
|
|
171
|
+
page,
|
|
172
|
+
setCell,
|
|
173
|
+
clearCell,
|
|
174
|
+
setNotebook,
|
|
175
|
+
clearNotebook,
|
|
176
|
+
setError,
|
|
177
|
+
clearError,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
export function useBusyErrors(pageSlug) {
|
|
181
|
+
const context = React.useContext(BusyScopeContext);
|
|
182
|
+
if (context === undefined) {
|
|
183
|
+
throw new Error('useBusyScope must be used within a BusyScopeProvider');
|
|
184
|
+
}
|
|
185
|
+
const { state, dispatch } = context;
|
|
186
|
+
const clearErrors = () => {
|
|
187
|
+
Object.keys(state.error[pageSlug]).forEach((notebookSlug) => {
|
|
188
|
+
dispatch({ type: 'CLEAR_ERROR', payload: { pageSlug, notebookSlug } });
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
let items;
|
|
192
|
+
if (Object.keys(state.error).length > 0 && state.error[pageSlug]) {
|
|
193
|
+
items = Object.entries(state.error[pageSlug]).map(([notebookSlug, errors]) => ({
|
|
194
|
+
pageSlug,
|
|
195
|
+
notebookSlug,
|
|
196
|
+
errors,
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
return { items, clearErrors };
|
|
124
200
|
}
|
|
125
201
|
export function selectCellIsBusy(state, pageSlug, notebookSlug, cellId, kind) {
|
|
126
202
|
var _a, _b;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { IdOrKey } from './types';
|
|
3
3
|
import type { IThebeCell } from 'thebe-core';
|
|
4
|
-
import { SourceFileKind } from 'myst-
|
|
4
|
+
import { SourceFileKind } from 'myst-spec-ext';
|
|
5
5
|
export declare function useExecutionScope({ clearOutputsOnExecute, }?: {
|
|
6
6
|
clearOutputsOnExecute?: boolean;
|
|
7
7
|
}): {
|
|
@@ -10,6 +10,7 @@ export declare function useExecutionScope({ clearOutputsOnExecute, }?: {
|
|
|
10
10
|
clearAll: (pageSlug: string) => void;
|
|
11
11
|
resetAll: (pageSlug: string) => void;
|
|
12
12
|
execute: (slug: string) => void;
|
|
13
|
+
canCompute: boolean;
|
|
13
14
|
slug: string;
|
|
14
15
|
state: import("./types").ExecuteScopeState;
|
|
15
16
|
dispatch: React.Dispatch<import("./actions").ExecuteScopeAction>;
|
|
@@ -31,6 +32,7 @@ export declare function useNotebookExecution(id: IdOrKey, clearOutputsOnExecute?
|
|
|
31
32
|
notebookIsResetting: boolean;
|
|
32
33
|
notebookIsBusy: boolean;
|
|
33
34
|
executionCount: number | null | undefined;
|
|
35
|
+
canCompute: boolean;
|
|
34
36
|
slug: string;
|
|
35
37
|
state: import("./types").ExecuteScopeState;
|
|
36
38
|
dispatch: React.Dispatch<import("./actions").ExecuteScopeAction>;
|
|
@@ -42,7 +44,8 @@ export declare function useNotebookExecution(id: IdOrKey, clearOutputsOnExecute?
|
|
|
42
44
|
* @param id
|
|
43
45
|
* @returns
|
|
44
46
|
*/
|
|
45
|
-
export declare function useCellExecution(id: IdOrKey): {
|
|
47
|
+
export declare function useCellExecution(id: IdOrKey, clearOutputsOnExecute?: boolean): {
|
|
48
|
+
canCompute: boolean;
|
|
46
49
|
kind: SourceFileKind;
|
|
47
50
|
ready: boolean;
|
|
48
51
|
execute: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/execute/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/execute/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAA8C,MAAM,YAAY,CAAC;AAGzF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,wBAAgB,iBAAiB,CAAC,EAChC,qBAA6B,GAC9B,GAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO;;kBAUR,MAAM;yBAuD1B,MAAM;yBAYN,MAAM;oBAzDI,MAAM;;;;;;EAkF9B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO,EAAE,qBAAqB,UAAQ;;;;;;;;;;;;;;;;EAgH9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,qBAAqB,UAAQ;;;;;;;;;;;EAgE1E;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO;;;;EAc/C;AAED,wBAAgB,iBAAiB,YAOhC"}
|
|
@@ -11,7 +11,7 @@ import React, { useCallback } from 'react';
|
|
|
11
11
|
import { ExecuteScopeContext } from './provider';
|
|
12
12
|
import { useBusyScope } from './busy';
|
|
13
13
|
import { findErrors, useThebeConfig } from 'thebe-react';
|
|
14
|
-
import { SourceFileKind } from 'myst-
|
|
14
|
+
import { SourceFileKind } from 'myst-spec-ext';
|
|
15
15
|
import { selectNotebookForPage } from './selectors';
|
|
16
16
|
export function useExecutionScope({ clearOutputsOnExecute = false, } = {}) {
|
|
17
17
|
var _a;
|
|
@@ -34,7 +34,8 @@ export function useExecutionScope({ clearOutputsOnExecute = false, } = {}) {
|
|
|
34
34
|
const execute = (slug) => {
|
|
35
35
|
// set busy
|
|
36
36
|
Object.entries(state.pages[slug].scopes).forEach(([notebookSlug, { notebook }]) => {
|
|
37
|
-
busy.
|
|
37
|
+
busy.clearError(slug, notebookSlug);
|
|
38
|
+
busy.setNotebook(slug, notebookSlug, notebook.code.map((c) => c.id), 'execute');
|
|
38
39
|
});
|
|
39
40
|
if (clearOutputsOnExecute) {
|
|
40
41
|
// clear all notebook cell outputs
|
|
@@ -78,7 +79,8 @@ export function useExecutionScope({ clearOutputsOnExecute = false, } = {}) {
|
|
|
78
79
|
const resetAll = useCallback((pageSlug) => {
|
|
79
80
|
var _a;
|
|
80
81
|
Object.entries((_a = state.pages[pageSlug]) === null || _a === void 0 ? void 0 : _a.scopes).forEach(([notebookSlug, { notebook, session }]) => {
|
|
81
|
-
busy.
|
|
82
|
+
busy.clearError(pageSlug, notebookSlug);
|
|
83
|
+
busy.setNotebook(pageSlug, notebookSlug, notebook.code.map((c) => c.id), 'reset');
|
|
82
84
|
setTimeout(() => {
|
|
83
85
|
var _a;
|
|
84
86
|
notebook.reset();
|
|
@@ -126,8 +128,9 @@ export function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
126
128
|
}
|
|
127
129
|
const execute = () => {
|
|
128
130
|
const nb = selectNotebookForPage(state, pageSlug, notebookSlug);
|
|
131
|
+
busy.clearError(pageSlug, notebookSlug);
|
|
129
132
|
// set busy
|
|
130
|
-
busy.setNotebook(pageSlug, notebookSlug, nb.
|
|
133
|
+
busy.setNotebook(pageSlug, notebookSlug, nb.code.map((c) => c.id), 'execute');
|
|
131
134
|
if (clearOutputsOnExecute)
|
|
132
135
|
nb.clear();
|
|
133
136
|
// let busy state update prior to launching execute
|
|
@@ -142,8 +145,11 @@ export function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
142
145
|
// execute all cells on the notebooks
|
|
143
146
|
const execReturns = yield nb.executeAll(true);
|
|
144
147
|
const errs = findErrors(execReturns);
|
|
145
|
-
if (errs != null)
|
|
146
|
-
console.error('
|
|
148
|
+
if (errs != null) {
|
|
149
|
+
console.error('an error occurred during notebook execution');
|
|
150
|
+
busy.setError(pageSlug, notebookSlug, errs);
|
|
151
|
+
busy.clearNotebook(pageSlug, notebookSlug, 'execute');
|
|
152
|
+
}
|
|
147
153
|
config === null || config === void 0 ? void 0 : config.events.off('status', handler);
|
|
148
154
|
}), 100);
|
|
149
155
|
};
|
|
@@ -160,7 +166,8 @@ export function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
160
166
|
*/
|
|
161
167
|
const reset = useCallback(() => {
|
|
162
168
|
const nb = selectNotebookForPage(state, pageSlug, notebookSlug);
|
|
163
|
-
busy.
|
|
169
|
+
busy.clearError(pageSlug, notebookSlug);
|
|
170
|
+
busy.setNotebook(pageSlug, notebookSlug, nb.code.map((c) => c.id), 'reset');
|
|
164
171
|
setTimeout(() => {
|
|
165
172
|
var _a, _b;
|
|
166
173
|
nb.reset();
|
|
@@ -187,7 +194,7 @@ export function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
187
194
|
* @param id
|
|
188
195
|
* @returns
|
|
189
196
|
*/
|
|
190
|
-
export function useCellExecution(id) {
|
|
197
|
+
export function useCellExecution(id, clearOutputsOnExecute = false) {
|
|
191
198
|
var _a, _b, _c, _d;
|
|
192
199
|
const busy = useBusyScope();
|
|
193
200
|
const context = React.useContext(ExecuteScopeContext);
|
|
@@ -213,7 +220,8 @@ export function useCellExecution(id) {
|
|
|
213
220
|
}
|
|
214
221
|
// set busy
|
|
215
222
|
busy.setCell(pageSlug, notebookSlug, cell.id, 'execute');
|
|
216
|
-
|
|
223
|
+
if (clearOutputsOnExecute)
|
|
224
|
+
cell.clear();
|
|
217
225
|
// let busy state update prior to launching execute
|
|
218
226
|
setTimeout(() => {
|
|
219
227
|
if (!cell)
|
|
@@ -236,6 +244,7 @@ export function useCellExecution(id) {
|
|
|
236
244
|
const notebookIsResetting = busy.notebook(pageSlug, notebookSlug, 'reset');
|
|
237
245
|
const notebookIsBusy = notebookIsExecuting || notebookIsResetting;
|
|
238
246
|
return {
|
|
247
|
+
canCompute: context.canCompute,
|
|
239
248
|
kind,
|
|
240
249
|
ready,
|
|
241
250
|
execute,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { Dependency } from 'myst-
|
|
2
|
-
import { SourceFileKind } from 'myst-
|
|
1
|
+
import type { Dependency } from 'myst-spec-ext';
|
|
2
|
+
import { SourceFileKind } from 'myst-spec-ext';
|
|
3
3
|
import type { Root } from 'mdast';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import type { ExecuteScopeAction } from './actions';
|
|
6
6
|
import type { ExecuteScopeState, IdKeyMap } from './types';
|
|
7
|
+
import type { Thebe } from 'myst-frontmatter';
|
|
7
8
|
export interface ExecuteScopeType {
|
|
9
|
+
canCompute: boolean;
|
|
8
10
|
slug: string;
|
|
9
11
|
state: ExecuteScopeState;
|
|
10
12
|
dispatch: React.Dispatch<ExecuteScopeAction>;
|
|
@@ -16,6 +18,9 @@ type ArticleContents = {
|
|
|
16
18
|
kind: SourceFileKind;
|
|
17
19
|
mdast: Root;
|
|
18
20
|
dependencies?: Dependency[];
|
|
21
|
+
frontmatter: {
|
|
22
|
+
thebe?: boolean | Thebe;
|
|
23
|
+
};
|
|
19
24
|
};
|
|
20
25
|
/**
|
|
21
26
|
* The ExecuteScopeProvider is responsible for maintaining the state of the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/execute/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/execute/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,KAAwC,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAc,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AASvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG9C,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC7C,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB,6CAA+D,CAAC;AAEhG,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;IAC5B,WAAW,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;KAAE,CAAC;CAC1C,CAAC;AA8DF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC,2CAiGxD"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SourceFileKind } from 'myst-
|
|
2
|
+
import { SourceFileKind } from 'myst-spec-ext';
|
|
3
3
|
import React, { useEffect, useReducer, useRef } from 'react';
|
|
4
4
|
import { selectAll } from 'unist-util-select';
|
|
5
5
|
import { reducer } from './reducer';
|
|
6
6
|
import { selectAreAllDependenciesReady, selectDependenciesToFetch, selectScopeNotebooksToBuild, selectSessionsToStart, } from './selectors';
|
|
7
7
|
import { MdastFetcher, NotebookBuilder, ServerMonitor, SessionStarter } from './leaf';
|
|
8
|
+
import { useCanCompute } from '../providers';
|
|
8
9
|
export const ExecuteScopeContext = React.createContext(undefined);
|
|
9
10
|
function useScopeNavigate({ contents: { slug, kind, mdast, dependencies }, state, dispatch, }) {
|
|
10
11
|
useEffect(() => {
|
|
@@ -56,6 +57,7 @@ function useExecutionScopeFetcher({ slug, state, dispatch, }) {
|
|
|
56
57
|
*/
|
|
57
58
|
export function ExecuteScopeProvider({ children, contents, }) {
|
|
58
59
|
var _a;
|
|
60
|
+
const canCompute = useCanCompute(contents);
|
|
59
61
|
// compute incoming for first render
|
|
60
62
|
const computables = selectAll('container > embed', contents.mdast).map((node) => {
|
|
61
63
|
const { key, label, source } = node;
|
|
@@ -91,7 +93,7 @@ export function ExecuteScopeProvider({ children, contents, }) {
|
|
|
91
93
|
const fetchTargets = selectDependenciesToFetch(state);
|
|
92
94
|
const notebookBuildTargets = selectScopeNotebooksToBuild(state);
|
|
93
95
|
const sessionStartTargets = selectSessionsToStart(state);
|
|
94
|
-
const memo = React.useMemo(() => ({ slug: contents.slug, state, dispatch, idkmap: idkmap.current }), [state, contents.slug]);
|
|
96
|
+
const memo = React.useMemo(() => ({ canCompute, slug: contents.slug, state, dispatch, idkmap: idkmap.current }), [state, contents.slug]);
|
|
95
97
|
if (typeof window !== 'undefined') {
|
|
96
98
|
window.executeScope = memo;
|
|
97
99
|
}
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { SourceFileKind } from 'myst-
|
|
12
|
+
import { SourceFileKind } from 'myst-spec-ext';
|
|
13
13
|
import { isAddMdastPayload, isAddNotebookPayload, isAddSessionPayload, isBuildStatusPayload, isNavigatePayload, isSlugPayload, } from './actions';
|
|
14
14
|
export function reducer(state, action) {
|
|
15
15
|
var _a;
|
|
@@ -22,5 +22,4 @@ export declare const selectSessionsToStart: (state: ExecuteScopeState) => {
|
|
|
22
22
|
export declare function selectAreAllDependenciesReady(state: ExecuteScopeState, slug: string): boolean;
|
|
23
23
|
export declare function selectAreAllNotebookScopesBuilt(state: ExecuteScopeState, slug: string): boolean;
|
|
24
24
|
export declare function selectAreAllSessionsStarted(state: ExecuteScopeState, slug: string): boolean;
|
|
25
|
-
export declare function selectNotebookCellIds(state: ExecuteScopeState, pageSlug: string, notebookSlug: string): string[];
|
|
26
25
|
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/execute/selectors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE9D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM;;EAE5E;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,oDAGrB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAExE;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAEnF;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAEtF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,yBAEhF;AAQD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,iBAAiB;UAKpD,MAAM;SACP,MAAM;IAclB;AAsBD,eAAO,MAAM,2BAA2B,UAlBvB,iBAAiB,KAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,C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jF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAInF;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAKrF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAMjF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SourceFileKind } from 'myst-
|
|
1
|
+
import { SourceFileKind } from 'myst-spec-ext';
|
|
2
2
|
export function selectScopeForPage(state, pageSlug) {
|
|
3
3
|
var _a, _b;
|
|
4
4
|
return (_b = (_a = state.pages[pageSlug]) === null || _a === void 0 ? void 0 : _a.scopes) !== null && _b !== void 0 ? _b : {};
|
|
@@ -34,11 +34,11 @@ export function selectDependenciesToFetch(state) {
|
|
|
34
34
|
.reduce((targets, [slug]) => [
|
|
35
35
|
...targets,
|
|
36
36
|
...state.pages[slug].dependencies
|
|
37
|
-
.filter((d) => { var _a; return !state.mdast[(_a = d.slug) !== null && _a !== void 0 ? _a : d.url]; })
|
|
37
|
+
.filter((d) => { var _a; return !state.mdast[((_a = d.slug) !== null && _a !== void 0 ? _a : d.url)]; })
|
|
38
38
|
.map((d) => {
|
|
39
39
|
var _a;
|
|
40
40
|
return ({
|
|
41
|
-
slug: (_a = d.slug) !== null && _a !== void 0 ? _a : d.url,
|
|
41
|
+
slug: ((_a = d.slug) !== null && _a !== void 0 ? _a : d.url),
|
|
42
42
|
url: d.url,
|
|
43
43
|
});
|
|
44
44
|
}),
|
|
@@ -57,7 +57,7 @@ function makeSelectScopeEventStatus(statusName) {
|
|
|
57
57
|
var _a;
|
|
58
58
|
return ({
|
|
59
59
|
pageSlug: slug,
|
|
60
|
-
notebookSlug: (_a = d.slug) !== null && _a !== void 0 ? _a : d.url,
|
|
60
|
+
notebookSlug: ((_a = d.slug) !== null && _a !== void 0 ? _a : d.url),
|
|
61
61
|
});
|
|
62
62
|
}));
|
|
63
63
|
return [...all, ...targets];
|
|
@@ -68,18 +68,14 @@ export const selectScopeNotebooksToBuild = makeSelectScopeEventStatus('build-not
|
|
|
68
68
|
export const selectSessionsToStart = makeSelectScopeEventStatus('start-session');
|
|
69
69
|
export function selectAreAllDependenciesReady(state, slug) {
|
|
70
70
|
var _a;
|
|
71
|
-
return (_a = state.pages[slug]) === null || _a === void 0 ? void 0 : _a.dependencies.every((dep) => { var _a; return !!state.mdast[(_a = dep.slug) !== null && _a !== void 0 ? _a : dep.url]; });
|
|
71
|
+
return (_a = state.pages[slug]) === null || _a === void 0 ? void 0 : _a.dependencies.every((dep) => { var _a; return !!state.mdast[((_a = dep.slug) !== null && _a !== void 0 ? _a : dep.url)]; });
|
|
72
72
|
}
|
|
73
73
|
export function selectAreAllNotebookScopesBuilt(state, slug) {
|
|
74
74
|
const rendering = state.pages[slug];
|
|
75
|
-
return rendering === null || rendering === void 0 ? void 0 : rendering.dependencies.every((dep) => { var _a; return !!rendering.scopes[(_a = dep.slug) !== null && _a !== void 0 ? _a : dep.url]; });
|
|
75
|
+
return rendering === null || rendering === void 0 ? void 0 : rendering.dependencies.every((dep) => { var _a; return !!rendering.scopes[((_a = dep.slug) !== null && _a !== void 0 ? _a : dep.url)]; });
|
|
76
76
|
}
|
|
77
77
|
export function selectAreAllSessionsStarted(state, slug) {
|
|
78
78
|
const rendering = state.pages[slug];
|
|
79
79
|
// TODO is this working??
|
|
80
|
-
return rendering === null || rendering === void 0 ? void 0 : rendering.dependencies.every((dep) => { var _a, _b; return !!((_b = rendering.scopes[(_a = dep.slug) !== null && _a !== void 0 ? _a : dep.url]) === null || _b === void 0 ? void 0 : _b.session); });
|
|
81
|
-
}
|
|
82
|
-
export function selectNotebookCellIds(state, pageSlug, notebookSlug) {
|
|
83
|
-
var _a, _b, _c, _d;
|
|
84
|
-
return (_d = (_c = (_b = (_a = state.pages[pageSlug]) === null || _a === void 0 ? void 0 : _a.scopes[notebookSlug]) === null || _b === void 0 ? void 0 : _b.notebook) === null || _c === void 0 ? void 0 : _c.cells.map(({ id }) => id)) !== null && _d !== void 0 ? _d : [];
|
|
80
|
+
return rendering === null || rendering === void 0 ? void 0 : rendering.dependencies.every((dep) => { var _a, _b; return !!((_b = rendering.scopes[((_a = dep.slug) !== null && _a !== void 0 ? _a : dep.url)]) === null || _b === void 0 ? void 0 : _b.session); });
|
|
85
81
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Root } from 'mdast';
|
|
2
|
-
import type { SourceFileKind, Dependency } from 'myst-
|
|
2
|
+
import type { SourceFileKind, Dependency } from 'myst-spec-ext';
|
|
3
3
|
import type { IRenderMimeRegistry, ThebeNotebook, ThebeSession } from 'thebe-core';
|
|
4
4
|
export type BuildStatus = 'pending' | 'fetching' | 'build-notebooks' | 'wait-for-server' | 'start-session' | 'error';
|
|
5
5
|
export type IdOrKey = string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/execute/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/execute/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnF,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,OAAO,CAAC;AAEZ,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MAAM,MAAM,GAAG,MAAM,CAA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AAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,QAAQ,EAChB,UAAU,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/execute/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,QAAQ,EAChB,UAAU,EAAE,mBAAmB,oDAuDhC"}
|
|
@@ -37,20 +37,21 @@ export function notebookFromMdast(core, config, pageSlug, notebookSlug, mdast, i
|
|
|
37
37
|
notebookSlug,
|
|
38
38
|
cellId: block.key,
|
|
39
39
|
};
|
|
40
|
-
idkmap[block.key] = target;
|
|
41
|
-
idkmap[
|
|
42
|
-
|
|
43
|
-
// include block labels to enable lookup by from embedded blocks
|
|
44
|
-
if (block.label)
|
|
45
|
-
idkmap[block.label] = target;
|
|
40
|
+
idkmap[block.key] = target; // can reference from block in notebook views
|
|
41
|
+
idkmap[output.id] = target; // can reference from output in article views
|
|
42
|
+
// include identifiers to enable lookup by (normalized) labels
|
|
46
43
|
if (block.identifier)
|
|
47
44
|
idkmap[block.identifier] = target;
|
|
48
|
-
|
|
45
|
+
if (codeCell.identifier)
|
|
46
|
+
idkmap[codeCell.identifier] = target;
|
|
47
|
+
if (output.identifier)
|
|
48
|
+
idkmap[output.identifier] = target;
|
|
49
|
+
return new core.ThebeCodeCell(target.cellId, notebook.id, (_a = codeCell.value) !== null && _a !== void 0 ? _a : '', config, (_b = block.data) !== null && _b !== void 0 ? _b : {}, notebook.rendermime);
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
51
52
|
// assume content - concatenate it
|
|
52
53
|
// TODO inject cell metadata
|
|
53
|
-
const cell = new core.
|
|
54
|
+
const cell = new core.ThebeMarkdownCell(block.key, notebook.id, block.children.reduce((acc, child) => { var _a; return acc + '\n' + ((_a = child.value) !== null && _a !== void 0 ? _a : ''); }, ''), (_c = block.data) !== null && _c !== void 0 ? _c : {}, notebook.rendermime);
|
|
54
55
|
return cell;
|
|
55
56
|
}
|
|
56
57
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figure.d.ts","sourceRoot":"","sources":["../../src/figure.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,2CAoBrD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SourceFileKind } from 'myst-spec-ext';
|
|
3
|
+
import { DEFAULT_RENDERERS, MyST } from 'myst-to-react';
|
|
4
|
+
import { OutputDecoration } from './decoration';
|
|
5
|
+
export function Figure({ node }) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7
|
+
const { container: Container } = DEFAULT_RENDERERS;
|
|
8
|
+
const isFromJupyer = ((_a = node.source) === null || _a === void 0 ? void 0 : _a.kind) === SourceFileKind.Notebook;
|
|
9
|
+
const output = (_b = node.children) === null || _b === void 0 ? void 0 : _b.find((child) => child.type === 'output');
|
|
10
|
+
if (isFromJupyer && !!output) {
|
|
11
|
+
const placeholder = (_c = node.children) === null || _c === void 0 ? void 0 : _c.find((child) => child.type === 'image' && child.placeholder);
|
|
12
|
+
const others = (_d = node.children) === null || _d === void 0 ? void 0 : _d.filter((child) => !(child.type === 'image' && child.placeholder));
|
|
13
|
+
return (_jsx(OutputDecoration, { outputId: output.id, placeholder: placeholder, title: (_e = node.source) === null || _e === void 0 ? void 0 : _e.title, url: (_f = node.source) === null || _f === void 0 ? void 0 : _f.url, children: _jsx(MyST, { ast: others }) }, node.key));
|
|
14
|
+
}
|
|
15
|
+
return _jsx(Container, { node: node });
|
|
16
|
+
}
|