From b582faf9a46b5e1f20ad1645f83fb5ba09e0ec91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= <fcollonval@gmail.com>
Date: Sat, 17 Apr 2021 14:44:24 +0200
Subject: [PATCH] Use latest nbdime (#926)

---
 package.json      | 96 +++++++++++++++++++++++++----------------------
 setup.py          |  2 +-
 style/base.css    | 11 ------
 style/diff-nb.css | 82 ----------------------------------------
 style/index.css   | 10 +++++
 5 files changed, 62 insertions(+), 139 deletions(-)

diff --git a/package.json b/package.json
index 44969b75c..639d8d54e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@jupyterlab/git",
-  "version": "0.30.0-beta.3",
+  "version": "0.30.0",
   "description": "A JupyterLab extension for version control using git",
   "main": "lib/index.js",
   "types": "lib/index.d.ts",
@@ -45,48 +45,6 @@
     "style/index.js"
   ],
   "styleModule": "style/index.js",
-  "jupyterlab": {
-    "discovery": {
-      "server": {
-        "managers": [
-          "pip",
-          "conda"
-        ],
-        "base": {
-          "name": "jupyterlab-git"
-        }
-      }
-    },
-    "extension": true,
-    "schemaDir": "schema",
-    "sharedPackages": {
-      "@material-ui/core": {
-        "singleton": true
-      },
-      "@material-ui/icons": {
-        "singleton": true
-      },
-      "@material-ui/lab": {
-        "singleton": true
-      },
-      "codemirror": {
-        "bundled": false,
-        "singleton": true
-      },
-      "nbdime": {
-        "singleton": true
-      },
-      "react": {
-        "bundled": false,
-        "singleton": true
-      },
-      "react-dom": {
-        "bundled": false,
-        "singleton": true
-      }
-    },
-    "outputDir": "jupyterlab_git/labextension"
-  },
   "dependencies": {
     "@jupyterlab/application": "^3.0.0",
     "@jupyterlab/apputils": "^3.0.0",
@@ -114,7 +72,8 @@
     "@material-ui/icons": "^4.5.1",
     "@material-ui/lab": "^4.0.0-alpha.54",
     "diff-match-patch": "^1.0.4",
-    "nbdime": "^6.1.0-beta.1",
+    "nbdime": "^6.1.0",
+    "nbdime-jupyterlab": "^2.1.0",
     "react": "^17.0.1",
     "react-dom": "^17.0.1",
     "react-textarea-autosize": "^7.1.2",
@@ -125,7 +84,7 @@
   "devDependencies": {
     "@babel/core": "^7.5.0",
     "@babel/preset-env": "^7.5.0",
-    "@jupyterlab/builder": "^3.0.0-rc.13",
+    "@jupyterlab/builder": "^3.0.0",
     "@jupyterlab/testutils": "^3.0.0",
     "@types/codemirror": "^0.0.97",
     "@types/diff-match-patch": "^1.0.32",
@@ -186,5 +145,52 @@
   "homepage": "https://github.com/jupyterlab/jupyterlab-git",
   "resolutions": {
     "@types/react": "^17.0.0"
+  },
+  "jupyterlab": {
+    "discovery": {
+      "server": {
+        "managers": [
+          "pip",
+          "conda"
+        ],
+        "base": {
+          "name": "jupyterlab-git"
+        }
+      }
+    },
+    "extension": true,
+    "schemaDir": "schema",
+    "sharedPackages": {
+      "@material-ui/core": {
+        "singleton": true
+      },
+      "@material-ui/icons": {
+        "singleton": true
+      },
+      "@material-ui/lab": {
+        "singleton": true
+      },
+      "codemirror": {
+        "bundled": false,
+        "singleton": true
+      },
+      "nbdime": {
+        "bundled": false,
+        "singleton": true
+      },
+      "nbdime-jupyterlab": {
+        "bundled": false,
+        "singleton": true
+      },
+      "react": {
+        "bundled": false,
+        "singleton": true
+      },
+      "react-dom": {
+        "bundled": false,
+        "singleton": true
+      }
+    },
+    "outputDir": "jupyterlab_git/labextension"
   }
 }
diff --git a/setup.py b/setup.py
index f22ec8053..91d5ef5fb 100644
--- a/setup.py
+++ b/setup.py
@@ -78,7 +78,7 @@
     packages=setuptools.find_packages(),
     install_requires=[
         "jupyter_server",
-        "nbdime~=3.0.0b1",
+        "nbdime~=3.0",
         "nbformat",
         "packaging",
         "pexpect",
diff --git a/style/base.css b/style/base.css
index 6fa46d569..af3ce1e8c 100644
--- a/style/base.css
+++ b/style/base.css
@@ -3,17 +3,6 @@
 | Distributed under the terms of the Modified BSD License.
 |----------------------------------------------------------------------------*/
 
-/* Import same style from nbdime than nbdime-jupyterlab
- * see index.ts
- */
-@import url('~nbdime/lib/common/collapsible.css');
-@import url('~nbdime/lib/upstreaming/flexpanel.css');
-@import url('~nbdime/lib/common/dragpanel.css');
-@import url('~nbdime/lib/styles/variables.css');
-@import url('~nbdime/lib/styles/common.css');
-@import url('~nbdime/lib/styles/diff.css');
-@import url('~nbdime/lib/styles/merge.css');
-
 @import url('diff-common.css');
 @import url('diff-nb.css');
 @import url('diff-text.css');
diff --git a/style/diff-nb.css b/style/diff-nb.css
index ab4faf880..4f14fd54a 100644
--- a/style/diff-nb.css
+++ b/style/diff-nb.css
@@ -60,85 +60,3 @@
   background-color: var(--jp-git-diff-deleted-color);
   border: none;
 }
-
-/* Imported from nbdime-jupyterlab */
-.jp-git-diff-root .nbdime-Widget {
-  display: flex;
-  flex-direction: column;
-}
-
-.jp-git-diff-root .nbdime-root {
-  padding: var(--jp-notebook-padding);
-  min-width: 50px;
-  min-height: 50px;
-  outline: none;
-  overflow: auto;
-  background: var(--jp-layout-color0);
-  color: var(--jp-ui-font-color0);
-  flex: 1 1 auto;
-}
-
-
-/* Header syling */
-
-.jp-git-diff-root .nbdime-Diff {
-  border-bottom: var(--jp-border-width) solid var(--jp-toolbar-border-color);
-  box-shadow: var(--jp-toolbar-box-shadow);
-  background: var(--jp-toolbar-background);
-  color: var(--jp-ui-font-color1);
-  flex: 0 0 auto;
-  padding: 2px;
-  z-index: 1;
-}
-
-/* Hiding unchanged cells if told to */
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Cell-diff.jp-Diff-unchanged {
-  display: none;
-}
-
-/* Show a marker with the number of cells hidden before */
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Cell-diff[data-nbdime-NCellsHiddenBefore]::before,
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Diff-addremchunk[data-nbdime-NCellsHiddenBefore]::before {
-  content: attr(data-nbdime-NCellsHiddenBefore) " unchanged cell(s) hidden";
-  position: absolute;
-  width: 100%;
-  top: 0;
-  background-color: var(--jp-layout-color2);
-  border-top: solid var(--jp-layout-color3) 1px;
-  border-bottom: solid var(--jp-layout-color3) 1px;
-  text-align: center;
-}
-
-/* Show a marker with the number of cells hidden after (for hidden cells at end) */
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Cell-diff[data-nbdime-NCellsHiddenAfter]::after,
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Diff-addremchunk[data-nbdime-NCellsHiddenAfter]::after {
-  content: attr(data-nbdime-NCellsHiddenAfter) " unchanged cell(s) hidden";
-  position: absolute;
-  width: 100%;
-  bottom: 0;
-  background-color: var(--jp-layout-color2);
-  border-top: solid var(--jp-layout-color3) 1px;
-  border-bottom: solid var(--jp-layout-color3) 1px;
-  text-align: center;
-}
-
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Cell-diff[data-nbdime-NCellsHiddenBefore],
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Diff-addremchunk[data-nbdime-NCellsHiddenBefore] {
-  padding-top: 40px;
-}
-
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Cell-diff[data-nbdime-NCellsHiddenAfter],
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Diff-addremchunk[data-nbdime-NCellsHiddenAfter] {
-  padding-bottom: 40px;
-}
-
-/* Marker for when all cells are unchanged and hidden */
-.jp-git-diff-root .nbdime-root.jp-mod-hideUnchanged .jp-Notebook-diff[data-nbdime-AllCellsHidden]::after {
-  content: "No changes, " attr(data-nbdime-AllCellsHidden) " unchanged cell(s) hidden";
-  display: block;
-  width: 100%;
-  background-color: var(--jp-layout-color2);
-  border-top: solid var(--jp-layout-color3) 1px;
-  border-bottom: solid var(--jp-layout-color3) 1px;
-  text-align: center;
-}
diff --git a/style/index.css b/style/index.css
index 8a7ea29e6..2cf33e4f6 100644
--- a/style/index.css
+++ b/style/index.css
@@ -1 +1,11 @@
+/* Import same style from nbdime and nbdime-jupyterlab (see index.ts) */
+@import url('~nbdime/lib/common/collapsible.css');
+@import url('~nbdime/lib/upstreaming/flexpanel.css');
+@import url('~nbdime/lib/common/dragpanel.css');
+@import url('~nbdime/lib/styles/variables.css');
+@import url('~nbdime/lib/styles/common.css');
+@import url('~nbdime/lib/styles/diff.css');
+@import url('~nbdime/lib/styles/merge.css');
+@import url('~nbdime-jupyterlab/style/index.css');
+
 @import url('base.css');