@datalayer/jupyter-react 1.1.9 → 1.2.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 (353) hide show
  1. package/README.md +74 -1
  2. package/lib/app/tabs/components/CellComponent.js +4 -2
  3. package/lib/app/tabs/components/CellComponent.js.map +1 -1
  4. package/lib/app/tabs/components/NotebookComponent.js +2 -2
  5. package/lib/app/tabs/components/NotebookComponent.js.map +1 -1
  6. package/lib/app/tabs/components/ViewerComponent.js +1 -1
  7. package/lib/app/tabs/components/ViewerComponent.js.map +1 -1
  8. package/lib/components/cell/Cell.d.ts +3 -3
  9. package/lib/components/cell/Cell.js +5 -12
  10. package/lib/components/cell/Cell.js.map +1 -1
  11. package/lib/components/cell/CellAdapter.d.ts +0 -2
  12. package/lib/components/cell/CellAdapter.js +5 -17
  13. package/lib/components/cell/CellAdapter.js.map +1 -1
  14. package/lib/components/jupyterlab/JupyterLabApp.js +6 -0
  15. package/lib/components/jupyterlab/JupyterLabApp.js.map +1 -1
  16. package/lib/components/kernel/{Kernelndicator.d.ts → KernelIndicator.d.ts} +1 -0
  17. package/lib/components/kernel/{Kernelndicator.js → KernelIndicator.js} +13 -5
  18. package/lib/components/kernel/KernelIndicator.js.map +1 -0
  19. package/lib/components/kernel/index.d.ts +1 -1
  20. package/lib/components/kernel/index.js +1 -1
  21. package/lib/components/kernel/index.js.map +1 -1
  22. package/lib/components/notebook/Notebook2.d.ts +6 -2
  23. package/lib/components/notebook/Notebook2.js +3 -2
  24. package/lib/components/notebook/Notebook2.js.map +1 -1
  25. package/lib/components/notebook/Notebook2Adapter.d.ts +10 -0
  26. package/lib/components/notebook/Notebook2Adapter.js +12 -0
  27. package/lib/components/notebook/Notebook2Adapter.js.map +1 -1
  28. package/lib/components/notebook/Notebook2Base.d.ts +7 -3
  29. package/lib/components/notebook/Notebook2Base.js +78 -48
  30. package/lib/components/notebook/Notebook2Base.js.map +1 -1
  31. package/lib/components/notebook/Notebook2State.d.ts +1 -0
  32. package/lib/components/notebook/Notebook2State.js +3 -0
  33. package/lib/components/notebook/Notebook2State.js.map +1 -1
  34. package/lib/components/notebook/NotebookAdapter.d.ts +1 -0
  35. package/lib/components/notebook/NotebookAdapter.js +7 -3
  36. package/lib/components/notebook/NotebookAdapter.js.map +1 -1
  37. package/lib/components/notebook/NotebookCommands.d.ts +25 -2
  38. package/lib/components/notebook/NotebookCommands.js +89 -10
  39. package/lib/components/notebook/NotebookCommands.js.map +1 -1
  40. package/lib/components/terminal/Terminal.js +1 -1
  41. package/lib/components/terminal/Terminal.js.map +1 -1
  42. package/lib/examples/Bokeh.js +2 -2
  43. package/lib/examples/Bokeh.js.map +1 -1
  44. package/lib/examples/Bqplot.js +2 -2
  45. package/lib/examples/Bqplot.js.map +1 -1
  46. package/lib/examples/Cell.js +4 -4
  47. package/lib/examples/Cell.js.map +1 -1
  48. package/lib/examples/CellLite.js +16 -4
  49. package/lib/examples/CellLite.js.map +1 -1
  50. package/lib/examples/Cells.js +9 -6
  51. package/lib/examples/Cells.js.map +1 -1
  52. package/lib/examples/CellsExecute.js +13 -9
  53. package/lib/examples/CellsExecute.js.map +1 -1
  54. package/lib/examples/Console.js +2 -2
  55. package/lib/examples/Console.js.map +1 -1
  56. package/lib/examples/ConsoleLite.js +3 -3
  57. package/lib/examples/ConsoleLite.js.map +1 -1
  58. package/lib/examples/Dashboard.js +2 -2
  59. package/lib/examples/Dashboard.js.map +1 -1
  60. package/lib/examples/Deno.js +2 -2
  61. package/lib/examples/Deno.js.map +1 -1
  62. package/lib/examples/Examples.d.ts +23 -0
  63. package/lib/examples/Examples.js +342 -0
  64. package/lib/examples/Examples.js.map +1 -0
  65. package/lib/examples/FileBrowser.js +4 -4
  66. package/lib/examples/FileBrowser.js.map +1 -1
  67. package/lib/examples/GeoJson.js +2 -2
  68. package/lib/examples/GeoJson.js.map +1 -1
  69. package/lib/examples/IPyLeaflet.js +3 -3
  70. package/lib/examples/IPyLeaflet.js.map +1 -1
  71. package/lib/examples/IPyReact.js +3 -3
  72. package/lib/examples/IPyReact.js.map +1 -1
  73. package/lib/examples/IPyWidgets.js +3 -3
  74. package/lib/examples/IPyWidgets.js.map +1 -1
  75. package/lib/examples/IPyWidgetsState.js +3 -3
  76. package/lib/examples/IPyWidgetsState.js.map +1 -1
  77. package/lib/examples/JupyterContext.js +2 -2
  78. package/lib/examples/JupyterContext.js.map +1 -1
  79. package/lib/examples/JupyterLabAppHeadless.js +2 -2
  80. package/lib/examples/JupyterLabAppHeadless.js.map +1 -1
  81. package/lib/examples/JupyterLabAppHeadlessServerless.js +2 -2
  82. package/lib/examples/JupyterLabAppHeadlessServerless.js.map +1 -1
  83. package/lib/examples/JupyterLabAppServerless.js +2 -2
  84. package/lib/examples/JupyterLabAppServerless.js.map +1 -1
  85. package/lib/examples/JupyterLabAppServiceManager.js +2 -2
  86. package/lib/examples/JupyterLabAppServiceManager.js.map +1 -1
  87. package/lib/examples/JupyterLabTheme.js +2 -2
  88. package/lib/examples/JupyterLabTheme.js.map +1 -1
  89. package/lib/examples/KernelExecute.d.ts +1 -1
  90. package/lib/examples/KernelExecute.js +9 -11
  91. package/lib/examples/KernelExecute.js.map +1 -1
  92. package/lib/examples/KernelExecuteLite.d.ts +1 -0
  93. package/lib/examples/KernelExecuteLite.js +51 -0
  94. package/lib/examples/KernelExecuteLite.js.map +1 -0
  95. package/lib/examples/KernelExecutor.js +10 -9
  96. package/lib/examples/KernelExecutor.js.map +1 -1
  97. package/lib/examples/KernelExecutorLite.js +63 -0
  98. package/lib/examples/KernelExecutorLite.js.map +1 -0
  99. package/lib/examples/Kernels.js +6 -5
  100. package/lib/examples/Kernels.js.map +1 -1
  101. package/lib/examples/Lumino.js +2 -2
  102. package/lib/examples/Lumino.js.map +1 -1
  103. package/lib/examples/Matplotlib.js +10 -6
  104. package/lib/examples/Matplotlib.js.map +1 -1
  105. package/lib/examples/Notebook.js +3 -2
  106. package/lib/examples/Notebook.js.map +1 -1
  107. package/lib/examples/Notebook2.js +9 -6
  108. package/lib/examples/Notebook2.js.map +1 -1
  109. package/lib/examples/Notebook2Actions.js +8 -6
  110. package/lib/examples/Notebook2Actions.js.map +1 -1
  111. package/lib/examples/Notebook2Collaborative.js +2 -2
  112. package/lib/examples/Notebook2Collaborative.js.map +1 -1
  113. package/lib/examples/Notebook2Lite.js +19 -14
  114. package/lib/examples/Notebook2Lite.js.map +1 -1
  115. package/lib/examples/NotebookCellSidebar.js +3 -3
  116. package/lib/examples/NotebookCellSidebar.js.map +1 -1
  117. package/lib/examples/NotebookCellToolbar.js +4 -4
  118. package/lib/examples/NotebookCellToolbar.js.map +1 -1
  119. package/lib/examples/NotebookCollaborative.js +2 -2
  120. package/lib/examples/NotebookCollaborative.js.map +1 -1
  121. package/lib/examples/NotebookColormode.js +15 -10
  122. package/lib/examples/NotebookColormode.js.map +1 -1
  123. package/lib/examples/NotebookExtension.js +4 -4
  124. package/lib/examples/NotebookExtension.js.map +1 -1
  125. package/lib/examples/NotebookExternalContent.js +18 -13
  126. package/lib/examples/NotebookExternalContent.js.map +1 -1
  127. package/lib/examples/NotebookInit.js +10 -9
  128. package/lib/examples/NotebookInit.js.map +1 -1
  129. package/lib/examples/NotebookKernel.js +4 -4
  130. package/lib/examples/NotebookKernel.js.map +1 -1
  131. package/lib/examples/NotebookKernelChange.js +2 -2
  132. package/lib/examples/NotebookKernelChange.js.map +1 -1
  133. package/lib/examples/NotebookLess.js +4 -4
  134. package/lib/examples/NotebookLess.js.map +1 -1
  135. package/lib/examples/NotebookLite.js +10 -6
  136. package/lib/examples/NotebookLite.js.map +1 -1
  137. package/lib/examples/NotebookLiteContext.js +10 -5
  138. package/lib/examples/NotebookLiteContext.js.map +1 -1
  139. package/lib/examples/NotebookLocalServer.js +3 -3
  140. package/lib/examples/NotebookLocalServer.js.map +1 -1
  141. package/lib/examples/NotebookNbformat.js +7 -5
  142. package/lib/examples/NotebookNbformat.js.map +1 -1
  143. package/lib/examples/NotebookNbformatChange.js +12 -6
  144. package/lib/examples/NotebookNbformatChange.js.map +1 -1
  145. package/lib/examples/NotebookNoContext.js +4 -3
  146. package/lib/examples/NotebookNoContext.js.map +1 -1
  147. package/lib/examples/NotebookNoPrimer.js +3 -2
  148. package/lib/examples/NotebookNoPrimer.js.map +1 -1
  149. package/lib/examples/NotebookOnSessionConnection.js +5 -5
  150. package/lib/examples/NotebookOnSessionConnection.js.map +1 -1
  151. package/lib/examples/NotebookPath.js +2 -2
  152. package/lib/examples/NotebookPath.js.map +1 -1
  153. package/lib/examples/NotebookPathChange.js +5 -4
  154. package/lib/examples/NotebookPathChange.js.map +1 -1
  155. package/lib/examples/NotebookReadonly.js +4 -4
  156. package/lib/examples/NotebookReadonly.js.map +1 -1
  157. package/lib/examples/NotebookServiceManager.js +4 -4
  158. package/lib/examples/NotebookServiceManager.js.map +1 -1
  159. package/lib/examples/NotebookSkeleton.js +3 -2
  160. package/lib/examples/NotebookSkeleton.js.map +1 -1
  161. package/lib/examples/NotebookTOC.d.ts +1 -0
  162. package/lib/examples/{NotebookToc.js → NotebookTOC.js} +12 -6
  163. package/lib/examples/NotebookTOC.js.map +1 -0
  164. package/lib/examples/NotebookTheme.js +10 -5
  165. package/lib/examples/NotebookTheme.js.map +1 -1
  166. package/lib/examples/NotebookThemeColormode.js +4 -4
  167. package/lib/examples/NotebookThemeColormode.js.map +1 -1
  168. package/lib/examples/NotebookURL.js +3 -2
  169. package/lib/examples/NotebookURL.js.map +1 -1
  170. package/lib/examples/NotebookUnmount.js +13 -7
  171. package/lib/examples/NotebookUnmount.js.map +1 -1
  172. package/lib/examples/ObservableHQ.js +2 -2
  173. package/lib/examples/ObservableHQ.js.map +1 -1
  174. package/lib/examples/OutputIPyWidgets.js +3 -3
  175. package/lib/examples/OutputIPyWidgets.js.map +1 -1
  176. package/lib/examples/OutputWithMonitoring.js +3 -2
  177. package/lib/examples/OutputWithMonitoring.js.map +1 -1
  178. package/lib/examples/Outputs.js +8 -8
  179. package/lib/examples/Outputs.js.map +1 -1
  180. package/lib/examples/OutputsIpynb.js +4 -4
  181. package/lib/examples/OutputsIpynb.js.map +1 -1
  182. package/lib/examples/Panel.js +2 -2
  183. package/lib/examples/Panel.js.map +1 -1
  184. package/lib/examples/Plotly.js +2 -2
  185. package/lib/examples/Plotly.js.map +1 -1
  186. package/lib/examples/PyGWalker.js +4 -4
  187. package/lib/examples/PyGWalker.js.map +1 -1
  188. package/lib/examples/Terminal.js +4 -3
  189. package/lib/examples/Terminal.js.map +1 -1
  190. package/lib/examples/Vega.js +2 -2
  191. package/lib/examples/Vega.js.map +1 -1
  192. package/lib/examples/Viewer.js +5 -4
  193. package/lib/examples/Viewer.js.map +1 -1
  194. package/lib/jupyter/JupyterConfig.js +6 -4
  195. package/lib/jupyter/JupyterConfig.js.map +1 -1
  196. package/lib/jupyter/collaboration/ICollaborationProvider.js.map +1 -1
  197. package/lib/jupyter/kernel/Kernel.js +21 -15
  198. package/lib/jupyter/kernel/Kernel.js.map +1 -1
  199. package/lib/jupyter/kernel/KernelState.d.ts +1 -1
  200. package/lib/jupyter/lite/Lite.d.ts +1 -1
  201. package/lib/jupyter/lite/LiteServer.d.ts +1 -1
  202. package/lib/jupyter/lite/LiteServer.js +20 -5
  203. package/lib/jupyter/lite/LiteServer.js.map +1 -1
  204. package/lib/jupyter/lite/contents/broadcast.d.ts +27 -0
  205. package/lib/jupyter/lite/contents/broadcast.js +60 -0
  206. package/lib/jupyter/lite/contents/broadcast.js.map +1 -0
  207. package/lib/jupyter/lite/contents/contents.d.ts +228 -0
  208. package/lib/jupyter/lite/contents/contents.js +774 -0
  209. package/lib/jupyter/lite/contents/contents.js.map +1 -0
  210. package/lib/jupyter/lite/contents/drivecontents.d.ts +92 -0
  211. package/lib/jupyter/lite/contents/drivecontents.js +133 -0
  212. package/lib/jupyter/lite/contents/drivecontents.js.map +1 -0
  213. package/lib/jupyter/lite/contents/drivefs.d.ts +193 -0
  214. package/lib/jupyter/lite/contents/drivefs.js +432 -0
  215. package/lib/jupyter/lite/contents/drivefs.js.map +1 -0
  216. package/lib/jupyter/lite/contents/emscripten.d.ts +89 -0
  217. package/lib/jupyter/lite/contents/emscripten.js +11 -0
  218. package/lib/jupyter/lite/contents/emscripten.js.map +1 -0
  219. package/lib/jupyter/lite/contents/index.d.ts +6 -0
  220. package/lib/jupyter/lite/contents/index.js +9 -0
  221. package/lib/jupyter/lite/contents/index.js.map +1 -0
  222. package/lib/jupyter/lite/contents/tokens.d.ts +136 -0
  223. package/lib/jupyter/lite/contents/tokens.js +66 -0
  224. package/lib/jupyter/lite/contents/tokens.js.map +1 -0
  225. package/lib/jupyter/lite/kernel/index.d.ts +4 -0
  226. package/lib/jupyter/lite/kernel/index.js +7 -0
  227. package/lib/jupyter/lite/kernel/index.js.map +1 -0
  228. package/lib/jupyter/lite/kernel/kernel.d.ts +245 -0
  229. package/lib/jupyter/lite/kernel/kernel.js +453 -0
  230. package/lib/jupyter/lite/kernel/kernel.js.map +1 -0
  231. package/lib/jupyter/lite/kernel/kernels.d.ts +85 -0
  232. package/lib/jupyter/lite/kernel/kernels.js +218 -0
  233. package/lib/jupyter/lite/kernel/kernels.js.map +1 -0
  234. package/lib/jupyter/lite/kernel/kernelspecs.d.ts +53 -0
  235. package/lib/jupyter/lite/kernel/kernelspecs.js +50 -0
  236. package/lib/jupyter/lite/kernel/kernelspecs.js.map +1 -0
  237. package/lib/jupyter/lite/kernel/tokens.d.ts +171 -0
  238. package/lib/jupyter/lite/kernel/tokens.js +16 -0
  239. package/lib/jupyter/lite/kernel/tokens.js.map +1 -0
  240. package/lib/jupyter/lite/licenses/index.d.ts +2 -0
  241. package/lib/jupyter/lite/licenses/index.js +5 -0
  242. package/lib/jupyter/lite/licenses/index.js.map +1 -0
  243. package/lib/jupyter/lite/licenses/licenses.d.ts +35 -0
  244. package/lib/jupyter/lite/licenses/licenses.js +95 -0
  245. package/lib/jupyter/lite/licenses/licenses.js.map +1 -0
  246. package/lib/jupyter/lite/licenses/tokens.d.ts +74 -0
  247. package/lib/jupyter/lite/licenses/tokens.js +13 -0
  248. package/lib/jupyter/lite/licenses/tokens.js.map +1 -0
  249. package/lib/jupyter/lite/localforage/index.d.ts +2 -0
  250. package/lib/jupyter/lite/localforage/index.js +5 -0
  251. package/lib/jupyter/lite/localforage/index.js.map +1 -0
  252. package/lib/jupyter/lite/localforage/memory.d.ts +5 -0
  253. package/lib/jupyter/lite/localforage/memory.js +10 -0
  254. package/lib/jupyter/lite/localforage/memory.js.map +1 -0
  255. package/lib/jupyter/lite/localforage/tokens.d.ts +12 -0
  256. package/lib/jupyter/lite/localforage/tokens.js +8 -0
  257. package/lib/jupyter/lite/localforage/tokens.js.map +1 -0
  258. package/lib/jupyter/lite/pyodide-kernel/_pypi.d.ts +18 -0
  259. package/lib/jupyter/lite/pyodide-kernel/_pypi.js +85 -0
  260. package/lib/jupyter/lite/pyodide-kernel/_pypi.js.map +1 -0
  261. package/lib/jupyter/lite/pyodide-kernel/coincident.worker.d.ts +15 -0
  262. package/lib/jupyter/lite/pyodide-kernel/coincident.worker.js +63 -0
  263. package/lib/jupyter/lite/pyodide-kernel/coincident.worker.js.map +1 -0
  264. package/lib/jupyter/lite/pyodide-kernel/comlink.worker.d.ts +9 -0
  265. package/lib/jupyter/lite/pyodide-kernel/comlink.worker.js +50 -0
  266. package/lib/jupyter/lite/pyodide-kernel/comlink.worker.js.map +1 -0
  267. package/lib/jupyter/lite/pyodide-kernel/index.d.ts +6 -0
  268. package/lib/jupyter/lite/pyodide-kernel/index.js +9 -0
  269. package/lib/jupyter/lite/pyodide-kernel/index.js.map +1 -0
  270. package/lib/jupyter/lite/pyodide-kernel/kernel.d.ts +157 -0
  271. package/lib/jupyter/lite/pyodide-kernel/kernel.js +294 -0
  272. package/lib/jupyter/lite/pyodide-kernel/kernel.js.map +1 -0
  273. package/lib/jupyter/lite/pyodide-kernel/pypi/all-local.json +128 -0
  274. package/lib/jupyter/lite/pyodide-kernel/pypi/all.json +128 -0
  275. package/lib/jupyter/lite/pyodide-kernel/schema/piplite.v0.schema.json +113 -0
  276. package/lib/jupyter/lite/pyodide-kernel/tokens.d.ts +82 -0
  277. package/lib/jupyter/lite/pyodide-kernel/tokens.js +8 -0
  278. package/lib/jupyter/lite/pyodide-kernel/tokens.js.map +1 -0
  279. package/lib/jupyter/lite/pyodide-kernel/worker.d.ts +138 -0
  280. package/lib/jupyter/lite/pyodide-kernel/worker.js +426 -0
  281. package/lib/jupyter/lite/pyodide-kernel/worker.js.map +1 -0
  282. package/lib/jupyter/lite/pyodide-kernel-extension/index.d.ts +4 -0
  283. package/lib/jupyter/lite/pyodide-kernel-extension/index.js +88 -0
  284. package/lib/jupyter/lite/pyodide-kernel-extension/index.js.map +1 -0
  285. package/lib/jupyter/lite/server/app.d.ts +87 -0
  286. package/lib/jupyter/lite/server/app.js +157 -0
  287. package/lib/jupyter/lite/server/app.js.map +1 -0
  288. package/lib/jupyter/lite/server/index.d.ts +4 -0
  289. package/lib/jupyter/lite/server/index.js +7 -0
  290. package/lib/jupyter/lite/server/index.js.map +1 -0
  291. package/lib/jupyter/lite/server/router.d.ts +99 -0
  292. package/lib/jupyter/lite/server/router.js +109 -0
  293. package/lib/jupyter/lite/server/router.js.map +1 -0
  294. package/lib/jupyter/lite/server/service-manager.d.ts +21 -0
  295. package/lib/jupyter/lite/server/service-manager.js +102 -0
  296. package/lib/jupyter/lite/server/service-manager.js.map +1 -0
  297. package/lib/jupyter/lite/server/service-worker.d.ts +58 -0
  298. package/lib/jupyter/lite/server/service-worker.js +145 -0
  299. package/lib/jupyter/lite/server/service-worker.js.map +1 -0
  300. package/lib/jupyter/lite/server/status.d.ts +18 -0
  301. package/lib/jupyter/lite/server/status.js +21 -0
  302. package/lib/jupyter/lite/server/status.js.map +1 -0
  303. package/lib/jupyter/lite/server/tokens.d.ts +38 -0
  304. package/lib/jupyter/lite/server/tokens.js +8 -0
  305. package/lib/jupyter/lite/server/tokens.js.map +1 -0
  306. package/lib/jupyter/lite/server-extension/index.d.ts +3 -0
  307. package/lib/jupyter/lite/server-extension/index.js +500 -0
  308. package/lib/jupyter/lite/server-extension/index.js.map +1 -0
  309. package/lib/jupyter/lite/session/index.d.ts +2 -0
  310. package/lib/jupyter/lite/session/index.js +5 -0
  311. package/lib/jupyter/lite/session/index.js.map +1 -0
  312. package/lib/jupyter/lite/session/sessions.d.ts +68 -0
  313. package/lib/jupyter/lite/session/sessions.js +185 -0
  314. package/lib/jupyter/lite/session/sessions.js.map +1 -0
  315. package/lib/jupyter/lite/session/tokens.d.ts +40 -0
  316. package/lib/jupyter/lite/session/tokens.js +6 -0
  317. package/lib/jupyter/lite/session/tokens.js.map +1 -0
  318. package/lib/jupyter/lite/settings/index.d.ts +2 -0
  319. package/lib/jupyter/lite/settings/index.js +5 -0
  320. package/lib/jupyter/lite/settings/index.js.map +1 -0
  321. package/lib/jupyter/lite/settings/settings.d.ts +75 -0
  322. package/lib/jupyter/lite/settings/settings.js +155 -0
  323. package/lib/jupyter/lite/settings/settings.js.map +1 -0
  324. package/lib/jupyter/lite/settings/tokens.d.ts +65 -0
  325. package/lib/jupyter/lite/settings/tokens.js +6 -0
  326. package/lib/jupyter/lite/settings/tokens.js.map +1 -0
  327. package/lib/jupyter/lite/translation/index.d.ts +2 -0
  328. package/lib/jupyter/lite/translation/index.js +5 -0
  329. package/lib/jupyter/lite/translation/index.js.map +1 -0
  330. package/lib/jupyter/lite/translation/tokens.d.ts +17 -0
  331. package/lib/jupyter/lite/translation/tokens.js +6 -0
  332. package/lib/jupyter/lite/translation/tokens.js.map +1 -0
  333. package/lib/jupyter/lite/translation/translation.d.ts +13 -0
  334. package/lib/jupyter/lite/translation/translation.js +52 -0
  335. package/lib/jupyter/lite/translation/translation.js.map +1 -0
  336. package/lib/jupyter/lite/types/index.d.ts +1 -0
  337. package/lib/jupyter/lite/types/index.js +4 -0
  338. package/lib/jupyter/lite/types/index.js.map +1 -0
  339. package/lib/jupyter/lite/types/tokens.d.ts +27 -0
  340. package/lib/jupyter/lite/types/tokens.js +4 -0
  341. package/lib/jupyter/lite/types/tokens.js.map +1 -0
  342. package/lib/jupyter/services/ServiceManagerLite.js +15 -6
  343. package/lib/jupyter/services/ServiceManagerLite.js.map +1 -1
  344. package/lib/state/JupyterReactState.js +7 -8
  345. package/lib/state/JupyterReactState.js.map +1 -1
  346. package/lib/theme/JupyterLabCss.js +4 -2
  347. package/lib/theme/JupyterLabCss.js.map +1 -1
  348. package/package.json +23 -16
  349. package/schema/kernel.v0.schema.json +42 -0
  350. package/style/icons/pyodide.svg +17 -0
  351. package/lib/components/kernel/Kernelndicator.js.map +0 -1
  352. package/lib/examples/NotebookToc.js.map +0 -1
  353. /package/lib/examples/{NotebookToc.d.ts → KernelExecutorLite.d.ts} +0 -0
@@ -0,0 +1,88 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { PageConfig, URLExt } from '@jupyterlab/coreutils';
4
+ import { IServiceWorkerManager, } from '../server';
5
+ import { IKernelSpecs } from '../kernel';
6
+ import { IBroadcastChannelWrapper } from '../contents';
7
+ // @ts-expect-error - JSON import is not typed
8
+ export * as KERNEL_SETTINGS_SCHEMA from '../../../../schema/kernel.v0.schema.json';
9
+ import KERNEL_ICON_SVG_STR from '../../../../style/icons/pyodide.svg';
10
+ const KERNEL_ICON_URL = `data:image/svg+xml;base64,${btoa(KERNEL_ICON_SVG_STR)}`;
11
+ /**
12
+ * The default CDN fallback for Pyodide
13
+ */
14
+ const PYODIDE_CDN_URL = 'https://cdn.jsdelivr.net/pyodide/v0.27.1/full/pyodide.js';
15
+ /**
16
+ * The id for the extension, and key in the litePlugins.
17
+ */
18
+ const PLUGIN_ID = '@jupyterlite/pyodide-kernel-extension:kernel';
19
+ /**
20
+ * A plugin to register the Pyodide kernel.
21
+ */
22
+ const kernel = {
23
+ id: PLUGIN_ID,
24
+ autoStart: true,
25
+ requires: [IKernelSpecs],
26
+ optional: [IServiceWorkerManager, IBroadcastChannelWrapper],
27
+ activate: (app, kernelspecs, serviceWorker, broadcastChannel) => {
28
+ const contentsManager = app.serviceManager.contents;
29
+ const config = JSON.parse(PageConfig.getOption('litePluginSettings') || '{}')[PLUGIN_ID] || {};
30
+ const baseUrl = PageConfig.getBaseUrl();
31
+ const url = config.pyodideUrl || PYODIDE_CDN_URL;
32
+ const pyodideUrl = URLExt.parse(url).href;
33
+ const pipliteWheelUrl = config.pipliteWheelUrl
34
+ ? URLExt.parse(config.pipliteWheelUrl).href
35
+ : undefined;
36
+ const rawPipUrls = config.pipliteUrls || [];
37
+ const pipliteUrls = rawPipUrls.map((pipUrl) => URLExt.parse(pipUrl).href);
38
+ const disablePyPIFallback = !!config.disablePyPIFallback;
39
+ const loadPyodideOptions = config.loadPyodideOptions || {};
40
+ for (const [key, value] of Object.entries(loadPyodideOptions)) {
41
+ if (key.endsWith('URL') && typeof value === 'string') {
42
+ loadPyodideOptions[key] = new URL(value, baseUrl).href;
43
+ }
44
+ }
45
+ kernelspecs.register({
46
+ spec: {
47
+ name: 'python',
48
+ display_name: 'Python (Pyodide)',
49
+ language: 'python',
50
+ argv: [],
51
+ resources: {
52
+ 'logo-32x32': KERNEL_ICON_URL,
53
+ 'logo-64x64': KERNEL_ICON_URL,
54
+ },
55
+ },
56
+ create: async (options) => {
57
+ const { PyodideKernel } = await import('../pyodide-kernel/index');
58
+ /*
59
+ TODO Restore this...
60
+ const mountDrive = !!(
61
+ (serviceWorker?.enabled && broadcastChannel?.enabled) ||
62
+ crossOriginIsolated
63
+ );
64
+ */
65
+ const mountDrive = false;
66
+ if (mountDrive) {
67
+ console.info('Pyodide contents will be synced with Jupyter Contents');
68
+ }
69
+ else {
70
+ console.warn('Pyodide contents will NOT be synced with Jupyter Contents');
71
+ }
72
+ return new PyodideKernel({
73
+ ...options,
74
+ pyodideUrl,
75
+ pipliteWheelUrl,
76
+ pipliteUrls,
77
+ disablePyPIFallback,
78
+ mountDrive,
79
+ loadPyodideOptions,
80
+ contentsManager,
81
+ });
82
+ },
83
+ });
84
+ },
85
+ };
86
+ const plugins = [kernel];
87
+ export default plugins;
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/pyodide-kernel-extension/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,qBAAqB,GAGtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAW,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,8CAA8C;AAC9C,OAAO,KAAK,sBAAsB,MAAM,0CAA0C,CAAC;AAEnF,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AAEtE,MAAM,eAAe,GAAG,6BAA6B,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC;AAEjF;;GAEG;AACH,MAAM,eAAe,GACnB,0DAA0D,CAAC;AAE7D;;GAEG;AACH,MAAM,SAAS,GAAG,8CAA8C,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,GAAkC;IAC5C,EAAE,EAAE,SAAS;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,CAAC,YAAY,CAAC;IACxB,QAAQ,EAAE,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;IAC3D,QAAQ,EAAE,CACR,GAAsB,EACtB,WAAyB,EACzB,aAAqC,EACrC,gBAA2C,EAC3C,EAAE;QACF,MAAM,eAAe,GAAG,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC;QAEpD,MAAM,MAAM,GACV,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC,CAC5D,SAAS,CACV,IAAI,EAAE,CAAC;QAEV,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC;QAEx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D,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;gBAClE;;;;;;kBAME;gBACF,MAAM,UAAU,GAAG,KAAK,CAAC;gBAEzB,IAAI,UAAU,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;gBACxE,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,IAAI,CACV,2DAA2D,CAC5D,CAAC;gBACJ,CAAC;gBAED,OAAO,IAAI,aAAa,CAAC;oBACvB,GAAG,OAAO;oBACV,UAAU;oBACV,eAAe;oBACf,WAAW;oBACX,mBAAmB;oBACnB,UAAU;oBACV,kBAAkB;oBAClB,eAAe;iBAChB,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,MAAM,OAAO,GAAmC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAe,OAAO,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { ServiceManager } from '@jupyterlab/services';
2
+ import { Application, IPlugin } from '@lumino/application';
3
+ import { Router } from './router';
4
+ /**
5
+ * Server is the main application class. It is instantiated once and shared.
6
+ */
7
+ export declare class JupyterLiteServer extends Application<never> {
8
+ /**
9
+ * Construct a new JupyterLite object.
10
+ *
11
+ * @param options The instantiation options for a JupyterLiteServer application.
12
+ */
13
+ constructor(options: Application.IOptions<never>);
14
+ /**
15
+ * The name of the application.
16
+ */
17
+ readonly name = "JupyterLite Server";
18
+ /**
19
+ * A namespace/prefix plugins may use to denote their provenance.
20
+ */
21
+ readonly namespace = "JupyterLite Server";
22
+ /**
23
+ * The version of the application.
24
+ */
25
+ readonly version = "unknown";
26
+ /**
27
+ * Get the underlying `Router` instance.
28
+ */
29
+ get router(): Router;
30
+ /**
31
+ * Get the underlying lite service manager for this app.
32
+ */
33
+ get serviceManager(): ServiceManager;
34
+ /**
35
+ * Handle an incoming request from the client.
36
+ *
37
+ * @param req The incoming request
38
+ * @param init The optional init request
39
+ */
40
+ fetch(req: RequestInfo, init?: RequestInit | null | undefined): Promise<Response>;
41
+ /**
42
+ * Attach the application shell to the DOM.
43
+ *
44
+ * @param id - The id of the host node for the shell, or `''`.
45
+ *
46
+ * #### Notes
47
+ * For this server application there is no shell to attach
48
+ */
49
+ protected attachShell(id: string): void;
50
+ /**
51
+ * A method invoked on a window `'resize'` event.
52
+ *
53
+ * #### Notes
54
+ * For this server application there is no shell to update
55
+ */
56
+ protected evtResize(event: Event): void;
57
+ /**
58
+ * Register plugins from a plugin module.
59
+ *
60
+ * @param mod - The plugin module to register.
61
+ */
62
+ registerPluginModule(mod: JupyterLiteServer.IPluginModule): void;
63
+ /**
64
+ * Register the plugins from multiple plugin modules.
65
+ *
66
+ * @param mods - The plugin modules to register.
67
+ */
68
+ registerPluginModules(mods: JupyterLiteServer.IPluginModule[]): void;
69
+ private _router;
70
+ private _serviceManager;
71
+ }
72
+ /**
73
+ * A namespace for Server statics.
74
+ */
75
+ export declare namespace JupyterLiteServer {
76
+ /**
77
+ * The interface for a module that exports a plugin or plugins as
78
+ * the default value.
79
+ */
80
+ interface IPluginModule {
81
+ /**
82
+ * The default export.
83
+ */
84
+ default: IPlugin<JupyterLiteServer, any> | IPlugin<JupyterLiteServer, any>[];
85
+ }
86
+ }
87
+ export type JupyterLiteServerPlugin<T> = IPlugin<JupyterLiteServer, T>;
@@ -0,0 +1,157 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { ServerConnection, ServiceManager } from '@jupyterlab/services';
4
+ import { Application } from '@lumino/application';
5
+ import { Signal, Stream } from '@lumino/signaling';
6
+ import { WebSocket } from 'mock-socket';
7
+ import { Router } from './router';
8
+ /**
9
+ * A local event manager service.
10
+ *
11
+ * #### Notes
12
+ * Schema IDs are not verified and all client-emitted events emit.
13
+ */
14
+ class LocalEventManager {
15
+ constructor(options) {
16
+ this._serverSettings = options.serverSettings;
17
+ this._stream = new Stream(this);
18
+ }
19
+ async emit({ data, schema_id }) {
20
+ this._stream.emit({ ...data, schema_id });
21
+ }
22
+ dispose() {
23
+ if (this.isDisposed) {
24
+ return;
25
+ }
26
+ this._isDisposed = true;
27
+ Signal.clearData(this);
28
+ this._stream.stop();
29
+ }
30
+ get isDisposed() {
31
+ return this._isDisposed;
32
+ }
33
+ get stream() {
34
+ return this._stream;
35
+ }
36
+ get serverSettings() {
37
+ return this._serverSettings;
38
+ }
39
+ _isDisposed = false;
40
+ _serverSettings;
41
+ _stream;
42
+ }
43
+ /**
44
+ * Server is the main application class. It is instantiated once and shared.
45
+ */
46
+ export class JupyterLiteServer extends Application {
47
+ /**
48
+ * Construct a new JupyterLite object.
49
+ *
50
+ * @param options The instantiation options for a JupyterLiteServer application.
51
+ */
52
+ constructor(options) {
53
+ super(options);
54
+ const serverSettings = {
55
+ ...ServerConnection.makeSettings(),
56
+ WebSocket,
57
+ fetch: this.fetch.bind(this) ?? undefined,
58
+ };
59
+ this._serviceManager = new ServiceManager({
60
+ standby: 'never',
61
+ serverSettings,
62
+ events: new LocalEventManager({ serverSettings }),
63
+ });
64
+ }
65
+ /**
66
+ * The name of the application.
67
+ */
68
+ name = 'JupyterLite Server';
69
+ /**
70
+ * A namespace/prefix plugins may use to denote their provenance.
71
+ */
72
+ namespace = this.name;
73
+ /**
74
+ * The version of the application.
75
+ */
76
+ version = 'unknown';
77
+ /**
78
+ * Get the underlying `Router` instance.
79
+ */
80
+ get router() {
81
+ return this._router;
82
+ }
83
+ /**
84
+ * Get the underlying lite service manager for this app.
85
+ */
86
+ get serviceManager() {
87
+ return this._serviceManager;
88
+ }
89
+ /**
90
+ * Handle an incoming request from the client.
91
+ *
92
+ * @param req The incoming request
93
+ * @param init The optional init request
94
+ */
95
+ async fetch(req, init) {
96
+ if (!(req instanceof Request)) {
97
+ throw Error('Request info is not a Request');
98
+ }
99
+ return this._router.route(req);
100
+ }
101
+ /**
102
+ * Attach the application shell to the DOM.
103
+ *
104
+ * @param id - The id of the host node for the shell, or `''`.
105
+ *
106
+ * #### Notes
107
+ * For this server application there is no shell to attach
108
+ */
109
+ attachShell(id) {
110
+ // no-op
111
+ }
112
+ /**
113
+ * A method invoked on a window `'resize'` event.
114
+ *
115
+ * #### Notes
116
+ * For this server application there is no shell to update
117
+ */
118
+ evtResize(event) {
119
+ // no-op
120
+ }
121
+ /**
122
+ * Register plugins from a plugin module.
123
+ *
124
+ * @param mod - The plugin module to register.
125
+ */
126
+ registerPluginModule(mod) {
127
+ let data = mod.default;
128
+ // Handle commonjs exports.
129
+ if (!Object.prototype.hasOwnProperty.call(mod, '__esModule')) {
130
+ data = mod;
131
+ }
132
+ if (!Array.isArray(data)) {
133
+ data = [data];
134
+ }
135
+ data.forEach(item => {
136
+ try {
137
+ this.registerPlugin(item);
138
+ }
139
+ catch (error) {
140
+ console.error(error);
141
+ }
142
+ });
143
+ }
144
+ /**
145
+ * Register the plugins from multiple plugin modules.
146
+ *
147
+ * @param mods - The plugin modules to register.
148
+ */
149
+ registerPluginModules(mods) {
150
+ mods.forEach(mod => {
151
+ this.registerPluginModule(mod);
152
+ });
153
+ }
154
+ _router = new Router();
155
+ _serviceManager;
156
+ }
157
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/server/app.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAS,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;GAKG;AACH,MAAM,iBAAiB;IACrB,YAAY,OAAuD;QACjE,IAAI,CAAC,eAAe,GAA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CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,qBAAqB,CAAC,IAAuC;QAC3D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACjB,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,OAAO,GAAG,IAAI,MAAM,EAAE,CAAC;IACvB,eAAe,CAAiB;CACzC"}
@@ -0,0 +1,4 @@
1
+ export * from './app';
2
+ export * from './router';
3
+ export * from './tokens';
4
+ export * from './service-manager';
@@ -0,0 +1,7 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ export * from './app';
4
+ export * from './router';
5
+ export * from './tokens';
6
+ export * from './service-manager';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/server/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { ReadonlyJSONObject } from '@lumino/coreutils';
2
+ /**
3
+ * A simple router.
4
+ */
5
+ export declare class Router {
6
+ /**
7
+ * Add a new GET route
8
+ *
9
+ * @param pattern The pattern to match
10
+ * @param callback The function to call on pattern match
11
+ *
12
+ */
13
+ get(pattern: string | RegExp, callback: Router.Callback): void;
14
+ /**
15
+ * Add a new PUT route
16
+ *
17
+ * @param pattern The pattern to match
18
+ * @param callback The function to call on pattern match
19
+ *
20
+ */
21
+ put(pattern: string | RegExp, callback: Router.Callback): void;
22
+ /**
23
+ * Add a new POST route
24
+ *
25
+ * @param pattern The pattern to match
26
+ * @param callback The function to call on pattern match
27
+ *
28
+ */
29
+ post(pattern: string | RegExp, callback: Router.Callback): void;
30
+ /**
31
+ * Add a new PATCH route
32
+ *
33
+ * @param pattern The pattern to match
34
+ * @param callback The function to call on pattern match
35
+ *
36
+ */
37
+ patch(pattern: string | RegExp, callback: Router.Callback): void;
38
+ /**
39
+ * Add a new DELETE route
40
+ *
41
+ * @param pattern The pattern to match
42
+ * @param callback The function to call on pattern match
43
+ *
44
+ */
45
+ delete(pattern: string | RegExp, callback: Router.Callback): void;
46
+ /**
47
+ * Route a request.
48
+ *
49
+ * @param req The request to route.
50
+ */
51
+ route(req: Request): Promise<Response>;
52
+ /**
53
+ * Add a new route.
54
+ *
55
+ * @param method The method
56
+ * @param pattern The pattern
57
+ * @param callback The callback
58
+ */
59
+ private _add;
60
+ private _routes;
61
+ }
62
+ /**
63
+ * A namespace for Router statics.
64
+ */
65
+ export declare namespace Router {
66
+ /**
67
+ * The Callback type.
68
+ */
69
+ type Callback = (req: IRequest, ...args: string[]) => Promise<Response>;
70
+ /**
71
+ * The Method type.
72
+ */
73
+ type Method = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';
74
+ /**
75
+ * The interface for a parsed request
76
+ */
77
+ interface IRequest {
78
+ /**
79
+ * The path for the url.
80
+ */
81
+ pathname: string;
82
+ /**
83
+ * The optional query parameters.
84
+ */
85
+ query?: ReadonlyJSONObject;
86
+ /**
87
+ * The optional body parameters.
88
+ */
89
+ body?: ReadonlyJSONObject;
90
+ }
91
+ /**
92
+ * An interface for a route.
93
+ */
94
+ interface IRoute {
95
+ method: Method;
96
+ pattern: string | RegExp;
97
+ callback: Callback;
98
+ }
99
+ }
@@ -0,0 +1,109 @@
1
+ /**
2
+ * A simple router.
3
+ */
4
+ export class Router {
5
+ /**
6
+ * Add a new GET route
7
+ *
8
+ * @param pattern The pattern to match
9
+ * @param callback The function to call on pattern match
10
+ *
11
+ */
12
+ get(pattern, callback) {
13
+ this._add('GET', pattern, callback);
14
+ }
15
+ /**
16
+ * Add a new PUT route
17
+ *
18
+ * @param pattern The pattern to match
19
+ * @param callback The function to call on pattern match
20
+ *
21
+ */
22
+ put(pattern, callback) {
23
+ this._add('PUT', pattern, callback);
24
+ }
25
+ /**
26
+ * Add a new POST route
27
+ *
28
+ * @param pattern The pattern to match
29
+ * @param callback The function to call on pattern match
30
+ *
31
+ */
32
+ post(pattern, callback) {
33
+ this._add('POST', pattern, callback);
34
+ }
35
+ /**
36
+ * Add a new PATCH route
37
+ *
38
+ * @param pattern The pattern to match
39
+ * @param callback The function to call on pattern match
40
+ *
41
+ */
42
+ patch(pattern, callback) {
43
+ this._add('PATCH', pattern, callback);
44
+ }
45
+ /**
46
+ * Add a new DELETE route
47
+ *
48
+ * @param pattern The pattern to match
49
+ * @param callback The function to call on pattern match
50
+ *
51
+ */
52
+ delete(pattern, callback) {
53
+ this._add('DELETE', pattern, callback);
54
+ }
55
+ /**
56
+ * Route a request.
57
+ *
58
+ * @param req The request to route.
59
+ */
60
+ async route(req) {
61
+ const url = new URL(req.url);
62
+ const { method } = req;
63
+ const { pathname } = url;
64
+ for (const r of this._routes) {
65
+ if (r.method !== method) {
66
+ continue;
67
+ }
68
+ const match = pathname.match(r.pattern);
69
+ if (!match) {
70
+ continue;
71
+ }
72
+ const matches = match.slice(1);
73
+ let body;
74
+ if (r.method === 'PATCH' || r.method === 'PUT' || r.method === 'POST') {
75
+ try {
76
+ body = JSON.parse(await req.text());
77
+ }
78
+ catch {
79
+ body = undefined;
80
+ }
81
+ }
82
+ return r.callback.call(null, {
83
+ pathname,
84
+ body,
85
+ query: Object.fromEntries(url.searchParams),
86
+ }, ...matches);
87
+ }
88
+ throw new Error('Cannot route ' + req.method + ' ' + req.url);
89
+ }
90
+ /**
91
+ * Add a new route.
92
+ *
93
+ * @param method The method
94
+ * @param pattern The pattern
95
+ * @param callback The callback
96
+ */
97
+ _add(method, pattern, callback) {
98
+ if (typeof pattern === 'string') {
99
+ pattern = new RegExp(pattern);
100
+ }
101
+ this._routes.push({
102
+ method,
103
+ pattern,
104
+ callback,
105
+ });
106
+ }
107
+ _routes = [];
108
+ }
109
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/server/router.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,MAAM;IACjB;;;;;;OAMG;IACH,GAAG,CAAC,OAAwB,EAAE,QAAyB;QACrD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAC,OAAwB,EAAE,QAAyB;QACrD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,OAAwB,EAAE,QAAyB;QACtD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAwB,EAAE,QAAyB;QACvD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,OAAwB,EAAE,QAAyB;QACxD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK,CAAC,GAAY;QACtB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QACvB,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;QAEzB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;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
+ import { ISignal } from '@lumino/signaling';
2
+ import { IServiceWorkerManager } from './tokens';
3
+ export declare class ServiceWorkerManager implements IServiceWorkerManager {
4
+ constructor(options?: IServiceWorkerManager.IOptions);
5
+ /**
6
+ * A signal emitted when the registration changes.
7
+ */
8
+ get registrationChanged(): ISignal<IServiceWorkerManager, ServiceWorkerRegistration | null>;
9
+ /**
10
+ * Whether the ServiceWorker is enabled or not.
11
+ */
12
+ get enabled(): boolean;
13
+ get ready(): Promise<void>;
14
+ private unregisterOldServiceWorkers;
15
+ private initialize;
16
+ private _pingServiceWorker;
17
+ private _setRegistration;
18
+ private _registration;
19
+ private _registrationChanged;
20
+ private _ready;
21
+ }