@datalayer/core 0.0.3 → 0.0.5

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 (332) hide show
  1. package/README.md +114 -3
  2. package/lib/App.css +2 -2
  3. package/lib/App.d.ts +1 -1
  4. package/lib/App.js +9 -9
  5. package/lib/__tests__/index.test.js +5 -5
  6. package/lib/api/DatalayerApi.d.ts +1 -1
  7. package/lib/api/DatalayerApi.js +3 -3
  8. package/lib/api/index.d.ts +3 -3
  9. package/lib/api/index.js +3 -3
  10. package/lib/api/runtimes/actions.js +22 -23
  11. package/lib/api/runtimes/settings.js +3 -3
  12. package/lib/api/runtimes/snapshots.d.ts +1 -1
  13. package/lib/api/runtimes/snapshots.js +8 -8
  14. package/lib/api/runtimes/utils.js +1 -4
  15. package/lib/collaboration/DatalayerCollaboration.d.ts +9 -0
  16. package/lib/collaboration/DatalayerCollaboration.js +28 -0
  17. package/lib/collaboration/DatalayerCollaborationProvider.d.ts +54 -0
  18. package/lib/collaboration/DatalayerCollaborationProvider.js +162 -0
  19. package/lib/collaboration/index.d.ts +2 -0
  20. package/lib/collaboration/index.js +6 -0
  21. package/lib/components/avatars/BoringAvatar.d.ts +1 -1
  22. package/lib/components/avatars/BoringAvatar.js +2 -2
  23. package/lib/components/avatars/UserProfileAvatar.js +2 -9
  24. package/lib/components/banners/NoAutomationBanner.js +4 -4
  25. package/lib/components/buttons/DownloadCSVButton.js +1 -1
  26. package/lib/components/buttons/UploadButton.js +1 -1
  27. package/lib/components/checkout/StripeCheckout.d.ts +1 -1
  28. package/lib/components/checkout/StripeCheckout.js +6 -6
  29. package/lib/components/confetti/ConfettiSuccess.js +1 -1
  30. package/lib/components/context/OrganizationSelect.js +5 -5
  31. package/lib/components/context/SpaceSelect.js +7 -7
  32. package/lib/components/display/AvatarSkeleton.js +1 -1
  33. package/lib/components/display/CenteredSpinner.js +4 -4
  34. package/lib/components/display/CodePreview.js +4 -4
  35. package/lib/components/display/DatalayerBox.js +13 -14
  36. package/lib/components/display/HorizontalCenter.d.ts +1 -1
  37. package/lib/components/display/HorizontalCenter.js +1 -1
  38. package/lib/components/display/JupyterDialog.js +17 -15
  39. package/lib/components/display/NavLink.d.ts +4 -2
  40. package/lib/components/display/NavLink.js +6 -4
  41. package/lib/components/display/NotebookSkeleton.js +2 -2
  42. package/lib/components/display/Placeholder.js +1 -1
  43. package/lib/components/display/ToTopBranded.js +1 -1
  44. package/lib/components/echarts/EChartsReact.d.ts +1 -1
  45. package/lib/components/echarts/EChartsReact.js +1 -1
  46. package/lib/components/flashes/FlashClosable.js +11 -11
  47. package/lib/components/flashes/FlashDisclaimer.js +2 -3
  48. package/lib/components/flashes/FlashGuest.js +3 -4
  49. package/lib/components/flashes/FlashSurveys.js +3 -4
  50. package/lib/components/flashes/FlashUnauthorized.js +2 -2
  51. package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
  52. package/lib/components/flashes/surveys/Survey2025_1.js +62 -85
  53. package/lib/components/iam/ExternalTokenSilentLogin.js +6 -4
  54. package/lib/components/icons/ArtifactIcon.d.ts +2 -2
  55. package/lib/components/icons/ArtifactIcon.js +39 -39
  56. package/lib/components/labels/VisibilityLabel.js +2 -5
  57. package/lib/components/landings/StepBlock.d.ts +1 -1
  58. package/lib/components/landings/StepBlock.js +1 -1
  59. package/lib/components/navbar/NavigationVisbilityObserver.js +2 -2
  60. package/lib/components/navbar/SubdomainNavBar.js +45 -23
  61. package/lib/components/navbar/SubdomainNavBar.module.css +33 -14
  62. package/lib/components/nbgrader/NbGradesDetails.d.ts +1 -1
  63. package/lib/components/nbgrader/NbGradesDetails.js +5 -8
  64. package/lib/components/notebooks/JupyterNotebook.js +5 -5
  65. package/lib/components/notebooks/JupyterNotebookToolbar.js +3 -3
  66. package/lib/components/primer/Helper.d.ts +1 -1
  67. package/lib/components/primer/Helper.js +5 -3
  68. package/lib/components/primer/Portals.d.ts +1 -1
  69. package/lib/components/primer/Portals.js +2 -2
  70. package/lib/components/primer/Styles.js +1 -1
  71. package/lib/components/progress/ConsumptionBar.js +2 -2
  72. package/lib/components/progress/CreditsIndicator.d.ts +1 -1
  73. package/lib/components/progress/CreditsIndicator.js +4 -7
  74. package/lib/components/progress/ProgressRing.js +2 -2
  75. package/lib/components/runtimes/RuntimeCellVariables.js +9 -9
  76. package/lib/components/runtimes/RuntimeCellVariablesDialog.js +3 -3
  77. package/lib/components/runtimes/RuntimeLauncherDialog.js +30 -34
  78. package/lib/components/runtimes/RuntimePickerBase.js +42 -31
  79. package/lib/components/runtimes/RuntimePickerCell.js +9 -12
  80. package/lib/components/runtimes/RuntimePickerNotebook.js +44 -44
  81. package/lib/components/runtimes/RuntimeReservationControl.js +10 -15
  82. package/lib/components/runtimes/RuntimeSimplePicker.js +9 -12
  83. package/lib/components/runtimes/RuntimeUtils.js +22 -12
  84. package/lib/components/runtimes/RuntimeVariables.js +7 -7
  85. package/lib/components/screenshot/ScreenCapture.js +9 -13
  86. package/lib/components/screenshot/ScreenCaptureButton.d.ts +1 -1
  87. package/lib/components/screenshot/ScreenCaptureButton.js +14 -8
  88. package/lib/components/snapshots/RuntimeSnapshotMenu.js +19 -17
  89. package/lib/components/snippets/SnippetDialog.js +5 -5
  90. package/lib/components/storage/ContentsBrowser.js +63 -56
  91. package/lib/components/storage/ContentsItems.js +10 -8
  92. package/lib/components/students/StudentItemStatus.d.ts +1 -1
  93. package/lib/components/students/StudentItemStatus.js +35 -16
  94. package/lib/components/subnav/SubNav.d.ts +1 -1
  95. package/lib/components/subnav/SubNav.js +30 -15
  96. package/lib/components/subnav/SubNav.module.css +55 -21
  97. package/lib/components/tables/DataTable.js +1 -4
  98. package/lib/components/text-reveal/TextRevealAnimation.js +7 -2
  99. package/lib/components/text-reveal/TextRevealAnimation.module.css +4 -2
  100. package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
  101. package/lib/components/tokens/SpaceVariantToken.js +5 -5
  102. package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -3
  103. package/lib/components/users/PeerIndicator.d.ts +1 -1
  104. package/lib/components/users/PeerIndicator.js +5 -5
  105. package/lib/config/Configuration.d.ts +48 -0
  106. package/lib/config/Configuration.js +42 -0
  107. package/lib/config/integrations/Loom.js +3 -3
  108. package/lib/examples/CellExample.d.ts +2 -2
  109. package/lib/examples/CellExample.js +34 -3
  110. package/lib/examples/DatalayerNotebookExample.d.ts +16 -0
  111. package/lib/examples/DatalayerNotebookExample.js +75 -0
  112. package/lib/examples/NativeNavigationExample.d.ts +8 -0
  113. package/lib/examples/NativeNavigationExample.js +97 -0
  114. package/lib/examples/NotebookExample.d.ts +1 -3
  115. package/lib/examples/NotebookExample.js +9 -7
  116. package/lib/examples/NotebookMutationsKernel.d.ts +2 -0
  117. package/lib/examples/NotebookMutationsKernel.js +115 -0
  118. package/lib/examples/NotebookMutationsServiceManager.d.ts +2 -0
  119. package/lib/examples/NotebookMutationsServiceManager.js +107 -0
  120. package/lib/examples/ReactRouterExample.d.ts +6 -0
  121. package/lib/examples/ReactRouterExample.js +175 -0
  122. package/lib/examples/example-selector.d.ts +22 -0
  123. package/lib/examples/example-selector.js +45 -0
  124. package/lib/examples/index.d.ts +2 -0
  125. package/lib/examples/index.js +6 -0
  126. package/lib/examples/main.js +153 -0
  127. package/lib/examples/notebooks/IPyWidgetsExample.ipynb.json +101 -0
  128. package/lib/examples/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
  129. package/lib/examples/{NotebookExample1.ipynb.json → notebooks/Lite.ipynb.json} +45 -53
  130. package/lib/examples/notebooks/Matplotlib.ipynb.json +137 -0
  131. package/lib/examples/notebooks/NotebookExample1.ipynb.json +126 -0
  132. package/lib/examples/notebooks/NotebookExample2.ipynb.json +48 -0
  133. package/lib/examples/notebooks/NotebookOutputs.ipynb.json +49 -0
  134. package/lib/examples/notebooks/NotebookToCExample.ipynb.json +102 -0
  135. package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
  136. package/lib/examples/notebooks/OutputIPyWidgetsExample.js +153 -0
  137. package/lib/examples/notebooks/PyGWalker.ipynb.json +55 -0
  138. package/lib/hooks/assets/OutputshotPlaceholders.d.ts +10 -10
  139. package/lib/hooks/assets/OutputshotPlaceholders.js +10 -10
  140. package/lib/hooks/index.d.ts +29 -28
  141. package/lib/hooks/index.js +29 -28
  142. package/lib/hooks/layouts/LayoutBackdrop.js +3 -6
  143. package/lib/hooks/layouts/LayoutScreenshot.css +1 -1
  144. package/lib/hooks/layouts/LayoutScreenshot.js +6 -6
  145. package/lib/hooks/useAIAgents.d.ts +1 -1
  146. package/lib/hooks/useAIAgents.js +6 -6
  147. package/lib/hooks/useAuthorization.js +4 -4
  148. package/lib/hooks/useBackdrop.js +7 -7
  149. package/lib/hooks/useBackdropJupyterLab.d.ts +1 -1
  150. package/lib/hooks/useBackdropJupyterLab.js +4 -4
  151. package/lib/hooks/useCache.d.ts +6 -2
  152. package/lib/hooks/useCache.js +233 -179
  153. package/lib/hooks/useCellOutputshot.js +3 -6
  154. package/lib/hooks/useContainsFocus.js +2 -1
  155. package/lib/hooks/useDatalayer.js +5 -3
  156. package/lib/hooks/useError.d.ts +1 -1
  157. package/lib/hooks/useError.js +2 -2
  158. package/lib/hooks/useExternalScript.js +4 -4
  159. package/lib/hooks/useFocusTrap.js +2 -1
  160. package/lib/hooks/useIAM.js +4 -5
  161. package/lib/hooks/useId.js +3 -3
  162. package/lib/hooks/useJupyterLabTheme.js +3 -1
  163. package/lib/hooks/useLocation.d.ts +22 -0
  164. package/lib/hooks/useLocation.js +149 -0
  165. package/lib/hooks/useLocationHandles.d.ts +2 -2
  166. package/lib/hooks/useLocationHandles.js +6 -4
  167. package/lib/hooks/useNavigate.d.ts +5 -1
  168. package/lib/hooks/useNavigate.js +62 -7
  169. package/lib/hooks/useNotebookAIAgent.js +3 -1
  170. package/lib/hooks/useParams.d.ts +5 -0
  171. package/lib/hooks/useParams.js +112 -0
  172. package/lib/hooks/useRuntimes.js +2 -2
  173. package/lib/hooks/useScreenshot.js +5 -5
  174. package/lib/hooks/useToast.js +15 -13
  175. package/lib/hooks/useUpload.js +9 -9
  176. package/lib/hooks/useUser.js +1 -1
  177. package/lib/index.css +1 -1
  178. package/lib/index.d.ts +6 -3
  179. package/lib/index.js +7 -3
  180. package/lib/mocks/components/FlashMock.js +4 -4
  181. package/lib/mocks/hooks/rests/rests.js +15 -18
  182. package/lib/mocks/hooks/useDatalayerMock.d.ts +2 -2
  183. package/lib/mocks/hooks/useDatalayerMock.js +7 -7
  184. package/lib/mocks/models/CodeBlockMock.js +1 -1
  185. package/lib/mocks/models/CodelineMock.js +1 -1
  186. package/lib/mocks/models/CourseMock.d.ts +1 -1
  187. package/lib/mocks/models/CourseMock.js +10 -10
  188. package/lib/mocks/models/InviteMock.d.ts +1 -1
  189. package/lib/mocks/models/InviteMock.js +21 -6
  190. package/lib/mocks/models/JupyterLabUserMock.js +2 -2
  191. package/lib/mocks/models/OrganisationMock.d.ts +1 -1
  192. package/lib/mocks/models/OrganisationMock.js +11 -7
  193. package/lib/mocks/models/SchoolMock.d.ts +1 -1
  194. package/lib/mocks/models/SchoolMock.js +6 -6
  195. package/lib/mocks/models/SpaceMock.d.ts +1 -1
  196. package/lib/mocks/models/SpaceMock.js +9 -9
  197. package/lib/mocks/models/TeamMock.d.ts +1 -1
  198. package/lib/mocks/models/TeamMock.js +6 -6
  199. package/lib/mocks/models/UserMock.d.ts +1 -1
  200. package/lib/mocks/models/UserMock.js +4 -6
  201. package/lib/mocks/views/ActionMenuMock.js +1 -1
  202. package/lib/mocks/views/ChartMock.js +3 -3
  203. package/lib/mocks/views/ChartMockOptions.js +24 -24
  204. package/lib/mocks/views/DashboardMock.js +74 -74
  205. package/lib/mocks/views/FormMock.js +1 -1
  206. package/lib/mocks/views/TableMock.js +1 -1
  207. package/lib/models/Account.d.ts +2 -2
  208. package/lib/models/Assignment.d.ts +2 -2
  209. package/lib/models/Cell.d.ts +1 -1
  210. package/lib/models/CodeBlock.d.ts +1 -1
  211. package/lib/models/CodefeedBlocks.d.ts +2 -2
  212. package/lib/models/Contact.d.ts +1 -1
  213. package/lib/models/Contact.js +14 -14
  214. package/lib/models/ContactIAMProvider.js +2 -2
  215. package/lib/models/Course.d.ts +7 -7
  216. package/lib/models/Dataset.d.ts +1 -1
  217. package/lib/models/Dean.d.ts +1 -1
  218. package/lib/models/Document.d.ts +1 -1
  219. package/lib/models/Environment.d.ts +2 -2
  220. package/lib/models/Exercise.d.ts +1 -1
  221. package/lib/models/IAMProviderLinked.js +1 -1
  222. package/lib/models/Instructor.d.ts +1 -1
  223. package/lib/models/Invite.d.ts +2 -2
  224. package/lib/models/Invite.js +1 -1
  225. package/lib/models/Item.d.ts +5 -5
  226. package/lib/models/LandingRoles.js +18 -18
  227. package/lib/models/Lesson.d.ts +1 -1
  228. package/lib/models/Member.d.ts +1 -1
  229. package/lib/models/Notebook.d.ts +1 -1
  230. package/lib/models/Organization.d.ts +4 -4
  231. package/lib/models/Organization.js +2 -2
  232. package/lib/models/OrganizationMember.d.ts +2 -2
  233. package/lib/models/Page.js +4 -2
  234. package/lib/models/PageTag.d.ts +1 -1
  235. package/lib/models/PageTag.js +56 -9
  236. package/lib/models/Profile.d.ts +1 -1
  237. package/lib/models/RolesOrganization.d.ts +1 -1
  238. package/lib/models/RolesOrganization.js +4 -12
  239. package/lib/models/RolesPlatform.d.ts +1 -1
  240. package/lib/models/RolesPlatform.js +12 -34
  241. package/lib/models/RolesTeam.d.ts +1 -1
  242. package/lib/models/RolesTeam.js +3 -10
  243. package/lib/models/Runtime.js +4 -4
  244. package/lib/models/RuntimeSnapshot.js +1 -1
  245. package/lib/models/School.d.ts +4 -4
  246. package/lib/models/Space.d.ts +5 -5
  247. package/lib/models/Space.js +3 -3
  248. package/lib/models/SpaceItem.d.ts +8 -8
  249. package/lib/models/SpaceMember.d.ts +2 -2
  250. package/lib/models/Student.d.ts +2 -2
  251. package/lib/models/StudentItem.d.ts +3 -3
  252. package/lib/models/Team.d.ts +3 -3
  253. package/lib/models/Team.js +2 -2
  254. package/lib/models/TeamMember.d.ts +2 -2
  255. package/lib/models/URN.js +1 -1
  256. package/lib/models/User.d.ts +2 -2
  257. package/lib/models/User.js +5 -3
  258. package/lib/models/UserOnboarding.d.ts +1 -1
  259. package/lib/models/UserOnboarding.js +7 -7
  260. package/lib/models/UserSettings.js +2 -2
  261. package/lib/models/index.d.ts +2 -2
  262. package/lib/models/index.js +2 -2
  263. package/lib/navigation/adapters/native.d.ts +11 -0
  264. package/lib/navigation/adapters/native.js +48 -0
  265. package/lib/navigation/adapters/nextjs.d.ts +9 -0
  266. package/lib/navigation/adapters/nextjs.js +35 -0
  267. package/lib/navigation/adapters/react-router.d.ts +4 -0
  268. package/lib/navigation/adapters/react-router.js +12 -0
  269. package/lib/navigation/components.d.ts +20 -0
  270. package/lib/navigation/components.js +36 -0
  271. package/lib/navigation/index.d.ts +4 -0
  272. package/lib/navigation/index.js +12 -0
  273. package/lib/routes/index.d.ts +1 -1
  274. package/lib/routes/index.js +1 -1
  275. package/lib/services/DatalayerServiceManager.d.ts +22 -0
  276. package/lib/services/DatalayerServiceManager.js +69 -0
  277. package/lib/services/index.d.ts +4 -0
  278. package/lib/services/index.js +7 -0
  279. package/lib/services/reconnectToRuntime.d.ts +32 -0
  280. package/lib/services/reconnectToRuntime.js +59 -0
  281. package/lib/state/State.d.ts +1 -1
  282. package/lib/state/State.js +1 -1
  283. package/lib/state/index.d.ts +1 -1
  284. package/lib/state/index.js +1 -1
  285. package/lib/state/storage/IAMStorage.js +14 -2
  286. package/lib/state/storage/index.d.ts +1 -1
  287. package/lib/state/storage/index.js +1 -1
  288. package/lib/state/substates/AIAgentState.js +4 -2
  289. package/lib/state/substates/CellState.js +6 -5
  290. package/lib/state/substates/CoreState.d.ts +1 -1
  291. package/lib/state/substates/CoreState.js +26 -17
  292. package/lib/state/substates/DatasourceState.js +1 -1
  293. package/lib/state/substates/IAMState.d.ts +4 -0
  294. package/lib/state/substates/IAMState.js +39 -23
  295. package/lib/state/substates/JupyterLabState.js +1 -1
  296. package/lib/state/substates/LayoutState.d.ts +2 -2
  297. package/lib/state/substates/LayoutState.js +41 -28
  298. package/lib/state/substates/OrganizationState.js +1 -1
  299. package/lib/state/substates/RuntimesState.js +11 -6
  300. package/lib/state/substates/SpaceState.js +1 -1
  301. package/lib/state/substates/SurveysState.js +4 -4
  302. package/lib/state/substates/TeamState.js +1 -1
  303. package/lib/test-setup.js +25 -3
  304. package/lib/theme/DatalayerTheme.js +1 -1
  305. package/lib/theme/DatalayerThemeProvider.js +17 -14
  306. package/lib/theme/Palette.js +1 -1
  307. package/lib/utils/Avatar.js +2 -2
  308. package/lib/utils/Browser.js +6 -6
  309. package/lib/utils/Cells.d.ts +1 -1
  310. package/lib/utils/Cookie.js +1 -1
  311. package/lib/utils/Date.js +2 -2
  312. package/lib/utils/Download.js +5 -3
  313. package/lib/utils/DownloadFile.js +4 -2
  314. package/lib/utils/Env.js +2 -1
  315. package/lib/utils/Lazy.d.ts +1 -1
  316. package/lib/utils/Lazy.js +2 -2
  317. package/lib/utils/Name.js +10 -8
  318. package/lib/utils/Notebook.d.ts +1 -1
  319. package/lib/utils/Notebook.js +3 -3
  320. package/lib/utils/Number.js +13 -9
  321. package/lib/utils/Plots.js +4 -4
  322. package/lib/utils/Screenshot.js +1 -1
  323. package/lib/utils/Sleep.js +1 -1
  324. package/lib/utils/Snapshot.js +2 -2
  325. package/lib/utils/String.js +2 -2
  326. package/lib/utils/Uri.js +1 -1
  327. package/lib/utils/WithSuspense.js +3 -6
  328. package/lib/utils/logger.d.ts +16 -0
  329. package/lib/utils/logger.js +52 -0
  330. package/package.json +49 -5
  331. package/lib/__tests__/App.test.js +0 -17
  332. /package/lib/{__tests__/App.test.d.ts → examples/main.d.ts} +0 -0
@@ -0,0 +1,175 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2025 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ import { useState, useEffect } from 'react';
7
+ import { BrowserRouter, Routes, Route, Link as RouterLink, NavLink, Outlet, Navigate, } from 'react-router-dom';
8
+ import { Box, Button, Heading, Text, TextInput } from '@primer/react';
9
+ import { useNavigate, useLocation, useParams, useHistory } from '../hooks';
10
+ /**
11
+ * Navigation Logger Component - Shows all navigation events
12
+ */
13
+ const NavigationLogger = () => {
14
+ const [logs, setLogs] = useState([]);
15
+ const location = useLocation();
16
+ const params = useParams();
17
+ useEffect(() => {
18
+ const log = `[${new Date().toLocaleTimeString()}] Navigated to ${location.pathname}${location.search}${location.hash} | Params: ${JSON.stringify(params)} | State: ${JSON.stringify(location.state)}`;
19
+ setLogs(prev => [...prev.slice(-9), log]);
20
+ }, [location, params]);
21
+ return (_jsxs(Box, { sx: {
22
+ p: 2,
23
+ mb: 3,
24
+ bg: 'canvas.subtle',
25
+ borderRadius: 2,
26
+ fontSize: 0,
27
+ fontFamily: 'mono',
28
+ maxHeight: 150,
29
+ overflowY: 'auto',
30
+ }, children: [_jsx(Text, { as: "div", sx: { fontWeight: 'bold', mb: 1 }, children: "Navigation Log:" }), logs.map((log, i) => (_jsx(Text, { as: "div", sx: { color: 'fg.muted' }, children: log }, i)))] }));
31
+ };
32
+ /**
33
+ * Navigation Controls - Test all navigation methods
34
+ */
35
+ const NavigationControls = () => {
36
+ const navigate = useNavigate();
37
+ const history = useHistory();
38
+ const location = useLocation();
39
+ const [customPath, setCustomPath] = useState('/custom');
40
+ const [stateValue, setStateValue] = useState('');
41
+ const handleNavigateWithState = () => {
42
+ navigate('/dashboard/analytics', {
43
+ state: { message: stateValue || 'Hello from navigation!' },
44
+ });
45
+ };
46
+ const handleReplaceWithState = () => {
47
+ history.replace('/settings', { replaced: true, time: Date.now() });
48
+ };
49
+ const handleNavigateWithQuery = () => {
50
+ navigate('/search?q=react&category=framework');
51
+ };
52
+ const handleNavigateWithHash = () => {
53
+ navigate('/docs#installation');
54
+ };
55
+ const handleComplexNavigation = () => {
56
+ navigate('/products/123/reviews?sort=newest#review-42');
57
+ };
58
+ return (_jsxs(Box, { sx: {
59
+ p: 3,
60
+ borderWidth: 1,
61
+ borderStyle: 'solid',
62
+ borderColor: 'border.default',
63
+ borderRadius: 2,
64
+ mb: 3,
65
+ }, children: [_jsx(Heading, { as: "h3", sx: { mb: 3 }, children: "Navigation Controls" }), _jsxs(Box, { sx: { mb: 3 }, children: [_jsx(Text, { as: "label", sx: { display: 'block', mb: 1, fontSize: 1 }, children: "Custom Path:" }), _jsx(TextInput, { value: customPath, onChange: e => setCustomPath(e.target.value), sx: { mb: 2 } }), _jsx(Button, { onClick: () => navigate(customPath), sx: { mr: 2 }, children: "Navigate to Custom Path" })] }), _jsxs(Box, { sx: { mb: 3 }, children: [_jsx(Text, { as: "label", sx: { display: 'block', mb: 1, fontSize: 1 }, children: "State Value:" }), _jsx(TextInput, { value: stateValue, onChange: e => setStateValue(e.target.value), placeholder: "Enter state to pass", sx: { mb: 2 } }), _jsx(Button, { onClick: handleNavigateWithState, variant: "primary", children: "Navigate with State" })] }), _jsxs(Box, { sx: { display: 'flex', gap: 2, flexWrap: 'wrap', mb: 3 }, children: [_jsx(Button, { onClick: () => history.back(), variant: "default", children: "\u2190 Back" }), _jsx(Button, { onClick: () => history.forward(), variant: "default", children: "Forward \u2192" }), _jsx(Button, { onClick: handleReplaceWithState, variant: "default", children: "Replace Current" }), _jsx(Button, { onClick: handleNavigateWithQuery, variant: "default", children: "Nav with Query" }), _jsx(Button, { onClick: handleNavigateWithHash, variant: "default", children: "Nav with Hash" }), _jsx(Button, { onClick: handleComplexNavigation, variant: "default", children: "Complex Navigation" })] }), _jsx(Box, { sx: { p: 2, bg: 'canvas.inset', borderRadius: 1 }, children: _jsxs(Text, { as: "div", sx: { fontSize: 0, fontFamily: 'mono' }, children: [_jsx("strong", { children: "Current Location:" }), _jsx("br", {}), "Path: ", location.pathname, _jsx("br", {}), "Search: ", location.search || '(none)', _jsx("br", {}), "Hash: ", location.hash || '(none)', _jsx("br", {}), "State: ", JSON.stringify(location.state) || '(none)'] }) })] }));
66
+ };
67
+ /**
68
+ * Layout Component with Navigation Menu
69
+ */
70
+ const Layout = () => {
71
+ return (_jsxs(Box, { children: [_jsx(Box, { as: "nav", sx: {
72
+ p: 3,
73
+ bg: 'canvas.subtle',
74
+ borderBottom: '1px solid',
75
+ borderColor: 'border.default',
76
+ mb: 3,
77
+ }, children: _jsxs(Box, { sx: { display: 'flex', gap: 3, flexWrap: 'wrap' }, children: [_jsx(NavLink, { to: "/", style: ({ isActive }) => ({
78
+ fontWeight: isActive ? 'bold' : 'normal',
79
+ color: isActive ? '#0969da' : 'inherit',
80
+ textDecoration: 'none',
81
+ }), children: "Home" }), _jsx(NavLink, { to: "/dashboard", style: ({ isActive }) => ({
82
+ fontWeight: isActive ? 'bold' : 'normal',
83
+ color: isActive ? '#0969da' : 'inherit',
84
+ textDecoration: 'none',
85
+ }), children: "Dashboard" }), _jsx(NavLink, { to: "/products", style: ({ isActive }) => ({
86
+ fontWeight: isActive ? 'bold' : 'normal',
87
+ color: isActive ? '#0969da' : 'inherit',
88
+ textDecoration: 'none',
89
+ }), children: "Products" }), _jsx(NavLink, { to: "/users/john-doe", style: ({ isActive }) => ({
90
+ fontWeight: isActive ? 'bold' : 'normal',
91
+ color: isActive ? '#0969da' : 'inherit',
92
+ textDecoration: 'none',
93
+ }), children: "User Profile" }), _jsx(NavLink, { to: "/settings", style: ({ isActive }) => ({
94
+ fontWeight: isActive ? 'bold' : 'normal',
95
+ color: isActive ? '#0969da' : 'inherit',
96
+ textDecoration: 'none',
97
+ }), children: "Settings" })] }) }), _jsx(NavigationLogger, {}), _jsx(NavigationControls, {}), _jsx(Box, { sx: {
98
+ p: 3,
99
+ borderWidth: 1,
100
+ borderStyle: 'solid',
101
+ borderColor: 'border.default',
102
+ borderRadius: 2,
103
+ minHeight: 200,
104
+ }, children: _jsx(Outlet, {}) })] }));
105
+ };
106
+ /**
107
+ * Page Components
108
+ */
109
+ const HomePage = () => (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 3 }, children: "Home Page" }), _jsx(Text, { as: "p", children: "Welcome to the comprehensive React Router example. This demonstrates:" }), _jsxs("ul", { children: [_jsx("li", { children: "Programmatic navigation with useNavigate" }), _jsx("li", { children: "Route parameters with useParams" }), _jsx("li", { children: "Query parameters and hash navigation" }), _jsx("li", { children: "Navigation state passing" }), _jsx("li", { children: "Browser history (back/forward)" }), _jsx("li", { children: "Nested routes" }), _jsx("li", { children: "Protected routes" }), _jsx("li", { children: "Active link styling" })] })] }));
110
+ const DashboardLayout = () => (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Dashboard" }), _jsxs(Box, { sx: { display: 'flex', gap: 2, mb: 3 }, children: [_jsx(RouterLink, { to: "/dashboard", children: "Overview" }), _jsx(RouterLink, { to: "/dashboard/analytics", children: "Analytics" }), _jsx(RouterLink, { to: "/dashboard/reports", children: "Reports" })] }), _jsx(Outlet, {})] }));
111
+ const DashboardOverview = () => {
112
+ const location = useLocation();
113
+ return (_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { mb: 2 }, children: "Overview" }), location.state && (_jsx(Box, { sx: { p: 2, bg: 'success.subtle', borderRadius: 1, mb: 2 }, children: _jsxs(Text, { children: ["State received: ", JSON.stringify(location.state)] }) })), _jsx(Text, { children: "Dashboard overview content here..." })] }));
114
+ };
115
+ const DashboardAnalytics = () => {
116
+ const location = useLocation();
117
+ return (_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { mb: 2 }, children: "Analytics" }), location.state && (_jsx(Box, { sx: { p: 2, bg: 'success.subtle', borderRadius: 1, mb: 2 }, children: _jsxs(Text, { children: ["State received: ", JSON.stringify(location.state)] }) })), _jsx(Text, { children: "Analytics data visualization would go here..." })] }));
118
+ };
119
+ const DashboardReports = () => (_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { mb: 2 }, children: "Reports" }), _jsx(Text, { children: "Reports section content..." })] }));
120
+ const ProductList = () => {
121
+ const navigate = useNavigate();
122
+ const products = [
123
+ { id: 1, name: 'Product A' },
124
+ { id: 2, name: 'Product B' },
125
+ { id: 3, name: 'Product C' },
126
+ ];
127
+ return (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 3 }, children: "Products" }), _jsx(Box, { sx: { display: 'grid', gap: 2 }, children: products.map(product => (_jsxs(Button, { onClick: () => navigate(`/products/${product.id}`), variant: "default", sx: { justifyContent: 'flex-start' }, children: [product.name, " \u2192"] }, product.id))) })] }));
128
+ };
129
+ const ProductDetail = () => {
130
+ const params = useParams();
131
+ const navigate = useNavigate();
132
+ return (_jsxs(Box, { children: [_jsx(Button, { onClick: () => navigate('/products'), variant: "default", sx: { mb: 3 }, children: "\u2190 Back to Products" }), _jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Product Details" }), _jsxs(Text, { as: "p", children: ["Product ID: ", params.id] }), _jsxs(Text, { as: "p", children: ["All params: ", JSON.stringify(params)] }), _jsx(Box, { sx: { mt: 3 }, children: _jsx(Button, { onClick: () => navigate(`/products/${params.id}/reviews`), variant: "primary", children: "View Reviews" }) })] }));
133
+ };
134
+ const ProductReviews = () => {
135
+ const params = useParams();
136
+ const location = useLocation();
137
+ return (_jsxs(Box, { children: [_jsxs(Heading, { as: "h1", sx: { mb: 2 }, children: ["Reviews for Product ", params.id] }), _jsxs(Text, { as: "p", children: ["Query params: ", location.search] }), _jsxs(Text, { as: "p", children: ["Hash: ", location.hash] })] }));
138
+ };
139
+ const UserProfile = () => {
140
+ const params = useParams();
141
+ return (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "User Profile" }), _jsxs(Text, { children: ["Username: ", params.username] })] }));
142
+ };
143
+ const SearchPage = () => {
144
+ const location = useLocation();
145
+ const searchParams = new URLSearchParams(location.search);
146
+ const query = searchParams.get('q');
147
+ const category = searchParams.get('category');
148
+ return (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Search Results" }), _jsxs(Text, { as: "p", children: ["Query: ", query || '(none)'] }), _jsxs(Text, { as: "p", children: ["Category: ", category || '(none)'] }), _jsxs(Text, { as: "p", children: ["Full search string: ", location.search] })] }));
149
+ };
150
+ const DocsPage = () => {
151
+ const location = useLocation();
152
+ return (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Documentation" }), _jsxs(Text, { as: "p", children: ["Current hash: ", location.hash || '(none)'] }), location.hash === '#installation' && (_jsxs(Box, { sx: { p: 2, bg: 'attention.subtle', borderRadius: 1, mt: 2 }, children: [_jsx(Heading, { as: "h2", sx: { mb: 1 }, children: "Installation" }), _jsx(Text, { children: "Installation instructions would be here..." })] }))] }));
153
+ };
154
+ const SettingsPage = () => {
155
+ const location = useLocation();
156
+ return (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Settings" }), location.state?.replaced && (_jsxs(Box, { sx: { p: 2, bg: 'attention.subtle', borderRadius: 1, mb: 2 }, children: [_jsx(Text, { children: "This page replaced the previous history entry!" }), _jsxs(Text, { children: ["Time: ", new Date(location.state.time).toLocaleTimeString()] })] })), _jsx(Text, { children: "Settings configuration would go here..." })] }));
157
+ };
158
+ const NotFound = () => (_jsxs(Box, { children: [_jsx(Heading, { as: "h1", sx: { mb: 2, color: 'danger.fg' }, children: "404 - Not Found" }), _jsx(Text, { children: "The page you're looking for doesn't exist." })] }));
159
+ /**
160
+ * Protected Route Component
161
+ */
162
+ const ProtectedRoute = ({ children, }) => {
163
+ const [isAuthenticated] = useState(true); // Simulate authentication
164
+ if (!isAuthenticated) {
165
+ return _jsx(Navigate, { to: "/", replace: true });
166
+ }
167
+ return _jsx(_Fragment, { children: children });
168
+ };
169
+ /**
170
+ * Main App Component - Advanced React Router Example
171
+ */
172
+ export const ReactRouterAdvancedExample = () => {
173
+ return (_jsx(BrowserRouter, { children: _jsxs(Box, { sx: { minHeight: '100vh', p: 4 }, children: [_jsxs(Box, { sx: { mb: 4, p: 3, bg: 'canvas.subtle', borderRadius: 2 }, children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Advanced React Router Navigation Example" }), _jsx(Text, { as: "p", sx: { mb: 2 }, children: "This comprehensive example demonstrates all navigation features working with our custom hooks that detect and use React Router." }), _jsx(Text, { as: "p", sx: { color: 'success.fg', fontWeight: 'bold' }, children: "\u2713 React Router detected and integrated with Datalayer SDK hooks" })] }), _jsx(Routes, { children: _jsxs(Route, { path: "/", element: _jsx(Layout, {}), children: [_jsx(Route, { index: true, element: _jsx(HomePage, {}) }), _jsxs(Route, { path: "dashboard", element: _jsx(DashboardLayout, {}), children: [_jsx(Route, { index: true, element: _jsx(DashboardOverview, {}) }), _jsx(Route, { path: "analytics", element: _jsx(DashboardAnalytics, {}) }), _jsx(Route, { path: "reports", element: _jsx(DashboardReports, {}) })] }), _jsx(Route, { path: "products/:id/reviews", element: _jsx(ProductReviews, {}) }), _jsx(Route, { path: "products/:id", element: _jsx(ProductDetail, {}) }), _jsx(Route, { path: "products", element: _jsx(ProductList, {}) }), _jsx(Route, { path: "users/:username", element: _jsx(UserProfile, {}) }), _jsx(Route, { path: "search", element: _jsx(SearchPage, {}) }), _jsx(Route, { path: "docs", element: _jsx(DocsPage, {}) }), _jsx(Route, { path: "settings", element: _jsx(ProtectedRoute, { children: _jsx(SettingsPage, {}) }) }), _jsx(Route, { path: "custom", element: _jsx(HomePage, {}) }), _jsx(Route, { path: "*", element: _jsx(NotFound, {}) })] }) })] }) }));
174
+ };
175
+ export default ReactRouterAdvancedExample;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Registry of available examples with dynamic imports.
3
+ * Add new examples here to make them available in the example runner.
4
+ */
5
+ export declare const EXAMPLES: Record<string, () => Promise<{
6
+ default: React.ComponentType;
7
+ }>>;
8
+ /**
9
+ * Get the list of available example names
10
+ */
11
+ export declare function getExampleNames(): string[];
12
+ /**
13
+ * Get the selected example based on environment variable
14
+ * Falls back to 'NotebookExample' if not specified or invalid
15
+ */
16
+ export declare function getSelectedExample(): () => Promise<{
17
+ default: React.ComponentType;
18
+ }>;
19
+ /**
20
+ * Get the selected example name
21
+ */
22
+ export declare function getSelectedExampleName(): string;
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Registry of available examples with dynamic imports.
7
+ * Add new examples here to make them available in the example runner.
8
+ */
9
+ export const EXAMPLES = {
10
+ CellExample: () => import('./CellExample'),
11
+ DatalayerNotebookExample: () => import('./DatalayerNotebookExample'),
12
+ NotebookExample: () => import('./NotebookExample'),
13
+ NotebookMutationsKernel: () => import('./NotebookMutationsKernel'),
14
+ NotebookMutationsServiceManager: () => import('./NotebookMutationsServiceManager'),
15
+ ReactRouterExample: () => import('./ReactRouterExample'),
16
+ NativeNavigationExample: () => import('./NativeNavigationExample'),
17
+ };
18
+ /**
19
+ * Get the list of available example names
20
+ */
21
+ export function getExampleNames() {
22
+ return Object.keys(EXAMPLES);
23
+ }
24
+ /**
25
+ * Get the selected example based on environment variable
26
+ * Falls back to 'NotebookExample' if not specified or invalid
27
+ */
28
+ export function getSelectedExample() {
29
+ // import.meta.env.EXAMPLE is defined in vite config
30
+ const exampleName = import.meta.env.EXAMPLE || 'NotebookExample';
31
+ if (!EXAMPLES[exampleName]) {
32
+ console.warn(`Example "${exampleName}" not found. Available examples:`, getExampleNames());
33
+ console.log('Falling back to NotebookExample');
34
+ return EXAMPLES['NotebookExample'];
35
+ }
36
+ return EXAMPLES[exampleName];
37
+ }
38
+ /**
39
+ * Get the selected example name
40
+ */
41
+ export function getSelectedExampleName() {
42
+ // import.meta.env.EXAMPLE is defined in vite config
43
+ const exampleName = import.meta.env.EXAMPLE || 'NotebookExample';
44
+ return EXAMPLES[exampleName] ? exampleName : 'NotebookExample';
45
+ }
@@ -0,0 +1,2 @@
1
+ export * from './NotebookMutationsKernel';
2
+ export * from './NotebookMutationsServiceManager';
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export * from './NotebookMutationsKernel';
6
+ export * from './NotebookMutationsServiceManager';
@@ -0,0 +1,153 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2025 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ import { useEffect, useState } from 'react';
7
+ import { createRoot } from 'react-dom/client';
8
+ import { loadJupyterConfig, JupyterReactTheme, createServerSettings, setJupyterServerUrl, setJupyterServerToken, getJupyterServerUrl, getJupyterServerToken, } from '@datalayer/jupyter-react';
9
+ import { ServiceManager } from '@jupyterlab/services';
10
+ import { coreStore } from '../state/substates/CoreState';
11
+ import { iamStore } from '../state';
12
+ import { getSelectedExample, getSelectedExampleName } from './example-selector';
13
+ import { createDatalayerServiceManager } from '../services/DatalayerServiceManager';
14
+ // Load configurations from DOM
15
+ const loadConfigurations = () => {
16
+ // Load Datalayer configuration
17
+ const datalayerConfigElement = document.getElementById('datalayer-config-data');
18
+ if (datalayerConfigElement?.textContent) {
19
+ try {
20
+ const datalayerConfig = JSON.parse(datalayerConfigElement.textContent);
21
+ if (datalayerConfig.runUrl) {
22
+ console.log('Setting Datalayer config:', datalayerConfig);
23
+ coreStore.getState().setConfiguration(datalayerConfig);
24
+ // Also set the token in the IAM store for API authentication
25
+ if (datalayerConfig.token) {
26
+ // Use the setLogin method to set the token in IAM store
27
+ // For now, we'll just set a minimal user object since we don't have full user data
28
+ iamStore.getState().setLogin({
29
+ id: 'example-id',
30
+ handle: 'example-user',
31
+ email: 'example@datalayer.com',
32
+ firstName: 'Example',
33
+ lastName: 'User',
34
+ initials: 'EU',
35
+ displayName: 'Example User',
36
+ avatarUrl: '',
37
+ roles: [],
38
+ setRoles: () => { },
39
+ iamProviders: [],
40
+ settings: {},
41
+ unsubscribedFromOutbounds: false,
42
+ onboarding: {},
43
+ events: [],
44
+ }, datalayerConfig.token);
45
+ }
46
+ }
47
+ }
48
+ catch (e) {
49
+ console.error('Failed to parse Datalayer config:', e);
50
+ }
51
+ }
52
+ // Load Jupyter configuration
53
+ loadJupyterConfig();
54
+ // Also set Jupyter server URL and token if available in jupyter-config-data
55
+ const jupyterConfigElement = document.getElementById('jupyter-config-data');
56
+ if (jupyterConfigElement?.textContent) {
57
+ try {
58
+ const jupyterConfig = JSON.parse(jupyterConfigElement.textContent);
59
+ if (jupyterConfig.baseUrl) {
60
+ setJupyterServerUrl(jupyterConfig.baseUrl);
61
+ }
62
+ if (jupyterConfig.token) {
63
+ setJupyterServerToken(jupyterConfig.token);
64
+ }
65
+ }
66
+ catch (e) {
67
+ console.error('Failed to parse Jupyter config:', e);
68
+ }
69
+ }
70
+ };
71
+ // Main App component that loads and renders the selected example
72
+ const ExampleApp = () => {
73
+ const [ExampleComponent, setExampleComponent] = useState(null);
74
+ const [loading, setLoading] = useState(true);
75
+ const [error, setError] = useState(null);
76
+ const [serviceManager, setServiceManager] = useState(null);
77
+ useEffect(() => {
78
+ // Load configurations
79
+ loadConfigurations();
80
+ // Create service manager
81
+ const createManager = async () => {
82
+ const { configuration } = coreStore.getState();
83
+ // Try to use DatalayerServiceManager if we have a token
84
+ if (configuration?.token) {
85
+ console.log('Using DatalayerServiceManager with token');
86
+ try {
87
+ const manager = await createDatalayerServiceManager(configuration.cpuEnvironment || 'python-3.11', configuration.credits || 100);
88
+ await manager.ready;
89
+ console.log('DatalayerServiceManager is ready');
90
+ setServiceManager(manager);
91
+ return;
92
+ }
93
+ catch (error) {
94
+ console.error('Failed to create DatalayerServiceManager:', error);
95
+ console.log('Falling back to regular ServiceManager');
96
+ }
97
+ }
98
+ // Fall back to regular ServiceManager
99
+ console.log('Using regular ServiceManager (no Datalayer token)');
100
+ const serverSettings = createServerSettings(getJupyterServerUrl(), getJupyterServerToken());
101
+ const manager = new ServiceManager({ serverSettings });
102
+ await manager.ready;
103
+ console.log('Regular ServiceManager is ready');
104
+ setServiceManager(manager);
105
+ };
106
+ createManager();
107
+ // Load the selected example
108
+ const loadExample = async () => {
109
+ try {
110
+ const exampleLoader = getSelectedExample();
111
+ const module = await exampleLoader();
112
+ setExampleComponent(() => module.default);
113
+ setLoading(false);
114
+ }
115
+ catch (e) {
116
+ console.error('Failed to load example:', e);
117
+ setError(`Failed to load example: ${e}`);
118
+ setLoading(false);
119
+ }
120
+ };
121
+ loadExample();
122
+ }, []);
123
+ if (loading) {
124
+ return (_jsxs("div", { style: { padding: '20px', textAlign: 'center' }, children: [_jsxs("h2", { children: ["Loading Example: ", getSelectedExampleName()] }), _jsx("p", { children: "Please wait..." })] }));
125
+ }
126
+ if (error) {
127
+ return (_jsxs("div", { style: { padding: '20px', color: 'red' }, children: [_jsx("h2", { children: "Error Loading Example" }), _jsx("pre", { children: error })] }));
128
+ }
129
+ if (!ExampleComponent) {
130
+ return (_jsxs("div", { style: { padding: '20px' }, children: [_jsx("h2", { children: "Example Not Found" }), _jsx("p", { children: "The selected example could not be loaded." })] }));
131
+ }
132
+ // Check if the example component expects props
133
+ // Most examples will need serviceManager
134
+ const exampleProps = {};
135
+ if (serviceManager) {
136
+ exampleProps.serviceManager = serviceManager;
137
+ }
138
+ return (_jsx(JupyterReactTheme, { children: _jsxs("div", { style: { width: '100vw', height: '100vh', overflow: 'hidden' }, children: [_jsxs("div", { style: {
139
+ padding: '10px',
140
+ background: '#f0f0f0',
141
+ borderBottom: '1px solid #ccc',
142
+ fontSize: '14px',
143
+ fontFamily: 'monospace',
144
+ }, children: ["Running Example: ", _jsx("strong", { children: getSelectedExampleName() })] }), _jsx("div", { style: { height: 'calc(100vh - 40px)', overflow: 'auto' }, children: _jsx(ExampleComponent, { ...exampleProps }) })] }) }));
145
+ };
146
+ // Mount the app
147
+ const root = document.getElementById('root');
148
+ if (root) {
149
+ createRoot(root).render(_jsx(ExampleApp, {}));
150
+ }
151
+ else {
152
+ console.error('Root element not found');
153
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "3a86eccf-352d-480d-b1b0-4cf355921be9",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "data": {
11
+ "application/vnd.jupyter.widget-view+json": {
12
+ "model_id": "c686864a5ad44793b53c9cf1b112fafe",
13
+ "version_major": 2,
14
+ "version_minor": 0
15
+ },
16
+ "text/plain": []
17
+ },
18
+ "metadata": {},
19
+ "output_type": "display_data"
20
+ }
21
+ ],
22
+ "source": ["import ipywidgets as widgets\n", "widgets.IntSlider()"]
23
+ },
24
+ {
25
+ "cell_type": "code",
26
+ "execution_count": 8,
27
+ "id": "f347e0ac-7614-4643-8fed-e6b5dfb67bcd",
28
+ "metadata": {},
29
+ "outputs": [
30
+ {
31
+ "data": {
32
+ "application/vnd.jupyter.widget-view+json": {
33
+ "model_id": "e361a274319a4715ae5cfc8104c87224",
34
+ "version_major": 2,
35
+ "version_minor": 0
36
+ },
37
+ "text/plain": ["FloatText(value=0.0)"]
38
+ },
39
+ "metadata": {},
40
+ "output_type": "display_data"
41
+ },
42
+ {
43
+ "data": {
44
+ "application/vnd.jupyter.widget-view+json": {
45
+ "model_id": "859ac1871f56461fa8f2c97e6e18c4c4",
46
+ "version_major": 2,
47
+ "version_minor": 0
48
+ },
49
+ "text/plain": ["FloatSlider(value=0.0)"]
50
+ },
51
+ "metadata": {},
52
+ "output_type": "display_data"
53
+ }
54
+ ],
55
+ "source": [
56
+ "from IPython.display import display\n",
57
+ "a = widgets.FloatText()\n",
58
+ "b = widgets.FloatSlider()\n",
59
+ "display(a,b)\n",
60
+ "mylink = widgets.jslink((a, 'value'), (b, 'value'))"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "code",
65
+ "execution_count": 7,
66
+ "id": "07f52271-ccae-476d-83b9-715c96168c7c",
67
+ "metadata": {},
68
+ "outputs": [],
69
+ "source": ["mylink.unlink()"]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": null,
74
+ "id": "81b15288-063d-412d-99db-c73453e18565",
75
+ "metadata": {},
76
+ "outputs": [],
77
+ "source": []
78
+ }
79
+ ],
80
+ "metadata": {
81
+ "kernelspec": {
82
+ "display_name": "Python 3 (ipykernel)",
83
+ "language": "python",
84
+ "name": "python3"
85
+ },
86
+ "language_info": {
87
+ "codemirror_mode": {
88
+ "name": "ipython",
89
+ "version": 3
90
+ },
91
+ "file_extension": ".py",
92
+ "mimetype": "text/x-python",
93
+ "name": "python",
94
+ "nbconvert_exporter": "python",
95
+ "pygments_lexer": "ipython3",
96
+ "version": "3.11.4"
97
+ }
98
+ },
99
+ "nbformat": 4,
100
+ "nbformat_minor": 5
101
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "58fc6682",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "data": {
11
+ "application/vnd.jupyter.widget-view+json": {
12
+ "model_id": "68c218b87d4d43589628d4f23e112319",
13
+ "version_major": 2,
14
+ "version_minor": 0
15
+ },
16
+ "text/plain": ["IntSlider(value=0)"]
17
+ },
18
+ "execution_count": 1,
19
+ "metadata": {},
20
+ "output_type": "execute_result"
21
+ }
22
+ ],
23
+ "source": ["import ipywidgets\n", "ipywidgets.IntSlider()"]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "id": "5af4e4a9",
29
+ "metadata": {},
30
+ "outputs": [],
31
+ "source": []
32
+ }
33
+ ],
34
+ "metadata": {
35
+ "kernelspec": {
36
+ "display_name": "Python 3 (ipykernel)",
37
+ "language": "python",
38
+ "name": "python3"
39
+ },
40
+ "language_info": {
41
+ "codemirror_mode": {
42
+ "name": "ipython",
43
+ "version": 3
44
+ },
45
+ "file_extension": ".py",
46
+ "mimetype": "text/x-python",
47
+ "name": "python",
48
+ "nbconvert_exporter": "python",
49
+ "pygments_lexer": "ipython3",
50
+ "version": "3.10.13"
51
+ },
52
+ "widgets": {
53
+ "application/vnd.jupyter.widget-state+json": {
54
+ "state": {
55
+ "1a916ae14b904353bc5f2db9714a8f2b": {
56
+ "model_module": "@jupyter-widgets/base",
57
+ "model_module_version": "2.0.0",
58
+ "model_name": "LayoutModel",
59
+ "state": {}
60
+ },
61
+ "32c74c0d7a7a4bbe84039bb47cc032d6": {
62
+ "model_module": "@jupyter-widgets/controls",
63
+ "model_module_version": "2.0.0",
64
+ "model_name": "IntSliderModel",
65
+ "state": {
66
+ "behavior": "drag-tap",
67
+ "layout": "IPY_MODEL_6753cb5249ae4429b1d0aaf7af2ef7c1",
68
+ "style": "IPY_MODEL_f18c172d32f54e0b810ff0725b827fdf",
69
+ "value": 33
70
+ }
71
+ },
72
+ "39beda15640c4c3fa82a284dc7df1235": {
73
+ "model_module": "@jupyter-widgets/controls",
74
+ "model_module_version": "2.0.0",
75
+ "model_name": "SliderStyleModel",
76
+ "state": {
77
+ "description_width": ""
78
+ }
79
+ },
80
+ "6753cb5249ae4429b1d0aaf7af2ef7c1": {
81
+ "model_module": "@jupyter-widgets/base",
82
+ "model_module_version": "2.0.0",
83
+ "model_name": "LayoutModel",
84
+ "state": {}
85
+ },
86
+ "68c218b87d4d43589628d4f23e112319": {
87
+ "model_module": "@jupyter-widgets/controls",
88
+ "model_module_version": "2.0.0",
89
+ "model_name": "IntSliderModel",
90
+ "state": {
91
+ "behavior": "drag-tap",
92
+ "layout": "IPY_MODEL_1a916ae14b904353bc5f2db9714a8f2b",
93
+ "style": "IPY_MODEL_39beda15640c4c3fa82a284dc7df1235"
94
+ }
95
+ },
96
+ "f18c172d32f54e0b810ff0725b827fdf": {
97
+ "model_module": "@jupyter-widgets/controls",
98
+ "model_module_version": "2.0.0",
99
+ "model_name": "SliderStyleModel",
100
+ "state": {
101
+ "description_width": ""
102
+ }
103
+ }
104
+ },
105
+ "version_major": 2,
106
+ "version_minor": 0
107
+ }
108
+ }
109
+ },
110
+ "nbformat": 4,
111
+ "nbformat_minor": 5
112
+ }