myst-to-react 0.13.7 → 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 +9 -0
- package/dist/block.d.ts.map +1 -0
- package/dist/block.js +24 -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,9 @@
|
|
|
1
|
+
import type { GenericParent } from 'myst-common';
|
|
2
|
+
import type { NodeRenderer } from '@myst-theme/providers';
|
|
3
|
+
export declare function Block({ node, className }: {
|
|
4
|
+
node: GenericParent;
|
|
5
|
+
className?: string;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
declare const BLOCK_RENDERERS: Record<string, NodeRenderer>;
|
|
8
|
+
export default BLOCK_RENDERERS;
|
|
9
|
+
//# 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;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
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
export function Block({ node, className }) {
|
|
6
|
+
var _a, _b;
|
|
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 }));
|
|
16
|
+
if (node.visibility === 'hide') {
|
|
17
|
+
return _jsx(Details, { title: "Block", children: block });
|
|
18
|
+
}
|
|
19
|
+
return block;
|
|
20
|
+
}
|
|
21
|
+
const BLOCK_RENDERERS = {
|
|
22
|
+
block: Block,
|
|
23
|
+
};
|
|
24
|
+
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.1",
|
|
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.1",
|
|
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",
|