From a1e0724aca0ec708ad17fcb447ece74fcb44d144 Mon Sep 17 00:00:00 2001 From: Mario Buikhuizen Date: Wed, 26 Jan 2022 15:14:53 +0100 Subject: [PATCH 1/2] feat: backward compatibility with 7.x This way widget libraries accessing JupyterPhosphorWidget and/or pWidget can run with 8.x without making a 7.x incompatible build. --- packages/base/src/widget.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/base/src/widget.ts b/packages/base/src/widget.ts index 376ee23f57..a9107d2041 100644 --- a/packages/base/src/widget.ts +++ b/packages/base/src/widget.ts @@ -885,6 +885,11 @@ export class JupyterLuminoWidget extends Widget { private _view: DOMWidgetView; } +/** + * @deprecated Use {@link JupyterLuminoWidget} instead (Since 8.0). + */ +export const JupyterPhosphorWidget = JupyterLuminoWidget; + export class JupyterLuminoPanelWidget extends Panel { constructor(options: JupyterLuminoWidget.IOptions & Panel.IOptions) { const view = options.view; @@ -1167,9 +1172,24 @@ export class DOMWidgetView extends WidgetView { this.el.removeAttribute('tabIndex'); } } + + /** + * @deprecated Use {@link luminoWidget} instead (Since 8.0). + */ + get pWidget(): Widget { + if (!DOMWidgetView.deprecationWarningDisplayed) { + console.warn( + 'The use of pWidget is deprecated, use luminoWidget instead.' + ); + DOMWidgetView.deprecationWarningDisplayed = true; + } + return this.luminoWidget; + } + el: HTMLElement; // Override typing '$el': any; luminoWidget: Widget; layoutPromise: Promise; stylePromise: Promise; + private static deprecationWarningDisplayed = false; } From 9e455852cdcff5912a23d34bb68f3cebe87eaf09 Mon Sep 17 00:00:00 2001 From: Mario Buikhuizen Date: Thu, 27 Jan 2022 12:48:45 +0100 Subject: [PATCH 2/2] fix: remove deprecation warning form console --- packages/base/src/widget.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/base/src/widget.ts b/packages/base/src/widget.ts index a9107d2041..f57110a312 100644 --- a/packages/base/src/widget.ts +++ b/packages/base/src/widget.ts @@ -1177,12 +1177,6 @@ export class DOMWidgetView extends WidgetView { * @deprecated Use {@link luminoWidget} instead (Since 8.0). */ get pWidget(): Widget { - if (!DOMWidgetView.deprecationWarningDisplayed) { - console.warn( - 'The use of pWidget is deprecated, use luminoWidget instead.' - ); - DOMWidgetView.deprecationWarningDisplayed = true; - } return this.luminoWidget; } @@ -1191,5 +1185,4 @@ export class DOMWidgetView extends WidgetView { luminoWidget: Widget; layoutPromise: Promise; stylePromise: Promise; - private static deprecationWarningDisplayed = false; }