Skip to content

Commit

Permalink
Merge pull request #7700 from telamonian/jlicon_migration
Browse files Browse the repository at this point in the history
Jlicon migration
  • Loading branch information
Steven Silvester committed Jan 7, 2020
2 parents e25304c + 6431b9b commit c5a560e
Show file tree
Hide file tree
Showing 437 changed files with 3,224 additions and 5,573 deletions.
29 changes: 15 additions & 14 deletions .eslintignore
@@ -1,24 +1,25 @@
node_modules
**/node_modules
**/lib
**/build
**/lib
**/node_modules
**/static
jupyterlab/schemas
jupyterlab/themes
jupyterlab/geckodriver
jupyterlab/staging/yarn.js
jupyterlab/chrome-test.js
jupyterlab/staging/index.js
tests/**/coverage

dev_mode/index.js
dev_mode/schemas
!dev_mode/static/index.out.js
dev_mode/static
dev_mode/themes
dev_mode/workspaces
docs/_build
docs/api
examples/app/build
examples/app/themes
examples/app/schemas
examples/app/themes
examples/chrome-example-test.js
tests/**/coverage
docs/_build
docs/api
!dev_mode/static/index.out.js
jupyterlab/chrome-test.js
jupyterlab/geckodriver
jupyterlab/schemas
jupyterlab/staging/index.js
jupyterlab/staging/yarn.js
jupyterlab/themes
packages/ui-components/src/icon/iconimports.ts
25 changes: 13 additions & 12 deletions .prettierignore
@@ -1,23 +1,24 @@
node_modules
**/build
**/node_modules
**/lib
**/build
**/package.json
**/static
jupyterlab/schemas
jupyterlab/themes
jupyterlab/geckodriver
jupyterlab/staging/yarn.js
jupyterlab/staging/index.js
tests/**/coverage

.eggs
dev_mode/index.js
dev_mode/schemas
dev_mode/static
dev_mode/themes
dev_mode/workspaces
docs/_build
docs/api
examples/app/build
examples/app/themes
examples/app/schemas
tests/**/coverage
docs/_build
docs/api
**/package.json
.eggs
jupyterlab/schemas
jupyterlab/themes
jupyterlab/geckodriver
jupyterlab/staging/yarn.js
jupyterlab/staging/index.js
packages/ui-components/src/icon/iconimports.ts
2 changes: 1 addition & 1 deletion buildutils/package.json
Expand Up @@ -38,7 +38,7 @@
"watch": "tsc -w --listEmittedFiles"
},
"dependencies": {
"@lumino/coreutils": "^1.4.0",
"@lumino/coreutils": "^1.4.2",
"@yarnpkg/lockfile": "^1.1.0",
"child_process": "~1.0.2",
"commander": "~4.0.1",
Expand Down
32 changes: 16 additions & 16 deletions buildutils/src/ensure-package.ts
Expand Up @@ -21,17 +21,13 @@ const HEADER_TEMPLATE = `
`;

const ICON_IMPORTS_TEMPLATE = `
import { Icon } from './interfaces';
import { JLIcon } from './jlicon';
// icon svg import statements
{{iconImportStatements}}
// defaultIcons definition
export namespace IconImports {
export const defaultIcons: ReadonlyArray<Icon.IModel> = [
{{iconModelDeclarations}}
];
}
// JLIcon instance construction
{{jliconConstruction}}
`;

const ICON_CSS_CLASSES_TEMPLATE = `
Expand Down Expand Up @@ -368,37 +364,41 @@ export async function ensureUiComponents(

// build the per-icon import code
let _iconImportStatements: string[] = [];
let _iconModelDeclarations: string[] = [];
let _jliconConstruction: string[] = [];
svgs.forEach(svg => {
const name = utils.stem(svg);
const svgpath = path
.relative(iconSrcDir, svg)
.split(path.sep)
.join('/');

const svgname = utils.camelCase(name) + 'Svg';
const iconname = utils.camelCase(name) + 'Icon';

if (dorequire) {
// load the icon svg using `require`
_iconModelDeclarations.push(
`{ name: '${name}', svg: require('${svgpath}').default }`
_jliconConstruction.push(
`export const ${iconname} = new JLIcon({ name: '${name}', svgstr: require('${svgpath}').default });`
);
} else {
// load the icon svg using `import`
const nameCamel = utils.camelCase(name) + 'Svg';
_iconImportStatements.push(`import ${svgname} from '${svgpath}';`);

_iconImportStatements.push(`import ${nameCamel} from '${svgpath}';`);
_iconModelDeclarations.push(`{ name: '${name}', svg: ${nameCamel} }`);
_jliconConstruction.push(
`export const ${iconname} = new JLIcon({ name: '${name}', svgstr: ${svgname} });`
);
}
});
const iconImportStatements = _iconImportStatements.join('\n');
const iconModelDeclarations = _iconModelDeclarations.join(',\n');
const jliconConstruction = _jliconConstruction.join('\n');

// generate the actual contents of the iconImports file
const iconImportsPath = path.join(iconSrcDir, 'iconimports.ts');
const iconImportsContents = utils.fromTemplate(
HEADER_TEMPLATE + ICON_IMPORTS_TEMPLATE,
{ funcName, iconImportStatements, iconModelDeclarations }
{ funcName, iconImportStatements, jliconConstruction }
);
messages.push(...ensureFile(iconImportsPath, iconImportsContents));
messages.push(...ensureFile(iconImportsPath, iconImportsContents, false));

/* support for deprecated icon CSS classes */
const iconCSSDir = path.join(pkgPath, 'style');
Expand Down
6 changes: 5 additions & 1 deletion buildutils/src/ensure-repo.ts
Expand Up @@ -33,7 +33,11 @@ let UNUSED: Dict<string[]> = {
'@jupyterlab/application': ['font-awesome'],
'@jupyterlab/apputils-extension': ['es6-promise'],
'@jupyterlab/services': ['node-fetch', 'ws'],
'@jupyterlab/testutils': ['node-fetch', 'identity-obj-proxy'],
'@jupyterlab/testutils': [
'node-fetch',
'identity-obj-proxy',
'jest-raw-loader'
],
'@jupyterlab/test-csvviewer': ['csv-spectrum'],
'@jupyterlab/vega5-extension': ['vega', 'vega-lite'],
'@jupyterlab/ui-components': ['@blueprintjs/icons']
Expand Down
24 changes: 12 additions & 12 deletions dev_mode/package.json
Expand Up @@ -170,18 +170,18 @@
"@jupyterlab/vdom": "~2.0.0-alpha.4",
"@jupyterlab/vdom-extension": "~2.0.0-alpha.4",
"@jupyterlab/vega5-extension": "~2.0.0-alpha.4",
"@lumino/algorithm": "^1.2.1",
"@lumino/application": "^1.7.4",
"@lumino/commands": "^1.9.0",
"@lumino/coreutils": "^1.4.0",
"@lumino/disposable": "^1.3.2",
"@lumino/domutils": "^1.1.5",
"@lumino/dragdrop": "^1.4.2",
"@lumino/messaging": "^1.3.1",
"@lumino/properties": "^1.1.4",
"@lumino/signaling": "^1.3.2",
"@lumino/virtualdom": "^1.2.1",
"@lumino/widgets": "^1.9.4",
"@lumino/algorithm": "^1.2.3",
"@lumino/application": "^1.7.7",
"@lumino/commands": "^1.9.1",
"@lumino/coreutils": "^1.4.2",
"@lumino/disposable": "^1.3.4",
"@lumino/domutils": "^1.1.7",
"@lumino/dragdrop": "^1.4.4",
"@lumino/messaging": "^1.3.3",
"@lumino/properties": "^1.1.6",
"@lumino/signaling": "^1.3.4",
"@lumino/virtualdom": "^1.4.0",
"@lumino/widgets": "^1.9.7",
"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-alpha.4",
"@jupyterlab/services": "^5.0.0-alpha.4",
"@jupyterlab/theme-light-extension": "^2.0.0-alpha.4",
"@lumino/commands": "^1.9.0",
"@lumino/widgets": "^1.9.4",
"@lumino/commands": "^1.9.1",
"@lumino/widgets": "^1.9.7",
"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-alpha.4",
"@jupyterlab/services": "^5.0.0-alpha.4",
"@jupyterlab/theme-light-extension": "^2.0.0-alpha.4",
"@lumino/commands": "^1.9.0",
"@lumino/widgets": "^1.9.4",
"@lumino/commands": "^1.9.1",
"@lumino/widgets": "^1.9.7",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
7 changes: 3 additions & 4 deletions examples/filebrowser/package.json
Expand Up @@ -16,10 +16,9 @@
"@jupyterlab/fileeditor": "^2.0.0-alpha.4",
"@jupyterlab/services": "^5.0.0-alpha.4",
"@jupyterlab/theme-light-extension": "^2.0.0-alpha.4",
"@jupyterlab/ui-components": "^2.0.0-alpha.4",
"@lumino/algorithm": "^1.2.1",
"@lumino/commands": "^1.9.0",
"@lumino/widgets": "^1.9.4",
"@lumino/algorithm": "^1.2.3",
"@lumino/commands": "^1.9.1",
"@lumino/widgets": "^1.9.7",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
7 changes: 2 additions & 5 deletions examples/filebrowser/src/index.ts
Expand Up @@ -34,8 +34,6 @@ import { FileBrowser, FileBrowserModel } from '@jupyterlab/filebrowser';

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

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

function main(): void {
let manager = new ServiceManager();
void manager.ready.then(() => {
Expand Down Expand Up @@ -88,8 +86,7 @@ function createApp(manager: ServiceManager.IManager): void {
let commands = new CommandRegistry();

let fbModel = new FileBrowserModel({
manager: docManager,
iconRegistry: defaultIconRegistry
manager: docManager
});
let fbWidget = new FileBrowser({
id: 'filebrowser',
Expand All @@ -98,7 +95,7 @@ function createApp(manager: ServiceManager.IManager): void {

// Add a creator toolbar item.
let creator = new ToolbarButton({
iconClassName: 'jp-AddIcon jp-Icon jp-Icon-16',
iconClass: 'jp-AddIcon jp-Icon jp-Icon-16',
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-alpha.4",
"@jupyterlab/services": "^5.0.0-alpha.4",
"@jupyterlab/theme-light-extension": "^2.0.0-alpha.4",
"@lumino/commands": "^1.9.0",
"@lumino/widgets": "^1.9.4",
"@lumino/commands": "^1.9.1",
"@lumino/widgets": "^1.9.7",
"es6-promise": "~4.2.8"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/OutputExamples.ipynb
Expand Up @@ -796,7 +796,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion examples/terminal/package.json
Expand Up @@ -11,7 +11,7 @@
"@jupyterlab/services": "^5.0.0-alpha.4",
"@jupyterlab/terminal": "^2.0.0-alpha.4",
"@jupyterlab/theme-light-extension": "^2.0.0-alpha.4",
"@lumino/widgets": "^1.9.4",
"@lumino/widgets": "^1.9.7",
"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.9.4"
"@lumino/widgets": "^1.9.7"
},
"jupyterlab": {
"mimeExtension": true
Expand Down
9 changes: 5 additions & 4 deletions packages/application-extension/package.json
Expand Up @@ -42,10 +42,11 @@
"@jupyterlab/property-inspector": "^2.0.0-alpha.4",
"@jupyterlab/settingregistry": "^2.0.0-alpha.4",
"@jupyterlab/statedb": "^2.0.0-alpha.4",
"@lumino/algorithm": "^1.2.1",
"@lumino/coreutils": "^1.4.0",
"@lumino/disposable": "^1.3.2",
"@lumino/widgets": "^1.9.4",
"@jupyterlab/ui-components": "^2.0.0-alpha.4",
"@lumino/algorithm": "^1.2.3",
"@lumino/coreutils": "^1.4.2",
"@lumino/disposable": "^1.3.4",
"@lumino/widgets": "^1.9.7",
"react": "~16.9.0"
},
"devDependencies": {
Expand Down
20 changes: 11 additions & 9 deletions packages/application-extension/src/index.tsx
Expand Up @@ -26,15 +26,17 @@ import {

import { PathExt, URLExt } from '@jupyterlab/coreutils';

import { IStateDB } from '@jupyterlab/statedb';

import { ISettingRegistry } from '@jupyterlab/settingregistry';

import {
IPropertyInspectorProvider,
SideBarPropertyInspectorProvider
} from '@jupyterlab/property-inspector';

import { ISettingRegistry } from '@jupyterlab/settingregistry';

import { IStateDB } from '@jupyterlab/statedb';

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

import { each, iter, toArray } from '@lumino/algorithm';

import { PromiseDelegate } from '@lumino/coreutils';
Expand Down Expand Up @@ -605,7 +607,7 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
commands.addCommand(CommandIDs.close, {
label: () => 'Close Tab',
isEnabled: () =>
!!shell.currentWidget && !!shell.currentWidget.title.closable,
!!shell.currentWidget && shell.currentWidget.title.closable,
execute: () => {
if (shell.currentWidget) {
shell.currentWidget.close();
Expand Down Expand Up @@ -673,7 +675,7 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
});

app.commands.addCommand(CommandIDs.toggleLeftArea, {
label: args => 'Show Left Sidebar',
label: () => 'Show Left Sidebar',
execute: () => {
if (shell.leftCollapsed) {
shell.expandLeft();
Expand All @@ -690,7 +692,7 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
palette.addItem({ command: CommandIDs.toggleLeftArea, category });

app.commands.addCommand(CommandIDs.toggleRightArea, {
label: args => 'Show Right Sidebar',
label: () => 'Show Right Sidebar',
execute: () => {
if (shell.rightCollapsed) {
shell.expandRight();
Expand All @@ -707,7 +709,7 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
palette.addItem({ command: CommandIDs.toggleRightArea, category });

app.commands.addCommand(CommandIDs.togglePresentationMode, {
label: args => 'Presentation Mode',
label: () => 'Presentation Mode',
execute: () => {
shell.presentationMode = !shell.presentationMode;
},
Expand Down Expand Up @@ -820,7 +822,7 @@ const propertyInspector: JupyterFrontEndPlugin<IPropertyInspectorProvider> = {
provides: IPropertyInspectorProvider,
activate: (app: JupyterFrontEnd, labshell: ILabShell) => {
const widget = new SideBarPropertyInspectorProvider(labshell);
widget.title.iconClass = 'jp-BuildIcon jp-SideBar-tabIcon';
widget.title.iconRenderer = buildIcon;
widget.title.caption = 'Property Inspector';
widget.id = 'jp-property-inspector';
labshell.add(widget, 'left');
Expand Down
1 change: 1 addition & 0 deletions packages/application-extension/style/index.css
Expand Up @@ -5,6 +5,7 @@

/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
@import url('~@lumino/widgets/style/index.css');
@import url('~@jupyterlab/ui-components/style/index.css');
@import url('~@jupyterlab/application/style/index.css');
@import url('~@jupyterlab/property-inspector/style/index.css');

Expand Down

0 comments on commit c5a560e

Please sign in to comment.