myst-to-react 1.2.2 → 1.3.0
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/math.d.ts.map +1 -1
- package/dist/math.js +7 -1
- package/package.json +2 -2
package/dist/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../src/math.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../src/math.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA6B1D,KAAK,QAAQ,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAmDF,QAAA,MAAM,cAAc;;;CAGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/math.js
CHANGED
|
@@ -2,14 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ExclamationCircleIcon } from '@heroicons/react/24/outline';
|
|
3
3
|
import { InlineError } from './inlineError.js';
|
|
4
4
|
import { HashLink } from './hashLink.js';
|
|
5
|
+
import { useIsScrollable } from '@myst-theme/providers';
|
|
5
6
|
import classNames from 'classnames';
|
|
6
7
|
const mathRenderer = ({ node, className }) => {
|
|
8
|
+
const { ref, isScrollable } = useIsScrollable();
|
|
7
9
|
if (node.type === 'math') {
|
|
8
10
|
if (node.error || !node.html) {
|
|
9
11
|
return (_jsxs("pre", { title: node.message, className: className, children: [_jsxs("span", { className: "text-red-500", children: [_jsx(ExclamationCircleIcon, { width: "1rem", height: "1rem", className: "inline mr-1" }), node.message, '\n\n'] }), node.value] }));
|
|
10
12
|
}
|
|
11
13
|
const id = node.html_id || node.identifier || node.key;
|
|
12
|
-
return (_jsxs("div", { id: id, className: classNames('flex my-5 group', className), children: [_jsx("div", {
|
|
14
|
+
return (_jsxs("div", { id: id, className: classNames('flex my-5 group', className), children: [_jsx("div", { ref: ref, tabIndex: isScrollable ? 0 : undefined, role: isScrollable ? 'region' : undefined, "aria-label": isScrollable
|
|
15
|
+
? node.enumerator
|
|
16
|
+
? `Equation ${node.enumerator}`
|
|
17
|
+
: 'Mathematical Equation'
|
|
18
|
+
: undefined, dangerouslySetInnerHTML: { __html: node.html }, className: "flex-grow overflow-x-auto overflow-y-hidden" }), node.enumerator && (_jsx("div", { className: "relative self-center flex-none pl-2 m-0 text-right select-none", children: _jsxs(HashLink, { id: id, kind: "Equation", className: "text-inherit hover:text-inherit", children: ["(", node.enumerator, ")"] }) }))] }));
|
|
13
19
|
}
|
|
14
20
|
if (node.error || !node.html) {
|
|
15
21
|
return _jsx(InlineError, { value: node.value, message: node.message, className: className });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@heroicons/react": "^2.0.18",
|
|
30
|
-
"@myst-theme/providers": "^1.
|
|
30
|
+
"@myst-theme/providers": "^1.3.0",
|
|
31
31
|
"@radix-ui/react-hover-card": "^1.0.6",
|
|
32
32
|
"@scienceicons/react": "^0.0.13",
|
|
33
33
|
"buffer": "^6.0.3",
|