@jupyter-notebook/application 7.7.0-alpha.0 → 7.7.0-alpha.1

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.
package/lib/shell.d.ts CHANGED
@@ -168,6 +168,14 @@ export declare class NotebookShell extends Widget implements JupyterFrontEnd.ISh
168
168
  * Handle a change on the down panel widgets
169
169
  */
170
170
  private _onTabPanelChanged;
171
+ /**
172
+ * Show the down panel, restoring its previous relative size.
173
+ */
174
+ private _showDownPanel;
175
+ /**
176
+ * Hide the down panel, saving its relative size to restore it later.
177
+ */
178
+ private _hideDownPanel;
171
179
  private _topWrapper;
172
180
  private _topHandler;
173
181
  private _menuWrapper;
@@ -178,7 +186,9 @@ export declare class NotebookShell extends Widget implements JupyterFrontEnd.ISh
178
186
  private _spacer_bottom;
179
187
  private _skipLinkWidgetHandler;
180
188
  private _main;
189
+ private _vsplitPanel;
181
190
  private _downPanel;
191
+ private _lastDownAreaSize;
182
192
  private _translator;
183
193
  private _currentChanged;
184
194
  private _mainWidgetLoaded;
package/lib/shell.js CHANGED
@@ -7,6 +7,10 @@ import { Signal } from '@lumino/signaling';
7
7
  import { BoxLayout, Panel, SplitPanel, Widget, } from '@lumino/widgets';
8
8
  import { PanelHandler, SidePanelHandler } from './panelhandler';
9
9
  import { TabPanelSvg } from '@jupyterlab/ui-components';
10
+ /**
11
+ * The default relative size of the down area when it is expanded.
12
+ */
13
+ const DEFAULT_DOWN_AREA_SIZE = 0.25;
10
14
  /**
11
15
  * The Jupyter Notebook application shell token.
12
16
  */
@@ -21,6 +25,7 @@ const DEFAULT_RANK = 900;
21
25
  export class NotebookShell extends Widget {
22
26
  constructor() {
23
27
  super();
28
+ this._lastDownAreaSize = DEFAULT_DOWN_AREA_SIZE;
24
29
  this._translator = nullTranslator;
25
30
  this._currentChanged = new Signal(this);
26
31
  this._mainWidgetLoaded = new PromiseDelegate();
@@ -73,6 +78,7 @@ export class NotebookShell extends Widget {
73
78
  middlePanel.addWidget(this._spacer_bottom);
74
79
  middlePanel.layout = middleLayout;
75
80
  const vsplitPanel = new SplitPanel();
81
+ this._vsplitPanel = vsplitPanel;
76
82
  vsplitPanel.id = 'jp-main-vsplit-panel';
77
83
  vsplitPanel.spacing = 1;
78
84
  vsplitPanel.orientation = 'vertical';
@@ -82,6 +88,7 @@ export class NotebookShell extends Widget {
82
88
  });
83
89
  this._downPanel = downPanel;
84
90
  this._downPanel.id = 'jp-down-stack';
91
+ SplitPanel.setStretch(downPanel, 0);
85
92
  // TODO: Consider storing this as an attribute this._hsplitPanel if saving/restoring layout needed
86
93
  const hsplitPanel = new SplitPanel();
87
94
  hsplitPanel.id = 'main-split-panel';
@@ -204,8 +211,14 @@ export class NotebookShell extends Widget {
204
211
  this.expandRight(id);
205
212
  }
206
213
  else if (area === 'down') {
207
- this._downPanel.show();
208
- widget.activate();
214
+ const tabIndex = this._downPanel.tabBar.titles.findIndex((title) => title.owner.id === id);
215
+ if (tabIndex >= 0) {
216
+ this._downPanel.currentIndex = tabIndex;
217
+ if (this._downPanel.isHidden) {
218
+ this._showDownPanel();
219
+ }
220
+ widget.activate();
221
+ }
209
222
  }
210
223
  else {
211
224
  widget.activate();
@@ -417,9 +430,31 @@ export class NotebookShell extends Widget {
417
430
  */
418
431
  _onTabPanelChanged() {
419
432
  if (this._downPanel.stackedPanel.widgets.length === 0) {
420
- this._downPanel.hide();
433
+ this._hideDownPanel();
421
434
  }
422
435
  }
436
+ /**
437
+ * Show the down panel, restoring its previous relative size.
438
+ */
439
+ _showDownPanel(size = this._lastDownAreaSize) {
440
+ const downSize = size > 0.0 ? size : DEFAULT_DOWN_AREA_SIZE;
441
+ this._lastDownAreaSize = downSize;
442
+ this._vsplitPanel.setRelativeSizes([
443
+ Math.max(1.0 - downSize, 0.0),
444
+ downSize,
445
+ ]);
446
+ this._downPanel.show();
447
+ }
448
+ /**
449
+ * Hide the down panel, saving its relative size to restore it later.
450
+ */
451
+ _hideDownPanel() {
452
+ const size = this._vsplitPanel.relativeSizes()[1];
453
+ if (size > 0.0) {
454
+ this._lastDownAreaSize = size;
455
+ }
456
+ this._downPanel.hide();
457
+ }
423
458
  }
424
459
  export var Private;
425
460
  (function (Private) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/application",
3
- "version": "7.7.0-alpha.0",
3
+ "version": "7.7.0-alpha.1",
4
4
  "description": "Jupyter Notebook - Application",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -42,11 +42,11 @@
42
42
  "watch": "tsc -b --watch"
43
43
  },
44
44
  "dependencies": {
45
- "@jupyterlab/application": "~4.7.0-alpha.0",
46
- "@jupyterlab/coreutils": "~6.7.0-alpha.0",
47
- "@jupyterlab/docregistry": "~4.7.0-alpha.0",
48
- "@jupyterlab/rendermime-interfaces": "~3.15.0-alpha.0",
49
- "@jupyterlab/ui-components": "~4.7.0-alpha.0",
45
+ "@jupyterlab/application": "~4.7.0-alpha.1",
46
+ "@jupyterlab/coreutils": "~6.7.0-alpha.1",
47
+ "@jupyterlab/docregistry": "~4.7.0-alpha.1",
48
+ "@jupyterlab/rendermime-interfaces": "~3.15.0-alpha.1",
49
+ "@jupyterlab/ui-components": "~4.7.0-alpha.1",
50
50
  "@lumino/algorithm": "^2.0.4",
51
51
  "@lumino/coreutils": "^2.2.2",
52
52
  "@lumino/messaging": "^2.0.4",
@@ -57,7 +57,7 @@
57
57
  "devDependencies": {
58
58
  "@babel/core": "^7.29.6",
59
59
  "@babel/preset-env": "^7.12.1",
60
- "@jupyterlab/testutils": "~4.7.0-alpha.0",
60
+ "@jupyterlab/testutils": "~4.7.0-alpha.1",
61
61
  "@types/jest": "^29.2.5",
62
62
  "jest": "^29.3.1",
63
63
  "rimraf": "^3.0.2",