Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post LabIcon cleanup; migrate last holdouts to LabIcon; fix icon styling #7864

Merged
merged 47 commits into from Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c47c998
fixed react icon for vdom filetype
telamonian Feb 9, 2020
a0b1522
migrated commands/menu items in filebrowser-extension to LabIcon
telamonian Feb 9, 2020
0d30a6c
integrity
telamonian Feb 9, 2020
fbc97bd
filebrowser-extension: all icons now LabIcon, .iconRenderer => .icon
telamonian Feb 9, 2020
3ef132b
notebook-extension: all icons now LabIcon, .iconRenderer => .icon
telamonian Feb 9, 2020
7f04236
terminal-extension: all icons now LabIcon, .iconRenderer => .icon
telamonian Feb 10, 2020
af6053e
migrated all refs to deprecated title.iconRenderer => title.icon
telamonian Feb 10, 2020
6b5a6c8
add LabIcon.renderer method to allow for binding props/styles to icons
telamonian Feb 10, 2020
cd74323
removes all uses of LabIcon.UNSTABLE_style from shell.ts
telamonian Feb 11, 2020
06300f6
refactored renderer => bindprops
telamonian Feb 15, 2020
c0c5b89
bindprops partially working
telamonian Feb 18, 2020
fbc4289
LabIcon.bindprops now works as intended
telamonian Feb 18, 2020
0a51bbd
added styling for filebrowser context menu item icons
telamonian Feb 18, 2020
f81b4a1
all filebrowser context menu item icons now migrated => LabIcon.
telamonian Feb 19, 2020
99e054d
fixed use of addIcon
telamonian Feb 19, 2020
cd1325a
fixed replace toggle button icon in find/replace widget
telamonian Feb 19, 2020
4c64ecd
fixed all launcher icons; removed all UNSTABLE methods from LabIcon
telamonian Feb 21, 2020
677339c
removed Private.nameToClassName from labicon.tsx
telamonian Feb 21, 2020
d62afc0
simplified icon resolvability check
telamonian Feb 21, 2020
63237c9
added temp fix (until lumino 2.0) for getting iconClass from a command
telamonian Feb 21, 2020
6e481ec
finished audit of all uses of `iconClass` in jlab core src
telamonian Feb 21, 2020
8bdb70b
starting to fix menu icons
telamonian Feb 21, 2020
cae9a04
integrity
telamonian Feb 21, 2020
4336f54
fixed menu item check marks. all menu icon issues fixed
telamonian Feb 21, 2020
e74e56e
bugfix for disabled submenu caret. Some submenu icons not working
telamonian Feb 21, 2020
e41db4c
added MenuSvg.insertItem hack to workaround submenu renderer issue
telamonian Feb 22, 2020
f9b53c9
fixed check mark icons in CommandPaletteSvg
telamonian Feb 22, 2020
4e75f14
CommandPalette header icon mostly fixed, some minor styling bugs remain
telamonian Feb 22, 2020
1cdb766
fixed styling for CommandPalette header icon
telamonian Feb 22, 2020
04688da
created/added clearIcon
telamonian Feb 22, 2020
bae948a
integrity
telamonian Feb 22, 2020
8db32e3
grouped Widget subclasses tweaked for svg icons into `widgets` subpkg
telamonian Feb 22, 2020
8e2b243
bumped lumino deps to latest, needed for icon/virtualdom fixes
telamonian Feb 22, 2020
96ca4ca
fixed icon kind docstrings
telamonian Feb 23, 2020
5a0a51b
cleaned up icon styling system
telamonian Feb 23, 2020
2ae36a5
plugged new icon styling system into the rest of the program
telamonian Feb 23, 2020
996ead6
fixes for/streamling of icon style merging
telamonian Feb 24, 2020
72ba558
fix to statusBar icon style; removed default elementPosition
telamonian Feb 24, 2020
c89aaac
deprecated `justify` => `elementPosition` across codebase
telamonian Feb 24, 2020
3099c28
implemented `elementSize` icon styling arg
telamonian Feb 24, 2020
8e63e3e
massive fixup of icon styling-related docstrings
telamonian Feb 24, 2020
fd332d1
moved currently unused Renderers into Private namespace
telamonian Feb 24, 2020
f7fdeca
deprecated/replaced `kind` => `stylesheet` across codebase
telamonian Feb 24, 2020
48651c2
fix for small regression in settings editor icon style/spacing
telamonian Feb 24, 2020
e6a179f
remove deprecated `rendererClass` from LabIcon.IOptions
telamonian Feb 24, 2020
1834e6b
critical bugfix to icon style caching
telamonian Feb 24, 2020
267ee49
audited icon css across the codebase
telamonian Feb 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintignore
Expand Up @@ -23,3 +23,10 @@ jupyterlab/staging/index.js
jupyterlab/staging/yarn.js
jupyterlab/themes
packages/ui-components/src/icon/iconimports.ts

# jetbrains IDE stuff
.idea/

# ms IDE stuff
.history/
.vscode/
7 changes: 7 additions & 0 deletions .prettierignore
Expand Up @@ -22,3 +22,10 @@ jupyterlab/geckodriver
jupyterlab/staging/yarn.js
jupyterlab/staging/index.js
packages/ui-components/src/icon/iconimports.ts

# jetbrains IDE stuff
.idea/

# ms IDE stuff
.history/
.vscode/
14 changes: 7 additions & 7 deletions dev_mode/package.json
Expand Up @@ -169,17 +169,17 @@
"@jupyterlab/vdom-extension": "~2.0.0-rc.1",
"@jupyterlab/vega5-extension": "~2.0.0-rc.1",
"@lumino/algorithm": "^1.2.3",
"@lumino/application": "^1.8.2",
"@lumino/commands": "^1.9.2",
"@lumino/application": "^1.8.4",
"@lumino/commands": "^1.10.1",
"@lumino/coreutils": "^1.4.2",
"@lumino/disposable": "^1.3.4",
"@lumino/disposable": "^1.3.5",
"@lumino/domutils": "^1.1.7",
"@lumino/dragdrop": "^1.5.0",
"@lumino/dragdrop": "^1.5.1",
"@lumino/messaging": "^1.3.3",
"@lumino/properties": "^1.1.6",
"@lumino/signaling": "^1.3.4",
"@lumino/virtualdom": "^1.5.0",
"@lumino/widgets": "^1.10.2",
"@lumino/signaling": "^1.3.5",
"@lumino/virtualdom": "^1.6.1",
"@lumino/widgets": "^1.11.1",
"react": "~16.9.0",
"react-dom": "~16.9.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/cell/package.json
Expand Up @@ -15,8 +15,8 @@
"@jupyterlab/rendermime": "^2.0.0-rc.1",
"@jupyterlab/services": "^5.0.0-rc.1",
"@jupyterlab/theme-light-extension": "^2.0.0-rc.1",
"@lumino/commands": "^1.9.2",
"@lumino/widgets": "^1.10.2",
"@lumino/commands": "^1.10.1",
"@lumino/widgets": "^1.11.1",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/console/package.json
Expand Up @@ -13,8 +13,8 @@
"@jupyterlab/rendermime": "^2.0.0-rc.1",
"@jupyterlab/services": "^5.0.0-rc.1",
"@jupyterlab/theme-light-extension": "^2.0.0-rc.1",
"@lumino/commands": "^1.9.2",
"@lumino/widgets": "^1.10.2",
"@lumino/commands": "^1.10.1",
"@lumino/widgets": "^1.11.1",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/filebrowser/package.json
Expand Up @@ -17,8 +17,8 @@
"@jupyterlab/services": "^5.0.0-rc.1",
"@jupyterlab/theme-light-extension": "^2.0.0-rc.1",
"@lumino/algorithm": "^1.2.3",
"@lumino/commands": "^1.9.2",
"@lumino/widgets": "^1.10.2",
"@lumino/commands": "^1.10.1",
"@lumino/widgets": "^1.11.1",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion examples/filebrowser/src/index.ts
Expand Up @@ -34,6 +34,8 @@ import { FileBrowser, FileBrowserModel } from '@jupyterlab/filebrowser';

import { FileEditorFactory } from '@jupyterlab/fileeditor';

import { addIcon } from '@jupyterlab/ui-components';

function main(): void {
let manager = new ServiceManager();
void manager.ready.then(() => {
Expand Down Expand Up @@ -95,7 +97,7 @@ function createApp(manager: ServiceManager.IManager): void {

// Add a creator toolbar item.
let creator = new ToolbarButton({
iconClass: 'jp-AddIcon jp-Icon jp-Icon-16',
icon: addIcon,
onClick: () => {
void docManager
.newUntitled({
Expand Down
4 changes: 2 additions & 2 deletions examples/notebook/package.json
Expand Up @@ -18,8 +18,8 @@
"@jupyterlab/rendermime": "^2.0.0-rc.1",
"@jupyterlab/services": "^5.0.0-rc.1",
"@jupyterlab/theme-light-extension": "^2.0.0-rc.1",
"@lumino/commands": "^1.9.2",
"@lumino/widgets": "^1.10.2",
"@lumino/commands": "^1.10.1",
"@lumino/widgets": "^1.11.1",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/terminal/package.json
Expand Up @@ -11,7 +11,7 @@
"@jupyterlab/services": "^5.0.0-rc.1",
"@jupyterlab/terminal": "^2.0.0-rc.1",
"@jupyterlab/theme-light-extension": "^2.0.0-rc.1",
"@lumino/widgets": "^1.10.2",
"@lumino/widgets": "^1.11.1",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion jupyterlab/tests/mock_packages/mimeextension/package.json
Expand Up @@ -3,7 +3,7 @@
"version": "0.3.0",
"private": true,
"dependencies": {
"@lumino/widgets": "^1.10.2"
"@lumino/widgets": "^1.11.1"
},
"jupyterlab": {
"mimeExtension": true
Expand Down
4 changes: 2 additions & 2 deletions packages/application-extension/package.json
Expand Up @@ -45,8 +45,8 @@
"@jupyterlab/ui-components": "^2.0.0-rc.2",
"@lumino/algorithm": "^1.2.3",
"@lumino/coreutils": "^1.4.2",
"@lumino/disposable": "^1.3.4",
"@lumino/widgets": "^1.10.2",
"@lumino/disposable": "^1.3.5",
"@lumino/widgets": "^1.11.1",
"react": "~16.9.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/application-extension/src/index.tsx
Expand Up @@ -825,7 +825,7 @@ const propertyInspector: JupyterFrontEndPlugin<IPropertyInspectorProvider> = {
provides: IPropertyInspectorProvider,
activate: (app: JupyterFrontEnd, labshell: ILabShell) => {
const widget = new SideBarPropertyInspectorProvider(labshell);
widget.title.iconRenderer = buildIcon;
widget.title.icon = buildIcon;
widget.title.caption = 'Property Inspector';
widget.id = 'jp-property-inspector';
labshell.add(widget, 'left');
Expand Down
12 changes: 6 additions & 6 deletions packages/application/package.json
Expand Up @@ -45,15 +45,15 @@
"@jupyterlab/statedb": "^2.0.0-rc.1",
"@jupyterlab/ui-components": "^2.0.0-rc.2",
"@lumino/algorithm": "^1.2.3",
"@lumino/application": "^1.8.2",
"@lumino/commands": "^1.9.2",
"@lumino/application": "^1.8.4",
"@lumino/commands": "^1.10.1",
"@lumino/coreutils": "^1.4.2",
"@lumino/disposable": "^1.3.4",
"@lumino/disposable": "^1.3.5",
"@lumino/messaging": "^1.3.3",
"@lumino/polling": "^1.0.3",
"@lumino/polling": "^1.0.4",
"@lumino/properties": "^1.1.6",
"@lumino/signaling": "^1.3.4",
"@lumino/widgets": "^1.10.2"
"@lumino/signaling": "^1.3.5",
"@lumino/widgets": "^1.11.1"
},
"devDependencies": {
"rimraf": "~3.0.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/application/src/frontend.ts
Expand Up @@ -7,6 +7,8 @@ import { DocumentRegistry } from '@jupyterlab/docregistry';

import { ServiceManager } from '@jupyterlab/services';

import { MenuSvg } from '@jupyterlab/ui-components';

import { IIterator } from '@lumino/algorithm';

import { Application, IPlugin } from '@lumino/application';
Expand Down Expand Up @@ -38,6 +40,10 @@ export abstract class JupyterFrontEnd<
* Construct a new JupyterFrontEnd object.
*/
constructor(options: JupyterFrontEnd.IOptions<T>) {
// render context menu with inline svg icon tweaks
options.contextMenuRenderer =
options.contextMenuRenderer || MenuSvg.defaultRenderer;

super(options);

// The default restored promise if one does not exist in the options.
Expand Down
20 changes: 8 additions & 12 deletions packages/application/src/shell.ts
Expand Up @@ -772,12 +772,10 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
// (for context menu support)
title.dataset = { ...title.dataset, id: widget.id };

// set an appropriate style class for the iconRenderer
if (title.iconRenderer) {
title.iconClass = LabIcon.UNSTABLE_style({
className: title.iconClass,
justify: 'center',
kind: 'mainAreaTab'
// bind an appropriate style to the icon
if (title.icon instanceof LabIcon) {
title.icon = title.icon.bindprops({
stylesheet: 'mainAreaTab'
});
}

Expand Down Expand Up @@ -1184,12 +1182,10 @@ namespace Private {
// in order to dispatch click events to the right widget.
title.dataset = { id: widget.id };

// set an appropriate style class for the iconRenderer
if (title.iconRenderer) {
title.iconClass = LabIcon.UNSTABLE_style({
className: title.iconClass,
justify: 'center',
kind: 'sideBar'
// bind an appropriate style to the icon
if (title.icon instanceof LabIcon) {
title.icon = title.icon.bindprops({
stylesheet: 'sideBar'
});
}

Expand Down
24 changes: 4 additions & 20 deletions packages/application/style/menus.css
Expand Up @@ -126,24 +126,8 @@
border-top: var(--jp-border-width) solid var(--jp-layout-color2);
}

.lm-Menu-itemIcon,
.lm-Menu-itemSubmenuIcon {
background-size: 16px;
background-repeat: no-repeat;
background-position: center;
}

.lm-Menu-item.lm-mod-toggled > .lm-Menu-itemIcon {
background-image: var(--jp-icon-check);
}

.lm-Menu-item.lm-mod-toggled.lm-mod-disabled > .lm-Menu-itemIcon {
background-image: var(--jp-icon-check-disabled);
}

.lm-Menu-item[data-type='submenu'] > .lm-Menu-itemSubmenuIcon {
background-image: var(--jp-icon-caret-right);
background-size: 18px;
background-repeat: no-repeat;
background-position: left;
/* gray out icon/caret for disable menu items */
.lm-Menu-item.lm-mod-disabled > .lm-Menu-itemIcon,
.lm-Menu-item[data-type='submenu'].lm-mod-disabled > .lm-Menu-itemSubmenuIcon {
opacity: 0.4;
}
8 changes: 4 additions & 4 deletions packages/apputils-extension/package.json
Expand Up @@ -45,11 +45,11 @@
"@jupyterlab/statedb": "^2.0.0-rc.1",
"@jupyterlab/ui-components": "^2.0.0-rc.2",
"@lumino/algorithm": "^1.2.3",
"@lumino/commands": "^1.9.2",
"@lumino/commands": "^1.10.1",
"@lumino/coreutils": "^1.4.2",
"@lumino/disposable": "^1.3.4",
"@lumino/polling": "^1.0.3",
"@lumino/widgets": "^1.10.2",
"@lumino/disposable": "^1.3.5",
"@lumino/polling": "^1.0.4",
"@lumino/widgets": "^1.11.1",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/apputils-extension/src/index.ts
Expand Up @@ -151,8 +151,8 @@ const splash: JupyterFrontEndPlugin<ISplashScreen> = {

jupyterFaviconIcon.element({
container: logo,
justify: 'center',
kind: 'splash'

stylesheet: 'splash'
});

galaxy.appendChild(logo);
Expand Down
12 changes: 8 additions & 4 deletions packages/apputils-extension/src/palette.ts
Expand Up @@ -10,7 +10,7 @@ import { CommandPalette } from '@lumino/widgets';

import { ILayoutRestorer, JupyterFrontEnd } from '@jupyterlab/application';
import { ICommandPalette, IPaletteItem } from '@jupyterlab/apputils';
import { paletteIcon } from '@jupyterlab/ui-components';
import { CommandPaletteSvg, paletteIcon } from '@jupyterlab/ui-components';

/**
* The command IDs used by the apputils extension.
Expand All @@ -29,7 +29,7 @@ export class Palette implements ICommandPalette {
*/
constructor(palette: CommandPalette) {
this._palette = palette;
this._palette.title.iconRenderer = paletteIcon;
this._palette.title.icon = paletteIcon;
this._palette.title.label = '';
this._palette.title.caption = 'Command Palette';
}
Expand Down Expand Up @@ -141,9 +141,13 @@ namespace Private {
*/
export function createPalette(app: JupyterFrontEnd): CommandPalette {
if (!palette) {
palette = new CommandPalette({ commands: app.commands });
// use a renderer tweaked to use inline svg icons
palette = new CommandPalette({
commands: app.commands,
renderer: CommandPaletteSvg.defaultRenderer
});
palette.id = 'command-palette';
palette.title.iconRenderer = paletteIcon;
palette.title.icon = paletteIcon;
palette.title.label = 'Commands';
}

Expand Down
10 changes: 5 additions & 5 deletions packages/apputils/package.json
Expand Up @@ -41,15 +41,15 @@
"@jupyterlab/statedb": "^2.0.0-rc.1",
"@jupyterlab/ui-components": "^2.0.0-rc.2",
"@lumino/algorithm": "^1.2.3",
"@lumino/commands": "^1.9.2",
"@lumino/commands": "^1.10.1",
"@lumino/coreutils": "^1.4.2",
"@lumino/disposable": "^1.3.4",
"@lumino/disposable": "^1.3.5",
"@lumino/domutils": "^1.1.7",
"@lumino/messaging": "^1.3.3",
"@lumino/properties": "^1.1.6",
"@lumino/signaling": "^1.3.4",
"@lumino/virtualdom": "^1.5.0",
"@lumino/widgets": "^1.10.2",
"@lumino/signaling": "^1.3.5",
"@lumino/virtualdom": "^1.6.1",
"@lumino/widgets": "^1.11.1",
"@types/react": "~16.9.16",
"react": "~16.9.0",
"react-dom": "~16.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/apputils/src/collapse.ts
Expand Up @@ -156,7 +156,7 @@ export class Collapse<T extends Widget = Widget> extends Widget {
(this._collapsed ? caretUpIcon : caretDownIcon).element({
container: this._header.node,
label: this._widget.title.label,
justify: 'right',
elementPosition: 'right',
height: '28px'
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/apputils/src/mainareawidget.ts
Expand Up @@ -177,9 +177,9 @@ export class MainAreaWidget<T extends Widget = Widget> extends Widget
const content = this.content;
this.title.label = content.title.label;
this.title.mnemonic = content.title.mnemonic;
this.title.icon = content.title.icon;
this.title.iconClass = content.title.iconClass;
this.title.iconLabel = content.title.iconLabel;
this.title.iconRenderer = content.title.iconRenderer;
this.title.caption = content.title.caption;
this.title.className = content.title.className;
this.title.dataset = content.title.dataset;
Expand All @@ -197,9 +197,9 @@ export class MainAreaWidget<T extends Widget = Widget> extends Widget
const content = this.content;
content.title.label = this.title.label;
content.title.mnemonic = this.title.mnemonic;
content.title.icon = this.title.icon;
content.title.iconClass = this.title.iconClass;
content.title.iconLabel = this.title.iconLabel;
content.title.iconRenderer = this.title.iconRenderer;
content.title.caption = this.title.caption;
content.title.className = this.title.className;
content.title.dataset = this.title.dataset;
Expand Down
2 changes: 1 addition & 1 deletion packages/apputils/src/styling.ts
Expand Up @@ -72,7 +72,7 @@ export namespace Styling {
wrapper.appendChild(
caretDownEmptyIcon.element({
tag: 'span',
kind: 'select',
stylesheet: 'select',
right: '8px',
top: '5px',
width: '18px'
Expand Down