myst-to-react 0.13.7 → 0.14.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/block.d.ts +11 -0
- package/dist/block.d.ts.map +1 -0
- package/dist/block.js +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/package.json +4 -4
package/dist/block.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GenericParent } from 'myst-common';
|
|
2
|
+
import type { NodeRenderer } from '@myst-theme/providers';
|
|
3
|
+
export declare function Block({ id, node, className, }: {
|
|
4
|
+
id: string;
|
|
5
|
+
node: GenericParent;
|
|
6
|
+
className?: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const BlockRenderer: NodeRenderer;
|
|
9
|
+
declare const BLOCK_RENDERERS: Record<string, NodeRenderer>;
|
|
10
|
+
export default BLOCK_RENDERERS;
|
|
11
|
+
//# sourceMappingURL=block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../src/block.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,wBAAgB,KAAK,CAAC,EACpB,EAAE,EACF,IAAI,EACJ,SAAS,GACV,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAuBA;AAED,eAAO,MAAM,aAAa,EAAE,YAI3B,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAEjD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/block.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Details } from './dropdown.js';
|
|
3
|
+
import { MyST } from './MyST.js';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { useGridSystemProvider } from '@myst-theme/providers';
|
|
6
|
+
export function Block({ id, node, className, }) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const grid = useGridSystemProvider();
|
|
9
|
+
const subGrid = node.visibility === 'hide' ? '' : `${grid} subgrid-gap col-screen`;
|
|
10
|
+
const dataClassName = typeof ((_a = node.data) === null || _a === void 0 ? void 0 : _a.class) === 'string' ? (_b = node.data) === null || _b === void 0 ? void 0 : _b.class : undefined;
|
|
11
|
+
// Hide the subgrid if either the dataClass or the className exists and includes `col-`
|
|
12
|
+
const noSubGrid = (dataClassName && dataClassName.includes('col-')) || (className && className.includes('col-'));
|
|
13
|
+
const block = (_jsx("div", { id: id, className: classNames('relative group/block', className, dataClassName, {
|
|
14
|
+
[subGrid]: !noSubGrid,
|
|
15
|
+
hidden: node.visibility === 'remove',
|
|
16
|
+
}), children: _jsx(MyST, { ast: node.children }) }, `block-${id}`));
|
|
17
|
+
if (node.visibility === 'hide') {
|
|
18
|
+
return _jsx(Details, { title: "Block", children: block });
|
|
19
|
+
}
|
|
20
|
+
return block;
|
|
21
|
+
}
|
|
22
|
+
export const BlockRenderer = ({ node, className }) => {
|
|
23
|
+
return (_jsx(Block, { id: node.key, node: node, className: classNames(node.class, className) }, node.key));
|
|
24
|
+
};
|
|
25
|
+
const BLOCK_RENDERERS = {
|
|
26
|
+
block: BlockRenderer,
|
|
27
|
+
};
|
|
28
|
+
export default BLOCK_RENDERERS;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,wDA2B7B,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { mergeRenderers } from '@myst-theme/providers';
|
|
|
2
2
|
import BASIC_RENDERERS from './basic.js';
|
|
3
3
|
import ADMONITION_RENDERERS from './admonitions.js';
|
|
4
4
|
import DROPDOWN_RENDERERS from './dropdown.js';
|
|
5
|
+
import BLOCK_RENDERERS from './block.js';
|
|
5
6
|
import CARD_RENDERERS from './card.js';
|
|
6
7
|
import GRID_RENDERERS from './grid.js';
|
|
7
8
|
import CITE_RENDERERS from './cite.js';
|
|
@@ -21,6 +22,7 @@ import PROOF_RENDERERS from './proof.js';
|
|
|
21
22
|
import EXERCISE_RENDERERS from './exercise.js';
|
|
22
23
|
import ASIDE_RENDERERS from './aside.js';
|
|
23
24
|
import UNKNOWN_MYST_RENDERERS from './unknown.js';
|
|
25
|
+
export { Block } from './block.js';
|
|
24
26
|
export { CopyIcon, HoverPopover, Tooltip, LinkCard } from './components/index.js';
|
|
25
27
|
export { CodeBlock } from './code.js';
|
|
26
28
|
export { HashLink, scrollToElement } from './hashLink.js';
|
|
@@ -31,6 +33,7 @@ export { useFetchMdast } from './crossReference.js';
|
|
|
31
33
|
export const DEFAULT_RENDERERS = mergeRenderers([
|
|
32
34
|
BASIC_RENDERERS,
|
|
33
35
|
UNKNOWN_MYST_RENDERERS,
|
|
36
|
+
BLOCK_RENDERERS,
|
|
34
37
|
IMAGE_RENDERERS,
|
|
35
38
|
LINK_RENDERERS,
|
|
36
39
|
CODE_RENDERERS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
|
-
"@myst-theme/providers": "^0.
|
|
24
|
+
"@myst-theme/providers": "^0.14.0",
|
|
25
25
|
"@scienceicons/react": "^0.0.11",
|
|
26
26
|
"@radix-ui/react-hover-card": "^1.0.6",
|
|
27
27
|
"buffer": "^6.0.3",
|
|
28
28
|
"classnames": "^2.3.2",
|
|
29
|
-
"myst-common": "^1.7.
|
|
30
|
-
"myst-config": "^1.7.
|
|
29
|
+
"myst-common": "^1.7.9",
|
|
30
|
+
"myst-config": "^1.7.9",
|
|
31
31
|
"myst-spec": "^0.0.5",
|
|
32
32
|
"nanoid": "^4.0.2",
|
|
33
33
|
"react-syntax-highlighter": "15.5.0",
|