From 3e9c51a4247a94a404e15ed9c31d4bef2797bbf9 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 15 Mar 2021 13:26:25 +0100 Subject: [PATCH 01/13] Update to TypeScript 4.2 --- examples/web3/package.json | 2 +- jupyterlab_widgets/package.json | 2 +- packages/base-manager/package.json | 2 +- packages/base/package.json | 2 +- packages/controls/package.json | 2 +- packages/html-manager/package.json | 2 +- packages/output/package.json | 2 +- yarn.lock | 15 +++++---------- 8 files changed, 12 insertions(+), 17 deletions(-) diff --git a/examples/web3/package.json b/examples/web3/package.json index cee2ac3661..de06ed1cee 100644 --- a/examples/web3/package.json +++ b/examples/web3/package.json @@ -35,7 +35,7 @@ "postcss-loader": "^3.0.0", "rimraf": "^2.6.1", "style-loader": "^1.1.2", - "typescript": "~3.7.4", + "typescript": "~4.2.3", "url-loader": "^3.0.0", "webpack": "^4.41.5" } diff --git a/jupyterlab_widgets/package.json b/jupyterlab_widgets/package.json index bd387f9580..c729bf421c 100644 --- a/jupyterlab_widgets/package.json +++ b/jupyterlab_widgets/package.json @@ -86,7 +86,7 @@ "npm-run-all": "^4.1.5", "prettier": "^1.19.0", "rimraf": "^3.0.2", - "typescript": "~3.9.0" + "typescript": "~4.2.3" }, "jupyterlab": { "extension": true, diff --git a/packages/base-manager/package.json b/packages/base-manager/package.json index 01a518b689..281a00b1f6 100644 --- a/packages/base-manager/package.json +++ b/packages/base-manager/package.json @@ -62,7 +62,7 @@ "rimraf": "^2.6.1", "sinon": "^7.3.2", "sinon-chai": "^3.3.0", - "typescript": "~3.7.4", + "typescript": "~4.2.3", "webpack": "^4.41.5" }, "publishConfig": { diff --git a/packages/base/package.json b/packages/base/package.json index 06324986e5..33b4ec72e7 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -67,7 +67,7 @@ "rimraf": "^2.6.1", "sinon": "^7.3.2", "sinon-chai": "^3.3.0", - "typescript": "~3.7.4", + "typescript": "~4.2.3", "webpack": "^4.41.5" } } diff --git a/packages/controls/package.json b/packages/controls/package.json index 313cd4dcfa..cbf1cc72cb 100644 --- a/packages/controls/package.json +++ b/packages/controls/package.json @@ -77,7 +77,7 @@ "sinon": "^7.3.2", "sinon-chai": "^3.3.0", "style-loader": "^1.1.2", - "typescript": "~3.7.4", + "typescript": "~4.2.3", "url-loader": "^3.0.0", "webpack": "^4.41.5" } diff --git a/packages/html-manager/package.json b/packages/html-manager/package.json index b64a319b51..d920e5b305 100644 --- a/packages/html-manager/package.json +++ b/packages/html-manager/package.json @@ -63,7 +63,7 @@ "mocha": "^6.1.4", "rimraf": "^2.6.1", "style-loader": "^1.1.2", - "typescript": "~3.7.4", + "typescript": "~4.2.3", "url-loader": "^3.0.0", "webpack": "^4.41.5", "webpack-cli": "^3.3.4" diff --git a/packages/output/package.json b/packages/output/package.json index ed20c72263..978fc14110 100644 --- a/packages/output/package.json +++ b/packages/output/package.json @@ -29,6 +29,6 @@ }, "devDependencies": { "rimraf": "^2.6.1", - "typescript": "~3.7.4" + "typescript": "~4.2.3" } } diff --git a/yarn.lock b/yarn.lock index a0055bcc29..e20acfbdb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11205,21 +11205,16 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@~3.7.4: - version "3.7.5" - resolved "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" - integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== - -typescript@~3.9.0: - version "3.9.7" - resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" - integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== - typescript@~4.1.3: version "4.1.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== +typescript@~4.2.3: + version "4.2.3" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" + integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== + typestyle@^2.0.4: version "2.1.0" resolved "https://registry.npmjs.org/typestyle/-/typestyle-2.1.0.tgz#7c5cc567de72cd8bfb686813150b92791aaa7636" From d5b900c679083d482e2856e216d8e4a929882549 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 15 Mar 2021 17:46:48 +0100 Subject: [PATCH 02/13] Handle delete with optionals --- packages/base/src/widget.ts | 40 +++++++++++-------- .../controls/src/widget_selectioncontainer.ts | 32 +++++++-------- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/packages/base/src/widget.ts b/packages/base/src/widget.ts index db7d19d500..fe5103f1b9 100644 --- a/packages/base/src/widget.ts +++ b/packages/base/src/widget.ts @@ -187,13 +187,16 @@ export class WidgetModel extends Backbone.Model { delete this.comm; } // Delete all views of this model - const views = Object.keys(this.views).map((id: string) => { - return this.views[id].then(view => view.remove()); - }); - delete this.views; - return Promise.all(views).then(() => { - return; - }); + if (this.views) { + const views = Object.keys(this.views).map((id: string) => { + return this.views![id].then(view => view.remove()); + }); + delete this.views; + return Promise.all(views).then(() => { + return; + }); + } + return Promise.resolve(); } /** @@ -466,6 +469,9 @@ export class WidgetModel extends Backbone.Model { * Send a sync message to the kernel. */ send_sync_message(state: JSONObject, callbacks: any = {}): void { + if (!this.comm) { + return; + } try { callbacks.iopub = callbacks.iopub || {}; const statuscb = callbacks.iopub.status; @@ -575,9 +581,9 @@ export class WidgetModel extends Backbone.Model { // values subclasses may set in their initialization functions. widget_manager: IWidgetManager; model_id: string; - views: { [key: string]: Promise }; + views?: { [key: string]: Promise }; state_change: Promise; - comm: IClassicComm; + comm?: IClassicComm; name: string; module: string; @@ -750,7 +756,7 @@ export namespace WidgetView { export namespace JupyterLuminoWidget { export interface IOptions { - view: DOMWidgetView; + view?: DOMWidgetView; } } @@ -759,7 +765,7 @@ export class JupyterLuminoWidget extends Widget { const view = options.view; delete options.view; super(options); - this._view = view; + this._view = view ?? null; } /** @@ -775,7 +781,7 @@ export class JupyterLuminoWidget extends Widget { if (this._view) { this._view.remove(); } - this._view = null!; + this._view = null; } /** @@ -786,10 +792,10 @@ export class JupyterLuminoWidget extends Widget { */ processMessage(msg: Message): void { super.processMessage(msg); - this._view.processLuminoMessage(msg); + this._view?.processLuminoMessage(msg); } - private _view: DOMWidgetView; + private _view: DOMWidgetView | null; } export class JupyterLuminoPanelWidget extends Panel { @@ -797,7 +803,7 @@ export class JupyterLuminoPanelWidget extends Panel { const view = options.view; delete options.view; super(options); - this._view = view; + this._view = view ?? null; } /** @@ -808,7 +814,7 @@ export class JupyterLuminoPanelWidget extends Panel { */ processMessage(msg: Message): void { super.processMessage(msg); - this._view.processLuminoMessage(msg); + this._view?.processLuminoMessage(msg); } /** @@ -827,7 +833,7 @@ export class JupyterLuminoPanelWidget extends Panel { this._view = null!; } - private _view: DOMWidgetView; + private _view: DOMWidgetView | null; } export class DOMWidgetView extends WidgetView { diff --git a/packages/controls/src/widget_selectioncontainer.ts b/packages/controls/src/widget_selectioncontainer.ts index 4c6df70c07..7e0b59990c 100644 --- a/packages/controls/src/widget_selectioncontainer.ts +++ b/packages/controls/src/widget_selectioncontainer.ts @@ -7,7 +7,7 @@ import { JupyterLuminoWidget, WidgetModel, reject, - WidgetView + WidgetView, } from '@jupyter-widgets/base'; import { BoxModel, BoxView } from './widget_box'; @@ -32,7 +32,7 @@ export class SelectionContainerModel extends BoxModel { ...super.defaults(), _model_name: 'SelectionContainerModel', selected_index: null, - _titles: [] + _titles: [], }; } } @@ -42,7 +42,7 @@ export class AccordionModel extends SelectionContainerModel { return { ...super.defaults(), _model_name: 'AccordionModel', - _view_name: 'AccordionView' + _view_name: 'AccordionView', }; } } @@ -55,7 +55,7 @@ export class JupyterLuminoAccordionWidget extends Accordion { const view = options.view; delete options.view; super(options); - this._view = view; + this._view = view ?? null; } /** @@ -66,7 +66,7 @@ export class JupyterLuminoAccordionWidget extends Accordion { */ processMessage(msg: Message): void { super.processMessage(msg); - this._view.processLuminoMessage(msg); + this._view?.processLuminoMessage(msg); } /** @@ -85,7 +85,7 @@ export class JupyterLuminoAccordionWidget extends Accordion { this._view = null!; } - private _view: DOMWidgetView; + private _view: DOMWidgetView | null; } export class AccordionView extends DOMWidgetView { @@ -127,7 +127,7 @@ export class AccordionView extends DOMWidgetView { accordion.addClass('jupyter-widgets'); accordion.addClass('widget-accordion'); accordion.addClass('widget-container'); - accordion.selection.selectionChanged.connect(sender => { + accordion.selection.selectionChanged.connect((sender) => { if (!this.updatingChildren) { this.model.set('selected_index', accordion.selection.index); this.touch(); @@ -219,7 +219,7 @@ export class TabModel extends SelectionContainerModel { return { ...super.defaults(), _model_name: 'TabModel', - _view_name: 'TabView' + _view_name: 'TabView', }; } } @@ -232,14 +232,14 @@ export class JupyterLuminoTabPanelWidget extends TabPanel { const view = options.view; delete options.view; super(options); - this._view = view; + this._view = view ?? null; // We want the view's messages to be the messages the tabContents panel // gets. MessageLoop.installMessageHook(this.tabContents, (handler, msg) => { // There may be times when we want the view's handler to be called // *after* the message has been processed by the widget, in which // case we'll need to revisit using a message hook. - this._view.processLuminoMessage(msg); + this._view?.processLuminoMessage(msg); return true; }); } @@ -257,16 +257,16 @@ export class JupyterLuminoTabPanelWidget extends TabPanel { if (this._view) { this._view.remove(); } - this._view = null!; + this._view = null; } - private _view: DOMWidgetView; + private _view: DOMWidgetView | null; } export class TabView extends DOMWidgetView { _createElement(tagName: string): HTMLElement { this.luminoWidget = new JupyterLuminoTabPanelWidget({ - view: this + view: this, }); return this.luminoWidget.node; } @@ -288,7 +288,7 @@ export class TabView extends DOMWidgetView { super.initialize(parameters); this.childrenViews = new ViewList( this.addChildView, - view => { + (view) => { view.remove(); }, this @@ -433,7 +433,7 @@ export class StackedModel extends SelectionContainerModel { return { ...super.defaults(), _model_name: 'StackedModel', - _view_name: 'StackedView' + _view_name: 'StackedView', }; } } @@ -452,7 +452,7 @@ export class StackedView extends BoxView { ?.update([selected_child]) .then((views: DOMWidgetView[]) => { // Notify all children that their sizes may have changed. - views.forEach(view => { + views.forEach((view) => { MessageLoop.postMessage( view.luminoWidget, Widget.ResizeMessage.UnknownSize From 6c7c4fbbcf545749b3eb59d002aaf8af0deeccb1 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 15 Mar 2021 18:06:43 +0100 Subject: [PATCH 03/13] Update to newer ESLint plugins --- .eslintrc.json | 17 +- jupyterlab_widgets/.eslintrc.js | 25 ++- jupyterlab_widgets/package.json | 12 +- jupyterlab_widgets/src/manager.ts | 33 +-- jupyterlab_widgets/src/output.ts | 4 +- jupyterlab_widgets/src/plugin.ts | 36 ++-- jupyterlab_widgets/src/renderer.ts | 3 +- package.json | 10 +- yarn.lock | 336 ++++++++++++----------------- 9 files changed, 222 insertions(+), 254 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index a61cb56a67..7f16e5342a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,16 +7,25 @@ "prettier" ], "rules": { - "@typescript-eslint/interface-name-prefix": [ + "@typescript-eslint/naming-convention": [ "error", - { "prefixWithI": "always" } + { + "selector": "interface", + "format": ["PascalCase"], + "custom": { + "regex": "^I[A-Z]", + "match": true + } + } ], "@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }], "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/camelcase": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-namespace": "off" + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/camelcase": "off" }, "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"] diff --git a/jupyterlab_widgets/.eslintrc.js b/jupyterlab_widgets/.eslintrc.js index afad45cfb9..92f616fb91 100644 --- a/jupyterlab_widgets/.eslintrc.js +++ b/jupyterlab_widgets/.eslintrc.js @@ -3,33 +3,42 @@ module.exports = { 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended' + 'plugin:prettier/recommended', ], parser: '@typescript-eslint/parser', parserOptions: { project: './tsconfig.json', sourceType: 'module', - tsconfigRootDir: __dirname + tsconfigRootDir: __dirname, }, plugins: ['@typescript-eslint'], rules: { - '@typescript-eslint/interface-name-prefix': [ + '@typescript-eslint/naming-convention': [ 'error', - { prefixWithI: 'always' } + { + selector: 'interface', + format: ['PascalCase'], + custom: { + regex: '^I[A-Z]', + match: true, + }, + }, ], '@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }], '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/camelcase': 'off', + '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/camelcase': 'off', '@typescript-eslint/quotes': [ 'error', 'single', - { avoidEscape: true, allowTemplateLiterals: false } + { avoidEscape: true, allowTemplateLiterals: false }, ], curly: ['error', 'all'], eqeqeq: 'error', - 'prefer-arrow-callback': 'error' - } + 'prefer-arrow-callback': 'error', + }, }; diff --git a/jupyterlab_widgets/package.json b/jupyterlab_widgets/package.json index c729bf421c..cfc5713ff6 100644 --- a/jupyterlab_widgets/package.json +++ b/jupyterlab_widgets/package.json @@ -78,13 +78,13 @@ "@jupyterlab/builder": "^3.0.0", "@jupyterlab/cells": "^3.0.0", "@types/semver": "^6.0.1", - "@typescript-eslint/eslint-plugin": "^2.27.0", - "@typescript-eslint/parser": "^2.27.0", - "eslint": "^7.5.0", - "eslint-config-prettier": "^6.10.1", - "eslint-plugin-prettier": "^3.1.2", + "@typescript-eslint/eslint-plugin": "^4.17.0", + "@typescript-eslint/parser": "^4.17.0", + "eslint": "^7.22.0", + "eslint-config-prettier": "^8.1.0", + "eslint-plugin-prettier": "^3.3.1", "npm-run-all": "^4.1.5", - "prettier": "^1.19.0", + "prettier": "^2.2.1", "rimraf": "^3.0.2", "typescript": "~4.2.3" }, diff --git a/jupyterlab_widgets/src/manager.ts b/jupyterlab_widgets/src/manager.ts index 12050aac3e..977dc7e607 100644 --- a/jupyterlab_widgets/src/manager.ts +++ b/jupyterlab_widgets/src/manager.ts @@ -10,13 +10,13 @@ import { WidgetModel, WidgetView, put_buffers, - ICallbacks + ICallbacks, } from '@jupyter-widgets/base'; import { ManagerBase, serialize_state, - IStateOptions + IStateOptions, } from '@jupyter-widgets/base-manager'; import { IDisposable } from '@lumino/disposable'; @@ -51,7 +51,8 @@ export const WIDGET_STATE_MIMETYPE = /** * A widget manager that returns Lumino widgets. */ -export abstract class LabWidgetManager extends ManagerBase +export abstract class LabWidgetManager + extends ManagerBase implements IDisposable { constructor(rendermime: IRenderMimeRegistry) { super(); @@ -66,8 +67,8 @@ export abstract class LabWidgetManager extends ManagerBase iopub: { output: (msg: KernelMessage.IIOPubMessage): void => { this._onUnhandledIOPubMessage.emit(msg); - } - } + }, + }, }; } @@ -76,7 +77,7 @@ export abstract class LabWidgetManager extends ManagerBase */ protected _handleKernelChanged({ oldValue, - newValue + newValue, }: Session.ISessionConnection.IKernelChangedArgs): void { if (oldValue) { oldValue.removeCommTarget(this.comm_target_name, this._handleCommOpen); @@ -108,7 +109,7 @@ export abstract class LabWidgetManager extends ManagerBase // For each comm id that we do not know about, create the comm, and request the state. const widgets_info = await Promise.all( - Object.keys(comm_ids).map(async comm_id => { + Object.keys(comm_ids).map(async (comm_id) => { try { await this.get_model(comm_id); // If we successfully get the model, do no more. @@ -140,7 +141,7 @@ export abstract class LabWidgetManager extends ManagerBase }); msg_id = comm.send( { - method: 'request_state' + method: 'request_state', }, this.callbacks(undefined) ); @@ -156,7 +157,7 @@ export abstract class LabWidgetManager extends ManagerBase // asynchronously, so promises to every widget reference should be available // by the time they are used. await Promise.all( - widgets_info.map(async widget_info => { + widgets_info.map(async (widget_info) => { if (!widget_info) { return; } @@ -166,7 +167,7 @@ export abstract class LabWidgetManager extends ManagerBase model_name: content.data.state._model_name, model_module: content.data.state._model_module, model_module_version: content.data.state._model_module_version, - comm: widget_info.comm + comm: widget_info.comm, }, content.data.state ); @@ -204,7 +205,7 @@ export abstract class LabWidgetManager extends ManagerBase throw new Error('No current kernel'); } const reply = await kernel.requestCommInfo({ - target_name: this.comm_target_name + target_name: this.comm_target_name, }); if (reply.content.status === 'ok') { return (reply.content as any).comms; @@ -340,7 +341,7 @@ export abstract class LabWidgetManager extends ManagerBase super.register_model(model_id, modelPromise); // Update the synchronous model map - modelPromise.then(model => { + modelPromise.then((model) => { this._modelsSync.set(model_id, model); model.once('comm:close', () => { this._modelsSync.delete(model_id); @@ -424,7 +425,7 @@ export class KernelWidgetManager extends LabWidgetManager { this._handleKernelChanged({ name: 'kernel', oldValue: null, - newValue: kernel + newValue: kernel, }); this.restoreWidgets(); } @@ -507,7 +508,7 @@ export class WidgetManager extends LabWidgetManager { this._handleKernelChanged({ name: 'kernel', oldValue: null, - newValue: context.sessionContext.session?.kernel + newValue: context.sessionContext.session?.kernel, }); } @@ -527,7 +528,7 @@ export class WidgetManager extends LabWidgetManager { private _saveState(): void { const state = this.get_state_sync({ drop_defaults: true }); this._context.model.metadata.set('widgets', { - 'application/vnd.jupyter.widget-state+json': state + 'application/vnd.jupyter.widget-state+json': state, }); } @@ -539,7 +540,7 @@ export class WidgetManager extends LabWidgetManager { // We only want to restore widgets from the kernel, not ones saved in the notebook. this.restoreWidgets(this._context!.model, { loadKernel: true, - loadNotebook: false + loadNotebook: false, }); } } diff --git a/jupyterlab_widgets/src/output.ts b/jupyterlab_widgets/src/output.ts index b853956f31..f703bcf137 100644 --- a/jupyterlab_widgets/src/output.ts +++ b/jupyterlab_widgets/src/output.ts @@ -49,7 +49,7 @@ export class OutputModel extends outputBase.OutputModel { * Register a new kernel */ _handleKernelChanged({ - oldValue + oldValue, }: Session.ISessionConnection.IKernelChangedArgs): void { const msgId = this.get('msg_id'); if (msgId && oldValue) { @@ -184,7 +184,7 @@ export class OutputView extends outputBase.OutputView { this._outputView = new OutputArea({ rendermime: this.model.widget_manager.rendermime, contentFactory: OutputArea.defaultContentFactory, - model: this.model.outputs + model: this.model.outputs, }); // TODO: why is this a readonly property now? // this._outputView.model = this.model.outputs; diff --git a/jupyterlab_widgets/src/plugin.ts b/jupyterlab_widgets/src/plugin.ts index 773c99e6c7..649d074870 100644 --- a/jupyterlab_widgets/src/plugin.ts +++ b/jupyterlab_widgets/src/plugin.ts @@ -10,12 +10,12 @@ import { INotebookModel, INotebookTracker, Notebook, - NotebookPanel + NotebookPanel, } from '@jupyterlab/notebook'; import { JupyterFrontEndPlugin, - JupyterFrontEnd + JupyterFrontEnd, } from '@jupyterlab/application'; import { IMainMenu } from '@jupyterlab/mainmenu'; @@ -83,7 +83,7 @@ function* outputViews( ): Generator { const linkedViews = filter( app.shell.widgets(), - w => w.id.startsWith('LinkedOutputView-') && (w as any).path === path + (w) => w.id.startsWith('LinkedOutputView-') && (w as any).path === path ); for (const view of toArray(linkedViews)) { for (const outputs of toArray(view.children())) { @@ -112,7 +112,7 @@ export function registerWidgetManager( let wManager = Private.widgetManagerProperty.get(context); if (!wManager) { wManager = new WidgetManager(context, rendermime, SETTINGS); - WIDGET_REGISTRY.forEach(data => wManager!.register(data)); + WIDGET_REGISTRY.forEach((data) => wManager!.register(data)); Private.widgetManagerProperty.set(context, wManager); } @@ -127,7 +127,7 @@ export function registerWidgetManager( { safe: false, mimeTypes: [WIDGET_VIEW_MIMETYPE], - createRenderer: options => new WidgetRenderer(options, wManager) + createRenderer: (options) => new WidgetRenderer(options, wManager), }, 0 ); @@ -149,7 +149,7 @@ const plugin: JupyterFrontEndPlugin = { optional: [INotebookTracker, ISettingRegistry, IMainMenu, ILoggerRegistry], provides: base.IJupyterWidgetRegistry, activate: activateWidgetExtension, - autoStart: true + autoStart: true, }; export default plugin; @@ -190,7 +190,7 @@ function activateWidgetExtension( } const data: nbformat.IOutput = { ...msg.content, - output_type: msg.header.msg_type + output_type: msg.header.msg_type, }; logger.rendermime = nb.content.rendermime; logger.log({ type: 'output', data, level }); @@ -215,13 +215,13 @@ function activateWidgetExtension( { safe: false, mimeTypes: [WIDGET_VIEW_MIMETYPE], - createRenderer: options => new WidgetRenderer(options) + createRenderer: (options) => new WidgetRenderer(options), }, 0 ); if (tracker !== null) { - tracker.forEach(panel => { + tracker.forEach((panel) => { registerWidgetManager( panel.context, panel.content.rendermime, @@ -251,20 +251,20 @@ function activateWidgetExtension( // Add a command for automatically saving (jupyter-)widget state. commands.addCommand('@jupyter-widgets/jupyterlab-manager:saveWidgetState', { label: 'Save Widget State Automatically', - execute: args => { + execute: (args) => { return settingRegistry .set(plugin.id, 'saveState', !SETTINGS.saveState) .catch((reason: Error) => { console.error(`Failed to set ${plugin.id}: ${reason.message}`); }); }, - isToggled: () => SETTINGS.saveState + isToggled: () => SETTINGS.saveState, }); } if (menu) { menu.settingsMenu.addGroup([ - { command: '@jupyter-widgets/jupyterlab-manager:saveWidgetState' } + { command: '@jupyter-widgets/jupyterlab-manager:saveWidgetState' }, ]); } @@ -279,8 +279,8 @@ function activateWidgetExtension( LayoutModel: base.LayoutModel, LayoutView: base.LayoutView, StyleModel: base.StyleModel, - StyleView: base.StyleView - } + StyleView: base.StyleView, + }, }); WIDGET_REGISTRY.push({ @@ -300,19 +300,19 @@ function activateWidgetExtension( '@jupyter-widgets/controls' ); }); - } + }, }); WIDGET_REGISTRY.push({ name: '@jupyter-widgets/output', version: OUTPUT_WIDGET_VERSION, - exports: { OutputModel, OutputView } + exports: { OutputModel, OutputView }, }); return { registerWidget(data: base.IWidgetRegistryData): void { WIDGET_REGISTRY.push(data); - } + }, }; } @@ -325,6 +325,6 @@ namespace Private { WidgetManager | undefined >({ name: 'widgetManager', - create: (owner: DocumentRegistry.Context): undefined => undefined + create: (owner: DocumentRegistry.Context): undefined => undefined, }); } diff --git a/jupyterlab_widgets/src/renderer.ts b/jupyterlab_widgets/src/renderer.ts index 3cedef9104..cd2d854c19 100644 --- a/jupyterlab_widgets/src/renderer.ts +++ b/jupyterlab_widgets/src/renderer.ts @@ -15,7 +15,8 @@ import { DOMWidgetModel } from '@jupyter-widgets/base'; /** * A renderer for widgets. */ -export class WidgetRenderer extends Panel +export class WidgetRenderer + extends Panel implements IRenderMime.IRenderer, IDisposable { constructor(options: IRenderMime.IRendererOptions, manager?: WidgetManager) { super(); diff --git a/package.json b/package.json index 7801831bf6..b5d9292064 100644 --- a/package.json +++ b/package.json @@ -33,15 +33,15 @@ }, "devDependencies": { "@jupyterlab/buildutils": "^3.0.0", - "@typescript-eslint/eslint-plugin": "^2.14.0", - "@typescript-eslint/parser": "^2.14.0", - "eslint": "^6.5.0", - "eslint-config-prettier": "^6.9.0", + "@typescript-eslint/eslint-plugin": "^4.17.0", + "@typescript-eslint/parser": "^4.17.0", + "eslint": "^7.22.0", + "eslint-config-prettier": "^8.1.0", "eslint-plugin-prettier": "^3.3.1", "husky": "^2.3.0", "lerna": "^3.20.2", "lint-staged": "^9.5.0", - "prettier": "^1.19.1", + "prettier": "^2.2.1", "sort-package-json": "~1.35" }, "engines": { diff --git a/yarn.lock b/yarn.lock index e20acfbdb9..3ba5050b13 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,13 @@ # yarn lockfile v1 +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== + dependencies: + "@babel/highlight" "^7.10.4" + "@babel/code-frame@^7.0.0": version "7.12.13" resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" @@ -14,6 +21,15 @@ resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== +"@babel/highlight@^7.10.4": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz#a8b2a66148f5b27d666b15d81774347a731d52d1" + integrity sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg== + dependencies: + "@babel/helper-validator-identifier" "^7.12.11" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/highlight@^7.12.13": version "7.12.13" resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.12.13.tgz#8ab538393e00370b26271b01fa08f7f27f2e795c" @@ -69,10 +85,10 @@ resolved "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.2.tgz#8f03a22a04de437254e8ce8cc84ba39689288752" integrity sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg== -"@eslint/eslintrc@^0.3.0": - version "0.3.0" - resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318" - integrity sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg== +"@eslint/eslintrc@^0.4.0": + version "0.4.0" + resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547" + integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -81,7 +97,6 @@ ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.20" minimatch "^3.0.4" strip-json-comments "^3.1.1" @@ -1714,11 +1729,6 @@ "@types/eslint" "*" "@types/estree" "*" -"@types/eslint-visitor-keys@^1.0.0": - version "1.0.0" - resolved "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" - integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== - "@types/eslint@*": version "7.2.6" resolved "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.6.tgz#5e9aff555a975596c03a98b59ecd103decc70c3c" @@ -1852,49 +1862,76 @@ resolved "https://registry.npmjs.org/@types/wnumb/-/wnumb-1.2.0.tgz#de93478a0d10ea2e27809b5e3fc90ac52c1acd43" integrity sha512-74+3MQqSTrDUtYisxrE8xbrTxmc3pi3G+yr1/TKNrMD7nfXIgUSgYeOu5R7g6Nsn/hl1GxKZ5VW2BuOQg9aLYg== -"@typescript-eslint/eslint-plugin@^2.14.0", "@typescript-eslint/eslint-plugin@^2.27.0": - version "2.34.0" - resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9" - integrity sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ== +"@typescript-eslint/eslint-plugin@^4.17.0": + version "4.17.0" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.17.0.tgz#6f856eca4e6a52ce9cf127dfd349096ad936aa2d" + integrity sha512-/fKFDcoHg8oNan39IKFOb5WmV7oWhQe1K6CDaAVfJaNWEhmfqlA24g+u1lqU5bMH7zuNasfMId4LaYWC5ijRLw== dependencies: - "@typescript-eslint/experimental-utils" "2.34.0" + "@typescript-eslint/experimental-utils" "4.17.0" + "@typescript-eslint/scope-manager" "4.17.0" + debug "^4.1.1" functional-red-black-tree "^1.0.1" + lodash "^4.17.15" regexpp "^3.0.0" + semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.34.0": - version "2.34.0" - resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f" - integrity sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA== +"@typescript-eslint/experimental-utils@4.17.0": + version "4.17.0" + resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.17.0.tgz#762c44aaa1a6a3c05b6d63a8648fb89b89f84c80" + integrity sha512-ZR2NIUbnIBj+LGqCFGQ9yk2EBQrpVVFOh9/Kd0Lm6gLpSAcCuLLe5lUCibKGCqyH9HPwYC0GIJce2O1i8VYmWA== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.34.0" + "@typescript-eslint/scope-manager" "4.17.0" + "@typescript-eslint/types" "4.17.0" + "@typescript-eslint/typescript-estree" "4.17.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^2.14.0", "@typescript-eslint/parser@^2.27.0": - version "2.34.0" - resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8" - integrity sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA== +"@typescript-eslint/parser@^4.17.0": + version "4.17.0" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.17.0.tgz#141b647ffc72ebebcbf9b0fe6087f65b706d3215" + integrity sha512-KYdksiZQ0N1t+6qpnl6JeK9ycCFprS9xBAiIrw4gSphqONt8wydBw4BXJi3C11ywZmyHulvMaLjWsxDjUSDwAw== dependencies: - "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.34.0" - "@typescript-eslint/typescript-estree" "2.34.0" - eslint-visitor-keys "^1.1.0" + "@typescript-eslint/scope-manager" "4.17.0" + "@typescript-eslint/types" "4.17.0" + "@typescript-eslint/typescript-estree" "4.17.0" + debug "^4.1.1" + +"@typescript-eslint/scope-manager@4.17.0": + version "4.17.0" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.17.0.tgz#f4edf94eff3b52a863180f7f89581bf963e3d37d" + integrity sha512-OJ+CeTliuW+UZ9qgULrnGpPQ1bhrZNFpfT/Bc0pzNeyZwMik7/ykJ0JHnQ7krHanFN9wcnPK89pwn84cRUmYjw== + dependencies: + "@typescript-eslint/types" "4.17.0" + "@typescript-eslint/visitor-keys" "4.17.0" -"@typescript-eslint/typescript-estree@2.34.0": - version "2.34.0" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5" - integrity sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg== +"@typescript-eslint/types@4.17.0": + version "4.17.0" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.17.0.tgz#f57d8fc7f31b348db946498a43050083d25f40ad" + integrity sha512-RN5z8qYpJ+kXwnLlyzZkiJwfW2AY458Bf8WqllkondQIcN2ZxQowAToGSd9BlAUZDB5Ea8I6mqL2quGYCLT+2g== + +"@typescript-eslint/typescript-estree@4.17.0": + version "4.17.0" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.17.0.tgz#b835d152804f0972b80dbda92477f9070a72ded1" + integrity sha512-lRhSFIZKUEPPWpWfwuZBH9trYIEJSI0vYsrxbvVvNyIUDoKWaklOAelsSkeh3E2VBSZiNe9BZ4E5tYBZbUczVQ== dependencies: + "@typescript-eslint/types" "4.17.0" + "@typescript-eslint/visitor-keys" "4.17.0" debug "^4.1.1" - eslint-visitor-keys "^1.1.0" - glob "^7.1.6" + globby "^11.0.1" is-glob "^4.0.1" - lodash "^4.17.15" semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/visitor-keys@4.17.0": + version "4.17.0" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.17.0.tgz#9c304cfd20287c14a31d573195a709111849b14d" + integrity sha512-WfuMN8mm5SSqXuAr9NM+fItJ0SVVphobWYkWOwQ1odsfC014Vdxk/92t4JwS1Q6fCA/ABfCKpa3AVtpUKTNKGQ== + dependencies: + "@typescript-eslint/types" "4.17.0" + eslint-visitor-keys "^2.0.0" + "@webassemblyjs/ast@1.11.0": version "1.11.0" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.0.tgz#a5aa679efdc9e51707a4207139da57920555961f" @@ -2223,7 +2260,7 @@ accepts@~1.3.4: mime-types "~2.1.24" negotiator "0.6.2" -acorn-jsx@^5.2.0, acorn-jsx@^5.3.1: +acorn-jsx@^5.3.1: version "5.3.1" resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== @@ -2233,7 +2270,7 @@ acorn@^6.4.1: resolved "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== -acorn@^7.1.1, acorn@^7.4.0: +acorn@^7.4.0: version "7.4.1" resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== @@ -2546,11 +2583,6 @@ assign-symbols@^1.0.0: resolved "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== - astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -4620,14 +4652,12 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" -eslint-config-prettier@^6.10.1, eslint-config-prettier@^6.9.0: - version "6.15.0" - resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" - integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== - dependencies: - get-stdin "^6.0.0" +eslint-config-prettier@^8.1.0: + version "8.1.0" + resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.1.0.tgz#4ef1eaf97afe5176e6a75ddfb57c335121abc5a6" + integrity sha512-oKMhGv3ihGbCIimCAjqkdzx2Q+jthoqnXSP+d86M9tptwugycmTFdVR4IpLgq2c4SHifbwO90z2fQ8/Aio73yw== -eslint-plugin-prettier@^3.1.2, eslint-plugin-prettier@^3.3.1: +eslint-plugin-prettier@^3.3.1: version "3.3.1" resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7" integrity sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ== @@ -4650,13 +4680,6 @@ eslint-scope@^5.0.0, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-utils@^1.4.3: - version "1.4.3" - resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" - integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== - dependencies: - eslint-visitor-keys "^1.1.0" - eslint-utils@^2.0.0, eslint-utils@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" @@ -4674,56 +4697,13 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@^6.5.0: - version "6.8.0" - resolved "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" - integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== - dependencies: - "@babel/code-frame" "^7.0.0" - ajv "^6.10.0" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^4.0.1" - doctrine "^3.0.0" - eslint-scope "^5.0.0" - eslint-utils "^1.4.3" - eslint-visitor-keys "^1.1.0" - espree "^6.1.2" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^5.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^5.0.0" - globals "^12.1.0" - ignore "^4.0.6" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - inquirer "^7.0.0" - is-glob "^4.0.0" - js-yaml "^3.13.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.14" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.3" - progress "^2.0.0" - regexpp "^2.0.1" - semver "^6.1.2" - strip-ansi "^5.2.0" - strip-json-comments "^3.0.1" - table "^5.2.3" - text-table "^0.2.0" - v8-compile-cache "^2.0.3" - -eslint@^7.5.0: - version "7.19.0" - resolved "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz#6719621b196b5fad72e43387981314e5d0dc3f41" - integrity sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg== +eslint@^7.22.0: + version "7.22.0" + resolved "https://registry.npmjs.org/eslint/-/eslint-7.22.0.tgz#07ecc61052fec63661a2cab6bd507127c07adc6f" + integrity sha512-3VawOtjSJUQiiqac8MQc+w457iGLfuNGLFn8JmF051tTKbh5/x/0vlcEj8OgDCaw7Ysa2Jn8paGshV7x2abKXg== dependencies: - "@babel/code-frame" "^7.0.0" - "@eslint/eslintrc" "^0.3.0" + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -4734,12 +4714,12 @@ eslint@^7.5.0: eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" espree "^7.3.1" - esquery "^1.2.0" + esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^6.0.0" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" - globals "^12.1.0" + globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" @@ -4747,7 +4727,7 @@ eslint@^7.5.0: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.20" + lodash "^4.17.21" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -4760,15 +4740,6 @@ eslint@^7.5.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^6.1.2: - version "6.2.1" - resolved "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" - integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== - dependencies: - acorn "^7.1.1" - acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.1.0" - espree@^7.3.0, espree@^7.3.1: version "7.3.1" resolved "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" @@ -4788,10 +4759,10 @@ esprima@^4.0.0: resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.0.1, esquery@^1.2.0: - version "1.3.1" - resolved "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" - integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" @@ -4988,7 +4959,7 @@ fast-glob@^2.2.6: merge2 "^1.2.3" micromatch "^3.1.10" -fast-glob@^3.0.3: +fast-glob@^3.0.3, fast-glob@^3.1.1: version "3.2.5" resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661" integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg== @@ -5049,17 +5020,10 @@ figures@^3.0.0: dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" - integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== - dependencies: - flat-cache "^2.0.1" - -file-entry-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz#7921a89c391c6d93efec2169ac6bf300c527ea0a" - integrity sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" @@ -5177,15 +5141,6 @@ findup-sync@^3.0.0: micromatch "^3.0.4" resolve-dir "^1.0.1" -flat-cache@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" - integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== - dependencies: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" - flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -5577,7 +5532,7 @@ glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.6: +glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@~7.1.6: version "7.1.6" resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -5632,6 +5587,13 @@ globals@^12.1.0: dependencies: type-fest "^0.8.1" +globals@^13.6.0: + version "13.6.0" + resolved "https://registry.npmjs.org/globals/-/globals-13.6.0.tgz#d77138e53738567bb96a3916ff6f6b487af20ef7" + integrity sha512-YFKCX0SiPg7l5oKYCJ2zZGxcXprVXHcSnVuvzrT3oSENQonVLqM5pf9fN5dLGZGyCjhw8TN8Btwe/jKnZ0pjvQ== + dependencies: + type-fest "^0.20.2" + globals@^9.18.0: version "9.18.0" resolved "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -5665,6 +5627,18 @@ globby@10.0.1, globby@^10.0.1: merge2 "^1.2.3" slash "^3.0.0" +globby@^11.0.1: + version "11.0.2" + resolved "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz#1af538b766a3b540ebfb58a32b2e2d5897321d83" + integrity sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" + slash "^3.0.0" + globby@^9.0.0, globby@^9.2.0: version "9.2.0" resolved "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" @@ -6033,7 +6007,7 @@ ignore@^4.0.3, ignore@^4.0.6: resolved "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.1.1: +ignore@^5.1.1, ignore@^5.1.4: version "5.1.8" resolved "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== @@ -6938,14 +6912,6 @@ lerna@^3.20.2: import-local "^2.0.0" npmlog "^4.1.2" -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - levn@^0.4.1: version "0.4.1" resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" @@ -6954,6 +6920,14 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" +levn@~0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -7171,6 +7145,11 @@ lodash@^4.17.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17. resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-symbols@2.2.0, log-symbols@^2.1.0, log-symbols@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" @@ -8246,7 +8225,7 @@ optimist@0.6.x, optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1, optionator@^0.8.3: +optionator@^0.8.1: version "0.8.3" resolved "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== @@ -9214,12 +9193,7 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^1.19.0, prettier@^1.19.1: - version "1.19.1" - resolved "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" - integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== - -prettier@^2.1.1: +prettier@^2.1.1, prettier@^2.2.1: version "2.2.1" resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== @@ -9736,11 +9710,6 @@ regexp.prototype.flags@^1.2.0: call-bind "^1.0.2" define-properties "^1.1.3" -regexpp@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" - integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== - regexpp@^3.0.0, regexpp@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" @@ -9946,7 +9915,7 @@ rgb@~0.1.0: resolved "https://registry.npmjs.org/rgb/-/rgb-0.1.0.tgz#be27b291e8feffeac1bd99729721bfa40fc037b5" integrity sha1-vieykej+/+rBvZlylyG/pA/AN7U= -rimraf@2.6.3, rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: version "2.6.3" resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -10081,7 +10050,7 @@ semver-compare@^1.0.0: resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.1, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -10221,15 +10190,6 @@ slice-ansi@0.0.4: resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= -slice-ansi@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" - integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== - dependencies: - ansi-styles "^3.2.0" - astral-regex "^1.0.0" - is-fullwidth-code-point "^2.0.0" - slice-ansi@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" @@ -10729,7 +10689,7 @@ strip-json-comments@2.0.1, strip-json-comments@~2.0.1: resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= -strip-json-comments@^3.0.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -10812,16 +10772,6 @@ symbol-observable@^1.1.0: resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== -table@^5.2.3: - version "5.4.6" - resolved "https://registry.npmjs.org/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" - integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== - dependencies: - ajv "^6.10.2" - lodash "^4.17.14" - slice-ansi "^2.1.0" - string-width "^3.0.0" - table@^6.0.4: version "6.0.7" resolved "https://registry.npmjs.org/table/-/table-6.0.7.tgz#e45897ffbcc1bcf9e8a87bf420f2c9e5a7a52a34" @@ -11172,6 +11122,11 @@ type-fest@^0.18.0: resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.3.0: version "0.3.1" resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" @@ -11814,13 +11769,6 @@ write-pkg@^3.1.0: sort-keys "^2.0.0" write-json-file "^2.2.0" -write@1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" - integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== - dependencies: - mkdirp "^0.5.1" - ws@^7.2.0: version "7.4.3" resolved "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz#1f9643de34a543b8edb124bdcbc457ae55a6e5cd" From 182f7f89beacf3ae86be7dcb805f13a73d685a2d Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 16:18:17 -0700 Subject: [PATCH 04/13] Upgrade to Typescript 4.3 --- examples/web3/package.json | 2 +- jupyterlab_widgets/package.json | 4 ++-- packages/base-manager/package.json | 6 +++--- packages/base/package.json | 2 +- packages/controls/package.json | 2 +- packages/html-manager/package.json | 2 +- packages/output/package.json | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/web3/package.json b/examples/web3/package.json index de06ed1cee..6fcf2aab5f 100644 --- a/examples/web3/package.json +++ b/examples/web3/package.json @@ -35,7 +35,7 @@ "postcss-loader": "^3.0.0", "rimraf": "^2.6.1", "style-loader": "^1.1.2", - "typescript": "~4.2.3", + "typescript": "~4.3.2", "url-loader": "^3.0.0", "webpack": "^4.41.5" } diff --git a/jupyterlab_widgets/package.json b/jupyterlab_widgets/package.json index cfc5713ff6..3a7607fc2b 100644 --- a/jupyterlab_widgets/package.json +++ b/jupyterlab_widgets/package.json @@ -31,10 +31,10 @@ ], "scripts": { "build": "jlpm run build:lib && jlpm run build:labextension:dev", - "build:prod": "jlpm run build:lib && jlpm run build:labextension", "build:labextension": "jupyter labextension build .", "build:labextension:dev": "jupyter labextension build --development True .", "build:lib": "tsc", + "build:prod": "jlpm run build:lib && jlpm run build:labextension", "clean": "jlpm run clean:lib", "clean:all": "jlpm run clean:lib && jlpm run clean:labextension", "clean:labextension": "rimraf jupyterlab_widgets/labextension", @@ -86,7 +86,7 @@ "npm-run-all": "^4.1.5", "prettier": "^2.2.1", "rimraf": "^3.0.2", - "typescript": "~4.2.3" + "typescript": "~4.3.2" }, "jupyterlab": { "extension": true, diff --git a/packages/base-manager/package.json b/packages/base-manager/package.json index 281a00b1f6..1960a4e41b 100644 --- a/packages/base-manager/package.json +++ b/packages/base-manager/package.json @@ -8,13 +8,13 @@ }, "license": "BSD-3-Clause", "author": "Project Jupyter", + "main": "lib/index.js", + "typings": "lib/index.d.ts", "files": [ "lib/**/*.d.ts", "lib/**/*.js", "css/*.css" ], - "main": "lib/index.js", - "typings": "lib/index.d.ts", "scripts": { "build": "npm run build:src", "build:src": "tsc --build", @@ -62,7 +62,7 @@ "rimraf": "^2.6.1", "sinon": "^7.3.2", "sinon-chai": "^3.3.0", - "typescript": "~4.2.3", + "typescript": "~4.3.2", "webpack": "^4.41.5" }, "publishConfig": { diff --git a/packages/base/package.json b/packages/base/package.json index 33b4ec72e7..8e212bbdbb 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -67,7 +67,7 @@ "rimraf": "^2.6.1", "sinon": "^7.3.2", "sinon-chai": "^3.3.0", - "typescript": "~4.2.3", + "typescript": "~4.3.2", "webpack": "^4.41.5" } } diff --git a/packages/controls/package.json b/packages/controls/package.json index cbf1cc72cb..869ccda100 100644 --- a/packages/controls/package.json +++ b/packages/controls/package.json @@ -77,7 +77,7 @@ "sinon": "^7.3.2", "sinon-chai": "^3.3.0", "style-loader": "^1.1.2", - "typescript": "~4.2.3", + "typescript": "~4.3.2", "url-loader": "^3.0.0", "webpack": "^4.41.5" } diff --git a/packages/html-manager/package.json b/packages/html-manager/package.json index d920e5b305..80dc7d9c5b 100644 --- a/packages/html-manager/package.json +++ b/packages/html-manager/package.json @@ -63,7 +63,7 @@ "mocha": "^6.1.4", "rimraf": "^2.6.1", "style-loader": "^1.1.2", - "typescript": "~4.2.3", + "typescript": "~4.3.2", "url-loader": "^3.0.0", "webpack": "^4.41.5", "webpack-cli": "^3.3.4" diff --git a/packages/output/package.json b/packages/output/package.json index 978fc14110..765641faa6 100644 --- a/packages/output/package.json +++ b/packages/output/package.json @@ -11,12 +11,12 @@ }, "license": "BSD-3-Clause", "author": "Project Jupyter", + "main": "lib/index.js", + "typings": "lib/index.d.ts", "files": [ "lib/**/*.d.ts", "lib/**/*.js" ], - "main": "lib/index.js", - "typings": "lib/index.d.ts", "scripts": { "build": "npm run build:src", "build:src": "tsc --build", @@ -29,6 +29,6 @@ }, "devDependencies": { "rimraf": "^2.6.1", - "typescript": "~4.2.3" + "typescript": "~4.3.2" } } From 4dcc3ca73ca9cd82c30c2df6bb353c44785076cf Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 16:22:02 -0700 Subject: [PATCH 05/13] Fix Typescript compilation errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One convention changed here is that a widget’s _view is now always a DOMWidgetView, and disposal invalidates the typing contract (rather than having to always special-case the disposal case of a null _view). --- jupyterlab_widgets/src/renderer.ts | 12 +------- packages/base-manager/src/manager-base.ts | 8 +++-- packages/base/src/widget.ts | 29 +++++++++---------- .../controls/src/widget_selectioncontainer.ts | 24 +++++++-------- 4 files changed, 30 insertions(+), 43 deletions(-) diff --git a/jupyterlab_widgets/src/renderer.ts b/jupyterlab_widgets/src/renderer.ts index cd2d854c19..d18f79f0db 100644 --- a/jupyterlab_widgets/src/renderer.ts +++ b/jupyterlab_widgets/src/renderer.ts @@ -90,16 +90,6 @@ export class WidgetRenderer }); } - /** - * Get whether the manager is disposed. - * - * #### Notes - * This is a read-only property. - */ - get isDisposed(): boolean { - return this._manager === null; - } - /** * Dispose the resources held by the manager. */ @@ -107,8 +97,8 @@ export class WidgetRenderer if (this.isDisposed) { return; } - super.dispose(); this._manager = null!; + super.dispose(); } private _rerender(): void { diff --git a/packages/base-manager/src/manager-base.ts b/packages/base-manager/src/manager-base.ts index d92a1c1b1b..82ea294bba 100644 --- a/packages/base-manager/src/manager-base.ts +++ b/packages/base-manager/src/manager-base.ts @@ -104,7 +104,9 @@ export abstract class ManagerBase implements IWidgetManager { // This presumes the view is added to the list of model views below view.once('remove', () => { - delete model.views[id]; + if (model.views) { + delete model.views[id]; + } }); return view; @@ -116,7 +118,9 @@ export abstract class ManagerBase implements IWidgetManager { } } )); - model.views[id] = viewPromise; + if (model.views) { + model.views[id] = viewPromise; + } return viewPromise; } diff --git a/packages/base/src/widget.ts b/packages/base/src/widget.ts index fe5103f1b9..da9fb6ba41 100644 --- a/packages/base/src/widget.ts +++ b/packages/base/src/widget.ts @@ -756,16 +756,17 @@ export namespace WidgetView { export namespace JupyterLuminoWidget { export interface IOptions { - view?: DOMWidgetView; + view: DOMWidgetView; } } export class JupyterLuminoWidget extends Widget { constructor(options: Widget.IOptions & JupyterLuminoWidget.IOptions) { const view = options.view; - delete options.view; + // Cast as any since we cannot delete a mandatory value + delete (options as any).view; super(options); - this._view = view ?? null; + this._view = view; } /** @@ -778,10 +779,8 @@ export class JupyterLuminoWidget extends Widget { return; } super.dispose(); - if (this._view) { - this._view.remove(); - } - this._view = null; + this._view.remove(); + this._view = null!; } /** @@ -792,18 +791,18 @@ export class JupyterLuminoWidget extends Widget { */ processMessage(msg: Message): void { super.processMessage(msg); - this._view?.processLuminoMessage(msg); + this._view.processLuminoMessage(msg); } - private _view: DOMWidgetView | null; + private _view: DOMWidgetView; } export class JupyterLuminoPanelWidget extends Panel { constructor(options: JupyterLuminoWidget.IOptions & Panel.IOptions) { const view = options.view; - delete options.view; + delete (options as any).view; super(options); - this._view = view ?? null; + this._view = view; } /** @@ -814,7 +813,7 @@ export class JupyterLuminoPanelWidget extends Panel { */ processMessage(msg: Message): void { super.processMessage(msg); - this._view?.processLuminoMessage(msg); + this._view.processLuminoMessage(msg); } /** @@ -827,13 +826,11 @@ export class JupyterLuminoPanelWidget extends Panel { return; } super.dispose(); - if (this._view) { - this._view.remove(); - } + this._view.remove(); this._view = null!; } - private _view: DOMWidgetView | null; + private _view: DOMWidgetView; } export class DOMWidgetView extends WidgetView { diff --git a/packages/controls/src/widget_selectioncontainer.ts b/packages/controls/src/widget_selectioncontainer.ts index 7e0b59990c..8137d1b769 100644 --- a/packages/controls/src/widget_selectioncontainer.ts +++ b/packages/controls/src/widget_selectioncontainer.ts @@ -53,9 +53,9 @@ export class AccordionModel extends SelectionContainerModel { export class JupyterLuminoAccordionWidget extends Accordion { constructor(options: JupyterLuminoWidget.IOptions & Accordion.IOptions) { const view = options.view; - delete options.view; + delete (options as any).view; super(options); - this._view = view ?? null; + this._view = view; } /** @@ -79,13 +79,11 @@ export class JupyterLuminoAccordionWidget extends Accordion { return; } super.dispose(); - if (this._view) { - this._view.remove(); - } + this._view.remove(); this._view = null!; } - private _view: DOMWidgetView | null; + private _view: DOMWidgetView; } export class AccordionView extends DOMWidgetView { @@ -230,16 +228,16 @@ export class TabModel extends SelectionContainerModel { export class JupyterLuminoTabPanelWidget extends TabPanel { constructor(options: JupyterLuminoWidget.IOptions & TabPanel.IOptions) { const view = options.view; - delete options.view; + delete (options as any).view; super(options); - this._view = view ?? null; + this._view = view; // We want the view's messages to be the messages the tabContents panel // gets. MessageLoop.installMessageHook(this.tabContents, (handler, msg) => { // There may be times when we want the view's handler to be called // *after* the message has been processed by the widget, in which // case we'll need to revisit using a message hook. - this._view?.processLuminoMessage(msg); + this._view.processLuminoMessage(msg); return true; }); } @@ -254,13 +252,11 @@ export class JupyterLuminoTabPanelWidget extends TabPanel { return; } super.dispose(); - if (this._view) { - this._view.remove(); - } - this._view = null; + this._view.remove(); + this._view = null!; } - private _view: DOMWidgetView | null; + private _view: DOMWidgetView; } export class TabView extends DOMWidgetView { From a9a90b1eaf1390110ca1954352d7e9be886f0626 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 16:22:11 -0700 Subject: [PATCH 06/13] Yarn lock update --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 3ba5050b13..43c6fb8f22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11160,16 +11160,16 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= +typescript@^4.3.2: + version "4.3.2" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== + typescript@~4.1.3: version "4.1.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== -typescript@~4.2.3: - version "4.2.3" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" - integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== - typestyle@^2.0.4: version "2.1.0" resolved "https://registry.npmjs.org/typestyle/-/typestyle-2.1.0.tgz#7c5cc567de72cd8bfb686813150b92791aaa7636" From 2912a929b169e397d967c68afe3c9df52b8ffbba Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 16:22:37 -0700 Subject: [PATCH 07/13] Fix for grandparent commit --- jupyterlab_widgets/src/output.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterlab_widgets/src/output.ts b/jupyterlab_widgets/src/output.ts index f703bcf137..aba1f2e535 100644 --- a/jupyterlab_widgets/src/output.ts +++ b/jupyterlab_widgets/src/output.ts @@ -125,7 +125,7 @@ export class OutputModel extends outputBase.OutputModel { export class JupyterLuminoPanelWidget extends Panel { constructor(options: JupyterLuminoWidget.IOptions & Panel.IOptions) { const view = options.view; - delete options.view; + delete (options as any).view; super(options); this._view = view; } From f5a67f8486bb78c5001088e3d87495e23f240457 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 16:27:20 -0700 Subject: [PATCH 08/13] Remove deprecated .pWidget attribute, preferring the new .luminoWidget attribute. --- examples/web2/manager.js | 2 +- examples/web3/src/index.ts | 2 +- jupyterlab_widgets/src/output.ts | 18 +++++++++--------- jupyterlab_widgets/src/renderer.ts | 2 +- packages/base/src/widget.ts | 10 ---------- packages/controls/src/widget_box.ts | 1 - packages/controls/src/widget_controller.ts | 1 - .../controls/src/widget_selectioncontainer.ts | 2 -- packages/html-manager/src/output.ts | 1 - widgetsnbextension/src/extension.js | 2 +- 10 files changed, 13 insertions(+), 28 deletions(-) diff --git a/examples/web2/manager.js b/examples/web2/manager.js index b70e7e0f92..9c39a1f33e 100644 --- a/examples/web2/manager.js +++ b/examples/web2/manager.js @@ -49,7 +49,7 @@ class WidgetManager extends ManagerBase { display_view(view) { var that = this; return Promise.resolve(view).then(function(view) { - LuminoWidget.attach(view.pWidget, that.el); + LuminoWidget.attach(view.luminoWidget, that.el); return view; }); } diff --git a/examples/web3/src/index.ts b/examples/web3/src/index.ts index f1e5fcde80..d3005e3c2f 100644 --- a/examples/web3/src/index.ts +++ b/examples/web3/src/index.ts @@ -63,7 +63,7 @@ document.addEventListener('DOMContentLoaded', async function(event) { const model = await manager.get_model(widgetData.model_id); if (model !== undefined) { const view = await manager.create_view(model); - luminoWidget.Widget.attach(view.pWidget, widgetarea); + luminoWidget.Widget.attach(view.luminoWidget, widgetarea); } } } diff --git a/jupyterlab_widgets/src/output.ts b/jupyterlab_widgets/src/output.ts index aba1f2e535..6b3413e79b 100644 --- a/jupyterlab_widgets/src/output.ts +++ b/jupyterlab_widgets/src/output.ts @@ -162,18 +162,18 @@ export class JupyterLuminoPanelWidget extends Panel { export class OutputView extends outputBase.OutputView { _createElement(tagName: string): HTMLElement { - this.pWidget = new JupyterLuminoPanelWidget({ view: this }); - return this.pWidget.node; + this.luminoWidget = new JupyterLuminoPanelWidget({ view: this }); + return this.luminoWidget.node; } _setElement(el: HTMLElement): void { - if (this.el || el !== this.pWidget.node) { + if (this.el || el !== this.luminoWidget.node) { // Boxes don't allow setting the element beyond the initial creation. throw new Error('Cannot reset the DOM element.'); } - this.el = this.pWidget.node; - this.$el = $(this.pWidget.node); + this.el = this.luminoWidget.node; + this.$el = $(this.luminoWidget.node); } /** @@ -190,10 +190,10 @@ export class OutputView extends outputBase.OutputView { // this._outputView.model = this.model.outputs; // TODO: why is this on the model now? // this._outputView.trusted = true; - this.pWidget.insertWidget(0, this._outputView); + this.luminoWidget.insertWidget(0, this._outputView); - this.pWidget.addClass('jupyter-widgets'); - this.pWidget.addClass('widget-output'); + this.luminoWidget.addClass('jupyter-widgets'); + this.luminoWidget.addClass('widget-output'); this.update(); // Set defaults. } @@ -204,5 +204,5 @@ export class OutputView extends outputBase.OutputView { model: OutputModel; _outputView: OutputArea; - pWidget: Panel; + luminoWidget: Panel; } diff --git a/jupyterlab_widgets/src/renderer.ts b/jupyterlab_widgets/src/renderer.ts index d18f79f0db..aed73c09cd 100644 --- a/jupyterlab_widgets/src/renderer.ts +++ b/jupyterlab_widgets/src/renderer.ts @@ -70,7 +70,7 @@ export class WidgetRenderer let widget: LuminoWidget; try { - widget = (await manager.create_view(wModel)).pWidget; + widget = (await manager.create_view(wModel)).luminoWidget; } catch (err) { this.node.textContent = 'Error displaying widget'; this.addClass('jupyter-widgets'); diff --git a/packages/base/src/widget.ts b/packages/base/src/widget.ts index da9fb6ba41..3fc5bc5353 100644 --- a/packages/base/src/widget.ts +++ b/packages/base/src/widget.ts @@ -881,16 +881,6 @@ export class DOMWidgetView extends WidgetView { this.updateTooltip(); } - /** - * Getter for backward compatibility. - * - * pWidget is deprecated and will be removed in the future, - * please use luminoWidget instead. - */ - get pWidget(): Widget { - return this.luminoWidget; - } - setLayout(layout: LayoutModel, oldLayout?: LayoutModel): void { if (layout) { this.layoutPromise = this.layoutPromise.then(oldLayoutView => { diff --git a/packages/controls/src/widget_box.ts b/packages/controls/src/widget_box.ts index 2c97fda6d5..e80f279e6d 100644 --- a/packages/controls/src/widget_box.ts +++ b/packages/controls/src/widget_box.ts @@ -136,7 +136,6 @@ export class BoxView extends DOMWidgetView { } children_views: ViewList | null; - pWidget: JupyterLuminoPanelWidget; luminoWidget: JupyterLuminoPanelWidget; static class_map = { diff --git a/packages/controls/src/widget_controller.ts b/packages/controls/src/widget_controller.ts index ba78bc38a5..5bc303f206 100644 --- a/packages/controls/src/widget_controller.ts +++ b/packages/controls/src/widget_controller.ts @@ -429,6 +429,5 @@ export class ControllerView extends DOMWidgetView { axis_box: Panel; button_box: Panel; model: ControllerModel; - pWidget: JupyterLuminoPanelWidget; luminoWidget: JupyterLuminoPanelWidget; } diff --git a/packages/controls/src/widget_selectioncontainer.ts b/packages/controls/src/widget_selectioncontainer.ts index 8137d1b769..b44f7375e7 100644 --- a/packages/controls/src/widget_selectioncontainer.ts +++ b/packages/controls/src/widget_selectioncontainer.ts @@ -207,7 +207,6 @@ export class AccordionView extends DOMWidgetView { } children_views: ViewList | null; - pWidget: Accordion; luminoWidget: Accordion; updatingChildren: boolean; } @@ -420,7 +419,6 @@ export class TabView extends DOMWidgetView { updatingTabs = false; childrenViews: ViewList | null; - pWidget: JupyterLuminoTabPanelWidget; luminoWidget: JupyterLuminoTabPanelWidget; } diff --git a/packages/html-manager/src/output.ts b/packages/html-manager/src/output.ts index dc4f0a0ffc..a9e602a1e3 100644 --- a/packages/html-manager/src/output.ts +++ b/packages/html-manager/src/output.ts @@ -69,6 +69,5 @@ export class OutputView extends outputBase.OutputView { model: OutputModel; private _outputView: OutputArea; - pWidget: Panel; luminoWidget: Panel; } diff --git a/widgetsnbextension/src/extension.js b/widgetsnbextension/src/extension.js index f9c24ffc36..dd65ba6ab5 100644 --- a/widgetsnbextension/src/extension.js +++ b/widgetsnbextension/src/extension.js @@ -134,7 +134,7 @@ function register_events(Jupyter, events, outputarea) { output._jupyterWidgetViews = output._jupyterWidgetViews || []; output._jupyterWidgetViews.push(id); views[id] = view; - LuminoWidget.Widget.attach(view.pWidget, node); + LuminoWidget.Widget.attach(view.luminoWidget, node); // Make the node completely disappear if the view is removed. view.once('remove', () => { From 9fab881e5b8854ad53a79435f2d6629aa38be8e1 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 16:27:38 -0700 Subject: [PATCH 09/13] Typo fix --- packages/controls/src/widget_string.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/controls/src/widget_string.ts b/packages/controls/src/widget_string.ts index ec59eab997..37848bd370 100644 --- a/packages/controls/src/widget_string.ts +++ b/packages/controls/src/widget_string.ts @@ -8,7 +8,7 @@ import { DescriptionView } from './widget_description'; import { uuid } from './utils'; /** - * Class name for a combobox with an invlid value. + * Class name for a combobox with an invalid value. */ const INVALID_VALUE_CLASS = 'jpwidgets-invalidComboValue'; From a342e0dbc7c779bb668e5a21c097d7cec9a6ac44 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 17:31:15 -0700 Subject: [PATCH 10/13] Fix the tagName typescript error. We had to upgrade backbone to get the new preinitialize method, so we can properly initialize the tagName. --- packages/base/package.json | 2 +- packages/controls/src/widget_audio.ts | 14 +++----------- packages/controls/src/widget_bool.ts | 14 +++----------- packages/controls/src/widget_button.ts | 14 +++----------- packages/controls/src/widget_image.ts | 14 +++----------- packages/controls/src/widget_tagsinput.ts | 14 +++----------- packages/controls/src/widget_upload.ts | 5 +++-- packages/controls/src/widget_video.ts | 14 +++----------- widgetsnbextension/package.json | 2 +- 9 files changed, 23 insertions(+), 70 deletions(-) diff --git a/packages/base/package.json b/packages/base/package.json index 8e212bbdbb..3cca93e9d9 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -38,7 +38,7 @@ "@lumino/widgets": "^1.3.0", "@types/backbone": "1.4.1", "@types/lodash": "^4.14.134", - "backbone": "1.2.3", + "backbone": "1.4.0", "jquery": "^3.1.1", "lodash": "^4.17.4" }, diff --git a/packages/controls/src/widget_audio.ts b/packages/controls/src/widget_audio.ts index 96c8628d9c..ff002f7053 100644 --- a/packages/controls/src/widget_audio.ts +++ b/packages/controls/src/widget_audio.ts @@ -81,17 +81,9 @@ export class AudioView extends DOMWidgetView { super.remove(); } - /** - * The default tag name. - * - * #### Notes - * This is a read-only attribute. - */ - get tagName(): string { - // We can't make this an attribute with a default value - // since it would be set after it is needed in the - // constructor. - return 'audio'; + preinitialize() { + // Must set this before the initialize method creates the element + this.tagName = 'audio'; } el: HTMLAudioElement; diff --git a/packages/controls/src/widget_bool.ts b/packages/controls/src/widget_bool.ts index 52a906da9a..3f8afbd504 100644 --- a/packages/controls/src/widget_bool.ts +++ b/packages/controls/src/widget_bool.ts @@ -262,17 +262,9 @@ export class ToggleButtonView extends DOMWidgetView { this.touch(); } - /** - * The default tag name. - * - * #### Notes - * This is a read-only attribute. - */ - get tagName(): string { - // We can't make this an attribute with a default value - // since it would be set after it is needed in the - // constructor. - return 'button'; + preinitialize() { + // Must set this before the initialize method creates the element + this.tagName = 'button'; } el: HTMLButtonElement; diff --git a/packages/controls/src/widget_button.ts b/packages/controls/src/widget_button.ts index 9efee0e5d5..faad16d2a4 100644 --- a/packages/controls/src/widget_button.ts +++ b/packages/controls/src/widget_button.ts @@ -121,17 +121,9 @@ export class ButtonView extends DOMWidgetView { this.send({ event: 'click' }); } - /** - * The default tag name. - * - * #### Notes - * This is a read-only attribute. - */ - get tagName(): string { - // We can't make this an attribute with a default value - // since it would be set after it is needed in the - // constructor. - return 'button'; + preinitialize() { + // Must set this before the initialize method creates the element + this.tagName = 'button'; } el: HTMLButtonElement; diff --git a/packages/controls/src/widget_image.ts b/packages/controls/src/widget_image.ts index 1e24f8518c..c2f033a1f7 100644 --- a/packages/controls/src/widget_image.ts +++ b/packages/controls/src/widget_image.ts @@ -88,17 +88,9 @@ export class ImageView extends DOMWidgetView { super.remove(); } - /** - * The default tag name. - * - * #### Notes - * This is a read-only attribute. - */ - get tagName(): string { - // We can't make this an attribute with a default value - // since it would be set after it is needed in the - // constructor. - return 'img'; + preinitialize() { + // Must set this before the initialize method creates the element + this.tagName = 'img'; } el: HTMLImageElement; diff --git a/packages/controls/src/widget_tagsinput.ts b/packages/controls/src/widget_tagsinput.ts index 229317abf3..423c94da44 100644 --- a/packages/controls/src/widget_tagsinput.ts +++ b/packages/controls/src/widget_tagsinput.ts @@ -538,17 +538,9 @@ abstract class TagsInputBaseView extends DOMWidgetView { this.updateTags(); } - /** - * The default tag name. - * - * #### Notes - * This is a read-only attribute. - */ - get tagName(): string { - // We can't make this an attribute with a default value - // since it would be set after it is needed in the - // constructor. - return 'div'; + preinitialize() { + // Must set this before the initialize method creates the element + this.tagName = 'div'; } /** diff --git a/packages/controls/src/widget_upload.ts b/packages/controls/src/widget_upload.ts index 73d93ad18a..dc93137d4a 100644 --- a/packages/controls/src/widget_upload.ts +++ b/packages/controls/src/widget_upload.ts @@ -41,8 +41,9 @@ export class FileUploadView extends DOMWidgetView { el: HTMLButtonElement; fileInput: HTMLInputElement; - get tagName(): string { - return 'button'; + preinitialize() { + // Must set this before the initialize method creates the element + this.tagName = 'button'; } render(): void { diff --git a/packages/controls/src/widget_video.ts b/packages/controls/src/widget_video.ts index 6a58752bc0..e25bd40354 100644 --- a/packages/controls/src/widget_video.ts +++ b/packages/controls/src/widget_video.ts @@ -99,17 +99,9 @@ export class VideoView extends DOMWidgetView { super.remove(); } - /** - * The default tag name. - * - * #### Notes - * This is a read-only attribute. - */ - get tagName(): string { - // We can't make this an attribute with a default value - // since it would be set after it is needed in the - // constructor. - return 'video'; + preinitialize() { + // Must set this before the initialize method creates the element + this.tagName = 'video'; } el: HTMLVideoElement; diff --git a/widgetsnbextension/package.json b/widgetsnbextension/package.json index 1107d42bd1..a467bfce15 100644 --- a/widgetsnbextension/package.json +++ b/widgetsnbextension/package.json @@ -29,7 +29,7 @@ "@jupyterlab/services": "^6.0.0", "@lumino/messaging": "^1.3.3", "@lumino/widgets": "^1.11.1", - "backbone": "1.2.3" + "backbone": "1.4.0" }, "devDependencies": { "css-loader": "^3.4.0", From f25c81807f8a0d9df3bf08d9c890f0afa31b7be1 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 17:31:22 -0700 Subject: [PATCH 11/13] Update yarn.lock --- yarn.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 43c6fb8f22..961084d516 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2731,12 +2731,12 @@ babylon@^6.18.0: resolved "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== -backbone@1.2.3: - version "1.2.3" - resolved "https://registry.npmjs.org/backbone/-/backbone-1.2.3.tgz#c22cfd07fc86ebbeae61d18929ed115e999d65b9" - integrity sha1-wiz9B/yG676uYdGJKe0RXpmdZbk= +backbone@1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/backbone/-/backbone-1.4.0.tgz#54db4de9df7c3811c3f032f34749a4cd27f3bd12" + integrity sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ== dependencies: - underscore ">=1.7.0" + underscore ">=1.8.3" backo2@1.0.2: version "1.0.2" @@ -11160,16 +11160,16 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^4.3.2: - version "4.3.2" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" - integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== - typescript@~4.1.3: version "4.1.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== +typescript@~4.3.2: + version "4.3.2" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== + typestyle@^2.0.4: version "2.1.0" resolved "https://registry.npmjs.org/typestyle/-/typestyle-2.1.0.tgz#7c5cc567de72cd8bfb686813150b92791aaa7636" @@ -11198,10 +11198,10 @@ umask@^1.1.0: resolved "https://registry.npmjs.org/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d" integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0= -underscore@>=1.7.0: - version "1.12.0" - resolved "https://registry.npmjs.org/underscore/-/underscore-1.12.0.tgz#4814940551fc80587cef7840d1ebb0f16453be97" - integrity sha512-21rQzss/XPMjolTiIezSu3JAjgagXKROtNrYFEOWK109qY1Uv2tVjPTZ1ci2HgvQDA16gHYSthQIJfB+XId/rQ== +underscore@>=1.8.3: + version "1.13.1" + resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz#0c1c6bd2df54b6b69f2314066d65b6cde6fcf9d1" + integrity sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g== union-value@^1.0.0: version "1.0.1" From 20ee4e6a49a3f9e685778c5c68ecb71c6825a274 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 18:14:29 -0700 Subject: [PATCH 12/13] Fix lint error --- jupyterlab_widgets/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterlab_widgets/src/index.ts b/jupyterlab_widgets/src/index.ts index 12e6e021fc..eb40b5522f 100644 --- a/jupyterlab_widgets/src/index.ts +++ b/jupyterlab_widgets/src/index.ts @@ -11,7 +11,7 @@ export { registerWidgetManager } from './plugin'; export { KernelWidgetManager, LabWidgetManager, - WidgetManager + WidgetManager, } from './manager'; export { WidgetRenderer } from './renderer'; From 1520db861b24a96ff626bb174831a7a04d128f36 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 8 Jun 2021 23:25:25 -0700 Subject: [PATCH 13/13] Fix pWidget reference in web1 example. --- examples/web1/index.html | 1 + examples/web1/manager.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/web1/index.html b/examples/web1/index.html index 8ef7b78562..6c4c2e8d81 100644 --- a/examples/web1/index.html +++ b/examples/web1/index.html @@ -1,5 +1,6 @@ + diff --git a/examples/web1/manager.js b/examples/web1/manager.js index 6a6e7e7dd1..01359d8379 100644 --- a/examples/web1/manager.js +++ b/examples/web1/manager.js @@ -49,7 +49,7 @@ class WidgetManager extends ManagerBase { display_view(view) { var that = this; return Promise.resolve(view).then(view => { - LuminoWidget.attach(view.pWidget, that.el); + LuminoWidget.attach(view.luminoWidget, that.el); return view; }); }