vis-util 5.0.6 → 5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/deep-object-assign.d.ts +1 -1
- package/declarations/deep-object-assign.d.ts.map +1 -1
- package/declarations/random/alea.d.ts +1 -1
- package/declarations/random/alea.d.ts.map +1 -1
- package/declarations/shared/configurator-types.d.ts +9 -9
- package/declarations/shared/configurator-types.d.ts.map +1 -1
- package/esnext/esm/vis-util.js +2 -2
- package/esnext/esm/vis-util.min.js +2 -2
- package/esnext/umd/vis-util.js +2 -2
- package/esnext/umd/vis-util.min.js +2 -2
- package/package.json +13 -13
- package/peer/esm/vis-util.js +108 -175
- package/peer/esm/vis-util.js.map +1 -1
- package/peer/esm/vis-util.min.js +4 -4
- package/peer/esm/vis-util.min.js.map +1 -1
- package/peer/umd/vis-util.js +108 -175
- package/peer/umd/vis-util.js.map +1 -1
- package/peer/umd/vis-util.min.js +4 -4
- package/peer/umd/vis-util.min.js.map +1 -1
- package/standalone/esm/vis-util.js +108 -175
- package/standalone/esm/vis-util.js.map +1 -1
- package/standalone/esm/vis-util.min.js +4 -4
- package/standalone/esm/vis-util.min.js.map +1 -1
- package/standalone/umd/vis-util.js +108 -175
- package/standalone/umd/vis-util.js.map +1 -1
- package/standalone/umd/vis-util.min.js +4 -4
- package/standalone/umd/vis-util.min.js.map +1 -1
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* utilitie collection for visjs
|
|
6
6
|
*
|
|
7
|
-
* @version 5.0.
|
|
8
|
-
* @date 2023-11-
|
|
7
|
+
* @version 5.0.7
|
|
8
|
+
* @date 2023-11-20T09:06:51.067Z
|
|
9
9
|
*
|
|
10
10
|
* @copyright (c) 2011-2017 Almende B.V, http://almende.com
|
|
11
11
|
* @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
|
|
@@ -3842,179 +3842,112 @@
|
|
|
3842
3842
|
var componentEmitter = {exports: {}};
|
|
3843
3843
|
|
|
3844
3844
|
(function (module) {
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
}
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
function
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
}
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
Emitter.prototype.
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
if (cb === fn || cb.fn === fn) {
|
|
3952
|
-
callbacks.splice(i, 1);
|
|
3953
|
-
break;
|
|
3954
|
-
}
|
|
3955
|
-
}
|
|
3956
|
-
|
|
3957
|
-
// Remove event specific arrays for event types that no
|
|
3958
|
-
// one is subscribed for to avoid memory leak.
|
|
3959
|
-
if (callbacks.length === 0) {
|
|
3960
|
-
delete this._callbacks['$' + event];
|
|
3961
|
-
}
|
|
3962
|
-
|
|
3963
|
-
return this;
|
|
3964
|
-
};
|
|
3965
|
-
|
|
3966
|
-
/**
|
|
3967
|
-
* Emit `event` with the given args.
|
|
3968
|
-
*
|
|
3969
|
-
* @param {String} event
|
|
3970
|
-
* @param {Mixed} ...
|
|
3971
|
-
* @return {Emitter}
|
|
3972
|
-
*/
|
|
3973
|
-
|
|
3974
|
-
Emitter.prototype.emit = function(event){
|
|
3975
|
-
this._callbacks = this._callbacks || {};
|
|
3976
|
-
|
|
3977
|
-
var args = new Array(arguments.length - 1)
|
|
3978
|
-
, callbacks = this._callbacks['$' + event];
|
|
3979
|
-
|
|
3980
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3981
|
-
args[i - 1] = arguments[i];
|
|
3982
|
-
}
|
|
3983
|
-
|
|
3984
|
-
if (callbacks) {
|
|
3985
|
-
callbacks = callbacks.slice(0);
|
|
3986
|
-
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
|
3987
|
-
callbacks[i].apply(this, args);
|
|
3988
|
-
}
|
|
3989
|
-
}
|
|
3990
|
-
|
|
3991
|
-
return this;
|
|
3992
|
-
};
|
|
3993
|
-
|
|
3994
|
-
/**
|
|
3995
|
-
* Return array of callbacks for `event`.
|
|
3996
|
-
*
|
|
3997
|
-
* @param {String} event
|
|
3998
|
-
* @return {Array}
|
|
3999
|
-
* @api public
|
|
4000
|
-
*/
|
|
4001
|
-
|
|
4002
|
-
Emitter.prototype.listeners = function(event){
|
|
4003
|
-
this._callbacks = this._callbacks || {};
|
|
4004
|
-
return this._callbacks['$' + event] || [];
|
|
4005
|
-
};
|
|
4006
|
-
|
|
4007
|
-
/**
|
|
4008
|
-
* Check if this emitter has `event` handlers.
|
|
4009
|
-
*
|
|
4010
|
-
* @param {String} event
|
|
4011
|
-
* @return {Boolean}
|
|
4012
|
-
* @api public
|
|
4013
|
-
*/
|
|
4014
|
-
|
|
4015
|
-
Emitter.prototype.hasListeners = function(event){
|
|
4016
|
-
return !! this.listeners(event).length;
|
|
4017
|
-
};
|
|
3845
|
+
function Emitter(object) {
|
|
3846
|
+
if (object) {
|
|
3847
|
+
return mixin(object);
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
this._callbacks = new Map();
|
|
3851
|
+
}
|
|
3852
|
+
|
|
3853
|
+
function mixin(object) {
|
|
3854
|
+
Object.assign(object, Emitter.prototype);
|
|
3855
|
+
object._callbacks = new Map();
|
|
3856
|
+
return object;
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3859
|
+
Emitter.prototype.on = function (event, listener) {
|
|
3860
|
+
const callbacks = this._callbacks.get(event) ?? [];
|
|
3861
|
+
callbacks.push(listener);
|
|
3862
|
+
this._callbacks.set(event, callbacks);
|
|
3863
|
+
return this;
|
|
3864
|
+
};
|
|
3865
|
+
|
|
3866
|
+
Emitter.prototype.once = function (event, listener) {
|
|
3867
|
+
const on = (...arguments_) => {
|
|
3868
|
+
this.off(event, on);
|
|
3869
|
+
listener.apply(this, arguments_);
|
|
3870
|
+
};
|
|
3871
|
+
|
|
3872
|
+
on.fn = listener;
|
|
3873
|
+
this.on(event, on);
|
|
3874
|
+
return this;
|
|
3875
|
+
};
|
|
3876
|
+
|
|
3877
|
+
Emitter.prototype.off = function (event, listener) {
|
|
3878
|
+
if (event === undefined && listener === undefined) {
|
|
3879
|
+
this._callbacks.clear();
|
|
3880
|
+
return this;
|
|
3881
|
+
}
|
|
3882
|
+
|
|
3883
|
+
if (listener === undefined) {
|
|
3884
|
+
this._callbacks.delete(event);
|
|
3885
|
+
return this;
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
const callbacks = this._callbacks.get(event);
|
|
3889
|
+
if (callbacks) {
|
|
3890
|
+
for (const [index, callback] of callbacks.entries()) {
|
|
3891
|
+
if (callback === listener || callback.fn === listener) {
|
|
3892
|
+
callbacks.splice(index, 1);
|
|
3893
|
+
break;
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
if (callbacks.length === 0) {
|
|
3898
|
+
this._callbacks.delete(event);
|
|
3899
|
+
} else {
|
|
3900
|
+
this._callbacks.set(event, callbacks);
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
return this;
|
|
3905
|
+
};
|
|
3906
|
+
|
|
3907
|
+
Emitter.prototype.emit = function (event, ...arguments_) {
|
|
3908
|
+
const callbacks = this._callbacks.get(event);
|
|
3909
|
+
if (callbacks) {
|
|
3910
|
+
// Create a copy of the callbacks array to avoid issues if it's modified during iteration
|
|
3911
|
+
const callbacksCopy = [...callbacks];
|
|
3912
|
+
|
|
3913
|
+
for (const callback of callbacksCopy) {
|
|
3914
|
+
callback.apply(this, arguments_);
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
return this;
|
|
3919
|
+
};
|
|
3920
|
+
|
|
3921
|
+
Emitter.prototype.listeners = function (event) {
|
|
3922
|
+
return this._callbacks.get(event) ?? [];
|
|
3923
|
+
};
|
|
3924
|
+
|
|
3925
|
+
Emitter.prototype.listenerCount = function (event) {
|
|
3926
|
+
if (event) {
|
|
3927
|
+
return this.listeners(event).length;
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3930
|
+
let totalCount = 0;
|
|
3931
|
+
for (const callbacks of this._callbacks.values()) {
|
|
3932
|
+
totalCount += callbacks.length;
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
return totalCount;
|
|
3936
|
+
};
|
|
3937
|
+
|
|
3938
|
+
Emitter.prototype.hasListeners = function (event) {
|
|
3939
|
+
return this.listenerCount(event) > 0;
|
|
3940
|
+
};
|
|
3941
|
+
|
|
3942
|
+
// Aliases
|
|
3943
|
+
Emitter.prototype.addEventListener = Emitter.prototype.on;
|
|
3944
|
+
Emitter.prototype.removeListener = Emitter.prototype.off;
|
|
3945
|
+
Emitter.prototype.removeEventListener = Emitter.prototype.off;
|
|
3946
|
+
Emitter.prototype.removeAllListeners = Emitter.prototype.off;
|
|
3947
|
+
|
|
3948
|
+
{
|
|
3949
|
+
module.exports = Emitter;
|
|
3950
|
+
}
|
|
4018
3951
|
} (componentEmitter));
|
|
4019
3952
|
|
|
4020
3953
|
var componentEmitterExports = componentEmitter.exports;
|