@myst-theme/site 1.1.3 → 1.2.0

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.1.3",
3
+ "version": "1.2.0",
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.1.3",
29
- "@myst-theme/diagrams": "^1.1.3",
30
- "@myst-theme/frontmatter": "^1.1.3",
31
- "@myst-theme/providers": "^1.1.3",
32
- "@myst-theme/search": "^1.1.3",
28
+ "@myst-theme/common": "^1.2.0",
29
+ "@myst-theme/diagrams": "^1.2.0",
30
+ "@myst-theme/frontmatter": "^1.2.0",
31
+ "@myst-theme/providers": "^1.2.0",
32
+ "@myst-theme/search": "^1.2.0",
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.1.3",
40
+ "myst-demo": "^1.2.0",
41
41
  "myst-spec-ext": "^1.8.1",
42
- "myst-to-react": "^1.1.3",
42
+ "myst-to-react": "^1.2.0",
43
43
  "nbtx": "^0.2.3",
44
44
  "node-cache": "^5.1.2",
45
45
  "node-fetch": "^2.6.11",
@@ -12,6 +12,7 @@ export const FooterLink = ({
12
12
  }: NavigationLink & { right?: boolean }) => {
13
13
  const baseurl = useBaseurl();
14
14
  const Link = useLinkProvider();
15
+ const linkText = short_title || title;
15
16
  return (
16
17
  <Link
17
18
  prefetch="intent"
@@ -20,6 +21,7 @@ export const FooterLink = ({
20
21
  { 'myst-footer-link-prev': right, 'myst-footer-link-next': !right },
21
22
  )}
22
23
  to={withBaseurl(url, baseurl)}
24
+ aria-label={`${right ? 'Previous: ' : 'Next: '}${linkText}`}
23
25
  >
24
26
  <div className="flex h-full align-middle">
25
27
  {right && (
@@ -33,7 +35,7 @@ export const FooterLink = ({
33
35
  <div className="myst-footer-link-group text-xs text-gray-500 dark:text-gray-400">
34
36
  {group || ' '}
35
37
  </div>
36
- {short_title || title}
38
+ {linkText}
37
39
  </div>
38
40
  {!right && (
39
41
  <ArrowRightIcon
@@ -3,6 +3,7 @@ import { PrimarySidebar } from './PrimarySidebar.js';
3
3
  import type { Heading } from '@myst-theme/common';
4
4
  import { getProjectHeadings } from '@myst-theme/common';
5
5
  import type { SiteManifest } from 'myst-config';
6
+ import type { GenericParent } from 'myst-common';
6
7
 
7
8
  /**
8
9
  * PrimaryNavigation will load nav links and headers from the site manifest and display
@@ -15,6 +16,7 @@ export const PrimaryNavigation = ({
15
16
  hide_toc,
16
17
  mobileOnly,
17
18
  footer,
19
+ navbarEnd,
18
20
  }: {
19
21
  children?: React.ReactNode;
20
22
  projectSlug?: string;
@@ -22,6 +24,7 @@ export const PrimaryNavigation = ({
22
24
  hide_toc?: boolean;
23
25
  mobileOnly?: boolean;
24
26
  footer?: React.ReactNode;
27
+ navbarEnd?: GenericParent;
25
28
  }) => {
26
29
  const config = useSiteManifest();
27
30
  if (!config) return null;
@@ -41,6 +44,7 @@ export const PrimaryNavigation = ({
41
44
  nav={nav}
42
45
  headings={headings}
43
46
  footer={footer}
47
+ navbarEnd={navbarEnd}
44
48
  />
45
49
  );
46
50
  };
@@ -63,6 +67,7 @@ export const ConfigurablePrimaryNavigation = ({
63
67
  nav,
64
68
  headings,
65
69
  footer,
70
+ navbarEnd,
66
71
  }: {
67
72
  children?: React.ReactNode;
68
73
  sidebarRef?: React.RefObject<HTMLDivElement>;
@@ -71,6 +76,7 @@ export const ConfigurablePrimaryNavigation = ({
71
76
  nav?: SiteManifest['nav'];
72
77
  headings?: Heading[];
73
78
  footer?: React.ReactNode;
79
+ navbarEnd?: GenericParent;
74
80
  }) => {
75
81
  const [open, setOpen] = useNavOpen();
76
82
  const top = useThemeTop();
@@ -107,6 +113,7 @@ export const ConfigurablePrimaryNavigation = ({
107
113
  nav={nav}
108
114
  headings={headings}
109
115
  footer={footer}
116
+ navbarEnd={navbarEnd}
110
117
  hide_toc={hide_toc}
111
118
  mobileOnly={mobileOnly}
112
119
  />
@@ -1,6 +1,8 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { useNavigation } from '@remix-run/react';
4
+ import type { GenericParent } from 'myst-common';
5
+ import { MyST } from 'myst-to-react';
4
6
  import {
5
7
  useNavOpen,
6
8
  useSiteManifest,
@@ -149,6 +151,7 @@ export const PrimarySidebar = ({
149
151
  sidebarRef,
150
152
  nav,
151
153
  footer,
154
+ navbarEnd,
152
155
  headings,
153
156
  hide_toc,
154
157
  mobileOnly,
@@ -157,6 +160,7 @@ export const PrimarySidebar = ({
157
160
  nav?: SiteManifest['nav'];
158
161
  headings?: Heading[];
159
162
  footer?: React.ReactNode;
163
+ navbarEnd?: GenericParent;
160
164
  hide_toc?: boolean;
161
165
  mobileOnly?: boolean;
162
166
  }) => {
@@ -222,6 +226,16 @@ export const PrimarySidebar = ({
222
226
  <SidebarNav nav={nav} />
223
227
  </nav>
224
228
  )}
229
+ {navbarEnd && (
230
+ <div
231
+ className={classNames(
232
+ 'article myst-primary-sidebar-navbar-end xl:hidden p-2 my-1 flex flex-wrap gap-2 [&_p]:contents',
233
+ sidebarSectionInsetClass,
234
+ )}
235
+ >
236
+ <MyST ast={navbarEnd} />
237
+ </div>
238
+ )}
225
239
  {nav && headings && <div className="my-3 border-b-2 lg:hidden" />}
226
240
  {headings && (
227
241
  <nav
@@ -3,6 +3,8 @@ import classNames from 'classnames';
3
3
  import { Menu, Transition } from '@headlessui/react';
4
4
  import { ChevronDownIcon, Bars3Icon as MenuIcon } from '@heroicons/react/24/solid';
5
5
  import type { SiteManifest, SiteNavItem } from 'myst-config';
6
+ import type { GenericParent } from 'myst-common';
7
+ import { MyST } from 'myst-to-react';
6
8
  import { ThemeButton } from './ThemeButton.js';
7
9
  import { Search } from './Search.js';
8
10
  import {
@@ -113,7 +115,15 @@ export function NavItems({ nav }: { nav?: SiteManifest['nav'] }) {
113
115
  );
114
116
  }
115
117
 
116
- export function TopNav({ hideToc, hideSearch }: { hideToc?: boolean; hideSearch?: boolean }) {
118
+ export function TopNav({
119
+ hideToc,
120
+ hideSearch,
121
+ navbarEnd,
122
+ }: {
123
+ hideToc?: boolean;
124
+ hideSearch?: boolean;
125
+ navbarEnd?: GenericParent;
126
+ }) {
117
127
  const [open, setOpen] = useNavOpen();
118
128
  const config = useSiteManifest();
119
129
  const { title, nav, actions } = config ?? {};
@@ -152,8 +162,17 @@ export function TopNav({ hideToc, hideSearch }: { hideToc?: boolean; hideSearch?
152
162
  <div className="flex items-center flex-grow w-auto">
153
163
  <NavItems nav={nav} />
154
164
  <div className="flex-grow block"></div>
165
+ {/* Search bar */}
155
166
  {!hideSearch && <Search />}
156
- <ThemeButton />
167
+ {/* Light/Dark theme button */}
168
+ <ThemeButton className="w-10 h-10 ml-3" />
169
+ {/* Custom part at end of navbar. It is `hidden` up until xl size since it will be in the sidebar drawer up to that point */}
170
+ {navbarEnd && (
171
+ <div className="article myst-navbar-end hidden xl:flex items-center ml-3 [&>*]:m-0">
172
+ <MyST ast={navbarEnd} />
173
+ </div>
174
+ )}
175
+ {/* Mobile pop-up for page actions */}
157
176
  <div className="block sm:hidden">
158
177
  <ActionMenu actions={actions} />
159
178
  </div>