@jupyterlab/ui-components 4.6.0-alpha.2 → 4.6.0-alpha.4
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/FormRendererRegistry.d.ts +1 -1
- package/lib/components/accordiontoolbar.d.ts +2 -1
- package/lib/components/accordiontoolbar.js.map +1 -1
- package/lib/components/button.js.map +1 -1
- package/lib/components/collapser.d.ts +2 -2
- package/lib/components/collapser.js.map +1 -1
- package/lib/components/form.d.ts +4 -4
- package/lib/components/form.js.map +1 -1
- package/lib/components/htmlselect.d.ts +2 -2
- package/lib/components/htmlselect.js +1 -3
- package/lib/components/htmlselect.js.map +1 -1
- package/lib/components/inputgroup.js.map +1 -1
- package/lib/components/menu.d.ts +1 -1
- package/lib/components/menu.js.map +1 -1
- package/lib/components/search.d.ts +1 -1
- package/lib/components/search.js +1 -1
- package/lib/components/search.js.map +1 -1
- package/lib/components/sidepanel.d.ts +1 -1
- package/lib/components/sidepanel.js.map +1 -1
- package/lib/components/spinner.d.ts +1 -1
- package/lib/components/switch.d.ts +2 -2
- package/lib/components/switch.js.map +1 -1
- package/lib/components/table.d.ts +2 -1
- package/lib/components/table.js.map +1 -1
- package/lib/components/toolbar.d.ts +5 -4
- package/lib/components/toolbar.js +1 -1
- package/lib/components/toolbar.js.map +1 -1
- package/lib/components/vdom.d.ts +4 -3
- package/lib/components/vdom.js.map +1 -1
- package/lib/components/windowedlist.d.ts +12 -5
- package/lib/components/windowedlist.js +37 -10
- package/lib/components/windowedlist.js.map +1 -1
- package/lib/hoverbox.js.map +1 -1
- package/lib/icon/labicon.d.ts +2 -2
- package/lib/icon/labicon.js +0 -1
- package/lib/icon/labicon.js.map +1 -1
- package/lib/icon/widgets/commandpalettesvg.d.ts +1 -1
- package/lib/icon/widgets/commandpalettesvg.js +1 -3
- package/lib/icon/widgets/commandpalettesvg.js.map +1 -1
- package/lib/icon/widgets/menusvg.d.ts +4 -3
- package/lib/icon/widgets/menusvg.js.map +1 -1
- package/lib/icon/widgets/tabbarsvg.d.ts +4 -3
- package/lib/icon/widgets/tabbarsvg.js.map +1 -1
- package/lib/style/icon.d.ts +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +8 -8
- package/src/FormRendererRegistry.tsx +1 -1
- package/src/components/accordiontoolbar.ts +5 -8
- package/src/components/button.tsx +1 -2
- package/src/components/collapser.ts +5 -3
- package/src/components/form.tsx +15 -20
- package/src/components/htmlselect.tsx +7 -6
- package/src/components/inputgroup.tsx +1 -2
- package/src/components/menu.ts +5 -4
- package/src/components/search.tsx +2 -2
- package/src/components/sidepanel.ts +2 -5
- package/src/components/spinner.ts +1 -1
- package/src/components/switch.ts +3 -2
- package/src/components/table.tsx +2 -1
- package/src/components/toolbar.tsx +10 -7
- package/src/components/vdom.ts +7 -4
- package/src/components/windowedlist.ts +47 -19
- package/src/hoverbox.ts +8 -6
- package/src/icon/labicon.tsx +8 -4
- package/src/icon/widgets/commandpalettesvg.ts +3 -4
- package/src/icon/widgets/menusvg.ts +5 -3
- package/src/icon/widgets/tabbarsvg.ts +6 -3
- package/src/style/icon.ts +1 -1
- package/src/utils.ts +2 -2
- package/style/base.css +15 -0
- package/style/rjsfTemplates.css +1 -0
- package/style/styling.css +1 -0
- package/style/windowedlist.css +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/ui-components",
|
|
3
|
-
"version": "4.6.0-alpha.
|
|
3
|
+
"version": "4.6.0-alpha.4",
|
|
4
4
|
"description": "JupyterLab - UI components written in React",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@jupyter/react-components": "^0.16.6",
|
|
44
44
|
"@jupyter/web-components": "^0.16.6",
|
|
45
|
-
"@jupyterlab/coreutils": "^6.6.0-alpha.
|
|
46
|
-
"@jupyterlab/observables": "^5.6.0-alpha.
|
|
47
|
-
"@jupyterlab/rendermime-interfaces": "^3.14.0-alpha.
|
|
48
|
-
"@jupyterlab/translation": "^4.6.0-alpha.
|
|
45
|
+
"@jupyterlab/coreutils": "^6.6.0-alpha.4",
|
|
46
|
+
"@jupyterlab/observables": "^5.6.0-alpha.4",
|
|
47
|
+
"@jupyterlab/rendermime-interfaces": "^3.14.0-alpha.4",
|
|
48
|
+
"@jupyterlab/translation": "^4.6.0-alpha.4",
|
|
49
49
|
"@lumino/algorithm": "^2.0.4",
|
|
50
50
|
"@lumino/commands": "^2.3.3",
|
|
51
51
|
"@lumino/coreutils": "^2.2.2",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@lumino/properties": "^2.0.4",
|
|
56
56
|
"@lumino/signaling": "^2.1.5",
|
|
57
57
|
"@lumino/virtualdom": "^2.0.4",
|
|
58
|
-
"@lumino/widgets": "^2.7.
|
|
58
|
+
"@lumino/widgets": "^2.7.5",
|
|
59
59
|
"@rjsf/core": "^5.13.4",
|
|
60
60
|
"@rjsf/utils": "^5.13.4",
|
|
61
61
|
"react": "^18.2.0",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"typestyle": "^2.0.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@jupyterlab/testing": "^4.6.0-alpha.
|
|
66
|
+
"@jupyterlab/testing": "^4.6.0-alpha.4",
|
|
67
67
|
"@types/jest": "^29.2.0",
|
|
68
68
|
"@types/react": "^18.0.26",
|
|
69
69
|
"jest": "^29.2.0",
|
|
70
70
|
"rimraf": "~5.0.5",
|
|
71
71
|
"svgo": "^3.3.2",
|
|
72
|
-
"typescript": "~5.
|
|
72
|
+
"typescript": "~5.9.3"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"react": "^18.2.0"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
| Distributed under the terms of the Modified BSD License.
|
|
4
4
|
|----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
-
import { IFormRenderer, IFormRendererRegistry } from './tokens';
|
|
6
|
+
import type { IFormRenderer, IFormRendererRegistry } from './tokens';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A registry for property renderers used in the FormEditor component.
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import { Message
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Title,
|
|
9
|
-
Widget
|
|
10
|
-
} from '@lumino/widgets';
|
|
4
|
+
import type { Message } from '@lumino/messaging';
|
|
5
|
+
import { MessageLoop } from '@lumino/messaging';
|
|
6
|
+
import type { Title } from '@lumino/widgets';
|
|
7
|
+
import { AccordionLayout, AccordionPanel, Widget } from '@lumino/widgets';
|
|
11
8
|
import { caretDownIcon } from '../icon';
|
|
12
|
-
import { Toolbar } from './toolbar';
|
|
9
|
+
import type { Toolbar } from './toolbar';
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
* Accordion panel layout that adds a toolbar in widget title if present.
|
|
@@ -9,8 +9,7 @@ import { classes } from '../utils';
|
|
|
9
9
|
/**
|
|
10
10
|
* Button component property
|
|
11
11
|
*/
|
|
12
|
-
export interface IButtonProps
|
|
13
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
12
|
+
export interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
14
13
|
/**
|
|
15
14
|
* Whether this button should use minimal styles.
|
|
16
15
|
*/
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import { Message } from '@lumino/messaging';
|
|
5
|
-
import { ISignal
|
|
6
|
-
import {
|
|
4
|
+
import type { Message } from '@lumino/messaging';
|
|
5
|
+
import type { ISignal } from '@lumino/signaling';
|
|
6
|
+
import { Signal } from '@lumino/signaling';
|
|
7
|
+
import type { Title } from '@lumino/widgets';
|
|
8
|
+
import { Panel, PanelLayout, Widget } from '@lumino/widgets';
|
|
7
9
|
|
|
8
10
|
import { caretDownIcon } from '../icon';
|
|
9
11
|
|
package/src/components/form.tsx
CHANGED
|
@@ -4,30 +4,26 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { Button } from '@jupyter/react-components';
|
|
7
|
-
import { ITranslator
|
|
8
|
-
import {
|
|
7
|
+
import type { ITranslator } from '@jupyterlab/translation';
|
|
8
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
9
|
+
import type { ReadonlyJSONObject } from '@lumino/coreutils';
|
|
10
|
+
import { JSONExt } from '@lumino/coreutils';
|
|
9
11
|
|
|
10
|
-
import
|
|
12
|
+
import type { FormProps, IChangeEvent } from '@rjsf/core';
|
|
13
|
+
import Form from '@rjsf/core';
|
|
11
14
|
|
|
12
|
-
import {
|
|
13
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
15
|
+
import type {
|
|
14
16
|
ArrayFieldTemplateProps,
|
|
15
|
-
canExpand,
|
|
16
17
|
FieldTemplateProps,
|
|
17
|
-
getTemplate,
|
|
18
18
|
ObjectFieldTemplateProps,
|
|
19
19
|
Registry,
|
|
20
20
|
UiSchema
|
|
21
21
|
} from '@rjsf/utils';
|
|
22
|
+
import { ADDITIONAL_PROPERTY_FLAG, canExpand, getTemplate } from '@rjsf/utils';
|
|
22
23
|
|
|
23
24
|
import React from 'react';
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
deleteIcon,
|
|
27
|
-
LabIcon,
|
|
28
|
-
moveDownIcon,
|
|
29
|
-
moveUpIcon
|
|
30
|
-
} from '../icon';
|
|
25
|
+
import type { LabIcon } from '../icon';
|
|
26
|
+
import { addIcon, deleteIcon, moveDownIcon, moveUpIcon } from '../icon';
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* Default `ui:options` for the UiSchema.
|
|
@@ -565,10 +561,10 @@ const CustomTemplateFactory = (options: FormComponent.ILabCustomizerProps) =>
|
|
|
565
561
|
isRoot
|
|
566
562
|
? 'jp-root'
|
|
567
563
|
: schema.type === 'object'
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
564
|
+
? 'jp-objectFieldWrapper'
|
|
565
|
+
: schema.type === 'array'
|
|
566
|
+
? 'jp-arrayFieldWrapper'
|
|
567
|
+
: 'jp-inputFieldWrapper jp-FormGroup-contentItem'
|
|
572
568
|
}`}
|
|
573
569
|
>
|
|
574
570
|
{children}
|
|
@@ -609,8 +605,7 @@ const CustomTemplateFactory = (options: FormComponent.ILabCustomizerProps) =>
|
|
|
609
605
|
* FormComponent properties
|
|
610
606
|
*/
|
|
611
607
|
export interface IFormComponentProps<T = ReadonlyJSONObject>
|
|
612
|
-
extends FormProps<T>,
|
|
613
|
-
FormComponent.ILabCustomizerProps {
|
|
608
|
+
extends FormProps<T>, FormComponent.ILabCustomizerProps {
|
|
614
609
|
/**
|
|
615
610
|
*
|
|
616
611
|
*/
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import type { LabIcon } from '../icon';
|
|
6
|
+
import { caretDownEmptyIcon } from '../icon';
|
|
6
7
|
import { classes } from '../utils';
|
|
7
|
-
import {
|
|
8
|
+
import type { IElementRefProps } from './interface';
|
|
9
|
+
import { DEFAULT_STYLE_CLASS } from './interface';
|
|
8
10
|
|
|
9
11
|
export const HTML_SELECT_CLASS = 'jp-HTMLSelect';
|
|
10
12
|
|
|
@@ -31,7 +33,8 @@ export interface IOptionProps {
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export interface IHTMLSelectProps
|
|
34
|
-
extends
|
|
36
|
+
extends
|
|
37
|
+
IElementRefProps<HTMLSelectElement>,
|
|
35
38
|
React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
36
39
|
defaultStyle?: boolean;
|
|
37
40
|
|
|
@@ -57,9 +60,7 @@ export class HTMLSelect extends React.Component<IHTMLSelectProps> {
|
|
|
57
60
|
|
|
58
61
|
const cls = classes(
|
|
59
62
|
HTML_SELECT_CLASS,
|
|
60
|
-
{
|
|
61
|
-
[DEFAULT_STYLE_CLASS]: defaultStyle
|
|
62
|
-
},
|
|
63
|
+
{ [DEFAULT_STYLE_CLASS]: defaultStyle },
|
|
63
64
|
className
|
|
64
65
|
);
|
|
65
66
|
|
|
@@ -10,8 +10,7 @@ import { classes } from '../utils';
|
|
|
10
10
|
/**
|
|
11
11
|
* InputGroup component properties
|
|
12
12
|
*/
|
|
13
|
-
export interface IInputGroupProps
|
|
14
|
-
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
13
|
+
export interface IInputGroupProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
15
14
|
/**
|
|
16
15
|
* Pass a ref to the input element
|
|
17
16
|
*/
|
package/src/components/menu.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
/* global WeakRef */
|
|
5
5
|
|
|
6
6
|
import { ArrayExt } from '@lumino/algorithm';
|
|
7
|
-
import { CommandRegistry } from '@lumino/commands';
|
|
8
|
-
import { ReadonlyJSONObject } from '@lumino/coreutils';
|
|
9
|
-
import {
|
|
7
|
+
import type { CommandRegistry } from '@lumino/commands';
|
|
8
|
+
import type { ReadonlyJSONObject } from '@lumino/coreutils';
|
|
9
|
+
import type { IDisposable } from '@lumino/disposable';
|
|
10
|
+
import { DisposableDelegate } from '@lumino/disposable';
|
|
10
11
|
import { Signal } from '@lumino/signaling';
|
|
11
|
-
import { VirtualElement } from '@lumino/virtualdom';
|
|
12
|
+
import type { VirtualElement } from '@lumino/virtualdom';
|
|
12
13
|
import { Menu } from '@lumino/widgets';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -5,7 +5,7 @@ import { StringExt } from '@lumino/algorithm';
|
|
|
5
5
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { Search } from '@jupyter/react-components';
|
|
7
7
|
import { searchIcon } from '../icon';
|
|
8
|
-
import { ISignal } from '@lumino/signaling';
|
|
8
|
+
import type { ISignal } from '@lumino/signaling';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The class name added to the filebrowser crumbs node.
|
|
@@ -114,7 +114,7 @@ export function fuzzySearch(source: string, query: string): IScore | null {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// Update the match if the score is better.
|
|
117
|
-
if (match
|
|
117
|
+
if (match.score <= score) {
|
|
118
118
|
score = match.score;
|
|
119
119
|
indices = match.indices;
|
|
120
120
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
nullTranslator,
|
|
7
|
-
TranslationBundle
|
|
8
|
-
} from '@jupyterlab/translation';
|
|
4
|
+
import type { ITranslator, TranslationBundle } from '@jupyterlab/translation';
|
|
5
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
9
6
|
import { AccordionPanel, Panel, PanelLayout, Widget } from '@lumino/widgets';
|
|
10
7
|
import { AccordionToolbar } from './accordiontoolbar';
|
|
11
8
|
import { Toolbar } from './toolbar';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
| Distributed under the terms of the Modified BSD License.
|
|
4
4
|
|----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
-
import { Message } from '@lumino/messaging';
|
|
6
|
+
import type { Message } from '@lumino/messaging';
|
|
7
7
|
import { Widget } from '@lumino/widgets';
|
|
8
8
|
|
|
9
9
|
/**
|
package/src/components/switch.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import { IChangedArgs } from '@jupyterlab/coreutils';
|
|
5
|
-
import { ISignal
|
|
4
|
+
import type { IChangedArgs } from '@jupyterlab/coreutils';
|
|
5
|
+
import type { ISignal } from '@lumino/signaling';
|
|
6
|
+
import { Signal } from '@lumino/signaling';
|
|
6
7
|
import { Widget } from '@lumino/widgets';
|
|
7
8
|
|
|
8
9
|
/**
|
package/src/components/table.tsx
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
7
|
+
import React, { useState } from 'react';
|
|
7
8
|
import { caretDownIcon, caretUpIcon } from '../icon';
|
|
8
9
|
|
|
9
10
|
export const TABLE_CLASS = 'jp-sortable-table';
|
|
@@ -8,13 +8,16 @@ import {
|
|
|
8
8
|
jpToolbar,
|
|
9
9
|
provideJupyterDesignSystem
|
|
10
10
|
} from '@jupyter/web-components';
|
|
11
|
-
import { ITranslator
|
|
11
|
+
import type { ITranslator } from '@jupyterlab/translation';
|
|
12
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
12
13
|
import { find, map, some } from '@lumino/algorithm';
|
|
13
14
|
import { CommandRegistry } from '@lumino/commands';
|
|
14
|
-
import { ReadonlyJSONObject } from '@lumino/coreutils';
|
|
15
|
-
import { Message
|
|
15
|
+
import type { ReadonlyJSONObject } from '@lumino/coreutils';
|
|
16
|
+
import type { Message } from '@lumino/messaging';
|
|
17
|
+
import { MessageLoop } from '@lumino/messaging';
|
|
16
18
|
import { AttachedProperty } from '@lumino/properties';
|
|
17
|
-
import { Layout
|
|
19
|
+
import type { Layout } from '@lumino/widgets';
|
|
20
|
+
import { PanelLayout, Widget } from '@lumino/widgets';
|
|
18
21
|
import { Throttler } from '@lumino/polling';
|
|
19
22
|
import * as React from 'react';
|
|
20
23
|
import { ellipsesIcon, LabIcon } from '../icon';
|
|
@@ -821,7 +824,7 @@ export function ToolbarButtonComponent(
|
|
|
821
824
|
// In some browsers, a button click event moves the focus from the main
|
|
822
825
|
// content to the button (see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus).
|
|
823
826
|
const handleClick =
|
|
824
|
-
props.noFocusOnClick ?? false
|
|
827
|
+
(props.noFocusOnClick ?? false)
|
|
825
828
|
? undefined
|
|
826
829
|
: (event: React.MouseEvent) => {
|
|
827
830
|
if (event.button === 0) {
|
|
@@ -837,7 +840,7 @@ export function ToolbarButtonComponent(
|
|
|
837
840
|
// Currently this is mostly useful for the notebook panel, to retrieve the focused
|
|
838
841
|
// cell before the click event.
|
|
839
842
|
const handleMouseDown =
|
|
840
|
-
props.noFocusOnClick ?? false
|
|
843
|
+
(props.noFocusOnClick ?? false)
|
|
841
844
|
? (event: React.MouseEvent) => {
|
|
842
845
|
// Fire action only when left button is pressed.
|
|
843
846
|
if (event.button === 0) {
|
|
@@ -890,7 +893,7 @@ export function ToolbarButtonComponent(
|
|
|
890
893
|
>
|
|
891
894
|
{(props.icon || props.iconClass) && (
|
|
892
895
|
<LabIcon.resolveReact
|
|
893
|
-
icon={props.pressed ? props.pressedIcon ?? props.icon : props.icon}
|
|
896
|
+
icon={props.pressed ? (props.pressedIcon ?? props.icon) : props.icon}
|
|
894
897
|
iconClass={
|
|
895
898
|
// add some extra classes for proper support of icons-as-css-background
|
|
896
899
|
classes(props.iconClass, 'jp-Icon')
|
package/src/components/vdom.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import { IDisposable } from '@lumino/disposable';
|
|
5
|
-
import { Message
|
|
6
|
-
import {
|
|
4
|
+
import type { IDisposable } from '@lumino/disposable';
|
|
5
|
+
import type { Message } from '@lumino/messaging';
|
|
6
|
+
import { MessageLoop } from '@lumino/messaging';
|
|
7
|
+
import type { ISignal } from '@lumino/signaling';
|
|
8
|
+
import { Signal } from '@lumino/signaling';
|
|
7
9
|
import { Widget } from '@lumino/widgets';
|
|
8
10
|
import * as React from 'react';
|
|
9
|
-
import {
|
|
11
|
+
import type { Root } from 'react-dom/client';
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
10
13
|
|
|
11
14
|
type ReactRenderElement =
|
|
12
15
|
| Array<React.ReactElement<any>>
|
|
@@ -10,14 +10,16 @@
|
|
|
10
10
|
* - https://github.com/WICG/virtual-scroller/
|
|
11
11
|
* Licensed by Contributors under the [W3C Software and Document License](http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document)
|
|
12
12
|
*/
|
|
13
|
-
import { IChangedArgs } from '@jupyterlab/coreutils';
|
|
14
|
-
import { IObservableList } from '@jupyterlab/observables';
|
|
13
|
+
import type { IChangedArgs } from '@jupyterlab/coreutils';
|
|
14
|
+
import type { IObservableList } from '@jupyterlab/observables';
|
|
15
15
|
import { ArrayExt } from '@lumino/algorithm';
|
|
16
16
|
import { PromiseDelegate } from '@lumino/coreutils';
|
|
17
|
-
import { IDisposable } from '@lumino/disposable';
|
|
18
|
-
import { Message
|
|
17
|
+
import type { IDisposable } from '@lumino/disposable';
|
|
18
|
+
import type { Message } from '@lumino/messaging';
|
|
19
|
+
import { MessageLoop } from '@lumino/messaging';
|
|
19
20
|
import { Throttler } from '@lumino/polling';
|
|
20
|
-
import { ISignal
|
|
21
|
+
import type { ISignal } from '@lumino/signaling';
|
|
22
|
+
import { Signal } from '@lumino/signaling';
|
|
21
23
|
import { PanelLayout, Widget } from '@lumino/widgets';
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -26,7 +28,7 @@ import { PanelLayout, Widget } from '@lumino/widgets';
|
|
|
26
28
|
*
|
|
27
29
|
* The time is given in milliseconds.
|
|
28
30
|
*/
|
|
29
|
-
const MAXIMUM_TIME_REMAINING =
|
|
31
|
+
const MAXIMUM_TIME_REMAINING = 3000;
|
|
30
32
|
|
|
31
33
|
/*
|
|
32
34
|
* Feature detection
|
|
@@ -665,7 +667,7 @@ export abstract class WindowedListModel implements WindowedList.IModel {
|
|
|
665
667
|
|
|
666
668
|
for (let i = this._measuredAllUntilIndex + 1; i <= index; i++) {
|
|
667
669
|
let size: number;
|
|
668
|
-
let measured
|
|
670
|
+
let measured: boolean;
|
|
669
671
|
|
|
670
672
|
if (this._widgetSizers[i]?.measured) {
|
|
671
673
|
size = this._widgetSizers[i].size;
|
|
@@ -1040,6 +1042,8 @@ export class WindowedList<
|
|
|
1040
1042
|
|
|
1041
1043
|
if (!this.viewModel.windowingActive) {
|
|
1042
1044
|
this._outerElement.scrollTo({ top: scrollOffset });
|
|
1045
|
+
// Scrolling done with browser-native code above
|
|
1046
|
+
this._markProgrammaticScrollingDone();
|
|
1043
1047
|
return;
|
|
1044
1048
|
}
|
|
1045
1049
|
|
|
@@ -1049,7 +1053,11 @@ export class WindowedList<
|
|
|
1049
1053
|
this.viewModel.scrollOffset = scrollOffset;
|
|
1050
1054
|
this._scrollUpdateWasRequested = true;
|
|
1051
1055
|
|
|
1056
|
+
// Scroll will happen in udpate() routine
|
|
1052
1057
|
this.update();
|
|
1058
|
+
} else {
|
|
1059
|
+
// No further scrolling will happen
|
|
1060
|
+
this._markProgrammaticScrollingDone();
|
|
1053
1061
|
}
|
|
1054
1062
|
}
|
|
1055
1063
|
|
|
@@ -1082,6 +1090,7 @@ export class WindowedList<
|
|
|
1082
1090
|
margin: number = 0.25,
|
|
1083
1091
|
alignPreference?: WindowedList.BaseScrollToAlignment
|
|
1084
1092
|
): Promise<void> {
|
|
1093
|
+
let deletage: PromiseDelegate<void>;
|
|
1085
1094
|
if (
|
|
1086
1095
|
!this._isScrolling ||
|
|
1087
1096
|
this._scrollToItem === null ||
|
|
@@ -1092,10 +1101,13 @@ export class WindowedList<
|
|
|
1092
1101
|
this._isScrolling.reject('Scrolling to a new item is requested.');
|
|
1093
1102
|
}
|
|
1094
1103
|
|
|
1095
|
-
|
|
1104
|
+
deletage = new PromiseDelegate<void>();
|
|
1105
|
+
this._isScrolling = deletage;
|
|
1096
1106
|
// Catch the internal reject, as otherwise this will
|
|
1097
1107
|
// result in an unhandled promise rejection in test.
|
|
1098
|
-
|
|
1108
|
+
deletage.promise.catch(console.debug);
|
|
1109
|
+
} else {
|
|
1110
|
+
deletage = this._isScrolling;
|
|
1099
1111
|
}
|
|
1100
1112
|
|
|
1101
1113
|
this._scrollToItem = [index, align, margin, alignPreference];
|
|
@@ -1131,7 +1143,7 @@ export class WindowedList<
|
|
|
1131
1143
|
)
|
|
1132
1144
|
);
|
|
1133
1145
|
|
|
1134
|
-
return
|
|
1146
|
+
return deletage.promise;
|
|
1135
1147
|
}
|
|
1136
1148
|
|
|
1137
1149
|
/**
|
|
@@ -1352,11 +1364,12 @@ export class WindowedList<
|
|
|
1352
1364
|
}
|
|
1353
1365
|
for (const widget of this.layout.widgets) {
|
|
1354
1366
|
this._itemsResizeObserver.observe(widget.node);
|
|
1355
|
-
widget.disposed.connect(
|
|
1356
|
-
|
|
1367
|
+
widget.disposed.connect(() =>
|
|
1368
|
+
this._itemsResizeObserver?.unobserve(widget.node)
|
|
1357
1369
|
);
|
|
1358
1370
|
}
|
|
1359
|
-
if (!this._areaResizeObserver) {
|
|
1371
|
+
if (!this._areaResizeObserver && this.viewModel.windowingActive) {
|
|
1372
|
+
// This is taken care by browser scroll anchoring outside of full windowing mode.
|
|
1360
1373
|
this._areaResizeObserver = new ResizeObserver(
|
|
1361
1374
|
this._onAreaResize.bind(this)
|
|
1362
1375
|
);
|
|
@@ -1369,6 +1382,7 @@ export class WindowedList<
|
|
|
1369
1382
|
* Turn off windowing related styles in the viewport.
|
|
1370
1383
|
*/
|
|
1371
1384
|
private _applyNoWindowingStyles() {
|
|
1385
|
+
this._outerElement.style.removeProperty('overflow-anchor');
|
|
1372
1386
|
this._viewport.style.position = 'relative';
|
|
1373
1387
|
this._viewport.style.contain = '';
|
|
1374
1388
|
this._viewport.style.top = '0px';
|
|
@@ -1379,6 +1393,7 @@ export class WindowedList<
|
|
|
1379
1393
|
* Turn on windowing related styles in the viewport.
|
|
1380
1394
|
*/
|
|
1381
1395
|
private _applyWindowingStyles() {
|
|
1396
|
+
this._outerElement.style.setProperty('overflow-anchor', 'none');
|
|
1382
1397
|
this._viewport.style.position = 'absolute';
|
|
1383
1398
|
this._viewport.style.contain = 'layout';
|
|
1384
1399
|
}
|
|
@@ -1434,8 +1449,8 @@ export class WindowedList<
|
|
|
1434
1449
|
const item = toAdd[index];
|
|
1435
1450
|
if (this._itemsResizeObserver && !this.layout.widgets.includes(item)) {
|
|
1436
1451
|
this._itemsResizeObserver.observe(item.node);
|
|
1437
|
-
item.disposed.connect(
|
|
1438
|
-
|
|
1452
|
+
item.disposed.connect(() =>
|
|
1453
|
+
this._itemsResizeObserver?.unobserve(item.node)
|
|
1439
1454
|
);
|
|
1440
1455
|
}
|
|
1441
1456
|
|
|
@@ -1466,6 +1481,7 @@ export class WindowedList<
|
|
|
1466
1481
|
if (this._scrollUpdateWasRequested) {
|
|
1467
1482
|
this._outerElement.scrollTop = this.viewModel.scrollOffset;
|
|
1468
1483
|
this._scrollUpdateWasRequested = false;
|
|
1484
|
+
this._markProgrammaticScrollingDone();
|
|
1469
1485
|
}
|
|
1470
1486
|
}
|
|
1471
1487
|
}
|
|
@@ -1542,8 +1558,13 @@ export class WindowedList<
|
|
|
1542
1558
|
* On implementation level, this is ensured by scrolling to `this._scrollToItem`
|
|
1543
1559
|
* which is cleared after a short timeout once the scrolling settles
|
|
1544
1560
|
* (see `this._resetScrollToItem()`).
|
|
1561
|
+
*
|
|
1562
|
+
* This is taken care by browser scroll anchoring outside of full windowing mode.
|
|
1545
1563
|
*/
|
|
1546
1564
|
private _scrollBackToItemOnResize() {
|
|
1565
|
+
if (!this.viewModel.windowingActive) {
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1547
1568
|
if (!this._scrollToItem) {
|
|
1548
1569
|
return;
|
|
1549
1570
|
}
|
|
@@ -1563,14 +1584,21 @@ export class WindowedList<
|
|
|
1563
1584
|
if (this._scrollToItem) {
|
|
1564
1585
|
this._resetScrollToItemTimeout = window.setTimeout(() => {
|
|
1565
1586
|
this._scrollToItem = null;
|
|
1566
|
-
|
|
1567
|
-
this._isScrolling.resolve();
|
|
1568
|
-
this._isScrolling = null;
|
|
1569
|
-
}
|
|
1587
|
+
this._markProgrammaticScrollingDone();
|
|
1570
1588
|
}, MAXIMUM_TIME_REMAINING);
|
|
1571
1589
|
}
|
|
1572
1590
|
}
|
|
1573
1591
|
|
|
1592
|
+
/**
|
|
1593
|
+
* Mark the current promise for programmatic scrolling as compelted.
|
|
1594
|
+
*/
|
|
1595
|
+
private _markProgrammaticScrollingDone() {
|
|
1596
|
+
if (this._isScrolling) {
|
|
1597
|
+
this._isScrolling.resolve();
|
|
1598
|
+
this._isScrolling = null;
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1574
1602
|
/**
|
|
1575
1603
|
* Render virtual scrollbar.
|
|
1576
1604
|
*/
|
package/src/hoverbox.ts
CHANGED
|
@@ -126,8 +126,10 @@ export namespace HoverBox {
|
|
|
126
126
|
/**
|
|
127
127
|
* An interface describing anchor coordinates.
|
|
128
128
|
*/
|
|
129
|
-
export interface IAnchor
|
|
130
|
-
|
|
129
|
+
export interface IAnchor extends Pick<
|
|
130
|
+
DOMRect,
|
|
131
|
+
'left' | 'right' | 'top' | 'bottom'
|
|
132
|
+
> {}
|
|
131
133
|
|
|
132
134
|
/**
|
|
133
135
|
* Set the visible dimensions of a hovering box anchored to an editor cursor.
|
|
@@ -173,10 +175,10 @@ export namespace HoverBox {
|
|
|
173
175
|
privilege === 'forceAbove'
|
|
174
176
|
? false
|
|
175
177
|
: privilege === 'forceBelow'
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
? true
|
|
179
|
+
: privilege === 'above'
|
|
180
|
+
? spaceAbove < maxHeight && spaceAbove < spaceBelow
|
|
181
|
+
: spaceBelow >= maxHeight || spaceBelow >= spaceAbove;
|
|
180
182
|
|
|
181
183
|
if (renderBelow) {
|
|
182
184
|
maxHeight = Math.min(spaceBelow - marginTop, maxHeight);
|
package/src/icon/labicon.tsx
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
|
|
4
|
+
import type { IRenderMime } from '@jupyterlab/rendermime-interfaces';
|
|
5
5
|
import { UUID } from '@lumino/coreutils';
|
|
6
6
|
import { Signal } from '@lumino/signaling';
|
|
7
|
-
import {
|
|
7
|
+
import type {
|
|
8
|
+
ElementAttrs,
|
|
9
|
+
VirtualElement,
|
|
10
|
+
VirtualNode
|
|
11
|
+
} from '@lumino/virtualdom';
|
|
8
12
|
import React from 'react';
|
|
9
|
-
import {
|
|
13
|
+
import type { Root } from 'react-dom/client';
|
|
14
|
+
import { createRoot } from 'react-dom/client';
|
|
10
15
|
import badSvgstr from '../../style/debug/bad.svg';
|
|
11
16
|
import blankSvgstr from '../../style/debug/blank.svg';
|
|
12
17
|
import refreshSvgstr from '../../style/icons/toolbar/refresh.svg';
|
|
@@ -920,7 +925,6 @@ namespace Private {
|
|
|
920
925
|
protected _rendererOptions?: LabIcon.IRendererOptions
|
|
921
926
|
) {}
|
|
922
927
|
|
|
923
|
-
// eslint-disable-next-line
|
|
924
928
|
render(container: HTMLElement, options?: LabIcon.IRendererOptions): void {}
|
|
925
929
|
unrender?(container: HTMLElement, options?: LabIcon.IRendererOptions): void;
|
|
926
930
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { VirtualElement } from '@lumino/virtualdom';
|
|
5
|
+
import { h } from '@lumino/virtualdom';
|
|
5
6
|
import { CommandPalette } from '@lumino/widgets';
|
|
6
7
|
import { LabIconStyle } from '../../style';
|
|
7
8
|
import { classes } from '../../utils';
|
|
@@ -27,9 +28,7 @@ export namespace CommandPaletteSvg {
|
|
|
27
28
|
renderHeader(data: CommandPalette.IHeaderRenderData): VirtualElement {
|
|
28
29
|
const content = this.formatHeader(data);
|
|
29
30
|
return h.li(
|
|
30
|
-
{
|
|
31
|
-
className: classes('lm-CommandPalette-header', 'jp-icon-hoverShow')
|
|
32
|
-
},
|
|
31
|
+
{ className: classes('lm-CommandPalette-header', 'jp-icon-hoverShow') },
|
|
33
32
|
content,
|
|
34
33
|
h.span(searchHeaderIcon)
|
|
35
34
|
);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
import { IDisposable } from '@lumino/disposable';
|
|
5
|
-
import { ISignal
|
|
6
|
-
import {
|
|
4
|
+
import type { IDisposable } from '@lumino/disposable';
|
|
5
|
+
import type { ISignal } from '@lumino/signaling';
|
|
6
|
+
import { Signal } from '@lumino/signaling';
|
|
7
|
+
import type { VirtualElement } from '@lumino/virtualdom';
|
|
8
|
+
import { h } from '@lumino/virtualdom';
|
|
7
9
|
import { ContextMenu, Menu } from '@lumino/widgets';
|
|
8
10
|
import { LabIconStyle } from '../../style';
|
|
9
11
|
import { classes } from '../../utils';
|