@myst-theme/site 1.3.0 → 1.3.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": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -25,11 +25,11 @@
25
25
  "dependencies": {
26
26
  "@headlessui/react": "^1.7.15",
27
27
  "@heroicons/react": "^2.0.18",
28
- "@myst-theme/common": "^1.3.0",
29
- "@myst-theme/diagrams": "^1.3.0",
30
- "@myst-theme/frontmatter": "^1.3.0",
31
- "@myst-theme/providers": "^1.3.0",
32
- "@myst-theme/search": "^1.3.0",
28
+ "@myst-theme/common": "^1.3.1",
29
+ "@myst-theme/diagrams": "^1.3.1",
30
+ "@myst-theme/frontmatter": "^1.3.1",
31
+ "@myst-theme/providers": "^1.3.1",
32
+ "@myst-theme/search": "^1.3.1",
33
33
  "@radix-ui/react-collapsible": "^1.0.3",
34
34
  "@radix-ui/react-dialog": "^1.0.3",
35
35
  "@radix-ui/react-visually-hidden": "^1.1.0",
@@ -37,9 +37,9 @@
37
37
  "lodash.throttle": "^4.1.1",
38
38
  "myst-common": "^1.8.1",
39
39
  "myst-config": "^1.7.9",
40
- "myst-demo": "^1.3.0",
40
+ "myst-demo": "^1.3.1",
41
41
  "myst-spec-ext": "^1.8.1",
42
- "myst-to-react": "^1.3.0",
42
+ "myst-to-react": "^1.3.1",
43
43
  "nbtx": "^0.2.3",
44
44
  "node-cache": "^5.1.2",
45
45
  "node-fetch": "^2.6.11",
@@ -29,7 +29,7 @@ export function HomeLink({
29
29
  {logo && (
30
30
  <div
31
31
  className={classNames('myst-home-link-logo mr-3 flex items-center', {
32
- 'dark:bg-white dark:rounded px-1': !logoDark,
32
+ 'dark:rounded px-1': !logoDark,
33
33
  })}
34
34
  >
35
35
  <img
@@ -44,13 +44,19 @@ function nestToc(toc: Heading[]): NestedHeading[] {
44
44
  }
45
45
 
46
46
  function pathnameMatchesHeading(pathname: string, heading: Heading, baseurl?: string) {
47
- const headingPath = withBaseurl(heading.path, baseurl);
48
- // In static html builds, pathname ends up with an unwanted trailing slash
49
- // and then won't match the heading's slashless path. So first normalize the
50
- // given path by removing any trailing slash.
51
- const normedPath = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
52
- if (normedPath && headingPath === `${normedPath}/index`) return true;
53
- return headingPath === normedPath;
47
+ // Normalize `pathname` to be comparable to the unprefixed `heading.path`.
48
+ //
49
+ // During SSR in `myst build --html` static builds, `useLocation().pathname`
50
+ // does not include the site's `baseurl`; on the client it does (Remix does
51
+ // not strip the basename here).
52
+ //
53
+ // Also strip any trailing slash, since static builds end up with one and
54
+ // `heading.path` is slashless.
55
+ let normed = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
56
+ if (baseurl && normed.startsWith(baseurl)) normed = normed.slice(baseurl.length);
57
+ const headingPath = heading.path;
58
+ if (normed && headingPath === `${normed}/index`) return true;
59
+ return headingPath === normed;
54
60
  }
55
61
 
56
62
  function childrenOpen(headings: NestedHeading[], pathname: string, baseurl?: string): string[] {
@@ -142,7 +142,7 @@ export function DocumentWithoutProviders({
142
142
  />
143
143
  {head}
144
144
  </head>
145
- <body className="m-0 transition-colors duration-500 bg-white dark:bg-stone-900">
145
+ <body className="m-0 bg-white dark:bg-stone-900">
146
146
  <BaseUrlProvider baseurl={baseurl}>
147
147
  <SiteProvider config={config}>{children}</SiteProvider>
148
148
  </BaseUrlProvider>