myst-to-react 0.3.0 → 0.3.1
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/cjs/admonitions.js +10 -10
- package/dist/cjs/basic.js +14 -14
- package/dist/cjs/card.js +8 -8
- package/dist/cjs/cite.js +4 -4
- package/dist/cjs/code.js +4 -4
- package/dist/cjs/components/CopyIcon.js +2 -2
- package/dist/cjs/components/HoverPopover.js +1 -1
- package/dist/cjs/components/LinkCard.js +2 -2
- package/dist/cjs/crossReference.js +2 -2
- package/dist/cjs/dropdown.js +2 -2
- package/dist/cjs/exercise.js +13 -13
- package/dist/cjs/extensions/chemicalFormula.d.ts +1 -1
- package/dist/cjs/extensions/chemicalFormula.js +2 -2
- package/dist/cjs/extensions/siunits.d.ts +1 -1
- package/dist/cjs/extensions/siunits.js +1 -1
- package/dist/cjs/footnotes.d.ts +1 -1
- package/dist/cjs/footnotes.js +2 -2
- package/dist/cjs/grid.js +2 -2
- package/dist/cjs/heading.js +4 -4
- package/dist/cjs/iframe.d.ts +1 -1
- package/dist/cjs/iframe.js +3 -3
- package/dist/cjs/inlineError.js +1 -1
- package/dist/cjs/inlineExpression.d.ts +1 -1
- package/dist/cjs/inlineExpression.js +1 -1
- package/dist/cjs/links/github.js +7 -7
- package/dist/cjs/links/index.js +9 -9
- package/dist/cjs/links/rrid.js +4 -4
- package/dist/cjs/links/wiki.js +3 -3
- package/dist/cjs/math.js +2 -2
- package/dist/cjs/proof.js +9 -9
- package/dist/cjs/tabs.js +8 -8
- package/dist/cjs/unknown.d.ts +1 -1
- package/dist/cjs/unknown.js +1 -1
- package/dist/esm/admonitions.js +9 -9
- package/dist/esm/basic.js +14 -14
- package/dist/esm/card.js +8 -8
- package/dist/esm/cite.js +4 -4
- package/dist/esm/code.js +4 -4
- package/dist/esm/components/CopyIcon.js +2 -2
- package/dist/esm/components/HoverPopover.js +1 -1
- package/dist/esm/components/LinkCard.js +2 -2
- package/dist/esm/crossReference.js +2 -2
- package/dist/esm/dropdown.js +2 -2
- package/dist/esm/exercise.js +13 -13
- package/dist/esm/extensions/chemicalFormula.d.ts +1 -1
- package/dist/esm/extensions/chemicalFormula.js +2 -2
- package/dist/esm/extensions/siunits.d.ts +1 -1
- package/dist/esm/extensions/siunits.js +1 -1
- package/dist/esm/footnotes.d.ts +1 -1
- package/dist/esm/footnotes.js +2 -2
- package/dist/esm/grid.js +2 -2
- package/dist/esm/heading.js +4 -4
- package/dist/esm/iframe.d.ts +1 -1
- package/dist/esm/iframe.js +3 -3
- package/dist/esm/inlineError.js +1 -1
- package/dist/esm/inlineExpression.d.ts +1 -1
- package/dist/esm/inlineExpression.js +1 -1
- package/dist/esm/links/github.js +7 -7
- package/dist/esm/links/index.js +9 -9
- package/dist/esm/links/rrid.js +4 -4
- package/dist/esm/links/wiki.js +3 -3
- package/dist/esm/math.js +2 -2
- package/dist/esm/proof.js +8 -8
- package/dist/esm/tabs.js +8 -8
- package/dist/esm/unknown.d.ts +1 -1
- package/dist/esm/unknown.js +1 -1
- package/dist/types/extensions/chemicalFormula.d.ts +1 -1
- package/dist/types/extensions/siunits.d.ts +1 -1
- package/dist/types/footnotes.d.ts +1 -1
- package/dist/types/iframe.d.ts +1 -1
- package/dist/types/inlineExpression.d.ts +1 -1
- package/dist/types/unknown.d.ts +1 -1
- package/package.json +8 -20
package/dist/esm/cite.js
CHANGED
|
@@ -8,10 +8,10 @@ function CiteChild({ html }) {
|
|
|
8
8
|
return (_jsx("div", { className: "hover-document w-[500px] sm:max-w-[500px] p-3", dangerouslySetInnerHTML: { __html: html || '' } }));
|
|
9
9
|
}
|
|
10
10
|
export const CiteGroup = (node, children) => {
|
|
11
|
-
return (_jsx("span",
|
|
11
|
+
return (_jsx("span", { className: classNames('cite-group', {
|
|
12
12
|
narrative: node.kind === 'narrative',
|
|
13
13
|
parenthetical: node.kind === 'parenthetical',
|
|
14
|
-
})
|
|
14
|
+
}), children: children }, node.key));
|
|
15
15
|
};
|
|
16
16
|
export const Cite = ({ label, error, children, }) => {
|
|
17
17
|
var _a, _b;
|
|
@@ -24,10 +24,10 @@ export const Cite = ({ label, error, children, }) => {
|
|
|
24
24
|
return _jsx(InlineError, { value: label, message: 'Citation Not Found' });
|
|
25
25
|
}
|
|
26
26
|
const doiUrl = doiString ? doi.buildUrl(doiString) : null;
|
|
27
|
-
return (_jsx(HoverPopover,
|
|
27
|
+
return (_jsx(HoverPopover, { openDelay: 300, card: _jsx(CiteChild, { html: html }), children: _jsxs("cite", { className: "hover-link", children: [doiUrl && (_jsx("a", { href: doiUrl, target: "_blank", rel: "noreferrer", className: "hover-link", children: children })), !doiUrl && children] }) }));
|
|
28
28
|
};
|
|
29
29
|
export const CiteRenderer = (node, children) => {
|
|
30
|
-
return (_jsx(Cite,
|
|
30
|
+
return (_jsx(Cite, { label: node.label, error: node.error, children: children }, node.key));
|
|
31
31
|
};
|
|
32
32
|
const CITE_RENDERERS = {
|
|
33
33
|
citeGroup: CiteGroup,
|
package/dist/esm/code.js
CHANGED
|
@@ -17,11 +17,11 @@ export function CodeBlock(props) {
|
|
|
17
17
|
const { isLight } = useTheme();
|
|
18
18
|
const { value, lang, identifier, emphasizeLines, showLineNumbers, className, showCopy = true, startingLineNumber = 1, filename, shadow, background, border, } = props;
|
|
19
19
|
const highlightLines = new Set(emphasizeLines);
|
|
20
|
-
return (_jsxs("div",
|
|
20
|
+
return (_jsxs("div", { id: identifier, className: classNames('relative group not-prose overflow-auto', className, {
|
|
21
21
|
'shadow hover:shadow-md dark:shadow-2xl dark:shadow-neutral-900 my-5 text-sm': shadow,
|
|
22
22
|
'bg-stone-200/10': background,
|
|
23
23
|
'border border-l-4 border-l-blue-400 border-gray-200 dark:border-l-blue-400 dark:border-gray-800': border,
|
|
24
|
-
})
|
|
24
|
+
}), children: [filename && _jsx("div", { className: "leading-3 mt-1 p-1", children: filename }), _jsx(SyntaxHighlighter, { language: normalizeLanguage(lang), startingLineNumber: startingLineNumber, showLineNumbers: showLineNumbers, style: isLight ? Object.assign(Object.assign({}, light), { hljs: Object.assign(Object.assign({}, light.hljs), { background: 'transparent' }) }) : dark, wrapLines: true, lineNumberContainerStyle: {
|
|
25
25
|
// This stops page content shifts
|
|
26
26
|
display: 'inline-block',
|
|
27
27
|
float: 'left',
|
|
@@ -39,7 +39,7 @@ export function CodeBlock(props) {
|
|
|
39
39
|
'data-highlight': 'true',
|
|
40
40
|
}
|
|
41
41
|
: { 'data-line-number': `${line}` };
|
|
42
|
-
}, customStyle: { padding: '0.8rem' }
|
|
42
|
+
}, customStyle: { padding: '0.8rem' }, children: value }), showCopy && (_jsx("div", { className: "absolute hidden top-1 right-1 group-hover:block", children: _jsx(CopyIcon, { text: value }) }))] }));
|
|
43
43
|
}
|
|
44
44
|
const code = (node) => {
|
|
45
45
|
return (_jsx(CodeBlock, { identifier: node.html_id, "data-mdast-node-type": node.type, "data-mdast-node-id": node.key, value: node.value || '', lang: node.lang, emphasizeLines: node.emphasizeLines, showLineNumbers: node.showLineNumbers, startingLineNumber: node.startingLineNumber, shadow: true, border: node.executable, background: !node.executable }, node.key));
|
|
@@ -57,7 +57,7 @@ function isColor(maybeColorHash) {
|
|
|
57
57
|
}
|
|
58
58
|
const inlineCode = (node, children) => {
|
|
59
59
|
if (isColor(node.value)) {
|
|
60
|
-
return (_jsxs("code",
|
|
60
|
+
return (_jsxs("code", { className: "bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-100 px-1 rounded", children: [children, _jsx("span", { style: { backgroundColor: node.value }, className: "inline-block w-[10px] h-[10px] rounded-full ml-1" })] }, node.key));
|
|
61
61
|
}
|
|
62
62
|
return _jsx("code", { children: children }, node.key);
|
|
63
63
|
};
|
|
@@ -13,8 +13,8 @@ export function CopyIcon({ text }) {
|
|
|
13
13
|
setTimeout(() => setCopied(false), 3000);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
return (_jsx("button",
|
|
16
|
+
return (_jsx("button", { title: copied ? 'Copied!!' : 'Copy to Clipboard', className: classNames('inline-flex items-center opacity-60 hover:opacity-100 active:opacity-40 cursor-pointer ml-2', 'transition-color duration-200 ease-in-out', {
|
|
17
17
|
'text-blue-500 border-blue-500': !copied,
|
|
18
18
|
'text-green-500 border-green-500 ': copied,
|
|
19
|
-
}), onClick: onClick, "aria-pressed": copied ? 'true' : 'false', "aria-label": "Copy code to clipboard"
|
|
19
|
+
}), onClick: onClick, "aria-pressed": copied ? 'true' : 'false', "aria-label": "Copy code to clipboard", children: copied ? (_jsx(CheckIcon, { className: "w-[24px] h-[24px] text-success" })) : (_jsx(DocumentDuplicateIcon, { className: "w-[24px] h-[24px]" })) }));
|
|
20
20
|
}
|
|
@@ -3,5 +3,5 @@ import { useState } from 'react';
|
|
|
3
3
|
import * as HoverCard from '@radix-ui/react-hover-card';
|
|
4
4
|
export function HoverPopover({ children, openDelay = 400, card, side, arrowClass = 'fill-white', }) {
|
|
5
5
|
const [load, setLoad] = useState(false);
|
|
6
|
-
return (_jsxs(HoverCard.Root,
|
|
6
|
+
return (_jsxs(HoverCard.Root, { openDelay: openDelay, children: [_jsx(HoverCard.Trigger, { asChild: true, onMouseEnter: () => setLoad(true), children: children }), _jsx(HoverCard.Portal, { children: _jsxs(HoverCard.Content, { className: "exclude-from-outline hover-card-content", sideOffset: 5, side: side, children: [typeof card === 'function' ? load && card({ load }) : card, _jsx(HoverCard.Arrow, { className: arrowClass })] }) })] }));
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ export function LinkCard({ url, title, internal = false, loading = false, descri
|
|
|
6
6
|
const Link = useLinkProvider();
|
|
7
7
|
const baseurl = useBaseurl();
|
|
8
8
|
const to = withBaseurl(url, baseurl);
|
|
9
|
-
return (_jsxs("div",
|
|
9
|
+
return (_jsxs("div", { className: classNames('hover-card-content rounded overflow-hidden', className, {
|
|
10
10
|
'animate-pulse': loading,
|
|
11
|
-
})
|
|
11
|
+
}), children: [!loading && thumbnail && (_jsx("img", { src: thumbnail, className: "w-full h-[150px] object-cover object-top object-left m-0" })), loading && _jsx("div", { className: "animate-pulse bg-slate-100 dark:bg-slate-800 w-full h-[150px]" }), internal && (_jsx(Link, { to: to, className: "block text-sm font-semibold text-inherit hover:text-inherit px-3 mt-3", prefetch: "intent", children: title })), !internal && (_jsxs("a", { href: to, className: "block text-sm font-semibold text-inherit hover:text-inherit px-3 mt-3", target: "_blank", rel: "noreferrer", children: [_jsx(ExternalLinkIcon, { className: "w-4 h-4 float-right" }), title] })), !loading && description && (_jsx("div", { className: "p-3 prose text-sm max-h-[300px] overflow-hidden", children: description }))] }));
|
|
12
12
|
}
|
|
@@ -138,14 +138,14 @@ export function CrossReferenceHover({ url: urlIn, dataUrl: dataUrlIn, remote: re
|
|
|
138
138
|
el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth' });
|
|
139
139
|
history.replaceState(undefined, '', `#${htmlId}`);
|
|
140
140
|
};
|
|
141
|
-
return (_jsx(HoverPopover,
|
|
141
|
+
return (_jsx(HoverPopover, { card: ({ load }) => (_jsx(XRefProvider, { remote: remote, url: url, dataUrl: dataUrl, children: _jsx("div", { className: "hover-document w-[500px] sm:max-w-[500px] px-3", children: _jsx(XrefChildren, { load: load, remote: remote, url: url, dataUrl: dataUrl, identifier: identifier }) }) })), children: _jsxs("span", { children: [remote && external && (_jsx("a", { href: `${url}${htmlId ? `#${htmlId}` : ''}`, target: "_blank", className: "hover-link", children: children })), remote && !external && (_jsx(Link, { to: `${withBaseurl(url, baseurl)}${htmlId ? `#${htmlId}` : ''}`, prefetch: "intent", className: "hover-link", children: children })), !remote && (_jsx("a", { href: `#${htmlId}`, onClick: scroll, className: "hover-link", children: children }))] }) }));
|
|
142
142
|
}
|
|
143
143
|
export const CrossReferenceNode = (node, children) => {
|
|
144
144
|
if (!children) {
|
|
145
145
|
return (_jsx(InlineError, { value: node.label || node.identifier || 'No Label', message: "Cross Reference Not Found" }, node.key));
|
|
146
146
|
}
|
|
147
147
|
const { remote, url, dataUrl, identifier, html_id } = node;
|
|
148
|
-
return (_jsx(CrossReferenceHover,
|
|
148
|
+
return (_jsx(CrossReferenceHover, { identifier: identifier, htmlId: html_id, remote: remote, url: url, dataUrl: dataUrl, children: children }, node.key));
|
|
149
149
|
};
|
|
150
150
|
const CROSS_REFERENCE_RENDERERS = {
|
|
151
151
|
crossReference: CrossReferenceNode,
|
package/dist/esm/dropdown.js
CHANGED
|
@@ -6,11 +6,11 @@ export const SummaryTitle = (node, children) => {
|
|
|
6
6
|
return children;
|
|
7
7
|
};
|
|
8
8
|
export function Details({ title, children, open, }) {
|
|
9
|
-
return (_jsxs("details",
|
|
9
|
+
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'), 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 font-thin text-sm text-neutral-700 dark:text-neutral-200", children: _jsx(ChevronRightIcon, { className: classNames(iconClass, 'details-toggle', 'transition-transform') }) }), title] }) }), _jsx("div", { className: "px-4 py-1 details-body", children: children })] }));
|
|
10
10
|
}
|
|
11
11
|
export const DetailsRenderer = (node, children) => {
|
|
12
12
|
const [title, ...rest] = children;
|
|
13
|
-
return (_jsx(Details,
|
|
13
|
+
return (_jsx(Details, { title: title, open: node.open, children: rest }, node.key));
|
|
14
14
|
};
|
|
15
15
|
const DROPDOWN_RENDERERS = {
|
|
16
16
|
details: DetailsRenderer,
|
package/dist/esm/exercise.js
CHANGED
|
@@ -26,17 +26,17 @@ function getColor({ classes = [] }, defaultColor = 'blue') {
|
|
|
26
26
|
}
|
|
27
27
|
const WrapperElement = ({ id, dropdown, className, children, }) => {
|
|
28
28
|
if (dropdown)
|
|
29
|
-
return (_jsx("details",
|
|
30
|
-
return (_jsx("aside",
|
|
29
|
+
return (_jsx("details", { id: id, className: className, children: children }));
|
|
30
|
+
return (_jsx("aside", { id: id, className: className, children: children }));
|
|
31
31
|
};
|
|
32
32
|
const HeaderElement = ({ dropdown, className, children, }) => {
|
|
33
33
|
if (dropdown)
|
|
34
|
-
return _jsx("summary",
|
|
35
|
-
return _jsx("div",
|
|
34
|
+
return _jsx("summary", { className: className, children: children });
|
|
35
|
+
return _jsx("div", { className: className, children: children });
|
|
36
36
|
};
|
|
37
37
|
const iconClass = 'h-8 w-8 inline-block pl-2 mr-2 self-center flex-none';
|
|
38
38
|
export function Callout({ title, color, dropdown, children, identifier, Icon, }) {
|
|
39
|
-
return (_jsxs(WrapperElement,
|
|
39
|
+
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', {
|
|
40
40
|
'dark:border-gray-500/60': !color || color === 'gray',
|
|
41
41
|
'dark:border-blue-500/60': color === 'blue',
|
|
42
42
|
'dark:border-green-500/60': color === 'green',
|
|
@@ -44,7 +44,7 @@ export function Callout({ title, color, dropdown, children, identifier, Icon, })
|
|
|
44
44
|
'dark:border-orange-500/60': color === 'orange',
|
|
45
45
|
'dark:border-red-500/60': color === 'red',
|
|
46
46
|
'dark:border-purple-500/60': color === 'purple',
|
|
47
|
-
})
|
|
47
|
+
}), 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
48
|
'bg-gray-50/80 dark:bg-slate-900': !color || color === 'gray',
|
|
49
49
|
'bg-blue-50/80 dark:bg-slate-900': color === 'blue',
|
|
50
50
|
'bg-green-50/80 dark:bg-slate-900': color === 'green',
|
|
@@ -53,7 +53,7 @@ export function Callout({ title, color, dropdown, children, identifier, Icon, })
|
|
|
53
53
|
'bg-red-50/80 dark:bg-slate-900': color === 'red',
|
|
54
54
|
'bg-purple-50/80 dark:bg-slate-900': color === 'purple',
|
|
55
55
|
'cursor-pointer hover:shadow-[inset_0_0_0px_30px_#00000003] dark:hover:shadow-[inset_0_0_0px_30px_#FFFFFF03]': dropdown,
|
|
56
|
-
})
|
|
56
|
+
}), children: [Icon && (_jsx(Icon, { className: classNames('h-8 w-8 inline-block pl-2 mr-2 self-center flex-none', classNames({
|
|
57
57
|
'text-gray-600': !color || color === 'gray',
|
|
58
58
|
'text-blue-600': color === 'blue',
|
|
59
59
|
'text-green-600': color === 'green',
|
|
@@ -61,8 +61,8 @@ export function Callout({ title, color, dropdown, children, identifier, Icon, })
|
|
|
61
61
|
'text-orange-600': color === 'orange',
|
|
62
62
|
'text-red-600': color === 'red',
|
|
63
63
|
'text-purple-600': color === 'purple',
|
|
64
|
-
})) })), _jsx("div",
|
|
65
|
-
'group')
|
|
64
|
+
})) })), _jsx("div", { className: classNames('text-neutral-900 dark:text-white grow self-center overflow-hidden break-words', { 'ml-4': !Icon }, // No icon!
|
|
65
|
+
'group'), children: title }), dropdown && (_jsx("div", { className: "font-thin text-sm text-neutral-700 dark:text-neutral-200 self-center flex-none", children: _jsx(ChevronRightIcon, { className: classNames(iconClass, 'transition-transform details-toggle') }) }))] }), _jsx("div", { className: classNames('px-4', { 'details-body': dropdown }), children: children })] }));
|
|
66
66
|
}
|
|
67
67
|
export const ExerciseRenderer = (node, children) => {
|
|
68
68
|
var _a, _b, _c;
|
|
@@ -75,8 +75,8 @@ export const ExerciseRenderer = (node, children) => {
|
|
|
75
75
|
const useTitle = ((_c = (_b = node.children) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.type) === 'admonitionTitle';
|
|
76
76
|
const identifier = node.html_id;
|
|
77
77
|
const enumerator = node.enumerator;
|
|
78
|
-
const titleNode = (_jsxs(_Fragment, { children: [_jsxs(HashLink,
|
|
79
|
-
return (_jsxs(Callout,
|
|
78
|
+
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: [" (", title, ")"] })] }));
|
|
79
|
+
return (_jsxs(Callout, { identifier: identifier, title: titleNode, color: color, dropdown: isDropdown, children: [!useTitle && title, rest] }, node.key));
|
|
80
80
|
};
|
|
81
81
|
export const SolutionRenderer = (node, children) => {
|
|
82
82
|
var _a, _b, _c;
|
|
@@ -88,8 +88,8 @@ export const SolutionRenderer = (node, children) => {
|
|
|
88
88
|
const isDropdown = classes.includes('dropdown');
|
|
89
89
|
const useTitle = ((_c = (_b = node.children) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.type) === 'admonitionTitle';
|
|
90
90
|
const identifier = node.html_id;
|
|
91
|
-
const titleNode = (_jsxs(_Fragment, { children: [node.gate === 'start' && 'Start of ', node.gate === 'end' && 'End of ', title, _jsx(HashLink,
|
|
92
|
-
return (_jsxs(Callout,
|
|
91
|
+
const titleNode = (_jsxs(_Fragment, { children: [node.gate === 'start' && 'Start of ', node.gate === 'end' && 'End of ', title, _jsx(HashLink, { id: identifier, kind: "Solution", hover: true, hideInPopup: true, children: ' #' })] }));
|
|
92
|
+
return (_jsxs(Callout, { identifier: identifier, title: useTitle ? titleNode : undefined, color: color, dropdown: isDropdown, children: [!useTitle && title, rest] }, node.key));
|
|
93
93
|
};
|
|
94
94
|
const EXERCISE_RENDERERS = {
|
|
95
95
|
exercise: ExerciseRenderer,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
2
2
|
export declare const ChemicalFormula: NodeRenderer;
|
|
3
3
|
declare const CHEM_RENDERERS: {
|
|
4
|
-
chemicalFormula: NodeRenderer
|
|
4
|
+
chemicalFormula: NodeRenderer;
|
|
5
5
|
};
|
|
6
6
|
export default CHEM_RENDERERS;
|
|
7
7
|
//# sourceMappingURL=chemicalFormula.d.ts.map
|
|
@@ -23,11 +23,11 @@ function parseFormula(formula) {
|
|
|
23
23
|
}
|
|
24
24
|
export const ChemicalFormula = (node) => {
|
|
25
25
|
const parts = parseFormula(node.value);
|
|
26
|
-
return (_jsx("code",
|
|
26
|
+
return (_jsx("code", { className: "text-inherit", children: parts.map((letter, index) => {
|
|
27
27
|
if (letter.match(/[0-9]/))
|
|
28
28
|
return _jsx("sub", { children: letter }, index);
|
|
29
29
|
return _jsx("span", { children: letter }, index);
|
|
30
|
-
}) }
|
|
30
|
+
}) }, node.key));
|
|
31
31
|
};
|
|
32
32
|
const CHEM_RENDERERS = {
|
|
33
33
|
chemicalFormula: ChemicalFormula,
|
|
@@ -3,7 +3,7 @@ export const SIUnits = (node) => {
|
|
|
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",
|
|
6
|
+
return (_jsx("span", { title: title, children: node.value }, node.key));
|
|
7
7
|
};
|
|
8
8
|
const SI_RENDERERS = {
|
|
9
9
|
si: SIUnits,
|
package/dist/esm/footnotes.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
2
2
|
export declare const FootnoteReference: NodeRenderer;
|
|
3
3
|
declare const FOOTNOTE_RENDERERS: {
|
|
4
|
-
footnoteReference: NodeRenderer
|
|
4
|
+
footnoteReference: NodeRenderer;
|
|
5
5
|
footnoteDefinition: () => null;
|
|
6
6
|
};
|
|
7
7
|
export default FOOTNOTE_RENDERERS;
|
package/dist/esm/footnotes.js
CHANGED
|
@@ -9,11 +9,11 @@ function FootnoteDefinition({ identifier }) {
|
|
|
9
9
|
const renderers = useNodeRenderers();
|
|
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
|
const children = useParse(node, renderers);
|
|
12
|
-
return (_jsx(XRefProvider, { children: _jsx("div",
|
|
12
|
+
return (_jsx(XRefProvider, { children: _jsx("div", { className: "hover-document w-[500px] sm:max-w-[500px] px-3", children: children }) }));
|
|
13
13
|
}
|
|
14
14
|
export const FootnoteReference = (node) => {
|
|
15
15
|
var _a;
|
|
16
|
-
return (_jsx(HoverPopover,
|
|
16
|
+
return (_jsx(HoverPopover, { openDelay: 0, card: _jsx(FootnoteDefinition, { identifier: node.identifier }), children: _jsx("span", { children: _jsxs("sup", { className: "hover-link", children: ["[", (_a = node.number) !== null && _a !== void 0 ? _a : node.identifier, "]"] }) }) }, node.key));
|
|
17
17
|
};
|
|
18
18
|
const FOOTNOTE_RENDERERS = {
|
|
19
19
|
footnoteReference: FootnoteReference,
|
package/dist/esm/grid.js
CHANGED
|
@@ -99,10 +99,10 @@ function gridColumnClasses(columns) {
|
|
|
99
99
|
function Grid({ columns, children }) {
|
|
100
100
|
const gridClasses = gridColumnClasses(columns);
|
|
101
101
|
const gutterClasses = 'gap-4';
|
|
102
|
-
return (_jsx("div",
|
|
102
|
+
return (_jsx("div", { className: classNames('myst-grid grid my-5', gridClasses, gutterClasses), children: children }));
|
|
103
103
|
}
|
|
104
104
|
export const GridRenderer = (node, children) => {
|
|
105
|
-
return (_jsx(Grid,
|
|
105
|
+
return (_jsx(Grid, { columns: node.columns, children: children }, node.key));
|
|
106
106
|
};
|
|
107
107
|
const GRID_RENDERERS = {
|
|
108
108
|
grid: GridRenderer,
|
package/dist/esm/heading.js
CHANGED
|
@@ -7,7 +7,7 @@ export function HashLink({ id, kind, title = `Link to this ${kind}`, children =
|
|
|
7
7
|
if (inCrossRef || !id) {
|
|
8
8
|
// If we are in a cross-reference pop-out, either hide hash link
|
|
9
9
|
// or return something that is **not** a link
|
|
10
|
-
return hideInPopup ? null : (_jsx("span",
|
|
10
|
+
return hideInPopup ? null : (_jsx("span", { className: classNames('select-none', className), children: children }));
|
|
11
11
|
}
|
|
12
12
|
const scroll = (evt) => {
|
|
13
13
|
evt.preventDefault();
|
|
@@ -15,15 +15,15 @@ export function HashLink({ id, kind, title = `Link to this ${kind}`, children =
|
|
|
15
15
|
el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth' });
|
|
16
16
|
history.replaceState(undefined, '', `#${id}`);
|
|
17
17
|
};
|
|
18
|
-
return (_jsx("a",
|
|
18
|
+
return (_jsx("a", { className: classNames('select-none no-underline text-inherit hover:text-inherit', className, {
|
|
19
19
|
'transition-opacity opacity-0 group-hover:opacity-70': hover,
|
|
20
20
|
'hover:underline': !hover,
|
|
21
|
-
}), onClick: scroll, href: `#${id}`, title: title, "aria-label": title
|
|
21
|
+
}), onClick: scroll, href: `#${id}`, title: title, "aria-label": title, children: children }));
|
|
22
22
|
}
|
|
23
23
|
const Heading = (node, children) => {
|
|
24
24
|
const { enumerator, depth, key, identifier, html_id } = node;
|
|
25
25
|
const id = html_id || identifier || key;
|
|
26
|
-
const textContent = (_jsxs(_Fragment, { children: [enumerator && _jsx("span",
|
|
26
|
+
const textContent = (_jsxs(_Fragment, { children: [enumerator && _jsx("span", { className: "select-none mr-3", children: enumerator }), _jsx("span", { className: "heading-text", children: children }), _jsx(HashLink, { id: id, kind: "Section", className: "px-2 font-normal", hover: true, hideInPopup: true })] }));
|
|
27
27
|
// The `heading-text` class is picked up in the Outline to select without the enumerator and "#" link
|
|
28
28
|
return e(`h${depth}`, {
|
|
29
29
|
key: node.key,
|
package/dist/esm/iframe.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
2
2
|
export declare const IFrame: NodeRenderer;
|
|
3
3
|
declare const IFRAME_RENDERERS: {
|
|
4
|
-
iframe: NodeRenderer
|
|
4
|
+
iframe: NodeRenderer;
|
|
5
5
|
};
|
|
6
6
|
export default IFRAME_RENDERERS;
|
|
7
7
|
//# sourceMappingURL=iframe.d.ts.map
|
package/dist/esm/iframe.js
CHANGED
|
@@ -23,19 +23,19 @@ function getStyleValue(width) {
|
|
|
23
23
|
}
|
|
24
24
|
export const IFrame = (node) => {
|
|
25
25
|
const width = getStyleValue(node.width) || 70;
|
|
26
|
-
return (_jsx("figure",
|
|
26
|
+
return (_jsx("figure", { id: node.label || undefined, style: { textAlign: node.align || 'center' }, children: _jsx("div", { style: {
|
|
27
27
|
position: 'relative',
|
|
28
28
|
display: 'inline-block',
|
|
29
29
|
paddingBottom: '60%',
|
|
30
30
|
width: `min(max(${width}%, 500px), 100%)`,
|
|
31
|
-
}
|
|
31
|
+
}, children: _jsx("iframe", { width: "100%", height: "100%", src: node.src, allowFullScreen: true, allow: "autoplay", style: {
|
|
32
32
|
width: '100%',
|
|
33
33
|
height: '100%',
|
|
34
34
|
position: 'absolute',
|
|
35
35
|
top: 0,
|
|
36
36
|
left: 0,
|
|
37
37
|
border: 'none',
|
|
38
|
-
} }) })
|
|
38
|
+
} }) }) }, node.key));
|
|
39
39
|
};
|
|
40
40
|
const IFRAME_RENDERERS = {
|
|
41
41
|
iframe: IFrame,
|
package/dist/esm/inlineError.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import ExclamationCircleIcon from '@heroicons/react/24/outline/ExclamationCircleIcon';
|
|
3
3
|
export function InlineError({ value, message }) {
|
|
4
|
-
return (_jsxs("span",
|
|
4
|
+
return (_jsxs("span", { className: "text-yellow-600", title: message || value, children: [_jsx(ExclamationCircleIcon, { className: "inline h-[1em] mr-1" }), value] }));
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
2
2
|
export declare const InlineExpression: NodeRenderer;
|
|
3
3
|
declare const INLINE_EXPRESSION_RENDERERS: {
|
|
4
|
-
inlineExpression: NodeRenderer
|
|
4
|
+
inlineExpression: NodeRenderer;
|
|
5
5
|
};
|
|
6
6
|
export default INLINE_EXPRESSION_RENDERERS;
|
|
7
7
|
//# sourceMappingURL=inlineExpression.d.ts.map
|
|
@@ -9,7 +9,7 @@ export const InlineExpression = (node, children) => {
|
|
|
9
9
|
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}` });
|
|
10
10
|
}
|
|
11
11
|
// TODO: something with Thebe in the future!
|
|
12
|
-
return (_jsx("span",
|
|
12
|
+
return (_jsx("span", { title: `Evaluated from: "${node.value}"`, children: children }, node.key));
|
|
13
13
|
};
|
|
14
14
|
const INLINE_EXPRESSION_RENDERERS = {
|
|
15
15
|
inlineExpression: InlineExpression,
|
package/dist/esm/links/github.js
CHANGED
|
@@ -40,7 +40,7 @@ function GithubFilePreview({ url, raw, org, repo, file, from, to, open, }) {
|
|
|
40
40
|
const { data, error } = useLoadWhenOpen(open, raw, fetcher);
|
|
41
41
|
let code = data;
|
|
42
42
|
if (error) {
|
|
43
|
-
return (_jsxs("div",
|
|
43
|
+
return (_jsxs("div", { className: "hover-document 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, { className: "w-4 h-4 float-right" }) }), _jsxs("div", { className: "mt-2", children: ["Error loading \"", file, "\" from GitHub."] })] }));
|
|
44
44
|
}
|
|
45
45
|
const lang = extToLanguage(file === null || file === void 0 ? void 0 : file.split('.').pop());
|
|
46
46
|
let startingLineNumber = 1;
|
|
@@ -73,28 +73,28 @@ function GithubIssuePreview({ url, org, repo, issue_number, open, }) {
|
|
|
73
73
|
var _a, _b;
|
|
74
74
|
const { data, error } = useLoadWhenOpen(open, `https://api.github.com/repos/${org}/${repo}/issues/${issue_number}`, jsonFetcher);
|
|
75
75
|
if (!data && !error) {
|
|
76
|
-
return (_jsx("div",
|
|
76
|
+
return (_jsx("div", { className: "hover-document w-[500px] sm:max-w-[500px] animate-pulse", children: "Loading..." }));
|
|
77
77
|
}
|
|
78
78
|
const resp = data;
|
|
79
79
|
if (error) {
|
|
80
|
-
return (_jsxs("div",
|
|
80
|
+
return (_jsxs("div", { className: "hover-document", children: [_jsx("a", { href: url, className: "block text-inherit hover:text-inherit", target: "_blank", rel: "noreferrer", children: _jsx(ExternalLinkIcon, { className: "w-4 h-4 float-right" }) }), _jsx("div", { className: "mt-2", children: "Error loading from GitHub." })] }));
|
|
81
81
|
}
|
|
82
82
|
const dateString = new Date(resp.created_at).toLocaleDateString('en-US', {
|
|
83
83
|
year: 'numeric',
|
|
84
84
|
month: 'long',
|
|
85
85
|
day: 'numeric',
|
|
86
86
|
});
|
|
87
|
-
return (_jsxs("div",
|
|
87
|
+
return (_jsxs("div", { className: "hover-document w-[400px] sm:max-w-[400px] p-3", children: [_jsxs("div", { className: "text-xs font-light", children: [org, "/", repo] }), _jsxs("div", { className: "text-lg font-bold my-2 dark:text-white", children: [resp.state === 'open' && (_jsx(PlusCircleIcon, { className: "w-6 h-6 inline-block text-green-700 dark:text-green-500 mr-2 -translate-y-px" })), resp.state === 'closed' && (_jsx(CheckCircleIcon, { className: "w-6 h-6 inline-block text-purple-700 dark:text-purple-500 mr-2 -translate-y-px" })), resp.title] }), _jsxs("div", { className: "text-xs font-light", children: ["#", issue_number, " opened on ", dateString, " by", ' ', _jsxs("span", { className: "font-normal", children: ["@", resp.user.login] })] }), _jsx("p", { className: "text-md max-h-[4rem] overflow-hidden", children: resp.body }), ((_a = resp.labels) === null || _a === void 0 ? void 0 : _a.length) > 0 && (_jsx("div", { className: "flex flex-wrap", children: (_b = resp.labels) === null || _b === void 0 ? void 0 : _b.map((label) => (_jsx("span", { className: classNames('mr-1 text-xs inline-flex items-center px-2 py-0.5 rounded-full', {
|
|
88
88
|
'text-white': useWhiteTextColor(label.color),
|
|
89
|
-
}), style: { backgroundColor: `#${label.color}` }
|
|
89
|
+
}), style: { backgroundColor: `#${label.color}` }, children: label.name }, label.id))) }))] }));
|
|
90
90
|
}
|
|
91
91
|
export function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, }) {
|
|
92
|
-
return (_jsx(HoverPopover,
|
|
92
|
+
return (_jsx(HoverPopover, { card: ({ load }) => {
|
|
93
93
|
if (kind === 'file') {
|
|
94
94
|
return (_jsx(GithubFilePreview, { url: url, raw: raw, file: file, from: from, to: to, open: load, org: org, repo: repo }));
|
|
95
95
|
}
|
|
96
96
|
if (kind === 'issue') {
|
|
97
97
|
return (_jsx(GithubIssuePreview, { url: url, open: load, org: org, issue_number: issue_number, repo: repo }));
|
|
98
98
|
}
|
|
99
|
-
}
|
|
99
|
+
}, children: _jsx("a", { href: url, className: "italic", target: "_blank", rel: "noreferrer", children: children }) }));
|
|
100
100
|
}
|
package/dist/esm/links/index.js
CHANGED
|
@@ -24,9 +24,9 @@ function InternalLink({ url, children }) {
|
|
|
24
24
|
const baseurl = useBaseurl();
|
|
25
25
|
const skipPreview = !page || (!page.description && !page.thumbnail);
|
|
26
26
|
if (!page || skipPreview) {
|
|
27
|
-
return (_jsx(Link,
|
|
27
|
+
return (_jsx(Link, { to: withBaseurl(url, baseurl), prefetch: "intent", children: children }));
|
|
28
28
|
}
|
|
29
|
-
return (_jsx(HoverPopover,
|
|
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
30
|
}
|
|
31
31
|
export const link = (node, children) => {
|
|
32
32
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
@@ -34,16 +34,16 @@ export const link = (node, children) => {
|
|
|
34
34
|
const protocol = node.protocol;
|
|
35
35
|
switch (protocol) {
|
|
36
36
|
case 'wiki':
|
|
37
|
-
return (_jsx(WikiLink,
|
|
37
|
+
return (_jsx(WikiLink, { url: node.url, page: (_b = node.data) === null || _b === void 0 ? void 0 : _b.page, wiki: (_c = node.data) === null || _c === void 0 ? void 0 : _c.wiki, children: children }, node.key));
|
|
38
38
|
case 'github':
|
|
39
|
-
return (_jsx(GithubLink,
|
|
39
|
+
return (_jsx(GithubLink, { kind: (_d = node.data) === null || _d === void 0 ? void 0 : _d.kind, url: node.url, org: (_e = node.data) === null || _e === void 0 ? void 0 : _e.org, repo: (_f = node.data) === null || _f === void 0 ? void 0 : _f.repo, raw: (_g = node.data) === null || _g === void 0 ? void 0 : _g.raw, file: (_h = node.data) === null || _h === void 0 ? void 0 : _h.file, from: (_j = node.data) === null || _j === void 0 ? void 0 : _j.from, to: (_k = node.data) === null || _k === void 0 ? void 0 : _k.to, issue_number: (_l = node.data) === null || _l === void 0 ? void 0 : _l.issue_number, children: children }, node.key));
|
|
40
40
|
case 'rrid':
|
|
41
41
|
return _jsx(RRIDLink, { rrid: (_m = node.data) === null || _m === void 0 ? void 0 : _m.rrid }, node.key);
|
|
42
42
|
default:
|
|
43
43
|
if (internal) {
|
|
44
|
-
return (_jsx(InternalLink,
|
|
44
|
+
return (_jsx(InternalLink, { url: node.url, children: children }, node.key));
|
|
45
45
|
}
|
|
46
|
-
return (_jsx("a",
|
|
46
|
+
return (_jsx("a", { target: "_blank", href: node.url, rel: "noreferrer", children: children }, node.key));
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
export const linkBlock = (node, children) => {
|
|
@@ -51,11 +51,11 @@ export const linkBlock = (node, children) => {
|
|
|
51
51
|
const iconClass = 'w-6 h-6 self-center transition-transform flex-none ml-3';
|
|
52
52
|
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';
|
|
53
53
|
const internal = (_a = node.internal) !== null && _a !== void 0 ? _a : false;
|
|
54
|
-
const nested = (_jsxs("div",
|
|
54
|
+
const nested = (_jsxs("div", { className: "flex align-middle h-full", children: [_jsxs("div", { className: "flex-grow", children: [node.title, _jsx("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: children })] }), internal && _jsx(LinkIcon, { className: iconClass }), !internal && _jsx(ExternalLinkIcon, { className: iconClass })] }));
|
|
55
55
|
if (internal) {
|
|
56
|
-
return (_jsx("a",
|
|
56
|
+
return (_jsx("a", { href: node.url, className: containerClass, children: nested }, node.key));
|
|
57
57
|
}
|
|
58
|
-
return (_jsx("a",
|
|
58
|
+
return (_jsx("a", { className: containerClass, target: "_blank", rel: "noopener noreferrer", href: node.url, children: nested }, node.key));
|
|
59
59
|
};
|
|
60
60
|
const LINK_RENDERERS = {
|
|
61
61
|
link,
|
package/dist/esm/links/rrid.js
CHANGED
|
@@ -10,18 +10,18 @@ function RRIDChild({ rrid }) {
|
|
|
10
10
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
11
|
const { data, error } = useSWR(`https://scicrunch.org/resolver/${rrid}.json`, fetcher);
|
|
12
12
|
if (!data && !error) {
|
|
13
|
-
return (_jsx("div",
|
|
13
|
+
return (_jsx("div", { className: "hover-document w-[500px] sm:max-w-[500px] animate-pulse", children: "Loading..." }));
|
|
14
14
|
}
|
|
15
15
|
const hit = (_b = (_a = data === null || data === void 0 ? void 0 : data.hits) === null || _a === void 0 ? void 0 : _a.hits) === null || _b === void 0 ? void 0 : _b[0];
|
|
16
16
|
if (error || !hit) {
|
|
17
|
-
return _jsxs("div",
|
|
17
|
+
return _jsxs("div", { className: "hover-document w-[500px] sm:max-w-[500px]", children: ["Error loading ", rrid, "."] });
|
|
18
18
|
}
|
|
19
19
|
const { name: title, curie, description, supercategory, keywords, types: categories, } = (_d = (_c = hit === null || hit === void 0 ? void 0 : hit._source) === null || _c === void 0 ? void 0 : _c.item) !== null && _d !== void 0 ? _d : {};
|
|
20
20
|
const category = (_e = supercategory === null || supercategory === void 0 ? void 0 : supercategory[0]) === null || _e === void 0 ? void 0 : _e.name;
|
|
21
21
|
const types = (_f = categories === null || categories === void 0 ? void 0 : categories.map(({ name }) => name)) !== null && _f !== void 0 ? _f : [];
|
|
22
22
|
const tags = (_g = keywords === null || keywords === void 0 ? void 0 : keywords.map(({ keyword }) => keyword)) !== null && _g !== void 0 ? _g : [];
|
|
23
|
-
return (_jsxs("div",
|
|
23
|
+
return (_jsxs("div", { className: "hover-document w-[500px] sm:max-w-[500px] p-3", children: [_jsxs("p", { className: "text-sm font-light", children: ["RRID: ", category] }), _jsxs("div", { className: "text-xl font-bold mb-4", children: [title, " ", _jsx("code", { children: curie })] }), _jsx("p", { className: "text-md", children: description }), types.length > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-xs font-thin my-2", children: "Categories" }), _jsx("div", { className: "flex flex-wrap ml-1", children: types === null || types === void 0 ? void 0 : types.map((tag) => (_jsx("span", { className: "ml-1 text-xs inline-flex items-center uppercase px-3 py-1 rounded-full border", children: tag }))) })] })), tags.length > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-xs font-thin my-2", children: "Tags" }), _jsx("div", { className: "flex flex-wrap ml-1", children: tags === null || tags === void 0 ? void 0 : tags.map((tag) => (_jsx("span", { className: "ml-1 text-xs inline-flex items-center uppercase px-3 py-1 rounded-full border", children: tag }))) })] }))] }));
|
|
24
24
|
}
|
|
25
25
|
export function RRIDLink({ rrid }) {
|
|
26
|
-
return (_jsx(HoverPopover,
|
|
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 })] }) }));
|
|
27
27
|
}
|