@myst-theme/site 0.5.7 → 0.5.9
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 +12 -9
- package/src/components/Abstract.tsx +1 -1
- package/src/components/DocumentOutline.tsx +1 -1
- package/src/components/FooterLinksBlock.tsx +1 -2
- package/src/components/Headers.tsx +1 -1
- package/src/components/Navigation/Navigation.tsx +1 -1
- package/src/components/Navigation/ThemeButton.tsx +2 -2
- package/src/components/Navigation/TopNav.tsx +7 -5
- package/src/components/Navigation/index.tsx +5 -5
- package/src/components/SkipToArticle.tsx +5 -7
- package/src/components/index.ts +11 -11
- package/src/index.ts +5 -5
- package/src/loaders/index.ts +3 -3
- package/src/pages/Article.tsx +9 -13
- package/src/pages/Root.tsx +10 -5
- package/src/pages/index.ts +5 -5
- package/src/seo/index.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/site",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "./src/index.ts",
|
|
5
6
|
"types": "./src/index.ts",
|
|
6
7
|
"files": [
|
|
@@ -16,27 +17,29 @@
|
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@headlessui/react": "^1.7.15",
|
|
18
19
|
"@heroicons/react": "^2.0.18",
|
|
19
|
-
"@myst-theme/diagrams": "^0.5.
|
|
20
|
-
"@myst-theme/frontmatter": "^0.5.
|
|
21
|
-
"@myst-theme/jupyter": "^0.5.
|
|
22
|
-
"@myst-theme/common": "^0.5.
|
|
23
|
-
"@myst-theme/providers": "^0.5.
|
|
20
|
+
"@myst-theme/diagrams": "^0.5.9",
|
|
21
|
+
"@myst-theme/frontmatter": "^0.5.9",
|
|
22
|
+
"@myst-theme/jupyter": "^0.5.9",
|
|
23
|
+
"@myst-theme/common": "^0.5.9",
|
|
24
|
+
"@myst-theme/providers": "^0.5.9",
|
|
24
25
|
"classnames": "^2.3.2",
|
|
25
26
|
"lodash.throttle": "^4.1.1",
|
|
26
27
|
"myst-common": "^1.1.8",
|
|
27
28
|
"myst-spec-ext": "^1.1.8",
|
|
28
29
|
"myst-config": "^1.1.8",
|
|
29
|
-
"myst-demo": "^0.5.
|
|
30
|
-
"myst-to-react": "^0.5.
|
|
30
|
+
"myst-demo": "^0.5.9",
|
|
31
|
+
"myst-to-react": "^0.5.9",
|
|
31
32
|
"nbtx": "^0.2.3",
|
|
32
33
|
"node-cache": "^5.1.2",
|
|
33
34
|
"node-fetch": "^2.6.11",
|
|
34
|
-
"thebe-react": "^0.3.
|
|
35
|
+
"thebe-react": "^0.3.5",
|
|
35
36
|
"unist-util-select": "^4.0.1"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"@types/react": "^16.8 || ^17.0 || ^18.0",
|
|
39
40
|
"@types/react-dom": "^16.8 || ^17.0 || ^18.0",
|
|
41
|
+
"@remix-run/react": "^1.17 || ^2.0",
|
|
42
|
+
"@remix-run/node": "^1.17 || ^2.0",
|
|
40
43
|
"react": "^16.8 || ^17.0 || ^18.0",
|
|
41
44
|
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
42
45
|
},
|
|
@@ -8,7 +8,7 @@ import { useNavigation } from '@remix-run/react';
|
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import throttle from 'lodash.throttle';
|
|
10
10
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
-
import DocumentChartBarIcon from '@heroicons/react/24/outline
|
|
11
|
+
import { DocumentChartBarIcon } from '@heroicons/react/24/outline';
|
|
12
12
|
|
|
13
13
|
const SELECTOR = [1, 2, 3, 4].map((n) => `main h${n}`).join(', ');
|
|
14
14
|
const HIGHLIGHT_CLASS = 'highlight';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import ArrowLeftIcon from '@heroicons/react/24/outline
|
|
3
|
-
import ArrowRightIcon from '@heroicons/react/24/outline/ArrowRightIcon';
|
|
2
|
+
import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline';
|
|
4
3
|
import type { FooterLinks, NavigationLink } from '@myst-theme/common';
|
|
5
4
|
import { useLinkProvider, useBaseurl, withBaseurl } from '@myst-theme/providers';
|
|
6
5
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { useGridSystemProvider } from '@myst-theme/providers';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import type { PageFrontmatter } from 'myst-frontmatter';
|
|
11
|
-
import { ThemeButton } from './Navigation';
|
|
11
|
+
import { ThemeButton } from './Navigation/index.js';
|
|
12
12
|
|
|
13
13
|
export function ArticleHeader({
|
|
14
14
|
frontmatter,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTheme } from '@myst-theme/providers';
|
|
2
|
-
import MoonIcon from '@heroicons/react/24/solid
|
|
3
|
-
import SunIcon from '@heroicons/react/24/outline
|
|
2
|
+
import { MoonIcon } from '@heroicons/react/24/solid';
|
|
3
|
+
import { SunIcon } from '@heroicons/react/24/outline';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
|
|
6
6
|
export function ThemeButton({ className = 'w-8 h-8 mx-3' }: { className?: string }) {
|
|
@@ -2,11 +2,13 @@ import { NavLink } from '@remix-run/react';
|
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { Menu, Transition } from '@headlessui/react';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import {
|
|
6
|
+
EllipsisVerticalIcon,
|
|
7
|
+
ChevronDownIcon,
|
|
8
|
+
Bars3Icon as MenuIcon,
|
|
9
|
+
} from '@heroicons/react/24/solid';
|
|
8
10
|
import type { SiteManifest, SiteNavItem } from 'myst-config';
|
|
9
|
-
import { ThemeButton } from './ThemeButton';
|
|
11
|
+
import { ThemeButton } from './ThemeButton.js';
|
|
10
12
|
import {
|
|
11
13
|
useBaseurl,
|
|
12
14
|
useLinkProvider,
|
|
@@ -14,7 +16,7 @@ import {
|
|
|
14
16
|
useSiteManifest,
|
|
15
17
|
withBaseurl,
|
|
16
18
|
} from '@myst-theme/providers';
|
|
17
|
-
import { LoadingBar } from './Loading';
|
|
19
|
+
import { LoadingBar } from './Loading.js';
|
|
18
20
|
|
|
19
21
|
export const DEFAULT_NAV_HEIGHT = 60;
|
|
20
22
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ThemeButton } from './ThemeButton';
|
|
2
|
-
export { TopNav, DEFAULT_NAV_HEIGHT } from './TopNav';
|
|
3
|
-
export { Navigation } from './Navigation';
|
|
4
|
-
export { TableOfContents, InlineTableOfContents, useTocHeight } from './TableOfContents';
|
|
5
|
-
export { LoadingBar } from './Loading';
|
|
1
|
+
export { ThemeButton } from './ThemeButton.js';
|
|
2
|
+
export { TopNav, DEFAULT_NAV_HEIGHT } from './TopNav.js';
|
|
3
|
+
export { Navigation } from './Navigation.js';
|
|
4
|
+
export { TableOfContents, InlineTableOfContents, useTocHeight } from './TableOfContents.js';
|
|
5
|
+
export { LoadingBar } from './Loading.js';
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function makeSkipClickHandler(hash: string) {
|
|
4
4
|
return (e: React.UIEvent<HTMLElement, Event>) => {
|
|
5
5
|
e.preventDefault();
|
|
6
6
|
const el = document.querySelector(`#${hash}`);
|
|
7
7
|
if (!el) return;
|
|
8
|
-
el.
|
|
8
|
+
(el.nextSibling as HTMLElement).focus();
|
|
9
9
|
history.replaceState(undefined, '', `#${hash}`);
|
|
10
|
-
(el.nextSibling as HTMLElement).focus({ preventScroll: true });
|
|
11
|
-
(e.target as HTMLElement).blur();
|
|
12
10
|
};
|
|
13
11
|
}
|
|
14
12
|
|
|
@@ -22,8 +20,8 @@ export function SkipToArticle({
|
|
|
22
20
|
const fm = 'skip-to-frontmatter';
|
|
23
21
|
const art = 'skip-to-article';
|
|
24
22
|
|
|
25
|
-
const
|
|
26
|
-
const articleHandler = useCallback(() =>
|
|
23
|
+
const frontmatterHandler = useCallback(() => makeSkipClickHandler(fm), [frontmatter]);
|
|
24
|
+
const articleHandler = useCallback(() => makeSkipClickHandler(art), [article]);
|
|
27
25
|
return (
|
|
28
26
|
<div
|
|
29
27
|
className="fixed top-1 left-1 h-[0px] w-[0px] focus-within:z-40 focus-within:h-auto focus-within:w-auto bg-white overflow-hidden focus-within:p-2 focus-within:ring-1"
|
|
@@ -33,7 +31,7 @@ export function SkipToArticle({
|
|
|
33
31
|
<a
|
|
34
32
|
href={`#${fm}`}
|
|
35
33
|
className="block px-2 py-1 text-black underline"
|
|
36
|
-
onClick={
|
|
34
|
+
onClick={frontmatterHandler}
|
|
37
35
|
>
|
|
38
36
|
Skip to article frontmatter
|
|
39
37
|
</a>
|
package/src/components/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { ContentBlocks } from './ContentBlocks';
|
|
2
|
-
export { DocumentOutline, useOutlineHeight, SupportingDocuments } from './DocumentOutline';
|
|
3
|
-
export { FooterLinksBlock } from './FooterLinksBlock';
|
|
4
|
-
export { ContentReload } from './ContentReload';
|
|
5
|
-
export { Bibliography } from './Bibliography';
|
|
6
|
-
export { ArticleHeader } from './Headers';
|
|
7
|
-
export { Abstract, Keywords } from './Abstract';
|
|
8
|
-
export { ExternalOrInternalLink } from './ExternalOrInternalLink';
|
|
9
|
-
export * from './Navigation';
|
|
10
|
-
export { renderers } from './renderers';
|
|
11
|
-
export * from './SkipToArticle';
|
|
1
|
+
export { ContentBlocks } from './ContentBlocks.js';
|
|
2
|
+
export { DocumentOutline, useOutlineHeight, SupportingDocuments } from './DocumentOutline.js';
|
|
3
|
+
export { FooterLinksBlock } from './FooterLinksBlock.js';
|
|
4
|
+
export { ContentReload } from './ContentReload.js';
|
|
5
|
+
export { Bibliography } from './Bibliography.js';
|
|
6
|
+
export { ArticleHeader } from './Headers.js';
|
|
7
|
+
export { Abstract, Keywords } from './Abstract.js';
|
|
8
|
+
export { ExternalOrInternalLink } from './ExternalOrInternalLink.js';
|
|
9
|
+
export * from './Navigation/index.js';
|
|
10
|
+
export { renderers } from './renderers.js';
|
|
11
|
+
export * from './SkipToArticle.js';
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './utils';
|
|
2
|
-
export * from './loaders';
|
|
3
|
-
export * from './components';
|
|
4
|
-
export * from './pages';
|
|
5
|
-
export * from './seo';
|
|
1
|
+
export * from './utils.js';
|
|
2
|
+
export * from './loaders/index.js';
|
|
3
|
+
export * from './components/index.js';
|
|
4
|
+
export * from './pages/index.js';
|
|
5
|
+
export * from './seo/index.js';
|
package/src/loaders/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './errors.server';
|
|
2
|
-
export * from './links';
|
|
3
|
-
export * from './theme.server';
|
|
1
|
+
export * from './errors.server.js';
|
|
2
|
+
export * from './links.js';
|
|
3
|
+
export * from './theme.server.js';
|
package/src/pages/Article.tsx
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ReferencesProvider } from '@myst-theme/providers';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
Abstract,
|
|
5
|
+
Bibliography,
|
|
6
|
+
ContentBlocks,
|
|
7
|
+
FooterLinksBlock,
|
|
8
|
+
Keywords,
|
|
9
|
+
} from '../components/index.js';
|
|
10
|
+
import { ErrorDocumentNotFound } from './ErrorDocumentNotFound.js';
|
|
11
|
+
import { ErrorProjectNotFound } from './ErrorProjectNotFound.js';
|
|
6
12
|
import type { PageLoader } from '@myst-theme/common';
|
|
7
13
|
import { copyNode, extractPart, type GenericParent } from 'myst-common';
|
|
8
14
|
import { SourceFileKind } from 'myst-spec-ext';
|
|
9
15
|
import {
|
|
10
|
-
useComputeOptions,
|
|
11
16
|
ExecuteScopeProvider,
|
|
12
17
|
BusyScopeProvider,
|
|
13
18
|
NotebookToolbar,
|
|
14
19
|
ConnectionStatusTray,
|
|
15
|
-
BinderBadge,
|
|
16
20
|
useCanCompute,
|
|
17
21
|
ErrorTray,
|
|
18
22
|
} from '@myst-theme/jupyter';
|
|
@@ -30,14 +34,11 @@ export const ArticlePage = React.memo(function ({
|
|
|
30
34
|
hideKeywords?: boolean;
|
|
31
35
|
}) {
|
|
32
36
|
const canCompute = useCanCompute(article);
|
|
33
|
-
const { binderBadgeUrl } = useComputeOptions();
|
|
34
37
|
const { hide_title_block, hide_footer_links } = (article.frontmatter as any)?.design ?? {};
|
|
35
38
|
|
|
36
39
|
const tree = copyNode(article.mdast);
|
|
37
40
|
const keywords = article.frontmatter?.keywords ?? [];
|
|
38
41
|
const abstract = showAbstract ? extractPart(tree, 'abstract') : undefined;
|
|
39
|
-
// take binder url from article frontmatter or fallback to project
|
|
40
|
-
const binderUrl = article.frontmatter.binder ?? binderBadgeUrl;
|
|
41
42
|
|
|
42
43
|
return (
|
|
43
44
|
<ReferencesProvider
|
|
@@ -53,11 +54,6 @@ export const ArticlePage = React.memo(function ({
|
|
|
53
54
|
className="pt-5 mb-8"
|
|
54
55
|
/>
|
|
55
56
|
)}
|
|
56
|
-
{binderUrl && !canCompute && (
|
|
57
|
-
<div className="flex justify-end">
|
|
58
|
-
<BinderBadge binder={binderUrl} />
|
|
59
|
-
</div>
|
|
60
|
-
)}
|
|
61
57
|
{canCompute && article.kind === SourceFileKind.Notebook && <NotebookToolbar showLaunch />}
|
|
62
58
|
<ErrorTray pageSlug={article.slug} />
|
|
63
59
|
<div id="skip-to-article" />
|
package/src/pages/Root.tsx
CHANGED
|
@@ -12,12 +12,13 @@ import {
|
|
|
12
12
|
Link,
|
|
13
13
|
NavLink,
|
|
14
14
|
} from '@remix-run/react';
|
|
15
|
-
import { DEFAULT_NAV_HEIGHT, renderers } from '../components';
|
|
16
|
-
import { Analytics } from '../seo';
|
|
17
|
-
import { Error404 } from './Error404';
|
|
15
|
+
import { DEFAULT_NAV_HEIGHT, renderers } from '../components/index.js';
|
|
16
|
+
import { Analytics } from '../seo/index.js';
|
|
17
|
+
import { Error404 } from './Error404.js';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import { ConfiguredThebeServerProvider } from '@myst-theme/jupyter';
|
|
20
20
|
import { ThebeBundleLoaderProvider } from 'thebe-react';
|
|
21
|
+
import type { BinderOptions, RepoProviderSpec } from 'thebe-core';
|
|
21
22
|
|
|
22
23
|
export function Document({
|
|
23
24
|
children,
|
|
@@ -27,6 +28,7 @@ export function Document({
|
|
|
27
28
|
title,
|
|
28
29
|
staticBuild,
|
|
29
30
|
baseurl,
|
|
31
|
+
loadThebeLite,
|
|
30
32
|
top = DEFAULT_NAV_HEIGHT,
|
|
31
33
|
}: {
|
|
32
34
|
children: React.ReactNode;
|
|
@@ -36,6 +38,7 @@ export function Document({
|
|
|
36
38
|
title?: string;
|
|
37
39
|
staticBuild?: boolean;
|
|
38
40
|
baseurl?: string;
|
|
41
|
+
loadThebeLite?: boolean;
|
|
39
42
|
top?: number;
|
|
40
43
|
}) {
|
|
41
44
|
const links = staticBuild
|
|
@@ -63,9 +66,11 @@ export function Document({
|
|
|
63
66
|
<body className="m-0 transition-colors duration-500 bg-white dark:bg-stone-900">
|
|
64
67
|
<ThemeProvider theme={theme} renderers={renderers} {...links} top={top}>
|
|
65
68
|
<BaseUrlProvider baseurl={baseurl}>
|
|
66
|
-
<ThebeBundleLoaderProvider loadThebeLite publicPath={baseurl}>
|
|
69
|
+
<ThebeBundleLoaderProvider loadThebeLite={loadThebeLite} publicPath={baseurl}>
|
|
67
70
|
<SiteProvider config={config}>
|
|
68
|
-
<ConfiguredThebeServerProvider
|
|
71
|
+
<ConfiguredThebeServerProvider siteManifest={config}>
|
|
72
|
+
{children}
|
|
73
|
+
</ConfiguredThebeServerProvider>
|
|
69
74
|
</SiteProvider>
|
|
70
75
|
</ThebeBundleLoaderProvider>
|
|
71
76
|
</BaseUrlProvider>
|
package/src/pages/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ErrorProjectNotFound } from './ErrorProjectNotFound';
|
|
2
|
-
export { ErrorDocumentNotFound } from './ErrorDocumentNotFound';
|
|
3
|
-
export { Error404 } from './Error404';
|
|
4
|
-
export { ArticlePage, ArticlePageCatchBoundary, ProjectPageCatchBoundary } from './Article';
|
|
5
|
-
export { App, Document, AppCatchBoundary } from './Root';
|
|
1
|
+
export { ErrorProjectNotFound } from './ErrorProjectNotFound.js';
|
|
2
|
+
export { ErrorDocumentNotFound } from './ErrorDocumentNotFound.js';
|
|
3
|
+
export { Error404 } from './Error404.js';
|
|
4
|
+
export { ArticlePage, ArticlePageCatchBoundary, ProjectPageCatchBoundary } from './Article.js';
|
|
5
|
+
export { App, Document, AppCatchBoundary } from './Root.js';
|
package/src/seo/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './analytics';
|
|
2
|
-
export * from './meta';
|
|
3
|
-
export * from './sitemap';
|
|
4
|
-
export * from './robots';
|
|
1
|
+
export * from './analytics.js';
|
|
2
|
+
export * from './meta.js';
|
|
3
|
+
export * from './sitemap.js';
|
|
4
|
+
export * from './robots.js';
|