@curvenote/theme-ui 2.0.1 → 2.0.2

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.
Files changed (252) hide show
  1. package/dist/components/index.d.ts +3 -3
  2. package/dist/components/index.d.ts.map +1 -1
  3. package/dist/components/index.js +3 -3
  4. package/dist/components/layout/app-layout.d.ts +3 -3
  5. package/dist/components/layout/app-layout.d.ts.map +1 -1
  6. package/dist/components/layout/app-layout.js +19 -15
  7. package/dist/components/layout/app-sidebar.d.ts +2 -1
  8. package/dist/components/layout/app-sidebar.d.ts.map +1 -1
  9. package/dist/components/layout/app-sidebar.js +8 -8
  10. package/dist/components/layout/article-layout.d.ts +3 -3
  11. package/dist/components/layout/article-layout.d.ts.map +1 -1
  12. package/dist/components/layout/article-layout.js +17 -10
  13. package/dist/components/layout/grid.d.ts +1 -1
  14. package/dist/components/layout/grid.d.ts.map +1 -1
  15. package/dist/components/layout/header.d.ts +5 -3
  16. package/dist/components/layout/header.d.ts.map +1 -1
  17. package/dist/components/layout/header.js +6 -3
  18. package/dist/components/layout/index.d.ts +7 -7
  19. package/dist/components/layout/index.d.ts.map +1 -1
  20. package/dist/components/layout/index.js +7 -7
  21. package/dist/components/layout/layout-header.d.ts +9 -0
  22. package/dist/components/layout/layout-header.d.ts.map +1 -0
  23. package/dist/components/layout/layout-header.js +13 -0
  24. package/dist/components/layout/loading-bar.d.ts +1 -1
  25. package/dist/components/layout/loading-bar.d.ts.map +1 -1
  26. package/dist/components/layout/loading-bar.js +1 -1
  27. package/dist/components/layout/site-header.d.ts +1 -1
  28. package/dist/components/layout/site-header.d.ts.map +1 -1
  29. package/dist/components/layout/site-header.js +18 -8
  30. package/dist/components/layout/types.d.ts +6 -0
  31. package/dist/components/layout/types.d.ts.map +1 -1
  32. package/dist/components/providers/analytics-boundary.d.ts +1 -1
  33. package/dist/components/providers/analytics-boundary.d.ts.map +1 -1
  34. package/dist/components/providers/analytics-boundary.js +3 -3
  35. package/dist/components/providers/analytics-dev-tray.d.ts +1 -1
  36. package/dist/components/providers/analytics-dev-tray.d.ts.map +1 -1
  37. package/dist/components/providers/analytics-dev-tray.js +3 -3
  38. package/dist/components/providers/article-versions-provider.d.ts +1 -1
  39. package/dist/components/providers/article-versions-provider.d.ts.map +1 -1
  40. package/dist/components/providers/compute.d.ts +1 -1
  41. package/dist/components/providers/compute.d.ts.map +1 -1
  42. package/dist/components/providers/curvenote-providers.d.ts +14 -18
  43. package/dist/components/providers/curvenote-providers.d.ts.map +1 -1
  44. package/dist/components/providers/curvenote-providers.js +10 -10
  45. package/dist/components/providers/design.d.ts +1 -1
  46. package/dist/components/providers/design.d.ts.map +1 -1
  47. package/dist/components/providers/design.js +2 -1
  48. package/dist/components/providers/index.d.ts +11 -11
  49. package/dist/components/providers/index.d.ts.map +1 -1
  50. package/dist/components/providers/index.js +11 -11
  51. package/dist/components/providers/lightbox-provider.d.ts +1 -1
  52. package/dist/components/providers/lightbox-provider.d.ts.map +1 -1
  53. package/dist/components/providers/myst-providers.d.ts +1 -1
  54. package/dist/components/providers/myst-providers.d.ts.map +1 -1
  55. package/dist/components/providers/overlay-depth.d.ts +1 -1
  56. package/dist/components/providers/overlay-depth.d.ts.map +1 -1
  57. package/dist/components/providers/page-providers.d.ts +2 -2
  58. package/dist/components/providers/page-providers.d.ts.map +1 -1
  59. package/dist/components/providers/ping-boundary.d.ts +1 -1
  60. package/dist/components/providers/ping-boundary.d.ts.map +1 -1
  61. package/dist/components/providers/platform-providers.d.ts +1 -1
  62. package/dist/components/providers/platform-providers.d.ts.map +1 -1
  63. package/dist/components/ui/Callout.d.ts +1 -1
  64. package/dist/components/ui/Callout.d.ts.map +1 -1
  65. package/dist/components/ui/Callout.js +1 -1
  66. package/dist/components/ui/PageCards.d.ts +2 -1
  67. package/dist/components/ui/PageCards.d.ts.map +1 -1
  68. package/dist/components/ui/abbreviations.d.ts +2 -1
  69. package/dist/components/ui/abbreviations.d.ts.map +1 -1
  70. package/dist/components/ui/abbreviations.js +7 -14
  71. package/dist/components/ui/abstract.d.ts +1 -1
  72. package/dist/components/ui/abstract.d.ts.map +1 -1
  73. package/dist/components/ui/accessibility-skip-to.d.ts +3 -3
  74. package/dist/components/ui/accessibility-skip-to.d.ts.map +1 -1
  75. package/dist/components/ui/accessibility-skip-to.js +1 -1
  76. package/dist/components/ui/acknowledgements.d.ts +1 -1
  77. package/dist/components/ui/acknowledgements.d.ts.map +1 -1
  78. package/dist/components/ui/acknowledgements.js +4 -4
  79. package/dist/components/ui/arrow.d.ts +3 -3
  80. package/dist/components/ui/arrow.d.ts.map +1 -1
  81. package/dist/components/ui/article-actions-downloads.d.ts +24 -3
  82. package/dist/components/ui/article-actions-downloads.d.ts.map +1 -1
  83. package/dist/components/ui/article-actions-downloads.js +58 -16
  84. package/dist/components/ui/article-actions-dropdown.d.ts +1 -1
  85. package/dist/components/ui/article-actions-dropdown.d.ts.map +1 -1
  86. package/dist/components/ui/article-actions-dropdown.js +9 -9
  87. package/dist/components/ui/article-actions-share.d.ts +1 -1
  88. package/dist/components/ui/article-actions-share.d.ts.map +1 -1
  89. package/dist/components/ui/article-actions-share.js +2 -2
  90. package/dist/components/ui/article-actions.d.ts +1 -1
  91. package/dist/components/ui/article-actions.d.ts.map +1 -1
  92. package/dist/components/ui/article-actions.js +29 -8
  93. package/dist/components/ui/article-bar.d.ts +16 -3
  94. package/dist/components/ui/article-bar.d.ts.map +1 -1
  95. package/dist/components/ui/article-bar.js +9 -7
  96. package/dist/components/ui/article-card.d.ts +1 -1
  97. package/dist/components/ui/article-card.d.ts.map +1 -1
  98. package/dist/components/ui/article-card.js +2 -2
  99. package/dist/components/ui/article-footer.d.ts +1 -1
  100. package/dist/components/ui/article-footer.d.ts.map +1 -1
  101. package/dist/components/ui/article-footer.js +1 -1
  102. package/dist/components/ui/author-popover.d.ts +1 -1
  103. package/dist/components/ui/author-popover.d.ts.map +1 -1
  104. package/dist/components/ui/author-popover.js +3 -3
  105. package/dist/components/ui/backmatter.d.ts +41 -3
  106. package/dist/components/ui/backmatter.d.ts.map +1 -1
  107. package/dist/components/ui/backmatter.js +117 -34
  108. package/dist/components/ui/badge.d.ts +1 -1
  109. package/dist/components/ui/badge.d.ts.map +1 -1
  110. package/dist/components/ui/badge.js +1 -1
  111. package/dist/components/ui/banner.d.ts +22 -1
  112. package/dist/components/ui/banner.d.ts.map +1 -1
  113. package/dist/components/ui/banner.js +44 -3
  114. package/dist/components/ui/bibliography.d.ts +1 -1
  115. package/dist/components/ui/bibliography.d.ts.map +1 -1
  116. package/dist/components/ui/bibliography.js +3 -3
  117. package/dist/components/ui/breadcrumb.d.ts +7 -7
  118. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  119. package/dist/components/ui/breadcrumb.js +1 -1
  120. package/dist/components/ui/button.d.ts +1 -1
  121. package/dist/components/ui/button.d.ts.map +1 -1
  122. package/dist/components/ui/button.js +2 -2
  123. package/dist/components/ui/calendar.d.ts +1 -1
  124. package/dist/components/ui/calendar.d.ts.map +1 -1
  125. package/dist/components/ui/calendar.js +2 -2
  126. package/dist/components/ui/citation.d.ts +2 -2
  127. package/dist/components/ui/citation.d.ts.map +1 -1
  128. package/dist/components/ui/citation.js +5 -5
  129. package/dist/components/ui/collapsible-backmatter-section.d.ts +2 -2
  130. package/dist/components/ui/collapsible-backmatter-section.d.ts.map +1 -1
  131. package/dist/components/ui/collapsible-backmatter-section.js +3 -3
  132. package/dist/components/ui/collapsible.d.ts +3 -3
  133. package/dist/components/ui/collapsible.d.ts.map +1 -1
  134. package/dist/components/ui/cookie-banner.d.ts +2 -1
  135. package/dist/components/ui/cookie-banner.d.ts.map +1 -1
  136. package/dist/components/ui/cookie-banner.js +4 -4
  137. package/dist/components/ui/data-availability.d.ts +1 -1
  138. package/dist/components/ui/data-availability.d.ts.map +1 -1
  139. package/dist/components/ui/data-availability.js +4 -4
  140. package/dist/components/ui/dhr-cta-buttons.d.ts +30 -0
  141. package/dist/components/ui/dhr-cta-buttons.d.ts.map +1 -0
  142. package/dist/components/ui/dhr-cta-buttons.js +40 -0
  143. package/dist/components/ui/dialog.d.ts +10 -10
  144. package/dist/components/ui/dialog.d.ts.map +1 -1
  145. package/dist/components/ui/dialog.js +1 -1
  146. package/dist/components/ui/document-outline.d.ts +11 -2
  147. package/dist/components/ui/document-outline.d.ts.map +1 -1
  148. package/dist/components/ui/document-outline.js +101 -54
  149. package/dist/components/ui/dropdown-menu.d.ts +15 -15
  150. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  151. package/dist/components/ui/dropdown-menu.js +1 -1
  152. package/dist/components/ui/error-page.d.ts +1 -1
  153. package/dist/components/ui/error-page.d.ts.map +1 -1
  154. package/dist/components/ui/error-page.js +1 -1
  155. package/dist/components/ui/font-styles.d.ts +23 -0
  156. package/dist/components/ui/font-styles.d.ts.map +1 -0
  157. package/dist/components/ui/font-styles.js +39 -0
  158. package/dist/components/ui/footer-links.d.ts +1 -1
  159. package/dist/components/ui/footer-links.d.ts.map +1 -1
  160. package/dist/components/ui/footer-links.js +2 -2
  161. package/dist/components/ui/footnotes.d.ts +1 -1
  162. package/dist/components/ui/footnotes.d.ts.map +1 -1
  163. package/dist/components/ui/footnotes.js +3 -2
  164. package/dist/components/ui/frontmatter-badges.d.ts +7 -7
  165. package/dist/components/ui/frontmatter-badges.d.ts.map +1 -1
  166. package/dist/components/ui/frontmatter-badges.js +5 -5
  167. package/dist/components/ui/frontmatter.d.ts +1 -1
  168. package/dist/components/ui/frontmatter.d.ts.map +1 -1
  169. package/dist/components/ui/frontmatter.js +1 -1
  170. package/dist/components/ui/hash-link.d.ts.map +1 -1
  171. package/dist/components/ui/hash-link.js +2 -1
  172. package/dist/components/ui/image.d.ts +2 -2
  173. package/dist/components/ui/image.d.ts.map +1 -1
  174. package/dist/components/ui/image.js +3 -3
  175. package/dist/components/ui/index.d.ts +61 -57
  176. package/dist/components/ui/index.d.ts.map +1 -1
  177. package/dist/components/ui/index.js +58 -56
  178. package/dist/components/ui/input.d.ts +1 -1
  179. package/dist/components/ui/input.d.ts.map +1 -1
  180. package/dist/components/ui/input.js +1 -1
  181. package/dist/components/ui/keywords.d.ts +1 -1
  182. package/dist/components/ui/keywords.d.ts.map +1 -1
  183. package/dist/components/ui/keywords.js +3 -3
  184. package/dist/components/ui/label.js +1 -1
  185. package/dist/components/ui/license-description.d.ts +1 -1
  186. package/dist/components/ui/license-description.d.ts.map +1 -1
  187. package/dist/components/ui/license-description.js +3 -3
  188. package/dist/components/ui/license-frontmatter.d.ts +2 -2
  189. package/dist/components/ui/license-frontmatter.d.ts.map +1 -1
  190. package/dist/components/ui/license-frontmatter.js +4 -4
  191. package/dist/components/ui/lightbox-container.d.ts +2 -2
  192. package/dist/components/ui/lightbox-container.d.ts.map +1 -1
  193. package/dist/components/ui/lightbox-container.js +2 -2
  194. package/dist/components/ui/lightbox.d.ts +3 -2
  195. package/dist/components/ui/lightbox.d.ts.map +1 -1
  196. package/dist/components/ui/lightbox.js +6 -6
  197. package/dist/components/ui/link-card.d.ts +1 -1
  198. package/dist/components/ui/link-card.d.ts.map +1 -1
  199. package/dist/components/ui/link-card.js +1 -1
  200. package/dist/components/ui/pagination.d.ts +7 -7
  201. package/dist/components/ui/pagination.d.ts.map +1 -1
  202. package/dist/components/ui/pagination.js +1 -1
  203. package/dist/components/ui/popover.d.ts +4 -4
  204. package/dist/components/ui/popover.d.ts.map +1 -1
  205. package/dist/components/ui/popover.js +1 -1
  206. package/dist/components/ui/search.d.ts +1 -1
  207. package/dist/components/ui/search.d.ts.map +1 -1
  208. package/dist/components/ui/search.js +2 -2
  209. package/dist/components/ui/select.d.ts +10 -10
  210. package/dist/components/ui/select.d.ts.map +1 -1
  211. package/dist/components/ui/select.js +1 -1
  212. package/dist/components/ui/separator.d.ts +1 -1
  213. package/dist/components/ui/separator.d.ts.map +1 -1
  214. package/dist/components/ui/separator.js +1 -1
  215. package/dist/components/ui/sheet.d.ts +8 -8
  216. package/dist/components/ui/sheet.d.ts.map +1 -1
  217. package/dist/components/ui/sheet.js +1 -1
  218. package/dist/components/ui/sidebar.d.ts +23 -23
  219. package/dist/components/ui/sidebar.d.ts.map +1 -1
  220. package/dist/components/ui/sidebar.js +3 -3
  221. package/dist/components/ui/skeleton.d.ts +1 -1
  222. package/dist/components/ui/skeleton.d.ts.map +1 -1
  223. package/dist/components/ui/skeleton.js +1 -1
  224. package/dist/components/ui/sonner.d.ts +1 -1
  225. package/dist/components/ui/sonner.d.ts.map +1 -1
  226. package/dist/components/ui/theme-button.d.ts +1 -1
  227. package/dist/components/ui/theme-button.d.ts.map +1 -1
  228. package/dist/components/ui/theme-button.js +3 -3
  229. package/dist/components/ui/tooltip.d.ts +4 -4
  230. package/dist/components/ui/tooltip.d.ts.map +1 -1
  231. package/dist/components/ui/tooltip.js +2 -2
  232. package/dist/components/ui/types.d.ts +1 -0
  233. package/dist/components/ui/types.d.ts.map +1 -1
  234. package/dist/components/ui/types.js +1 -0
  235. package/dist/hooks/index.d.ts +4 -4
  236. package/dist/hooks/index.d.ts.map +1 -1
  237. package/dist/hooks/index.js +4 -4
  238. package/dist/hooks/use-theme.d.ts +1 -1
  239. package/dist/hooks/use-theme.d.ts.map +1 -1
  240. package/dist/index.d.ts +3 -3
  241. package/dist/index.d.ts.map +1 -1
  242. package/dist/index.js +3 -3
  243. package/dist/lib/dedupeAbbreviations.d.ts +11 -0
  244. package/dist/lib/dedupeAbbreviations.d.ts.map +1 -1
  245. package/dist/lib/dedupeAbbreviations.js +17 -0
  246. package/dist/lib/fonts.d.ts +29 -0
  247. package/dist/lib/fonts.d.ts.map +1 -0
  248. package/dist/lib/fonts.js +148 -0
  249. package/dist/lib/index.d.ts +6 -5
  250. package/dist/lib/index.d.ts.map +1 -1
  251. package/dist/lib/index.js +6 -5
  252. package/package.json +22 -4
@@ -5,10 +5,24 @@ import { toText } from 'myst-common';
5
5
  import { useFrontmatter } from '@myst-theme/providers';
6
6
  import { MyST } from 'myst-to-react';
7
7
  import { Link } from 'react-router';
8
- import { cn } from '../../lib/utils';
8
+ import { cn } from '../../lib/utils.js';
9
9
  import { useEffect, useMemo, useState, useRef } from 'react';
10
- import { useAnalytics } from '../providers';
11
- import { articleMdastForOutline } from '../../lib/knownParts';
10
+ import { useAnalytics, useDesign } from '../providers/index.js';
11
+ import { useBackmatterVisibility } from './backmatter.js';
12
+ import { articleMdastForOutline } from '../../lib/knownParts.js';
13
+ const DEFAULT_OUTLINE_LEVELS = 2;
14
+ /** Indentation baseline when the article has no headings (backmatter-only outline). */
15
+ const DEFAULT_OUTLINE_BASE_DEPTH = 2;
16
+ /** Show the outline whenever there is at least one entry (heading or backmatter). */
17
+ export function shouldRenderDocumentOutline(itemCount) {
18
+ return itemCount > 0;
19
+ }
20
+ /** Shallowest heading depth, or a stable fallback for backmatter-only outlines. */
21
+ export function resolveOutlineBaseDepth(headerDepths) {
22
+ if (headerDepths.length === 0)
23
+ return DEFAULT_OUTLINE_BASE_DEPTH;
24
+ return Math.min(...headerDepths);
25
+ }
12
26
  // Transform function to remove links from header nodes using unist-util-visit
13
27
  function transformHeaders(headers) {
14
28
  return headers.map((header) => {
@@ -25,27 +39,56 @@ function transformHeaders(headers) {
25
39
  return transformedHeader;
26
40
  });
27
41
  }
28
- export function DocumentOutline({ mdast, maxdepth = 3, className }) {
42
+ export function DocumentOutline({ mdast, maxLevels, className }) {
29
43
  const capture = useAnalytics();
30
44
  const frontmatter = useFrontmatter();
45
+ const { outline_maxdepth, hide_outline_backmatter } = useDesign();
46
+ // a configured depth wins over the default the surrounding layout asked for
47
+ const levels = outline_maxdepth ?? maxLevels ?? DEFAULT_OUTLINE_LEVELS;
31
48
  const outlineMdast = useMemo(() => articleMdastForOutline(mdast, frontmatter?.parts), [mdast, frontmatter?.parts]);
32
49
  const [activeId, setActiveId] = useState(null);
33
50
  const timeoutRef = useRef(null);
34
51
  const lastActiveIdRef = useRef(null);
35
- const ulRef = useRef(null);
52
+ const scrollRef = useRef(null);
36
53
  const [maxHeight, setMaxHeight] = useState(undefined);
37
54
  const [isVisible, setIsVisible] = useState(true);
38
55
  // Extract headers from mdast with extracted parts removed (same as article body).
39
- const rawHeaders = selectAll('heading', outlineMdast);
40
- const headers = transformHeaders(rawHeaders);
56
+ const headers = useMemo(() => transformHeaders(selectAll('heading', outlineMdast)), [outlineMdast]);
57
+ // Levels are counted from the shallowest heading present, not from `h1`: article bodies
58
+ // normally start at `h2` (the title is the `h1`), but a document that starts deeper should
59
+ // still get its first level listed. Backmatter-only outlines fall back to h2 indentation.
60
+ const baseDepth = useMemo(() => resolveOutlineBaseDepth(headers.map((h) => h.depth)), [headers]);
61
+ // not clamped: `0` (or less) selects no headings at all, which hides the outline entirely
62
+ const deepest = baseDepth + levels - 1;
63
+ // Headers that are actually rendered in the outline; if a deeper header (e.g. h4 when only
64
+ // two levels are shown) is closest to the viewport, we highlight the nearest preceding one.
65
+ const visibleHeaders = useMemo(() => headers.filter((h) => h.depth <= deepest && h.html_id), [headers, deepest]);
66
+ // Backmatter sections are appended as a separated group, in the order they render on the page.
67
+ const backmatter = useBackmatterVisibility();
68
+ const backmatterSections = hide_outline_backmatter ? [] : backmatter.visible;
69
+ const backmatterKey = backmatterSections.map((section) => section.anchor).join(',');
70
+ const items = useMemo(() => {
71
+ const headings = visibleHeaders.map((header) => ({
72
+ identifier: header.html_id,
73
+ depth: header.depth,
74
+ header,
75
+ }));
76
+ if (!backmatterKey)
77
+ return headings;
78
+ return [
79
+ ...headings,
80
+ ...backmatterSections.map((section) => ({
81
+ identifier: section.anchor,
82
+ depth: baseDepth,
83
+ title: section.title,
84
+ })),
85
+ ];
86
+ // `backmatterKey` stands in for `backmatterSections`, which is a fresh array each render
87
+ }, [visibleHeaders, baseDepth, backmatterKey]);
41
88
  useEffect(() => {
42
- // Only consider headers that are actually rendered in the outline; if a
43
- // deeper header (e.g. h4 when maxdepth is 3) is the closest to the
44
- // viewport, we want to highlight the nearest preceding displayed header.
45
- const visibleHeaders = headers.filter((h) => h.depth <= maxdepth && h.html_id);
46
89
  // Set initial active header based on scroll position
47
90
  const handleScroll = () => {
48
- if (visibleHeaders.length === 0)
91
+ if (items.length === 0)
49
92
  return;
50
93
  const scrollTop = window.scrollY;
51
94
  const windowHeight = window.innerHeight;
@@ -53,28 +96,28 @@ export function DocumentOutline({ mdast, maxdepth = 3, className }) {
53
96
  const scrollBottom = scrollTop + windowHeight;
54
97
  // If we're at the very top, activate the first displayed header
55
98
  if (scrollTop < windowHeight * 0.1) {
56
- const firstHeader = visibleHeaders[0];
57
- if (firstHeader?.html_id) {
58
- setActiveId(firstHeader.html_id);
99
+ const firstHeader = items[0];
100
+ if (firstHeader?.identifier) {
101
+ setActiveId(firstHeader.identifier);
59
102
  }
60
103
  return;
61
104
  }
62
105
  // If we're near the bottom of the page, activate the last displayed header
63
106
  if (scrollBottom > documentHeight - windowHeight * 0.2) {
64
- const lastHeader = visibleHeaders[visibleHeaders.length - 1];
65
- if (lastHeader?.html_id) {
66
- setActiveId(lastHeader.html_id);
107
+ const lastHeader = items[items.length - 1];
108
+ if (lastHeader?.identifier) {
109
+ setActiveId(lastHeader.identifier);
67
110
  }
68
111
  return;
69
112
  }
70
113
  // Find the displayed header that's currently in view
71
- for (let i = visibleHeaders.length - 1; i >= 0; i--) {
72
- const header = visibleHeaders[i];
73
- const element = document.getElementById(header.html_id);
114
+ for (let i = items.length - 1; i >= 0; i--) {
115
+ const header = items[i];
116
+ const element = document.getElementById(header.identifier);
74
117
  if (element) {
75
118
  const rect = element.getBoundingClientRect();
76
119
  if (rect.top <= windowHeight * 0.2) {
77
- setActiveId(header.html_id);
120
+ setActiveId(header.identifier);
78
121
  break;
79
122
  }
80
123
  }
@@ -90,9 +133,9 @@ export function DocumentOutline({ mdast, maxdepth = 3, className }) {
90
133
  clearTimeout(timeoutRef.current);
91
134
  }
92
135
  };
93
- }, [headers, maxdepth]);
136
+ }, [items]);
94
137
  useEffect(() => {
95
- const ulElement = ulRef.current;
138
+ const ulElement = scrollRef.current;
96
139
  if (!ulElement)
97
140
  return;
98
141
  const updateMaxHeight = () => {
@@ -151,36 +194,40 @@ export function DocumentOutline({ mdast, maxdepth = 3, className }) {
151
194
  window.removeEventListener('resize', updateMaxHeight);
152
195
  };
153
196
  }, []); // Empty dependency array - only run on mount/unmount
154
- if (!headers || headers.length < 2) {
197
+ // Nothing to list — don't render the "On this page" heading over an empty outline.
198
+ // Count composed `items` (headings + visible backmatter), not headings alone: a short
199
+ // article with References/Footnotes still has something useful to list.
200
+ if (!shouldRenderDocumentOutline(items.length)) {
155
201
  return null;
156
202
  }
157
- return (_jsxs("nav", { className: cn('relative space-y-2 font-sans not-prose transition-opacity', { 'opacity-100': isVisible, 'opacity-0 pointer-events-none': !isVisible }, className), children: [_jsx("h3", { className: "mb-4 text-sm font-normal text-muted-foreground", children: "On this page" }), _jsx("ul", { ref: ulRef, className: "overflow-y-auto space-y-1 border-l-1", style: { maxHeight }, children: headers
158
- .filter((header) => header.depth <= maxdepth)
159
- .map((header, index) => {
160
- const depth = header.depth;
161
- const identifier = header.html_id;
162
- const paddingLeft = `${Math.max(1, depth - 1) * 12}px`;
163
- const isActive = activeId === identifier;
164
- return (_jsx("li", { children: _jsx(Link, { to: `#${identifier}`, className: cn('block relative text-sm transition-colors', 'px-2 py-1 -ml-[2px]', isActive
165
- ? 'text-foreground border-primary border-l-3 bg-primary/2'
166
- : 'text-muted-foreground border-border', 'hover:underline'), style: { paddingLeft }, onClick: (e) => {
167
- e.preventDefault();
168
- const el = document.querySelector(`#${identifier}`);
169
- if (!el)
170
- return;
171
- el.scrollIntoView({ behavior: 'smooth' });
172
- history.replaceState(undefined, '', `#${identifier}`);
173
- // Changes keyboard tab-index location
174
- if (el.tabIndex === -1)
175
- el.tabIndex = -1;
176
- el.focus({ preventScroll: true });
177
- capture('document_outline_heading_clicked', {
178
- surface: 'document_outline',
179
- headingId: identifier,
180
- headingDepth: depth,
181
- headingIndex: index,
182
- headingText: toText(header),
183
- });
184
- }, children: _jsx(MyST, { ast: header.children }) }) }, index));
185
- }) })] }));
203
+ // Rows are grouped so the left rail breaks between the document headings and the backmatter.
204
+ const renderItem = (item, index) => {
205
+ const { identifier, header } = item;
206
+ const paddingLeft = `${(item.depth - baseDepth + 1) * 12}px`;
207
+ const isActive = activeId === identifier;
208
+ return (_jsx("li", { children: _jsx(Link, { to: `#${identifier}`, className: cn('block relative text-sm transition-colors', 'px-2 py-1 -ml-[2px]', isActive
209
+ ? 'text-foreground border-primary border-l-3 bg-primary/2'
210
+ : 'text-muted-foreground border-border', 'hover:underline'), style: { paddingLeft }, onClick: (e) => {
211
+ e.preventDefault();
212
+ const el = document.querySelector(`#${identifier}`);
213
+ if (!el)
214
+ return;
215
+ el.scrollIntoView({ behavior: 'smooth' });
216
+ history.replaceState(undefined, '', `#${identifier}`);
217
+ // Changes keyboard tab-index location
218
+ if (el.tabIndex === -1)
219
+ el.tabIndex = -1;
220
+ el.focus({ preventScroll: true });
221
+ capture('document_outline_heading_clicked', {
222
+ surface: 'document_outline',
223
+ headingId: identifier,
224
+ headingDepth: item.depth,
225
+ headingIndex: index,
226
+ headingText: header ? toText(header) : item.title,
227
+ });
228
+ }, children: header ? _jsx(MyST, { ast: header.children }) : item.title }) }, identifier));
229
+ };
230
+ const headingItems = items.filter((item) => item.header);
231
+ const backmatterItems = items.filter((item) => !item.header);
232
+ return (_jsxs("nav", { className: cn('relative space-y-2 font-ui transition-opacity not-prose', { 'opacity-100': isVisible, 'opacity-0 pointer-events-none': !isVisible }, className), children: [_jsx("h3", { className: "mb-4 text-sm font-normal text-muted-foreground", children: "On this page" }), _jsxs("div", { ref: scrollRef, className: "overflow-y-auto", style: { maxHeight }, children: [headingItems.length > 0 && (_jsx("ul", { className: "space-y-1 border-l-1", children: headingItems.map(renderItem) })), backmatterItems.length > 0 && (_jsx("ul", { className: "mt-4 space-y-1 lg:mt-8 border-l-1", children: backmatterItems.map((item, index) => renderItem(item, headingItems.length + index)) }))] })] }));
186
233
  }
@@ -1,26 +1,26 @@
1
1
  import * as React from 'react';
2
2
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
- declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
- declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
5
- declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
6
- declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
7
- declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
3
+ declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): React.JSX.Element;
4
+ declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): React.JSX.Element;
5
+ declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): React.JSX.Element;
6
+ declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): React.JSX.Element;
7
+ declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): React.JSX.Element;
8
8
  declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
9
9
  inset?: boolean;
10
10
  variant?: 'default' | 'destructive';
11
- }): import("react/jsx-runtime").JSX.Element;
12
- declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
13
- declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
14
- declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): import("react/jsx-runtime").JSX.Element;
11
+ }): React.JSX.Element;
12
+ declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): React.JSX.Element;
13
+ declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): React.JSX.Element;
14
+ declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): React.JSX.Element;
15
15
  declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
16
16
  inset?: boolean;
17
- }): import("react/jsx-runtime").JSX.Element;
18
- declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
19
- declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
20
- declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
17
+ }): React.JSX.Element;
18
+ declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React.JSX.Element;
19
+ declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
20
+ declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React.JSX.Element;
21
21
  declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
22
22
  inset?: boolean;
23
- }): import("react/jsx-runtime").JSX.Element;
24
- declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
23
+ }): React.JSX.Element;
24
+ declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): React.JSX.Element;
25
25
  export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
26
26
  //# sourceMappingURL=dropdown-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AAKvE,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC,2CAE1F;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,MAAM,CAAC,2CAE3D;AAED,iBAAS,mBAAmB,CAAC,EAC3B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,OAAO,CAAC,2CAE5D;AAED,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,UAAc,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,OAAO,CAAC,2CAc5D;AAED,iBAAS,iBAAiB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,KAAK,CAAC,2CAEhG;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,KAAK,EACL,OAAmB,EACnB,GAAG,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KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,GAAG,CAAC,qBAE5F;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,UAAU,CAAC,GAAG;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,qBAeA;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,UAAU,CAAC,qBAW/D;AAED,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GACvB,CAAC"}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
4
4
  import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
5
- import { cn } from '../../lib/utils';
5
+ import { cn } from '../../lib/utils.js';
6
6
  function DropdownMenu({ ...props }) {
7
7
  return _jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
8
8
  }
@@ -4,6 +4,6 @@ interface ErrorPageProps {
4
4
  description?: string;
5
5
  className?: string;
6
6
  }
7
- export declare function ErrorPage({ error, title, description, className }: ErrorPageProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function ErrorPage({ error, title, description, className }: ErrorPageProps): import("react").JSX.Element;
8
8
  export {};
9
9
  //# sourceMappingURL=error-page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-page.d.ts","sourceRoot":"","sources":["../../../src/components/ui/error-page.tsx"],"names":[],"mappings":"AAGA,UAAU,cAAc;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,cAAc,2CAmCjF"}
1
+ {"version":3,"file":"error-page.d.ts","sourceRoot":"","sources":["../../../src/components/ui/error-page.tsx"],"names":[],"mappings":"AAGA,UAAU,cAAc;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,cAAc,+BAmCjF"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { isRouteErrorResponse } from 'react-router';
3
- import { cn } from '../../lib/utils';
3
+ import { cn } from '../../lib/utils.js';
4
4
  export function ErrorPage({ error, title, description, className }) {
5
5
  let message = title || 'Oops!';
6
6
  let details = description || 'An unexpected error occurred.';
@@ -0,0 +1,23 @@
1
+ import type { ThemeFontsConfig } from '@curvenote/common';
2
+ /**
3
+ * The body font the Curvenote apps ship with when a site configures nothing. Matches the
4
+ * `--font-body` default in `@curvenote/styles/fonts.css`; this is what loads it.
5
+ */
6
+ export declare const DEFAULT_SITE_FONTS: ThemeFontsConfig;
7
+ /**
8
+ * Renders a site's configured fonts: `@font-face` rules and the `--font-*` tokens as an
9
+ * inline `<style>`, plus the Google Fonts link and preloads when the config asks for them.
10
+ *
11
+ * `defaults` is what the app loads for any slot the site leaves unset — typically
12
+ * `DEFAULT_SITE_FONTS`, so Noto Sans is only downloaded by sites that will actually show
13
+ * it. A site that sets `body` never fetches the default; one that sets only `heading`
14
+ * still gets the default body underneath it.
15
+ *
16
+ * Server-rendered from the site config, so the tokens are in the first byte of HTML and
17
+ * there is no flash of the fallback family. Renders nothing when no fonts are configured
18
+ * and no defaults are given.
19
+ */
20
+ export declare function FontStyles({ defaults }?: {
21
+ defaults?: ThemeFontsConfig;
22
+ }): import("react").JSX.Element | null;
23
+ //# sourceMappingURL=font-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font-styles.d.ts","sourceRoot":"","sources":["../../../src/components/ui/font-styles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAU1D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAEhC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAAO,sCAqC5E"}
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { buildFontCss, fontPreloads, googleFontsHref, unsetDefaultFonts, withDefaultFonts, } from '../../lib/fonts.js';
3
+ import { usePlatformSite } from '../providers/platform-providers.js';
4
+ /**
5
+ * The body font the Curvenote apps ship with when a site configures nothing. Matches the
6
+ * `--font-body` default in `@curvenote/styles/fonts.css`; this is what loads it.
7
+ */
8
+ export const DEFAULT_SITE_FONTS = {
9
+ body: { family: 'Noto Sans', source: 'google', weights: ['100..900'], italic: true },
10
+ };
11
+ /**
12
+ * Renders a site's configured fonts: `@font-face` rules and the `--font-*` tokens as an
13
+ * inline `<style>`, plus the Google Fonts link and preloads when the config asks for them.
14
+ *
15
+ * `defaults` is what the app loads for any slot the site leaves unset — typically
16
+ * `DEFAULT_SITE_FONTS`, so Noto Sans is only downloaded by sites that will actually show
17
+ * it. A site that sets `body` never fetches the default; one that sets only `heading`
18
+ * still gets the default body underneath it.
19
+ *
20
+ * Server-rendered from the site config, so the tokens are in the first byte of HTML and
21
+ * there is no flash of the fallback family. Renders nothing when no fonts are configured
22
+ * and no defaults are given.
23
+ */
24
+ export function FontStyles({ defaults } = {}) {
25
+ const site = usePlatformSite();
26
+ const fonts = site?.theme_config?.fonts;
27
+ const load = withDefaultFonts(fonts, defaults);
28
+ const css = [
29
+ buildFontCss(fonts),
30
+ buildFontCss(unsetDefaultFonts(fonts, defaults), { tokens: false }),
31
+ ]
32
+ .filter(Boolean)
33
+ .join('\n');
34
+ const google = googleFontsHref(load);
35
+ const preloads = fontPreloads(load);
36
+ if (!css && !google)
37
+ return null;
38
+ return (_jsxs(_Fragment, { children: [google && (_jsxs(_Fragment, { children: [_jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" }), _jsx("link", { rel: "stylesheet", href: google })] })), preloads.map((href) => (_jsx("link", { rel: "preload", as: "font", type: "font/woff2", href: href, crossOrigin: "anonymous" }, href))), css && _jsx("style", { dangerouslySetInnerHTML: { __html: css } })] }));
39
+ }
@@ -9,6 +9,6 @@ interface FooterLinksProps {
9
9
  next?: NavItem;
10
10
  } | null;
11
11
  }
12
- export declare function FooterLinks({ navigation }: FooterLinksProps): import("react/jsx-runtime").JSX.Element | null;
12
+ export declare function FooterLinks({ navigation }: FooterLinksProps): import("react").JSX.Element | null;
13
13
  export {};
14
14
  //# sourceMappingURL=footer-links.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"footer-links.d.ts","sourceRoot":"","sources":["../../../src/components/ui/footer-links.tsx"],"names":[],"mappings":"AAMA,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAgCD,UAAU,gBAAgB;IACxB,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,GAAG,IAAI,CAAC;CACV;AAED,wBAAgB,WAAW,CAAC,EAAE,UAAU,EAAE,EAAE,gBAAgB,kDAuB3D"}
1
+ {"version":3,"file":"footer-links.d.ts","sourceRoot":"","sources":["../../../src/components/ui/footer-links.tsx"],"names":[],"mappings":"AAMA,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAgCD,UAAU,gBAAgB;IACxB,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,GAAG,IAAI,CAAC;CACV;AAED,wBAAgB,WAAW,CAAC,EAAE,UAAU,EAAE,EAAE,gBAAgB,sCAuB3D"}
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Link } from 'react-router';
3
3
  import { ChevronLeft, ChevronRight } from 'lucide-react';
4
4
  import { useBaseurl, withBaseurl } from '@myst-theme/providers';
5
- import { cn } from '../../lib/utils';
6
- import { useDesign } from '../providers/design';
5
+ import { cn } from '../../lib/utils.js';
6
+ import { useDesign } from '../providers/design.js';
7
7
  function FooterLink({ item, align, label }) {
8
8
  const baseUrl = useBaseurl();
9
9
  const isLeft = align === 'left';
@@ -1,4 +1,4 @@
1
1
  export declare function Footnotes({ className }: {
2
2
  className?: string;
3
- }): import("react/jsx-runtime").JSX.Element | null;
3
+ }): import("react").JSX.Element | null;
4
4
  //# sourceMappingURL=footnotes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../../../src/components/ui/footnotes.tsx"],"names":[],"mappings":"AAwBA,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kDA4C9D"}
1
+ {"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../../../src/components/ui/footnotes.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,sCA4C9D"}
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useFrontmatter, useReferences } from '@myst-theme/providers';
3
3
  import { HashLink, MyST } from 'myst-to-react';
4
4
  import { selectAll } from 'unist-util-select';
5
- import { cn } from '../../lib/utils';
5
+ import { cn } from '../../lib/utils.js';
6
+ import { PART_IDS } from './types.js';
6
7
  function useFootnotes() {
7
8
  // TODO: parts as well
8
9
  const frontmatter = useFrontmatter();
@@ -22,7 +23,7 @@ export function Footnotes({ className }) {
22
23
  const footnotes = useFootnotes();
23
24
  if (!footnotes)
24
25
  return null;
25
- return (_jsxs("section", { id: "footnotes", className: cn('min-w-full prose dark:prose-invert prose-sm', className), children: [_jsxs("header", { className: "text-lg font-semibold text-stone-900 dark:text-white group", children: ["Footnotes", _jsx(HashLink, { id: "footnotes", title: "Link to Footnotes", hover: true, className: "ml-2" })] }), _jsx("div", { className: cn('pl-3 mb-8 text-xs text-stone-500 dark:text-stone-300'), children: _jsx("ol", { children: footnotes.defs.map((fn) => {
26
+ return (_jsxs("section", { id: PART_IDS.footnotes, className: cn('min-w-full prose dark:prose-invert prose-sm font-small', className), children: [_jsxs("header", { className: "text-lg font-semibold text-stone-900 dark:text-white group", children: ["Footnotes", _jsx(HashLink, { id: PART_IDS.footnotes, title: "Link to Footnotes", hover: true, className: "ml-2" })] }), _jsx("div", { className: cn('pl-3 mb-8 text-xs text-stone-500 dark:text-stone-300'), children: _jsx("ol", { children: footnotes.defs.map((fn) => {
26
27
  return (_jsx("li", { id: `fn-${fn.identifier}`, className: "group", children: _jsxs("div", { className: "flex flex-row", children: [_jsx("div", { className: "break-words grow", children: _jsx(MyST, { ast: fn.children }) }), _jsx("div", { className: "flex flex-col grow-0", children: footnotes.refs
27
28
  .filter((ref) => ref.identifier === fn.identifier)
28
29
  .map((ref) => (_jsx(HashLink, { id: `fnref-${ref.key}`, title: "Link to Content", hover: "desktop", className: "p-1", children: "\u21A9", scrollBehavior: "instant" }, ref.key))) })] }) }, fn.key));
@@ -4,34 +4,34 @@ export declare function DateString({ date, format, mobileFormat, spacer, classNa
4
4
  mobileFormat?: Intl.DateTimeFormatOptions;
5
5
  spacer?: boolean;
6
6
  className?: string;
7
- }): import("react/jsx-runtime").JSX.Element | null;
7
+ }): import("react").JSX.Element | null;
8
8
  export declare function TwitterLink({ twitter: possibleLink }: {
9
9
  twitter?: string;
10
- }): import("react/jsx-runtime").JSX.Element | null;
10
+ }): import("react").JSX.Element | null;
11
11
  export declare function GitHubLink({ github: possibleLink }: {
12
12
  github?: string;
13
- }): import("react/jsx-runtime").JSX.Element | null;
13
+ }): import("react").JSX.Element | null;
14
14
  export declare function OpenAccessBadge({ open_access, className, }: {
15
15
  open_access?: boolean;
16
16
  className?: string;
17
- }): import("react/jsx-runtime").JSX.Element | null;
17
+ }): import("react").JSX.Element | null;
18
18
  export declare function OrcidBadge({ orcid, className, authorIndex, authorName, isCorresponding, }: {
19
19
  orcid?: string;
20
20
  className?: string;
21
21
  authorIndex?: number;
22
22
  authorName?: string;
23
23
  isCorresponding?: boolean;
24
- }): import("react/jsx-runtime").JSX.Element | null;
24
+ }): import("react").JSX.Element | null;
25
25
  export declare function DoiLink({ doi: possibleLink, spacer, shortenOnSmallScreens, className, }: {
26
26
  doi?: string;
27
27
  spacer?: boolean;
28
28
  shortenOnSmallScreens?: boolean;
29
29
  className?: string;
30
- }): import("react/jsx-runtime").JSX.Element | null;
30
+ }): import("react").JSX.Element | null;
31
31
  export declare function EmailLink({ email, authorIndex, authorName, isCorresponding, }: {
32
32
  email?: string;
33
33
  authorIndex?: number;
34
34
  authorName?: string;
35
35
  isCorresponding?: boolean;
36
- }): import("react/jsx-runtime").JSX.Element | null;
36
+ }): import("react").JSX.Element | null;
37
37
  //# sourceMappingURL=frontmatter-badges.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter-badges.d.ts","sourceRoot":"","sources":["../../../src/components/ui/frontmatter-badges.tsx"],"names":[],"mappings":"AAQA,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,MAIC,EACD,YAAY,EACZ,MAAM,EACN,SAAS,GACV,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IACpC,YAAY,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IAC1C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,kDAwBA;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,kDAqB1E;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,kDAqBvE;AACD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,SAAS,GACV,EAAE;IACD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,kDA0BA;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,WAAW,EACX,UAAU,EACV,eAAe,GAChB,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,kDAiCA;AAED,wBAAgB,OAAO,CAAC,EACtB,GAAG,EAAE,YAAY,EACjB,MAAM,EACN,qBAAqB,EACrB,SAAS,GACV,EAAE;IACD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,kDAuBA;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,UAAU,EACV,eAAsB,GACvB,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,kDAgCA"}
1
+ {"version":3,"file":"frontmatter-badges.d.ts","sourceRoot":"","sources":["../../../src/components/ui/frontmatter-badges.tsx"],"names":[],"mappings":"AAQA,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,MAIC,EACD,YAAY,EACZ,MAAM,EACN,SAAS,GACV,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IACpC,YAAY,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IAC1C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,sCAwBA;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,sCAqB1E;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,sCAqBvE;AACD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,SAAS,GACV,EAAE;IACD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,sCA0BA;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,WAAW,EACX,UAAU,EACV,eAAe,GAChB,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,sCAiCA;AAED,wBAAgB,OAAO,CAAC,EACtB,GAAG,EAAE,YAAY,EACjB,MAAM,EACN,qBAAqB,EACrB,SAAS,GACV,EAAE;IACD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,sCAuBA;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,UAAU,EACV,eAAsB,GACvB,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,sCAgCA"}
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { OpenAccessIcon, GithubIcon, XIcon, OrcidIcon } from '@scienceicons/react/24/solid';
3
- import { cn } from '../../lib/utils';
4
- import { SimpleTooltip } from './tooltip';
3
+ import { cn } from '../../lib/utils.js';
4
+ import { SimpleTooltip } from './tooltip.js';
5
5
  import { Mail } from 'lucide-react';
6
- import { HashLink } from './hash-link';
7
- import { PART_IDS } from './types';
8
- import { useAnalytics } from '../providers';
6
+ import { HashLink } from './hash-link.js';
7
+ import { PART_IDS } from './types.js';
8
+ import { useAnalytics } from '../providers/index.js';
9
9
  export function DateString({ date, format = {
10
10
  year: 'numeric',
11
11
  month: 'long',
@@ -2,6 +2,6 @@ type FrontmatterProps = {
2
2
  title?: string;
3
3
  subtitle?: string;
4
4
  };
5
- export declare function Frontmatter({ title, subtitle }: FrontmatterProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function Frontmatter({ title, subtitle }: FrontmatterProps): import("react").JSX.Element;
6
6
  export default Frontmatter;
7
7
  //# sourceMappingURL=frontmatter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../src/components/ui/frontmatter.tsx"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAOhE;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../src/components/ui/frontmatter.tsx"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAOhE;AAED,eAAe,WAAW,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from '../../lib/utils';
2
+ import { cn } from '../../lib/utils.js';
3
3
  export function Frontmatter({ title, subtitle }) {
4
4
  return (_jsxs("div", { children: [title && _jsx("h1", { className: cn({ 'mb-4': subtitle }), children: title }), subtitle && _jsx("div", { className: "mb-10 text-lg text-muted-foreground", children: subtitle })] }));
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hash-link.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IAClB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,CAAC;AAUjF,wBAAgB,eAAe,CAC7B,EAAE,EAAE,WAAW,GAAG,IAAI,EACtB,EACE,MAAe,EACf,cAAyB,EACzB,YAAwB,EACxB,WAAkB,GACnB,GAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC;CAClB,QAcP;AAGD,eAAO,MAAM,QAAQ;SA3Dd,MAAM;WACJ,MAAM;YACL,MAAM,GAAG,IAAI;eACV,SAAS;oBACJ,OAAO;YACf,OAAO,GAAG,SAAS;gBACf,MAAM;kBACJ,OAAO;qBACJ,cAAc;mBAChB,MAAM,GAAG,SAAS,GAAG,KAAK;kBAC3B,OAAO;cACX,OAAO;IACjB,wEAAwE;kBAC1D,MAAM;gBACR,iBAAiB;IAC7B;;;OAGG;qBACc,MAAM;oIAkIvB,CAAC"}
@@ -6,7 +6,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { useXRefState } from '@myst-theme/providers';
7
7
  import { cn } from '@curvenote/react-utils';
8
8
  import { forwardRef, useCallback, } from 'react';
9
- import { useAnalytics } from '../providers';
9
+ import { useAnalytics } from '../providers/index.js';
10
10
  function openDetails(el) {
11
11
  if (!el)
12
12
  return;
@@ -32,6 +32,7 @@ export function scrollToElement(el, { htmlId = el?.id, scrollBehavior = 'smooth'
32
32
  el.focus({ preventScroll: true });
33
33
  }
34
34
  }
35
+ // eslint-disable-next-line @typescript-eslint/no-shadow -- the render function name is the displayName
35
36
  export const HashLink = forwardRef(function HashLink({ id, kind, title = kind ? `Link to this ${kind}` : 'Link to this section', children = '¶', canSelectText = false, hover, className = 'font-normal', hideInPopup, scrollBehavior, historyState, focusTarget, noWidth, scrollDelay, analytics, analyticsEvent = 'content_hash_link_clicked', onClick, ...rest }, ref) {
36
37
  const capture = useAnalytics();
37
38
  const { inCrossRef } = useXRefState();
@@ -29,9 +29,9 @@ export declare function Picture({ ref, className, src, srcOptimized, urlSource,
29
29
  onLoad?: () => void;
30
30
  onLoadedData?: () => void;
31
31
  onError?: () => void;
32
- }): import("react/jsx-runtime").JSX.Element;
32
+ }): React.JSX.Element;
33
33
  export declare function Image({ src, srcOptimized, urlSource, alt, className, showLightbox, width, height, align, caption, onLightboxOpen, onError, }: ImageProps & {
34
34
  caption?: string | GenericParent;
35
- }): import("react/jsx-runtime").JSX.Element;
35
+ }): React.JSX.Element;
36
36
  export {};
37
37
  //# sourceMappingURL=image.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/ui/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO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AC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,qBA+CA;AAED,wBAAgB,KAAK,CAAC,EACpB,GAAG,EACH,YAAY,EACZ,SAAS,EACT,GAAG,EACH,SAAS,EACT,YAAmB,EACnB,KAAK,EACL,MAAM,EACN,KAAgB,EAChB,OAAO,EACP,cAAc,EACd,OAAO,GACR,EAAE,UAAU,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,qBAyCnD"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { cn } from '../../lib/utils';
4
- import { useLightbox } from '../providers/lightbox-provider';
5
- import { OverlayInteractionDepthContext } from '../providers/overlay-depth';
3
+ import { cn } from '../../lib/utils.js';
4
+ import { useLightbox } from '../providers/lightbox-provider.js';
5
+ import { OverlayInteractionDepthContext } from '../providers/overlay-depth.js';
6
6
  function getStyleValue(width) {
7
7
  if (typeof width === 'number' && Number.isNaN(width)) {
8
8
  // If it is nan, return undefined.