Skip to content

Commit c07a154

Browse files
committed
all tabbar icons now rendered by blended react/phosphor vdom elements
requires the changes in the phosphorjs/phosphor#437 PR
1 parent ef5fe63 commit c07a154

File tree

16 files changed

+66
-35
lines changed

16 files changed

+66
-35
lines changed

packages/application/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"@jupyterlab/rendermime": "^2.0.0-alpha.1",
4343
"@jupyterlab/rendermime-interfaces": "^2.0.0-alpha.1",
4444
"@jupyterlab/services": "^5.0.0-alpha.1",
45-
"@jupyterlab/ui-components": "^2.0.0-alpha.1",
4645
"@phosphor/algorithm": "^1.2.0",
4746
"@phosphor/application": "^1.7.0",
4847
"@phosphor/commands": "^1.7.0",

packages/application/src/shell.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { Debouncer } from '@jupyterlab/coreutils';
55

66
import { DocumentRegistry } from '@jupyterlab/docregistry';
77

8-
import { DockPanelSvg, TabBarSvg } from '@jupyterlab/ui-components';
9-
108
import { ArrayExt, find, IIterator, iter, toArray } from '@phosphor/algorithm';
119

1210
import { PromiseDelegate, Token } from '@phosphor/coreutils';
@@ -179,9 +177,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
179177
let topHandler = (this._topHandler = new Private.PanelHandler());
180178
let bottomPanel = (this._bottomPanel = new BoxPanel());
181179
let hboxPanel = new BoxPanel();
182-
let dockPanel = (this._dockPanel = new DockPanelSvg({
183-
kind: 'dockPanelBar'
184-
}));
180+
let dockPanel = (this._dockPanel = new DockPanel());
185181
MessageLoop.installMessageHook(dockPanel, this._dockChildHook);
186182

187183
let hsplitPanel = new SplitPanel();
@@ -1062,8 +1058,7 @@ namespace Private {
10621058
* Construct a new side bar handler.
10631059
*/
10641060
constructor() {
1065-
this._sideBar = new TabBarSvg<Widget>({
1066-
kind: 'sideBar',
1061+
this._sideBar = new TabBar<Widget>({
10671062
insertBehavior: 'none',
10681063
removeBehavior: 'none',
10691064
allowDeselect: true

packages/application/style/index.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
77
@import url('~@phosphor/widgets/style/index.css');
8-
@import url('~@jupyterlab/ui-components/style/index.css');
98
@import url('~@jupyterlab/apputils/style/index.css');
109
@import url('~@jupyterlab/docregistry/style/index.css');
1110
@import url('~font-awesome/css/font-awesome.min.css');

packages/application/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
},
2424
{
2525
"path": "../services"
26-
},
27-
{
28-
"path": "../ui-components"
2926
}
3027
]
3128
}

packages/apputils/src/mainareawidget.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export class MainAreaWidget<T extends Widget = Widget> extends Widget
174174
this.title.mnemonic = content.title.mnemonic;
175175
this.title.iconClass = content.title.iconClass;
176176
this.title.iconLabel = content.title.iconLabel;
177+
this.title.iconPass = content.title.iconPass;
177178
this.title.caption = content.title.caption;
178179
this.title.className = content.title.className;
179180
this.title.dataset = content.title.dataset;
@@ -193,6 +194,7 @@ export class MainAreaWidget<T extends Widget = Widget> extends Widget
193194
content.title.mnemonic = this.title.mnemonic;
194195
content.title.iconClass = this.title.iconClass;
195196
content.title.iconLabel = this.title.iconLabel;
197+
content.title.iconPass = this.title.iconPass;
196198
content.title.caption = this.title.caption;
197199
content.title.className = this.title.className;
198200
content.title.dataset = this.title.dataset;

packages/csvviewer-extension/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ function activateCsv(
130130
if (ft) {
131131
widget.title.iconClass = ft.iconClass!;
132132
widget.title.iconLabel = ft.iconLabel!;
133+
widget.title.iconPass = ft.iconPass!;
133134
}
134135
// Set the theme for the new widget.
135136
widget.content.style = style;
@@ -209,6 +210,7 @@ function activateTsv(
209210
if (ft) {
210211
widget.title.iconClass = ft.iconClass!;
211212
widget.title.iconLabel = ft.iconLabel!;
213+
widget.title.iconPass = ft.iconPass!;
212214
}
213215
// Set the theme for the new widget.
214216
widget.content.style = style;

packages/docregistry/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@jupyterlab/rendermime": "^2.0.0-alpha.1",
4444
"@jupyterlab/rendermime-interfaces": "^2.0.0-alpha.1",
4545
"@jupyterlab/services": "^5.0.0-alpha.1",
46+
"@jupyterlab/ui-components": "^2.0.0-alpha.1",
4647
"@phosphor/algorithm": "^1.2.0",
4748
"@phosphor/coreutils": "^1.3.1",
4849
"@phosphor/disposable": "^1.3.0",

packages/docregistry/src/default.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,12 @@ export abstract class ABCWidgetFactory<
389389
// Create the new widget
390390
const widget = this.createNewWidget(context, source);
391391

392+
const ft = this._fileTypes[0];
393+
if (ft) {
394+
widget.title.iconClass = ft.iconClass;
395+
widget.title.iconLabel = ft.iconLabel;
396+
widget.title.iconPass = ft.iconPass;
397+
}
392398
// Add toolbar items
393399
let items: DocumentRegistry.IToolbarItem[];
394400
if (this._toolbarFactory) {

packages/docregistry/src/mimedocument.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ export class MimeDocumentFactory extends ABCWidgetFactory<MimeDocument> {
287287

288288
content.title.iconClass = ft.iconClass;
289289
content.title.iconLabel = ft.iconLabel;
290+
content.title.iconPass = ft.iconPass;
290291

291292
const widget = new MimeDocument({ content, context });
292293

packages/docregistry/src/registry.ts

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
import { Contents, Kernel } from '@jupyterlab/services';
5-
64
import {
75
ArrayExt,
86
ArrayIterator,
@@ -34,6 +32,22 @@ import { IModelDB } from '@jupyterlab/observables';
3432

3533
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
3634

35+
import { Contents, Kernel } from '@jupyterlab/services';
36+
37+
import {
38+
fileIcon,
39+
folderIcon,
40+
imageIcon,
41+
JLIcon,
42+
jsonIcon,
43+
markdownIcon,
44+
notebookIcon,
45+
pythonIcon,
46+
rKernelIcon,
47+
spreadsheetIcon,
48+
yamlIcon
49+
} from '@jupyterlab/ui-components';
50+
3751
import { TextModelFactory } from './default';
3852

3953
/**
@@ -1166,6 +1180,8 @@ export namespace DocumentRegistry {
11661180
*/
11671181
readonly iconLabel?: string;
11681182

1183+
readonly iconPass?: JLIcon.IPhosphor;
1184+
11691185
/**
11701186
* The content type of the new file.
11711187
*/
@@ -1184,7 +1200,7 @@ export namespace DocumentRegistry {
11841200
name: 'default',
11851201
extensions: [],
11861202
mimeTypes: [],
1187-
iconClass: 'jp-MaterialIcon jp-FileIcon',
1203+
iconPass: fileIcon.phosphor({ kind: 'dockPanelBar', center: true }),
11881204
iconLabel: '',
11891205
contentType: 'file',
11901206
fileFormat: 'text'
@@ -1235,7 +1251,7 @@ export namespace DocumentRegistry {
12351251
extensions: ['.ipynb'],
12361252
contentType: 'notebook',
12371253
fileFormat: 'json',
1238-
iconClass: 'jp-MaterialIcon jp-NotebookIcon'
1254+
iconPass: notebookIcon.phosphor({ kind: 'dockPanelBar', center: true })
12391255
};
12401256

12411257
/**
@@ -1247,7 +1263,7 @@ export namespace DocumentRegistry {
12471263
extensions: [],
12481264
mimeTypes: ['text/directory'],
12491265
contentType: 'directory',
1250-
iconClass: 'jp-MaterialIcon jp-FolderIcon'
1266+
iconPass: folderIcon.phosphor({ kind: 'dockPanelBar', center: true })
12511267
};
12521268

12531269
/**
@@ -1262,56 +1278,56 @@ export namespace DocumentRegistry {
12621278
displayName: 'Markdown File',
12631279
extensions: ['.md'],
12641280
mimeTypes: ['text/markdown'],
1265-
iconClass: 'jp-MaterialIcon jp-MarkdownIcon'
1281+
iconPass: markdownIcon.phosphor({ kind: 'dockPanelBar', center: true })
12661282
},
12671283
{
12681284
name: 'python',
12691285
displayName: 'Python File',
12701286
extensions: ['.py'],
12711287
mimeTypes: ['text/x-python'],
1272-
iconClass: 'jp-MaterialIcon jp-PythonIcon'
1288+
iconPass: pythonIcon.phosphor({ kind: 'dockPanelBar', center: true })
12731289
},
12741290
{
12751291
name: 'json',
12761292
displayName: 'JSON File',
12771293
extensions: ['.json'],
12781294
mimeTypes: ['application/json'],
1279-
iconClass: 'jp-MaterialIcon jp-JsonIcon'
1295+
iconPass: jsonIcon.phosphor({ kind: 'dockPanelBar', center: true })
12801296
},
12811297
{
12821298
name: 'csv',
12831299
displayName: 'CSV File',
12841300
extensions: ['.csv'],
12851301
mimeTypes: ['text/csv'],
1286-
iconClass: 'jp-MaterialIcon jp-SpreadsheetIcon'
1302+
iconPass: spreadsheetIcon.phosphor({ kind: 'dockPanelBar', center: true })
12871303
},
12881304
{
12891305
name: 'tsv',
12901306
displayName: 'TSV File',
12911307
extensions: ['.tsv'],
12921308
mimeTypes: ['text/csv'],
1293-
iconClass: 'jp-MaterialIcon jp-SpreadsheetIcon'
1309+
iconPass: spreadsheetIcon.phosphor({ kind: 'dockPanelBar', center: true })
12941310
},
12951311
{
12961312
name: 'r',
12971313
displayName: 'R File',
12981314
mimeTypes: ['text/x-rsrc'],
12991315
extensions: ['.r'],
1300-
iconClass: 'jp-MaterialIcon jp-RKernelIcon'
1316+
iconPass: rKernelIcon.phosphor({ kind: 'dockPanelBar', center: true })
13011317
},
13021318
{
13031319
name: 'yaml',
13041320
displayName: 'YAML File',
13051321
mimeTypes: ['text/x-yaml', 'text/yaml'],
13061322
extensions: ['.yaml', '.yml'],
1307-
iconClass: 'jp-MaterialIcon jp-YamlIcon'
1323+
iconPass: yamlIcon.phosphor({ kind: 'dockPanelBar', center: true })
13081324
},
13091325
{
13101326
name: 'svg',
13111327
displayName: 'Image',
13121328
mimeTypes: ['image/svg+xml'],
13131329
extensions: ['.svg'],
1314-
iconClass: 'jp-MaterialIcon jp-ImageIcon',
1330+
iconPass: imageIcon.phosphor({ kind: 'dockPanelBar', center: true }),
13151331
fileFormat: 'base64'
13161332
},
13171333
{
@@ -1320,38 +1336,39 @@ export namespace DocumentRegistry {
13201336
mimeTypes: ['image/tiff'],
13211337
extensions: ['.tif', '.tiff'],
13221338
iconClass: 'jp-MaterialIcon jp-ImageIcon',
1339+
iconPass: imageIcon.phosphor({ kind: 'dockPanelBar', center: true }),
13231340
fileFormat: 'base64'
13241341
},
13251342
{
13261343
name: 'jpeg',
13271344
displayName: 'Image',
13281345
mimeTypes: ['image/jpeg'],
13291346
extensions: ['.jpg', '.jpeg'],
1330-
iconClass: 'jp-MaterialIcon jp-ImageIcon',
1347+
iconPass: imageIcon.phosphor({ kind: 'dockPanelBar', center: true }),
13311348
fileFormat: 'base64'
13321349
},
13331350
{
13341351
name: 'gif',
13351352
displayName: 'Image',
13361353
mimeTypes: ['image/gif'],
13371354
extensions: ['.gif'],
1338-
iconClass: 'jp-MaterialIcon jp-ImageIcon',
1355+
iconPass: imageIcon.phosphor({ kind: 'dockPanelBar', center: true }),
13391356
fileFormat: 'base64'
13401357
},
13411358
{
13421359
name: 'png',
13431360
displayName: 'Image',
13441361
mimeTypes: ['image/png'],
13451362
extensions: ['.png'],
1346-
iconClass: 'jp-MaterialIcon jp-ImageIcon',
1363+
iconPass: imageIcon.phosphor({ kind: 'dockPanelBar', center: true }),
13471364
fileFormat: 'base64'
13481365
},
13491366
{
13501367
name: 'bmp',
13511368
displayName: 'Image',
13521369
mimeTypes: ['image/bmp'],
13531370
extensions: ['.bmp'],
1354-
iconClass: 'jp-MaterialIcon jp-ImageIcon',
1371+
iconPass: imageIcon.phosphor({ kind: 'dockPanelBar', center: true }),
13551372
fileFormat: 'base64'
13561373
}
13571374
];

0 commit comments

Comments
 (0)