myst-to-react 0.1.18 → 0.1.20
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/cjs/admonitions.d.ts +32 -0
- package/dist/cjs/admonitions.d.ts.map +1 -0
- package/dist/cjs/admonitions.js +126 -0
- package/dist/cjs/basic.d.ts +62 -0
- package/dist/cjs/basic.d.ts.map +1 -0
- package/dist/cjs/basic.js +125 -0
- package/dist/cjs/card.d.ts +27 -0
- package/dist/cjs/card.d.ts.map +1 -0
- package/dist/cjs/card.js +64 -0
- package/dist/cjs/cite.d.ts +6 -0
- package/dist/cjs/cite.d.ts.map +1 -0
- package/dist/cjs/cite.js +36 -0
- package/dist/cjs/code.d.ts +21 -0
- package/dist/cjs/code.d.ts.map +1 -0
- package/dist/cjs/code.js +66 -0
- package/dist/cjs/components/ClickPopover.d.ts +11 -0
- package/dist/cjs/components/ClickPopover.d.ts.map +1 -0
- package/dist/cjs/components/ClickPopover.js +18 -0
- package/dist/cjs/components/CopyIcon.d.ts +5 -0
- package/dist/cjs/components/CopyIcon.d.ts.map +1 -0
- package/dist/cjs/components/CopyIcon.js +28 -0
- package/dist/cjs/components/HoverPopover.d.ts +9 -0
- package/dist/cjs/components/HoverPopover.d.ts.map +1 -0
- package/dist/cjs/components/HoverPopover.js +32 -0
- package/dist/cjs/components/LinkCard.d.ts +11 -0
- package/dist/cjs/components/LinkCard.d.ts.map +1 -0
- package/dist/cjs/components/LinkCard.js +15 -0
- package/dist/cjs/convertToReact.d.ts +6 -0
- package/dist/cjs/convertToReact.d.ts.map +1 -0
- package/dist/cjs/convertToReact.js +30 -0
- package/dist/cjs/crossReference.d.ts +13 -0
- package/dist/cjs/crossReference.d.ts.map +1 -0
- package/dist/cjs/crossReference.js +92 -0
- package/dist/cjs/dropdown.d.ts +16 -0
- package/dist/cjs/dropdown.d.ts.map +1 -0
- package/dist/cjs/dropdown.js +27 -0
- package/dist/cjs/extensions/chemicalFormula.d.ts +7 -0
- package/dist/cjs/extensions/chemicalFormula.d.ts.map +1 -0
- package/dist/cjs/extensions/chemicalFormula.js +39 -0
- package/dist/cjs/extensions/index.d.ts +4 -0
- package/dist/cjs/extensions/index.d.ts.map +1 -0
- package/dist/cjs/extensions/index.js +9 -0
- package/dist/cjs/extensions/siunits.d.ts +7 -0
- package/dist/cjs/extensions/siunits.d.ts.map +1 -0
- package/dist/cjs/extensions/siunits.js +12 -0
- package/dist/cjs/footnotes.d.ts +11 -0
- package/dist/cjs/footnotes.d.ts.map +1 -0
- package/dist/cjs/footnotes.js +24 -0
- package/dist/cjs/grid.d.ts +11 -0
- package/dist/cjs/grid.d.ts.map +1 -0
- package/dist/cjs/grid.js +117 -0
- package/dist/cjs/heading.d.ts +14 -0
- package/dist/cjs/heading.d.ts.map +1 -0
- package/dist/cjs/heading.js +40 -0
- package/dist/cjs/iframe.d.ts +7 -0
- package/dist/cjs/iframe.d.ts.map +1 -0
- package/dist/cjs/iframe.js +24 -0
- package/dist/cjs/image.d.ts +11 -0
- package/dist/cjs/image.d.ts.map +1 -0
- package/dist/cjs/image.js +52 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +45 -0
- package/dist/cjs/inlineError.d.ts +8 -0
- package/dist/cjs/inlineError.d.ts.map +1 -0
- package/dist/cjs/inlineError.js +9 -0
- package/dist/cjs/links/github.d.ts +12 -0
- package/dist/cjs/links/github.d.ts.map +1 -0
- package/dist/cjs/links/github.js +63 -0
- package/dist/cjs/links/index.d.ts +14 -0
- package/dist/cjs/links/index.d.ts.map +1 -0
- package/dist/cjs/links/index.js +68 -0
- package/dist/cjs/links/rrid.d.ts +5 -0
- package/dist/cjs/links/rrid.d.ts.map +1 -0
- package/dist/cjs/links/rrid.js +35 -0
- package/dist/cjs/links/wiki.d.ts +8 -0
- package/dist/cjs/links/wiki.d.ts.map +1 -0
- package/dist/cjs/links/wiki.js +39 -0
- package/dist/cjs/math.d.ts +13 -0
- package/dist/cjs/math.d.ts.map +1 -0
- package/dist/cjs/math.js +29 -0
- package/dist/cjs/reactive.d.ts +88 -0
- package/dist/cjs/reactive.d.ts.map +1 -0
- package/dist/cjs/reactive.js +64 -0
- package/dist/cjs/tabs.d.ts +12 -0
- package/dist/cjs/tabs.d.ts.map +1 -0
- package/dist/cjs/tabs.js +38 -0
- package/dist/types/admonitions.d.ts +32 -0
- package/dist/types/admonitions.d.ts.map +1 -0
- package/dist/types/basic.d.ts +62 -0
- package/dist/types/basic.d.ts.map +1 -0
- package/dist/types/card.d.ts +27 -0
- package/dist/types/card.d.ts.map +1 -0
- package/dist/types/cite.d.ts +6 -0
- package/dist/types/cite.d.ts.map +1 -0
- package/dist/types/code.d.ts +21 -0
- package/dist/types/code.d.ts.map +1 -0
- package/dist/types/components/ClickPopover.d.ts +11 -0
- package/dist/types/components/ClickPopover.d.ts.map +1 -0
- package/dist/types/components/CopyIcon.d.ts +5 -0
- package/dist/types/components/CopyIcon.d.ts.map +1 -0
- package/dist/types/components/HoverPopover.d.ts +9 -0
- package/dist/types/components/HoverPopover.d.ts.map +1 -0
- package/dist/types/components/LinkCard.d.ts +11 -0
- package/dist/types/components/LinkCard.d.ts.map +1 -0
- package/dist/types/convertToReact.d.ts +6 -0
- package/dist/types/convertToReact.d.ts.map +1 -0
- package/dist/types/crossReference.d.ts +13 -0
- package/dist/types/crossReference.d.ts.map +1 -0
- package/dist/types/dropdown.d.ts +16 -0
- package/dist/types/dropdown.d.ts.map +1 -0
- package/dist/types/extensions/chemicalFormula.d.ts +7 -0
- package/dist/types/extensions/chemicalFormula.d.ts.map +1 -0
- package/dist/types/extensions/index.d.ts +4 -0
- package/dist/types/extensions/index.d.ts.map +1 -0
- package/dist/types/extensions/siunits.d.ts +7 -0
- package/dist/types/extensions/siunits.d.ts.map +1 -0
- package/dist/types/footnotes.d.ts +11 -0
- package/dist/types/footnotes.d.ts.map +1 -0
- package/dist/types/grid.d.ts +11 -0
- package/dist/types/grid.d.ts.map +1 -0
- package/dist/types/heading.d.ts +14 -0
- package/dist/types/heading.d.ts.map +1 -0
- package/dist/types/iframe.d.ts +7 -0
- package/dist/types/iframe.d.ts.map +1 -0
- package/dist/types/image.d.ts +11 -0
- package/dist/types/image.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/inlineError.d.ts +8 -0
- package/dist/types/inlineError.d.ts.map +1 -0
- package/dist/types/links/github.d.ts +12 -0
- package/dist/types/links/github.d.ts.map +1 -0
- package/dist/types/links/index.d.ts +14 -0
- package/dist/types/links/index.d.ts.map +1 -0
- package/dist/types/links/rrid.d.ts +5 -0
- package/dist/types/links/rrid.d.ts.map +1 -0
- package/dist/types/links/wiki.d.ts +8 -0
- package/dist/types/links/wiki.d.ts.map +1 -0
- package/dist/types/math.d.ts +13 -0
- package/dist/types/math.d.ts.map +1 -0
- package/dist/types/reactive.d.ts +88 -0
- package/dist/types/reactive.d.ts.map +1 -0
- package/dist/types/tabs.d.ts +12 -0
- package/dist/types/tabs.d.ts.map +1 -0
- package/package.json +18 -21
- package/src/admonitions.tsx +0 -183
- package/src/basic.tsx +0 -229
- package/src/card.tsx +0 -153
- package/src/cite.tsx +0 -43
- package/src/code.tsx +0 -119
- package/src/components/ClickPopover.tsx +0 -56
- package/src/components/CopyIcon.tsx +0 -40
- package/src/components/HoverPopover.tsx +0 -60
- package/src/components/LinkCard.tsx +0 -42
- package/src/convertToReact.ts +0 -33
- package/src/crossReference.tsx +0 -139
- package/src/dropdown.tsx +0 -69
- package/src/extensions/chemicalFormula.tsx +0 -42
- package/src/extensions/index.tsx +0 -10
- package/src/extensions/siunits.tsx +0 -15
- package/src/footnotes.tsx +0 -30
- package/src/grid.tsx +0 -127
- package/src/heading.tsx +0 -68
- package/src/iframe.tsx +0 -42
- package/src/image.tsx +0 -97
- package/src/index.tsx +0 -65
- package/src/inlineError.tsx +0 -15
- package/src/links/index.tsx +0 -132
- package/src/links/rrid.tsx +0 -81
- package/src/links/wiki.tsx +0 -119
- package/src/math.tsx +0 -81
- package/src/mermaid.tsx +0 -49
- package/src/myst.tsx +0 -226
- package/src/output/components.tsx +0 -34
- package/src/output/error.tsx +0 -20
- package/src/output/hooks.ts +0 -127
- package/src/output/index.tsx +0 -7
- package/src/output/jupyter.tsx +0 -86
- package/src/output/output.tsx +0 -79
- package/src/output/outputBlock.tsx +0 -21
- package/src/output/safe.tsx +0 -84
- package/src/output/selectors.ts +0 -15
- package/src/output/stream.tsx +0 -18
- package/src/reactive.tsx +0 -64
- package/src/tabs.tsx +0 -63
- package/src/types.ts +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inlineError.d.ts","sourceRoot":"","sources":["../../src/inlineError.tsx"],"names":[],"mappings":";AAEA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,eAOpD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function GithubLink({ children, url, org, repo, raw, file, from, to, }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
url: string;
|
|
5
|
+
raw: string;
|
|
6
|
+
org: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
file: string;
|
|
9
|
+
from?: number;
|
|
10
|
+
to?: number;
|
|
11
|
+
}): JSX.Element;
|
|
12
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/links/github.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAwGnD,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,GAAG,EACH,GAAG,EACH,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,EAAE,GACH,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,eAqBA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Link } from 'myst-spec';
|
|
2
|
+
import type { NodeRenderer } from '@myst-theme/providers';
|
|
3
|
+
type TransformedLink = Link & {
|
|
4
|
+
internal?: boolean;
|
|
5
|
+
protocol?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const link: NodeRenderer<TransformedLink>;
|
|
8
|
+
export declare const linkBlock: NodeRenderer<TransformedLink>;
|
|
9
|
+
declare const LINK_RENDERERS: {
|
|
10
|
+
link: NodeRenderer<TransformedLink>;
|
|
11
|
+
linkBlock: NodeRenderer<TransformedLink>;
|
|
12
|
+
};
|
|
13
|
+
export default LINK_RENDERERS;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/links/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D,KAAK,eAAe,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAiDxE,eAAO,MAAM,IAAI,EAAE,YAAY,CAAC,eAAe,CA+C9C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,eAAe,CAkCnD,CAAC;AAEF,QAAA,MAAM,cAAc;;;CAGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rrid.d.ts","sourceRoot":"","sources":["../../../src/links/rrid.tsx"],"names":[],"mappings":";AAyEA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,eAOlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../../src/links/wiki.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgG1B,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,IAAI,GACL,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,eAQA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InlineMath, Math } from 'myst-spec';
|
|
2
|
+
import type { NodeRenderer } from '@myst-theme/providers';
|
|
3
|
+
type MathLike = (InlineMath | Math) & {
|
|
4
|
+
error?: boolean;
|
|
5
|
+
message?: string;
|
|
6
|
+
html?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const MATH_RENDERERS: {
|
|
9
|
+
math: NodeRenderer<MathLike>;
|
|
10
|
+
inlineMath: NodeRenderer<MathLike>;
|
|
11
|
+
};
|
|
12
|
+
export default MATH_RENDERERS;
|
|
13
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/math.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA2B1D,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;AAuCF,QAAA,MAAM,cAAc;;;CAGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { GenericNode } from 'mystjs';
|
|
3
|
+
export declare const RVar: (node: GenericNode) => import("react").ReactElement<{
|
|
4
|
+
key: any;
|
|
5
|
+
name: any;
|
|
6
|
+
value: string | undefined;
|
|
7
|
+
':value': any;
|
|
8
|
+
format: any;
|
|
9
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
10
|
+
export declare const RDisplay: (node: GenericNode) => import("react").ReactElement<{
|
|
11
|
+
key: any;
|
|
12
|
+
name: any;
|
|
13
|
+
value: string | undefined;
|
|
14
|
+
':value': any;
|
|
15
|
+
format: any;
|
|
16
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
17
|
+
export declare const RDynamic: (node: GenericNode) => import("react").ReactElement<{
|
|
18
|
+
key: any;
|
|
19
|
+
name: any;
|
|
20
|
+
value: string | undefined;
|
|
21
|
+
':value': any;
|
|
22
|
+
max: any;
|
|
23
|
+
':max': any;
|
|
24
|
+
min: any;
|
|
25
|
+
':min': any;
|
|
26
|
+
step: any;
|
|
27
|
+
':step': any;
|
|
28
|
+
':change': any;
|
|
29
|
+
format: any;
|
|
30
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
31
|
+
export declare const RRange: (node: GenericNode) => import("react").ReactElement<{
|
|
32
|
+
key: any;
|
|
33
|
+
name: any;
|
|
34
|
+
value: string | undefined;
|
|
35
|
+
':value': any;
|
|
36
|
+
max: any;
|
|
37
|
+
':max': any;
|
|
38
|
+
min: any;
|
|
39
|
+
':min': any;
|
|
40
|
+
step: any;
|
|
41
|
+
':step': any;
|
|
42
|
+
':change': any;
|
|
43
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
44
|
+
declare const REACTIVE_RENDERERS: {
|
|
45
|
+
'r:var': (node: GenericNode) => import("react").ReactElement<{
|
|
46
|
+
key: any;
|
|
47
|
+
name: any;
|
|
48
|
+
value: string | undefined;
|
|
49
|
+
':value': any;
|
|
50
|
+
format: any;
|
|
51
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
52
|
+
'r:display': (node: GenericNode) => import("react").ReactElement<{
|
|
53
|
+
key: any;
|
|
54
|
+
name: any;
|
|
55
|
+
value: string | undefined;
|
|
56
|
+
':value': any;
|
|
57
|
+
format: any;
|
|
58
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
59
|
+
'r:dynamic': (node: GenericNode) => import("react").ReactElement<{
|
|
60
|
+
key: any;
|
|
61
|
+
name: any;
|
|
62
|
+
value: string | undefined;
|
|
63
|
+
':value': any;
|
|
64
|
+
max: any;
|
|
65
|
+
':max': any;
|
|
66
|
+
min: any;
|
|
67
|
+
':min': any;
|
|
68
|
+
step: any;
|
|
69
|
+
':step': any;
|
|
70
|
+
':change': any;
|
|
71
|
+
format: any;
|
|
72
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
73
|
+
'r:range': (node: GenericNode) => import("react").ReactElement<{
|
|
74
|
+
key: any;
|
|
75
|
+
name: any;
|
|
76
|
+
value: string | undefined;
|
|
77
|
+
':value': any;
|
|
78
|
+
max: any;
|
|
79
|
+
':max': any;
|
|
80
|
+
min: any;
|
|
81
|
+
':min': any;
|
|
82
|
+
step: any;
|
|
83
|
+
':step': any;
|
|
84
|
+
':change': any;
|
|
85
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
86
|
+
};
|
|
87
|
+
export default REACTIVE_RENDERERS;
|
|
88
|
+
//# sourceMappingURL=reactive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../../src/reactive.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG1C,eAAO,MAAM,IAAI,SAAU,WAAW;;;;;;uDAQrC,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,WAAW;;;;;;uDAQzC,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,WAAW;;;;;;;;;;;;;uDAezC,CAAC;AAEF,eAAO,MAAM,MAAM,SAAU,WAAW;;;;;;;;;;;;uDAcvC,CAAC;AAEF,QAAA,MAAM,kBAAkB;oBArDG,WAAW;;;;;;;wBAUP,WAAW;;;;;;;wBAUX,WAAW;;;;;;;;;;;;;;sBAiBb,WAAW;;;;;;;;;;;;;CAqBvC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GenericNode } from 'myst-common';
|
|
2
|
+
import type { NodeRenderer } from '@myst-theme/providers';
|
|
3
|
+
interface TabItem extends GenericNode {
|
|
4
|
+
key: string;
|
|
5
|
+
title: string;
|
|
6
|
+
sync?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const TabSetRenderer: NodeRenderer;
|
|
9
|
+
export declare const TabItemRenderer: NodeRenderer<TabItem>;
|
|
10
|
+
declare const TAB_RENDERERS: Record<string, NodeRenderer>;
|
|
11
|
+
export default TAB_RENDERERS;
|
|
12
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,UAAU,OAAQ,SAAQ,WAAW;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,cAAc,EAAE,YAiC5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,OAAO,CAOjD,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAG/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"main": "
|
|
5
|
-
"types": "
|
|
3
|
+
"version": "0.1.20",
|
|
4
|
+
"main": "dist/cjs/index.js",
|
|
5
|
+
"types": "dist/types/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
|
-
"
|
|
7
|
+
"dist"
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
|
+
"clean": "rimraf dist",
|
|
11
12
|
"compile": "tsc",
|
|
12
13
|
"lint": "eslint \"src/**/*.ts*\" \"src/**/*.tsx\" -c ./.eslintrc.js",
|
|
13
|
-
"lint:format": "prettier --check \"src/**/*.{ts,tsx,md}\""
|
|
14
|
+
"lint:format": "prettier --check \"src/**/*.{ts,tsx,md}\"",
|
|
15
|
+
"dev": "npm-run-all --parallel \"build:* -- --watch\"",
|
|
16
|
+
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
17
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --declarationMap --outDir dist/types",
|
|
18
|
+
"build": "npm-run-all -l clean -p build:cjs build:types"
|
|
14
19
|
},
|
|
15
20
|
"dependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"@curvenote/connect": "^0.0.6",
|
|
18
|
-
"@curvenote/nbtx": "^0.1.11",
|
|
19
|
-
"@curvenote/ui-providers": "*",
|
|
21
|
+
"@myst-theme/providers": "^0.1.20",
|
|
20
22
|
"@headlessui/react": "^1.6.5",
|
|
21
|
-
"@heroicons/react": "^
|
|
23
|
+
"@heroicons/react": "^2.0.12",
|
|
22
24
|
"@popperjs/core": "^2.11.5",
|
|
23
|
-
"ansi-to-react": "^6.1.6",
|
|
24
25
|
"buffer": "^6.0.3",
|
|
25
26
|
"classnames": "^2.3.1",
|
|
26
|
-
"
|
|
27
|
+
"myst-common": "^0.0.12",
|
|
28
|
+
"myst-config": "^0.0.6",
|
|
27
29
|
"myst-spec": "^0.0.4",
|
|
28
|
-
"myst-to-docx": "*",
|
|
29
|
-
"myst-to-tex": "*",
|
|
30
|
-
"myst-transforms": "*",
|
|
31
|
-
"mystjs": "^0.0.13",
|
|
32
30
|
"nanoid": "^4.0.0",
|
|
33
31
|
"react-popper": "^2.3.0",
|
|
34
32
|
"react-syntax-highlighter": "^15.5.0",
|
|
@@ -36,8 +34,6 @@
|
|
|
36
34
|
"unist-util-select": "^4.0.1"
|
|
37
35
|
},
|
|
38
36
|
"peerDependencies": {
|
|
39
|
-
"@remix-run/node": "^1.7.2",
|
|
40
|
-
"@remix-run/react": "^1.7.2",
|
|
41
37
|
"@types/react": "^16.8 || ^17.0 || ^18.0",
|
|
42
38
|
"@types/react-dom": "^16.8 || ^17.0 || ^18.0",
|
|
43
39
|
"react": "^16.8 || ^17.0 || ^18.0",
|
|
@@ -46,11 +42,12 @@
|
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
44
|
"@types/js-yaml": "^4.0.5",
|
|
49
|
-
"@types/mermaid": "^8.2.9",
|
|
50
45
|
"@types/react-syntax-highlighter": "^15.5.5",
|
|
51
46
|
"eslint": "^8.21.0",
|
|
52
|
-
"eslint-config-curvenote": "
|
|
53
|
-
"
|
|
47
|
+
"eslint-config-curvenote": "latest",
|
|
48
|
+
"npm-run-all": "^4.1.5",
|
|
49
|
+
"react-redux": "^8.0.5",
|
|
50
|
+
"tsconfig": "latest",
|
|
54
51
|
"typescript": "latest"
|
|
55
52
|
},
|
|
56
53
|
"overrides": {
|
package/src/admonitions.tsx
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import type * as spec from 'myst-spec';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import type { NodeRenderer } from './types';
|
|
4
|
-
import {
|
|
5
|
-
InformationCircleIcon,
|
|
6
|
-
ExclamationIcon as OExclamationIcon,
|
|
7
|
-
SpeakerphoneIcon,
|
|
8
|
-
PencilAltIcon,
|
|
9
|
-
ArrowCircleRightIcon,
|
|
10
|
-
} from '@heroicons/react/outline';
|
|
11
|
-
import {
|
|
12
|
-
ExclamationIcon as SExclamationIcon,
|
|
13
|
-
ExclamationCircleIcon as SExclamationCircleIcon,
|
|
14
|
-
XCircleIcon,
|
|
15
|
-
LightBulbIcon,
|
|
16
|
-
LightningBoltIcon,
|
|
17
|
-
ChevronRightIcon,
|
|
18
|
-
} from '@heroicons/react/solid';
|
|
19
|
-
import classNames from 'classnames';
|
|
20
|
-
// import { AdmonitionKind } from 'mystjs';
|
|
21
|
-
|
|
22
|
-
// TODO: get this from myst-spec?
|
|
23
|
-
enum AdmonitionKind {
|
|
24
|
-
admonition = 'admonition',
|
|
25
|
-
attention = 'attention',
|
|
26
|
-
caution = 'caution',
|
|
27
|
-
danger = 'danger',
|
|
28
|
-
error = 'error',
|
|
29
|
-
important = 'important',
|
|
30
|
-
hint = 'hint',
|
|
31
|
-
note = 'note',
|
|
32
|
-
seealso = 'seealso',
|
|
33
|
-
tip = 'tip',
|
|
34
|
-
warning = 'warning',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
type ColorAndKind = {
|
|
38
|
-
kind: AdmonitionKind;
|
|
39
|
-
color: 'blue' | 'green' | 'yellow' | 'red';
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
function getClasses(className?: string) {
|
|
43
|
-
const classes =
|
|
44
|
-
className
|
|
45
|
-
?.split(' ')
|
|
46
|
-
.map((s) => s.trim().toLowerCase())
|
|
47
|
-
.filter((s) => !!s) ?? [];
|
|
48
|
-
return [...new Set(classes)];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getFirstKind({
|
|
52
|
-
kind,
|
|
53
|
-
classes = [],
|
|
54
|
-
}: {
|
|
55
|
-
kind?: AdmonitionKind | string;
|
|
56
|
-
classes?: string[];
|
|
57
|
-
}): ColorAndKind {
|
|
58
|
-
if (kind === AdmonitionKind.note || classes.includes('note')) {
|
|
59
|
-
return { kind: AdmonitionKind.note, color: 'blue' };
|
|
60
|
-
}
|
|
61
|
-
if (kind === AdmonitionKind.important || classes.includes('important')) {
|
|
62
|
-
return { kind: AdmonitionKind.important, color: 'blue' };
|
|
63
|
-
}
|
|
64
|
-
if (kind === AdmonitionKind.hint || classes.includes('hint')) {
|
|
65
|
-
return { kind: AdmonitionKind.hint, color: 'green' };
|
|
66
|
-
}
|
|
67
|
-
if (kind === AdmonitionKind.seealso || classes.includes('seealso')) {
|
|
68
|
-
return { kind: AdmonitionKind.seealso, color: 'green' };
|
|
69
|
-
}
|
|
70
|
-
if (kind === AdmonitionKind.tip || classes.includes('tip')) {
|
|
71
|
-
return { kind: AdmonitionKind.tip, color: 'green' };
|
|
72
|
-
}
|
|
73
|
-
if (kind === AdmonitionKind.attention || classes.includes('attention')) {
|
|
74
|
-
return { kind: AdmonitionKind.attention, color: 'yellow' };
|
|
75
|
-
}
|
|
76
|
-
if (kind === AdmonitionKind.warning || classes.includes('warning')) {
|
|
77
|
-
return { kind: AdmonitionKind.warning, color: 'yellow' };
|
|
78
|
-
}
|
|
79
|
-
if (kind === AdmonitionKind.caution || classes.includes('caution')) {
|
|
80
|
-
return { kind: AdmonitionKind.caution, color: 'yellow' };
|
|
81
|
-
}
|
|
82
|
-
if (kind === AdmonitionKind.danger || classes.includes('danger')) {
|
|
83
|
-
return { kind: AdmonitionKind.danger, color: 'red' };
|
|
84
|
-
}
|
|
85
|
-
if (kind === AdmonitionKind.error || classes.includes('error')) {
|
|
86
|
-
return { kind: AdmonitionKind.error, color: 'red' };
|
|
87
|
-
}
|
|
88
|
-
return { kind: AdmonitionKind.note, color: 'blue' };
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const iconClass = 'h-8 w-8 inline-block pl-2 mr-2 -translate-y-[1px]';
|
|
92
|
-
|
|
93
|
-
function AdmonitionIcon({ kind }: { kind: AdmonitionKind }) {
|
|
94
|
-
if (kind === AdmonitionKind.note) return <InformationCircleIcon className={iconClass} />;
|
|
95
|
-
if (kind === AdmonitionKind.caution) return <OExclamationIcon className={iconClass} />;
|
|
96
|
-
if (kind === AdmonitionKind.warning) return <SExclamationIcon className={iconClass} />;
|
|
97
|
-
if (kind === AdmonitionKind.danger) return <SExclamationCircleIcon className={iconClass} />;
|
|
98
|
-
if (kind === AdmonitionKind.error) return <XCircleIcon className={iconClass} />;
|
|
99
|
-
if (kind === AdmonitionKind.attention) return <SpeakerphoneIcon className={iconClass} />;
|
|
100
|
-
if (kind === AdmonitionKind.tip) return <PencilAltIcon className={iconClass} />;
|
|
101
|
-
if (kind === AdmonitionKind.hint) return <LightBulbIcon className={iconClass} />;
|
|
102
|
-
if (kind === AdmonitionKind.important) return <LightningBoltIcon className={iconClass} />;
|
|
103
|
-
if (kind === AdmonitionKind.seealso) return <ArrowCircleRightIcon className={iconClass} />;
|
|
104
|
-
return <InformationCircleIcon className={iconClass} />;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const AdmonitionTitle: NodeRenderer<spec.AdmonitionTitle> = (node, children) => {
|
|
108
|
-
return children;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
function Admonition({
|
|
112
|
-
title,
|
|
113
|
-
kind,
|
|
114
|
-
color,
|
|
115
|
-
dropdown,
|
|
116
|
-
children,
|
|
117
|
-
}: ColorAndKind & { title: React.ReactNode; children: React.ReactNode[]; dropdown: boolean }) {
|
|
118
|
-
const [open, setOpen] = useState(false);
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<aside
|
|
122
|
-
className={classNames(
|
|
123
|
-
'admonition rounded-md my-4 border-l-4 shadow-md dark:shadow-2xl dark:shadow-neutral-900',
|
|
124
|
-
{
|
|
125
|
-
'border-blue-500': color === 'blue',
|
|
126
|
-
'border-green-600': color === 'green',
|
|
127
|
-
'border-amber-600': color === 'yellow',
|
|
128
|
-
'border-red-600': color === 'red',
|
|
129
|
-
},
|
|
130
|
-
)}
|
|
131
|
-
>
|
|
132
|
-
<p
|
|
133
|
-
className={classNames('admonition-header m-0 text-lg font-medium py-1', {
|
|
134
|
-
'text-blue-600 bg-blue-50 dark:bg-slate-900': color === 'blue',
|
|
135
|
-
'text-green-600 bg-green-50 dark:bg-slate-900': color === 'green',
|
|
136
|
-
'text-amber-600 bg-amber-50 dark:bg-slate-900': color === 'yellow',
|
|
137
|
-
'text-red-600 bg-red-50 dark:bg-slate-900': color === 'red',
|
|
138
|
-
'cursor-pointer hover:shadow-[inset_0_0_0px_20px_#00000003] dark:hover:shadow-[inset_0_0_0px_20px_#FFFFFF03]':
|
|
139
|
-
dropdown,
|
|
140
|
-
})}
|
|
141
|
-
onClick={dropdown ? () => setOpen(!open) : undefined}
|
|
142
|
-
>
|
|
143
|
-
<AdmonitionIcon kind={kind} />
|
|
144
|
-
<span className="text-neutral-900 dark:text-white">
|
|
145
|
-
{dropdown && (
|
|
146
|
-
<span className="block float-right font-thin text-sm text-neutral-700 dark:text-neutral-200">
|
|
147
|
-
{!open && 'Click to show'}
|
|
148
|
-
<ChevronRightIcon
|
|
149
|
-
className={classNames(iconClass, 'transition-transform', {
|
|
150
|
-
'rotate-90 -translate-y-[5px]': open,
|
|
151
|
-
})}
|
|
152
|
-
/>
|
|
153
|
-
</span>
|
|
154
|
-
)}
|
|
155
|
-
{title}
|
|
156
|
-
</span>
|
|
157
|
-
</p>
|
|
158
|
-
{(!dropdown || open) && (
|
|
159
|
-
<div className="px-4 py-1 bg-gray-50 dark:bg-stone-800">{children}</div>
|
|
160
|
-
)}
|
|
161
|
-
</aside>
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export const AdmonitionRenderer: NodeRenderer<spec.Admonition> = (node, children) => {
|
|
166
|
-
const [title, ...rest] = children as any[];
|
|
167
|
-
const classes = getClasses(node.class);
|
|
168
|
-
const { kind, color } = getFirstKind({ kind: node.kind, classes });
|
|
169
|
-
const isDropdown = classes.includes('dropdown');
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<Admonition key={node.key} title={title} kind={kind} color={color} dropdown={isDropdown}>
|
|
173
|
-
{rest}
|
|
174
|
-
</Admonition>
|
|
175
|
-
);
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const ADMONITION_RENDERERS = {
|
|
179
|
-
admonition: AdmonitionRenderer,
|
|
180
|
-
admonitionTitle: AdmonitionTitle,
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export default ADMONITION_RENDERERS;
|