@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
 
5
4
  import type { IDisposable } from '@lumino/disposable';
6
5
  import type { ISignal } from '@lumino/signaling';
@@ -16,6 +15,8 @@ const submenuIcon = caretRightIcon.bindprops({
16
15
  stylesheet: 'menuItem'
17
16
  });
18
17
 
18
+ type WritableMenuRenderer = Menu & { renderer: Menu.IRenderer };
19
+
19
20
  /**
20
21
  * An object which implements a universal context menu.
21
22
  * Tweaked to use inline svg icons
@@ -135,7 +136,7 @@ export namespace MenuSvg {
135
136
  // override renderer, if needed
136
137
  if (menu.renderer === Menu.defaultRenderer) {
137
138
  // cast away readonly on menu.renderer
138
- (menu as any).renderer = MenuSvg.defaultRenderer;
139
+ (menu as WritableMenuRenderer).renderer = MenuSvg.defaultRenderer;
139
140
  }
140
141
 
141
142
  // ensure correct renderer on any submenus that get added in the future
@@ -149,7 +150,7 @@ export namespace MenuSvg {
149
150
  };
150
151
 
151
152
  // recurse through submenus
152
- for (const item of (menu as any)._items as Menu.IItem[]) {
153
+ for (const item of menu.items) {
153
154
  if (item.submenu) {
154
155
  overrideDefaultRenderer(item.submenu);
155
156
  }
@@ -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 { ITranslator } from '@jupyterlab/translation';
6
5
  import { nullTranslator } from '@jupyterlab/translation';
@@ -43,7 +42,7 @@ export namespace TabBarSvg {
43
42
  *
44
43
  * Falls back to the `jpTabLabel` dataset entry, then to the caption.
45
44
  */
46
- export function titleLabel(title: Title<any>): string {
45
+ export function titleLabel(title: Title<unknown>): string {
47
46
  return title.label || title.dataset['jpTabLabel'] || title.caption;
48
47
  }
49
48
 
@@ -58,7 +57,7 @@ export namespace TabBarSvg {
58
57
  *
59
58
  * @returns A virtual element representing the tab label.
60
59
  */
61
- renderLabel(data: TabBar.IRenderData<any>): VirtualElement {
60
+ renderLabel(data: TabBar.IRenderData<unknown>): VirtualElement {
62
61
  return h.div({ className: 'lm-TabBar-tabLabel' }, titleLabel(data.title));
63
62
  }
64
63
 
@@ -69,7 +68,7 @@ export namespace TabBarSvg {
69
68
  *
70
69
  * @returns A virtual element representing the tab close icon.
71
70
  */
72
- renderCloseIcon(data: TabBar.IRenderData<any>): VirtualElement {
71
+ renderCloseIcon(data: TabBar.IRenderData<unknown>): VirtualElement {
73
72
  const trans = (TabBarSvg.translator ?? nullTranslator).load('jupyterlab');
74
73
  const label = titleLabel(data.title);
75
74
  const title = label ? trans.__('Close %1', label) : trans.__('Close tab');
package/src/utils.ts CHANGED
@@ -1,14 +1,15 @@
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 { Text } from '@jupyterlab/coreutils';
6
5
 
6
+ type ClassNameMapping = { [className: string]: unknown };
7
+
7
8
  /**
8
9
  * Inner works of class combining functions
9
10
  */
10
11
  function _classes(
11
- classes: (string | false | undefined | null | { [className: string]: any })[]
12
+ classes: (string | false | undefined | null | ClassNameMapping)[]
12
13
  ): string[] {
13
14
  return classes
14
15
  .map(c =>
@@ -30,13 +31,7 @@ function _classes(
30
31
  * @returns A single string with the combined className
31
32
  */
32
33
  export function classes(
33
- ...classes: (
34
- | string
35
- | false
36
- | undefined
37
- | null
38
- | { [className: string]: any }
39
- )[]
34
+ ...classes: (string | false | undefined | null | ClassNameMapping)[]
40
35
  ): string {
41
36
  return _classes(classes).join(' ');
42
37
  }
@@ -49,13 +44,7 @@ export function classes(
49
44
  * @returns A single string with the combined className
50
45
  */
51
46
  export function classesDedupe(
52
- ...classes: (
53
- | string
54
- | false
55
- | undefined
56
- | null
57
- | { [className: string]: any }
58
- )[]
47
+ ...classes: (string | false | undefined | null | ClassNameMapping)[]
59
48
  ): string {
60
49
  return [...new Set(_classes(classes))].join(' ');
61
50
  }
@@ -108,6 +108,7 @@
108
108
  --jp-icon-redo: url('icons/toolbar/redo.svg');
109
109
  --jp-icon-refresh: url('icons/toolbar/refresh.svg');
110
110
  --jp-icon-regex: url('icons/search/regex.svg');
111
+ --jp-icon-restore: url('icons/toolbar/restore.svg');
111
112
  --jp-icon-run: url('icons/toolbar/run.svg');
112
113
  --jp-icon-running: url('icons/sidebar/running.svg');
113
114
  --jp-icon-save: url('icons/toolbar/save.svg');
@@ -525,6 +526,10 @@
525
526
  background-image: var(--jp-icon-regex);
526
527
  }
527
528
 
529
+ .jp-RestoreIcon {
530
+ background-image: var(--jp-icon-restore);
531
+ }
532
+
528
533
  .jp-RunIcon {
529
534
  background-image: var(--jp-icon-run);
530
535
  }
@@ -1,6 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 50.978 50.978">
2
- <g fill="#616161" class="jp-icon3">
3
- <path d="M43.52 7.458C38.711 2.648 32.307 0 25.489 0 18.67 0 12.266 2.648 7.458 7.458c-9.943 9.941-9.943 26.119 0 36.062 4.809 4.809 11.212 7.456 18.031 7.458h.002c6.816 0 13.221-2.648 18.029-7.458 4.809-4.809 7.457-11.212 7.457-18.03 0-6.82-2.649-13.224-7.457-18.032m-1.414 34.647c-4.432 4.431-10.332 6.872-16.615 6.872h-.002c-6.285-.001-12.187-2.441-16.617-6.872-9.162-9.163-9.162-24.071 0-33.233C13.303 4.44 19.204 2 25.489 2c6.284 0 12.186 2.44 16.617 6.872 4.431 4.431 6.871 10.332 6.871 16.617 0 6.283-2.441 12.186-6.871 16.616"/>
4
- <path d="M23.578 32.218q-.034-2.602.496-3.972t2.272-3.253q.702-.805 1.367-1.575.939-1.13 1.436-2.175.496-1.061.495-2.5 0-1.643-.779-2.979-.848-1.319-2.806-1.369-2.703.085-3.55 1.832a5.3 5.3 0 0 0-.607 1.814 11.3 11.3 0 0 0-.207 2.174h-2.937q-.136-3.312 1.493-5.719 1.593-2.459 5.378-2.527 3.24.034 5.141 1.758 1.918 1.74 1.95 4.811 0 1.712-.41 2.911a7.6 7.6 0 0 1-1.268 2.243 22 22 0 0 1-1.73 2.002 34 34 0 0 0-1.987 2.346 5.2 5.2 0 0 0-.565 1.199q-.24 1.438-.171 2.979zm0 6.002v-3.484h3.076v3.484z"/>
5
- </g>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" fill="currentColor"
3
+ d="m7.2 10.9h1v1.1h-1zm0.699-7.2c-0.843 0-1.45 0.413-1.75 0.881-0.3 0.467-0.354 0.937-0.354 1.22v0.5h1v-0.5c0-0.117 0.0458-0.447 0.195-0.68 0.15-0.233 0.347-0.422 0.904-0.422 0.629 0 0.909 0.128 1.06 0.289 0.148 0.161 0.244 0.467 0.244 1.01 0 0.322-0.374 0.816-0.879 1.4s-1.12 1.27-1.12 2.2l-1.95e-4 0.5h1l1.95e-4 -0.5c1.8e-4 -0.462 0.382-0.977 0.877-1.55 0.495-0.57 1.12-1.17 1.12-2.05 0-0.656-0.105-1.25-0.508-1.69-0.402-0.439-1.02-0.613-1.79-0.613zm0.101-3.7c-4.41 0-8 3.59-8 8 0 4.41 3.59 8 8 8 4.41 0 8-3.59 8-8 0-4.41-3.59-8-8-8zm0 1c3.87 0 7 3.13 7 7 0 3.87-3.13 7-7 7-3.87 0-7-3.13-7-7 0-3.87 3.13-7 7-7z" />
6
4
  </svg>
@@ -1,3 +1,3 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 24 24">
2
- <path fill="#616161" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z" class="jp-icon3"/>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" fill="currentColor" d="m13 8.8h-4v4h-1.6v-4h-4v-1.6h4v-4h1.6v4h4z"/>
3
3
  </svg>
@@ -1,3 +1,3 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 24 24">
2
- <path fill="#616161" d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" class="jp-icon3 jp-icon-selectable"/>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3 jp-icon-selectable" d="m6 11-3-3-1 1 4 4 8.4-8.4-1-1z" fill="currentColor"/>
3
3
  </svg>
@@ -1,5 +1,5 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 24 24">
2
- <circle cx="12" cy="12" r="11" fill="none" class="jp-icon-none jp-icon-selectable-inverse jp-icon3-hover"/>
3
- <path fill="#616161" d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" class="jp-icon3 jp-icon-selectable jp-icon-accent2-hover"/>
4
- <circle cx="12" cy="12" r="7" fill="none" class="jp-icon-none jp-icon-busy"/>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
2
+ <circle fill="none" class="jp-icon-none jp-icon-selectable-inverse jp-icon3-hover" cx="8" cy="8" r="7.3"/>
3
+ <path class="jp-icon3 jp-icon-selectable jp-icon-accent2-hover" d="m13 4.2-1-1-3.8 3.8-3.8-3.8-1 1 3.8 3.8-3.8 3.8 1 1 3.8-3.8 3.8 3.8 1-1-3.8-3.8z" fill="currentColor"/>
4
+ <circle class="jp-icon-none jp-icon-busy" cx="8" cy="8" r="4.6" fill="none"/>
5
5
  </svg>
@@ -1,3 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
2
- <path fill="#626262" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z" class="jp-icon3"/>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" fill="currentColor"
3
+ d="m4 13c0 0.7 0.6 1.3 1.3 1.3h5.4c0.7 0 1.3-0.6 1.3-1.3v-8h-8zm8.6-10h-2.2l-0.7-0.7h-3.4l-0.7 0.7h-2.2l1e-7 1.3h9.2z"/>
3
4
  </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" fill="currentColor"
3
+ d="m1.5 1.5v5.4h5.4l-2.3-2.3a4.9 4.9 0 0 1 3.5-1.5 4.9 4.9 0 0 1 4.9 4.9 4.9 4.9 0 0 1-4.9 4.9 4.9 4.9 0 0 1-4.8-3.7h-1.6a6.5 6.5 0 0 0 6.4 5.3 6.5 6.5 0 0 0 6.5-6.5 6.5 6.5 0 0 0-6.5-6.5 6.5 6.5 0 0 0-4.6 2z"/>
4
+ </svg>