@jupyterlab/ui-components 4.7.0-alpha.1 → 4.7.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.
Files changed (43) hide show
  1. package/lib/components/form.js +2 -2
  2. package/lib/components/form.js.map +1 -1
  3. package/lib/components/menu.js +1 -1
  4. package/lib/components/menu.js.map +1 -1
  5. package/lib/components/toolbar.d.ts +9 -11
  6. package/lib/components/toolbar.js +94 -57
  7. package/lib/components/toolbar.js.map +1 -1
  8. package/lib/components/vdom.d.ts +15 -1
  9. package/lib/components/vdom.js +59 -6
  10. package/lib/components/vdom.js.map +1 -1
  11. package/lib/components/windowedlist.js +4 -4
  12. package/lib/components/windowedlist.js.map +1 -1
  13. package/lib/hoverbox.js +4 -9
  14. package/lib/hoverbox.js.map +1 -1
  15. package/lib/icon/iconimports.d.ts +1 -0
  16. package/lib/icon/iconimports.js +2 -0
  17. package/lib/icon/iconimports.js.map +1 -1
  18. package/lib/icon/widgets/menusvg.js +1 -2
  19. package/lib/icon/widgets/menusvg.js.map +1 -1
  20. package/lib/icon/widgets/tabbarsvg.d.ts +3 -3
  21. package/lib/icon/widgets/tabbarsvg.js +0 -1
  22. package/lib/icon/widgets/tabbarsvg.js.map +1 -1
  23. package/lib/utils.d.ts +6 -6
  24. package/lib/utils.js +0 -1
  25. package/lib/utils.js.map +1 -1
  26. package/package.json +9 -9
  27. package/src/components/form.tsx +1 -1
  28. package/src/components/menu.ts +1 -1
  29. package/src/components/toolbar.tsx +103 -60
  30. package/src/components/vdom.ts +61 -9
  31. package/src/components/windowedlist.ts +4 -4
  32. package/src/hoverbox.ts +3 -11
  33. package/src/icon/iconimports.ts +2 -0
  34. package/src/icon/widgets/menusvg.ts +4 -3
  35. package/src/icon/widgets/tabbarsvg.ts +3 -4
  36. package/src/utils.ts +5 -16
  37. package/style/deprecated.css +5 -0
  38. package/style/icons/info.svg +3 -5
  39. package/style/icons/toolbar/add.svg +2 -2
  40. package/style/icons/toolbar/check.svg +2 -2
  41. package/style/icons/toolbar/close.svg +4 -4
  42. package/style/icons/toolbar/delete.svg +3 -2
  43. package/style/icons/toolbar/restore.svg +4 -0
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
4
3
  import { nullTranslator } from '@jupyterlab/translation';
5
4
  import { h, hpass } from '@lumino/virtualdom';
6
5
  import { DockPanel, TabBar, TabPanel } from '@lumino/widgets';
@@ -1 +1 @@
1
- {"version":3,"file":"tabbarsvg.js","sourceRoot":"","sources":["../../../src/icon/widgets/tabbarsvg.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D,uDAAuD;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,MAAM,OAAO,SAAa,SAAQ,MAAS;IAMzC;;;;OAIG;IACH,YAAY,UAA8B,EAAE;;QAC1C,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,CAAC,MAAA,SAAS,CAAC,UAAU,mCAAI,cAAc,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC1E,OAAO,CAAC,OAAO,CAAC;YACd,SAAS,EAAE,IAAI,CAAC,aAAa;YAC7B,KAAK,EAAE,KAAK,CAAC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AY,UAA6B,EAAE;QACzC,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC,eAAe,CAAC;QACjE,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF"}
package/lib/utils.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ type ClassNameMapping = {
2
+ [className: string]: unknown;
3
+ };
1
4
  /**
2
5
  * Combines classNames.
3
6
  *
@@ -5,9 +8,7 @@
5
8
  *
6
9
  * @returns A single string with the combined className
7
10
  */
8
- export declare function classes(...classes: (string | false | undefined | null | {
9
- [className: string]: any;
10
- })[]): string;
11
+ export declare function classes(...classes: (string | false | undefined | null | ClassNameMapping)[]): string;
11
12
  /**
12
13
  * Combines classNames. Removes all duplicates
13
14
  *
@@ -15,9 +16,7 @@ export declare function classes(...classes: (string | false | undefined | null |
15
16
  *
16
17
  * @returns A single string with the combined className
17
18
  */
18
- export declare function classesDedupe(...classes: (string | false | undefined | null | {
19
- [className: string]: any;
20
- })[]): string;
19
+ export declare function classesDedupe(...classes: (string | false | undefined | null | ClassNameMapping)[]): string;
21
20
  /**
22
21
  * Translates the attributes of a DOM element into attributes that can
23
22
  * be understood by React. Currently not comprehensive, we will add special
@@ -42,3 +41,4 @@ export declare function getReactAttrs(elem: Element, { ignore }?: {
42
41
  * @returns The tree item
43
42
  */
44
43
  export declare function getTreeItemElement(el: HTMLElement): HTMLElement | null;
44
+ export {};
package/lib/utils.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
4
3
  import { Text } from '@jupyterlab/coreutils';
5
4
  /**
6
5
  * Inner works of class combining functions
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D,uDAAuD;AAEv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AAE,CAAC;YAC9D,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,EAAE,EAAE,CAAC,CAAC;AACX,CAAC;AAED,kBAAkB;AAElB;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,EAAsB;IAC/C,OAAO,EAAE,YAAY,WAAW,IAAI,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,UAAU,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAe;IAChD,IAAI,IAAI,GAAG,EAAwB,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/ui-components",
3
- "version": "4.7.0-alpha.1",
3
+ "version": "4.7.0-beta.0",
4
4
  "description": "JupyterLab - UI components written in React",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -40,12 +40,12 @@
40
40
  "watch": "tsc -b --watch"
41
41
  },
42
42
  "dependencies": {
43
- "@jupyter/react-components": "^0.16.6",
44
- "@jupyter/web-components": "^0.16.6",
45
- "@jupyterlab/coreutils": "^6.7.0-alpha.1",
46
- "@jupyterlab/observables": "^5.7.0-alpha.1",
47
- "@jupyterlab/rendermime-interfaces": "^3.15.0-alpha.1",
48
- "@jupyterlab/translation": "^4.7.0-alpha.1",
43
+ "@jupyter/react-components": "^0.17.1",
44
+ "@jupyter/web-components": "^0.17.1",
45
+ "@jupyterlab/coreutils": "^6.7.0-beta.0",
46
+ "@jupyterlab/observables": "^5.7.0-beta.0",
47
+ "@jupyterlab/rendermime-interfaces": "^3.15.0-beta.0",
48
+ "@jupyterlab/translation": "^4.7.0-beta.0",
49
49
  "@lumino/algorithm": "^2.0.5",
50
50
  "@lumino/commands": "^2.3.4",
51
51
  "@lumino/coreutils": "^2.2.3",
@@ -55,7 +55,7 @@
55
55
  "@lumino/properties": "^2.0.5",
56
56
  "@lumino/signaling": "^2.1.6",
57
57
  "@lumino/virtualdom": "^2.0.5",
58
- "@lumino/widgets": "^2.9.0",
58
+ "@lumino/widgets": "^2.10.0",
59
59
  "@rjsf/core": "^5.13.4",
60
60
  "@rjsf/utils": "^5.13.4",
61
61
  "react": "^18.2.0",
@@ -63,7 +63,7 @@
63
63
  "typestyle": "^2.0.4"
64
64
  },
65
65
  "devDependencies": {
66
- "@jupyterlab/testing": "^4.7.0-alpha.1",
66
+ "@jupyterlab/testing": "^4.7.0-beta.0",
67
67
  "@types/jest": "^29.2.0",
68
68
  "@types/react": "^18.0.26",
69
69
  "jest": "^29.2.0",
@@ -515,7 +515,7 @@ const CustomTemplateFactory = (options: FormComponent.ILabCustomizerProps) =>
515
515
  }`}
516
516
  >
517
517
  {!hasCustomField &&
518
- (rawErrors?.length ? (
518
+ ((rawErrors?.length ?? 0) > 0 ? (
519
519
  // Shows a red indicator for fields that have validation errors
520
520
  <div className="jp-modifiedIndicator jp-errorIndicator" />
521
521
  ) : (
@@ -188,7 +188,7 @@ export class RankedMenu extends Menu implements IRankedMenu {
188
188
  addItem(options: IRankedMenu.IItemOptions): IDisposableMenuItem {
189
189
  let insertIndex = -1;
190
190
 
191
- if (options.rank) {
191
+ if (options.rank !== undefined) {
192
192
  insertIndex = this._ranks.findIndex(rank => options.rank! < rank);
193
193
  }
194
194
  if (insertIndex < 0) {
@@ -390,8 +390,8 @@ export class ReactiveToolbar extends Toolbar<Widget> {
390
390
  super(options);
391
391
  this.insertItem(0, TOOLBAR_OPENER_NAME, this.popupOpener);
392
392
  this.popupOpener.hide();
393
- this._resizer = new Throttler(async (callTwice = false) => {
394
- await this._onResize(callTwice);
393
+ this._resizer = new Throttler(async () => {
394
+ await this._onResize();
395
395
  }, 500);
396
396
  }
397
397
 
@@ -406,10 +406,39 @@ export class ReactiveToolbar extends Toolbar<Widget> {
406
406
  if (this._resizer) {
407
407
  this._resizer.dispose();
408
408
  }
409
+ this._itemResizeObserver.disconnect();
409
410
 
410
411
  super.dispose();
411
412
  }
412
413
 
414
+ protected onChildRemoved(msg: Widget.ChildMessage): void {
415
+ this._itemResizeObserver.unobserve(msg.child.node);
416
+ // If the widget is being moved to the popup opener, keep tracking its
417
+ // intended position so it can be restored to the right slot later.
418
+ // NOTE: we cannot check msg.child.parent here because Lumino fires
419
+ // child-removed before updating the parent reference; use the transit
420
+ // set instead.
421
+ if (this._movingToPopup.has(msg.child)) {
422
+ return;
423
+ }
424
+ const name = Private.nameProperty.get(msg.child);
425
+ if (!name || name === TOOLBAR_OPENER_NAME) {
426
+ return;
427
+ }
428
+ const position = this._widgetPositions.get(name);
429
+ if (position === undefined) {
430
+ return;
431
+ }
432
+ this._widgetPositions.delete(name);
433
+ this._widgetWidths.delete(name);
434
+ // Shift down all items that were logically after the removed one.
435
+ this._widgetPositions.forEach((pos, key) => {
436
+ if (pos > position) {
437
+ this._widgetPositions.set(key, pos - 1);
438
+ }
439
+ });
440
+ }
441
+
413
442
  /**
414
443
  * Insert an item into the toolbar at the after a target item.
415
444
  *
@@ -477,6 +506,11 @@ export class ReactiveToolbar extends Toolbar<Widget> {
477
506
  Math.min(index, (this.layout as ToolbarLayout).widgets.length - 1)
478
507
  );
479
508
  status = super.insertItem(j, name, widget);
509
+ if (status && !widget.hasClass(TOOLBAR_SPACER_CLASS)) {
510
+ // Watch the border box: a padding change, for example from a theme,
511
+ // leaves the content box as it is but changes the width the layout uses.
512
+ this._itemResizeObserver.observe(widget.node, { box: 'border-box' });
513
+ }
480
514
 
481
515
  if (j !== index) {
482
516
  // This happens if the widget has been inserted at a wrong position:
@@ -512,11 +546,9 @@ export class ReactiveToolbar extends Toolbar<Widget> {
512
546
  this._widgetPositions.set(name, index);
513
547
 
514
548
  // Invokes resizing to ensure correct display of items after an addition, only
515
- // if the toolbar is rendered. Call the resizer twice (callTwice = true) so that
516
- // widgets that have not yet been painted (clientWidth === 0) get a chance to be
517
- // rendered before the second pass recalculates the layout.
549
+ // if the toolbar is rendered.
518
550
  if (this.isVisible) {
519
- void this._resizer.invoke(true);
551
+ void this._resizer.invoke();
520
552
  }
521
553
  }
522
554
  return status;
@@ -528,7 +560,7 @@ export class ReactiveToolbar extends Toolbar<Widget> {
528
560
  * Invokes resizing to ensure correct display of items.
529
561
  */
530
562
  onAfterShow(msg: Message): void {
531
- void this._resizer.stop().then(() => void this._resizer.invoke(true));
563
+ void this._resizer.stop().then(() => void this._resizer.invoke());
532
564
  }
533
565
 
534
566
  /**
@@ -543,14 +575,28 @@ export class ReactiveToolbar extends Toolbar<Widget> {
543
575
 
544
576
  protected onResize(msg: Widget.ResizeMessage): void {
545
577
  super.onResize(msg);
578
+ if (msg.width > 0 && this._resizer) {
579
+ void this._resizer.invoke();
580
+ }
581
+ }
546
582
 
547
- // Check if the resize event is due to a zoom change.
548
- const zoom = Math.round((window.outerWidth / window.innerWidth) * 100);
549
- if (zoom !== this._zoom) {
550
- this._zoomChanged = true;
551
- this._zoom = zoom;
583
+ /**
584
+ * Invoke the resizer when an item in the toolbar no longer has the width
585
+ * used to place the items, for example when the kernel name changes.
586
+ */
587
+ private _onItemResize(entries: ResizeObserverEntry[]): void {
588
+ if (!this.isVisible) {
589
+ return;
552
590
  }
553
- if (msg.width > 0 && this._resizer) {
591
+ const widgets = (this.layout as ToolbarLayout).widgets;
592
+ const resized = entries.some(entry => {
593
+ const widget = widgets.find(w => w.node === entry.target);
594
+ return (
595
+ widget !== undefined &&
596
+ widget.node.clientWidth !== this._getWidgetWidth(widget)
597
+ );
598
+ });
599
+ if (resized) {
554
600
  void this._resizer.invoke();
555
601
  }
556
602
  }
@@ -558,16 +604,19 @@ export class ReactiveToolbar extends Toolbar<Widget> {
558
604
  /**
559
605
  * Move the toolbar items between the reactive toolbar and the popup toolbar,
560
606
  * depending on the width of the toolbar and the width of each item.
561
- *
562
- * @param callTwice - whether to call the function twice.
563
- *
564
- * **NOTES**
565
- * The `callTwice` parameter is useful when the toolbar is displayed the first time,
566
- * because the size of the items is unknown before their first rendering. The first
567
- * call will usually add all the items in the main toolbar, and the second call will
568
- * reorganize the items between the main toolbar and the popup toolbar.
569
607
  */
570
- private async _onResize(callTwice = false) {
608
+ private async _onResize() {
609
+ // Wait for all the items to render before measuring any of them. Waiting
610
+ // between two measurements would let an item that is already measured
611
+ // change its width, and the resizer drops the call that the item observer
612
+ // makes while this method runs.
613
+ await Promise.all(
614
+ (this.layout as ToolbarLayout).widgets.map(widget =>
615
+ widget instanceof ReactWidget ? widget.renderPromise : undefined
616
+ )
617
+ ).catch(msg => {
618
+ console.error('Error while computing the ReactiveToolbar', msg);
619
+ });
571
620
  if (!(this.parent && this.parent.isAttached)) {
572
621
  return;
573
622
  }
@@ -588,7 +637,7 @@ export class ReactiveToolbar extends Toolbar<Widget> {
588
637
  // Get the saved position of the widget to insert.
589
638
  const widget = widgetsToRemove.pop()!;
590
639
  const name = Private.nameProperty.get(widget);
591
- width -= this._widgetWidths.get(name) || 0;
640
+ width -= this._widgetWidths.get(name) ?? 0;
592
641
  const position = this._widgetPositions.get(name) ?? 0;
593
642
 
594
643
  // Get the saved position of the first item in the popup toolbar.
@@ -603,7 +652,9 @@ export class ReactiveToolbar extends Toolbar<Widget> {
603
652
 
604
653
  // Insert the widget in the popup toolbar.
605
654
  const index = position - openerFirstIndex;
655
+ this._movingToPopup.add(widget);
606
656
  opener.insertWidget(index, widget);
657
+ this._movingToPopup.delete(widget);
607
658
  }
608
659
  if (opener.widgetCount() > 0) {
609
660
  const widgetsToAdd = [];
@@ -644,9 +695,6 @@ export class ReactiveToolbar extends Toolbar<Widget> {
644
695
  } else {
645
696
  opener.hide();
646
697
  }
647
- if (callTwice) {
648
- await this._onResize();
649
- }
650
698
  })
651
699
  .catch(msg => {
652
700
  console.error('Error while computing the ReactiveToolbar', msg);
@@ -661,6 +709,16 @@ export class ReactiveToolbar extends Toolbar<Widget> {
661
709
  const opener = this.popupOpener;
662
710
  const widgets = [...(this.layout as ToolbarLayout).widgets];
663
711
  const toIndex = widgets.length - 1;
712
+ const widths = widgets
713
+ .slice(0, toIndex)
714
+ .map(widget =>
715
+ this._saveWidgetWidth(Private.nameProperty.get(widget), widget)
716
+ );
717
+ // Count the opener only if the items do not all fit without it. Otherwise
718
+ // the last items move to the popup although they all fit in the toolbar.
719
+ const fitWithoutOpener =
720
+ widths.reduce((total, itemWidth) => total + itemWidth, width) <=
721
+ toolbarWidth;
664
722
 
665
723
  const widgetsToRemove = [];
666
724
 
@@ -668,23 +726,11 @@ export class ReactiveToolbar extends Toolbar<Widget> {
668
726
  while (index < toIndex) {
669
727
  const widget = widgets[index];
670
728
  const name = Private.nameProperty.get(widget);
671
- // Compute the widget size only if
672
- // - the zoom has changed.
673
- // - the widget size has not been computed yet.
674
- let widgetWidth: number;
675
- if (this._zoomChanged) {
676
- widgetWidth = await this._saveWidgetWidth(name, widget);
677
- } else {
678
- // The widget widths can be 0px if it has been added to the toolbar but
679
- // not rendered, this is why we must use '||' instead of '??'.
680
- widgetWidth =
681
- this._getWidgetWidth(widget) ||
682
- (await this._saveWidgetWidth(name, widget));
683
- }
684
- width += widgetWidth;
729
+ width += widths[index];
685
730
  if (
686
731
  widgetsToRemove.length === 0 &&
687
732
  opener.isHidden &&
733
+ !fitWithoutOpener &&
688
734
  width + openerWidth > toolbarWidth
689
735
  ) {
690
736
  width += openerWidth;
@@ -701,20 +747,13 @@ export class ReactiveToolbar extends Toolbar<Widget> {
701
747
  }
702
748
  index++;
703
749
  }
704
- this._zoomChanged = false;
705
750
  return {
706
751
  width: width,
707
752
  widgetsToRemove: widgetsToRemove
708
753
  };
709
754
  }
710
755
 
711
- private async _saveWidgetWidth(
712
- name: string,
713
- widget: Widget
714
- ): Promise<number> {
715
- if (widget instanceof ReactWidget) {
716
- await widget.renderPromise;
717
- }
756
+ private _saveWidgetWidth(name: string, widget: Widget): number {
718
757
  const widgetWidth = widget.hasClass(TOOLBAR_SPACER_CLASS)
719
758
  ? 2
720
759
  : widget.node.clientWidth;
@@ -724,17 +763,17 @@ export class ReactiveToolbar extends Toolbar<Widget> {
724
763
 
725
764
  private _getWidgetWidth(widget: Widget): number {
726
765
  const widgetName = Private.nameProperty.get(widget);
727
- return this._widgetWidths.get(widgetName) || 0;
766
+ return this._widgetWidths.get(widgetName) ?? 0;
728
767
  }
729
768
 
730
769
  protected readonly popupOpener: ToolbarPopupOpener = new ToolbarPopupOpener();
731
770
  private readonly _resizer: Throttler;
732
771
  private readonly _widgetWidths = new Map<string, number>();
733
772
  private _widgetPositions = new Map<string, number>();
734
- // The zoom property is not the real browser zoom, but a value proportional to
735
- // the zoom, which is modified when the zoom changes.
736
- private _zoom: number;
737
- private _zoomChanged = true;
773
+ private _movingToPopup = new Set<Widget>();
774
+ private _itemResizeObserver = new ResizeObserver(
775
+ this._onItemResize.bind(this)
776
+ );
738
777
  }
739
778
 
740
779
  /**
@@ -854,8 +893,12 @@ export function ToolbarButtonComponent(
854
893
 
855
894
  const handleKeyDown = (event: React.KeyboardEvent) => {
856
895
  const { key } = event;
857
- if (key === 'Enter' || key === ' ') {
858
- props.onClick?.(event);
896
+ if ((key === 'Enter' || key === ' ') && props.onClick) {
897
+ // Stop the browser from clicking the button, and then also
898
+ // passing the key to whatever the action focused
899
+ // (a cell editor, a dialog button).
900
+ event.preventDefault();
901
+ props.onClick(event);
859
902
  }
860
903
  };
861
904
 
@@ -932,7 +975,7 @@ export class ToolbarButton extends ReactWidget {
932
975
  addToolbarButtonClass(this);
933
976
  this._enabled = props.enabled ?? true;
934
977
  this._pressed = this._enabled! && (props.pressed ?? false);
935
- this._onClick = props.onClick!;
978
+ this._onClick = props.onClick;
936
979
  }
937
980
 
938
981
  /**
@@ -994,7 +1037,7 @@ export class ToolbarButton extends ReactWidget {
994
1037
  this.pressed = !this.pressed;
995
1038
 
996
1039
  // Call the original click handler, if defined
997
- this._onClick(event);
1040
+ this._onClick?.(event);
998
1041
  };
999
1042
  }
1000
1043
 
@@ -1005,14 +1048,14 @@ export class ToolbarButton extends ReactWidget {
1005
1048
  noFocusOnClick={this.props.noFocusOnClick}
1006
1049
  pressed={this.pressed}
1007
1050
  enabled={this.enabled}
1008
- onClick={this.onClick}
1051
+ onClick={this._onClick ? this.onClick : undefined}
1009
1052
  />
1010
1053
  );
1011
1054
  }
1012
1055
 
1013
1056
  private _pressed: boolean;
1014
1057
  private _enabled: boolean;
1015
- private _onClick: (event?: React.SyntheticEvent) => void;
1058
+ private _onClick?: (event?: React.SyntheticEvent) => void;
1016
1059
  }
1017
1060
 
1018
1061
  /**
@@ -1105,7 +1148,7 @@ export class CommandToolbarButton extends ReactWidget {
1105
1148
  addCommandToolbarButtonClass(this);
1106
1149
  this.setCommandAttributes(commands, id, args);
1107
1150
  commands.commandChanged.connect((_, change) => {
1108
- if (change.id === props.id) {
1151
+ if (change.id === props.id || change.type === 'many-changed') {
1109
1152
  this.setCommandAttributes(commands, id, args);
1110
1153
  }
1111
1154
  }, this);
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
4
3
 
5
4
  import type { IDisposable } from '@lumino/disposable';
6
5
  import type { Message } from '@lumino/messaging';
@@ -12,9 +11,7 @@ import * as React from 'react';
12
11
  import type { Root } from 'react-dom/client';
13
12
  import { createRoot } from 'react-dom/client';
14
13
 
15
- type ReactRenderElement =
16
- | Array<React.ReactElement<any>>
17
- | React.ReactElement<any>;
14
+ type ReactRenderElement = Array<React.ReactElement> | React.ReactElement;
18
15
 
19
16
  /**
20
17
  * An abstract class for a Lumino widget which renders a React component.
@@ -63,14 +60,69 @@ export abstract class ReactWidget extends Widget {
63
60
  MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);
64
61
  }
65
62
 
63
+ /**
64
+ * The parent of the widget.
65
+ */
66
+ get parent(): Widget | null {
67
+ return super.parent;
68
+ }
69
+ set parent(value: Widget | null) {
70
+ // A move to a detached parent, or to one without a layout to attach the
71
+ // widget, unmounts at once, while the node is still in the document.
72
+ this._moving = value !== null && value.isAttached && value.layout !== null;
73
+ try {
74
+ super.parent = value;
75
+ } finally {
76
+ this._moving = false;
77
+ }
78
+ }
79
+
66
80
  /**
67
81
  * Called before the widget is detached from the DOM.
68
82
  */
69
83
  protected onBeforeDetach(msg: Message): void {
70
- // Unmount the component so it can tear down.
71
- if (this._rootDOM !== null) {
72
- this._rootDOM.unmount();
84
+ if (this._moving) {
85
+ // A widget moved to an attached parent is attached again synchronously
86
+ // and keeps its component state; unmount if the layout did not attach it.
87
+ queueMicrotask(() => {
88
+ if (!this.isAttached) {
89
+ this._unmount();
90
+ }
91
+ });
92
+ return;
93
+ }
94
+ // Unmount while the node is in the document, so that cleanups can still
95
+ // detach or measure what they rendered.
96
+ this._unmount();
97
+ }
98
+
99
+ /**
100
+ * Dispose the widget.
101
+ */
102
+ dispose(): void {
103
+ if (this.isDisposed) {
104
+ return;
105
+ }
106
+ // A widget disposed while already detached receives no `before-detach`
107
+ // message, and without this call its React root would stay mounted with
108
+ // every subscription of its components.
109
+ try {
110
+ this._unmount();
111
+ } finally {
112
+ super.dispose();
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Unmount the React tree, if one is mounted.
118
+ */
119
+ private _unmount(): void {
120
+ const root = this._rootDOM;
121
+ if (root !== null) {
122
+ // Forget the root first: a cleanup that throws would otherwise leave a
123
+ // root that cannot render again.
73
124
  this._rootDOM = null;
125
+ root.unmount();
74
126
  }
75
127
  }
76
128
 
@@ -99,8 +151,7 @@ export abstract class ReactWidget extends Widget {
99
151
  requestIdleCallback(() => resolve());
100
152
  } else {
101
153
  // If the virtual node is null, unmount the node content
102
- this._rootDOM.unmount();
103
- this._rootDOM = null;
154
+ this._unmount();
104
155
  requestIdleCallback(() => resolve());
105
156
  }
106
157
  });
@@ -109,6 +160,7 @@ export abstract class ReactWidget extends Widget {
109
160
  // Set whenever a new render is triggered and resolved when it is finished.
110
161
  renderPromise?: Promise<void>;
111
162
  private _rootDOM: Root | null = null;
163
+ private _moving = false;
112
164
  }
113
165
 
114
166
  /**
@@ -1328,7 +1328,7 @@ export class WindowedList<
1328
1328
  this._viewport.dataset.isScrolling = 'true';
1329
1329
  }
1330
1330
 
1331
- if (this._timerToClearScrollStatus) {
1331
+ if (this._timerToClearScrollStatus !== null) {
1332
1332
  window.clearTimeout(this._timerToClearScrollStatus);
1333
1333
  }
1334
1334
  // TODO: remove once `scrollend` event is supported by Safari
@@ -1694,11 +1694,11 @@ export class WindowedList<
1694
1694
  * Clear any outstanding timeout and enqueue scrolling to a new item.
1695
1695
  */
1696
1696
  private _resetScrollToItem(): void {
1697
- if (this._resetScrollToItemTimeout) {
1697
+ if (this._resetScrollToItemTimeout !== null) {
1698
1698
  clearTimeout(this._resetScrollToItemTimeout);
1699
1699
  }
1700
1700
 
1701
- if (this._programmaticScrollTimeout) {
1701
+ if (this._programmaticScrollTimeout !== null) {
1702
1702
  clearTimeout(this._programmaticScrollTimeout);
1703
1703
  }
1704
1704
 
@@ -1841,7 +1841,7 @@ export class WindowedList<
1841
1841
  * Handle `scrollend` events on the scroller.
1842
1842
  */
1843
1843
  private _onScrollEnd() {
1844
- if (this._timerToClearScrollStatus) {
1844
+ if (this._timerToClearScrollStatus !== null) {
1845
1845
  window.clearTimeout(this._timerToClearScrollStatus);
1846
1846
  }
1847
1847
  this._viewport.dataset.isScrolling = 'false';
package/src/hoverbox.ts CHANGED
@@ -214,23 +214,15 @@ export namespace HoverBox {
214
214
  const initialHeight = options.size
215
215
  ? options.size.height
216
216
  : node.getBoundingClientRect().height;
217
- const offsetAbove =
218
- (options.offset &&
219
- options.offset.vertical &&
220
- options.offset.vertical.above) ||
221
- 0;
222
- const offsetBelow =
223
- (options.offset &&
224
- options.offset.vertical &&
225
- options.offset.vertical.below) ||
226
- 0;
217
+ const offsetAbove = options.offset?.vertical?.above ?? 0;
218
+ const offsetBelow = options.offset?.vertical?.below ?? 0;
227
219
  let top = renderBelow
228
220
  ? hostRect.bottom - spaceBelow + offsetBelow
229
221
  : hostRect.top + spaceAbove - initialHeight + offsetAbove;
230
222
  node.style.top = `${Math.floor(top)}px`;
231
223
 
232
224
  // Position the box horizontally.
233
- const offsetHorizontal = (options.offset && options.offset.horizontal) || 0;
225
+ const offsetHorizontal = options.offset?.horizontal ?? 0;
234
226
  let left = anchor.left + offsetHorizontal;
235
227
 
236
228
  node.style.left = `${Math.ceil(left)}px`;
@@ -104,6 +104,7 @@ import reactSvgstr from '../../style/icons/filetype/react.svg';
104
104
  import redoSvgstr from '../../style/icons/toolbar/redo.svg';
105
105
  import refreshSvgstr from '../../style/icons/toolbar/refresh.svg';
106
106
  import regexSvgstr from '../../style/icons/search/regex.svg';
107
+ import restoreSvgstr from '../../style/icons/toolbar/restore.svg';
107
108
  import runSvgstr from '../../style/icons/toolbar/run.svg';
108
109
  import runningSvgstr from '../../style/icons/sidebar/running.svg';
109
110
  import saveSvgstr from '../../style/icons/toolbar/save.svg';
@@ -231,6 +232,7 @@ export const reactIcon = new LabIcon({ name: 'ui-components:react', svgstr: reac
231
232
  export const redoIcon = new LabIcon({ name: 'ui-components:redo', svgstr: redoSvgstr });
232
233
  export const refreshIcon = new LabIcon({ name: 'ui-components:refresh', svgstr: refreshSvgstr });
233
234
  export const regexIcon = new LabIcon({ name: 'ui-components:regex', svgstr: regexSvgstr });
235
+ export const restoreIcon = new LabIcon({ name: 'ui-components:restore', svgstr: restoreSvgstr });
234
236
  export const runIcon = new LabIcon({ name: 'ui-components:run', svgstr: runSvgstr });
235
237
  export const runningIcon = new LabIcon({ name: 'ui-components:running', svgstr: runningSvgstr });
236
238
  export const saveIcon = new LabIcon({ name: 'ui-components:save', svgstr: saveSvgstr });