@jupyter-notebook/application-extension 7.0.0-alpha.8 → 7.0.0-beta.0

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- import { ILabStatus, IRouter, ITreePathUpdater, JupyterFrontEnd } from '@jupyterlab/application';
4
- import { sessionContextDialogs, ISessionContextDialogs, DOMUtils, ICommandPalette, IToolbarWidgetRegistry } from '@jupyterlab/apputils';
3
+ import { ILabStatus, IRouter, ITreePathUpdater, JupyterFrontEnd, } from '@jupyterlab/application';
4
+ import { DOMUtils, ICommandPalette, IToolbarWidgetRegistry, } from '@jupyterlab/apputils';
5
5
  import { ConsolePanel } from '@jupyterlab/console';
6
6
  import { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils';
7
7
  import { IDocumentManager, renameDialog } from '@jupyterlab/docmanager';
@@ -9,12 +9,11 @@ import { DocumentWidget } from '@jupyterlab/docregistry';
9
9
  import { IMainMenu } from '@jupyterlab/mainmenu';
10
10
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
11
11
  import { ITranslator } from '@jupyterlab/translation';
12
- import { NotebookApp, NotebookShell, INotebookShell } from '@jupyter-notebook/application';
12
+ import { NotebookApp, NotebookShell, INotebookShell, SidePanelPalette, } from '@jupyter-notebook/application';
13
13
  import { jupyterIcon } from '@jupyter-notebook/ui-components';
14
14
  import { PromiseDelegate } from '@lumino/coreutils';
15
- import { DisposableDelegate, DisposableSet } from '@lumino/disposable';
15
+ import { DisposableDelegate, DisposableSet, } from '@lumino/disposable';
16
16
  import { Menu, Widget } from '@lumino/widgets';
17
- import { SideBarPalette } from './sidebarpalette';
18
17
  /**
19
18
  * A regular expression to match path to notebooks and documents
20
19
  */
@@ -33,7 +32,7 @@ var CommandIDs;
33
32
  */
34
33
  CommandIDs.toggleTop = 'application:toggle-top';
35
34
  /**
36
- * Toggle sidebar visibility
35
+ * Toggle side panel visibility
37
36
  */
38
37
  CommandIDs.togglePanel = 'application:toggle-panel';
39
38
  /**
@@ -70,12 +69,12 @@ const dirty = {
70
69
  }
71
70
  const trans = translator.load('notebook');
72
71
  const message = trans.__('Are you sure you want to exit Jupyter Notebook?\n\nAny unsaved changes will be lost.');
73
- window.addEventListener('beforeunload', event => {
72
+ window.addEventListener('beforeunload', (event) => {
74
73
  if (app.status.isDirty) {
75
74
  return (event.returnValue = message);
76
75
  }
77
76
  });
78
- }
77
+ },
79
78
  };
80
79
  /**
81
80
  * The logo plugin.
@@ -96,11 +95,11 @@ const logo = {
96
95
  padding: '2px 2px 2px 8px',
97
96
  height: '28px',
98
97
  width: 'auto',
99
- cursor: 'pointer'
98
+ cursor: 'pointer',
100
99
  });
101
100
  logo.id = 'jp-NotebookLogo';
102
101
  app.shell.add(logo, 'top', { rank: 0 });
103
- }
102
+ },
104
103
  };
105
104
  /**
106
105
  * A plugin to open documents in the main area.
@@ -126,13 +125,13 @@ const opener = {
126
125
  const factory = (_b = urlParams.get('factory')) !== null && _b !== void 0 ? _b : 'default';
127
126
  app.started.then(async () => {
128
127
  docManager.open(file, factory, undefined, {
129
- ref: '_noref'
128
+ ref: '_noref',
130
129
  });
131
130
  });
132
- }
131
+ },
133
132
  });
134
133
  router.register({ command, pattern: TREE_PATTERN });
135
- }
134
+ },
136
135
  };
137
136
  /**
138
137
  * A plugin to customize menus
@@ -160,7 +159,7 @@ const menus = {
160
159
  default:
161
160
  break;
162
161
  }
163
- }
162
+ },
164
163
  };
165
164
  /**
166
165
  * A plugin to provide a spacer at rank 900 in the menu area
@@ -173,7 +172,7 @@ const menuSpacer = {
173
172
  menu.id = DOMUtils.createDomID();
174
173
  menu.addClass('jp-NotebookSpacer');
175
174
  app.shell.add(menu, 'menu', { rank: 900 });
176
- }
175
+ },
177
176
  };
178
177
  /**
179
178
  * Add commands to open the tree and running pages.
@@ -190,20 +189,25 @@ const pages = {
190
189
  label: trans.__('Open JupyterLab'),
191
190
  execute: () => {
192
191
  window.open(`${baseUrl}lab`);
193
- }
192
+ },
194
193
  });
194
+ const page = PageConfig.getOption('notebookPage');
195
195
  app.commands.addCommand(CommandIDs.openTree, {
196
- label: trans.__('Open Files'),
196
+ label: trans.__('File Browser'),
197
197
  execute: () => {
198
- window.open(`${baseUrl}tree`);
199
- }
198
+ if (page === 'tree') {
199
+ app.commands.execute('filebrowser:activate');
200
+ }
201
+ else {
202
+ window.open(`${baseUrl}tree`);
203
+ }
204
+ },
200
205
  });
201
206
  if (palette) {
202
- [CommandIDs.openLab, CommandIDs.openTree].forEach(command => {
203
- palette.addItem({ command, category: 'View' });
204
- });
207
+ palette.addItem({ command: CommandIDs.openLab, category: 'View' });
208
+ palette.addItem({ command: CommandIDs.openTree, category: 'View' });
205
209
  }
206
- }
210
+ },
207
211
  };
208
212
  /**
209
213
  * The default paths for a Jupyter Notebook app.
@@ -217,16 +221,7 @@ const paths = {
217
221
  throw new Error(`${paths.id} must be activated in Jupyter Notebook.`);
218
222
  }
219
223
  return app.paths;
220
- }
221
- };
222
- /**
223
- * The default session dialogs plugin
224
- */
225
- const sessionDialogs = {
226
- id: '@jupyter-notebook/application-extension:session-dialogs',
227
- provides: ISessionContextDialogs,
228
- autoStart: true,
229
- activate: () => sessionContextDialogs
224
+ },
230
225
  };
231
226
  /**
232
227
  * The default Jupyter Notebook application shell.
@@ -240,7 +235,7 @@ const shell = {
240
235
  return app.shell;
241
236
  },
242
237
  autoStart: true,
243
- provides: INotebookShell
238
+ provides: INotebookShell,
244
239
  };
245
240
  /**
246
241
  * The default JupyterLab application status provider.
@@ -254,7 +249,7 @@ const status = {
254
249
  throw new Error(`${status.id} must be activated in Jupyter Notebook.`);
255
250
  }
256
251
  return app.status;
257
- }
252
+ },
258
253
  };
259
254
  /**
260
255
  * A plugin to display the document title in the browser tab title
@@ -288,7 +283,7 @@ const tabTitle = {
288
283
  };
289
284
  shell.currentChanged.connect(setTabTitle);
290
285
  setTabTitle();
291
- }
286
+ },
292
287
  };
293
288
  /**
294
289
  * A plugin to display and rename the title of a file
@@ -303,7 +298,7 @@ const title = {
303
298
  const trans = translator.load('notebook');
304
299
  const node = document.createElement('div');
305
300
  if (toolbarRegistry) {
306
- toolbarRegistry.addFactory('TopBar', 'widgetTitle', toolbar => {
301
+ toolbarRegistry.addFactory('TopBar', 'widgetTitle', (toolbar) => {
307
302
  const widget = new Widget({ node });
308
303
  widget.id = 'jp-title';
309
304
  return widget;
@@ -357,9 +352,9 @@ const title = {
357
352
  }
358
353
  const encoded = encodeURIComponent(newPath);
359
354
  router.navigate(`/${route}/${encoded}`, {
360
- skipRouting: true
355
+ skipRouting: true,
361
356
  });
362
- }
357
+ },
363
358
  });
364
359
  node.onclick = async () => {
365
360
  void commands.execute(CommandIDs.rename);
@@ -367,7 +362,7 @@ const title = {
367
362
  };
368
363
  shell.currentChanged.connect(addTitle);
369
364
  void addTitle();
370
- }
365
+ },
371
366
  };
372
367
  /**
373
368
  * Plugin to toggle the top header visibility.
@@ -388,7 +383,7 @@ const topVisibility = {
388
383
  void settingRegistry.set(pluginId, 'visible', top.isVisible);
389
384
  }
390
385
  },
391
- isToggled: () => top.isVisible
386
+ isToggled: () => top.isVisible,
392
387
  });
393
388
  let settingsOverride = false;
394
389
  if (settingRegistry) {
@@ -403,7 +398,7 @@ const topVisibility = {
403
398
  Promise.all([loadSettings, app.restored])
404
399
  .then(([settings]) => {
405
400
  updateSettings(settings);
406
- settings.changed.connect(settings => {
401
+ settings.changed.connect((settings) => {
407
402
  updateSettings(settings);
408
403
  });
409
404
  })
@@ -428,13 +423,13 @@ const topVisibility = {
428
423
  // listen on format change (mobile and desktop) to make the view more compact
429
424
  app.formatChanged.connect(onChanged);
430
425
  },
431
- autoStart: true
426
+ autoStart: true,
432
427
  };
433
428
  /**
434
- * Plugin to toggle the left or right sidebar's visibility.
429
+ * Plugin to toggle the left or right side panel's visibility.
435
430
  */
436
- const sidebarVisibility = {
437
- id: '@jupyter-notebook/application-extension:sidebar',
431
+ const sidePanelVisibility = {
432
+ id: '@jupyter-notebook/application-extension:sidepanel',
438
433
  requires: [INotebookShell, ITranslator],
439
434
  optional: [IMainMenu, ICommandPalette],
440
435
  autoStart: true,
@@ -443,11 +438,11 @@ const sidebarVisibility = {
443
438
  /* Arguments for togglePanel command:
444
439
  * side, left or right area
445
440
  * title, widget title to show in the menu
446
- * id, widget ID to activate in the sidebar
441
+ * id, widget ID to activate in the side panel
447
442
  */
448
443
  app.commands.addCommand(CommandIDs.togglePanel, {
449
- label: args => args['title'],
450
- caption: args => {
444
+ label: (args) => args['title'],
445
+ caption: (args) => {
451
446
  // We do not substitute the parameter into the string because the parameter is not
452
447
  // localized (e.g., it is always 'left') even though the string is localized.
453
448
  if (args['side'] === 'left') {
@@ -458,7 +453,7 @@ const sidebarVisibility = {
458
453
  }
459
454
  return trans.__('Show %1 in the sidebar', args['title']);
460
455
  },
461
- execute: args => {
456
+ execute: (args) => {
462
457
  var _a, _b;
463
458
  switch (args['side']) {
464
459
  case 'left':
@@ -491,7 +486,7 @@ const sidebarVisibility = {
491
486
  break;
492
487
  }
493
488
  },
494
- isToggled: args => {
489
+ isToggled: (args) => {
495
490
  switch (args['side']) {
496
491
  case 'left': {
497
492
  if (notebookShell.leftCollapsed) {
@@ -515,17 +510,17 @@ const sidebarVisibility = {
515
510
  }
516
511
  }
517
512
  return false;
518
- }
513
+ },
519
514
  });
520
- const sideBarMenu = {
515
+ const sidePanelMenu = {
521
516
  left: null,
522
- right: null
517
+ right: null,
523
518
  };
524
519
  /**
525
- * The function which adds entries to the View menu for each widget of a sidebar.
520
+ * The function which adds entries to the View menu for each widget of a side panel.
526
521
  *
527
- * @param area - 'left' or 'right', the area of the side bar.
528
- * @param entryLabel - the name of the main entry in the View menu for that sidebar.
522
+ * @param area - 'left' or 'right', the area of the side panel.
523
+ * @param entryLabel - the name of the main entry in the View menu for that side panel.
529
524
  * @returns - The disposable menu added to the View menu or null.
530
525
  */
531
526
  const updateMenu = (area, entryLabel) => {
@@ -533,86 +528,86 @@ const sidebarVisibility = {
533
528
  if (menu === null) {
534
529
  return null;
535
530
  }
536
- // Remove the previous menu entry for this sidebar.
537
- (_a = sideBarMenu[area]) === null || _a === void 0 ? void 0 : _a.dispose();
538
- // Creates a new menu entry and populates it with sidebar widgets.
531
+ // Remove the previous menu entry for this side panel.
532
+ (_a = sidePanelMenu[area]) === null || _a === void 0 ? void 0 : _a.dispose();
533
+ // Creates a new menu entry and populates it with side panel widgets.
539
534
  const newMenu = new Menu({ commands: app.commands });
540
535
  newMenu.title.label = entryLabel;
541
536
  const widgets = notebookShell.widgets(area);
542
537
  let menuToAdd = false;
543
- for (let widget of widgets) {
538
+ for (const widget of widgets) {
544
539
  newMenu.addItem({
545
540
  command: CommandIDs.togglePanel,
546
541
  args: {
547
542
  side: area,
548
543
  title: `Show ${widget.title.caption}`,
549
- id: widget.id
550
- }
544
+ id: widget.id,
545
+ },
551
546
  });
552
547
  menuToAdd = true;
553
548
  }
554
549
  // If there are widgets, add the menu to the main menu entry.
555
550
  if (menuToAdd) {
556
- sideBarMenu[area] = menu.viewMenu.addItem({
551
+ sidePanelMenu[area] = menu.viewMenu.addItem({
557
552
  type: 'submenu',
558
- submenu: newMenu
553
+ submenu: newMenu,
559
554
  });
560
555
  }
561
556
  };
562
557
  app.restored.then(() => {
563
558
  // Create menu entries for the left and right panel.
564
559
  if (menu) {
565
- const getSideBarLabel = (area) => {
560
+ const getSidePanelLabel = (area) => {
566
561
  if (area === 'left') {
567
- return trans.__(`Left Sidebar`);
562
+ return trans.__('Left Sidebar');
568
563
  }
569
564
  else {
570
- return trans.__(`Right Sidebar`);
565
+ return trans.__('Right Sidebar');
571
566
  }
572
567
  };
573
568
  const leftArea = notebookShell.leftHandler.area;
574
- const leftLabel = getSideBarLabel(leftArea);
569
+ const leftLabel = getSidePanelLabel(leftArea);
575
570
  updateMenu(leftArea, leftLabel);
576
571
  const rightArea = notebookShell.rightHandler.area;
577
- const rightLabel = getSideBarLabel(rightArea);
572
+ const rightLabel = getSidePanelLabel(rightArea);
578
573
  updateMenu(rightArea, rightLabel);
579
- const handleSideBarChange = (sidebar, widget) => {
580
- const label = getSideBarLabel(sidebar.area);
581
- updateMenu(sidebar.area, label);
574
+ const handleSidePanelChange = (sidePanel, widget) => {
575
+ const label = getSidePanelLabel(sidePanel.area);
576
+ updateMenu(sidePanel.area, label);
582
577
  };
583
- notebookShell.leftHandler.widgetAdded.connect(handleSideBarChange);
584
- notebookShell.leftHandler.widgetRemoved.connect(handleSideBarChange);
585
- notebookShell.rightHandler.widgetAdded.connect(handleSideBarChange);
586
- notebookShell.rightHandler.widgetRemoved.connect(handleSideBarChange);
578
+ notebookShell.leftHandler.widgetAdded.connect(handleSidePanelChange);
579
+ notebookShell.leftHandler.widgetRemoved.connect(handleSidePanelChange);
580
+ notebookShell.rightHandler.widgetAdded.connect(handleSidePanelChange);
581
+ notebookShell.rightHandler.widgetRemoved.connect(handleSidePanelChange);
587
582
  }
588
583
  // Add palette entries for side panels.
589
584
  if (palette) {
590
- const sideBarPalette = new SideBarPalette({
585
+ const sidePanelPalette = new SidePanelPalette({
591
586
  commandPalette: palette,
592
- command: CommandIDs.togglePanel
587
+ command: CommandIDs.togglePanel,
593
588
  });
594
- notebookShell.leftHandler.widgets.forEach(widget => {
595
- sideBarPalette.addItem(widget, notebookShell.leftHandler.area);
589
+ notebookShell.leftHandler.widgets.forEach((widget) => {
590
+ sidePanelPalette.addItem(widget, notebookShell.leftHandler.area);
596
591
  });
597
- notebookShell.rightHandler.widgets.forEach(widget => {
598
- sideBarPalette.addItem(widget, notebookShell.rightHandler.area);
592
+ notebookShell.rightHandler.widgets.forEach((widget) => {
593
+ sidePanelPalette.addItem(widget, notebookShell.rightHandler.area);
599
594
  });
600
- // Update menu and palette when widgets are added or removed from sidebars.
601
- notebookShell.leftHandler.widgetAdded.connect((sidebar, widget) => {
602
- sideBarPalette.addItem(widget, sidebar.area);
595
+ // Update menu and palette when widgets are added or removed from side panels.
596
+ notebookShell.leftHandler.widgetAdded.connect((sidePanel, widget) => {
597
+ sidePanelPalette.addItem(widget, sidePanel.area);
603
598
  });
604
- notebookShell.leftHandler.widgetRemoved.connect((sidebar, widget) => {
605
- sideBarPalette.removeItem(widget, sidebar.area);
599
+ notebookShell.leftHandler.widgetRemoved.connect((sidePanel, widget) => {
600
+ sidePanelPalette.removeItem(widget, sidePanel.area);
606
601
  });
607
- notebookShell.rightHandler.widgetAdded.connect((sidebar, widget) => {
608
- sideBarPalette.addItem(widget, sidebar.area);
602
+ notebookShell.rightHandler.widgetAdded.connect((sidePanel, widget) => {
603
+ sidePanelPalette.addItem(widget, sidePanel.area);
609
604
  });
610
- notebookShell.rightHandler.widgetRemoved.connect((sidebar, widget) => {
611
- sideBarPalette.removeItem(widget, sidebar.area);
605
+ notebookShell.rightHandler.widgetRemoved.connect((sidePanel, widget) => {
606
+ sidePanelPalette.removeItem(widget, sidePanel.area);
612
607
  });
613
608
  }
614
609
  });
615
- }
610
+ },
616
611
  };
617
612
  /**
618
613
  * The default tree route resolver plugin.
@@ -640,7 +635,7 @@ const tree = {
640
635
  // Clean up artifacts immediately upon routing.
641
636
  set.dispose();
642
637
  delegate.resolve({ browser, file: PageConfig.getOption('treePath') });
643
- })
638
+ }),
644
639
  }));
645
640
  set.add(router.register({ command: CommandIDs.resolveTree, pattern: treePattern }));
646
641
  // If a route is handled by the router without the tree command being
@@ -657,7 +652,7 @@ const tree = {
657
652
  router.routed.disconnect(listener);
658
653
  }));
659
654
  return { paths: delegate.promise };
660
- }
655
+ },
661
656
  };
662
657
  const treePathUpdater = {
663
658
  id: '@jupyter-notebook/application-extension:tree-updater',
@@ -674,7 +669,15 @@ const treePathUpdater = {
674
669
  }
675
670
  return updateTreePath;
676
671
  },
677
- autoStart: true
672
+ autoStart: true,
673
+ };
674
+ const translator = {
675
+ id: '@jupyter-notebook/application-extension:translator',
676
+ requires: [INotebookShell, ITranslator],
677
+ autoStart: true,
678
+ activate: (app, notebookShell, translator) => {
679
+ notebookShell.translator = translator;
680
+ },
678
681
  };
679
682
  /**
680
683
  * Zen mode plugin
@@ -710,7 +713,7 @@ const zen = {
710
713
  document.exitFullscreen();
711
714
  toggleOff();
712
715
  }
713
- }
716
+ },
714
717
  });
715
718
  document.addEventListener('fullscreenchange', () => {
716
719
  if (!document.fullscreenElement) {
@@ -720,7 +723,7 @@ const zen = {
720
723
  if (palette) {
721
724
  palette.addItem({ command: CommandIDs.toggleZen, category: 'Mode' });
722
725
  }
723
- }
726
+ },
724
727
  };
725
728
  /**
726
729
  * Export the plugins as default.
@@ -733,15 +736,15 @@ const plugins = [
733
736
  opener,
734
737
  pages,
735
738
  paths,
736
- sessionDialogs,
737
739
  shell,
738
- sidebarVisibility,
740
+ sidePanelVisibility,
739
741
  status,
740
742
  tabTitle,
741
743
  title,
742
744
  topVisibility,
743
745
  tree,
744
746
  treePathUpdater,
745
- zen
747
+ translator,
748
+ zen,
746
749
  ];
747
750
  export default plugins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/application-extension",
3
- "version": "7.0.0-alpha.8",
3
+ "version": "7.0.0-beta.0",
4
4
  "description": "Jupyter Notebook - Application Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -35,30 +35,29 @@
35
35
  "build:prod": "tsc -b",
36
36
  "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
37
37
  "docs": "typedoc src",
38
- "prepublishOnly": "npm run build",
39
38
  "watch": "tsc -b --watch"
40
39
  },
41
40
  "dependencies": {
42
- "@jupyter-notebook/application": "^7.0.0-alpha.8",
43
- "@jupyter-notebook/ui-components": "^7.0.0-alpha.8",
44
- "@jupyterlab/application": "^4.0.0-alpha.15",
45
- "@jupyterlab/apputils": "^4.0.0-alpha.15",
46
- "@jupyterlab/celltags": "^4.0.0-alpha.15",
47
- "@jupyterlab/codeeditor": "^4.0.0-alpha.15",
48
- "@jupyterlab/console": "^4.0.0-alpha.15",
49
- "@jupyterlab/coreutils": "^6.0.0-alpha.15",
50
- "@jupyterlab/docmanager": "^4.0.0-alpha.15",
51
- "@jupyterlab/docregistry": "^4.0.0-alpha.15",
52
- "@jupyterlab/mainmenu": "^4.0.0-alpha.15",
53
- "@jupyterlab/settingregistry": "^4.0.0-alpha.15",
54
- "@jupyterlab/translation": "^4.0.0-alpha.15",
55
- "@lumino/coreutils": "^2.0.0-alpha.6",
56
- "@lumino/disposable": "^2.0.0-alpha.6",
57
- "@lumino/widgets": "^2.0.0-alpha.6"
41
+ "@jupyter-notebook/application": "^7.0.0-beta.0",
42
+ "@jupyter-notebook/ui-components": "^7.0.0-beta.0",
43
+ "@jupyterlab/application": "^4.0.0-beta.0",
44
+ "@jupyterlab/apputils": "^4.0.0-beta.0",
45
+ "@jupyterlab/celltags": "^4.0.0-alpha.20",
46
+ "@jupyterlab/codeeditor": "^4.0.0-beta.0",
47
+ "@jupyterlab/console": "^4.0.0-beta.0",
48
+ "@jupyterlab/coreutils": "^6.0.0-beta.0",
49
+ "@jupyterlab/docmanager": "^4.0.0-beta.0",
50
+ "@jupyterlab/docregistry": "^4.0.0-beta.0",
51
+ "@jupyterlab/mainmenu": "^4.0.0-beta.0",
52
+ "@jupyterlab/settingregistry": "^4.0.0-beta.0",
53
+ "@jupyterlab/translation": "^4.0.0-beta.0",
54
+ "@lumino/coreutils": "^2.0.0",
55
+ "@lumino/disposable": "^2.0.0",
56
+ "@lumino/widgets": "^2.0.1"
58
57
  },
59
58
  "devDependencies": {
60
59
  "rimraf": "^3.0.2",
61
- "typescript": "~4.7.3"
60
+ "typescript": "~5.0.2"
62
61
  },
63
62
  "publishConfig": {
64
63
  "access": "public"
package/style/base.css CHANGED
@@ -23,3 +23,13 @@
23
23
  text-align: center;
24
24
  margin-top: 8px;
25
25
  }
26
+
27
+ .jp-MimeDocument .jp-RenderedJSON {
28
+ background: var(--jp-layout-color0);
29
+ }
30
+
31
+ /* Hide the stub toolbar that appears above terminals and documents */
32
+
33
+ .jp-MainAreaWidget > .jp-Toolbar-micro {
34
+ display: none;
35
+ }
@@ -1,61 +0,0 @@
1
- import { ICommandPalette } from '@jupyterlab/apputils';
2
- import { IDisposable } from '@lumino/disposable';
3
- import { Widget } from '@lumino/widgets';
4
- /**
5
- * A class to manages the palette entries associated to the side bar.
6
- */
7
- export declare class SideBarPalette {
8
- /**
9
- * Construct a new side bar palette.
10
- */
11
- constructor(options: SideBarPaletteOption);
12
- /**
13
- * Get a command palette item from the widget id and the area.
14
- */
15
- getItem(widget: Readonly<Widget>, area: 'left' | 'right'): SideBarPaletteItem | null;
16
- /**
17
- * Add an item to the command palette.
18
- */
19
- addItem(widget: Readonly<Widget>, area: 'left' | 'right'): void;
20
- /**
21
- * Remove an item from the command palette.
22
- */
23
- removeItem(widget: Readonly<Widget>, area: 'left' | 'right'): void;
24
- _command: string;
25
- _commandPalette: ICommandPalette;
26
- _items: SideBarPaletteItem[];
27
- }
28
- declare type SideBarPaletteItem = {
29
- /**
30
- * The ID of the widget associated to the command palette.
31
- */
32
- widgetId: string;
33
- /**
34
- * The area of the panel associated to the command palette.
35
- */
36
- area: 'left' | 'right';
37
- /**
38
- * The disposable object to remove the item from command palette.
39
- */
40
- disposable: IDisposable;
41
- };
42
- /**
43
- * An interface for the options to include in SideBarPalette constructor.
44
- */
45
- declare type SideBarPaletteOption = {
46
- /**
47
- * The commands palette.
48
- */
49
- commandPalette: ICommandPalette;
50
- /**
51
- * The command to call from each sidebar menu entry.
52
- *
53
- * ### Notes
54
- * That command required 3 args :
55
- * side: 'left' | 'right', the area to toggle
56
- * title: string, label of the command
57
- * id: string, id of the widget to activate
58
- */
59
- command: string;
60
- };
61
- export {};
@@ -1,61 +0,0 @@
1
- /**
2
- * A class to manages the palette entries associated to the side bar.
3
- */
4
- export class SideBarPalette {
5
- /**
6
- * Construct a new side bar palette.
7
- */
8
- constructor(options) {
9
- this._items = [];
10
- this._commandPalette = options.commandPalette;
11
- this._command = options.command;
12
- }
13
- /**
14
- * Get a command palette item from the widget id and the area.
15
- */
16
- getItem(widget, area) {
17
- const itemList = this._items;
18
- for (let i = 0; i < itemList.length; i++) {
19
- const item = itemList[i];
20
- if (item.widgetId == widget.id && item.area == area) {
21
- return item;
22
- }
23
- }
24
- return null;
25
- }
26
- /**
27
- * Add an item to the command palette.
28
- */
29
- addItem(widget, area) {
30
- // Check if the item does not already exist.
31
- if (this.getItem(widget, area)) {
32
- return;
33
- }
34
- // Add a new item in command palette.
35
- const disposableDelegate = this._commandPalette.addItem({
36
- command: this._command,
37
- category: 'View',
38
- args: {
39
- side: area,
40
- title: `Show ${widget.title.caption}`,
41
- id: widget.id
42
- }
43
- });
44
- // Keep the disposableDelegate objet to be able to dispose of the item if the widget
45
- // is remove from the side bar.
46
- this._items.push({
47
- widgetId: widget.id,
48
- area: area,
49
- disposable: disposableDelegate
50
- });
51
- }
52
- /**
53
- * Remove an item from the command palette.
54
- */
55
- removeItem(widget, area) {
56
- const item = this.getItem(widget, area);
57
- if (item) {
58
- item.disposable.dispose();
59
- }
60
- }
61
- }