@myst-theme/frontmatter 0.14.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,9 @@ export declare function GitHubLink({ github: possibleLink }: {
22
22
  export declare function OpenAccessBadge({ open_access }: {
23
23
  open_access?: boolean;
24
24
  }): import("react/jsx-runtime").JSX.Element | null;
25
+ export declare function EditLink({ editUrl }: {
26
+ editUrl?: string;
27
+ }): import("react/jsx-runtime").JSX.Element | null;
25
28
  export declare function Journal({ venue, volume, issue, className, }: {
26
29
  venue?: Required<PageFrontmatter>['venue'];
27
30
  volume?: Required<PageFrontmatter>['volume'];
@@ -1 +1 @@
1
- {"version":3,"file":"FrontmatterBlock.d.ts","sourceRoot":"","sources":["../src/FrontmatterBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAyB/C,wBAAgB,OAAO,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kDAe7F;AAED,wBAAgB,QAAQ,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kDAgB9F;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,MAIC,EACD,MAAM,GACP,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,kDAiBA;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAA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Ae,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,kDAyBA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,WAAW,EACX,IAA6B,EAC7B,WAAqB,EACrB,UAAU,EACV,WAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,wBAAwB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,kDAkGA"}
@@ -6,6 +6,7 @@ import { LicenseBadges } from './licenses.js';
6
6
  import { DownloadsDropdown } from './downloads.js';
7
7
  import { AuthorAndAffiliations, AuthorsList } from './Authors.js';
8
8
  import { LaunchButton } from './LaunchButton.js';
9
+ import { PencilSquareIcon } from '@heroicons/react/24/outline';
9
10
  function ExternalOrInternalLink({ to, className, title, children, }) {
10
11
  return (_jsx("a", { href: to, className: className, title: title, children: children }));
11
12
  }
@@ -57,6 +58,11 @@ export function OpenAccessBadge({ open_access }) {
57
58
  return null;
58
59
  return (_jsx("a", { href: "https://en.wikipedia.org/wiki/Open_access", target: "_blank", rel: "noopener noreferrer", title: "Open Access", className: "text-inherit hover:text-inherit", children: _jsx(OpenAccessIcon, { width: "1.25rem", height: "1.25rem", className: "mr-1 inline-block opacity-60 hover:opacity-100 hover:text-[#E18435]" }) }));
59
60
  }
61
+ export function EditLink({ editUrl }) {
62
+ if (!editUrl)
63
+ return null;
64
+ return (_jsx("a", { href: editUrl, title: "Edit This Page", target: "_blank", rel: "noopener noreferrer", className: "text-inherit hover:text-inherit", children: _jsx(PencilSquareIcon, { width: "1.25rem", height: "1.25rem", className: "inline-block mr-1 opacity-60 hover:opacity-100" }) }));
65
+ }
60
66
  export function Journal({ venue, volume, issue, className, }) {
61
67
  if (!venue)
62
68
  return null;
@@ -68,7 +74,7 @@ export function Journal({ venue, volume, issue, className, }) {
68
74
  export function FrontmatterBlock({ frontmatter, kind = SourceFileKind.Article, authorStyle = 'block', hideBadges, hideExports, className, thebe, location, }) {
69
75
  if (!frontmatter)
70
76
  return null;
71
- const { title, subtitle, subject, doi, open_access, license, github, venue, volume, issue, exports, downloads, date, authors, enumerator, } = frontmatter;
77
+ const { title, subtitle, subject, doi, open_access, license, github, venue, volume, issue, exports, downloads, date, authors, enumerator, edit_url, } = frontmatter;
72
78
  const isJupyter = kind === SourceFileKind.Notebook;
73
79
  const hasExports = downloads ? downloads.length > 0 : exports && exports.length > 0;
74
80
  const hasAuthors = authors && authors.length > 0;
@@ -83,5 +89,5 @@ export function FrontmatterBlock({ frontmatter, kind = SourceFileKind.Article, a
83
89
  }
84
90
  return (_jsxs("div", { id: "skip-to-frontmatter", "aria-label": "article frontmatter", className: classNames(className), children: [showHeaderBlock && (_jsxs("div", { className: "flex items-center h-6 mb-5 text-sm font-light", children: [subject && (_jsx("div", { className: classNames('flex-none pr-2 smallcaps', {
85
91
  'border-r mr-2': venue,
86
- }), children: subject })), _jsx(Journal, { venue: venue, volume: volume, issue: issue }), _jsx("div", { className: "flex-grow" }), !hideBadges && (_jsxs(_Fragment, { children: [_jsx(LicenseBadges, { license: license }), _jsx(OpenAccessBadge, { open_access: open_access }), _jsx(GitHubLink, { github: github }), isJupyter && (_jsx("div", { className: "inline-block mr-1", children: _jsx(JupyterIcon, { width: "1.25rem", height: "1.25rem", className: "inline-block", title: "Jupyter Notebook" }) }))] })), !hideExports && _jsx(DownloadsDropdown, { exports: (downloads !== null && downloads !== void 0 ? downloads : exports) }), !hideLaunch && thebe && location && _jsx(LaunchButton, { thebe: thebe, location: location })] })), title && (_jsxs("h1", { className: "mb-0", children: [enumerator && _jsx("span", { className: "mr-3 select-none", children: enumerator }), title] })), subtitle && _jsx("p", { className: "mt-2 mb-0 lead text-zinc-600 dark:text-zinc-400", children: subtitle }), hasAuthors && authorStyle === 'list' && (_jsx(AuthorsList, { authors: frontmatter.authors, affiliations: frontmatter.affiliations })), hasAuthors && authorStyle === 'block' && (_jsx(AuthorAndAffiliations, { authors: frontmatter.authors, affiliations: frontmatter.affiliations })), hasDateOrDoi && (_jsxs("div", { className: "flex mt-2 text-sm font-light", children: [_jsx(DateString, { date: date, spacer: !!doi }), _jsx(DoiBadge, { doi: doi })] }))] }));
92
+ }), children: subject })), _jsx(Journal, { venue: venue, volume: volume, issue: issue }), _jsx("div", { className: "flex-grow" }), !hideBadges && (_jsxs(_Fragment, { children: [_jsx(LicenseBadges, { license: license }), _jsx(OpenAccessBadge, { open_access: open_access }), _jsx(GitHubLink, { github: github }), isJupyter && (_jsx("div", { className: "inline-block mr-1", children: _jsx(JupyterIcon, { width: "1.25rem", height: "1.25rem", className: "inline-block", title: "Jupyter Notebook" }) }))] })), _jsx(EditLink, { editUrl: edit_url !== null && edit_url !== void 0 ? edit_url : undefined }), !hideExports && _jsx(DownloadsDropdown, { exports: (downloads !== null && downloads !== void 0 ? downloads : exports) }), !hideLaunch && thebe && location && _jsx(LaunchButton, { thebe: thebe, location: location })] })), title && (_jsxs("h1", { className: "mb-0", children: [enumerator && _jsx("span", { className: "mr-3 select-none", children: enumerator }), title] })), subtitle && _jsx("p", { className: "mt-2 mb-0 lead text-zinc-600 dark:text-zinc-400", children: subtitle }), hasAuthors && authorStyle === 'list' && (_jsx(AuthorsList, { authors: frontmatter.authors, affiliations: frontmatter.affiliations })), hasAuthors && authorStyle === 'block' && (_jsx(AuthorAndAffiliations, { authors: frontmatter.authors, affiliations: frontmatter.affiliations })), hasDateOrDoi && (_jsxs("div", { className: "flex mt-2 text-sm font-light", children: [_jsx(DateString, { date: date, spacer: !!doi }), _jsx(DoiBadge, { doi: doi })] }))] }));
87
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/frontmatter",
3
- "version": "0.14.3",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",