myst-to-react 0.2.3 → 0.2.5
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 +3 -3
- 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 +1 -1
- package/dist/cjs/heading.d.ts.map +1 -1
- package/dist/cjs/heading.js +7 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/links/github.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 +36 -0
- package/dist/cjs/proof.d.ts.map +1 -0
- package/dist/cjs/proof.js +110 -0
- 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 +1 -1
- package/dist/types/heading.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/links/rrid.d.ts.map +1 -1
- package/dist/types/proof.d.ts +36 -0
- package/dist/types/proof.d.ts.map +1 -0
- 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',
|
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":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,KAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,uBAAuB,CAAC;CAC/B,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC9D,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,aAAa,EAAE,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAChD,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5C,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE9C,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAEpD,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAExC,aAAa,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACnC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAEnC,cAAc,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C,cAAc,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C,qBAAqB,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAC;CAC5D,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,kBAmMtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
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;AAS1D,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 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 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 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 = {
|
package/dist/cjs/heading.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Heading } from 'myst-spec';
|
|
3
3
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
4
|
export declare function HashLink({ id, kind, title, children, hover, className, hideInPopup, }: {
|
|
5
|
-
id
|
|
5
|
+
id?: string;
|
|
6
6
|
kind: string;
|
|
7
7
|
title?: string;
|
|
8
8
|
hover?: boolean;
|
|
@@ -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,EAAE,MAAM,CAAC;
|
|
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
|
@@ -10,15 +10,20 @@ const react_1 = require("react");
|
|
|
10
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
11
|
function HashLink({ id, kind, title = `Link to this ${kind}`, children = '¶', hover, className = 'font-normal', hideInPopup, }) {
|
|
12
12
|
const { inCrossRef } = (0, providers_1.useXRefState)();
|
|
13
|
-
if (inCrossRef) {
|
|
13
|
+
if (inCrossRef || !id) {
|
|
14
14
|
// If we are in a cross-reference pop-out, either hide hash link
|
|
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) => {
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAsBjD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEzC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAoB1D,CAAC;AAEF,wBAAgB,QAAQ,CACtB,IAAI,EAAE,aAAa,GAAG,IAAI,EAC1B,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAqB,6BAU5D"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const crossReference_1 = __importDefault(require("./crossReference"));
|
|
|
23
23
|
const tabs_1 = __importDefault(require("./tabs"));
|
|
24
24
|
const extensions_1 = __importDefault(require("./extensions"));
|
|
25
25
|
const inlineExpression_1 = __importDefault(require("./inlineExpression"));
|
|
26
|
+
const proof_1 = __importDefault(require("./proof"));
|
|
26
27
|
var CopyIcon_1 = require("./components/CopyIcon");
|
|
27
28
|
Object.defineProperty(exports, "CopyIcon", { enumerable: true, get: function () { return CopyIcon_1.CopyIcon; } });
|
|
28
29
|
var code_2 = require("./code");
|
|
@@ -35,7 +36,7 @@ Object.defineProperty(exports, "Details", { enumerable: true, get: function () {
|
|
|
35
36
|
var tabs_2 = require("./tabs");
|
|
36
37
|
Object.defineProperty(exports, "TabSet", { enumerable: true, get: function () { return tabs_2.TabSet; } });
|
|
37
38
|
Object.defineProperty(exports, "TabItem", { enumerable: true, get: function () { return tabs_2.TabItem; } });
|
|
38
|
-
exports.DEFAULT_RENDERERS = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, basic_1.default), image_1.default), links_1.default), code_1.default), math_1.default), cite_1.default), tabs_1.default), iframe_1.default), footnotes_1.default), admonitions_1.default), reactive_1.default), heading_1.default), crossReference_1.default), dropdown_1.default), card_1.default), grid_1.default), inlineExpression_1.default), extensions_1.default);
|
|
39
|
+
exports.DEFAULT_RENDERERS = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, basic_1.default), image_1.default), links_1.default), code_1.default), math_1.default), cite_1.default), tabs_1.default), iframe_1.default), footnotes_1.default), admonitions_1.default), reactive_1.default), heading_1.default), crossReference_1.default), dropdown_1.default), card_1.default), grid_1.default), inlineExpression_1.default), extensions_1.default), proof_1.default);
|
|
39
40
|
function useParse(node, renderers = exports.DEFAULT_RENDERERS) {
|
|
40
41
|
if (!node)
|
|
41
42
|
return null;
|
package/dist/cjs/links/github.js
CHANGED
|
@@ -37,7 +37,7 @@ function GithubFilePreview({ url, raw, org, repo, file, from, to, open, }) {
|
|
|
37
37
|
const { data, error } = useLoadWhenOpen(open, raw, fetcher);
|
|
38
38
|
let code = data;
|
|
39
39
|
if (error) {
|
|
40
|
-
return ((0, jsx_runtime_1.jsxs)("
|
|
40
|
+
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.jsxs)("div", Object.assign({ className: "mt-2" }, { children: ["Error loading \"", file, "\" from GitHub."] }))] })));
|
|
41
41
|
}
|
|
42
42
|
const lang = extToLanguage(file === null || file === void 0 ? void 0 : file.split('.').pop());
|
|
43
43
|
let startingLineNumber = 1;
|
|
@@ -56,9 +56,9 @@ function GithubFilePreview({ url, raw, org, repo, file, from, to, open, }) {
|
|
|
56
56
|
code = code === null || code === void 0 ? void 0 : code.split('\n').slice(0, 10).join('\n');
|
|
57
57
|
}
|
|
58
58
|
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]" }));
|
|
59
|
+
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]" }));
|
|
60
60
|
}
|
|
61
61
|
function GithubLink({ children, url, org, repo, raw, file, from, to, }) {
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: ({
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(HoverPopover_1.HoverPopover, Object.assign({ card: ({ load }) => ((0, jsx_runtime_1.jsx)(GithubFilePreview, { url: url, raw: raw, file: file, from: from, to: to, open: load, org: org, repo: repo })) }, { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: url, className: "italic", target: "_blank", rel: "noreferrer" }, { children: children })) })));
|
|
63
63
|
}
|
|
64
64
|
exports.GithubLink = GithubLink;
|
|
@@ -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":";AAgEA,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 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" }, { 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 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;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Admonition as AdmonitionSpec } from 'myst-spec';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
|
+
export declare enum ProofKind {
|
|
5
|
+
proof = "proof",
|
|
6
|
+
axiom = "axiom",
|
|
7
|
+
lemma = "lemma",
|
|
8
|
+
definition = "definition",
|
|
9
|
+
criterion = "criterion",
|
|
10
|
+
remark = "remark",
|
|
11
|
+
conjecture = "conjecture",
|
|
12
|
+
corollary = "corollary",
|
|
13
|
+
algorithm = "algorithm",
|
|
14
|
+
example = "example",
|
|
15
|
+
property = "property",
|
|
16
|
+
observation = "observation",
|
|
17
|
+
proposition = "proposition",
|
|
18
|
+
assumption = "assumption",
|
|
19
|
+
theorem = "theorem"
|
|
20
|
+
}
|
|
21
|
+
type Color = 'gray' | 'blue' | 'green' | 'yellow' | 'orange' | 'red' | 'purple';
|
|
22
|
+
export declare function Proof({ title, kind, color, dropdown, children, identifier, enumerator, }: {
|
|
23
|
+
title?: React.ReactNode;
|
|
24
|
+
color?: Color;
|
|
25
|
+
kind?: ProofKind;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
dropdown?: boolean;
|
|
28
|
+
identifier?: string;
|
|
29
|
+
enumerator?: string;
|
|
30
|
+
}): JSX.Element;
|
|
31
|
+
export declare const ProofRenderer: NodeRenderer<AdmonitionSpec>;
|
|
32
|
+
declare const PROOF_RENDERERS: {
|
|
33
|
+
proof: NodeRenderer<AdmonitionSpec>;
|
|
34
|
+
};
|
|
35
|
+
export default PROOF_RENDERERS;
|
|
36
|
+
//# sourceMappingURL=proof.d.ts.map
|
|
@@ -0,0 +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,eAwDA;AAED,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,cAAc,CAsBtD,CAAC;AAEF,QAAA,MAAM,eAAe;;CAEpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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.ProofRenderer = exports.Proof = exports.ProofKind = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ChevronRightIcon_1 = __importDefault(require("@heroicons/react/24/solid/ChevronRightIcon"));
|
|
9
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
const heading_1 = require("./heading");
|
|
11
|
+
var ProofKind;
|
|
12
|
+
(function (ProofKind) {
|
|
13
|
+
ProofKind["proof"] = "proof";
|
|
14
|
+
ProofKind["axiom"] = "axiom";
|
|
15
|
+
ProofKind["lemma"] = "lemma";
|
|
16
|
+
ProofKind["definition"] = "definition";
|
|
17
|
+
ProofKind["criterion"] = "criterion";
|
|
18
|
+
ProofKind["remark"] = "remark";
|
|
19
|
+
ProofKind["conjecture"] = "conjecture";
|
|
20
|
+
ProofKind["corollary"] = "corollary";
|
|
21
|
+
ProofKind["algorithm"] = "algorithm";
|
|
22
|
+
ProofKind["example"] = "example";
|
|
23
|
+
ProofKind["property"] = "property";
|
|
24
|
+
ProofKind["observation"] = "observation";
|
|
25
|
+
ProofKind["proposition"] = "proposition";
|
|
26
|
+
ProofKind["assumption"] = "assumption";
|
|
27
|
+
ProofKind["theorem"] = "theorem";
|
|
28
|
+
})(ProofKind = exports.ProofKind || (exports.ProofKind = {}));
|
|
29
|
+
function getClasses(className) {
|
|
30
|
+
var _a;
|
|
31
|
+
const classes = (_a = className === null || className === void 0 ? void 0 : className.split(' ').map((s) => s.trim().toLowerCase()).filter((s) => !!s)) !== null && _a !== void 0 ? _a : [];
|
|
32
|
+
return [...new Set(classes)];
|
|
33
|
+
}
|
|
34
|
+
function capitalize(kind) {
|
|
35
|
+
if (!kind)
|
|
36
|
+
return '';
|
|
37
|
+
return kind.slice(0, 1).toUpperCase() + kind.slice(1);
|
|
38
|
+
}
|
|
39
|
+
function getColor({ kind }) {
|
|
40
|
+
switch (kind) {
|
|
41
|
+
case ProofKind.proof:
|
|
42
|
+
case ProofKind.algorithm:
|
|
43
|
+
return { color: 'gray' };
|
|
44
|
+
case ProofKind.lemma:
|
|
45
|
+
case ProofKind.conjecture:
|
|
46
|
+
case ProofKind.theorem:
|
|
47
|
+
return { color: 'purple' };
|
|
48
|
+
case ProofKind.observation:
|
|
49
|
+
case ProofKind.assumption:
|
|
50
|
+
case ProofKind.axiom:
|
|
51
|
+
return { color: 'yellow' };
|
|
52
|
+
case ProofKind.criterion:
|
|
53
|
+
case ProofKind.corollary:
|
|
54
|
+
case ProofKind.property:
|
|
55
|
+
return { color: 'orange' };
|
|
56
|
+
case ProofKind.example:
|
|
57
|
+
return { color: 'green' };
|
|
58
|
+
case ProofKind.remark:
|
|
59
|
+
return { color: 'red' };
|
|
60
|
+
case ProofKind.definition:
|
|
61
|
+
case ProofKind.proposition:
|
|
62
|
+
default:
|
|
63
|
+
return { color: 'blue' };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const WrapperElement = ({ id, dropdown, className, children, }) => {
|
|
67
|
+
if (dropdown)
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)("details", Object.assign({ id: id, className: className }, { children: children })));
|
|
69
|
+
return ((0, jsx_runtime_1.jsx)("aside", Object.assign({ id: id, className: className }, { children: children })));
|
|
70
|
+
};
|
|
71
|
+
const HeaderElement = ({ dropdown, className, children, }) => {
|
|
72
|
+
if (dropdown)
|
|
73
|
+
return (0, jsx_runtime_1.jsx)("summary", Object.assign({ className: className }, { children: children }));
|
|
74
|
+
return (0, jsx_runtime_1.jsx)("div", Object.assign({ className: className }, { children: children }));
|
|
75
|
+
};
|
|
76
|
+
const iconClass = 'h-8 w-8 inline-block pl-2 mr-2 self-center flex-none';
|
|
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', 'dark:bg-stone-800', 'overflow-hidden', {
|
|
79
|
+
// 'shadow-lg': !color || color === 'gray',
|
|
80
|
+
// 'border-l-2 border-blue-500': color === 'blue',
|
|
81
|
+
// 'border-l-2 border-green-500': color === 'green',
|
|
82
|
+
// 'border-l-2 border-amber-500': color === 'yellow',
|
|
83
|
+
// 'border-l-2 border-orange-500': color === 'orange',
|
|
84
|
+
// 'border-l-2 border-red-500': color === 'red',
|
|
85
|
+
}) }, { 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 dark:border-l-4 border-slate-400', {
|
|
86
|
+
'bg-gray-50/80 dark:bg-slate-900 dark:border-gray-500': !color || color === 'gray',
|
|
87
|
+
'bg-blue-50/80 dark:bg-slate-900 dark:border-blue-500': color === 'blue',
|
|
88
|
+
'bg-green-50/80 dark:bg-slate-900 dark:border-green-500': color === 'green',
|
|
89
|
+
'bg-amber-50/80 dark:bg-slate-900 dark:border-amber-500': color === 'yellow',
|
|
90
|
+
'bg-orange-50/80 dark:bg-slate-900 dark:border-orange-500': color === 'orange',
|
|
91
|
+
'bg-red-50/80 dark:bg-slate-900 dark:border-red-500': color === 'red',
|
|
92
|
+
'bg-purple-50/80 dark:bg-slate-900 dark:border-purple-500': color === 'purple',
|
|
93
|
+
'cursor-pointer hover:shadow-[inset_0_0_0px_30px_#00000003] dark:hover:shadow-[inset_0_0_0px_30px_#FFFFFF03]': dropdown,
|
|
94
|
+
}) }, { 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
|
+
exports.Proof = Proof;
|
|
97
|
+
const ProofRenderer = (node, children) => {
|
|
98
|
+
var _a;
|
|
99
|
+
const [title, ...rest] = children;
|
|
100
|
+
const classes = getClasses(node.class);
|
|
101
|
+
const { color } = getColor({ kind: node.kind, classes });
|
|
102
|
+
const isDropdown = classes.includes('dropdown');
|
|
103
|
+
const useTitle = ((_a = node.children) === null || _a === void 0 ? void 0 : _a[0].type) === 'admonitionTitle';
|
|
104
|
+
return ((0, jsx_runtime_1.jsxs)(Proof, Object.assign({ identifier: node.html_id, title: useTitle ? title : undefined, kind: node.kind, enumerator: node.enumerator, color: color, dropdown: isDropdown }, { children: [!useTitle && title, rest] }), node.key));
|
|
105
|
+
};
|
|
106
|
+
exports.ProofRenderer = ProofRenderer;
|
|
107
|
+
const PROOF_RENDERERS = {
|
|
108
|
+
proof: exports.ProofRenderer,
|
|
109
|
+
};
|
|
110
|
+
exports.default = PROOF_RENDERERS;
|
|
@@ -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;AAS1D,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"}
|
package/dist/types/heading.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Heading } from 'myst-spec';
|
|
3
3
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
4
|
export declare function HashLink({ id, kind, title, children, hover, className, hideInPopup, }: {
|
|
5
|
-
id
|
|
5
|
+
id?: string;
|
|
6
6
|
kind: string;
|
|
7
7
|
title?: string;
|
|
8
8
|
hover?: boolean;
|
|
@@ -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,EAAE,MAAM,CAAC;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAsBjD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEzC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAoB1D,CAAC;AAEF,wBAAgB,QAAQ,CACtB,IAAI,EAAE,aAAa,GAAG,IAAI,EAC1B,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAqB,6BAU5D"}
|
|
@@ -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":";AAgEA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,eAQlD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Admonition as AdmonitionSpec } from 'myst-spec';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { NodeRenderer } from '@myst-theme/providers';
|
|
4
|
+
export declare enum ProofKind {
|
|
5
|
+
proof = "proof",
|
|
6
|
+
axiom = "axiom",
|
|
7
|
+
lemma = "lemma",
|
|
8
|
+
definition = "definition",
|
|
9
|
+
criterion = "criterion",
|
|
10
|
+
remark = "remark",
|
|
11
|
+
conjecture = "conjecture",
|
|
12
|
+
corollary = "corollary",
|
|
13
|
+
algorithm = "algorithm",
|
|
14
|
+
example = "example",
|
|
15
|
+
property = "property",
|
|
16
|
+
observation = "observation",
|
|
17
|
+
proposition = "proposition",
|
|
18
|
+
assumption = "assumption",
|
|
19
|
+
theorem = "theorem"
|
|
20
|
+
}
|
|
21
|
+
type Color = 'gray' | 'blue' | 'green' | 'yellow' | 'orange' | 'red' | 'purple';
|
|
22
|
+
export declare function Proof({ title, kind, color, dropdown, children, identifier, enumerator, }: {
|
|
23
|
+
title?: React.ReactNode;
|
|
24
|
+
color?: Color;
|
|
25
|
+
kind?: ProofKind;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
dropdown?: boolean;
|
|
28
|
+
identifier?: string;
|
|
29
|
+
enumerator?: string;
|
|
30
|
+
}): JSX.Element;
|
|
31
|
+
export declare const ProofRenderer: NodeRenderer<AdmonitionSpec>;
|
|
32
|
+
declare const PROOF_RENDERERS: {
|
|
33
|
+
proof: NodeRenderer<AdmonitionSpec>;
|
|
34
|
+
};
|
|
35
|
+
export default PROOF_RENDERERS;
|
|
36
|
+
//# sourceMappingURL=proof.d.ts.map
|
|
@@ -0,0 +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,eAwDA;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.5",
|
|
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.3",
|
|
21
|
-
"@headlessui/react": "^1.7.13",
|
|
22
20
|
"@heroicons/react": "^2.0.13",
|
|
23
|
-
"@
|
|
21
|
+
"@myst-theme/providers": "^0.2.5",
|
|
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"}
|