@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.
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -3
- package/dist/components/layout/app-layout.d.ts +3 -3
- package/dist/components/layout/app-layout.d.ts.map +1 -1
- package/dist/components/layout/app-layout.js +19 -15
- package/dist/components/layout/app-sidebar.d.ts +2 -1
- package/dist/components/layout/app-sidebar.d.ts.map +1 -1
- package/dist/components/layout/app-sidebar.js +8 -8
- package/dist/components/layout/article-layout.d.ts +3 -3
- package/dist/components/layout/article-layout.d.ts.map +1 -1
- package/dist/components/layout/article-layout.js +17 -10
- package/dist/components/layout/grid.d.ts +1 -1
- package/dist/components/layout/grid.d.ts.map +1 -1
- package/dist/components/layout/header.d.ts +5 -3
- package/dist/components/layout/header.d.ts.map +1 -1
- package/dist/components/layout/header.js +6 -3
- package/dist/components/layout/index.d.ts +7 -7
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +7 -7
- package/dist/components/layout/layout-header.d.ts +9 -0
- package/dist/components/layout/layout-header.d.ts.map +1 -0
- package/dist/components/layout/layout-header.js +13 -0
- package/dist/components/layout/loading-bar.d.ts +1 -1
- package/dist/components/layout/loading-bar.d.ts.map +1 -1
- package/dist/components/layout/loading-bar.js +1 -1
- package/dist/components/layout/site-header.d.ts +1 -1
- package/dist/components/layout/site-header.d.ts.map +1 -1
- package/dist/components/layout/site-header.js +18 -8
- package/dist/components/layout/types.d.ts +6 -0
- package/dist/components/layout/types.d.ts.map +1 -1
- package/dist/components/providers/analytics-boundary.d.ts +1 -1
- package/dist/components/providers/analytics-boundary.d.ts.map +1 -1
- package/dist/components/providers/analytics-boundary.js +3 -3
- package/dist/components/providers/analytics-dev-tray.d.ts +1 -1
- package/dist/components/providers/analytics-dev-tray.d.ts.map +1 -1
- package/dist/components/providers/analytics-dev-tray.js +3 -3
- package/dist/components/providers/article-versions-provider.d.ts +1 -1
- package/dist/components/providers/article-versions-provider.d.ts.map +1 -1
- package/dist/components/providers/compute.d.ts +1 -1
- package/dist/components/providers/compute.d.ts.map +1 -1
- package/dist/components/providers/curvenote-providers.d.ts +14 -18
- package/dist/components/providers/curvenote-providers.d.ts.map +1 -1
- package/dist/components/providers/curvenote-providers.js +10 -10
- package/dist/components/providers/design.d.ts +1 -1
- package/dist/components/providers/design.d.ts.map +1 -1
- package/dist/components/providers/design.js +2 -1
- package/dist/components/providers/index.d.ts +11 -11
- package/dist/components/providers/index.d.ts.map +1 -1
- package/dist/components/providers/index.js +11 -11
- package/dist/components/providers/lightbox-provider.d.ts +1 -1
- package/dist/components/providers/lightbox-provider.d.ts.map +1 -1
- package/dist/components/providers/myst-providers.d.ts +1 -1
- package/dist/components/providers/myst-providers.d.ts.map +1 -1
- package/dist/components/providers/overlay-depth.d.ts +1 -1
- package/dist/components/providers/overlay-depth.d.ts.map +1 -1
- package/dist/components/providers/page-providers.d.ts +2 -2
- package/dist/components/providers/page-providers.d.ts.map +1 -1
- package/dist/components/providers/ping-boundary.d.ts +1 -1
- package/dist/components/providers/ping-boundary.d.ts.map +1 -1
- package/dist/components/providers/platform-providers.d.ts +1 -1
- package/dist/components/providers/platform-providers.d.ts.map +1 -1
- package/dist/components/ui/Callout.d.ts +1 -1
- package/dist/components/ui/Callout.d.ts.map +1 -1
- package/dist/components/ui/Callout.js +1 -1
- package/dist/components/ui/PageCards.d.ts +2 -1
- package/dist/components/ui/PageCards.d.ts.map +1 -1
- package/dist/components/ui/abbreviations.d.ts +2 -1
- package/dist/components/ui/abbreviations.d.ts.map +1 -1
- package/dist/components/ui/abbreviations.js +7 -14
- package/dist/components/ui/abstract.d.ts +1 -1
- package/dist/components/ui/abstract.d.ts.map +1 -1
- package/dist/components/ui/accessibility-skip-to.d.ts +3 -3
- package/dist/components/ui/accessibility-skip-to.d.ts.map +1 -1
- package/dist/components/ui/accessibility-skip-to.js +1 -1
- package/dist/components/ui/acknowledgements.d.ts +1 -1
- package/dist/components/ui/acknowledgements.d.ts.map +1 -1
- package/dist/components/ui/acknowledgements.js +4 -4
- package/dist/components/ui/arrow.d.ts +3 -3
- package/dist/components/ui/arrow.d.ts.map +1 -1
- package/dist/components/ui/article-actions-downloads.d.ts +24 -3
- package/dist/components/ui/article-actions-downloads.d.ts.map +1 -1
- package/dist/components/ui/article-actions-downloads.js +58 -16
- package/dist/components/ui/article-actions-dropdown.d.ts +1 -1
- package/dist/components/ui/article-actions-dropdown.d.ts.map +1 -1
- package/dist/components/ui/article-actions-dropdown.js +9 -9
- package/dist/components/ui/article-actions-share.d.ts +1 -1
- package/dist/components/ui/article-actions-share.d.ts.map +1 -1
- package/dist/components/ui/article-actions-share.js +2 -2
- package/dist/components/ui/article-actions.d.ts +1 -1
- package/dist/components/ui/article-actions.d.ts.map +1 -1
- package/dist/components/ui/article-actions.js +29 -8
- package/dist/components/ui/article-bar.d.ts +16 -3
- package/dist/components/ui/article-bar.d.ts.map +1 -1
- package/dist/components/ui/article-bar.js +9 -7
- package/dist/components/ui/article-card.d.ts +1 -1
- package/dist/components/ui/article-card.d.ts.map +1 -1
- package/dist/components/ui/article-card.js +2 -2
- package/dist/components/ui/article-footer.d.ts +1 -1
- package/dist/components/ui/article-footer.d.ts.map +1 -1
- package/dist/components/ui/article-footer.js +1 -1
- package/dist/components/ui/author-popover.d.ts +1 -1
- package/dist/components/ui/author-popover.d.ts.map +1 -1
- package/dist/components/ui/author-popover.js +3 -3
- package/dist/components/ui/backmatter.d.ts +41 -3
- package/dist/components/ui/backmatter.d.ts.map +1 -1
- package/dist/components/ui/backmatter.js +117 -34
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/banner.d.ts +22 -1
- package/dist/components/ui/banner.d.ts.map +1 -1
- package/dist/components/ui/banner.js +44 -3
- package/dist/components/ui/bibliography.d.ts +1 -1
- package/dist/components/ui/bibliography.d.ts.map +1 -1
- package/dist/components/ui/bibliography.js +3 -3
- package/dist/components/ui/breadcrumb.d.ts +7 -7
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/calendar.d.ts +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/citation.d.ts +2 -2
- package/dist/components/ui/citation.d.ts.map +1 -1
- package/dist/components/ui/citation.js +5 -5
- package/dist/components/ui/collapsible-backmatter-section.d.ts +2 -2
- package/dist/components/ui/collapsible-backmatter-section.d.ts.map +1 -1
- package/dist/components/ui/collapsible-backmatter-section.js +3 -3
- package/dist/components/ui/collapsible.d.ts +3 -3
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/cookie-banner.d.ts +2 -1
- package/dist/components/ui/cookie-banner.d.ts.map +1 -1
- package/dist/components/ui/cookie-banner.js +4 -4
- package/dist/components/ui/data-availability.d.ts +1 -1
- package/dist/components/ui/data-availability.d.ts.map +1 -1
- package/dist/components/ui/data-availability.js +4 -4
- package/dist/components/ui/dhr-cta-buttons.d.ts +30 -0
- package/dist/components/ui/dhr-cta-buttons.d.ts.map +1 -0
- package/dist/components/ui/dhr-cta-buttons.js +40 -0
- package/dist/components/ui/dialog.d.ts +10 -10
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/document-outline.d.ts +11 -2
- package/dist/components/ui/document-outline.d.ts.map +1 -1
- package/dist/components/ui/document-outline.js +101 -54
- package/dist/components/ui/dropdown-menu.d.ts +15 -15
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/error-page.d.ts +1 -1
- package/dist/components/ui/error-page.d.ts.map +1 -1
- package/dist/components/ui/error-page.js +1 -1
- package/dist/components/ui/font-styles.d.ts +23 -0
- package/dist/components/ui/font-styles.d.ts.map +1 -0
- package/dist/components/ui/font-styles.js +39 -0
- package/dist/components/ui/footer-links.d.ts +1 -1
- package/dist/components/ui/footer-links.d.ts.map +1 -1
- package/dist/components/ui/footer-links.js +2 -2
- package/dist/components/ui/footnotes.d.ts +1 -1
- package/dist/components/ui/footnotes.d.ts.map +1 -1
- package/dist/components/ui/footnotes.js +3 -2
- package/dist/components/ui/frontmatter-badges.d.ts +7 -7
- package/dist/components/ui/frontmatter-badges.d.ts.map +1 -1
- package/dist/components/ui/frontmatter-badges.js +5 -5
- package/dist/components/ui/frontmatter.d.ts +1 -1
- package/dist/components/ui/frontmatter.d.ts.map +1 -1
- package/dist/components/ui/frontmatter.js +1 -1
- package/dist/components/ui/hash-link.d.ts.map +1 -1
- package/dist/components/ui/hash-link.js +2 -1
- package/dist/components/ui/image.d.ts +2 -2
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +3 -3
- package/dist/components/ui/index.d.ts +61 -57
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +58 -56
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/keywords.d.ts +1 -1
- package/dist/components/ui/keywords.d.ts.map +1 -1
- package/dist/components/ui/keywords.js +3 -3
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/license-description.d.ts +1 -1
- package/dist/components/ui/license-description.d.ts.map +1 -1
- package/dist/components/ui/license-description.js +3 -3
- package/dist/components/ui/license-frontmatter.d.ts +2 -2
- package/dist/components/ui/license-frontmatter.d.ts.map +1 -1
- package/dist/components/ui/license-frontmatter.js +4 -4
- package/dist/components/ui/lightbox-container.d.ts +2 -2
- package/dist/components/ui/lightbox-container.d.ts.map +1 -1
- package/dist/components/ui/lightbox-container.js +2 -2
- package/dist/components/ui/lightbox.d.ts +3 -2
- package/dist/components/ui/lightbox.d.ts.map +1 -1
- package/dist/components/ui/lightbox.js +6 -6
- package/dist/components/ui/link-card.d.ts +1 -1
- package/dist/components/ui/link-card.d.ts.map +1 -1
- package/dist/components/ui/link-card.js +1 -1
- package/dist/components/ui/pagination.d.ts +7 -7
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/popover.d.ts +4 -4
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/search.d.ts +1 -1
- package/dist/components/ui/search.d.ts.map +1 -1
- package/dist/components/ui/search.js +2 -2
- package/dist/components/ui/select.d.ts +10 -10
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/separator.d.ts +1 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.d.ts +8 -8
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +23 -23
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +3 -3
- package/dist/components/ui/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/sonner.d.ts +1 -1
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/theme-button.d.ts +1 -1
- package/dist/components/ui/theme-button.d.ts.map +1 -1
- package/dist/components/ui/theme-button.js +3 -3
- package/dist/components/ui/tooltip.d.ts +4 -4
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +2 -2
- package/dist/components/ui/types.d.ts +1 -0
- package/dist/components/ui/types.d.ts.map +1 -1
- package/dist/components/ui/types.js +1 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/use-theme.d.ts +1 -1
- package/dist/hooks/use-theme.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/dedupeAbbreviations.d.ts +11 -0
- package/dist/lib/dedupeAbbreviations.d.ts.map +1 -1
- package/dist/lib/dedupeAbbreviations.js +17 -0
- package/dist/lib/fonts.d.ts +29 -0
- package/dist/lib/fonts.d.ts.map +1 -0
- package/dist/lib/fonts.js +148 -0
- package/dist/lib/index.d.ts +6 -5
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +6 -5
- package/package.json +22 -4
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, Badge, } from '.';
|
|
3
|
-
import { Citation } from './citation';
|
|
2
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, Badge, } from './index.js';
|
|
3
|
+
import { Citation } from './citation.js';
|
|
4
4
|
import { useFrontmatter, useProjectManifest } from '@myst-theme/providers';
|
|
5
5
|
import { toast } from 'sonner';
|
|
6
6
|
import { doi } from 'doi-utils';
|
|
7
7
|
import { Download, Quote, Copy, Pencil, Clock, BlocksIcon, Share, Sun, Moon, Monitor, FolderCode, FileText, Scale, } from 'lucide-react';
|
|
8
|
-
import { ArticleDownloadItems, ArticleExportItems, useDownloads, triggerDirectDownload, } from './article-actions-downloads';
|
|
8
|
+
import { ArticleDownloadItems, ArticleExportItems, useDownloads, triggerDirectDownload, } from './article-actions-downloads.js';
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { ArticleActionsShare, useVisibleShareOptions } from './article-actions-share';
|
|
10
|
+
import { ArticleActionsShare, useVisibleShareOptions } from './article-actions-share.js';
|
|
11
11
|
import { useTheme } from 'next-themes';
|
|
12
|
-
import { useAnalytics, useDesign } from '../providers';
|
|
13
|
-
import { useArticleVersions } from '../providers/article-versions-provider';
|
|
14
|
-
import { HashLink } from './hash-link';
|
|
15
|
-
import { PART_IDS } from './types';
|
|
12
|
+
import { useAnalytics, useDesign } from '../providers/index.js';
|
|
13
|
+
import { useArticleVersions } from '../providers/article-versions-provider.js';
|
|
14
|
+
import { HashLink } from './hash-link.js';
|
|
15
|
+
import { PART_IDS } from './types.js';
|
|
16
16
|
function formatDate(dateStr) {
|
|
17
17
|
return new Date(dateStr).toLocaleDateString('en-US', {
|
|
18
18
|
month: 'short',
|
|
@@ -107,7 +107,7 @@ export function ArticleActionsDropdown({ children, onOpenChange, }) {
|
|
|
107
107
|
article?.license ||
|
|
108
108
|
article?.open_access ||
|
|
109
109
|
article?.copyright);
|
|
110
|
-
return (_jsxs(DropdownMenu, { onOpenChange: onOpenChange, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: children }), _jsxs(DropdownMenuContent, { className: "w-56", align: "end", children: [_jsx(DropdownMenuLabel, { children: "Article Actions" }), _jsx(DropdownMenuSeparator, {}), hasSinglePdfDownload && singlePdfDownload ? (link_downloads ? (_jsx(DropdownMenuItem, { asChild: true, children: _jsxs("a", { href: singlePdfDownload.url, download: singlePdfDownload.filename, target: "_blank", rel: "noopener noreferrer", onClick: () => capture('article_download', {
|
|
110
|
+
return (_jsxs(DropdownMenu, { onOpenChange: onOpenChange, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: children }), _jsxs(DropdownMenuContent, { className: "w-56 font-ui", align: "end", children: [_jsx(DropdownMenuLabel, { children: "Article Actions" }), _jsx(DropdownMenuSeparator, {}), hasSinglePdfDownload && singlePdfDownload ? (link_downloads ? (_jsx(DropdownMenuItem, { asChild: true, children: _jsxs("a", { href: singlePdfDownload.url, download: singlePdfDownload.filename, target: "_blank", rel: "noopener noreferrer", onClick: () => capture('article_download', {
|
|
111
111
|
action: 'clicked',
|
|
112
112
|
category: 'download',
|
|
113
113
|
format: 'pdf',
|
|
@@ -18,6 +18,6 @@ export declare function useVisibleShareOptions(): {
|
|
|
18
18
|
export declare function ArticleActionsShare({ url, title }: {
|
|
19
19
|
url?: string;
|
|
20
20
|
title: string;
|
|
21
|
-
}):
|
|
21
|
+
}): React.JSX.Element;
|
|
22
22
|
export {};
|
|
23
23
|
//# sourceMappingURL=article-actions-share.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article-actions-share.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-actions-share.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAavD,KAAK,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,GAAG,GAAG,OAAO,CAAC;AAoE1E;;;;GAIG;AACH,wBAAgB,sBAAsB;UAtE9B,MAAM;iBACC,gBAAgB;aACpB,MAAM,aAAa;UACtB,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;YACzC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM;IAsE/C;AAED,wBAAgB,mBAAmB,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"article-actions-share.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-actions-share.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAavD,KAAK,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,GAAG,GAAG,OAAO,CAAC;AAoE1E;;;;GAIG;AACH,wBAAgB,sBAAsB;UAtE9B,MAAM;iBACC,gBAAgB;aACpB,MAAM,aAAa;UACtB,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;YACzC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM;IAsE/C;AAED,wBAAgB,mBAAmB,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,qBAqClF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import { DropdownMenuItem } from '.';
|
|
3
|
+
import { DropdownMenuItem } from './index.js';
|
|
4
4
|
import { BlueskyIcon,
|
|
5
5
|
// RedditIcon,
|
|
6
6
|
// FacebookIcon,
|
|
7
7
|
LinkedinIcon, XIcon, EmailIcon, SembleIcon, } from '@scienceicons/react/24/solid';
|
|
8
|
-
import { useAnalytics, useDesign } from '../providers';
|
|
8
|
+
import { useAnalytics, useDesign } from '../providers/index.js';
|
|
9
9
|
const SHARE_OPTIONS = [
|
|
10
10
|
{
|
|
11
11
|
name: 'Bluesky',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function ArticleActions(): import("react
|
|
1
|
+
export declare function ArticleActions(): import("react").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=article-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article-actions.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-actions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"article-actions.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-actions.tsx"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,gCAyJ7B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, SimpleTooltip } from '.';
|
|
2
|
+
import { Button, SimpleTooltip } from './index.js';
|
|
3
3
|
import { QuoteIcon, EllipsisVerticalIcon, SearchIcon, FileDown } from 'lucide-react';
|
|
4
|
-
import { Citation } from './citation';
|
|
5
|
-
import { ArticleActionsDropdown } from './article-actions-dropdown';
|
|
6
|
-
import { useDownloads } from './article-actions-downloads';
|
|
7
|
-
import { SearchDialog } from './search';
|
|
8
|
-
import { useAnalytics, useDesign } from '../providers';
|
|
4
|
+
import { Citation } from './citation.js';
|
|
5
|
+
import { ArticleActionsDropdown } from './article-actions-dropdown.js';
|
|
6
|
+
import { getIconForFormat, handleDownload, useDownloads } from './article-actions-downloads.js';
|
|
7
|
+
import { SearchDialog } from './search.js';
|
|
8
|
+
import { useAnalytics, useDesign } from '../providers/index.js';
|
|
9
9
|
import { useBaseurl, withBaseurl } from '@myst-theme/providers';
|
|
10
10
|
export function ArticleActions() {
|
|
11
11
|
const { projectDownloads, articleDownloads } = useDownloads();
|
|
@@ -16,12 +16,20 @@ export function ArticleActions() {
|
|
|
16
16
|
const allDownloads = [...projectDownloads, ...articleDownloads];
|
|
17
17
|
// Find PDF download
|
|
18
18
|
const pdfDownload = allDownloads.find((download) => download.format?.toLowerCase() === 'pdf' || download.url?.toLowerCase().endsWith('.pdf'));
|
|
19
|
+
const restOfDownloads = allDownloads.filter((download) => download !== pdfDownload);
|
|
20
|
+
// `article_bar_downloads` may be a number, capping how many downloads get their own button
|
|
21
|
+
const barDownloadLimit = typeof design.article_bar_downloads === 'number'
|
|
22
|
+
? Math.max(0, design.article_bar_downloads)
|
|
23
|
+
: design.article_bar_downloads
|
|
24
|
+
? restOfDownloads.length
|
|
25
|
+
: 0;
|
|
26
|
+
const barDownloads = restOfDownloads.slice(0, barDownloadLimit);
|
|
19
27
|
const pdfDownloadScope = pdfDownload && projectDownloads.includes(pdfDownload) ? 'project' : 'article';
|
|
20
28
|
// When nice_pdf_links is disabled, always use the server-provided download URL rather than the
|
|
21
29
|
// rewritten `{baseurl}.pdf` link, which may not resolve in environments like theme previews.
|
|
22
30
|
const useNicePdfLink = design.nice_pdf_links !== false;
|
|
23
31
|
const pdfDownloadUrl = useNicePdfLink && baseurl ? withBaseurl('.pdf', baseurl) : pdfDownload?.url;
|
|
24
|
-
return (_jsxs("div", { className: "flex gap-2 items-center", children: [!design.hide_search && (_jsx(SearchDialog, { onOpenChange: (open) => open && capture('search_opened', { surface: 'article_bar' }), children: _jsx(SimpleTooltip, { title: "Search", children: _jsx(Button, { variant: "outline", size: "icon", "aria-label": "Search", asChild: true, children: _jsx("div", { children: _jsx(SearchIcon, {}) }) }) }) })), pdfDownload && (_jsx(SimpleTooltip, { title: "Download PDF", children: _jsx(Button, { variant: "outline", className: "hidden
|
|
32
|
+
return (_jsxs("div", { className: "flex gap-2 items-center", children: [!design.hide_search && (_jsx(SearchDialog, { onOpenChange: (open) => open && capture('search_opened', { surface: 'article_bar' }), children: _jsx(SimpleTooltip, { title: "Search", children: _jsx(Button, { variant: "outline", size: "icon", "aria-label": "Search", asChild: true, children: _jsx("div", { children: _jsx(SearchIcon, {}) }) }) }) })), pdfDownload && (_jsx(SimpleTooltip, { title: "Download PDF", children: _jsx(Button, { variant: "outline", className: "hidden sm:inline-flex", size: "icon", "aria-label": "Download PDF", asChild: true, children: _jsx("a", { href: pdfDownloadUrl, target: "_blank", rel: "noopener noreferrer", onClick: () => capture('article_download', {
|
|
25
33
|
action: 'clicked',
|
|
26
34
|
category: 'download',
|
|
27
35
|
format: 'pdf',
|
|
@@ -29,5 +37,18 @@ export function ArticleActions() {
|
|
|
29
37
|
downloadFilename: pdfDownload.filename,
|
|
30
38
|
scope: pdfDownloadScope,
|
|
31
39
|
surface: 'article_bar_button',
|
|
32
|
-
}), children: _jsx(FileDown, {}) }) }) })),
|
|
40
|
+
}), children: _jsx(FileDown, {}) }) }) })), barDownloads.length > 0 && (_jsx("div", { className: "flex hidden gap-2 sm:inline-flex", children: barDownloads.map((download) => {
|
|
41
|
+
const Icon = getIconForFormat(download.format, download.filename);
|
|
42
|
+
const downloadScope = projectDownloads.includes(download) ? 'project' : 'article';
|
|
43
|
+
return (_jsx(SimpleTooltip, { title: download.title
|
|
44
|
+
? `${download.title}${download.filename ? ` (${download.filename})` : ''}`
|
|
45
|
+
: (download.filename ?? download.format ?? ''), children: _jsx(Button, { variant: "outline", "aria-label": download.format, asChild: true, children: _jsxs("a", { href: download.url, download: download.filename, target: "_blank", rel: "noopener noreferrer", className: "no-underline", onClick: (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
handleDownload(download, capture, {
|
|
48
|
+
category: 'download',
|
|
49
|
+
scope: downloadScope,
|
|
50
|
+
surface: 'article_bar_button',
|
|
51
|
+
});
|
|
52
|
+
}, children: [_jsx(Icon, {}), _jsx("span", { className: "hidden md:max-w-[7ch] md:truncate md:inline lg:max-w-[14ch] xl:max-w-none xl:truncate-none", children: download.title ?? download.filename })] }) }) }));
|
|
53
|
+
}) })), _jsx(Citation, { onOpenChange: (open) => open && capture('article_citation_opened', { surface: 'article_bar_button' }), children: _jsx(SimpleTooltip, { title: "Cite this article", children: _jsx(Button, { variant: "outline", className: "hidden sm:inline-flex", size: "icon", "aria-label": "Cite this article", children: _jsx(QuoteIcon, {}) }) }) }), _jsx(ArticleActionsDropdown, { onOpenChange: (open) => open && capture('article_actions_menu_opened', { surface: 'article_bar' }), children: _jsx(SimpleTooltip, { title: "More article actions", children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "More article actions", children: _jsx(EllipsisVerticalIcon, {}) }) }) })] }));
|
|
33
54
|
}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
export declare function AuthorsList({ source }: {
|
|
2
2
|
source?: 'project' | 'article';
|
|
3
|
-
}): import("react
|
|
4
|
-
export declare function ArticleBar({ source, sticky, tight, className, }: {
|
|
3
|
+
}): import("react").JSX.Element | null;
|
|
4
|
+
export declare function ArticleBar({ source, sticky, tight, className, date: dateOverride, doi: doiOverride, }: {
|
|
5
5
|
source?: 'project' | 'article';
|
|
6
6
|
sticky?: 'top' | 'bottom';
|
|
7
7
|
tight?: boolean;
|
|
8
8
|
className?: string;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Override the manifest's date/DOI. The platform apps pass the published work's values
|
|
11
|
+
* here so the bar agrees with the page's `<meta>` tags — the content's own frontmatter
|
|
12
|
+
* is what the author typed and is not updated by publishing.
|
|
13
|
+
*
|
|
14
|
+
* Stopgap. The `work ?? project ?? page` resolution is repeated in every route that
|
|
15
|
+
* has a work, and components that only see the MyST providers cannot do it themselves.
|
|
16
|
+
* A provider for the published work plus a `useArticleMetadata()` that surfaces the
|
|
17
|
+
* merged record would let this bar, `AuthorsList`, `<meta>` and analytics all read one
|
|
18
|
+
* value — see plans/article-metadata-provider.md.
|
|
19
|
+
*/
|
|
20
|
+
date?: string;
|
|
21
|
+
doi?: string;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
10
23
|
//# sourceMappingURL=article-bar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article-bar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-bar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"article-bar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-bar.tsx"],"names":[],"mappings":"AAuDA,wBAAgB,WAAW,CAAC,EAAE,MAAkB,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,sCAcrF;AAED,wBAAgB,UAAU,CAAC,EACzB,MAAkB,EAClB,MAAM,EACN,KAAa,EACb,SAAS,EACT,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,WAAW,GACjB,EAAE;IACD,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,+BA0DA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AuthorPopover } from './author-popover';
|
|
3
|
-
import { DateString, DoiLink, EmailLink, OpenAccessBadge, OrcidBadge } from './frontmatter-badges';
|
|
4
|
-
import { LicenseBadges } from './license-frontmatter';
|
|
5
|
-
import { ArticleActions } from './article-actions';
|
|
2
|
+
import { AuthorPopover } from './author-popover.js';
|
|
3
|
+
import { DateString, DoiLink, EmailLink, OpenAccessBadge, OrcidBadge, } from './frontmatter-badges.js';
|
|
4
|
+
import { LicenseBadges } from './license-frontmatter.js';
|
|
5
|
+
import { ArticleActions } from './article-actions.js';
|
|
6
6
|
import { useFrontmatter, useProjectManifest } from '@myst-theme/providers';
|
|
7
7
|
import { cn } from '@curvenote/react-utils';
|
|
8
8
|
function AuthorsPopoverList({ authors = [], affiliations = [], }) {
|
|
@@ -24,17 +24,19 @@ export function AuthorsList({ source = 'article' }) {
|
|
|
24
24
|
}
|
|
25
25
|
return (_jsx(AuthorsPopoverList, { authors: frontmatter.authors, affiliations: frontmatter.affiliations }));
|
|
26
26
|
}
|
|
27
|
-
export function ArticleBar({ source = 'article', sticky, tight = false, className, }) {
|
|
27
|
+
export function ArticleBar({ source = 'article', sticky, tight = false, className, date: dateOverride, doi: doiOverride, }) {
|
|
28
28
|
const project = useProjectManifest();
|
|
29
29
|
const page = useFrontmatter();
|
|
30
30
|
const frontmatter = source === 'project' ? project : page;
|
|
31
|
+
const date = dateOverride ?? frontmatter?.date;
|
|
32
|
+
const doi = doiOverride ?? frontmatter?.doi;
|
|
31
33
|
return (_jsx("div", { className: cn('pointer-events-none', {
|
|
32
34
|
'my-4': !tight,
|
|
33
35
|
'sticky top-0 pb-4': sticky === 'top',
|
|
34
36
|
'sticky bottom-0 pt-4': sticky === 'bottom',
|
|
35
37
|
// Add a full-width gradient fade-in pseudo element when sticky bottom
|
|
36
38
|
'before:absolute before:top-0 before:left-0 before:w-full before:h-4 before:pointer-events-none before:z-[-1] before:content-[""] before:bg-linear-to-t before:from-background before:to-transparent': sticky === 'bottom',
|
|
37
|
-
}, className), children: _jsxs("div", { className: cn('flex flex-row items-center py-3 bg-background border-y border-border', 'pointer-events-auto'), children: [_jsx("div", { className: "flex flex-col flex-1 gap-1", children: _jsxs("div", { className: "flex gap-1 items-center pl-3
|
|
39
|
+
}, className), children: _jsxs("div", { className: cn('flex flex-row items-center py-3 bg-background border-y border-border font-ui', 'pointer-events-auto'), children: [_jsx("div", { className: "flex flex-col flex-1 gap-1", children: _jsxs("div", { className: "flex gap-1 items-center pl-3 text-sm text-muted-foreground", children: [date && (_jsx(DateString, { date: date, spacer: !!doi, format: {
|
|
38
40
|
year: 'numeric',
|
|
39
41
|
month: 'long',
|
|
40
42
|
day: 'numeric',
|
|
@@ -42,5 +44,5 @@ export function ArticleBar({ source = 'article', sticky, tight = false, classNam
|
|
|
42
44
|
year: 'numeric',
|
|
43
45
|
month: 'short',
|
|
44
46
|
day: 'numeric',
|
|
45
|
-
} })),
|
|
47
|
+
} })), doi && _jsx(DoiLink, { doi: doi, shortenOnSmallScreens: true }), _jsx(LicenseBadges, { license: frontmatter?.license, className: "hidden sm:inline-block" }), _jsx(OpenAccessBadge, { open_access: frontmatter?.open_access, className: "hidden sm:inline-block" })] }) }), _jsx(ArticleActions, {})] }) }));
|
|
46
48
|
}
|
|
@@ -7,6 +7,6 @@ interface ArticleCardProps {
|
|
|
7
7
|
showDoi?: boolean;
|
|
8
8
|
showDate?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare function ArticleCard({ to, article, showThumbnails, showAuthors, showDoi, showDate, }: ArticleCardProps): import("react
|
|
10
|
+
export declare function ArticleCard({ to, article, showThumbnails, showAuthors, showDoi, showDate, }: ArticleCardProps): import("react").JSX.Element;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=article-card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article-card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-card.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CACd,IAAI,CACF,cAAc,EACd,IAAI,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,KAAK,GAAG,OAAO,CACrF,CACF,CAAC;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,OAAO,EACP,cAAc,EACd,WAAW,EACX,OAAe,EACf,QAAgB,GACjB,EAAE,gBAAgB
|
|
1
|
+
{"version":3,"file":"article-card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-card.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CACd,IAAI,CACF,cAAc,EACd,IAAI,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,KAAK,GAAG,OAAO,CACrF,CACF,CAAC;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,OAAO,EACP,cAAc,EACd,WAAW,EACX,OAAe,EACf,QAAgB,GACjB,EAAE,gBAAgB,+BAmGlB"}
|
|
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Link } from 'react-router';
|
|
3
3
|
import { buildUrl } from 'doi-utils';
|
|
4
4
|
import { CurvenoteIcon } from '@scienceicons/react/24/solid';
|
|
5
|
-
import { useImageLoad } from '../../hooks';
|
|
5
|
+
import { useImageLoad } from '../../hooks/index.js';
|
|
6
6
|
export function ArticleCard({ to, article, showThumbnails, showAuthors, showDoi = false, showDate = false, }) {
|
|
7
7
|
const { imageLoaded, showPlaceholder, imgRef, handleImageLoad } = useImageLoad({
|
|
8
8
|
src: article.links?.thumbnail || '',
|
|
9
9
|
minDelay: 300,
|
|
10
10
|
});
|
|
11
|
-
return (_jsx(Link, { to: to, className: "block no-underline group hover:no-underline", prefetch: "intent", children: _jsx("article", { className: "overflow-hidden font-
|
|
11
|
+
return (_jsx(Link, { to: to, className: "block no-underline group hover:no-underline", prefetch: "intent", children: _jsx("article", { className: "overflow-hidden font-ui rounded-sm border transition-shadow border-gray-200/50 hover:shadow-md not-prose", children: _jsxs("div", { className: "flex", children: [showThumbnails && article.links?.thumbnail && (_jsxs("div", { className: "hidden relative w-40 shrink-0 sm:block lg:w-50 xl:w-60", children: [_jsx("div", { className: "absolute inset-0 bg-center bg-no-repeat bg-cover transition-opacity duration-750", style: {
|
|
12
12
|
backgroundImage: imageLoaded ? `url(${article.links.thumbnail})` : 'none',
|
|
13
13
|
opacity: imageLoaded ? 1 : 0,
|
|
14
14
|
} }), showPlaceholder && (_jsx("div", { className: "flex relative justify-center items-center h-full bg-gray-100 dark:bg-gray-800", children: _jsx(CurvenoteIcon, { className: "fill-gray-200 dark:fill-gray-900", height: 60, width: 60 }) })), _jsx("img", { ref: imgRef, src: article.links.thumbnail, className: "hidden", onLoad: handleImageLoad })] })), _jsxs("div", { className: "flex-1 p-6 min-w-0", children: [_jsx("div", { className: "mb-2 text-lg text-foreground", children: _jsx("span", { className: "transition-colors group-hover:text-blue-800 dark:group-hover:text-blue-500", children: article.title }) }), article.description && (_jsx("p", { className: "mb-3 text-sm font-light text-muted-foreground line-clamp-2", children: article.description })), _jsxs("div", { className: "flex flex-wrap gap-4 items-center text-xs font-light text-muted-foreground", children: [showAuthors && article.authors && article.authors.length > 0 && (_jsx("div", { className: "flex items-center", children: _jsx("span", { children: article.authors.length <= 3 ? (article.authors.map((author, index) => (_jsxs("span", { children: [author.name, index < (article.authors?.length ?? 0) - 1
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function ArticleFooter(): import("react
|
|
1
|
+
export declare function ArticleFooter(): import("react").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=article-footer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article-footer.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-footer.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"article-footer.d.ts","sourceRoot":"","sources":["../../../src/components/ui/article-footer.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,gCAc5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { JournalFooter } from '@curvenote/footers';
|
|
3
|
-
import { Backmatter, useBackmatter } from './backmatter';
|
|
3
|
+
import { Backmatter, useBackmatter } from './backmatter.js';
|
|
4
4
|
export function ArticleFooter() {
|
|
5
5
|
const backmatter = useBackmatter();
|
|
6
6
|
return (_jsxs("footer", { className: "mt-10", children: [backmatter && (_jsx("div", { className: "py-10 w-full border-t bg-stone-50/10", children: _jsx("section", { className: "px-2 max-w-full lg:max-w-screen-lg lg:mx-auto md:px-4", children: _jsx(Backmatter, {}) }) })), _jsx(JournalFooter, { className: "mt-0 bg-stone-800", brandFooter: null })] }));
|
|
@@ -4,5 +4,5 @@ export declare function AuthorPopover({ author, affiliations, className, authorI
|
|
|
4
4
|
affiliations: PageFrontmatter['affiliations'];
|
|
5
5
|
className?: string;
|
|
6
6
|
authorIndex?: number;
|
|
7
|
-
}): import("react
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=author-popover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"author-popover.d.ts","sourceRoot":"","sources":["../../../src/components/ui/author-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAuBxD,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB
|
|
1
|
+
{"version":3,"file":"author-popover.d.ts","sourceRoot":"","sources":["../../../src/components/ui/author-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAuBxD,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,+BA8IA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Popover, PopoverContent, PopoverTrigger, SimpleTooltip } from '.';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
2
|
+
import { Button, Popover, PopoverContent, PopoverTrigger, SimpleTooltip } from './index.js';
|
|
3
|
+
import { cn } from '../../lib/utils.js';
|
|
4
4
|
import { PopoverArrow } from '@radix-ui/react-popover';
|
|
5
5
|
import { Copy } from 'lucide-react';
|
|
6
6
|
import { toast } from 'sonner';
|
|
7
|
-
import { useAnalytics } from '../providers';
|
|
7
|
+
import { useAnalytics } from '../providers/index.js';
|
|
8
8
|
function Affiliation({ affiliations, affiliationId, }) {
|
|
9
9
|
const affiliation = affiliations?.find((a) => a.id === affiliationId);
|
|
10
10
|
if (!affiliation) {
|
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
import type { GenericParent } from 'myst-common';
|
|
2
2
|
import type { PageFrontmatterWithDownloads } from '@myst-theme/common';
|
|
3
|
-
|
|
3
|
+
/** Backmatter sections, in the order `Backmatter` renders them. */
|
|
4
|
+
export type BackmatterSectionId = 'acknowledgements' | 'data_availability' | 'license' | 'footnotes' | 'keywords' | 'abbreviations' | 'bibliography';
|
|
5
|
+
export type BackmatterSection = {
|
|
6
|
+
id: BackmatterSectionId;
|
|
7
|
+
/** `id` of the rendered `<section>`, for anchor links */
|
|
8
|
+
anchor: string;
|
|
9
|
+
/** Heading the section renders, e.g. for an outline entry */
|
|
10
|
+
title: string;
|
|
11
|
+
/** The page has content for this section */
|
|
12
|
+
hasContent: boolean;
|
|
13
|
+
/** The design config allows this section */
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
/** Actually rendered: has content, enabled, and backmatter is not hidden wholesale */
|
|
16
|
+
visible: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type BackmatterVisibility = {
|
|
19
|
+
/** Any section has content, whatever the design config says */
|
|
20
|
+
hasContent: boolean;
|
|
21
|
+
/** Every known section, in render order */
|
|
22
|
+
sections: BackmatterSection[];
|
|
23
|
+
/** Only the sections rendered on the page, in render order */
|
|
24
|
+
visible: BackmatterSection[];
|
|
25
|
+
/** Look up one section by id */
|
|
26
|
+
get: (id: BackmatterSectionId) => BackmatterSection;
|
|
27
|
+
};
|
|
28
|
+
type BackmatterSource = {
|
|
4
29
|
mdast?: GenericParent;
|
|
5
30
|
frontmatter?: PageFrontmatterWithDownloads;
|
|
6
|
-
}
|
|
7
|
-
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Which backmatter sections exist on the page and which of those the design config shows.
|
|
34
|
+
* Use this over `useBackmatter` when you need to know *what* is rendered, not just whether
|
|
35
|
+
* anything is — e.g. to list the sections in the document outline.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useBackmatterVisibility({ mdast, frontmatter, }?: BackmatterSource): BackmatterVisibility;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the page has any backmatter content at all, ignoring the design config.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated Prefer `useBackmatterVisibility`, which reports the individual sections and
|
|
42
|
+
* whether the design config shows them.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useBackmatter(source?: BackmatterSource): boolean;
|
|
45
|
+
export declare function Backmatter(): import("react").JSX.Element | null;
|
|
8
46
|
export default Backmatter;
|
|
9
47
|
//# sourceMappingURL=backmatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backmatter.d.ts","sourceRoot":"","sources":["../../../src/components/ui/backmatter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,aAAa,CAAC;AAS5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"backmatter.d.ts","sourceRoot":"","sources":["../../../src/components/ui/backmatter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,aAAa,CAAC;AAS5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AA6CvE,mEAAmE;AACnE,MAAM,MAAM,mBAAmB,GAC3B,kBAAkB,GAClB,mBAAmB,GACnB,SAAS,GACT,WAAW,GACX,UAAU,GACV,eAAe,GACf,cAAc,CAAC;AAEnB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,mBAAmB,CAAC;IACxB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,sFAAsF;IACtF,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,+DAA+D;IAC/D,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,8DAA8D;IAC9D,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,gCAAgC;IAChC,GAAG,EAAE,CAAC,EAAE,EAAE,mBAAmB,KAAK,iBAAiB,CAAC;CACrD,CAAC;AAyDF,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,4BAA4B,CAAC;CAC5C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,WAAW,GACZ,GAAE,gBAAqB,GAAG,oBAAoB,CA0C9C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,GAAE,gBAAqB,GAAG,OAAO,CAEpE;AAED,wBAAgB,UAAU,uCAqBzB;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useFrontmatter, useReferences } from '@myst-theme/providers';
|
|
3
|
-
import { Abbreviations } from './abbreviations';
|
|
4
|
-
import { Bibliography } from './bibliography';
|
|
5
|
-
import { Footnotes } from './footnotes';
|
|
6
|
-
import { Acknowledgements } from './acknowledgements';
|
|
7
|
-
import { DataAvailability } from './data-availability';
|
|
8
|
-
import { Keywords } from './keywords';
|
|
3
|
+
import { Abbreviations } from './abbreviations.js';
|
|
4
|
+
import { Bibliography } from './bibliography.js';
|
|
5
|
+
import { Footnotes } from './footnotes.js';
|
|
6
|
+
import { Acknowledgements } from './acknowledgements.js';
|
|
7
|
+
import { DataAvailability } from './data-availability.js';
|
|
8
|
+
import { Keywords } from './keywords.js';
|
|
9
9
|
import { selectAll } from 'unist-util-select';
|
|
10
|
-
import { extractKnownParts } from '../../lib/knownParts';
|
|
10
|
+
import { extractKnownParts } from '../../lib/knownParts.js';
|
|
11
|
+
import { selectAbbreviationEntries } from '../../lib/dedupeAbbreviations.js';
|
|
11
12
|
import { copyNode } from 'myst-common';
|
|
12
|
-
import { LicenseDescription } from './license-description';
|
|
13
|
-
import { useDesign } from '../providers/design';
|
|
14
|
-
import { SkipToAnchor } from './accessibility-skip-to';
|
|
13
|
+
import { LicenseDescription } from './license-description.js';
|
|
14
|
+
import { useDesign } from '../providers/design.js';
|
|
15
|
+
import { SkipToAnchor } from './accessibility-skip-to.js';
|
|
16
|
+
import { PART_IDS } from './types.js';
|
|
15
17
|
function getTrees(mdast, parts) {
|
|
16
18
|
return [mdast, ...Object.values(parts ?? {}).map((part) => part.mdast)].filter(Boolean);
|
|
17
19
|
}
|
|
18
20
|
function hasFootnotes(trees) {
|
|
19
|
-
|
|
21
|
+
// matches <Footnotes />, which renders only when there are definitions to list
|
|
22
|
+
return trees.some((part) => selectAll('footnoteDefinition', part).length > 0);
|
|
20
23
|
}
|
|
21
24
|
function hasAbbreviations(frontmatter, trees) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
false);
|
|
25
|
+
// matches <Abbreviations />, which lists only the abbreviations used in the text
|
|
26
|
+
return selectAbbreviationEntries(trees ?? [], frontmatter?.abbreviations).length > 0;
|
|
25
27
|
}
|
|
26
28
|
function hasBibliography(cite) {
|
|
27
29
|
return Object.keys(cite?.data ?? 0).length > 0;
|
|
@@ -33,35 +35,116 @@ function hasKeywords(frontmatter) {
|
|
|
33
35
|
const keywords = frontmatter?.keywords;
|
|
34
36
|
return Array.isArray(keywords) && keywords.length > 0;
|
|
35
37
|
}
|
|
36
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Single source of truth for backmatter: render order, anchors, titles, and the design option
|
|
40
|
+
* that gates each section. `Backmatter` and the document outline both read from this.
|
|
41
|
+
*/
|
|
42
|
+
const BACKMATTER_SECTIONS = [
|
|
43
|
+
{
|
|
44
|
+
id: 'acknowledgements',
|
|
45
|
+
anchor: PART_IDS.acknowledgements,
|
|
46
|
+
title: 'Acknowledgements',
|
|
47
|
+
enabled: (d) => !d.hide_acknowledgements,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'data_availability',
|
|
51
|
+
anchor: PART_IDS.data_availability,
|
|
52
|
+
title: 'Data Availability',
|
|
53
|
+
enabled: (d) => !d.hide_data_availability,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'license',
|
|
57
|
+
anchor: PART_IDS.license,
|
|
58
|
+
title: 'License',
|
|
59
|
+
enabled: (d) => !d.hide_license_description,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'footnotes',
|
|
63
|
+
anchor: PART_IDS.footnotes,
|
|
64
|
+
title: 'Footnotes',
|
|
65
|
+
enabled: (d) => !d.hide_footnotes,
|
|
66
|
+
},
|
|
67
|
+
// keywords are opt-in rather than opt-out
|
|
68
|
+
{
|
|
69
|
+
id: 'keywords',
|
|
70
|
+
anchor: PART_IDS.keywords,
|
|
71
|
+
title: 'Keywords',
|
|
72
|
+
enabled: (d) => d.hide_keywords === false,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'abbreviations',
|
|
76
|
+
anchor: PART_IDS.abbreviations,
|
|
77
|
+
title: 'Abbreviations',
|
|
78
|
+
enabled: (d) => d.hide_abbreviation_list !== true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'bibliography',
|
|
82
|
+
anchor: PART_IDS.bibliography,
|
|
83
|
+
title: 'References',
|
|
84
|
+
enabled: (d) => d.hide_bibliography !== true,
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
/**
|
|
88
|
+
* Which backmatter sections exist on the page and which of those the design config shows.
|
|
89
|
+
* Use this over `useBackmatter` when you need to know *what* is rendered, not just whether
|
|
90
|
+
* anything is — e.g. to list the sections in the document outline.
|
|
91
|
+
*/
|
|
92
|
+
export function useBackmatterVisibility({ mdast, frontmatter, } = {}) {
|
|
93
|
+
const design = useDesign();
|
|
37
94
|
const references = useReferences();
|
|
38
95
|
const pageFrontmatter = useFrontmatter();
|
|
39
96
|
const page = mdast ?? references?.article;
|
|
40
|
-
const
|
|
97
|
+
const resolvedFrontmatter = frontmatter ?? pageFrontmatter;
|
|
98
|
+
const parts = resolvedFrontmatter?.parts;
|
|
41
99
|
const trees = getTrees(page, parts);
|
|
42
|
-
|
|
43
|
-
const abbreviations = hasAbbreviations(frontmatter, trees);
|
|
44
|
-
const bibliography = hasBibliography(references?.cite);
|
|
45
|
-
const licenseDescription = hasLicenseDescription(pageFrontmatter);
|
|
46
|
-
const keywords = hasKeywords(frontmatter ?? pageFrontmatter);
|
|
47
|
-
// Check for acknowledgments and data availability
|
|
100
|
+
// Acknowledgements and data availability are parts of the article tree, not frontmatter
|
|
48
101
|
const tree = copyNode(page || { type: 'root', children: [] });
|
|
49
102
|
const knownParts = page ? extractKnownParts(tree, parts) : null;
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
103
|
+
const hasContent = {
|
|
104
|
+
acknowledgements: !!knownParts?.acknowledgments,
|
|
105
|
+
data_availability: !!knownParts?.data_availability,
|
|
106
|
+
license: hasLicenseDescription(resolvedFrontmatter),
|
|
107
|
+
footnotes: hasFootnotes(trees),
|
|
108
|
+
keywords: hasKeywords(resolvedFrontmatter),
|
|
109
|
+
abbreviations: hasAbbreviations(resolvedFrontmatter, trees),
|
|
110
|
+
bibliography: hasBibliography(references?.cite),
|
|
111
|
+
};
|
|
112
|
+
const sections = BACKMATTER_SECTIONS.map(({ id, anchor, title, enabled }) => {
|
|
113
|
+
const content = hasContent[id];
|
|
114
|
+
const isEnabled = enabled(design);
|
|
115
|
+
return {
|
|
116
|
+
id,
|
|
117
|
+
anchor,
|
|
118
|
+
title,
|
|
119
|
+
hasContent: content,
|
|
120
|
+
enabled: isEnabled,
|
|
121
|
+
visible: content && isEnabled && !design.hide_backmatter,
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
hasContent: sections.some((section) => section.hasContent),
|
|
126
|
+
sections,
|
|
127
|
+
visible: sections.filter((section) => section.visible),
|
|
128
|
+
get: (id) => sections.find((section) => section.id === id),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Whether the page has any backmatter content at all, ignoring the design config.
|
|
133
|
+
*
|
|
134
|
+
* @deprecated Prefer `useBackmatterVisibility`, which reports the individual sections and
|
|
135
|
+
* whether the design config shows them.
|
|
136
|
+
*/
|
|
137
|
+
export function useBackmatter(source = {}) {
|
|
138
|
+
return useBackmatterVisibility(source).hasContent;
|
|
59
139
|
}
|
|
60
140
|
export function Backmatter() {
|
|
61
141
|
const design = useDesign();
|
|
62
|
-
const
|
|
63
|
-
|
|
142
|
+
const backmatter = useBackmatterVisibility();
|
|
143
|
+
// each section still decides for itself whether it has anything to render; the table only
|
|
144
|
+
// decides whether the design config allows it
|
|
145
|
+
const enabled = (id) => backmatter.get(id).enabled;
|
|
146
|
+
if (design.hide_backmatter || !backmatter.hasContent)
|
|
64
147
|
return null;
|
|
65
|
-
return (_jsxs(_Fragment, { children: [_jsx(SkipToAnchor, { id: "skip-to-backmatter" }),
|
|
148
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkipToAnchor, { id: "skip-to-backmatter" }), enabled('acknowledgements') && _jsx(Acknowledgements, {}), enabled('data_availability') && _jsx(DataAvailability, {}), enabled('license') && _jsx(LicenseDescription, {}), enabled('footnotes') && _jsx(Footnotes, {}), enabled('keywords') && _jsx(Keywords, {}), enabled('abbreviations') && (_jsx(Abbreviations, { hideManyAbbreviations: design.hide_abbreviation_list })), enabled('bibliography') && _jsx(Bibliography, { hideManyReferences: design.hide_bibliography })] }));
|
|
66
149
|
}
|
|
67
150
|
export default Backmatter;
|
|
@@ -5,6 +5,6 @@ declare const badgeVariants: (props?: ({
|
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
7
7
|
asChild?: boolean;
|
|
8
|
-
}):
|
|
8
|
+
}): React.JSX.Element;
|
|
9
9
|
export { Badge, badgeVariants };
|
|
10
10
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;8EAiBlB,CAAC;AAEF,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAO,EACP,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;8EAiBlB,CAAC;AAEF,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAO,EACP,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,qBAM3F;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
5
|
+
import { cn } from '../../lib/utils.js';
|
|
6
6
|
const badgeVariants = cva('inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden', {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
+
import type { DesignOptions } from '@curvenote/common';
|
|
2
|
+
/**
|
|
3
|
+
* Where the banner is rendered: behind the top of the title block (`inset`), in the flow of the
|
|
4
|
+
* article (`inline`), or not at all (`none`).
|
|
5
|
+
*/
|
|
6
|
+
export type BannerStyle = NonNullable<DesignOptions['banner_style']> | 'none';
|
|
7
|
+
/**
|
|
8
|
+
* Banner placement for the current page, e.g. `useBannerStyle() === 'inset' && !!project.banner`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useBannerStyle(): BannerStyle;
|
|
1
11
|
export declare function Banner({ banner, bannerOptimized, inset, thin, }: {
|
|
2
12
|
banner: string;
|
|
3
13
|
bannerOptimized?: string;
|
|
4
14
|
inset?: boolean;
|
|
5
15
|
thin?: boolean;
|
|
6
|
-
}): import("react
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Banner rendered in the flow of the article (`banner_style: 'inline'`), sized to the body
|
|
19
|
+
* column, with an optional attribution line underneath (`banner_attribution`).
|
|
20
|
+
*
|
|
21
|
+
* Renders nothing unless the design opts in and the project actually has a banner. Like the
|
|
22
|
+
* project banner it draws from, it only appears on the project's index page — not on the other
|
|
23
|
+
* pages of a multi-page project.
|
|
24
|
+
*/
|
|
25
|
+
export declare function InlineBanner({ className }: {
|
|
26
|
+
className?: string;
|
|
27
|
+
}): import("react").JSX.Element | null;
|
|
7
28
|
//# sourceMappingURL=banner.d.ts.map
|