Sfoglia il codice sorgente

added the jupyter.lab.setting-icon field

telamonian 5 anni fa
parent
commit
6671fc81d3

+ 1 - 1
packages/codemirror-extension/schema/commands.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-TextEditorIcon",
+  "jupyter.lab.setting-icon": "ui-components:textEditor",
   "jupyter.lab.setting-icon-label": "CodeMirror",
   "title": "CodeMirror",
   "description": "Text editor settings for all CodeMirror editors.",

+ 1 - 1
packages/console-extension/schema/tracker.json

@@ -1,7 +1,7 @@
 {
   "title": "Code Console",
   "description": "Code Console settings.",
-  "jupyter.lab.setting-icon-class": "jp-ConsoleIcon",
+  "jupyter.lab.setting-icon": "ui-components:console",
   "jupyter.lab.setting-icon-label": "Code Console Settings",
   "jupyter.lab.shortcuts": [
     {

+ 1 - 1
packages/docmanager-extension/schema/plugin.json

@@ -1,7 +1,7 @@
 {
   "title": "Document Manager",
   "description": "Document Manager settings.",
-  "jupyter.lab.setting-icon-class": "jp-FileIcon",
+  "jupyter.lab.setting-icon": "ui-components:file",
   "jupyter.lab.setting-icon-label": "Document Manager",
   "jupyter.lab.transform": true,
   "jupyter.lab.shortcuts": [

+ 1 - 1
packages/extensionmanager-extension/schema/plugin.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-SettingsIcon",
+  "jupyter.lab.setting-icon": "ui-components:settings",
   "jupyter.lab.setting-icon-label": "Extension Manager",
   "title": "Extension Manager",
   "description": "Extension manager settings.",

+ 1 - 1
packages/filebrowser-extension/schema/browser.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-FolderIcon",
+  "jupyter.lab.setting-icon": "ui-components:folder",
   "jupyter.lab.setting-icon-label": "File Browser",
   "title": "File Browser",
   "description": "File Browser settings.",

+ 1 - 1
packages/fileeditor-extension/schema/plugin.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-TextEditorIcon",
+  "jupyter.lab.setting-icon": "ui-components:textEditor",
   "jupyter.lab.setting-icon-label": "Editor",
   "title": "Text Editor",
   "description": "Text editor settings.",

+ 1 - 1
packages/logconsole-extension/schema/plugin.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-ListIcon",
+  "jupyter.lab.setting-icon": "ui-components:list",
   "jupyter.lab.setting-icon-label": "Log Console",
   "title": "Log Console",
   "description": "Log Console settings.",

+ 1 - 1
packages/markdownviewer-extension/schema/plugin.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-MarkdownIcon",
+  "jupyter.lab.setting-icon": "ui-components:markdown",
   "jupyter.lab.setting-icon-label": "Markdown Viewer",
   "title": "Markdown Viewer",
   "description": "Markdown viewer settings.",

+ 1 - 1
packages/notebook-extension/schema/tracker.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-NotebookIcon",
+  "jupyter.lab.setting-icon": "ui-components:notebook",
   "jupyter.lab.setting-icon-label": "Notebook",
   "jupyter.lab.shortcuts": [
     {

+ 26 - 17
packages/settingeditor/src/pluginlist.tsx

@@ -189,6 +189,12 @@ export namespace PluginList {
  * A namespace for private module data.
  */
 namespace Private {
+  /**
+   * The JupyterLab plugin schema key for the setting editor
+   * icon class of a plugin.
+   */
+  const ICON_KEY = 'jupyter.lab.setting-icon';
+
   /**
    * The JupyterLab plugin schema key for the setting editor
    * icon class of a plugin.
@@ -259,26 +265,29 @@ namespace Private {
     const items = plugins.map(plugin => {
       const { id, schema, version } = plugin;
       const itemTitle = `${schema.description}\n${id}\n${version}`;
+      const icon = getHint(ICON_KEY, registry, plugin);
       const iconClass = getHint(ICON_CLASS_KEY, registry, plugin);
       const iconTitle = getHint(ICON_LABEL_KEY, registry, plugin);
 
-      return (
-        <li
-          className={id === selection ? 'jp-mod-selected' : ''}
-          data-id={id}
-          key={id}
-          title={itemTitle}
-        >
-          <LabIcon.UNSTABLE_getReact
-            name={iconClass}
-            fallback={settingsIcon}
-            title={iconTitle}
-            tag="span"
-            kind="settingsEditor"
-          />
-          <span>{schema.title || id}</span>
-        </li>
-      );
+      if (icon)
+        return (
+          <li
+            className={id === selection ? 'jp-mod-selected' : ''}
+            data-id={id}
+            key={id}
+            title={itemTitle}
+          >
+            <LabIcon.UNSTABLE_getReact
+              name={icon}
+              fallback={settingsIcon}
+              className={iconClass}
+              title={iconTitle}
+              tag="span"
+              kind="settingsEditor"
+            />
+            <span>{schema.title || id}</span>
+          </li>
+        );
     });
 
     ReactDOM.unmountComponentAtNode(node);

+ 5 - 1
packages/settingregistry/src/plugin-schema.json

@@ -7,9 +7,13 @@
   "additionalProperties": true,
   "properties": {
     "jupyter.lab.setting-deprecated": { "type": "boolean", "default": false },
+    "jupyter.lab.setting-icon": {
+      "type": "string",
+      "default": "ui-components:settings"
+    },
     "jupyter.lab.setting-icon-class": {
       "type": "string",
-      "default": "jp-SettingsIcon"
+      "default": ""
     },
     "jupyter.lab.setting-icon-label": { "type": "string", "default": "Plugin" },
     "jupyter.lab.shortcuts": {

+ 5 - 0
packages/settingregistry/src/tokens.ts

@@ -264,6 +264,11 @@ export namespace ISettingRegistry {
      */
     'jupyter.lab.setting-deprecated'?: boolean;
 
+    /**
+     * The JupyterLab icon hint.
+     */
+    'jupyter.lab.setting-icon'?: string;
+
     /**
      * The JupyterLab icon class hint.
      */

+ 1 - 1
packages/shortcuts-extension/schema/shortcuts.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "ui-components:keyboard",
+  "jupyter.lab.setting-icon": "ui-components:keyboard",
   "jupyter.lab.setting-icon-label": "Keyboard Shortcuts",
   "jupyter.lab.transform": true,
   "title": "Keyboard Shortcuts",

+ 1 - 1
packages/statusbar-extension/schema/plugin.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-SettingsIcon",
+  "jupyter.lab.setting-icon": "ui-components:settings",
   "jupyter.lab.setting-icon-label": "Status Bar",
   "title": "Status Bar",
   "description": "Status Bar settings.",

+ 1 - 1
packages/terminal-extension/schema/plugin.json

@@ -1,5 +1,5 @@
 {
-  "jupyter.lab.setting-icon-class": "jp-TerminalIcon",
+  "jupyter.lab.setting-icon": "ui-components:terminal",
   "jupyter.lab.setting-icon-label": "Terminal",
   "title": "Terminal",
   "description": "Terminal settings.",

+ 1 - 0
packages/ui-components/src/style/icon.ts

@@ -356,6 +356,7 @@ function containerCSS(props: IIconStyle): NestedCSSProperties {
  */
 export const iconStyle = (props?: IIconStyle): string => {
   if (!props || Object.keys(props).length === 0) {
+    // props is empty
     return '';
   }