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

@devexpress/dx-core

Package Overview
Dependencies
Maintainers
13
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devexpress/dx-core - npm Package Compare versions

Comparing version 1.10.0 to 1.10.1

dist/dx-core.d.ts

580

dist/dx-core.es.js
/**
* Bundle of @devexpress/dx-core
* Generated: 2018-12-25
* Version: 1.10.0
* Generated: 2019-02-06
* Version: 1.10.1
* License: https://js.devexpress.com/Licensing
*/
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/** @internal */
var DELAY = 200;
var compare = function compare(a, b) {
var aPosition = a.position();
var bPosition = b.position();
for (var i = 0; i < Math.min(aPosition.length, bPosition.length); i += 1) {
if (aPosition[i] < bPosition[i]) return -1;
if (aPosition[i] > bPosition[i]) return 1;
}
return aPosition.length - bPosition.length;
/** @internal */
var compare = function (a, b) {
var aPosition = a.position();
var bPosition = b.position();
for (var i = 0; i < Math.min(aPosition.length, bPosition.length); i += 1) {
if (aPosition[i] < bPosition[i])
return -1;
if (aPosition[i] > bPosition[i])
return 1;
}
return aPosition.length - bPosition.length;
};
var insertPlugin = function insertPlugin(array, newItem) {
var result = array.slice();
var nextItemIndex = array.findIndex(function (item) {
return compare(newItem, item) <= 0;
});
var targetIndex = nextItemIndex < 0 ? array.length : nextItemIndex;
var alreadyExists = targetIndex >= 0 && targetIndex < array.length && compare(newItem, array[targetIndex]) === 0;
result.splice(targetIndex, alreadyExists ? 1 : 0, newItem);
return result;
/** @internal */
var insertPlugin = function (array, newItem) {
var result = array.slice();
var nextItemIndex = array.findIndex(function (item) { return compare(newItem, item) <= 0; });
var targetIndex = nextItemIndex < 0 ? array.length : nextItemIndex;
var alreadyExists = (targetIndex >= 0 && targetIndex < array.length)
&& compare(newItem, array[targetIndex]) === 0;
result.splice(targetIndex, alreadyExists ? 1 : 0, newItem);
return result;
};
var createClickHandlers = function createClickHandlers(click, dblClick) {
var timeoutId;
var events = {};
if (click) {
events.onClick = function (e) {
if (!timeoutId) {
timeoutId = setTimeout(function () {
clearTimeout(timeoutId);
click(e);
}, DELAY);
}
};
}
if (dblClick) {
events.onDoubleClick = function (e) {
clearTimeout(timeoutId);
dblClick(e);
};
}
return events;
/** @internal */
var createClickHandlers = function (click, dblClick) {
var timeoutId;
var events = {};
if (click) {
events.onClick = function (e) {
if (!timeoutId) {
timeoutId = setTimeout(function () {
clearTimeout(timeoutId);
click(e);
}, DELAY);
}
};
}
if (dblClick) {
events.onDoubleClick = function (e) {
clearTimeout(timeoutId);
dblClick(e);
};
}
return events;
};
/* globals window:true */
/** @internal */
var isEdgeBrowser = function () { return /Edge/.test(window.navigator.userAgent); };
var isEdgeBrowser = function isEdgeBrowser() {
return /Edge/.test(window.navigator.userAgent);
};
var getDependencyError = function getDependencyError(pluginName, dependencyName) {
return new Error("The '".concat(pluginName, "' plugin requires '").concat(dependencyName, "' to be defined before it."));
};
var PluginHost =
/*#__PURE__*/
function () {
function PluginHost() {
_classCallCheck(this, PluginHost);
this.plugins = [];
this.subscriptions = new Set();
this.gettersCache = {};
}
_createClass(PluginHost, [{
key: "ensureDependencies",
value: function ensureDependencies() {
var defined = new Set();
var knownOptionals = new Map();
this.plugins.filter(function (plugin) {
return plugin.container;
}).forEach(function (plugin) {
if (knownOptionals.has(plugin.name)) {
throw getDependencyError(knownOptionals.get(plugin.name), plugin.name);
}
plugin.dependencies.forEach(function (dependency) {
if (defined.has(dependency.name)) return;
if (dependency.optional) {
if (!knownOptionals.has(dependency.name)) {
knownOptionals.set(dependency.name, plugin.name);
var getDependencyError = function (pluginName, dependencyName) { return new Error("The '" + pluginName + "' plugin requires '" + dependencyName + "' to be defined before it."); };
/** @internal */
var PluginHost = /*#__PURE__*/ (function () {
function PluginHost() {
this.gettersCache = {};
this.knownKeysCache = {};
this.validationRequired = true;
this.plugins = [];
this.subscriptions = new Set();
}
PluginHost.prototype.ensureDependencies = function () {
var defined = new Set();
var knownOptionals = new Map();
this.plugins
.filter(function (plugin) { return plugin.container; })
.forEach(function (plugin) {
var pluginName = plugin.name || '';
if (knownOptionals.has(pluginName)) {
throw (getDependencyError(knownOptionals.get(pluginName), pluginName));
}
return;
}
throw getDependencyError(plugin.name, dependency.name);
(plugin.dependencies || [])
.forEach(function (dependency) {
if (defined.has(dependency.name))
return;
if (dependency.optional) {
if (!knownOptionals.has(dependency.name)) {
knownOptionals.set(dependency.name, pluginName);
}
return;
}
throw (getDependencyError(pluginName, dependency.name));
});
defined.add(pluginName);
});
defined.add(plugin.name);
});
}
}, {
key: "registerPlugin",
value: function registerPlugin(plugin) {
this.plugins = insertPlugin(this.plugins, plugin);
this.cleanPluginsCache();
}
}, {
key: "unregisterPlugin",
value: function unregisterPlugin(plugin) {
this.plugins.splice(this.plugins.indexOf(plugin), 1);
this.cleanPluginsCache();
}
}, {
key: "cleanPluginsCache",
value: function cleanPluginsCache() {
this.validationRequired = true;
this.gettersCache = {};
this.knownKeysCache = {};
}
}, {
key: "knownKeys",
value: function knownKeys(postfix) {
if (!this.knownKeysCache[postfix]) {
this.knownKeysCache[postfix] = Array.from(this.plugins.map(function (plugin) {
return Object.keys(plugin);
}).map(function (keys) {
return keys.filter(function (key) {
return key.endsWith(postfix);
})[0];
}).filter(function (key) {
return !!key;
}).reduce(function (acc, key) {
return acc.add(key);
}, new Set())).map(function (key) {
return key.replace(postfix, '');
};
PluginHost.prototype.registerPlugin = function (plugin) {
this.plugins = insertPlugin(this.plugins, plugin);
this.cleanPluginsCache();
};
PluginHost.prototype.unregisterPlugin = function (plugin) {
this.plugins.splice(this.plugins.indexOf(plugin), 1);
this.cleanPluginsCache();
};
PluginHost.prototype.knownKeys = function (postfix) {
if (!this.knownKeysCache[postfix]) {
this.knownKeysCache[postfix] = Array.from(this.plugins
.map(function (plugin) { return Object.keys(plugin); })
.map(function (keys) { return keys.filter(function (key) { return key.endsWith(postfix); })[0]; })
.filter(function (key) { return !!key; })
.reduce(function (acc, key) { return acc.add(key); }, new Set()))
.map(function (key) { return key.replace(postfix, ''); });
}
return this.knownKeysCache[postfix];
};
PluginHost.prototype.collect = function (key, upTo) {
var _this = this;
if (this.validationRequired) {
this.ensureDependencies();
this.validationRequired = false;
}
if (!this.gettersCache[key]) {
this.gettersCache[key] = this.plugins.map(function (plugin) { return plugin[key]; }).filter(function (plugin) { return !!plugin; });
}
if (!upTo)
return this.gettersCache[key];
var upToIndex = this.plugins.indexOf(upTo);
return this.gettersCache[key].filter(function (getter) {
var pluginIndex = _this.plugins.findIndex(function (plugin) { return plugin[key] === getter; });
return pluginIndex < upToIndex;
});
}
return this.knownKeysCache[postfix];
}
}, {
key: "collect",
value: function collect(key, upTo) {
var _this = this;
if (this.validationRequired) {
this.ensureDependencies();
this.validationRequired = false;
}
if (!this.gettersCache[key]) {
this.gettersCache[key] = this.plugins.map(function (plugin) {
return plugin[key];
}).filter(function (plugin) {
return !!plugin;
};
PluginHost.prototype.get = function (key, upTo) {
var plugins = this.collect(key, upTo);
if (!plugins.length)
return undefined;
var result = plugins[0]();
plugins.slice(1).forEach(function (plugin) {
result = plugin(result);
});
}
return result;
};
PluginHost.prototype.registerSubscription = function (subscription) {
this.subscriptions.add(subscription);
};
PluginHost.prototype.unregisterSubscription = function (subscription) {
this.subscriptions.delete(subscription);
};
PluginHost.prototype.broadcast = function (event, message) {
this.subscriptions.forEach(function (subscription) { return subscription[event] && subscription[event](message); });
};
PluginHost.prototype.cleanPluginsCache = function () {
this.validationRequired = true;
this.gettersCache = {};
this.knownKeysCache = {};
};
return PluginHost;
}());
if (!upTo) return this.gettersCache[key];
var upToIndex = this.plugins.indexOf(upTo);
return this.gettersCache[key].filter(function (getter) {
var pluginIndex = _this.plugins.findIndex(function (plugin) {
return plugin[key] === getter;
});
return pluginIndex < upToIndex;
});
/** @internal */
var EventEmitter = /*#__PURE__*/ (function () {
function EventEmitter() {
this.handlers = [];
}
}, {
key: "get",
value: function get(key, upTo) {
var plugins = this.collect(key, upTo);
if (!plugins.length) return undefined;
var result = plugins[0]();
plugins.slice(1).forEach(function (plugin) {
result = plugin(result);
});
return result;
}
}, {
key: "registerSubscription",
value: function registerSubscription(subscription) {
this.subscriptions.add(subscription);
}
}, {
key: "unregisterSubscription",
value: function unregisterSubscription(subscription) {
this.subscriptions.delete(subscription);
}
}, {
key: "broadcast",
value: function broadcast(event, message) {
this.subscriptions.forEach(function (subscription) {
return subscription[event] && subscription[event](message);
});
}
}]);
EventEmitter.prototype.emit = function (e) {
this.handlers.forEach(function (handler) { return handler(e); });
};
EventEmitter.prototype.subscribe = function (handler) {
this.handlers.push(handler);
};
EventEmitter.prototype.unsubscribe = function (handler) {
this.handlers.splice(this.handlers.indexOf(handler), 1);
};
return EventEmitter;
}());
return PluginHost;
}();
var EventEmitter =
/*#__PURE__*/
function () {
function EventEmitter() {
_classCallCheck(this, EventEmitter);
this.handlers = [];
}
_createClass(EventEmitter, [{
key: "emit",
value: function emit(e) {
this.handlers.forEach(function (handler) {
return handler(e);
});
/** @internal */
var shallowEqual = function (objA, objB) {
if (objA === objB) {
return true;
}
}, {
key: "subscribe",
value: function subscribe(handler) {
this.handlers.push(handler);
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
}, {
key: "unsubscribe",
value: function unsubscribe(handler) {
this.handlers.splice(this.handlers.indexOf(handler), 1);
// Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
// tslint:disable-next-line: prefer-for-of
for (var i = 0; i < keysA.length; i += 1) {
if (!hasOwn.call(objB, keysA[i])
|| objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
var valA = objA[keysA[i]];
var valB = objB[keysA[i]];
if (valA !== valB) {
return false;
}
}
}]);
return EventEmitter;
}();
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
} // Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
for (var i = 0; i < keysA.length; i += 1) {
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
};
/** @internal */
var argumentsShallowEqual = function (prev, next) {
if (prev === null || next === null || prev.length !== next.length) {
return false;
}
var valA = objA[keysA[i]];
var valB = objB[keysA[i]];
if (valA !== valB) {
return false;
for (var i = 0; i < prev.length; i += 1) {
if (prev[i] !== next[i]) {
return false;
}
}
}
return true;
}
function argumentsShallowEqual(prev, next) {
if (prev === null || next === null || prev.length !== next.length) {
return false;
}
for (var i = 0; i < prev.length; i += 1) {
if (prev[i] !== next[i]) {
return false;
}
}
return true;
}
var memoize = function memoize(func) {
var lastArgs = null;
var lastResult = null;
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (lastArgs === null || !argumentsShallowEqual(lastArgs, args)) {
lastResult = func.apply(void 0, args);
}
lastArgs = args;
return lastResult;
};
return true;
};
var easeInQuad = function easeInQuad(t) {
return t * t;
/** @internal */
var memoize = function (func) {
var lastArgs = null;
var lastResult = null;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (lastArgs === null || !argumentsShallowEqual(lastArgs, args)) {
lastResult = func.apply(void 0, args);
}
lastArgs = args;
return lastResult;
};
};
var easeOutQuad = function easeOutQuad(t) {
return t * (2 - t);
};
var easeInOutQuad = function easeInOutQuad(t) {
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
};
var easeInCubic = function easeInCubic(t) {
return t * t * t;
};
var easeOutCubic = function easeOutCubic(t) {
return (t - 1) * (t - 1) * (t - 1) + 1;
};
var easeInOutCubic = function easeInOutCubic(t) {
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
};
var easeInQuart = function easeInQuart(t) {
return t * t * t * t;
};
var easeOutQuart = function easeOutQuart(t) {
return 1 - (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var easeInOutQuart = function easeInOutQuart(t) {
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var easeInQuint = function easeInQuint(t) {
return t * t * t * t * t;
};
var easeOutQuint = function easeOutQuint(t) {
return 1 + (t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var easeInOutQuint = function easeInOutQuint(t) {
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var processPattern = function processPattern(pattern, params) {
return Object.keys(params).reduce(function (msg, key) {
return msg.replace("{".concat(key, "}"), params[key]);
}, pattern);
};
/** @internal */
var easeInQuad = function (t) { return t * t; };
/** @internal */
var easeOutQuad = function (t) { return t * (2 - t); };
/** @internal */
var easeInOutQuad = function (t) { return (t < 0.5
? 2 * t * t
: -1 + ((4 - (2 * t)) * t)); };
/** @internal */
var easeInCubic = function (t) { return t * t * t; };
/** @internal */
var easeOutCubic = function (t) { return ((t - 1) * (t - 1) * (t - 1)) + 1; };
/** @internal */
var easeInOutCubic = function (t) { return (t < 0.5
? 4 * t * t * t
: ((t - 1) * ((2 * t) - 2) * ((2 * t) - 2)) + 1); };
/** @internal */
var easeInQuart = function (t) { return t * t * t * t; };
/** @internal */
var easeOutQuart = function (t) { return 1 - ((t - 1) * (t - 1) * (t - 1) * (t - 1)); };
/** @internal */
var easeInOutQuart = function (t) { return (t < 0.5
? 8 * t * t * t * t
: 1 - (8 * (t - 1) * (t - 1) * (t - 1) * (t - 1))); };
/** @internal */
var easeInQuint = function (t) { return t * t * t * t * t; };
/** @internal */
var easeOutQuint = function (t) { return 1 + ((t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1)); };
/** @internal */
var easeInOutQuint = function (t) { return (t < 0.5
? 16 * t * t * t * t * t
: 1 + (16 * (t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1))); };
var getMessagesFormatter = function getMessagesFormatter(messages) {
return function (key, params) {
var processPattern = function (pattern, params) { return Object.keys(params).reduce(function (msg, key) { return msg.replace("{" + key + "}", params[key]); }, pattern); };
/** @internal */
var getMessagesFormatter = function (messages) { return function (key, params) {
var message = messages[key];
if (typeof message === 'function') {
return message(params);
return message(params);
}
if (params) {
return processPattern(message, params);
return processPattern(message, params);
}
return message;
};
};
}; };
export { PluginHost, EventEmitter, memoize, shallowEqual, argumentsShallowEqual, getMessagesFormatter, createClickHandlers, isEdgeBrowser, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint };
//# sourceMappingURL=dx-core.es.js.map
/**
* Bundle of @devexpress/dx-core
* Generated: 2018-12-25
* Version: 1.10.0
* Generated: 2019-02-06
* Version: 1.10.1
* License: https://js.devexpress.com/Licensing

@@ -14,372 +14,268 @@ */

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/** @internal */
var DELAY = 200;
var compare = function compare(a, b) {
var aPosition = a.position();
var bPosition = b.position();
for (var i = 0; i < Math.min(aPosition.length, bPosition.length); i += 1) {
if (aPosition[i] < bPosition[i]) return -1;
if (aPosition[i] > bPosition[i]) return 1;
}
return aPosition.length - bPosition.length;
/** @internal */
var compare = function (a, b) {
var aPosition = a.position();
var bPosition = b.position();
for (var i = 0; i < Math.min(aPosition.length, bPosition.length); i += 1) {
if (aPosition[i] < bPosition[i])
return -1;
if (aPosition[i] > bPosition[i])
return 1;
}
return aPosition.length - bPosition.length;
};
var insertPlugin = function insertPlugin(array, newItem) {
var result = array.slice();
var nextItemIndex = array.findIndex(function (item) {
return compare(newItem, item) <= 0;
});
var targetIndex = nextItemIndex < 0 ? array.length : nextItemIndex;
var alreadyExists = targetIndex >= 0 && targetIndex < array.length && compare(newItem, array[targetIndex]) === 0;
result.splice(targetIndex, alreadyExists ? 1 : 0, newItem);
return result;
/** @internal */
var insertPlugin = function (array, newItem) {
var result = array.slice();
var nextItemIndex = array.findIndex(function (item) { return compare(newItem, item) <= 0; });
var targetIndex = nextItemIndex < 0 ? array.length : nextItemIndex;
var alreadyExists = (targetIndex >= 0 && targetIndex < array.length)
&& compare(newItem, array[targetIndex]) === 0;
result.splice(targetIndex, alreadyExists ? 1 : 0, newItem);
return result;
};
var createClickHandlers = function createClickHandlers(click, dblClick) {
var timeoutId;
var events = {};
if (click) {
events.onClick = function (e) {
if (!timeoutId) {
timeoutId = setTimeout(function () {
clearTimeout(timeoutId);
click(e);
}, DELAY);
}
};
}
if (dblClick) {
events.onDoubleClick = function (e) {
clearTimeout(timeoutId);
dblClick(e);
};
}
return events;
/** @internal */
var createClickHandlers = function (click, dblClick) {
var timeoutId;
var events = {};
if (click) {
events.onClick = function (e) {
if (!timeoutId) {
timeoutId = setTimeout(function () {
clearTimeout(timeoutId);
click(e);
}, DELAY);
}
};
}
if (dblClick) {
events.onDoubleClick = function (e) {
clearTimeout(timeoutId);
dblClick(e);
};
}
return events;
};
/* globals window:true */
/** @internal */
var isEdgeBrowser = function () { return /Edge/.test(window.navigator.userAgent); };
var isEdgeBrowser = function isEdgeBrowser() {
return /Edge/.test(window.navigator.userAgent);
};
var getDependencyError = function getDependencyError(pluginName, dependencyName) {
return new Error("The '".concat(pluginName, "' plugin requires '").concat(dependencyName, "' to be defined before it."));
};
var PluginHost =
/*#__PURE__*/
function () {
function PluginHost() {
_classCallCheck(this, PluginHost);
this.plugins = [];
this.subscriptions = new Set();
this.gettersCache = {};
}
_createClass(PluginHost, [{
key: "ensureDependencies",
value: function ensureDependencies() {
var defined = new Set();
var knownOptionals = new Map();
this.plugins.filter(function (plugin) {
return plugin.container;
}).forEach(function (plugin) {
if (knownOptionals.has(plugin.name)) {
throw getDependencyError(knownOptionals.get(plugin.name), plugin.name);
}
plugin.dependencies.forEach(function (dependency) {
if (defined.has(dependency.name)) return;
if (dependency.optional) {
if (!knownOptionals.has(dependency.name)) {
knownOptionals.set(dependency.name, plugin.name);
var getDependencyError = function (pluginName, dependencyName) { return new Error("The '" + pluginName + "' plugin requires '" + dependencyName + "' to be defined before it."); };
/** @internal */
var PluginHost = /*#__PURE__*/ (function () {
function PluginHost() {
this.gettersCache = {};
this.knownKeysCache = {};
this.validationRequired = true;
this.plugins = [];
this.subscriptions = new Set();
}
PluginHost.prototype.ensureDependencies = function () {
var defined = new Set();
var knownOptionals = new Map();
this.plugins
.filter(function (plugin) { return plugin.container; })
.forEach(function (plugin) {
var pluginName = plugin.name || '';
if (knownOptionals.has(pluginName)) {
throw (getDependencyError(knownOptionals.get(pluginName), pluginName));
}
return;
}
throw getDependencyError(plugin.name, dependency.name);
(plugin.dependencies || [])
.forEach(function (dependency) {
if (defined.has(dependency.name))
return;
if (dependency.optional) {
if (!knownOptionals.has(dependency.name)) {
knownOptionals.set(dependency.name, pluginName);
}
return;
}
throw (getDependencyError(pluginName, dependency.name));
});
defined.add(pluginName);
});
defined.add(plugin.name);
});
}
}, {
key: "registerPlugin",
value: function registerPlugin(plugin) {
this.plugins = insertPlugin(this.plugins, plugin);
this.cleanPluginsCache();
}
}, {
key: "unregisterPlugin",
value: function unregisterPlugin(plugin) {
this.plugins.splice(this.plugins.indexOf(plugin), 1);
this.cleanPluginsCache();
}
}, {
key: "cleanPluginsCache",
value: function cleanPluginsCache() {
this.validationRequired = true;
this.gettersCache = {};
this.knownKeysCache = {};
}
}, {
key: "knownKeys",
value: function knownKeys(postfix) {
if (!this.knownKeysCache[postfix]) {
this.knownKeysCache[postfix] = Array.from(this.plugins.map(function (plugin) {
return Object.keys(plugin);
}).map(function (keys) {
return keys.filter(function (key) {
return key.endsWith(postfix);
})[0];
}).filter(function (key) {
return !!key;
}).reduce(function (acc, key) {
return acc.add(key);
}, new Set())).map(function (key) {
return key.replace(postfix, '');
};
PluginHost.prototype.registerPlugin = function (plugin) {
this.plugins = insertPlugin(this.plugins, plugin);
this.cleanPluginsCache();
};
PluginHost.prototype.unregisterPlugin = function (plugin) {
this.plugins.splice(this.plugins.indexOf(plugin), 1);
this.cleanPluginsCache();
};
PluginHost.prototype.knownKeys = function (postfix) {
if (!this.knownKeysCache[postfix]) {
this.knownKeysCache[postfix] = Array.from(this.plugins
.map(function (plugin) { return Object.keys(plugin); })
.map(function (keys) { return keys.filter(function (key) { return key.endsWith(postfix); })[0]; })
.filter(function (key) { return !!key; })
.reduce(function (acc, key) { return acc.add(key); }, new Set()))
.map(function (key) { return key.replace(postfix, ''); });
}
return this.knownKeysCache[postfix];
};
PluginHost.prototype.collect = function (key, upTo) {
var _this = this;
if (this.validationRequired) {
this.ensureDependencies();
this.validationRequired = false;
}
if (!this.gettersCache[key]) {
this.gettersCache[key] = this.plugins.map(function (plugin) { return plugin[key]; }).filter(function (plugin) { return !!plugin; });
}
if (!upTo)
return this.gettersCache[key];
var upToIndex = this.plugins.indexOf(upTo);
return this.gettersCache[key].filter(function (getter) {
var pluginIndex = _this.plugins.findIndex(function (plugin) { return plugin[key] === getter; });
return pluginIndex < upToIndex;
});
}
return this.knownKeysCache[postfix];
}
}, {
key: "collect",
value: function collect(key, upTo) {
var _this = this;
if (this.validationRequired) {
this.ensureDependencies();
this.validationRequired = false;
}
if (!this.gettersCache[key]) {
this.gettersCache[key] = this.plugins.map(function (plugin) {
return plugin[key];
}).filter(function (plugin) {
return !!plugin;
};
PluginHost.prototype.get = function (key, upTo) {
var plugins = this.collect(key, upTo);
if (!plugins.length)
return undefined;
var result = plugins[0]();
plugins.slice(1).forEach(function (plugin) {
result = plugin(result);
});
}
return result;
};
PluginHost.prototype.registerSubscription = function (subscription) {
this.subscriptions.add(subscription);
};
PluginHost.prototype.unregisterSubscription = function (subscription) {
this.subscriptions.delete(subscription);
};
PluginHost.prototype.broadcast = function (event, message) {
this.subscriptions.forEach(function (subscription) { return subscription[event] && subscription[event](message); });
};
PluginHost.prototype.cleanPluginsCache = function () {
this.validationRequired = true;
this.gettersCache = {};
this.knownKeysCache = {};
};
return PluginHost;
}());
if (!upTo) return this.gettersCache[key];
var upToIndex = this.plugins.indexOf(upTo);
return this.gettersCache[key].filter(function (getter) {
var pluginIndex = _this.plugins.findIndex(function (plugin) {
return plugin[key] === getter;
});
return pluginIndex < upToIndex;
});
/** @internal */
var EventEmitter = /*#__PURE__*/ (function () {
function EventEmitter() {
this.handlers = [];
}
}, {
key: "get",
value: function get(key, upTo) {
var plugins = this.collect(key, upTo);
if (!plugins.length) return undefined;
var result = plugins[0]();
plugins.slice(1).forEach(function (plugin) {
result = plugin(result);
});
return result;
}
}, {
key: "registerSubscription",
value: function registerSubscription(subscription) {
this.subscriptions.add(subscription);
}
}, {
key: "unregisterSubscription",
value: function unregisterSubscription(subscription) {
this.subscriptions.delete(subscription);
}
}, {
key: "broadcast",
value: function broadcast(event, message) {
this.subscriptions.forEach(function (subscription) {
return subscription[event] && subscription[event](message);
});
}
}]);
EventEmitter.prototype.emit = function (e) {
this.handlers.forEach(function (handler) { return handler(e); });
};
EventEmitter.prototype.subscribe = function (handler) {
this.handlers.push(handler);
};
EventEmitter.prototype.unsubscribe = function (handler) {
this.handlers.splice(this.handlers.indexOf(handler), 1);
};
return EventEmitter;
}());
return PluginHost;
}();
var EventEmitter =
/*#__PURE__*/
function () {
function EventEmitter() {
_classCallCheck(this, EventEmitter);
this.handlers = [];
}
_createClass(EventEmitter, [{
key: "emit",
value: function emit(e) {
this.handlers.forEach(function (handler) {
return handler(e);
});
/** @internal */
var shallowEqual = function (objA, objB) {
if (objA === objB) {
return true;
}
}, {
key: "subscribe",
value: function subscribe(handler) {
this.handlers.push(handler);
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
}, {
key: "unsubscribe",
value: function unsubscribe(handler) {
this.handlers.splice(this.handlers.indexOf(handler), 1);
// Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
// tslint:disable-next-line: prefer-for-of
for (var i = 0; i < keysA.length; i += 1) {
if (!hasOwn.call(objB, keysA[i])
|| objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
var valA = objA[keysA[i]];
var valB = objB[keysA[i]];
if (valA !== valB) {
return false;
}
}
}]);
return EventEmitter;
}();
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
} // Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
for (var i = 0; i < keysA.length; i += 1) {
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
};
/** @internal */
var argumentsShallowEqual = function (prev, next) {
if (prev === null || next === null || prev.length !== next.length) {
return false;
}
var valA = objA[keysA[i]];
var valB = objB[keysA[i]];
if (valA !== valB) {
return false;
for (var i = 0; i < prev.length; i += 1) {
if (prev[i] !== next[i]) {
return false;
}
}
}
return true;
}
function argumentsShallowEqual(prev, next) {
if (prev === null || next === null || prev.length !== next.length) {
return false;
}
for (var i = 0; i < prev.length; i += 1) {
if (prev[i] !== next[i]) {
return false;
}
}
return true;
}
var memoize = function memoize(func) {
var lastArgs = null;
var lastResult = null;
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (lastArgs === null || !argumentsShallowEqual(lastArgs, args)) {
lastResult = func.apply(void 0, args);
}
lastArgs = args;
return lastResult;
};
return true;
};
var easeInQuad = function easeInQuad(t) {
return t * t;
/** @internal */
var memoize = function (func) {
var lastArgs = null;
var lastResult = null;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (lastArgs === null || !argumentsShallowEqual(lastArgs, args)) {
lastResult = func.apply(void 0, args);
}
lastArgs = args;
return lastResult;
};
};
var easeOutQuad = function easeOutQuad(t) {
return t * (2 - t);
};
var easeInOutQuad = function easeInOutQuad(t) {
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
};
var easeInCubic = function easeInCubic(t) {
return t * t * t;
};
var easeOutCubic = function easeOutCubic(t) {
return (t - 1) * (t - 1) * (t - 1) + 1;
};
var easeInOutCubic = function easeInOutCubic(t) {
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
};
var easeInQuart = function easeInQuart(t) {
return t * t * t * t;
};
var easeOutQuart = function easeOutQuart(t) {
return 1 - (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var easeInOutQuart = function easeInOutQuart(t) {
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var easeInQuint = function easeInQuint(t) {
return t * t * t * t * t;
};
var easeOutQuint = function easeOutQuint(t) {
return 1 + (t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var easeInOutQuint = function easeInOutQuint(t) {
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1);
};
var processPattern = function processPattern(pattern, params) {
return Object.keys(params).reduce(function (msg, key) {
return msg.replace("{".concat(key, "}"), params[key]);
}, pattern);
};
/** @internal */
var easeInQuad = function (t) { return t * t; };
/** @internal */
var easeOutQuad = function (t) { return t * (2 - t); };
/** @internal */
var easeInOutQuad = function (t) { return (t < 0.5
? 2 * t * t
: -1 + ((4 - (2 * t)) * t)); };
/** @internal */
var easeInCubic = function (t) { return t * t * t; };
/** @internal */
var easeOutCubic = function (t) { return ((t - 1) * (t - 1) * (t - 1)) + 1; };
/** @internal */
var easeInOutCubic = function (t) { return (t < 0.5
? 4 * t * t * t
: ((t - 1) * ((2 * t) - 2) * ((2 * t) - 2)) + 1); };
/** @internal */
var easeInQuart = function (t) { return t * t * t * t; };
/** @internal */
var easeOutQuart = function (t) { return 1 - ((t - 1) * (t - 1) * (t - 1) * (t - 1)); };
/** @internal */
var easeInOutQuart = function (t) { return (t < 0.5
? 8 * t * t * t * t
: 1 - (8 * (t - 1) * (t - 1) * (t - 1) * (t - 1))); };
/** @internal */
var easeInQuint = function (t) { return t * t * t * t * t; };
/** @internal */
var easeOutQuint = function (t) { return 1 + ((t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1)); };
/** @internal */
var easeInOutQuint = function (t) { return (t < 0.5
? 16 * t * t * t * t * t
: 1 + (16 * (t - 1) * (t - 1) * (t - 1) * (t - 1) * (t - 1))); };
var getMessagesFormatter = function getMessagesFormatter(messages) {
return function (key, params) {
var processPattern = function (pattern, params) { return Object.keys(params).reduce(function (msg, key) { return msg.replace("{" + key + "}", params[key]); }, pattern); };
/** @internal */
var getMessagesFormatter = function (messages) { return function (key, params) {
var message = messages[key];
if (typeof message === 'function') {
return message(params);
return message(params);
}
if (params) {
return processPattern(message, params);
return processPattern(message, params);
}
return message;
};
};
}; };

@@ -386,0 +282,0 @@ exports.PluginHost = PluginHost;

{
"name": "@devexpress/dx-core",
"version": "1.10.0",
"version": "1.10.1",
"description": "Core library for DevExtreme Reactive Components",

@@ -28,2 +28,3 @@ "author": {

"module": "dist/dx-core.es.js",
"types": "dist/dx-core.d.ts",
"globalName": "DevExpress.DXCore",

@@ -39,23 +40,22 @@ "files": [

"build:watch": "rollup -c rollup.config.js -w",
"lint": "eslint \"src/**\"",
"dts": "tsc -p tsconfig.dts.json && node ./merge-dts.js",
"lint": "tslint -p tsconfig.lint.json",
"lint:fix": "yarn run lint -- --fix"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"core-js": "^2.6.1",
"eslint": "^5.11.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.1.2",
"jest": "^23.6.0",
"rollup": "^0.68.2",
"rollup-plugin-babel": "^4.1.0",
"rollup-plugin-license": "^0.7.0"
"core-js": "^2.6.3",
"jest": "^24.0.0",
"prettier": "^1.16.4",
"rollup": "^1.1.2",
"rollup-plugin-license": "^0.8.1",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-typescript2": "^0.19.2",
"tslint": "^5.12.1",
"tslint-config-airbnb": "^5.11.1",
"tslint-config-prettier": "^1.17.0",
"tslint-react": "^3.6.0",
"typescript": "^3.3.1",
"typescript-tslint-plugin": "^0.3.1"
},
"gitHead": "0890839a23a7afd042ad3984dca69232767d60cd"
"gitHead": "c49e13b898b71a22a0d8045ab5b0aa28547e27b2"
}

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