@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
|
@@ -3,11 +3,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import { useState } from 'react';
|
|
12
7
|
import { Box, Button, PageLayout } from '@primer/react';
|
|
13
8
|
import { Dialog } from '@primer/react/experimental';
|
|
@@ -16,9 +11,6 @@ const DataTableDetails = (props) => {
|
|
|
16
11
|
};
|
|
17
12
|
export const DataTable = (props) => {
|
|
18
13
|
const [dialog, setDialog] = useState(false);
|
|
19
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, { children: dialog ?
|
|
20
|
-
_jsx(Dialog, { sx: { width: "100%", height: '100%' }, onClose: e => setDialog(false), children: _jsx(DataTableDetails, { ...props }) })
|
|
21
|
-
:
|
|
22
|
-
_jsx(DataTableDetails, { ...props }) }), _jsx(Box, { children: _jsx(Button, { onClick: e => setDialog(true), children: "Zoom" }) })] }));
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { children: dialog ? (_jsx(Dialog, { sx: { width: '100%', height: '100%' }, onClose: e => setDialog(false), children: _jsx(DataTableDetails, { ...props }) })) : (_jsx(DataTableDetails, { ...props })) }), _jsx(Box, { children: _jsx(Button, { onClick: e => setDialog(true), children: "Zoom" }) })] }));
|
|
23
15
|
};
|
|
24
16
|
export default DataTable;
|
|
@@ -3,11 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import React, { useEffect } from 'react';
|
|
12
7
|
import clsx from 'clsx';
|
|
13
8
|
import { useTextRevealAnimationLines } from './useTextRevealAnimationLines';
|
|
@@ -45,11 +40,15 @@ export function TextRevealAnimation({ children, ...rest }) {
|
|
|
45
40
|
}
|
|
46
41
|
};
|
|
47
42
|
}, [ref]);
|
|
48
|
-
if (typeof children !== 'string' &&
|
|
49
|
-
|
|
43
|
+
if (typeof children !== 'string' &&
|
|
44
|
+
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test')) {
|
|
50
45
|
console.warn('Children passed to TextRevealAnimation must be a string');
|
|
51
46
|
return null;
|
|
52
47
|
}
|
|
53
48
|
return (_jsx("span", { ref: ref, ...rest, children: lines?.map((line, i) => (_jsxs(React.Fragment, { children: [_jsx("span", { className: clsx(styles.TextRevealAnimation, animationStarted && styles['TextRevealAnimation--visible'], animationStarted &&
|
|
54
|
-
(hasAnimationCompleted
|
|
49
|
+
(hasAnimationCompleted
|
|
50
|
+
? styles['TextRevealAnimation']
|
|
51
|
+
: styles['TextRevealAnimation--animated'])), style: {
|
|
52
|
+
'--animation-delay': `${220 + i * 200}ms`,
|
|
53
|
+
}, onAnimationEnd: () => onLineAnimationEnd(i), children: line }), ' '] }, line))) }));
|
|
55
54
|
}
|
|
@@ -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
|
+
@keyframes wipe {
|
|
7
|
+
from {
|
|
8
|
+
transform: scaleX(1);
|
|
9
|
+
}
|
|
10
|
+
to {
|
|
11
|
+
transform: scaleX(0);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.TextRevealAnimation {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
transition: opacity var(--brand-animation-duration-default)
|
|
18
|
+
var(--brand-animation-easing-default);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.TextRevealAnimation--visible {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.TextRevealAnimation,
|
|
26
|
+
.TextRevealAnimation--animated {
|
|
27
|
+
width: 100%;
|
|
28
|
+
min-height: 1lh;
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.TextRevealAnimation--animated::after {
|
|
33
|
+
content: '';
|
|
34
|
+
display: inline;
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
background-color: var(--brand-color-accent-primary);
|
|
41
|
+
transform-origin: right;
|
|
42
|
+
animation: wipe var(--brand-animation-duration-extended) forwards
|
|
43
|
+
var(--brand-animation-easing-default);
|
|
44
|
+
animation-delay: var(--animation-delay);
|
|
45
|
+
}
|
|
@@ -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
|
import { useRef, useEffect, useState } from 'react';
|
|
11
6
|
export const useTextRevealAnimationLines = (text) => {
|
|
12
7
|
const ref = useRef(null);
|
|
@@ -3,20 +3,15 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
|
-
import { Token } from "@primer/react";
|
|
12
|
-
import { ProjectIcon } from "@primer/octicons-react";
|
|
13
|
-
import { StudentIcon } from "@datalayer/icons-react";
|
|
6
|
+
import { Token } from '@primer/react';
|
|
7
|
+
import { ProjectIcon } from '@primer/octicons-react';
|
|
8
|
+
import { StudentIcon } from '@datalayer/icons-react';
|
|
14
9
|
export const SpaceVariantToken = (props) => {
|
|
15
10
|
const { variant } = props;
|
|
16
11
|
switch (variant) {
|
|
17
|
-
case
|
|
12
|
+
case 'default':
|
|
18
13
|
return _jsx(Token, { text: "default", leadingVisual: ProjectIcon });
|
|
19
|
-
case
|
|
14
|
+
case 'course':
|
|
20
15
|
return _jsx(Token, { text: "course", leadingVisual: StudentIcon });
|
|
21
16
|
default:
|
|
22
17
|
return _jsx(_Fragment, {});
|
|
@@ -3,11 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import { Button, Box } from '@primer/react';
|
|
12
7
|
import { RepoPushIcon, PlayIcon, StopIcon } from '@primer/octicons-react';
|
|
13
8
|
import { notebookStore } from '@datalayer/jupyter-react';
|
|
@@ -16,8 +11,6 @@ export const AssignmentEditorToolbar = (props) => {
|
|
|
16
11
|
const { notebookId } = props;
|
|
17
12
|
const { grade } = useGradeStore();
|
|
18
13
|
const notebook = notebookStore.getState().selectNotebook(notebookId);
|
|
19
|
-
return (_jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }), notebook?.kernelStatus !== 'busy' &&
|
|
20
|
-
_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: PlayIcon, onClick: e => notebookStore.getState().runAll(notebookId), children: "Run all" }) }), notebook?.kernelStatus === 'busy' &&
|
|
21
|
-
_jsx(Box, { children: _jsx(Button, { variant: "danger", size: "small", leadingVisual: StopIcon, onClick: e => notebookStore.getState().interrupt(notebookId), children: "Interrupt" }) })] }));
|
|
14
|
+
return (_jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }), notebook?.kernelStatus !== 'busy' && (_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: PlayIcon, onClick: e => notebookStore.getState().runAll(notebookId), children: "Run all" }) })), notebook?.kernelStatus === 'busy' && (_jsx(Box, { children: _jsx(Button, { variant: "danger", size: "small", leadingVisual: StopIcon, onClick: e => notebookStore.getState().interrupt(notebookId), children: "Interrupt" }) }))] }));
|
|
22
15
|
};
|
|
23
16
|
export default AssignmentEditorToolbar;
|
|
@@ -3,11 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import { Button, Box } from '@primer/react';
|
|
12
7
|
import { RepoPushIcon } from '@primer/octicons-react';
|
|
13
8
|
import { documentStore } from '../../state';
|
|
@@ -3,11 +3,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import { NotebookCommandIds } from '@datalayer/jupyter-react';
|
|
12
7
|
import { Button } from '@primer/react';
|
|
13
8
|
import { PlayIcon, StopIcon } from '@primer/octicons-react';
|
|
@@ -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 './AssignmentEditorToolbar';
|
|
11
6
|
export * from './DocumentEditorToolbar';
|
|
12
7
|
export * from './NotebookEditorToolbar';
|
|
@@ -15,4 +15,4 @@ export type IPeersIndicatorProps = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Connected peers indicator
|
|
17
17
|
*/
|
|
18
|
-
export declare function PeersIndicator({ awareness, currentUserHandle }: IPeersIndicatorProps): JSX.Element | null;
|
|
18
|
+
export declare function PeersIndicator({ awareness, currentUserHandle, }: IPeersIndicatorProps): JSX.Element | null;
|
|
@@ -3,11 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import { useEffect, useState } from 'react';
|
|
12
7
|
import { Avatar, AvatarStack } from '@primer/react';
|
|
13
8
|
import { getAvatarURL, getRelativeTime } from '../../utils';
|
|
@@ -23,7 +18,7 @@ var NotificationType;
|
|
|
23
18
|
const MSG_TO_NOTIFICATION = {
|
|
24
19
|
'-1': NotificationType.ERROR,
|
|
25
20
|
'0': NotificationType.PROGRESS,
|
|
26
|
-
'1': NotificationType.SUCCESS
|
|
21
|
+
'1': NotificationType.SUCCESS,
|
|
27
22
|
};
|
|
28
23
|
function isExpired(timestamp) {
|
|
29
24
|
// Timestamp is expired if older than 10 seconds ago
|
|
@@ -36,7 +31,7 @@ function defaultAvatarSrc(color, text) {
|
|
|
36
31
|
/**
|
|
37
32
|
* Connected peers indicator
|
|
38
33
|
*/
|
|
39
|
-
export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
34
|
+
export function PeersIndicator({ awareness, currentUserHandle, }) {
|
|
40
35
|
const [peers, setPeers] = useState([]);
|
|
41
36
|
useEffect(() => {
|
|
42
37
|
const onAwarenessChange = () => {
|
|
@@ -63,7 +58,7 @@ export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
|
63
58
|
notificationType: notExpiredNotification &&
|
|
64
59
|
peer.notification?.message_type !== undefined
|
|
65
60
|
? MSG_TO_NOTIFICATION[peer.notification?.message_type.toString()]
|
|
66
|
-
: undefined
|
|
61
|
+
: undefined,
|
|
67
62
|
}
|
|
68
63
|
: {
|
|
69
64
|
avatarUrl: user.avatar_url,
|
|
@@ -71,7 +66,7 @@ export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
|
71
66
|
displayName: user.display_name,
|
|
72
67
|
handle: user.name,
|
|
73
68
|
initials: user.initials,
|
|
74
|
-
username: user.username
|
|
69
|
+
username: user.username,
|
|
75
70
|
};
|
|
76
71
|
// Ensure to display a peer only once
|
|
77
72
|
if (!agg.map(p => p.username).includes(newPeer.username)) {
|
|
@@ -97,7 +92,7 @@ export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
|
97
92
|
return (_jsx(Avatar, { sx: {
|
|
98
93
|
border: peer.notificationType
|
|
99
94
|
? `var(--borderWidth-thick) solid ${peer.notificationType}`
|
|
100
|
-
: 'none'
|
|
95
|
+
: 'none',
|
|
101
96
|
}, title: title, src: peer.avatarUrl
|
|
102
97
|
? getAvatarURL(peer.avatarUrl)
|
|
103
98
|
: defaultAvatarSrc(peer.color, peer.initials), size: AVATAR_SIZE }, peer.displayName));
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { ISignal } from '@lumino/signaling';
|
|
2
2
|
export declare const FORCE_ACTIVATE_RUNTIMES_PLUGINS = false;
|
|
3
|
+
/**
|
|
4
|
+
* Configuration interface for Datalayer platform integration
|
|
5
|
+
*
|
|
6
|
+
* This interface defines the configuration needed to connect to
|
|
7
|
+
* and interact with the Datalayer platform services.
|
|
8
|
+
*/
|
|
3
9
|
export type IDatalayerCoreConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* Datalayer RUN URL.
|
|
12
|
+
* The base URL for the Datalayer platform API.
|
|
13
|
+
* @example "https://prod1.datalayer.run"
|
|
14
|
+
*/
|
|
15
|
+
runUrl: string;
|
|
16
|
+
/**
|
|
17
|
+
* Datalayer API authentication token.
|
|
18
|
+
* Used for authenticating requests to the Datalayer platform.
|
|
19
|
+
*/
|
|
20
|
+
token: string;
|
|
21
|
+
/**
|
|
22
|
+
* Credits limit for kernel usage.
|
|
23
|
+
* Determines the maximum credits that can be consumed by kernels.
|
|
24
|
+
*/
|
|
25
|
+
credits: number;
|
|
26
|
+
/**
|
|
27
|
+
* CPU environment name.
|
|
28
|
+
* Specifies which CPU-based environment to use for kernels.
|
|
29
|
+
* @example "python-cpu-env"
|
|
30
|
+
*/
|
|
31
|
+
cpuEnvironment: string;
|
|
32
|
+
/**
|
|
33
|
+
* GPU environment name.
|
|
34
|
+
* Specifies which GPU-enabled environment to use for kernels.
|
|
35
|
+
* @example "ai-env"
|
|
36
|
+
*/
|
|
37
|
+
gpuEnvironment: string;
|
|
4
38
|
/**
|
|
5
39
|
* Use mock model, useful for e.g. storybooks.
|
|
6
40
|
*/
|
|
@@ -108,4 +142,18 @@ export declare class DatalayerConfiguration {
|
|
|
108
142
|
get configuration(): IDatalayerCoreConfig;
|
|
109
143
|
get configurationChanged(): ISignal<DatalayerConfiguration, IDatalayerCoreConfig>;
|
|
110
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Default configuration values for Datalayer
|
|
147
|
+
*/
|
|
148
|
+
export declare const DEFAULT_DATALAYER_CONFIG: Partial<IDatalayerCoreConfig>;
|
|
149
|
+
/**
|
|
150
|
+
* Type guard to check if a config object is a valid IDatalayerConfig
|
|
151
|
+
*/
|
|
152
|
+
export declare function isDatalayerConfig(config: any): config is IDatalayerCoreConfig;
|
|
153
|
+
/**
|
|
154
|
+
* Helper function to merge partial config with defaults
|
|
155
|
+
* @param config Partial configuration to merge
|
|
156
|
+
* @returns Complete configuration with defaults applied, or undefined if required fields missing
|
|
157
|
+
*/
|
|
158
|
+
export declare function mergeConfigWithDefaults(config?: Partial<IDatalayerCoreConfig>): Partial<IDatalayerCoreConfig> | undefined;
|
|
111
159
|
export default DatalayerConfiguration;
|
|
@@ -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
|
import { Signal } from '@lumino/signaling';
|
|
11
6
|
import { coreStore } from '../state';
|
|
12
7
|
export const FORCE_ACTIVATE_RUNTIMES_PLUGINS = false;
|
|
@@ -27,4 +22,46 @@ export class DatalayerConfiguration {
|
|
|
27
22
|
return this._configurationChanged;
|
|
28
23
|
}
|
|
29
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Default configuration values for Datalayer
|
|
27
|
+
*/
|
|
28
|
+
export const DEFAULT_DATALAYER_CONFIG = {
|
|
29
|
+
runUrl: 'https://prod1.datalayer.run',
|
|
30
|
+
credits: 100,
|
|
31
|
+
cpuEnvironment: 'python-cpu-env',
|
|
32
|
+
gpuEnvironment: 'ai-env',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Type guard to check if a config object is a valid IDatalayerConfig
|
|
36
|
+
*/
|
|
37
|
+
export function isDatalayerConfig(config) {
|
|
38
|
+
return (config &&
|
|
39
|
+
typeof config === 'object' &&
|
|
40
|
+
typeof config.runUrl === 'string' &&
|
|
41
|
+
typeof config.token === 'string' &&
|
|
42
|
+
typeof config.credits === 'number' &&
|
|
43
|
+
typeof config.cpuEnvironment === 'string' &&
|
|
44
|
+
typeof config.gpuEnvironment === 'string');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to merge partial config with defaults
|
|
48
|
+
* @param config Partial configuration to merge
|
|
49
|
+
* @returns Complete configuration with defaults applied, or undefined if required fields missing
|
|
50
|
+
*/
|
|
51
|
+
export function mergeConfigWithDefaults(config) {
|
|
52
|
+
if (!config)
|
|
53
|
+
return undefined;
|
|
54
|
+
// If we have required fields (token and runUrl), merge with defaults for optional fields
|
|
55
|
+
if (config.token && config.runUrl) {
|
|
56
|
+
return {
|
|
57
|
+
runUrl: config.runUrl,
|
|
58
|
+
token: config.token,
|
|
59
|
+
credits: config.credits ?? DEFAULT_DATALAYER_CONFIG.credits,
|
|
60
|
+
cpuEnvironment: config.cpuEnvironment ?? DEFAULT_DATALAYER_CONFIG.cpuEnvironment,
|
|
61
|
+
gpuEnvironment: config.gpuEnvironment ?? DEFAULT_DATALAYER_CONFIG.gpuEnvironment,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// If missing required fields, return undefined
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
30
67
|
export default DatalayerConfiguration;
|
package/lib/config/index.js
CHANGED
|
@@ -2,20 +2,15 @@
|
|
|
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
|
const IS_LOCALHOST = location.hostname === 'localhost';
|
|
11
6
|
export const getLoomPublicAppId = () => {
|
|
12
7
|
return IS_LOCALHOST
|
|
13
8
|
? LOOM_PUBLIC_APP_ID.LOCALHOST
|
|
14
|
-
: LOOM_PUBLIC_APP_ID.
|
|
9
|
+
: LOOM_PUBLIC_APP_ID.DATALAYER_APP;
|
|
15
10
|
};
|
|
16
11
|
// It is safe to expose PUBLIC APP ID here.
|
|
17
12
|
// @see https://dev.loom.com/docs
|
|
18
13
|
const LOOM_PUBLIC_APP_ID = {
|
|
19
|
-
LOCALHOST:
|
|
20
|
-
|
|
14
|
+
LOCALHOST: '05754d5d-4778-4e6f-852a-a22fa0b5e87f',
|
|
15
|
+
DATALAYER_APP: '4b431848-adf7-457e-a545-0b0c7d21602a',
|
|
21
16
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
/*
|
|
7
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
8
|
+
*
|
|
9
|
+
* MIT License
|
|
10
|
+
*/
|
|
11
|
+
import { useEffect, useState } from 'react';
|
|
12
|
+
import { Box, Button, Label } from '@primer/react';
|
|
13
|
+
import { ServiceManager } from '@jupyterlab/services';
|
|
14
|
+
import { createServerSettings, getJupyterServerUrl, getJupyterServerToken, } from '@datalayer/jupyter-react';
|
|
15
|
+
import { Cell, KernelIndicator, useKernelsStore, useCellsStore, Kernel, } from '@datalayer/jupyter-react';
|
|
16
|
+
const CELL_ID = 'cell-example-1';
|
|
17
|
+
const DEFAULT_SOURCE = `from IPython.display import display
|
|
18
|
+
|
|
19
|
+
for i in range(10):
|
|
20
|
+
display('I am a long string which is repeatedly added to the dom in separated divs: %d' % i)`;
|
|
21
|
+
export const CellExample = (props) => {
|
|
22
|
+
const [kernel, setKernel] = useState();
|
|
23
|
+
const [serviceManager, setServiceManager] = useState(props.serviceManager);
|
|
24
|
+
const kernelsStore = useKernelsStore();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
// Create service manager if not provided
|
|
27
|
+
if (!props.serviceManager) {
|
|
28
|
+
const serverSettings = createServerSettings(getJupyterServerUrl(), getJupyterServerToken());
|
|
29
|
+
const manager = new ServiceManager({ serverSettings });
|
|
30
|
+
setServiceManager(manager);
|
|
31
|
+
}
|
|
32
|
+
}, [props.serviceManager]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!kernel && serviceManager) {
|
|
35
|
+
// Create a kernel using the service manager
|
|
36
|
+
const createKernel = async () => {
|
|
37
|
+
// Create a Kernel wrapper
|
|
38
|
+
const k = new Kernel({
|
|
39
|
+
kernelName: 'python3',
|
|
40
|
+
});
|
|
41
|
+
// @ts-expect-error - Set service manager after construction
|
|
42
|
+
k._serviceManager = serviceManager;
|
|
43
|
+
await k.ready;
|
|
44
|
+
setKernel(k);
|
|
45
|
+
};
|
|
46
|
+
createKernel();
|
|
47
|
+
}
|
|
48
|
+
}, [serviceManager]);
|
|
49
|
+
const cellsStore = useCellsStore();
|
|
50
|
+
if (!kernel) {
|
|
51
|
+
return (_jsxs(Box, { p: 4, children: [_jsx(Box, { as: "h1", children: "A Jupyter Cell" }), _jsx(Box, { children: "Loading kernel..." })] }));
|
|
52
|
+
}
|
|
53
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { as: "h1", children: "A Jupyter Cell" }), _jsxs(Box, { children: ["Source: ", cellsStore.getSource(CELL_ID)] }), _jsxs(Box, { children: ["Outputs Count: ", cellsStore.getOutputsCount(CELL_ID)] }), _jsxs(Box, { children: ["Kernel State: ", _jsx(Label, { children: kernelsStore.getExecutionState(kernel.id) })] }), _jsxs(Box, { children: ["Kernel Phase: ", _jsx(Label, { children: kernelsStore.getExecutionPhase(kernel.id) })] }), _jsxs(Box, { display: "flex", children: [_jsx(Box, { children: "Kernel Indicator:" }), _jsx(Box, { ml: 3, children: _jsx(KernelIndicator, { kernel: kernel.connection }) })] }), _jsx(Box, { children: _jsx(Button, { onClick: () => cellsStore.execute(CELL_ID), children: "Run cell" }) }), _jsx(Cell, { source: DEFAULT_SOURCE, id: CELL_ID })] }));
|
|
54
|
+
};
|
|
55
|
+
export default CellExample;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ServiceManager } from '@jupyterlab/services';
|
|
2
|
+
/**
|
|
3
|
+
* Example demonstrating how to use Datalayer services with Notebook
|
|
4
|
+
*
|
|
5
|
+
* This example shows:
|
|
6
|
+
* 1. How to create and use DatalayerServiceManager for kernel management
|
|
7
|
+
* 2. How to create and use DatalayerCollaborationProvider for real-time collaboration
|
|
8
|
+
* 3. How to enable/disable Datalayer collaboration
|
|
9
|
+
* 4. How to pass these to the base Notebook component
|
|
10
|
+
* 5. Graceful fallback when Datalayer credentials are not available
|
|
11
|
+
*/
|
|
12
|
+
type IDatalayerNotebookExampleProps = {
|
|
13
|
+
serviceManager?: ServiceManager.IManager;
|
|
14
|
+
};
|
|
15
|
+
declare const DatalayerNotebookExample: (props: IDatalayerNotebookExampleProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default DatalayerNotebookExample;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } 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, useMemo } from 'react';
|
|
7
|
+
import { Box, Checkbox, FormControl, Heading } from '@primer/react';
|
|
8
|
+
import { loadJupyterConfig, JupyterReactTheme, Notebook2, } from '@datalayer/jupyter-react';
|
|
9
|
+
import { DatalayerCollaborationProvider } from '../collaboration/DatalayerCollaborationProvider';
|
|
10
|
+
import { createDatalayerServiceManager } from '../services/DatalayerServiceManager';
|
|
11
|
+
import { useCoreStore } from '../state/substates/CoreState';
|
|
12
|
+
import nbformatExample from './notebooks/NotebookExample1.ipynb.json';
|
|
13
|
+
// This corresponds to the notebook ID in the URL when you open an existing notbook in your library
|
|
14
|
+
const NOTEBOOK_ID = '01JZQRQ35GG871QQCZW9TB1A8J';
|
|
15
|
+
const DatalayerNotebookExample = (props) => {
|
|
16
|
+
// Load config on component mount
|
|
17
|
+
loadJupyterConfig();
|
|
18
|
+
const [nbformat] = useState(nbformatExample);
|
|
19
|
+
const [enableCollaboration, setEnableCollaboration] = useState(false);
|
|
20
|
+
const [readonly] = useState(false);
|
|
21
|
+
const [serviceManager, setServiceManager] = useState(props.serviceManager);
|
|
22
|
+
const { configuration } = useCoreStore();
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
// Create DatalayerServiceManager if not provided
|
|
25
|
+
const createManager = async () => {
|
|
26
|
+
if (props.serviceManager) {
|
|
27
|
+
// Use provided service manager (should be DatalayerServiceManager from main.tsx)
|
|
28
|
+
// Wait for it to be ready
|
|
29
|
+
await props.serviceManager.ready;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// Create DatalayerServiceManager if we have credentials
|
|
33
|
+
if (configuration?.token && configuration?.runUrl) {
|
|
34
|
+
try {
|
|
35
|
+
console.log('Creating DatalayerServiceManager for Datalayer infrastructure');
|
|
36
|
+
// Now we can pass undefined to use config/defaults
|
|
37
|
+
const manager = await createDatalayerServiceManager(configuration?.cpuEnvironment, configuration?.credits);
|
|
38
|
+
await manager.ready;
|
|
39
|
+
setServiceManager(manager);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Failed to create DatalayerServiceManager:', error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.warn('Datalayer credentials not configured. Please set runUrl and token.');
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
createManager();
|
|
50
|
+
}, [props.serviceManager, configuration]);
|
|
51
|
+
// Create the collaboration provider when enabled
|
|
52
|
+
const collaborationProvider = useMemo(() => {
|
|
53
|
+
if (!enableCollaboration) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
const runUrl = configuration?.runUrl;
|
|
57
|
+
const token = configuration?.token;
|
|
58
|
+
if (!runUrl || !token) {
|
|
59
|
+
console.warn('Datalayer collaboration enabled but runUrl or token not configured. ' +
|
|
60
|
+
'Please configure them in the Datalayer store or environment.');
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
// Create and return the Datalayer collaboration provider
|
|
64
|
+
return new DatalayerCollaborationProvider({
|
|
65
|
+
runUrl,
|
|
66
|
+
token,
|
|
67
|
+
});
|
|
68
|
+
}, [enableCollaboration, configuration]);
|
|
69
|
+
return (_jsx(JupyterReactTheme, { children: _jsxs(Box, { p: 3, children: [_jsx(Heading, { as: "h2", sx: { mb: 3 }, children: "DatalayerNotebook Collaboration Example" }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: enableCollaboration, onChange: e => setEnableCollaboration(e.target.checked) }), _jsx(FormControl.Label, { children: "Enable Datalayer Collaboration" })] }) }), (!configuration?.runUrl || !configuration?.token) && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'danger.subtle' }, children: "Warning: Datalayer configuration is missing. Please configure runUrl and token to use DatalayerServiceManager and collaboration features." })), !serviceManager && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'attention.subtle' }, children: "Note: DatalayerServiceManager is not available. Notebook functionality will be limited." })), _jsx(Box, { sx: {
|
|
70
|
+
border: '1px solid',
|
|
71
|
+
borderColor: 'border.default',
|
|
72
|
+
borderRadius: 2,
|
|
73
|
+
}, children: serviceManager ? (_jsx(Notebook2, { id: NOTEBOOK_ID, height: "calc(100vh - 200px)", nbformat: nbformat, readonly: readonly, serviceManager: serviceManager, startDefaultKernel: true, collaborationProvider: collaborationProvider })) : (_jsx(Box, { sx: { p: 4, textAlign: 'center' }, children: "Loading ServiceManager..." })) }), _jsxs(Box, { sx: { mt: 2, fontSize: 1, color: 'fg.subtle' }, children: [_jsx("p", { children: "This example demonstrates how to use Datalayer services with Notebook:" }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "DatalayerServiceManager:" }), " Connects to Datalayer infrastructure for kernel management"] }), _jsxs("li", { children: [_jsx("strong", { children: "DatalayerCollaborationProvider:" }), " Enables real-time collaboration"] }), _jsx("li", { children: "Both require Datalayer credentials (runUrl and token)" }), _jsx("li", { children: "Pass them directly to the base Notebook component" }), _jsx("li", { children: "No wrapper components needed - just create the services and pass them as props" }), _jsx("li", { children: "This shows the explicit, composable pattern for Datalayer integration" })] })] })] }) }));
|
|
74
|
+
};
|
|
75
|
+
export default DatalayerNotebookExample;
|