@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 { useCallback, useEffect, useState } from 'react';
|
|
12
7
|
import { KernelIndicator } from '@datalayer/jupyter-react';
|
|
13
8
|
import { ISanitizer } from '@jupyterlab/apputils';
|
|
@@ -19,32 +14,32 @@ import { ArtifactIcon } from '../../components/icons';
|
|
|
19
14
|
import { KernelLauncherDialog } from '../../components/runtimes';
|
|
20
15
|
import { useRuntimesStore } from '../../state';
|
|
21
16
|
/**
|
|
22
|
-
* Cause to open the new
|
|
17
|
+
* Cause to open the new runtime dialog.
|
|
23
18
|
*/
|
|
24
|
-
var
|
|
25
|
-
(function (
|
|
19
|
+
var RuntimeDialogCause;
|
|
20
|
+
(function (RuntimeDialogCause) {
|
|
26
21
|
/**
|
|
27
22
|
* Don't open.
|
|
28
23
|
*/
|
|
29
|
-
|
|
24
|
+
RuntimeDialogCause[RuntimeDialogCause["None"] = 0] = "None";
|
|
30
25
|
/**
|
|
31
|
-
* Launch a new Remote
|
|
26
|
+
* Launch a new Remote Runtime.
|
|
32
27
|
*/
|
|
33
|
-
|
|
28
|
+
RuntimeDialogCause[RuntimeDialogCause["New"] = 1] = "New";
|
|
34
29
|
/**
|
|
35
|
-
* Transfer the state from the current
|
|
30
|
+
* Transfer the state from the current Runtime to a new Remote Runtime.
|
|
36
31
|
*/
|
|
37
|
-
|
|
38
|
-
})(
|
|
32
|
+
RuntimeDialogCause[RuntimeDialogCause["Transfer"] = 2] = "Transfer";
|
|
33
|
+
})(RuntimeDialogCause || (RuntimeDialogCause = {}));
|
|
39
34
|
/**
|
|
40
35
|
* Runtime simple picker component.
|
|
41
36
|
*/
|
|
42
37
|
export function RuntimeSimplePicker(props) {
|
|
43
|
-
const { assignRuntime
|
|
44
|
-
const { runtimeModels
|
|
45
|
-
const [
|
|
38
|
+
const { assignRuntime, sessionConnection } = props;
|
|
39
|
+
const { runtimeModels, multiServiceManager, jupyterLabAdapter } = useRuntimesStore();
|
|
40
|
+
const [runtimeLocation, setRuntimeLocation] = useState();
|
|
46
41
|
const [luminoServices, setLuminoServices] = useState({});
|
|
47
|
-
const [dialogCause, setDialogCause] = useState(
|
|
42
|
+
const [dialogCause, setDialogCause] = useState(RuntimeDialogCause.None);
|
|
48
43
|
const [status, setStatus] = useState('');
|
|
49
44
|
useEffect(() => {
|
|
50
45
|
if (sessionConnection) {
|
|
@@ -69,39 +64,39 @@ export function RuntimeSimplePicker(props) {
|
|
|
69
64
|
}
|
|
70
65
|
}, [multiServiceManager?.remote?.runtimesManager]);
|
|
71
66
|
const handleLaunchRemoteKernel = useCallback(() => {
|
|
72
|
-
setDialogCause(
|
|
67
|
+
setDialogCause(RuntimeDialogCause.New);
|
|
73
68
|
}, []);
|
|
74
69
|
const handleCloseDialog = useCallback((runtimeDesc) => {
|
|
75
70
|
if (runtimeDesc) {
|
|
76
71
|
switch (dialogCause) {
|
|
77
|
-
case
|
|
72
|
+
case RuntimeDialogCause.New:
|
|
78
73
|
refreshRemoteKernels().then(() => {
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
setRuntimeLocation('remote');
|
|
75
|
+
assignRuntime({
|
|
81
76
|
runtimeDesc,
|
|
82
77
|
runtimeModel: multiServiceManager?.remote?.runtimesManager
|
|
83
78
|
.get()
|
|
84
|
-
.find(model => model.id === runtimeDesc.kernelId)
|
|
79
|
+
.find(model => model.id === runtimeDesc.kernelId),
|
|
85
80
|
});
|
|
86
81
|
});
|
|
87
82
|
break;
|
|
88
|
-
case
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
case RuntimeDialogCause.Transfer:
|
|
84
|
+
setRuntimeLocation('remote');
|
|
85
|
+
assignRuntime({ runtimeDesc, transferState: true });
|
|
91
86
|
break;
|
|
92
87
|
}
|
|
93
88
|
}
|
|
94
|
-
setDialogCause(
|
|
89
|
+
setDialogCause(RuntimeDialogCause.None);
|
|
95
90
|
}, [refreshRemoteKernels, multiServiceManager?.remote, dialogCause]);
|
|
96
91
|
useEffect(() => {
|
|
97
92
|
if (jupyterLabAdapter) {
|
|
98
93
|
Promise.all([
|
|
99
94
|
jupyterLabAdapter.jupyterLab.resolveOptionalService(IMarkdownParser),
|
|
100
|
-
jupyterLabAdapter.jupyterLab.resolveOptionalService(ISanitizer)
|
|
95
|
+
jupyterLabAdapter.jupyterLab.resolveOptionalService(ISanitizer),
|
|
101
96
|
]).then(services => {
|
|
102
97
|
setLuminoServices({
|
|
103
98
|
[IMarkdownParser.name]: services[0],
|
|
104
|
-
[ISanitizer.name]: services[1]
|
|
99
|
+
[ISanitizer.name]: services[1],
|
|
105
100
|
});
|
|
106
101
|
});
|
|
107
102
|
}
|
|
@@ -110,7 +105,7 @@ export function RuntimeSimplePicker(props) {
|
|
|
110
105
|
}
|
|
111
106
|
}, [jupyterLabAdapter]);
|
|
112
107
|
return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: () => {
|
|
113
|
-
switch (
|
|
108
|
+
switch (runtimeLocation) {
|
|
114
109
|
case 'browser':
|
|
115
110
|
return _jsx(BrowserIcon, {});
|
|
116
111
|
case 'remote':
|
|
@@ -119,26 +114,23 @@ export function RuntimeSimplePicker(props) {
|
|
|
119
114
|
return _jsx(EyeIcon, {});
|
|
120
115
|
}
|
|
121
116
|
return _jsx(ArtifactIcon, { type: "runtime" });
|
|
122
|
-
}, trailingVisual: () => sessionConnection
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(EyeIcon, {}) }), "Viewer", _jsx(ActionList.Description, { variant: "block", children: "A simple Notebook Viewer without Runtime." })] }), _jsxs(ActionList.Item, { selected: kernelLocation === 'browser', onSelect: () => {
|
|
130
|
-
setKernelLocation('browser');
|
|
131
|
-
assignKernel({
|
|
117
|
+
}, trailingVisual: () => sessionConnection ? (_jsx(Box, { sx: { paddingTop: '5px' }, children: _jsx(KernelIndicator, { kernel: sessionConnection.kernel }) })) : (_jsx(_Fragment, {})), size: "small", variant: "invisible", children: _jsx(Tooltip, { text: status, direction: "s", children: _jsx(Button, { variant: "invisible", size: "small", children: sessionConnection?.kernel?.name ?? 'Runtimes' }) }) }), _jsx(ActionMenu.Overlay, { width: "medium", children: _jsxs(ActionList, { selectionVariant: "single", showDividers: true, children: [_jsxs(ActionList.Group, { children: [_jsxs(ActionList.Item, { selected: runtimeLocation === undefined &&
|
|
118
|
+
sessionConnection === undefined, onSelect: () => {
|
|
119
|
+
setRuntimeLocation(undefined);
|
|
120
|
+
assignRuntime({ runtimeDesc: undefined });
|
|
121
|
+
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(EyeIcon, {}) }), "Viewer", _jsx(ActionList.Description, { variant: "block", children: "A simple Notebook Viewer without Runtime." })] }), _jsxs(ActionList.Item, { selected: runtimeLocation === 'browser', onSelect: () => {
|
|
122
|
+
setRuntimeLocation('browser');
|
|
123
|
+
assignRuntime({
|
|
132
124
|
runtimeDesc: {
|
|
133
125
|
name: 'pyodide',
|
|
134
126
|
location: 'browser',
|
|
135
|
-
language: 'python'
|
|
136
|
-
}
|
|
127
|
+
language: 'python',
|
|
128
|
+
},
|
|
137
129
|
});
|
|
138
|
-
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(BrowserIcon, {}) }), "Browser Runtime", _jsx(ActionList.Description, { variant: "block", children: "A Browser Runtime based on Pyodide." })] })] }),
|
|
130
|
+
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(BrowserIcon, {}) }), "Browser Runtime", _jsx(ActionList.Description, { variant: "block", children: "A Browser Runtime based on Pyodide." })] })] }), runtimeModels.length > 0 && (_jsxs(ActionList.Group, { children: [_jsx(ActionList.GroupHeading, { children: "Cloud Runtimes" }), runtimeModels.map(kernelModel => {
|
|
139
131
|
return (_jsxs(ActionList.Item, { selected: sessionConnection?.kernel?.id === kernelModel.id, onSelect: () => {
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
setRuntimeLocation('remote');
|
|
133
|
+
assignRuntime({
|
|
142
134
|
runtimeDesc: {
|
|
143
135
|
name: kernelModel.environment_name,
|
|
144
136
|
language: '',
|
|
@@ -146,16 +138,16 @@ export function RuntimeSimplePicker(props) {
|
|
|
146
138
|
displayName: kernelModel.given_name,
|
|
147
139
|
kernelId: kernelModel.id,
|
|
148
140
|
burningRate: kernelModel.burning_rate,
|
|
149
|
-
podName: kernelModel.pod_name
|
|
141
|
+
podName: kernelModel.pod_name,
|
|
150
142
|
},
|
|
151
|
-
runtimeModel: kernelModel
|
|
143
|
+
runtimeModel: kernelModel,
|
|
152
144
|
});
|
|
153
145
|
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(ArtifactIcon, { type: "runtime" }) }), kernelModel.given_name, _jsx(ActionList.Description, { variant: "block", children: kernelModel.environment_name })] }, kernelModel.id));
|
|
154
|
-
})] })), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Group, { children: [_jsxs(ActionList.Item, { selected: false, onSelect: handleLaunchRemoteKernel, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, {}) }), "Launch a new Runtime\u2026"] }), _jsxs(ActionList.Item, { disabled:
|
|
155
|
-
setDialogCause(
|
|
156
|
-
}, title: "Transfer the state of the current Runtime to a new Remote Runtime.", children: [_jsx(ActionList.LeadingVisual, { children: _jsx(UnfoldIcon, {}) }), "Transfer state to a new Runtime\u2026"] })] })] }) })] }), multiServiceManager?.remote && dialogCause > 0 && (_jsx(KernelLauncherDialog, { dialogTitle: dialogCause ===
|
|
146
|
+
})] })), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Group, { children: [_jsxs(ActionList.Item, { selected: false, onSelect: handleLaunchRemoteKernel, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, {}) }), "Launch a new Runtime\u2026"] }), _jsxs(ActionList.Item, { disabled: runtimeLocation !== 'browser', selected: false, onSelect: () => {
|
|
147
|
+
setDialogCause(RuntimeDialogCause.Transfer);
|
|
148
|
+
}, title: "Transfer the state of the current Runtime to a new Remote Runtime.", children: [_jsx(ActionList.LeadingVisual, { children: _jsx(UnfoldIcon, {}) }), "Transfer state to a new Runtime\u2026"] })] })] }) })] }), multiServiceManager?.remote && dialogCause > 0 && (_jsx(KernelLauncherDialog, { dialogTitle: dialogCause === RuntimeDialogCause.Transfer
|
|
157
149
|
? 'Switch to a new Cloud Runtime'
|
|
158
|
-
: undefined, manager: multiServiceManager.remote, onSubmit: handleCloseDialog, markdownParser: luminoServices[IMarkdownParser.name], sanitizer: luminoServices[ISanitizer.name], startKernel: dialogCause ===
|
|
150
|
+
: undefined, manager: multiServiceManager.remote, onSubmit: handleCloseDialog, markdownParser: luminoServices[IMarkdownParser.name], sanitizer: luminoServices[ISanitizer.name], startKernel: dialogCause === RuntimeDialogCause.Transfer
|
|
159
151
|
? 'defer'
|
|
160
|
-
: dialogCause ===
|
|
152
|
+
: dialogCause === RuntimeDialogCause.New }))] }));
|
|
161
153
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SessionContext } from '@jupyterlab/apputils';
|
|
2
2
|
import { ITranslator } from '@jupyterlab/translation';
|
|
3
3
|
import { IMultiServiceManager } from '../../api';
|
|
4
|
-
import { IRuntimeDesc } from '../../
|
|
4
|
+
import { IRuntimeDesc } from '../../models';
|
|
5
5
|
export type IDatalayerRuntimeDesc = IRuntimeDesc & {
|
|
6
6
|
gpu?: string;
|
|
7
7
|
};
|
|
@@ -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 { PathExt } from '@jupyterlab/coreutils';
|
|
11
6
|
import { nullTranslator } from '@jupyterlab/translation';
|
|
12
7
|
const ASSIGN_NEW_RUNTIME_LABEL = 'Assign a new Runtime';
|
|
@@ -41,7 +36,7 @@ export function getGroupedRuntimeDescs(multiServiceManager, kernelId, translator
|
|
|
41
36
|
.map(session => {
|
|
42
37
|
const spec = multiServiceManager.browser.kernelspecs.specs.kernelspecs[session.kernel.name];
|
|
43
38
|
return {
|
|
44
|
-
id:
|
|
39
|
+
id: '', // TODO Assign a proper ID.
|
|
45
40
|
kernelId: session.kernel.id,
|
|
46
41
|
name: spec.name,
|
|
47
42
|
language: spec.language,
|
|
@@ -67,7 +62,9 @@ export function getGroupedRuntimeDescs(multiServiceManager, kernelId, translator
|
|
|
67
62
|
.concat((multiServiceManager.remote?.runtimesManager.get() ?? [])
|
|
68
63
|
.filter(k => k.id && !listedAsSession.includes(k.id))
|
|
69
64
|
.map(runtime => {
|
|
70
|
-
const environment = multiServiceManager
|
|
65
|
+
const environment = multiServiceManager
|
|
66
|
+
.remote.environments.get()
|
|
67
|
+
.find(env => env.name === runtime.environment_name);
|
|
71
68
|
return {
|
|
72
69
|
kernelId: runtime.id,
|
|
73
70
|
name: environment.name,
|
|
@@ -87,16 +84,15 @@ export function getGroupedRuntimeDescs(multiServiceManager, kernelId, translator
|
|
|
87
84
|
name: spec.name,
|
|
88
85
|
language: spec.language,
|
|
89
86
|
displayName: spec.display_name,
|
|
90
|
-
location: 'browser'
|
|
87
|
+
location: 'browser',
|
|
91
88
|
};
|
|
92
89
|
}))
|
|
93
90
|
.filter(filterKernels);
|
|
94
91
|
runningSessions.push(...runningKernels);
|
|
95
92
|
if (runningSessions.length) {
|
|
96
|
-
const key =
|
|
97
|
-
ASSIGN_EXISTING_REMOTE_RUNTIME_LABEL
|
|
98
|
-
:
|
|
99
|
-
ASSIGN_EXISTING_RUNTIME_LABEL;
|
|
93
|
+
const key = variant === 'cell'
|
|
94
|
+
? ASSIGN_EXISTING_REMOTE_RUNTIME_LABEL
|
|
95
|
+
: ASSIGN_EXISTING_RUNTIME_LABEL;
|
|
100
96
|
kernels[key] = runningSessions;
|
|
101
97
|
}
|
|
102
98
|
// Environments.
|
|
@@ -118,15 +114,18 @@ export function getGroupedRuntimeDescs(multiServiceManager, kernelId, translator
|
|
|
118
114
|
displayName: spec.title,
|
|
119
115
|
location: 'remote',
|
|
120
116
|
gpu: spec.resources?.['nvidia.com/gpu'],
|
|
121
|
-
burningRate: spec.burning_rate
|
|
117
|
+
burningRate: spec.burning_rate,
|
|
122
118
|
}))
|
|
123
119
|
.filter(filterKernels) ?? []));
|
|
124
|
-
environments.push(...Object.values(multiServiceManager.browser?.kernelspecs.specs?.kernelspecs ?? {})
|
|
120
|
+
environments.push(...Object.values(multiServiceManager.browser?.kernelspecs.specs?.kernelspecs ?? {})
|
|
121
|
+
.filter(spec => !!spec)
|
|
122
|
+
.map(spec => ({
|
|
125
123
|
name: spec.name,
|
|
126
124
|
language: spec.language,
|
|
127
125
|
displayName: spec.display_name,
|
|
128
|
-
location: 'browser'
|
|
129
|
-
}))
|
|
126
|
+
location: 'browser',
|
|
127
|
+
}))
|
|
128
|
+
.filter(filterKernels));
|
|
130
129
|
if (environments.length) {
|
|
131
130
|
kernels[trans.__(ASSIGN_NEW_RUNTIME_LABEL)] = environments;
|
|
132
131
|
}
|
|
@@ -165,7 +164,13 @@ export function getDefaultKernelName(selector) {
|
|
|
165
164
|
}
|
|
166
165
|
if (matches.length === 1) {
|
|
167
166
|
const specName = matches[0];
|
|
168
|
-
console.warn('No exact match found for ' +
|
|
167
|
+
console.warn('No exact match found for ' +
|
|
168
|
+
specName +
|
|
169
|
+
', using runtime ' +
|
|
170
|
+
specName +
|
|
171
|
+
' that matches ' +
|
|
172
|
+
'language=' +
|
|
173
|
+
language);
|
|
169
174
|
return specName;
|
|
170
175
|
}
|
|
171
176
|
// No matches found.
|
|
@@ -3,14 +3,9 @@ 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 { useMemo } from 'react';
|
|
12
7
|
import { IconButton, ToggleSwitch, FormControl } from '@primer/react';
|
|
13
|
-
import { Box } from
|
|
8
|
+
import { Box } from '@datalayer/primer-addons';
|
|
14
9
|
import { Blankslate, DataTable, Table } from '@primer/react/experimental';
|
|
15
10
|
import { nullTranslator } from '@jupyterlab/translation';
|
|
16
11
|
import { checkIcon } from '@jupyterlab/ui-components';
|
|
@@ -18,7 +13,7 @@ import { checkIcon } from '@jupyterlab/ui-components';
|
|
|
18
13
|
* Runtime variables selector component.
|
|
19
14
|
*/
|
|
20
15
|
export function RuntimeVariables(props) {
|
|
21
|
-
const { className, translator, selectedVariables, setSelectVariable, transferVariables, setTransferVariable, kernelVariables } = props;
|
|
16
|
+
const { className, translator, selectedVariables, setSelectVariable, transferVariables, setTransferVariable, kernelVariables, } = props;
|
|
22
17
|
const trans = useMemo(() => (translator ?? nullTranslator).load('jupyterlab'), [translator]);
|
|
23
18
|
const nRows = Object.keys(kernelVariables ?? {}).length;
|
|
24
19
|
// Sorting and actions does not play nice together :'(
|
|
@@ -26,11 +21,11 @@ export function RuntimeVariables(props) {
|
|
|
26
21
|
{
|
|
27
22
|
header: trans.__('Name'),
|
|
28
23
|
field: 'name',
|
|
29
|
-
rowHeader: true
|
|
24
|
+
rowHeader: true,
|
|
30
25
|
},
|
|
31
26
|
{
|
|
32
27
|
header: trans.__('Type'),
|
|
33
|
-
field: 'type'
|
|
28
|
+
field: 'type',
|
|
34
29
|
},
|
|
35
30
|
{
|
|
36
31
|
id: 'select',
|
|
@@ -68,10 +63,10 @@ export function RuntimeVariables(props) {
|
|
|
68
63
|
setSelectVariable([...selectedVariables, row.name]);
|
|
69
64
|
}
|
|
70
65
|
} }));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
66
|
+
},
|
|
67
|
+
},
|
|
73
68
|
];
|
|
74
|
-
return (_jsxs(Box, { className: className, sx: { paddingTop:
|
|
69
|
+
return (_jsxs(Box, { className: className, sx: { paddingTop: '10px' }, children: [_jsxs(FormControl, { layout: "horizontal", children: [_jsx(FormControl.Label, { children: trans.__('Transfer variables') }), _jsx(ToggleSwitch, { checked: transferVariables, size: "small", onClick: e => {
|
|
75
70
|
e.preventDefault();
|
|
76
71
|
setTransferVariable(!transferVariables);
|
|
77
72
|
}, "aria-labelledby": "kernel-toggle-variables" })] }), transferVariables && (_jsxs(Table.Container, { sx: { flex: '1 1 auto', marginTop: 3 }, children: [_jsx(Table.Subtitle, { as: "p", id: "dla-kernel-variables-subtitle", children: trans.__('The list of transferable runtime variables.') }), kernelVariables ? (Object.keys(kernelVariables ?? {}).length ? (_jsx(DataTable, { "aria-labelledby": "dla-kernel-variables", "aria-describedby": "dla-kernel-variables-subtitle", data: Object.entries(kernelVariables ?? {})
|
|
@@ -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 './RuntimeCellVariables';
|
|
11
6
|
export * from './RuntimeCellVariablesDialog';
|
|
12
7
|
export * from './RuntimeLauncherDialog';
|
|
@@ -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 { Component } from 'react';
|
|
12
7
|
import html2canvas from 'html2canvas';
|
|
13
8
|
export class ScreenCapture extends Component {
|
|
@@ -50,7 +45,7 @@ export class ScreenCapture extends Component {
|
|
|
50
45
|
};
|
|
51
46
|
handStartCapture = () => this.setState({ on: true });
|
|
52
47
|
handleMouseMove = (e) => {
|
|
53
|
-
const { isMouseDown, windowWidth, windowHeight, startX, startY, borderWidth } = this.state;
|
|
48
|
+
const { isMouseDown, windowWidth, windowHeight, startX, startY, borderWidth, } = this.state;
|
|
54
49
|
let cropPositionTop = startY;
|
|
55
50
|
let cropPositionLeft = startX;
|
|
56
51
|
const endX = e.clientX;
|
|
@@ -68,28 +63,24 @@ export class ScreenCapture extends Component {
|
|
|
68
63
|
let cropHeigth = 0;
|
|
69
64
|
if (isMouseDown) {
|
|
70
65
|
if (isStartTopLeft) {
|
|
71
|
-
newBorderWidth = `${startY}px ${windowWidth - endX}px ${windowHeight -
|
|
72
|
-
endY}px ${startX}px`;
|
|
66
|
+
newBorderWidth = `${startY}px ${windowWidth - endX}px ${windowHeight - endY}px ${startX}px`;
|
|
73
67
|
cropWidth = endX - startX;
|
|
74
68
|
cropHeigth = endY - startY;
|
|
75
69
|
}
|
|
76
70
|
if (isStartTopRight) {
|
|
77
|
-
newBorderWidth = `${startY}px ${windowWidth - startX}px ${windowHeight -
|
|
78
|
-
endY}px ${endX}px`;
|
|
71
|
+
newBorderWidth = `${startY}px ${windowWidth - startX}px ${windowHeight - endY}px ${endX}px`;
|
|
79
72
|
cropWidth = startX - endX;
|
|
80
73
|
cropHeigth = endY - startY;
|
|
81
74
|
cropPositionLeft = endX;
|
|
82
75
|
}
|
|
83
76
|
if (isStartBottomLeft) {
|
|
84
|
-
newBorderWidth = `${endY}px ${windowWidth - endX}px ${windowHeight -
|
|
85
|
-
startY}px ${startX}px`;
|
|
77
|
+
newBorderWidth = `${endY}px ${windowWidth - endX}px ${windowHeight - startY}px ${startX}px`;
|
|
86
78
|
cropWidth = endX - startX;
|
|
87
79
|
cropHeigth = startY - endY;
|
|
88
80
|
cropPositionTop = endY;
|
|
89
81
|
}
|
|
90
82
|
if (isStartBottomRight) {
|
|
91
|
-
newBorderWidth = `${endY}px ${windowWidth - startX}px ${windowHeight -
|
|
92
|
-
startY}px ${endX}px`;
|
|
83
|
+
newBorderWidth = `${endY}px ${windowWidth - startX}px ${windowHeight - startY}px ${endX}px`;
|
|
93
84
|
cropWidth = startX - endX;
|
|
94
85
|
cropHeigth = startY - endY;
|
|
95
86
|
cropPositionLeft = endX;
|
|
@@ -132,11 +123,11 @@ export class ScreenCapture extends Component {
|
|
|
132
123
|
const { windowWidth, windowHeight, cropPositionTop, cropPositionLeft, cropWidth, cropHeigth, } = this.state;
|
|
133
124
|
const body = document.querySelector('body');
|
|
134
125
|
if (body) {
|
|
135
|
-
|
|
126
|
+
const scale = window.devicePixelRatio;
|
|
136
127
|
html2canvas(body, {
|
|
137
128
|
width: windowWidth,
|
|
138
129
|
height: windowHeight,
|
|
139
|
-
scale: scale
|
|
130
|
+
scale: scale,
|
|
140
131
|
}).then(canvas => {
|
|
141
132
|
const croppedCanvas = document.createElement('canvas');
|
|
142
133
|
const croppedCanvasContext = croppedCanvas.getContext('2d');
|
|
@@ -161,7 +152,7 @@ export class ScreenCapture extends Component {
|
|
|
161
152
|
renderChild = () => {
|
|
162
153
|
const { children } = this.props;
|
|
163
154
|
const props = {
|
|
164
|
-
onStartCapture: this.handStartCapture
|
|
155
|
+
onStartCapture: this.handStartCapture,
|
|
165
156
|
};
|
|
166
157
|
if (typeof children === 'function') {
|
|
167
158
|
return children(props);
|
|
@@ -169,11 +160,11 @@ export class ScreenCapture extends Component {
|
|
|
169
160
|
return children;
|
|
170
161
|
};
|
|
171
162
|
render() {
|
|
172
|
-
const { on, crossHairsTop, crossHairsLeft, borderWidth, isMouseDown
|
|
163
|
+
const { on, crossHairsTop, crossHairsLeft, borderWidth, isMouseDown } = this.state;
|
|
173
164
|
if (!on) {
|
|
174
165
|
return this.renderChild();
|
|
175
166
|
}
|
|
176
|
-
return (_jsxs("div", { onMouseMove: this.handleMouseMove, onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp, children: [this.renderChild(), _jsx("div", { className: `overlay ${isMouseDown && 'highlighting'}`, style: { borderWidth: `${borderWidth}` } }), _jsx("div", { className:
|
|
167
|
+
return (_jsxs("div", { onMouseMove: this.handleMouseMove, onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp, children: [this.renderChild(), _jsx("div", { className: `overlay ${isMouseDown && 'highlighting'}`, style: { borderWidth: `${borderWidth}` } }), _jsx("div", { className: "crosshairs", style: { left: crossHairsLeft + 'px', top: crossHairsTop + 'px' } })] }));
|
|
177
168
|
}
|
|
178
169
|
}
|
|
179
170
|
export default ScreenCapture;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Link, Tooltip, Button } from
|
|
3
|
-
import { ScreenFullIcon } from
|
|
4
|
-
import { lazyWithPreload, WithSuspense } from
|
|
5
|
-
import { useToast } from
|
|
6
|
-
import { useLayoutStore } from
|
|
7
|
-
const ScreenCapture = WithSuspense(lazyWithPreload(() => import(
|
|
2
|
+
import { Link, Tooltip, Button } from '@primer/react';
|
|
3
|
+
import { ScreenFullIcon } from '@primer/octicons-react';
|
|
4
|
+
import { lazyWithPreload, WithSuspense } from '../../utils';
|
|
5
|
+
import { useToast } from '../../hooks';
|
|
6
|
+
import { useLayoutStore } from '../../state';
|
|
7
|
+
const ScreenCapture = WithSuspense(lazyWithPreload(() => import('../screenshot/ScreenCapture')));
|
|
8
8
|
export const ScreenCaptureButton = (props) => {
|
|
9
9
|
const { enqueueToast } = useToast();
|
|
10
10
|
const { setScreenCapture, hideScreenshot } = useLayoutStore();
|
|
@@ -15,7 +15,13 @@ export const ScreenCaptureButton = (props) => {
|
|
|
15
15
|
};
|
|
16
16
|
return (_jsx(ScreenCapture, { onEndCapture: handleScreenCapture, children: ({ onStartCapture }) => (_jsx(Tooltip, { text: "Take a screen capture", direction: "s", children: _jsx(Button, { variant: "invisible", children: _jsx(Link, { href: "javascript: return false;", sx: {
|
|
17
17
|
color: 'fg.muted',
|
|
18
|
-
':hover, :focus, &[aria-expanded=true]': {
|
|
19
|
-
|
|
18
|
+
':hover, :focus, &[aria-expanded=true]': {
|
|
19
|
+
background: 'none !important',
|
|
20
|
+
color: 'accent.fg',
|
|
21
|
+
},
|
|
22
|
+
}, onClick: e => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
onStartCapture();
|
|
25
|
+
}, children: _jsx(ScreenFullIcon, {}) }) }) })) }));
|
|
20
26
|
};
|
|
21
27
|
export default ScreenCaptureButton;
|
|
@@ -2,10 +2,5 @@
|
|
|
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 './ScreenCapture';
|
|
11
6
|
export * from './ScreenCaptureButton';
|
|
@@ -3,17 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
6
|
+
import { useCallback, useEffect, useState, } from 'react';
|
|
12
7
|
import { CameraIcon } from '@datalayer/icons-react';
|
|
13
|
-
import { ActionList, ActionMenu, Box, Flash, FormControl, Select, Spinner } from '@primer/react';
|
|
8
|
+
import { ActionList, ActionMenu, Box, Flash, FormControl, Select, Spinner, } from '@primer/react';
|
|
14
9
|
import { Dialog } from '@primer/react/experimental';
|
|
15
10
|
import { useToast } from '../../hooks';
|
|
16
|
-
import { createRuntimeSnapshot, getRuntimeSnapshots, loadBrowserRuntimeSnapshot, loadRuntimeSnapshot } from '../../api';
|
|
11
|
+
import { createRuntimeSnapshot, getRuntimeSnapshots, loadBrowserRuntimeSnapshot, loadRuntimeSnapshot, } from '../../api';
|
|
17
12
|
import { useRuntimesStore } from '../../state';
|
|
18
13
|
import { createRuntimeSnapshotName } from '../../utils';
|
|
19
14
|
/**
|
|
@@ -21,7 +16,7 @@ import { createRuntimeSnapshotName } from '../../utils';
|
|
|
21
16
|
*/
|
|
22
17
|
export function RuntimeSnapshotMenu(props) {
|
|
23
18
|
const { children, connection, podName, multiServiceManager, disabled } = props;
|
|
24
|
-
const { addRuntimeSnapshot, runtimesRunUrl, runtimeSnapshots, setRuntimeSnapshots } = useRuntimesStore();
|
|
19
|
+
const { addRuntimeSnapshot, runtimesRunUrl, runtimeSnapshots, setRuntimeSnapshots, } = useRuntimesStore();
|
|
25
20
|
const { trackAsyncTask } = useToast();
|
|
26
21
|
const [openLoadDialog, setOpenLoadDialog] = useState(false);
|
|
27
22
|
const [loadingKernelSnapshot, setLoadingKernelSnapshot] = useState(false);
|
|
@@ -47,7 +42,7 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
47
42
|
const onKerenelSnapshotChanged = useCallback(event => {
|
|
48
43
|
setSelection(event.target.value);
|
|
49
44
|
}, []);
|
|
50
|
-
const onLoadKernelSnapshotSubmit = useCallback(async ({ id, connection, podName }) => {
|
|
45
|
+
const onLoadKernelSnapshotSubmit = useCallback(async ({ id, connection, podName, }) => {
|
|
51
46
|
if (podName) {
|
|
52
47
|
await loadRuntimeSnapshot({ id: podName, from: id });
|
|
53
48
|
}
|
|
@@ -68,7 +63,7 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
68
63
|
podName,
|
|
69
64
|
name: snapshotName,
|
|
70
65
|
description: snapshotName,
|
|
71
|
-
stop: false
|
|
66
|
+
stop: false,
|
|
72
67
|
});
|
|
73
68
|
ref = podName.split('-', 2).reverse()[0];
|
|
74
69
|
task.then(s => {
|
|
@@ -82,7 +77,7 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
82
77
|
let isPending = true;
|
|
83
78
|
task = createRuntimeSnapshot({
|
|
84
79
|
connection: multiServiceManager.browser.kernels.connectTo({
|
|
85
|
-
model
|
|
80
|
+
model,
|
|
86
81
|
}),
|
|
87
82
|
metadata: { filename: `${snapshotName}.data` },
|
|
88
83
|
onUploadProgress: () => {
|
|
@@ -93,7 +88,7 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
93
88
|
snapshot = snapshots.find(s => s.name === snapshotName);
|
|
94
89
|
});
|
|
95
90
|
}
|
|
96
|
-
}
|
|
91
|
+
},
|
|
97
92
|
});
|
|
98
93
|
}
|
|
99
94
|
if (task) {
|
|
@@ -104,12 +99,12 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
104
99
|
? `Runtime ${ref} will not be snapshotted as it does not contain any serializable state.`
|
|
105
100
|
: `Failed to pause runtime ${ref} - ${reason}`;
|
|
106
101
|
return msg;
|
|
107
|
-
}
|
|
102
|
+
},
|
|
108
103
|
},
|
|
109
104
|
pending: { message: `Taking a snapshot of runtime ${ref}…` },
|
|
110
105
|
success: {
|
|
111
|
-
message: () => `Runtime ${ref} successfully snapshotted as ${snapshotName}
|
|
112
|
-
}
|
|
106
|
+
message: () => `Runtime ${ref} successfully snapshotted as ${snapshotName}.`,
|
|
107
|
+
},
|
|
113
108
|
});
|
|
114
109
|
await task;
|
|
115
110
|
if (snapshot) {
|
|
@@ -121,7 +116,9 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
121
116
|
setTakingSnapshot(false);
|
|
122
117
|
}
|
|
123
118
|
}, [connection, podName, multiServiceManager]);
|
|
124
|
-
return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: CameraIcon, variant: "invisible", size: "small", disabled: loadingKernelSnapshot || takingKernelSnapshot || disabled, children: children }), _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { onSelect: onLoadKernelSnapshot, disabled: loadingKernelSnapshot || runtimeSnapshots.length === 0, children: "Load a runtime snapshot\u2026" }), _jsx(ActionList.Item, { onSelect: onTakeKernelSnapshot, disabled: takingKernelSnapshot, children: "Take a runtime snapshot" })] }) })] }), openLoadDialog && (_jsx(Dialog, { title: "Choose a runtime snapshot to load", onClose: () => {
|
|
119
|
+
return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: CameraIcon, variant: "invisible", size: "small", disabled: loadingKernelSnapshot || takingKernelSnapshot || disabled, children: children }), _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { onSelect: onLoadKernelSnapshot, disabled: loadingKernelSnapshot || runtimeSnapshots.length === 0, children: "Load a runtime snapshot\u2026" }), _jsx(ActionList.Item, { onSelect: onTakeKernelSnapshot, disabled: takingKernelSnapshot, children: "Take a runtime snapshot" })] }) })] }), openLoadDialog && (_jsx(Dialog, { title: "Choose a runtime snapshot to load", onClose: () => {
|
|
120
|
+
setOpenLoadDialog(false);
|
|
121
|
+
}, footerButtons: [
|
|
125
122
|
{
|
|
126
123
|
buttonType: 'default',
|
|
127
124
|
content: 'Cancel',
|
|
@@ -130,11 +127,11 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
130
127
|
event.preventDefault();
|
|
131
128
|
setOpenLoadDialog(false);
|
|
132
129
|
}
|
|
133
|
-
}
|
|
130
|
+
},
|
|
134
131
|
},
|
|
135
132
|
{
|
|
136
133
|
buttonType: 'primary',
|
|
137
|
-
content: loadingKernelSnapshot ? _jsx(Spinner, { size: "small" }) : 'Load',
|
|
134
|
+
content: loadingKernelSnapshot ? (_jsx(Spinner, { size: "small" })) : ('Load'),
|
|
138
135
|
disabled: loadingKernelSnapshot,
|
|
139
136
|
onClick: async (event) => {
|
|
140
137
|
if (!event.defaultPrevented) {
|
|
@@ -147,7 +144,7 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
147
144
|
await onLoadKernelSnapshotSubmit({
|
|
148
145
|
connection,
|
|
149
146
|
id: snapshot.id,
|
|
150
|
-
podName
|
|
147
|
+
podName,
|
|
151
148
|
});
|
|
152
149
|
}
|
|
153
150
|
else {
|
|
@@ -160,8 +157,8 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
159
|
},
|
|
163
|
-
autoFocus: true
|
|
164
|
-
}
|
|
160
|
+
autoFocus: true,
|
|
161
|
+
},
|
|
165
162
|
], children: _jsxs(Box, { as: "form", children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Snapshot" }), _jsx(Select, { name: "snapshot", value: selection, onChange: onKerenelSnapshotChanged, block: true, children: runtimeSnapshots.map(s => (_jsx(Select.Option, { value: s.id, children: s.name ? `${s.name} (${s.id})` : s.id }, s.id))) })] }), error && _jsx(Flash, { variant: "danger", children: error })] }) }))] }));
|
|
166
163
|
}
|
|
167
164
|
RuntimeSnapshotMenu.defaultProps = {
|