@jupyter-notebook/application 7.0.0-alpha.11 → 7.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,6 +60,10 @@ export declare class SidePanelHandler extends PanelHandler {
60
60
  * Signal fired when a widget is removed from the panel
61
61
  */
62
62
  get widgetRemoved(): ISignal<SidePanelHandler, Widget>;
63
+ /**
64
+ * Get the close button element.
65
+ */
66
+ get closeButton(): HTMLButtonElement;
63
67
  /**
64
68
  * Expand the sidebar.
65
69
  *
@@ -118,6 +122,7 @@ export declare class SidePanelHandler extends PanelHandler {
118
122
  private _widgetPanel;
119
123
  private _currentWidget;
120
124
  private _lastCurrentWidget;
125
+ private _closeButton;
121
126
  private _widgetAdded;
122
127
  private _widgetRemoved;
123
128
  }
@@ -67,18 +67,19 @@ export class SidePanelHandler extends PanelHandler {
67
67
  this._lastCurrentWidget = null;
68
68
  this._widgetPanel = new StackedPanel();
69
69
  this._widgetPanel.widgetRemoved.connect(this._onWidgetRemoved, this);
70
- const closeButton = document.createElement('button');
70
+ this._closeButton = document.createElement('button');
71
71
  closeIcon.element({
72
- container: closeButton,
72
+ container: this._closeButton,
73
73
  height: '16px',
74
74
  width: 'auto'
75
75
  });
76
- closeButton.onclick = () => {
76
+ this._closeButton.onclick = () => {
77
77
  this.collapse();
78
78
  this.hide();
79
79
  };
80
- closeButton.className = 'jp-Button jp-SidePanel-collapse';
81
- const icon = new Widget({ node: closeButton });
80
+ this._closeButton.className = 'jp-Button jp-SidePanel-collapse';
81
+ this._closeButton.title = 'Collapse side panel';
82
+ const icon = new Widget({ node: this._closeButton });
82
83
  this._panel.addWidget(icon);
83
84
  this._panel.addWidget(this._widgetPanel);
84
85
  }
@@ -126,6 +127,12 @@ export class SidePanelHandler extends PanelHandler {
126
127
  get widgetRemoved() {
127
128
  return this._widgetRemoved;
128
129
  }
130
+ /**
131
+ * Get the close button element.
132
+ */
133
+ get closeButton() {
134
+ return this._closeButton;
135
+ }
129
136
  /**
130
137
  * Expand the sidebar.
131
138
  *
package/lib/shell.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { JupyterFrontEnd } from '@jupyterlab/application';
2
2
  import { DocumentRegistry } from '@jupyterlab/docregistry';
3
+ import { ITranslator } from '@jupyterlab/translation';
3
4
  import { Token } from '@lumino/coreutils';
4
5
  import { ISignal } from '@lumino/signaling';
5
6
  import { Widget } from '@lumino/widgets';
@@ -54,6 +55,11 @@ export declare class NotebookShell extends Widget implements JupyterFrontEnd.ISh
54
55
  * Promise that resolves when the main widget is loaded
55
56
  */
56
57
  get restored(): Promise<void>;
58
+ /**
59
+ * Getter and setter for the translator.
60
+ */
61
+ get translator(): ITranslator;
62
+ set translator(value: ITranslator);
57
63
  /**
58
64
  * Activate a widget in its area.
59
65
  */
@@ -108,6 +114,7 @@ export declare class NotebookShell extends Widget implements JupyterFrontEnd.ISh
108
114
  private _rightHandler;
109
115
  private _spacer;
110
116
  private _main;
117
+ private _translator;
111
118
  private _currentChanged;
112
119
  private _mainWidgetLoaded;
113
120
  }
package/lib/shell.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
+ import { nullTranslator } from '@jupyterlab/translation';
3
4
  import { find } from '@lumino/algorithm';
4
5
  import { PromiseDelegate, Token } from '@lumino/coreutils';
5
6
  import { Signal } from '@lumino/signaling';
@@ -19,6 +20,7 @@ const DEFAULT_RANK = 900;
19
20
  export class NotebookShell extends Widget {
20
21
  constructor() {
21
22
  super();
23
+ this._translator = nullTranslator;
22
24
  this._currentChanged = new Signal(this);
23
25
  this._mainWidgetLoaded = new PromiseDelegate();
24
26
  this.id = 'main';
@@ -30,8 +32,11 @@ export class NotebookShell extends Widget {
30
32
  const topWrapper = (this._topWrapper = new Panel());
31
33
  const menuWrapper = (this._menuWrapper = new Panel());
32
34
  this._topHandler.panel.id = 'top-panel';
35
+ this._topHandler.panel.node.setAttribute('role', 'banner');
33
36
  this._menuHandler.panel.id = 'menu-panel';
37
+ this._menuHandler.panel.node.setAttribute('role', 'navigation');
34
38
  this._main.id = 'main-panel';
39
+ this._main.node.setAttribute('role', 'main');
35
40
  this._spacer = new Widget();
36
41
  this._spacer.id = 'spacer-widget';
37
42
  // create wrappers around the top and menu areas
@@ -43,7 +48,9 @@ export class NotebookShell extends Widget {
43
48
  const leftHandler = this._leftHandler;
44
49
  const rightHandler = this._rightHandler;
45
50
  leftHandler.panel.id = 'jp-left-stack';
51
+ leftHandler.panel.node.setAttribute('role', 'complementary');
46
52
  rightHandler.panel.id = 'jp-right-stack';
53
+ rightHandler.panel.node.setAttribute('role', 'complementary');
47
54
  // Hide the side panels by default.
48
55
  leftHandler.hide();
49
56
  rightHandler.hide();
@@ -134,6 +141,21 @@ export class NotebookShell extends Widget {
134
141
  get restored() {
135
142
  return this._mainWidgetLoaded.promise;
136
143
  }
144
+ /**
145
+ * Getter and setter for the translator.
146
+ */
147
+ get translator() {
148
+ var _a;
149
+ return (_a = this._translator) !== null && _a !== void 0 ? _a : nullTranslator;
150
+ }
151
+ set translator(value) {
152
+ if (value !== this._translator) {
153
+ this._translator = value;
154
+ const trans = value.load('notebook');
155
+ this._leftHandler.closeButton.title = trans.__('Collapse %1 side panel', this._leftHandler.area);
156
+ this._rightHandler.closeButton.title = trans.__('Collapse %1 side panel', this._rightHandler.area);
157
+ }
158
+ }
137
159
  /**
138
160
  * Activate a widget in its area.
139
161
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/application",
3
- "version": "7.0.0-alpha.11",
3
+ "version": "7.0.0-alpha.13",
4
4
  "description": "Jupyter Notebook - Application",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -43,22 +43,22 @@
43
43
  "watch": "tsc -b --watch"
44
44
  },
45
45
  "dependencies": {
46
- "@jupyterlab/application": "^4.0.0-alpha.17",
47
- "@jupyterlab/coreutils": "^6.0.0-alpha.17",
48
- "@jupyterlab/docregistry": "^4.0.0-alpha.17",
49
- "@jupyterlab/rendermime-interfaces": "^3.8.0-alpha.17",
50
- "@jupyterlab/ui-components": "^4.0.0-alpha.32",
51
- "@lumino/algorithm": "^2.0.0-alpha.7",
52
- "@lumino/coreutils": "^2.0.0-alpha.7",
53
- "@lumino/messaging": "^2.0.0-alpha.7",
54
- "@lumino/polling": "^2.0.0-alpha.7",
55
- "@lumino/signaling": "^2.0.0-alpha.7",
56
- "@lumino/widgets": "^2.0.0-alpha.7"
46
+ "@jupyterlab/application": "^4.0.0-alpha.19",
47
+ "@jupyterlab/coreutils": "^6.0.0-alpha.19",
48
+ "@jupyterlab/docregistry": "^4.0.0-alpha.19",
49
+ "@jupyterlab/rendermime-interfaces": "^3.8.0-alpha.19",
50
+ "@jupyterlab/ui-components": "^4.0.0-alpha.34",
51
+ "@lumino/algorithm": "^2.0.0-beta.0",
52
+ "@lumino/coreutils": "^2.0.0-beta.0",
53
+ "@lumino/messaging": "^2.0.0-beta.0",
54
+ "@lumino/polling": "^2.0.0-beta.1",
55
+ "@lumino/signaling": "^2.0.0-beta.1",
56
+ "@lumino/widgets": "^2.0.0-beta.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/core": "^7.11.6",
60
60
  "@babel/preset-env": "^7.12.1",
61
- "@jupyterlab/testutils": "^4.0.0-alpha.17",
61
+ "@jupyterlab/testutils": "^4.0.0-alpha.19",
62
62
  "@types/jest": "^29.2.5",
63
63
  "jest": "^29.3.1",
64
64
  "rimraf": "^3.0.2",