@myst-theme/site 0.17.0 → 0.17.1

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.17.0",
3
+ "version": "0.17.1",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -21,11 +21,11 @@
21
21
  "dependencies": {
22
22
  "@headlessui/react": "^1.7.15",
23
23
  "@heroicons/react": "^2.0.18",
24
- "@myst-theme/common": "^0.17.0",
25
- "@myst-theme/diagrams": "^0.17.0",
26
- "@myst-theme/frontmatter": "^0.17.0",
27
- "@myst-theme/providers": "^0.17.0",
28
- "@myst-theme/search": "^0.17.0",
24
+ "@myst-theme/common": "^0.17.1",
25
+ "@myst-theme/diagrams": "^0.17.1",
26
+ "@myst-theme/frontmatter": "^0.17.1",
27
+ "@myst-theme/providers": "^0.17.1",
28
+ "@myst-theme/search": "^0.17.1",
29
29
  "@radix-ui/react-collapsible": "^1.0.3",
30
30
  "@radix-ui/react-dialog": "^1.0.3",
31
31
  "@radix-ui/react-visually-hidden": "^1.1.0",
@@ -33,9 +33,9 @@
33
33
  "lodash.throttle": "^4.1.1",
34
34
  "myst-common": "^1.8.1",
35
35
  "myst-config": "^1.7.9",
36
- "myst-demo": "^0.17.0",
36
+ "myst-demo": "^0.17.1",
37
37
  "myst-spec-ext": "^1.8.1",
38
- "myst-to-react": "^0.17.0",
38
+ "myst-to-react": "^0.17.1",
39
39
  "nbtx": "^0.2.3",
40
40
  "node-cache": "^5.1.2",
41
41
  "node-fetch": "^2.6.11",
@@ -410,7 +410,10 @@ export const DocumentOutline = ({
410
410
  <div className="flex flex-row gap-2 mb-4 text-sm leading-6 uppercase rounded-lg text-slate-900 dark:text-slate-100">
411
411
  {title}
412
412
  <Collapsible.Trigger asChild>
413
- <button className="self-center flex-none rounded-md group hover:bg-slate-300/30 focus:outline outline-blue-200 outline-2">
413
+ <button
414
+ className="self-center flex-none rounded-md group hover:bg-slate-300/30 focus:outline outline-blue-200 outline-2"
415
+ aria-label="Open Contents"
416
+ >
414
417
  <ChevronRightIcon
415
418
  className="transition-transform duration-300 group-data-[state=open]:rotate-90 text-text-slate-700 dark:text-slate-100"
416
419
  height="1.5rem"
@@ -43,8 +43,12 @@ function nestToc(toc: Heading[]): NestedHeading[] {
43
43
 
44
44
  function pathnameMatchesHeading(pathname: string, heading: Heading, baseurl?: string) {
45
45
  const headingPath = withBaseurl(heading.path, baseurl);
46
- if (pathname && headingPath === `${pathname}/index`) return true;
47
- return headingPath === pathname;
46
+ // In static html builds, pathname ends up with an unwanted trailing slash
47
+ // and then won't match the heading's slashless path. So first normalize the
48
+ // given path by removing any trailing slash.
49
+ const normedPath = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
50
+ if (normedPath && headingPath === `${normedPath}/index`) return true;
51
+ return headingPath === normedPath;
48
52
  }
49
53
 
50
54
  function childrenOpen(headings: NestedHeading[], pathname: string, baseurl?: string): string[] {
@@ -5,7 +5,13 @@ import { ChevronDownIcon, Bars3Icon as MenuIcon } from '@heroicons/react/24/soli
5
5
  import type { SiteManifest, SiteNavItem } from 'myst-config';
6
6
  import { ThemeButton } from './ThemeButton.js';
7
7
  import { Search } from './Search.js';
8
- import { useNavLinkProvider, useNavOpen, useSiteManifest } from '@myst-theme/providers';
8
+ import {
9
+ useBaseurl,
10
+ useNavLinkProvider,
11
+ useNavOpen,
12
+ useSiteManifest,
13
+ withBaseurl,
14
+ } from '@myst-theme/providers';
9
15
  import { LoadingBar } from './Loading.js';
10
16
  import { HomeLink } from './HomeLink.js';
11
17
  import { ActionMenu } from './ActionMenu.js';
@@ -15,12 +21,13 @@ export const DEFAULT_NAV_HEIGHT = 60;
15
21
 
16
22
  export function NavItem({ item }: { item: SiteNavItem }) {
17
23
  const NavLink = useNavLinkProvider();
24
+ const baseurl = useBaseurl();
18
25
  if (!('children' in item)) {
19
26
  return (
20
27
  <div className="relative inline-block mx-2 grow-0">
21
28
  <ExternalOrInternalLink
22
29
  nav
23
- to={item.url ?? ''}
30
+ to={withBaseurl(item.url, baseurl) ?? ''}
24
31
  className={({ isActive }) =>
25
32
  classNames(
26
33
  'inline-flex items-center justify-center w-full mx-2 py-1 text-md font-medium dark:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75',
@@ -168,11 +168,11 @@ export function AppErrorBoundary() {
168
168
  const error = useRouteError();
169
169
  return (
170
170
  <Document theme={Theme.light}>
171
- <article className="article">
172
- <main className="article-grid subgrid-gap col-screen">
171
+ <main className="article-grid subgrid-gap col-screen">
172
+ <article className="article">
173
173
  {isRouteErrorResponse(error) ? <Error404 /> : <ErrorUnhandled error={error as any} />}
174
- </main>
175
- </article>
174
+ </article>
175
+ </main>
176
176
  </Document>
177
177
  );
178
178
  }