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.
Files changed (187) hide show
  1. package/dist/cjs/admonitions.d.ts +32 -0
  2. package/dist/cjs/admonitions.d.ts.map +1 -0
  3. package/dist/cjs/admonitions.js +126 -0
  4. package/dist/cjs/basic.d.ts +62 -0
  5. package/dist/cjs/basic.d.ts.map +1 -0
  6. package/dist/cjs/basic.js +125 -0
  7. package/dist/cjs/card.d.ts +27 -0
  8. package/dist/cjs/card.d.ts.map +1 -0
  9. package/dist/cjs/card.js +64 -0
  10. package/dist/cjs/cite.d.ts +6 -0
  11. package/dist/cjs/cite.d.ts.map +1 -0
  12. package/dist/cjs/cite.js +36 -0
  13. package/dist/cjs/code.d.ts +21 -0
  14. package/dist/cjs/code.d.ts.map +1 -0
  15. package/dist/cjs/code.js +66 -0
  16. package/dist/cjs/components/ClickPopover.d.ts +11 -0
  17. package/dist/cjs/components/ClickPopover.d.ts.map +1 -0
  18. package/dist/cjs/components/ClickPopover.js +18 -0
  19. package/dist/cjs/components/CopyIcon.d.ts +5 -0
  20. package/dist/cjs/components/CopyIcon.d.ts.map +1 -0
  21. package/dist/cjs/components/CopyIcon.js +28 -0
  22. package/dist/cjs/components/HoverPopover.d.ts +9 -0
  23. package/dist/cjs/components/HoverPopover.d.ts.map +1 -0
  24. package/dist/cjs/components/HoverPopover.js +32 -0
  25. package/dist/cjs/components/LinkCard.d.ts +11 -0
  26. package/dist/cjs/components/LinkCard.d.ts.map +1 -0
  27. package/dist/cjs/components/LinkCard.js +15 -0
  28. package/dist/cjs/convertToReact.d.ts +6 -0
  29. package/dist/cjs/convertToReact.d.ts.map +1 -0
  30. package/dist/cjs/convertToReact.js +30 -0
  31. package/dist/cjs/crossReference.d.ts +13 -0
  32. package/dist/cjs/crossReference.d.ts.map +1 -0
  33. package/dist/cjs/crossReference.js +92 -0
  34. package/dist/cjs/dropdown.d.ts +16 -0
  35. package/dist/cjs/dropdown.d.ts.map +1 -0
  36. package/dist/cjs/dropdown.js +27 -0
  37. package/dist/cjs/extensions/chemicalFormula.d.ts +7 -0
  38. package/dist/cjs/extensions/chemicalFormula.d.ts.map +1 -0
  39. package/dist/cjs/extensions/chemicalFormula.js +39 -0
  40. package/dist/cjs/extensions/index.d.ts +4 -0
  41. package/dist/cjs/extensions/index.d.ts.map +1 -0
  42. package/dist/cjs/extensions/index.js +9 -0
  43. package/dist/cjs/extensions/siunits.d.ts +7 -0
  44. package/dist/cjs/extensions/siunits.d.ts.map +1 -0
  45. package/dist/cjs/extensions/siunits.js +12 -0
  46. package/dist/cjs/footnotes.d.ts +11 -0
  47. package/dist/cjs/footnotes.d.ts.map +1 -0
  48. package/dist/cjs/footnotes.js +24 -0
  49. package/dist/cjs/grid.d.ts +11 -0
  50. package/dist/cjs/grid.d.ts.map +1 -0
  51. package/dist/cjs/grid.js +117 -0
  52. package/dist/cjs/heading.d.ts +14 -0
  53. package/dist/cjs/heading.d.ts.map +1 -0
  54. package/dist/cjs/heading.js +40 -0
  55. package/dist/cjs/iframe.d.ts +7 -0
  56. package/dist/cjs/iframe.d.ts.map +1 -0
  57. package/dist/cjs/iframe.js +24 -0
  58. package/dist/cjs/image.d.ts +11 -0
  59. package/dist/cjs/image.d.ts.map +1 -0
  60. package/dist/cjs/image.js +52 -0
  61. package/dist/cjs/index.d.ts +9 -0
  62. package/dist/cjs/index.d.ts.map +1 -0
  63. package/dist/cjs/index.js +45 -0
  64. package/dist/cjs/inlineError.d.ts +8 -0
  65. package/dist/cjs/inlineError.d.ts.map +1 -0
  66. package/dist/cjs/inlineError.js +9 -0
  67. package/dist/cjs/links/github.d.ts +12 -0
  68. package/dist/cjs/links/github.d.ts.map +1 -0
  69. package/dist/cjs/links/github.js +63 -0
  70. package/dist/cjs/links/index.d.ts +14 -0
  71. package/dist/cjs/links/index.d.ts.map +1 -0
  72. package/dist/cjs/links/index.js +68 -0
  73. package/dist/cjs/links/rrid.d.ts +5 -0
  74. package/dist/cjs/links/rrid.d.ts.map +1 -0
  75. package/dist/cjs/links/rrid.js +35 -0
  76. package/dist/cjs/links/wiki.d.ts +8 -0
  77. package/dist/cjs/links/wiki.d.ts.map +1 -0
  78. package/dist/cjs/links/wiki.js +39 -0
  79. package/dist/cjs/math.d.ts +13 -0
  80. package/dist/cjs/math.d.ts.map +1 -0
  81. package/dist/cjs/math.js +29 -0
  82. package/dist/cjs/reactive.d.ts +88 -0
  83. package/dist/cjs/reactive.d.ts.map +1 -0
  84. package/dist/cjs/reactive.js +64 -0
  85. package/dist/cjs/tabs.d.ts +12 -0
  86. package/dist/cjs/tabs.d.ts.map +1 -0
  87. package/dist/cjs/tabs.js +38 -0
  88. package/dist/types/admonitions.d.ts +32 -0
  89. package/dist/types/admonitions.d.ts.map +1 -0
  90. package/dist/types/basic.d.ts +62 -0
  91. package/dist/types/basic.d.ts.map +1 -0
  92. package/dist/types/card.d.ts +27 -0
  93. package/dist/types/card.d.ts.map +1 -0
  94. package/dist/types/cite.d.ts +6 -0
  95. package/dist/types/cite.d.ts.map +1 -0
  96. package/dist/types/code.d.ts +21 -0
  97. package/dist/types/code.d.ts.map +1 -0
  98. package/dist/types/components/ClickPopover.d.ts +11 -0
  99. package/dist/types/components/ClickPopover.d.ts.map +1 -0
  100. package/dist/types/components/CopyIcon.d.ts +5 -0
  101. package/dist/types/components/CopyIcon.d.ts.map +1 -0
  102. package/dist/types/components/HoverPopover.d.ts +9 -0
  103. package/dist/types/components/HoverPopover.d.ts.map +1 -0
  104. package/dist/types/components/LinkCard.d.ts +11 -0
  105. package/dist/types/components/LinkCard.d.ts.map +1 -0
  106. package/dist/types/convertToReact.d.ts +6 -0
  107. package/dist/types/convertToReact.d.ts.map +1 -0
  108. package/dist/types/crossReference.d.ts +13 -0
  109. package/dist/types/crossReference.d.ts.map +1 -0
  110. package/dist/types/dropdown.d.ts +16 -0
  111. package/dist/types/dropdown.d.ts.map +1 -0
  112. package/dist/types/extensions/chemicalFormula.d.ts +7 -0
  113. package/dist/types/extensions/chemicalFormula.d.ts.map +1 -0
  114. package/dist/types/extensions/index.d.ts +4 -0
  115. package/dist/types/extensions/index.d.ts.map +1 -0
  116. package/dist/types/extensions/siunits.d.ts +7 -0
  117. package/dist/types/extensions/siunits.d.ts.map +1 -0
  118. package/dist/types/footnotes.d.ts +11 -0
  119. package/dist/types/footnotes.d.ts.map +1 -0
  120. package/dist/types/grid.d.ts +11 -0
  121. package/dist/types/grid.d.ts.map +1 -0
  122. package/dist/types/heading.d.ts +14 -0
  123. package/dist/types/heading.d.ts.map +1 -0
  124. package/dist/types/iframe.d.ts +7 -0
  125. package/dist/types/iframe.d.ts.map +1 -0
  126. package/dist/types/image.d.ts +11 -0
  127. package/dist/types/image.d.ts.map +1 -0
  128. package/dist/types/index.d.ts +9 -0
  129. package/dist/types/index.d.ts.map +1 -0
  130. package/dist/types/inlineError.d.ts +8 -0
  131. package/dist/types/inlineError.d.ts.map +1 -0
  132. package/dist/types/links/github.d.ts +12 -0
  133. package/dist/types/links/github.d.ts.map +1 -0
  134. package/dist/types/links/index.d.ts +14 -0
  135. package/dist/types/links/index.d.ts.map +1 -0
  136. package/dist/types/links/rrid.d.ts +5 -0
  137. package/dist/types/links/rrid.d.ts.map +1 -0
  138. package/dist/types/links/wiki.d.ts +8 -0
  139. package/dist/types/links/wiki.d.ts.map +1 -0
  140. package/dist/types/math.d.ts +13 -0
  141. package/dist/types/math.d.ts.map +1 -0
  142. package/dist/types/reactive.d.ts +88 -0
  143. package/dist/types/reactive.d.ts.map +1 -0
  144. package/dist/types/tabs.d.ts +12 -0
  145. package/dist/types/tabs.d.ts.map +1 -0
  146. package/package.json +18 -21
  147. package/src/admonitions.tsx +0 -183
  148. package/src/basic.tsx +0 -229
  149. package/src/card.tsx +0 -153
  150. package/src/cite.tsx +0 -43
  151. package/src/code.tsx +0 -119
  152. package/src/components/ClickPopover.tsx +0 -56
  153. package/src/components/CopyIcon.tsx +0 -40
  154. package/src/components/HoverPopover.tsx +0 -60
  155. package/src/components/LinkCard.tsx +0 -42
  156. package/src/convertToReact.ts +0 -33
  157. package/src/crossReference.tsx +0 -139
  158. package/src/dropdown.tsx +0 -69
  159. package/src/extensions/chemicalFormula.tsx +0 -42
  160. package/src/extensions/index.tsx +0 -10
  161. package/src/extensions/siunits.tsx +0 -15
  162. package/src/footnotes.tsx +0 -30
  163. package/src/grid.tsx +0 -127
  164. package/src/heading.tsx +0 -68
  165. package/src/iframe.tsx +0 -42
  166. package/src/image.tsx +0 -97
  167. package/src/index.tsx +0 -65
  168. package/src/inlineError.tsx +0 -15
  169. package/src/links/index.tsx +0 -132
  170. package/src/links/rrid.tsx +0 -81
  171. package/src/links/wiki.tsx +0 -119
  172. package/src/math.tsx +0 -81
  173. package/src/mermaid.tsx +0 -49
  174. package/src/myst.tsx +0 -226
  175. package/src/output/components.tsx +0 -34
  176. package/src/output/error.tsx +0 -20
  177. package/src/output/hooks.ts +0 -127
  178. package/src/output/index.tsx +0 -7
  179. package/src/output/jupyter.tsx +0 -86
  180. package/src/output/output.tsx +0 -79
  181. package/src/output/outputBlock.tsx +0 -21
  182. package/src/output/safe.tsx +0 -84
  183. package/src/output/selectors.ts +0 -15
  184. package/src/output/stream.tsx +0 -18
  185. package/src/reactive.tsx +0 -64
  186. package/src/tabs.tsx +0 -63
  187. package/src/types.ts +0 -6
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ value: string;
4
+ message?: string;
5
+ }
6
+ export declare function InlineError({ value, message }: Props): JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=inlineError.d.ts.map
@@ -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,5 @@
1
+ /// <reference types="react" />
2
+ export declare function RRIDLink({ rrid }: {
3
+ rrid: string;
4
+ }): JSX.Element;
5
+ //# sourceMappingURL=rrid.d.ts.map
@@ -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,8 @@
1
+ import React from 'react';
2
+ export declare function WikiLink({ children, page, url, wiki, }: {
3
+ children: React.ReactNode;
4
+ page: string;
5
+ url: string;
6
+ wiki: string;
7
+ }): JSX.Element;
8
+ //# sourceMappingURL=wiki.d.ts.map
@@ -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.18",
4
- "main": "./src/index.tsx",
5
- "types": "./src/index.tsx",
3
+ "version": "0.1.20",
4
+ "main": "dist/cjs/index.js",
5
+ "types": "dist/types/index.d.ts",
6
6
  "files": [
7
- "src"
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
- "@curvenote/blocks": "^1.5.15",
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": "^1.0.6",
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
- "mermaid": "^9.1.7",
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
- "tsconfig": "*",
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": {
@@ -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;