@myst-theme/site 0.1.23 → 0.1.24
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.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"main": "./src/index.ts",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@headlessui/react": "^1.7.8",
|
|
18
18
|
"@heroicons/react": "^2.0.14",
|
|
19
|
-
"@myst-theme/diagrams": "^0.1.
|
|
20
|
-
"@myst-theme/frontmatter": "^0.1.
|
|
21
|
-
"@myst-theme/jupyter": "^0.1.
|
|
22
|
-
"@myst-theme/providers": "^0.1.
|
|
19
|
+
"@myst-theme/diagrams": "^0.1.24",
|
|
20
|
+
"@myst-theme/frontmatter": "^0.1.24",
|
|
21
|
+
"@myst-theme/jupyter": "^0.1.24",
|
|
22
|
+
"@myst-theme/providers": "^0.1.24",
|
|
23
23
|
"classnames": "^2.3.2",
|
|
24
24
|
"lodash.throttle": "^4.1.1",
|
|
25
25
|
"myst-common": "^0.0.12",
|
|
26
26
|
"myst-config": "^0.0.9",
|
|
27
|
-
"myst-demo": "^0.1.
|
|
28
|
-
"myst-to-react": "^0.1.
|
|
27
|
+
"myst-demo": "^0.1.24",
|
|
28
|
+
"myst-to-react": "^0.1.24",
|
|
29
29
|
"mystjs": "^0.0.15",
|
|
30
30
|
"nbtx": "^0.2.3",
|
|
31
31
|
"node-cache": "^5.1.2",
|
|
@@ -11,7 +11,7 @@ export function Bibliography() {
|
|
|
11
11
|
if (!filtered || !data || filtered.length === 0) return null;
|
|
12
12
|
const refs = hidden ? filtered.slice(0, HIDE_OVER_N_REFERENCES) : filtered;
|
|
13
13
|
return (
|
|
14
|
-
<section>
|
|
14
|
+
<section className="article-grid article-subgrid-gap col-screen">
|
|
15
15
|
{filtered.length > HIDE_OVER_N_REFERENCES && (
|
|
16
16
|
<button
|
|
17
17
|
onClick={() => setHidden(!hidden)}
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
import { useParse, DEFAULT_RENDERERS } from 'myst-to-react';
|
|
2
2
|
import type { Parent } from 'myst-spec';
|
|
3
3
|
import { useNodeRenderers } from '@myst-theme/providers';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
|
|
5
|
-
function Block({ id, node }: { id: string; node: Parent }) {
|
|
6
|
+
function Block({ id, node, className }: { id: string; node: Parent; className?: string }) {
|
|
6
7
|
const renderers = useNodeRenderers() ?? DEFAULT_RENDERERS;
|
|
7
8
|
const children = useParse(node, renderers);
|
|
8
|
-
|
|
9
|
+
const subGrid = 'article-grid article-subgrid-gap col-screen';
|
|
10
|
+
const dataClassName = typeof node.data?.class === 'string' ? node.data?.class : undefined;
|
|
11
|
+
// Hide the subgrid if either the dataClass or the className exists and includes `col-`
|
|
12
|
+
const noSubGrid =
|
|
13
|
+
(dataClassName && dataClassName.includes('col-')) || (className && className.includes('col-'));
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
id={id}
|
|
17
|
+
className={classNames(className, dataClassName, {
|
|
18
|
+
[subGrid]: !noSubGrid,
|
|
19
|
+
})}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
9
24
|
}
|
|
10
25
|
|
|
11
|
-
export function ContentBlocks({ mdast }: { mdast: Parent }) {
|
|
26
|
+
export function ContentBlocks({ mdast, className }: { mdast: Parent; className?: string }) {
|
|
12
27
|
const blocks = mdast.children as Parent[];
|
|
13
28
|
return (
|
|
14
29
|
<>
|
|
15
30
|
{blocks.map((node, index) => {
|
|
16
|
-
return <Block key={(node as any).key} id={`${index}`} node={node} />;
|
|
31
|
+
return <Block key={(node as any).key} id={`${index}`} node={node} className={className} />;
|
|
17
32
|
})}
|
|
18
33
|
</>
|
|
19
34
|
);
|
|
@@ -151,10 +151,13 @@ const useIntersectionObserver = (highlight: () => void, onScreen: Set<HTMLHeadin
|
|
|
151
151
|
return { observer };
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
+
const DOC_OUTLINE_CLASS =
|
|
155
|
+
'fixed z-10 bottom-0 right-[max(0px,calc(50%-45rem))] w-[14rem] lg:w-[18rem] py-10 px-4 lg:px-8 overflow-y-auto hidden md:block';
|
|
156
|
+
|
|
154
157
|
export const DocumentOutline = ({
|
|
155
158
|
top,
|
|
156
159
|
height,
|
|
157
|
-
className =
|
|
160
|
+
className = DOC_OUTLINE_CLASS,
|
|
158
161
|
}: {
|
|
159
162
|
top?: number;
|
|
160
163
|
height?: number;
|
|
@@ -101,6 +101,9 @@ const Headings = ({ folder, headings, sections }: Props) => {
|
|
|
101
101
|
);
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
+
const TOC_CLASS =
|
|
105
|
+
'flex-col fixed z-30 bottom-0 left-[max(0px,calc(50%-45rem))] w-[19.5rem] border-r border-stone-200 dark:border-stone-700';
|
|
106
|
+
|
|
104
107
|
export const TableOfContents = ({
|
|
105
108
|
projectSlug,
|
|
106
109
|
top,
|
|
@@ -123,7 +126,7 @@ export const TableOfContents = ({
|
|
|
123
126
|
if (!headings) return null;
|
|
124
127
|
return (
|
|
125
128
|
<div
|
|
126
|
-
className={classNames('
|
|
129
|
+
className={classNames(TOC_CLASS, 'overflow-hidden', {
|
|
127
130
|
flex: open,
|
|
128
131
|
'bg-white dark:bg-stone-900': open, // just apply when open, so that theme can transition
|
|
129
132
|
'hidden xl:flex': !open,
|
package/src/pages/Root.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { ContentReload, renderers } from '../components';
|
|
16
16
|
import { Analytics } from '../seo';
|
|
17
17
|
import { ErrorSiteNotFound } from './ErrorSiteNotFound';
|
|
18
|
+
import classNames from 'classnames';
|
|
18
19
|
|
|
19
20
|
export function Document({
|
|
20
21
|
children,
|
|
@@ -22,15 +23,17 @@ export function Document({
|
|
|
22
23
|
config,
|
|
23
24
|
title,
|
|
24
25
|
CONTENT_CDN_PORT,
|
|
26
|
+
scrollTopClass = 'scroll-p-20',
|
|
25
27
|
}: {
|
|
26
28
|
children: React.ReactNode;
|
|
27
29
|
theme: Theme;
|
|
28
30
|
config?: SiteManifest;
|
|
29
31
|
title?: string;
|
|
30
32
|
CONTENT_CDN_PORT?: number | string;
|
|
33
|
+
scrollTopClass?: string;
|
|
31
34
|
}) {
|
|
32
35
|
return (
|
|
33
|
-
<html lang="en" className={theme}>
|
|
36
|
+
<html lang="en" className={classNames(theme, scrollTopClass)}>
|
|
34
37
|
<head>
|
|
35
38
|
<meta charSet="utf-8" />
|
|
36
39
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
@@ -69,7 +72,7 @@ export function AppCatchBoundary() {
|
|
|
69
72
|
return (
|
|
70
73
|
<Document theme={Theme.light} title={caught.statusText}>
|
|
71
74
|
<article className="content">
|
|
72
|
-
<main className="
|
|
75
|
+
<main className="article-grid article-subgrid-gap col-screen">
|
|
73
76
|
<ErrorSiteNotFound />
|
|
74
77
|
</main>
|
|
75
78
|
</article>
|
|
@@ -81,7 +84,7 @@ export function AppDebugErrorBoundary({ error }: { error: { message: string; sta
|
|
|
81
84
|
return (
|
|
82
85
|
<Document theme={Theme.light} title="Error">
|
|
83
86
|
<div className="mt-16">
|
|
84
|
-
<main className="
|
|
87
|
+
<main className="article-grid article-subgrid-gap col-screen">
|
|
85
88
|
<h1>An Error Occurred</h1>
|
|
86
89
|
<code>{error.message}</code>
|
|
87
90
|
<pre>{error.stack}</pre>
|