@datalayer/core 0.0.2 → 0.0.3
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 +12 -1
- package/lib/App.css +47 -0
- package/lib/App.d.ts +1 -1
- package/lib/App.js +17 -5
- package/lib/__tests__/index.test.js +2 -1
- package/lib/api/{RunApi.d.ts → DatalayerApi.d.ts} +4 -4
- package/lib/api/{RunApi.js → DatalayerApi.js} +4 -9
- package/lib/api/index.d.ts +2 -1
- package/lib/api/index.js +2 -6
- 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} +26 -31
- 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 +0 -5
- package/lib/api/runtimes/snapshots.js +0 -5
- package/lib/api/runtimes/utils.js +0 -5
- package/lib/assets/react.svg +1 -0
- package/lib/components/avatars/BoringAvatar.d.ts +1 -2
- 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 +0 -5
- package/lib/components/avatars/index.js +0 -5
- package/lib/components/banners/NoAutomationBanner.js +0 -5
- package/lib/components/banners/index.js +0 -5
- package/lib/components/buttons/DownloadCSVButton.d.ts +1 -1
- package/lib/components/buttons/DownloadCSVButton.js +0 -5
- 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 +0 -5
- package/lib/components/buttons/index.js +0 -5
- package/lib/components/checkout/StripeCheckout.js +0 -5
- package/lib/components/checkout/index.js +0 -5
- package/lib/components/confetti/ConfettiSuccess.js +0 -5
- package/lib/components/confetti/index.js +0 -5
- package/lib/components/context/OrganizationSelect.js +0 -5
- package/lib/components/context/SpaceSelect.js +0 -5
- package/lib/components/context/index.js +0 -5
- package/lib/components/display/AvatarSkeleton.js +0 -5
- package/lib/components/display/CenteredSpinner.js +0 -5
- package/lib/components/display/CodePreview.js +0 -5
- package/lib/components/display/DatalayerBox.js +0 -5
- package/lib/components/display/JupyterDialog.js +0 -5
- package/lib/components/display/NavLink.js +0 -5
- package/lib/components/display/NotebookSkeleton.js +0 -5
- package/lib/components/display/Placeholder.js +0 -5
- package/lib/components/display/ToTopBranded.js +0 -5
- package/lib/components/display/VisuallyHidden.js +0 -5
- package/lib/components/display/index.js +0 -5
- package/lib/components/echarts/EChartsReact.js +6 -6
- package/lib/components/echarts/index.js +0 -5
- package/lib/components/flashes/FlashClosable.js +0 -5
- package/lib/components/flashes/FlashDisclaimer.js +0 -5
- package/lib/components/flashes/FlashGuest.js +0 -5
- package/lib/components/flashes/FlashSurveys.js +0 -5
- package/lib/components/flashes/FlashUnauthorized.js +0 -5
- package/lib/components/flashes/index.js +0 -5
- package/lib/components/flashes/surveys/Survey2025_1.js +0 -5
- package/lib/components/flashes/surveys/index.js +0 -5
- package/lib/components/iam/ExternalTokenSilentLogin.js +0 -5
- package/lib/components/iam/index.js +0 -5
- package/lib/components/icons/ArtifactIcon.js +0 -5
- package/lib/components/icons/index.js +0 -5
- package/lib/components/index.js +1 -6
- package/lib/components/labels/VisibilityLabel.js +0 -5
- package/lib/components/labels/index.js +0 -5
- package/lib/components/landings/StepBlock.js +0 -5
- package/lib/components/landings/index.js +0 -5
- package/lib/components/navbar/NavigationVisbilityObserver.js +0 -5
- package/lib/components/navbar/SubdomainNavBar.js +2 -7
- package/lib/components/navbar/SubdomainNavBar.module.css +718 -0
- package/lib/components/navbar/index.js +0 -5
- package/lib/components/nbgrader/NbGradesDetails.js +0 -5
- package/lib/components/nbgrader/index.js +0 -5
- package/lib/components/notebooks/JupyterNotebook.js +0 -5
- package/lib/components/notebooks/JupyterNotebookToolbar.js +0 -5
- package/lib/components/notebooks/index.js +0 -5
- package/lib/components/primer/Portals.js +0 -5
- package/lib/components/primer/Styles.js +0 -5
- package/lib/components/primer/index.js +0 -5
- package/lib/components/progress/ConsumptionBar.js +0 -5
- package/lib/components/progress/CreditsIndicator.js +0 -6
- package/lib/components/progress/ProgressBar.js +0 -5
- package/lib/components/progress/Timer.js +0 -5
- package/lib/components/progress/index.js +0 -5
- package/lib/components/runtimes/RuntimeCellVariables.js +0 -5
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +4 -9
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -2
- package/lib/components/runtimes/RuntimeLauncherDialog.js +2 -6
- package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.js +0 -5
- package/lib/components/runtimes/RuntimePickerCell.js +0 -5
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -2
- package/lib/components/runtimes/RuntimePickerNotebook.js +1 -6
- package/lib/components/runtimes/RuntimeReservationControl.js +0 -5
- package/lib/components/runtimes/RuntimeSimplePicker.d.ts +1 -1
- package/lib/components/runtimes/RuntimeSimplePicker.js +36 -41
- package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
- package/lib/components/runtimes/RuntimeUtils.js +0 -5
- package/lib/components/runtimes/RuntimeVariables.js +0 -5
- package/lib/components/runtimes/index.js +0 -5
- package/lib/components/screenshot/ScreenCapture.js +1 -6
- package/lib/components/screenshot/index.js +0 -5
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +0 -5
- package/lib/components/snapshots/index.js +0 -5
- package/lib/components/snippets/SnippetDialog.js +0 -5
- package/lib/components/snippets/index.js +0 -5
- package/lib/components/storage/ContentsBrowser.js +12 -7
- package/lib/components/storage/ContentsItems.js +0 -5
- package/lib/components/storage/index.js +0 -5
- package/lib/components/students/StudentItemStatus.js +6 -8
- package/lib/components/students/index.js +0 -5
- package/lib/components/subnav/SubNav.d.ts +2 -2
- package/lib/components/subnav/SubNav.js +4 -9
- package/lib/components/subnav/SubNav.module.css +683 -0
- package/lib/components/subnav/index.js +0 -5
- package/lib/components/tables/DataTable.js +0 -5
- package/lib/components/tables/index.js +0 -5
- package/lib/components/text-reveal/TextRevealAnimation.js +0 -6
- package/lib/components/text-reveal/TextRevealAnimation.module.css +43 -0
- package/lib/components/text-reveal/index.js +0 -5
- package/lib/components/text-reveal/useTextRevealAnimationLines.js +0 -5
- package/lib/components/tokens/SpaceVariantToken.js +0 -5
- package/lib/components/tokens/index.js +0 -5
- package/lib/components/toolbars/AssignmentEditorToolbar.js +0 -5
- 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.js +0 -5
- package/lib/components/users/index.js +0 -5
- package/lib/config/Configuration.js +0 -5
- package/lib/config/index.js +0 -5
- package/lib/config/integrations/Loom.js +0 -5
- package/lib/config/integrations/index.js +0 -5
- package/lib/examples/CellExample.d.ts +6 -0
- package/lib/examples/CellExample.js +24 -0
- package/lib/examples/NotebookExample.d.ts +8 -0
- package/lib/examples/NotebookExample.js +22 -0
- package/lib/examples/NotebookExample1.ipynb.json +136 -0
- package/lib/hooks/assets/OutputshotPlaceholders.js +0 -5
- package/lib/hooks/assets/index.js +0 -5
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.js +1 -6
- package/lib/hooks/layouts/LayoutBackdrop.js +0 -5
- package/lib/hooks/layouts/LayoutScreenshot.css +58 -0
- package/lib/hooks/layouts/LayoutScreenshot.d.ts +1 -0
- package/lib/hooks/layouts/LayoutScreenshot.js +1 -5
- package/lib/hooks/layouts/index.js +0 -5
- package/lib/hooks/useAIAgents.js +7 -12
- package/lib/hooks/useAuthorization.js +0 -6
- package/lib/hooks/useBackdrop.js +0 -5
- package/lib/hooks/useBackdropJupyterLab.js +0 -5
- package/lib/hooks/useCache.d.ts +2 -2
- package/lib/hooks/useCache.js +178 -183
- package/lib/hooks/useCellOutputshot.js +0 -5
- package/lib/hooks/useContainsFocus.js +0 -5
- package/lib/hooks/useDatalayer.d.ts +21 -0
- package/lib/hooks/{useRun.js → useDatalayer.js} +12 -16
- package/lib/hooks/useError.js +0 -5
- package/lib/hooks/useExternalScript.js +0 -5
- package/lib/hooks/useFocusTrap.d.ts +1 -1
- package/lib/hooks/useFocusTrap.js +1 -6
- package/lib/hooks/useIAM.js +2 -7
- package/lib/hooks/useId.js +3 -8
- package/lib/hooks/useIsomorphicLayoutEffect.js +0 -5
- package/lib/hooks/useJupyterLabTheme.js +0 -5
- package/lib/hooks/useKeyboardEscape.js +0 -5
- package/lib/hooks/useLocationHandles.js +0 -5
- package/lib/hooks/useNavigate.js +0 -5
- package/lib/hooks/useNotebookAIAgent.js +0 -5
- package/lib/hooks/useOnClickOutside.js +0 -5
- package/lib/hooks/useRef.js +0 -5
- package/lib/hooks/useRuntimes.js +0 -5
- package/lib/hooks/useScreenshot.js +0 -5
- package/lib/hooks/useToast.js +6 -8
- package/lib/hooks/useUpload.js +0 -5
- 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/main.js +1 -2
- package/lib/mocks/components/FlashMock.js +0 -5
- 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 +0 -5
- package/lib/mocks/hooks/useDatalayerMock.d.ts +6 -0
- package/lib/mocks/hooks/{useRunMock.js → useDatalayerMock.js} +2 -7
- package/lib/mocks/index.js +0 -5
- package/lib/mocks/jupyter/index.js +1 -6
- package/lib/mocks/models/CodeBlockMock.js +0 -5
- package/lib/mocks/models/CodelineMock.js +0 -5
- package/lib/mocks/models/CourseMock.js +0 -5
- package/lib/mocks/models/InviteMock.js +0 -5
- package/lib/mocks/models/SpaceMock.js +0 -5
- package/lib/mocks/models/UserMock.js +0 -5
- package/lib/mocks/models/index.js +0 -5
- package/lib/mocks/views/ActionMenuMock.js +0 -5
- package/lib/mocks/views/ChartMock.js +0 -5
- package/lib/mocks/views/ChartMockOptions.js +0 -5
- package/lib/mocks/views/DashboardMock.js +0 -5
- package/lib/mocks/views/FormMock.js +0 -5
- package/lib/mocks/views/TableMock.js +0 -5
- package/lib/mocks/views/WipMock.js +0 -5
- package/lib/mocks/views/index.js +0 -5
- package/lib/models/Contact.js +0 -5
- package/lib/models/ContactEvent.js +0 -5
- package/lib/models/Credits.js +0 -5
- package/lib/models/Dataset.d.ts +1 -1
- package/lib/models/Datasource.js +0 -5
- package/lib/models/Errors.js +0 -5
- package/lib/models/GrowthKPI.js +0 -5
- package/lib/models/IAMProviderUsers.js +0 -5
- package/lib/models/IAMToken.js +0 -5
- package/lib/models/Inbound.js +0 -5
- package/lib/models/LandingRoles.js +0 -5
- package/lib/models/Organization.js +0 -5
- package/lib/models/Outbound.js +7 -12
- package/lib/models/PageTag.d.ts +1 -1
- package/lib/models/RolesOrganization.js +0 -5
- package/lib/models/RolesPlatform.js +0 -5
- package/lib/models/RolesTeam.js +0 -5
- package/lib/models/Runtime.d.ts +59 -1
- package/lib/models/Runtime.js +7 -5
- package/lib/models/Secret.js +0 -5
- package/lib/models/Survey.js +0 -5
- package/lib/models/Team.js +0 -5
- package/lib/models/URN.js +0 -5
- package/lib/models/User.js +2 -7
- package/lib/models/UserEvent.js +0 -5
- package/lib/models/UserOnboarding.js +0 -5
- package/lib/models/UserSettings.js +0 -5
- package/lib/models/index.js +0 -5
- package/lib/routes/Routes.js +0 -5
- package/lib/routes/index.js +0 -5
- package/lib/state/State.js +0 -5
- package/lib/state/index.js +0 -5
- package/lib/state/storage/IAMStorage.js +0 -5
- package/lib/state/storage/index.js +0 -5
- package/lib/state/substates/AIAgentState.js +0 -5
- package/lib/state/substates/CellState.js +0 -5
- package/lib/state/substates/CoreState.js +0 -5
- package/lib/state/substates/DatasourceState.js +0 -5
- package/lib/state/substates/DocumentState.js +0 -5
- package/lib/state/substates/GradeState.js +0 -5
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/IAMState.js +15 -18
- package/lib/state/substates/JupyterLabState.js +0 -5
- package/lib/state/substates/NbformatState.js +0 -5
- package/lib/state/substates/OrganizationState.js +0 -5
- package/lib/state/substates/RuntimesState.d.ts +2 -2
- package/lib/state/substates/RuntimesState.js +0 -5
- package/lib/state/substates/SpaceState.js +0 -5
- package/lib/state/substates/SurveysState.js +3 -8
- package/lib/state/substates/TeamState.js +0 -5
- 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 +51 -1
- package/lib/theme/DatalayerTheme.js +0 -5
- package/lib/theme/DatalayerThemeProvider.js +0 -5
- package/lib/theme/Palette.js +0 -5
- package/lib/theme/index.js +0 -5
- package/lib/utils/Array.js +0 -5
- package/lib/utils/Avatar.js +0 -5
- package/lib/utils/Browser.js +0 -5
- package/lib/utils/Cookie.js +0 -5
- package/lib/utils/Date.js +3 -8
- package/lib/utils/Download.js +0 -5
- package/lib/utils/DownloadFile.js +0 -5
- package/lib/utils/Env.js +0 -5
- 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.js +0 -6
- package/lib/utils/Name.js +0 -5
- package/lib/utils/Number.js +1 -6
- package/lib/utils/Plots.d.ts +1 -1
- package/lib/utils/Plots.js +1 -1
- package/lib/utils/Random.js +0 -5
- package/lib/utils/Screenshot.js +0 -5
- package/lib/utils/Scroll.js +3 -7
- package/lib/utils/Sleep.js +0 -5
- package/lib/utils/Snapshot.js +0 -5
- package/lib/utils/String.js +0 -5
- package/lib/utils/Uri.js +1 -6
- package/lib/utils/Validator.js +0 -5
- package/lib/utils/WithSuspense.js +0 -5
- package/lib/utils/index.js +0 -5
- package/package.json +58 -28
- package/style/animation/Animation.module.css +174 -0
- package/style/base.css +64 -0
- package/style/index.css +6 -0
- 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/theme/index.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export * from './DatalayerTheme';
|
|
11
6
|
export * from './DatalayerThemeProvider';
|
|
12
7
|
export * from './Palette';
|
package/lib/utils/Array.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export const asArray = (obj) => {
|
|
11
6
|
if (Array.isArray(obj)) {
|
|
12
7
|
return obj;
|
package/lib/utils/Avatar.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export const DEFAULT_AVATAR_URL = 'https://avatars.githubusercontent.com/u/70511875?s=200&v=4';
|
|
11
6
|
export const DEFAULT_AVATAR_URL_ENCODED = encodeURIComponent(DEFAULT_AVATAR_URL);
|
|
12
7
|
function stringToColor(string) {
|
package/lib/utils/Browser.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
// https://stackoverflow.com/questions/49328382/browser-detection-in-reactjs
|
|
11
6
|
// https://codepedia.info/detect-browser-in-javascript
|
|
12
7
|
export const detectBrowser = () => {
|
package/lib/utils/Cookie.js
CHANGED
package/lib/utils/Date.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
//- Taken from https://stackoverflow.com/questions/6108819/javascript-timestamp-to-relative-time
|
|
11
6
|
// in miliseconds
|
|
12
7
|
const units = {
|
|
@@ -22,7 +17,7 @@ const rtf = new Intl.RelativeTimeFormat(undefined, {
|
|
|
22
17
|
style: 'short'
|
|
23
18
|
});
|
|
24
19
|
export const getRelativeTime = (d1, d2 = new Date()) => {
|
|
25
|
-
|
|
20
|
+
const elapsed = d1.getTime() - d2.getTime();
|
|
26
21
|
// "Math.abs" accounts for both "past" & "future" scenarios
|
|
27
22
|
for (const u in units)
|
|
28
23
|
if (Math.abs(elapsed) > units[u] || u === 'second')
|
|
@@ -34,8 +29,8 @@ const p = (i) => {
|
|
|
34
29
|
return i > 1 ? 's' : '';
|
|
35
30
|
};
|
|
36
31
|
export const timeSince = (date) => {
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
const seconds = Math.floor((new Date().getTime() - date.getTime()) / 1000);
|
|
33
|
+
let interval = seconds / 31536000;
|
|
39
34
|
if (interval > 1) {
|
|
40
35
|
const i = Math.floor(interval);
|
|
41
36
|
return i + ` year${p(i)}`;
|
package/lib/utils/Download.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export function jsonToCSVString(json) {
|
|
11
6
|
const headers = Object.keys(json[0]);
|
|
12
7
|
let csvString = '';
|
package/lib/utils/Env.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export const isDevDeployment = () => {
|
|
11
6
|
return location.hostname.startsWith('dev') || location.hostname.startsWith('localhost');
|
|
12
7
|
};
|
package/lib/utils/File.js
CHANGED
package/lib/utils/Ids.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
import { v4 as uuid_v4 } from 'uuid';
|
|
11
6
|
import { ulid } from 'ulid';
|
|
12
7
|
export const newUuid = () => {
|
package/lib/utils/Jupyter.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
import { PageConfig } from '@jupyterlab/coreutils';
|
|
11
6
|
let _insideJupyterLab = null;
|
|
12
7
|
export function isInsideJupyterLab() {
|
package/lib/utils/Lazy.js
CHANGED
|
@@ -2,12 +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
|
-
// Taken from https://github.com/ianschmitz/react-lazy-with-preload with Datalayer License.
|
|
11
5
|
import { createElement, forwardRef, lazy as reactLazy } from "react";
|
|
12
6
|
export function lazyWithPreload(factory) {
|
|
13
7
|
const LazyComponent = reactLazy(factory);
|
package/lib/utils/Name.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export const asDisplayName = (givenName, familyName) => {
|
|
11
6
|
return givenName ?
|
|
12
7
|
familyName ?
|
package/lib/utils/Number.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
const LOOKUP_VALUE_SYMBOL = [
|
|
11
6
|
{ value: 1, symbol: "" },
|
|
12
7
|
{ value: 1e3, symbol: "K" },
|
|
@@ -19,7 +14,7 @@ const LOOKUP_VALUE_SYMBOL = [
|
|
|
19
14
|
// https://stackoverflow.com/questions/9461621/format-a-number-as-2-5k-if-a-thousand-or-more-otherwise-900
|
|
20
15
|
export function numberFormatter(num, digits = 1) {
|
|
21
16
|
const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
|
22
|
-
|
|
17
|
+
const item = LOOKUP_VALUE_SYMBOL.slice().reverse().find(function (item) {
|
|
23
18
|
return num >= item.value;
|
|
24
19
|
});
|
|
25
20
|
return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0";
|
package/lib/utils/Plots.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { IUsage } from '../models';
|
|
|
5
5
|
* @param usages Usages
|
|
6
6
|
* @param interval Histogram interval
|
|
7
7
|
* @param range Range with month in 1-based scale
|
|
8
|
-
* @returns Histogram data
|
|
8
|
+
* @returns Histogram data {x: [], y: []}
|
|
9
9
|
*/
|
|
10
10
|
export declare function createHistogram(usages: IUsage[], interval: number, range: {
|
|
11
11
|
month: number;
|
package/lib/utils/Plots.js
CHANGED
|
@@ -9,7 +9,7 @@ import { getDate, getDaysInMonth, getMonth, isSameMonth, isSameYear } from 'date
|
|
|
9
9
|
* @param usages Usages
|
|
10
10
|
* @param interval Histogram interval
|
|
11
11
|
* @param range Range with month in 1-based scale
|
|
12
|
-
* @returns Histogram data
|
|
12
|
+
* @returns Histogram data {x: [], y: []}
|
|
13
13
|
*/
|
|
14
14
|
export function createHistogram(usages, interval, range) {
|
|
15
15
|
const referenceDate = new Date(range.year, range.month - 1);
|
package/lib/utils/Random.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export function getRandomInt(max) {
|
|
11
6
|
return Math.floor(Math.random() * max);
|
|
12
7
|
}
|
package/lib/utils/Screenshot.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
import html2canvas from 'html2canvas';
|
|
11
6
|
export const takeHTMLNodeScreenshot = async (node) => {
|
|
12
7
|
const sc = html2canvas(node, {
|
package/lib/utils/Scroll.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
const easeInOutQuad = (t, b, c, d) => {
|
|
11
6
|
t /= d / 2;
|
|
12
7
|
if (t < 1)
|
|
@@ -15,7 +10,8 @@ const easeInOutQuad = (t, b, c, d) => {
|
|
|
15
10
|
return (-c / 2) * (t * (t - 2) - 1) + b;
|
|
16
11
|
};
|
|
17
12
|
const scrollGo = (element, target, to, duration) => {
|
|
18
|
-
|
|
13
|
+
const start = element.scrollTop, change = to - start, increment = 20;
|
|
14
|
+
let currentTime = 0;
|
|
19
15
|
const animateScroll = () => {
|
|
20
16
|
currentTime += increment;
|
|
21
17
|
const scrollTop = easeInOutQuad(currentTime, start, change, duration);
|
|
@@ -30,7 +26,7 @@ const scrollGo = (element, target, to, duration) => {
|
|
|
30
26
|
animateScroll();
|
|
31
27
|
};
|
|
32
28
|
const smoothScroll = (target) => {
|
|
33
|
-
|
|
29
|
+
const targetScroll = document.getElementById(target);
|
|
34
30
|
scrollGo(document.body, target, targetScroll?.offsetTop, 1250);
|
|
35
31
|
};
|
|
36
32
|
export default smoothScroll;
|
package/lib/utils/Sleep.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export const sleep = async (ms) => {
|
|
11
6
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12
7
|
};
|
package/lib/utils/Snapshot.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
import { adjectives, animals, uniqueNamesGenerator } from 'unique-names-generator';
|
|
11
6
|
/**
|
|
12
7
|
* Kernel snapshot description configuration.
|
package/lib/utils/String.js
CHANGED
package/lib/utils/Uri.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export const currentUri = () => {
|
|
11
6
|
return window.location.protocol + "//" + window.location.host;
|
|
12
7
|
};
|
|
@@ -22,7 +17,7 @@ export const dataURItoBlob = (dataURI) => {
|
|
|
22
17
|
// Create a view into the buffer.
|
|
23
18
|
const ia = new Uint8Array(ab);
|
|
24
19
|
// Set the bytes of the buffer to the correct values.
|
|
25
|
-
for (
|
|
20
|
+
for (let i = 0; i < byteString.length; i++) {
|
|
26
21
|
ia[i] = byteString.charCodeAt(i);
|
|
27
22
|
}
|
|
28
23
|
// Write the ArrayBuffer to a blob, and you're done.
|
package/lib/utils/Validator.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
11
6
|
export const isValidEmail = (value) => {
|
|
12
7
|
if (!value) {
|
|
@@ -3,11 +3,6 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import { Suspense } from "react";
|
|
12
7
|
import { SkeletonBox } from "@primer/react/experimental";
|
|
13
8
|
const Loading = (props) => {
|
package/lib/utils/index.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
export * from './Array';
|
|
11
6
|
export * from './Avatar';
|
|
12
7
|
export * from './Browser';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Datalayer",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "vite",
|
|
44
|
-
"build": "tsc -b && vite build",
|
|
45
|
-
"build:lib": "tsc -b",
|
|
44
|
+
"build": "gulp resources-to-lib && tsc -b && vite build",
|
|
45
|
+
"build:lib": "gulp resources-to-lib && tsc -b",
|
|
46
46
|
"lint": "eslint .",
|
|
47
47
|
"preview": "vite preview",
|
|
48
48
|
"start": "vite",
|
|
@@ -55,36 +55,60 @@
|
|
|
55
55
|
"storybook": "storybook dev -p 6006",
|
|
56
56
|
"build-storybook": "storybook build",
|
|
57
57
|
"typedoc": "typedoc --options typedoc.json --out docs/docs/typescript_api",
|
|
58
|
-
"watch:lib": "
|
|
58
|
+
"watch:lib": "run-p 'watch:lib:*'",
|
|
59
|
+
"watch:lib:res": "gulp resources-to-lib-watch",
|
|
60
|
+
"watch:lib:src": "tsc -b -w"
|
|
59
61
|
},
|
|
60
62
|
"dependencies": {
|
|
61
|
-
"@jupyterlab/services": "^7.0.0",
|
|
62
|
-
"@jupyterlab/coreutils": "^6.0.0",
|
|
63
|
-
"react": "^19.1.0",
|
|
64
|
-
"react-dom": "^19.1.0",
|
|
65
|
-
"zustand": "^4.4.1"
|
|
66
|
-
},
|
|
67
|
-
"peerDependencies": {
|
|
68
63
|
"@datalayer/icons-react": "^1.0.6",
|
|
69
64
|
"@datalayer/jupyter-react": "^1.0.5",
|
|
65
|
+
"@datalayer/primer-addons": "^1.0.3",
|
|
66
|
+
"@datalayer/primer-rjsf": "^1.0.1",
|
|
67
|
+
"@jupyterlab/coreutils": "^6.0.0",
|
|
68
|
+
"@jupyterlab/services": "^7.0.0",
|
|
69
|
+
"@jupyterlite/javascript-kernel-extension": "^0.3.0",
|
|
70
|
+
"@primer/brand-primitives": "^0.51.0",
|
|
71
|
+
"@primer/css": "^21.5.1",
|
|
70
72
|
"@primer/octicons-react": "^19.15.1",
|
|
71
73
|
"@primer/primitives": "^10.5.0",
|
|
72
74
|
"@primer/react": "^37.19.0",
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
+
"@primer/react-brand": "^0.51.0",
|
|
76
|
+
"@stripe/react-stripe-js": "^2.7.1",
|
|
77
|
+
"axios": "^1.7.7",
|
|
78
|
+
"boring-avatars": "^2.0.1",
|
|
79
|
+
"buffer": "^6.0.3",
|
|
80
|
+
"date-fns": "^2.29.3",
|
|
81
|
+
"echarts": "^5.5.0",
|
|
82
|
+
"echarts-for-react": "^3.0.2",
|
|
83
|
+
"fuse.js": "^7.0.0",
|
|
84
|
+
"html2canvas": "^1.4.1",
|
|
85
|
+
"jwt-decode": "^2.2.0",
|
|
86
|
+
"localforage": "^1.10.0",
|
|
87
|
+
"marked": "^4.0.10",
|
|
88
|
+
"mock-socket": "^9.3.1",
|
|
89
|
+
"react": "18.3.1",
|
|
90
|
+
"react-confetti": "^6.4.0",
|
|
91
|
+
"react-dom": "18.3.1",
|
|
92
|
+
"react-router-dom": "^6.22.3",
|
|
93
|
+
"tus-js-client": "^4.2.3",
|
|
94
|
+
"ulid": "^2.3.0",
|
|
95
|
+
"unique-names-generator": "^4.7.1",
|
|
96
|
+
"usehooks-ts": "^2.9.1",
|
|
97
|
+
"validator": "^13.7.0",
|
|
98
|
+
"zustand": "^4.4.1"
|
|
75
99
|
},
|
|
76
100
|
"devDependencies": {
|
|
77
|
-
"@chromatic-com/storybook": "^4.0
|
|
101
|
+
"@chromatic-com/storybook": "^4.1.0",
|
|
78
102
|
"@eslint/js": "^9.29.0",
|
|
79
|
-
"@storybook/addon-a11y": "^9.
|
|
80
|
-
"@storybook/addon-docs": "^9.
|
|
81
|
-
"@storybook/addon-onboarding": "^9.
|
|
82
|
-
"@storybook/addon-vitest": "^9.
|
|
83
|
-
"@storybook/builder-vite": "^9.
|
|
84
|
-
"@storybook/react-vite": "^9.
|
|
103
|
+
"@storybook/addon-a11y": "^9.1.1",
|
|
104
|
+
"@storybook/addon-docs": "^9.1.1",
|
|
105
|
+
"@storybook/addon-onboarding": "^9.1.1",
|
|
106
|
+
"@storybook/addon-vitest": "^9.1.1",
|
|
107
|
+
"@storybook/builder-vite": "^9.1.1",
|
|
108
|
+
"@storybook/react-vite": "^9.1.1",
|
|
85
109
|
"@types/node": "^20.11.0",
|
|
86
|
-
"@types/react": "
|
|
87
|
-
"@types/react-dom": "
|
|
110
|
+
"@types/react": "18.3.20",
|
|
111
|
+
"@types/react-dom": "18.3.6",
|
|
88
112
|
"@vitejs/plugin-react": "^4.5.2",
|
|
89
113
|
"@vitest/browser": "^3.2.4",
|
|
90
114
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -92,16 +116,22 @@
|
|
|
92
116
|
"eslint": "^9.29.0",
|
|
93
117
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
94
118
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
95
|
-
"eslint-plugin-storybook": "^9.
|
|
119
|
+
"eslint-plugin-storybook": "^9.1.1",
|
|
96
120
|
"globals": "^16.2.0",
|
|
121
|
+
"gulp": "^4.0.2",
|
|
122
|
+
"gulp-append-prepend": "^1.0.8",
|
|
123
|
+
"gulp-filter": "^6.0.0",
|
|
124
|
+
"gulp-watch": "^5.0.1",
|
|
97
125
|
"jsdom": "^26.0.0",
|
|
126
|
+
"npm-run-all": "^4.1.5",
|
|
98
127
|
"playwright": "^1.53.2",
|
|
99
128
|
"rimraf": "^6.0.1",
|
|
100
|
-
"storybook": "^9.
|
|
129
|
+
"storybook": "^9.1.1",
|
|
101
130
|
"typedoc-plugin-markdown": "^4.0.0",
|
|
102
131
|
"typescript": "^5.8.3",
|
|
103
132
|
"typescript-eslint": "^8.34.1",
|
|
104
133
|
"vite": "^7.0.0",
|
|
134
|
+
"vite-plugin-treat-umd-as-commonjs": "^0.1.4",
|
|
105
135
|
"vitest": "^3.2.4"
|
|
106
136
|
},
|
|
107
137
|
"overrides": {
|
|
@@ -112,11 +142,11 @@
|
|
|
112
142
|
"@microsoft/fast-react-wrapper": "0.3.24",
|
|
113
143
|
"@microsoft/fast-web-utilities": "5.4.1",
|
|
114
144
|
"@microsoft/load-themed-styles": "1.10.295",
|
|
115
|
-
"@types/react": "
|
|
116
|
-
"@types/react-dom": "
|
|
145
|
+
"@types/react": "18.3.20",
|
|
146
|
+
"@types/react-dom": "18.3.6",
|
|
117
147
|
"pyodide": "0.28.0",
|
|
118
|
-
"react": "
|
|
119
|
-
"react-dom": "
|
|
148
|
+
"react": "18.3.1",
|
|
149
|
+
"react-dom": "18.3.1",
|
|
120
150
|
"typescript": "^5.8.3"
|
|
121
151
|
}
|
|
122
152
|
}
|