From 550b3ad187356d4480454a306d14c655e1d480a0 Mon Sep 17 00:00:00 2001 From: Eric Charles Date: Tue, 8 Oct 2024 10:18:03 +0200 Subject: [PATCH] Mutations Example (#318) * chore: mutatoins * chore: notebook mutations * chore: mutations * chore: mutations * example: mutating notebook * chore: datalayer kernel provider * Automatic application of license header * chore: credits config --------- Co-authored-by: github-actions[bot] --- docs/docusaurus.config.js | 325 +++++++++--------- docs/package.json | 19 +- docs/src/components/HomepageFeatures.js | 2 +- packages/react/public/index-local.html | 6 +- packages/react/public/index.html | 7 +- packages/react/src/components/index.ts | 1 + .../react/src/components/lumino/Lumino.tsx | 2 +- .../src/components/notebook/Notebook.tsx | 154 +++++---- .../components/notebook/NotebookAdapter.ts | 128 ++++--- .../src/components/notebook/NotebookState.ts | 15 +- .../notebook/cell/sidebar/CellSidebar.tsx | 12 +- .../src/components/utils/SpinnerCentered.tsx | 31 ++ packages/react/src/components/utils/index.ts | 7 + packages/react/src/examples/NotebookLite.tsx | 11 +- .../src/examples/NotebookLiteContext.tsx | 35 ++ .../react/src/examples/NotebookMutations.tsx | 165 ++++++--- packages/react/src/index.ts | 1 + packages/react/src/jupyter/JupyterConfig.ts | 60 ++-- .../react/src/jupyter/JupyterDefaults.tsx | 5 + packages/react/src/jupyter/kernel/Kernel.ts | 54 +-- .../jupyter/services/ServiceManagerLess.ts | 134 +++----- .../jupyter/services/ServiceManagerLite.ts | 18 +- packages/react/src/providers/index.ts | 7 + .../src/providers/kernels/DatalayerKernels.ts | 87 +++++ packages/react/src/providers/kernels/index.ts | 7 + packages/react/src/state/IDatalayerConfig.ts | 28 ++ .../react/src/state/IJupyterReactConfig.ts | 12 - packages/react/src/state/JupyterReactState.ts | 84 ++--- packages/react/src/state/index.ts | 2 +- packages/react/webpack.config.js | 5 +- 30 files changed, 860 insertions(+), 564 deletions(-) create mode 100644 packages/react/src/components/utils/SpinnerCentered.tsx create mode 100644 packages/react/src/components/utils/index.ts create mode 100644 packages/react/src/examples/NotebookLiteContext.tsx create mode 100755 packages/react/src/providers/index.ts create mode 100755 packages/react/src/providers/kernels/DatalayerKernels.ts create mode 100755 packages/react/src/providers/kernels/index.ts create mode 100644 packages/react/src/state/IDatalayerConfig.ts delete mode 100644 packages/react/src/state/IJupyterReactConfig.ts diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index bacfa910..3a0e57f8 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -20,7 +20,8 @@ module.exports = { projectName: 'Jupyter UI', plugins: [ '@datalayer/jupyter-docusaurus-plugin', - '@docusaurus/theme-live-codeblock' + '@docusaurus/theme-live-codeblock', + 'docusaurus-lunr-search', ], /* 'docusaurus-plugin-typedoc', @@ -29,163 +30,173 @@ module.exports = { tsconfig: '../tsconfig.json', }, */ - themeConfig: { - colorMode: { - defaultMode: 'light', - disableSwitch: true, - }, - liveCodeBlock: { - playgroundPosition: 'bottom', - }, - navbar: { - title: 'Jupyter UI', - logo: { - alt: 'Datalayer Logo', - src: 'img/datalayer/logo.svg', + themes: [ + '@docusaurus/theme-mermaid', + ], + themeConfig: { + colorMode: { + defaultMode: 'light', + disableSwitch: true, + }, + prism: { + additionalLanguages: ['bash'], + }, + liveCodeBlock: { + playgroundPosition: 'bottom', + }, + navbar: { + title: 'Jupyter UI', + logo: { + alt: 'Datalayer Logo', + src: 'img/datalayer/logo.svg', + }, + items: [ + { + type: 'doc', + docId: 'about/index', + position: 'left', + label: 'About', + }, + { + type: 'doc', + docId: '/category/develop', + position: 'left', + label: 'Develop', + }, + { + type: 'doc', + docId: '/category/components', + position: 'left', + label: 'Components', + }, + { + type: 'doc', + docId: '/category/state', + position: 'left', + label: 'State', + }, + { + type: 'doc', + docId: '/category/deployments', + position: 'left', + label: 'Deployments', + }, + { + type: 'doc', + docId: '/category/examples', + position: 'left', + label: 'Examples', + }, + { + type: 'doc', + docId: '/category/integrations', + position: 'left', + label: 'Integrations', + }, + { + type: 'doc', + docId: '/category/themes', + position: 'left', + label: 'Themes', + }, + { + type: 'doc', + docId: '/category/demos', + position: 'left', + label: 'Demos', + }, + { + type: 'doc', + docId: 'resources/index', + position: 'left', + label: 'Resources', + }, + { + type: 'doc', + docId: 'support/index', + position: 'left', + label: 'Support', + }, + { + type: 'doc', + docId: 'license/index', + position: 'left', + label: 'License', + }, + { + href: 'https://www.linkedin.com/company/datalayer', + position: 'right', + className: 'header-linkedin-link', + 'aria-label': 'Linkedin', + }, + { + href: 'https://x.com/DatalayerIO', + position: 'right', + className: 'header-x-link', + 'aria-label': 'X', + }, + { + href: 'https://github.com/datalayer/jupyter-ui', + position: 'right', + className: 'header-github-link', + 'aria-label': 'GitHub repository', + }, + { + href: 'https://datalayer.tech', + position: 'right', + className: 'header-datalayer-io-link', + 'aria-label': 'Datalayer Tech', + }, + ], + }, + footer: { + style: 'dark', + links: [ + { + title: 'Community', + items: [ + { + label: 'GitHub', + href: 'https://github.com/datalayer', + }, + { + label: 'X', + href: 'https://x.com/datalayerio', + }, + { + label: 'Linkedin', + href: 'https://www.linkedin.com/company/datalayer', + }, + ], + }, + { + title: 'More', + items: [ + { + label: 'Datalayer', + href: 'https://datalayer.io', + }, + { + label: 'Datalayer Docs', + href: 'https://docs.datalayer.io', + }, + { + label: 'Datalayer Tech', + href: 'https://datalayer.tech', + }, + { + label: 'Datalayer Guide', + href: 'https://datalayer.guide', + }, + { + label: 'Datalayer Blog', + href: 'https://datalayer.blog', + }, + ], + } + ], + copyright: `Copyright © ${new Date().getFullYear()} Datalayer, Inc.`, }, - items: [ - { - type: 'doc', - docId: 'about/index', - position: 'left', - label: 'About', - }, - { - type: 'doc', - docId: '/category/develop', - position: 'left', - label: 'Develop', - }, - { - type: 'doc', - docId: '/category/components', - position: 'left', - label: 'Components', - }, - { - type: 'doc', - docId: '/category/state', - position: 'left', - label: 'State', - }, - { - type: 'doc', - docId: '/category/deployments', - position: 'left', - label: 'Deployments', - }, - { - type: 'doc', - docId: '/category/examples', - position: 'left', - label: 'Examples', - }, - { - type: 'doc', - docId: '/category/integrations', - position: 'left', - label: 'Integrations', - }, - { - type: 'doc', - docId: '/category/themes', - position: 'left', - label: 'Themes', - }, - { - type: 'doc', - docId: '/category/demos', - position: 'left', - label: 'Demos', - }, - { - type: 'doc', - docId: 'resources/index', - position: 'left', - label: 'Resources', - }, - { - type: 'doc', - docId: 'support/index', - position: 'left', - label: 'Support', - }, - { - type: 'doc', - docId: 'license/index', - position: 'left', - label: 'License', - }, - { - href: 'https://www.linkedin.com/company/datalayer', - position: 'right', - className: 'header-linkedin-link', - 'aria-label': 'Linkedin', - }, - { - href: 'https://x.com/DatalayerIO', - position: 'right', - className: 'header-x-link', - 'aria-label': 'X', - }, - { - href: 'https://github.com/datalayer/jupyter-ui', - position: 'right', - className: 'header-github-link', - 'aria-label': 'GitHub repository', - }, - { - href: 'https://datalayer.tech', - position: 'right', - className: 'header-datalayer-io-link', - 'aria-label': 'Datalayer Tech', - }, - ], - }, - footer: { - style: 'dark', - links: [ - { - title: 'Community', - items: [ - { - label: 'GitHub', - href: 'https://github.com/datalayer', - }, - { - label: 'X', - href: 'https://x.com/datalayerio', - }, - { - label: 'Linkedin', - href: 'https://www.linkedin.com/company/datalayer', - }, - ], - }, - { - title: 'More', - items: [ - { - label: 'Datalayer', - href: 'https://datalayer.io', - }, - { - label: 'Datalayer Tech', - href: 'https://datalayer.tech', - }, - { - label: 'Datalayer Guide', - href: 'https://datalayer.guide', - }, - { - label: 'Datalayer Blog', - href: 'https://datalayer.blog', - }, - ], - } - ], - copyright: `Copyright © ${new Date().getFullYear()} Datalayer, Inc.`, - }, }, presets: [ [ diff --git a/docs/package.json b/docs/package.json index f1a89eca..490b50a1 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,7 +5,7 @@ "scripts": { "docusaurus": "docusaurus", "start": "docusaurus start", - "build": "docusaurus build", + "build": "cross-env USE_SIMPLE_CSS_MINIFIER=true docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", @@ -16,11 +16,14 @@ }, "dependencies": { "@datalayer/jupyter-docusaurus-plugin": "^0.1.1", - "@docusaurus/core": "2.4.0", - "@docusaurus/preset-classic": "2.4.0", - "@docusaurus/theme-live-codeblock": "2.4.0", - "@mdx-js/react": "^1.6.22", - "clsx": "^1.2.1", + "@docusaurus/core": "3.4.0", + "@docusaurus/preset-classic": "3.4.0", + "@docusaurus/theme-live-codeblock": "3.4.0", + "@docusaurus/theme-mermaid": "3.4.0", + "@mdx-js/react": "^3.0.1", + "@primer/react-brand": "0.37.0-rc.ab1bfc11", + "clsx": "^2.1.1", + "docusaurus-lunr-search": "3.5.0", "docusaurus-plugin-typedoc": "~0.17.5", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -29,7 +32,9 @@ "typedoc-plugin-markdown": "^3.13.5" }, "devDependencies": { - "@types/node": "^18.15.3", + "@docusaurus/module-type-aliases": "3.4.0", + "@tsconfig/docusaurus": "2.0.3", + "cross-env": "^7.0.3", "typescript": "~5.0.3" }, "browserslist": { diff --git a/docs/src/components/HomepageFeatures.js b/docs/src/components/HomepageFeatures.js index d612c090..bd98d536 100644 --- a/docs/src/components/HomepageFeatures.js +++ b/docs/src/components/HomepageFeatures.js @@ -14,7 +14,7 @@ const FeatureList = [ Svg: require('../../static/img/target.svg').default, description: ( <> - Jupyter UI lets you focus on your work, and we'll do the chores. Check the support options. + Jupyter UI lets you focus on your work, and we'll do the chores. Check the support options. ), }, diff --git a/packages/react/public/index-local.html b/packages/react/public/index-local.html index ecf913c7..a882b318 100755 --- a/packages/react/public/index-local.html +++ b/packages/react/public/index-local.html @@ -12,7 +12,11 @@