Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@lumino/widgets

Package Overview
Dependencies
Maintainers
7
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lumino/widgets - npm Package Compare versions

Comparing version 2.0.0-beta.1 to 2.0.0-rc.0

27

package.json
{
"name": "@lumino/widgets",
"version": "2.0.0-beta.1",
"version": "2.0.0-rc.0",
"description": "Lumino Widgets",

@@ -57,15 +57,16 @@ "homepage": "https://github.com/jupyterlab/lumino",

"dependencies": {
"@lumino/algorithm": "^2.0.0-beta.0",
"@lumino/commands": "^2.0.0-beta.1",
"@lumino/coreutils": "^2.0.0-beta.0",
"@lumino/disposable": "^2.0.0-beta.1",
"@lumino/domutils": "^2.0.0-beta.0",
"@lumino/dragdrop": "^2.0.0-beta.1",
"@lumino/keyboard": "^2.0.0-beta.0",
"@lumino/messaging": "^2.0.0-beta.0",
"@lumino/properties": "^2.0.0-beta.0",
"@lumino/signaling": "^2.0.0-beta.1",
"@lumino/virtualdom": "^2.0.0-beta.0"
"@lumino/algorithm": "^2.0.0-rc.0",
"@lumino/commands": "^2.0.0-rc.0",
"@lumino/coreutils": "^2.0.0-rc.0",
"@lumino/disposable": "^2.0.0-rc.0",
"@lumino/domutils": "^2.0.0-rc.0",
"@lumino/dragdrop": "^2.0.0-rc.0",
"@lumino/keyboard": "^2.0.0-rc.0",
"@lumino/messaging": "^2.0.0-rc.0",
"@lumino/properties": "^2.0.0-rc.0",
"@lumino/signaling": "^2.0.0-rc.0",
"@lumino/virtualdom": "^2.0.0-rc.0"
},
"devDependencies": {
"@lumino/buildutils": "^2.0.0-rc.0",
"@microsoft/api-extractor": "^7.6.0",

@@ -94,3 +95,3 @@ "@rollup/plugin-commonjs": "^24.0.0",

"tslib": "^2.4.0",
"typedoc": "~0.23.9",
"typedoc": "^0.23.25",
"typescript": "~4.9.4"

@@ -97,0 +98,0 @@ },

@@ -7,2 +7,3 @@ /*

import { ArrayExt } from '@lumino/algorithm';
import { UUID } from '@lumino/coreutils';
import { SplitLayout } from './splitlayout';

@@ -88,2 +89,24 @@ import { Title } from './title';

/**
* Insert a widget into the layout at the specified index.
*
* @param index - The index at which to insert the widget.
*
* @param widget - The widget to insert into the layout.
*
* #### Notes
* The index will be clamped to the bounds of the widgets.
*
* If the widget is already added to the layout, it will be moved.
*
* #### Undefined Behavior
* An `index` which is non-integral.
*/
insertWidget(index: number, widget: Widget): void {
if (!widget.id) {
widget.id = `id-${UUID.uuid4()}`;
}
super.insertWidget(index, widget);
}
/**
* Attach a widget to the parent's DOM node.

@@ -90,0 +113,0 @@ *

@@ -16,3 +16,3 @@ // Copyright (c) Jupyter Development Team.

* #### Notes
* This class provides a convenience wrapper around [[AccordionLayout]].
* This class provides a convenience wrapper around {@link AccordionLayout}.
*/

@@ -405,3 +405,2 @@ export class AccordionPanel extends SplitPanel {

const handle = document.createElement('h3');
handle.setAttribute('role', 'tab');
handle.setAttribute('tabindex', '0');

@@ -408,0 +407,0 @@ handle.id = this.createTitleKey(data);

@@ -31,3 +31,3 @@ // Copyright (c) Jupyter Development Team.

* There is no limit to this value, but it will be clamped to the
* bounds defined by [[minSize]] and [[maxSize]].
* bounds defined by {@link minSize} and {@link maxSize}.
*

@@ -46,3 +46,3 @@ * The default value is `0`.

* It is assumed that this value lies in the range `[0, Infinity)`
* and that it is `<=` to [[maxSize]]. Failure to adhere to this
* and that it is `<=` to {@link maxSize}. Failure to adhere to this
* constraint will yield undefined results.

@@ -62,3 +62,3 @@ *

* It is assumed that this value lies in the range `[0, Infinity]`
* and that it is `>=` to [[minSize]]. Failure to adhere to this
* and that it is `>=` to {@link minSize}. Failure to adhere to this
* constraint will yield undefined results.

@@ -92,3 +92,3 @@ *

* #### Notes
* This value is the output of a call to [[boxCalc]]. It represents
* This value is the output of a call to {@link BoxEngine.calc}. It represents
* the computed size for the object along the layout orientation,

@@ -173,3 +173,3 @@ * and will always lie in the range `[minSize, maxSize]`.

* #### Notes
* The [[size]] of each sizer is updated with the computed size.
* The {@link BoxSizer.size} of each sizer is updated with the computed size.
*

@@ -176,0 +176,0 @@ * This function can be called at any time to recompute the layout for

@@ -20,3 +20,3 @@ // Copyright (c) Jupyter Development Team.

* #### Notes
* This class provides a convenience wrapper around a [[BoxLayout]].
* This class provides a convenience wrapper around a {@link BoxLayout}.
*/

@@ -23,0 +23,0 @@ export class BoxPanel extends Panel {

@@ -276,2 +276,10 @@ // Copyright (c) Jupyter Development Team.

/**
* A message handler invoked on an `'after-show'` message.
*/
protected onAfterShow(msg: Message): void {
this.update();
super.onAfterShow(msg);
}
/**
* A message handler invoked on an `'activate-request'` message.

@@ -291,2 +299,6 @@ */

protected onUpdateRequest(msg: Message): void {
if (this.isHidden) {
return;
}
// Fetch the current query text and content node.

@@ -293,0 +305,0 @@ let query = this.inputNode.value;

@@ -18,2 +18,4 @@ // Copyright (c) Jupyter Development Team.

import { CommandRegistry } from '@lumino/commands';
import {

@@ -51,2 +53,6 @@ ElementARIAAttrs,

};
this._overflowMenuOptions = options.overflowMenuOptions || {
overflowMenuVisible: true,
title: '...'
};
}

@@ -79,2 +85,16 @@

/**
* The overflow index of the menu bar.
*/
get overflowIndex(): number {
return this._overflowIndex;
}
/**
* The overflow menu of the menu bar.
*/
get overflowMenu(): Menu | null {
return this._overflowMenu;
}
/**
* Get the menu bar content node.

@@ -194,4 +214,4 @@ *

*/
addMenu(menu: Menu): void {
this.insertMenu(this._menus.length, menu);
addMenu(menu: Menu, update: boolean = true): void {
this.insertMenu(this._menus.length, menu, update);
}

@@ -211,3 +231,3 @@

*/
insertMenu(index: number, menu: Menu): void {
insertMenu(index: number, menu: Menu, update: boolean = true): void {
// Close the child menu before making changes.

@@ -236,3 +256,5 @@ this._closeChildMenu();

// Schedule an update of the items.
this.update();
if (update) {
this.update();
}

@@ -259,3 +281,5 @@ // There is nothing more to do.

// Schedule an update of the items.
this.update();
if (update) {
this.update();
}
}

@@ -271,4 +295,4 @@

*/
removeMenu(menu: Menu): void {
this.removeMenuAt(this._menus.indexOf(menu));
removeMenu(menu: Menu, update: boolean = true): void {
this.removeMenuAt(this._menus.indexOf(menu), update);
}

@@ -284,3 +308,3 @@

*/
removeMenuAt(index: number): void {
removeMenuAt(index: number, update: boolean = true): void {
// Close the child menu before making changes.

@@ -306,3 +330,5 @@ this._closeChildMenu();

// Schedule an update of the items.
this.update();
if (update) {
this.update();
}
}

@@ -401,2 +427,10 @@

/**
* A message handler invoked on a `'resize'` message.
*/
protected onResize(msg: Widget.ResizeMessage): void {
this.update();
super.onResize(msg);
}
/**
* A message handler invoked on an `'update-request'` message.

@@ -412,12 +446,15 @@ */

: 0;
let content = new Array<VirtualElement>(menus.length);
for (let i = 0, n = menus.length; i < n; ++i) {
let title = menus[i].title;
let active = i === activeIndex;
if (active && menus[i].items.length == 0) {
active = false;
}
let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;
let totalMenuSize = 0;
let overflowMenuVisible = false;
// Check that the overflow menu doesn't count
length = this._overflowMenu !== null ? length - 1 : length;
let content = new Array<VirtualElement>(length);
// Render visible menus
for (let i = 0; i < length; ++i) {
content[i] = renderer.renderItem({
title,
active,
title: menus[i].title,
active: i === activeIndex && menus[i].items.length !== 0,
tabbable: i === tabFocusIndex,

@@ -428,7 +465,109 @@ onfocus: () => {

});
// Calculate size of current menu
totalMenuSize += this._menuItemSizes[i];
// Check if overflow menu is already rendered
if (menus[i].title.label === this._overflowMenuOptions.title) {
overflowMenuVisible = true;
length--;
}
}
// Render overflow menu if needed and active
if (this._overflowMenuOptions.overflowMenuVisible) {
if (this._overflowIndex > -1 && !overflowMenuVisible) {
// Create overflow menu
if (this._overflowMenu === null) {
this._overflowMenu = new Menu({ commands: new CommandRegistry() });
this._overflowMenu.title.label = this._overflowMenuOptions.title;
this._overflowMenu.title.mnemonic = 0;
this.addMenu(this._overflowMenu, false);
}
// Move menus to overflow menu
for (let i = menus.length - 2; i >= length; i--) {
const submenu = this.menus[i];
submenu.title.mnemonic = 0;
this._overflowMenu.insertItem(0, {
type: 'submenu',
submenu: submenu
});
this.removeMenu(submenu, false);
}
content[length] = renderer.renderItem({
title: this._overflowMenu.title,
active: length === activeIndex && menus[length].items.length !== 0,
tabbable: length === tabFocusIndex,
onfocus: () => {
this.activeIndex = length;
}
});
length++;
} else if (this._overflowMenu !== null) {
// Remove submenus from overflow menu
let overflowMenuItems = this._overflowMenu.items;
let screenSize = this.node.offsetWidth;
let n = this._overflowMenu.items.length;
for (let i = 0; i < n; ++i) {
let index = menus.length - 1 - i;
if (screenSize - totalMenuSize > this._menuItemSizes[index]) {
let menu = overflowMenuItems[0].submenu as Menu;
this._overflowMenu.removeItemAt(0);
this.insertMenu(length, menu, false);
content[length] = renderer.renderItem({
title: menu.title,
active: false,
tabbable: length === tabFocusIndex,
onfocus: () => {
this.activeIndex = length;
}
});
length++;
}
}
if (this._overflowMenu.items.length === 0) {
this.removeMenu(this._overflowMenu, false);
content.pop();
this._overflowMenu = null;
this._overflowIndex = -1;
}
}
}
VirtualDOM.render(content, this.contentNode);
this._updateOverflowIndex();
}
/**
* Calculate and update the current overflow index.
*/
private _updateOverflowIndex(): void {
// Get elements visible in the main menu bar
const itemMenus = this.contentNode.childNodes;
let screenSize = this.node.offsetWidth;
let totalMenuSize = 0;
let index = -1;
let n = itemMenus.length;
if (this._menuItemSizes.length == 0) {
// Check if it is the first resize and get info about menu items sizes
for (let i = 0; i < n; i++) {
let item = itemMenus[i] as HTMLLIElement;
// Add sizes to array
totalMenuSize += item.offsetWidth;
this._menuItemSizes.push(item.offsetWidth);
if (totalMenuSize > screenSize && index === -1) {
index = i;
}
}
} else {
// Calculate current menu size
for (let i = 0; i < this._menuItemSizes.length; i++) {
totalMenuSize += this._menuItemSizes[i];
if (totalMenuSize > screenSize) {
index = i;
break;
}
}
}
this._overflowIndex = index;
}
/**
* Handle the `'keydown'` event for the menu bar.

@@ -757,4 +896,8 @@ *

private _forceItemsPosition: Menu.IOpenOptions;
private _overflowMenuOptions: IOverflowMenuOptions;
private _menus: Menu[] = [];
private _childMenu: Menu | null = null;
private _overflowMenu: Menu | null = null;
private _menuItemSizes: number[] = [];
private _overflowIndex: number = -1;
}

@@ -786,2 +929,11 @@

forceItemsPosition?: Menu.IOpenOptions;
/**
* Whether to add a overflow menu if there's overflow.
*
* Setting to `true` will enable the logic that creates an overflow menu
* to show the menu items that don't fit entirely on the screen.
*
* The default is `true`.
*/
overflowMenuOptions?: IOverflowMenuOptions;
}

@@ -971,2 +1123,18 @@

/**
* Options for overflow menu.
*/
export interface IOverflowMenuOptions {
/**
* Determines if a overflow menu appears when the menu items overflow.
*/
overflowMenuVisible: boolean;
/**
* Determines the title of the overflow menu.
*
* Default: `...`.
*/
title: string;
}
/**
* The namespace for the module implementation details.

@@ -973,0 +1141,0 @@ */

@@ -22,3 +22,3 @@ // Copyright (c) Jupyter Development Team.

*
* This class provides a convenience wrapper around a [[PanelLayout]].
* This class provides a convenience wrapper around a {@link PanelLayout}.
*/

@@ -25,0 +25,0 @@ export class Panel extends Widget {

@@ -30,3 +30,3 @@ // Copyright (c) Jupyter Development Team.

* #### Notes
* This class provides a convenience wrapper around a [[SplitLayout]].
* This class provides a convenience wrapper around a {@link SplitLayout}.
*/

@@ -33,0 +33,0 @@ export class SplitPanel extends Panel {

@@ -22,3 +22,3 @@ // Copyright (c) Jupyter Development Team.

* #### Notes
* This class provides a convenience wrapper around a [[StackedLayout]].
* This class provides a convenience wrapper around a {@link StackedLayout}.
*/

@@ -25,0 +25,0 @@ export class StackedPanel extends Panel {

@@ -414,3 +414,3 @@ /* eslint-disable @typescript-eslint/no-empty-function */

* #### Notes
* This causes the [[isHidden]] property to be `false`.
* This causes the {@link isHidden} property to be `false`.
*

@@ -442,3 +442,3 @@ * If the widget is not explicitly hidden, this is a no-op.

* #### Notes
* This causes the [[isHidden]] property to be `true`.
* This causes the {@link isHidden} property to be `true`.
*

@@ -445,0 +445,0 @@ * If the widget is explicitly hidden, this is a no-op.

@@ -38,2 +38,18 @@ import { SplitLayout } from './splitlayout';

/**
* Insert a widget into the layout at the specified index.
*
* @param index - The index at which to insert the widget.
*
* @param widget - The widget to insert into the layout.
*
* #### Notes
* The index will be clamped to the bounds of the widgets.
*
* If the widget is already added to the layout, it will be moved.
*
* #### Undefined Behavior
* An `index` which is non-integral.
*/
insertWidget(index: number, widget: Widget): void;
/**
* Attach a widget to the parent's DOM node.

@@ -40,0 +56,0 @@ *

@@ -11,3 +11,3 @@ import { Message } from '@lumino/messaging';

* #### Notes
* This class provides a convenience wrapper around [[AccordionLayout]].
* This class provides a convenience wrapper around {@link AccordionLayout}.
*/

@@ -14,0 +14,0 @@ export declare class AccordionPanel extends SplitPanel {

@@ -21,3 +21,3 @@ /**

* There is no limit to this value, but it will be clamped to the
* bounds defined by [[minSize]] and [[maxSize]].
* bounds defined by {@link minSize} and {@link maxSize}.
*

@@ -35,3 +35,3 @@ * The default value is `0`.

* It is assumed that this value lies in the range `[0, Infinity)`
* and that it is `<=` to [[maxSize]]. Failure to adhere to this
* and that it is `<=` to {@link maxSize}. Failure to adhere to this
* constraint will yield undefined results.

@@ -50,3 +50,3 @@ *

* It is assumed that this value lies in the range `[0, Infinity]`
* and that it is `>=` to [[minSize]]. Failure to adhere to this
* and that it is `>=` to {@link minSize}. Failure to adhere to this
* constraint will yield undefined results.

@@ -78,3 +78,3 @@ *

* #### Notes
* This value is the output of a call to [[boxCalc]]. It represents
* This value is the output of a call to {@link BoxEngine.calc}. It represents
* the computed size for the object along the layout orientation,

@@ -157,3 +157,3 @@ * and will always lie in the range `[minSize, maxSize]`.

* #### Notes
* The [[size]] of each sizer is updated with the computed size.
* The {@link BoxSizer.size} of each sizer is updated with the computed size.
*

@@ -160,0 +160,0 @@ * This function can be called at any time to recompute the layout for

@@ -8,3 +8,3 @@ import { BoxLayout } from './boxlayout';

* #### Notes
* This class provides a convenience wrapper around a [[BoxLayout]].
* This class provides a convenience wrapper around a {@link BoxLayout}.
*/

@@ -11,0 +11,0 @@ export declare class BoxPanel extends Panel {

@@ -127,2 +127,6 @@ import { ReadonlyJSONObject } from '@lumino/coreutils';

/**
* A message handler invoked on an `'after-show'` message.
*/
protected onAfterShow(msg: Message): void;
/**
* A message handler invoked on an `'activate-request'` message.

@@ -129,0 +133,0 @@ */

@@ -32,2 +32,10 @@ import { Message } from '@lumino/messaging';

/**
* The overflow index of the menu bar.
*/
get overflowIndex(): number;
/**
* The overflow menu of the menu bar.
*/
get overflowMenu(): Menu | null;
/**
* Get the menu bar content node.

@@ -85,3 +93,3 @@ *

*/
addMenu(menu: Menu): void;
addMenu(menu: Menu, update?: boolean): void;
/**

@@ -99,3 +107,3 @@ * Insert a menu into the menu bar at the specified index.

*/
insertMenu(index: number, menu: Menu): void;
insertMenu(index: number, menu: Menu, update?: boolean): void;
/**

@@ -109,3 +117,3 @@ * Remove a menu from the menu bar.

*/
removeMenu(menu: Menu): void;
removeMenu(menu: Menu, update?: boolean): void;
/**

@@ -119,3 +127,3 @@ * Remove the menu at a given index from the menu bar.

*/
removeMenuAt(index: number): void;
removeMenuAt(index: number, update?: boolean): void;
/**

@@ -149,2 +157,6 @@ * Remove all menus from the menu bar.

/**
* A message handler invoked on a `'resize'` message.
*/
protected onResize(msg: Widget.ResizeMessage): void;
/**
* A message handler invoked on an `'update-request'` message.

@@ -154,2 +166,6 @@ */

/**
* Calculate and update the current overflow index.
*/
private _updateOverflowIndex;
/**
* Handle the `'keydown'` event for the menu bar.

@@ -209,4 +225,8 @@ *

private _forceItemsPosition;
private _overflowMenuOptions;
private _menus;
private _childMenu;
private _overflowMenu;
private _menuItemSizes;
private _overflowIndex;
}

@@ -237,2 +257,11 @@ /**

forceItemsPosition?: Menu.IOpenOptions;
/**
* Whether to add a overflow menu if there's overflow.
*
* Setting to `true` will enable the logic that creates an overflow menu
* to show the menu items that don't fit entirely on the screen.
*
* The default is `true`.
*/
overflowMenuOptions?: IOverflowMenuOptions;
}

@@ -347,1 +376,16 @@ /**

}
/**
* Options for overflow menu.
*/
export interface IOverflowMenuOptions {
/**
* Determines if a overflow menu appears when the menu items overflow.
*/
overflowMenuVisible: boolean;
/**
* Determines the title of the overflow menu.
*
* Default: `...`.
*/
title: string;
}

@@ -11,3 +11,3 @@ import { PanelLayout } from './panellayout';

*
* This class provides a convenience wrapper around a [[PanelLayout]].
* This class provides a convenience wrapper around a {@link PanelLayout}.
*/

@@ -14,0 +14,0 @@ export declare class Panel extends Widget {

@@ -10,3 +10,3 @@ import { Message } from '@lumino/messaging';

* #### Notes
* This class provides a convenience wrapper around a [[SplitLayout]].
* This class provides a convenience wrapper around a {@link SplitLayout}.
*/

@@ -13,0 +13,0 @@ export declare class SplitPanel extends Panel {

@@ -9,3 +9,3 @@ import { ISignal } from '@lumino/signaling';

* #### Notes
* This class provides a convenience wrapper around a [[StackedLayout]].
* This class provides a convenience wrapper around a {@link StackedLayout}.
*/

@@ -12,0 +12,0 @@ export declare class StackedPanel extends Panel {

@@ -216,3 +216,3 @@ import { IObservableDisposable } from '@lumino/disposable';

* #### Notes
* This causes the [[isHidden]] property to be `false`.
* This causes the {@link isHidden} property to be `false`.
*

@@ -226,3 +226,3 @@ * If the widget is not explicitly hidden, this is a no-op.

* #### Notes
* This causes the [[isHidden]] property to be `true`.
* This causes the {@link isHidden} property to be `true`.
*

@@ -229,0 +229,0 @@ * If the widget is explicitly hidden, this is a no-op.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc