@datalayer/core 0.0.2 → 0.0.4
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.
- package/README.md +124 -2
- package/lib/App.css +47 -0
- package/lib/App.js +14 -2
- package/lib/__tests__/index.test.js +7 -6
- package/lib/api/{RunApi.d.ts → DatalayerApi.d.ts} +4 -4
- package/lib/api/{RunApi.js → DatalayerApi.js} +6 -11
- package/lib/api/index.d.ts +3 -2
- package/lib/api/index.js +3 -7
- package/lib/api/{runtimes → jupyter}/exec/Python.js +0 -5
- package/lib/api/{runtimes → jupyter}/exec/Snippets.js +0 -5
- package/lib/api/{runtimes → jupyter}/exec/index.js +0 -5
- package/lib/api/jupyter/index.d.ts +2 -0
- package/lib/api/jupyter/index.js +6 -0
- package/lib/api/{runtimes → jupyter}/kernelsHandler.d.ts +1 -1
- package/lib/api/{runtimes → jupyter}/kernelsHandler.js +1 -6
- package/lib/api/runtimes/actions.d.ts +102 -0
- package/lib/api/runtimes/{runtimesApi.js → actions.js} +47 -53
- package/lib/api/runtimes/{runtimesApi.d.ts → apis.d.ts} +8 -105
- package/lib/api/runtimes/apis.js +5 -0
- package/lib/api/runtimes/index.d.ts +2 -4
- package/lib/api/runtimes/index.js +2 -9
- package/lib/api/runtimes/settings.js +3 -8
- package/lib/api/runtimes/snapshots.d.ts +1 -1
- package/lib/api/runtimes/snapshots.js +8 -13
- package/lib/api/runtimes/utils.js +1 -9
- package/lib/assets/react.svg +1 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +9 -0
- package/lib/collaboration/DatalayerCollaboration.js +28 -0
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +54 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +162 -0
- package/lib/collaboration/index.d.ts +2 -0
- package/lib/collaboration/index.js +6 -0
- package/lib/components/avatars/BoringAvatar.d.ts +2 -3
- package/lib/components/avatars/BoringAvatar.js +14 -9
- package/lib/components/avatars/BoringAvatar.stories.d.ts +27 -0
- package/lib/components/avatars/BoringAvatar.stories.js +23 -0
- package/lib/components/avatars/UserProfileAvatar.js +2 -14
- package/lib/components/avatars/index.js +0 -5
- package/lib/components/banners/NoAutomationBanner.js +4 -9
- package/lib/components/banners/index.js +0 -5
- package/lib/components/buttons/DownloadCSVButton.d.ts +1 -1
- package/lib/components/buttons/DownloadCSVButton.js +1 -6
- package/lib/components/buttons/DownloadJsonButton.d.ts +1 -1
- package/lib/components/buttons/DownloadJsonButton.js +0 -5
- package/lib/components/buttons/LongActionButton.js +0 -5
- package/lib/components/buttons/UploadButton.js +1 -6
- package/lib/components/buttons/index.js +0 -5
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/checkout/StripeCheckout.js +6 -11
- package/lib/components/checkout/index.js +0 -5
- package/lib/components/confetti/ConfettiSuccess.js +1 -6
- package/lib/components/confetti/index.js +0 -5
- package/lib/components/context/OrganizationSelect.js +5 -10
- package/lib/components/context/SpaceSelect.js +7 -12
- package/lib/components/context/index.js +0 -5
- package/lib/components/display/AvatarSkeleton.js +1 -6
- package/lib/components/display/CenteredSpinner.js +4 -9
- package/lib/components/display/CodePreview.js +4 -9
- package/lib/components/display/DatalayerBox.js +13 -19
- package/lib/components/display/HorizontalCenter.d.ts +1 -1
- package/lib/components/display/HorizontalCenter.js +1 -1
- package/lib/components/display/JupyterDialog.js +17 -20
- package/lib/components/display/NavLink.d.ts +4 -2
- package/lib/components/display/NavLink.js +6 -9
- package/lib/components/display/NotebookSkeleton.js +2 -7
- package/lib/components/display/Placeholder.js +1 -6
- package/lib/components/display/ToTopBranded.js +1 -6
- package/lib/components/display/VisuallyHidden.js +0 -5
- package/lib/components/display/index.js +0 -5
- package/lib/components/echarts/EChartsReact.d.ts +1 -1
- package/lib/components/echarts/EChartsReact.js +7 -7
- package/lib/components/echarts/index.js +0 -5
- package/lib/components/flashes/FlashClosable.js +11 -16
- package/lib/components/flashes/FlashDisclaimer.js +2 -8
- package/lib/components/flashes/FlashGuest.js +3 -9
- package/lib/components/flashes/FlashSurveys.js +3 -9
- package/lib/components/flashes/FlashUnauthorized.js +2 -7
- package/lib/components/flashes/index.js +0 -5
- package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
- package/lib/components/flashes/surveys/Survey2025_1.js +62 -90
- package/lib/components/flashes/surveys/index.js +0 -5
- package/lib/components/iam/ExternalTokenSilentLogin.js +6 -9
- package/lib/components/iam/index.js +0 -5
- package/lib/components/icons/ArtifactIcon.d.ts +2 -2
- package/lib/components/icons/ArtifactIcon.js +39 -44
- package/lib/components/icons/index.js +0 -5
- package/lib/components/index.js +1 -6
- package/lib/components/labels/VisibilityLabel.js +2 -10
- package/lib/components/labels/index.js +0 -5
- package/lib/components/landings/StepBlock.d.ts +1 -1
- package/lib/components/landings/StepBlock.js +1 -6
- package/lib/components/landings/index.js +0 -5
- package/lib/components/navbar/NavigationVisbilityObserver.js +2 -7
- package/lib/components/navbar/SubdomainNavBar.js +46 -29
- package/lib/components/navbar/SubdomainNavBar.module.css +737 -0
- package/lib/components/navbar/index.js +0 -5
- package/lib/components/nbgrader/NbGradesDetails.d.ts +1 -1
- package/lib/components/nbgrader/NbGradesDetails.js +5 -13
- package/lib/components/nbgrader/index.js +0 -5
- package/lib/components/notebooks/JupyterNotebook.js +5 -10
- package/lib/components/notebooks/JupyterNotebookToolbar.js +3 -8
- package/lib/components/notebooks/index.js +0 -5
- package/lib/components/primer/Helper.d.ts +1 -1
- package/lib/components/primer/Helper.js +5 -3
- package/lib/components/primer/Portals.d.ts +1 -1
- package/lib/components/primer/Portals.js +2 -7
- package/lib/components/primer/Styles.js +1 -6
- package/lib/components/primer/index.js +0 -5
- package/lib/components/progress/ConsumptionBar.js +2 -7
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/progress/CreditsIndicator.js +4 -13
- package/lib/components/progress/ProgressBar.js +0 -5
- package/lib/components/progress/ProgressRing.js +2 -2
- package/lib/components/progress/Timer.js +0 -5
- package/lib/components/progress/index.js +0 -5
- package/lib/components/runtimes/RuntimeCellVariables.js +9 -14
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +7 -12
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -2
- package/lib/components/runtimes/RuntimeLauncherDialog.js +32 -40
- package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.js +42 -36
- package/lib/components/runtimes/RuntimePickerCell.js +9 -17
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -2
- package/lib/components/runtimes/RuntimePickerNotebook.js +45 -50
- package/lib/components/runtimes/RuntimeReservationControl.js +10 -20
- package/lib/components/runtimes/RuntimeSimplePicker.d.ts +1 -1
- package/lib/components/runtimes/RuntimeSimplePicker.js +44 -52
- package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
- package/lib/components/runtimes/RuntimeUtils.js +22 -17
- package/lib/components/runtimes/RuntimeVariables.js +7 -12
- package/lib/components/runtimes/index.js +0 -5
- package/lib/components/screenshot/ScreenCapture.js +10 -19
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +1 -1
- package/lib/components/screenshot/ScreenCaptureButton.js +14 -8
- package/lib/components/screenshot/index.js +0 -5
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +19 -22
- package/lib/components/snapshots/index.js +0 -5
- package/lib/components/snippets/SnippetDialog.js +5 -10
- package/lib/components/snippets/index.js +0 -5
- package/lib/components/storage/ContentsBrowser.js +75 -63
- package/lib/components/storage/ContentsItems.js +10 -13
- package/lib/components/storage/index.js +0 -5
- package/lib/components/students/StudentItemStatus.d.ts +1 -1
- package/lib/components/students/StudentItemStatus.js +38 -21
- package/lib/components/students/index.js +0 -5
- package/lib/components/subnav/SubNav.d.ts +3 -3
- package/lib/components/subnav/SubNav.js +34 -24
- package/lib/components/subnav/SubNav.module.css +717 -0
- package/lib/components/subnav/index.js +0 -5
- package/lib/components/tables/DataTable.js +1 -9
- package/lib/components/tables/index.js +0 -5
- package/lib/components/text-reveal/TextRevealAnimation.js +7 -8
- package/lib/components/text-reveal/TextRevealAnimation.module.css +45 -0
- package/lib/components/text-reveal/index.js +0 -5
- package/lib/components/text-reveal/useTextRevealAnimationLines.js +0 -5
- package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
- package/lib/components/tokens/SpaceVariantToken.js +5 -10
- package/lib/components/tokens/index.js +0 -5
- package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -8
- package/lib/components/toolbars/DocumentEditorToolbar.js +0 -5
- package/lib/components/toolbars/NotebookEditorToolbar.d.ts +1 -1
- package/lib/components/toolbars/NotebookEditorToolbar.js +0 -5
- package/lib/components/toolbars/index.js +0 -5
- package/lib/components/users/PeerIndicator.d.ts +1 -1
- package/lib/components/users/PeerIndicator.js +5 -10
- package/lib/components/users/index.js +0 -5
- package/lib/config/Configuration.d.ts +48 -0
- package/lib/config/Configuration.js +42 -5
- package/lib/config/index.js +0 -5
- package/lib/config/integrations/Loom.js +3 -8
- package/lib/config/integrations/index.js +0 -5
- package/lib/examples/CellExample.d.ts +6 -0
- package/lib/examples/CellExample.js +55 -0
- package/lib/examples/DatalayerNotebookExample.d.ts +16 -0
- package/lib/examples/DatalayerNotebookExample.js +75 -0
- package/lib/examples/NativeNavigationExample.d.ts +8 -0
- package/lib/examples/NativeNavigationExample.js +97 -0
- package/lib/examples/NotebookExample.d.ts +6 -0
- package/lib/examples/NotebookExample.js +24 -0
- package/lib/examples/NotebookMutationsKernel.d.ts +2 -0
- package/lib/examples/NotebookMutationsKernel.js +115 -0
- package/lib/examples/NotebookMutationsServiceManager.d.ts +2 -0
- package/lib/examples/NotebookMutationsServiceManager.js +107 -0
- package/lib/examples/ReactRouterExample.d.ts +6 -0
- package/lib/examples/ReactRouterExample.js +175 -0
- package/lib/examples/example-selector.d.ts +22 -0
- package/lib/examples/example-selector.js +45 -0
- package/lib/examples/index.d.ts +2 -0
- package/lib/examples/index.js +6 -0
- package/lib/examples/main.js +153 -0
- package/lib/examples/notebooks/IPyWidgetsExample.ipynb.json +101 -0
- package/lib/examples/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
- package/lib/examples/notebooks/Lite.ipynb.json +128 -0
- package/lib/examples/notebooks/Matplotlib.ipynb.json +137 -0
- package/lib/examples/notebooks/NotebookExample1.ipynb.json +126 -0
- package/lib/examples/notebooks/NotebookExample2.ipynb.json +48 -0
- package/lib/examples/notebooks/NotebookOutputs.ipynb.json +49 -0
- package/lib/examples/notebooks/NotebookToCExample.ipynb.json +102 -0
- package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
- package/lib/examples/notebooks/OutputIPyWidgetsExample.js +153 -0
- package/lib/examples/notebooks/PyGWalker.ipynb.json +55 -0
- package/lib/hooks/assets/OutputshotPlaceholders.d.ts +10 -10
- package/lib/hooks/assets/OutputshotPlaceholders.js +9 -14
- package/lib/hooks/assets/index.js +0 -5
- package/lib/hooks/index.d.ts +29 -28
- package/lib/hooks/index.js +29 -33
- package/lib/hooks/layouts/LayoutBackdrop.js +3 -11
- package/lib/hooks/layouts/LayoutScreenshot.css +58 -0
- package/lib/hooks/layouts/LayoutScreenshot.d.ts +1 -0
- package/lib/hooks/layouts/LayoutScreenshot.js +7 -11
- package/lib/hooks/layouts/index.js +0 -5
- package/lib/hooks/useAIAgents.d.ts +1 -1
- package/lib/hooks/useAIAgents.js +13 -18
- package/lib/hooks/useAuthorization.js +4 -10
- package/lib/hooks/useBackdrop.js +7 -12
- package/lib/hooks/useBackdropJupyterLab.d.ts +1 -1
- package/lib/hooks/useBackdropJupyterLab.js +4 -9
- package/lib/hooks/useCache.d.ts +8 -4
- package/lib/hooks/useCache.js +410 -361
- package/lib/hooks/useCellOutputshot.js +3 -11
- package/lib/hooks/useContainsFocus.js +2 -6
- package/lib/hooks/useDatalayer.d.ts +21 -0
- package/lib/hooks/{useRun.js → useDatalayer.js} +16 -18
- package/lib/hooks/useError.d.ts +1 -1
- package/lib/hooks/useError.js +2 -7
- package/lib/hooks/useExternalScript.js +4 -9
- package/lib/hooks/useFocusTrap.d.ts +1 -1
- package/lib/hooks/useFocusTrap.js +3 -7
- package/lib/hooks/useIAM.js +6 -12
- package/lib/hooks/useId.js +6 -11
- package/lib/hooks/useIsomorphicLayoutEffect.js +0 -5
- package/lib/hooks/useJupyterLabTheme.js +3 -6
- package/lib/hooks/useKeyboardEscape.js +0 -5
- package/lib/hooks/useLocation.d.ts +22 -0
- package/lib/hooks/useLocation.js +149 -0
- package/lib/hooks/useLocationHandles.d.ts +2 -2
- package/lib/hooks/useLocationHandles.js +6 -9
- package/lib/hooks/useNavigate.d.ts +5 -1
- package/lib/hooks/useNavigate.js +62 -12
- package/lib/hooks/useNotebookAIAgent.js +3 -6
- package/lib/hooks/useOnClickOutside.js +0 -5
- package/lib/hooks/useParams.d.ts +5 -0
- package/lib/hooks/useParams.js +152 -0
- package/lib/hooks/useRef.js +0 -5
- package/lib/hooks/useRuntimes.js +2 -7
- package/lib/hooks/useScreenshot.js +5 -10
- package/lib/hooks/useToast.js +21 -21
- package/lib/hooks/useUpload.js +9 -14
- package/lib/hooks/useUser.js +1 -1
- package/lib/hooks/useVisibilityObserver.js +0 -5
- package/lib/hooks/useWindowSize.js +0 -6
- package/lib/i18n/Labels.js +0 -5
- package/lib/i18n/index.js +0 -5
- package/lib/index.css +73 -0
- package/lib/index.d.ts +6 -3
- package/lib/index.js +7 -3
- package/lib/main.js +1 -2
- package/lib/mocks/components/FlashMock.js +4 -9
- package/lib/mocks/components/index.js +0 -5
- package/lib/mocks/hooks/index.d.ts +1 -1
- package/lib/mocks/hooks/index.js +1 -6
- package/lib/mocks/hooks/rests/index.js +0 -5
- package/lib/mocks/hooks/rests/rests.js +15 -23
- package/lib/mocks/hooks/useDatalayerMock.d.ts +6 -0
- package/lib/mocks/hooks/{useRunMock.js → useDatalayerMock.js} +9 -14
- package/lib/mocks/index.js +0 -5
- package/lib/mocks/jupyter/index.js +1 -6
- package/lib/mocks/models/CodeBlockMock.js +1 -6
- package/lib/mocks/models/CodelineMock.js +1 -6
- package/lib/mocks/models/CourseMock.d.ts +1 -1
- package/lib/mocks/models/CourseMock.js +10 -15
- package/lib/mocks/models/InviteMock.d.ts +1 -1
- package/lib/mocks/models/InviteMock.js +21 -11
- package/lib/mocks/models/JupyterLabUserMock.js +2 -2
- package/lib/mocks/models/OrganisationMock.d.ts +1 -1
- package/lib/mocks/models/OrganisationMock.js +11 -7
- package/lib/mocks/models/SchoolMock.d.ts +1 -1
- package/lib/mocks/models/SchoolMock.js +6 -6
- package/lib/mocks/models/SpaceMock.d.ts +1 -1
- package/lib/mocks/models/SpaceMock.js +9 -14
- package/lib/mocks/models/TeamMock.d.ts +1 -1
- package/lib/mocks/models/TeamMock.js +6 -6
- package/lib/mocks/models/UserMock.d.ts +1 -1
- package/lib/mocks/models/UserMock.js +4 -11
- package/lib/mocks/models/index.js +0 -5
- package/lib/mocks/views/ActionMenuMock.js +1 -6
- package/lib/mocks/views/ChartMock.js +3 -8
- package/lib/mocks/views/ChartMockOptions.js +24 -29
- package/lib/mocks/views/DashboardMock.js +74 -79
- package/lib/mocks/views/FormMock.js +1 -6
- package/lib/mocks/views/TableMock.js +1 -6
- package/lib/mocks/views/WipMock.js +0 -5
- package/lib/mocks/views/index.js +0 -5
- package/lib/models/Account.d.ts +2 -2
- package/lib/models/Assignment.d.ts +2 -2
- package/lib/models/Cell.d.ts +1 -1
- package/lib/models/CodeBlock.d.ts +1 -1
- package/lib/models/CodefeedBlocks.d.ts +2 -2
- package/lib/models/Contact.d.ts +1 -1
- package/lib/models/Contact.js +14 -19
- package/lib/models/ContactEvent.js +0 -5
- package/lib/models/ContactIAMProvider.js +2 -2
- package/lib/models/Course.d.ts +7 -7
- package/lib/models/Credits.js +0 -5
- package/lib/models/Dataset.d.ts +2 -2
- package/lib/models/Datasource.js +0 -5
- package/lib/models/Dean.d.ts +1 -1
- package/lib/models/Document.d.ts +1 -1
- package/lib/models/Environment.d.ts +2 -2
- package/lib/models/Errors.js +0 -5
- package/lib/models/Exercise.d.ts +1 -1
- package/lib/models/GrowthKPI.js +0 -5
- package/lib/models/IAMProviderLinked.js +1 -1
- package/lib/models/IAMProviderUsers.js +0 -5
- package/lib/models/IAMToken.js +0 -5
- package/lib/models/Inbound.js +0 -5
- package/lib/models/Instructor.d.ts +1 -1
- package/lib/models/Invite.d.ts +2 -2
- package/lib/models/Invite.js +1 -1
- package/lib/models/Item.d.ts +5 -5
- package/lib/models/LandingRoles.js +18 -23
- package/lib/models/Lesson.d.ts +1 -1
- package/lib/models/Member.d.ts +1 -1
- package/lib/models/Notebook.d.ts +1 -1
- package/lib/models/Organization.d.ts +4 -4
- package/lib/models/Organization.js +2 -7
- package/lib/models/OrganizationMember.d.ts +2 -2
- package/lib/models/Outbound.js +7 -12
- package/lib/models/Page.js +4 -2
- package/lib/models/PageTag.d.ts +2 -2
- package/lib/models/PageTag.js +56 -9
- package/lib/models/Profile.d.ts +1 -1
- package/lib/models/RolesOrganization.d.ts +1 -1
- package/lib/models/RolesOrganization.js +4 -17
- package/lib/models/RolesPlatform.d.ts +1 -1
- package/lib/models/RolesPlatform.js +12 -39
- package/lib/models/RolesTeam.d.ts +1 -1
- package/lib/models/RolesTeam.js +3 -15
- package/lib/models/Runtime.d.ts +59 -1
- package/lib/models/Runtime.js +11 -9
- package/lib/models/RuntimeSnapshot.js +1 -1
- package/lib/models/School.d.ts +4 -4
- package/lib/models/Secret.js +0 -5
- package/lib/models/Space.d.ts +5 -5
- package/lib/models/Space.js +3 -3
- package/lib/models/SpaceItem.d.ts +8 -8
- package/lib/models/SpaceMember.d.ts +2 -2
- package/lib/models/Student.d.ts +2 -2
- package/lib/models/StudentItem.d.ts +3 -3
- package/lib/models/Survey.js +0 -5
- package/lib/models/Team.d.ts +3 -3
- package/lib/models/Team.js +2 -7
- package/lib/models/TeamMember.d.ts +2 -2
- package/lib/models/URN.js +1 -6
- package/lib/models/User.d.ts +2 -2
- package/lib/models/User.js +7 -10
- package/lib/models/UserEvent.js +0 -5
- package/lib/models/UserOnboarding.d.ts +1 -1
- package/lib/models/UserOnboarding.js +7 -12
- package/lib/models/UserSettings.js +2 -7
- package/lib/models/index.d.ts +2 -2
- package/lib/models/index.js +2 -7
- package/lib/navigation/adapters/native.d.ts +11 -0
- package/lib/navigation/adapters/native.js +48 -0
- package/lib/navigation/adapters/nextjs.d.ts +9 -0
- package/lib/navigation/adapters/nextjs.js +35 -0
- package/lib/navigation/adapters/react-router.d.ts +4 -0
- package/lib/navigation/adapters/react-router.js +12 -0
- package/lib/navigation/components.d.ts +20 -0
- package/lib/navigation/components.js +36 -0
- package/lib/navigation/index.d.ts +4 -0
- package/lib/navigation/index.js +12 -0
- package/lib/routes/Routes.js +0 -5
- package/lib/routes/index.d.ts +1 -1
- package/lib/routes/index.js +1 -6
- package/lib/services/DatalayerServiceManager.d.ts +22 -0
- package/lib/services/DatalayerServiceManager.js +79 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +7 -0
- package/lib/services/reconnectToRuntime.d.ts +32 -0
- package/lib/services/reconnectToRuntime.js +59 -0
- package/lib/state/State.d.ts +1 -1
- package/lib/state/State.js +1 -6
- package/lib/state/index.d.ts +1 -1
- package/lib/state/index.js +1 -6
- package/lib/state/storage/IAMStorage.js +14 -7
- package/lib/state/storage/index.d.ts +1 -1
- package/lib/state/storage/index.js +1 -6
- package/lib/state/substates/AIAgentState.js +4 -7
- package/lib/state/substates/CellState.js +6 -10
- package/lib/state/substates/CoreState.d.ts +1 -1
- package/lib/state/substates/CoreState.js +23 -20
- package/lib/state/substates/DatasourceState.js +1 -6
- package/lib/state/substates/DocumentState.js +0 -5
- package/lib/state/substates/GradeState.js +0 -5
- package/lib/state/substates/IAMState.d.ts +5 -1
- package/lib/state/substates/IAMState.js +88 -72
- package/lib/state/substates/JupyterLabState.js +1 -6
- package/lib/state/substates/LayoutState.d.ts +2 -2
- package/lib/state/substates/LayoutState.js +41 -28
- package/lib/state/substates/NbformatState.js +0 -5
- package/lib/state/substates/OrganizationState.js +1 -6
- package/lib/state/substates/RuntimesState.d.ts +2 -2
- package/lib/state/substates/RuntimesState.js +6 -10
- package/lib/state/substates/SpaceState.js +1 -6
- package/lib/state/substates/SurveysState.js +7 -12
- package/lib/state/substates/TeamState.js +1 -6
- package/lib/state/substates/index.js +0 -5
- package/lib/stories/assets/accessibility.png +0 -0
- package/lib/stories/assets/accessibility.svg +1 -0
- package/lib/stories/assets/addon-library.png +0 -0
- package/lib/stories/assets/assets.png +0 -0
- package/lib/stories/assets/context.png +0 -0
- package/lib/stories/assets/discord.svg +1 -0
- package/lib/stories/assets/docs.png +0 -0
- package/lib/stories/assets/figma-plugin.png +0 -0
- package/lib/stories/assets/github.svg +1 -0
- package/lib/stories/assets/share.png +0 -0
- package/lib/stories/assets/styling.png +0 -0
- package/lib/stories/assets/testing.png +0 -0
- package/lib/stories/assets/theming.png +0 -0
- package/lib/stories/assets/tutorials.svg +1 -0
- package/lib/stories/assets/youtube.svg +1 -0
- package/lib/stories/button.css +35 -0
- package/lib/stories/header.css +37 -0
- package/lib/stories/page.css +73 -0
- package/lib/test-setup.js +73 -1
- package/lib/theme/DatalayerTheme.js +1 -6
- package/lib/theme/DatalayerThemeProvider.js +17 -19
- package/lib/theme/Palette.js +1 -6
- package/lib/theme/index.js +0 -5
- package/lib/utils/Array.js +0 -5
- package/lib/utils/Avatar.js +2 -7
- package/lib/utils/Browser.js +6 -11
- package/lib/utils/Cells.d.ts +1 -1
- package/lib/utils/Cookie.js +1 -6
- package/lib/utils/Date.js +5 -10
- package/lib/utils/Download.js +5 -8
- package/lib/utils/DownloadFile.js +4 -7
- package/lib/utils/Env.js +2 -6
- package/lib/utils/File.js +0 -5
- package/lib/utils/Ids.js +0 -5
- package/lib/utils/Jupyter.js +0 -5
- package/lib/utils/Lazy.d.ts +1 -1
- package/lib/utils/Lazy.js +2 -8
- package/lib/utils/Name.js +10 -13
- package/lib/utils/Notebook.d.ts +1 -1
- package/lib/utils/Notebook.js +3 -3
- package/lib/utils/Number.js +13 -14
- package/lib/utils/Plots.d.ts +1 -1
- package/lib/utils/Plots.js +5 -5
- package/lib/utils/Random.js +0 -5
- package/lib/utils/Screenshot.js +1 -6
- package/lib/utils/Scroll.js +3 -7
- package/lib/utils/Sleep.js +1 -6
- package/lib/utils/Snapshot.js +2 -7
- package/lib/utils/String.js +2 -7
- package/lib/utils/Uri.js +2 -7
- package/lib/utils/Validator.js +0 -5
- package/lib/utils/WithSuspense.js +3 -11
- package/lib/utils/index.js +0 -5
- package/package.json +96 -30
- package/style/animation/Animation.module.css +174 -0
- package/style/base.css +64 -0
- package/style/index.css +6 -0
- package/lib/__tests__/App.test.js +0 -17
- package/lib/api/runtimes/models.d.ts +0 -59
- package/lib/api/runtimes/models.js +0 -11
- package/lib/hooks/useRun.d.ts +0 -21
- package/lib/mocks/hooks/useRunMock.d.ts +0 -6
- /package/lib/api/{runtimes → jupyter}/exec/Python.d.ts +0 -0
- /package/lib/api/{runtimes → jupyter}/exec/Snippets.d.ts +0 -0
- /package/lib/api/{runtimes → jupyter}/exec/index.d.ts +0 -0
- /package/lib/{__tests__/App.test.d.ts → examples/main.d.ts} +0 -0
package/lib/models/Space.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { asUser } from
|
|
6
|
-
import { asArray } from
|
|
5
|
+
import { asUser } from './User';
|
|
6
|
+
import { asArray } from '../utils';
|
|
7
7
|
import { newUserMock } from './../mocks/models';
|
|
8
8
|
/**
|
|
9
9
|
* Convert the raw space object to {@link ISpace}.
|
|
@@ -33,7 +33,7 @@ export const asSpace = (raw_space) => {
|
|
|
33
33
|
owner,
|
|
34
34
|
organization: {
|
|
35
35
|
handle: raw_space.handle_s,
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
37
|
};
|
|
38
38
|
return space;
|
|
39
39
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { INotebook } from
|
|
2
|
-
import { IDocument } from
|
|
3
|
-
import { ICell } from
|
|
4
|
-
import { IDataset } from
|
|
5
|
-
import { IEnvironment } from
|
|
6
|
-
import { ILesson } from
|
|
7
|
-
import { IExercise } from
|
|
8
|
-
import { IAssignment } from
|
|
1
|
+
import { INotebook } from './Notebook';
|
|
2
|
+
import { IDocument } from './Document';
|
|
3
|
+
import { ICell } from './Cell';
|
|
4
|
+
import { IDataset } from './Dataset';
|
|
5
|
+
import { IEnvironment } from './Environment';
|
|
6
|
+
import { ILesson } from './Lesson';
|
|
7
|
+
import { IExercise } from './Exercise';
|
|
8
|
+
import { IAssignment } from './Assignment';
|
|
9
9
|
export type ISpaceItem = IDataset | INotebook | ICell | IEnvironment | ILesson | IExercise | IAssignment | IDocument;
|
|
10
10
|
export default ISpaceItem;
|
package/lib/models/Student.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IItemType } from
|
|
2
|
-
import { IStudent } from
|
|
3
|
-
import { ISpaceItem } from
|
|
1
|
+
import { IItemType } from './ItemType';
|
|
2
|
+
import { IStudent } from './Student';
|
|
3
|
+
import { ISpaceItem } from './SpaceItem';
|
|
4
4
|
export type IStudentItem = {
|
|
5
5
|
id: string;
|
|
6
6
|
type: 'student_item';
|
package/lib/models/Survey.js
CHANGED
package/lib/models/Team.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TeamMember } from
|
|
2
|
-
import IOrganization from
|
|
1
|
+
import { TeamMember } from './TeamMember';
|
|
2
|
+
import IOrganization from './Organization';
|
|
3
3
|
export type IAnyTeam = ITeam;
|
|
4
4
|
export declare function asTeam(t: any, organizationId: string): ITeam;
|
|
5
5
|
export type IBaseTeam = {
|
|
@@ -16,7 +16,7 @@ export type IBaseTeam = {
|
|
|
16
16
|
};
|
|
17
17
|
export type ITeam = IBaseTeam & {
|
|
18
18
|
type: 'team';
|
|
19
|
-
organization: Pick<IOrganization,
|
|
19
|
+
organization: Pick<IOrganization, 'id'>;
|
|
20
20
|
members: TeamMember[];
|
|
21
21
|
};
|
|
22
22
|
export default ITeam;
|
package/lib/models/Team.js
CHANGED
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
|
-
import { asArray } from "../utils";
|
|
11
|
-
import { asUser } from "./User";
|
|
5
|
+
import { asArray } from '../utils';
|
|
6
|
+
import { asUser } from './User';
|
|
12
7
|
export function asTeam(t, organizationId) {
|
|
13
8
|
let members = new Array();
|
|
14
9
|
if (t.members) {
|
package/lib/models/URN.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export class URN {
|
|
11
6
|
_partition;
|
|
12
7
|
_service;
|
|
@@ -16,7 +11,7 @@ export class URN {
|
|
|
16
11
|
_uid;
|
|
17
12
|
// private _path: string;
|
|
18
13
|
constructor(urn) {
|
|
19
|
-
const parts = urn.split(
|
|
14
|
+
const parts = urn.split(':');
|
|
20
15
|
this._partition = parts[1];
|
|
21
16
|
this._service = parts[2];
|
|
22
17
|
this._region = parts[3];
|
package/lib/models/User.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IInvite } from
|
|
2
|
-
import { IIAMProviderLinked } from
|
|
1
|
+
import { IInvite } from './Invite';
|
|
2
|
+
import { IIAMProviderLinked } from './IAMProviderLinked';
|
|
3
3
|
import { IUserOnboarding } from './UserOnboarding';
|
|
4
4
|
import { IUserSettings } from './UserSettings';
|
|
5
5
|
import { IUserEvent } from './UserEvent';
|
package/lib/models/User.js
CHANGED
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
import { asDisplayName, namesAsInitials } from '../utils';
|
|
11
|
-
import { asIAMProviderLinked } from
|
|
6
|
+
import { asIAMProviderLinked } from './IAMProviderLinked';
|
|
12
7
|
import { BOOTSTRAP_USER_ONBOARDING } from './UserOnboarding';
|
|
13
8
|
import { UserSettings } from './UserSettings';
|
|
14
9
|
import { asUserEvent } from './UserEvent';
|
|
@@ -61,11 +56,11 @@ export class User {
|
|
|
61
56
|
this.lastName = u.last_name_t;
|
|
62
57
|
this.initials = namesAsInitials(u.first_name_t, u.last_name_t);
|
|
63
58
|
const displayName = asDisplayName(u.first_name_t, u.last_name_t);
|
|
64
|
-
this.displayName = displayName ===
|
|
59
|
+
this.displayName = displayName === '' ? u.handle_s : displayName;
|
|
65
60
|
this.avatarUrl = u.avatar_url_s;
|
|
66
61
|
this.origin = u.origin_s;
|
|
67
|
-
this.joinDate = u.join_ts_dt ? new Date(u.join_ts_dt) : undefined
|
|
68
|
-
|
|
62
|
+
this.joinDate = u.join_ts_dt ? new Date(u.join_ts_dt) : undefined;
|
|
63
|
+
this.credits = u.credits_i ? Number(u.credits_i) : 0;
|
|
69
64
|
this.creditsCustomerId = u.credits_customer_uid;
|
|
70
65
|
this.roles = u.roles_ss ?? [];
|
|
71
66
|
let iamProviders = [];
|
|
@@ -79,7 +74,9 @@ export class User {
|
|
|
79
74
|
this.settings = new UserSettings(u.settings ?? {});
|
|
80
75
|
this.unsubscribedFromOutbounds = u.unsubscribed_from_outbounds_b ?? false;
|
|
81
76
|
this.mfaUrl = u.mfa_url_s;
|
|
82
|
-
this.onboarding = u.onboarding_s
|
|
77
|
+
this.onboarding = u.onboarding_s
|
|
78
|
+
? JSON.parse(u.onboarding_s)
|
|
79
|
+
: BOOTSTRAP_USER_ONBOARDING;
|
|
83
80
|
this.linkedContactId = u.linked_contact_uid;
|
|
84
81
|
let events = u.events ?? [];
|
|
85
82
|
if (!Array.isArray(events)) {
|
package/lib/models/UserEvent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const WELCOME_RUNTIME_TOUR_NAME = "welcome-runtime";
|
|
2
2
|
export declare const BOOTSTRAP_USER_ONBOARDING: IUserOnboarding;
|
|
3
3
|
export type IOnboardingPosition = 'top' | 'bottom' | 'invisible' | 'sidebar';
|
|
4
|
-
export type ITourStatus =
|
|
4
|
+
export type ITourStatus = 'idle' | 'ready' | 'waiting' | 'running' | 'paused' | 'skipped' | 'finished' | 'error';
|
|
5
5
|
export type ITour = {
|
|
6
6
|
status: ITourStatus;
|
|
7
7
|
};
|
|
@@ -2,23 +2,18 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
|
-
export const WELCOME_RUNTIME_TOUR_NAME = "welcome-runtime";
|
|
5
|
+
export const WELCOME_RUNTIME_TOUR_NAME = 'welcome-runtime';
|
|
11
6
|
export const BOOTSTRAP_USER_ONBOARDING = {
|
|
12
7
|
clients: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
Platform: 0,
|
|
9
|
+
JupyterLab: 0,
|
|
10
|
+
CLI: 0,
|
|
11
|
+
VSCode: 0,
|
|
17
12
|
},
|
|
18
13
|
position: 'top',
|
|
19
14
|
tours: {
|
|
20
|
-
|
|
21
|
-
status:
|
|
15
|
+
'welcome-runtime': {
|
|
16
|
+
status: 'ready',
|
|
22
17
|
},
|
|
23
18
|
},
|
|
24
19
|
};
|
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
|
-
export const AI_AGENTS_URL_KEY = "aiagents_url_s";
|
|
11
|
-
export const CAN_INVITE_URL_KEY = "can_invite_b";
|
|
5
|
+
export const AI_AGENTS_URL_KEY = 'aiagents_url_s';
|
|
6
|
+
export const CAN_INVITE_URL_KEY = 'can_invite_b';
|
|
12
7
|
export class UserSettings {
|
|
13
8
|
_aiAgentsUrl;
|
|
14
9
|
_canInvite;
|
package/lib/models/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export * from './Cell';
|
|
|
5
5
|
export * from './CodeBlock';
|
|
6
6
|
export * from './CodefeedBlocks';
|
|
7
7
|
export * from './Contact';
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
8
|
+
export * from './ContactEvent';
|
|
9
|
+
export * from './ContactIAMProvider';
|
|
10
10
|
export * from './ContactTags';
|
|
11
11
|
export * from './Content';
|
|
12
12
|
export * from './Course';
|
package/lib/models/index.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export * from './AIAgent';
|
|
11
6
|
export * from './Base';
|
|
12
7
|
export * from './Assignment';
|
|
@@ -14,8 +9,8 @@ export * from './Cell';
|
|
|
14
9
|
export * from './CodeBlock';
|
|
15
10
|
export * from './CodefeedBlocks';
|
|
16
11
|
export * from './Contact';
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
12
|
+
export * from './ContactEvent';
|
|
13
|
+
export * from './ContactIAMProvider';
|
|
19
14
|
export * from './ContactTags';
|
|
20
15
|
export * from './Content';
|
|
21
16
|
export * from './Course';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create native browser navigation function
|
|
3
|
+
*/
|
|
4
|
+
export declare const createNativeNavigate: () => (to: string, options?: any) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Simple native adapter for backward compatibility
|
|
7
|
+
*/
|
|
8
|
+
export declare const createNativeAdapter: () => {
|
|
9
|
+
name: string;
|
|
10
|
+
isAvailable: () => boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
// Global event emitter for navigation changes
|
|
6
|
+
const navigationListeners = new Set();
|
|
7
|
+
const notifyNavigationChange = () => {
|
|
8
|
+
navigationListeners.forEach(listener => listener());
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Create native browser navigation function
|
|
12
|
+
*/
|
|
13
|
+
export const createNativeNavigate = () => {
|
|
14
|
+
return (to, options) => {
|
|
15
|
+
if (typeof window === 'undefined')
|
|
16
|
+
return;
|
|
17
|
+
// Parse the URL
|
|
18
|
+
const url = new URL(to, window.location.href);
|
|
19
|
+
// Use options if provided, otherwise default to empty object
|
|
20
|
+
const navOptions = options || {};
|
|
21
|
+
const state = navOptions.state || null;
|
|
22
|
+
if (navOptions.replace) {
|
|
23
|
+
window.history.replaceState(state, '', url.href);
|
|
24
|
+
// Dispatch custom event for location hooks
|
|
25
|
+
window.dispatchEvent(new Event('replacestate'));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
window.history.pushState(state, '', url.href);
|
|
29
|
+
// Dispatch custom event for location hooks
|
|
30
|
+
window.dispatchEvent(new Event('pushstate'));
|
|
31
|
+
}
|
|
32
|
+
// Notify all listeners of the navigation
|
|
33
|
+
notifyNavigationChange();
|
|
34
|
+
// Handle scrolling
|
|
35
|
+
if (navOptions.scroll !== false) {
|
|
36
|
+
window.scrollTo(0, 0);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Simple native adapter for backward compatibility
|
|
42
|
+
*/
|
|
43
|
+
export const createNativeAdapter = () => {
|
|
44
|
+
return {
|
|
45
|
+
name: 'native',
|
|
46
|
+
isAvailable: () => typeof window !== 'undefined' && !!window.history && !!window.location,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if we're in a Next.js environment
|
|
3
|
+
*/
|
|
4
|
+
export declare const isNextJsEnvironment: () => boolean;
|
|
5
|
+
export declare const useParamsNext: any;
|
|
6
|
+
export declare const useSearchParamsNext: any;
|
|
7
|
+
export declare const useRouterNext: any;
|
|
8
|
+
export declare const usePathnameNext: any;
|
|
9
|
+
export declare const useRouterNextPages: any;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
// Try to import Next.js modules if available
|
|
6
|
+
let nextNavigationModule = null;
|
|
7
|
+
let nextRouterModule = null;
|
|
8
|
+
// Only try to load Next.js modules if we're in a Next.js environment
|
|
9
|
+
if (typeof window !== 'undefined' && window.__NEXT_DATA__) {
|
|
10
|
+
try {
|
|
11
|
+
nextNavigationModule = require('next/navigation');
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// Next.js App Router not available
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
nextRouterModule = require('next/router');
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Next.js Pages Router not available
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if we're in a Next.js environment
|
|
25
|
+
*/
|
|
26
|
+
export const isNextJsEnvironment = () => {
|
|
27
|
+
return typeof window !== 'undefined' && window.__NEXT_DATA__;
|
|
28
|
+
};
|
|
29
|
+
// Export App Router hooks directly for synchronous access
|
|
30
|
+
export const useParamsNext = nextNavigationModule?.useParams || undefined;
|
|
31
|
+
export const useSearchParamsNext = nextNavigationModule?.useSearchParams || undefined;
|
|
32
|
+
export const useRouterNext = nextNavigationModule?.useRouter || undefined;
|
|
33
|
+
export const usePathnameNext = nextNavigationModule?.usePathname || undefined;
|
|
34
|
+
// Export Pages Router hooks (for potential future use)
|
|
35
|
+
export const useRouterNextPages = nextRouterModule?.useRouter || undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
// Import React Router hooks directly
|
|
6
|
+
// If react-router-dom is not installed, the build will fail
|
|
7
|
+
// which is expected behavior
|
|
8
|
+
import * as ReactRouterDom from 'react-router-dom';
|
|
9
|
+
// Export hooks for use in our navigation hooks
|
|
10
|
+
export const useParamsRR = ReactRouterDom.useParams;
|
|
11
|
+
export const useLocationRR = ReactRouterDom.useLocation;
|
|
12
|
+
export const useNavigateRR = ReactRouterDom.useNavigate;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface NavigationLinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
|
|
3
|
+
to: string;
|
|
4
|
+
replace?: boolean;
|
|
5
|
+
state?: any;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Navigation link component that works with any routing solution
|
|
9
|
+
*/
|
|
10
|
+
export declare const NavigationLink: React.ForwardRefExoticComponent<NavigationLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
|
+
/**
|
|
12
|
+
* Compatibility export for react-router-dom Link
|
|
13
|
+
* @deprecated Use NavigationLink
|
|
14
|
+
*/
|
|
15
|
+
export declare const Link: React.ForwardRefExoticComponent<NavigationLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
16
|
+
/**
|
|
17
|
+
* Compatibility export for react-router-dom NavLink
|
|
18
|
+
* @deprecated Use NavigationLink with custom styling
|
|
19
|
+
*/
|
|
20
|
+
export declare const NavLink: React.ForwardRefExoticComponent<NavigationLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { 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 { forwardRef, useCallback } from 'react';
|
|
7
|
+
import { useNavigate } from '../hooks/useNavigate';
|
|
8
|
+
/**
|
|
9
|
+
* Navigation link component that works with any routing solution
|
|
10
|
+
*/
|
|
11
|
+
export const NavigationLink = forwardRef(({ to, children, replace = false, state, onClick, ...props }, ref) => {
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const handleClick = useCallback((e) => {
|
|
14
|
+
// Allow custom onClick handler
|
|
15
|
+
if (onClick) {
|
|
16
|
+
onClick(e);
|
|
17
|
+
}
|
|
18
|
+
// If not prevented, navigate
|
|
19
|
+
if (!e.defaultPrevented) {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
navigate(to, e, true, { replace, state });
|
|
22
|
+
}
|
|
23
|
+
}, [to, replace, state, navigate, onClick]);
|
|
24
|
+
return (_jsx("a", { ref: ref, href: to, onClick: handleClick, ...props, children: children }));
|
|
25
|
+
});
|
|
26
|
+
NavigationLink.displayName = 'NavigationLink';
|
|
27
|
+
/**
|
|
28
|
+
* Compatibility export for react-router-dom Link
|
|
29
|
+
* @deprecated Use NavigationLink
|
|
30
|
+
*/
|
|
31
|
+
export const Link = NavigationLink;
|
|
32
|
+
/**
|
|
33
|
+
* Compatibility export for react-router-dom NavLink
|
|
34
|
+
* @deprecated Use NavigationLink with custom styling
|
|
35
|
+
*/
|
|
36
|
+
export const NavLink = NavigationLink;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useParamsRR, useLocationRR, useNavigateRR, } from './adapters/react-router';
|
|
2
|
+
export { useParamsNext, useSearchParamsNext, useRouterNext, usePathnameNext, useRouterNextPages, isNextJsEnvironment, } from './adapters/nextjs';
|
|
3
|
+
export { createNativeAdapter, createNativeNavigate } from './adapters/native';
|
|
4
|
+
export { NavigationLink, Link, NavLink } from './components';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
// Export React Router hook exports for direct use
|
|
6
|
+
export { useParamsRR, useLocationRR, useNavigateRR, } from './adapters/react-router';
|
|
7
|
+
// Export Next.js hook exports for direct use
|
|
8
|
+
export { useParamsNext, useSearchParamsNext, useRouterNext, usePathnameNext, useRouterNextPages, isNextJsEnvironment, } from './adapters/nextjs';
|
|
9
|
+
// Native adapter utilities
|
|
10
|
+
export { createNativeAdapter, createNativeNavigate } from './adapters/native';
|
|
11
|
+
// Export components if they exist
|
|
12
|
+
export { NavigationLink, Link, NavLink } from './components';
|
package/lib/routes/Routes.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export const CONTACT_ROUTE = 'contact';
|
|
11
6
|
export const SUPPORT_ROUTE = 'support';
|
|
12
7
|
export const USAGE_ROUTE = 'usage';
|
package/lib/routes/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './Routes';
|
package/lib/routes/index.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ServiceManager } from '@jupyterlab/services';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a ServiceManager configured for Datalayer's infrastructure
|
|
4
|
+
*
|
|
5
|
+
* This function requests a new kernel from Datalayer's platform and
|
|
6
|
+
* returns a configured ServiceManager that connects to the allocated
|
|
7
|
+
* Jupyter server instance.
|
|
8
|
+
*
|
|
9
|
+
* @param environmentName - The name of the Datalayer environment to use
|
|
10
|
+
* @param credits - The credit limit for this kernel session
|
|
11
|
+
* @returns A configured ServiceManager instance
|
|
12
|
+
* @throws Error if the kernel request fails or configuration is missing
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const serviceManager = await createDatalayerServiceManager('python-cpu-env', 100);
|
|
17
|
+
* await serviceManager.ready;
|
|
18
|
+
* // Use the service manager with notebooks
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const createDatalayerServiceManager: (environmentName?: string, credits?: number) => Promise<ServiceManager.IManager>;
|
|
22
|
+
export default createDatalayerServiceManager;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { ServerConnection, ServiceManager } from '@jupyterlab/services';
|
|
6
|
+
import { coreStore } from '../state/substates/CoreState';
|
|
7
|
+
import { DEFAULT_DATALAYER_CONFIG } from '../config/Configuration';
|
|
8
|
+
import { createRuntime } from '../api/runtimes/actions';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a ServiceManager configured for Datalayer's infrastructure
|
|
11
|
+
*
|
|
12
|
+
* This function requests a new kernel from Datalayer's platform and
|
|
13
|
+
* returns a configured ServiceManager that connects to the allocated
|
|
14
|
+
* Jupyter server instance.
|
|
15
|
+
*
|
|
16
|
+
* @param environmentName - The name of the Datalayer environment to use
|
|
17
|
+
* @param credits - The credit limit for this kernel session
|
|
18
|
+
* @returns A configured ServiceManager instance
|
|
19
|
+
* @throws Error if the kernel request fails or configuration is missing
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const serviceManager = await createDatalayerServiceManager('python-cpu-env', 100);
|
|
24
|
+
* await serviceManager.ready;
|
|
25
|
+
* // Use the service manager with notebooks
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const createDatalayerServiceManager = async (environmentName, credits) => {
|
|
29
|
+
const { configuration } = coreStore.getState();
|
|
30
|
+
const token = configuration?.token || '';
|
|
31
|
+
// Use provided values or fall back to config or defaults
|
|
32
|
+
const actualEnvironmentName = environmentName ||
|
|
33
|
+
configuration?.cpuEnvironment ||
|
|
34
|
+
DEFAULT_DATALAYER_CONFIG.cpuEnvironment;
|
|
35
|
+
const actualCredits = credits ?? configuration?.credits ?? DEFAULT_DATALAYER_CONFIG.credits;
|
|
36
|
+
if (!token) {
|
|
37
|
+
throw new Error('Datalayer API token is required to create a service manager');
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
// Use the existing createRuntime function which handles auth properly
|
|
41
|
+
const runtime = await createRuntime({
|
|
42
|
+
environmentName: actualEnvironmentName,
|
|
43
|
+
type: 'notebook',
|
|
44
|
+
givenName: `Jupyter React Kernel - ${new Date().toISOString()}`,
|
|
45
|
+
creditsLimit: actualCredits,
|
|
46
|
+
capabilities: [],
|
|
47
|
+
});
|
|
48
|
+
const serverSettings = ServerConnection.makeSettings({
|
|
49
|
+
baseUrl: runtime.ingress,
|
|
50
|
+
wsUrl: runtime.ingress.replace(/^http/, 'ws'),
|
|
51
|
+
token: runtime.token,
|
|
52
|
+
appendToken: true,
|
|
53
|
+
});
|
|
54
|
+
const serviceManager = new ServiceManager({ serverSettings });
|
|
55
|
+
// Store runtime info on the serviceManager instance for access
|
|
56
|
+
serviceManager.__datalayerRuntime = {
|
|
57
|
+
environmentName: actualEnvironmentName,
|
|
58
|
+
credits: actualCredits,
|
|
59
|
+
reservationId: runtime.reservation_id,
|
|
60
|
+
podName: runtime.pod_name,
|
|
61
|
+
ingress: runtime.ingress,
|
|
62
|
+
token: runtime.token,
|
|
63
|
+
createdAt: new Date().toISOString(),
|
|
64
|
+
};
|
|
65
|
+
console.log('Created Datalayer service manager:', {
|
|
66
|
+
environmentName: actualEnvironmentName,
|
|
67
|
+
credits: actualCredits,
|
|
68
|
+
reservationId: runtime.reservation_id,
|
|
69
|
+
podName: runtime.pod_name,
|
|
70
|
+
ingress: runtime.ingress,
|
|
71
|
+
});
|
|
72
|
+
return serviceManager;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Error creating Datalayer service manager:', error);
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export default createDatalayerServiceManager;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createDatalayerServiceManager } from './DatalayerServiceManager';
|
|
2
|
+
export { default as DatalayerServiceManager } from './DatalayerServiceManager';
|
|
3
|
+
export { reconnectToRuntime } from './reconnectToRuntime';
|
|
4
|
+
export type { RuntimeInfo } from './reconnectToRuntime';
|