@myst-theme/site 1.0.0 → 1.1.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.0.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -8,6 +8,10 @@
8
8
  "src"
9
9
  ],
10
10
  "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/jupyter-book/myst-theme.git"
14
+ },
11
15
  "sideEffects": false,
12
16
  "scripts": {
13
17
  "clean": "rimraf dist",
@@ -21,11 +25,11 @@
21
25
  "dependencies": {
22
26
  "@headlessui/react": "^1.7.15",
23
27
  "@heroicons/react": "^2.0.18",
24
- "@myst-theme/common": "^1.0.0",
25
- "@myst-theme/diagrams": "^1.0.0",
26
- "@myst-theme/frontmatter": "^1.0.0",
27
- "@myst-theme/providers": "^1.0.0",
28
- "@myst-theme/search": "^1.0.0",
28
+ "@myst-theme/common": "^1.1.0",
29
+ "@myst-theme/diagrams": "^1.1.0",
30
+ "@myst-theme/frontmatter": "^1.1.0",
31
+ "@myst-theme/providers": "^1.1.0",
32
+ "@myst-theme/search": "^1.1.0",
29
33
  "@radix-ui/react-collapsible": "^1.0.3",
30
34
  "@radix-ui/react-dialog": "^1.0.3",
31
35
  "@radix-ui/react-visually-hidden": "^1.1.0",
@@ -33,9 +37,9 @@
33
37
  "lodash.throttle": "^4.1.1",
34
38
  "myst-common": "^1.8.1",
35
39
  "myst-config": "^1.7.9",
36
- "myst-demo": "^1.0.0",
40
+ "myst-demo": "^1.1.0",
37
41
  "myst-spec-ext": "^1.8.1",
38
- "myst-to-react": "^1.0.0",
42
+ "myst-to-react": "^1.1.0",
39
43
  "nbtx": "^0.2.3",
40
44
  "node-cache": "^5.1.2",
41
45
  "node-fetch": "^2.6.11",
@@ -25,8 +25,8 @@ export function HomeLink({
25
25
  >
26
26
  {logo && (
27
27
  <div
28
- className={classNames('myst-home-link-logo p-1 mr-3', {
29
- 'dark:bg-white dark:rounded': !logoDark,
28
+ className={classNames('myst-home-link-logo mr-3 flex items-center', {
29
+ 'dark:bg-white dark:rounded px-1': !logoDark,
30
30
  })}
31
31
  >
32
32
  <img
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useLinkProvider, useNavLinkProvider } from '@myst-theme/providers';
2
+ import { isExternalUrl, useLinkProvider, useNavLinkProvider } from '@myst-theme/providers';
3
3
 
4
4
  export function ExternalOrInternalLink({
5
5
  to,
@@ -19,7 +19,7 @@ export function ExternalOrInternalLink({
19
19
  const Link = useLinkProvider();
20
20
  const NavLink = useNavLinkProvider();
21
21
  const staticClass = typeof className === 'function' ? className({ isActive: false }) : className;
22
- if (to.startsWith('http') || to.startsWith('mailto:')) {
22
+ if (isExternalUrl(to)) {
23
23
  return (
24
24
  <a
25
25
  href={to}
@@ -172,7 +172,7 @@ const NestedToc = ({ heading }: { heading: NestedHeading }) => {
172
172
  <Collapsible.Root className="w-full" open={open} onOpenChange={setOpen}>
173
173
  <div
174
174
  className={classNames(
175
- 'myst-toc-item flex flex-row w-full gap-2 px-2 my-1 text-left rounded-lg outline-none',
175
+ 'myst-toc-item flex flex-row w-full gap-2 pl-2 my-1 text-left rounded-lg outline-none',
176
176
  {
177
177
  'myst-toc-item-exact bg-blue-300/30': exact,
178
178
  'hover:bg-slate-300/30': !exact,
@@ -189,7 +189,7 @@ const NestedToc = ({ heading }: { heading: NestedHeading }) => {
189
189
  />
190
190
  <Collapsible.Trigger asChild>
191
191
  <button
192
- className="self-center flex-none rounded-md group hover:bg-slate-300/30 focus:outline outline-blue-200 outline-2"
192
+ className="self-stretch flex items-center flex-none px-1 rounded-l-md group hover:bg-slate-300/30 focus-visible:outline outline-blue-200 outline-2"
193
193
  aria-label="Open Folder"
194
194
  >
195
195
  <ChevronRightIcon
@@ -3,7 +3,7 @@ import { MoonIcon } from '@heroicons/react/24/solid';
3
3
  import { SunIcon } from '@heroicons/react/24/outline';
4
4
  import classNames from 'classnames';
5
5
 
6
- export function ThemeButton({ className = 'w-8 h-8 mx-3' }: { className?: string }) {
6
+ export function ThemeButton({ className = 'w-10 h-10 mx-3' }: { className?: string }) {
7
7
  const { nextTheme } = useThemeSwitcher();
8
8
  return (
9
9
  <button
@@ -64,35 +64,38 @@ export function NavItem({ item }: { item: SiteNavItem }) {
64
64
  leaveTo="transform opacity-0 scale-95"
65
65
  >
66
66
  <Menu.Items className="myst-top-nav-dropdown-items absolute w-48 py-1 mt-2 origin-top-left bg-white rounded-sm shadow-lg left-4 ring-1 ring-black ring-opacity-5 focus:outline-none">
67
- {item.children?.map((action) => (
68
- <Menu.Item key={action.url}>
69
- {/* This is really ugly, BUT, the action needs to be defined HERE or the click away doesn't work for some reason */}
70
- {action.url?.startsWith('http') ? (
71
- <a
72
- href={action.url || ''}
73
- className="myst-top-nav-dropdown-item block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-black"
74
- target="_blank"
75
- rel="noopener noreferrer"
76
- >
77
- {action.title}
78
- </a>
79
- ) : (
80
- <NavLink
81
- to={action.url || ''}
82
- className={({ isActive }) =>
83
- classNames(
84
- 'myst-top-nav-dropdown-item block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-black',
85
- {
86
- 'text-black font-bold': isActive,
87
- },
88
- )
89
- }
90
- >
91
- {action.title}
92
- </NavLink>
93
- )}
94
- </Menu.Item>
95
- ))}
67
+ {item.children?.map((action) => {
68
+ const url = withBaseurl(action.url, baseurl) || '';
69
+ return (
70
+ <Menu.Item key={action.url}>
71
+ {/* This is really ugly, BUT, the action needs to be defined HERE or the click away doesn't work for some reason */}
72
+ {action.url?.startsWith('http') ? (
73
+ <a
74
+ href={url}
75
+ className="myst-top-nav-dropdown-item block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-black"
76
+ target="_blank"
77
+ rel="noopener noreferrer"
78
+ >
79
+ {action.title}
80
+ </a>
81
+ ) : (
82
+ <NavLink
83
+ to={url}
84
+ className={({ isActive }) =>
85
+ classNames(
86
+ 'myst-top-nav-dropdown-item block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-black',
87
+ {
88
+ 'text-black font-bold': isActive,
89
+ },
90
+ )
91
+ }
92
+ >
93
+ {action.title}
94
+ </NavLink>
95
+ )}
96
+ </Menu.Item>
97
+ );
98
+ })}
96
99
  </Menu.Items>
97
100
  </Transition>
98
101
  </Menu>
@@ -127,12 +130,12 @@ export function TopNav({ hideToc, hideSearch }: { hideToc?: boolean; hideSearch?
127
130
  })}
128
131
  >
129
132
  <button
130
- className="myst-top-nav-menu-button flex items-center border-stone-400 text-stone-800 hover:text-stone-900 dark:text-stone-200 hover:dark:text-stone-100"
133
+ className="myst-top-nav-menu-button flex items-center justify-center border-stone-400 text-stone-800 hover:text-stone-900 dark:text-stone-200 hover:dark:text-stone-100 w-10 h-10"
131
134
  onClick={() => {
132
135
  setOpen(!open);
133
136
  }}
134
137
  >
135
- <MenuIcon width="2rem" height="2rem" className="m-1" />
138
+ <MenuIcon width="1.5rem" height="1.5rem" />
136
139
  <span className="sr-only">Open Menu</span>
137
140
  </button>
138
141
  </div>