myst-to-react 0.13.5 → 0.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MyST.d.ts +2 -1
- package/dist/MyST.d.ts.map +1 -1
- package/dist/MyST.js +6 -6
- package/dist/admonitions.js +4 -4
- package/dist/aside.js +3 -3
- package/dist/basic.d.ts.map +1 -1
- package/dist/basic.js +67 -67
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +9 -9
- package/dist/cite.d.ts +2 -1
- package/dist/cite.d.ts.map +1 -1
- package/dist/cite.js +8 -8
- package/dist/code.d.ts.map +1 -1
- package/dist/code.js +6 -6
- package/dist/components/HoverPopover.d.ts +2 -1
- package/dist/components/HoverPopover.d.ts.map +1 -1
- package/dist/components/HoverPopover.js +3 -2
- package/dist/crossReference.d.ts +2 -1
- package/dist/crossReference.d.ts.map +1 -1
- package/dist/crossReference.js +8 -6
- package/dist/dropdown.d.ts.map +1 -1
- package/dist/dropdown.js +4 -4
- package/dist/exercise.d.ts +2 -1
- package/dist/exercise.d.ts.map +1 -1
- package/dist/exercise.js +6 -6
- package/dist/extensions/chemicalFormula.d.ts.map +1 -1
- package/dist/extensions/chemicalFormula.js +3 -2
- package/dist/extensions/siunits.d.ts.map +1 -1
- package/dist/extensions/siunits.js +2 -2
- package/dist/footnotes.js +2 -2
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +4 -4
- package/dist/hashLink.d.ts +1 -1
- package/dist/hashLink.d.ts.map +1 -1
- package/dist/hashLink.js +2 -1
- package/dist/heading.d.ts.map +1 -1
- package/dist/heading.js +3 -2
- package/dist/iframe.js +2 -2
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +4 -5
- package/dist/inlineError.d.ts +2 -1
- package/dist/inlineError.d.ts.map +1 -1
- package/dist/inlineError.js +3 -2
- package/dist/inlineExpression.d.ts.map +1 -1
- package/dist/inlineExpression.js +5 -4
- package/dist/links/github.d.ts +2 -1
- package/dist/links/github.d.ts.map +1 -1
- package/dist/links/github.js +8 -8
- package/dist/links/index.d.ts.map +1 -1
- package/dist/links/index.js +18 -17
- package/dist/links/ror.d.ts +2 -1
- package/dist/links/ror.d.ts.map +1 -1
- package/dist/links/ror.js +2 -2
- package/dist/links/rrid.d.ts +2 -1
- package/dist/links/rrid.d.ts.map +1 -1
- package/dist/links/rrid.js +2 -2
- package/dist/links/wiki.d.ts +2 -1
- package/dist/links/wiki.d.ts.map +1 -1
- package/dist/links/wiki.js +3 -2
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +6 -5
- package/dist/proof.d.ts +2 -1
- package/dist/proof.d.ts.map +1 -1
- package/dist/proof.js +4 -4
- package/dist/reactive.d.ts.map +1 -1
- package/dist/reactive.js +8 -4
- package/dist/tabs.d.ts +4 -2
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +8 -8
- package/dist/unknown.d.ts.map +1 -1
- package/dist/unknown.js +2 -2
- package/package.json +4 -4
package/dist/MyST.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { NodeRenderersValidated } from '@myst-theme/providers';
|
|
2
2
|
import type { GenericNode } from 'myst-common';
|
|
3
3
|
export declare function selectRenderer(renderers: NodeRenderersValidated, node: GenericNode): import("@myst-theme/providers").NodeRenderer<any>;
|
|
4
|
-
export declare function MyST({ ast }: {
|
|
4
|
+
export declare function MyST({ ast, className, }: {
|
|
5
5
|
ast?: GenericNode | GenericNode[];
|
|
6
|
+
className?: string;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
7
8
|
//# sourceMappingURL=MyST.d.ts.map
|
package/dist/MyST.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MyST.d.ts","sourceRoot":"","sources":["../src/MyST.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW/C,wBAAgB,cAAc,CAAC,SAAS,EAAE,sBAAsB,EAAE,IAAI,EAAE,WAAW,qDAMlF;AAED,wBAAgB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"MyST.d.ts","sourceRoot":"","sources":["../src/MyST.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW/C,wBAAgB,cAAc,CAAC,SAAS,EAAE,sBAAsB,EAAE,IAAI,EAAE,WAAW,qDAMlF;AAED,wBAAgB,IAAI,CAAC,EACnB,GAAG,EACH,SAAS,GACV,EAAE;IACD,GAAG,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,kDAeA"}
|
package/dist/MyST.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { matches } from 'unist-util-select';
|
|
3
3
|
import { useNodeRenderers } from '@myst-theme/providers';
|
|
4
|
-
function DefaultComponent({ node }) {
|
|
4
|
+
function DefaultComponent({ node, className }) {
|
|
5
5
|
if (!node.children)
|
|
6
|
-
return _jsx("span", { children: node.value });
|
|
7
|
-
return (_jsx("div", { children: _jsx(MyST, { ast: node.children }) }));
|
|
6
|
+
return _jsx("span", { className: className, children: node.value });
|
|
7
|
+
return (_jsx("div", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
8
8
|
}
|
|
9
9
|
export function selectRenderer(renderers, node) {
|
|
10
10
|
var _a, _b, _c;
|
|
@@ -14,16 +14,16 @@ export function selectRenderer(renderers, node) {
|
|
|
14
14
|
.find(([selector]) => selector !== 'base' && matches(selector, node))) === null || _b === void 0 ? void 0 : _b[1];
|
|
15
15
|
return (_c = SpecificComponent !== null && SpecificComponent !== void 0 ? SpecificComponent : componentRenderers === null || componentRenderers === void 0 ? void 0 : componentRenderers.base) !== null && _c !== void 0 ? _c : DefaultComponent;
|
|
16
16
|
}
|
|
17
|
-
export function MyST({ ast }) {
|
|
17
|
+
export function MyST({ ast, className, }) {
|
|
18
18
|
const renderers = useNodeRenderers();
|
|
19
19
|
if (!ast || ast.length === 0)
|
|
20
20
|
return null;
|
|
21
21
|
if (!Array.isArray(ast)) {
|
|
22
22
|
const Component = selectRenderer(renderers, ast);
|
|
23
|
-
return _jsx(Component, { node: ast }, ast.key);
|
|
23
|
+
return _jsx(Component, { node: ast, className: className }, ast.key);
|
|
24
24
|
}
|
|
25
25
|
return (_jsx(_Fragment, { children: ast === null || ast === void 0 ? void 0 : ast.map((node) => {
|
|
26
26
|
const Component = selectRenderer(renderers, node);
|
|
27
|
-
return _jsx(Component, { node: node }, node.key);
|
|
27
|
+
return _jsx(Component, { node: node, className: className }, node.key);
|
|
28
28
|
}) }));
|
|
29
29
|
}
|
package/dist/admonitions.js
CHANGED
|
@@ -83,8 +83,8 @@ function AdmonitionIcon({ kind, className }) {
|
|
|
83
83
|
return _jsx(ArrowRightCircleIcon, Object.assign({}, opts));
|
|
84
84
|
return _jsx(InformationCircleIcon, Object.assign({}, opts));
|
|
85
85
|
}
|
|
86
|
-
export const AdmonitionTitle = ({ node }) => {
|
|
87
|
-
return _jsx(MyST, { ast: node.children });
|
|
86
|
+
export const AdmonitionTitle = ({ node, className }) => {
|
|
87
|
+
return _jsx(MyST, { ast: node.children, className: className });
|
|
88
88
|
};
|
|
89
89
|
const WrapperElement = ({ dropdown, className, children, open, }) => {
|
|
90
90
|
if (dropdown)
|
|
@@ -121,7 +121,7 @@ export function Admonition({ title, kind, color, simple, dropdown, children, hid
|
|
|
121
121
|
'text-red-600': color === 'red',
|
|
122
122
|
}) })), _jsx("div", { className: classNames('text-neutral-900 dark:text-white grow self-center overflow-hidden break-words', { 'ml-4': hideIcon }), children: title }), dropdown && (_jsx("div", { className: "self-center flex-none text-sm font-thin text-neutral-700 dark:text-neutral-200", children: _jsx(ChevronRightIcon, { width: "2rem", height: "2rem", className: classNames(iconClass, 'transition-transform details-toggle') }) }))] })), _jsx("div", { className: classNames('px-4', { 'py-1': !simple, 'details-body': dropdown }), children: children })] }));
|
|
123
123
|
}
|
|
124
|
-
export const AdmonitionRenderer = ({ node }) => {
|
|
124
|
+
export const AdmonitionRenderer = ({ node, className }) => {
|
|
125
125
|
const [title, ...rest] = node.children;
|
|
126
126
|
const classes = getClasses(node.class);
|
|
127
127
|
const { kind, color } = getFirstKind({ kind: node.kind, classes });
|
|
@@ -130,7 +130,7 @@ export const AdmonitionRenderer = ({ node }) => {
|
|
|
130
130
|
const hideIcon = node.icon === false;
|
|
131
131
|
const isOpen = node.open === true;
|
|
132
132
|
const useTitle = (title === null || title === void 0 ? void 0 : title.type) === 'admonitionTitle';
|
|
133
|
-
return (_jsx(Admonition, { title: useTitle ? _jsx(MyST, { ast: [title] }) : undefined, kind: kind, color: color, dropdown: isDropdown, open: isOpen, simple: isSimple, hideIcon: hideIcon, className: classNames(classes), children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
|
|
133
|
+
return (_jsx(Admonition, { title: useTitle ? _jsx(MyST, { ast: [title] }) : undefined, kind: kind, color: color, dropdown: isDropdown, open: isOpen, simple: isSimple, hideIcon: hideIcon, className: classNames(classes, className), children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
|
|
134
134
|
};
|
|
135
135
|
const ADMONITION_RENDERERS = {
|
|
136
136
|
admonition: AdmonitionRenderer,
|
package/dist/aside.js
CHANGED
|
@@ -19,13 +19,13 @@ function getAsideClass(kind) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
export const AsideRenderer = ({ node }) => {
|
|
22
|
+
export const AsideRenderer = ({ node, className }) => {
|
|
23
23
|
const [title, ...rest] = node.children;
|
|
24
24
|
const classes = getAsideClass(node.kind);
|
|
25
25
|
if (title.type !== 'admonitionTitle') {
|
|
26
|
-
return (_jsx("aside", { className: classNames(classes.container, node.class), children: _jsx(MyST, { ast: node.children }) }));
|
|
26
|
+
return (_jsx("aside", { className: classNames(classes.container, node.class, className), children: _jsx(MyST, { ast: node.children }) }));
|
|
27
27
|
}
|
|
28
|
-
return (_jsxs("aside", { className: classNames(classes.container, node.class), children: [_jsx("div", { className: classes.title, children: _jsx(MyST, { ast: title }) }), _jsx("div", { className: classes.body, children: _jsx(MyST, { ast: rest }) })] }));
|
|
28
|
+
return (_jsxs("aside", { className: classNames(classes.container, node.class, className), children: [_jsx("div", { className: classes.title, children: _jsx(MyST, { ast: title }) }), _jsx("div", { className: classes.body, children: _jsx(MyST, { ast: rest }) })] }));
|
|
29
29
|
};
|
|
30
30
|
const ASIDE_RENDERERS = {
|
|
31
31
|
aside: AsideRenderer,
|
package/dist/basic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../src/basic.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,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;IAC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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,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IACjC,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;IAC3D,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;CAClC,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,kBA2TtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/basic.js
CHANGED
|
@@ -15,90 +15,90 @@ const BASIC_RENDERERS = {
|
|
|
15
15
|
const text = node.value.split('');
|
|
16
16
|
return (_jsx(_Fragment, { children: text.map((v, i) => (_jsxs(React.Fragment, { children: [v, i < text.length - 1 && _jsx("wbr", {})] }, i))) }));
|
|
17
17
|
},
|
|
18
|
-
span({ node }) {
|
|
19
|
-
return (_jsx("span", { className: node.class, style: node.style, id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
18
|
+
span({ node, className }) {
|
|
19
|
+
return (_jsx("span", { className: classNames(node.class, className), style: node.style, id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
20
20
|
},
|
|
21
|
-
div({ node }) {
|
|
22
|
-
return (_jsx("div", { className: node.class, style: node.style, id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
21
|
+
div({ node, className }) {
|
|
22
|
+
return (_jsx("div", { className: classNames(node.class, className), style: node.style, id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
23
23
|
},
|
|
24
|
-
delete({ node }) {
|
|
25
|
-
return (_jsx("del", { children: _jsx(MyST, { ast: node.children }) }));
|
|
24
|
+
delete({ node, className }) {
|
|
25
|
+
return (_jsx("del", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
26
26
|
},
|
|
27
|
-
strong({ node }) {
|
|
28
|
-
return (_jsx("strong", { children: _jsx(MyST, { ast: node.children }) }));
|
|
27
|
+
strong({ node, className }) {
|
|
28
|
+
return (_jsx("strong", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
29
29
|
},
|
|
30
|
-
emphasis({ node }) {
|
|
31
|
-
return (_jsx("em", { children: _jsx(MyST, { ast: node.children }) }));
|
|
30
|
+
emphasis({ node, className }) {
|
|
31
|
+
return (_jsx("em", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
32
32
|
},
|
|
33
|
-
underline({ node }) {
|
|
34
|
-
return (_jsx("span", { style: { textDecoration: 'underline' }, children: _jsx(MyST, { ast: node.children }) }));
|
|
33
|
+
underline({ node, className }) {
|
|
34
|
+
return (_jsx("span", { style: { textDecoration: 'underline' }, className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
35
35
|
},
|
|
36
|
-
smallcaps({ node }) {
|
|
37
|
-
return (_jsx("span", { style: { fontVariant: 'small-caps' }, children: _jsx(MyST, { ast: node.children }) }));
|
|
36
|
+
smallcaps({ node, className }) {
|
|
37
|
+
return (_jsx("span", { style: { fontVariant: 'small-caps' }, className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
38
38
|
},
|
|
39
|
-
link({ node }) {
|
|
40
|
-
return (_jsx("a", { target: "_blank", href: node.url, rel: "noreferrer", children: _jsx(MyST, { ast: node.children }) }));
|
|
39
|
+
link({ node, className }) {
|
|
40
|
+
return (_jsx("a", { target: "_blank", href: node.url, className: classNames(node.class, className), rel: "noreferrer", children: _jsx(MyST, { ast: node.children }) }));
|
|
41
41
|
},
|
|
42
|
-
paragraph({ node }) {
|
|
43
|
-
return (_jsx("p", { id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
42
|
+
paragraph({ node, className }) {
|
|
43
|
+
return (_jsx("p", { id: node.html_id, className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
44
44
|
},
|
|
45
|
-
algorithmLine({ node }) {
|
|
45
|
+
algorithmLine({ node, className }) {
|
|
46
46
|
var _a;
|
|
47
47
|
// Used in algorithms
|
|
48
48
|
const style = {
|
|
49
49
|
paddingLeft: `${((_a = node.indent) !== null && _a !== void 0 ? _a : 0) + 2}rem`,
|
|
50
50
|
};
|
|
51
|
-
return (_jsx("p", { className:
|
|
51
|
+
return (_jsx("p", { className: classNames('line', className), style: style, "data-line-number": node.enumerator, children: _jsx(MyST, { ast: node.children }) }));
|
|
52
52
|
},
|
|
53
|
-
break() {
|
|
54
|
-
return _jsx("br", {});
|
|
53
|
+
break({ className }) {
|
|
54
|
+
return _jsx("br", { className: className });
|
|
55
55
|
},
|
|
56
|
-
inlineMath({ node }) {
|
|
57
|
-
return _jsx("code", { children: node.value });
|
|
56
|
+
inlineMath({ node, className }) {
|
|
57
|
+
return _jsx("code", { className: className, children: node.value });
|
|
58
58
|
},
|
|
59
|
-
math({ node }) {
|
|
60
|
-
return _jsx("code", { children: node.value });
|
|
59
|
+
math({ node, className }) {
|
|
60
|
+
return _jsx("code", { className: className, children: node.value });
|
|
61
61
|
},
|
|
62
|
-
list({ node }) {
|
|
62
|
+
list({ node, className }) {
|
|
63
63
|
if (node.ordered) {
|
|
64
|
-
return (_jsx("ol", { start: node.start || undefined, id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
64
|
+
return (_jsx("ol", { start: node.start || undefined, id: node.html_id, className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
65
65
|
}
|
|
66
|
-
return (_jsx("ul", { id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
66
|
+
return (_jsx("ul", { id: node.html_id, className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
67
67
|
},
|
|
68
|
-
listItem({ node }) {
|
|
68
|
+
listItem({ node, className }) {
|
|
69
69
|
if (node.checked == null) {
|
|
70
|
-
return (_jsx("li", { children: _jsx(MyST, { ast: node.children }) }));
|
|
70
|
+
return (_jsx("li", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
71
71
|
}
|
|
72
|
-
return (_jsxs("li", { className:
|
|
72
|
+
return (_jsxs("li", { className: classNames('task-list-item', className), children: [_jsx("input", { type: "checkbox", className: "task-list-item-checkbox", defaultChecked: node.checked }), _jsx(MyST, { ast: node.children })] }));
|
|
73
73
|
},
|
|
74
|
-
container({ node }) {
|
|
74
|
+
container({ node, className }) {
|
|
75
75
|
const figureName = `fig-${node.kind}`;
|
|
76
|
-
return (_jsx("figure", { id: node.html_id || node.identifier || node.key, className: classNames({ [figureName]: !!node.kind, subcontainer: node.subcontainer }, node.class), children: _jsx(MyST, { ast: node.children }) }));
|
|
76
|
+
return (_jsx("figure", { id: node.html_id || node.identifier || node.key, className: classNames({ [figureName]: !!node.kind, subcontainer: node.subcontainer }, node.class, className), children: _jsx(MyST, { ast: node.children }) }));
|
|
77
77
|
},
|
|
78
|
-
caption({ node }) {
|
|
79
|
-
return (_jsx("figcaption", { className:
|
|
78
|
+
caption({ node, className }) {
|
|
79
|
+
return (_jsx("figcaption", { className: classNames('group', className), children: _jsx(MyST, { ast: node.children }) }));
|
|
80
80
|
},
|
|
81
|
-
legend({ node }) {
|
|
82
|
-
return (_jsx("figcaption", { className:
|
|
81
|
+
legend({ node, className }) {
|
|
82
|
+
return (_jsx("figcaption", { className: classNames('text-sm', className), children: _jsx(MyST, { ast: node.children }) }));
|
|
83
83
|
},
|
|
84
|
-
blockquote({ node }) {
|
|
85
|
-
return (_jsx("blockquote", { id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
|
|
84
|
+
blockquote({ node, className }) {
|
|
85
|
+
return (_jsx("blockquote", { id: node.html_id, className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
86
86
|
},
|
|
87
87
|
thematicBreak() {
|
|
88
88
|
return _jsx("hr", { className: "py-2 my-5 translate-y-2" });
|
|
89
89
|
},
|
|
90
|
-
captionNumber({ node }) {
|
|
90
|
+
captionNumber({ node, className }) {
|
|
91
91
|
const id = node.html_id || node.identifier || node.key;
|
|
92
|
-
return (_jsx(HashLink, { id: id, kind: node.kind, className:
|
|
92
|
+
return (_jsx(HashLink, { id: id, kind: node.kind, className: classNames('mr-1 font-semibold text-inherit hover:text-inherit hover:font-semibold', className), children: _jsx(MyST, { ast: node.children }) }));
|
|
93
93
|
},
|
|
94
|
-
table({ node }) {
|
|
94
|
+
table({ node, className }) {
|
|
95
95
|
// TODO: actually render the tbody on the server if it isn't included here.
|
|
96
|
-
return (_jsx("table", { className: node.class, style: node.style, children: _jsx("tbody", { children: _jsx(MyST, { ast: node.children }) }) }));
|
|
96
|
+
return (_jsx("table", { className: classNames(node.class, className), style: node.style, children: _jsx("tbody", { children: _jsx(MyST, { ast: node.children }) }) }));
|
|
97
97
|
},
|
|
98
|
-
tableRow({ node }) {
|
|
99
|
-
return (_jsx("tr", { className: node.class, style: node.style, children: _jsx(MyST, { ast: node.children }) }));
|
|
98
|
+
tableRow({ node, className }) {
|
|
99
|
+
return (_jsx("tr", { className: classNames(node.class, className), style: node.style, children: _jsx(MyST, { ast: node.children }) }));
|
|
100
100
|
},
|
|
101
|
-
tableCell({ node }) {
|
|
101
|
+
tableCell({ node, className }) {
|
|
102
102
|
const ifGreaterThanOne = (num) => (num === 1 ? undefined : num);
|
|
103
103
|
const attrs = {
|
|
104
104
|
rowSpan: ifGreaterThanOne(node.rowspan),
|
|
@@ -110,17 +110,17 @@ const BASIC_RENDERERS = {
|
|
|
110
110
|
'text-center': node.align === 'center',
|
|
111
111
|
};
|
|
112
112
|
if (node.header)
|
|
113
|
-
return (_jsx("th", Object.assign({ className: classNames(node.class, align), style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
|
|
114
|
-
return (_jsx("td", Object.assign({ className: classNames(node.class, align), style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
|
|
113
|
+
return (_jsx("th", Object.assign({ className: classNames(node.class, align, className), style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
|
|
114
|
+
return (_jsx("td", Object.assign({ className: classNames(node.class, align, className), style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
|
|
115
115
|
},
|
|
116
|
-
subscript({ node }) {
|
|
117
|
-
return (_jsx("sub", { children: _jsx(MyST, { ast: node.children }) }));
|
|
116
|
+
subscript({ node, className }) {
|
|
117
|
+
return (_jsx("sub", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
118
118
|
},
|
|
119
|
-
superscript({ node }) {
|
|
120
|
-
return (_jsx("sup", { children: _jsx(MyST, { ast: node.children }) }));
|
|
119
|
+
superscript({ node, className }) {
|
|
120
|
+
return (_jsx("sup", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
121
121
|
},
|
|
122
|
-
abbreviation({ node }) {
|
|
123
|
-
return (_jsx(Tooltip, { title: node.title, children: _jsx("abbr", { "aria-label": node.title, className: "border-b border-dotted cursor-help", children: _jsx(MyST, { ast: node.children }) }) }));
|
|
122
|
+
abbreviation({ node, className }) {
|
|
123
|
+
return (_jsx(Tooltip, { title: node.title, className: classNames(className), children: _jsx("abbr", { "aria-label": node.title, className: "border-b border-dotted cursor-help", children: _jsx(MyST, { ast: node.children }) }) }));
|
|
124
124
|
},
|
|
125
125
|
mystComment() {
|
|
126
126
|
return null;
|
|
@@ -128,28 +128,28 @@ const BASIC_RENDERERS = {
|
|
|
128
128
|
comment() {
|
|
129
129
|
return null;
|
|
130
130
|
},
|
|
131
|
-
definitionList({ node }) {
|
|
132
|
-
return (_jsx("dl", { className:
|
|
131
|
+
definitionList({ node, className }) {
|
|
132
|
+
return (_jsx("dl", { className: classNames('my-5', className), id: node.html_id || node.identifier || node.key, children: _jsx(MyST, { ast: node.children }) }));
|
|
133
133
|
},
|
|
134
|
-
definitionTerm({ node }) {
|
|
134
|
+
definitionTerm({ node, className }) {
|
|
135
135
|
var _a, _b;
|
|
136
136
|
const allowedStrongTypes = new Set(['text', 'emphasis']);
|
|
137
137
|
const makeStrong = (_b = (_a = node.children) === null || _a === void 0 ? void 0 : _a.reduce((allowed, n) => allowed && allowedStrongTypes.has(n.type), true)) !== null && _b !== void 0 ? _b : false;
|
|
138
|
-
return (_jsx("dt", { id: node.html_id || node.identifier || node.key, children: makeStrong ? (_jsx("strong", { children: _jsx(MyST, { ast: node.children }) })) : (_jsx(MyST, { ast: node.children })) }));
|
|
138
|
+
return (_jsx("dt", { id: node.html_id || node.identifier || node.key, className: className, children: makeStrong ? (_jsx("strong", { children: _jsx(MyST, { ast: node.children }) })) : (_jsx(MyST, { ast: node.children })) }));
|
|
139
139
|
},
|
|
140
|
-
definitionDescription({ node }) {
|
|
141
|
-
return (_jsx("dd", { children: _jsx(MyST, { ast: node.children }) }));
|
|
140
|
+
definitionDescription({ node, className }) {
|
|
141
|
+
return (_jsx("dd", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
142
142
|
},
|
|
143
|
-
keyboard({ node }) {
|
|
144
|
-
return (_jsx("kbd", { children: _jsx(MyST, { ast: node.children }) }));
|
|
143
|
+
keyboard({ node, className }) {
|
|
144
|
+
return (_jsx("kbd", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
145
145
|
},
|
|
146
|
-
include({ node }) {
|
|
146
|
+
include({ node, className }) {
|
|
147
147
|
// TODO, provider could give context about the filename
|
|
148
|
-
return _jsx(MyST, { ast: node.children });
|
|
148
|
+
return _jsx(MyST, { ast: node.children, className: className });
|
|
149
149
|
},
|
|
150
|
-
glossary({ node }) {
|
|
150
|
+
glossary({ node, className }) {
|
|
151
151
|
// TODO, provider could give context about the filename
|
|
152
|
-
return (_jsx("div", { id: node.html_id || node.identifier || node.key, className: node.class, children: _jsx(MyST, { ast: node.children }) }));
|
|
152
|
+
return (_jsx("div", { id: node.html_id || node.identifier || node.key, className: classNames(node.class, className), children: _jsx(MyST, { ast: node.children }) }));
|
|
153
153
|
},
|
|
154
154
|
};
|
|
155
155
|
export default BASIC_RENDERERS;
|
package/dist/card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../src/card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AACF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AACF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AACF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAAY,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../src/card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AACF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AACF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AACF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAAY,CAAC,UAAU,CAW3C,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAAY,CAAC,UAAU,CAW3C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,aAAa,CAMjD,CAAC;AAmDF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,QAAQ,CAqC/C,CAAC;AAEF,QAAA,MAAM,cAAc;;;;;CAKnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/card.js
CHANGED
|
@@ -2,14 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { useLinkProvider, useBaseurl, withBaseurl } from '@myst-theme/providers';
|
|
4
4
|
import { MyST } from './MyST.js';
|
|
5
|
-
export const Header = ({ node }) => {
|
|
6
|
-
return (_jsx("header", { className:
|
|
5
|
+
export const Header = ({ node, className }) => {
|
|
6
|
+
return (_jsx("header", { className: classNames('py-1 pl-3 m-0 border-b border-gray-100 bg-gray-50 dark:bg-slate-900 dark:border-gray-800', className), children: _jsx(MyST, { ast: node.children }) }));
|
|
7
7
|
};
|
|
8
|
-
export const Footer = ({ node }) => {
|
|
9
|
-
return (_jsx("footer", { className:
|
|
8
|
+
export const Footer = ({ node, className }) => {
|
|
9
|
+
return (_jsx("footer", { className: classNames('py-1 pl-3 m-0 border-t border-gray-100 bg-gray-50 dark:bg-slate-900 dark:border-gray-800', className), children: _jsx(MyST, { ast: node.children }) }));
|
|
10
10
|
};
|
|
11
|
-
export const CardTitle = ({ node }) => {
|
|
12
|
-
return (_jsx("div", { className:
|
|
11
|
+
export const CardTitle = ({ node, className }) => {
|
|
12
|
+
return (_jsx("div", { className: classNames('pt-3 font-bold group-hover:underline', className), children: _jsx(MyST, { ast: node.children }) }));
|
|
13
13
|
};
|
|
14
14
|
function getParts(children) {
|
|
15
15
|
var _a, _b;
|
|
@@ -34,16 +34,16 @@ function ExternalOrInternalLink({ to, className, isStatic, prefetch = 'intent',
|
|
|
34
34
|
}
|
|
35
35
|
return (_jsx(Link, { to: withBaseurl(to, baseurl), className: className, prefetch: prefetch, children: children }));
|
|
36
36
|
}
|
|
37
|
-
export const CardRenderer = ({ node }) => {
|
|
37
|
+
export const CardRenderer = ({ node, className }) => {
|
|
38
38
|
const parts = getParts(node.children);
|
|
39
39
|
const url = node.url;
|
|
40
40
|
const isStatic = node.static || false;
|
|
41
41
|
const link = !!url;
|
|
42
42
|
const sharedStyle = 'my-5 rounded shadow dark:shadow-neutral-800 overflow-hidden border border-gray-100 dark:border-gray-800 flex flex-col';
|
|
43
43
|
if (link) {
|
|
44
|
-
return (_jsxs(ExternalOrInternalLink, { to: url, isStatic: isStatic, className: classNames(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: [_jsx(MyST, { ast: parts.header }), _jsx("div", { className: "flex-grow px-4 py-2", children: _jsx(MyST, { ast: parts.body }) }), _jsx(MyST, { ast: parts.footer })] }));
|
|
44
|
+
return (_jsxs(ExternalOrInternalLink, { to: url, isStatic: isStatic, className: classNames(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', className), children: [_jsx(MyST, { ast: parts.header }), _jsx("div", { className: "flex-grow px-4 py-2", children: _jsx(MyST, { ast: parts.body }) }), _jsx(MyST, { ast: parts.footer })] }));
|
|
45
45
|
}
|
|
46
|
-
return (_jsxs("div", { className: sharedStyle, children: [_jsx(MyST, { ast: parts.header }), _jsx("div", { className: "flex-grow px-4 py-2", children: _jsx(MyST, { ast: parts.body }) }), _jsx(MyST, { ast: parts.footer })] }));
|
|
46
|
+
return (_jsxs("div", { className: classNames(sharedStyle, className), children: [_jsx(MyST, { ast: parts.header }), _jsx("div", { className: "flex-grow px-4 py-2", children: _jsx(MyST, { ast: parts.body }) }), _jsx(MyST, { ast: parts.footer })] }));
|
|
47
47
|
};
|
|
48
48
|
const CARD_RENDERERS = {
|
|
49
49
|
card: CardRenderer,
|
package/dist/cite.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
2
2
|
import type { GenericParent } from 'myst-common';
|
|
3
3
|
export declare const CiteGroup: NodeRenderer<GenericParent>;
|
|
4
|
-
export declare const Cite: ({ label, error, children, }: {
|
|
4
|
+
export declare const Cite: ({ label, error, children, className, }: {
|
|
5
5
|
label?: string;
|
|
6
6
|
error?: boolean;
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
8
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export declare const CiteRenderer: NodeRenderer;
|
|
10
11
|
declare const CITE_RENDERERS: Record<string, NodeRenderer>;
|
package/dist/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;AAK1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAiBjD,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../src/cite.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAiBjD,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,aAAa,CAiBjD,CAAC;AAEF,eAAO,MAAM,IAAI,2CAKd;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CA4BA,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,YAO1B,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAGhD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/cite.js
CHANGED
|
@@ -14,7 +14,7 @@ function useNumberedReferences() {
|
|
|
14
14
|
function CiteChild({ html }) {
|
|
15
15
|
return (_jsx("div", { className: "hover-document article w-[500px] sm:max-w-[500px] p-3", dangerouslySetInnerHTML: { __html: html || '' } }));
|
|
16
16
|
}
|
|
17
|
-
export const CiteGroup = ({ node }) => {
|
|
17
|
+
export const CiteGroup = ({ node, className }) => {
|
|
18
18
|
var _a, _b;
|
|
19
19
|
const allCite = (_b = (_a = node.children) === null || _a === void 0 ? void 0 : _a.every((child) => child.type === 'cite')) !== null && _b !== void 0 ? _b : false;
|
|
20
20
|
return (_jsx("span", { className: classNames({
|
|
@@ -22,24 +22,24 @@ export const CiteGroup = ({ node }) => {
|
|
|
22
22
|
'xref-group': !allCite,
|
|
23
23
|
narrative: node.kind === 'narrative',
|
|
24
24
|
parenthetical: node.kind === 'parenthetical',
|
|
25
|
-
}), children: _jsx(MyST, { ast: node.children }) }));
|
|
25
|
+
}, className), children: _jsx(MyST, { ast: node.children }) }));
|
|
26
26
|
};
|
|
27
|
-
export const Cite = ({ label, error, children, }) => {
|
|
27
|
+
export const Cite = ({ label, error, children, className, }) => {
|
|
28
28
|
var _a, _b;
|
|
29
29
|
const references = useReferences();
|
|
30
30
|
if (!label) {
|
|
31
|
-
return _jsx(InlineError, { value: "cite (no label)", message: 'Citation Has No Label' });
|
|
31
|
+
return (_jsx(InlineError, { value: "cite (no label)", message: 'Citation Has No Label', className: className }));
|
|
32
32
|
}
|
|
33
33
|
const { html, doi: doiString, url: refUrl } = (_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 : {};
|
|
34
34
|
if (error) {
|
|
35
|
-
return _jsx(InlineError, { value: label, message: 'Citation Not Found' });
|
|
35
|
+
return _jsx(InlineError, { value: label, message: 'Citation Not Found', className: className });
|
|
36
36
|
}
|
|
37
37
|
const url = doiString ? doi.buildUrl(doiString) : refUrl;
|
|
38
|
-
return (_jsx(HoverPopover, { openDelay: 300, card: _jsx(CiteChild, { html: html }), children: _jsxs("cite", { children: [url && (_jsx("a", { href: url, target: "_blank", rel: "noreferrer", className: "hover-link", children: children })), !url && _jsx("span", { className: "hover-link", children: children })] }) }));
|
|
38
|
+
return (_jsx(HoverPopover, { openDelay: 300, card: _jsx(CiteChild, { html: html }), children: _jsxs("cite", { className: className, children: [url && (_jsx("a", { href: url, target: "_blank", rel: "noreferrer", className: "hover-link", children: children })), !url && _jsx("span", { className: "hover-link", children: children })] }) }));
|
|
39
39
|
};
|
|
40
|
-
export const CiteRenderer = ({ node }) => {
|
|
40
|
+
export const CiteRenderer = ({ node, className }) => {
|
|
41
41
|
const numbered = useNumberedReferences();
|
|
42
|
-
return (_jsx(Cite, { label: node.label, error: node.error, children: numbered && node.kind === 'parenthetical' ? node.enumerator : _jsx(MyST, { ast: node.children }) }));
|
|
42
|
+
return (_jsx(Cite, { label: node.label, error: node.error, className: className, children: numbered && node.kind === 'parenthetical' ? node.enumerator : _jsx(MyST, { ast: node.children }) }));
|
|
43
43
|
};
|
|
44
44
|
const CITE_RENDERERS = {
|
|
45
45
|
citeGroup: CiteGroup,
|
package/dist/code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAU1D,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;AAaF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,2CAiFrC;
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAU1D,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;AAaF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,2CAiFrC;AAgED,QAAA,MAAM,cAAc;;;CAGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/code.js
CHANGED
|
@@ -55,8 +55,8 @@ export function CodeBlock(props) {
|
|
|
55
55
|
'border border-l-4 border-l-blue-400 border-gray-200 dark:border-l-blue-400 dark:border-gray-800': border,
|
|
56
56
|
}), children: [filename && (_jsxs("div", { className: "flex flex-row pl-2 bg-white border-b dark:bg-slate-600 dark:border-slate-300", children: [_jsx(DocumentIcon, { width: "16px", height: "16px", className: "self-center flex-none inline-block text-gray-500 dark:text-gray-100" }), _jsx("div", { className: "self-center p-2 text-sm leading-3 prose text-slate-600 dark:text-white", children: filename })] })), _jsx(SyntaxHighlighter, Object.assign({}, highlighterProps, { className: "block p-3 hljs", children: value })), showCopy && (_jsx(CopyIcon, { text: value, className: classNames('absolute right-1', { 'top-[32px]': filename, 'top-1': !filename }) }))] }));
|
|
57
57
|
}
|
|
58
|
-
const code = ({ node }) => {
|
|
59
|
-
const child = (_jsx(CodeBlock, { identifier: node.html_id, "data-mdast-node-type": node.type, "data-mdast-node-id": node.key, value: node.value || '', lang: node.lang, filename: node.filename, emphasizeLines: node.emphasizeLines, showLineNumbers: node.showLineNumbers, startingLineNumber: node.startingLineNumber, shadow: true, border: node.executable, background: !node.executable, className: classNames({ hidden: node.visibility === 'remove' }, node.class) }));
|
|
58
|
+
const code = ({ node, className }) => {
|
|
59
|
+
const child = (_jsx(CodeBlock, { identifier: node.html_id, "data-mdast-node-type": node.type, "data-mdast-node-id": node.key, value: node.value || '', lang: node.lang, filename: node.filename, emphasizeLines: node.emphasizeLines, showLineNumbers: node.showLineNumbers, startingLineNumber: node.startingLineNumber, shadow: true, border: node.executable, background: !node.executable, className: classNames({ hidden: node.visibility === 'remove' }, node.class, className) }));
|
|
60
60
|
if (node.visibility === 'hide') {
|
|
61
61
|
return _jsx(Details, { title: "Source", children: child });
|
|
62
62
|
}
|
|
@@ -73,15 +73,15 @@ function isColor(maybeColorHash) {
|
|
|
73
73
|
const color = match[1];
|
|
74
74
|
return color;
|
|
75
75
|
}
|
|
76
|
-
const inlineCode = ({ node }) => {
|
|
76
|
+
const inlineCode = ({ node, className }) => {
|
|
77
77
|
if (isColor(node.value)) {
|
|
78
|
-
return (_jsxs("code", { className:
|
|
78
|
+
return (_jsxs("code", { className: classNames('px-1 rounded bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-100', className), children: [node.value, _jsx("span", { style: { backgroundColor: node.value }, className: "inline-block w-[10px] h-[10px] rounded-full ml-1" })] }));
|
|
79
79
|
}
|
|
80
80
|
if (node.children && node.children.length > 0) {
|
|
81
81
|
// The inline code can potentially have children
|
|
82
|
-
return (_jsx("code", { children: _jsx(MyST, { ast: node.children }) }));
|
|
82
|
+
return (_jsx("code", { className: className, children: _jsx(MyST, { ast: node.children }) }));
|
|
83
83
|
}
|
|
84
|
-
return _jsx("code", { children: node.value });
|
|
84
|
+
return _jsx("code", { className: className, children: node.value });
|
|
85
85
|
};
|
|
86
86
|
const CODE_RENDERERS = {
|
|
87
87
|
code,
|
|
@@ -8,8 +8,9 @@ export declare function HoverPopover({ children, openDelay, card, side, arrowCla
|
|
|
8
8
|
load: boolean;
|
|
9
9
|
}) => React.ReactNode);
|
|
10
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare function Tooltip({ title, children, }: {
|
|
11
|
+
export declare function Tooltip({ title, children, className, }: {
|
|
12
12
|
title: React.ReactNode;
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
+
className?: string;
|
|
14
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
//# sourceMappingURL=HoverPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoverPopover.d.ts","sourceRoot":"","sources":["../../src/components/HoverPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"HoverPopover.d.ts","sourceRoot":"","sources":["../../src/components/HoverPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,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,2CAmBA;AAED,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAmBA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import * as HoverCard from '@radix-ui/react-hover-card';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
export function HoverPopover({ children, openDelay = 400, card, side, arrowClass = 'fill-white', }) {
|
|
5
6
|
const [load, setLoad] = useState(false);
|
|
6
7
|
return (_jsxs(HoverCard.Root, { openDelay: openDelay, children: [_jsx(HoverCard.Trigger, { asChild: true, onMouseEnter: () => setLoad(true), children: children }), _jsx(HoverCard.Portal, { children: _jsxs(HoverCard.Content, { className: "exclude-from-outline hover-card-content", sideOffset: 5, side: side, children: [typeof card === 'function' ? load && card({ load }) : card, _jsx(HoverCard.Arrow, { className: arrowClass })] }) })] }));
|
|
7
8
|
}
|
|
8
|
-
export function Tooltip({ title, children, }) {
|
|
9
|
-
return (_jsx(HoverPopover, { side: "top", card: _jsx("div", { className:
|
|
9
|
+
export function Tooltip({ title, children, className, }) {
|
|
10
|
+
return (_jsx(HoverPopover, { side: "top", card: _jsx("div", { className: classNames('p-1 text-xs text-white bg-blue-900 dark:bg-white dark:text-black', className), children: title }), arrowClass: "fill-blue-900 dark:fill-white", children: children }));
|
|
10
11
|
}
|
package/dist/crossReference.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ export declare function useFetchMdast({ remote, url, remoteBaseUrl, dataUrl, }:
|
|
|
6
6
|
remoteBaseUrl?: string;
|
|
7
7
|
dataUrl?: string;
|
|
8
8
|
}): import("swr").SWRResponse<any, any, any>;
|
|
9
|
-
export declare function CrossReferenceHover({ url: urlIn, dataUrl: dataUrlIn, remote: remoteIn, remoteBaseUrl: remoteBaseUrlIn, children, identifier, htmlId, }: {
|
|
9
|
+
export declare function CrossReferenceHover({ url: urlIn, dataUrl: dataUrlIn, remote: remoteIn, remoteBaseUrl: remoteBaseUrlIn, children, identifier, className, htmlId, }: {
|
|
10
10
|
remote?: boolean;
|
|
11
11
|
url?: string;
|
|
12
12
|
dataUrl?: string;
|
|
13
13
|
remoteBaseUrl?: string;
|
|
14
14
|
identifier: string;
|
|
15
15
|
htmlId?: string;
|
|
16
|
+
className?: string;
|
|
16
17
|
children: React.ReactNode;
|
|
17
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export declare const CrossReferenceNode: NodeRenderer<CrossReference>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../src/crossReference.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAOL,KAAK,YAAY,EAElB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../src/crossReference.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAOL,KAAK,YAAY,EAElB,MAAM,uBAAuB,CAAC;AA6E/B,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,GAAG,EACH,aAAa,EACb,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,4CAIA;AAqBD,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,QAAQ,EAChB,aAAa,EAAE,eAAe,EAC9B,QAAQ,EACR,UAAU,EACV,SAAS,EACT,MAAW,GACZ,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAuEA;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,cAAc,CAkC3D,CAAC;AAEF,QAAA,MAAM,yBAAyB;;CAE9B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
package/dist/crossReference.js
CHANGED
|
@@ -6,6 +6,7 @@ import { HoverPopover } from './components/index.js';
|
|
|
6
6
|
import { MyST } from './MyST.js';
|
|
7
7
|
import { selectMdastNodes } from 'myst-common';
|
|
8
8
|
import { scrollToElement } from './hashLink.js';
|
|
9
|
+
import classNames from 'classnames';
|
|
9
10
|
const fetcher = (...args) => fetch(...args).then((res) => {
|
|
10
11
|
if (res.status === 200)
|
|
11
12
|
return res.json();
|
|
@@ -81,7 +82,7 @@ function useSelectNodes({ load, identifier }) {
|
|
|
81
82
|
});
|
|
82
83
|
return { htmlId, nodes, loading: remote && !data, error: remote && error };
|
|
83
84
|
}
|
|
84
|
-
export function CrossReferenceHover({ url: urlIn, dataUrl: dataUrlIn, remote: remoteIn, remoteBaseUrl: remoteBaseUrlIn, children, identifier, htmlId = '', }) {
|
|
85
|
+
export function CrossReferenceHover({ url: urlIn, dataUrl: dataUrlIn, remote: remoteIn, remoteBaseUrl: remoteBaseUrlIn, children, identifier, className, htmlId = '', }) {
|
|
85
86
|
var _a;
|
|
86
87
|
const Link = useLinkProvider();
|
|
87
88
|
const baseurl = useBaseurl();
|
|
@@ -98,14 +99,15 @@ export function CrossReferenceHover({ url: urlIn, dataUrl: dataUrlIn, remote: re
|
|
|
98
99
|
const el = document.getElementById(htmlId);
|
|
99
100
|
scrollToElement(el, { htmlId });
|
|
100
101
|
};
|
|
101
|
-
|
|
102
|
+
const isButtonLike = (className !== null && className !== void 0 ? className : '').split(' ').includes('button');
|
|
103
|
+
return (_jsx(HoverPopover, { card: ({ load }) => (_jsx(XRefProvider, { remote: remote, remoteBaseUrl: remoteBaseUrl, url: url, dataUrl: dataUrl, children: _jsxs("div", { className: "hover-document article w-[500px] sm:max-w-[500px] overflow-auto", children: [remoteBaseUrl && (_jsxs("div", { className: "w-full px-3 py-1 text-xs border-b bg-gray-50", children: [_jsx("strong", { className: "text-gray-700", children: "Source: " }), _jsx("a", { className: classNames('text-gray-700', className), href: `${createRemoteBaseUrl(url, remoteBaseUrl)}${htmlId ? `#${htmlId}` : ''}`, target: "_blank", children: remoteBaseUrl })] })), _jsx("div", { className: "px-3", children: _jsx(XrefChildren, { load: load, identifier: identifier }) })] }) })), children: _jsxs("span", { children: [remote && external && (_jsx("a", { href: `${createRemoteBaseUrl(url, remoteBaseUrl)}${htmlId ? `#${htmlId}` : ''}`, target: "_blank", className: classNames({ 'hover-link': !isButtonLike }, className), children: children })), remote && !external && (_jsx(Link, { to: `${withBaseurl(url, baseurl)}${htmlId ? `#${htmlId}` : ''}`, prefetch: "intent", className: classNames({ 'hover-link': !isButtonLike }, className), children: children })), !remote && (_jsx("a", { href: `#${htmlId}`, onClick: scroll, className: classNames({ 'hover-link': !isButtonLike }, className), children: children }))] }) }));
|
|
102
104
|
}
|
|
103
|
-
export const CrossReferenceNode = ({ node }) => {
|
|
105
|
+
export const CrossReferenceNode = ({ node, className }) => {
|
|
104
106
|
if (!node.children) {
|
|
105
|
-
return (_jsx(InlineError, { value: node.label || node.identifier || 'No Label', message: "Cross Reference Not Found" }));
|
|
107
|
+
return (_jsx(InlineError, { value: node.label || node.identifier || 'No Label', message: "Cross Reference Not Found", className: className }));
|
|
106
108
|
}
|
|
107
|
-
const { remote, url, dataUrl, remoteBaseUrl, identifier, html_id } = node;
|
|
108
|
-
return (_jsxs(CrossReferenceHover, { identifier: identifier, htmlId: html_id, remote: remote, url: url, dataUrl: dataUrl, remoteBaseUrl: remoteBaseUrl, children: [node.prefix && _jsxs(_Fragment, { children: [node.prefix, " "] }), _jsx(MyST, { ast: node.children }), node.suffix || null] }));
|
|
109
|
+
const { remote, url, dataUrl, remoteBaseUrl, identifier, html_id, class: nodeClass, } = node;
|
|
110
|
+
return (_jsxs(CrossReferenceHover, { identifier: identifier, htmlId: html_id, remote: remote, url: url, dataUrl: dataUrl, remoteBaseUrl: remoteBaseUrl, className: classNames(nodeClass, className), children: [node.prefix && _jsxs(_Fragment, { children: [node.prefix, " "] }), _jsx(MyST, { ast: node.children }), node.suffix || null] }));
|
|
109
111
|
};
|
|
110
112
|
const CROSS_REFERENCE_RENDERERS = {
|
|
111
113
|
crossReference: CrossReferenceNode,
|
package/dist/dropdown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../src/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAIF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,WAAW,CAElD,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,SAAS,GACV,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CA+BA;AAED,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../src/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAIF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,WAAW,CAElD,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,IA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