@myst-theme/jupyter 0.3.7 → 0.3.8
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/embed.d.ts.map +1 -1
- package/dist/cjs/embed.js +7 -3
- package/dist/cjs/execute/hooks.d.ts +3 -0
- package/dist/cjs/execute/hooks.d.ts.map +1 -1
- package/dist/cjs/execute/hooks.js +5 -4
- package/dist/cjs/execute/provider.d.ts +5 -0
- package/dist/cjs/execute/provider.d.ts.map +1 -1
- package/dist/cjs/execute/provider.js +3 -1
- 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 +1 -6
- package/dist/cjs/execute/utils.js +1 -1
- package/dist/cjs/providers.d.ts +6 -1
- package/dist/cjs/providers.d.ts.map +1 -1
- package/dist/cjs/providers.js +8 -3
- package/dist/esm/BinderBadge.js +1 -1
- package/dist/esm/embed.d.ts.map +1 -1
- package/dist/esm/embed.js +7 -3
- package/dist/esm/execute/hooks.d.ts +3 -0
- package/dist/esm/execute/hooks.d.ts.map +1 -1
- package/dist/esm/execute/hooks.js +5 -4
- package/dist/esm/execute/provider.d.ts +5 -0
- package/dist/esm/execute/provider.d.ts.map +1 -1
- package/dist/esm/execute/provider.js +3 -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 +0 -4
- package/dist/esm/execute/utils.js +1 -1
- package/dist/esm/providers.d.ts +6 -1
- package/dist/esm/providers.d.ts.map +1 -1
- package/dist/esm/providers.js +6 -2
- package/dist/types/embed.d.ts.map +1 -1
- package/dist/types/execute/hooks.d.ts +3 -0
- package/dist/types/execute/hooks.d.ts.map +1 -1
- package/dist/types/execute/provider.d.ts +5 -0
- 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/providers.d.ts +6 -1
- package/dist/types/providers.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/cjs/BinderBadge.js
CHANGED
|
@@ -8,6 +8,6 @@ function BinderBadgeLogo() {
|
|
|
8
8
|
function BinderBadge({ binder }) {
|
|
9
9
|
if (!binder)
|
|
10
10
|
return null;
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "inline-block
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "inline-block m-1 opacity-80 hover:opacity-100", children: (0, jsx_runtime_1.jsx)("a", { href: binder, title: `Launch Binder Session: ${binder}`, target: "_blank", rel: "noopener noreferrer", className: "text-inherit hover:text-inherit", children: (0, jsx_runtime_1.jsx)(BinderBadgeLogo, {}) }) }));
|
|
12
12
|
}
|
|
13
13
|
exports.BinderBadge = BinderBadge;
|
package/dist/cjs/embed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/embed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/embed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AA2E/D,wBAAgB,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,2CAajE"}
|
package/dist/cjs/embed.js
CHANGED
|
@@ -9,11 +9,15 @@ const solid_1 = require("@scienceicons/react/24/solid");
|
|
|
9
9
|
const unist_util_select_1 = require("unist-util-select");
|
|
10
10
|
const providers_1 = require("@myst-theme/providers");
|
|
11
11
|
function EmbedWithControls({ outputKey, children, title = 'Jupyter Notebook', url, }) {
|
|
12
|
-
const { kind } = (0, execute_1.useCellExecution)(outputKey);
|
|
12
|
+
const { canCompute, kind } = (0, execute_1.useCellExecution)(outputKey);
|
|
13
13
|
const Link = (0, providers_1.useLinkProvider)();
|
|
14
14
|
const baseurl = (0, providers_1.useBaseurl)();
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const showComputeControls = canCompute && kind === myst_common_1.SourceFileKind.Article;
|
|
16
|
+
if (showComputeControls) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "shadow", children: [(0, jsx_runtime_1.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: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)(solid_1.JupyterIcon, { className: "inline-block w-5 h-5" }), (0, jsx_runtime_1.jsx)("span", { className: "ml-2", children: "Source:" }), url && ((0, jsx_runtime_1.jsx)(Link, { to: (0, providers_1.withBaseurl)(url, baseurl), className: "ml-2 no-underline text-normal hover:underline", children: title }))] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow" }), (0, jsx_runtime_1.jsx)(ArticleCellControls_1.ArticleStatusBadge, { id: outputKey }), (0, jsx_runtime_1.jsx)(ArticleCellControls_1.ArticleRunNotebook, { id: outputKey }), (0, jsx_runtime_1.jsx)(ArticleCellControls_1.ArticleResetNotebook, { id: outputKey })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2", children: children })] }));
|
|
18
|
+
}
|
|
19
|
+
// light
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children, (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-end text-xs", children: [(0, jsx_runtime_1.jsx)(solid_1.JupyterIcon, { className: "inline-block w-3 h-3" }), (0, jsx_runtime_1.jsx)("div", { className: "ml-1", children: "Source:" }), url && ((0, jsx_runtime_1.jsx)(Link, { to: (0, providers_1.withBaseurl)(url, baseurl), className: "ml-1 no-underline text-normal hover:underline", children: title }))] })] }));
|
|
17
21
|
}
|
|
18
22
|
function Embed(node, children) {
|
|
19
23
|
var _a, _b;
|
|
@@ -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>;
|
|
@@ -43,6 +45,7 @@ export declare function useNotebookExecution(id: IdOrKey, clearOutputsOnExecute?
|
|
|
43
45
|
* @returns
|
|
44
46
|
*/
|
|
45
47
|
export declare function useCellExecution(id: IdOrKey): {
|
|
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,aAAa,CAAC;AAG7C,wBAAgB,iBAAiB,CAAC,EAChC,qBAA6B,GAC9B,GAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO;;kBAUR,MAAM;yBAsD1B,MAAM;yBAYN,MAAM;oBAxDI,MAAM;;;;;;EAgF9B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO,EAAE,qBAAqB,UAAQ;;;;;;;;;;;;;;;;EA2G9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO;;;;;;;;;;;EAgE3C;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO;;;;EAc/C;AAED,wBAAgB,iBAAiB,YAOhC"}
|
|
@@ -60,7 +60,7 @@ function useExecutionScope({ clearOutputsOnExecute = false, } = {}) {
|
|
|
60
60
|
const execute = (slug) => {
|
|
61
61
|
// set busy
|
|
62
62
|
Object.entries(state.pages[slug].scopes).forEach(([notebookSlug, { notebook }]) => {
|
|
63
|
-
busy.setNotebook(slug, notebookSlug, notebook.
|
|
63
|
+
busy.setNotebook(slug, notebookSlug, notebook.code.map((c) => c.id), 'execute');
|
|
64
64
|
});
|
|
65
65
|
if (clearOutputsOnExecute) {
|
|
66
66
|
// clear all notebook cell outputs
|
|
@@ -104,7 +104,7 @@ function useExecutionScope({ clearOutputsOnExecute = false, } = {}) {
|
|
|
104
104
|
const resetAll = (0, react_1.useCallback)((pageSlug) => {
|
|
105
105
|
var _a;
|
|
106
106
|
Object.entries((_a = state.pages[pageSlug]) === null || _a === void 0 ? void 0 : _a.scopes).forEach(([notebookSlug, { notebook, session }]) => {
|
|
107
|
-
busy.setNotebook(pageSlug, notebookSlug, notebook.
|
|
107
|
+
busy.setNotebook(pageSlug, notebookSlug, notebook.code.map((c) => c.id), 'reset');
|
|
108
108
|
setTimeout(() => {
|
|
109
109
|
var _a;
|
|
110
110
|
notebook.reset();
|
|
@@ -154,7 +154,7 @@ function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
154
154
|
const execute = () => {
|
|
155
155
|
const nb = (0, selectors_1.selectNotebookForPage)(state, pageSlug, notebookSlug);
|
|
156
156
|
// set busy
|
|
157
|
-
busy.setNotebook(pageSlug, notebookSlug, nb.
|
|
157
|
+
busy.setNotebook(pageSlug, notebookSlug, nb.code.map((c) => c.id), 'execute');
|
|
158
158
|
if (clearOutputsOnExecute)
|
|
159
159
|
nb.clear();
|
|
160
160
|
// let busy state update prior to launching execute
|
|
@@ -187,7 +187,7 @@ function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
187
187
|
*/
|
|
188
188
|
const reset = (0, react_1.useCallback)(() => {
|
|
189
189
|
const nb = (0, selectors_1.selectNotebookForPage)(state, pageSlug, notebookSlug);
|
|
190
|
-
busy.setNotebook(pageSlug, notebookSlug, nb.
|
|
190
|
+
busy.setNotebook(pageSlug, notebookSlug, nb.code.map((c) => c.id), 'reset');
|
|
191
191
|
setTimeout(() => {
|
|
192
192
|
var _a, _b;
|
|
193
193
|
nb.reset();
|
|
@@ -264,6 +264,7 @@ function useCellExecution(id) {
|
|
|
264
264
|
const notebookIsResetting = busy.notebook(pageSlug, notebookSlug, 'reset');
|
|
265
265
|
const notebookIsBusy = notebookIsExecuting || notebookIsResetting;
|
|
266
266
|
return {
|
|
267
|
+
canCompute: context.canCompute,
|
|
267
268
|
kind,
|
|
268
269
|
ready,
|
|
269
270
|
execute,
|
|
@@ -4,7 +4,9 @@ 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,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,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;AAUvE,MAAM,WAAW,gBAAgB;IAC/B,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;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/execute/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,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;AAUvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,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"}
|
|
@@ -31,6 +31,7 @@ const unist_util_select_1 = require("unist-util-select");
|
|
|
31
31
|
const reducer_1 = require("./reducer");
|
|
32
32
|
const selectors_1 = require("./selectors");
|
|
33
33
|
const leaf_1 = require("./leaf");
|
|
34
|
+
const __1 = require("..");
|
|
34
35
|
exports.ExecuteScopeContext = react_1.default.createContext(undefined);
|
|
35
36
|
function useScopeNavigate({ contents: { slug, kind, mdast, dependencies }, state, dispatch, }) {
|
|
36
37
|
(0, react_1.useEffect)(() => {
|
|
@@ -82,6 +83,7 @@ function useExecutionScopeFetcher({ slug, state, dispatch, }) {
|
|
|
82
83
|
*/
|
|
83
84
|
function ExecuteScopeProvider({ children, contents, }) {
|
|
84
85
|
var _a;
|
|
86
|
+
const canCompute = (0, __1.useCanCompute)(contents);
|
|
85
87
|
// compute incoming for first render
|
|
86
88
|
const computables = (0, unist_util_select_1.selectAll)('container > embed', contents.mdast).map((node) => {
|
|
87
89
|
const { key, label, source } = node;
|
|
@@ -117,7 +119,7 @@ function ExecuteScopeProvider({ children, contents, }) {
|
|
|
117
119
|
const fetchTargets = (0, selectors_1.selectDependenciesToFetch)(state);
|
|
118
120
|
const notebookBuildTargets = (0, selectors_1.selectScopeNotebooksToBuild)(state);
|
|
119
121
|
const sessionStartTargets = (0, selectors_1.selectSessionsToStart)(state);
|
|
120
|
-
const memo = react_1.default.useMemo(() => ({ slug: contents.slug, state, dispatch, idkmap: idkmap.current }), [state, contents.slug]);
|
|
122
|
+
const memo = react_1.default.useMemo(() => ({ canCompute, slug: contents.slug, state, dispatch, idkmap: idkmap.current }), [state, contents.slug]);
|
|
121
123
|
if (typeof window !== 'undefined') {
|
|
122
124
|
window.executeScope = memo;
|
|
123
125
|
}
|
|
@@ -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,CAAA;CAAE,EAkBS,CAAC;AACzF,eAAO,MAAM,qBAAqB,UAnBjB,iBAAiB,KAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EAmBC,CAAC;AAEjF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAEnF;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAA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AK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAGrF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAIjF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.selectAreAllSessionsStarted = exports.selectAreAllNotebookScopesBuilt = exports.selectAreAllDependenciesReady = exports.selectSessionsToStart = exports.selectScopeNotebooksToBuild = exports.selectDependenciesToFetch = exports.selectExecutionScopeStatus = exports.selectAreExecutionScopesBuilding = exports.selectAreExecutionScopesReady = exports.selectIsComputable = exports.selectNotebookForPage = exports.selectScopeForPage = void 0;
|
|
4
4
|
const myst_common_1 = require("myst-common");
|
|
5
5
|
function selectScopeForPage(state, pageSlug) {
|
|
6
6
|
var _a, _b;
|
|
@@ -92,8 +92,3 @@ function selectAreAllSessionsStarted(state, slug) {
|
|
|
92
92
|
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); });
|
|
93
93
|
}
|
|
94
94
|
exports.selectAreAllSessionsStarted = selectAreAllSessionsStarted;
|
|
95
|
-
function selectNotebookCellIds(state, pageSlug, notebookSlug) {
|
|
96
|
-
var _a, _b, _c, _d;
|
|
97
|
-
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 : [];
|
|
98
|
-
}
|
|
99
|
-
exports.selectNotebookCellIds = selectNotebookCellIds;
|
|
@@ -48,7 +48,7 @@ function notebookFromMdast(core, config, pageSlug, notebookSlug, mdast, idkmap,
|
|
|
48
48
|
idkmap[block.label] = target;
|
|
49
49
|
if (block.identifier)
|
|
50
50
|
idkmap[block.identifier] = target;
|
|
51
|
-
return new core.
|
|
51
|
+
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);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
// assume content - concatenate it
|
package/dist/cjs/providers.d.ts
CHANGED
|
@@ -7,11 +7,16 @@ export declare function useComputeOptions(): {
|
|
|
7
7
|
githubBadgeUrl?: undefined;
|
|
8
8
|
binderBadgeUrl?: undefined;
|
|
9
9
|
} | {
|
|
10
|
-
canCompute: boolean;
|
|
11
10
|
thebe: import("./utils").ExtendedCoreOptions | undefined;
|
|
12
11
|
githubBadgeUrl: string | undefined;
|
|
13
12
|
binderBadgeUrl: string | undefined;
|
|
13
|
+
canCompute?: undefined;
|
|
14
14
|
};
|
|
15
|
+
export declare function useCanCompute(article: {
|
|
16
|
+
frontmatter: {
|
|
17
|
+
thebe?: boolean | Record<string, any>;
|
|
18
|
+
};
|
|
19
|
+
}): boolean;
|
|
15
20
|
export declare function ConfiguredThebeServerProvider({ children }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
16
21
|
export type PartialPage = {
|
|
17
22
|
kind: SourceFileKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAIlC,wBAAgB,iBAAiB;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAIlC,wBAAgB,iBAAiB;;;;;;;;;;EAuBhC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE;IAAE,WAAW,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CAAA;CAAE,WAGhG;AAED,wBAAgB,6BAA6B,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,iBAAiB,2CAalF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;CACb,CAAC"}
|
package/dist/cjs/providers.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ConfiguredThebeServerProvider = exports.useComputeOptions = void 0;
|
|
6
|
+
exports.ConfiguredThebeServerProvider = exports.useCanCompute = exports.useComputeOptions = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const thebe_react_1 = require("thebe-react");
|
|
@@ -23,8 +23,7 @@ function useComputeOptions() {
|
|
|
23
23
|
const binderBadgeUrl = mainProject === null || mainProject === void 0 ? void 0 : mainProject.binder;
|
|
24
24
|
const thebeOptions = (0, utils_1.thebeFrontmatterToOptions)(thebeFrontmatter, githubBadgeUrl, binderBadgeUrl);
|
|
25
25
|
return {
|
|
26
|
-
|
|
27
|
-
thebe: thebeOptions,
|
|
26
|
+
thebe: thebeFrontmatter ? thebeOptions : undefined,
|
|
28
27
|
githubBadgeUrl,
|
|
29
28
|
binderBadgeUrl,
|
|
30
29
|
};
|
|
@@ -32,6 +31,12 @@ function useComputeOptions() {
|
|
|
32
31
|
return react_1.default.useMemo(makeOptions, [config]);
|
|
33
32
|
}
|
|
34
33
|
exports.useComputeOptions = useComputeOptions;
|
|
34
|
+
function useCanCompute(article) {
|
|
35
|
+
var _a;
|
|
36
|
+
const { thebe } = useComputeOptions();
|
|
37
|
+
return !!thebe && ((_a = article.frontmatter) === null || _a === void 0 ? void 0 : _a.thebe) !== false;
|
|
38
|
+
}
|
|
39
|
+
exports.useCanCompute = useCanCompute;
|
|
35
40
|
function ConfiguredThebeServerProvider({ children }) {
|
|
36
41
|
const { thebe } = useComputeOptions();
|
|
37
42
|
return ((0, jsx_runtime_1.jsx)(thebe_react_1.ThebeServerProvider, { connect: false, options: thebe, useBinder: thebe === null || thebe === void 0 ? void 0 : thebe.useBinder, useJupyterLite: thebe === null || thebe === void 0 ? void 0 : thebe.useJupyterLite, children: children }));
|
package/dist/esm/BinderBadge.js
CHANGED
|
@@ -5,5 +5,5 @@ function BinderBadgeLogo() {
|
|
|
5
5
|
export function BinderBadge({ binder }) {
|
|
6
6
|
if (!binder)
|
|
7
7
|
return null;
|
|
8
|
-
return (_jsx("div", { className: "inline-block
|
|
8
|
+
return (_jsx("div", { className: "inline-block m-1 opacity-80 hover:opacity-100", children: _jsx("a", { href: binder, title: `Launch Binder Session: ${binder}`, target: "_blank", rel: "noopener noreferrer", className: "text-inherit hover:text-inherit", children: _jsx(BinderBadgeLogo, {}) }) }));
|
|
9
9
|
}
|
package/dist/esm/embed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/embed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/embed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AA2E/D,wBAAgB,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,2CAajE"}
|
package/dist/esm/embed.js
CHANGED
|
@@ -6,11 +6,15 @@ import { JupyterIcon } from '@scienceicons/react/24/solid';
|
|
|
6
6
|
import { select } from 'unist-util-select';
|
|
7
7
|
import { useLinkProvider, useBaseurl, withBaseurl } from '@myst-theme/providers';
|
|
8
8
|
function EmbedWithControls({ outputKey, children, title = 'Jupyter Notebook', url, }) {
|
|
9
|
-
const { kind } = useCellExecution(outputKey);
|
|
9
|
+
const { canCompute, kind } = useCellExecution(outputKey);
|
|
10
10
|
const Link = useLinkProvider();
|
|
11
11
|
const baseurl = useBaseurl();
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const showComputeControls = canCompute && kind === SourceFileKind.Article;
|
|
13
|
+
if (showComputeControls) {
|
|
14
|
+
return (_jsxs("div", { className: "shadow", children: [_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 })] }));
|
|
15
|
+
}
|
|
16
|
+
// light
|
|
17
|
+
return (_jsxs(_Fragment, { children: [children, _jsxs("div", { className: "flex items-center justify-end text-xs", children: [_jsx(JupyterIcon, { className: "inline-block w-3 h-3" }), _jsx("div", { className: "ml-1", children: "Source:" }), url && (_jsx(Link, { to: withBaseurl(url, baseurl), className: "ml-1 no-underline text-normal hover:underline", children: title }))] })] }));
|
|
14
18
|
}
|
|
15
19
|
export function Embed(node, children) {
|
|
16
20
|
var _a, _b;
|
|
@@ -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>;
|
|
@@ -43,6 +45,7 @@ export declare function useNotebookExecution(id: IdOrKey, clearOutputsOnExecute?
|
|
|
43
45
|
* @returns
|
|
44
46
|
*/
|
|
45
47
|
export declare function useCellExecution(id: IdOrKey): {
|
|
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,aAAa,CAAC;AAG7C,wBAAgB,iBAAiB,CAAC,EAChC,qBAA6B,GAC9B,GAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO;;kBAUR,MAAM;yBAsD1B,MAAM;yBAYN,MAAM;oBAxDI,MAAM;;;;;;EAgF9B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO,EAAE,qBAAqB,UAAQ;;;;;;;;;;;;;;;;EA2G9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO;;;;;;;;;;;EAgE3C;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO;;;;EAc/C;AAED,wBAAgB,iBAAiB,YAOhC"}
|
|
@@ -34,7 +34,7 @@ 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.setNotebook(slug, notebookSlug, notebook.
|
|
37
|
+
busy.setNotebook(slug, notebookSlug, notebook.code.map((c) => c.id), 'execute');
|
|
38
38
|
});
|
|
39
39
|
if (clearOutputsOnExecute) {
|
|
40
40
|
// clear all notebook cell outputs
|
|
@@ -78,7 +78,7 @@ export function useExecutionScope({ clearOutputsOnExecute = false, } = {}) {
|
|
|
78
78
|
const resetAll = useCallback((pageSlug) => {
|
|
79
79
|
var _a;
|
|
80
80
|
Object.entries((_a = state.pages[pageSlug]) === null || _a === void 0 ? void 0 : _a.scopes).forEach(([notebookSlug, { notebook, session }]) => {
|
|
81
|
-
busy.setNotebook(pageSlug, notebookSlug, notebook.
|
|
81
|
+
busy.setNotebook(pageSlug, notebookSlug, notebook.code.map((c) => c.id), 'reset');
|
|
82
82
|
setTimeout(() => {
|
|
83
83
|
var _a;
|
|
84
84
|
notebook.reset();
|
|
@@ -127,7 +127,7 @@ export function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
127
127
|
const execute = () => {
|
|
128
128
|
const nb = selectNotebookForPage(state, pageSlug, notebookSlug);
|
|
129
129
|
// set busy
|
|
130
|
-
busy.setNotebook(pageSlug, notebookSlug, nb.
|
|
130
|
+
busy.setNotebook(pageSlug, notebookSlug, nb.code.map((c) => c.id), 'execute');
|
|
131
131
|
if (clearOutputsOnExecute)
|
|
132
132
|
nb.clear();
|
|
133
133
|
// let busy state update prior to launching execute
|
|
@@ -160,7 +160,7 @@ export function useNotebookExecution(id, clearOutputsOnExecute = false) {
|
|
|
160
160
|
*/
|
|
161
161
|
const reset = useCallback(() => {
|
|
162
162
|
const nb = selectNotebookForPage(state, pageSlug, notebookSlug);
|
|
163
|
-
busy.setNotebook(pageSlug, notebookSlug, nb.
|
|
163
|
+
busy.setNotebook(pageSlug, notebookSlug, nb.code.map((c) => c.id), 'reset');
|
|
164
164
|
setTimeout(() => {
|
|
165
165
|
var _a, _b;
|
|
166
166
|
nb.reset();
|
|
@@ -236,6 +236,7 @@ export function useCellExecution(id) {
|
|
|
236
236
|
const notebookIsResetting = busy.notebook(pageSlug, notebookSlug, 'reset');
|
|
237
237
|
const notebookIsBusy = notebookIsExecuting || notebookIsResetting;
|
|
238
238
|
return {
|
|
239
|
+
canCompute: context.canCompute,
|
|
239
240
|
kind,
|
|
240
241
|
ready,
|
|
241
242
|
execute,
|
|
@@ -4,7 +4,9 @@ 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,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,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;AAUvE,MAAM,WAAW,gBAAgB;IAC/B,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;IAC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 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 '..';
|
|
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
|
}
|
|
@@ -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,CAAA;CAAE,EAkBS,CAAC;AACzF,eAAO,MAAM,qBAAqB,UAnBjB,iBAAiB,KAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EAmBC,CAAC;AAEjF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,iBAAiB,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BAAiB,EAAE,IAAI,EAAE,MAAM,WAEnF;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAGrF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAIjF"}
|
|
@@ -79,7 +79,3 @@ export function selectAreAllSessionsStarted(state, slug) {
|
|
|
79
79
|
// TODO is this working??
|
|
80
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
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 : [];
|
|
85
|
-
}
|
|
@@ -45,7 +45,7 @@ export function notebookFromMdast(core, config, pageSlug, notebookSlug, mdast, i
|
|
|
45
45
|
idkmap[block.label] = target;
|
|
46
46
|
if (block.identifier)
|
|
47
47
|
idkmap[block.identifier] = target;
|
|
48
|
-
return new core.
|
|
48
|
+
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
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
// assume content - concatenate it
|
package/dist/esm/providers.d.ts
CHANGED
|
@@ -7,11 +7,16 @@ export declare function useComputeOptions(): {
|
|
|
7
7
|
githubBadgeUrl?: undefined;
|
|
8
8
|
binderBadgeUrl?: undefined;
|
|
9
9
|
} | {
|
|
10
|
-
canCompute: boolean;
|
|
11
10
|
thebe: import("./utils").ExtendedCoreOptions | undefined;
|
|
12
11
|
githubBadgeUrl: string | undefined;
|
|
13
12
|
binderBadgeUrl: string | undefined;
|
|
13
|
+
canCompute?: undefined;
|
|
14
14
|
};
|
|
15
|
+
export declare function useCanCompute(article: {
|
|
16
|
+
frontmatter: {
|
|
17
|
+
thebe?: boolean | Record<string, any>;
|
|
18
|
+
};
|
|
19
|
+
}): boolean;
|
|
15
20
|
export declare function ConfiguredThebeServerProvider({ children }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
16
21
|
export type PartialPage = {
|
|
17
22
|
kind: SourceFileKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAIlC,wBAAgB,iBAAiB;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAIlC,wBAAgB,iBAAiB;;;;;;;;;;EAuBhC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE;IAAE,WAAW,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CAAA;CAAE,WAGhG;AAED,wBAAgB,6BAA6B,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,iBAAiB,2CAalF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;CACb,CAAC"}
|
package/dist/esm/providers.js
CHANGED
|
@@ -17,14 +17,18 @@ export function useComputeOptions() {
|
|
|
17
17
|
const binderBadgeUrl = mainProject === null || mainProject === void 0 ? void 0 : mainProject.binder;
|
|
18
18
|
const thebeOptions = thebeFrontmatterToOptions(thebeFrontmatter, githubBadgeUrl, binderBadgeUrl);
|
|
19
19
|
return {
|
|
20
|
-
|
|
21
|
-
thebe: thebeOptions,
|
|
20
|
+
thebe: thebeFrontmatter ? thebeOptions : undefined,
|
|
22
21
|
githubBadgeUrl,
|
|
23
22
|
binderBadgeUrl,
|
|
24
23
|
};
|
|
25
24
|
};
|
|
26
25
|
return React.useMemo(makeOptions, [config]);
|
|
27
26
|
}
|
|
27
|
+
export function useCanCompute(article) {
|
|
28
|
+
var _a;
|
|
29
|
+
const { thebe } = useComputeOptions();
|
|
30
|
+
return !!thebe && ((_a = article.frontmatter) === null || _a === void 0 ? void 0 : _a.thebe) !== false;
|
|
31
|
+
}
|
|
28
32
|
export function ConfiguredThebeServerProvider({ children }) {
|
|
29
33
|
const { thebe } = useComputeOptions();
|
|
30
34
|
return (_jsx(ThebeServerProvider, { connect: false, options: thebe, useBinder: thebe === null || thebe === void 0 ? void 0 : thebe.useBinder, useJupyterLite: thebe === null || thebe === void 0 ? void 0 : thebe.useJupyterLite, children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/embed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/embed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AA2E/D,wBAAgB,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,2CAajE"}
|
|
@@ -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>;
|
|
@@ -43,6 +45,7 @@ export declare function useNotebookExecution(id: IdOrKey, clearOutputsOnExecute?
|
|
|
43
45
|
* @returns
|
|
44
46
|
*/
|
|
45
47
|
export declare function useCellExecution(id: IdOrKey): {
|
|
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,aAAa,CAAC;AAG7C,wBAAgB,iBAAiB,CAAC,EAChC,qBAA6B,GAC9B,GAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO;;kBAUR,MAAM;yBAsD1B,MAAM;yBAYN,MAAM;oBAxDI,MAAM;;;;;;EAgF9B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO,EAAE,qBAAqB,UAAQ;;;;;;;;;;;;;;;;EA2G9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO;;;;;;;;;;;EAgE3C;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO;;;;EAc/C;AAED,wBAAgB,iBAAiB,YAOhC"}
|
|
@@ -4,7 +4,9 @@ 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,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,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;AAUvE,MAAM,WAAW,gBAAgB;IAC/B,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;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/execute/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,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;AAUvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,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"}
|
|
@@ -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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|
10
|
-
canCompute: boolean;
|
|
11
10
|
thebe: import("./utils").ExtendedCoreOptions | undefined;
|
|
12
11
|
githubBadgeUrl: string | undefined;
|
|
13
12
|
binderBadgeUrl: string | undefined;
|
|
13
|
+
canCompute?: undefined;
|
|
14
14
|
};
|
|
15
|
+
export declare function useCanCompute(article: {
|
|
16
|
+
frontmatter: {
|
|
17
|
+
thebe?: boolean | Record<string, any>;
|
|
18
|
+
};
|
|
19
|
+
}): boolean;
|
|
15
20
|
export declare function ConfiguredThebeServerProvider({ children }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
16
21
|
export type PartialPage = {
|
|
17
22
|
kind: SourceFileKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAIlC,wBAAgB,iBAAiB;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAIlC,wBAAgB,iBAAiB;;;;;;;;;;EAuBhC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE;IAAE,WAAW,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CAAA;CAAE,WAGhG;AAED,wBAAgB,6BAA6B,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,iBAAiB,2CAalF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;CACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/jupyter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@headlessui/react": "^1.7.15",
|
|
25
25
|
"@heroicons/react": "^2.0.18",
|
|
26
|
-
"@myst-theme/providers": "^0.3.
|
|
26
|
+
"@myst-theme/providers": "^0.3.8",
|
|
27
27
|
"ansi-to-react": "^6.1.6",
|
|
28
28
|
"buffer": "^6.0.3",
|
|
29
29
|
"classnames": "^2.3.2",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"myst-config": "^1.0.0",
|
|
32
32
|
"myst-frontmatter": "^1.0.0",
|
|
33
33
|
"myst-spec": "^0.0.4",
|
|
34
|
-
"myst-to-react": "^0.3.
|
|
34
|
+
"myst-to-react": "^0.3.8",
|
|
35
35
|
"nanoid": "^4.0.2",
|
|
36
36
|
"nbtx": "^0.2.3",
|
|
37
37
|
"react-syntax-highlighter": "^15.5.0",
|
|
38
38
|
"swr": "^2.1.5",
|
|
39
|
-
"thebe-core": "^0.
|
|
40
|
-
"thebe-lite": "^0.
|
|
41
|
-
"thebe-react": "^0.
|
|
39
|
+
"thebe-core": "^0.3.0",
|
|
40
|
+
"thebe-lite": "^0.3.0",
|
|
41
|
+
"thebe-react": "^0.3.0",
|
|
42
42
|
"unist-util-select": "^4.0.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|