@myst-theme/site 0.16.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.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -21,21 +21,21 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@headlessui/react": "^1.7.15",
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
|
-
"@myst-theme/common": "^0.
|
|
25
|
-
"@myst-theme/diagrams": "^0.
|
|
26
|
-
"@myst-theme/frontmatter": "^0.
|
|
27
|
-
"@myst-theme/providers": "^0.
|
|
28
|
-
"@myst-theme/search": "^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",
|
|
32
32
|
"classnames": "^2.3.2",
|
|
33
33
|
"lodash.throttle": "^4.1.1",
|
|
34
|
-
"myst-common": "^1.
|
|
34
|
+
"myst-common": "^1.8.1",
|
|
35
35
|
"myst-config": "^1.7.9",
|
|
36
|
-
"myst-demo": "^0.
|
|
37
|
-
"myst-spec-ext": "^1.
|
|
38
|
-
"myst-to-react": "^0.
|
|
36
|
+
"myst-demo": "^0.17.1",
|
|
37
|
+
"myst-spec-ext": "^1.8.1",
|
|
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
|
|
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"
|
|
@@ -6,11 +6,13 @@ export function HomeLink({
|
|
|
6
6
|
logoDark,
|
|
7
7
|
logoText,
|
|
8
8
|
name,
|
|
9
|
+
url,
|
|
9
10
|
}: {
|
|
10
11
|
logo?: string;
|
|
11
12
|
logoDark?: string;
|
|
12
13
|
logoText?: string;
|
|
13
14
|
name?: string;
|
|
15
|
+
url?: string;
|
|
14
16
|
}) {
|
|
15
17
|
const Link = useLinkProvider();
|
|
16
18
|
const baseurl = useBaseurl();
|
|
@@ -18,7 +20,7 @@ export function HomeLink({
|
|
|
18
20
|
return (
|
|
19
21
|
<Link
|
|
20
22
|
className="flex items-center ml-3 dark:text-white w-fit md:ml-5 xl:ml-7"
|
|
21
|
-
to={withBaseurl('/', baseurl)}
|
|
23
|
+
to={url ? url : withBaseurl('/', baseurl)}
|
|
22
24
|
prefetch="intent"
|
|
23
25
|
>
|
|
24
26
|
{logo && (
|
|
@@ -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
|
-
|
|
47
|
-
|
|
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 {
|
|
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',
|
|
@@ -107,7 +114,7 @@ export function TopNav({ hideToc, hideSearch }: { hideToc?: boolean; hideSearch?
|
|
|
107
114
|
const [open, setOpen] = useNavOpen();
|
|
108
115
|
const config = useSiteManifest();
|
|
109
116
|
const { title, nav, actions } = config ?? {};
|
|
110
|
-
const { logo, logo_dark, logo_text } = config?.options ?? {};
|
|
117
|
+
const { logo, logo_dark, logo_text, logo_url } = config?.options ?? {};
|
|
111
118
|
return (
|
|
112
119
|
<div className="bg-white/80 backdrop-blur dark:bg-stone-900/80 shadow dark:shadow-stone-700 p-3 md:px-8 sticky w-screen top-0 z-30 h-[60px]">
|
|
113
120
|
<nav className="flex items-center justify-between flex-nowrap max-w-[1440px] mx-auto">
|
|
@@ -130,7 +137,13 @@ export function TopNav({ hideToc, hideSearch }: { hideToc?: boolean; hideSearch?
|
|
|
130
137
|
</button>
|
|
131
138
|
</div>
|
|
132
139
|
}
|
|
133
|
-
<HomeLink
|
|
140
|
+
<HomeLink
|
|
141
|
+
name={title}
|
|
142
|
+
logo={logo}
|
|
143
|
+
logoDark={logo_dark}
|
|
144
|
+
logoText={logo_text}
|
|
145
|
+
url={logo_url}
|
|
146
|
+
/>
|
|
134
147
|
</div>
|
|
135
148
|
<div className="flex items-center flex-grow w-auto">
|
|
136
149
|
<NavItems nav={nav} />
|
package/src/pages/Root.tsx
CHANGED
|
@@ -168,11 +168,11 @@ export function AppErrorBoundary() {
|
|
|
168
168
|
const error = useRouteError();
|
|
169
169
|
return (
|
|
170
170
|
<Document theme={Theme.light}>
|
|
171
|
-
<
|
|
172
|
-
<
|
|
171
|
+
<main className="article-grid subgrid-gap col-screen">
|
|
172
|
+
<article className="article">
|
|
173
173
|
{isRouteErrorResponse(error) ? <Error404 /> : <ErrorUnhandled error={error as any} />}
|
|
174
|
-
</
|
|
175
|
-
</
|
|
174
|
+
</article>
|
|
175
|
+
</main>
|
|
176
176
|
</Document>
|
|
177
177
|
);
|
|
178
178
|
}
|