@myst-theme/site 0.5.11 → 0.5.13
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.5.
|
|
3
|
+
"version": "0.5.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@headlessui/react": "^1.7.15",
|
|
19
19
|
"@heroicons/react": "^2.0.18",
|
|
20
|
-
"@myst-theme/common": "^0.5.
|
|
21
|
-
"@myst-theme/diagrams": "^0.5.
|
|
22
|
-
"@myst-theme/frontmatter": "^0.5.
|
|
23
|
-
"@myst-theme/jupyter": "^0.5.
|
|
24
|
-
"@myst-theme/providers": "^0.5.
|
|
20
|
+
"@myst-theme/common": "^0.5.13",
|
|
21
|
+
"@myst-theme/diagrams": "^0.5.13",
|
|
22
|
+
"@myst-theme/frontmatter": "^0.5.13",
|
|
23
|
+
"@myst-theme/jupyter": "^0.5.13",
|
|
24
|
+
"@myst-theme/providers": "^0.5.13",
|
|
25
25
|
"@radix-ui/react-collapsible": "^1.0.3",
|
|
26
26
|
"classnames": "^2.3.2",
|
|
27
27
|
"lodash.throttle": "^4.1.1",
|
|
28
|
-
"myst-common": "^1.1.
|
|
29
|
-
"myst-config": "^1.1.
|
|
30
|
-
"myst-demo": "^0.5.
|
|
31
|
-
"myst-spec-ext": "^1.1.
|
|
32
|
-
"myst-to-react": "^0.5.
|
|
28
|
+
"myst-common": "^1.1.13",
|
|
29
|
+
"myst-config": "^1.1.13",
|
|
30
|
+
"myst-demo": "^0.5.13",
|
|
31
|
+
"myst-spec-ext": "^1.1.13",
|
|
32
|
+
"myst-to-react": "^0.5.13",
|
|
33
33
|
"nbtx": "^0.2.3",
|
|
34
34
|
"node-cache": "^5.1.2",
|
|
35
35
|
"node-fetch": "^2.6.11",
|
|
@@ -35,11 +35,11 @@ function nestToc(toc: Heading[]): NestedHeading[] {
|
|
|
35
35
|
return items;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function childrenOpen(headings: NestedHeading[], pathname: string): string[] {
|
|
38
|
+
function childrenOpen(headings: NestedHeading[], pathname: string, baseurl?: string): string[] {
|
|
39
39
|
return headings
|
|
40
40
|
.map((heading) => {
|
|
41
|
-
if (heading.path === pathname) return [heading.id];
|
|
42
|
-
const open = childrenOpen(heading.children, pathname);
|
|
41
|
+
if (withBaseurl(heading.path, baseurl) === pathname) return [heading.id];
|
|
42
|
+
const open = childrenOpen(heading.children, pathname, baseurl);
|
|
43
43
|
if (open.length === 0) return [];
|
|
44
44
|
return [heading.id, ...open];
|
|
45
45
|
})
|
|
@@ -103,14 +103,14 @@ function LinkItem({
|
|
|
103
103
|
|
|
104
104
|
const NestedToc = ({ heading }: { heading: NestedHeading }) => {
|
|
105
105
|
const { pathname } = useLocation();
|
|
106
|
-
const
|
|
106
|
+
const baseurl = useBaseurl();
|
|
107
|
+
const startOpen = childrenOpen([heading], pathname, baseurl).includes(heading.id);
|
|
107
108
|
const nav = useNavigation();
|
|
108
|
-
nav.state;
|
|
109
109
|
const [open, setOpen] = React.useState(startOpen);
|
|
110
110
|
useEffect(() => {
|
|
111
111
|
if (nav.state === 'idle') setOpen(startOpen);
|
|
112
112
|
}, [nav.state]);
|
|
113
|
-
const exact = pathname === heading.path;
|
|
113
|
+
const exact = pathname === withBaseurl(heading.path, baseurl);
|
|
114
114
|
if (!heading.children || heading.children.length === 0) {
|
|
115
115
|
return (
|
|
116
116
|
<LinkItem
|
package/src/pages/Root.tsx
CHANGED
|
@@ -18,7 +18,6 @@ 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';
|
|
22
21
|
|
|
23
22
|
export function Document({
|
|
24
23
|
children,
|
|
@@ -59,8 +58,8 @@ export function Document({
|
|
|
59
58
|
<Meta />
|
|
60
59
|
<Links />
|
|
61
60
|
<Analytics
|
|
62
|
-
analytics_google={config?.analytics_google}
|
|
63
|
-
analytics_plausible={config?.analytics_plausible}
|
|
61
|
+
analytics_google={config?.options?.analytics_google}
|
|
62
|
+
analytics_plausible={config?.options?.analytics_plausible}
|
|
64
63
|
/>
|
|
65
64
|
</head>
|
|
66
65
|
<body className="m-0 transition-colors duration-500 bg-white dark:bg-stone-900">
|