@myst-theme/site 0.10.0 → 0.11.0
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 +11 -11
- package/src/components/renderers.ts +2 -2
- package/src/pages/Article.tsx +0 -10
- package/src/pages/ErrorUnhandled.tsx +14 -0
- package/src/pages/Root.tsx +8 -4
- package/src/pages/index.ts +3 -2
- package/src/seo/meta.ts +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/site",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@headlessui/react": "^1.7.15",
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
|
-
"@myst-theme/common": "^0.
|
|
25
|
-
"@myst-theme/diagrams": "^0.
|
|
26
|
-
"@myst-theme/frontmatter": "^0.
|
|
27
|
-
"@myst-theme/jupyter": "^0.
|
|
28
|
-
"@myst-theme/providers": "^0.
|
|
24
|
+
"@myst-theme/common": "^0.11.0",
|
|
25
|
+
"@myst-theme/diagrams": "^0.11.0",
|
|
26
|
+
"@myst-theme/frontmatter": "^0.11.0",
|
|
27
|
+
"@myst-theme/jupyter": "^0.11.0",
|
|
28
|
+
"@myst-theme/providers": "^0.11.0",
|
|
29
29
|
"@radix-ui/react-collapsible": "^1.0.3",
|
|
30
30
|
"classnames": "^2.3.2",
|
|
31
31
|
"lodash.throttle": "^4.1.1",
|
|
32
|
-
"myst-common": "^1.
|
|
33
|
-
"myst-config": "^1.
|
|
34
|
-
"myst-demo": "^0.
|
|
35
|
-
"myst-spec-ext": "^1.
|
|
36
|
-
"myst-to-react": "^0.
|
|
32
|
+
"myst-common": "^1.6.0",
|
|
33
|
+
"myst-config": "^1.6.0",
|
|
34
|
+
"myst-demo": "^0.11.0",
|
|
35
|
+
"myst-spec-ext": "^1.6.0",
|
|
36
|
+
"myst-to-react": "^0.11.0",
|
|
37
37
|
"nbtx": "^0.2.3",
|
|
38
38
|
"node-cache": "^5.1.2",
|
|
39
39
|
"node-fetch": "^2.6.11",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NodeRenderers } from '@myst-theme/providers';
|
|
2
2
|
import { DEFAULT_RENDERERS } from 'myst-to-react';
|
|
3
3
|
import { MystDemoRenderer } from 'myst-demo';
|
|
4
4
|
import { MermaidNodeRenderer } from '@myst-theme/diagrams';
|
|
5
5
|
import OUTPUT_RENDERERS from '@myst-theme/jupyter';
|
|
6
6
|
|
|
7
|
-
export const renderers:
|
|
7
|
+
export const renderers: NodeRenderers = {
|
|
8
8
|
...DEFAULT_RENDERERS,
|
|
9
9
|
myst: MystDemoRenderer,
|
|
10
10
|
mermaid: MermaidNodeRenderer,
|
package/src/pages/Article.tsx
CHANGED
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
FrontmatterParts,
|
|
8
8
|
BackmatterParts,
|
|
9
9
|
} from '../components/index.js';
|
|
10
|
-
import { ErrorDocumentNotFound } from './ErrorDocumentNotFound.js';
|
|
11
|
-
import { ErrorProjectNotFound } from './ErrorProjectNotFound.js';
|
|
12
10
|
import type { PageLoader } from '@myst-theme/common';
|
|
13
11
|
import { copyNode, type GenericParent } from 'myst-common';
|
|
14
12
|
import { SourceFileKind } from 'myst-spec-ext';
|
|
@@ -80,11 +78,3 @@ export const ArticlePage = React.memo(function ({
|
|
|
80
78
|
</ReferencesProvider>
|
|
81
79
|
);
|
|
82
80
|
});
|
|
83
|
-
|
|
84
|
-
export function ProjectPageCatchBoundary() {
|
|
85
|
-
return <ErrorProjectNotFound />;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function ArticlePageCatchBoundary() {
|
|
89
|
-
return <ErrorDocumentNotFound />;
|
|
90
|
-
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ErrorResponse = {
|
|
2
|
+
status: number;
|
|
3
|
+
statusText: string;
|
|
4
|
+
data: any;
|
|
5
|
+
};
|
|
6
|
+
export function ErrorUnhandled({ error }: { error: ErrorResponse }) {
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<h1>Unexpected Error Occurred</h1>
|
|
10
|
+
<p>Status: {error.status}</p>
|
|
11
|
+
<p>{error.data.message}</p>
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
}
|
package/src/pages/Root.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SiteManifest } from 'myst-config';
|
|
2
2
|
import type { SiteLoader } from '@myst-theme/common';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NodeRenderers } from '@myst-theme/providers';
|
|
4
4
|
import { BaseUrlProvider, SiteProvider, Theme, ThemeProvider } from '@myst-theme/providers';
|
|
5
5
|
import {
|
|
6
6
|
Links,
|
|
@@ -12,10 +12,13 @@ import {
|
|
|
12
12
|
useLoaderData,
|
|
13
13
|
Link,
|
|
14
14
|
NavLink,
|
|
15
|
+
useRouteError,
|
|
16
|
+
isRouteErrorResponse,
|
|
15
17
|
} from '@remix-run/react';
|
|
16
18
|
import { DEFAULT_NAV_HEIGHT, renderers as defaultRenderers } from '../components/index.js';
|
|
17
19
|
import { Analytics } from '../seo/index.js';
|
|
18
20
|
import { Error404 } from './Error404.js';
|
|
21
|
+
import { ErrorUnhandled } from './ErrorUnhandled.js';
|
|
19
22
|
import classNames from 'classnames';
|
|
20
23
|
|
|
21
24
|
export function Document({
|
|
@@ -37,7 +40,7 @@ export function Document({
|
|
|
37
40
|
staticBuild?: boolean;
|
|
38
41
|
baseurl?: string;
|
|
39
42
|
top?: number;
|
|
40
|
-
renderers?:
|
|
43
|
+
renderers?: NodeRenderers;
|
|
41
44
|
}) {
|
|
42
45
|
const links = staticBuild
|
|
43
46
|
? {
|
|
@@ -86,12 +89,13 @@ export function App() {
|
|
|
86
89
|
);
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
export function
|
|
92
|
+
export function AppErrorBoundary() {
|
|
93
|
+
const error = useRouteError();
|
|
90
94
|
return (
|
|
91
95
|
<Document theme={Theme.light}>
|
|
92
96
|
<article className="article">
|
|
93
97
|
<main className="article-grid subgrid-gap col-screen">
|
|
94
|
-
<Error404 />
|
|
98
|
+
{isRouteErrorResponse(error) ? <Error404 /> : <ErrorUnhandled error={error as any} />}
|
|
95
99
|
</main>
|
|
96
100
|
</article>
|
|
97
101
|
</Document>
|
package/src/pages/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ErrorProjectNotFound } from './ErrorProjectNotFound.js';
|
|
2
2
|
export { ErrorDocumentNotFound } from './ErrorDocumentNotFound.js';
|
|
3
3
|
export { Error404 } from './Error404.js';
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
4
|
+
export { ErrorUnhandled } from './ErrorUnhandled.js';
|
|
5
|
+
export { ArticlePage } from './Article.js';
|
|
6
|
+
export { App, Document, AppErrorBoundary } from './Root.js';
|
package/src/seo/meta.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { V2_MetaDescriptor } from '@remix-run/react';
|
|
2
2
|
|
|
3
3
|
export type SocialSite = {
|
|
4
4
|
title: string;
|
|
@@ -17,15 +17,15 @@ export type SocialArticle = {
|
|
|
17
17
|
keywords?: string[];
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
function allDefined(meta: Record<string, string | null | undefined>):
|
|
21
|
-
return Object.fromEntries(Object.entries(meta).filter(([, v]) => v)) as
|
|
20
|
+
function allDefined(meta: Record<string, string | null | undefined>): V2_MetaDescriptor {
|
|
21
|
+
return Object.fromEntries(Object.entries(meta).filter(([, v]) => v)) as V2_MetaDescriptor;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function getMetaTagsForSite_V1({
|
|
25
25
|
title,
|
|
26
26
|
description,
|
|
27
27
|
twitter,
|
|
28
|
-
}: SocialSite):
|
|
28
|
+
}: SocialSite): V2_MetaDescriptor {
|
|
29
29
|
const meta = {
|
|
30
30
|
title,
|
|
31
31
|
description,
|
|
@@ -60,7 +60,7 @@ export function getMetaTagsForArticle_V1({
|
|
|
60
60
|
image,
|
|
61
61
|
twitter,
|
|
62
62
|
keywords,
|
|
63
|
-
}: SocialArticle):
|
|
63
|
+
}: SocialArticle): V2_MetaDescriptor {
|
|
64
64
|
const meta = {
|
|
65
65
|
title,
|
|
66
66
|
description,
|