myst-to-react 0.13.5 → 0.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/MyST.d.ts +2 -1
  2. package/dist/MyST.d.ts.map +1 -1
  3. package/dist/MyST.js +6 -6
  4. package/dist/admonitions.js +4 -4
  5. package/dist/aside.js +3 -3
  6. package/dist/basic.d.ts.map +1 -1
  7. package/dist/basic.js +67 -67
  8. package/dist/card.d.ts.map +1 -1
  9. package/dist/card.js +9 -9
  10. package/dist/cite.d.ts +2 -1
  11. package/dist/cite.d.ts.map +1 -1
  12. package/dist/cite.js +8 -8
  13. package/dist/code.d.ts.map +1 -1
  14. package/dist/code.js +6 -6
  15. package/dist/components/HoverPopover.d.ts +2 -1
  16. package/dist/components/HoverPopover.d.ts.map +1 -1
  17. package/dist/components/HoverPopover.js +3 -2
  18. package/dist/crossReference.d.ts +2 -1
  19. package/dist/crossReference.d.ts.map +1 -1
  20. package/dist/crossReference.js +8 -6
  21. package/dist/dropdown.d.ts.map +1 -1
  22. package/dist/dropdown.js +4 -4
  23. package/dist/exercise.d.ts +2 -1
  24. package/dist/exercise.d.ts.map +1 -1
  25. package/dist/exercise.js +6 -6
  26. package/dist/extensions/chemicalFormula.d.ts.map +1 -1
  27. package/dist/extensions/chemicalFormula.js +3 -2
  28. package/dist/extensions/siunits.d.ts.map +1 -1
  29. package/dist/extensions/siunits.js +2 -2
  30. package/dist/footnotes.js +2 -2
  31. package/dist/grid.d.ts.map +1 -1
  32. package/dist/grid.js +4 -4
  33. package/dist/hashLink.d.ts +1 -1
  34. package/dist/hashLink.d.ts.map +1 -1
  35. package/dist/hashLink.js +2 -1
  36. package/dist/heading.d.ts.map +1 -1
  37. package/dist/heading.js +3 -2
  38. package/dist/iframe.js +2 -2
  39. package/dist/image.d.ts.map +1 -1
  40. package/dist/image.js +4 -5
  41. package/dist/inlineError.d.ts +2 -1
  42. package/dist/inlineError.d.ts.map +1 -1
  43. package/dist/inlineError.js +3 -2
  44. package/dist/inlineExpression.d.ts.map +1 -1
  45. package/dist/inlineExpression.js +5 -4
  46. package/dist/links/github.d.ts +2 -1
  47. package/dist/links/github.d.ts.map +1 -1
  48. package/dist/links/github.js +8 -8
  49. package/dist/links/index.d.ts.map +1 -1
  50. package/dist/links/index.js +18 -17
  51. package/dist/links/ror.d.ts +2 -1
  52. package/dist/links/ror.d.ts.map +1 -1
  53. package/dist/links/ror.js +2 -2
  54. package/dist/links/rrid.d.ts +2 -1
  55. package/dist/links/rrid.d.ts.map +1 -1
  56. package/dist/links/rrid.js +2 -2
  57. package/dist/links/wiki.d.ts +2 -1
  58. package/dist/links/wiki.d.ts.map +1 -1
  59. package/dist/links/wiki.js +3 -2
  60. package/dist/math.d.ts.map +1 -1
  61. package/dist/math.js +6 -5
  62. package/dist/proof.d.ts +2 -1
  63. package/dist/proof.d.ts.map +1 -1
  64. package/dist/proof.js +4 -4
  65. package/dist/reactive.d.ts.map +1 -1
  66. package/dist/reactive.js +8 -4
  67. package/dist/tabs.d.ts +4 -2
  68. package/dist/tabs.d.ts.map +1 -1
  69. package/dist/tabs.js +8 -8
  70. package/dist/unknown.d.ts.map +1 -1
  71. package/dist/unknown.js +2 -2
  72. package/package.json +4 -4
package/dist/dropdown.js CHANGED
@@ -3,15 +3,15 @@ import { ChevronRightIcon } from '@heroicons/react/24/solid';
3
3
  import classNames from 'classnames';
4
4
  import { MyST } from './MyST.js';
5
5
  const iconClass = 'inline-block pl-2 mr-2 -translate-y-[1px]';
6
- export const SummaryTitle = ({ node }) => {
7
- return _jsx(MyST, { ast: node.children });
6
+ export const SummaryTitle = ({ node, className }) => {
7
+ return _jsx(MyST, { ast: node.children, className: className });
8
8
  };
9
9
  export function Details({ title, children, open, className, }) {
10
10
  return (_jsxs("details", { className: classNames('rounded-md my-5 shadow dark:shadow-2xl dark:shadow-neutral-900 overflow-hidden', 'bg-gray-50 dark:bg-stone-800', className), open: open, children: [_jsx("summary", { className: classNames('m-0 text-lg font-medium py-1 min-h-[2em] pl-3', 'cursor-pointer hover:shadow-[inset_0_0_0px_30px_#00000003] dark:hover:shadow-[inset_0_0_0px_30px_#FFFFFF03]', 'bg-gray-100 dark:bg-slate-900'), children: _jsxs("span", { className: "text-neutral-900 dark:text-white", children: [_jsx("span", { className: "block float-right text-sm font-thin text-neutral-700 dark:text-neutral-200", children: _jsx(ChevronRightIcon, { width: "1.5rem", height: "1.5rem", className: classNames(iconClass, 'details-toggle', 'transition-transform') }) }), title] }) }), _jsx("div", { className: "px-4 py-1 details-body", children: children })] }));
11
11
  }
12
- export const DetailsRenderer = ({ node }) => {
12
+ export const DetailsRenderer = ({ node, className }) => {
13
13
  const [title, ...rest] = node.children;
14
- return (_jsx(Details, { title: _jsx(MyST, { ast: [title] }), open: node.open, className: node.class, children: _jsx(MyST, { ast: rest }) }));
14
+ return (_jsx(Details, { title: _jsx(MyST, { ast: [title] }), open: node.open, className: classNames(node.class, className), children: _jsx(MyST, { ast: rest }) }));
15
15
  };
16
16
  const DROPDOWN_RENDERERS = {
17
17
  details: DetailsRenderer,
@@ -2,12 +2,13 @@ import type { Admonition as AdmonitionSpec } from 'myst-spec';
2
2
  import React from 'react';
3
3
  import type { NodeRenderer } from '@myst-theme/providers';
4
4
  type Color = 'gray' | 'blue' | 'green' | 'yellow' | 'orange' | 'red' | 'purple';
5
- export declare function Callout({ title, color, dropdown, children, identifier, Icon, }: {
5
+ export declare function Callout({ title, color, dropdown, children, identifier, className, Icon, }: {
6
6
  title?: React.ReactNode;
7
7
  color?: Color;
8
8
  children: React.ReactNode;
9
9
  dropdown?: boolean;
10
10
  identifier?: string;
11
+ className?: string;
11
12
  Icon?: (props: {
12
13
  width?: string;
13
14
  height?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../src/exercise.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAkEhF,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;CACxF,2CA8EA;AAED,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,cAAc,CAiCzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,cAAc,CAgCzD,CAAC;AAEF,QAAA,MAAM,kBAAkB;;;CAGvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../src/exercise.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAkEhF,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;CACxF,2CA+EA;AAED,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,cAAc,CAuCzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,cAAc,CAiCzD,CAAC;AAEF,QAAA,MAAM,kBAAkB;;;CAGvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
package/dist/exercise.js CHANGED
@@ -36,7 +36,7 @@ const HeaderElement = ({ dropdown, className, children, }) => {
36
36
  return _jsx("div", { className: className, children: children });
37
37
  };
38
38
  const iconClass = 'inline-block pl-2 mr-2 self-center flex-none';
39
- export function Callout({ title, color, dropdown, children, identifier, Icon, }) {
39
+ export function Callout({ title, color, dropdown, children, identifier, className, Icon, }) {
40
40
  return (_jsxs(WrapperElement, { id: identifier, dropdown: dropdown, className: classNames('my-5 shadow dark:bg-stone-800 overflow-hidden', 'dark:border-l-4 border-slate-400', {
41
41
  'dark:border-gray-500/60': !color || color === 'gray',
42
42
  'dark:border-blue-500/60': color === 'blue',
@@ -45,7 +45,7 @@ export function Callout({ title, color, dropdown, children, identifier, Icon, })
45
45
  'dark:border-orange-500/60': color === 'orange',
46
46
  'dark:border-red-500/60': color === 'red',
47
47
  'dark:border-purple-500/60': color === 'purple',
48
- }), children: [_jsxs(HeaderElement, { dropdown: dropdown, className: classNames('m-0 font-medium py-2 flex min-w-0', 'text-md', 'border-y dark:border-y-0', {
48
+ }, className), children: [_jsxs(HeaderElement, { dropdown: dropdown, className: classNames('m-0 font-medium py-2 flex min-w-0', 'text-md', 'border-y dark:border-y-0', {
49
49
  'bg-gray-50/80 dark:bg-slate-900': !color || color === 'gray',
50
50
  'bg-blue-50/80 dark:bg-slate-900': color === 'blue',
51
51
  'bg-green-50/80 dark:bg-slate-900': color === 'green',
@@ -65,7 +65,7 @@ export function Callout({ title, color, dropdown, children, identifier, Icon, })
65
65
  })) })), _jsx("div", { className: classNames('text-neutral-900 dark:text-white grow self-center overflow-hidden break-words', { 'ml-4': !Icon }, // No icon!
66
66
  'group'), children: title }), dropdown && (_jsx("div", { className: "self-center flex-none text-sm font-thin text-neutral-700 dark:text-neutral-200", children: _jsx(ChevronRightIcon, { width: "1.5rem", height: "1.5rem", className: classNames(iconClass, 'transition-transform details-toggle') }) }))] }), _jsx("div", { className: classNames('px-4', { 'details-body': dropdown }), children: children })] }));
67
67
  }
68
- export const ExerciseRenderer = ({ node }) => {
68
+ export const ExerciseRenderer = ({ node, className }) => {
69
69
  var _a, _b, _c;
70
70
  if (node.hidden)
71
71
  return null;
@@ -77,9 +77,9 @@ export const ExerciseRenderer = ({ node }) => {
77
77
  const identifier = node.html_id;
78
78
  const enumerator = node.enumerator;
79
79
  const titleNode = (_jsxs(_Fragment, { children: [_jsxs(HashLink, { id: identifier, kind: "Exercise", children: [node.gate === 'start' && 'Start of ', node.gate === 'end' && 'End of ', "Exercise", enumerator != null && _jsxs(_Fragment, { children: [" ", enumerator] })] }), useTitle && (_jsxs(_Fragment, { children: [' ', "(", _jsx(MyST, { ast: [title] }), ")"] }))] }));
80
- return (_jsx(Callout, { identifier: identifier, title: titleNode, color: color, dropdown: isDropdown, children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
80
+ return (_jsx(Callout, { identifier: identifier, title: titleNode, color: color, dropdown: isDropdown, className: className, children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
81
81
  };
82
- export const SolutionRenderer = ({ node }) => {
82
+ export const SolutionRenderer = ({ node, className }) => {
83
83
  var _a, _b, _c;
84
84
  if (node.hidden)
85
85
  return null;
@@ -90,7 +90,7 @@ export const SolutionRenderer = ({ node }) => {
90
90
  const useTitle = ((_c = (_b = node.children) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.type) === 'admonitionTitle';
91
91
  const identifier = node.html_id;
92
92
  const titleNode = (_jsxs(_Fragment, { children: [node.gate === 'start' && 'Start of ', node.gate === 'end' && 'End of ', _jsx(MyST, { ast: [title] }), _jsx(HashLink, { id: identifier, kind: "Solution", hover: true, hideInPopup: true, children: ' #' })] }));
93
- return (_jsx(Callout, { identifier: identifier, title: useTitle ? titleNode : undefined, color: color, dropdown: isDropdown, children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
93
+ return (_jsx(Callout, { identifier: identifier, title: useTitle ? titleNode : undefined, color: color, dropdown: isDropdown, className: className, children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
94
94
  };
95
95
  const EXERCISE_RENDERERS = {
96
96
  exercise: ExerciseRenderer,
@@ -1 +1 @@
1
- {"version":3,"file":"chemicalFormula.d.ts","sourceRoot":"","sources":["../../src/extensions/chemicalFormula.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA0B1D,eAAO,MAAM,eAAe,EAAE,YAU7B,CAAC;AAEF,QAAA,MAAM,cAAc;;CAEnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"chemicalFormula.d.ts","sourceRoot":"","sources":["../../src/extensions/chemicalFormula.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA2B1D,eAAO,MAAM,eAAe,EAAE,YAU7B,CAAC;AAEF,QAAA,MAAM,cAAc;;CAEnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
2
3
  /**
3
4
  * Separate numbers and letters so that numbers can be <sub>2</sub>
4
5
  * @param formula a string H2O
@@ -22,9 +23,9 @@ function parseFormula(formula) {
22
23
  return [...acc, `${last !== null && last !== void 0 ? last : ''}${letter}`];
23
24
  }, []);
24
25
  }
25
- export const ChemicalFormula = ({ node }) => {
26
+ export const ChemicalFormula = ({ node, className }) => {
26
27
  const parts = parseFormula(node.value);
27
- return (_jsx("span", { className: "text-inherit", "aria-roledescription": "Chemical Formula", children: parts.map((letter, index) => {
28
+ return (_jsx("span", { className: classNames('text-inherit', className), "aria-roledescription": "Chemical Formula", children: parts.map((letter, index) => {
28
29
  if (letter.match(/[0-9]/))
29
30
  return _jsx("sub", { children: letter }, index);
30
31
  return _jsx("span", { children: letter }, index);
@@ -1 +1 @@
1
- {"version":3,"file":"siunits.d.ts","sourceRoot":"","sources":["../../src/extensions/siunits.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,eAAO,MAAM,OAAO,EAAE,YAIrB,CAAC;AAEF,QAAA,MAAM,YAAY;;CAEjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"siunits.d.ts","sourceRoot":"","sources":["../../src/extensions/siunits.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,eAAO,MAAM,OAAO,EAAE,YAQrB,CAAC;AAEF,QAAA,MAAM,YAAY;;CAEjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export const SIUnits = ({ node }) => {
2
+ export const SIUnits = ({ node, className }) => {
3
3
  var _a;
4
4
  const space = node.number == null ? '' : ' ';
5
5
  const title = `${(_a = node.number) !== null && _a !== void 0 ? _a : ''}${space}${node.alt}`;
6
- return _jsx("span", { title: title, children: node.value });
6
+ return (_jsx("span", { title: title, className: className, children: node.value }));
7
7
  };
8
8
  const SI_RENDERERS = {
9
9
  si: SIUnits,
package/dist/footnotes.js CHANGED
@@ -10,9 +10,9 @@ function FootnoteDefinition({ identifier }) {
10
10
  const node = (_b = (_a = references === null || references === void 0 ? void 0 : references.footnotes) === null || _a === void 0 ? void 0 : _a[identifier]) !== null && _b !== void 0 ? _b : select(`footnoteDefinition[identifier=${identifier}]`, references === null || references === void 0 ? void 0 : references.article);
11
11
  return (_jsx(XRefProvider, { children: _jsx("div", { className: "hover-document article w-[500px] sm:max-w-[500px] px-3 text-sm", children: _jsx(MyST, { ast: node === null || node === void 0 ? void 0 : node.children }) }) }));
12
12
  }
13
- export const FootnoteReference = ({ node }) => {
13
+ export const FootnoteReference = ({ node, className }) => {
14
14
  var _a, _b;
15
- return (_jsx(HoverPopover, { openDelay: 0, card: _jsx(FootnoteDefinition, { identifier: node.identifier }), children: _jsx("span", { id: `fnref-${node.key}`, children: _jsx("sup", { className: "hover-link", children: _jsxs(HashLink, { id: `fn-${node.identifier}`, title: "Link to Footnote", scrollBehavior: "instant", canSelectText: true, children: ["[", (_b = (_a = node.enumerator) !== null && _a !== void 0 ? _a : node.number) !== null && _b !== void 0 ? _b : node.identifier, "]"] }) }) }) }));
15
+ return (_jsx(HoverPopover, { openDelay: 0, card: _jsx(FootnoteDefinition, { identifier: node.identifier }), children: _jsx("span", { id: `fnref-${node.key}`, className: className, children: _jsx("sup", { className: "hover-link", children: _jsxs(HashLink, { id: `fn-${node.identifier}`, title: "Link to Footnote", scrollBehavior: "instant", canSelectText: true, children: ["[", (_b = (_a = node.enumerator) !== null && _a !== void 0 ? _a : node.number) !== null && _b !== void 0 ? _b : node.identifier, "]"] }) }) }) }));
16
16
  };
17
17
  const FOOTNOTE_RENDERERS = {
18
18
  footnoteReference: FootnoteReference,
@@ -1 +1 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../src/grid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA6GF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,QAAQ,CAM/C,CAAC;AAEF,QAAA,MAAM,cAAc;;CAEnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../src/grid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAuHF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,QAAQ,CAM/C,CAAC;AAEF,QAAA,MAAM,cAAc;;CAEnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
package/dist/grid.js CHANGED
@@ -97,13 +97,13 @@ function gridColumnClasses(columns) {
97
97
  getColumnClassName(gridClassNames.xl, columns[3]),
98
98
  ].join(' ');
99
99
  }
100
- function Grid({ columns, children }) {
100
+ function Grid({ columns, children, className, }) {
101
101
  const gridClasses = gridColumnClasses(columns);
102
102
  const gutterClasses = 'gap-4';
103
- return (_jsx("div", { className: classNames('myst-grid grid my-5', gridClasses, gutterClasses), children: children }));
103
+ return (_jsx("div", { className: classNames('myst-grid grid my-5', gridClasses, gutterClasses, className), children: children }));
104
104
  }
105
- export const GridRenderer = ({ node }) => {
106
- return (_jsx(Grid, { columns: node.columns, children: _jsx(MyST, { ast: node.children }) }));
105
+ export const GridRenderer = ({ node, className }) => {
106
+ return (_jsx(Grid, { columns: node.columns, className: className, children: _jsx(MyST, { ast: node.children }) }));
107
107
  };
108
108
  const GRID_RENDERERS = {
109
109
  grid: GridRenderer,
@@ -14,7 +14,7 @@ export declare function HashLink({ id, kind, title, children, canSelectText, hov
14
14
  id?: string;
15
15
  kind?: string;
16
16
  title?: string;
17
- hover?: boolean;
17
+ hover?: boolean | 'desktop';
18
18
  children?: '#' | '¶' | React.ReactNode;
19
19
  canSelectText?: boolean;
20
20
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"hashLink.d.ts","sourceRoot":"","sources":["../src/hashLink.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6DAA6D;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAUF,wBAAgB,eAAe,CAC7B,EAAE,EAAE,WAAW,GAAG,IAAI,EACtB,EACE,MAAe,EACf,cAAyB,EACzB,YAAwB,EACxB,WAAkB,GACnB,GAAE;IACD,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,gBAAqB,QAe1B;AAED,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,KAA8B,EAC9B,QAAc,EACd,aAAqB,EACrB,KAAK,EACL,SAAyB,EACzB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,GACZ,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,gBAAgB,kDA6BnB"}
1
+ {"version":3,"file":"hashLink.d.ts","sourceRoot":"","sources":["../src/hashLink.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6DAA6D;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAUF,wBAAgB,eAAe,CAC7B,EAAE,EAAE,WAAW,GAAG,IAAI,EACtB,EACE,MAAe,EACf,cAAyB,EACzB,YAAwB,EACxB,WAAkB,GACnB,GAAE;IACD,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,gBAAqB,QAe1B;AAED,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,KAA8B,EAC9B,QAAc,EACd,aAAqB,EACrB,KAAK,EACL,SAAyB,EACzB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,GACZ,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,gBAAgB,kDA+BnB"}
package/dist/hashLink.js CHANGED
@@ -41,7 +41,8 @@ export function HashLink({ id, kind, title = `Link to this ${kind}`, children =
41
41
  };
42
42
  return (_jsx("a", { className: classNames('no-underline text-inherit hover:text-inherit', className, {
43
43
  'select-none': !canSelectText,
44
- 'transition-opacity opacity-0 focus:opacity-100 group-hover:opacity-70': hover,
44
+ 'transition-opacity opacity-0 focus:opacity-100 group-hover:opacity-70': hover === true,
45
+ '[@media(hover:hover)]:transition-opacity [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:focus:opacity-100 [@media(hover:hover)]:group-hover:opacity-70': hover === 'desktop',
45
46
  'hover:underline': !hover,
46
47
  }), onClick: scroll, href: `#${id}`, title: title, "aria-label": title, children: children }));
47
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../src/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA4B1D,QAAA,MAAM,iBAAiB;;CAEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../src/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA6B1D,QAAA,MAAM,iBAAiB;;CAEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/dist/heading.js CHANGED
@@ -2,14 +2,15 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { createElement as e } from 'react';
3
3
  import { MyST } from './MyST.js';
4
4
  import { HashLink } from './hashLink.js';
5
- const Heading = ({ node }) => {
5
+ import classNames from 'classnames';
6
+ const Heading = ({ node, className }) => {
6
7
  const { enumerator, depth, key, identifier, html_id } = node;
7
8
  const id = html_id || identifier || key;
8
9
  const textContent = (_jsxs(_Fragment, { children: [enumerator && _jsx("span", { className: "mr-3 select-none", children: enumerator }), _jsx("span", { className: "heading-text", children: _jsx(MyST, { ast: node.children }) }), _jsx(HashLink, { id: id, kind: "Section", className: "px-2 font-normal", hover: true, hideInPopup: true })] }));
9
10
  // The `heading-text` class is picked up in the Outline to select without the enumerator and "#" link
10
11
  return e(`h${depth}`, {
11
12
  id,
12
- className: 'relative group',
13
+ className: classNames('relative group', className),
13
14
  }, textContent);
14
15
  };
15
16
  const HEADING_RENDERERS = {
package/dist/iframe.js CHANGED
@@ -22,9 +22,9 @@ function getStyleValue(width) {
22
22
  }
23
23
  return width;
24
24
  }
25
- export const IFrame = ({ node }) => {
25
+ export const IFrame = ({ node, className }) => {
26
26
  const width = getStyleValue(node.width) || 70;
27
- return (_jsx("div", { id: node.label || undefined, style: { textAlign: node.align || 'center' }, className: classNames('leading-[0]', node.class), children: _jsx("div", { className: "relative inline-block", style: {
27
+ return (_jsx("div", { id: node.label || undefined, style: { textAlign: node.align || 'center' }, className: classNames('leading-[0]', node.class, className), children: _jsx("div", { className: "relative inline-block", style: {
28
28
  paddingBottom: '60%',
29
29
  width: `min(max(${width}%, 500px), 100%)`,
30
30
  }, children: _jsx("iframe", { width: "100%", height: "100%", src: node.src, allowFullScreen: true, allow: "autoplay", style: {
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,KAAK,SAAS,GAAG,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgIrD,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,CAezC,CAAC;AAEF,QAAA,MAAM,eAAe;;CAEpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,KAAK,SAAS,GAAG,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgIrD,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,CAezC,CAAC;AAEF,QAAA,MAAM,eAAe;;CAEpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/dist/image.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
2
3
  function getStyleValue(width) {
3
4
  if (typeof width === 'number' && Number.isNaN(width)) {
4
5
  // If it is nan, return undefined.
@@ -32,9 +33,7 @@ function alignToMargin(align) {
32
33
  }
33
34
  }
34
35
  function Video({ className, id, src, urlSource, align = 'center', width, height, }) {
35
- return (_jsx("video", {
36
- // className={className}
37
- id: id, style: Object.assign({ width: getStyleValue(width), height: getStyleValue(height) }, alignToMargin(align)), src: src, "data-canonical-url": urlSource, autoPlay: true,
36
+ return (_jsx("video", { className: className, id: id, style: Object.assign({ width: getStyleValue(width), height: getStyleValue(height) }, alignToMargin(align)), src: src, "data-canonical-url": urlSource, autoPlay: true,
38
37
  // For autoplay, the element needs to be muted to actually start!
39
38
  muted: true, "webkit-playsinline": "true", playsInline: true, loop: true }));
40
39
  }
@@ -47,8 +46,8 @@ function Picture({ className, id, src, srcOptimized, urlSource, align = 'center'
47
46
  return image;
48
47
  return (_jsxs("picture", { className: className, children: [_jsx("source", { srcSet: srcOptimized, type: "image/webp" }), image] }));
49
48
  }
50
- export const Image = ({ node }) => {
51
- return (_jsx(Picture, { className: node.class, id: node.html_id || node.identifier || node.key, src: node.url, srcOptimized: node.urlOptimized, alt: node.alt || node.title, width: node.width || undefined, height: node.height || undefined, align: node.align,
49
+ export const Image = ({ node, className }) => {
50
+ return (_jsx(Picture, { className: classNames(node.class, className), id: node.html_id || node.identifier || node.key, src: node.url, srcOptimized: node.urlOptimized, alt: node.alt || node.title, width: node.width || undefined, height: node.height || undefined, align: node.align,
52
51
  // Note that sourceUrl is for backwards compatibility
53
52
  urlSource: node.urlSource || node.sourceUrl }));
54
53
  };
@@ -1,7 +1,8 @@
1
1
  interface Props {
2
2
  value: string;
3
3
  message?: string;
4
+ className?: string;
4
5
  }
5
- export declare function InlineError({ value, message }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export declare function InlineError({ value, message, className }: Props): import("react/jsx-runtime").JSX.Element;
6
7
  export {};
7
8
  //# sourceMappingURL=inlineError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inlineError.d.ts","sourceRoot":"","sources":["../src/inlineError.tsx"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,2CAOpD"}
1
+ {"version":3,"file":"inlineError.d.ts","sourceRoot":"","sources":["../src/inlineError.tsx"],"names":[],"mappings":"AAGA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,KAAK,2CAO/D"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ExclamationCircleIcon } from '@heroicons/react/24/outline';
3
- export function InlineError({ value, message }) {
4
- return (_jsxs("span", { className: "text-yellow-600", title: message || value, children: [_jsx(ExclamationCircleIcon, { width: "1rem", height: "1rem", className: "inline mr-1" }), value] }));
3
+ import classNames from 'classnames';
4
+ export function InlineError({ value, message, className }) {
5
+ return (_jsxs("span", { className: classNames('text-yellow-600', className), title: message || value, children: [_jsx(ExclamationCircleIcon, { width: "1rem", height: "1rem", className: "inline mr-1" }), value] }));
5
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"inlineExpression.d.ts","sourceRoot":"","sources":["../src/inlineExpression.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,eAAO,MAAM,gBAAgB,EAAE,YAe9B,CAAC;AAEF,QAAA,MAAM,2BAA2B;;CAEhC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
1
+ {"version":3,"file":"inlineExpression.d.ts","sourceRoot":"","sources":["../src/inlineExpression.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D,eAAO,MAAM,gBAAgB,EAAE,YAsB9B,CAAC;AAEF,QAAA,MAAM,2BAA2B;;CAEhC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
@@ -2,16 +2,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { InlineError } from './inlineError.js';
3
3
  import { Tooltip } from './components/index.js';
4
4
  import { MyST } from './MyST.js';
5
- export const InlineExpression = ({ node }) => {
5
+ import classNames from 'classnames';
6
+ export const InlineExpression = ({ node, className }) => {
6
7
  var _a, _b, _c;
7
8
  if (!node.result) {
8
- return _jsx(InlineError, { value: `Unexecuted inline expression for: ${node.value}` });
9
+ return (_jsx(InlineError, { value: `Unexecuted inline expression for: ${node.value}`, className: className }));
9
10
  }
10
11
  if (((_a = node.result) === null || _a === void 0 ? void 0 : _a.status) !== 'ok') {
11
- return _jsx(InlineError, { value: `${(_b = node.result) === null || _b === void 0 ? void 0 : _b.ename}: ${(_c = node.result) === null || _c === void 0 ? void 0 : _c.evalue}` });
12
+ return (_jsx(InlineError, { value: `${(_b = node.result) === null || _b === void 0 ? void 0 : _b.ename}: ${(_c = node.result) === null || _c === void 0 ? void 0 : _c.evalue}`, className: className }));
12
13
  }
13
14
  // TODO: something with Thebe in the future!
14
- return (_jsx(Tooltip, { title: _jsx("code", { children: node.value }), children: _jsx("span", { className: "border-b border-dotted cursor-help", children: _jsx(MyST, { ast: node.children }) }) }));
15
+ return (_jsx(Tooltip, { title: _jsx("code", { children: node.value }), children: _jsx("span", { className: classNames('border-b border-dotted cursor-help', className), children: _jsx(MyST, { ast: node.children }) }) }));
15
16
  };
16
17
  const INLINE_EXPRESSION_RENDERERS = {
17
18
  inlineExpression: InlineExpression,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, }: {
2
+ export declare function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, className, }: {
3
3
  children: React.ReactNode;
4
4
  kind: 'file' | 'issue';
5
5
  url: string;
@@ -10,5 +10,6 @@ export declare function GithubLink({ kind, children, url, org, repo, raw, file,
10
10
  from?: number;
11
11
  issue_number?: string | number;
12
12
  to?: number;
13
+ className?: string;
13
14
  }): import("react/jsx-runtime").JSX.Element;
14
15
  //# sourceMappingURL=github.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/links/github.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA8NnD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,GAAG,EACH,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,EAAE,EACF,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,2CAoCA"}
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/links/github.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkOnD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,GAAG,EACH,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,EAAE,EACF,YAAY,EACZ,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAsCA"}
@@ -33,11 +33,11 @@ function useLoadWhenOpen(open, url, loader) {
33
33
  }, [cached, url, data]);
34
34
  return { data: cached, error };
35
35
  }
36
- function GithubFilePreview({ url, raw, org, repo, file, from, to, open, }) {
36
+ function GithubFilePreview({ url, raw, org, repo, file, from, to, open, className, }) {
37
37
  const { data, error } = useLoadWhenOpen(open, raw, fetcher);
38
38
  let code = data;
39
39
  if (error) {
40
- return (_jsxs("div", { className: "hover-document article w-[500px] sm:max-w-[500px]", children: [_jsx("a", { href: url, className: "block text-inherit hover:text-inherit", target: "_blank", rel: "noreferrer", children: _jsx(ExternalLinkIcon, { width: "1rem", height: "1rem", className: "float-right" }) }), _jsxs("div", { className: "mt-2", children: ["Error loading \"", file, "\" from GitHub."] })] }));
40
+ return (_jsxs("div", { className: "hover-document article w-[500px] sm:max-w-[500px]", children: [_jsx("a", { href: url, className: classNames('block text-inherit hover:text-inherit', className), target: "_blank", rel: "noreferrer", children: _jsx(ExternalLinkIcon, { width: "1rem", height: "1rem", className: "float-right" }) }), _jsxs("div", { className: "mt-2", children: ["Error loading \"", file, "\" from GitHub."] })] }));
41
41
  }
42
42
  const lang = extToLanguage(file === null || file === void 0 ? void 0 : file.split('.').pop());
43
43
  let startingLineNumber = 1;
@@ -66,7 +66,7 @@ function useWhiteTextColor(bgColor) {
66
66
  const b = parseInt(color.substring(4, 6), 16); // hexToB
67
67
  return r * 0.299 + g * 0.587 + b * 0.114 <= 186;
68
68
  }
69
- function GithubIssuePreview({ url, org, repo, issue_number, open, }) {
69
+ function GithubIssuePreview({ url, org, repo, issue_number, open, className, }) {
70
70
  var _a, _b;
71
71
  const { data, error } = useLoadWhenOpen(open, `https://api.github.com/repos/${org}/${repo}/issues/${issue_number}`, jsonFetcher);
72
72
  if (!data && !error) {
@@ -74,7 +74,7 @@ function GithubIssuePreview({ url, org, repo, issue_number, open, }) {
74
74
  }
75
75
  const resp = data;
76
76
  if (error) {
77
- return (_jsxs("div", { className: "hover-document article", children: [_jsx("a", { href: url, className: "block text-inherit hover:text-inherit", target: "_blank", rel: "noreferrer", children: _jsx(ExternalLinkIcon, { className: "float-right w-4 h-4" }) }), _jsx("div", { className: "mt-2", children: "Error loading from GitHub." })] }));
77
+ return (_jsxs("div", { className: "hover-document article", children: [_jsx("a", { href: url, className: classNames('block text-inherit hover:text-inherit', className), target: "_blank", rel: "noreferrer", children: _jsx(ExternalLinkIcon, { className: "float-right w-4 h-4" }) }), _jsx("div", { className: "mt-2", children: "Error loading from GitHub." })] }));
78
78
  }
79
79
  const dateString = new Date(resp.created_at).toLocaleDateString('en-US', {
80
80
  year: 'numeric',
@@ -85,13 +85,13 @@ function GithubIssuePreview({ url, org, repo, issue_number, open, }) {
85
85
  'text-white': useWhiteTextColor(label.color),
86
86
  }), style: { backgroundColor: `#${label.color}` }, children: label.name }, label.id))) }))] }));
87
87
  }
88
- export function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, }) {
88
+ export function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, className, }) {
89
89
  return (_jsx(HoverPopover, { card: ({ load }) => {
90
90
  if (kind === 'file') {
91
- return (_jsx(GithubFilePreview, { url: url, raw: raw, file: file, from: from, to: to, open: load, org: org, repo: repo }));
91
+ return (_jsx(GithubFilePreview, { url: url, raw: raw, file: file, from: from, to: to, open: load, org: org, repo: repo, className: className }));
92
92
  }
93
93
  if (kind === 'issue') {
94
- return (_jsx(GithubIssuePreview, { url: url, open: load, org: org, issue_number: issue_number, repo: repo }));
94
+ return (_jsx(GithubIssuePreview, { url: url, open: load, org: org, issue_number: issue_number, repo: repo, className: className }));
95
95
  }
96
- }, children: _jsx("a", { href: url, className: "italic", target: "_blank", rel: "noreferrer", children: children }) }));
96
+ }, children: _jsx("a", { href: url, className: classNames('italic', className), target: "_blank", rel: "noreferrer", children: children }) }));
97
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/links/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOtC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAQzE,KAAK,eAAe,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA0CxE,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,eAAe,CAM1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,eAAe,CAgB5D,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,eAAe,CAE1D,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,eAAe,CAEzD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,eAAe,CAcpD,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,eAAe,CA8BnD,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,aAerB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/links/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOtC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AASzE,KAAK,eAAe,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkDxE,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,eAAe,CAW1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,eAAe,CAiB5D,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,eAAe,CAI1D,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,eAAe,CAQzD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,eAAe,CAmBpD,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,eAAe,CAmCnD,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,aAerB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -7,6 +7,7 @@ import { RRIDLink } from './rrid.js';
7
7
  import { RORLink } from './ror.js';
8
8
  import { GithubLink } from './github.js';
9
9
  import { MyST } from '../MyST.js';
10
+ import classNames from 'classnames';
10
11
  function getPageInfo(site, path) {
11
12
  var _a;
12
13
  if (!site)
@@ -17,51 +18,51 @@ function getPageInfo(site, path) {
17
18
  return undefined;
18
19
  return project.pages.find((p) => p.slug === (pageSlug || projectSlug));
19
20
  }
20
- function InternalLink({ url, children }) {
21
+ function InternalLink({ url, children, className, }) {
21
22
  const Link = useLinkProvider();
22
23
  const site = useSiteManifest();
23
24
  const page = getPageInfo(site, url);
24
25
  const baseurl = useBaseurl();
25
26
  const skipPreview = !page || (!page.description && !page.thumbnail);
26
27
  if (!page || skipPreview) {
27
- return (_jsx(Link, { to: withBaseurl(url, baseurl), prefetch: "intent", children: children }));
28
+ return (_jsx(Link, { to: withBaseurl(url, baseurl), prefetch: "intent", className: className, children: children }));
28
29
  }
29
- return (_jsx(HoverPopover, { card: _jsx(LinkCard, { internal: true, url: url, title: page.title, description: page.description, thumbnail: page.thumbnailOptimized || page.thumbnail }), children: _jsx(Link, { to: withBaseurl(url, baseurl), prefetch: "intent", children: children }) }));
30
+ return (_jsx(HoverPopover, { card: _jsx(LinkCard, { internal: true, url: url, title: page.title, description: page.description, thumbnail: page.thumbnailOptimized || page.thumbnail }), children: _jsx(Link, { to: withBaseurl(url, baseurl), prefetch: "intent", className: className, children: children }) }));
30
31
  }
31
- export const WikiLinkRenderer = ({ node }) => {
32
+ export const WikiLinkRenderer = ({ node, className }) => {
32
33
  var _a, _b;
33
- return (_jsx(WikiLink, { url: node.url, page: (_a = node.data) === null || _a === void 0 ? void 0 : _a.page, wiki: (_b = node.data) === null || _b === void 0 ? void 0 : _b.wiki, children: _jsx(MyST, { ast: node.children }) }));
34
+ return (_jsx(WikiLink, { url: node.url, page: (_a = node.data) === null || _a === void 0 ? void 0 : _a.page, wiki: (_b = node.data) === null || _b === void 0 ? void 0 : _b.wiki, className: classNames(node.class, className), children: _jsx(MyST, { ast: node.children }) }));
34
35
  };
35
- export const GithubLinkRenderer = ({ node }) => {
36
+ export const GithubLinkRenderer = ({ node, className }) => {
36
37
  var _a, _b, _c, _d, _e, _f, _g, _h;
37
- return (_jsx(GithubLink, { kind: (_a = node.data) === null || _a === void 0 ? void 0 : _a.kind, url: node.url, org: (_b = node.data) === null || _b === void 0 ? void 0 : _b.org, repo: (_c = node.data) === null || _c === void 0 ? void 0 : _c.repo, raw: (_d = node.data) === null || _d === void 0 ? void 0 : _d.raw, file: (_e = node.data) === null || _e === void 0 ? void 0 : _e.file, from: (_f = node.data) === null || _f === void 0 ? void 0 : _f.from, to: (_g = node.data) === null || _g === void 0 ? void 0 : _g.to, issue_number: (_h = node.data) === null || _h === void 0 ? void 0 : _h.issue_number, children: _jsx(MyST, { ast: node.children }) }));
38
+ return (_jsx(GithubLink, { kind: (_a = node.data) === null || _a === void 0 ? void 0 : _a.kind, url: node.url, org: (_b = node.data) === null || _b === void 0 ? void 0 : _b.org, repo: (_c = node.data) === null || _c === void 0 ? void 0 : _c.repo, raw: (_d = node.data) === null || _d === void 0 ? void 0 : _d.raw, file: (_e = node.data) === null || _e === void 0 ? void 0 : _e.file, from: (_f = node.data) === null || _f === void 0 ? void 0 : _f.from, to: (_g = node.data) === null || _g === void 0 ? void 0 : _g.to, issue_number: (_h = node.data) === null || _h === void 0 ? void 0 : _h.issue_number, className: classNames(node.class, className), children: _jsx(MyST, { ast: node.children }) }));
38
39
  };
39
- export const RRIDLinkRenderer = ({ node }) => {
40
+ export const RRIDLinkRenderer = ({ node, className }) => {
40
41
  var _a;
41
- return (_jsx(RRIDLink, { rrid: (_a = node.data) === null || _a === void 0 ? void 0 : _a.rrid }));
42
+ return (_jsx(RRIDLink, { rrid: (_a = node.data) === null || _a === void 0 ? void 0 : _a.rrid, className: classNames(node.class, className) }));
42
43
  };
43
- export const RORLinkRenderer = ({ node }) => {
44
+ export const RORLinkRenderer = ({ node, className }) => {
44
45
  var _a;
45
- return (_jsx(RORLink, { node: node, ror: (_a = node.data) === null || _a === void 0 ? void 0 : _a.ror }));
46
+ return (_jsx(RORLink, { node: node, ror: (_a = node.data) === null || _a === void 0 ? void 0 : _a.ror, className: classNames(node.class, className) }));
46
47
  };
47
- export const SimpleLink = ({ node }) => {
48
+ export const SimpleLink = ({ node, className }) => {
48
49
  var _a;
49
50
  const internal = (_a = node.internal) !== null && _a !== void 0 ? _a : false;
50
51
  if (internal) {
51
- return (_jsx(InternalLink, { url: node.url, children: _jsx(MyST, { ast: node.children }) }));
52
+ return (_jsx(InternalLink, { url: node.url, className: classNames(node.class, className), children: _jsx(MyST, { ast: node.children }) }));
52
53
  }
53
- return (_jsx("a", { target: "_blank", href: node.url, rel: "noreferrer", children: _jsx(MyST, { ast: node.children }) }));
54
+ return (_jsx("a", { target: "_blank", rel: "noreferrer", href: node.url, className: classNames(node.class, className), children: _jsx(MyST, { ast: node.children }) }));
54
55
  };
55
- export const linkBlock = ({ node }) => {
56
+ export const linkBlock = ({ node, className }) => {
56
57
  var _a;
57
58
  const iconClass = 'self-center transition-transform flex-none ml-3';
58
59
  const containerClass = 'flex-1 p-4 my-5 block border font-normal hover:border-blue-500 dark:hover:border-blue-400 no-underline hover:text-blue-600 dark:hover:text-blue-400 text-gray-600 dark:text-gray-100 border-gray-200 dark:border-gray-500 rounded shadow-sm hover:shadow-lg dark:shadow-neutral-700';
59
60
  const internal = (_a = node.internal) !== null && _a !== void 0 ? _a : false;
60
61
  const nested = (_jsxs("div", { className: "flex h-full align-middle", children: [_jsxs("div", { className: "flex-grow", children: [node.title, _jsx("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: _jsx(MyST, { ast: node.children }) })] }), internal && _jsx(LinkIcon, { width: "1.5rem", height: "1.5rem", className: iconClass }), !internal && _jsx(ExternalLinkIcon, { width: "1.5rem", height: "1.5rem", className: iconClass })] }));
61
62
  if (internal) {
62
- return (_jsx("a", { href: node.url, className: containerClass, children: nested }));
63
+ return (_jsx("a", { href: node.url, className: classNames(containerClass, className), children: nested }));
63
64
  }
64
- return (_jsx("a", { className: containerClass, target: "_blank", rel: "noopener noreferrer", href: node.url, children: nested }));
65
+ return (_jsx("a", { className: classNames(containerClass, className), target: "_blank", rel: "noopener noreferrer", href: node.url, children: nested }));
65
66
  };
66
67
  const LINK_RENDERERS = {
67
68
  link: {
@@ -1,6 +1,7 @@
1
1
  import type { GenericNode } from 'myst-common';
2
- export declare function RORLink({ node, ror }: {
2
+ export declare function RORLink({ node, ror, className, }: {
3
3
  node: GenericNode;
4
4
  ror: string;
5
+ className?: string;
5
6
  }): import("react/jsx-runtime").JSX.Element;
6
7
  //# sourceMappingURL=ror.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ror.d.ts","sourceRoot":"","sources":["../../src/links/ror.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiF/C,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,2CAQxE"}
1
+ {"version":3,"file":"ror.d.ts","sourceRoot":"","sources":["../../src/links/ror.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiF/C,wBAAgB,OAAO,CAAC,EACtB,IAAI,EACJ,GAAG,EACH,SAAS,GACV,EAAE;IACD,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAaA"}
package/dist/links/ror.js CHANGED
@@ -25,6 +25,6 @@ function RORChild({ ror }) {
25
25
  const links = [...basicLinks, ...wikiLink];
26
26
  return (_jsxs("div", { className: "hover-document article w-[500px] sm:max-w-[500px] p-3", children: [_jsxs("p", { className: "flex items-stretch gap-2 text-sm font-light", children: [_jsx(RorIcon, { width: "1.25rem", height: "1.25rem", className: "self-center inline-block" }), _jsx("a", { href: `https://ror.org/${ror}`, className: "self-center", target: "_blank", rel: "noopener noreferrer", children: _jsx("code", { children: ror }) })] }), _jsx("div", { className: "mb-4 text-xl font-bold", children: data.name }), _jsxs("dl", { className: "mb-4 text-sm", children: [_jsx("dt", { children: "Country" }), _jsx("dd", { children: country_name }), links.length > 0 && (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Links" }), links.map(({ url, text }) => (_jsx("dd", { children: _jsx("a", { href: url, children: text || url }) })))] })), ((_c = data.acronyms) === null || _c === void 0 ? void 0 : _c.length) > 0 && (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Acronyms" }), data.acronyms.map((text) => (_jsx("dd", { children: text })))] })), ((_d = data.labels) === null || _d === void 0 ? void 0 : _d.length) > 0 && (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Labels" }), data.labels.map(({ label, iso639 }) => (_jsxs("dd", { children: [label, iso639 ? ` (${iso639})` : null] })))] }))] })] }));
27
27
  }
28
- export function RORLink({ node, ror }) {
29
- return (_jsx(HoverPopover, { card: _jsx(RORChild, { ror: ror }), children: _jsx("a", { href: `https://ror.org/${ror}`, target: "_blank", rel: "noopener noreferrer", children: _jsx(MyST, { ast: node.children }) }) }));
28
+ export function RORLink({ node, ror, className, }) {
29
+ return (_jsx(HoverPopover, { card: _jsx(RORChild, { ror: ror }), children: _jsx("a", { href: `https://ror.org/${ror}`, target: "_blank", rel: "noopener noreferrer", className: className, children: _jsx(MyST, { ast: node.children }) }) }));
30
30
  }
@@ -1,4 +1,5 @@
1
- export declare function RRIDLink({ rrid }: {
1
+ export declare function RRIDLink({ rrid, className }: {
2
2
  rrid: string;
3
+ className?: string;
3
4
  }): import("react/jsx-runtime").JSX.Element;
4
5
  //# sourceMappingURL=rrid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rrid.d.ts","sourceRoot":"","sources":["../../src/links/rrid.tsx"],"names":[],"mappings":"AAsEA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,2CAQlD"}
1
+ {"version":3,"file":"rrid.d.ts","sourceRoot":"","sources":["../../src/links/rrid.tsx"],"names":[],"mappings":"AAsEA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAajF"}
@@ -22,6 +22,6 @@ function RRIDChild({ rrid }) {
22
22
  const tags = (_g = keywords === null || keywords === void 0 ? void 0 : keywords.map(({ keyword }) => keyword)) !== null && _g !== void 0 ? _g : [];
23
23
  return (_jsxs("div", { className: "hover-document article w-[500px] sm:max-w-[500px] p-3", children: [_jsxs("p", { className: "text-sm font-light", children: ["RRID: ", category] }), _jsxs("div", { className: "mb-4 text-xl font-bold", children: [title, " ", _jsx("code", { children: curie })] }), _jsx("p", { className: "text-md", children: description }), types.length > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "my-2 text-xs font-thin", children: "Categories" }), _jsx("div", { className: "flex flex-wrap ml-1", children: types === null || types === void 0 ? void 0 : types.map((tag) => (_jsx("span", { className: "inline-flex items-center px-3 py-1 ml-1 text-xs uppercase border rounded-full", children: tag }))) })] })), tags.length > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "my-2 text-xs font-thin", children: "Tags" }), _jsx("div", { className: "flex flex-wrap ml-1", children: tags === null || tags === void 0 ? void 0 : tags.map((tag) => (_jsx("span", { className: "inline-flex items-center px-3 py-1 ml-1 text-xs uppercase border rounded-full", children: tag }))) })] }))] }));
24
24
  }
25
- export function RRIDLink({ rrid }) {
26
- return (_jsx(HoverPopover, { card: _jsx(RRIDChild, { rrid: rrid }), children: _jsxs("a", { href: `https://scicrunch.org/resolver/${rrid}`, target: "_blank", rel: "noopener noreferrer", children: ["RRID: ", _jsx("cite", { className: "italic", children: rrid })] }) }));
25
+ export function RRIDLink({ rrid, className }) {
26
+ return (_jsx(HoverPopover, { card: _jsx(RRIDChild, { rrid: rrid }), children: _jsxs("a", { href: `https://scicrunch.org/resolver/${rrid}`, target: "_blank", rel: "noopener noreferrer", className: className, children: ["RRID: ", _jsx("cite", { className: "italic", children: rrid })] }) }));
27
27
  }
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- export declare function WikiLink({ children, page, url, wiki, }: {
2
+ export declare function WikiLink({ children, page, url, wiki, className, }: {
3
3
  children: React.ReactNode;
4
4
  page: string;
5
5
  url: string;
6
6
  wiki: string;
7
+ className?: string;
7
8
  }): import("react/jsx-runtime").JSX.Element;
8
9
  //# sourceMappingURL=wiki.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/links/wiki.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAqG1B,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,IAAI,GACL,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,2CAQA"}
1
+ {"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/links/wiki.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAsG1B,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAQA"}