myst-to-react 0.2.4 → 0.2.6
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 +4 -4
- package/dist/cjs/basic.d.ts.map +1 -1
- package/dist/cjs/basic.js +7 -6
- package/dist/cjs/card.js +1 -1
- package/dist/cjs/cite.d.ts.map +1 -1
- package/dist/cjs/cite.js +9 -7
- package/dist/cjs/code.d.ts +3 -1
- package/dist/cjs/code.d.ts.map +1 -1
- package/dist/cjs/code.js +7 -6
- package/dist/cjs/components/HoverPopover.d.ts +5 -3
- package/dist/cjs/components/HoverPopover.d.ts.map +1 -1
- package/dist/cjs/components/HoverPopover.js +27 -25
- package/dist/cjs/components/LinkCard.d.ts.map +1 -1
- package/dist/cjs/components/LinkCard.js +6 -2
- package/dist/cjs/crossReference.d.ts +5 -2
- package/dist/cjs/crossReference.d.ts.map +1 -1
- package/dist/cjs/crossReference.js +21 -26
- package/dist/cjs/footnotes.d.ts.map +1 -1
- package/dist/cjs/footnotes.js +3 -3
- package/dist/cjs/heading.d.ts.map +1 -1
- package/dist/cjs/heading.js +6 -1
- package/dist/cjs/links/github.d.ts +3 -1
- package/dist/cjs/links/github.d.ts.map +1 -1
- package/dist/cjs/links/github.js +49 -4
- package/dist/cjs/links/index.d.ts.map +1 -1
- package/dist/cjs/links/index.js +3 -3
- package/dist/cjs/links/rrid.d.ts.map +1 -1
- package/dist/cjs/links/rrid.js +5 -6
- package/dist/cjs/links/wiki.js +3 -3
- package/dist/cjs/proof.d.ts.map +1 -1
- package/dist/cjs/proof.js +16 -15
- package/dist/types/basic.d.ts.map +1 -1
- package/dist/types/cite.d.ts.map +1 -1
- package/dist/types/code.d.ts +3 -1
- package/dist/types/code.d.ts.map +1 -1
- package/dist/types/components/HoverPopover.d.ts +5 -3
- package/dist/types/components/HoverPopover.d.ts.map +1 -1
- package/dist/types/components/LinkCard.d.ts.map +1 -1
- package/dist/types/crossReference.d.ts +5 -2
- package/dist/types/crossReference.d.ts.map +1 -1
- package/dist/types/footnotes.d.ts.map +1 -1
- package/dist/types/heading.d.ts.map +1 -1
- package/dist/types/links/github.d.ts +3 -1
- package/dist/types/links/github.d.ts.map +1 -1
- package/dist/types/links/index.d.ts.map +1 -1
- package/dist/types/links/rrid.d.ts.map +1 -1
- package/dist/types/proof.d.ts.map +1 -1
- package/package.json +3 -5
- package/dist/cjs/components/ClickPopover.d.ts +0 -11
- package/dist/cjs/components/ClickPopover.d.ts.map +0 -1
- package/dist/cjs/components/ClickPopover.js +0 -18
- package/dist/types/components/ClickPopover.d.ts +0 -11
- package/dist/types/components/ClickPopover.d.ts.map +0 -1
package/dist/cjs/admonitions.js
CHANGED
|
@@ -111,9 +111,9 @@ const HeaderElement = ({ dropdown, className, children, }) => {
|
|
|
111
111
|
return (0, jsx_runtime_1.jsx)("div", Object.assign({ className: className }, { children: children }));
|
|
112
112
|
};
|
|
113
113
|
function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, }) {
|
|
114
|
-
return ((0, jsx_runtime_1.jsxs)(WrapperElement, Object.assign({ dropdown: dropdown, className: (0, classnames_1.default)('my-5 shadow-md dark:shadow-2xl dark:shadow-neutral-900', 'bg-gray-50 dark:bg-stone-800', 'overflow-hidden', {
|
|
115
|
-
'rounded
|
|
116
|
-
'
|
|
114
|
+
return ((0, jsx_runtime_1.jsxs)(WrapperElement, Object.assign({ dropdown: dropdown, className: (0, classnames_1.default)('my-5 shadow-md dark:shadow-2xl dark:shadow-neutral-900', 'bg-gray-50/10 dark:bg-stone-800', 'overflow-hidden', {
|
|
115
|
+
'rounded border-l-4': !simple,
|
|
116
|
+
'border-l-2': simple,
|
|
117
117
|
'border-blue-500': !color || color === 'blue',
|
|
118
118
|
'border-green-600': color === 'green',
|
|
119
119
|
'border-amber-600': color === 'yellow',
|
|
@@ -133,7 +133,7 @@ function Admonition({ title, kind, color, simple, dropdown, children, hideIcon,
|
|
|
133
133
|
'text-green-600': color === 'green',
|
|
134
134
|
'text-amber-600': color === 'yellow',
|
|
135
135
|
'text-red-600': color === 'red',
|
|
136
|
-
}) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)('text-neutral-900 dark:text-white grow self-center overflow-hidden break-words', { 'ml-
|
|
136
|
+
}) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)('text-neutral-900 dark:text-white grow self-center overflow-hidden break-words', { 'ml-4': hideIcon }) }, { children: title })), dropdown && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "font-thin text-sm text-neutral-700 dark:text-neutral-200 self-center flex-none" }, { children: (0, jsx_runtime_1.jsx)(ChevronRightIcon_1.default, { className: (0, classnames_1.default)(iconClass, 'transition-transform details-toggle') }) })))] }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)('px-4', { 'py-1': !simple, 'details-body': dropdown }) }, { children: children }))] })));
|
|
137
137
|
}
|
|
138
138
|
exports.Admonition = Admonition;
|
|
139
139
|
const AdmonitionRenderer = (node, children) => {
|
package/dist/cjs/basic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/basic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/basic.tsx"],"names":[],"mappings":"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"}
|
package/dist/cjs/basic.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const heading_1 = require("./heading");
|
|
8
8
|
const classnames_1 = __importDefault(require("classnames"));
|
|
9
|
+
const HoverPopover_1 = require("./components/HoverPopover");
|
|
9
10
|
const BASIC_RENDERERS = {
|
|
10
11
|
delete(node, children) {
|
|
11
12
|
return (0, jsx_runtime_1.jsx)("del", { children: children }, node.key);
|
|
@@ -26,7 +27,7 @@ const BASIC_RENDERERS = {
|
|
|
26
27
|
return ((0, jsx_runtime_1.jsx)("a", Object.assign({ target: "_blank", href: node.url, rel: "noreferrer" }, { children: children }), node.key));
|
|
27
28
|
},
|
|
28
29
|
paragraph(node, children) {
|
|
29
|
-
return (0, jsx_runtime_1.jsx)("p", { children: children }, node.key);
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)("p", Object.assign({ id: node.html_id }, { children: children }), node.key));
|
|
30
31
|
},
|
|
31
32
|
break(node) {
|
|
32
33
|
return (0, jsx_runtime_1.jsx)("br", {}, node.key);
|
|
@@ -39,9 +40,9 @@ const BASIC_RENDERERS = {
|
|
|
39
40
|
},
|
|
40
41
|
list(node, children) {
|
|
41
42
|
if (node.ordered) {
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)("ol", Object.assign({ start: node.start || undefined }, { children: children }), node.key));
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("ol", Object.assign({ start: node.start || undefined, id: node.html_id }, { children: children }), node.key));
|
|
43
44
|
}
|
|
44
|
-
return (0, jsx_runtime_1.jsx)("ul", { children: children }, node.key);
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)("ul", Object.assign({ id: node.html_id }, { children: children }), node.key));
|
|
45
46
|
},
|
|
46
47
|
listItem(node, children) {
|
|
47
48
|
if (node.checked == null) {
|
|
@@ -56,7 +57,7 @@ const BASIC_RENDERERS = {
|
|
|
56
57
|
return ((0, jsx_runtime_1.jsx)("figcaption", Object.assign({ className: "group" }, { children: children }), node.key));
|
|
57
58
|
},
|
|
58
59
|
blockquote(node, children) {
|
|
59
|
-
return (0, jsx_runtime_1.jsx)("blockquote", { children: children }, node.key);
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)("blockquote", Object.assign({ id: node.html_id }, { children: children }), node.key));
|
|
60
61
|
},
|
|
61
62
|
thematicBreak(node) {
|
|
62
63
|
return (0, jsx_runtime_1.jsx)("hr", { className: "py-2 my-5 translate-y-2" }, node.key);
|
|
@@ -97,7 +98,7 @@ const BASIC_RENDERERS = {
|
|
|
97
98
|
return (0, jsx_runtime_1.jsx)("sup", { children: children }, node.key);
|
|
98
99
|
},
|
|
99
100
|
abbreviation(node, children) {
|
|
100
|
-
return ((0, jsx_runtime_1.jsx)("
|
|
101
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ side: "top", card: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "bg-blue-900 text-white dark:bg-white dark:text-black text-xs p-1" }, { children: node.title })), arrowClass: "fill-blue-900 dark:fill-white" }, { children: (0, jsx_runtime_1.jsx)("abbr", Object.assign({ "aria-label": node.title, className: "cursor-help border-b border-dotted" }, { children: children })) }), node.key));
|
|
101
102
|
},
|
|
102
103
|
mystComment() {
|
|
103
104
|
return null;
|
|
@@ -106,7 +107,7 @@ const BASIC_RENDERERS = {
|
|
|
106
107
|
return null;
|
|
107
108
|
},
|
|
108
109
|
definitionList(node, children) {
|
|
109
|
-
return ((0, jsx_runtime_1.jsx)("dl", Object.assign({ className: "my-5" }, { children: children }), node.key));
|
|
110
|
+
return ((0, jsx_runtime_1.jsx)("dl", Object.assign({ className: "my-5", id: node.html_id }, { children: children }), node.key));
|
|
110
111
|
},
|
|
111
112
|
definitionTerm(node, children) {
|
|
112
113
|
let strongChildren = children;
|
package/dist/cjs/card.js
CHANGED
|
@@ -45,7 +45,7 @@ function ExternalOrInternalLink({ to, className, isStatic, prefetch = 'intent',
|
|
|
45
45
|
function Card({ children, url, isStatic, }) {
|
|
46
46
|
const parts = getParts(children);
|
|
47
47
|
const link = !!url;
|
|
48
|
-
const sharedStyle = 'my-5 rounded
|
|
48
|
+
const sharedStyle = 'my-5 rounded shadow dark:shadow-neutral-800 overflow-hidden border border-gray-100 dark:border-gray-800 flex flex-col';
|
|
49
49
|
if (link) {
|
|
50
50
|
return ((0, jsx_runtime_1.jsxs)(ExternalOrInternalLink, Object.assign({ to: url, isStatic: isStatic, className: (0, classnames_1.default)(sharedStyle, 'text-inherit hover:text-inherit', 'block font-normal no-underline hover:no-underline cursor-pointer group', 'hover:border-blue-500 dark:hover:border-blue-400') }, { children: [parts.header, (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "py-2 px-4 flex-grow" }, { children: parts.body })), parts.footer] })));
|
|
51
51
|
}
|
package/dist/cjs/cite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../../src/cite.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../../src/cite.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAc1D,eAAO,MAAM,SAAS,EAAE,YAYvB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,YAmBlB,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAGhD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/cjs/cite.js
CHANGED
|
@@ -7,13 +7,11 @@ exports.Cite = exports.CiteGroup = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const classnames_1 = __importDefault(require("classnames"));
|
|
9
9
|
const providers_1 = require("@myst-theme/providers");
|
|
10
|
-
const
|
|
10
|
+
const doi_utils_1 = __importDefault(require("doi-utils"));
|
|
11
11
|
const inlineError_1 = require("./inlineError");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const { html } = (_b = (_a = references === null || references === void 0 ? void 0 : references.cite) === null || _a === void 0 ? void 0 : _a.data[label]) !== null && _b !== void 0 ? _b : {};
|
|
16
|
-
return (0, jsx_runtime_1.jsx)("div", { dangerouslySetInnerHTML: { __html: html || '' } });
|
|
12
|
+
const HoverPopover_1 = require("./components/HoverPopover");
|
|
13
|
+
function CiteChild({ html }) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "hover-document w-[500px] sm:max-w-[500px] p-3", dangerouslySetInnerHTML: { __html: html || '' } }));
|
|
17
15
|
}
|
|
18
16
|
const CiteGroup = (node, children) => {
|
|
19
17
|
return ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, classnames_1.default)('cite-group', {
|
|
@@ -23,10 +21,14 @@ const CiteGroup = (node, children) => {
|
|
|
23
21
|
};
|
|
24
22
|
exports.CiteGroup = CiteGroup;
|
|
25
23
|
const Cite = (node, children) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const references = (0, providers_1.useReferences)();
|
|
26
|
+
const { html, doi: doiString } = (_b = (_a = references === null || references === void 0 ? void 0 : references.cite) === null || _a === void 0 ? void 0 : _a.data[node.label]) !== null && _b !== void 0 ? _b : {};
|
|
26
27
|
if (node.error) {
|
|
27
28
|
return (0, jsx_runtime_1.jsx)(inlineError_1.InlineError, { value: node.label, message: 'Citation Not Found' }, node.key);
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
const doiUrl = doiString ? doi_utils_1.default.buildUrl(doiString) : null;
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ openDelay: 300, card: (0, jsx_runtime_1.jsx)(CiteChild, { html: html }) }, { children: (0, jsx_runtime_1.jsxs)("cite", Object.assign({ className: "hover-link" }, { children: [doiUrl && ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: doiUrl, target: "_blank", rel: "noreferrer", className: "hover-link" }, { children: children }))), !doiUrl && children] })) }), node.key));
|
|
30
32
|
};
|
|
31
33
|
exports.Cite = Cite;
|
|
32
34
|
const CITE_RENDERERS = {
|
package/dist/cjs/code.d.ts
CHANGED
|
@@ -3,13 +3,15 @@ import type { InlineCode } from 'myst-spec';
|
|
|
3
3
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
4
|
type Props = {
|
|
5
5
|
value: string;
|
|
6
|
+
identifier?: string;
|
|
6
7
|
lang?: string;
|
|
7
|
-
executable?: boolean;
|
|
8
8
|
showCopy?: boolean;
|
|
9
9
|
showLineNumbers?: boolean;
|
|
10
10
|
startingLineNumber?: number;
|
|
11
11
|
emphasizeLines?: number[];
|
|
12
12
|
filename?: string;
|
|
13
|
+
shadow?: boolean;
|
|
14
|
+
background?: boolean;
|
|
13
15
|
border?: boolean;
|
|
14
16
|
className?: string;
|
|
15
17
|
};
|
package/dist/cjs/code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/code.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/code.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAWF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,eAgErC;AAiDD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA/C0B,OAAO;;;CAkDpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/cjs/code.js
CHANGED
|
@@ -21,12 +21,13 @@ function normalizeLanguage(lang) {
|
|
|
21
21
|
}
|
|
22
22
|
function CodeBlock(props) {
|
|
23
23
|
const { isLight } = (0, providers_1.useTheme)();
|
|
24
|
-
const { value, lang,
|
|
24
|
+
const { value, lang, identifier, emphasizeLines, showLineNumbers, className, showCopy = true, startingLineNumber = 1, filename, shadow, background, border, } = props;
|
|
25
25
|
const highlightLines = new Set(emphasizeLines);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ id: identifier, className: (0, classnames_1.default)('relative group not-prose overflow-auto', className, {
|
|
27
|
+
'shadow hover:shadow-md dark:shadow-2xl dark:shadow-neutral-900 my-5 text-sm': shadow,
|
|
28
|
+
'bg-stone-200/10': background,
|
|
29
|
+
'border border-l-4 border-l-blue-400 border-gray-200 dark:border-l-blue-400 dark:border-gray-800': border,
|
|
30
|
+
}) }, { children: [filename && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "leading-3 mt-1 p-1" }, { children: filename })), (0, jsx_runtime_1.jsx)(react_syntax_highlighter_1.LightAsync, Object.assign({ language: normalizeLanguage(lang), startingLineNumber: startingLineNumber, showLineNumbers: showLineNumbers, style: isLight ? Object.assign(Object.assign({}, xcode_1.default), { hljs: Object.assign(Object.assign({}, xcode_1.default.hljs), { background: 'transparent' }) }) : vs2015_1.default, wrapLines: true, lineNumberContainerStyle: {
|
|
30
31
|
// This stops page content shifts
|
|
31
32
|
display: 'inline-block',
|
|
32
33
|
float: 'left',
|
|
@@ -48,7 +49,7 @@ function CodeBlock(props) {
|
|
|
48
49
|
}
|
|
49
50
|
exports.CodeBlock = CodeBlock;
|
|
50
51
|
const code = (node) => {
|
|
51
|
-
return ((0, jsx_runtime_1.jsx)(CodeBlock, { "data-mdast-node-type": node.type, "data-mdast-node-id": node.key, value: node.value || '', lang: node.lang,
|
|
52
|
+
return ((0, jsx_runtime_1.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));
|
|
52
53
|
};
|
|
53
54
|
function isColor(maybeColorHash) {
|
|
54
55
|
if (!maybeColorHash || maybeColorHash.length > 9)
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function HoverPopover({ children, card, }: {
|
|
2
|
+
export declare function HoverPopover({ children, openDelay, card, side, arrowClass, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
openDelay?: number;
|
|
5
|
+
arrowClass?: string;
|
|
6
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
7
|
card: React.ReactNode | ((args: {
|
|
5
|
-
|
|
6
|
-
close?: () => void;
|
|
8
|
+
load: boolean;
|
|
7
9
|
}) => React.ReactNode);
|
|
8
10
|
}): JSX.Element;
|
|
9
11
|
//# sourceMappingURL=HoverPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoverPopover.d.ts","sourceRoot":"","sources":["../../../src/components/HoverPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"HoverPopover.d.ts","sourceRoot":"","sources":["../../../src/components/HoverPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAe,EACf,IAAI,EACJ,IAAI,EACJ,UAAyB,GAC1B,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CACxE,eAmBA"}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.HoverPopover = void 0;
|
|
4
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
28
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const timeoutDuration = 300;
|
|
11
|
-
const [open, setOpen] = (0, react_1.useState)(false);
|
|
12
|
-
let openTimeout;
|
|
13
|
-
let closeTimeout;
|
|
14
|
-
const onMouseEnter = () => {
|
|
15
|
-
clearTimeout(closeTimeout);
|
|
16
|
-
if (open)
|
|
17
|
-
return;
|
|
18
|
-
setOpen(true);
|
|
19
|
-
};
|
|
20
|
-
const onMouseLeave = () => {
|
|
21
|
-
clearTimeout(openTimeout);
|
|
22
|
-
if (!open)
|
|
23
|
-
return;
|
|
24
|
-
closeTimeout = setTimeout(() => setOpen(false), timeoutDuration);
|
|
25
|
-
};
|
|
26
|
-
const [popperElement, setPopperElement] = (0, react_1.useState)(null);
|
|
27
|
-
const { styles, attributes } = (0, react_popper_1.usePopper)(buttonRef.current, popperElement, {
|
|
28
|
-
placement: 'bottom-start',
|
|
29
|
-
});
|
|
30
|
-
return ((0, jsx_runtime_1.jsxs)("span", Object.assign({ onMouseLeave: onMouseLeave }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ ref: buttonRef, onMouseMove: onMouseEnter, onMouseEnter: onMouseEnter }, { children: children })), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "exclude-from-outline absolute z-30 sm:max-w-[500px]", ref: setPopperElement, style: Object.assign({}, styles.popper) }, attributes.popper, { children: (0, jsx_runtime_1.jsx)(react_2.Transition, Object.assign({ className: "my-2 p-4 shadow-xl bg-white dark:bg-zinc-900 text-sm dark:text-white rounded border border-slate-100 dark:border-zinc-500 break-words", enter: "transition ease-out duration-200", enterFrom: "opacity-0 translate-y-1", enterTo: "opacity-100 translate-y-0", leave: "transition ease-in duration-150", leaveFrom: "opacity-100 translate-y-0", leaveTo: "opacity-0 translate-y-1", onMouseEnter: onMouseEnter, show: open }, { children: typeof card === 'function' ? card({ open, close: () => setOpen(false) }) : card })) }))] })));
|
|
29
|
+
const HoverCard = __importStar(require("@radix-ui/react-hover-card"));
|
|
30
|
+
function HoverPopover({ children, openDelay = 400, card, side, arrowClass = 'fill-white', }) {
|
|
31
|
+
const [load, setLoad] = (0, react_1.useState)(false);
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)(HoverCard.Root, Object.assign({ openDelay: openDelay }, { children: [(0, jsx_runtime_1.jsx)(HoverCard.Trigger, Object.assign({ asChild: true, onMouseEnter: () => setLoad(true) }, { children: children })), (0, jsx_runtime_1.jsx)(HoverCard.Portal, { children: (0, jsx_runtime_1.jsxs)(HoverCard.Content, Object.assign({ className: "exclude-from-outline hover-card-content", sideOffset: 5, side: side }, { children: [typeof card === 'function' ? card({ load }) : card, (0, jsx_runtime_1.jsx)(HoverCard.Arrow, { className: arrowClass })] })) })] })));
|
|
31
33
|
}
|
|
32
34
|
exports.HoverPopover = HoverPopover;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkCard.d.ts","sourceRoot":"","sources":["../../../src/components/LinkCard.tsx"],"names":[],"mappings":";AAIA,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,KAAK,EACL,QAAgB,EAChB,OAAe,EACf,WAAW,EACX,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"LinkCard.d.ts","sourceRoot":"","sources":["../../../src/components/LinkCard.tsx"],"names":[],"mappings":";AAIA,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,KAAK,EACL,QAAgB,EAChB,OAAe,EACf,WAAW,EACX,SAAS,EACT,SAAmE,GACpE,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,eAuCA"}
|
|
@@ -8,8 +8,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const providers_1 = require("@myst-theme/providers");
|
|
9
9
|
const ArrowTopRightOnSquareIcon_1 = __importDefault(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"));
|
|
10
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
|
-
function LinkCard({ url, title, internal = false, loading = false, description, thumbnail, className = 'w-[300px]', }) {
|
|
11
|
+
function LinkCard({ url, title, internal = false, loading = false, description, thumbnail, className = 'w-[300px] sm:max-w-[500px] bg-white rounded shadow-md', }) {
|
|
12
12
|
const Link = (0, providers_1.useLinkProvider)();
|
|
13
|
-
|
|
13
|
+
const baseurl = (0, providers_1.useBaseurl)();
|
|
14
|
+
const to = (0, providers_1.withBaseurl)(url, baseurl);
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)('hover-card-content rounded overflow-hidden', className, {
|
|
16
|
+
'animate-pulse': loading,
|
|
17
|
+
}) }, { children: [!loading && thumbnail && ((0, jsx_runtime_1.jsx)("img", { src: thumbnail, className: "w-full h-[150px] object-cover object-top object-left m-0" })), loading && (0, jsx_runtime_1.jsx)("div", { className: "animate-pulse bg-slate-100 dark:bg-slate-800 w-full h-[150px]" }), internal && ((0, jsx_runtime_1.jsx)(Link, Object.assign({ to: to, className: "block text-sm font-semibold text-inherit hover:text-inherit px-3 mt-3", prefetch: "intent" }, { children: title }))), !internal && ((0, jsx_runtime_1.jsxs)("a", Object.assign({ href: to, className: "block text-sm font-semibold text-inherit hover:text-inherit px-3 mt-3", target: "_blank", rel: "noreferrer" }, { children: [(0, jsx_runtime_1.jsx)(ArrowTopRightOnSquareIcon_1.default, { className: "w-4 h-4 float-right" }), title] }))), !loading && description && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "p-3 prose text-sm max-h-[300px] overflow-hidden" }, { children: description })))] })));
|
|
14
18
|
}
|
|
15
19
|
exports.LinkCard = LinkCard;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CrossReference } from 'myst-spec';
|
|
3
3
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function CrossReferenceHover({ url, dataUrl, remote, children, identifier, }: {
|
|
5
|
+
remote?: boolean;
|
|
6
|
+
url?: string;
|
|
7
|
+
dataUrl?: string;
|
|
5
8
|
identifier: string;
|
|
6
|
-
|
|
9
|
+
children: React.ReactNode;
|
|
7
10
|
}): JSX.Element;
|
|
8
11
|
export declare const CrossReferenceNode: NodeRenderer<CrossReference>;
|
|
9
12
|
declare const CROSS_REFERENCE_RENDERERS: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../../src/crossReference.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../../src/crossReference.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAYhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuE1D,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EACH,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,GACX,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,eA4DA;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,cAAc,CAsB3D,CAAC;AAEF,QAAA,MAAM,yBAAyB;;CAE9B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -3,17 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CrossReferenceNode = exports.
|
|
6
|
+
exports.CrossReferenceNode = exports.CrossReferenceHover = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const unist_util_select_1 = require("unist-util-select");
|
|
9
9
|
const unist_util_visit_1 = require("unist-util-visit");
|
|
10
|
-
const LinkIcon_1 = __importDefault(require("@heroicons/react/24/outline/LinkIcon"));
|
|
11
|
-
const ArrowTopRightOnSquareIcon_1 = __importDefault(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"));
|
|
12
10
|
const providers_1 = require("@myst-theme/providers");
|
|
13
11
|
const _1 = require(".");
|
|
14
12
|
const inlineError_1 = require("./inlineError");
|
|
15
|
-
const ClickPopover_1 = require("./components/ClickPopover");
|
|
16
13
|
const swr_1 = __importDefault(require("swr"));
|
|
14
|
+
const HoverPopover_1 = require("./components/HoverPopover");
|
|
17
15
|
const MAX_NODES = 3; // Max nodes to show after a header
|
|
18
16
|
function selectMdastNodes(mdast, identifier) {
|
|
19
17
|
const identifiers = (0, unist_util_select_1.selectAll)(`[identifier=${identifier}],[key=${identifier}]`, mdast);
|
|
@@ -47,16 +45,24 @@ const fetcher = (...args) => fetch(...args).then((res) => {
|
|
|
47
45
|
});
|
|
48
46
|
// This is a small component that must be distinct based on the nodes
|
|
49
47
|
// This is because the useParse can have different numbers of hooks, which breaks things
|
|
50
|
-
function XrefChildren({ nodes }) {
|
|
48
|
+
function XrefChildren({ nodes, loading, error, identifier, }) {
|
|
51
49
|
const renderers = (0, providers_1.useNodeRenderers)();
|
|
52
50
|
const children = (0, _1.useParse)({ type: 'block', children: nodes }, renderers);
|
|
51
|
+
if (loading) {
|
|
52
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Loading..." });
|
|
53
|
+
}
|
|
54
|
+
if (error) {
|
|
55
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Error loading remote page." });
|
|
56
|
+
}
|
|
57
|
+
if (!nodes || nodes.length === 0) {
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(inlineError_1.InlineError, { value: identifier || 'No Label', message: "Cross Reference Not Found" }) }));
|
|
59
|
+
}
|
|
53
60
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
54
61
|
}
|
|
55
|
-
function
|
|
62
|
+
function CrossReferenceHover({ url, dataUrl, remote, children, identifier, }) {
|
|
56
63
|
var _a, _b, _c, _d;
|
|
57
64
|
const Link = (0, providers_1.useLinkProvider)();
|
|
58
65
|
const baseurl = (0, providers_1.useBaseurl)();
|
|
59
|
-
const { dataUrl, remote, url } = (0, providers_1.useXRefState)();
|
|
60
66
|
// dataUrl should point directly to the cross reference mdast data.
|
|
61
67
|
// If dataUrl is not provided, it will be computed by appending .json to the url.
|
|
62
68
|
const external = (_a = url === null || url === void 0 ? void 0 : url.startsWith('http')) !== null && _a !== void 0 ? _a : false;
|
|
@@ -71,31 +77,20 @@ function ReferencedContent({ identifier, close, }) {
|
|
|
71
77
|
const nodes = selectMdastNodes(mdast, identifier);
|
|
72
78
|
const htmlId = ((_c = nodes[0]) === null || _c === void 0 ? void 0 : _c.html_id) || ((_d = nodes[0]) === null || _d === void 0 ? void 0 : _d.identifier);
|
|
73
79
|
const link = `${url}${htmlId ? `#${htmlId}` : ''}`;
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const el = document.getElementById(htmlId);
|
|
79
|
-
el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth' });
|
|
80
|
-
}, 10);
|
|
80
|
+
const scroll = (e) => {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
const el = document.getElementById(htmlId);
|
|
83
|
+
el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth' });
|
|
81
84
|
};
|
|
82
|
-
|
|
83
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Loading..." });
|
|
84
|
-
}
|
|
85
|
-
if (remote && error) {
|
|
86
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Error loading remote page." });
|
|
87
|
-
}
|
|
88
|
-
if (!nodes || nodes.length === 0) {
|
|
89
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(inlineError_1.InlineError, { value: identifier || 'No Label', message: "Cross Reference Not Found" }) }));
|
|
90
|
-
}
|
|
91
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "exclude-from-outline" }, { children: [remote && external && ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: link, className: "absolute top-4 right-1", target: "_blank" }, { children: (0, jsx_runtime_1.jsx)(ArrowTopRightOnSquareIcon_1.default, { className: "w-4 h-4" }) }))), remote && !external && ((0, jsx_runtime_1.jsx)(Link, Object.assign({ to: (0, providers_1.withBaseurl)(url, baseurl), className: "absolute top-4 right-1", prefetch: "intent" }, { children: (0, jsx_runtime_1.jsx)(ArrowTopRightOnSquareIcon_1.default, { className: "w-4 h-4" }) }))), !remote && ((0, jsx_runtime_1.jsx)("button", Object.assign({ onClick: onClose, className: "absolute top-4 right-1" }, { children: (0, jsx_runtime_1.jsx)(LinkIcon_1.default, { className: "w-4 h-4" }) }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "popout" }, { children: (0, jsx_runtime_1.jsx)(XrefChildren, { nodes: nodes }) }))] })));
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: (0, jsx_runtime_1.jsx)(providers_1.XRefProvider, Object.assign({ remote: remote, url: url, dataUrl: dataUrl }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hover-document w-[500px] sm:max-w-[500px] px-3" }, { children: (0, jsx_runtime_1.jsx)(XrefChildren, { nodes: nodes, loading: remote && !data, error: remote && error, identifier: identifier }) })) })) }, { children: (0, jsx_runtime_1.jsxs)("span", { children: [remote && external && ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: link, target: "_blank", className: "hover-link" }, { children: children }))), remote && !external && ((0, jsx_runtime_1.jsx)(Link, Object.assign({ to: `${(0, providers_1.withBaseurl)(url, baseurl)}#${htmlId}`, prefetch: "intent", className: "hover-link" }, { children: children }))), !remote && ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: `#${htmlId}`, onClick: scroll, className: "hover-link" }, { children: children })))] }) })));
|
|
92
86
|
}
|
|
93
|
-
exports.
|
|
87
|
+
exports.CrossReferenceHover = CrossReferenceHover;
|
|
94
88
|
const CrossReferenceNode = (node, children) => {
|
|
95
89
|
if (!children) {
|
|
96
90
|
return ((0, jsx_runtime_1.jsx)(inlineError_1.InlineError, { value: node.label || node.identifier || 'No Label', message: "Cross Reference Not Found" }, node.key));
|
|
97
91
|
}
|
|
98
|
-
|
|
92
|
+
const { remote, url, dataUrl, identifier } = node;
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(CrossReferenceHover, Object.assign({ identifier: identifier, remote: remote, url: url, dataUrl: dataUrl }, { children: children }), node.key));
|
|
99
94
|
};
|
|
100
95
|
exports.CrossReferenceNode = CrossReferenceNode;
|
|
101
96
|
const CROSS_REFERENCE_RENDERERS = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../../src/footnotes.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../../src/footnotes.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAoB1D,eAAO,MAAM,iBAAiB,EAAE,YAY/B,CAAC;AAEF,QAAA,MAAM,kBAAkB;;;CAIvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/dist/cjs/footnotes.js
CHANGED
|
@@ -4,19 +4,19 @@ exports.FootnoteReference = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const providers_1 = require("@myst-theme/providers");
|
|
6
6
|
const _1 = require(".");
|
|
7
|
-
const ClickPopover_1 = require("./components/ClickPopover");
|
|
8
7
|
const unist_util_select_1 = require("unist-util-select");
|
|
8
|
+
const HoverPopover_1 = require("./components/HoverPopover");
|
|
9
9
|
function FootnoteDefinition({ identifier }) {
|
|
10
10
|
var _a, _b;
|
|
11
11
|
const references = (0, providers_1.useReferences)();
|
|
12
12
|
const renderers = (0, providers_1.useNodeRenderers)();
|
|
13
13
|
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 : (0, unist_util_select_1.select)(`footnoteDefinition[identifier=${identifier}]`, references === null || references === void 0 ? void 0 : references.article);
|
|
14
14
|
const children = (0, _1.useParse)(node, renderers);
|
|
15
|
-
return (0, jsx_runtime_1.jsx)(providers_1.XRefProvider, { children: children });
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(providers_1.XRefProvider, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hover-document w-[500px] sm:max-w-[500px] px-3" }, { children: children })) }));
|
|
16
16
|
}
|
|
17
17
|
const FootnoteReference = (node) => {
|
|
18
18
|
var _a;
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ openDelay: 0, card: (0, jsx_runtime_1.jsx)(FootnoteDefinition, { identifier: node.identifier }) }, { children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsxs)("sup", Object.assign({ className: "hover-link" }, { children: ["[", (_a = node.number) !== null && _a !== void 0 ? _a : node.identifier, "]"] })) }) }), node.key));
|
|
20
20
|
};
|
|
21
21
|
exports.FootnoteReference = FootnoteReference;
|
|
22
22
|
const FOOTNOTE_RENDERERS = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/heading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,KAA8B,EAC9B,QAAc,EACd,KAAK,EACL,SAAyB,EACzB,WAAW,GACZ,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/heading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,KAA8B,EAC9B,QAAc,EACd,KAAK,EACL,SAAyB,EACzB,WAAW,GACZ,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,sBA4BA;AAED,QAAA,MAAM,OAAO,EAAE,YAAY,CAAC,OAAO,CAoBlC,CAAC;AAEF,QAAA,MAAM,iBAAiB;;CAEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/dist/cjs/heading.js
CHANGED
|
@@ -15,10 +15,15 @@ function HashLink({ id, kind, title = `Link to this ${kind}`, children = '¶', h
|
|
|
15
15
|
// or return something that is **not** a link
|
|
16
16
|
return hideInPopup ? null : ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, classnames_1.default)('select-none', className) }, { children: children })));
|
|
17
17
|
}
|
|
18
|
+
const scroll = (evt) => {
|
|
19
|
+
evt.preventDefault();
|
|
20
|
+
const el = document.getElementById(id);
|
|
21
|
+
el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth' });
|
|
22
|
+
};
|
|
18
23
|
return ((0, jsx_runtime_1.jsx)("a", Object.assign({ className: (0, classnames_1.default)('select-none no-underline', className, {
|
|
19
24
|
'transition-opacity opacity-0 group-hover:opacity-70': hover,
|
|
20
25
|
'hover:underline': !hover,
|
|
21
|
-
}), href: `#${id}`, title: title, "aria-label": title }, { children: children })));
|
|
26
|
+
}), onClick: scroll, href: `#${id}`, title: title, "aria-label": title }, { children: children })));
|
|
22
27
|
}
|
|
23
28
|
exports.HashLink = HashLink;
|
|
24
29
|
const Heading = (node, children) => {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function GithubLink({ children, url, org, repo, raw, file, from, to, }: {
|
|
2
|
+
export declare function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
kind: 'file' | 'issue';
|
|
4
5
|
url: string;
|
|
5
6
|
raw: string;
|
|
6
7
|
org: string;
|
|
7
8
|
repo: string;
|
|
8
9
|
file: string;
|
|
9
10
|
from?: number;
|
|
11
|
+
issue_number?: string | number;
|
|
10
12
|
to?: number;
|
|
11
13
|
}): JSX.Element;
|
|
12
14
|
//# sourceMappingURL=github.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/links/github.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/links/github.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAoNnD,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,eAsCA"}
|
package/dist/cjs/links/github.js
CHANGED
|
@@ -7,15 +7,23 @@ exports.GithubLink = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const swr_1 = __importDefault(require("swr"));
|
|
9
9
|
const ArrowTopRightOnSquareIcon_1 = __importDefault(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"));
|
|
10
|
+
const PlusCircleIcon_1 = __importDefault(require("@heroicons/react/24/outline/PlusCircleIcon"));
|
|
11
|
+
const CheckCircleIcon_1 = __importDefault(require("@heroicons/react/24/outline/CheckCircleIcon"));
|
|
10
12
|
const HoverPopover_1 = require("../components/HoverPopover");
|
|
11
13
|
const LinkCard_1 = require("../components/LinkCard");
|
|
12
14
|
const react_1 = require("react");
|
|
13
15
|
const code_1 = require("../code");
|
|
16
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
14
17
|
const fetcher = (...args) => fetch(...args).then((res) => {
|
|
15
18
|
if (res.status === 200)
|
|
16
19
|
return res.text();
|
|
17
20
|
throw new Error(`Content returned with status ${res.status}.`);
|
|
18
21
|
});
|
|
22
|
+
const jsonFetcher = (...args) => fetch(...args).then((res) => {
|
|
23
|
+
if (res.status === 200)
|
|
24
|
+
return res.json();
|
|
25
|
+
throw new Error(`Content returned with status ${res.status}.`);
|
|
26
|
+
});
|
|
19
27
|
function extToLanguage(ext) {
|
|
20
28
|
var _a;
|
|
21
29
|
return ((_a = {
|
|
@@ -23,6 +31,7 @@ function extToLanguage(ext) {
|
|
|
23
31
|
js: 'javascript',
|
|
24
32
|
py: 'python',
|
|
25
33
|
md: 'markdown',
|
|
34
|
+
yml: 'yaml',
|
|
26
35
|
}[ext !== null && ext !== void 0 ? ext : '']) !== null && _a !== void 0 ? _a : ext);
|
|
27
36
|
}
|
|
28
37
|
function useLoadWhenOpen(open, url, loader) {
|
|
@@ -37,7 +46,7 @@ function GithubFilePreview({ url, raw, org, repo, file, from, to, open, }) {
|
|
|
37
46
|
const { data, error } = useLoadWhenOpen(open, raw, fetcher);
|
|
38
47
|
let code = data;
|
|
39
48
|
if (error) {
|
|
40
|
-
return ((0, jsx_runtime_1.jsxs)("
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hover-document w-[500px] sm:max-w-[500px]" }, { children: [(0, jsx_runtime_1.jsx)("a", Object.assign({ href: url, className: "block text-inherit hover:text-inherit", target: "_blank", rel: "noreferrer" }, { children: (0, jsx_runtime_1.jsx)(ArrowTopRightOnSquareIcon_1.default, { className: "w-4 h-4 float-right" }) })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "mt-2" }, { children: ["Error loading \"", file, "\" from GitHub."] }))] })));
|
|
41
50
|
}
|
|
42
51
|
const lang = extToLanguage(file === null || file === void 0 ? void 0 : file.split('.').pop());
|
|
43
52
|
let startingLineNumber = 1;
|
|
@@ -56,9 +65,45 @@ function GithubFilePreview({ url, raw, org, repo, file, from, to, open, }) {
|
|
|
56
65
|
code = code === null || code === void 0 ? void 0 : code.split('\n').slice(0, 10).join('\n');
|
|
57
66
|
}
|
|
58
67
|
const description = code ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(code_1.CodeBlock, { value: code, lang: lang, filename: file, showLineNumbers: true, startingLineNumber: startingLineNumber, emphasizeLines: emphasizeLines, showCopy: false }) })) : null;
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(LinkCard_1.LinkCard, { loading: !code, url: url, title: `GitHub - ${org}/${repo}`, description: description, className: "max-w-[80vw]" }));
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(LinkCard_1.LinkCard, { loading: !code, url: url, title: `GitHub - ${org}/${repo}`, description: description, className: "hover-document max-w-[80vw]" }));
|
|
69
|
+
}
|
|
70
|
+
// https://stackoverflow.com/questions/3942878/how-to-decide-font-color-in-white-or-black-depending-on-background-color
|
|
71
|
+
function useWhiteTextColor(bgColor) {
|
|
72
|
+
const color = bgColor.charAt(0) === '#' ? bgColor.substring(1, 7) : bgColor;
|
|
73
|
+
const r = parseInt(color.substring(0, 2), 16); // hexToR
|
|
74
|
+
const g = parseInt(color.substring(2, 4), 16); // hexToG
|
|
75
|
+
const b = parseInt(color.substring(4, 6), 16); // hexToB
|
|
76
|
+
return r * 0.299 + g * 0.587 + b * 0.114 <= 186;
|
|
77
|
+
}
|
|
78
|
+
function GithubIssuePreview({ url, org, repo, issue_number, open, }) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
const { data, error } = useLoadWhenOpen(open, `https://api.github.com/repos/${org}/${repo}/issues/${issue_number}`, jsonFetcher);
|
|
81
|
+
if (!data && !error) {
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hover-document w-[500px] sm:max-w-[500px] animate-pulse" }, { children: "Loading..." })));
|
|
83
|
+
}
|
|
84
|
+
const resp = data;
|
|
85
|
+
if (error) {
|
|
86
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hover-document" }, { children: [(0, jsx_runtime_1.jsx)("a", Object.assign({ href: url, className: "block text-inherit hover:text-inherit", target: "_blank", rel: "noreferrer" }, { children: (0, jsx_runtime_1.jsx)(ArrowTopRightOnSquareIcon_1.default, { className: "w-4 h-4 float-right" }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "mt-2" }, { children: "Error loading from GitHub." }))] })));
|
|
87
|
+
}
|
|
88
|
+
const dateString = new Date(resp.created_at).toLocaleDateString('en-US', {
|
|
89
|
+
year: 'numeric',
|
|
90
|
+
month: 'long',
|
|
91
|
+
day: 'numeric',
|
|
92
|
+
});
|
|
93
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hover-document w-[400px] sm:max-w-[400px] p-3" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "text-xs font-light" }, { children: [org, "/", repo] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "text-lg font-bold my-2 dark:text-white" }, { children: [resp.state === 'open' && ((0, jsx_runtime_1.jsx)(PlusCircleIcon_1.default, { className: "w-6 h-6 inline-block text-green-700 dark:text-green-500 mr-2 -translate-y-px" })), resp.state === 'closed' && ((0, jsx_runtime_1.jsx)(CheckCircleIcon_1.default, { className: "w-6 h-6 inline-block text-purple-700 dark:text-purple-500 mr-2 -translate-y-px" })), resp.title] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "text-xs font-light" }, { children: ["#", issue_number, " opened on ", dateString, " by", ' ', (0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "font-normal" }, { children: ["@", resp.user.login] }))] })), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "text-md max-h-[4rem] overflow-hidden" }, { children: resp.body })), ((_a = resp.labels) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex flex-wrap" }, { children: (_b = resp.labels) === null || _b === void 0 ? void 0 : _b.map((label) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, classnames_1.default)('mr-1 text-xs inline-flex items-center px-2 py-0.5 rounded-full', {
|
|
94
|
+
'text-white': useWhiteTextColor(label.color),
|
|
95
|
+
}), style: { backgroundColor: `#${label.color}` } }, { children: label.name }), label.id))) })))] })));
|
|
60
96
|
}
|
|
61
|
-
function GithubLink({ children, url, org, repo, raw, file, from, to, }) {
|
|
62
|
-
|
|
97
|
+
function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, }) {
|
|
98
|
+
console.log(kind);
|
|
99
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: ({ load }) => {
|
|
100
|
+
console.log('here', kind);
|
|
101
|
+
if (kind === 'file') {
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(GithubFilePreview, { url: url, raw: raw, file: file, from: from, to: to, open: load, org: org, repo: repo }));
|
|
103
|
+
}
|
|
104
|
+
if (kind === 'issue') {
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(GithubIssuePreview, { url: url, open: load, org: org, issue_number: issue_number, repo: repo }));
|
|
106
|
+
}
|
|
107
|
+
} }, { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: url, className: "italic", target: "_blank", rel: "noreferrer" }, { children: children })) })));
|
|
63
108
|
}
|
|
64
109
|
exports.GithubLink = GithubLink;
|
|
@@ -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;AAKtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D,KAAK,eAAe,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA0CxE,eAAO,MAAM,IAAI,EAAE,YAAY,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/links/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D,KAAK,eAAe,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA0CxE,eAAO,MAAM,IAAI,EAAE,YAAY,CAAC,eAAe,CAiD9C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,eAAe,CAkCnD,CAAC;AAEF,QAAA,MAAM,cAAc;;;CAGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/cjs/links/index.js
CHANGED
|
@@ -35,16 +35,16 @@ function InternalLink({ url, children }) {
|
|
|
35
35
|
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: (0, jsx_runtime_1.jsx)(LinkCard_1.LinkCard, { internal: true, url: url, title: page.title, description: page.description, thumbnail: page.thumbnailOptimized || page.thumbnail }) }, { children: (0, jsx_runtime_1.jsx)(Link, Object.assign({ to: (0, providers_1.withBaseurl)(url, baseurl), prefetch: "intent" }, { children: children })) })));
|
|
36
36
|
}
|
|
37
37
|
const link = (node, children) => {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
39
39
|
const internal = (_a = node.internal) !== null && _a !== void 0 ? _a : false;
|
|
40
40
|
const protocol = node.protocol;
|
|
41
41
|
switch (protocol) {
|
|
42
42
|
case 'wiki':
|
|
43
43
|
return ((0, jsx_runtime_1.jsx)(wiki_1.WikiLink, Object.assign({ 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));
|
|
44
44
|
case 'github':
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(github_1.GithubLink, Object.assign({ url: node.url, org: (
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(github_1.GithubLink, Object.assign({ 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));
|
|
46
46
|
case 'rrid':
|
|
47
|
-
return (0, jsx_runtime_1.jsx)(rrid_1.RRIDLink, { rrid: (
|
|
47
|
+
return (0, jsx_runtime_1.jsx)(rrid_1.RRIDLink, { rrid: (_m = node.data) === null || _m === void 0 ? void 0 : _m.rrid }, node.key);
|
|
48
48
|
default:
|
|
49
49
|
if (internal) {
|
|
50
50
|
return ((0, jsx_runtime_1.jsx)(InternalLink, Object.assign({ url: node.url }, { children: children }), node.key));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rrid.d.ts","sourceRoot":"","sources":["../../../src/links/rrid.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"rrid.d.ts","sourceRoot":"","sources":["../../../src/links/rrid.tsx"],"names":[],"mappings":";AAkEA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,eAQlD"}
|
package/dist/cjs/links/rrid.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.RRIDLink = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const swr_1 = __importDefault(require("swr"));
|
|
9
|
-
const
|
|
10
|
-
const ClickPopover_1 = require("../components/ClickPopover");
|
|
9
|
+
const HoverPopover_1 = require("../components/HoverPopover");
|
|
11
10
|
const fetcher = (...args) => fetch(...args).then((res) => {
|
|
12
11
|
if (res.status === 200)
|
|
13
12
|
return res.json();
|
|
@@ -17,19 +16,19 @@ function RRIDChild({ rrid }) {
|
|
|
17
16
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
18
17
|
const { data, error } = (0, swr_1.default)(`https://scicrunch.org/resolver/${rrid}.json`, fetcher);
|
|
19
18
|
if (!data && !error) {
|
|
20
|
-
return (0, jsx_runtime_1.jsx)("
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hover-document w-[500px] sm:max-w-[500px] animate-pulse" }, { children: "Loading..." })));
|
|
21
20
|
}
|
|
22
21
|
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];
|
|
23
22
|
if (error || !hit) {
|
|
24
|
-
return (0, jsx_runtime_1.jsxs)("
|
|
23
|
+
return (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hover-document w-[500px] sm:max-w-[500px]" }, { children: ["Error loading ", rrid, "."] }));
|
|
25
24
|
}
|
|
26
25
|
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 : {};
|
|
27
26
|
const category = (_e = supercategory === null || supercategory === void 0 ? void 0 : supercategory[0]) === null || _e === void 0 ? void 0 : _e.name;
|
|
28
27
|
const types = (_f = categories === null || categories === void 0 ? void 0 : categories.map(({ name }) => name)) !== null && _f !== void 0 ? _f : [];
|
|
29
28
|
const tags = (_g = keywords === null || keywords === void 0 ? void 0 : keywords.map(({ keyword }) => keyword)) !== null && _g !== void 0 ? _g : [];
|
|
30
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hover-document w-[500px] sm:max-w-[500px] p-3" }, { children: [(0, jsx_runtime_1.jsxs)("p", Object.assign({ className: "text-sm font-light" }, { children: ["RRID: ", category] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "text-xl font-bold mb-4" }, { children: [title, " ", (0, jsx_runtime_1.jsx)("code", { children: curie })] })), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "text-md" }, { children: description })), types.length > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-xs font-thin my-2" }, { children: "Categories" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex flex-wrap ml-1" }, { children: types === null || types === void 0 ? void 0 : types.map((tag) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "ml-1 text-xs inline-flex items-center uppercase px-3 py-1 rounded-full border" }, { children: tag })))) }))] })), tags.length > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-xs font-thin my-2" }, { children: "Tags" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex flex-wrap ml-1" }, { children: tags === null || tags === void 0 ? void 0 : tags.map((tag) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "ml-1 text-xs inline-flex items-center uppercase px-3 py-1 rounded-full border" }, { children: tag })))) }))] }))] })));
|
|
31
30
|
}
|
|
32
31
|
function RRIDLink({ rrid }) {
|
|
33
|
-
return ((0, jsx_runtime_1.
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: (0, jsx_runtime_1.jsx)(RRIDChild, { rrid: rrid }) }, { children: (0, jsx_runtime_1.jsxs)("a", Object.assign({ href: `https://scicrunch.org/resolver/${rrid}`, target: "_blank", rel: "noopener noreferrer" }, { children: ["RRID: ", (0, jsx_runtime_1.jsx)("cite", Object.assign({ className: "italic" }, { children: rrid }))] })) })));
|
|
34
33
|
}
|
|
35
34
|
exports.RRIDLink = RRIDLink;
|
package/dist/cjs/links/wiki.js
CHANGED
|
@@ -22,9 +22,9 @@ function createWikiUrl(name, wiki) {
|
|
|
22
22
|
function createWikiApiUrl(name, wiki) {
|
|
23
23
|
return `${wiki || ENGLISH_WIKIPEDIA}api/rest_v1/page/summary/${name}`;
|
|
24
24
|
}
|
|
25
|
-
function WikiChild({ page, wiki,
|
|
25
|
+
function WikiChild({ page, wiki, load }) {
|
|
26
26
|
var _a, _b;
|
|
27
|
-
const { data, error } = (0, swr_1.default)(
|
|
27
|
+
const { data, error } = (0, swr_1.default)(load ? createWikiApiUrl(page, wiki) : null, fetcher);
|
|
28
28
|
const { thumbnail, extract, content_urls } = data !== null && data !== void 0 ? data : {};
|
|
29
29
|
const url = (_b = (_a = content_urls === null || content_urls === void 0 ? void 0 : content_urls.desktop) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : createWikiUrl(page);
|
|
30
30
|
const image = thumbnail === null || thumbnail === void 0 ? void 0 : thumbnail.source;
|
|
@@ -34,6 +34,6 @@ function WikiChild({ page, wiki, open }) {
|
|
|
34
34
|
return ((0, jsx_runtime_1.jsx)(LinkCard_1.LinkCard, { loading: !data, url: url, title: (0, jsx_runtime_1.jsx)(WikiTextMark, {}), thumbnail: image, description: extract }));
|
|
35
35
|
}
|
|
36
36
|
function WikiLink({ children, page, url, wiki, }) {
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: ({
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: ({ load }) => (0, jsx_runtime_1.jsx)(WikiChild, { wiki: wiki, page: page, load: load }) }, { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: url, className: "italic", target: "_blank", rel: "noreferrer" }, { children: children })) })));
|
|
38
38
|
}
|
|
39
39
|
exports.WikiLink = WikiLink;
|
package/dist/cjs/proof.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/proof.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;AAK1D,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAqFhF,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,
|
|
1
|
+
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/proof.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;AAK1D,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAqFhF,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,eA4DA;AAED,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,cAAc,CAsBtD,CAAC;AAEF,QAAA,MAAM,eAAe;;CAEpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/cjs/proof.js
CHANGED
|
@@ -75,21 +75,22 @@ const HeaderElement = ({ dropdown, className, children, }) => {
|
|
|
75
75
|
};
|
|
76
76
|
const iconClass = 'h-8 w-8 inline-block pl-2 mr-2 self-center flex-none';
|
|
77
77
|
function Proof({ title, kind, color, dropdown, children, identifier, enumerator, }) {
|
|
78
|
-
return ((0, jsx_runtime_1.jsxs)(WrapperElement, Object.assign({ id: identifier, dropdown: dropdown, className: (0, classnames_1.default)('my-5 shadow
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
'bg-
|
|
88
|
-
'bg-
|
|
89
|
-
'bg-
|
|
90
|
-
'bg-
|
|
91
|
-
'bg-
|
|
92
|
-
'bg-
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(WrapperElement, Object.assign({ id: identifier, dropdown: dropdown, className: (0, classnames_1.default)('my-5 shadow dark:bg-stone-800 overflow-hidden', 'dark:border-l-4 border-slate-400', {
|
|
79
|
+
'dark:border-gray-500/60': !color || color === 'gray',
|
|
80
|
+
'dark:border-blue-500/60': color === 'blue',
|
|
81
|
+
'dark:border-green-500/60': color === 'green',
|
|
82
|
+
'dark:border-amber-500/70': color === 'yellow',
|
|
83
|
+
'dark:border-orange-500/60': color === 'orange',
|
|
84
|
+
'dark:border-red-500/60': color === 'red',
|
|
85
|
+
'dark:border-purple-500/60': color === 'purple',
|
|
86
|
+
}) }, { children: [(0, jsx_runtime_1.jsxs)(HeaderElement, Object.assign({ dropdown: dropdown, className: (0, classnames_1.default)('m-0 font-medium py-2 flex min-w-0', 'text-md', 'border-y dark:border-y-0', {
|
|
87
|
+
'bg-gray-50/80 dark:bg-slate-900': !color || color === 'gray',
|
|
88
|
+
'bg-blue-50/80 dark:bg-slate-900': color === 'blue',
|
|
89
|
+
'bg-green-50/80 dark:bg-slate-900': color === 'green',
|
|
90
|
+
'bg-amber-50/80 dark:bg-slate-900': color === 'yellow',
|
|
91
|
+
'bg-orange-50/80 dark:bg-slate-900': color === 'orange',
|
|
92
|
+
'bg-red-50/80 dark:bg-slate-900': color === 'red',
|
|
93
|
+
'bg-purple-50/80 dark:bg-slate-900': color === 'purple',
|
|
93
94
|
'cursor-pointer hover:shadow-[inset_0_0_0px_30px_#00000003] dark:hover:shadow-[inset_0_0_0px_30px_#FFFFFF03]': dropdown,
|
|
94
95
|
}) }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)('text-neutral-900 dark:text-white grow self-center overflow-hidden break-words', 'ml-4') }, { children: [(0, jsx_runtime_1.jsxs)(heading_1.HashLink, Object.assign({ id: identifier, kind: capitalize(kind) }, { children: [capitalize(kind), " ", enumerator] })), ' ', title && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["(", title, ")"] })] })), dropdown && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "font-thin text-sm text-neutral-700 dark:text-neutral-200 self-center flex-none" }, { children: (0, jsx_runtime_1.jsx)(ChevronRightIcon_1.default, { className: (0, classnames_1.default)(iconClass, 'transition-transform details-toggle') }) })))] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)('px-4', { 'details-body': dropdown }) }, { children: children }))] })));
|
|
95
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/basic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/basic.tsx"],"names":[],"mappings":"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"}
|
package/dist/types/cite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../../src/cite.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../../src/cite.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAc1D,eAAO,MAAM,SAAS,EAAE,YAYvB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,YAmBlB,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAGhD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/types/code.d.ts
CHANGED
|
@@ -3,13 +3,15 @@ import type { InlineCode } from 'myst-spec';
|
|
|
3
3
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
4
|
type Props = {
|
|
5
5
|
value: string;
|
|
6
|
+
identifier?: string;
|
|
6
7
|
lang?: string;
|
|
7
|
-
executable?: boolean;
|
|
8
8
|
showCopy?: boolean;
|
|
9
9
|
showLineNumbers?: boolean;
|
|
10
10
|
startingLineNumber?: number;
|
|
11
11
|
emphasizeLines?: number[];
|
|
12
12
|
filename?: string;
|
|
13
|
+
shadow?: boolean;
|
|
14
|
+
background?: boolean;
|
|
13
15
|
border?: boolean;
|
|
14
16
|
className?: string;
|
|
15
17
|
};
|
package/dist/types/code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/code.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/code.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAWF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,eAgErC;AAiDD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA/C0B,OAAO;;;CAkDpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function HoverPopover({ children, card, }: {
|
|
2
|
+
export declare function HoverPopover({ children, openDelay, card, side, arrowClass, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
openDelay?: number;
|
|
5
|
+
arrowClass?: string;
|
|
6
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
7
|
card: React.ReactNode | ((args: {
|
|
5
|
-
|
|
6
|
-
close?: () => void;
|
|
8
|
+
load: boolean;
|
|
7
9
|
}) => React.ReactNode);
|
|
8
10
|
}): JSX.Element;
|
|
9
11
|
//# sourceMappingURL=HoverPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoverPopover.d.ts","sourceRoot":"","sources":["../../../src/components/HoverPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"HoverPopover.d.ts","sourceRoot":"","sources":["../../../src/components/HoverPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAe,EACf,IAAI,EACJ,IAAI,EACJ,UAAyB,GAC1B,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CACxE,eAmBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkCard.d.ts","sourceRoot":"","sources":["../../../src/components/LinkCard.tsx"],"names":[],"mappings":";AAIA,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,KAAK,EACL,QAAgB,EAChB,OAAe,EACf,WAAW,EACX,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"LinkCard.d.ts","sourceRoot":"","sources":["../../../src/components/LinkCard.tsx"],"names":[],"mappings":";AAIA,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,KAAK,EACL,QAAgB,EAChB,OAAe,EACf,WAAW,EACX,SAAS,EACT,SAAmE,GACpE,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,eAuCA"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CrossReference } from 'myst-spec';
|
|
3
3
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function CrossReferenceHover({ url, dataUrl, remote, children, identifier, }: {
|
|
5
|
+
remote?: boolean;
|
|
6
|
+
url?: string;
|
|
7
|
+
dataUrl?: string;
|
|
5
8
|
identifier: string;
|
|
6
|
-
|
|
9
|
+
children: React.ReactNode;
|
|
7
10
|
}): JSX.Element;
|
|
8
11
|
export declare const CrossReferenceNode: NodeRenderer<CrossReference>;
|
|
9
12
|
declare const CROSS_REFERENCE_RENDERERS: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../../src/crossReference.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../../src/crossReference.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAYhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuE1D,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EACH,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,GACX,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,eA4DA;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,cAAc,CAsB3D,CAAC;AAEF,QAAA,MAAM,yBAAyB;;CAE9B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../../src/footnotes.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../../src/footnotes.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAoB1D,eAAO,MAAM,iBAAiB,EAAE,YAY/B,CAAC;AAEF,QAAA,MAAM,kBAAkB;;;CAIvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/heading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,KAA8B,EAC9B,QAAc,EACd,KAAK,EACL,SAAyB,EACzB,WAAW,GACZ,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/heading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,KAA8B,EAC9B,QAAc,EACd,KAAK,EACL,SAAyB,EACzB,WAAW,GACZ,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,sBA4BA;AAED,QAAA,MAAM,OAAO,EAAE,YAAY,CAAC,OAAO,CAoBlC,CAAC;AAEF,QAAA,MAAM,iBAAiB;;CAEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function GithubLink({ children, url, org, repo, raw, file, from, to, }: {
|
|
2
|
+
export declare function GithubLink({ kind, children, url, org, repo, raw, file, from, to, issue_number, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
kind: 'file' | 'issue';
|
|
4
5
|
url: string;
|
|
5
6
|
raw: string;
|
|
6
7
|
org: string;
|
|
7
8
|
repo: string;
|
|
8
9
|
file: string;
|
|
9
10
|
from?: number;
|
|
11
|
+
issue_number?: string | number;
|
|
10
12
|
to?: number;
|
|
11
13
|
}): JSX.Element;
|
|
12
14
|
//# sourceMappingURL=github.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/links/github.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/links/github.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAoNnD,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,eAsCA"}
|
|
@@ -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;AAKtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D,KAAK,eAAe,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA0CxE,eAAO,MAAM,IAAI,EAAE,YAAY,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/links/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D,KAAK,eAAe,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA0CxE,eAAO,MAAM,IAAI,EAAE,YAAY,CAAC,eAAe,CAiD9C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,eAAe,CAkCnD,CAAC;AAEF,QAAA,MAAM,cAAc;;;CAGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rrid.d.ts","sourceRoot":"","sources":["../../../src/links/rrid.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"rrid.d.ts","sourceRoot":"","sources":["../../../src/links/rrid.tsx"],"names":[],"mappings":";AAkEA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,eAQlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/proof.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;AAK1D,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAqFhF,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,
|
|
1
|
+
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/proof.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;AAK1D,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAqFhF,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,eA4DA;AAED,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,cAAc,CAsBtD,CAAC;AAEF,QAAA,MAAM,eAAe;;CAEpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"types": "dist/types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -17,17 +17,15 @@
|
|
|
17
17
|
"build": "npm-run-all -l clean -p build:cjs build:types"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@myst-theme/providers": "^0.2.4",
|
|
21
|
-
"@headlessui/react": "^1.7.13",
|
|
22
20
|
"@heroicons/react": "^2.0.13",
|
|
23
|
-
"@
|
|
21
|
+
"@myst-theme/providers": "^0.2.6",
|
|
22
|
+
"@radix-ui/react-hover-card": "^1.0.5",
|
|
24
23
|
"buffer": "^6.0.3",
|
|
25
24
|
"classnames": "^2.3.2",
|
|
26
25
|
"myst-common": "^0.0.16",
|
|
27
26
|
"myst-config": "^0.0.14",
|
|
28
27
|
"myst-spec": "^0.0.4",
|
|
29
28
|
"nanoid": "^4.0.0",
|
|
30
|
-
"react-popper": "^2.3.0",
|
|
31
29
|
"react-syntax-highlighter": "^15.5.0",
|
|
32
30
|
"swr": "^1.3.0",
|
|
33
31
|
"unist-util-select": "^4.0.3"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export declare function ClickPopover({ children, card, as, }: {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
card: React.ReactNode | ((args: {
|
|
6
|
-
open: boolean;
|
|
7
|
-
close: () => void;
|
|
8
|
-
}) => React.ReactNode);
|
|
9
|
-
as?: ElementType;
|
|
10
|
-
}): JSX.Element;
|
|
11
|
-
//# sourceMappingURL=ClickPopover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickPopover.d.ts","sourceRoot":"","sources":["../../../src/components/ClickPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,IAAI,EACJ,EAAW,GACZ,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1F,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB,eAyCA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ClickPopover = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const react_2 = require("@headlessui/react");
|
|
10
|
-
const react_popper_1 = require("react-popper");
|
|
11
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
12
|
-
function ClickPopover({ children, card, as = 'cite', }) {
|
|
13
|
-
const [referenceElement, setReferenceElement] = (0, react_1.useState)(null);
|
|
14
|
-
const [popperElement, setPopperElement] = (0, react_1.useState)(null);
|
|
15
|
-
const { styles, attributes } = (0, react_popper_1.usePopper)(referenceElement, popperElement);
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Popover, Object.assign({ as: "span" }, { children: ({ open, close }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Popover.Button, Object.assign({ ref: setReferenceElement, as: as, className: (0, classnames_1.default)({ 'border-dotted': !open }, 'cursor-zoom-in border-b-2 border-b-blue-600 hover:text-blue-600 hover:border-solid', { 'text-blue-600 border-solid': open }) }, { children: children })), (0, jsx_runtime_1.jsx)(react_2.Popover.Panel, Object.assign({ className: "exclude-from-outline absolute z-30 sm:max-w-[500px]", ref: setPopperElement, style: Object.assign({}, styles.popper) }, attributes.popper, { children: (0, jsx_runtime_1.jsx)(react_2.Transition, Object.assign({ className: "my-2 p-4 shadow-xl bg-white dark:bg-zinc-900 text-sm dark:text-white rounded border-2 border-slate-200 dark:border-zinc-500 break-words", enter: "transition ease-out duration-200", enterFrom: "opacity-0 translate-y-1", enterTo: "opacity-100 translate-y-0", leave: "transition ease-in duration-150", leaveFrom: "opacity-100 translate-y-0", leaveTo: "opacity-0 translate-y-1" }, { children: open && (typeof card === 'function' ? card({ open, close }) : card) })) }))] })) })));
|
|
17
|
-
}
|
|
18
|
-
exports.ClickPopover = ClickPopover;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export declare function ClickPopover({ children, card, as, }: {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
card: React.ReactNode | ((args: {
|
|
6
|
-
open: boolean;
|
|
7
|
-
close: () => void;
|
|
8
|
-
}) => React.ReactNode);
|
|
9
|
-
as?: ElementType;
|
|
10
|
-
}): JSX.Element;
|
|
11
|
-
//# sourceMappingURL=ClickPopover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickPopover.d.ts","sourceRoot":"","sources":["../../../src/components/ClickPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,IAAI,EACJ,EAAW,GACZ,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1F,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB,eAyCA"}
|