@myst-theme/jupyter 0.5.16 → 0.5.18

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.
@@ -1,11 +1,11 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import { useThebeServer } from 'thebe-react';
4
- import { useThebeOptions } from './providers.js';
4
+ import { useComputeOptions } from './providers.js';
5
5
  import { selectAreExecutionScopesBuilding, useExecutionScope } from './execute/index.js';
6
6
  export function ConnectionStatusTray({ waitForSessions }) {
7
7
  var _a, _b, _c;
8
- const thebe = useThebeOptions();
8
+ const options = useComputeOptions();
9
9
  const { connecting, ready: serverReady, error: serverError, events } = useThebeServer();
10
10
  const { slug, ready: scopeReady, state } = useExecutionScope();
11
11
  const [show, setShow] = useState(false);
@@ -23,7 +23,7 @@ export function ConnectionStatusTray({ waitForSessions }) {
23
23
  events.on('status', handleStatus);
24
24
  }, [events]);
25
25
  useEffect(() => {
26
- if (!(thebe === null || thebe === void 0 ? void 0 : thebe.options))
26
+ if (!(options === null || options === void 0 ? void 0 : options.thebe))
27
27
  return;
28
28
  if (busy || error) {
29
29
  setShow(true);
@@ -35,17 +35,17 @@ export function ConnectionStatusTray({ waitForSessions }) {
35
35
  setUnsub(undefined);
36
36
  }, 1000);
37
37
  }
38
- }, [thebe, busy, ready, error]);
39
- const host = ((_a = thebe === null || thebe === void 0 ? void 0 : thebe.options) === null || _a === void 0 ? void 0 : _a.useBinder)
38
+ }, [options, busy, ready, error]);
39
+ const host = ((_a = options === null || options === void 0 ? void 0 : options.thebe) === null || _a === void 0 ? void 0 : _a.useBinder)
40
40
  ? 'Binder'
41
- : ((_b = thebe === null || thebe === void 0 ? void 0 : thebe.options) === null || _b === void 0 ? void 0 : _b.useJupyterLite)
41
+ : ((_b = options === null || options === void 0 ? void 0 : options.thebe) === null || _b === void 0 ? void 0 : _b.useJupyterLite)
42
42
  ? 'JupyterLite'
43
43
  : 'Local Server';
44
44
  // TODO radix ui toast!
45
45
  if (show && error) {
46
46
  return (_jsxs("div", { className: "fixed p-3 z-[11] text-sm text-gray-700 bg-white border rounded shadow-lg bottom-2 sm:right-2 max-w-[90%] md:max-w-[300px] min-w-0", children: [_jsxs("div", { className: "mb-2 font-semibold text-center", children: ["\u26D4\uFE0F Error connecting to ", host, " \u26D4\uFE0F"] }), _jsx("div", { className: "my-1 max-h-[15rem] mono overflow-hidden text-ellipsis", children: error }), _jsx("div", { className: "flex justify-end", children: _jsx("div", { className: "text-xs cursor-pointer hover:underline", role: "button", onClick: () => setShow(false), children: "dismiss" }) })] }));
47
47
  }
48
- if (show && ((_c = thebe === null || thebe === void 0 ? void 0 : thebe.options) === null || _c === void 0 ? void 0 : _c.useJupyterLite)) {
48
+ if (show && ((_c = options === null || options === void 0 ? void 0 : options.thebe) === null || _c === void 0 ? void 0 : _c.useJupyterLite)) {
49
49
  return (_jsxs("div", { className: "fixed p-3 z-[11] text-sm text-gray-700 bg-white border rounded shadow-lg bottom-2 sm:right-2 max-w-[90%] md:max-w-[300px] min-w-0", children: [_jsxs("div", { className: "mb-1 font-semibold text-center", children: ["\u26A1\uFE0F Connecting to ", host, " \u26A1\uFE0F"] }), !ready && _jsx("div", { className: "max-h-[5rem] mono overflow-hidden text-ellipsis", children: status }), ready && (_jsx("div", { className: "max-h-[15rem] mono overflow-hidden text-ellipsis", children: "The in-browser JupyterLite server is ready, press run anytime." }))] }));
50
50
  }
51
51
  if (show) {
package/dist/ErrorTray.js CHANGED
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
3
3
  import { useThebeLoader } from 'thebe-react';
4
4
  import { useBusyErrors } from './execute/busy.js';
5
5
  function ErrorDecoration({ children, idx }) {
6
- return (_jsxs("div", { className: "relative py-3 mx-2 my-8 border rounded", children: [_jsx("div", { className: "absolute z-10 flex items-center bg-white -top-3 -left-2", children: idx && _jsxs("div", { className: "ml-1 text-sm text-gray-500", children: ["cell #: ", idx] }) }), _jsx("div", { className: "mx-3", children: children })] }));
6
+ return (_jsxs("div", { className: "relative py-3 mx-2 my-8 border rounded", children: [_jsx("div", { className: "absolute z-10 flex items-center bg-white -top-3 -left-2", children: idx && _jsxs("div", { className: "ml-1 text-sm text-gray-500", children: ["cell #: ", idx + 1] }) }), _jsx("div", { className: "mx-3", children: children })] }));
7
7
  }
8
8
  function ErrorTrayMessage({ errors }) {
9
9
  const { core } = useThebeLoader();
@@ -24,7 +24,7 @@ function ErrorTrayMessage({ errors }) {
24
24
  }, [core, errors]);
25
25
  if (!core)
26
26
  return null;
27
- return (_jsx("div", { children: errors.map((error, idx) => (_jsx("div", { className: "not-prose min-w-[400px]", children: _jsx(ErrorDecoration, { idx: error.index, children: _jsx("div", { className: "z-100", ref: refs[idx] }, error.id) }) }))) }));
27
+ return (_jsx("div", { children: errors.map((error, idx) => (_jsx("div", { className: "not-prose min-w-[400px]", children: _jsx(ErrorDecoration, { idx: error.index, children: _jsx("div", { className: "z-100", ref: refs[idx] }, error.id) }) }, `error-${error.id}`))) }));
28
28
  }
29
29
  export function ErrorTray({ pageSlug, index }) {
30
30
  const { items } = useBusyErrors(pageSlug);
@@ -32,7 +32,7 @@ export function ErrorTray({ pageSlug, index }) {
32
32
  return null;
33
33
  if (index && index)
34
34
  return null;
35
- return (_jsx("div", { className: "relative px-4 pt-3 mt-8 text-sm text-red-600 border border-red-400 rounded border-1", children: items.map(({ notebookSlug, errors }) => {
36
- return (_jsxs("div", { children: [_jsxs("div", { children: [_jsx("span", { className: "font-bold", children: "Error" }), " in notebook ", _jsxs("span", { children: ["\"", notebookSlug, "\""] })] }), _jsx(ErrorTrayMessage, { errors: errors })] }));
35
+ return (_jsx("div", { className: "relative px-4 pt-3 my-8 text-sm text-red-600 border border-red-400 rounded border-1", children: items.map(({ notebookSlug, errors }, i) => {
36
+ return (_jsxs("div", { children: [_jsxs("div", { children: [_jsx("span", { className: "font-bold", children: "Error" }), " in notebook ", _jsxs("span", { children: ["\"", notebookSlug, "\""] })] }), _jsx(ErrorTrayMessage, { errors: errors })] }, `${notebookSlug}-${i}`));
37
37
  }) }));
38
38
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" resolution-mode="require"/>
1
2
  export declare const MaybeLongContent: ({ content, path, render, }: {
2
3
  content?: string | undefined;
3
4
  path?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;sBAOT,MAAM,KAAK,WAAW;6CAUzC,CAAC;AAEF,eAAO,MAAM,aAAa;aAAqC,MAAM;6CAWpE,CAAC"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,gBAAgB;;;sBAOT,MAAM,KAAK,WAAW;6CAUzC,CAAC;AAEF,eAAO,MAAM,aAAa;aAAqC,MAAM;6CAWpE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useThebeServer } from 'thebe-react';
3
3
  import { useNotebookExecution } from '../execute/hooks.js';
4
- import { Reset, Run, SpinnerStatusButton } from './Buttons.js';
4
+ import { Restart, Run, SpinnerStatusButton } from './Buttons.js';
5
5
  import { selectAreExecutionScopesBuilding } from '../execute/index.js';
6
6
  export function ArticleStatusBadge({ id }) {
7
7
  const { connect, connecting } = useThebeServer();
@@ -27,5 +27,5 @@ export function ArticleResetNotebook({ id }) {
27
27
  const { ready, notebookIsResetting, notebookIsBusy, reset } = useNotebookExecution(id);
28
28
  if (!ready)
29
29
  return null;
30
- return (_jsx(Reset, { ready: ready, resetting: notebookIsResetting, disabled: notebookIsBusy, onClick: reset, title: "Reset the figure to its original state and restart the kernel" }));
30
+ return (_jsx(Restart, { ready: ready, resetting: notebookIsResetting, disabled: notebookIsBusy, onClick: reset, title: "Reset the figure to its original state and restart the kernel" }));
31
31
  }
@@ -1,5 +1,5 @@
1
- export declare function LaunchBinder({ style, location }: {
2
- style: 'link' | 'button';
1
+ export declare function LaunchBinder({ type, location }: {
2
+ type: 'link' | 'button';
3
3
  location?: string;
4
4
  }): import("react/jsx-runtime").JSX.Element;
5
5
  export declare function SpinnerStatusButton({ ready, busy, modified, onClick, }: {
@@ -29,7 +29,7 @@ export declare function ReRun({ ready, executing, disabled, title, onClick, }: {
29
29
  disabled?: boolean;
30
30
  onClick: () => void;
31
31
  }): import("react/jsx-runtime").JSX.Element;
32
- export declare function Reset({ ready, resetting, disabled, title, onClick, }: {
32
+ export declare function Restart({ ready, resetting, disabled, title, onClick, }: {
33
33
  ready: boolean;
34
34
  resetting: boolean;
35
35
  title?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Buttons.d.ts","sourceRoot":"","sources":["../../src/controls/Buttons.tsx"],"names":[],"mappings":"AAwDA,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,2CA6DhG;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,GACR,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,2CAuCA;AA2CD,wBAAgB,GAAG,CAAC,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,2CAWA;AAED,wBAAgB,KAAK,CAAC,EACpB,KAAK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AC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,2CAWA;AAED,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,2CAaA;AAED,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,2CAeA;AAED,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,2CAgBA"}
@@ -14,11 +14,11 @@ function BinderButton({ icon, label, title, busy, error, className, onClick, })
14
14
  }
15
15
  return (_jsx("button", { className: className, disabled: busy, onClick: onClick, title: title, children: _jsxs("div", { className: "flex items-center h-full", children: [iconToShow, _jsx("span", { children: label })] }) }));
16
16
  }
17
- export function LaunchBinder({ style, location }) {
17
+ export function LaunchBinder({ type, location }) {
18
18
  const { connecting, ready, error, autoClickRef, handleStart, getUserServerUrl } = useLaunchBinder();
19
19
  let btnStyles = 'flex gap-1 px-2 py-1 font-normal no-underline border rounded bg-slate-200 border-slate-600 hover:bg-slate-800 hover:text-white hover:border-transparent';
20
20
  let icon = (_jsx(ArrowTopRightOnSquareIcon, { width: "1rem", height: "1rem", className: "self-center mr-2 transition-transform group-hover:-translate-x-1 shrink-0" }));
21
- if (style === 'link') {
21
+ if (type === 'link') {
22
22
  icon = _jsx(ArrowTopRightOnSquareIcon, { width: "1.5rem", height: "1.5rem", className: "inline h-5 pr-2" });
23
23
  btnStyles =
24
24
  'inline-flex items-center mr-2 font-medium no-underline text-gray-900 lg:mr-0 lg:flex';
@@ -60,9 +60,11 @@ export function SpinnerStatusButton({ ready, busy, modified, onClick, }) {
60
60
  }), disabled: ready, title: title, "aria-label": `status`, onClick: onClick !== null && onClick !== void 0 ? onClick : (() => ({})), children: icon }), busy && (_jsx("span", { className: "absolute top-0 left-0 z-10 opacity-100", children: _jsx(Spinner, { size: 24 }) }))] }));
61
61
  }
62
62
  function SpinnerButton({ ready, icon, busy, disabled, title, onClick, }) {
63
- return (_jsxs("div", { className: "relative flex text-sm", children: [_jsx("button", { className: classNames('cursor-pointer text-gray-700 dark:text-white active:text-green-700 hover:opacity-100', {
63
+ return (_jsxs("div", { className: "relative flex text-sm", children: [_jsx("button", { className: classNames(' text-gray-700 dark:text-white active:text-green-700 ', {
64
64
  'opacity-10 hover:opacity-10': busy,
65
- 'opacity-70': !busy,
65
+ 'opacity-70': !busy && !disabled,
66
+ 'cursor-pointer hover:opacity-100': !disabled,
67
+ 'cursor-not-allowed opacity-10 hover:opacity-10': disabled,
66
68
  }), disabled: disabled || !ready || busy, onClick: () => onClick(), title: title !== null && title !== void 0 ? title : 'run all cells', "aria-label": title !== null && title !== void 0 ? title : 'run all cells', children: icon }), busy && (_jsx("span", { className: "absolute top-0 left-0 z-10 opacity-100", children: _jsx(Spinner, { size: 24 }) }))] }));
67
69
  }
68
70
  export function Run({ ready, executing, disabled, title, onClick, }) {
@@ -74,13 +76,13 @@ export function Power({ ready, executing, disabled, title, onClick, }) {
74
76
  export function ReRun({ ready, executing, disabled, title, onClick, }) {
75
77
  return (_jsx(SpinnerButton, { ready: ready, busy: executing, disabled: disabled, title: title !== null && title !== void 0 ? title : 'run all cells', onClick: onClick, icon: _jsx(ArrowPathIcon, { width: "1.5rem", height: "1.5rem", className: "inline-block align-top" }) }));
76
78
  }
77
- export function Reset({ ready, resetting, disabled, title, onClick, }) {
79
+ export function Restart({ ready, resetting, disabled, title, onClick, }) {
78
80
  return (_jsx(SpinnerButton, { ready: ready, busy: resetting, disabled: disabled, title: title !== null && title !== void 0 ? title : 'reset notebook', onClick: onClick, icon: _jsx(ArrowUturnLeftIcon, { width: "1.5rem", height: "1.5rem", className: "inline-block align-top" }) }));
79
81
  }
80
82
  export function Clear({ ready, disabled, title, onClick, }) {
81
- return (_jsx("button", { className: classNames('flex text-gray-700 dark:text-white opacity-70 ', {
82
- 'cursor-not-allowed': disabled || !ready,
83
- 'active:text-green-700 hover:opacity-100 cursor-pointer': !disabled,
83
+ return (_jsx("button", { className: classNames('flex text-gray-700 dark:text-white', {
84
+ 'cursor-not-allowed opacity-10': disabled || !ready,
85
+ 'active:text-green-700 opacity-70 hover:opacity-100 cursor-pointer': !disabled,
84
86
  }), disabled: disabled || !ready, onClick: () => onClick(), title: title !== null && title !== void 0 ? title : 'clear', "aria-label": title !== null && title !== void 0 ? title : 'clear', children: _jsx(MinusCircleIcon, { width: "1.5rem", height: "1.5rem", className: "inline-block align-top" }) }));
85
87
  }
86
88
  export function Launch({ ready, disabled, title, onClick, }) {
@@ -1 +1 @@
1
- {"version":3,"file":"NotebookToolbar.d.ts","sourceRoot":"","sources":["../../src/controls/NotebookToolbar.tsx"],"names":[],"mappings":"AAaA,wBAAgB,eAAe,CAAC,EAAE,UAAkB,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,kDAiG/E"}
1
+ {"version":3,"file":"NotebookToolbar.d.ts","sourceRoot":"","sources":["../../src/controls/NotebookToolbar.tsx"],"names":[],"mappings":"AAaA,wBAAgB,eAAe,CAAC,EAAE,UAAkB,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,kDAkG/E"}
@@ -3,7 +3,7 @@ import { useExecutionScope, selectIsComputable, selectAreExecutionScopesBuilding
3
3
  import { useThebeServer } from 'thebe-react';
4
4
  import { PowerIcon } from '@heroicons/react/24/outline';
5
5
  import { Spinner } from './Spinner.js';
6
- import { Clear, Launch, Reset, Run } from './Buttons.js';
6
+ import { Clear, Launch, Restart, Run } from './Buttons.js';
7
7
  import classNames from 'classnames';
8
8
  export function NotebookToolbar({ showLaunch = false }) {
9
9
  const { slug, ready, state, start, resetAll, clearAll, execute } = useExecutionScope();
@@ -39,6 +39,6 @@ export function NotebookToolbar({ showLaunch = false }) {
39
39
  if (computable)
40
40
  return (_jsx("div", { className: "sticky top-[60px] flex justify-end w-full z-20 pointer-events-none", children: _jsxs("div", { className: "flex p-1 m-1 space-x-1 border rounded-full shadow pointer-events-auto border-stone-300 bg-white/80 dark:bg-stone-900/80 backdrop-blur", children: [!ready && (_jsxs("div", { className: "rounded", children: [_jsx("button", { className: classNames('flex text-center rounded-full cursor-pointer text-stone-800 dark:text-white hover:opacity-100 opacity-60', {
41
41
  'opacity-10 text-stone-100 dark:text-stone-700': connecting || building,
42
- }), onClick: handleStart, disabled: building, "aria-label": "start compute environment", children: _jsx(PowerIcon, { className: "inline-block w-6 h-6 align-top", title: "enable compute" }) }), (connecting || building) && !error && (_jsx("span", { className: "absolute top-1 left-1 z-10 w-[22px] h-[22px] opacity-100", title: title, children: _jsx(Spinner, { size: 24 }) }))] })), ready && (_jsx(Run, { ready: ready, executing: busy.page(slug, 'execute'), onClick: handleRun, title: "Run all cells" })), ready && (_jsx(Reset, { ready: ready, resetting: busy.page(slug, 'reset'), onClick: handleReset, title: "Reset notebook and restart kernel" })), ready && (_jsx(Clear, { ready: ready, disabled: busy.page(slug, 'execute') || busy.page(slug, 'reset'), onClick: handleClear, title: "Clear all cells" })), showLaunch && ready && (_jsx(Launch, { ready: ready, disabled: false, onClick: handleLaunch, title: "Launch notebook in Jupyter" }))] }) }));
42
+ }), onClick: handleStart, disabled: building, "aria-label": "start compute environment", children: _jsx(PowerIcon, { className: "inline-block w-6 h-6 align-top", title: "enable compute" }) }), (connecting || building) && !error && (_jsx("span", { className: "absolute top-1 left-1 z-10 w-[22px] h-[22px] opacity-100", title: title, children: _jsx(Spinner, { size: 24 }) }))] })), ready && (_jsx(Run, { ready: ready, executing: busy.page(slug, 'execute'), onClick: handleRun, title: "Run all cells" })), ready && (_jsx(Restart, { ready: ready, resetting: busy.page(slug, 'reset'), onClick: handleReset, disabled: busy.page(slug, 'execute'), title: "Reset notebook and restart kernel" })), ready && (_jsx(Clear, { ready: ready, disabled: busy.page(slug, 'execute') || busy.page(slug, 'reset'), onClick: handleClear, title: "Clear all cells" })), showLaunch && ready && (_jsx(Launch, { ready: ready, disabled: false, onClick: handleLaunch, title: "Launch notebook in Jupyter" }))] }) }));
43
43
  return null;
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"decoration.d.ts","sourceRoot":"","sources":["../src/decoration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAqB/C,wBAAgB,cAAc,4BAG7B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,KAA0B,EAC1B,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,2CA6DA"}
1
+ {"version":3,"file":"decoration.d.ts","sourceRoot":"","sources":["../src/decoration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsB/C,wBAAgB,cAAc,4BAG7B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,KAA0B,EAC1B,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,2CA+DA"}
@@ -5,6 +5,7 @@ import { useCellExecution } from './execute/index.js';
5
5
  import { ArticleResetNotebook, ArticleRunNotebook, ArticleStatusBadge, } from './controls/ArticleCellControls.js';
6
6
  import { JupyterIcon } from '@scienceicons/react/24/solid';
7
7
  import { useLinkProvider, useBaseurl, withBaseurl, useThemeTop } from '@myst-theme/providers';
8
+ import { useComputeOptions } from './providers.js';
8
9
  const PlaceholderContext = React.createContext({});
9
10
  function PlaceholderProvider({ placeholder, children, }) {
10
11
  const value = React.useMemo(() => ({ placeholder }), [placeholder]);
@@ -15,11 +16,12 @@ export function usePlaceholder() {
15
16
  return context.placeholder;
16
17
  }
17
18
  export function OutputDecoration({ outputId, placeholder, children, title = 'Jupyter Notebook', url, }) {
18
- const { canCompute, kind } = useCellExecution(outputId);
19
+ const { kind } = useCellExecution(outputId);
20
+ const compute = useComputeOptions();
19
21
  const Link = useLinkProvider();
20
22
  const top = useThemeTop();
21
23
  const baseurl = useBaseurl();
22
- const showComputeControls = canCompute && kind === SourceFileKind.Article;
24
+ const showComputeControls = (compute === null || compute === void 0 ? void 0 : compute.enabled) && (compute === null || compute === void 0 ? void 0 : compute.features.figureCompute) && kind === SourceFileKind.Article;
23
25
  if (showComputeControls) {
24
26
  return (_jsxs("div", { className: "mb-4 shadow", children: [_jsx("div", { className: "sticky z-[2] w-full bg-gray-100/80 backdrop-blur dark:bg-neutral-800/80 py-1 px-2", style: { top }, children: _jsxs("div", { className: "flex items-center", children: [_jsxs("div", { className: "flex items-center", children: [_jsx(JupyterIcon, { width: "1.25rem", height: "1.25rem", className: "inline-block" }), _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: outputId }), _jsx(ArticleRunNotebook, { id: outputId }), _jsx(ArticleResetNotebook, { id: outputId })] }) }), _jsx(PlaceholderProvider, { placeholder: placeholder, children: children })] }));
25
27
  }
@@ -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,YAAY,CAAC;AAE1C,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"}
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,YAAY,CAAC;AAE1C,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;yBA2D1B,MAAM;yBAYN,MAAM;oBA7DI,MAAM;;;;;;EAsF9B;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"}
@@ -57,8 +57,11 @@ export function useExecutionScope({ clearOutputsOnExecute = false, } = {}) {
57
57
  yield Promise.all(Object.entries(state.pages[slug].scopes).map(([, { notebook }]) => __awaiter(this, void 0, void 0, function* () {
58
58
  const execReturns = yield notebook.executeAll(true);
59
59
  const errs = findErrors(execReturns);
60
- if (errs != null)
60
+ if (errs != null) {
61
61
  console.error('errors', errs);
62
+ busy.setError(slug, notebook.id, errs);
63
+ busy.clearNotebook(slug, notebook.id, 'execute');
64
+ }
62
65
  })));
63
66
  config === null || config === void 0 ? void 0 : config.events.off('status', handler);
64
67
  }), 100);
@@ -1 +1 @@
1
- {"version":3,"file":"leaf.d.ts","sourceRoot":"","sources":["../../src/execute/leaf.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAW9D,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ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;IACD,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;CAC9C,kDAkBA;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,KAAK,EACL,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;CAC9C,QA8CA;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;CAC9C,QAmFA;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;CAC9C,QA4BA"}
@@ -64,6 +64,9 @@ export function SessionStarter({ pageSlug, notebookSlug, location, state, dispat
64
64
  return;
65
65
  lock.current = true;
66
66
  console.debug(`Jupyter: Starting session for ${pageSlug}-${notebookSlug} at ${location}`);
67
+ if (location === undefined) {
68
+ console.warn('Article/Notebook json is missing the location field, this maybe break notebook execution when located outside of the root folder');
69
+ }
67
70
  server.listRunningSessions().then((sessions) => {
68
71
  var _a;
69
72
  console.debug('Jupyter: running sessions', sessions);
@@ -71,9 +74,12 @@ export function SessionStarter({ pageSlug, notebookSlug, location, state, dispat
71
74
  // we need to replace the filename with one based on the page slug and notebook slug
72
75
  // in order to allow for multiple independent sessions of the same notebook
73
76
  let path = `/${pageSlug}-${notebookSlug}.ipynb`;
77
+ console.debug('session starter path:', path);
74
78
  const match = (_a = location === null || location === void 0 ? void 0 : location.match(/(.*)\/.*.ipynb$/)) !== null && _a !== void 0 ? _a : null;
75
79
  if (match) {
80
+ console.debug('session starter match:', match);
76
81
  path = `${match[1]}/${pageSlug}-${notebookSlug}.ipynb`;
82
+ console.debug('session starter path (modified):', path);
77
83
  }
78
84
  const existing = sessions.find((s) => s.path === path);
79
85
  if (existing) {
@@ -24,7 +24,8 @@ type ArticleContents = {
24
24
  * execution scope. It is also responsible for fetching the json for dependencies
25
25
  * and adding them to the sources tree.
26
26
  */
27
- export declare function ExecuteScopeProvider({ children, contents, }: React.PropsWithChildren<{
27
+ export declare function ExecuteScopeProvider({ children, enable, contents, }: React.PropsWithChildren<{
28
+ enable: boolean;
28
29
  contents: ArticleContents;
29
30
  }>): import("react/jsx-runtime").JSX.Element;
30
31
  export {};
@@ -1 +1 @@
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,KAAwC,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAc,iBAAiB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAU1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAA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AE,cAAc,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;CAC7B,CAAC;AAmEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC,2CAiGzE"}
@@ -5,7 +5,6 @@ import { selectAll } from 'unist-util-select';
5
5
  import { reducer } from './reducer.js';
6
6
  import { selectAreAllDependenciesReady, selectDependenciesToFetch, selectScopeNotebooksToBuild, selectSessionsToStart, } from './selectors.js';
7
7
  import { MdastFetcher, NotebookBuilder, ServerMonitor, SessionStarter } from './leaf.js';
8
- import { useCanCompute } from '../providers.js';
9
8
  export const ExecuteScopeContext = React.createContext(undefined);
10
9
  function useScopeNavigate({ contents: { slug, location, kind, mdast, dependencies }, state, dispatch, }) {
11
10
  useEffect(() => {
@@ -55,9 +54,8 @@ function listComputables(mdast) {
55
54
  * execution scope. It is also responsible for fetching the json for dependencies
56
55
  * and adding them to the sources tree.
57
56
  */
58
- export function ExecuteScopeProvider({ children, contents, }) {
57
+ export function ExecuteScopeProvider({ children, enable, contents, }) {
59
58
  var _a, _b;
60
- const canCompute = useCanCompute();
61
59
  // compute incoming for first render
62
60
  const computables = listComputables(contents.mdast);
63
61
  const fallbackLocation = contents.kind === SourceFileKind.Notebook ? '/fallback.ipynb' : '/';
@@ -88,13 +86,13 @@ export function ExecuteScopeProvider({ children, contents, }) {
88
86
  const notebookBuildTargets = selectScopeNotebooksToBuild(state);
89
87
  const sessionStartTargets = selectSessionsToStart(state);
90
88
  const memo = React.useMemo(() => ({
91
- canCompute,
89
+ canCompute: enable,
92
90
  slug: contents.slug,
93
91
  location: contents.location,
94
92
  state,
95
93
  dispatch,
96
94
  idkmap: idkmap.current,
97
- }), [state, contents.slug]);
95
+ }), [state, contents.slug, enable]);
98
96
  if (typeof window !== 'undefined') {
99
97
  window.executeScope = memo;
100
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,MAAM,CAAC;AAKd,UAAU,WAAW;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA0BD,wBAAgB,cAAc,CAC5B,OAAO,CAAC,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,GACX;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAQvC;AAuBD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG;IACtE,IAAI,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC;CACxB,CAqCA;AAUD,MAAM,CAAC,OAAO,UAAU,aAAa;;;EAapC;AAED,wBAAgB,eAAe;;;;yBAOpB,iBAAiB;;kCAkBZ,MAAM;EAsBrB"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,MAAM,CAAC;AAKd,UAAU,WAAW;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA0BD,wBAAgB,cAAc,CAC5B,OAAO,CAAC,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,GACX;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAQvC;AAuBD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG;IACtE,IAAI,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC;CACxB,CAqCA;AAUD,MAAM,CAAC,OAAO,UAAU,aAAa;;;EAapC;AAED,wBAAgB,eAAe;;;;yBAOpB,iBAAiB;;kCAkBZ,MAAM;EAqBrB"}
package/dist/hooks.js CHANGED
@@ -135,9 +135,7 @@ export function useLaunchBinder() {
135
135
  if (userServerUrl && location) {
136
136
  // add the location to the url pathname
137
137
  const url = new URL(userServerUrl);
138
- if (url.pathname.endsWith('/'))
139
- url.pathname = url.pathname.slice(0, -1);
140
- url.pathname = `${url.pathname}/lab/tree${location}`;
138
+ url.pathname = `${url.pathname}lab/tree${location}`.replace(/\/+/g, '/');
141
139
  userServerUrl = url.toString();
142
140
  }
143
141
  return userServerUrl;
@@ -2,20 +2,28 @@ import type { SourceFileKind } from 'myst-spec-ext';
2
2
  import React from 'react';
3
3
  import { type ExtendedCoreOptions } from './utils.js';
4
4
  import type { GenericParent } from 'myst-common';
5
- import type { SiteManifest } from 'myst-config';
6
5
  import type { RepoProviderSpec } from 'thebe-core';
7
- type ThebeOptionsContextType = {
8
- options?: ExtendedCoreOptions;
9
- githubBadgeUrl?: string;
10
- binderBadgeUrl?: string;
6
+ type ComputeOptionsContextType = {
7
+ enabled: boolean;
8
+ features: {
9
+ notebookCompute: boolean;
10
+ figureCompute: boolean;
11
+ launchBinder: boolean;
12
+ };
13
+ thebe?: ExtendedCoreOptions;
14
+ customRepoProviders?: RepoProviderSpec[];
11
15
  };
12
- export declare function ConfiguredThebeServerProvider({ siteManifest, optionOverrideFn, customRepoProviders, children, }: React.PropsWithChildren<{
13
- siteManifest?: SiteManifest;
14
- optionOverrideFn?: (opts: ExtendedCoreOptions) => ExtendedCoreOptions;
16
+ export declare function ComputeOptionsProvider({ features, optionOverrideFn, customRepoProviders, children, }: React.PropsWithChildren<{
17
+ features: {
18
+ notebookCompute: boolean;
19
+ figureCompute: boolean;
20
+ launchBinder: boolean;
21
+ };
22
+ optionOverrideFn?: (opts?: ExtendedCoreOptions) => ExtendedCoreOptions | undefined;
15
23
  customRepoProviders?: RepoProviderSpec[];
16
24
  }>): import("react/jsx-runtime").JSX.Element;
17
- export declare function useCanCompute(): boolean;
18
- export declare function useThebeOptions(): ThebeOptionsContextType | undefined;
25
+ export declare function useCanCompute(): boolean | undefined;
26
+ export declare function useComputeOptions(): ComputeOptionsContextType | undefined;
19
27
  export type PartialPage = {
20
28
  kind: SourceFileKind;
21
29
  file: string;
@@ -24,5 +32,14 @@ export type PartialPage = {
24
32
  slug: string;
25
33
  mdast: GenericParent;
26
34
  };
35
+ /**
36
+ *
37
+ * @param baseurl - as a prop allows for flexibility in themes
38
+ * @returns
39
+ */
40
+ export declare function ThebeLoaderAndServer({ baseurl, connect, children, }: React.PropsWithChildren<{
41
+ connect?: boolean;
42
+ baseurl?: string;
43
+ }>): import("react/jsx-runtime").JSX.Element;
27
44
  export {};
28
45
  //# sourceMappingURL=providers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,YAAY,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiCnD,KAAK,uBAAuB,GAAG;IAC7B,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAIF,wBAAgB,6BAA6B,CAAC,EAC5C,YAAY,EACZ,g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AK,CAAC,iBAAiB,CAAC;IACzB,QAAQ,EAAE;QACR,eAAe,EAAE,OAAO,CAAC;QACzB,aAAa,EAAE,OAAO,CAAC;QACvB,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,mBAAmB,KAAK,mBAAmB,GAAG,SAAS,CAAC;IACnF,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC1C,CAAC,2CA2BD;AAED,wBAAgB,aAAa,wBAG5B;AAED,wBAAgB,iBAAiB,0CAEhC;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,2CAkBlE"}
package/dist/providers.js CHANGED
@@ -1,39 +1,46 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useContext } from 'react';
3
- import { ThebeServerProvider } from 'thebe-react';
4
3
  import { thebeFrontmatterToOptions } from './utils.js';
5
- function makeThebeOptions(siteManifest, optionsOverrideFn = (opts) => opts) {
6
- var _a;
7
- if (!siteManifest)
8
- return {};
9
- // TODO there may be multiple projects?
10
- // useProjectManifest?
11
- const mainProject = (_a = siteManifest === null || siteManifest === void 0 ? void 0 : siteManifest.projects) === null || _a === void 0 ? void 0 : _a[0];
12
- const thebeFrontmatter = mainProject === null || mainProject === void 0 ? void 0 : mainProject.thebe;
13
- const githubBadgeUrl = mainProject === null || mainProject === void 0 ? void 0 : mainProject.github;
14
- const binderBadgeUrl = mainProject === null || mainProject === void 0 ? void 0 : mainProject.binder;
15
- const optionsFromFrontmatter = thebeFrontmatterToOptions(thebeFrontmatter, githubBadgeUrl, binderBadgeUrl);
16
- let options = optionsFromFrontmatter;
17
- if (options)
18
- options = optionsOverrideFn(options);
19
- return {
20
- options,
21
- githubBadgeUrl,
22
- binderBadgeUrl,
23
- };
24
- }
25
- const ThebeOptionsContext = React.createContext(undefined);
26
- export function ConfiguredThebeServerProvider({ siteManifest, optionOverrideFn, customRepoProviders, children, }) {
27
- var _a, _b, _c, _d;
28
- const thebe = React.useMemo(() => makeThebeOptions(siteManifest, optionOverrideFn), [siteManifest, optionOverrideFn]);
29
- if (!siteManifest)
30
- return _jsx(_Fragment, { children: children });
31
- return (_jsx(ThebeOptionsContext.Provider, { value: thebe, children: _jsx(ThebeServerProvider, { connect: false, options: thebe.options, useBinder: (_b = (_a = thebe.options) === null || _a === void 0 ? void 0 : _a.useBinder) !== null && _b !== void 0 ? _b : false, useJupyterLite: (_d = (_c = thebe.options) === null || _c === void 0 ? void 0 : _c.useJupyterLite) !== null && _d !== void 0 ? _d : false, customRepoProviders: customRepoProviders, children: _jsx(_Fragment, { children: children }) }) }));
4
+ import { useProjectManifest } from '@myst-theme/providers';
5
+ import { ThebeBundleLoaderProvider, ThebeServerProvider } from 'thebe-react';
6
+ const ComputeOptionsContext = React.createContext(undefined);
7
+ export function ComputeOptionsProvider({ features, optionOverrideFn, customRepoProviders, children, }) {
8
+ const project = useProjectManifest();
9
+ const options = React.useMemo(() => {
10
+ if (!project)
11
+ return;
12
+ const thebeFrontmatter = project === null || project === void 0 ? void 0 : project.thebe;
13
+ const githubBadgeUrl = project === null || project === void 0 ? void 0 : project.github;
14
+ const binderBadgeUrl = project === null || project === void 0 ? void 0 : project.binder;
15
+ const optionsFromFrontmatter = thebeFrontmatterToOptions(thebeFrontmatter);
16
+ const optionsWithOverrides = optionOverrideFn
17
+ ? optionOverrideFn(optionsFromFrontmatter)
18
+ : optionsFromFrontmatter;
19
+ return {
20
+ enabled: !!optionsWithOverrides,
21
+ thebe: optionsWithOverrides,
22
+ githubBadgeUrl,
23
+ binderBadgeUrl,
24
+ features,
25
+ customRepoProviders,
26
+ };
27
+ }, [project, optionOverrideFn]);
28
+ return (_jsx(ComputeOptionsContext.Provider, { value: options, children: children }));
32
29
  }
33
30
  export function useCanCompute() {
34
- const thebe = useContext(ThebeOptionsContext);
35
- return !!(thebe === null || thebe === void 0 ? void 0 : thebe.options);
31
+ const context = useContext(ComputeOptionsContext);
32
+ return context === null || context === void 0 ? void 0 : context.enabled;
33
+ }
34
+ export function useComputeOptions() {
35
+ return useContext(ComputeOptionsContext);
36
36
  }
37
- export function useThebeOptions() {
38
- return useContext(ThebeOptionsContext);
37
+ /**
38
+ *
39
+ * @param baseurl - as a prop allows for flexibility in themes
40
+ * @returns
41
+ */
42
+ export function ThebeLoaderAndServer({ baseurl, connect, children, }) {
43
+ var _a, _b, _c, _d, _e, _f, _g;
44
+ const compute = useComputeOptions();
45
+ return (_jsx(ThebeBundleLoaderProvider, { loadThebeLite: (_b = (_a = compute === null || compute === void 0 ? void 0 : compute.thebe) === null || _a === void 0 ? void 0 : _a.useJupyterLite) !== null && _b !== void 0 ? _b : false, publicPath: baseurl, children: _jsx(ThebeServerProvider, { connect: connect !== null && connect !== void 0 ? connect : false, options: compute === null || compute === void 0 ? void 0 : compute.thebe, useBinder: (_d = (_c = compute === null || compute === void 0 ? void 0 : compute.thebe) === null || _c === void 0 ? void 0 : _c.useBinder) !== null && _d !== void 0 ? _d : false, useJupyterLite: (_f = (_e = compute === null || compute === void 0 ? void 0 : compute.thebe) === null || _e === void 0 ? void 0 : _e.useJupyterLite) !== null && _f !== void 0 ? _f : false, customRepoProviders: (_g = compute === null || compute === void 0 ? void 0 : compute.customRepoProviders) !== null && _g !== void 0 ? _g : [], children: children }) }));
39
46
  }
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { Thebe } from 'myst-frontmatter';
1
+ import type { ExpandedThebeFrontmatter } from 'myst-frontmatter';
2
2
  import type { CoreOptions } from 'thebe-core';
3
3
  export type ExtendedCoreOptions = CoreOptions & {
4
4
  useBinder?: boolean;
5
5
  useJupyterLite?: boolean;
6
6
  };
7
- export declare function thebeFrontmatterToOptions(fm: boolean | Thebe | undefined, githubBadgeUrl: string | undefined, binderBadgeUrl: string | undefined): ExtendedCoreOptions | undefined;
7
+ export declare function thebeFrontmatterToOptions(fm: ExpandedThebeFrontmatter | undefined): ExtendedCoreOptions | undefined;
8
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAA0C,MAAM,kBAAkB,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,YAAY,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAyDF,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,EAC/B,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,mBAAmB,GAAG,SAAS,CAgHjC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAwB,MAAM,kBAAkB,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAMF,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,wBAAwB,GAAG,SAAS,GACvC,mBAAmB,GAAG,SAAS,CAwCjC"}
package/dist/utils.js CHANGED
@@ -1,48 +1,10 @@
1
- function extractGithubRepoInfo(url) {
2
- const pattern = /https?:\/\/github\.com\/([^/]+)\/([^/]+)/;
3
- const match = url.match(pattern);
4
- if (match) {
5
- return {
6
- owner: match[1],
7
- repo: match[2],
8
- };
9
- }
10
- return null;
11
- }
12
- function extractBinderRepoInfo(url) {
13
- const pattern = /(https?:\/\/[^/]+(?:\/[^/]+)*?)\/(v\d+)\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)/;
14
- const match = url.match(pattern);
15
- if (match) {
16
- const repoProviderAbbreviation = match[3];
17
- let repoProvider;
18
- switch (repoProviderAbbreviation) {
19
- case 'gh':
20
- repoProvider = 'github';
21
- break;
22
- case 'gl':
23
- repoProvider = 'gitlab';
24
- break;
25
- default:
26
- repoProvider = repoProviderAbbreviation;
27
- }
28
- return {
29
- binderUrl: match[1],
30
- repoProvider: repoProvider,
31
- owner: match[4],
32
- repo: match[5],
33
- ref: match[6],
34
- };
35
- }
36
- return null;
37
- }
38
1
  function isObject(maybeObject) {
39
2
  return typeof maybeObject === 'object' && maybeObject !== null;
40
3
  }
41
- export function thebeFrontmatterToOptions(fm, githubBadgeUrl, binderBadgeUrl) {
42
- var _a;
43
- if (fm === undefined || fm === false)
4
+ export function thebeFrontmatterToOptions(fm) {
5
+ if (fm === undefined)
44
6
  return undefined;
45
- const { binder, server, lite, kernelName, disableSessionSaving, mathjaxConfig, mathjaxUrl } = (_a = fm) !== null && _a !== void 0 ? _a : {};
7
+ const { binder, server, lite, kernelName, disableSessionSaving, mathjaxConfig, mathjaxUrl } = fm !== null && fm !== void 0 ? fm : {};
46
8
  const thebeOptions = { mathjaxConfig, mathjaxUrl };
47
9
  if (disableSessionSaving) {
48
10
  thebeOptions.savedSessionOptions = { enabled: false };
@@ -53,90 +15,16 @@ export function thebeFrontmatterToOptions(fm, githubBadgeUrl, binderBadgeUrl) {
53
15
  kernelName: kernelName,
54
16
  };
55
17
  }
56
- // handle shortcut options for binder
57
- /**
58
- * github: owner/repo | url
59
- * binder: url
60
- * thebe: true
61
- *
62
- * OR
63
- *
64
- * github: owner/repo | url
65
- * binder: url
66
- * thebe:
67
- * binder: true
68
- */
69
- if (binder === true || (fm === true && (githubBadgeUrl || binderBadgeUrl))) {
70
- thebeOptions.useBinder = true;
71
- if (githubBadgeUrl || binderBadgeUrl) {
72
- const isValidBinderUrl = binderBadgeUrl ? extractBinderRepoInfo(binderBadgeUrl) : false;
73
- if (isValidBinderUrl) {
74
- const { binderUrl, owner, repo, ref } = isValidBinderUrl;
75
- thebeOptions.binderOptions = {
76
- binderUrl,
77
- repo: `${owner}/${repo}`,
78
- ref,
79
- };
80
- }
81
- else if (githubBadgeUrl) {
82
- // TODO test for owner/repo vs url
83
- const isUrl = extractGithubRepoInfo(githubBadgeUrl);
84
- if (isUrl != null) {
85
- const { owner, repo } = isUrl;
86
- thebeOptions.binderOptions = {
87
- repo: `${owner}/${repo}`,
88
- ref: 'HEAD',
89
- };
90
- }
91
- else if (githubBadgeUrl.split('/').length === 2) {
92
- // assume owner/repo
93
- thebeOptions.binderOptions = {
94
- repo: githubBadgeUrl,
95
- ref: 'HEAD',
96
- };
97
- }
98
- else {
99
- console.debug('myst-theme:thebeFrontmatterToOptions looks like an invalid github frontmatter value', githubBadgeUrl);
100
- console.debug('myst-theme:thebeFrontmatterToOptions cannot connect to binder');
101
- thebeOptions.useBinder = false;
102
- }
103
- }
104
- }
105
- }
106
- else if (isObject(binder)) {
107
- // handle fully specified binder options
18
+ if (binder) {
108
19
  thebeOptions.useBinder = true;
109
- const { url, ref, provider, repo } = binder;
110
- thebeOptions.binderOptions = {
111
- ref,
112
- repo,
113
- };
114
- if (url)
115
- thebeOptions.binderOptions.binderUrl = url;
116
- if (provider)
117
- thebeOptions.binderOptions.repoProvider = provider;
20
+ const { repo, ref, url, provider } = binder;
21
+ thebeOptions.binderOptions = { repo, ref, binderUrl: url, repoProvider: provider };
118
22
  }
119
- // handle jupyterlite
120
- /**
121
- * thebe:
122
- * lite: true
123
- */
23
+ // check for juptyer lite
124
24
  if (lite === true) {
125
25
  thebeOptions.useJupyterLite = true;
126
26
  }
127
- // handle shortcut options for direct server, which really is the fallback for any shortcut option
128
- /**
129
- * github: undefined
130
- * binder: undefined
131
- * thebe: true
132
- *
133
- * OR
134
- *
135
- * github: undefined
136
- * binder: undefined
137
- * thebe:
138
- * server: true
139
- */
27
+ // translate fm to server settings
140
28
  if (isObject(server)) {
141
29
  // handle fully specified server object
142
30
  const { url, token } = server;
@@ -146,6 +34,5 @@ export function thebeFrontmatterToOptions(fm, githubBadgeUrl, binderBadgeUrl) {
146
34
  if (token)
147
35
  thebeOptions.serverSettings.token = token;
148
36
  }
149
- // else if (fm === true || server === true || !server) => do nothing - just return / fall though for defaults
150
37
  return thebeOptions;
151
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/jupyter",
3
- "version": "0.5.16",
3
+ "version": "0.5.18",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,23 +25,23 @@
25
25
  "@curvenote/ansi-to-react": "^7.0.0",
26
26
  "@headlessui/react": "^1.7.15",
27
27
  "@heroicons/react": "^2.0.18",
28
- "@myst-theme/providers": "^0.5.16",
28
+ "@myst-theme/providers": "^0.5.18",
29
29
  "@scienceicons/react": "^0.0.6",
30
30
  "buffer": "^6.0.3",
31
31
  "classnames": "^2.3.2",
32
- "myst-common": "^1.1.16",
33
- "myst-config": "^1.1.16",
34
- "myst-frontmatter": "^1.1.16",
32
+ "myst-common": "^1.1.18",
33
+ "myst-config": "^1.1.18",
34
+ "myst-frontmatter": "^1.1.18",
35
35
  "myst-spec": "^0.0.4",
36
- "myst-spec-ext": "^1.1.16",
37
- "myst-to-react": "^0.5.16",
36
+ "myst-spec-ext": "^1.1.18",
37
+ "myst-to-react": "^0.5.18",
38
38
  "nanoid": "^4.0.2",
39
39
  "nbtx": "^0.2.3",
40
40
  "react-syntax-highlighter": "^15.5.0",
41
41
  "swr": "^2.1.5",
42
- "thebe-core": "^0.3.5",
43
- "thebe-lite": "^0.3.5",
44
- "thebe-react": "^0.3.5",
42
+ "thebe-core": "^0.4.3",
43
+ "thebe-lite": "^0.4.3",
44
+ "thebe-react": "^0.4.3",
45
45
  "unist-util-select": "^4.0.3"
46
46
  },
47
47
  "peerDependencies": {
@@ -49,5 +49,6 @@
49
49
  "@types/react-dom": "^16.8 || ^17.0 || ^18.0",
50
50
  "react": "^16.8 || ^17.0 || ^18.0",
51
51
  "react-dom": "^16.8 || ^17.0 || ^18.0"
52
- }
52
+ },
53
+ "devDependencies": {}
53
54
  }