@datalayer/core 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -3
- package/lib/App.css +2 -2
- package/lib/App.d.ts +1 -1
- package/lib/App.js +9 -9
- package/lib/__tests__/index.test.js +5 -5
- package/lib/api/DatalayerApi.d.ts +1 -1
- package/lib/api/DatalayerApi.js +3 -3
- package/lib/api/index.d.ts +3 -3
- package/lib/api/index.js +3 -3
- package/lib/api/runtimes/actions.js +22 -23
- package/lib/api/runtimes/settings.js +3 -3
- package/lib/api/runtimes/snapshots.d.ts +1 -1
- package/lib/api/runtimes/snapshots.js +8 -8
- package/lib/api/runtimes/utils.js +1 -4
- 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 +1 -1
- package/lib/components/avatars/BoringAvatar.js +2 -2
- package/lib/components/avatars/UserProfileAvatar.js +2 -9
- package/lib/components/banners/NoAutomationBanner.js +4 -4
- package/lib/components/buttons/DownloadCSVButton.js +1 -1
- package/lib/components/buttons/UploadButton.js +1 -1
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/checkout/StripeCheckout.js +6 -6
- package/lib/components/confetti/ConfettiSuccess.js +1 -1
- package/lib/components/context/OrganizationSelect.js +5 -5
- package/lib/components/context/SpaceSelect.js +7 -7
- package/lib/components/display/AvatarSkeleton.js +1 -1
- package/lib/components/display/CenteredSpinner.js +4 -4
- package/lib/components/display/CodePreview.js +4 -4
- package/lib/components/display/DatalayerBox.js +13 -14
- package/lib/components/display/HorizontalCenter.d.ts +1 -1
- package/lib/components/display/HorizontalCenter.js +1 -1
- package/lib/components/display/JupyterDialog.js +17 -15
- package/lib/components/display/NavLink.d.ts +4 -2
- package/lib/components/display/NavLink.js +6 -4
- package/lib/components/display/NotebookSkeleton.js +2 -2
- package/lib/components/display/Placeholder.js +1 -1
- package/lib/components/display/ToTopBranded.js +1 -1
- package/lib/components/echarts/EChartsReact.d.ts +1 -1
- package/lib/components/echarts/EChartsReact.js +1 -1
- package/lib/components/flashes/FlashClosable.js +11 -11
- package/lib/components/flashes/FlashDisclaimer.js +2 -3
- package/lib/components/flashes/FlashGuest.js +3 -4
- package/lib/components/flashes/FlashSurveys.js +3 -4
- package/lib/components/flashes/FlashUnauthorized.js +2 -2
- package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
- package/lib/components/flashes/surveys/Survey2025_1.js +62 -85
- package/lib/components/iam/ExternalTokenSilentLogin.js +6 -4
- package/lib/components/icons/ArtifactIcon.d.ts +2 -2
- package/lib/components/icons/ArtifactIcon.js +39 -39
- package/lib/components/labels/VisibilityLabel.js +2 -5
- package/lib/components/landings/StepBlock.d.ts +1 -1
- package/lib/components/landings/StepBlock.js +1 -1
- package/lib/components/navbar/NavigationVisbilityObserver.js +2 -2
- package/lib/components/navbar/SubdomainNavBar.js +45 -23
- package/lib/components/navbar/SubdomainNavBar.module.css +33 -14
- package/lib/components/nbgrader/NbGradesDetails.d.ts +1 -1
- package/lib/components/nbgrader/NbGradesDetails.js +5 -8
- package/lib/components/notebooks/JupyterNotebook.js +5 -5
- package/lib/components/notebooks/JupyterNotebookToolbar.js +3 -3
- 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 -2
- package/lib/components/primer/Styles.js +1 -1
- package/lib/components/progress/ConsumptionBar.js +2 -2
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/progress/CreditsIndicator.js +4 -7
- package/lib/components/progress/ProgressRing.js +2 -2
- package/lib/components/runtimes/RuntimeCellVariables.js +9 -9
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +3 -3
- package/lib/components/runtimes/RuntimeLauncherDialog.js +30 -34
- package/lib/components/runtimes/RuntimePickerBase.js +42 -31
- package/lib/components/runtimes/RuntimePickerCell.js +9 -12
- package/lib/components/runtimes/RuntimePickerNotebook.js +44 -44
- package/lib/components/runtimes/RuntimeReservationControl.js +10 -15
- package/lib/components/runtimes/RuntimeSimplePicker.js +9 -12
- package/lib/components/runtimes/RuntimeUtils.js +22 -12
- package/lib/components/runtimes/RuntimeVariables.js +7 -7
- package/lib/components/screenshot/ScreenCapture.js +9 -13
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +1 -1
- package/lib/components/screenshot/ScreenCaptureButton.js +14 -8
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +19 -17
- package/lib/components/snippets/SnippetDialog.js +5 -5
- package/lib/components/storage/ContentsBrowser.js +63 -56
- package/lib/components/storage/ContentsItems.js +10 -8
- package/lib/components/students/StudentItemStatus.d.ts +1 -1
- package/lib/components/students/StudentItemStatus.js +35 -16
- package/lib/components/subnav/SubNav.d.ts +1 -1
- package/lib/components/subnav/SubNav.js +30 -15
- package/lib/components/subnav/SubNav.module.css +55 -21
- package/lib/components/tables/DataTable.js +1 -4
- package/lib/components/text-reveal/TextRevealAnimation.js +7 -2
- package/lib/components/text-reveal/TextRevealAnimation.module.css +4 -2
- package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
- package/lib/components/tokens/SpaceVariantToken.js +5 -5
- package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -3
- package/lib/components/users/PeerIndicator.d.ts +1 -1
- package/lib/components/users/PeerIndicator.js +5 -5
- package/lib/config/Configuration.d.ts +48 -0
- package/lib/config/Configuration.js +42 -0
- package/lib/config/integrations/Loom.js +3 -3
- package/lib/examples/CellExample.d.ts +2 -2
- package/lib/examples/CellExample.js +34 -3
- 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 +1 -3
- package/lib/examples/NotebookExample.js +9 -7
- 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/{NotebookExample1.ipynb.json → notebooks/Lite.ipynb.json} +45 -53
- 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 +10 -10
- package/lib/hooks/index.d.ts +29 -28
- package/lib/hooks/index.js +29 -28
- package/lib/hooks/layouts/LayoutBackdrop.js +3 -6
- package/lib/hooks/layouts/LayoutScreenshot.css +1 -1
- package/lib/hooks/layouts/LayoutScreenshot.js +6 -6
- package/lib/hooks/useAIAgents.d.ts +1 -1
- package/lib/hooks/useAIAgents.js +6 -6
- package/lib/hooks/useAuthorization.js +4 -4
- package/lib/hooks/useBackdrop.js +7 -7
- package/lib/hooks/useBackdropJupyterLab.d.ts +1 -1
- package/lib/hooks/useBackdropJupyterLab.js +4 -4
- package/lib/hooks/useCache.d.ts +6 -2
- package/lib/hooks/useCache.js +233 -179
- package/lib/hooks/useCellOutputshot.js +3 -6
- package/lib/hooks/useContainsFocus.js +2 -1
- package/lib/hooks/useDatalayer.js +5 -3
- package/lib/hooks/useError.d.ts +1 -1
- package/lib/hooks/useError.js +2 -2
- package/lib/hooks/useExternalScript.js +4 -4
- package/lib/hooks/useFocusTrap.js +2 -1
- package/lib/hooks/useIAM.js +4 -5
- package/lib/hooks/useId.js +3 -3
- package/lib/hooks/useJupyterLabTheme.js +3 -1
- 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 -4
- package/lib/hooks/useNavigate.d.ts +5 -1
- package/lib/hooks/useNavigate.js +62 -7
- package/lib/hooks/useNotebookAIAgent.js +3 -1
- package/lib/hooks/useParams.d.ts +5 -0
- package/lib/hooks/useParams.js +112 -0
- package/lib/hooks/useRuntimes.js +2 -2
- package/lib/hooks/useScreenshot.js +5 -5
- package/lib/hooks/useToast.js +15 -13
- package/lib/hooks/useUpload.js +9 -9
- package/lib/hooks/useUser.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.js +7 -3
- package/lib/mocks/components/FlashMock.js +4 -4
- package/lib/mocks/hooks/rests/rests.js +15 -18
- package/lib/mocks/hooks/useDatalayerMock.d.ts +2 -2
- package/lib/mocks/hooks/useDatalayerMock.js +7 -7
- package/lib/mocks/models/CodeBlockMock.js +1 -1
- package/lib/mocks/models/CodelineMock.js +1 -1
- package/lib/mocks/models/CourseMock.d.ts +1 -1
- package/lib/mocks/models/CourseMock.js +10 -10
- package/lib/mocks/models/InviteMock.d.ts +1 -1
- package/lib/mocks/models/InviteMock.js +21 -6
- 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 -9
- 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 -6
- package/lib/mocks/views/ActionMenuMock.js +1 -1
- package/lib/mocks/views/ChartMock.js +3 -3
- package/lib/mocks/views/ChartMockOptions.js +24 -24
- package/lib/mocks/views/DashboardMock.js +74 -74
- package/lib/mocks/views/FormMock.js +1 -1
- package/lib/mocks/views/TableMock.js +1 -1
- 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 -14
- package/lib/models/ContactIAMProvider.js +2 -2
- package/lib/models/Course.d.ts +7 -7
- package/lib/models/Dataset.d.ts +1 -1
- 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/Exercise.d.ts +1 -1
- package/lib/models/IAMProviderLinked.js +1 -1
- 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 -18
- 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 -2
- package/lib/models/OrganizationMember.d.ts +2 -2
- package/lib/models/Page.js +4 -2
- package/lib/models/PageTag.d.ts +1 -1
- 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 -12
- package/lib/models/RolesPlatform.d.ts +1 -1
- package/lib/models/RolesPlatform.js +12 -34
- package/lib/models/RolesTeam.d.ts +1 -1
- package/lib/models/RolesTeam.js +3 -10
- package/lib/models/Runtime.js +4 -4
- package/lib/models/RuntimeSnapshot.js +1 -1
- package/lib/models/School.d.ts +4 -4
- 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/Team.d.ts +3 -3
- package/lib/models/Team.js +2 -2
- package/lib/models/TeamMember.d.ts +2 -2
- package/lib/models/URN.js +1 -1
- package/lib/models/User.d.ts +2 -2
- package/lib/models/User.js +5 -3
- package/lib/models/UserOnboarding.d.ts +1 -1
- package/lib/models/UserOnboarding.js +7 -7
- package/lib/models/UserSettings.js +2 -2
- package/lib/models/index.d.ts +2 -2
- package/lib/models/index.js +2 -2
- 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/index.d.ts +1 -1
- package/lib/routes/index.js +1 -1
- package/lib/services/DatalayerServiceManager.d.ts +22 -0
- package/lib/services/DatalayerServiceManager.js +69 -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 -1
- package/lib/state/index.d.ts +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/storage/IAMStorage.js +14 -2
- package/lib/state/storage/index.d.ts +1 -1
- package/lib/state/storage/index.js +1 -1
- package/lib/state/substates/AIAgentState.js +4 -2
- package/lib/state/substates/CellState.js +6 -5
- package/lib/state/substates/CoreState.d.ts +1 -1
- package/lib/state/substates/CoreState.js +26 -17
- package/lib/state/substates/DatasourceState.js +1 -1
- package/lib/state/substates/IAMState.d.ts +4 -0
- package/lib/state/substates/IAMState.js +39 -23
- package/lib/state/substates/JupyterLabState.js +1 -1
- package/lib/state/substates/LayoutState.d.ts +2 -2
- package/lib/state/substates/LayoutState.js +41 -28
- package/lib/state/substates/OrganizationState.js +1 -1
- package/lib/state/substates/RuntimesState.js +11 -6
- package/lib/state/substates/SpaceState.js +1 -1
- package/lib/state/substates/SurveysState.js +4 -4
- package/lib/state/substates/TeamState.js +1 -1
- package/lib/test-setup.js +25 -3
- package/lib/theme/DatalayerTheme.js +1 -1
- package/lib/theme/DatalayerThemeProvider.js +17 -14
- package/lib/theme/Palette.js +1 -1
- package/lib/utils/Avatar.js +2 -2
- package/lib/utils/Browser.js +6 -6
- package/lib/utils/Cells.d.ts +1 -1
- package/lib/utils/Cookie.js +1 -1
- package/lib/utils/Date.js +2 -2
- package/lib/utils/Download.js +5 -3
- package/lib/utils/DownloadFile.js +4 -2
- package/lib/utils/Env.js +2 -1
- package/lib/utils/Lazy.d.ts +1 -1
- package/lib/utils/Lazy.js +2 -2
- package/lib/utils/Name.js +10 -8
- package/lib/utils/Notebook.d.ts +1 -1
- package/lib/utils/Notebook.js +3 -3
- package/lib/utils/Number.js +13 -9
- package/lib/utils/Plots.js +4 -4
- package/lib/utils/Screenshot.js +1 -1
- package/lib/utils/Sleep.js +1 -1
- package/lib/utils/Snapshot.js +2 -2
- package/lib/utils/String.js +2 -2
- package/lib/utils/Uri.js +1 -1
- package/lib/utils/WithSuspense.js +3 -6
- package/lib/utils/logger.d.ts +16 -0
- package/lib/utils/logger.js +52 -0
- package/package.json +49 -5
- package/lib/__tests__/App.test.js +0 -17
- /package/lib/{__tests__/App.test.d.ts → examples/main.d.ts} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { WebsocketProvider } from 'y-websocket';
|
|
6
|
+
import { URLExt } from '@jupyterlab/coreutils';
|
|
7
|
+
import { Signal } from '@lumino/signaling';
|
|
8
|
+
// Import CollaborationStatus enum separately since it's exported
|
|
9
|
+
var CollaborationStatus;
|
|
10
|
+
(function (CollaborationStatus) {
|
|
11
|
+
CollaborationStatus["Disconnected"] = "disconnected";
|
|
12
|
+
CollaborationStatus["Connecting"] = "connecting";
|
|
13
|
+
CollaborationStatus["Connected"] = "connected";
|
|
14
|
+
CollaborationStatus["Error"] = "error";
|
|
15
|
+
})(CollaborationStatus || (CollaborationStatus = {}));
|
|
16
|
+
import { requestDatalayerCollaborationSessionId } from './DatalayerCollaboration';
|
|
17
|
+
import { coreStore } from '../state/substates/CoreState';
|
|
18
|
+
/**
|
|
19
|
+
* Datalayer collaboration provider
|
|
20
|
+
*
|
|
21
|
+
* This provider connects to Datalayer's collaboration service using WebSockets.
|
|
22
|
+
*/
|
|
23
|
+
export class DatalayerCollaborationProvider {
|
|
24
|
+
type = 'datalayer';
|
|
25
|
+
_status = CollaborationStatus.Disconnected;
|
|
26
|
+
_provider = null;
|
|
27
|
+
_sharedModel = null;
|
|
28
|
+
_statusChanged = new Signal(this);
|
|
29
|
+
_errorOccurred = new Signal(this);
|
|
30
|
+
_syncStateChanged = new Signal(this);
|
|
31
|
+
_isDisposed = false;
|
|
32
|
+
_config;
|
|
33
|
+
_onSync = null;
|
|
34
|
+
_onConnectionClose = null;
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this._config = config;
|
|
37
|
+
}
|
|
38
|
+
get status() {
|
|
39
|
+
return this._status;
|
|
40
|
+
}
|
|
41
|
+
get isConnected() {
|
|
42
|
+
return this._status === CollaborationStatus.Connected;
|
|
43
|
+
}
|
|
44
|
+
get isDisposed() {
|
|
45
|
+
return this._isDisposed;
|
|
46
|
+
}
|
|
47
|
+
get events() {
|
|
48
|
+
return {
|
|
49
|
+
statusChanged: this._statusChanged,
|
|
50
|
+
errorOccurred: this._errorOccurred,
|
|
51
|
+
syncStateChanged: this._syncStateChanged,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
setStatus(status) {
|
|
55
|
+
if (this._status !== status) {
|
|
56
|
+
this._status = status;
|
|
57
|
+
this._statusChanged.emit(status);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async connect(sharedModel, documentId, options) {
|
|
61
|
+
if (this.isConnected) {
|
|
62
|
+
console.warn('Already connected to Datalayer collaboration service');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.setStatus(CollaborationStatus.Connecting);
|
|
66
|
+
try {
|
|
67
|
+
// Get configuration from store or use provided config
|
|
68
|
+
const { configuration } = coreStore.getState();
|
|
69
|
+
const runUrl = this._config.runUrl ?? configuration?.runUrl;
|
|
70
|
+
const token = this._config.token ?? configuration?.token;
|
|
71
|
+
if (!runUrl) {
|
|
72
|
+
throw new Error('Datalayer runUrl is not configured');
|
|
73
|
+
}
|
|
74
|
+
if (!token) {
|
|
75
|
+
throw new Error('Datalayer token is not configured');
|
|
76
|
+
}
|
|
77
|
+
const { ydoc, awareness } = sharedModel;
|
|
78
|
+
// Build WebSocket URL
|
|
79
|
+
const documentURL = URLExt.join(runUrl, '/api/spacer/v1/documents');
|
|
80
|
+
const wsUrl = documentURL.replace(/^http/, 'ws');
|
|
81
|
+
// Request collaboration session from Datalayer
|
|
82
|
+
const sessionId = await requestDatalayerCollaborationSessionId({
|
|
83
|
+
url: URLExt.join(documentURL, documentId),
|
|
84
|
+
token,
|
|
85
|
+
});
|
|
86
|
+
// Create WebSocket provider
|
|
87
|
+
this._provider = new WebsocketProvider(wsUrl, documentId, ydoc, {
|
|
88
|
+
disableBc: true,
|
|
89
|
+
params: {
|
|
90
|
+
sessionId,
|
|
91
|
+
token,
|
|
92
|
+
},
|
|
93
|
+
awareness,
|
|
94
|
+
...options,
|
|
95
|
+
});
|
|
96
|
+
this._sharedModel = sharedModel;
|
|
97
|
+
// Set up event handlers
|
|
98
|
+
this._onSync = (isSynced) => {
|
|
99
|
+
this.handleSync(isSynced);
|
|
100
|
+
};
|
|
101
|
+
this._onConnectionClose = (event) => {
|
|
102
|
+
if (event) {
|
|
103
|
+
this.handleConnectionClose(event);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
this._provider.on('sync', this._onSync);
|
|
107
|
+
this._provider.on('connection-close', this._onConnectionClose);
|
|
108
|
+
console.log('Connected to Datalayer collaboration service');
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
this.setStatus(CollaborationStatus.Error);
|
|
112
|
+
this._errorOccurred.emit(error);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
disconnect() {
|
|
117
|
+
if (this._provider) {
|
|
118
|
+
if (this._onSync) {
|
|
119
|
+
this._provider.off('sync', this._onSync);
|
|
120
|
+
}
|
|
121
|
+
if (this._onConnectionClose) {
|
|
122
|
+
this._provider.off('connection-close', this._onConnectionClose);
|
|
123
|
+
}
|
|
124
|
+
this._provider.disconnect();
|
|
125
|
+
this._provider = null;
|
|
126
|
+
}
|
|
127
|
+
this._sharedModel = null;
|
|
128
|
+
this.setStatus(CollaborationStatus.Disconnected);
|
|
129
|
+
}
|
|
130
|
+
getProvider() {
|
|
131
|
+
return this._provider;
|
|
132
|
+
}
|
|
133
|
+
getSharedModel() {
|
|
134
|
+
return this._sharedModel;
|
|
135
|
+
}
|
|
136
|
+
handleConnectionClose(event) {
|
|
137
|
+
console.warn('Collaboration connection closed:', event);
|
|
138
|
+
this.setStatus(CollaborationStatus.Disconnected);
|
|
139
|
+
// Handle session expiration (code 4002)
|
|
140
|
+
if (event.code === 4002) {
|
|
141
|
+
console.warn('Datalayer collaboration session expired');
|
|
142
|
+
// Attempt to reconnect could be implemented here
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
handleSync(isSynced) {
|
|
146
|
+
this._syncStateChanged.emit(isSynced);
|
|
147
|
+
if (isSynced) {
|
|
148
|
+
this.setStatus(CollaborationStatus.Connected);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
dispose() {
|
|
152
|
+
if (this._isDisposed) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.disconnect();
|
|
156
|
+
// Signals don't need explicit disposal in Lumino
|
|
157
|
+
// They are cleaned up when the object is garbage collected
|
|
158
|
+
this._isDisposed = true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Export the provider for direct instantiation
|
|
162
|
+
export default DatalayerCollaborationProvider;
|
|
@@ -15,12 +15,12 @@ const variants = [
|
|
|
15
15
|
];
|
|
16
16
|
export const getRandomBoringAvatarVariant = () => variants[Math.floor(Math.random() * variants.length)] as VariantType;
|
|
17
17
|
*/
|
|
18
|
-
const getRandomBoringAvatarVariant = () =>
|
|
18
|
+
const getRandomBoringAvatarVariant = () => 'bauhaus';
|
|
19
19
|
const RANDOM_BORING_AVATOR_VARIANT = getRandomBoringAvatarVariant();
|
|
20
20
|
export const BoringAvatar = (props) => {
|
|
21
21
|
const { displayName, size, square, style } = props;
|
|
22
22
|
const variant = props.variant ?? getRandomBoringAvatarVariant();
|
|
23
|
-
return (_jsx("span", { style: { ...style || {} }, children: _jsx(BoringAvatars, { size: size, name: displayName, variant: variant, square: square, colors: [
|
|
23
|
+
return (_jsx("span", { style: { ...(style || {}) }, children: _jsx(BoringAvatars, { size: size, name: displayName, variant: variant, square: square, colors: [
|
|
24
24
|
'#000000',
|
|
25
25
|
'#146A7C',
|
|
26
26
|
'#16A085',
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
import { Avatar, Link } from '@primer/react';
|
|
7
|
-
import { Box } from
|
|
7
|
+
import { Box } from '@datalayer/primer-addons';
|
|
8
8
|
import { AvatarSkeleton } from '../../components/display';
|
|
9
9
|
import { getAvatarURL } from '../../utils';
|
|
10
10
|
const Profile = (props) => {
|
|
@@ -17,14 +17,7 @@ const Profile = (props) => {
|
|
|
17
17
|
};
|
|
18
18
|
export const UserProfileAvatar = (props) => {
|
|
19
19
|
const { onClick, user, size } = props;
|
|
20
|
-
return
|
|
21
|
-
onClick
|
|
22
|
-
?
|
|
23
|
-
_jsx(Link, { href: "javascript: return false;", onClick: onClick, children: _jsx(Profile, { ...props }) })
|
|
24
|
-
:
|
|
25
|
-
_jsx(Profile, { ...props })
|
|
26
|
-
:
|
|
27
|
-
_jsx(AvatarSkeleton, { size: size }));
|
|
20
|
+
return user ? (onClick ? (_jsx(Link, { href: "javascript: return false;", onClick: onClick, children: _jsx(Profile, { ...props }) })) : (_jsx(Profile, { ...props }))) : (_jsx(AvatarSkeleton, { size: size }));
|
|
28
21
|
};
|
|
29
22
|
UserProfileAvatar.defaultProps = {
|
|
30
23
|
size: 100,
|
|
@@ -3,11 +3,11 @@ 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
|
-
import { Link } from
|
|
7
|
-
import { Banner } from
|
|
8
|
-
import { useNavigate } from
|
|
6
|
+
import { Link } from '@primer/react';
|
|
7
|
+
import { Banner } from '@primer/react/experimental';
|
|
8
|
+
import { useNavigate } from '../../hooks';
|
|
9
9
|
export const NoAutomationBanner = () => {
|
|
10
10
|
const navigate = useNavigate();
|
|
11
|
-
return (_jsx(_Fragment, { children: _jsx(Banner, { title: "Warning", description: _jsxs(_Fragment, { children: ["We don't have bandwidth to automate this feature.
|
|
11
|
+
return (_jsx(_Fragment, { children: _jsx(Banner, { title: "Warning", description: _jsxs(_Fragment, { children: ["We don't have bandwidth to automate this feature.", ' ', _jsx(Link, { href: "", onClick: e => navigate('/contact', e), children: "Please reach out" }), ' ', "to prioritize this."] }), primaryAction: _jsx(Banner.PrimaryAction, { onClick: e => navigate('/contact', e), children: "Reach out" }), variant: "warning" }) }));
|
|
12
12
|
};
|
|
13
13
|
export default NoAutomationBanner;
|
|
@@ -11,6 +11,6 @@ export const DownloadCSVButton = (props) => {
|
|
|
11
11
|
return (_jsx(Button, { variant: variant, leadingVisual: DownloadIcon, onClick: e => downloadCSV(data, fileName), children: "Download" }));
|
|
12
12
|
};
|
|
13
13
|
DownloadCSVButton.defaultProps = {
|
|
14
|
-
variant:
|
|
14
|
+
variant: 'default',
|
|
15
15
|
};
|
|
16
16
|
export default DownloadCSVButton;
|
|
@@ -27,6 +27,6 @@ export interface IPrice {
|
|
|
27
27
|
/**
|
|
28
28
|
* Stripe checkout.
|
|
29
29
|
*/
|
|
30
|
-
export declare function StripeCheckout({ checkoutPortal }: {
|
|
30
|
+
export declare function StripeCheckout({ checkoutPortal, }: {
|
|
31
31
|
checkoutPortal: ICheckoutPortal | null;
|
|
32
32
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,13 +5,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { createElement, useCallback, useEffect, useState } from 'react';
|
|
7
7
|
import { Button, Flash, FormControl, Spinner, Text } from '@primer/react';
|
|
8
|
-
import { Box } from
|
|
8
|
+
import { Box } from '@datalayer/primer-addons';
|
|
9
9
|
import { useCache } from '../../hooks';
|
|
10
10
|
import { useIAMStore } from '../../state';
|
|
11
11
|
/**
|
|
12
12
|
* Stripe checkout.
|
|
13
13
|
*/
|
|
14
|
-
export function StripeCheckout({ checkoutPortal }) {
|
|
14
|
+
export function StripeCheckout({ checkoutPortal, }) {
|
|
15
15
|
const { iamRunUrl } = useIAMStore();
|
|
16
16
|
const { createCheckoutSession, refreshStripePrices } = useCache();
|
|
17
17
|
const [stripe, setStripe] = useState(null);
|
|
@@ -70,7 +70,7 @@ export function StripeCheckout({ checkoutPortal }) {
|
|
|
70
70
|
display: 'grid',
|
|
71
71
|
gap: 'var(--stack-gap-normal)',
|
|
72
72
|
gridTemplateColumns: Array(items.length).fill('1fr').join(' '),
|
|
73
|
-
padding: 'var(--stack-padding-normal) 0'
|
|
73
|
+
padding: 'var(--stack-padding-normal) 0',
|
|
74
74
|
}, children: items.map(item => (_jsx(Box, { role: "radio", "aria-labelledby": `checkout-price-${item.id}`, "aria-checked": product?.id === item.id, onClick: () => {
|
|
75
75
|
setProduct(item);
|
|
76
76
|
}, sx: {
|
|
@@ -81,12 +81,12 @@ export function StripeCheckout({ checkoutPortal }) {
|
|
|
81
81
|
? 'var(--borderColor-accent-emphasis)'
|
|
82
82
|
: 'var(--borderColor-default)',
|
|
83
83
|
padding: 'var(--stack-padding-condensed)',
|
|
84
|
-
cursor: 'pointer'
|
|
84
|
+
cursor: 'pointer',
|
|
85
85
|
}, children: _jsxs(FormControl, { sx: {
|
|
86
|
-
alignItems: 'center'
|
|
86
|
+
alignItems: 'center',
|
|
87
87
|
}, children: [_jsx(FormControl.Label, { id: `checkout-price-${item.id}`, sx: { alignSelf: 'center' }, children: item.name }), _jsx(Text, { as: "p", children: new Intl.NumberFormat(undefined, {
|
|
88
88
|
style: 'currency',
|
|
89
|
-
currency: item.currency
|
|
89
|
+
currency: item.currency,
|
|
90
90
|
}).format(item.amount / 100) }), _jsxs(Text, { as: "p", children: [item.credits, " credits"] })] }, item.id) }))) }), _jsx(Button, { variant: "primary", onClick: () => {
|
|
91
91
|
setCheckout(true);
|
|
92
92
|
}, disabled: product === null, sx: { float: 'right' }, children: "Checkout" })] })) : (_jsx(Box, { children: _jsx(Flash, { variant: "danger", children: "Unable to fetch the available products. Please try again later." }) }));
|
|
@@ -7,6 +7,6 @@ import { useWindowSize } from 'usehooks-ts';
|
|
|
7
7
|
import Confetti from 'react-confetti';
|
|
8
8
|
export const ConfettiSuccess = () => {
|
|
9
9
|
const { width, height } = useWindowSize();
|
|
10
|
-
return
|
|
10
|
+
return _jsx(Confetti, { width: width, height: height });
|
|
11
11
|
};
|
|
12
12
|
export default ConfettiSuccess;
|
|
@@ -3,11 +3,11 @@ 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
|
-
import { useState, useEffect, useCallback } from
|
|
7
|
-
import { Select } from
|
|
8
|
-
import { useCache, useUser } from
|
|
9
|
-
import { useLayoutStore } from
|
|
10
|
-
const NO_ORGANIZATION_SELECTED_VALUE =
|
|
6
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
7
|
+
import { Select } from '@primer/react';
|
|
8
|
+
import { useCache, useUser } from './../../hooks';
|
|
9
|
+
import { useLayoutStore } from '../../state';
|
|
10
|
+
const NO_ORGANIZATION_SELECTED_VALUE = 'NO_ORGANIZATION_SELECTED_VALUE';
|
|
11
11
|
export const OrganizationSelect = () => {
|
|
12
12
|
const user = useUser();
|
|
13
13
|
const { organization, updateLayoutOrganization, updateLayoutSpace } = useLayoutStore();
|
|
@@ -3,15 +3,15 @@ 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
|
-
import { useState, useEffect, useCallback } from
|
|
7
|
-
import { FormControl, Select } from
|
|
8
|
-
import { Box } from
|
|
9
|
-
import { useCache, useUser } from
|
|
10
|
-
import { useLayoutStore } from
|
|
6
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
7
|
+
import { FormControl, Select } from '@primer/react';
|
|
8
|
+
import { Box } from '@datalayer/primer-addons';
|
|
9
|
+
import { useCache, useUser } from './../../hooks';
|
|
10
|
+
import { useLayoutStore } from '../../state';
|
|
11
11
|
export const SpaceSelect = () => {
|
|
12
12
|
const user = useUser();
|
|
13
13
|
const { organization, space, updateLayoutSpace } = useLayoutStore();
|
|
14
|
-
const { refreshUserSpaces, getUserSpaces, refreshOrganizationSpaces, getOrganizationSpaces } = useCache();
|
|
14
|
+
const { refreshUserSpaces, getUserSpaces, refreshOrganizationSpaces, getOrganizationSpaces, } = useCache();
|
|
15
15
|
const [spaces, setSpaces] = useState([]);
|
|
16
16
|
const [_, setSelection] = useState(space);
|
|
17
17
|
useEffect(() => {
|
|
@@ -32,7 +32,7 @@ export const SpaceSelect = () => {
|
|
|
32
32
|
}, [user, organization]);
|
|
33
33
|
const onSelectionChange = useCallback((e) => {
|
|
34
34
|
const selectedSpace = e.target.value;
|
|
35
|
-
const org =
|
|
35
|
+
const org = selectedSpace === undefined
|
|
36
36
|
? undefined
|
|
37
37
|
: spaces[parseInt(selectedSpace, 10)];
|
|
38
38
|
setSelection(org);
|
|
@@ -3,7 +3,7 @@ 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
|
-
import { SkeletonAvatar } from
|
|
6
|
+
import { SkeletonAvatar } from '@primer/react/experimental';
|
|
7
7
|
export const AvatarSkeleton = (props) => {
|
|
8
8
|
const { size } = props;
|
|
9
9
|
return (_jsx(_Fragment, { children: _jsx(SkeletonAvatar, { size: size }) }));
|
|
@@ -3,18 +3,18 @@ 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
|
-
import { Spinner, Text } from
|
|
7
|
-
import { Box } from
|
|
6
|
+
import { Spinner, Text } from '@primer/react';
|
|
7
|
+
import { Box } from '@datalayer/primer-addons';
|
|
8
8
|
export const CenteredSpinner = (props) => {
|
|
9
9
|
const { message, size } = props;
|
|
10
10
|
return (_jsxs(Box, { sx: {
|
|
11
11
|
display: 'flex',
|
|
12
12
|
alignItems: 'center',
|
|
13
13
|
justifyContent: 'center',
|
|
14
|
-
minHeight: '40px'
|
|
14
|
+
minHeight: '40px',
|
|
15
15
|
}, children: [_jsx(Spinner, { size: size }), message && _jsx(Text, { sx: { marginLeft: 3 }, children: message })] }));
|
|
16
16
|
};
|
|
17
17
|
CenteredSpinner.defaultProps = {
|
|
18
|
-
size:
|
|
18
|
+
size: 'medium',
|
|
19
19
|
};
|
|
20
20
|
export default CenteredSpinner;
|
|
@@ -6,10 +6,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
export const CodePreview = (props) => {
|
|
7
7
|
const { code } = props;
|
|
8
8
|
return (_jsx("pre", { style: {
|
|
9
|
-
fontSize:
|
|
10
|
-
wordBreak:
|
|
11
|
-
wordWrap:
|
|
12
|
-
whiteSpace:
|
|
9
|
+
fontSize: '12px',
|
|
10
|
+
wordBreak: 'break-all',
|
|
11
|
+
wordWrap: 'break-word',
|
|
12
|
+
whiteSpace: 'pre-wrap',
|
|
13
13
|
}, children: code }));
|
|
14
14
|
};
|
|
15
15
|
export default CodePreview;
|
|
@@ -3,24 +3,23 @@ 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
|
-
import { Link, Text } from
|
|
7
|
-
import { Box } from
|
|
8
|
-
import { ArrowRightIcon } from
|
|
9
|
-
import { useNavigate } from
|
|
6
|
+
import { Link, Text } from '@primer/react';
|
|
7
|
+
import { Box } from '@datalayer/primer-addons';
|
|
8
|
+
import { ArrowRightIcon } from '@primer/octicons-react';
|
|
9
|
+
import { useNavigate } from '../../hooks';
|
|
10
10
|
export const DatalayerBox = (props) => {
|
|
11
11
|
const { title, linkLabel, linkRoute, children } = props;
|
|
12
12
|
const navigate = useNavigate();
|
|
13
13
|
return (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: {
|
|
14
|
-
display:
|
|
15
|
-
alignItems:
|
|
16
|
-
justifyContent:
|
|
17
|
-
paddingRight: 4
|
|
18
|
-
}, children: [_jsx(Text, { as: "h2", sx: { borderLeft:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
borderRadius: "2",
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'space-between',
|
|
17
|
+
paddingRight: 4,
|
|
18
|
+
}, children: [_jsx(Text, { as: "h2", sx: { borderLeft: '6px solid #28b899', paddingLeft: 2 }, children: title }), linkRoute && linkLabel && (_jsxs(Link, { href: "javascript: return false;", onClick: e => navigate(linkRoute), children: [linkLabel, _jsx(ArrowRightIcon, {})] }))] }), _jsx(Box, { sx: {
|
|
19
|
+
borderColor: 'border.default',
|
|
20
|
+
borderStyle: 'solid',
|
|
21
|
+
borderWidth: '1',
|
|
22
|
+
borderRadius: '2',
|
|
24
23
|
padding: 4,
|
|
25
24
|
marginTop: 2,
|
|
26
25
|
}, children: children })] }));
|
|
@@ -3,27 +3,25 @@ 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
|
-
import { createElement, useState } from 'react';
|
|
6
|
+
import { createElement, useState, } from 'react';
|
|
7
7
|
import { Dialog } from '@jupyterlab/apputils';
|
|
8
8
|
import { ReactWidget } from '@jupyterlab/ui-components';
|
|
9
9
|
import { PromiseDelegate } from '@lumino/coreutils';
|
|
10
10
|
import { Widget } from '@lumino/widgets';
|
|
11
11
|
import { FocusKeys } from '@primer/behaviors';
|
|
12
12
|
import { Checkbox, FormControl, useFocusZone } from '@primer/react';
|
|
13
|
-
import { Dialog as PrimerDialog } from '@primer/react/experimental';
|
|
13
|
+
import { Dialog as PrimerDialog, } from '@primer/react/experimental';
|
|
14
14
|
function DialogFooter(props) {
|
|
15
15
|
const { checkbox, footerButtons, setChecked } = props;
|
|
16
16
|
const [checked, setLocalChecked] = useState();
|
|
17
17
|
const { containerRef: footerRef } = useFocusZone({
|
|
18
18
|
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.Tab,
|
|
19
|
-
focusInStrategy: 'closest'
|
|
19
|
+
focusInStrategy: 'closest',
|
|
20
20
|
});
|
|
21
|
-
return (_jsxs(PrimerDialog.Footer, { className: "dla-dialog-footer", ref: footerRef, children: [checkbox &&
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, title: checkbox.caption ?? '' }), _jsx(FormControl.Label, { children: checkbox.label ?? '' })] }), _jsx("div", { className: "dla-dialog-footer-spacer" }), footerButtons &&
|
|
26
|
-
_jsx(PrimerDialog.Buttons, { buttons: footerButtons })] }));
|
|
21
|
+
return (_jsxs(PrimerDialog.Footer, { className: "dla-dialog-footer", ref: footerRef, children: [checkbox && (_jsxs(FormControl, { layout: "horizontal", children: [_jsx(Checkbox, { className: checkbox.className ?? '', checked: checked, defaultChecked: checkbox.checked, onChange: e => {
|
|
22
|
+
setLocalChecked(e.target.checked);
|
|
23
|
+
setChecked(e.target.checked);
|
|
24
|
+
}, title: checkbox.caption ?? '' }), _jsx(FormControl.Label, { children: checkbox.label ?? '' })] })), _jsx("div", { className: "dla-dialog-footer-spacer" }), footerButtons && (_jsx(PrimerDialog.Buttons, { buttons: footerButtons }))] }));
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
29
27
|
* A primer dialog mimicking the JupyterLab dialog interface
|
|
@@ -38,7 +36,7 @@ export class JupyterDialog extends ReactWidget {
|
|
|
38
36
|
_result = {
|
|
39
37
|
button: null,
|
|
40
38
|
isChecked: null,
|
|
41
|
-
value: null
|
|
39
|
+
value: null,
|
|
42
40
|
};
|
|
43
41
|
/**
|
|
44
42
|
* Create a dialog instance.
|
|
@@ -50,13 +48,13 @@ export class JupyterDialog extends ReactWidget {
|
|
|
50
48
|
this.checkbox = options.checkbox ?? null;
|
|
51
49
|
this.buttons = options.buttons ?? [
|
|
52
50
|
Dialog.cancelButton(),
|
|
53
|
-
Dialog.okButton()
|
|
51
|
+
Dialog.okButton(),
|
|
54
52
|
];
|
|
55
53
|
this.dialogTitle = options.title;
|
|
56
54
|
}
|
|
57
55
|
_renderBody = (props) => (_jsx(PrimerDialog.Body, { children: createElement(this.body, {
|
|
58
56
|
...props,
|
|
59
|
-
setValue: this.setValue
|
|
57
|
+
setValue: this.setValue,
|
|
60
58
|
}) }));
|
|
61
59
|
_renderFooter = (props) => (_jsx(DialogFooter, { ...props, checkbox: this.checkbox, setChecked: this.setChecked }));
|
|
62
60
|
render() {
|
|
@@ -69,12 +67,16 @@ export class JupyterDialog extends ReactWidget {
|
|
|
69
67
|
}, onClose: this.close, footerButtons: this.buttons.map((but, idx) => {
|
|
70
68
|
const footerButton = {
|
|
71
69
|
buttonType: but.displayType === 'default'
|
|
72
|
-
? but.accept
|
|
70
|
+
? but.accept
|
|
71
|
+
? 'primary'
|
|
72
|
+
: 'default'
|
|
73
73
|
: 'danger',
|
|
74
|
-
onClick: () => {
|
|
74
|
+
onClick: () => {
|
|
75
|
+
this.handleButton(idx);
|
|
76
|
+
},
|
|
75
77
|
content: but.label,
|
|
76
78
|
'aria-label': but.ariaLabel,
|
|
77
|
-
autoFocus: but.accept
|
|
79
|
+
autoFocus: but.accept,
|
|
78
80
|
};
|
|
79
81
|
return footerButton;
|
|
80
82
|
}), renderBody: this._renderBody, renderFooter: this._renderFooter, title: this.dialogTitle }));
|
|
@@ -2,8 +2,10 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
export type NavLinkProps = {
|
|
3
3
|
to: string;
|
|
4
4
|
children: ReactNode;
|
|
5
|
+
[key: string]: any;
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Navigation link for primer NavList
|
|
9
|
+
* Works with React Router, Next.js, or native browser navigation
|
|
8
10
|
*/
|
|
9
|
-
export declare const NavLink: import("react").ForwardRefExoticComponent<NavLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
11
|
+
export declare const NavLink: import("react").ForwardRefExoticComponent<Omit<NavLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -6,12 +6,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
import { forwardRef, useCallback } from 'react';
|
|
7
7
|
import { useNavigate } from '../../hooks';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Navigation link for primer NavList
|
|
10
|
+
* Works with React Router, Next.js, or native browser navigation
|
|
10
11
|
*/
|
|
11
12
|
export const NavLink = forwardRef(({ to, children, ...props }, ref) => {
|
|
12
13
|
const navigate = useNavigate();
|
|
13
|
-
const onClick = useCallback(() => {
|
|
14
|
+
const onClick = useCallback((e) => {
|
|
15
|
+
e.preventDefault();
|
|
14
16
|
navigate(to);
|
|
15
|
-
}, [to]);
|
|
16
|
-
return (_jsx("a", { ref: ref, ...props, onClick: onClick, children: children }));
|
|
17
|
+
}, [to, navigate]);
|
|
18
|
+
return (_jsx("a", { ref: ref, href: to, ...props, onClick: onClick, children: children }));
|
|
17
19
|
});
|
|
@@ -3,8 +3,8 @@ 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
|
-
import { Box } from
|
|
7
|
-
import { SkeletonBox } from
|
|
6
|
+
import { Box } from '@datalayer/primer-addons';
|
|
7
|
+
import { SkeletonBox } from '@primer/react/experimental';
|
|
8
8
|
export const NotebookSkeleton = () => {
|
|
9
9
|
return (_jsxs(_Fragment, { children: [_jsx(SkeletonBox, { height: "100px" }), _jsx(Box, { style: { height: 20 } }), _jsx(SkeletonBox, { height: "100px" }), _jsx(Box, { style: { height: 20 } }), _jsx(SkeletonBox, { height: "100px" }), _jsx(Box, { style: { height: 20 } }), _jsx(SkeletonBox, { height: "100px" })] }));
|
|
10
10
|
};
|
|
@@ -4,6 +4,6 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
export const Placeholder = () => {
|
|
7
|
-
return
|
|
7
|
+
return _jsx(_Fragment, {});
|
|
8
8
|
};
|
|
9
9
|
export default Placeholder;
|
|
@@ -3,7 +3,7 @@ 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
|
-
import { Button } from
|
|
6
|
+
import { Button } from '@primer/react-brand';
|
|
7
7
|
import { MoveToTopIcon } from '@primer/octicons-react';
|
|
8
8
|
export const ToTopBranded = () => {
|
|
9
9
|
return (_jsx("div", { style: { position: 'fixed', bottom: '50px', left: '100px' }, children: _jsx(Button, { leadingVisual: _jsx(MoveToTopIcon, {}), hasArrow: false, size: "small", onClick: e => window.scrollTo(0, 0), children: "Go Top" }) }));
|
|
@@ -7,5 +7,5 @@ export interface EChartsProps {
|
|
|
7
7
|
loading?: boolean;
|
|
8
8
|
theme?: 'light' | 'dark';
|
|
9
9
|
}
|
|
10
|
-
export declare const EChartsReact: ({ options, style, settings, loading, theme }: EChartsProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const EChartsReact: ({ options, style, settings, loading, theme, }: EChartsProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default EChartsReact;
|