myst-to-react 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/block.d.ts +2 -4
- package/dist/block.d.ts.map +1 -1
- package/dist/block.js +11 -15
- package/package.json +2 -2
package/dist/block.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { GenericParent } from 'myst-common';
|
|
2
2
|
import type { NodeRenderer } from '@myst-theme/providers';
|
|
3
|
-
export declare function Block({
|
|
4
|
-
id: string;
|
|
3
|
+
export declare function Block({ node, className }: {
|
|
5
4
|
node: GenericParent;
|
|
6
5
|
className?: string;
|
|
7
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare const BlockRenderer: NodeRenderer;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
9
7
|
declare const BLOCK_RENDERERS: Record<string, NodeRenderer>;
|
|
10
8
|
export default BLOCK_RENDERERS;
|
|
11
9
|
//# sourceMappingURL=block.d.ts.map
|
package/dist/block.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../src/block.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../src/block.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kDAoBrF;AAED,QAAA,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAEjD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/block.js
CHANGED
|
@@ -2,27 +2,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Details } from './dropdown.js';
|
|
3
3
|
import { MyST } from './MyST.js';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
|
|
6
|
-
export function Block({ id, node, className, }) {
|
|
5
|
+
export function Block({ node, className }) {
|
|
7
6
|
var _a, _b;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const cn = classNames(className, node.class, {
|
|
8
|
+
[(_a = node.data) === null || _a === void 0 ? void 0 : _a.class]: typeof ((_b = node.data) === null || _b === void 0 ? void 0 : _b.class) === 'string',
|
|
9
|
+
});
|
|
10
|
+
if (node.visibility === 'remove')
|
|
11
|
+
return null;
|
|
12
|
+
// Only wrap this in a block if the block has a class name or an identifier
|
|
13
|
+
// Otherwise pass through the contents as is.
|
|
14
|
+
// This allows children (e.g. margin) access to the grid-system
|
|
15
|
+
const block = cn || node.identifier ? (_jsx("div", { id: node.identifier, className: cn, children: _jsx(MyST, { ast: node.children }) })) : (_jsx(MyST, { ast: node.children }));
|
|
17
16
|
if (node.visibility === 'hide') {
|
|
18
17
|
return _jsx(Details, { title: "Block", children: block });
|
|
19
18
|
}
|
|
20
19
|
return block;
|
|
21
20
|
}
|
|
22
|
-
export const BlockRenderer = ({ node, className }) => {
|
|
23
|
-
return (_jsx(Block, { id: node.key, node: node, className: classNames(node.class, className) }, node.key));
|
|
24
|
-
};
|
|
25
21
|
const BLOCK_RENDERERS = {
|
|
26
|
-
block:
|
|
22
|
+
block: Block,
|
|
27
23
|
};
|
|
28
24
|
export default BLOCK_RENDERERS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
|
-
"@myst-theme/providers": "^0.14.
|
|
24
|
+
"@myst-theme/providers": "^0.14.1",
|
|
25
25
|
"@scienceicons/react": "^0.0.11",
|
|
26
26
|
"@radix-ui/react-hover-card": "^1.0.6",
|
|
27
27
|
"buffer": "^6.0.3",
|