@myst-theme/site 0.2.10 → 0.3.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/site",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"main": "./src/index.ts",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -14,38 +14,33 @@
|
|
|
14
14
|
"lint:format": "prettier --check \"src/**/*.{ts,tsx,md}\""
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@headlessui/react": "^1.7.
|
|
18
|
-
"@heroicons/react": "^2.0.
|
|
19
|
-
"@myst-theme/diagrams": "^0.
|
|
20
|
-
"@myst-theme/frontmatter": "^0.
|
|
21
|
-
"@myst-theme/jupyter": "^0.
|
|
22
|
-
"@myst-theme/providers": "^0.
|
|
17
|
+
"@headlessui/react": "^1.7.15",
|
|
18
|
+
"@heroicons/react": "^2.0.18",
|
|
19
|
+
"@myst-theme/diagrams": "^0.3.1",
|
|
20
|
+
"@myst-theme/frontmatter": "^0.3.1",
|
|
21
|
+
"@myst-theme/jupyter": "^0.3.1",
|
|
22
|
+
"@myst-theme/providers": "^0.3.1",
|
|
23
23
|
"classnames": "^2.3.2",
|
|
24
24
|
"lodash.throttle": "^4.1.1",
|
|
25
|
-
"myst-common": "^
|
|
26
|
-
"myst-config": "^0.0
|
|
27
|
-
"myst-demo": "^0.
|
|
28
|
-
"myst-to-react": "^0.
|
|
25
|
+
"myst-common": "^1.0.1",
|
|
26
|
+
"myst-config": "^1.0.0",
|
|
27
|
+
"myst-demo": "^0.3.1",
|
|
28
|
+
"myst-to-react": "^0.3.1",
|
|
29
29
|
"nbtx": "^0.2.3",
|
|
30
30
|
"node-cache": "^5.1.2",
|
|
31
|
-
"node-fetch": "^2.6.
|
|
32
|
-
"thebe-react": "^0.
|
|
31
|
+
"node-fetch": "^2.6.11",
|
|
32
|
+
"thebe-react": "^0.2.3",
|
|
33
33
|
"unist-util-select": "^4.0.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@remix-run/node": "^1.
|
|
37
|
-
"@remix-run/react": "^1.
|
|
36
|
+
"@remix-run/node": "^1.17.0",
|
|
37
|
+
"@remix-run/react": "^1.17.0",
|
|
38
38
|
"@types/react": "^16.8 || ^17.0 || ^18.0",
|
|
39
39
|
"@types/react-dom": "^16.8 || ^17.0 || ^18.0",
|
|
40
40
|
"react": "^16.8 || ^17.0 || ^18.0",
|
|
41
41
|
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/lodash.throttle": "^4.1.7"
|
|
45
|
-
"@types/node-fetch": "^2.6.2",
|
|
46
|
-
"eslint": "^8.21.0",
|
|
47
|
-
"eslint-config-curvenote": "latest",
|
|
48
|
-
"tsconfig": "latest",
|
|
49
|
-
"typescript": "latest"
|
|
44
|
+
"@types/lodash.throttle": "^4.1.7"
|
|
50
45
|
}
|
|
51
46
|
}
|
|
@@ -99,7 +99,14 @@ export function NotebookRunAll() {
|
|
|
99
99
|
return (
|
|
100
100
|
<div className="flex">
|
|
101
101
|
<div className="group flex relative space-x-1">
|
|
102
|
-
<Run
|
|
102
|
+
<Run
|
|
103
|
+
ready={ready}
|
|
104
|
+
executing={executing}
|
|
105
|
+
execute={(options) => {
|
|
106
|
+
clear();
|
|
107
|
+
return executeAll(options);
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
103
110
|
<button
|
|
104
111
|
className="flex items-center cursor-pointer text-gray-700 active:text-green-700 opacity-60 hover:opacity-100"
|
|
105
112
|
disabled={!ready || executing}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useThebeLoader, useThebeServer, useThebeSession } from 'thebe-react';
|
|
2
2
|
import PowerIcon from '@heroicons/react/24/outline/PowerIcon';
|
|
3
3
|
import { useHasNotebookProvider } from '@myst-theme/jupyter';
|
|
4
4
|
import { useNavigation } from '@remix-run/react';
|
|
@@ -8,7 +8,7 @@ export function EnableCompute({
|
|
|
8
8
|
canCompute,
|
|
9
9
|
children,
|
|
10
10
|
}: React.PropsWithChildren<{ canCompute: boolean }>) {
|
|
11
|
-
const { load, loading, core } =
|
|
11
|
+
const { load, loading, core } = useThebeLoader();
|
|
12
12
|
const { connect, connecting, ready: serverReady, error: serverError } = useThebeServer();
|
|
13
13
|
const {
|
|
14
14
|
start,
|
|
@@ -54,7 +54,7 @@ export function EnableCompute({
|
|
|
54
54
|
}, [shutdown, navigation]);
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<div className="flex mx-1 items-center">
|
|
57
|
+
<div className="flex mx-1 items-center mb-2">
|
|
58
58
|
<button className={classes} onClick={() => setEnabling(true)} disabled={enabling || enabled}>
|
|
59
59
|
<PowerIcon className="h-6 w-6 mx-1 inline-block align-top" title="enable compute" />
|
|
60
60
|
</button>
|
|
@@ -185,7 +185,7 @@ export const TableOfContents = ({
|
|
|
185
185
|
>
|
|
186
186
|
<nav
|
|
187
187
|
aria-label="Table of Contents"
|
|
188
|
-
className="flex-grow overflow-y-auto transition-opacity mt-6 pb-3 ml-3 xl:ml-0 mr-3"
|
|
188
|
+
className="flex-grow overflow-y-auto transition-opacity mt-6 pb-3 ml-3 xl:ml-0 mr-3 max-w-[350px]"
|
|
189
189
|
>
|
|
190
190
|
<Headings folder={projectSlug} headings={headings} sections={config?.projects} />
|
|
191
191
|
</nav>
|
package/src/loaders/utils.ts
CHANGED
|
@@ -72,7 +72,7 @@ export function getFooterLinks(
|
|
|
72
72
|
projectSlug?: string,
|
|
73
73
|
slug?: string,
|
|
74
74
|
): FooterLinks {
|
|
75
|
-
if (!
|
|
75
|
+
if (!slug || !config) return {};
|
|
76
76
|
const pages = getProjectHeadings(config, projectSlug, {
|
|
77
77
|
addGroups: true,
|
|
78
78
|
});
|
package/src/pages/Article.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ReferencesProvider
|
|
2
|
+
import { ReferencesProvider } from '@myst-theme/providers';
|
|
3
3
|
import { FrontmatterBlock } from '@myst-theme/frontmatter';
|
|
4
4
|
import { Bibliography, ContentBlocks, FooterLinksBlock } from '../components';
|
|
5
5
|
import { ErrorDocumentNotFound } from './ErrorDocumentNotFound';
|
|
6
6
|
import { ErrorProjectNotFound } from './ErrorProjectNotFound';
|
|
7
7
|
import type { PageLoader } from '../types';
|
|
8
|
-
import { ThebeSessionProvider } from 'thebe-react';
|
|
8
|
+
import { ThebeRenderMimeRegistryProvider, ThebeSessionProvider } from 'thebe-react';
|
|
9
9
|
import type { GenericParent } from 'myst-common';
|
|
10
10
|
import { SourceFileKind } from 'myst-common';
|
|
11
11
|
import { EnableCompute } from '../components/EnableCompute';
|
|
12
12
|
import { NotebookRunAll } from '../components/ComputeControls';
|
|
13
|
-
import { NotebookProvider, BinderBadge } from '@myst-theme/jupyter';
|
|
13
|
+
import { NotebookProvider, BinderBadge, useComputeOptions } from '@myst-theme/jupyter';
|
|
14
14
|
|
|
15
15
|
export const ArticlePage = React.memo(function ({ article }: { article: PageLoader }) {
|
|
16
16
|
const computeOptions = useComputeOptions();
|
|
@@ -23,25 +23,27 @@ export const ArticlePage = React.memo(function ({ article }: { article: PageLoad
|
|
|
23
23
|
references={{ ...article.references, article: article.mdast }}
|
|
24
24
|
frontmatter={article.frontmatter}
|
|
25
25
|
>
|
|
26
|
-
<
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
<div className="flex-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
<ThebeRenderMimeRegistryProvider>
|
|
27
|
+
<ThebeSessionProvider start={false} name={article.slug}>
|
|
28
|
+
{!hide_title_block && (
|
|
29
|
+
<FrontmatterBlock kind={article.kind} frontmatter={article.frontmatter} />
|
|
30
|
+
)}
|
|
31
|
+
<NotebookProvider siteConfig={false} page={article}>
|
|
32
|
+
<div className="flex items-center">
|
|
33
|
+
<div className="flex-grow"></div>
|
|
34
|
+
{binder && <BinderBadge binder={binder} />}
|
|
35
|
+
{canCompute && isJupyter && (
|
|
36
|
+
<EnableCompute canCompute={true} key={article.slug}>
|
|
37
|
+
<NotebookRunAll />
|
|
38
|
+
</EnableCompute>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
<ContentBlocks pageKind={article.kind} mdast={article.mdast as GenericParent} />
|
|
42
|
+
<Bibliography />
|
|
43
|
+
{!hide_footer_links && <FooterLinksBlock links={article.footer} />}
|
|
44
|
+
</NotebookProvider>
|
|
45
|
+
</ThebeSessionProvider>
|
|
46
|
+
</ThebeRenderMimeRegistryProvider>
|
|
45
47
|
</ReferencesProvider>
|
|
46
48
|
);
|
|
47
49
|
});
|
package/src/pages/Root.tsx
CHANGED
|
@@ -16,8 +16,8 @@ import { ContentReload, renderers } from '../components';
|
|
|
16
16
|
import { Analytics } from '../seo';
|
|
17
17
|
import { Error404 } from './Error404';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
|
-
import { ThebeCoreProvider } from 'thebe-react';
|
|
20
19
|
import { ConfiguredThebeServerProvider } from '@myst-theme/jupyter';
|
|
20
|
+
import { ThebeBundleLoaderProvider } from 'thebe-react';
|
|
21
21
|
|
|
22
22
|
export function Document({
|
|
23
23
|
children,
|
|
@@ -63,11 +63,11 @@ export function Document({
|
|
|
63
63
|
<body className="m-0 transition-colors duration-500 bg-white dark:bg-stone-900">
|
|
64
64
|
<ThemeProvider theme={theme} renderers={renderers} {...links}>
|
|
65
65
|
<BaseUrlProvider baseurl={baseurl}>
|
|
66
|
-
<
|
|
66
|
+
<ThebeBundleLoaderProvider loadThebeLite>
|
|
67
67
|
<SiteProvider config={config}>
|
|
68
68
|
<ConfiguredThebeServerProvider>{children}</ConfiguredThebeServerProvider>
|
|
69
69
|
</SiteProvider>
|
|
70
|
-
</
|
|
70
|
+
</ThebeBundleLoaderProvider>
|
|
71
71
|
</BaseUrlProvider>
|
|
72
72
|
</ThemeProvider>
|
|
73
73
|
<ScrollRestoration />
|