@myst-theme/site 0.2.4 → 0.2.6

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.2.4",
3
+ "version": "0.2.6",
4
4
  "main": "./src/index.ts",
5
5
  "types": "./src/index.ts",
6
6
  "files": [
@@ -16,16 +16,16 @@
16
16
  "dependencies": {
17
17
  "@headlessui/react": "^1.7.13",
18
18
  "@heroicons/react": "^2.0.14",
19
- "@myst-theme/diagrams": "^0.2.4",
20
- "@myst-theme/frontmatter": "^0.2.4",
21
- "@myst-theme/jupyter": "^0.2.4",
22
- "@myst-theme/providers": "^0.2.4",
19
+ "@myst-theme/diagrams": "^0.2.6",
20
+ "@myst-theme/frontmatter": "^0.2.6",
21
+ "@myst-theme/jupyter": "^0.2.6",
22
+ "@myst-theme/providers": "^0.2.6",
23
23
  "classnames": "^2.3.2",
24
24
  "lodash.throttle": "^4.1.1",
25
25
  "myst-common": "^0.0.16",
26
26
  "myst-config": "^0.0.14",
27
- "myst-demo": "^0.2.4",
28
- "myst-to-react": "^0.2.4",
27
+ "myst-demo": "^0.2.6",
28
+ "myst-to-react": "^0.2.6",
29
29
  "nbtx": "^0.2.3",
30
30
  "node-cache": "^5.1.2",
31
31
  "node-fetch": "^2.6.7",
@@ -28,7 +28,7 @@ function Block({
28
28
  }) {
29
29
  const renderers = useNodeRenderers() ?? DEFAULT_RENDERERS;
30
30
  const children = useParse(node, renderers);
31
- const subGrid = 'article-grid article-subgrid-gap col-screen';
31
+ const subGrid = 'article-grid article-subgrid-gap col-screen mb-10';
32
32
  const dataClassName = typeof node.data?.class === 'string' ? node.data?.class : undefined;
33
33
  // Hide the subgrid if either the dataClass or the className exists and includes `col-`
34
34
  const noSubGrid =
@@ -154,7 +154,7 @@ const useIntersectionObserver = (highlight: () => void, onScreen: Set<HTMLHeadin
154
154
  };
155
155
 
156
156
  const DOC_OUTLINE_CLASS =
157
- 'fixed z-10 bottom-0 right-[max(0px,calc(50%-45rem))] w-[14rem] lg:w-[18rem] py-10 px-4 lg:px-8 overflow-y-auto hidden lg:block';
157
+ 'fixed bottom-0 right-[max(0px,calc(50%-45rem))] w-[14rem] lg:w-[18rem] py-10 px-4 lg:px-8 overflow-y-auto hidden lg:block';
158
158
 
159
159
  export function useOutlineHeight<T extends HTMLElement = HTMLElement>() {
160
160
  const container = useRef<T>(null);
@@ -20,14 +20,14 @@ export function Navigation({
20
20
  if (hide_toc) return <>{children}</>;
21
21
  return (
22
22
  <>
23
+ {children}
23
24
  {open && (
24
25
  <div
25
- className="fixed inset-0 bg-black opacity-50 z-30"
26
+ className="fixed inset-0 bg-black opacity-50"
26
27
  style={{ marginTop: top }}
27
28
  onClick={() => setOpen(false)}
28
29
  ></div>
29
30
  )}
30
- {children}
31
31
  <TableOfContents tocRef={tocRef} projectSlug={projectSlug} top={top} footer={footer} />
32
32
  </>
33
33
  );
@@ -109,7 +109,7 @@ const Headings = ({ folder, headings, sections }: Props) => {
109
109
  );
110
110
  };
111
111
 
112
- export function useTocHeight<T extends HTMLElement = HTMLElement>(top?: number) {
112
+ export function useTocHeight<T extends HTMLElement = HTMLElement>(top = 0, inset = 0) {
113
113
  const container = useRef<T>(null);
114
114
  const toc = useRef<HTMLDivElement>(null);
115
115
  const transitionState = useNavigation().state;
@@ -117,8 +117,7 @@ export function useTocHeight<T extends HTMLElement = HTMLElement>(top?: number)
117
117
  if (!container.current || !toc.current) return;
118
118
  const height = container.current.offsetHeight - window.scrollY;
119
119
  const div = toc.current.firstChild as HTMLDivElement;
120
- const MAGIC_PADDING = 16; // I dunno, just go with it ...
121
- if (div) div.style.height = `min(calc(100vh - ${top ?? 0}px), ${height + MAGIC_PADDING}px)`;
120
+ if (div) div.style.height = `min(calc(100vh - ${top}px), ${height + inset}px)`;
122
121
  const nav = toc.current.querySelector('nav');
123
122
  if (nav) nav.style.opacity = height > 150 ? '1' : '0';
124
123
  };
@@ -164,7 +163,7 @@ export const TableOfContents = ({
164
163
  <div
165
164
  ref={tocRef}
166
165
  className={classNames(
167
- 'fixed xl:article-grid article-grid-gap xl:w-screen z-30 xl:pointer-events-none overflow-auto max-xl:min-w-[300px]',
166
+ 'fixed xl:article-grid article-grid-gap xl:w-screen xl:pointer-events-none overflow-auto max-xl:min-w-[300px]',
168
167
  { hidden: !open },
169
168
  )}
170
169
  style={{