@myst-theme/jupyter 0.5.10 → 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.
|
@@ -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":"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,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;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,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/providers.d.ts
CHANGED
|
@@ -14,12 +14,8 @@ export declare function ConfiguredThebeServerProvider({ siteManifest, optionOver
|
|
|
14
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,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,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,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AAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC"}
|
package/dist/providers.js
CHANGED
|
@@ -22,7 +22,7 @@ function makeThebeOptions(siteManifest, optionsOverrideFn = (opts) => opts) {
|
|
|
22
22
|
binderBadgeUrl,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
const ThebeOptionsContext = React.createContext(
|
|
25
|
+
const ThebeOptionsContext = React.createContext(undefined);
|
|
26
26
|
export function ConfiguredThebeServerProvider({ siteManifest, optionOverrideFn, customRepoProviders, children, }) {
|
|
27
27
|
var _a, _b, _c, _d;
|
|
28
28
|
const thebe = React.useMemo(() => makeThebeOptions(siteManifest, optionOverrideFn), [siteManifest, optionOverrideFn]);
|
|
@@ -30,10 +30,9 @@ export function ConfiguredThebeServerProvider({ siteManifest, optionOverrideFn,
|
|
|
30
30
|
return _jsx(_Fragment, { children: children });
|
|
31
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 }) }) }));
|
|
32
32
|
}
|
|
33
|
-
export function useCanCompute(
|
|
34
|
-
var _a;
|
|
33
|
+
export function useCanCompute() {
|
|
35
34
|
const thebe = useContext(ThebeOptionsContext);
|
|
36
|
-
return !!thebe
|
|
35
|
+
return !!(thebe === null || thebe === void 0 ? void 0 : thebe.options);
|
|
37
36
|
}
|
|
38
37
|
export function useThebeOptions() {
|
|
39
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",
|