@lumino/commands
Advanced tools
Comparing version 1.9.2 to 1.10.0
import { ReadonlyPartialJSONObject } from '@lumino/coreutils'; | ||
import { IDisposable } from '@lumino/disposable'; | ||
import { ISignal } from '@lumino/signaling'; | ||
import { VirtualElement } from '@lumino/virtualdom'; | ||
/** | ||
@@ -106,5 +107,17 @@ * An object which manages a collection of commands. | ||
/** | ||
* @deprecated Use `iconClass()` instead. | ||
* Get the icon renderer for a specific command. | ||
* | ||
* DEPRECATED: if set to a string value, the .icon field will | ||
* function as an alias for the .iconClass field, for backwards | ||
* compatibility. In the future when this is removed, the default | ||
* return type will become undefined. | ||
* | ||
* @param id - The id of the command of interest. | ||
* | ||
* @param args - The arguments for the command. | ||
* | ||
* @returns The icon renderer for the command, or | ||
* an empty string if the command is not registered. | ||
*/ | ||
icon(id: string, args?: ReadonlyPartialJSONObject): string; | ||
icon(id: string, args?: ReadonlyPartialJSONObject): VirtualElement.IRenderer | undefined | string; | ||
/** | ||
@@ -366,5 +379,14 @@ * Get the icon class for a specific command. | ||
/** | ||
* @deprecated Use `iconClass` instead. | ||
* The icon renderer for the command. | ||
* | ||
* #### Notes | ||
* This can be an IRenderer object, or a function which returns the | ||
* renderer based on the provided command arguments. | ||
* | ||
* The default value is undefined. | ||
* | ||
* DEPRECATED: if set to a string value, the .icon field will function as | ||
* an alias for the .iconClass field, for backwards compatibility | ||
*/ | ||
icon?: string | CommandFunc<string>; | ||
icon?: VirtualElement.IRenderer | undefined | string | CommandFunc<VirtualElement.IRenderer | undefined | string>; | ||
/** | ||
@@ -371,0 +393,0 @@ * The icon class for the command. |
@@ -189,7 +189,20 @@ "use strict"; | ||
/** | ||
* @deprecated Use `iconClass()` instead. | ||
* Get the icon renderer for a specific command. | ||
* | ||
* DEPRECATED: if set to a string value, the .icon field will | ||
* function as an alias for the .iconClass field, for backwards | ||
* compatibility. In the future when this is removed, the default | ||
* return type will become undefined. | ||
* | ||
* @param id - The id of the command of interest. | ||
* | ||
* @param args - The arguments for the command. | ||
* | ||
* @returns The icon renderer for the command, or | ||
* an empty string if the command is not registered. | ||
*/ | ||
CommandRegistry.prototype.icon = function (id, args) { | ||
if (args === void 0) { args = coreutils_1.JSONExt.emptyObject; } | ||
return this.iconClass(id, args); | ||
var cmd = this._commands[id]; | ||
return cmd ? cmd.icon.call(undefined, args) : /* <DEPRECATED> */ '' /* </DEPRECATED> */ /* <FUTURE> undefined </FUTURE> */; | ||
}; | ||
@@ -732,2 +745,17 @@ /** | ||
function createCommand(options) { | ||
var icon; | ||
var iconClass; | ||
/* <DEPRECATED> */ | ||
if (!(options.icon) || typeof options.icon === 'string') { | ||
// alias icon to iconClass | ||
iconClass = asFunc(options.iconClass || options.icon, emptyStringFunc); | ||
icon = iconClass; | ||
} | ||
else { | ||
/* /<DEPRECATED> */ | ||
iconClass = asFunc(options.iconClass, emptyStringFunc); | ||
icon = asFunc(options.icon, undefinedFunc); | ||
/* <DEPRECATED> */ | ||
} | ||
/* </DEPRECATED> */ | ||
return { | ||
@@ -737,3 +765,4 @@ execute: options.execute, | ||
mnemonic: asFunc(options.mnemonic, negativeOneFunc), | ||
iconClass: asFunc(options.iconClass || options.icon, emptyStringFunc), | ||
icon: icon, | ||
iconClass: iconClass, | ||
iconLabel: asFunc(options.iconLabel, emptyStringFunc), | ||
@@ -844,2 +873,6 @@ caption: asFunc(options.caption, emptyStringFunc), | ||
/** | ||
* A singleton undefined function | ||
*/ | ||
var undefinedFunc = function () { return undefined; }; | ||
/** | ||
* Cast a value or command func to a command func. | ||
@@ -846,0 +879,0 @@ */ |
{ | ||
"name": "@lumino/commands", | ||
"version": "1.9.2", | ||
"version": "1.10.0", | ||
"description": "Lumino Commands", | ||
@@ -38,5 +38,12 @@ "homepage": "https://github.com/jupyterlab/lumino", | ||
"test": "npm run test:firefox", | ||
"test:chrome": "cd tests && karma start --browsers=Chrome", | ||
"test:firefox": "cd tests && karma start --browsers=Firefox", | ||
"test:ie": "cd tests && karma start --browsers=IE", | ||
"test:chrome": "npm run test:nobrowser -- --browsers=Chrome", | ||
"test:chrome-headless": "npm run test:nobrowser -- --browsers=ChromeHeadless", | ||
"test:ie": "npm run test:nobrowser -- --browsers=IE", | ||
"test:firefox": "npm run test:nobrowser -- --browsers=Firefox", | ||
"test:nobrowser": "cd tests && karma start", | ||
"test:debug": "npm run test:debug:firefox", | ||
"test:debug:chrome-headless": "npm run test:debug:nobrowser -- --browsers=ChromeHeadless", | ||
"test:debug:chrome": "npm run test:debug:nobrowser -- --browsers=Chrome", | ||
"test:debug:firefox": "npm run test:debug:nobrowser -- --browsers=Firefox", | ||
"test:debug:nobrowser": "cd tests && karma start --singleRun=false --debug=true --browserNoActivityTimeout=10000000 --browserDisconnectTimeout=10000000", | ||
"watch": "tsc --build --watch" | ||
@@ -50,3 +57,4 @@ }, | ||
"@lumino/keyboard": "^1.1.6", | ||
"@lumino/signaling": "^1.3.4" | ||
"@lumino/signaling": "^1.3.4", | ||
"@lumino/virtualdom": "^1.6.0" | ||
}, | ||
@@ -76,3 +84,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "b277e78d7bdbfa27b655a3a19240c055eab30f27" | ||
"gitHead": "5e8427c9769e8ba3c961ea62e22cae5e696f52ea" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66771
1693
7
+ Added@lumino/virtualdom@^1.6.0
+ Added@lumino/virtualdom@1.14.3(transitive)