@datalayer/jupyter-react 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. package/LICENSE +1 -1
  2. package/lib/app/App.js +1 -1
  3. package/lib/app/JupyterReact.js +1 -1
  4. package/lib/app/tabs/AboutTab.js +2 -2
  5. package/lib/app/tabs/AboutTab.js.map +1 -1
  6. package/lib/app/tabs/ComponentsTab.js +2 -2
  7. package/lib/app/tabs/ComponentsTab.js.map +1 -1
  8. package/lib/app/tabs/components/CellComponent.js +4 -4
  9. package/lib/app/tabs/components/CellComponent.js.map +1 -1
  10. package/lib/app/tabs/components/FileBrowserComponent.js +1 -1
  11. package/lib/app/tabs/components/IPyWidgetsComponent.js +1 -1
  12. package/lib/app/tabs/components/NotebookComponent.js +3 -3
  13. package/lib/app/tabs/components/NotebookComponent.js.map +1 -1
  14. package/lib/app/tabs/components/ViewerComponent.js +3 -3
  15. package/lib/app/tabs/components/ViewerComponent.js.map +1 -1
  16. package/lib/components/button/Button.js +1 -1
  17. package/lib/components/cell/Cell.d.ts +6 -0
  18. package/lib/components/cell/Cell.js +5 -9
  19. package/lib/components/cell/Cell.js.map +1 -1
  20. package/lib/components/cell/CellAdapter.js +3 -3
  21. package/lib/components/cell/CellAdapter.js.map +1 -1
  22. package/lib/components/cell/CellCommands.js +2 -2
  23. package/lib/components/cell/CellRedux.js +1 -1
  24. package/lib/components/cell/CellZustand.js +1 -1
  25. package/lib/components/codemirror/CodeMirrorEditor.js +2 -3
  26. package/lib/components/codemirror/CodeMirrorEditor.js.map +1 -1
  27. package/lib/components/codemirror/CodeMirrorOutputToolbar.js +2 -2
  28. package/lib/components/codemirror/CodeMirrorOutputToolbar.js.map +1 -1
  29. package/lib/components/codemirror/CodeMirrorTheme.js +1 -1
  30. package/lib/components/commands/Commands.js +2 -2
  31. package/lib/components/commands/Commands.js.map +1 -1
  32. package/lib/components/commands/CommandsAdapter.css +1 -1
  33. package/lib/components/commands/CommandsAdapter.js +1 -1
  34. package/lib/components/commands/CommandsState.js +1 -1
  35. package/lib/components/console/Console.css +1 -1
  36. package/lib/components/console/Console.d.ts +12 -1
  37. package/lib/components/console/Console.js +12 -8
  38. package/lib/components/console/Console.js.map +1 -1
  39. package/lib/components/console/ConsoleAdapter.d.ts +23 -2
  40. package/lib/components/console/ConsoleAdapter.js +28 -14
  41. package/lib/components/console/ConsoleAdapter.js.map +1 -1
  42. package/lib/components/console/ConsoleRedux.js +1 -1
  43. package/lib/components/console/ConsoleZustand.js +1 -1
  44. package/lib/components/dialog/Dialog.js +2 -2
  45. package/lib/components/dialog/Dialog.js.map +1 -1
  46. package/lib/components/dialog/DialogAdapter.js +1 -1
  47. package/lib/components/filebrowser/FileBrowser.js +1 -1
  48. package/lib/components/filemanager/FileManagerJupyterLab.js +2 -2
  49. package/lib/components/filemanager/FileManagerJupyterLab.js.map +1 -1
  50. package/lib/components/filemanager/FileManagerState.js +1 -1
  51. package/lib/components/filemanager/lab/FileManagerAdapter.css +1 -1
  52. package/lib/components/filemanager/lab/FileManagerAdapter.js +1 -1
  53. package/lib/components/jupyterlab/JupyterLabApp.d.ts +2 -2
  54. package/lib/components/jupyterlab/JupyterLabApp.js +1 -1
  55. package/lib/components/jupyterlab/JupyterLabAppAdapter.js +1 -1
  56. package/lib/components/jupyterlab/JupyterLabAppCss.d.ts +2 -2
  57. package/lib/components/jupyterlab/JupyterLabAppCss.js +1 -1
  58. package/lib/components/jupyterlab/JupyterLabAppPlugins.js +1 -1
  59. package/lib/components/kernel/KernelActionMenu.d.ts +8 -0
  60. package/lib/components/kernel/KernelActionMenu.js +21 -0
  61. package/lib/components/kernel/KernelActionMenu.js.map +1 -0
  62. package/lib/components/kernel/KernelInspector.d.ts +6 -0
  63. package/lib/components/kernel/KernelInspector.js +31 -0
  64. package/lib/components/kernel/KernelInspector.js.map +1 -0
  65. package/lib/components/kernel/KernelLauncher.d.ts +2 -0
  66. package/lib/components/kernel/KernelLauncher.js +11 -0
  67. package/lib/components/kernel/KernelLauncher.js.map +1 -0
  68. package/lib/components/kernel/KernelLogs.d.ts +2 -0
  69. package/lib/components/kernel/KernelLogs.js +11 -0
  70. package/lib/components/kernel/KernelLogs.js.map +1 -0
  71. package/lib/components/kernel/KernelProgressBar.d.ts +2 -0
  72. package/lib/components/kernel/KernelProgressBar.js +26 -0
  73. package/lib/components/kernel/KernelProgressBar.js.map +1 -0
  74. package/lib/components/kernel/KernelSelector.d.ts +8 -0
  75. package/lib/components/kernel/KernelSelector.js +40 -0
  76. package/lib/components/kernel/KernelSelector.js.map +1 -0
  77. package/lib/components/kernel/KernelStatus.d.ts +27 -0
  78. package/lib/components/kernel/KernelStatus.js +67 -0
  79. package/lib/components/kernel/KernelStatus.js.map +1 -0
  80. package/lib/components/kernel/KernelUsage.d.ts +6 -0
  81. package/lib/components/kernel/KernelUsage.js +100 -0
  82. package/lib/components/kernel/KernelUsage.js.map +1 -0
  83. package/lib/components/kernel/KernelVariables.d.ts +6 -0
  84. package/lib/components/kernel/KernelVariables.js +23 -0
  85. package/lib/components/kernel/KernelVariables.js.map +1 -0
  86. package/lib/components/kernel/Kernels.d.ts +2 -0
  87. package/lib/components/kernel/Kernels.js +88 -0
  88. package/lib/components/kernel/Kernels.js.map +1 -0
  89. package/lib/components/kernel/index.d.ts +10 -0
  90. package/lib/components/kernel/index.js +16 -0
  91. package/lib/components/kernel/index.js.map +1 -0
  92. package/lib/components/kernel/inspector/kernelinspector.css +68 -0
  93. package/lib/components/kernel/inspector/model.d.ts +56 -0
  94. package/lib/components/kernel/inspector/model.js +201 -0
  95. package/lib/components/kernel/inspector/model.js.map +1 -0
  96. package/lib/components/kernel/inspector/widget.d.ts +40 -0
  97. package/lib/components/kernel/inspector/widget.js +190 -0
  98. package/lib/components/kernel/inspector/widget.js.map +1 -0
  99. package/lib/components/kernel/variables/handler.d.ts +86 -0
  100. package/lib/components/kernel/variables/handler.js +262 -0
  101. package/lib/components/kernel/variables/handler.js.map +1 -0
  102. package/lib/components/kernel/variables/inspectorscripts.d.ts +20 -0
  103. package/lib/components/kernel/variables/inspectorscripts.js +349 -0
  104. package/lib/components/kernel/variables/inspectorscripts.js.map +1 -0
  105. package/lib/components/kernel/variables/kernelconnector.d.ts +37 -0
  106. package/lib/components/kernel/variables/kernelconnector.js +76 -0
  107. package/lib/components/kernel/variables/kernelconnector.js.map +1 -0
  108. package/lib/components/kernel/variables/manager.d.ts +26 -0
  109. package/lib/components/kernel/variables/manager.js +70 -0
  110. package/lib/components/kernel/variables/manager.js.map +1 -0
  111. package/lib/components/kernel/variables/tokens.d.ts +48 -0
  112. package/lib/components/kernel/variables/tokens.js +7 -0
  113. package/lib/components/kernel/variables/tokens.js.map +1 -0
  114. package/lib/components/kernel/variables/variablesinspector.css +110 -0
  115. package/lib/components/kernel/variables/variablesinspector.d.ts +5 -0
  116. package/lib/components/kernel/variables/variablesinspector.js +85 -0
  117. package/lib/components/kernel/variables/variablesinspector.js.map +1 -0
  118. package/lib/components/kernel/variables/widget.d.ts +33 -0
  119. package/lib/components/kernel/variables/widget.js +391 -0
  120. package/lib/components/kernel/variables/widget.js.map +1 -0
  121. package/lib/{jupyter → components}/lumino/Lumino.js +1 -1
  122. package/lib/components/lumino/Lumino.js.map +1 -0
  123. package/lib/{jupyter → components}/lumino/LuminoBox.js +1 -1
  124. package/lib/components/lumino/LuminoBox.js.map +1 -0
  125. package/lib/{jupyter → components}/lumino/LuminoDetached.js +1 -1
  126. package/lib/components/lumino/LuminoDetached.js.map +1 -0
  127. package/lib/{jupyter → components}/lumino/LuminoObservable.js +1 -1
  128. package/lib/components/lumino/LuminoObservable.js.map +1 -0
  129. package/lib/components/lumino/LuminoRedux.js +7 -0
  130. package/lib/components/lumino/LuminoRedux.js.map +1 -0
  131. package/lib/{jupyter → components}/lumino/ReactPortalWidget.js +1 -1
  132. package/lib/components/lumino/ReactPortalWidget.js.map +1 -0
  133. package/lib/components/notebook/Notebook.css +1 -1
  134. package/lib/components/notebook/Notebook.js +12 -8
  135. package/lib/components/notebook/Notebook.js.map +1 -1
  136. package/lib/components/notebook/NotebookAdapter.d.ts +3 -1
  137. package/lib/components/notebook/NotebookAdapter.js +92 -61
  138. package/lib/components/notebook/NotebookAdapter.js.map +1 -1
  139. package/lib/components/notebook/NotebookCommands.d.ts +23 -21
  140. package/lib/components/notebook/NotebookCommands.js +52 -27
  141. package/lib/components/notebook/NotebookCommands.js.map +1 -1
  142. package/lib/components/notebook/NotebookRedux.js +1 -1
  143. package/lib/components/notebook/NotebookZustand.js +1 -1
  144. package/lib/components/notebook/cell/metadata/CellMetadataEditor.js +2 -2
  145. package/lib/components/notebook/cell/metadata/CellMetadataEditor.js.map +1 -1
  146. package/lib/components/notebook/cell/metadata/NbGraderCells.js +11 -11
  147. package/lib/components/notebook/cell/prompt/Countdown.js +2 -2
  148. package/lib/components/notebook/cell/prompt/Countdown.js.map +1 -1
  149. package/lib/components/notebook/cell/prompt/CountdownInputPrompt.js +1 -1
  150. package/lib/components/notebook/cell/prompt/CountdownOutputPrompt.js +1 -1
  151. package/lib/components/notebook/cell/prompt/CountdownOutputPrompt.js.map +1 -1
  152. package/lib/components/notebook/cell/sidebar/CellSidebar.js +1 -1
  153. package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +1 -1
  154. package/lib/components/notebook/cell/sidebar/CellSidebarRun.js +1 -1
  155. package/lib/components/notebook/cell/sidebar/CellSidebarWidget.d.ts +1 -1
  156. package/lib/components/notebook/cell/sidebar/CellSidebarWidget.js +2 -2
  157. package/lib/components/notebook/cell/sidebar/CellSidebarWidget.js.map +1 -1
  158. package/lib/components/notebook/content/JupyterReactContentFactory.js +1 -1
  159. package/lib/components/notebook/marked/marked.js +2 -2
  160. package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js +1 -1
  161. package/lib/components/output/Output.css +1 -1
  162. package/lib/components/output/Output.d.ts +13 -10
  163. package/lib/components/output/Output.js +34 -59
  164. package/lib/components/output/Output.js.map +1 -1
  165. package/lib/components/output/OutputAdapter.d.ts +3 -3
  166. package/lib/components/output/OutputAdapter.js +19 -17
  167. package/lib/components/output/OutputAdapter.js.map +1 -1
  168. package/lib/components/output/OutputIPyWidgets.css +1 -1
  169. package/lib/components/output/OutputIPyWidgets.js +2 -2
  170. package/lib/components/output/OutputIPyWidgets.js.map +1 -1
  171. package/lib/components/output/OutputRedux.js +1 -1
  172. package/lib/components/output/OutputRenderer.js +26 -2
  173. package/lib/components/output/OutputRenderer.js.map +1 -1
  174. package/lib/components/output/OutputZustand.d.ts +5 -0
  175. package/lib/components/output/OutputZustand.js +6 -1
  176. package/lib/components/output/OutputZustand.js.map +1 -1
  177. package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsAttached.js +2 -2
  178. package/lib/components/output/ipywidgets/IPyWidgetsAttached.js.map +1 -0
  179. package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsViewManager.js +8 -7
  180. package/lib/components/output/ipywidgets/IPyWidgetsViewManager.js.map +1 -0
  181. package/lib/components/settings/Settings.js +2 -2
  182. package/lib/components/settings/Settings.js.map +1 -1
  183. package/lib/components/settings/SettingsAdapter.css +1 -1
  184. package/lib/components/settings/SettingsAdapter.js +1 -1
  185. package/lib/components/settings/SettingsRedux.js +1 -1
  186. package/lib/components/settings/SettingsZustand.js +1 -1
  187. package/lib/components/terminal/Terminal.d.ts +5 -1
  188. package/lib/components/terminal/Terminal.js +3 -3
  189. package/lib/components/terminal/Terminal.js.map +1 -1
  190. package/lib/components/terminal/TerminalAdapter.js +13 -4
  191. package/lib/components/terminal/TerminalAdapter.js.map +1 -1
  192. package/lib/components/terminal/TerminalRedux.js +1 -1
  193. package/lib/components/terminal/TerminalZustand.js +1 -1
  194. package/lib/components/textinput/TextInput.js +1 -1
  195. package/lib/components/viewer/Viewer.d.ts +2 -1
  196. package/lib/components/viewer/Viewer.js +17 -4
  197. package/lib/components/viewer/Viewer.js.map +1 -1
  198. package/lib/components/viewer/input/CodemirrorView.js +1 -1
  199. package/lib/components/viewer/input/CodemirrorViewer.js +3 -3
  200. package/lib/components/viewer/input/CodemirrorViewer.js.map +1 -1
  201. package/lib/components/viewer/input/InputViewer.js +2 -5
  202. package/lib/components/viewer/input/InputViewer.js.map +1 -1
  203. package/lib/components/viewer/output/OutputAdapter.js +3 -3
  204. package/lib/components/viewer/output/OutputAdapter.js.map +1 -1
  205. package/lib/components/viewer/output/OutputViewer.js +1 -1
  206. package/lib/components/viewer/output/OutputViewer.js.map +1 -1
  207. package/lib/examples/All.js +6 -5
  208. package/lib/examples/All.js.map +1 -1
  209. package/lib/examples/Bokeh.js +1 -1
  210. package/lib/examples/Bqplot.js +8 -2
  211. package/lib/examples/Bqplot.js.map +1 -1
  212. package/lib/examples/Cell.js +1 -1
  213. package/lib/examples/CellLite.js +16 -0
  214. package/lib/examples/CellLite.js.map +1 -0
  215. package/lib/examples/Cells.js +1 -1
  216. package/lib/examples/Console.js +2 -2
  217. package/lib/examples/Console.js.map +1 -1
  218. package/lib/examples/ConsoleLite.js +4 -2
  219. package/lib/examples/ConsoleLite.js.map +1 -1
  220. package/lib/examples/Dashboard.js +1 -1
  221. package/lib/examples/Deno.js +18 -0
  222. package/lib/examples/Deno.js.map +1 -0
  223. package/lib/examples/FileBrowser.js +1 -1
  224. package/lib/examples/GeoJson.js +1 -1
  225. package/lib/examples/IPyLeaflet.js +8 -2
  226. package/lib/examples/IPyLeaflet.js.map +1 -1
  227. package/lib/examples/IPyReact.js +8 -4
  228. package/lib/examples/IPyReact.js.map +1 -1
  229. package/lib/examples/IPyWidgets.js +1 -1
  230. package/lib/examples/IPyWidgetsWithState.js +1 -1
  231. package/lib/examples/JupyterLabApp.js +2 -2
  232. package/lib/examples/JupyterLabHeadlessApp.js +3 -3
  233. package/lib/examples/JupyterLabHeadlessApp.js.map +1 -1
  234. package/lib/examples/KernelExecResult.d.ts +1 -0
  235. package/lib/examples/KernelExecResult.js +40 -0
  236. package/lib/examples/KernelExecResult.js.map +1 -0
  237. package/lib/examples/KernelExecutor.js +55 -0
  238. package/lib/examples/KernelExecutor.js.map +1 -0
  239. package/lib/examples/Kernels.d.ts +1 -0
  240. package/lib/examples/Kernels.js +78 -0
  241. package/lib/examples/Kernels.js.map +1 -0
  242. package/lib/examples/Lumino.js +2 -2
  243. package/lib/examples/Lumino.js.map +1 -1
  244. package/lib/examples/Matplotlib.js +12 -8
  245. package/lib/examples/Matplotlib.js.map +1 -1
  246. package/lib/examples/Notebook.js +11 -6
  247. package/lib/examples/Notebook.js.map +1 -1
  248. package/lib/examples/NotebookCellSidebar.js +10 -6
  249. package/lib/examples/NotebookCellSidebar.js.map +1 -1
  250. package/lib/examples/NotebookColorMode.js +47 -0
  251. package/lib/examples/NotebookColorMode.js.map +1 -0
  252. package/lib/examples/NotebookExternalContent.js +10 -6
  253. package/lib/examples/NotebookExternalContent.js.map +1 -1
  254. package/lib/examples/NotebookInit.js +9 -5
  255. package/lib/examples/NotebookInit.js.map +1 -1
  256. package/lib/examples/NotebookInjectableReduxStore.js +1 -1
  257. package/lib/examples/NotebookKernelChange.js +5 -4
  258. package/lib/examples/NotebookKernelChange.js.map +1 -1
  259. package/lib/examples/NotebookLite.d.ts +1 -0
  260. package/lib/examples/NotebookLite.js +20 -0
  261. package/lib/examples/NotebookLite.js.map +1 -0
  262. package/lib/examples/NotebookNbFormat.d.ts +1 -0
  263. package/lib/examples/{NotebookModel.js → NotebookNbFormat.js} +12 -8
  264. package/lib/examples/NotebookNbFormat.js.map +1 -0
  265. package/lib/examples/NotebookNbFormatChange.d.ts +1 -0
  266. package/lib/examples/{NotebookModelChange.js → NotebookNbFormatChange.js} +13 -9
  267. package/lib/examples/NotebookNbFormatChange.js.map +1 -0
  268. package/lib/examples/NotebookPath.js +10 -6
  269. package/lib/examples/NotebookPath.js.map +1 -1
  270. package/lib/examples/NotebookPathChange.js +10 -6
  271. package/lib/examples/NotebookPathChange.js.map +1 -1
  272. package/lib/examples/NotebookSkeleton.d.ts +1 -0
  273. package/lib/examples/NotebookSkeleton.js +28 -0
  274. package/lib/examples/NotebookSkeleton.js.map +1 -0
  275. package/lib/examples/NotebookTheme.d.ts +1 -0
  276. package/lib/examples/NotebookTheme.js +48 -0
  277. package/lib/examples/NotebookTheme.js.map +1 -0
  278. package/lib/examples/NotebookUnmount.js +6 -5
  279. package/lib/examples/NotebookUnmount.js.map +1 -1
  280. package/lib/examples/ObservableHQ.d.ts +1 -0
  281. package/lib/examples/ObservableHQ.js +18 -0
  282. package/lib/examples/ObservableHQ.js.map +1 -0
  283. package/lib/examples/Output.js +4 -4
  284. package/lib/examples/Output.js.map +1 -1
  285. package/lib/examples/OutputIPyWidgets.js +1 -1
  286. package/lib/examples/Outputs.js +3 -3
  287. package/lib/examples/Outputs.js.map +1 -1
  288. package/lib/examples/Panel.js +1 -1
  289. package/lib/examples/Plotly.js +1 -1
  290. package/lib/examples/RunningSessions.js +3 -3
  291. package/lib/examples/RunningSessions.js.map +1 -1
  292. package/lib/examples/Terminal.js +2 -2
  293. package/lib/examples/Terminal.js.map +1 -1
  294. package/lib/examples/Vega.js +1 -1
  295. package/lib/examples/Viewer.js +7 -69
  296. package/lib/examples/Viewer.js.map +1 -1
  297. package/lib/examples/lumino/LuminoWidget.d.ts +1 -1
  298. package/lib/examples/lumino/LuminoWidget.js +5 -5
  299. package/lib/examples/lumino/LuminoWidget.js.map +1 -1
  300. package/lib/examples/notebooks/OutputIPyWidgetsExample.js +1 -1
  301. package/lib/examples/sidebars/CellSidebarSource.js +1 -1
  302. package/lib/examples/state/ExampleReduxState.js +1 -1
  303. package/lib/examples/toolbars/NotebookToolbar.js +8 -5
  304. package/lib/examples/toolbars/NotebookToolbar.js.map +1 -1
  305. package/lib/examples/toolbars/NotebookToolbarAutoSave.js +2 -2
  306. package/lib/examples/toolbars/NotebookToolbarAutoSave.js.map +1 -1
  307. package/lib/examples/toolbars/NotebookToolbarStatus.js +1 -1
  308. package/lib/index.css +1 -1
  309. package/lib/index.d.ts +33 -24
  310. package/lib/index.js +54 -37
  311. package/lib/index.js.map +1 -1
  312. package/lib/jupyter/Jupyter.d.ts +7 -26
  313. package/lib/jupyter/Jupyter.js +24 -19
  314. package/lib/jupyter/Jupyter.js.map +1 -1
  315. package/lib/jupyter/JupyterAuthError.js +1 -1
  316. package/lib/jupyter/JupyterConfig.js +2 -2
  317. package/lib/jupyter/JupyterConfig.js.map +1 -1
  318. package/lib/jupyter/JupyterContext.d.ts +117 -24
  319. package/lib/jupyter/JupyterContext.js +116 -101
  320. package/lib/jupyter/JupyterContext.js.map +1 -1
  321. package/lib/jupyter/JupyterHandlers.js +1 -1
  322. package/lib/jupyter/ipywidgets/{lab → cache}/semvercache.d.ts +3 -1
  323. package/lib/jupyter/ipywidgets/{lab → cache}/semvercache.js +3 -1
  324. package/lib/jupyter/ipywidgets/cache/semvercache.js.map +1 -0
  325. package/lib/jupyter/ipywidgets/classic/IPyWidgetsClassicManager.d.ts +34 -0
  326. package/lib/jupyter/ipywidgets/classic/IPyWidgetsClassicManager.js +185 -0
  327. package/lib/jupyter/ipywidgets/classic/IPyWidgetsClassicManager.js.map +1 -0
  328. package/lib/jupyter/ipywidgets/lab/manager.d.ts +4 -4
  329. package/lib/jupyter/ipywidgets/lab/manager.js +21 -9
  330. package/lib/jupyter/ipywidgets/lab/manager.js.map +1 -1
  331. package/lib/jupyter/ipywidgets/lab/output.js +1 -1
  332. package/lib/jupyter/ipywidgets/lab/plugin.d.ts +6 -5
  333. package/lib/jupyter/ipywidgets/lab/plugin.js +44 -42
  334. package/lib/jupyter/ipywidgets/lab/plugin.js.map +1 -1
  335. package/lib/jupyter/ipywidgets/lab/renderer.js +1 -1
  336. package/lib/jupyter/ipywidgets/lab/renderer.js.map +1 -1
  337. package/lib/jupyter/ipywidgets/plotly/Figure.js +181 -170
  338. package/lib/jupyter/ipywidgets/plotly/Figure.js.map +1 -1
  339. package/lib/jupyter/ipywidgets/plotly/JupyterlabPlugin.js +1 -1
  340. package/lib/jupyter/ipywidgets/plotly/Version.js +1 -1
  341. package/lib/jupyter/ipywidgets/plotly/index.js +1 -1
  342. package/lib/jupyter/kernel/Kernel.d.ts +69 -17
  343. package/lib/jupyter/kernel/Kernel.js +68 -42
  344. package/lib/jupyter/kernel/Kernel.js.map +1 -1
  345. package/lib/jupyter/kernel/KernelExecutor.d.ts +38 -0
  346. package/lib/jupyter/kernel/KernelExecutor.js +149 -0
  347. package/lib/jupyter/kernel/KernelExecutor.js.map +1 -0
  348. package/lib/jupyter/kernel/index.d.ts +2 -0
  349. package/lib/jupyter/kernel/index.js +8 -0
  350. package/lib/jupyter/kernel/index.js.map +1 -0
  351. package/lib/jupyter/lab/JupyterLabColorMode.d.ts +1 -0
  352. package/lib/jupyter/lab/JupyterLabColorMode.js +7 -0
  353. package/lib/jupyter/lab/JupyterLabColorMode.js.map +1 -0
  354. package/lib/jupyter/lab/JupyterLabCss.d.ts +6 -3
  355. package/lib/jupyter/lab/JupyterLabCss.js +53 -25
  356. package/lib/jupyter/lab/JupyterLabCss.js.map +1 -1
  357. package/lib/jupyter/lab/JupyterLabCssImports.d.ts +16 -16
  358. package/lib/jupyter/lab/JupyterLabCssImports.js +17 -17
  359. package/lib/jupyter/lab/JupyterLabCssImports.js.map +1 -1
  360. package/lib/jupyter/lab/__tests__/datalayer.spec.js +1 -1
  361. package/lib/jupyter/lab/index.d.ts +2 -2
  362. package/lib/jupyter/lab/index.js +2 -3
  363. package/lib/jupyter/lab/index.js.map +1 -1
  364. package/lib/jupyter/lab/notebook/content/CountdownContentFactory.d.ts +3 -8
  365. package/lib/jupyter/lab/notebook/content/CountdownContentFactory.js +7 -13
  366. package/lib/jupyter/lab/notebook/content/CountdownContentFactory.js.map +1 -1
  367. package/lib/jupyter/lab/notebook/content/plugin.js +3 -3
  368. package/lib/jupyter/lab/notebook/content/plugin.js.map +1 -1
  369. package/lib/jupyter/lab/notebook/index.js +1 -1
  370. package/lib/jupyter/lite/LiteServer.d.ts +11 -2
  371. package/lib/jupyter/lite/LiteServer.js +42 -67
  372. package/lib/jupyter/lite/LiteServer.js.map +1 -1
  373. package/lib/jupyter/renderers/index.js +1 -1
  374. package/lib/jupyter/renderers/plotly/PlotlyRenderer.js +5 -5
  375. package/lib/jupyter/renderers/plotly/PlotlyRenderer.js.map +1 -1
  376. package/lib/jupyter/renderers/plotly/plotly.css +1 -1
  377. package/lib/jupyter/services/Services.js +1 -1
  378. package/lib/jupyter/theme.d.ts +2 -2
  379. package/lib/jupyter/theme.js +16 -15
  380. package/lib/jupyter/theme.js.map +1 -1
  381. package/lib/state/index.js +1 -1
  382. package/lib/state/redux/InitState.js +1 -1
  383. package/lib/state/redux/State.js +1 -1
  384. package/lib/state/redux/Store.js +1 -1
  385. package/lib/utils/Utils.d.ts +3 -2
  386. package/lib/utils/Utils.js +46 -2
  387. package/lib/utils/Utils.js.map +1 -1
  388. package/lib/utils/index.d.ts +1 -0
  389. package/lib/utils/index.js +2 -0
  390. package/lib/utils/index.js.map +1 -0
  391. package/package.json +170 -86
  392. package/style/base.css +1 -1
  393. package/style/index.css +1 -1
  394. package/style/index.js +1 -1
  395. package/lib/examples/NotebookModel.js.map +0 -1
  396. package/lib/examples/NotebookModelChange.js.map +0 -1
  397. package/lib/examples/NotebookThemed.js +0 -52
  398. package/lib/examples/NotebookThemed.js.map +0 -1
  399. package/lib/examples/ViewerFile.js +0 -19
  400. package/lib/examples/ViewerFile.js.map +0 -1
  401. package/lib/jupyter/ipywidgets/IPyWidgetsAttached.js.map +0 -1
  402. package/lib/jupyter/ipywidgets/IPyWidgetsViewManager.js.map +0 -1
  403. package/lib/jupyter/ipywidgets/lab/semvercache.js.map +0 -1
  404. package/lib/jupyter/ipywidgets/manager/IPyWidgetsClassicManager.d.ts +0 -19
  405. package/lib/jupyter/ipywidgets/manager/IPyWidgetsClassicManager.js +0 -85
  406. package/lib/jupyter/ipywidgets/manager/IPyWidgetsClassicManager.js.map +0 -1
  407. package/lib/jupyter/kernel/KernelModel.d.ts +0 -18
  408. package/lib/jupyter/kernel/KernelModel.js +0 -57
  409. package/lib/jupyter/kernel/KernelModel.js.map +0 -1
  410. package/lib/jupyter/lab/JupyterLabTheme.d.ts +0 -1
  411. package/lib/jupyter/lab/JupyterLabTheme.js +0 -7
  412. package/lib/jupyter/lab/JupyterLabTheme.js.map +0 -1
  413. package/lib/jupyter/lumino/Lumino.js.map +0 -1
  414. package/lib/jupyter/lumino/LuminoBox.js.map +0 -1
  415. package/lib/jupyter/lumino/LuminoDetached.js.map +0 -1
  416. package/lib/jupyter/lumino/LuminoObservable.js.map +0 -1
  417. package/lib/jupyter/lumino/LuminoRedux.js +0 -7
  418. package/lib/jupyter/lumino/LuminoRedux.js.map +0 -1
  419. package/lib/jupyter/lumino/ReactPortalWidget.js.map +0 -1
  420. /package/lib/{jupyter → components}/lumino/Lumino.d.ts +0 -0
  421. /package/lib/{jupyter → components}/lumino/LuminoBox.d.ts +0 -0
  422. /package/lib/{jupyter → components}/lumino/LuminoDetached.d.ts +0 -0
  423. /package/lib/{jupyter → components}/lumino/LuminoObservable.d.ts +0 -0
  424. /package/lib/{jupyter → components}/lumino/LuminoRedux.d.ts +0 -0
  425. /package/lib/{jupyter → components}/lumino/ReactPortalWidget.d.ts +0 -0
  426. /package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsAttached.d.ts +0 -0
  427. /package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsViewManager.d.ts +0 -0
  428. /package/lib/examples/{NotebookModel.d.ts → CellLite.d.ts} +0 -0
  429. /package/lib/examples/{NotebookModelChange.d.ts → Deno.d.ts} +0 -0
  430. /package/lib/examples/{NotebookThemed.d.ts → KernelExecutor.d.ts} +0 -0
  431. /package/lib/examples/{ViewerFile.d.ts → NotebookColorMode.d.ts} +0 -0
@@ -0,0 +1,349 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ class Languages {
7
+ /**
8
+ * Init and query script for supported languages.
9
+ */
10
+ static py_script = `import json
11
+ import sys
12
+ from importlib import __import__
13
+ from IPython import get_ipython
14
+ from IPython.core.magics.namespace import NamespaceMagics
15
+
16
+
17
+ _jupyterlab_variableinspector_nms = NamespaceMagics()
18
+ _jupyterlab_variableinspector_Jupyter = get_ipython()
19
+ _jupyterlab_variableinspector_nms.shell = _jupyterlab_variableinspector_Jupyter.kernel.shell
20
+
21
+ __np = None
22
+ __pd = None
23
+ __pyspark = None
24
+ __tf = None
25
+ __K = None
26
+ __torch = None
27
+ __ipywidgets = None
28
+ __xr = None
29
+
30
+
31
+ def _attempt_import(module):
32
+ try:
33
+ return __import__(module)
34
+ except ImportError:
35
+ return None
36
+
37
+
38
+ def _check_imported():
39
+ global __np, __pd, __pyspark, __tf, __K, __torch, __ipywidgets, __xr
40
+
41
+ __np = _attempt_import('numpy')
42
+ __pd = _attempt_import('pandas')
43
+ __pyspark = _attempt_import('pyspark')
44
+ __tf = _attempt_import('tensorflow')
45
+ __K = _attempt_import('keras.backend') or _attempt_import('tensorflow.keras.backend')
46
+ __torch = _attempt_import('torch')
47
+ __ipywidgets = _attempt_import('ipywidgets')
48
+ __xr = _attempt_import('xarray')
49
+
50
+
51
+ def _jupyterlab_variableinspector_getsizeof(x):
52
+ if type(x).__name__ in ['ndarray', 'Series']:
53
+ return x.nbytes
54
+ elif __pyspark and isinstance(x, __pyspark.sql.DataFrame):
55
+ return "?"
56
+ elif __tf and isinstance(x, __tf.Variable):
57
+ return "?"
58
+ elif __torch and isinstance(x, __torch.Tensor):
59
+ return x.element_size() * x.nelement()
60
+ elif __pd and type(x).__name__ == 'DataFrame':
61
+ return x.memory_usage().sum()
62
+ else:
63
+ return sys.getsizeof(x)
64
+
65
+
66
+ def _jupyterlab_variableinspector_getshapeof(x):
67
+ if __pd and isinstance(x, __pd.DataFrame):
68
+ return "%d rows x %d cols" % x.shape
69
+ if __pd and isinstance(x, __pd.Series):
70
+ return "%d rows" % x.shape
71
+ if __np and isinstance(x, __np.ndarray):
72
+ shape = " x ".join([str(i) for i in x.shape])
73
+ return "%s" % shape
74
+ if __pyspark and isinstance(x, __pyspark.sql.DataFrame):
75
+ return "? rows x %d cols" % len(x.columns)
76
+ if __tf and isinstance(x, __tf.Variable):
77
+ shape = " x ".join([str(int(i)) for i in x.shape])
78
+ return "%s" % shape
79
+ if __tf and isinstance(x, __tf.Tensor):
80
+ shape = " x ".join([str(int(i)) for i in x.shape])
81
+ return "%s" % shape
82
+ if __torch and isinstance(x, __torch.Tensor):
83
+ shape = " x ".join([str(int(i)) for i in x.shape])
84
+ return "%s" % shape
85
+ if __xr and isinstance(x, __xr.DataArray):
86
+ shape = " x ".join([str(int(i)) for i in x.shape])
87
+ return "%s" % shape
88
+ if isinstance(x, list):
89
+ return "%s" % len(x)
90
+ if isinstance(x, dict):
91
+ return "%s keys" % len(x)
92
+ return None
93
+
94
+
95
+ def _jupyterlab_variableinspector_getcontentof(x):
96
+ # returns content in a friendly way for python variables
97
+ # pandas and numpy
98
+ if __pd and isinstance(x, __pd.DataFrame):
99
+ colnames = ', '.join(x.columns.map(str))
100
+ content = "Columns: %s" % colnames
101
+ elif __pd and isinstance(x, __pd.Series):
102
+ content = str(x.values).replace(" ", ", ")[1:-1]
103
+ content = content.replace("\\n", "")
104
+ elif __np and isinstance(x, __np.ndarray):
105
+ content = x.__repr__()
106
+ elif __xr and isinstance(x, __xr.DataArray):
107
+ content = x.values.__repr__()
108
+ else:
109
+ content = str(x)
110
+
111
+ if len(content) > 150:
112
+ return content[:150] + " ..."
113
+ else:
114
+ return content
115
+
116
+
117
+ def _jupyterlab_variableinspector_is_matrix(x):
118
+ # True if type(x).__name__ in ["DataFrame", "ndarray", "Series"] else False
119
+ if __pd and isinstance(x, __pd.DataFrame):
120
+ return True
121
+ if __pd and isinstance(x, __pd.Series):
122
+ return True
123
+ if __np and isinstance(x, __np.ndarray) and len(x.shape) <= 2:
124
+ return True
125
+ if __pyspark and isinstance(x, __pyspark.sql.DataFrame):
126
+ return True
127
+ if __tf and isinstance(x, __tf.Variable) and len(x.shape) <= 2:
128
+ return True
129
+ if __tf and isinstance(x, __tf.Tensor) and len(x.shape) <= 2:
130
+ return True
131
+ if __torch and isinstance(x, __torch.Tensor) and len(x.shape) <= 2:
132
+ return True
133
+ if __xr and isinstance(x, __xr.DataArray) and len(x.shape) <= 2:
134
+ return True
135
+ if isinstance(x, list):
136
+ return True
137
+ return False
138
+
139
+
140
+ def _jupyterlab_variableinspector_is_widget(x):
141
+ return __ipywidgets and issubclass(x, __ipywidgets.DOMWidget)
142
+
143
+
144
+ def _jupyterlab_variableinspector_dict_list():
145
+ _check_imported()
146
+ def keep_cond(v):
147
+ try:
148
+ obj = eval(v)
149
+ if isinstance(obj, str):
150
+ return True
151
+ if __tf and isinstance(obj, __tf.Variable):
152
+ return True
153
+ if __pd and __pd is not None and (
154
+ isinstance(obj, __pd.core.frame.DataFrame)
155
+ or isinstance(obj, __pd.core.series.Series)):
156
+ return True
157
+ if __xr and __xr is not None and isinstance(obj, __xr.DataArray):
158
+ return True
159
+ if str(obj)[0] == "<":
160
+ return False
161
+ if v in ['__np', '__pd', '__pyspark', '__tf', '__K', '__torch', '__ipywidgets', '__xr']:
162
+ return obj is not None
163
+ if str(obj).startswith("_Feature"):
164
+ # removes tf/keras objects
165
+ return False
166
+ return True
167
+ except:
168
+ return False
169
+ values = _jupyterlab_variableinspector_nms.who_ls()
170
+ vardic = [
171
+ {
172
+ 'varName': _v,
173
+ 'varType': type(eval(_v)).__name__,
174
+ 'varSize': str(_jupyterlab_variableinspector_getsizeof(eval(_v))),
175
+ 'varShape': str(_jupyterlab_variableinspector_getshapeof(eval(_v))) if _jupyterlab_variableinspector_getshapeof(eval(_v)) else '',
176
+ 'varContent': str(_jupyterlab_variableinspector_getcontentof(eval(_v))),
177
+ 'isMatrix': _jupyterlab_variableinspector_is_matrix(eval(_v)),
178
+ 'isWidget': _jupyterlab_variableinspector_is_widget(type(eval(_v)))
179
+ }
180
+ for _v in values if keep_cond(_v)
181
+ ]
182
+ return json.dumps(vardic, ensure_ascii=False)
183
+
184
+
185
+ def _jupyterlab_variableinspector_getmatrixcontent(x, max_rows=10000):
186
+ # to do: add something to handle this in the future
187
+ threshold = max_rows
188
+
189
+ if __pd and __pyspark and isinstance(x, __pyspark.sql.DataFrame):
190
+ df = x.limit(threshold).toPandas()
191
+ return _jupyterlab_variableinspector_getmatrixcontent(df.copy())
192
+ elif __np and __pd and type(x).__name__ == "DataFrame":
193
+ if threshold is not None:
194
+ x = x.head(threshold)
195
+ x.columns = x.columns.map(str)
196
+ return x.to_json(orient="table", default_handler=_jupyterlab_variableinspector_default, force_ascii=False)
197
+ elif __np and __pd and type(x).__name__ == "Series":
198
+ if threshold is not None:
199
+ x = x.head(threshold)
200
+ return x.to_json(orient="table", default_handler=_jupyterlab_variableinspector_default, force_ascii=False)
201
+ elif __np and __pd and type(x).__name__ == "ndarray":
202
+ df = __pd.DataFrame(x)
203
+ return _jupyterlab_variableinspector_getmatrixcontent(df)
204
+ elif __tf and (isinstance(x, __tf.Variable) or isinstance(x, __tf.Tensor)):
205
+ df = __K.get_value(x)
206
+ return _jupyterlab_variableinspector_getmatrixcontent(df)
207
+ elif __torch and isinstance(x, __torch.Tensor):
208
+ df = x.cpu().numpy()
209
+ return _jupyterlab_variableinspector_getmatrixcontent(df)
210
+ elif __xr and isinstance(x, __xr.DataArray):
211
+ df = x.to_numpy()
212
+ return _jupyterlab_variableinspector_getmatrixcontent(df)
213
+ elif isinstance(x, list):
214
+ s = __pd.Series(x)
215
+ return _jupyterlab_variableinspector_getmatrixcontent(s)
216
+
217
+
218
+ def _jupyterlab_variableinspector_displaywidget(widget):
219
+ display(widget)
220
+
221
+
222
+ def _jupyterlab_variableinspector_default(o):
223
+ if isinstance(o, __np.number): return int(o)
224
+ raise TypeError
225
+
226
+
227
+ def _jupyterlab_variableinspector_deletevariable(x):
228
+ exec("del %s" % x, globals())
229
+ `;
230
+ static r_script = `library(repr)
231
+
232
+ .ls.objects = function (pos = 1, pattern, order.by, decreasing = FALSE, head = FALSE,
233
+ n = 5)
234
+ {
235
+ napply <- function(names, fn) sapply(names, function(x) fn(get(x,
236
+ pos = pos)))
237
+ names <- ls(pos = pos, pattern = pattern)
238
+ if (length(names) == 0) {
239
+ return(jsonlite::toJSON(data.frame()))
240
+ }
241
+ obj.class <- napply(names, function(x) as.character(class(x))[1])
242
+ obj.mode <- napply(names, mode)
243
+ obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class)
244
+ obj.size <- napply(names, object.size)
245
+ obj.dim <- t(napply(names, function(x) as.numeric(dim(x))[1:2]))
246
+ obj.content <- rep("NA", length(names))
247
+ has_no_dim <- is.na(obj.dim)[1:length(names)]
248
+ obj.dim[has_no_dim, 1] <- napply(names, length)[has_no_dim]
249
+ vec <- (obj.type != "function")
250
+ obj.content[vec] <- napply(names[vec], function(x) toString(x, width = 154)[1])
251
+
252
+ obj.rownames <- napply(names, rownames)
253
+ has_rownames <- obj.rownames != "NULL"
254
+ obj.rownames <- sapply(obj.rownames[has_rownames], function(x) paste(x,
255
+ collapse=", "))
256
+ obj.rownames.short <- sapply(obj.rownames, function(x) paste(substr(x, 1, 150), "...."))
257
+ obj.rownames <- ifelse(nchar(obj.rownames) > 154, obj.rownames.short, obj.rownames)
258
+ obj.rownames <- sapply(obj.rownames, function(x) paste("Row names: ",x))
259
+ obj.content[has_rownames] <- obj.rownames
260
+
261
+
262
+ obj.colnames <- napply(names, colnames)
263
+ has_colnames <- obj.colnames != "NULL"
264
+ obj.colnames <- sapply(obj.colnames[has_colnames], function(x) paste(x,
265
+ collapse = ", "))
266
+ obj.colnames.short <- sapply(obj.colnames, function(x) paste(substr(x,
267
+ 1, 150), "...."))
268
+ obj.colnames <- ifelse(nchar(obj.colnames) > 154, obj.colnames.short,
269
+ obj.colnames)
270
+ obj.colnames <- sapply(obj.colnames, function(x) paste("Column names: ",x))
271
+
272
+ obj.content[has_colnames] <- obj.colnames
273
+
274
+ is_function <- (obj.type == "function")
275
+ obj.content[is_function] <- napply(names[is_function], function(x) paste(strsplit(repr_text(x),")")[[1]][1],")",sep=""))
276
+ obj.content <- unlist(obj.content, use.names = FALSE)
277
+
278
+
279
+ out <- data.frame(obj.type, obj.size, obj.dim)
280
+ names(out) <- c("varType", "varSize", "Rows", "Columns")
281
+ out$varShape <- paste(out$Rows, " x ", out$Columns)
282
+ out$varContent <- obj.content
283
+ out$isMatrix <- FALSE
284
+ out$varName <- row.names(out)
285
+ out <- out[, !(names(out) %in% c("Rows", "Columns"))]
286
+ rownames(out) <- NULL
287
+ print(out)
288
+ if (!missing(order.by))
289
+ out <- out[order(out[[order.by]], decreasing = decreasing),
290
+ ]
291
+ if (head)
292
+ out <- head(out, n)
293
+ jsonlite::toJSON(out)
294
+ }
295
+
296
+ .deleteVariable <- function(x) {
297
+ remove(list=c(x), envir=.GlobalEnv)
298
+ }
299
+ `;
300
+ static scripts = {
301
+ python3: {
302
+ initScript: Languages.py_script,
303
+ queryCommand: '_jupyterlab_variableinspector_dict_list()',
304
+ matrixQueryCommand: '_jupyterlab_variableinspector_getmatrixcontent',
305
+ widgetQueryCommand: '_jupyterlab_variableinspector_displaywidget',
306
+ deleteCommand: '_jupyterlab_variableinspector_deletevariable',
307
+ },
308
+ python2: {
309
+ initScript: Languages.py_script,
310
+ queryCommand: '_jupyterlab_variableinspector_dict_list()',
311
+ matrixQueryCommand: '_jupyterlab_variableinspector_getmatrixcontent',
312
+ widgetQueryCommand: '_jupyterlab_variableinspector_displaywidget',
313
+ deleteCommand: '_jupyterlab_variableinspector_deletevariable',
314
+ },
315
+ python: {
316
+ initScript: Languages.py_script,
317
+ queryCommand: '_jupyterlab_variableinspector_dict_list()',
318
+ matrixQueryCommand: '_jupyterlab_variableinspector_getmatrixcontent',
319
+ widgetQueryCommand: '_jupyterlab_variableinspector_displaywidget',
320
+ deleteCommand: '_jupyterlab_variableinspector_deletevariable',
321
+ },
322
+ R: {
323
+ initScript: Languages.r_script,
324
+ queryCommand: '.ls.objects()',
325
+ matrixQueryCommand: '.ls.objects',
326
+ widgetQueryCommand: 'TODO',
327
+ deleteCommand: '.deleteVariable',
328
+ },
329
+ scala: {
330
+ initScript: '_root_.almond.api.JupyterAPIHolder.value.VariableInspector.init()',
331
+ queryCommand: '_root_.almond.api.JupyterAPIHolder.value.VariableInspector.dictList()',
332
+ matrixQueryCommand: '',
333
+ widgetQueryCommand: '',
334
+ deleteCommand: '', // TODO
335
+ },
336
+ };
337
+ static getScript(lang) {
338
+ return new Promise((resolve, reject) => {
339
+ if (lang in Languages.scripts) {
340
+ resolve(Languages.scripts[lang]);
341
+ }
342
+ else {
343
+ reject('Language ' + lang + ' not supported yet!');
344
+ }
345
+ });
346
+ }
347
+ }
348
+ export { Languages };
349
+ //# sourceMappingURL=inspectorscripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectorscripts.js","sourceRoot":"","sources":["../../../../src/components/kernel/variables/inspectorscripts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,MAAsB,SAAS;IAC7B;;OAEG;IAEH,MAAM,CAAC,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2NpB,CAAC;IAEA,MAAM,CAAC,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqEf,CAAC;IAEJ,MAAM,CAAC,OAAO,GAAiD;QAC7D,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,SAAS;YAC/B,YAAY,EAAE,2CAA2C;YACzD,kBAAkB,EAAE,gDAAgD;YACpE,kBAAkB,EAAE,6CAA6C;YACjE,aAAa,EAAE,8CAA8C;SAC9D;QACD,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,SAAS;YAC/B,YAAY,EAAE,2CAA2C;YACzD,kBAAkB,EAAE,gDAAgD;YACpE,kBAAkB,EAAE,6CAA6C;YACjE,aAAa,EAAE,8CAA8C;SAC9D;QACD,MAAM,EAAE;YACN,UAAU,EAAE,SAAS,CAAC,SAAS;YAC/B,YAAY,EAAE,2CAA2C;YACzD,kBAAkB,EAAE,gDAAgD;YACpE,kBAAkB,EAAE,6CAA6C;YACjE,aAAa,EAAE,8CAA8C;SAC9D;QACD,CAAC,EAAE;YACD,UAAU,EAAE,SAAS,CAAC,QAAQ;YAC9B,YAAY,EAAE,eAAe;YAC7B,kBAAkB,EAAE,aAAa;YACjC,kBAAkB,EAAE,MAAM;YAC1B,aAAa,EAAE,iBAAiB;SACjC;QACD,KAAK,EAAE;YACL,UAAU,EACR,mEAAmE;YACrE,YAAY,EACV,uEAAuE;YACzE,kBAAkB,EAAE,EAAE;YACtB,kBAAkB,EAAE,EAAE;YACtB,aAAa,EAAE,EAAE,EAAE,OAAO;SAC3B;KACF,CAAC;IAEF,MAAM,CAAC,SAAS,CAAC,IAAY;QAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,IAAI,IAAI,SAAS,CAAC,OAAO,EAAE;gBAC7B,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;aAClC;iBAAM;gBACL,MAAM,CAAC,WAAW,GAAG,IAAI,GAAG,qBAAqB,CAAC,CAAC;aACpD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;SAzVmB,SAAS"}
@@ -0,0 +1,37 @@
1
+ import { KernelMessage } from '@jupyterlab/services';
2
+ import { IKernelConnection, IShellFuture } from '@jupyterlab/services/lib/kernel/kernel';
3
+ import { IExecuteReplyMsg, IExecuteRequestMsg } from '@jupyterlab/services/lib/kernel/messages';
4
+ import { ISignal } from '@lumino/signaling';
5
+ import Kernel from './../../../jupyter/kernel/Kernel';
6
+ /**
7
+ * Connector class that handles execute request to a kernel
8
+ */
9
+ export declare class KernelConnector {
10
+ private _kernel;
11
+ private _kernelRestarted;
12
+ constructor(options: KernelConnector.IOptions);
13
+ get kernelRestarted(): ISignal<KernelConnector, Promise<void>>;
14
+ get kernelLanguage(): Promise<string>;
15
+ get kernelName(): string;
16
+ /**
17
+ * A Promise that is fulfilled when the session associated w/ the connector is ready.
18
+ */
19
+ get ready(): Promise<void>;
20
+ /**
21
+ * A signal emitted for iopub messages of the kernel associated with the kernel.
22
+ */
23
+ get iopubMessage(): ISignal<IKernelConnection, KernelMessage.IMessage>;
24
+ /**
25
+ * Executes the given request on the kernel associated with the connector.
26
+ * @param content: IExecuteRequestMsg to forward to the kernel.
27
+ * @param ioCallback: Callable to forward IOPub messages of the kernel to.
28
+ * @returns Promise<KernelMessage.IExecuteReplyMsg>
29
+ */
30
+ fetch(content: KernelMessage.IExecuteRequestMsg['content'], ioCallback: (msg: KernelMessage.IIOPubMessage) => any): Promise<KernelMessage.IExecuteReplyMsg>;
31
+ execute(content: KernelMessage.IExecuteRequestMsg['content']): IShellFuture<IExecuteRequestMsg, IExecuteReplyMsg>;
32
+ }
33
+ export declare namespace KernelConnector {
34
+ interface IOptions {
35
+ kernel: Kernel;
36
+ }
37
+ }
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { Signal } from '@lumino/signaling';
7
+ /**
8
+ * Connector class that handles execute request to a kernel
9
+ */
10
+ export class KernelConnector {
11
+ _kernel;
12
+ _kernelRestarted = new Signal(this);
13
+ constructor(options) {
14
+ this._kernel = options.kernel;
15
+ this._kernel.connection?.statusChanged.connect((_, newStatus) => {
16
+ switch (newStatus) {
17
+ case 'restarting':
18
+ case 'autorestarting':
19
+ this._kernelRestarted.emit(this._kernel.ready);
20
+ break;
21
+ default:
22
+ break;
23
+ }
24
+ });
25
+ }
26
+ get kernelRestarted() {
27
+ return this._kernelRestarted;
28
+ }
29
+ get kernelLanguage() {
30
+ if (!this._kernel) {
31
+ return Promise.resolve('');
32
+ }
33
+ return this._kernel.connection.info.then(infoReply => {
34
+ return infoReply.language_info.name;
35
+ });
36
+ }
37
+ get kernelName() {
38
+ return this._kernel.connection.name;
39
+ }
40
+ /**
41
+ * A Promise that is fulfilled when the session associated w/ the connector is ready.
42
+ */
43
+ get ready() {
44
+ return this._kernel.ready;
45
+ }
46
+ /**
47
+ * A signal emitted for iopub messages of the kernel associated with the kernel.
48
+ */
49
+ get iopubMessage() {
50
+ return this._kernel.connection.iopubMessage;
51
+ }
52
+ /**
53
+ * Executes the given request on the kernel associated with the connector.
54
+ * @param content: IExecuteRequestMsg to forward to the kernel.
55
+ * @param ioCallback: Callable to forward IOPub messages of the kernel to.
56
+ * @returns Promise<KernelMessage.IExecuteReplyMsg>
57
+ */
58
+ fetch(content, ioCallback) {
59
+ const kernel = this._kernel.connection;
60
+ if (!kernel) {
61
+ return Promise.reject(new Error('Require kernel to perform variable inspection!'));
62
+ }
63
+ const future = kernel.requestExecute(content);
64
+ future.onIOPub = (msg) => {
65
+ ioCallback(msg);
66
+ };
67
+ return future.done;
68
+ }
69
+ execute(content) {
70
+ if (!this._kernel.connection) {
71
+ throw new Error('No session available.');
72
+ }
73
+ return this._kernel.connection.requestExecute(content);
74
+ }
75
+ }
76
+ //# sourceMappingURL=kernelconnector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernelconnector.js","sourceRoot":"","sources":["../../../../src/components/kernel/variables/kernelconnector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;GAEG;AACH,MAAM,OAAO,eAAe;IAClB,OAAO,CAAS;IAChB,gBAAgB,GAAG,IAAI,MAAM,CAAsB,IAAI,CAAC,CAAC;IAEjE,YAAY,OAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,OAAO,CAC5C,CAAC,CAAC,EAAE,SAA+B,EAAE,EAAE;YACrC,QAAQ,SAAS,EAAE;gBACjB,KAAK,YAAY,CAAC;gBAClB,KAAK,gBAAgB;oBACnB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;oBAC/C,MAAM;gBACR;oBACE,MAAM;aACT;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,IAAI,cAAc;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YACpD,OAAO,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,UAAW,CAAC,IAAI,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,UAAW,CAAC,YAAY,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CACH,OAAoD,EACpD,UAAqD;QAErD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAC5D,CAAC;SACH;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,CAAC,OAAO,GAAG,CAAC,GAAgC,EAAQ,EAAE;YAC1D,UAAU,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC,CAAC;QACF,OAAO,MAAM,CAAC,IAA+C,CAAC;IAChE,CAAC;IAED,OAAO,CACL,OAAoD;QAEpD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;SAC1C;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;CACF"}
@@ -0,0 +1,26 @@
1
+ import { VariableInspectionHandler } from './handler';
2
+ import { VariableInspectorPanel } from './widget';
3
+ import { IVariableInspector, IVariableInspectorManager } from './tokens';
4
+ /**
5
+ * A class that manages variable inspector widget instances and offers persistent
6
+ * `IVariableInspector` instance that other plugins can communicate with.
7
+ */
8
+ export declare class VariableInspectorManager implements IVariableInspectorManager {
9
+ private _source;
10
+ private _panel?;
11
+ private _handlers;
12
+ hasHandler(id: string): boolean;
13
+ getHandler(id: string): VariableInspectionHandler;
14
+ addHandler(handler: VariableInspectionHandler): void;
15
+ /**
16
+ * The current inspector panel.
17
+ */
18
+ get panel(): VariableInspectorPanel | undefined;
19
+ set panel(panel: VariableInspectorPanel | undefined);
20
+ /**
21
+ * The source of events the inspector panel listens for.
22
+ */
23
+ get source(): IVariableInspector.IInspectable | null;
24
+ set source(source: IVariableInspector.IInspectable | null);
25
+ private _onSourceDisposed;
26
+ }
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ /**
7
+ * A class that manages variable inspector widget instances and offers persistent
8
+ * `IVariableInspector` instance that other plugins can communicate with.
9
+ */
10
+ export class VariableInspectorManager {
11
+ _source = null;
12
+ _panel;
13
+ _handlers = {};
14
+ hasHandler(id) {
15
+ if (this._handlers[id]) {
16
+ return true;
17
+ }
18
+ else {
19
+ return false;
20
+ }
21
+ }
22
+ getHandler(id) {
23
+ return this._handlers[id];
24
+ }
25
+ addHandler(handler) {
26
+ this._handlers[handler.id] = handler;
27
+ }
28
+ /**
29
+ * The current inspector panel.
30
+ */
31
+ get panel() {
32
+ return this._panel;
33
+ }
34
+ set panel(panel) {
35
+ if (this.panel === panel) {
36
+ return;
37
+ }
38
+ this._panel = panel;
39
+ if (panel && !panel.source) {
40
+ panel.source = this._source;
41
+ }
42
+ }
43
+ /**
44
+ * The source of events the inspector panel listens for.
45
+ */
46
+ get source() {
47
+ return this._source;
48
+ }
49
+ set source(source) {
50
+ if (this._source === source) {
51
+ return;
52
+ }
53
+ // remove subscriptions
54
+ if (this._source) {
55
+ this._source.disposed.disconnect(this._onSourceDisposed, this);
56
+ }
57
+ this._source = source;
58
+ if (this._panel && !this._panel.isDisposed) {
59
+ this._panel.source = this._source;
60
+ }
61
+ // Subscribe to new source
62
+ if (this._source) {
63
+ this._source.disposed.connect(this._onSourceDisposed, this);
64
+ }
65
+ }
66
+ _onSourceDisposed() {
67
+ this._source = null;
68
+ }
69
+ }
70
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../../src/components/kernel/variables/manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAC3B,OAAO,GAA2C,IAAI,CAAC;IACvD,MAAM,CAA0B;IAChC,SAAS,GAAgD,EAAE,CAAC;IAEpE,UAAU,CAAC,EAAU;QACnB,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE;YACtB,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IAED,UAAU,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,UAAU,CAAC,OAAkC;QAC3C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,KAAyC;QACjD,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE;YACxB,OAAO;SACR;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;SAC7B;IACH,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,MAAM,CAAC,MAA8C;QACvD,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE;YAC3B,OAAO;SACR;QAED,uBAAuB;QACvB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;SAChE;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;SACnC;QACD,0BAA0B;QAC1B,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;SAC7D;IACH,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
2
+ import { Kernel, KernelMessage } from '@jupyterlab/services';
3
+ import { DataModel } from '@lumino/datagrid';
4
+ import { IObservableDisposable } from '@lumino/disposable';
5
+ import { ISignal } from '@lumino/signaling';
6
+ import type { VariableInspectionHandler } from './handler';
7
+ export interface IVariableInspectorManager {
8
+ source: IVariableInspector.IInspectable | null;
9
+ hasHandler(id: string): boolean;
10
+ getHandler(id: string): VariableInspectionHandler;
11
+ addHandler(handler: VariableInspectionHandler): void;
12
+ }
13
+ /**
14
+ * An interface for an inspector.
15
+ */
16
+ export interface IVariableInspector {
17
+ source: IVariableInspector.IInspectable | null;
18
+ }
19
+ /**
20
+ * A namespace for inspector interfaces.
21
+ */
22
+ export declare namespace IVariableInspector {
23
+ interface IInspectable extends IObservableDisposable {
24
+ inspected: ISignal<IInspectable, IVariableInspectorUpdate>;
25
+ rendermime: IRenderMimeRegistry | null;
26
+ performInspection(): void;
27
+ performMatrixInspection(varName: string, maxRows?: number): Promise<DataModel>;
28
+ performWidgetInspection(varName: string): Kernel.IShellFuture<KernelMessage.IExecuteRequestMsg, KernelMessage.IExecuteReplyMsg>;
29
+ performDelete(varName: string): void;
30
+ }
31
+ interface IVariableInspectorUpdate {
32
+ title: IVariableTitle;
33
+ payload: Array<IVariable>;
34
+ }
35
+ interface IVariable {
36
+ varName: string;
37
+ varSize: string;
38
+ varShape: string;
39
+ varContent: string;
40
+ varType: string;
41
+ isMatrix: boolean;
42
+ isWidget: boolean;
43
+ }
44
+ interface IVariableTitle {
45
+ kernelName?: string;
46
+ contextName?: string;
47
+ }
48
+ }
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../src/components/kernel/variables/tokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}