@myst-theme/jupyter 0.5.9 → 0.5.11
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/ConnectionStatusTray.js +7 -6
- package/dist/controls/Buttons.d.ts.map +1 -1
- package/dist/controls/Buttons.js +4 -29
- package/dist/execute/provider.d.ts.map +1 -1
- package/dist/execute/provider.js +2 -2
- package/dist/hooks.d.ts +8 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +41 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/providers.d.ts +3 -7
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +6 -5
- package/package.json +3 -3
|
@@ -4,7 +4,8 @@ import { useThebeServer } from 'thebe-react';
|
|
|
4
4
|
import { useThebeOptions } 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
9
|
const { connecting, ready: serverReady, error: serverError, events } = useThebeServer();
|
|
9
10
|
const { slug, ready: scopeReady, state } = useExecutionScope();
|
|
10
11
|
const [show, setShow] = useState(false);
|
|
@@ -22,7 +23,7 @@ export function ConnectionStatusTray({ waitForSessions }) {
|
|
|
22
23
|
events.on('status', handleStatus);
|
|
23
24
|
}, [events]);
|
|
24
25
|
useEffect(() => {
|
|
25
|
-
if (!options)
|
|
26
|
+
if (!(thebe === null || thebe === void 0 ? void 0 : thebe.options))
|
|
26
27
|
return;
|
|
27
28
|
if (busy || error) {
|
|
28
29
|
setShow(true);
|
|
@@ -34,17 +35,17 @@ export function ConnectionStatusTray({ waitForSessions }) {
|
|
|
34
35
|
setUnsub(undefined);
|
|
35
36
|
}, 1000);
|
|
36
37
|
}
|
|
37
|
-
}, [
|
|
38
|
-
const host = (
|
|
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)
|
|
39
40
|
? 'Binder'
|
|
40
|
-
: (
|
|
41
|
+
: ((_b = thebe === null || thebe === void 0 ? void 0 : thebe.options) === null || _b === void 0 ? void 0 : _b.useJupyterLite)
|
|
41
42
|
? 'JupyterLite'
|
|
42
43
|
: 'Local Server';
|
|
43
44
|
// TODO radix ui toast!
|
|
44
45
|
if (show && error) {
|
|
45
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" }) })] }));
|
|
46
47
|
}
|
|
47
|
-
if (show && (
|
|
48
|
+
if (show && ((_c = thebe === null || thebe === void 0 ? void 0 : thebe.options) === null || _c === void 0 ? void 0 : _c.useJupyterLite)) {
|
|
48
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." }))] }));
|
|
49
50
|
}
|
|
50
51
|
if (show) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Buttons.d.ts","sourceRoot":"","sources":["../../src/controls/Buttons.tsx"],"names":[],"mappings":"
|
|
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,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,2CAiBA;AAED,wBAAgB,KAAK,CAAC,EACpB,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,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"}
|
package/dist/controls/Buttons.js
CHANGED
|
@@ -3,8 +3,7 @@ import { PlayCircleIcon, ArrowPathIcon, MinusCircleIcon, ArrowTopRightOnSquareIc
|
|
|
3
3
|
import { BoltIcon as BoltIconSolid } from '@heroicons/react/24/solid';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { Spinner } from './Spinner.js';
|
|
6
|
-
import {
|
|
7
|
-
import { useCallback, useState } from 'react';
|
|
6
|
+
import { useLaunchBinder } from '../hooks.js';
|
|
8
7
|
function BinderButton({ icon, label, title, busy, error, className, onClick, }) {
|
|
9
8
|
let iconToShow = icon;
|
|
10
9
|
if (error) {
|
|
@@ -16,15 +15,7 @@ function BinderButton({ icon, label, title, busy, error, className, onClick, })
|
|
|
16
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 })] }) }));
|
|
17
16
|
}
|
|
18
17
|
export function LaunchBinder({ style, location }) {
|
|
19
|
-
const {
|
|
20
|
-
const [autoOpen, setAutoOpen] = useState(false);
|
|
21
|
-
// automatically click the link when the server is ready
|
|
22
|
-
// but only if the connection was initiated in this component by the user
|
|
23
|
-
const autoClick = useCallback((node) => {
|
|
24
|
-
if (node != null && autoOpen) {
|
|
25
|
-
node.click();
|
|
26
|
-
}
|
|
27
|
-
}, [autoOpen]);
|
|
18
|
+
const { connecting, ready, error, autoClickRef, handleStart, getUserServerUrl } = useLaunchBinder();
|
|
28
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';
|
|
29
20
|
let icon = (_jsx(ArrowTopRightOnSquareIcon, { width: "1rem", height: "1rem", className: "self-center mr-2 transition-transform group-hover:-translate-x-1 shrink-0" }));
|
|
30
21
|
if (style === 'link') {
|
|
@@ -32,26 +23,10 @@ export function LaunchBinder({ style, location }) {
|
|
|
32
23
|
btnStyles =
|
|
33
24
|
'inline-flex items-center mr-2 font-medium no-underline text-gray-900 lg:mr-0 lg:flex';
|
|
34
25
|
}
|
|
35
|
-
const handleStart = () => {
|
|
36
|
-
if (!connect) {
|
|
37
|
-
console.debug("LaunchBinder: Trying to start a connection but connect() isn't defined");
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
setAutoOpen(true);
|
|
41
|
-
connect();
|
|
42
|
-
};
|
|
43
26
|
if (ready) {
|
|
44
27
|
// we expect ?token= to be in the url
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// add the location to the url pathname
|
|
48
|
-
const url = new URL(userServerUrl);
|
|
49
|
-
if (url.pathname.endsWith('/'))
|
|
50
|
-
url.pathname = url.pathname.slice(0, -1);
|
|
51
|
-
url.pathname = `${url.pathname}/lab/tree${location}`;
|
|
52
|
-
userServerUrl = url.toString();
|
|
53
|
-
}
|
|
54
|
-
return (_jsx("a", { ref: autoClick, className: btnStyles, href: userServerUrl, target: "_blank", rel: "noopener noreferrer", title: "Binder server is available, click to open in a new tab", children: _jsxs("div", { className: "flex items-center h-full", children: [icon, _jsx("span", { children: "Open in Binder" })] }) }));
|
|
28
|
+
const userServerUrl = getUserServerUrl(location);
|
|
29
|
+
return (_jsx("a", { ref: autoClickRef, className: btnStyles, href: userServerUrl, target: "_blank", rel: "noopener noreferrer", title: "Binder server is available, click to open in a new tab", children: _jsxs("div", { className: "flex items-center h-full", children: [icon, _jsx("span", { children: "Open in Binder" })] }) }));
|
|
55
30
|
}
|
|
56
31
|
let label = 'Launch Binder';
|
|
57
32
|
let title = 'Click to start a new compute session';
|
|
@@ -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;AAS1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,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,CAA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AAc,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;IAC5B,WAAW,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;KAAE,CAAC;CAC1C,CAAC;AAmEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC,2CAmGxD"}
|
package/dist/execute/provider.js
CHANGED
|
@@ -44,7 +44,7 @@ function useExecutionScopeFetcher({ slug, state, dispatch, }) {
|
|
|
44
44
|
}, [state.builds, state.mdast]);
|
|
45
45
|
}
|
|
46
46
|
function listComputables(mdast) {
|
|
47
|
-
return selectAll('container[kind=figure]
|
|
47
|
+
return selectAll('container[kind=figure]:has(output), embed:has(output)', mdast).map((node) => {
|
|
48
48
|
const { key, label, source } = node;
|
|
49
49
|
const output = selectAll('output', node);
|
|
50
50
|
return { embedKey: key, outputKey: output[0].key, label, source };
|
|
@@ -57,7 +57,7 @@ function listComputables(mdast) {
|
|
|
57
57
|
*/
|
|
58
58
|
export function ExecuteScopeProvider({ children, contents, }) {
|
|
59
59
|
var _a, _b;
|
|
60
|
-
const canCompute = useCanCompute(
|
|
60
|
+
const canCompute = useCanCompute();
|
|
61
61
|
// compute incoming for first render
|
|
62
62
|
const computables = listComputables(contents.mdast);
|
|
63
63
|
const fallbackLocation = contents.kind === SourceFileKind.Notebook ? '/fallback.ipynb' : '/';
|
package/dist/hooks.d.ts
CHANGED
|
@@ -15,5 +15,13 @@ export default function useWindowSize(): {
|
|
|
15
15
|
width: number;
|
|
16
16
|
height: number;
|
|
17
17
|
};
|
|
18
|
+
export declare function useLaunchBinder(): {
|
|
19
|
+
connecting: boolean;
|
|
20
|
+
ready: boolean;
|
|
21
|
+
error: string | undefined;
|
|
22
|
+
autoClickRef: (node: HTMLAnchorElement) => void;
|
|
23
|
+
handleStart: () => void;
|
|
24
|
+
getUserServerUrl: (location?: string) => string | undefined;
|
|
25
|
+
};
|
|
18
26
|
export {};
|
|
19
27
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/hooks.js
CHANGED
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { default as useSWRImmutable } from 'swr/immutable';
|
|
11
11
|
import { walkOutputs } from 'nbtx';
|
|
12
|
-
import { useState, useLayoutEffect } from 'react';
|
|
12
|
+
import { useState, useLayoutEffect, useCallback } from 'react';
|
|
13
|
+
import { useThebeServer } from 'thebe-react';
|
|
13
14
|
function fetcher(url) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
const resp = yield fetch(url);
|
|
@@ -111,3 +112,42 @@ export default function useWindowSize() {
|
|
|
111
112
|
}, []);
|
|
112
113
|
return windowSize;
|
|
113
114
|
}
|
|
115
|
+
export function useLaunchBinder() {
|
|
116
|
+
const { connect, connecting, ready, server, error } = useThebeServer();
|
|
117
|
+
const [autoOpen, setAutoOpen] = useState(false);
|
|
118
|
+
// automatically click the link when the server is ready
|
|
119
|
+
// but only if the connection was initiated in this component by the user
|
|
120
|
+
const autoClickRef = useCallback((node) => {
|
|
121
|
+
if (node != null && autoOpen) {
|
|
122
|
+
node.click();
|
|
123
|
+
}
|
|
124
|
+
}, [autoOpen]);
|
|
125
|
+
const handleStart = useCallback(() => {
|
|
126
|
+
if (!connect) {
|
|
127
|
+
console.debug("LaunchBinder: Trying to start a connection but connect() isn't defined");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
setAutoOpen(true);
|
|
131
|
+
connect();
|
|
132
|
+
}, [connect]);
|
|
133
|
+
const getUserServerUrl = useCallback((location) => {
|
|
134
|
+
let userServerUrl = server === null || server === void 0 ? void 0 : server.userServerUrl;
|
|
135
|
+
if (userServerUrl && location) {
|
|
136
|
+
// add the location to the url pathname
|
|
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}`;
|
|
141
|
+
userServerUrl = url.toString();
|
|
142
|
+
}
|
|
143
|
+
return userServerUrl;
|
|
144
|
+
}, [server]);
|
|
145
|
+
return {
|
|
146
|
+
connecting,
|
|
147
|
+
ready,
|
|
148
|
+
error,
|
|
149
|
+
autoClickRef,
|
|
150
|
+
handleStart,
|
|
151
|
+
getUserServerUrl,
|
|
152
|
+
};
|
|
153
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,5 +12,7 @@ export * from './ConnectionStatusTray.js';
|
|
|
12
12
|
export * from './providers.js';
|
|
13
13
|
export * from './execute/index.js';
|
|
14
14
|
export * from './controls/index.js';
|
|
15
|
+
export * from './utils.js';
|
|
16
|
+
export { useLaunchBinder } from './hooks.js';
|
|
15
17
|
export default OUTPUT_RENDERERS;
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,QAAA,MAAM,gBAAgB;;;;CAIrB,CAAC;AAEF,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,QAAA,MAAM,gBAAgB;;;;CAIrB,CAAC;AAEF,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,4 +12,6 @@ export * from './ConnectionStatusTray.js';
|
|
|
12
12
|
export * from './providers.js';
|
|
13
13
|
export * from './execute/index.js';
|
|
14
14
|
export * from './controls/index.js';
|
|
15
|
+
export * from './utils.js';
|
|
16
|
+
export { useLaunchBinder } from './hooks.js';
|
|
15
17
|
export default OUTPUT_RENDERERS;
|
package/dist/providers.d.ts
CHANGED
|
@@ -11,15 +11,11 @@ type ThebeOptionsContextType = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function ConfiguredThebeServerProvider({ siteManifest, optionOverrideFn, customRepoProviders, children, }: React.PropsWithChildren<{
|
|
13
13
|
siteManifest?: SiteManifest;
|
|
14
|
-
optionOverrideFn?: (opts
|
|
14
|
+
optionOverrideFn?: (opts: ExtendedCoreOptions) => ExtendedCoreOptions;
|
|
15
15
|
customRepoProviders?: RepoProviderSpec[];
|
|
16
16
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare function useCanCompute(
|
|
18
|
-
|
|
19
|
-
thebe?: boolean | Record<string, any>;
|
|
20
|
-
};
|
|
21
|
-
}): boolean;
|
|
22
|
-
export declare function useThebeOptions(): ThebeOptionsContextType;
|
|
17
|
+
export declare function useCanCompute(): boolean;
|
|
18
|
+
export declare function useThebeOptions(): ThebeOptionsContextType | undefined;
|
|
23
19
|
export type PartialPage = {
|
|
24
20
|
kind: SourceFileKind;
|
|
25
21
|
file: string;
|
package/dist/providers.d.ts.map
CHANGED
|
@@ -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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EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC"}
|
package/dist/providers.js
CHANGED
|
@@ -13,14 +13,16 @@ function makeThebeOptions(siteManifest, optionsOverrideFn = (opts) => opts) {
|
|
|
13
13
|
const githubBadgeUrl = mainProject === null || mainProject === void 0 ? void 0 : mainProject.github;
|
|
14
14
|
const binderBadgeUrl = mainProject === null || mainProject === void 0 ? void 0 : mainProject.binder;
|
|
15
15
|
const optionsFromFrontmatter = thebeFrontmatterToOptions(thebeFrontmatter, githubBadgeUrl, binderBadgeUrl);
|
|
16
|
-
|
|
16
|
+
let options = optionsFromFrontmatter;
|
|
17
|
+
if (options)
|
|
18
|
+
options = optionsOverrideFn(options);
|
|
17
19
|
return {
|
|
18
20
|
options,
|
|
19
21
|
githubBadgeUrl,
|
|
20
22
|
binderBadgeUrl,
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
|
-
const ThebeOptionsContext = React.createContext(
|
|
25
|
+
const ThebeOptionsContext = React.createContext(undefined);
|
|
24
26
|
export function ConfiguredThebeServerProvider({ siteManifest, optionOverrideFn, customRepoProviders, children, }) {
|
|
25
27
|
var _a, _b, _c, _d;
|
|
26
28
|
const thebe = React.useMemo(() => makeThebeOptions(siteManifest, optionOverrideFn), [siteManifest, optionOverrideFn]);
|
|
@@ -28,10 +30,9 @@ export function ConfiguredThebeServerProvider({ siteManifest, optionOverrideFn,
|
|
|
28
30
|
return _jsx(_Fragment, { children: children });
|
|
29
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 }) }) }));
|
|
30
32
|
}
|
|
31
|
-
export function useCanCompute(
|
|
32
|
-
var _a;
|
|
33
|
+
export function useCanCompute() {
|
|
33
34
|
const thebe = useContext(ThebeOptionsContext);
|
|
34
|
-
return !!thebe
|
|
35
|
+
return !!(thebe === null || thebe === void 0 ? void 0 : thebe.options);
|
|
35
36
|
}
|
|
36
37
|
export function useThebeOptions() {
|
|
37
38
|
return useContext(ThebeOptionsContext);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/jupyter",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
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.
|
|
28
|
+
"@myst-theme/providers": "^0.5.11",
|
|
29
29
|
"@scienceicons/react": "^0.0.6",
|
|
30
30
|
"buffer": "^6.0.3",
|
|
31
31
|
"classnames": "^2.3.2",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"myst-frontmatter": "^1.1.8",
|
|
35
35
|
"myst-spec": "^0.0.4",
|
|
36
36
|
"myst-spec-ext": "^1.1.8",
|
|
37
|
-
"myst-to-react": "^0.5.
|
|
37
|
+
"myst-to-react": "^0.5.11",
|
|
38
38
|
"nanoid": "^4.0.2",
|
|
39
39
|
"nbtx": "^0.2.3",
|
|
40
40
|
"react-syntax-highlighter": "^15.5.0",
|