@phosphor/commands
Advanced tools
Comparing version 0.1.5 to 1.0.0
@@ -149,2 +149,13 @@ import { JSONObject } from '@phosphor/coreutils'; | ||
/** | ||
* Get the dataset for a specific command. | ||
* | ||
* @param id - The id of the command of interest. | ||
* | ||
* @param args - The arguments for the command. | ||
* | ||
* @returns The dataset for the command, or an empty dataset if | ||
* the command is not registered. | ||
*/ | ||
dataset(id: string, args?: JSONObject): CommandRegistry.Dataset; | ||
/** | ||
* Test whether a specific command is enabled. | ||
@@ -278,2 +289,8 @@ * | ||
/** | ||
* A type alias for a simple immutable string dataset. | ||
*/ | ||
type Dataset = { | ||
readonly [key: string]: string; | ||
}; | ||
/** | ||
* An options object for creating a command. | ||
@@ -389,2 +406,15 @@ * | ||
/** | ||
* The dataset for the command. | ||
* | ||
* #### Notes | ||
* The dataset values will be added to the primary node for the | ||
* visual representation of the command. | ||
* | ||
* This can be a dataset object, or a function which returns the | ||
* dataset object based on the provided command arguments. | ||
* | ||
* The default value is an empty dataset. | ||
*/ | ||
dataset?: Dataset | CommandFunc<Dataset>; | ||
/** | ||
* A function which indicates whether the command is enabled. | ||
@@ -391,0 +421,0 @@ * |
@@ -246,2 +246,17 @@ "use strict"; | ||
/** | ||
* Get the dataset for a specific command. | ||
* | ||
* @param id - The id of the command of interest. | ||
* | ||
* @param args - The arguments for the command. | ||
* | ||
* @returns The dataset for the command, or an empty dataset if | ||
* the command is not registered. | ||
*/ | ||
CommandRegistry.prototype.dataset = function (id, args) { | ||
if (args === void 0) { args = coreutils_1.JSONExt.emptyObject; } | ||
var cmd = this._commands[id]; | ||
return cmd ? cmd.dataset.call(undefined, args) : {}; | ||
}; | ||
/** | ||
* Test whether a specific command is enabled. | ||
@@ -641,2 +656,3 @@ * | ||
className: asFunc(options.className, emptyStringFunc), | ||
dataset: asFunc(options.dataset, emptyDatasetFunc), | ||
isEnabled: options.isEnabled || trueFunc, | ||
@@ -738,2 +754,6 @@ isToggled: options.isToggled || falseFunc, | ||
/** | ||
* A singleton empty dataset function. | ||
*/ | ||
var emptyDatasetFunc = function () { return ({}); }; | ||
/** | ||
* Cast a value or command func to a command func. | ||
@@ -740,0 +760,0 @@ */ |
{ | ||
"name": "@phosphor/commands", | ||
"version": "0.1.5", | ||
"version": "1.0.0", | ||
"description": "PhosphorJS - Commands", | ||
@@ -15,8 +15,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@phosphor/algorithm": "^0.1.1", | ||
"@phosphor/coreutils": "^0.1.5", | ||
"@phosphor/disposable": "^0.1.1", | ||
"@phosphor/domutils": "^0.1.2", | ||
"@phosphor/keyboard": "^0.1.1", | ||
"@phosphor/signaling": "^0.1.2" | ||
"@phosphor/algorithm": "^1.0.0", | ||
"@phosphor/coreutils": "^1.0.0", | ||
"@phosphor/disposable": "^1.0.0", | ||
"@phosphor/domutils": "^1.0.0", | ||
"@phosphor/keyboard": "^1.0.0", | ||
"@phosphor/signaling": "^1.0.0" | ||
}, | ||
@@ -23,0 +23,0 @@ "devDependencies": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
56438
1510
0
+ Added@phosphor/algorithm@1.2.0(transitive)
+ Added@phosphor/coreutils@1.3.1(transitive)
+ Added@phosphor/disposable@1.3.1(transitive)
+ Added@phosphor/domutils@1.1.4(transitive)
+ Added@phosphor/keyboard@1.1.3(transitive)
+ Added@phosphor/signaling@1.3.1(transitive)
- Removed@phosphor/algorithm@0.1.1(transitive)
- Removed@phosphor/coreutils@0.1.5(transitive)
- Removed@phosphor/disposable@0.1.1(transitive)
- Removed@phosphor/domutils@0.1.2(transitive)
- Removed@phosphor/keyboard@0.1.1(transitive)
- Removed@phosphor/signaling@0.1.2(transitive)
Updated@phosphor/algorithm@^1.0.0
Updated@phosphor/coreutils@^1.0.0
Updated@phosphor/disposable@^1.0.0
Updated@phosphor/domutils@^1.0.0
Updated@phosphor/keyboard@^1.0.0
Updated@phosphor/signaling@^1.0.0