@datalayer/jupyter-lexical 0.0.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.
Files changed (233) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/lib/components/InsertEquationDialog.d.ts +6 -0
  4. package/lib/components/InsertEquationDialog.js +17 -0
  5. package/lib/components/InsertEquationDialog.js.map +1 -0
  6. package/lib/components/InsertImageDialog.d.ts +13 -0
  7. package/lib/components/InsertImageDialog.js +48 -0
  8. package/lib/components/InsertImageDialog.js.map +1 -0
  9. package/lib/components/JupyterCellComponent.d.ts +2 -0
  10. package/lib/components/JupyterCellComponent.js +12 -0
  11. package/lib/components/JupyterCellComponent.js.map +1 -0
  12. package/lib/components/JupyterOutputComponent.d.ts +13 -0
  13. package/lib/components/JupyterOutputComponent.js +8 -0
  14. package/lib/components/JupyterOutputComponent.js.map +1 -0
  15. package/lib/convert/LexicalToNbFormat.d.ts +4 -0
  16. package/lib/convert/LexicalToNbFormat.js +100 -0
  17. package/lib/convert/LexicalToNbFormat.js.map +1 -0
  18. package/lib/convert/NbFormatToLexical.d.ts +4 -0
  19. package/lib/convert/NbFormatToLexical.js +31 -0
  20. package/lib/convert/NbFormatToLexical.js.map +1 -0
  21. package/lib/convert/markdown/MarkdownExport.d.ts +11 -0
  22. package/lib/convert/markdown/MarkdownExport.js +129 -0
  23. package/lib/convert/markdown/MarkdownExport.js.map +1 -0
  24. package/lib/convert/markdown/MarkdownImport.d.ts +2 -0
  25. package/lib/convert/markdown/MarkdownImport.js +246 -0
  26. package/lib/convert/markdown/MarkdownImport.js.map +1 -0
  27. package/lib/convert/markdown/MarkdownShortcuts.d.ts +10 -0
  28. package/lib/convert/markdown/MarkdownShortcuts.js +254 -0
  29. package/lib/convert/markdown/MarkdownShortcuts.js.map +1 -0
  30. package/lib/convert/markdown/MarkdownTransformers.d.ts +39 -0
  31. package/lib/convert/markdown/MarkdownTransformers.js +242 -0
  32. package/lib/convert/markdown/MarkdownTransformers.js.map +1 -0
  33. package/lib/convert/markdown/convertToMarkdown.d.ts +1 -0
  34. package/lib/convert/markdown/convertToMarkdown.js +126 -0
  35. package/lib/convert/markdown/convertToMarkdown.js.map +1 -0
  36. package/lib/convert/markdown/index.d.ts +17 -0
  37. package/lib/convert/markdown/index.js +46 -0
  38. package/lib/convert/markdown/index.js.map +1 -0
  39. package/lib/convert/markdown/utils.d.ts +24 -0
  40. package/lib/convert/markdown/utils.js +303 -0
  41. package/lib/convert/markdown/utils.js.map +1 -0
  42. package/lib/convert/transformers/MarkdownTransformers.d.ts +13 -0
  43. package/lib/convert/transformers/MarkdownTransformers.js +178 -0
  44. package/lib/convert/transformers/MarkdownTransformers.js.map +1 -0
  45. package/lib/examples/App.d.ts +1 -0
  46. package/lib/examples/App.js +22 -0
  47. package/lib/examples/App.js.map +1 -0
  48. package/lib/examples/Editor.d.ts +9 -0
  49. package/lib/examples/Editor.js +81 -0
  50. package/lib/examples/Editor.js.map +1 -0
  51. package/lib/examples/Example.d.ts +1 -0
  52. package/lib/examples/Example.js +11 -0
  53. package/lib/examples/Example.js.map +1 -0
  54. package/lib/examples/content/Example.ipynb.json +98 -0
  55. package/lib/examples/content/Example.lexical.json +259 -0
  56. package/lib/examples/context/LexicalContext.d.ts +13 -0
  57. package/lib/examples/context/LexicalContext.js +22 -0
  58. package/lib/examples/context/LexicalContext.js.map +1 -0
  59. package/lib/examples/plugins/ToolbarPlugin.d.ts +2 -0
  60. package/lib/examples/plugins/ToolbarPlugin.js +448 -0
  61. package/lib/examples/plugins/ToolbarPlugin.js.map +1 -0
  62. package/lib/examples/plugins/TreeViewPlugin.d.ts +2 -0
  63. package/lib/examples/plugins/TreeViewPlugin.js +13 -0
  64. package/lib/examples/plugins/TreeViewPlugin.js.map +1 -0
  65. package/lib/examples/themes/Theme.d.ts +10 -0
  66. package/lib/examples/themes/Theme.js +94 -0
  67. package/lib/examples/themes/Theme.js.map +1 -0
  68. package/lib/hooks/useModal.d.ts +2 -0
  69. package/lib/hooks/useModal.js +39 -0
  70. package/lib/hooks/useModal.js.map +1 -0
  71. package/lib/images/yellow-flower-small.jpg +0 -0
  72. package/lib/index.d.ts +40 -0
  73. package/lib/index.js +55 -0
  74. package/lib/index.js.map +1 -0
  75. package/lib/jupyter/index.d.ts +0 -0
  76. package/lib/jupyter/index.js +6 -0
  77. package/lib/jupyter/index.js.map +1 -0
  78. package/lib/jupyter/lab/Example.d.ts +1 -0
  79. package/lib/jupyter/lab/Example.js +11 -0
  80. package/lib/jupyter/lab/Example.js.map +1 -0
  81. package/lib/jupyter/lab/__tests__/datalayer.spec.d.ts +0 -0
  82. package/lib/jupyter/lab/__tests__/datalayer.spec.js +11 -0
  83. package/lib/jupyter/lab/__tests__/datalayer.spec.js.map +1 -0
  84. package/lib/jupyter/lab/component/MockComponent.d.ts +2 -0
  85. package/lib/jupyter/lab/component/MockComponent.js +17 -0
  86. package/lib/jupyter/lab/component/MockComponent.js.map +1 -0
  87. package/lib/jupyter/lab/component/MockTab1.d.ts +2 -0
  88. package/lib/jupyter/lab/component/MockTab1.js +14 -0
  89. package/lib/jupyter/lab/component/MockTab1.js.map +1 -0
  90. package/lib/jupyter/lab/handler.d.ts +8 -0
  91. package/lib/jupyter/lab/handler.js +41 -0
  92. package/lib/jupyter/lab/handler.js.map +1 -0
  93. package/lib/jupyter/lab/index.d.ts +7 -0
  94. package/lib/jupyter/lab/index.js +73 -0
  95. package/lib/jupyter/lab/index.js.map +1 -0
  96. package/lib/jupyter/lab/widget.d.ts +6 -0
  97. package/lib/jupyter/lab/widget.js +18 -0
  98. package/lib/jupyter/lab/widget.js.map +1 -0
  99. package/lib/nodes/EquationNode.d.ts +31 -0
  100. package/lib/nodes/EquationNode.js +118 -0
  101. package/lib/nodes/EquationNode.js.map +1 -0
  102. package/lib/nodes/ImageNode.css +50 -0
  103. package/lib/nodes/ImageNode.d.ts +58 -0
  104. package/lib/nodes/ImageNode.js +275 -0
  105. package/lib/nodes/ImageNode.js.map +1 -0
  106. package/lib/nodes/JupyterCodeHighlightNode.d.ts +49 -0
  107. package/lib/nodes/JupyterCodeHighlightNode.js +165 -0
  108. package/lib/nodes/JupyterCodeHighlightNode.js.map +1 -0
  109. package/lib/nodes/JupyterCodeHighlighter.d.ts +28 -0
  110. package/lib/nodes/JupyterCodeHighlighter.js +522 -0
  111. package/lib/nodes/JupyterCodeHighlighter.js.map +1 -0
  112. package/lib/nodes/JupyterCodeNode.d.ts +50 -0
  113. package/lib/nodes/JupyterCodeNode.js +277 -0
  114. package/lib/nodes/JupyterCodeNode.js.map +1 -0
  115. package/lib/nodes/JupyterOutputNode.d.ts +58 -0
  116. package/lib/nodes/JupyterOutputNode.js +144 -0
  117. package/lib/nodes/JupyterOutputNode.js.map +1 -0
  118. package/lib/nodes/YouTubeNode.d.ts +28 -0
  119. package/lib/nodes/YouTubeNode.js +56 -0
  120. package/lib/nodes/YouTubeNode.js.map +1 -0
  121. package/lib/plugins/AutoEmbedPlugin.d.ts +17 -0
  122. package/lib/plugins/AutoEmbedPlugin.js +110 -0
  123. package/lib/plugins/AutoEmbedPlugin.js.map +1 -0
  124. package/lib/plugins/AutoLinkPlugin.d.ts +2 -0
  125. package/lib/plugins/AutoLinkPlugin.js +34 -0
  126. package/lib/plugins/AutoLinkPlugin.js.map +1 -0
  127. package/lib/plugins/CodeActionMenuPlugin.css +52 -0
  128. package/lib/plugins/CodeActionMenuPlugin.d.ts +12 -0
  129. package/lib/plugins/CodeActionMenuPlugin.js +108 -0
  130. package/lib/plugins/CodeActionMenuPlugin.js.map +1 -0
  131. package/lib/plugins/ComponentPickerMenuPlugin.d.ts +2 -0
  132. package/lib/plugins/ComponentPickerMenuPlugin.js +244 -0
  133. package/lib/plugins/ComponentPickerMenuPlugin.js.map +1 -0
  134. package/lib/plugins/EquationsPlugin.d.ts +21 -0
  135. package/lib/plugins/EquationsPlugin.js +48 -0
  136. package/lib/plugins/EquationsPlugin.js.map +1 -0
  137. package/lib/plugins/HorizontalRulePlugin.d.ts +2 -0
  138. package/lib/plugins/HorizontalRulePlugin.js +40 -0
  139. package/lib/plugins/HorizontalRulePlugin.js.map +1 -0
  140. package/lib/plugins/ImagesPlugin.d.ts +25 -0
  141. package/lib/plugins/ImagesPlugin.js +212 -0
  142. package/lib/plugins/ImagesPlugin.js.map +1 -0
  143. package/lib/plugins/JupyterPlugin.css +13 -0
  144. package/lib/plugins/JupyterPlugin.d.ts +16 -0
  145. package/lib/plugins/JupyterPlugin.js +169 -0
  146. package/lib/plugins/JupyterPlugin.js.map +1 -0
  147. package/lib/plugins/ListMaxIndentLevelPlugin.d.ts +4 -0
  148. package/lib/plugins/ListMaxIndentLevelPlugin.js +49 -0
  149. package/lib/plugins/ListMaxIndentLevelPlugin.js.map +1 -0
  150. package/lib/plugins/MardownPlugin.d.ts +2 -0
  151. package/lib/plugins/MardownPlugin.js +20 -0
  152. package/lib/plugins/MardownPlugin.js.map +1 -0
  153. package/lib/plugins/NbformatContentPlugin.d.ts +6 -0
  154. package/lib/plugins/NbformatContentPlugin.js +20 -0
  155. package/lib/plugins/NbformatContentPlugin.js.map +1 -0
  156. package/lib/plugins/TableOfContentsPlugin.css +87 -0
  157. package/lib/plugins/TableOfContentsPlugin.d.ts +3 -0
  158. package/lib/plugins/TableOfContentsPlugin.js +115 -0
  159. package/lib/plugins/TableOfContentsPlugin.js.map +1 -0
  160. package/lib/plugins/YouTubePlugin.d.ts +4 -0
  161. package/lib/plugins/YouTubePlugin.js +34 -0
  162. package/lib/plugins/YouTubePlugin.js.map +1 -0
  163. package/lib/ui/Button.css +40 -0
  164. package/lib/ui/Button.d.ts +18 -0
  165. package/lib/ui/Button.js +8 -0
  166. package/lib/ui/Button.js.map +1 -0
  167. package/lib/ui/ContentEditable.css +24 -0
  168. package/lib/ui/ContentEditable.d.ts +5 -0
  169. package/lib/ui/ContentEditable.js +20 -0
  170. package/lib/ui/ContentEditable.js.map +1 -0
  171. package/lib/ui/CopyButton.d.ts +7 -0
  172. package/lib/ui/CopyButton.js +47 -0
  173. package/lib/ui/CopyButton.js.map +1 -0
  174. package/lib/ui/Dialog.css +23 -0
  175. package/lib/ui/Dialog.d.ts +16 -0
  176. package/lib/ui/Dialog.js +21 -0
  177. package/lib/ui/Dialog.js.map +1 -0
  178. package/lib/ui/DropDown.d.ts +23 -0
  179. package/lib/ui/DropDown.js +119 -0
  180. package/lib/ui/DropDown.js.map +1 -0
  181. package/lib/ui/EquationEditor.css +42 -0
  182. package/lib/ui/EquationEditor.d.ts +18 -0
  183. package/lib/ui/EquationEditor.js +31 -0
  184. package/lib/ui/EquationEditor.js.map +1 -0
  185. package/lib/ui/FileInput.d.ts +15 -0
  186. package/lib/ui/FileInput.js +18 -0
  187. package/lib/ui/FileInput.js.map +1 -0
  188. package/lib/ui/ImageResizer.d.ts +16 -0
  189. package/lib/ui/ImageResizer.js +166 -0
  190. package/lib/ui/ImageResizer.js.map +1 -0
  191. package/lib/ui/Input.css +37 -0
  192. package/lib/ui/KatexEquationAlterer.css +45 -0
  193. package/lib/ui/KatexEquationAlterer.d.ts +7 -0
  194. package/lib/ui/KatexEquationAlterer.js +33 -0
  195. package/lib/ui/KatexEquationAlterer.js.map +1 -0
  196. package/lib/ui/KatexRenderer.d.ts +6 -0
  197. package/lib/ui/KatexRenderer.js +36 -0
  198. package/lib/ui/KatexRenderer.js.map +1 -0
  199. package/lib/ui/Modal.css +67 -0
  200. package/lib/ui/Modal.d.ts +15 -0
  201. package/lib/ui/Modal.js +58 -0
  202. package/lib/ui/Modal.js.map +1 -0
  203. package/lib/ui/Placeholder.css +29 -0
  204. package/lib/ui/Placeholder.d.ts +14 -0
  205. package/lib/ui/Placeholder.js +7 -0
  206. package/lib/ui/Placeholder.js.map +1 -0
  207. package/lib/ui/PrettierButton.css +20 -0
  208. package/lib/ui/PrettierButton.tsx_tmp +133 -0
  209. package/lib/ui/TextInput.d.ts +16 -0
  210. package/lib/ui/TextInput.js +20 -0
  211. package/lib/ui/TextInput.js.map +1 -0
  212. package/lib/utils/canUseDOM.d.ts +8 -0
  213. package/lib/utils/canUseDOM.js +16 -0
  214. package/lib/utils/canUseDOM.js.map +1 -0
  215. package/lib/utils/debouncer.d.ts +1 -0
  216. package/lib/utils/debouncer.js +24 -0
  217. package/lib/utils/debouncer.js.map +1 -0
  218. package/lib/utils/invariant.d.ts +8 -0
  219. package/lib/utils/invariant.js +23 -0
  220. package/lib/utils/invariant.js.map +1 -0
  221. package/lib/utils/join.d.ts +8 -0
  222. package/lib/utils/join.js +16 -0
  223. package/lib/utils/join.js.map +1 -0
  224. package/lib/utils/selection.d.ts +8 -0
  225. package/lib/utils/selection.js +14 -0
  226. package/lib/utils/selection.js.map +1 -0
  227. package/lib/utils/useLayoutEffect.d.ts +10 -0
  228. package/lib/utils/useLayoutEffect.js +19 -0
  229. package/lib/utils/useLayoutEffect.js.map +1 -0
  230. package/package.json +166 -0
  231. package/style/base.css +16 -0
  232. package/style/index.css +7 -0
  233. package/style/index.js +7 -0
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2021-2023 Datalayer, Inc.
4
+ *
5
+ * MIT License
6
+ */
7
+ /**
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ import { useCallback, useMemo, useState } from 'react';
14
+ import Modal from '../ui/Modal';
15
+ export const useModal = () => {
16
+ const [modalContent, setModalContent] = useState(null);
17
+ const onClose = useCallback(() => {
18
+ setModalContent(null);
19
+ }, []);
20
+ const modal = useMemo(() => {
21
+ if (modalContent === null) {
22
+ return null;
23
+ }
24
+ const { title, content, closeOnClickOutside } = modalContent;
25
+ return (_jsx(Modal, { onClose: onClose, title: title, closeOnClickOutside: closeOnClickOutside, children: content }));
26
+ }, [modalContent, onClose]);
27
+ const showModal = useCallback((title,
28
+ // eslint-disable-next-line no-shadow
29
+ getContent, closeOnClickOutside = false) => {
30
+ setModalContent({
31
+ closeOnClickOutside,
32
+ content: getContent(onClose),
33
+ title,
34
+ });
35
+ }, [onClose]);
36
+ return [modal, showModal];
37
+ };
38
+ export default useModal;
39
+ //# sourceMappingURL=useModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useModal.js","sourceRoot":"","sources":["../../src/hooks/useModal.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH,OAAO,EAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAGtB,EAAE;IACF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAI7C,IAAI,CAAC,CAAC;IACT,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/B,eAAe,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,IAAI,YAAY,KAAK,IAAI,EAAE;YACzB,OAAO,IAAI,CAAC;SACb;QACD,MAAM,EAAC,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAC,GAAG,YAAY,CAAC;QAC3D,OAAO,CACL,KAAC,KAAK,IACJ,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,mBAAmB,EAAE,mBAAmB,YACvC,OAAO,GACF,CACT,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,WAAW,CAC3B,CACE,KAAa;IACb,qCAAqC;IACrC,UAAgD,EAChD,mBAAmB,GAAG,KAAK,EAC3B,EAAE;QACF,eAAe,CAAC;YACd,mBAAmB;YACnB,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;YAC5B,KAAK;SACN,CAAC,CAAC;IACL,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IACF,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5B,CAAC,CAAA;AAED,eAAe,QAAQ,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ export * from "./components/JupyterOutputComponent";
2
+ export * from "./convert/LexicalToNbFormat";
3
+ export * from "./convert/NbFormatToLexical";
4
+ export * from "./hooks/useModal";
5
+ export * from "./nodes/JupyterCodeHighlighter";
6
+ export * from "./nodes/JupyterCodeHighlightNode";
7
+ export * from "./nodes/JupyterCodeNode";
8
+ export * from "./nodes/EquationNode";
9
+ export * from "./nodes/ImageNode";
10
+ export * from "./nodes/JupyterOutputNode";
11
+ export * from "./nodes/YouTubeNode";
12
+ export * from "./plugins/AutoEmbedPlugin";
13
+ export * from "./plugins/AutoLinkPlugin";
14
+ export * from "./plugins/CodeActionMenuPlugin";
15
+ export * from "./plugins/ComponentPickerMenuPlugin";
16
+ export * from "./plugins/EquationsPlugin";
17
+ export * from "./plugins/HorizontalRulePlugin";
18
+ export * from "./plugins/ImagesPlugin";
19
+ export * from "./plugins/JupyterPlugin";
20
+ export * from "./plugins/ListMaxIndentLevelPlugin";
21
+ export * from "./plugins/MardownPlugin";
22
+ export * from "./plugins/NbformatContentPlugin";
23
+ export * from "./plugins/TableOfContentsPlugin";
24
+ export * from "./plugins/YouTubePlugin";
25
+ export * from "./ui/Button";
26
+ export * from "./ui/ContentEditable";
27
+ export * from "./ui/DropDown";
28
+ export * from "./ui/EquationEditor";
29
+ export * from "./ui/FileInput";
30
+ export * from "./ui/ImageResizer";
31
+ export * from "./ui/KatexEquationAlterer";
32
+ export * from "./ui/KatexEquationAlterer";
33
+ export * from "./ui/KatexRenderer";
34
+ export * from "./ui/Modal";
35
+ export * from "./ui/Placeholder";
36
+ export * from "./ui/TextInput";
37
+ export * from "./utils/selection";
38
+ export * from "./utils/join";
39
+ export * from "./utils/canUseDOM";
40
+ export * from "./utils/useLayoutEffect";
package/lib/index.js ADDED
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ // Components.
7
+ // export * from "./components/InsertEquationDialog";
8
+ // export * from "./components/InsertImageDialog";
9
+ export * from "./components/JupyterOutputComponent";
10
+ // Convert.
11
+ export * from "./convert/LexicalToNbFormat";
12
+ export * from "./convert/NbFormatToLexical";
13
+ // Hooks.
14
+ export * from "./hooks/useModal";
15
+ // Nodes.
16
+ export * from "./nodes/JupyterCodeHighlighter";
17
+ export * from "./nodes/JupyterCodeHighlightNode";
18
+ export * from "./nodes/JupyterCodeNode";
19
+ export * from "./nodes/EquationNode";
20
+ export * from "./nodes/ImageNode";
21
+ export * from "./nodes/JupyterOutputNode";
22
+ export * from "./nodes/YouTubeNode";
23
+ // Plugins.
24
+ export * from "./plugins/AutoEmbedPlugin";
25
+ export * from "./plugins/AutoLinkPlugin";
26
+ export * from "./plugins/CodeActionMenuPlugin";
27
+ export * from "./plugins/ComponentPickerMenuPlugin";
28
+ export * from "./plugins/EquationsPlugin";
29
+ export * from "./plugins/HorizontalRulePlugin";
30
+ export * from "./plugins/ImagesPlugin";
31
+ export * from "./plugins/JupyterPlugin";
32
+ export * from "./plugins/ListMaxIndentLevelPlugin";
33
+ export * from "./plugins/MardownPlugin";
34
+ export * from "./plugins/NbformatContentPlugin";
35
+ export * from "./plugins/TableOfContentsPlugin";
36
+ export * from "./plugins/YouTubePlugin";
37
+ // UI.
38
+ export * from "./ui/Button";
39
+ export * from "./ui/ContentEditable";
40
+ export * from "./ui/DropDown";
41
+ export * from "./ui/EquationEditor";
42
+ export * from "./ui/FileInput";
43
+ export * from "./ui/ImageResizer";
44
+ export * from "./ui/KatexEquationAlterer";
45
+ export * from "./ui/KatexEquationAlterer";
46
+ export * from "./ui/KatexRenderer";
47
+ export * from "./ui/Modal";
48
+ export * from "./ui/Placeholder";
49
+ export * from "./ui/TextInput";
50
+ // Utils.
51
+ export * from "./utils/selection";
52
+ export * from "./utils/join";
53
+ export * from "./utils/canUseDOM";
54
+ export * from "./utils/useLayoutEffect";
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc;AACd,qDAAqD;AACrD,kDAAkD;AAClD,cAAc,qCAAqC,CAAC;AACpD,WAAW;AACX,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,SAAS;AACT,cAAc,kBAAkB,CAAC;AACjC,SAAS;AACT,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,WAAW;AACX,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,MAAM;AACN,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,SAAS;AACT,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
File without changes
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/jupyter/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2021-2023 Datalayer, Inc.
4
+ *
5
+ * MIT License
6
+ */
7
+ import { createRoot } from 'react-dom/client';
8
+ import MockComponent from './component/MockComponent';
9
+ const root = createRoot(document.getElementById('root'));
10
+ root.render(_jsx(MockComponent, {}));
11
+ //# sourceMappingURL=Example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Example.js","sourceRoot":"","sources":["../../../src/jupyter/lab/Example.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAEtD,MAAM,IAAI,GAAG,UAAU,CACrB,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAgB,CAC/C,CAAC;AAEF,IAAI,CAAC,MAAM,CAAC,KAAC,aAAa,KAAG,CAAC,CAAC"}
File without changes
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ describe('@datalayer/jupyter-lexical', () => {
7
+ it('should be tested', () => {
8
+ expect(1 + 1).toEqual(2);
9
+ });
10
+ });
11
+ //# sourceMappingURL=datalayer.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datalayer.spec.js","sourceRoot":"","sources":["../../../../src/jupyter/lab/__tests__/datalayer.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC1B,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const MockComponent: () => JSX.Element;
2
+ export default MockComponent;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2021-2023 Datalayer, Inc.
4
+ *
5
+ * MIT License
6
+ */
7
+ import { useState } from 'react';
8
+ import { ThemeProvider, BaseStyles, Box } from '@primer/react';
9
+ import { CpuIcon } from '@primer/octicons-react';
10
+ import { UnderlineNav } from '@primer/react/drafts';
11
+ import MockTab1 from './MockTab1';
12
+ const MockComponent = () => {
13
+ const [tab, setTab] = useState(1);
14
+ return (_jsx(_Fragment, { children: _jsx(ThemeProvider, { children: _jsx(BaseStyles, { children: _jsxs(Box, { style: { maxWidth: 700 }, children: [_jsx(Box, { mb: 3, children: _jsx(UnderlineNav, { children: _jsx(UnderlineNav.Item, { "aria-current": "page", icon: CpuIcon, onSelect: e => { e.preventDefault(); setTab(1); }, children: "Kernels" }) }) }), _jsx(Box, { children: (tab === 1) && _jsx(MockTab1, {}) })] }) }) }) }));
15
+ };
16
+ export default MockComponent;
17
+ //# sourceMappingURL=MockComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MockComponent.js","sourceRoot":"","sources":["../../../../src/jupyter/lab/component/MockComponent.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,aAAa,GAAG,GAAgB,EAAE;IACtC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClC,OAAO,CACL,4BACE,KAAC,aAAa,cACZ,KAAC,UAAU,cACT,MAAC,GAAG,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,GAAG,EAAC,aACzB,KAAC,GAAG,IAAC,EAAE,EAAE,CAAC,YACR,KAAC,YAAY,cACX,KAAC,YAAY,CAAC,IAAI,oBAAc,MAAM,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAE,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,wBAEjF,GACP,GACX,EACN,KAAC,GAAG,cACD,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,KAAC,QAAQ,KAAE,GACvB,IACF,GACK,GACC,GACf,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const MockTab1: () => JSX.Element;
2
+ export default MockTab1;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2021-2023 Datalayer, Inc.
4
+ *
5
+ * MIT License
6
+ */
7
+ import { ActionList, Avatar, ActionMenu, ProgressBar, Box, } from '@primer/react';
8
+ import { LinkIcon, AlertIcon } from '@primer/octicons-react';
9
+ import { DaskIcon, PyTorchIcon, TensorFlowIcon } from "@datalayer/icons-react";
10
+ const MockTab1 = () => {
11
+ return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { children: "Kernels" }), _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { onSelect: event => console.log('New file'), children: "New kernel" }), _jsx(ActionList.Item, { children: "Copy kernel" }), _jsx(ActionList.Item, { children: "Edit kernel" }), _jsx(ActionList.Divider, {}), _jsx(ActionList.Item, { variant: "danger", children: "Delete kernel" })] }) })] }), _jsxs(ActionList, { children: [_jsxs(ActionList.Item, { children: [_jsx(ActionList.LeadingVisual, { children: _jsx(DaskIcon, {}) }), "Dask kernel"] }), _jsxs(ActionList.Item, { children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PyTorchIcon, {}) }), "PyTorch Kernel"] }), _jsxs(ActionList.Item, { children: [_jsx(ActionList.LeadingVisual, { children: _jsx(TensorFlowIcon, {}) }), "Tensorflow Kernel"] }), _jsx(Box, { borderColor: "border.default", borderBottomWidth: 1, borderBottomStyle: "solid", pb: 3 }), _jsxs(ActionList.Item, { children: [_jsx(ActionList.LeadingVisual, { children: _jsx(LinkIcon, {}) }), "Starting..."] }), _jsx(ProgressBar, { progress: 80 }), _jsx(Box, { borderColor: "border.default", borderBottomWidth: 1, borderBottomStyle: "solid", pb: 3 }), _jsxs(ActionList.Item, { children: [_jsx(ActionList.LeadingVisual, { children: _jsx(Avatar, { src: "https://github.com/mona.png" }) }), "Me"] }), _jsxs(ActionList.Item, { variant: "danger", children: [_jsx(ActionList.LeadingVisual, { children: _jsx(AlertIcon, {}) }), "4 vulnerabilities"] })] })] }));
12
+ };
13
+ export default MockTab1;
14
+ //# sourceMappingURL=MockTab1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MockTab1.js","sourceRoot":"","sources":["../../../../src/jupyter/lab/component/MockTab1.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EACL,UAAU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,QAAQ,EAAE,EAAE,GAAI,EAC7B,KAAC,GAAG,IAAC,WAAW,EAAC,gBAAgB,EAAC,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAC,OAAO,EAAC,EAAE,EAAE,CAAC,GAAG,EAC1F,MAAC,UAAU,CAAC,IAAI,eACd,KAAC,UAAU,CAAC,aAAa,cACvB,KAAC,MAAM,IAAC,GAAG,EAAC,6BAA6B,GAAG,GACnB,UAEX,EAClB,MAAC,UAAU,CAAC,IAAI,IAAC,OAAO,EAAC,QAAQ,aAC/B,KAAC,UAAU,CAAC,aAAa,cACvB,KAAC,SAAS,KAAG,GACY,yBAEX,IACP,IACZ,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Call the API extension
3
+ *
4
+ * @param endPoint API REST end point for the extension
5
+ * @param init Initial values for the request
6
+ * @returns The response body interpreted as JSON
7
+ */
8
+ export declare function requestAPI<T>(endPoint?: string, init?: RequestInit): Promise<T>;
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { URLExt } from '@jupyterlab/coreutils';
7
+ import { ServerConnection } from '@jupyterlab/services';
8
+ /**
9
+ * Call the API extension
10
+ *
11
+ * @param endPoint API REST end point for the extension
12
+ * @param init Initial values for the request
13
+ * @returns The response body interpreted as JSON
14
+ */
15
+ export async function requestAPI(endPoint = '', init = {}) {
16
+ // Make request to Jupyter API
17
+ const settings = ServerConnection.makeSettings();
18
+ const requestUrl = URLExt.join(settings.baseUrl, 'jupyter_lexical', // API Namespace
19
+ endPoint);
20
+ let response;
21
+ try {
22
+ response = await ServerConnection.makeRequest(requestUrl, init, settings);
23
+ }
24
+ catch (error) {
25
+ throw new ServerConnection.NetworkError(error);
26
+ }
27
+ let data = await response.text();
28
+ if (data.length > 0) {
29
+ try {
30
+ data = JSON.parse(data);
31
+ }
32
+ catch (error) {
33
+ console.log('Not a JSON response body.', response);
34
+ }
35
+ }
36
+ if (!response.ok) {
37
+ throw new ServerConnection.ResponseError(response, data.message || data);
38
+ }
39
+ return data;
40
+ }
41
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/jupyter/lab/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAQ,GAAG,EAAE,EACb,OAAoB,EAAE;IAEtB,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,YAAY,EAAE,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAC5B,QAAQ,CAAC,OAAO,EAChB,iBAAiB,EAAE,gBAAgB;IACnC,QAAQ,CACT,CAAC;IACF,IAAI,QAAkB,CAAC;IACvB,IAAI;QACF,QAAQ,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC3E;IAAC,OAAO,KAAU,EAAE;QACnB,MAAM,IAAI,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;KAChD;IACD,IAAI,IAAI,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACtC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACnB,IAAI;YACF,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACzB;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAC;SACpD;KACF;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;QAChB,MAAM,IAAI,gBAAgB,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;KAC1E;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+ import '../../../style/index.css';
3
+ /**
4
+ * Initialization data for the @datalayer/jupyter-lexical extension.
5
+ */
6
+ declare const plugin: JupyterFrontEndPlugin<void>;
7
+ export default plugin;
@@ -0,0 +1,73 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { ISettingRegistry } from '@jupyterlab/settingregistry';
7
+ import { MainAreaWidget, ICommandPalette } from '@jupyterlab/apputils';
8
+ import { ILauncher } from '@jupyterlab/launcher';
9
+ import { reactIcon } from '@jupyterlab/ui-components';
10
+ import { requestAPI } from './handler';
11
+ import { DatalayerWidget } from './widget';
12
+ import '../../../style/index.css';
13
+ /**
14
+ * The command IDs used by the plugin.
15
+ */
16
+ var CommandIDs;
17
+ (function (CommandIDs) {
18
+ CommandIDs.create = 'create-jupyter-lexical-widget';
19
+ })(CommandIDs || (CommandIDs = {}));
20
+ /**
21
+ * Initialization data for the @datalayer/jupyter-lexical extension.
22
+ */
23
+ const plugin = {
24
+ id: '@datalayer/jupyter-lexical:plugin',
25
+ autoStart: true,
26
+ requires: [ICommandPalette],
27
+ optional: [ISettingRegistry, ILauncher],
28
+ activate: (app, palette, settingRegistry, launcher) => {
29
+ const { commands } = app;
30
+ const command = CommandIDs.create;
31
+ commands.addCommand(command, {
32
+ caption: 'Show Jupyter Lexical',
33
+ label: 'Jupyter Lexical',
34
+ icon: (args) => reactIcon,
35
+ execute: () => {
36
+ const content = new DatalayerWidget();
37
+ const widget = new MainAreaWidget({ content });
38
+ widget.title.label = 'Jupyter Lexical';
39
+ widget.title.icon = reactIcon;
40
+ app.shell.add(widget, 'main');
41
+ }
42
+ });
43
+ const category = 'Jupyter Lexical';
44
+ palette.addItem({ command, category, args: { origin: 'from palette' } });
45
+ if (launcher) {
46
+ launcher.add({
47
+ command,
48
+ category: 'Datalayer',
49
+ rank: 4,
50
+ });
51
+ }
52
+ console.log('JupyterLab plugin @datalayer/jupyter-lexical:plugin is activated.');
53
+ if (settingRegistry) {
54
+ settingRegistry
55
+ .load(plugin.id)
56
+ .then(settings => {
57
+ console.log('@datalayer/jupyter-lexical settings loaded:', settings.composite);
58
+ })
59
+ .catch(reason => {
60
+ console.error('Failed to load settings for @datalayer/jupyter-lexical.', reason);
61
+ });
62
+ }
63
+ requestAPI('get_example')
64
+ .then(data => {
65
+ console.log(data);
66
+ })
67
+ .catch(reason => {
68
+ console.error(`Error while accessing the jupyter server extension.\n${reason}`);
69
+ });
70
+ }
71
+ };
72
+ export default plugin;
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jupyter/lab/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,0BAA0B,CAAC;AAElC;;GAEG;AACH,IAAU,UAAU,CAEnB;AAFD,WAAU,UAAU;IACL,iBAAM,GAAG,+BAA+B,CAAC;AACxD,CAAC,EAFS,UAAU,KAAV,UAAU,QAEnB;AAED;;GAEG;AACH,MAAM,MAAM,GAAgC;IAC1C,EAAE,EAAE,mCAAmC;IACvC,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,CAAC,eA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E;gBACf,OAAO,CAAC,GAAG,CAAC,6CAA6C,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;YACjF,CAAC,CAAC;iBACD,KAAK,CAAC,MAAM,CAAC,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE,MAAM,CAAC,CAAC;YACnF,CAAC,CAAC,CAAC;SACN;QACD,UAAU,CAAM,aAAa,CAAC;aAC3B,IAAI,CAAC,IAAI,CAAC,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC,CAAC;aACD,KAAK,CAAC,MAAM,CAAC,EAAE;YACd,OAAO,CAAC,KAAK,CACX,wDAAwD,MAAM,EAAE,CACjE,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { ReactWidget } from '@jupyterlab/apputils';
3
+ export declare class DatalayerWidget extends ReactWidget {
4
+ constructor();
5
+ render(): JSX.Element;
6
+ }
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2021-2023 Datalayer, Inc.
4
+ *
5
+ * MIT License
6
+ */
7
+ import { ReactWidget } from '@jupyterlab/apputils';
8
+ import MockComponent from './component/MockComponent';
9
+ export class DatalayerWidget extends ReactWidget {
10
+ constructor() {
11
+ super();
12
+ this.addClass('dla-Container');
13
+ }
14
+ render() {
15
+ return _jsx(MockComponent, {});
16
+ }
17
+ }
18
+ //# sourceMappingURL=widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../src/jupyter/lab/widget.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAEtD,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACjC,CAAC;IAED,MAAM;QACJ,OAAO,KAAC,aAAa,KAAE,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
9
+ import { DecoratorNode } from 'lexical';
10
+ export type SerializedEquationNode = Spread<{
11
+ type: 'equation';
12
+ equation: string;
13
+ inline: boolean;
14
+ }, SerializedLexicalNode>;
15
+ export declare class EquationNode extends DecoratorNode<JSX.Element> {
16
+ __equation: string;
17
+ __inline: boolean;
18
+ static getType(): string;
19
+ static clone(node: EquationNode): EquationNode;
20
+ constructor(equation: string, inline?: boolean, key?: NodeKey);
21
+ static importJSON(serializedNode: SerializedEquationNode): EquationNode;
22
+ exportJSON(): SerializedEquationNode;
23
+ createDOM(_config: EditorConfig): HTMLElement;
24
+ updateDOM(prevNode: EquationNode): boolean;
25
+ getEquation(): string;
26
+ setEquation(equation: string): void;
27
+ decorate(): JSX.Element;
28
+ }
29
+ export declare function $createEquationNode(equation?: string, inline?: boolean): EquationNode;
30
+ export declare function $isEquationNode(node: LexicalNode | null | undefined): node is EquationNode;
31
+ export default EquationNode;
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
+ import { mergeRegister } from '@lexical/utils';
4
+ import { $getNodeByKey, $getSelection, $isNodeSelection, COMMAND_PRIORITY_HIGH, DecoratorNode, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND, } from 'lexical';
5
+ import { useCallback, useEffect, useRef, useState } from 'react';
6
+ import EquationEditor from '../ui/EquationEditor';
7
+ import KatexRenderer from '../ui/KatexRenderer';
8
+ function EquationComponent({ equation, inline, nodeKey, }) {
9
+ const [editor] = useLexicalComposerContext();
10
+ const [equationValue, setEquationValue] = useState(equation);
11
+ const [showEquationEditor, setShowEquationEditor] = useState(false);
12
+ const inputRef = useRef(null);
13
+ const onHide = useCallback((restoreSelection) => {
14
+ setShowEquationEditor(false);
15
+ editor.update(() => {
16
+ const node = $getNodeByKey(nodeKey);
17
+ if ($isEquationNode(node)) {
18
+ node.setEquation(equationValue);
19
+ if (restoreSelection) {
20
+ node.selectNext(0, 0);
21
+ }
22
+ }
23
+ });
24
+ }, [editor, equationValue, nodeKey]);
25
+ useEffect(() => {
26
+ if (!showEquationEditor && equationValue !== equation) {
27
+ setEquationValue(equation);
28
+ }
29
+ }, [showEquationEditor, equation, equationValue]);
30
+ useEffect(() => {
31
+ if (showEquationEditor) {
32
+ return mergeRegister(editor.registerCommand(SELECTION_CHANGE_COMMAND, (payload) => {
33
+ const activeElement = document.activeElement;
34
+ const inputElem = inputRef.current;
35
+ if (inputElem !== activeElement) {
36
+ onHide();
37
+ }
38
+ return false;
39
+ }, COMMAND_PRIORITY_HIGH), editor.registerCommand(KEY_ESCAPE_COMMAND, (payload) => {
40
+ const activeElement = document.activeElement;
41
+ const inputElem = inputRef.current;
42
+ if (inputElem === activeElement) {
43
+ onHide(true);
44
+ return true;
45
+ }
46
+ return false;
47
+ }, COMMAND_PRIORITY_HIGH));
48
+ }
49
+ else {
50
+ return editor.registerUpdateListener(({ editorState }) => {
51
+ const isSelected = editorState.read(() => {
52
+ const selection = $getSelection();
53
+ return ($isNodeSelection(selection) &&
54
+ selection.has(nodeKey) &&
55
+ selection.getNodes().length === 1);
56
+ });
57
+ if (isSelected) {
58
+ setShowEquationEditor(true);
59
+ }
60
+ });
61
+ }
62
+ }, [editor, nodeKey, onHide, showEquationEditor]);
63
+ return (_jsx(_Fragment, { children: showEquationEditor ? (_jsx(EquationEditor, { equation: equationValue, setEquation: setEquationValue, inline: inline, inputRef: inputRef })) : (_jsx(KatexRenderer, { equation: equationValue, inline: inline, onClick: () => {
64
+ setShowEquationEditor(true);
65
+ } })) }));
66
+ }
67
+ export class EquationNode extends DecoratorNode {
68
+ __equation;
69
+ __inline;
70
+ static getType() {
71
+ return 'equation';
72
+ }
73
+ static clone(node) {
74
+ return new EquationNode(node.__equation, node.__inline, node.__key);
75
+ }
76
+ constructor(equation, inline, key) {
77
+ super(key);
78
+ this.__equation = equation;
79
+ this.__inline = inline ?? false;
80
+ }
81
+ static importJSON(serializedNode) {
82
+ const node = $createEquationNode(serializedNode.equation, serializedNode.inline);
83
+ return node;
84
+ }
85
+ exportJSON() {
86
+ return {
87
+ equation: this.getEquation(),
88
+ inline: this.__inline,
89
+ type: 'equation',
90
+ version: 1,
91
+ };
92
+ }
93
+ createDOM(_config) {
94
+ return document.createElement(this.__inline ? 'span' : 'div');
95
+ }
96
+ updateDOM(prevNode) {
97
+ // If the inline property changes, replace the element
98
+ return this.__inline !== prevNode.__inline;
99
+ }
100
+ getEquation() {
101
+ return this.__equation;
102
+ }
103
+ setEquation(equation) {
104
+ const writable = this.getWritable();
105
+ writable.__equation = equation;
106
+ }
107
+ decorate() {
108
+ return (_jsx(EquationComponent, { equation: this.__equation, inline: this.__inline, nodeKey: this.__key }));
109
+ }
110
+ }
111
+ export function $createEquationNode(equation = '', inline = false) {
112
+ return new EquationNode(equation, inline);
113
+ }
114
+ export function $isEquationNode(node) {
115
+ return node instanceof EquationNode;
116
+ }
117
+ export default EquationNode;
118
+ //# sourceMappingURL=EquationNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EquationNode.js","sourceRoot":"","sources":["../../src/nodes/EquationNode.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAC,yBAAyB,EAAC,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,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AC,QAAQ;YACrB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,CAAC;SACX,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,OAAqB;QAC7B,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,SAAS,CAAC,QAAsB;QAC9B,sDAAsD;QACtD,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC;IAC7C,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,WAAW,CAAC,QAAgB;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED,QAAQ;QACN,OAAO,CACL,KAAC,iBAAiB,IAChB,QAAQ,EAAE,IAAI,CAAC,UAAU,EACzB,MAAM,EAAE,IAAI,CAAC,QAAQ,EACrB,OAAO,EAAE,IAAI,CAAC,KAAK,GACnB,CACH,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CACjC,QAAQ,GAAG,EAAE,EACb,MAAM,GAAG,KAAK;IAEd,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,IAAoC;IAEpC,OAAO,IAAI,YAAY,YAAY,CAAC;AACtC,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+
7
+ /**
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ *
14
+ */
15
+
16
+ .ImageNode__contentEditable {
17
+ min-height: 20px;
18
+ border: 0px;
19
+ resize: none;
20
+ cursor: text;
21
+ caret-color: rgb(5, 5, 5);
22
+ display: block;
23
+ position: relative;
24
+ tab-size: 1;
25
+ outline: 0px;
26
+ padding: 10px;
27
+ user-select: text;
28
+ font-size: 12px;
29
+ width: calc(100% - 20px);
30
+ white-space: pre-wrap;
31
+ word-break: break-word;
32
+ }
33
+
34
+ .ImageNode__placeholder {
35
+ font-size: 12px;
36
+ color: #888;
37
+ overflow: hidden;
38
+ position: absolute;
39
+ text-overflow: ellipsis;
40
+ top: 10px;
41
+ left: 10px;
42
+ user-select: none;
43
+ white-space: nowrap;
44
+ display: inline-block;
45
+ pointer-events: none;
46
+ }
47
+
48
+ .image-control-wrapper--resizing {
49
+ touch-action: none;
50
+ }