@myst-theme/site 0.13.1 → 0.13.3

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.1",
3
+ "version": "0.13.3",
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.1",
25
- "@myst-theme/diagrams": "^0.13.1",
26
- "@myst-theme/frontmatter": "^0.13.1",
27
- "@myst-theme/jupyter": "^0.13.1",
28
- "@myst-theme/providers": "^0.13.1",
29
- "@myst-theme/search": "^0.13.1",
24
+ "@myst-theme/common": "^0.13.3",
25
+ "@myst-theme/diagrams": "^0.13.3",
26
+ "@myst-theme/frontmatter": "^0.13.3",
27
+ "@myst-theme/jupyter": "^0.13.3",
28
+ "@myst-theme/providers": "^0.13.3",
29
+ "@myst-theme/search": "^0.13.3",
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.0",
39
- "myst-config": "^1.7.0",
40
- "myst-demo": "^0.13.1",
41
- "myst-spec-ext": "^1.7.0",
42
- "myst-to-react": "^0.13.1",
38
+ "myst-common": "^1.7.3",
39
+ "myst-config": "^1.7.3",
40
+ "myst-demo": "^0.13.3",
41
+ "myst-spec-ext": "^1.7.3",
42
+ "myst-to-react": "^0.13.3",
43
43
  "nbtx": "^0.2.3",
44
44
  "node-cache": "^5.1.2",
45
45
  "node-fetch": "^2.6.11",
@@ -365,7 +365,7 @@ export const DocumentOutline = ({
365
365
  selector?: string;
366
366
  children?: React.ReactNode;
367
367
  maxdepth?: number;
368
- isMargin: boolean;
368
+ isMargin?: boolean;
369
369
  }) => {
370
370
  const { activeId, headings } = useHeaders(selector, maxdepth);
371
371
  const [open, setOpen] = useState(false);
@@ -7,7 +7,7 @@ import {
7
7
  } from '@myst-theme/frontmatter';
8
8
  import { useGridSystemProvider } from '@myst-theme/providers';
9
9
  import classNames from 'classnames';
10
- import type { PageFrontmatter } from 'myst-frontmatter';
10
+ import type { PageFrontmatterWithDownloads } from '@myst-theme/common';
11
11
  import { ThemeButton } from './Navigation/index.js';
12
12
 
13
13
  export function ArticleHeader({
@@ -16,13 +16,13 @@ export function ArticleHeader({
16
16
  toggleTheme,
17
17
  className,
18
18
  }: {
19
- frontmatter: PageFrontmatter;
19
+ frontmatter: PageFrontmatterWithDownloads;
20
20
  children?: React.ReactNode;
21
21
  toggleTheme?: boolean;
22
22
  className?: string;
23
23
  }) {
24
24
  const grid = useGridSystemProvider();
25
- const { subject, venue, biblio, ...rest } = frontmatter ?? {};
25
+ const { subject, venue, volume, issue, ...rest } = frontmatter ?? {};
26
26
  const positionBackground = {
27
27
  'col-page-right': grid === 'article-left-grid',
28
28
  'col-page': grid === 'article-grid',
@@ -71,7 +71,12 @@ export function ArticleHeader({
71
71
  })}
72
72
  >
73
73
  {subject && <div className={classNames('flex-none pr-2 smallcaps')}>{subject}</div>}
74
- <Journal venue={venue} biblio={biblio} className="hidden pl-2 border-l md:block" />
74
+ <Journal
75
+ venue={venue}
76
+ volume={volume}
77
+ issue={issue}
78
+ className="hidden pl-2 border-l md:block"
79
+ />
75
80
  <div className="flex-grow"></div>
76
81
  <div className="hidden sm:block">
77
82
  <LicenseBadges license={frontmatter?.license} />
@@ -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 accessbility and is deprecated. Please move children to the page component.`,
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 (withBaseurl(heading.path, baseurl) === pathname) return [heading.id];
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 === withBaseurl(heading.path, baseurl);
119
+ const exact = pathnameMatchesHeading(pathname, heading, baseurl);
114
120
  if (!heading.children || heading.children.length === 0) {
115
121
  return (
116
122
  <LinkItem
@@ -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