@myst-theme/site 0.13.2 → 0.13.4
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.13.
|
|
3
|
+
"version": "0.13.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@headlessui/react": "^1.7.15",
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
|
-
"@myst-theme/common": "^0.13.
|
|
25
|
-
"@myst-theme/diagrams": "^0.13.
|
|
26
|
-
"@myst-theme/frontmatter": "^0.13.
|
|
27
|
-
"@myst-theme/jupyter": "^0.13.
|
|
28
|
-
"@myst-theme/providers": "^0.13.
|
|
29
|
-
"@myst-theme/search": "^0.13.
|
|
24
|
+
"@myst-theme/common": "^0.13.4",
|
|
25
|
+
"@myst-theme/diagrams": "^0.13.4",
|
|
26
|
+
"@myst-theme/frontmatter": "^0.13.4",
|
|
27
|
+
"@myst-theme/jupyter": "^0.13.4",
|
|
28
|
+
"@myst-theme/providers": "^0.13.4",
|
|
29
|
+
"@myst-theme/search": "^0.13.4",
|
|
30
30
|
"@radix-ui/react-collapsible": "^1.0.3",
|
|
31
31
|
"@radix-ui/react-dialog": "^1.0.3",
|
|
32
32
|
"@radix-ui/react-radio-group": "^1.2.0",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@radix-ui/react-visually-hidden": "^1.1.0",
|
|
36
36
|
"classnames": "^2.3.2",
|
|
37
37
|
"lodash.throttle": "^4.1.1",
|
|
38
|
-
"myst-common": "^1.7.
|
|
39
|
-
"myst-config": "^1.7.
|
|
40
|
-
"myst-demo": "^0.13.
|
|
41
|
-
"myst-spec-ext": "^1.7.
|
|
42
|
-
"myst-to-react": "^0.13.
|
|
38
|
+
"myst-common": "^1.7.3",
|
|
39
|
+
"myst-config": "^1.7.3",
|
|
40
|
+
"myst-demo": "^0.13.4",
|
|
41
|
+
"myst-spec-ext": "^1.7.3",
|
|
42
|
+
"myst-to-react": "^0.13.4",
|
|
43
43
|
"nbtx": "^0.2.3",
|
|
44
44
|
"node-cache": "^5.1.2",
|
|
45
45
|
"node-fetch": "^2.6.11",
|
|
@@ -12,6 +12,7 @@ import type { RefObject } from 'react';
|
|
|
12
12
|
import { DocumentChartBarIcon } from '@heroicons/react/24/outline';
|
|
13
13
|
import { ChevronRightIcon } from '@heroicons/react/24/solid';
|
|
14
14
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
15
|
+
import { slugToUrl } from 'myst-common';
|
|
15
16
|
|
|
16
17
|
const SELECTOR = [1, 2, 3, 4].map((n) => `main h${n}`).join(', ');
|
|
17
18
|
|
|
@@ -365,7 +366,7 @@ export const DocumentOutline = ({
|
|
|
365
366
|
selector?: string;
|
|
366
367
|
children?: React.ReactNode;
|
|
367
368
|
maxdepth?: number;
|
|
368
|
-
isMargin
|
|
369
|
+
isMargin?: boolean;
|
|
369
370
|
}) => {
|
|
370
371
|
const { activeId, headings } = useHeaders(selector, maxdepth);
|
|
371
372
|
const [open, setOpen] = useState(false);
|
|
@@ -443,7 +444,7 @@ export function SupportingDocuments() {
|
|
|
443
444
|
return (
|
|
444
445
|
<li key={p.slug}>
|
|
445
446
|
<NavLink
|
|
446
|
-
to={withBaseurl(`/${p.slug}#main`, baseurl)}
|
|
447
|
+
to={withBaseurl(`/${slugToUrl(p.slug)}#main`, baseurl)}
|
|
447
448
|
prefetch="intent"
|
|
448
449
|
className={({ isActive }) =>
|
|
449
450
|
classNames('no-underline flex self-center hover:text-blue-700', {
|
|
@@ -77,7 +77,7 @@ export const ConfigurablePrimaryNavigation = ({
|
|
|
77
77
|
|
|
78
78
|
if (children)
|
|
79
79
|
console.warn(
|
|
80
|
-
`Including children in Navigation can break keyboard
|
|
80
|
+
`Including children in Navigation can break keyboard accessibility and is deprecated. Please move children to the page component.`,
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
// the logic on the following line looks wrong, this will return `null` or `<></>`
|
|
@@ -35,10 +35,16 @@ function nestToc(toc: Heading[]): NestedHeading[] {
|
|
|
35
35
|
return items;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function pathnameMatchesHeading(pathname: string, heading: Heading, baseurl?: string) {
|
|
39
|
+
const headingPath = withBaseurl(heading.path, baseurl);
|
|
40
|
+
if (pathname && headingPath === `${pathname}/index`) return true;
|
|
41
|
+
return headingPath === pathname;
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
function childrenOpen(headings: NestedHeading[], pathname: string, baseurl?: string): string[] {
|
|
39
45
|
return headings
|
|
40
46
|
.map((heading) => {
|
|
41
|
-
if (
|
|
47
|
+
if (pathnameMatchesHeading(pathname, heading, baseurl)) return [heading.id];
|
|
42
48
|
const open = childrenOpen(heading.children, pathname, baseurl);
|
|
43
49
|
if (open.length === 0) return [];
|
|
44
50
|
return [heading.id, ...open];
|
|
@@ -110,7 +116,7 @@ const NestedToc = ({ heading }: { heading: NestedHeading }) => {
|
|
|
110
116
|
useEffect(() => {
|
|
111
117
|
if (nav.state === 'idle') setOpen(startOpen);
|
|
112
118
|
}, [nav.state]);
|
|
113
|
-
const exact = pathname
|
|
119
|
+
const exact = pathnameMatchesHeading(pathname, heading, baseurl);
|
|
114
120
|
if (!heading.children || heading.children.length === 0) {
|
|
115
121
|
return (
|
|
116
122
|
<LinkItem
|
package/src/seo/sitemap.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { slugToUrl } from 'myst-common';
|
|
1
2
|
import type { SiteManifest } from 'myst-config';
|
|
2
3
|
|
|
3
4
|
type ManifestProjectItem = Required<SiteManifest>['projects'][0]['pages'][0];
|
|
@@ -148,7 +149,7 @@ export function getSiteSlugs(
|
|
|
148
149
|
const projectSlug = project.slug ? `/${project.slug}` : '';
|
|
149
150
|
const pages = project.pages
|
|
150
151
|
.filter((page): page is ManifestProjectItem => 'slug' in page)
|
|
151
|
-
.map((page) => `${baseurl}${projectSlug}/${page.slug}`);
|
|
152
|
+
.map((page) => `${baseurl}${projectSlug}/${slugToUrl(page.slug)}`);
|
|
152
153
|
if (opts?.excludeIndex) return [...pages];
|
|
153
154
|
return [
|
|
154
155
|
opts?.explicitIndex
|