@myst-theme/site 1.2.0 → 1.3.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.
|
|
3
|
+
"version": "1.3.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.
|
|
29
|
-
"@myst-theme/diagrams": "^1.
|
|
30
|
-
"@myst-theme/frontmatter": "^1.
|
|
31
|
-
"@myst-theme/providers": "^1.
|
|
32
|
-
"@myst-theme/search": "^1.
|
|
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",
|
|
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.
|
|
40
|
+
"myst-demo": "^1.3.0",
|
|
41
41
|
"myst-spec-ext": "^1.8.1",
|
|
42
|
-
"myst-to-react": "^1.
|
|
42
|
+
"myst-to-react": "^1.3.0",
|
|
43
43
|
"nbtx": "^0.2.3",
|
|
44
44
|
"node-cache": "^5.1.2",
|
|
45
45
|
"node-fetch": "^2.6.11",
|
|
@@ -12,7 +12,7 @@ export function Keywords({
|
|
|
12
12
|
}) {
|
|
13
13
|
if (hideKeywords || !keywords || keywords.length === 0) return null;
|
|
14
14
|
return (
|
|
15
|
-
<div className={classNames('myst-keywords mb-10 group', className)}>
|
|
15
|
+
<div id="myst-keywords" className={classNames('myst-keywords mb-10 group', className)}>
|
|
16
16
|
<span className="myst-keywords-label mr-2 font-semibold">Keywords:</span>
|
|
17
17
|
<span className="myst-keywords-list">
|
|
18
18
|
{keywords.map((k, i) => (
|
|
@@ -26,7 +26,7 @@ export function Keywords({
|
|
|
26
26
|
</span>
|
|
27
27
|
))}
|
|
28
28
|
</span>
|
|
29
|
-
<HashLink id="keywords" title="Link to Keywords" hover className="ml-2" />
|
|
29
|
+
<HashLink id="myst-keywords" title="Link to Keywords" hover className="ml-2" />
|
|
30
30
|
</div>
|
|
31
31
|
);
|
|
32
32
|
}
|
|
@@ -245,13 +245,13 @@ function SearchResultItem({
|
|
|
245
245
|
/>
|
|
246
246
|
);
|
|
247
247
|
|
|
248
|
-
// Render the
|
|
249
|
-
let
|
|
248
|
+
// Render the context i.e. file name
|
|
249
|
+
let contextRenderer;
|
|
250
250
|
if (result.type === 'lvl1') {
|
|
251
|
-
|
|
251
|
+
contextRenderer = undefined;
|
|
252
252
|
} else {
|
|
253
|
-
const
|
|
254
|
-
|
|
253
|
+
const contextName = result.hierarchy.lvl1!;
|
|
254
|
+
contextRenderer = <MarkedText text={contextName} matches={matches} className="text-xs" />;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
const enterIconRenderer = (
|
|
@@ -268,8 +268,8 @@ function SearchResultItem({
|
|
|
268
268
|
<div className="flex flex-row h-11">
|
|
269
269
|
{iconRenderer}
|
|
270
270
|
<div className="flex flex-col justify-center truncate grow">
|
|
271
|
+
{contextRenderer}
|
|
271
272
|
{titleRenderer}
|
|
272
|
-
{subtitleRenderer}
|
|
273
273
|
</div>
|
|
274
274
|
{enterIconRenderer}
|
|
275
275
|
</div>
|
|
@@ -527,6 +527,7 @@ function SearchForm({
|
|
|
527
527
|
id={searchInputID}
|
|
528
528
|
aria-labelledby={searchLabelID}
|
|
529
529
|
aria-controls={searchListID}
|
|
530
|
+
aria-expanded={!!searchResults}
|
|
530
531
|
placeholder="Search"
|
|
531
532
|
type="search"
|
|
532
533
|
required
|
|
@@ -557,9 +558,15 @@ const SearchPlaceholderButton = forwardRef<
|
|
|
557
558
|
HTMLButtonElement,
|
|
558
559
|
SearchPlaceholderButtonProps & Dialog.DialogTriggerProps
|
|
559
560
|
>(({ className, disabled, ...props }, ref) => {
|
|
561
|
+
// Here we remove aria-controls from props so we can *decide* whether to insert it later
|
|
562
|
+
// This is because radix has a bug where it'll try pointing to a non-existent element
|
|
563
|
+
// if the dialog isn't open, so that's the logic we test below.
|
|
564
|
+
// ref: https://github.com/radix-ui/primitives/issues/3560
|
|
565
|
+
const { 'aria-controls': ariaControls, ...restProps } = props;
|
|
560
566
|
return (
|
|
561
567
|
<button
|
|
562
|
-
{...
|
|
568
|
+
{...restProps}
|
|
569
|
+
aria-controls={restProps['aria-expanded'] ? ariaControls : undefined}
|
|
563
570
|
className={classNames(
|
|
564
571
|
'myst-search-bar',
|
|
565
572
|
className,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useThemeSwitcher } from '@myst-theme/providers';
|
|
2
|
-
import { MoonIcon } from '@heroicons/react/24/solid';
|
|
3
|
-
import { SunIcon } from '@heroicons/react/24/outline';
|
|
2
|
+
import { MoonIcon, SunIcon } from '@heroicons/react/24/solid';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
|
|
6
5
|
export function ThemeButton({ className = 'w-10 h-10 mx-3' }: { className?: string }) {
|
|
@@ -8,15 +7,15 @@ export function ThemeButton({ className = 'w-10 h-10 mx-3' }: { className?: stri
|
|
|
8
7
|
return (
|
|
9
8
|
<button
|
|
10
9
|
className={classNames(
|
|
11
|
-
'myst-theme-button theme rounded-full
|
|
10
|
+
'myst-theme-button theme shrink-0 rounded-full border border-stone-700 dark:border-white hover:bg-neutral-100 border-solid overflow-hidden text-stone-700 dark:text-white hover:text-stone-500 dark:hover:text-neutral-800',
|
|
12
11
|
className,
|
|
13
12
|
)}
|
|
14
13
|
title={`Toggle theme between light and dark mode`}
|
|
15
14
|
aria-label={`Toggle theme between light and dark mode`}
|
|
16
15
|
onClick={nextTheme}
|
|
17
16
|
>
|
|
18
|
-
<MoonIcon className="myst-theme-moon-icon h-full w-full p-
|
|
19
|
-
<SunIcon className="myst-theme-sun-icon h-full w-full p-
|
|
17
|
+
<MoonIcon className="myst-theme-moon-icon h-full w-full p-[18%] hidden dark:block" />
|
|
18
|
+
<SunIcon className="myst-theme-sun-icon h-full w-full p-[18%] dark:hidden" />
|
|
20
19
|
</button>
|
|
21
20
|
);
|
|
22
21
|
}
|
|
@@ -128,8 +128,12 @@ export function TopNav({
|
|
|
128
128
|
const config = useSiteManifest();
|
|
129
129
|
const { title, nav, actions } = config ?? {};
|
|
130
130
|
const { logo, logo_dark, logo_text, logo_url, logo_alt } = config?.options ?? {};
|
|
131
|
+
// TODO: when the nav wraps to multiple lines the header grows past 60px, but
|
|
132
|
+
// there are downstream consumers of DEFAULT_NAV_HEIGHT and this will
|
|
133
|
+
// cause a mismatch if the navbar grows. Here we set it to `min-h` to let
|
|
134
|
+
// it grow, but we'll need to revisit downstream height consumers eventually.
|
|
131
135
|
return (
|
|
132
|
-
<div className="myst-top-nav bg-white/80 backdrop-blur dark:bg-stone-900/80 shadow dark:shadow-stone-700 p-3 md:px-8 sticky w-full top-0 z-30 h-[60px]">
|
|
136
|
+
<div className="myst-top-nav bg-white/80 backdrop-blur dark:bg-stone-900/80 shadow dark:shadow-stone-700 p-3 md:px-8 sticky w-full top-0 z-30 min-h-[60px]">
|
|
133
137
|
<nav className="myst-top-nav-bar flex items-center justify-between flex-nowrap max-w-[1440px] mx-auto">
|
|
134
138
|
<div className="flex flex-row xl:min-w-[19.5rem] mr-2 sm:mr-7 justify-start items-center shrink-0">
|
|
135
139
|
{
|
|
@@ -165,7 +169,7 @@ export function TopNav({
|
|
|
165
169
|
{/* Search bar */}
|
|
166
170
|
{!hideSearch && <Search />}
|
|
167
171
|
{/* Light/Dark theme button */}
|
|
168
|
-
<ThemeButton className="w-
|
|
172
|
+
<ThemeButton className="w-8 h-8 ml-3" />
|
|
169
173
|
{/* 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
174
|
{navbarEnd && (
|
|
171
175
|
<div className="article myst-navbar-end hidden xl:flex items-center ml-3 [&>*]:m-0">
|