Browse Source

wip theme switching

Steven Silvester 7 năm trước cách đây
mục cha
commit
25632234ea

+ 1 - 1
jupyterlab/package.json

@@ -47,7 +47,6 @@
     "@jupyterlab/terminal-extension": "^0.9.0",
     "@jupyterlab/theme-dark-extension": "^0.9.0",
     "@jupyterlab/theme-light-extension": "^0.9.0",
-    "@jupyterlab/theming": "^0.9.0",
     "@jupyterlab/tooltip": "^0.9.0",
     "@jupyterlab/tooltip-extension": "^0.9.0",
     "@jupyterlab/vega2-extension": "^0.9.0",
@@ -95,6 +94,7 @@
       "@jupyterlab/shortcuts-extension": "",
       "@jupyterlab/tabmanager-extension": "",
       "@jupyterlab/terminal-extension": "",
+      "@jupyterlab/theme-dark-extension": "lib/index.js",
       "@jupyterlab/theme-light-extension": "lib/index.js",
       "@jupyterlab/tooltip-extension": ""
     },

+ 3 - 2
packages/theme-dark-extension/package.json

@@ -3,14 +3,15 @@
   "version": "0.9.0",
   "description": "JupyterLab - Default Dark Theme",
   "dependencies": {
-    "@jupyterlab/theming": "^0.9.0"
+    "@jupyterlab/application": "0.9.0",
+    "@jupyterlab/apputils": "0.9.0"
   },
   "repository": {
     "type": "git",
     "url": "https://github.com/jupyterlab/jupyterlab.git"
   },
   "jupyterlab": {
-    "themeCSS": "style/index.css"
+    "extension": "lib/index.js"
   },
   "files": ["style/*.css"],
   "author": "Project Jupyter",

+ 31 - 0
packages/theme-dark-extension/src/index.ts

@@ -0,0 +1,31 @@
+
+
+import {
+  JupyterLab, JupyterLabPlugin
+} from '@jupyterlab/application';
+
+import {
+  IThemeManager
+} from '@jupyterlab/apputils';
+
+
+
+const plugin: JupyterLabPlugin<void> = {
+  id: 'theme-dark-extension',
+  requires: [IThemeManager],
+  activate: function(app: JupyterLab, manager: IThemeManager) {
+    manager.register({
+      name: 'JupyterLab Dark',
+      load: function() {
+        return manager.loadCSS('./lab/api/themes/jupyterlab-theme-dark-extension/style/index.css');
+      },
+      unload: function() {
+        return Promise.resolve(void 0);
+      }
+    });
+  },
+  autoStart: true
+};
+
+
+export default plugin;

+ 14 - 14
packages/theme-light-extension/src/index.ts

@@ -11,20 +11,20 @@ import {
 
 
 const plugin: JupyterLabPlugin<void> = {
-    id: 'theme-light-extension',
-    requires: [IThemeManager],
-    activate: function(app: JupyterLab, manager: IThemeManager) {
-        manager.register({
-            name: 'JupyterLab Light',
-            load: function() {
-                return Promise.resolve(['./lab/api/themes/jupyterlab-theme-light-extension/style/index.css']);
-            },
-            unload: function() {
-                return Promise.resolve(void 0);
-            }
-        });
-    },
-    autoStart: true
+  id: 'theme-light-extension',
+  requires: [IThemeManager],
+  activate: function(app: JupyterLab, manager: IThemeManager) {
+    manager.register({
+      name: 'JupyterLab Light',
+      load: function() {
+        return manager.loadCSS('./lab/api/themes/jupyterlab-theme-light-extension/style/index.css');
+      },
+      unload: function() {
+        return Promise.resolve(void 0);
+      }
+    });
+  },
+  autoStart: true
 };