@myst-theme/site 0.2.5 → 0.2.7
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.
|
|
3
|
+
"version": "0.2.7",
|
|
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.
|
|
20
|
-
"@myst-theme/frontmatter": "^0.2.
|
|
21
|
-
"@myst-theme/jupyter": "^0.2.
|
|
22
|
-
"@myst-theme/providers": "^0.2.
|
|
19
|
+
"@myst-theme/diagrams": "^0.2.7",
|
|
20
|
+
"@myst-theme/frontmatter": "^0.2.7",
|
|
21
|
+
"@myst-theme/jupyter": "^0.2.7",
|
|
22
|
+
"@myst-theme/providers": "^0.2.7",
|
|
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.
|
|
28
|
-
"myst-to-react": "^0.2.
|
|
27
|
+
"myst-demo": "^0.2.7",
|
|
28
|
+
"myst-to-react": "^0.2.7",
|
|
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 =
|
|
@@ -58,6 +58,7 @@ const Headings = ({ headings, activeId, highlight }: Props) => (
|
|
|
58
58
|
el.classList.add(HIGHLIGHT_CLASS);
|
|
59
59
|
highlight?.();
|
|
60
60
|
el.scrollIntoView({ behavior: 'smooth' });
|
|
61
|
+
history.replaceState(undefined, '', `#${heading.id}`);
|
|
61
62
|
}}
|
|
62
63
|
// Note that the title can have math in it!
|
|
63
64
|
dangerouslySetInnerHTML={{ __html: heading.titleHTML }}
|
|
@@ -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
|
|
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
|
-
|
|
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
|
};
|