@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/site",
3
- "version": "0.10.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.10.0",
25
- "@myst-theme/diagrams": "^0.10.0",
26
- "@myst-theme/frontmatter": "^0.10.0",
27
- "@myst-theme/jupyter": "^0.10.0",
28
- "@myst-theme/providers": "^0.10.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.5.0",
33
- "myst-config": "^1.5.0",
34
- "myst-demo": "^0.10.0",
35
- "myst-spec-ext": "^1.5.0",
36
- "myst-to-react": "^0.10.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 { NodeRenderer } from '@myst-theme/providers';
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: Record<string, NodeRenderer> = {
7
+ export const renderers: NodeRenderers = {
8
8
  ...DEFAULT_RENDERERS,
9
9
  myst: MystDemoRenderer,
10
10
  mermaid: MermaidNodeRenderer,
@@ -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
+ }
@@ -1,6 +1,6 @@
1
1
  import type { SiteManifest } from 'myst-config';
2
2
  import type { SiteLoader } from '@myst-theme/common';
3
- import type { NodeRenderer } from '@myst-theme/providers';
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?: Record<string, NodeRenderer>;
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 AppCatchBoundary() {
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>
@@ -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 { ArticlePage, ArticlePageCatchBoundary, ProjectPageCatchBoundary } from './Article.js';
5
- export { App, Document, AppCatchBoundary } from './Root.js';
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 { HtmlMetaDescriptor, V2_MetaDescriptor } from '@remix-run/react';
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>): HtmlMetaDescriptor {
21
- return Object.fromEntries(Object.entries(meta).filter(([, v]) => v)) as HtmlMetaDescriptor;
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): HtmlMetaDescriptor {
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): HtmlMetaDescriptor {
63
+ }: SocialArticle): V2_MetaDescriptor {
64
64
  const meta = {
65
65
  title,
66
66
  description,