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

@lumino/application

Package Overview
Dependencies
Maintainers
6
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lumino/application - npm Package Compare versions

Comparing version 1.29.3 to 2.0.0-alpha.0

204

dist/index.es6.js
import { CommandRegistry } from '@lumino/commands';
import { PromiseDelegate } from '@lumino/coreutils';
import { Widget, ContextMenu } from '@lumino/widgets';
import { ContextMenu, Widget } from '@lumino/widgets';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/** @deprecated */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
// Copyright (c) Jupyter Development Team.
/**

@@ -37,3 +14,3 @@ * A class for creating pluggable applications.

*/
var Application = /** @class */ (function () {
class Application {
/**

@@ -44,3 +21,3 @@ * Construct a new application.

*/
function Application(options) {
constructor(options) {
this._started = false;

@@ -51,6 +28,6 @@ this._pluginMap = Private.createPluginMap();

// Create the application command registry.
var commands = new CommandRegistry();
let commands = new CommandRegistry();
// Create the application context menu.
var renderer = options.contextMenuRenderer;
var contextMenu = new ContextMenu({ commands: commands, renderer: renderer });
let renderer = options.contextMenuRenderer;
let contextMenu = new ContextMenu({ commands, renderer });
// Initialize the application state.

@@ -61,17 +38,13 @@ this.commands = commands;

}
Object.defineProperty(Application.prototype, "started", {
/**
* A promise which resolves after the application has started.
*
* #### Notes
* This promise will resolve after the `start()` method is called,
* when all the bootstrapping and shell mounting work is complete.
*/
get: function () {
return this._delegate.promise;
},
enumerable: true,
configurable: true
});
/**
* A promise which resolves after the application has started.
*
* #### Notes
* This promise will resolve after the `start()` method is called,
* when all the bootstrapping and shell mounting work is complete.
*/
get started() {
return this._delegate.promise;
}
/**
* Test whether a plugin is registered with the application.

@@ -83,5 +56,5 @@ *

*/
Application.prototype.hasPlugin = function (id) {
hasPlugin(id) {
return id in this._pluginMap;
};
}
/**

@@ -92,5 +65,5 @@ * List the IDs of the plugins registered with the application.

*/
Application.prototype.listPlugins = function () {
listPlugins() {
return Object.keys(this._pluginMap);
};
}
/**

@@ -108,9 +81,9 @@ * Register a plugin with the application.

*/
Application.prototype.registerPlugin = function (plugin) {
registerPlugin(plugin) {
// Throw an error if the plugin id is already registered.
if (plugin.id in this._pluginMap) {
throw new Error("Plugin '" + plugin.id + "' is already registered.");
throw new Error(`Plugin '${plugin.id}' is already registered.`);
}
// Create the normalized plugin data.
var data = Private.createPluginData(plugin);
let data = Private.createPluginData(plugin);
// Ensure the plugin does not cause a cyclic dependency.

@@ -124,3 +97,3 @@ Private.ensureNoCycle(data, this._pluginMap, this._serviceMap);

this._pluginMap[data.id] = data;
};
}
/**

@@ -134,8 +107,7 @@ * Register multiple plugins with the application.

*/
Application.prototype.registerPlugins = function (plugins) {
for (var _i = 0, plugins_1 = plugins; _i < plugins_1.length; _i++) {
var plugin = plugins_1[_i];
registerPlugins(plugins) {
for (let plugin of plugins) {
this.registerPlugin(plugin);
}
};
}
/**

@@ -149,8 +121,7 @@ * Activate the plugin with the given id.

*/
Application.prototype.activatePlugin = function (id) {
var _this = this;
activatePlugin(id) {
// Reject the promise if the plugin is not registered.
var data = this._pluginMap[id];
let data = this._pluginMap[id];
if (!data) {
return Promise.reject(new Error("Plugin '" + id + "' is not registered."));
return Promise.reject(new Error(`Plugin '${id}' is not registered.`));
}

@@ -166,13 +137,13 @@ // Resolve immediately if the plugin is already activated.

// Resolve the required services for the plugin.
var required = data.requires.map(function (t) { return _this.resolveRequiredService(t); });
let required = data.requires.map(t => this.resolveRequiredService(t));
// Resolve the optional services for the plugin.
var optional = data.optional.map(function (t) { return _this.resolveOptionalService(t); });
let optional = data.optional.map(t => this.resolveOptionalService(t));
// Create the array of promises to resolve.
var promises = required.concat(optional);
let promises = required.concat(optional);
// Setup the resolver promise for the plugin.
data.promise = Promise.all(promises)
.then(function (services) {
return data.activate.apply(undefined, __spreadArrays([_this], services));
.then(services => {
return data.activate.apply(undefined, [this, ...services]);
})
.then(function (service) {
.then(service => {
data.service = service;

@@ -182,3 +153,3 @@ data.activated = true;

})
.catch(function (error) {
.catch(error => {
data.promise = null;

@@ -189,3 +160,3 @@ throw error;

return data.promise;
};
}
/**

@@ -210,10 +181,10 @@ * Resolve a required service of a given type.

*/
Application.prototype.resolveRequiredService = function (token) {
resolveRequiredService(token) {
// Reject the promise if there is no provider for the type.
var id = this._serviceMap.get(token);
let id = this._serviceMap.get(token);
if (!id) {
return Promise.reject(new Error("No provider for: " + token.name + "."));
return Promise.reject(new Error(`No provider for: ${token.name}.`));
}
// Resolve immediately if the plugin is already activated.
var data = this._pluginMap[id];
let data = this._pluginMap[id];
if (data.activated) {

@@ -223,4 +194,4 @@ return Promise.resolve(data.service);

// Otherwise, activate the plugin and wait on the results.
return this.activatePlugin(id).then(function () { return data.service; });
};
return this.activatePlugin(id).then(() => data.service);
}
/**

@@ -245,5 +216,5 @@ * Resolve an optional service of a given type.

*/
Application.prototype.resolveOptionalService = function (token) {
resolveOptionalService(token) {
// Resolve with `null` if there is no provider for the type.
var id = this._serviceMap.get(token);
let id = this._serviceMap.get(token);
if (!id) {

@@ -253,3 +224,3 @@ return Promise.resolve(null);

// Resolve immediately if the plugin is already activated.
var data = this._pluginMap[id];
let data = this._pluginMap[id];
if (data.activated) {

@@ -260,10 +231,10 @@ return Promise.resolve(data.service);

return this.activatePlugin(id)
.then(function () {
.then(() => {
return data.service;
})
.catch(function (reason) {
.catch(reason => {
console.error(reason);
return null;
});
};
}
/**

@@ -290,5 +261,3 @@ * Start the application.

*/
Application.prototype.start = function (options) {
var _this = this;
if (options === void 0) { options = {}; }
start(options = {}) {
// Return immediately if the application is already started.

@@ -301,9 +270,9 @@ if (this._started) {

// Parse the host id for attaching the shell.
var hostID = options.hostID || '';
let hostID = options.hostID || '';
// Collect the ids of the startup plugins.
var startups = Private.collectStartupPlugins(this._pluginMap, options);
let startups = Private.collectStartupPlugins(this._pluginMap, options);
// Generate the activation promises.
var promises = startups.map(function (id) {
return _this.activatePlugin(id).catch(function (error) {
console.error("Plugin '" + id + "' failed to activate.");
let promises = startups.map(id => {
return this.activatePlugin(id).catch(error => {
console.error(`Plugin '${id}' failed to activate.`);
console.error(error);

@@ -313,10 +282,10 @@ });

// Wait for the plugins to activate, then finalize startup.
Promise.all(promises).then(function () {
_this.attachShell(hostID);
_this.addEventListeners();
_this._delegate.resolve(undefined);
Promise.all(promises).then(() => {
this.attachShell(hostID);
this.addEventListeners();
this._delegate.resolve(undefined);
});
// Return the pending delegate promise.
return this._delegate.promise;
};
}
/**

@@ -332,3 +301,3 @@ * Handle the DOM events for the application.

*/
Application.prototype.handleEvent = function (event) {
handleEvent(event) {
switch (event.type) {

@@ -345,3 +314,3 @@ case 'resize':

}
};
}
/**

@@ -357,5 +326,5 @@ * Attach the application shell to the DOM.

*/
Application.prototype.attachShell = function (id) {
attachShell(id) {
Widget.attach(this.shell, (id && document.getElementById(id)) || document.body);
};
}
/**

@@ -370,7 +339,7 @@ * Add the application event listeners.

*/
Application.prototype.addEventListeners = function () {
addEventListeners() {
document.addEventListener('contextmenu', this);
document.addEventListener('keydown', this, true);
window.addEventListener('resize', this);
};
}
/**

@@ -385,5 +354,5 @@ * A method invoked on a document `'keydown'` event.

*/
Application.prototype.evtKeydown = function (event) {
evtKeydown(event) {
this.commands.processKeydownEvent(event);
};
}
/**

@@ -402,3 +371,3 @@ * A method invoked on a document `'contextmenu'` event.

*/
Application.prototype.evtContextMenu = function (event) {
evtContextMenu(event) {
if (event.shiftKey) {

@@ -411,3 +380,3 @@ return;

}
};
}
/**

@@ -421,7 +390,6 @@ * A method invoked on a window `'resize'` event.

*/
Application.prototype.evtResize = function (event) {
evtResize(event) {
this.shell.update();
};
return Application;
}());
}
}
/**

@@ -469,3 +437,3 @@ * The namespace for the module implementation details.

function ensureNoCycle(data, pluginMap, serviceMap) {
var dependencies = data.requires.concat(data.optional);
let dependencies = data.requires.concat(data.optional);
// Bail early if there cannot be a cycle.

@@ -476,6 +444,6 @@ if (!data.provides || dependencies.length === 0) {

// Setup a stack to trace service resolution.
var trace = [data.id];
let trace = [data.id];
// Throw an exception if a cycle is present.
if (dependencies.some(visit)) {
throw new Error("Cycle detected: " + trace.join(' -> ') + ".");
throw new Error(`Cycle detected: ${trace.join(' -> ')}.`);
}

@@ -486,8 +454,8 @@ function visit(token) {

}
var id = serviceMap.get(token);
let id = serviceMap.get(token);
if (!id) {
return false;
}
var other = pluginMap[id];
var otherDependencies = other.requires.concat(other.optional);
let other = pluginMap[id];
let otherDependencies = other.requires.concat(other.optional);
if (otherDependencies.length === 0) {

@@ -510,5 +478,5 @@ return false;

// Create a map to hold the plugin IDs.
var resultMap = Object.create(null);
let resultMap = Object.create(null);
// Collect the auto-start plugins.
for (var id in pluginMap) {
for (let id in pluginMap) {
if (pluginMap[id].autoStart) {

@@ -520,4 +488,3 @@ resultMap[id] = true;

if (options.startPlugins) {
for (var _i = 0, _a = options.startPlugins; _i < _a.length; _i++) {
var id = _a[_i];
for (let id of options.startPlugins) {
resultMap[id] = true;

@@ -528,4 +495,3 @@ }

if (options.ignorePlugins) {
for (var _b = 0, _c = options.ignorePlugins; _b < _c.length; _b++) {
var id = _c[_b];
for (let id of options.ignorePlugins) {
delete resultMap[id];

@@ -532,0 +498,0 @@ }

@@ -5,28 +5,5 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_application = {}, global.lumino_commands, global.lumino_coreutils, global.lumino_widgets));
}(this, (function (exports, commands, coreutils, widgets) { 'use strict';
})(this, (function (exports, commands, coreutils, widgets) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/** @deprecated */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
// Copyright (c) Jupyter Development Team.
/**

@@ -40,3 +17,3 @@ * A class for creating pluggable applications.

*/
var Application = /** @class */ (function () {
class Application {
/**

@@ -47,3 +24,3 @@ * Construct a new application.

*/
function Application(options) {
constructor(options) {
this._started = false;

@@ -54,6 +31,6 @@ this._pluginMap = Private.createPluginMap();

// Create the application command registry.
var commands$1 = new commands.CommandRegistry();
let commands$1 = new commands.CommandRegistry();
// Create the application context menu.
var renderer = options.contextMenuRenderer;
var contextMenu = new widgets.ContextMenu({ commands: commands$1, renderer: renderer });
let renderer = options.contextMenuRenderer;
let contextMenu = new widgets.ContextMenu({ commands: commands$1, renderer });
// Initialize the application state.

@@ -64,17 +41,13 @@ this.commands = commands$1;

}
Object.defineProperty(Application.prototype, "started", {
/**
* A promise which resolves after the application has started.
*
* #### Notes
* This promise will resolve after the `start()` method is called,
* when all the bootstrapping and shell mounting work is complete.
*/
get: function () {
return this._delegate.promise;
},
enumerable: true,
configurable: true
});
/**
* A promise which resolves after the application has started.
*
* #### Notes
* This promise will resolve after the `start()` method is called,
* when all the bootstrapping and shell mounting work is complete.
*/
get started() {
return this._delegate.promise;
}
/**
* Test whether a plugin is registered with the application.

@@ -86,5 +59,5 @@ *

*/
Application.prototype.hasPlugin = function (id) {
hasPlugin(id) {
return id in this._pluginMap;
};
}
/**

@@ -95,5 +68,5 @@ * List the IDs of the plugins registered with the application.

*/
Application.prototype.listPlugins = function () {
listPlugins() {
return Object.keys(this._pluginMap);
};
}
/**

@@ -111,9 +84,9 @@ * Register a plugin with the application.

*/
Application.prototype.registerPlugin = function (plugin) {
registerPlugin(plugin) {
// Throw an error if the plugin id is already registered.
if (plugin.id in this._pluginMap) {
throw new Error("Plugin '" + plugin.id + "' is already registered.");
throw new Error(`Plugin '${plugin.id}' is already registered.`);
}
// Create the normalized plugin data.
var data = Private.createPluginData(plugin);
let data = Private.createPluginData(plugin);
// Ensure the plugin does not cause a cyclic dependency.

@@ -127,3 +100,3 @@ Private.ensureNoCycle(data, this._pluginMap, this._serviceMap);

this._pluginMap[data.id] = data;
};
}
/**

@@ -137,8 +110,7 @@ * Register multiple plugins with the application.

*/
Application.prototype.registerPlugins = function (plugins) {
for (var _i = 0, plugins_1 = plugins; _i < plugins_1.length; _i++) {
var plugin = plugins_1[_i];
registerPlugins(plugins) {
for (let plugin of plugins) {
this.registerPlugin(plugin);
}
};
}
/**

@@ -152,8 +124,7 @@ * Activate the plugin with the given id.

*/
Application.prototype.activatePlugin = function (id) {
var _this = this;
activatePlugin(id) {
// Reject the promise if the plugin is not registered.
var data = this._pluginMap[id];
let data = this._pluginMap[id];
if (!data) {
return Promise.reject(new Error("Plugin '" + id + "' is not registered."));
return Promise.reject(new Error(`Plugin '${id}' is not registered.`));
}

@@ -169,13 +140,13 @@ // Resolve immediately if the plugin is already activated.

// Resolve the required services for the plugin.
var required = data.requires.map(function (t) { return _this.resolveRequiredService(t); });
let required = data.requires.map(t => this.resolveRequiredService(t));
// Resolve the optional services for the plugin.
var optional = data.optional.map(function (t) { return _this.resolveOptionalService(t); });
let optional = data.optional.map(t => this.resolveOptionalService(t));
// Create the array of promises to resolve.
var promises = required.concat(optional);
let promises = required.concat(optional);
// Setup the resolver promise for the plugin.
data.promise = Promise.all(promises)
.then(function (services) {
return data.activate.apply(undefined, __spreadArrays([_this], services));
.then(services => {
return data.activate.apply(undefined, [this, ...services]);
})
.then(function (service) {
.then(service => {
data.service = service;

@@ -185,3 +156,3 @@ data.activated = true;

})
.catch(function (error) {
.catch(error => {
data.promise = null;

@@ -192,3 +163,3 @@ throw error;

return data.promise;
};
}
/**

@@ -213,10 +184,10 @@ * Resolve a required service of a given type.

*/
Application.prototype.resolveRequiredService = function (token) {
resolveRequiredService(token) {
// Reject the promise if there is no provider for the type.
var id = this._serviceMap.get(token);
let id = this._serviceMap.get(token);
if (!id) {
return Promise.reject(new Error("No provider for: " + token.name + "."));
return Promise.reject(new Error(`No provider for: ${token.name}.`));
}
// Resolve immediately if the plugin is already activated.
var data = this._pluginMap[id];
let data = this._pluginMap[id];
if (data.activated) {

@@ -226,4 +197,4 @@ return Promise.resolve(data.service);

// Otherwise, activate the plugin and wait on the results.
return this.activatePlugin(id).then(function () { return data.service; });
};
return this.activatePlugin(id).then(() => data.service);
}
/**

@@ -248,5 +219,5 @@ * Resolve an optional service of a given type.

*/
Application.prototype.resolveOptionalService = function (token) {
resolveOptionalService(token) {
// Resolve with `null` if there is no provider for the type.
var id = this._serviceMap.get(token);
let id = this._serviceMap.get(token);
if (!id) {

@@ -256,3 +227,3 @@ return Promise.resolve(null);

// Resolve immediately if the plugin is already activated.
var data = this._pluginMap[id];
let data = this._pluginMap[id];
if (data.activated) {

@@ -263,10 +234,10 @@ return Promise.resolve(data.service);

return this.activatePlugin(id)
.then(function () {
.then(() => {
return data.service;
})
.catch(function (reason) {
.catch(reason => {
console.error(reason);
return null;
});
};
}
/**

@@ -293,5 +264,3 @@ * Start the application.

*/
Application.prototype.start = function (options) {
var _this = this;
if (options === void 0) { options = {}; }
start(options = {}) {
// Return immediately if the application is already started.

@@ -304,9 +273,9 @@ if (this._started) {

// Parse the host id for attaching the shell.
var hostID = options.hostID || '';
let hostID = options.hostID || '';
// Collect the ids of the startup plugins.
var startups = Private.collectStartupPlugins(this._pluginMap, options);
let startups = Private.collectStartupPlugins(this._pluginMap, options);
// Generate the activation promises.
var promises = startups.map(function (id) {
return _this.activatePlugin(id).catch(function (error) {
console.error("Plugin '" + id + "' failed to activate.");
let promises = startups.map(id => {
return this.activatePlugin(id).catch(error => {
console.error(`Plugin '${id}' failed to activate.`);
console.error(error);

@@ -316,10 +285,10 @@ });

// Wait for the plugins to activate, then finalize startup.
Promise.all(promises).then(function () {
_this.attachShell(hostID);
_this.addEventListeners();
_this._delegate.resolve(undefined);
Promise.all(promises).then(() => {
this.attachShell(hostID);
this.addEventListeners();
this._delegate.resolve(undefined);
});
// Return the pending delegate promise.
return this._delegate.promise;
};
}
/**

@@ -335,3 +304,3 @@ * Handle the DOM events for the application.

*/
Application.prototype.handleEvent = function (event) {
handleEvent(event) {
switch (event.type) {

@@ -348,3 +317,3 @@ case 'resize':

}
};
}
/**

@@ -360,5 +329,5 @@ * Attach the application shell to the DOM.

*/
Application.prototype.attachShell = function (id) {
attachShell(id) {
widgets.Widget.attach(this.shell, (id && document.getElementById(id)) || document.body);
};
}
/**

@@ -373,7 +342,7 @@ * Add the application event listeners.

*/
Application.prototype.addEventListeners = function () {
addEventListeners() {
document.addEventListener('contextmenu', this);
document.addEventListener('keydown', this, true);
window.addEventListener('resize', this);
};
}
/**

@@ -388,5 +357,5 @@ * A method invoked on a document `'keydown'` event.

*/
Application.prototype.evtKeydown = function (event) {
evtKeydown(event) {
this.commands.processKeydownEvent(event);
};
}
/**

@@ -405,3 +374,3 @@ * A method invoked on a document `'contextmenu'` event.

*/
Application.prototype.evtContextMenu = function (event) {
evtContextMenu(event) {
if (event.shiftKey) {

@@ -414,3 +383,3 @@ return;

}
};
}
/**

@@ -424,7 +393,6 @@ * A method invoked on a window `'resize'` event.

*/
Application.prototype.evtResize = function (event) {
evtResize(event) {
this.shell.update();
};
return Application;
}());
}
}
/**

@@ -472,3 +440,3 @@ * The namespace for the module implementation details.

function ensureNoCycle(data, pluginMap, serviceMap) {
var dependencies = data.requires.concat(data.optional);
let dependencies = data.requires.concat(data.optional);
// Bail early if there cannot be a cycle.

@@ -479,6 +447,6 @@ if (!data.provides || dependencies.length === 0) {

// Setup a stack to trace service resolution.
var trace = [data.id];
let trace = [data.id];
// Throw an exception if a cycle is present.
if (dependencies.some(visit)) {
throw new Error("Cycle detected: " + trace.join(' -> ') + ".");
throw new Error(`Cycle detected: ${trace.join(' -> ')}.`);
}

@@ -489,8 +457,8 @@ function visit(token) {

}
var id = serviceMap.get(token);
let id = serviceMap.get(token);
if (!id) {
return false;
}
var other = pluginMap[id];
var otherDependencies = other.requires.concat(other.optional);
let other = pluginMap[id];
let otherDependencies = other.requires.concat(other.optional);
if (otherDependencies.length === 0) {

@@ -513,5 +481,5 @@ return false;

// Create a map to hold the plugin IDs.
var resultMap = Object.create(null);
let resultMap = Object.create(null);
// Collect the auto-start plugins.
for (var id in pluginMap) {
for (let id in pluginMap) {
if (pluginMap[id].autoStart) {

@@ -523,4 +491,3 @@ resultMap[id] = true;

if (options.startPlugins) {
for (var _i = 0, _a = options.startPlugins; _i < _a.length; _i++) {
var id = _a[_i];
for (let id of options.startPlugins) {
resultMap[id] = true;

@@ -531,4 +498,3 @@ }

if (options.ignorePlugins) {
for (var _b = 0, _c = options.ignorePlugins; _b < _c.length; _b++) {
var id = _c[_b];
for (let id of options.ignorePlugins) {
delete resultMap[id];

@@ -547,3 +513,3 @@ }

})));
}));
//# sourceMappingURL=index.js.map

@@ -1,16 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/commands"),require("@lumino/coreutils"),require("@lumino/widgets")):"function"==typeof define&&define.amd?define(["exports","@lumino/commands","@lumino/coreutils","@lumino/widgets"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_application={},e.lumino_commands,e.lumino_coreutils,e.lumino_widgets)}(this,(function(e,t,i,r){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var n,o=function(){function e(e){this._started=!1,this._pluginMap=n.createPluginMap(),this._serviceMap=n.createServiceMap(),this._delegate=new i.PromiseDelegate;var o=new t.CommandRegistry,s=e.contextMenuRenderer,a=new r.ContextMenu({commands:o,renderer:s});this.commands=o,this.contextMenu=a,this.shell=e.shell}return Object.defineProperty(e.prototype,"started",{get:function(){return this._delegate.promise},enumerable:!0,configurable:!0}),e.prototype.hasPlugin=function(e){return e in this._pluginMap},e.prototype.listPlugins=function(){return Object.keys(this._pluginMap)},e.prototype.registerPlugin=function(e){if(e.id in this._pluginMap)throw new Error("Plugin '"+e.id+"' is already registered.");var t=n.createPluginData(e);n.ensureNoCycle(t,this._pluginMap,this._serviceMap),t.provides&&this._serviceMap.set(t.provides,t.id),this._pluginMap[t.id]=t},e.prototype.registerPlugins=function(e){for(var t=0,i=e;t<i.length;t++){var r=i[t];this.registerPlugin(r)}},e.prototype.activatePlugin=function(e){var t=this,i=this._pluginMap[e];if(!i)return Promise.reject(new Error("Plugin '"+e+"' is not registered."));if(i.activated)return Promise.resolve(void 0);if(i.promise)return i.promise;var r=i.requires.map((function(e){return t.resolveRequiredService(e)})),n=i.optional.map((function(e){return t.resolveOptionalService(e)})),o=r.concat(n);return i.promise=Promise.all(o).then((function(e){return i.activate.apply(void 0,function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var r=Array(e),n=0;for(t=0;t<i;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,n++)r[n]=o[s];return r}([t],e))})).then((function(e){i.service=e,i.activated=!0,i.promise=null})).catch((function(e){throw i.promise=null,e})),i.promise},e.prototype.resolveRequiredService=function(e){var t=this._serviceMap.get(e);if(!t)return Promise.reject(new Error("No provider for: "+e.name+"."));var i=this._pluginMap[t];return i.activated?Promise.resolve(i.service):this.activatePlugin(t).then((function(){return i.service}))},e.prototype.resolveOptionalService=function(e){var t=this._serviceMap.get(e);if(!t)return Promise.resolve(null);var i=this._pluginMap[t];return i.activated?Promise.resolve(i.service):this.activatePlugin(t).then((function(){return i.service})).catch((function(e){return console.error(e),null}))},e.prototype.start=function(e){var t=this;if(void 0===e&&(e={}),this._started)return this._delegate.promise;this._started=!0;var i=e.hostID||"",r=n.collectStartupPlugins(this._pluginMap,e).map((function(e){return t.activatePlugin(e).catch((function(t){console.error("Plugin '"+e+"' failed to activate."),console.error(t)}))}));return Promise.all(r).then((function(){t.attachShell(i),t.addEventListeners(),t._delegate.resolve(void 0)})),this._delegate.promise},e.prototype.handleEvent=function(e){switch(e.type){case"resize":this.evtResize(e);break;case"keydown":this.evtKeydown(e);break;case"contextmenu":this.evtContextMenu(e)}},e.prototype.attachShell=function(e){r.Widget.attach(this.shell,e&&document.getElementById(e)||document.body)},e.prototype.addEventListeners=function(){document.addEventListener("contextmenu",this),document.addEventListener("keydown",this,!0),window.addEventListener("resize",this)},e.prototype.evtKeydown=function(e){this.commands.processKeydownEvent(e)},e.prototype.evtContextMenu=function(e){e.shiftKey||this.contextMenu.open(e)&&(e.preventDefault(),e.stopPropagation())},e.prototype.evtResize=function(e){this.shell.update()},e}();!function(e){e.createPluginMap=function(){return Object.create(null)},e.createServiceMap=function(){return new Map},e.createPluginData=function(e){return{id:e.id,service:null,promise:null,activated:!1,activate:e.activate,provides:e.provides||null,autoStart:e.autoStart||!1,requires:e.requires?e.requires.slice():[],optional:e.optional?e.optional.slice():[]}},e.ensureNoCycle=function(e,t,i){var r=e.requires.concat(e.optional);if(e.provides&&0!==r.length){var n=[e.id];if(r.some((function r(o){if(o===e.provides)return!0;var s=i.get(o);if(!s)return!1;var a=t[s],u=a.requires.concat(a.optional);if(0===u.length)return!1;if(n.push(s),u.some(r))return!0;return n.pop(),!1})))throw new Error("Cycle detected: "+n.join(" -> ")+".")}},e.collectStartupPlugins=function(e,t){var i=Object.create(null);for(var r in e)e[r].autoStart&&(i[r]=!0);if(t.startPlugins)for(var n=0,o=t.startPlugins;n<o.length;n++){i[r=o[n]]=!0}if(t.ignorePlugins)for(var s=0,a=t.ignorePlugins;s<a.length;s++){delete i[r=a[s]]}return Object.keys(i)}}(n||(n={})),e.Application=o,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/commands"),require("@lumino/coreutils"),require("@lumino/widgets")):"function"==typeof define&&define.amd?define(["exports","@lumino/commands","@lumino/coreutils","@lumino/widgets"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_application={},e.lumino_commands,e.lumino_coreutils,e.lumino_widgets)}(this,(function(e,t,i,r){"use strict";var n;!function(e){e.createPluginMap=function(){return Object.create(null)},e.createServiceMap=function(){return new Map},e.createPluginData=function(e){return{id:e.id,service:null,promise:null,activated:!1,activate:e.activate,provides:e.provides||null,autoStart:e.autoStart||!1,requires:e.requires?e.requires.slice():[],optional:e.optional?e.optional.slice():[]}},e.ensureNoCycle=function(e,t,i){let r=e.requires.concat(e.optional);if(!e.provides||0===r.length)return;let n=[e.id];if(r.some((function r(s){if(s===e.provides)return!0;let o=i.get(s);if(!o)return!1;let l=t[o],a=l.requires.concat(l.optional);if(0===a.length)return!1;if(n.push(o),a.some(r))return!0;return n.pop(),!1})))throw new Error(`Cycle detected: ${n.join(" -> ")}.`)},e.collectStartupPlugins=function(e,t){let i=Object.create(null);for(let t in e)e[t].autoStart&&(i[t]=!0);if(t.startPlugins)for(let e of t.startPlugins)i[e]=!0;if(t.ignorePlugins)for(let e of t.ignorePlugins)delete i[e];return Object.keys(i)}}(n||(n={})),e.Application=class{constructor(e){this._started=!1,this._pluginMap=n.createPluginMap(),this._serviceMap=n.createServiceMap(),this._delegate=new i.PromiseDelegate;let s=new t.CommandRegistry,o=e.contextMenuRenderer,l=new r.ContextMenu({commands:s,renderer:o});this.commands=s,this.contextMenu=l,this.shell=e.shell}get started(){return this._delegate.promise}hasPlugin(e){return e in this._pluginMap}listPlugins(){return Object.keys(this._pluginMap)}registerPlugin(e){if(e.id in this._pluginMap)throw new Error(`Plugin '${e.id}' is already registered.`);let t=n.createPluginData(e);n.ensureNoCycle(t,this._pluginMap,this._serviceMap),t.provides&&this._serviceMap.set(t.provides,t.id),this._pluginMap[t.id]=t}registerPlugins(e){for(let t of e)this.registerPlugin(t)}activatePlugin(e){let t=this._pluginMap[e];if(!t)return Promise.reject(new Error(`Plugin '${e}' is not registered.`));if(t.activated)return Promise.resolve(void 0);if(t.promise)return t.promise;let i=t.requires.map((e=>this.resolveRequiredService(e))),r=t.optional.map((e=>this.resolveOptionalService(e))),n=i.concat(r);return t.promise=Promise.all(n).then((e=>t.activate.apply(void 0,[this,...e]))).then((e=>{t.service=e,t.activated=!0,t.promise=null})).catch((e=>{throw t.promise=null,e})),t.promise}resolveRequiredService(e){let t=this._serviceMap.get(e);if(!t)return Promise.reject(new Error(`No provider for: ${e.name}.`));let i=this._pluginMap[t];return i.activated?Promise.resolve(i.service):this.activatePlugin(t).then((()=>i.service))}resolveOptionalService(e){let t=this._serviceMap.get(e);if(!t)return Promise.resolve(null);let i=this._pluginMap[t];return i.activated?Promise.resolve(i.service):this.activatePlugin(t).then((()=>i.service)).catch((e=>(console.error(e),null)))}start(e={}){if(this._started)return this._delegate.promise;this._started=!0;let t=e.hostID||"",i=n.collectStartupPlugins(this._pluginMap,e).map((e=>this.activatePlugin(e).catch((t=>{console.error(`Plugin '${e}' failed to activate.`),console.error(t)}))));return Promise.all(i).then((()=>{this.attachShell(t),this.addEventListeners(),this._delegate.resolve(void 0)})),this._delegate.promise}handleEvent(e){switch(e.type){case"resize":this.evtResize(e);break;case"keydown":this.evtKeydown(e);break;case"contextmenu":this.evtContextMenu(e)}}attachShell(e){r.Widget.attach(this.shell,e&&document.getElementById(e)||document.body)}addEventListeners(){document.addEventListener("contextmenu",this),document.addEventListener("keydown",this,!0),window.addEventListener("resize",this)}evtKeydown(e){this.commands.processKeydownEvent(e)}evtContextMenu(e){e.shiftKey||this.contextMenu.open(e)&&(e.preventDefault(),e.stopPropagation())}evtResize(e){this.shell.update()}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.min.js.map
{
"name": "@lumino/application",
"version": "1.29.3",
"version": "2.0.0-alpha.0",
"description": "Lumino Pluggable Application",

@@ -14,9 +14,3 @@ "homepage": "https://github.com/jupyterlab/lumino",

"license": "BSD-3-Clause",
"author": "S. Chris Colbert <sccolbert@gmail.com>",
"contributors": [
"A. T. Darian <git@darian.email>",
"Dave Willmer <dave.willmer@gmail.com>",
"S. Chris Colbert <sccolbert@gmail.com>",
"Steven Silvester <steven.silvester@gmail.com>"
],
"author": "Project Jupyter",
"main": "dist/index.js",

@@ -39,3 +33,2 @@ "jsdelivr": "dist/index.min.js",

"clean:test": "rimraf tests/build",
"docs": "typedoc --options tdoptions.json src",
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",

@@ -50,9 +43,14 @@ "test": "npm run test:firefox-headless",

},
"typedoc": {
"entryPoint": "./src/index.ts",
"displayName": "application"
},
"dependencies": {
"@lumino/commands": "^1.20.1",
"@lumino/coreutils": "^1.12.1",
"@lumino/widgets": "^1.34.0"
"@lumino/commands": "^2.0.0-alpha.0",
"@lumino/coreutils": "^2.0.0-alpha.0",
"@lumino/widgets": "^2.0.0-alpha.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.6.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/chai": "^3.4.35",

@@ -68,13 +66,13 @@ "@types/mocha": "^2.2.39",

"mocha": "^9.0.3",
"postcss": "^8.4.14",
"rimraf": "^3.0.2",
"rollup": "^2.56.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup": "^2.77.2",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-sourcemaps": "^0.6.3",
"terser": "^5.7.1",
"tslib": "^2.3.0",
"typedoc": "~0.15.0",
"typescript": "~3.6.0",
"webpack": "^4.41.3",
"webpack-cli": "^3.3.10"
"tslib": "^2.4.0",
"typedoc": "~0.23.9",
"typescript": "~4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},

@@ -81,0 +79,0 @@ "publishConfig": {

@@ -125,3 +125,3 @@ import { CommandRegistry } from '@lumino/commands';

*/
readonly started: Promise<void>;
get started(): Promise<void>;
/**

@@ -352,2 +352,1 @@ * Test whether a plugin is registered with the application.

}
//# sourceMappingURL=index.d.ts.map

Sorry, the diff of this file is not supported yet

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