force-graph 1.43.0 → 1.43.1
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/README.md +1 -1
- package/dist/force-graph.js +806 -794
- package/dist/force-graph.js.map +1 -1
- package/dist/force-graph.min.js +3 -3
- package/dist/force-graph.mjs +1 -1
- package/package.json +15 -15
- package/src/force-graph.js +1 -1
package/dist/force-graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.43.
|
|
1
|
+
// Version 1.43.1 force-graph - https://github.com/vasturiano/force-graph
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -83,17 +83,17 @@
|
|
|
83
83
|
}
|
|
84
84
|
return target;
|
|
85
85
|
}
|
|
86
|
-
function _typeof(obj) {
|
|
86
|
+
function _typeof$1(obj) {
|
|
87
87
|
"@babel/helpers - typeof";
|
|
88
88
|
|
|
89
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
89
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
90
90
|
return typeof obj;
|
|
91
91
|
} : function (obj) {
|
|
92
92
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
93
|
-
}, _typeof(obj);
|
|
93
|
+
}, _typeof$1(obj);
|
|
94
94
|
}
|
|
95
95
|
function _defineProperty(obj, key, value) {
|
|
96
|
-
key = _toPropertyKey$
|
|
96
|
+
key = _toPropertyKey$3(key);
|
|
97
97
|
if (key in obj) {
|
|
98
98
|
Object.defineProperty(obj, key, {
|
|
99
99
|
value: value,
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
function _nonIterableRest$2() {
|
|
174
174
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
175
175
|
}
|
|
176
|
-
function _toPrimitive$
|
|
176
|
+
function _toPrimitive$3(input, hint) {
|
|
177
177
|
if (typeof input !== "object" || input === null) return input;
|
|
178
178
|
var prim = input[Symbol.toPrimitive];
|
|
179
179
|
if (prim !== undefined) {
|
|
@@ -183,8 +183,8 @@
|
|
|
183
183
|
}
|
|
184
184
|
return (hint === "string" ? String : Number)(input);
|
|
185
185
|
}
|
|
186
|
-
function _toPropertyKey$
|
|
187
|
-
var key = _toPrimitive$
|
|
186
|
+
function _toPropertyKey$3(arg) {
|
|
187
|
+
var key = _toPrimitive$3(arg, "string");
|
|
188
188
|
return typeof key === "symbol" ? key : String(key);
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -1052,7 +1052,7 @@
|
|
|
1052
1052
|
}
|
|
1053
1053
|
}
|
|
1054
1054
|
|
|
1055
|
-
var root$
|
|
1055
|
+
var root$2 = [null];
|
|
1056
1056
|
|
|
1057
1057
|
function Selection$1(groups, parents) {
|
|
1058
1058
|
this._groups = groups;
|
|
@@ -1060,7 +1060,7 @@
|
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
1062
|
function selection() {
|
|
1063
|
-
return new Selection$1([[document.documentElement]], root$
|
|
1063
|
+
return new Selection$1([[document.documentElement]], root$2);
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
1066
1066
|
function selection_selection() {
|
|
@@ -1109,7 +1109,7 @@
|
|
|
1109
1109
|
function d3Select(selector) {
|
|
1110
1110
|
return typeof selector === "string"
|
|
1111
1111
|
? new Selection$1([[document.querySelector(selector)]], [document.documentElement])
|
|
1112
|
-
: new Selection$1([[selector]], root$
|
|
1112
|
+
: new Selection$1([[selector]], root$2);
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
1115
|
function sourceEvent(event) {
|
|
@@ -2190,7 +2190,7 @@
|
|
|
2190
2190
|
clock = typeof performance === "object" && performance.now ? performance : Date,
|
|
2191
2191
|
setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
|
|
2192
2192
|
|
|
2193
|
-
function now$
|
|
2193
|
+
function now$4() {
|
|
2194
2194
|
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
|
2195
2195
|
}
|
|
2196
2196
|
|
|
@@ -2208,7 +2208,7 @@
|
|
|
2208
2208
|
constructor: Timer,
|
|
2209
2209
|
restart: function(callback, delay, time) {
|
|
2210
2210
|
if (typeof callback !== "function") throw new TypeError("callback is not a function");
|
|
2211
|
-
time = (time == null ? now$
|
|
2211
|
+
time = (time == null ? now$4() : +time) + (delay == null ? 0 : +delay);
|
|
2212
2212
|
if (!this._next && taskTail !== this) {
|
|
2213
2213
|
if (taskTail) taskTail._next = this;
|
|
2214
2214
|
else taskHead = this;
|
|
@@ -2234,7 +2234,7 @@
|
|
|
2234
2234
|
}
|
|
2235
2235
|
|
|
2236
2236
|
function timerFlush() {
|
|
2237
|
-
now$
|
|
2237
|
+
now$4(); // Get the current time, if not already set.
|
|
2238
2238
|
++frame; // Pretend we’ve set an alarm, if we haven’t already.
|
|
2239
2239
|
var t = taskHead, e;
|
|
2240
2240
|
while (t) {
|
|
@@ -3149,7 +3149,7 @@
|
|
|
3149
3149
|
if (name instanceof Transition) {
|
|
3150
3150
|
id = name._id, name = name._name;
|
|
3151
3151
|
} else {
|
|
3152
|
-
id = newId(), (timing = defaultTiming).time = now$
|
|
3152
|
+
id = newId(), (timing = defaultTiming).time = now$4(), name = name == null ? null : name + "";
|
|
3153
3153
|
}
|
|
3154
3154
|
|
|
3155
3155
|
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
|
@@ -3769,28 +3769,230 @@
|
|
|
3769
3769
|
return min;
|
|
3770
3770
|
}
|
|
3771
3771
|
|
|
3772
|
-
|
|
3772
|
+
/** Detect free variable `global` from Node.js. */
|
|
3773
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
3774
|
+
|
|
3775
|
+
var freeGlobal$1 = freeGlobal;
|
|
3776
|
+
|
|
3777
|
+
/** Detect free variable `self`. */
|
|
3778
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
3779
|
+
|
|
3780
|
+
/** Used as a reference to the global object. */
|
|
3781
|
+
var root = freeGlobal$1 || freeSelf || Function('return this')();
|
|
3782
|
+
|
|
3783
|
+
var root$1 = root;
|
|
3784
|
+
|
|
3785
|
+
/** Built-in value references. */
|
|
3786
|
+
var Symbol$1 = root$1.Symbol;
|
|
3787
|
+
|
|
3788
|
+
var Symbol$2 = Symbol$1;
|
|
3789
|
+
|
|
3790
|
+
/** Used for built-in method references. */
|
|
3791
|
+
var objectProto$1 = Object.prototype;
|
|
3792
|
+
|
|
3793
|
+
/** Used to check objects for own properties. */
|
|
3794
|
+
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
3773
3795
|
|
|
3774
3796
|
/**
|
|
3775
|
-
*
|
|
3776
|
-
*
|
|
3777
|
-
*
|
|
3778
|
-
* Released under MIT license <https://lodash.com/license>
|
|
3779
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
3780
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
3797
|
+
* Used to resolve the
|
|
3798
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
3799
|
+
* of values.
|
|
3781
3800
|
*/
|
|
3801
|
+
var nativeObjectToString$1 = objectProto$1.toString;
|
|
3782
3802
|
|
|
3783
|
-
/**
|
|
3784
|
-
var
|
|
3803
|
+
/** Built-in value references. */
|
|
3804
|
+
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
3785
3805
|
|
|
3786
|
-
/**
|
|
3787
|
-
|
|
3806
|
+
/**
|
|
3807
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
3808
|
+
*
|
|
3809
|
+
* @private
|
|
3810
|
+
* @param {*} value The value to query.
|
|
3811
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
3812
|
+
*/
|
|
3813
|
+
function getRawTag(value) {
|
|
3814
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag$1),
|
|
3815
|
+
tag = value[symToStringTag$1];
|
|
3816
|
+
|
|
3817
|
+
try {
|
|
3818
|
+
value[symToStringTag$1] = undefined;
|
|
3819
|
+
var unmasked = true;
|
|
3820
|
+
} catch (e) {}
|
|
3821
|
+
|
|
3822
|
+
var result = nativeObjectToString$1.call(value);
|
|
3823
|
+
if (unmasked) {
|
|
3824
|
+
if (isOwn) {
|
|
3825
|
+
value[symToStringTag$1] = tag;
|
|
3826
|
+
} else {
|
|
3827
|
+
delete value[symToStringTag$1];
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
return result;
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
/** Used for built-in method references. */
|
|
3834
|
+
var objectProto = Object.prototype;
|
|
3835
|
+
|
|
3836
|
+
/**
|
|
3837
|
+
* Used to resolve the
|
|
3838
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
3839
|
+
* of values.
|
|
3840
|
+
*/
|
|
3841
|
+
var nativeObjectToString = objectProto.toString;
|
|
3842
|
+
|
|
3843
|
+
/**
|
|
3844
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
3845
|
+
*
|
|
3846
|
+
* @private
|
|
3847
|
+
* @param {*} value The value to convert.
|
|
3848
|
+
* @returns {string} Returns the converted string.
|
|
3849
|
+
*/
|
|
3850
|
+
function objectToString(value) {
|
|
3851
|
+
return nativeObjectToString.call(value);
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3854
|
+
/** `Object#toString` result references. */
|
|
3855
|
+
var nullTag = '[object Null]',
|
|
3856
|
+
undefinedTag = '[object Undefined]';
|
|
3857
|
+
|
|
3858
|
+
/** Built-in value references. */
|
|
3859
|
+
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
3860
|
+
|
|
3861
|
+
/**
|
|
3862
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
3863
|
+
*
|
|
3864
|
+
* @private
|
|
3865
|
+
* @param {*} value The value to query.
|
|
3866
|
+
* @returns {string} Returns the `toStringTag`.
|
|
3867
|
+
*/
|
|
3868
|
+
function baseGetTag(value) {
|
|
3869
|
+
if (value == null) {
|
|
3870
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
3871
|
+
}
|
|
3872
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
3873
|
+
? getRawTag(value)
|
|
3874
|
+
: objectToString(value);
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
/**
|
|
3878
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
3879
|
+
* and has a `typeof` result of "object".
|
|
3880
|
+
*
|
|
3881
|
+
* @static
|
|
3882
|
+
* @memberOf _
|
|
3883
|
+
* @since 4.0.0
|
|
3884
|
+
* @category Lang
|
|
3885
|
+
* @param {*} value The value to check.
|
|
3886
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
3887
|
+
* @example
|
|
3888
|
+
*
|
|
3889
|
+
* _.isObjectLike({});
|
|
3890
|
+
* // => true
|
|
3891
|
+
*
|
|
3892
|
+
* _.isObjectLike([1, 2, 3]);
|
|
3893
|
+
* // => true
|
|
3894
|
+
*
|
|
3895
|
+
* _.isObjectLike(_.noop);
|
|
3896
|
+
* // => false
|
|
3897
|
+
*
|
|
3898
|
+
* _.isObjectLike(null);
|
|
3899
|
+
* // => false
|
|
3900
|
+
*/
|
|
3901
|
+
function isObjectLike(value) {
|
|
3902
|
+
return value != null && typeof value == 'object';
|
|
3903
|
+
}
|
|
3788
3904
|
|
|
3789
3905
|
/** `Object#toString` result references. */
|
|
3790
3906
|
var symbolTag = '[object Symbol]';
|
|
3791
3907
|
|
|
3792
|
-
/**
|
|
3793
|
-
|
|
3908
|
+
/**
|
|
3909
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
3910
|
+
*
|
|
3911
|
+
* @static
|
|
3912
|
+
* @memberOf _
|
|
3913
|
+
* @since 4.0.0
|
|
3914
|
+
* @category Lang
|
|
3915
|
+
* @param {*} value The value to check.
|
|
3916
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
3917
|
+
* @example
|
|
3918
|
+
*
|
|
3919
|
+
* _.isSymbol(Symbol.iterator);
|
|
3920
|
+
* // => true
|
|
3921
|
+
*
|
|
3922
|
+
* _.isSymbol('abc');
|
|
3923
|
+
* // => false
|
|
3924
|
+
*/
|
|
3925
|
+
function isSymbol(value) {
|
|
3926
|
+
return typeof value == 'symbol' ||
|
|
3927
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3930
|
+
/** Used to match a single whitespace character. */
|
|
3931
|
+
var reWhitespace = /\s/;
|
|
3932
|
+
|
|
3933
|
+
/**
|
|
3934
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
3935
|
+
* character of `string`.
|
|
3936
|
+
*
|
|
3937
|
+
* @private
|
|
3938
|
+
* @param {string} string The string to inspect.
|
|
3939
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
3940
|
+
*/
|
|
3941
|
+
function trimmedEndIndex(string) {
|
|
3942
|
+
var index = string.length;
|
|
3943
|
+
|
|
3944
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
3945
|
+
return index;
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
/** Used to match leading whitespace. */
|
|
3949
|
+
var reTrimStart = /^\s+/;
|
|
3950
|
+
|
|
3951
|
+
/**
|
|
3952
|
+
* The base implementation of `_.trim`.
|
|
3953
|
+
*
|
|
3954
|
+
* @private
|
|
3955
|
+
* @param {string} string The string to trim.
|
|
3956
|
+
* @returns {string} Returns the trimmed string.
|
|
3957
|
+
*/
|
|
3958
|
+
function baseTrim(string) {
|
|
3959
|
+
return string
|
|
3960
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
3961
|
+
: string;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3964
|
+
/**
|
|
3965
|
+
* Checks if `value` is the
|
|
3966
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
3967
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
3968
|
+
*
|
|
3969
|
+
* @static
|
|
3970
|
+
* @memberOf _
|
|
3971
|
+
* @since 0.1.0
|
|
3972
|
+
* @category Lang
|
|
3973
|
+
* @param {*} value The value to check.
|
|
3974
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
3975
|
+
* @example
|
|
3976
|
+
*
|
|
3977
|
+
* _.isObject({});
|
|
3978
|
+
* // => true
|
|
3979
|
+
*
|
|
3980
|
+
* _.isObject([1, 2, 3]);
|
|
3981
|
+
* // => true
|
|
3982
|
+
*
|
|
3983
|
+
* _.isObject(_.noop);
|
|
3984
|
+
* // => true
|
|
3985
|
+
*
|
|
3986
|
+
* _.isObject(null);
|
|
3987
|
+
* // => false
|
|
3988
|
+
*/
|
|
3989
|
+
function isObject(value) {
|
|
3990
|
+
var type = typeof value;
|
|
3991
|
+
return value != null && (type == 'object' || type == 'function');
|
|
3992
|
+
}
|
|
3993
|
+
|
|
3994
|
+
/** Used as references for various `Number` constants. */
|
|
3995
|
+
var NAN = 0 / 0;
|
|
3794
3996
|
|
|
3795
3997
|
/** Used to detect bad signed hexadecimal string values. */
|
|
3796
3998
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
@@ -3804,28 +4006,49 @@
|
|
|
3804
4006
|
/** Built-in method references without a dependency on `root`. */
|
|
3805
4007
|
var freeParseInt = parseInt;
|
|
3806
4008
|
|
|
3807
|
-
/** Detect free variable `global` from Node.js. */
|
|
3808
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
3809
|
-
|
|
3810
|
-
/** Detect free variable `self`. */
|
|
3811
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
3812
|
-
|
|
3813
|
-
/** Used as a reference to the global object. */
|
|
3814
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
|
3815
|
-
|
|
3816
|
-
/** Used for built-in method references. */
|
|
3817
|
-
var objectProto = Object.prototype;
|
|
3818
|
-
|
|
3819
4009
|
/**
|
|
3820
|
-
*
|
|
3821
|
-
*
|
|
3822
|
-
*
|
|
4010
|
+
* Converts `value` to a number.
|
|
4011
|
+
*
|
|
4012
|
+
* @static
|
|
4013
|
+
* @memberOf _
|
|
4014
|
+
* @since 4.0.0
|
|
4015
|
+
* @category Lang
|
|
4016
|
+
* @param {*} value The value to process.
|
|
4017
|
+
* @returns {number} Returns the number.
|
|
4018
|
+
* @example
|
|
4019
|
+
*
|
|
4020
|
+
* _.toNumber(3.2);
|
|
4021
|
+
* // => 3.2
|
|
4022
|
+
*
|
|
4023
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
4024
|
+
* // => 5e-324
|
|
4025
|
+
*
|
|
4026
|
+
* _.toNumber(Infinity);
|
|
4027
|
+
* // => Infinity
|
|
4028
|
+
*
|
|
4029
|
+
* _.toNumber('3.2');
|
|
4030
|
+
* // => 3.2
|
|
3823
4031
|
*/
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
4032
|
+
function toNumber(value) {
|
|
4033
|
+
if (typeof value == 'number') {
|
|
4034
|
+
return value;
|
|
4035
|
+
}
|
|
4036
|
+
if (isSymbol(value)) {
|
|
4037
|
+
return NAN;
|
|
4038
|
+
}
|
|
4039
|
+
if (isObject(value)) {
|
|
4040
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
4041
|
+
value = isObject(other) ? (other + '') : other;
|
|
4042
|
+
}
|
|
4043
|
+
if (typeof value != 'string') {
|
|
4044
|
+
return value === 0 ? value : +value;
|
|
4045
|
+
}
|
|
4046
|
+
value = baseTrim(value);
|
|
4047
|
+
var isBinary = reIsBinary.test(value);
|
|
4048
|
+
return (isBinary || reIsOctal.test(value))
|
|
4049
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
4050
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
4051
|
+
}
|
|
3829
4052
|
|
|
3830
4053
|
/**
|
|
3831
4054
|
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
@@ -3844,9 +4067,18 @@
|
|
|
3844
4067
|
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
3845
4068
|
*/
|
|
3846
4069
|
var now$2 = function() {
|
|
3847
|
-
return root.Date.now();
|
|
4070
|
+
return root$1.Date.now();
|
|
3848
4071
|
};
|
|
3849
4072
|
|
|
4073
|
+
var now$3 = now$2;
|
|
4074
|
+
|
|
4075
|
+
/** Error message constants. */
|
|
4076
|
+
var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
|
4077
|
+
|
|
4078
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
4079
|
+
var nativeMax = Math.max,
|
|
4080
|
+
nativeMin = Math.min;
|
|
4081
|
+
|
|
3850
4082
|
/**
|
|
3851
4083
|
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
3852
4084
|
* milliseconds have elapsed since the last time the debounced function was
|
|
@@ -3914,7 +4146,7 @@
|
|
|
3914
4146
|
trailing = true;
|
|
3915
4147
|
|
|
3916
4148
|
if (typeof func != 'function') {
|
|
3917
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
4149
|
+
throw new TypeError(FUNC_ERROR_TEXT$1);
|
|
3918
4150
|
}
|
|
3919
4151
|
wait = toNumber(wait) || 0;
|
|
3920
4152
|
if (isObject(options)) {
|
|
@@ -3946,9 +4178,11 @@
|
|
|
3946
4178
|
function remainingWait(time) {
|
|
3947
4179
|
var timeSinceLastCall = time - lastCallTime,
|
|
3948
4180
|
timeSinceLastInvoke = time - lastInvokeTime,
|
|
3949
|
-
|
|
4181
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
3950
4182
|
|
|
3951
|
-
return maxing
|
|
4183
|
+
return maxing
|
|
4184
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
4185
|
+
: timeWaiting;
|
|
3952
4186
|
}
|
|
3953
4187
|
|
|
3954
4188
|
function shouldInvoke(time) {
|
|
@@ -3963,7 +4197,7 @@
|
|
|
3963
4197
|
}
|
|
3964
4198
|
|
|
3965
4199
|
function timerExpired() {
|
|
3966
|
-
var time = now$
|
|
4200
|
+
var time = now$3();
|
|
3967
4201
|
if (shouldInvoke(time)) {
|
|
3968
4202
|
return trailingEdge(time);
|
|
3969
4203
|
}
|
|
@@ -3992,11 +4226,11 @@
|
|
|
3992
4226
|
}
|
|
3993
4227
|
|
|
3994
4228
|
function flush() {
|
|
3995
|
-
return timerId === undefined ? result : trailingEdge(now$
|
|
4229
|
+
return timerId === undefined ? result : trailingEdge(now$3());
|
|
3996
4230
|
}
|
|
3997
4231
|
|
|
3998
4232
|
function debounced() {
|
|
3999
|
-
var time = now$
|
|
4233
|
+
var time = now$3(),
|
|
4000
4234
|
isInvoking = shouldInvoke(time);
|
|
4001
4235
|
|
|
4002
4236
|
lastArgs = arguments;
|
|
@@ -4009,6 +4243,7 @@
|
|
|
4009
4243
|
}
|
|
4010
4244
|
if (maxing) {
|
|
4011
4245
|
// Handle invocations in a tight loop.
|
|
4246
|
+
clearTimeout(timerId);
|
|
4012
4247
|
timerId = setTimeout(timerExpired, wait);
|
|
4013
4248
|
return invokeFunc(lastCallTime);
|
|
4014
4249
|
}
|
|
@@ -4023,6 +4258,9 @@
|
|
|
4023
4258
|
return debounced;
|
|
4024
4259
|
}
|
|
4025
4260
|
|
|
4261
|
+
/** Error message constants. */
|
|
4262
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
4263
|
+
|
|
4026
4264
|
/**
|
|
4027
4265
|
* Creates a throttled function that only invokes `func` at most once per
|
|
4028
4266
|
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
@@ -4085,144 +4323,25 @@
|
|
|
4085
4323
|
});
|
|
4086
4324
|
}
|
|
4087
4325
|
|
|
4088
|
-
/**
|
|
4089
|
-
* Checks if `value` is the
|
|
4090
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
4091
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
4092
|
-
*
|
|
4093
|
-
* @static
|
|
4094
|
-
* @memberOf _
|
|
4095
|
-
* @since 0.1.0
|
|
4096
|
-
* @category Lang
|
|
4097
|
-
* @param {*} value The value to check.
|
|
4098
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
4099
|
-
* @example
|
|
4100
|
-
*
|
|
4101
|
-
* _.isObject({});
|
|
4102
|
-
* // => true
|
|
4103
|
-
*
|
|
4104
|
-
* _.isObject([1, 2, 3]);
|
|
4105
|
-
* // => true
|
|
4106
|
-
*
|
|
4107
|
-
* _.isObject(_.noop);
|
|
4108
|
-
* // => true
|
|
4109
|
-
*
|
|
4110
|
-
* _.isObject(null);
|
|
4111
|
-
* // => false
|
|
4112
|
-
*/
|
|
4113
|
-
function isObject(value) {
|
|
4114
|
-
var type = typeof value;
|
|
4115
|
-
return !!value && (type == 'object' || type == 'function');
|
|
4116
|
-
}
|
|
4117
|
-
|
|
4118
|
-
/**
|
|
4119
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
4120
|
-
* and has a `typeof` result of "object".
|
|
4121
|
-
*
|
|
4122
|
-
* @static
|
|
4123
|
-
* @memberOf _
|
|
4124
|
-
* @since 4.0.0
|
|
4125
|
-
* @category Lang
|
|
4126
|
-
* @param {*} value The value to check.
|
|
4127
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
4128
|
-
* @example
|
|
4129
|
-
*
|
|
4130
|
-
* _.isObjectLike({});
|
|
4131
|
-
* // => true
|
|
4132
|
-
*
|
|
4133
|
-
* _.isObjectLike([1, 2, 3]);
|
|
4134
|
-
* // => true
|
|
4135
|
-
*
|
|
4136
|
-
* _.isObjectLike(_.noop);
|
|
4137
|
-
* // => false
|
|
4138
|
-
*
|
|
4139
|
-
* _.isObjectLike(null);
|
|
4140
|
-
* // => false
|
|
4141
|
-
*/
|
|
4142
|
-
function isObjectLike(value) {
|
|
4143
|
-
return !!value && typeof value == 'object';
|
|
4144
|
-
}
|
|
4145
|
-
|
|
4146
|
-
/**
|
|
4147
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
4148
|
-
*
|
|
4149
|
-
* @static
|
|
4150
|
-
* @memberOf _
|
|
4151
|
-
* @since 4.0.0
|
|
4152
|
-
* @category Lang
|
|
4153
|
-
* @param {*} value The value to check.
|
|
4154
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
4155
|
-
* @example
|
|
4156
|
-
*
|
|
4157
|
-
* _.isSymbol(Symbol.iterator);
|
|
4158
|
-
* // => true
|
|
4159
|
-
*
|
|
4160
|
-
* _.isSymbol('abc');
|
|
4161
|
-
* // => false
|
|
4162
|
-
*/
|
|
4163
|
-
function isSymbol(value) {
|
|
4164
|
-
return typeof value == 'symbol' ||
|
|
4165
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
4166
|
-
}
|
|
4167
|
-
|
|
4168
|
-
/**
|
|
4169
|
-
* Converts `value` to a number.
|
|
4170
|
-
*
|
|
4171
|
-
* @static
|
|
4172
|
-
* @memberOf _
|
|
4173
|
-
* @since 4.0.0
|
|
4174
|
-
* @category Lang
|
|
4175
|
-
* @param {*} value The value to process.
|
|
4176
|
-
* @returns {number} Returns the number.
|
|
4177
|
-
* @example
|
|
4178
|
-
*
|
|
4179
|
-
* _.toNumber(3.2);
|
|
4180
|
-
* // => 3.2
|
|
4181
|
-
*
|
|
4182
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
4183
|
-
* // => 5e-324
|
|
4184
|
-
*
|
|
4185
|
-
* _.toNumber(Infinity);
|
|
4186
|
-
* // => Infinity
|
|
4187
|
-
*
|
|
4188
|
-
* _.toNumber('3.2');
|
|
4189
|
-
* // => 3.2
|
|
4190
|
-
*/
|
|
4191
|
-
function toNumber(value) {
|
|
4192
|
-
if (typeof value == 'number') {
|
|
4193
|
-
return value;
|
|
4194
|
-
}
|
|
4195
|
-
if (isSymbol(value)) {
|
|
4196
|
-
return NAN;
|
|
4197
|
-
}
|
|
4198
|
-
if (isObject(value)) {
|
|
4199
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
4200
|
-
value = isObject(other) ? (other + '') : other;
|
|
4201
|
-
}
|
|
4202
|
-
if (typeof value != 'string') {
|
|
4203
|
-
return value === 0 ? value : +value;
|
|
4204
|
-
}
|
|
4205
|
-
value = value.replace(reTrim, '');
|
|
4206
|
-
var isBinary = reIsBinary.test(value);
|
|
4207
|
-
return (isBinary || reIsOctal.test(value))
|
|
4208
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
4209
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
4210
|
-
}
|
|
4211
|
-
|
|
4212
|
-
var lodash_throttle = throttle;
|
|
4213
|
-
|
|
4214
|
-
var throttle$1 = lodash_throttle;
|
|
4215
|
-
|
|
4216
4326
|
/**
|
|
4217
4327
|
* The Ease class provides a collection of easing functions for use with tween.js.
|
|
4218
4328
|
*/
|
|
4219
|
-
var Easing = {
|
|
4220
|
-
Linear: {
|
|
4329
|
+
var Easing = Object.freeze({
|
|
4330
|
+
Linear: Object.freeze({
|
|
4221
4331
|
None: function (amount) {
|
|
4222
4332
|
return amount;
|
|
4223
4333
|
},
|
|
4224
|
-
|
|
4225
|
-
|
|
4334
|
+
In: function (amount) {
|
|
4335
|
+
return this.None(amount);
|
|
4336
|
+
},
|
|
4337
|
+
Out: function (amount) {
|
|
4338
|
+
return this.None(amount);
|
|
4339
|
+
},
|
|
4340
|
+
InOut: function (amount) {
|
|
4341
|
+
return this.None(amount);
|
|
4342
|
+
},
|
|
4343
|
+
}),
|
|
4344
|
+
Quadratic: Object.freeze({
|
|
4226
4345
|
In: function (amount) {
|
|
4227
4346
|
return amount * amount;
|
|
4228
4347
|
},
|
|
@@ -4235,8 +4354,8 @@
|
|
|
4235
4354
|
}
|
|
4236
4355
|
return -0.5 * (--amount * (amount - 2) - 1);
|
|
4237
4356
|
},
|
|
4238
|
-
},
|
|
4239
|
-
Cubic: {
|
|
4357
|
+
}),
|
|
4358
|
+
Cubic: Object.freeze({
|
|
4240
4359
|
In: function (amount) {
|
|
4241
4360
|
return amount * amount * amount;
|
|
4242
4361
|
},
|
|
@@ -4249,8 +4368,8 @@
|
|
|
4249
4368
|
}
|
|
4250
4369
|
return 0.5 * ((amount -= 2) * amount * amount + 2);
|
|
4251
4370
|
},
|
|
4252
|
-
},
|
|
4253
|
-
Quartic: {
|
|
4371
|
+
}),
|
|
4372
|
+
Quartic: Object.freeze({
|
|
4254
4373
|
In: function (amount) {
|
|
4255
4374
|
return amount * amount * amount * amount;
|
|
4256
4375
|
},
|
|
@@ -4263,8 +4382,8 @@
|
|
|
4263
4382
|
}
|
|
4264
4383
|
return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
|
|
4265
4384
|
},
|
|
4266
|
-
},
|
|
4267
|
-
Quintic: {
|
|
4385
|
+
}),
|
|
4386
|
+
Quintic: Object.freeze({
|
|
4268
4387
|
In: function (amount) {
|
|
4269
4388
|
return amount * amount * amount * amount * amount;
|
|
4270
4389
|
},
|
|
@@ -4277,19 +4396,19 @@
|
|
|
4277
4396
|
}
|
|
4278
4397
|
return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
|
|
4279
4398
|
},
|
|
4280
|
-
},
|
|
4281
|
-
Sinusoidal: {
|
|
4399
|
+
}),
|
|
4400
|
+
Sinusoidal: Object.freeze({
|
|
4282
4401
|
In: function (amount) {
|
|
4283
|
-
return 1 - Math.
|
|
4402
|
+
return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
|
|
4284
4403
|
},
|
|
4285
4404
|
Out: function (amount) {
|
|
4286
4405
|
return Math.sin((amount * Math.PI) / 2);
|
|
4287
4406
|
},
|
|
4288
4407
|
InOut: function (amount) {
|
|
4289
|
-
return 0.5 * (1 - Math.
|
|
4408
|
+
return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
|
|
4290
4409
|
},
|
|
4291
|
-
},
|
|
4292
|
-
Exponential: {
|
|
4410
|
+
}),
|
|
4411
|
+
Exponential: Object.freeze({
|
|
4293
4412
|
In: function (amount) {
|
|
4294
4413
|
return amount === 0 ? 0 : Math.pow(1024, amount - 1);
|
|
4295
4414
|
},
|
|
@@ -4308,8 +4427,8 @@
|
|
|
4308
4427
|
}
|
|
4309
4428
|
return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
|
|
4310
4429
|
},
|
|
4311
|
-
},
|
|
4312
|
-
Circular: {
|
|
4430
|
+
}),
|
|
4431
|
+
Circular: Object.freeze({
|
|
4313
4432
|
In: function (amount) {
|
|
4314
4433
|
return 1 - Math.sqrt(1 - amount * amount);
|
|
4315
4434
|
},
|
|
@@ -4322,8 +4441,8 @@
|
|
|
4322
4441
|
}
|
|
4323
4442
|
return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
|
|
4324
4443
|
},
|
|
4325
|
-
},
|
|
4326
|
-
Elastic: {
|
|
4444
|
+
}),
|
|
4445
|
+
Elastic: Object.freeze({
|
|
4327
4446
|
In: function (amount) {
|
|
4328
4447
|
if (amount === 0) {
|
|
4329
4448
|
return 0;
|
|
@@ -4355,15 +4474,15 @@
|
|
|
4355
4474
|
}
|
|
4356
4475
|
return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
|
|
4357
4476
|
},
|
|
4358
|
-
},
|
|
4359
|
-
Back: {
|
|
4477
|
+
}),
|
|
4478
|
+
Back: Object.freeze({
|
|
4360
4479
|
In: function (amount) {
|
|
4361
4480
|
var s = 1.70158;
|
|
4362
|
-
return amount * amount * ((s + 1) * amount - s);
|
|
4481
|
+
return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
|
|
4363
4482
|
},
|
|
4364
4483
|
Out: function (amount) {
|
|
4365
4484
|
var s = 1.70158;
|
|
4366
|
-
return --amount * amount * ((s + 1) * amount + s) + 1;
|
|
4485
|
+
return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
|
|
4367
4486
|
},
|
|
4368
4487
|
InOut: function (amount) {
|
|
4369
4488
|
var s = 1.70158 * 1.525;
|
|
@@ -4372,8 +4491,8 @@
|
|
|
4372
4491
|
}
|
|
4373
4492
|
return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
|
|
4374
4493
|
},
|
|
4375
|
-
},
|
|
4376
|
-
Bounce: {
|
|
4494
|
+
}),
|
|
4495
|
+
Bounce: Object.freeze({
|
|
4377
4496
|
In: function (amount) {
|
|
4378
4497
|
return 1 - Easing.Bounce.Out(1 - amount);
|
|
4379
4498
|
},
|
|
@@ -4397,8 +4516,27 @@
|
|
|
4397
4516
|
}
|
|
4398
4517
|
return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
|
|
4399
4518
|
},
|
|
4519
|
+
}),
|
|
4520
|
+
generatePow: function (power) {
|
|
4521
|
+
if (power === void 0) { power = 4; }
|
|
4522
|
+
power = power < Number.EPSILON ? Number.EPSILON : power;
|
|
4523
|
+
power = power > 10000 ? 10000 : power;
|
|
4524
|
+
return {
|
|
4525
|
+
In: function (amount) {
|
|
4526
|
+
return Math.pow(amount, power);
|
|
4527
|
+
},
|
|
4528
|
+
Out: function (amount) {
|
|
4529
|
+
return 1 - Math.pow((1 - amount), power);
|
|
4530
|
+
},
|
|
4531
|
+
InOut: function (amount) {
|
|
4532
|
+
if (amount < 0.5) {
|
|
4533
|
+
return Math.pow((amount * 2), power) / 2;
|
|
4534
|
+
}
|
|
4535
|
+
return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
|
|
4536
|
+
},
|
|
4537
|
+
};
|
|
4400
4538
|
},
|
|
4401
|
-
};
|
|
4539
|
+
});
|
|
4402
4540
|
|
|
4403
4541
|
var now;
|
|
4404
4542
|
// Include a performance.now polyfill.
|
|
@@ -4611,8 +4749,10 @@
|
|
|
4611
4749
|
this._startTime = 0;
|
|
4612
4750
|
this._easingFunction = Easing.Linear.None;
|
|
4613
4751
|
this._interpolationFunction = Interpolation.Linear;
|
|
4752
|
+
// eslint-disable-next-line
|
|
4614
4753
|
this._chainedTweens = [];
|
|
4615
4754
|
this._onStartCallbackFired = false;
|
|
4755
|
+
this._onEveryStartCallbackFired = false;
|
|
4616
4756
|
this._id = Sequence.nextId();
|
|
4617
4757
|
this._isChainStopped = false;
|
|
4618
4758
|
this._goToEnd = false;
|
|
@@ -4638,10 +4778,13 @@
|
|
|
4638
4778
|
return this;
|
|
4639
4779
|
};
|
|
4640
4780
|
Tween.prototype.duration = function (d) {
|
|
4781
|
+
if (d === void 0) { d = 1000; }
|
|
4641
4782
|
this._duration = d;
|
|
4642
4783
|
return this;
|
|
4643
4784
|
};
|
|
4644
|
-
Tween.prototype.start = function (time) {
|
|
4785
|
+
Tween.prototype.start = function (time, overrideStartingValues) {
|
|
4786
|
+
if (time === void 0) { time = now$1(); }
|
|
4787
|
+
if (overrideStartingValues === void 0) { overrideStartingValues = false; }
|
|
4645
4788
|
if (this._isPlaying) {
|
|
4646
4789
|
return this;
|
|
4647
4790
|
}
|
|
@@ -4660,13 +4803,17 @@
|
|
|
4660
4803
|
this._isPlaying = true;
|
|
4661
4804
|
this._isPaused = false;
|
|
4662
4805
|
this._onStartCallbackFired = false;
|
|
4806
|
+
this._onEveryStartCallbackFired = false;
|
|
4663
4807
|
this._isChainStopped = false;
|
|
4664
|
-
this._startTime = time
|
|
4808
|
+
this._startTime = time;
|
|
4665
4809
|
this._startTime += this._delayTime;
|
|
4666
|
-
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat);
|
|
4810
|
+
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
|
|
4667
4811
|
return this;
|
|
4668
4812
|
};
|
|
4669
|
-
Tween.prototype.
|
|
4813
|
+
Tween.prototype.startFromCurrentValues = function (time) {
|
|
4814
|
+
return this.start(time, true);
|
|
4815
|
+
};
|
|
4816
|
+
Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
|
|
4670
4817
|
for (var property in _valuesEnd) {
|
|
4671
4818
|
var startValue = _object[property];
|
|
4672
4819
|
var startValueIsArray = Array.isArray(startValue);
|
|
@@ -4686,7 +4833,9 @@
|
|
|
4686
4833
|
// handle an array of relative values
|
|
4687
4834
|
endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
|
|
4688
4835
|
// Create a local copy of the Array with the start value at the front
|
|
4689
|
-
|
|
4836
|
+
if (_valuesStart[property] === undefined) {
|
|
4837
|
+
_valuesEnd[property] = [startValue].concat(endValues);
|
|
4838
|
+
}
|
|
4690
4839
|
}
|
|
4691
4840
|
// handle the deepness of the values
|
|
4692
4841
|
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
|
@@ -4700,11 +4849,11 @@
|
|
|
4700
4849
|
_valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
|
|
4701
4850
|
// eslint-disable-next-line
|
|
4702
4851
|
// @ts-ignore FIXME?
|
|
4703
|
-
this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]);
|
|
4852
|
+
this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
|
|
4704
4853
|
}
|
|
4705
4854
|
else {
|
|
4706
|
-
// Save the starting value, but only once.
|
|
4707
|
-
if (typeof _valuesStart[property] === 'undefined') {
|
|
4855
|
+
// Save the starting value, but only once unless override is requested.
|
|
4856
|
+
if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
|
|
4708
4857
|
_valuesStart[property] = startValue;
|
|
4709
4858
|
}
|
|
4710
4859
|
if (!startValueIsArray) {
|
|
@@ -4775,14 +4924,17 @@
|
|
|
4775
4924
|
return this;
|
|
4776
4925
|
};
|
|
4777
4926
|
Tween.prototype.group = function (group) {
|
|
4927
|
+
if (group === void 0) { group = mainGroup; }
|
|
4778
4928
|
this._group = group;
|
|
4779
4929
|
return this;
|
|
4780
4930
|
};
|
|
4781
4931
|
Tween.prototype.delay = function (amount) {
|
|
4932
|
+
if (amount === void 0) { amount = 0; }
|
|
4782
4933
|
this._delayTime = amount;
|
|
4783
4934
|
return this;
|
|
4784
4935
|
};
|
|
4785
4936
|
Tween.prototype.repeat = function (times) {
|
|
4937
|
+
if (times === void 0) { times = 0; }
|
|
4786
4938
|
this._initialRepeat = times;
|
|
4787
4939
|
this._repeat = times;
|
|
4788
4940
|
return this;
|
|
@@ -4792,17 +4944,21 @@
|
|
|
4792
4944
|
return this;
|
|
4793
4945
|
};
|
|
4794
4946
|
Tween.prototype.yoyo = function (yoyo) {
|
|
4947
|
+
if (yoyo === void 0) { yoyo = false; }
|
|
4795
4948
|
this._yoyo = yoyo;
|
|
4796
4949
|
return this;
|
|
4797
4950
|
};
|
|
4798
4951
|
Tween.prototype.easing = function (easingFunction) {
|
|
4952
|
+
if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
|
|
4799
4953
|
this._easingFunction = easingFunction;
|
|
4800
4954
|
return this;
|
|
4801
4955
|
};
|
|
4802
4956
|
Tween.prototype.interpolation = function (interpolationFunction) {
|
|
4957
|
+
if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
|
|
4803
4958
|
this._interpolationFunction = interpolationFunction;
|
|
4804
4959
|
return this;
|
|
4805
4960
|
};
|
|
4961
|
+
// eslint-disable-next-line
|
|
4806
4962
|
Tween.prototype.chain = function () {
|
|
4807
4963
|
var tweens = [];
|
|
4808
4964
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -4815,6 +4971,10 @@
|
|
|
4815
4971
|
this._onStartCallback = callback;
|
|
4816
4972
|
return this;
|
|
4817
4973
|
};
|
|
4974
|
+
Tween.prototype.onEveryStart = function (callback) {
|
|
4975
|
+
this._onEveryStartCallback = callback;
|
|
4976
|
+
return this;
|
|
4977
|
+
};
|
|
4818
4978
|
Tween.prototype.onUpdate = function (callback) {
|
|
4819
4979
|
this._onUpdateCallback = callback;
|
|
4820
4980
|
return this;
|
|
@@ -4848,7 +5008,7 @@
|
|
|
4848
5008
|
if (time > endTime)
|
|
4849
5009
|
return false;
|
|
4850
5010
|
if (autoStart)
|
|
4851
|
-
this.start(time);
|
|
5011
|
+
this.start(time, true);
|
|
4852
5012
|
}
|
|
4853
5013
|
this._goToEnd = false;
|
|
4854
5014
|
if (time < this._startTime) {
|
|
@@ -4860,6 +5020,12 @@
|
|
|
4860
5020
|
}
|
|
4861
5021
|
this._onStartCallbackFired = true;
|
|
4862
5022
|
}
|
|
5023
|
+
if (this._onEveryStartCallbackFired === false) {
|
|
5024
|
+
if (this._onEveryStartCallback) {
|
|
5025
|
+
this._onEveryStartCallback(this._object);
|
|
5026
|
+
}
|
|
5027
|
+
this._onEveryStartCallbackFired = true;
|
|
5028
|
+
}
|
|
4863
5029
|
elapsed = (time - this._startTime) / this._duration;
|
|
4864
5030
|
elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
|
|
4865
5031
|
var value = this._easingFunction(elapsed);
|
|
@@ -4898,6 +5064,7 @@
|
|
|
4898
5064
|
if (this._onRepeatCallback) {
|
|
4899
5065
|
this._onRepeatCallback(this._object);
|
|
4900
5066
|
}
|
|
5067
|
+
this._onEveryStartCallbackFired = false;
|
|
4901
5068
|
return true;
|
|
4902
5069
|
}
|
|
4903
5070
|
else {
|
|
@@ -4907,7 +5074,7 @@
|
|
|
4907
5074
|
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
|
4908
5075
|
// Make the chained tweens start exactly at the time they should,
|
|
4909
5076
|
// even if the `update()` method was called way past the duration of the tween
|
|
4910
|
-
this._chainedTweens[i].start(this._startTime + this._duration);
|
|
5077
|
+
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
|
4911
5078
|
}
|
|
4912
5079
|
this._isPlaying = false;
|
|
4913
5080
|
return false;
|
|
@@ -4971,7 +5138,7 @@
|
|
|
4971
5138
|
return Tween;
|
|
4972
5139
|
}());
|
|
4973
5140
|
|
|
4974
|
-
var VERSION = '
|
|
5141
|
+
var VERSION = '19.0.0';
|
|
4975
5142
|
|
|
4976
5143
|
/**
|
|
4977
5144
|
* Tween.js - Licensed under the MIT license
|
|
@@ -5086,22 +5253,47 @@
|
|
|
5086
5253
|
|
|
5087
5254
|
var debounce_1 = debounce;
|
|
5088
5255
|
|
|
5256
|
+
function _iterableToArrayLimit$1(arr, i) {
|
|
5257
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
5258
|
+
if (null != _i) {
|
|
5259
|
+
var _s,
|
|
5260
|
+
_e,
|
|
5261
|
+
_x,
|
|
5262
|
+
_r,
|
|
5263
|
+
_arr = [],
|
|
5264
|
+
_n = !0,
|
|
5265
|
+
_d = !1;
|
|
5266
|
+
try {
|
|
5267
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
5268
|
+
if (Object(_i) !== _i) return;
|
|
5269
|
+
_n = !1;
|
|
5270
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
5271
|
+
} catch (err) {
|
|
5272
|
+
_d = !0, _e = err;
|
|
5273
|
+
} finally {
|
|
5274
|
+
try {
|
|
5275
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
5276
|
+
} finally {
|
|
5277
|
+
if (_d) throw _e;
|
|
5278
|
+
}
|
|
5279
|
+
}
|
|
5280
|
+
return _arr;
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5089
5283
|
function _classCallCheck$1(instance, Constructor) {
|
|
5090
5284
|
if (!(instance instanceof Constructor)) {
|
|
5091
5285
|
throw new TypeError("Cannot call a class as a function");
|
|
5092
5286
|
}
|
|
5093
5287
|
}
|
|
5094
|
-
|
|
5095
5288
|
function _defineProperties$1(target, props) {
|
|
5096
5289
|
for (var i = 0; i < props.length; i++) {
|
|
5097
5290
|
var descriptor = props[i];
|
|
5098
5291
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
5099
5292
|
descriptor.configurable = true;
|
|
5100
5293
|
if ("value" in descriptor) descriptor.writable = true;
|
|
5101
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
5294
|
+
Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
|
|
5102
5295
|
}
|
|
5103
5296
|
}
|
|
5104
|
-
|
|
5105
5297
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
5106
5298
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
5107
5299
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
@@ -5110,45 +5302,12 @@
|
|
|
5110
5302
|
});
|
|
5111
5303
|
return Constructor;
|
|
5112
5304
|
}
|
|
5113
|
-
|
|
5114
5305
|
function _slicedToArray$1(arr, i) {
|
|
5115
5306
|
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$1();
|
|
5116
5307
|
}
|
|
5117
|
-
|
|
5118
5308
|
function _arrayWithHoles$1(arr) {
|
|
5119
5309
|
if (Array.isArray(arr)) return arr;
|
|
5120
5310
|
}
|
|
5121
|
-
|
|
5122
|
-
function _iterableToArrayLimit$1(arr, i) {
|
|
5123
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
5124
|
-
|
|
5125
|
-
if (_i == null) return;
|
|
5126
|
-
var _arr = [];
|
|
5127
|
-
var _n = true;
|
|
5128
|
-
var _d = false;
|
|
5129
|
-
|
|
5130
|
-
var _s, _e;
|
|
5131
|
-
|
|
5132
|
-
try {
|
|
5133
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
5134
|
-
_arr.push(_s.value);
|
|
5135
|
-
|
|
5136
|
-
if (i && _arr.length === i) break;
|
|
5137
|
-
}
|
|
5138
|
-
} catch (err) {
|
|
5139
|
-
_d = true;
|
|
5140
|
-
_e = err;
|
|
5141
|
-
} finally {
|
|
5142
|
-
try {
|
|
5143
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
5144
|
-
} finally {
|
|
5145
|
-
if (_d) throw _e;
|
|
5146
|
-
}
|
|
5147
|
-
}
|
|
5148
|
-
|
|
5149
|
-
return _arr;
|
|
5150
|
-
}
|
|
5151
|
-
|
|
5152
5311
|
function _unsupportedIterableToArray$2(o, minLen) {
|
|
5153
5312
|
if (!o) return;
|
|
5154
5313
|
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
|
|
@@ -5157,50 +5316,57 @@
|
|
|
5157
5316
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
5158
5317
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
|
|
5159
5318
|
}
|
|
5160
|
-
|
|
5161
5319
|
function _arrayLikeToArray$2(arr, len) {
|
|
5162
5320
|
if (len == null || len > arr.length) len = arr.length;
|
|
5163
|
-
|
|
5164
5321
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
5165
|
-
|
|
5166
5322
|
return arr2;
|
|
5167
5323
|
}
|
|
5168
|
-
|
|
5169
5324
|
function _nonIterableRest$1() {
|
|
5170
5325
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5171
5326
|
}
|
|
5327
|
+
function _toPrimitive$2(input, hint) {
|
|
5328
|
+
if (typeof input !== "object" || input === null) return input;
|
|
5329
|
+
var prim = input[Symbol.toPrimitive];
|
|
5330
|
+
if (prim !== undefined) {
|
|
5331
|
+
var res = prim.call(input, hint || "default");
|
|
5332
|
+
if (typeof res !== "object") return res;
|
|
5333
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5334
|
+
}
|
|
5335
|
+
return (hint === "string" ? String : Number)(input);
|
|
5336
|
+
}
|
|
5337
|
+
function _toPropertyKey$2(arg) {
|
|
5338
|
+
var key = _toPrimitive$2(arg, "string");
|
|
5339
|
+
return typeof key === "symbol" ? key : String(key);
|
|
5340
|
+
}
|
|
5172
5341
|
|
|
5173
5342
|
var Prop = /*#__PURE__*/_createClass$1(function Prop(name, _ref) {
|
|
5174
5343
|
var _ref$default = _ref["default"],
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5344
|
+
defaultVal = _ref$default === void 0 ? null : _ref$default,
|
|
5345
|
+
_ref$triggerUpdate = _ref.triggerUpdate,
|
|
5346
|
+
triggerUpdate = _ref$triggerUpdate === void 0 ? true : _ref$triggerUpdate,
|
|
5347
|
+
_ref$onChange = _ref.onChange,
|
|
5348
|
+
onChange = _ref$onChange === void 0 ? function (newVal, state) {} : _ref$onChange;
|
|
5181
5349
|
_classCallCheck$1(this, Prop);
|
|
5182
|
-
|
|
5183
5350
|
this.name = name;
|
|
5184
5351
|
this.defaultVal = defaultVal;
|
|
5185
5352
|
this.triggerUpdate = triggerUpdate;
|
|
5186
5353
|
this.onChange = onChange;
|
|
5187
5354
|
});
|
|
5188
|
-
|
|
5189
5355
|
function index$3 (_ref2) {
|
|
5190
5356
|
var _ref2$stateInit = _ref2.stateInit,
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5357
|
+
stateInit = _ref2$stateInit === void 0 ? function () {
|
|
5358
|
+
return {};
|
|
5359
|
+
} : _ref2$stateInit,
|
|
5360
|
+
_ref2$props = _ref2.props,
|
|
5361
|
+
rawProps = _ref2$props === void 0 ? {} : _ref2$props,
|
|
5362
|
+
_ref2$methods = _ref2.methods,
|
|
5363
|
+
methods = _ref2$methods === void 0 ? {} : _ref2$methods,
|
|
5364
|
+
_ref2$aliases = _ref2.aliases,
|
|
5365
|
+
aliases = _ref2$aliases === void 0 ? {} : _ref2$aliases,
|
|
5366
|
+
_ref2$init = _ref2.init,
|
|
5367
|
+
initFn = _ref2$init === void 0 ? function () {} : _ref2$init,
|
|
5368
|
+
_ref2$update = _ref2.update,
|
|
5369
|
+
updateFn = _ref2$update === void 0 ? function () {} : _ref2$update;
|
|
5204
5370
|
// Parse props into Prop instances
|
|
5205
5371
|
var props = Object.keys(rawProps).map(function (propName) {
|
|
5206
5372
|
return new Prop(propName, rawProps[propName]);
|
|
@@ -5208,98 +5374,94 @@
|
|
|
5208
5374
|
return function () {
|
|
5209
5375
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5210
5376
|
// Holds component state
|
|
5211
|
-
var state = Object.assign({}, stateInit instanceof Function ? stateInit(options) : stateInit,
|
|
5377
|
+
var state = Object.assign({}, stateInit instanceof Function ? stateInit(options) : stateInit,
|
|
5378
|
+
// Support plain objects for backwards compatibility
|
|
5212
5379
|
{
|
|
5213
5380
|
initialised: false
|
|
5214
|
-
});
|
|
5381
|
+
});
|
|
5215
5382
|
|
|
5216
|
-
|
|
5383
|
+
// keeps track of which props triggered an update
|
|
5384
|
+
var changedProps = {};
|
|
5217
5385
|
|
|
5386
|
+
// Component constructor
|
|
5218
5387
|
function comp(nodeElement) {
|
|
5219
5388
|
initStatic(nodeElement, options);
|
|
5220
5389
|
digest();
|
|
5221
5390
|
return comp;
|
|
5222
5391
|
}
|
|
5223
|
-
|
|
5224
5392
|
var initStatic = function initStatic(nodeElement, options) {
|
|
5225
5393
|
initFn.call(comp, nodeElement, state, options);
|
|
5226
5394
|
state.initialised = true;
|
|
5227
5395
|
};
|
|
5228
|
-
|
|
5229
5396
|
var digest = debounce_1(function () {
|
|
5230
5397
|
if (!state.initialised) {
|
|
5231
5398
|
return;
|
|
5232
5399
|
}
|
|
5233
|
-
|
|
5234
5400
|
updateFn.call(comp, state, changedProps);
|
|
5235
5401
|
changedProps = {};
|
|
5236
|
-
}, 1);
|
|
5402
|
+
}, 1);
|
|
5237
5403
|
|
|
5404
|
+
// Getter/setter methods
|
|
5238
5405
|
props.forEach(function (prop) {
|
|
5239
5406
|
comp[prop.name] = getSetProp(prop);
|
|
5240
|
-
|
|
5241
5407
|
function getSetProp(_ref3) {
|
|
5242
5408
|
var prop = _ref3.name,
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5409
|
+
_ref3$triggerUpdate = _ref3.triggerUpdate,
|
|
5410
|
+
redigest = _ref3$triggerUpdate === void 0 ? false : _ref3$triggerUpdate,
|
|
5411
|
+
_ref3$onChange = _ref3.onChange,
|
|
5412
|
+
onChange = _ref3$onChange === void 0 ? function (newVal, state) {} : _ref3$onChange,
|
|
5413
|
+
_ref3$defaultVal = _ref3.defaultVal,
|
|
5414
|
+
defaultVal = _ref3$defaultVal === void 0 ? null : _ref3$defaultVal;
|
|
5249
5415
|
return function (_) {
|
|
5250
5416
|
var curVal = state[prop];
|
|
5251
|
-
|
|
5252
5417
|
if (!arguments.length) {
|
|
5253
5418
|
return curVal;
|
|
5254
5419
|
} // Getter mode
|
|
5255
5420
|
|
|
5256
|
-
|
|
5257
5421
|
var val = _ === undefined ? defaultVal : _; // pick default if value passed is undefined
|
|
5258
|
-
|
|
5259
5422
|
state[prop] = val;
|
|
5260
|
-
onChange.call(comp, val, state, curVal);
|
|
5423
|
+
onChange.call(comp, val, state, curVal);
|
|
5261
5424
|
|
|
5425
|
+
// track changed props
|
|
5262
5426
|
!changedProps.hasOwnProperty(prop) && (changedProps[prop] = curVal);
|
|
5263
|
-
|
|
5264
5427
|
if (redigest) {
|
|
5265
5428
|
digest();
|
|
5266
5429
|
}
|
|
5267
|
-
|
|
5268
5430
|
return comp;
|
|
5269
5431
|
};
|
|
5270
5432
|
}
|
|
5271
|
-
});
|
|
5433
|
+
});
|
|
5272
5434
|
|
|
5435
|
+
// Other methods
|
|
5273
5436
|
Object.keys(methods).forEach(function (methodName) {
|
|
5274
5437
|
comp[methodName] = function () {
|
|
5275
5438
|
var _methods$methodName;
|
|
5276
|
-
|
|
5277
5439
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5278
5440
|
args[_key] = arguments[_key];
|
|
5279
5441
|
}
|
|
5280
|
-
|
|
5281
5442
|
return (_methods$methodName = methods[methodName]).call.apply(_methods$methodName, [comp, state].concat(args));
|
|
5282
5443
|
};
|
|
5283
|
-
});
|
|
5444
|
+
});
|
|
5284
5445
|
|
|
5446
|
+
// Link aliases
|
|
5285
5447
|
Object.entries(aliases).forEach(function (_ref4) {
|
|
5286
5448
|
var _ref5 = _slicedToArray$1(_ref4, 2),
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5449
|
+
alias = _ref5[0],
|
|
5450
|
+
target = _ref5[1];
|
|
5290
5451
|
return comp[alias] = comp[target];
|
|
5291
|
-
});
|
|
5452
|
+
});
|
|
5292
5453
|
|
|
5454
|
+
// Reset all component props to their default value
|
|
5293
5455
|
comp.resetProps = function () {
|
|
5294
5456
|
props.forEach(function (prop) {
|
|
5295
5457
|
comp[prop.name](prop.defaultVal);
|
|
5296
5458
|
});
|
|
5297
5459
|
return comp;
|
|
5298
|
-
};
|
|
5460
|
+
};
|
|
5299
5461
|
|
|
5462
|
+
//
|
|
5300
5463
|
|
|
5301
5464
|
comp.resetProps(); // Apply all prop defaults
|
|
5302
|
-
|
|
5303
5465
|
state._rerender = digest; // Expose digest method
|
|
5304
5466
|
|
|
5305
5467
|
return comp;
|
|
@@ -5316,15 +5478,22 @@
|
|
|
5316
5478
|
};
|
|
5317
5479
|
}); // constant
|
|
5318
5480
|
|
|
5319
|
-
|
|
5481
|
+
// This file is autogenerated. It's used to publish ESM to npm.
|
|
5482
|
+
function _typeof(obj) {
|
|
5483
|
+
"@babel/helpers - typeof";
|
|
5484
|
+
|
|
5485
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
5486
|
+
return typeof obj;
|
|
5487
|
+
} : function (obj) {
|
|
5488
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
5489
|
+
}, _typeof(obj);
|
|
5490
|
+
}
|
|
5320
5491
|
|
|
5321
|
-
// This file is autogenerated. It's used to publish ESM to npm.
|
|
5322
5492
|
// https://github.com/bgrins/TinyColor
|
|
5323
5493
|
// Brian Grinstead, MIT License
|
|
5324
5494
|
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5495
|
+
var trimLeft = /^\s+/;
|
|
5496
|
+
var trimRight = /\s+$/;
|
|
5328
5497
|
function tinycolor(color, opts) {
|
|
5329
5498
|
color = color ? color : "";
|
|
5330
5499
|
opts = opts || {};
|
|
@@ -5337,15 +5506,8 @@
|
|
|
5337
5506
|
if (!(this instanceof tinycolor)) {
|
|
5338
5507
|
return new tinycolor(color, opts);
|
|
5339
5508
|
}
|
|
5340
|
-
|
|
5341
5509
|
var rgb = inputToRGB(color);
|
|
5342
|
-
|
|
5343
|
-
(this._r = rgb.r),
|
|
5344
|
-
(this._g = rgb.g),
|
|
5345
|
-
(this._b = rgb.b),
|
|
5346
|
-
(this._a = rgb.a),
|
|
5347
|
-
(this._roundA = Math.round(100 * this._a) / 100),
|
|
5348
|
-
(this._format = opts.format || rgb.format);
|
|
5510
|
+
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
5349
5511
|
this._gradientType = opts.gradientType;
|
|
5350
5512
|
|
|
5351
5513
|
// Don't let the range of [0,255] come back in [0,1].
|
|
@@ -5355,194 +5517,140 @@
|
|
|
5355
5517
|
if (this._r < 1) this._r = Math.round(this._r);
|
|
5356
5518
|
if (this._g < 1) this._g = Math.round(this._g);
|
|
5357
5519
|
if (this._b < 1) this._b = Math.round(this._b);
|
|
5358
|
-
|
|
5359
5520
|
this._ok = rgb.ok;
|
|
5360
5521
|
}
|
|
5361
|
-
|
|
5362
5522
|
tinycolor.prototype = {
|
|
5363
|
-
isDark: function () {
|
|
5523
|
+
isDark: function isDark() {
|
|
5364
5524
|
return this.getBrightness() < 128;
|
|
5365
5525
|
},
|
|
5366
|
-
isLight: function () {
|
|
5526
|
+
isLight: function isLight() {
|
|
5367
5527
|
return !this.isDark();
|
|
5368
5528
|
},
|
|
5369
|
-
isValid: function () {
|
|
5529
|
+
isValid: function isValid() {
|
|
5370
5530
|
return this._ok;
|
|
5371
5531
|
},
|
|
5372
|
-
getOriginalInput: function () {
|
|
5532
|
+
getOriginalInput: function getOriginalInput() {
|
|
5373
5533
|
return this._originalInput;
|
|
5374
5534
|
},
|
|
5375
|
-
getFormat: function () {
|
|
5535
|
+
getFormat: function getFormat() {
|
|
5376
5536
|
return this._format;
|
|
5377
5537
|
},
|
|
5378
|
-
getAlpha: function () {
|
|
5538
|
+
getAlpha: function getAlpha() {
|
|
5379
5539
|
return this._a;
|
|
5380
5540
|
},
|
|
5381
|
-
getBrightness: function () {
|
|
5541
|
+
getBrightness: function getBrightness() {
|
|
5382
5542
|
//http://www.w3.org/TR/AERT#color-contrast
|
|
5383
5543
|
var rgb = this.toRgb();
|
|
5384
5544
|
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
5385
5545
|
},
|
|
5386
|
-
getLuminance: function () {
|
|
5546
|
+
getLuminance: function getLuminance() {
|
|
5387
5547
|
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
5388
5548
|
var rgb = this.toRgb();
|
|
5389
5549
|
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
5390
5550
|
RsRGB = rgb.r / 255;
|
|
5391
5551
|
GsRGB = rgb.g / 255;
|
|
5392
5552
|
BsRGB = rgb.b / 255;
|
|
5393
|
-
|
|
5394
|
-
if (
|
|
5395
|
-
else
|
|
5396
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
|
|
5397
|
-
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
5398
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
|
|
5399
|
-
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
5553
|
+
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
5554
|
+
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
5555
|
+
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
5400
5556
|
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
5401
5557
|
},
|
|
5402
|
-
setAlpha: function (value) {
|
|
5558
|
+
setAlpha: function setAlpha(value) {
|
|
5403
5559
|
this._a = boundAlpha(value);
|
|
5404
5560
|
this._roundA = Math.round(100 * this._a) / 100;
|
|
5405
5561
|
return this;
|
|
5406
5562
|
},
|
|
5407
|
-
toHsv: function () {
|
|
5563
|
+
toHsv: function toHsv() {
|
|
5408
5564
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
5409
|
-
return {
|
|
5565
|
+
return {
|
|
5566
|
+
h: hsv.h * 360,
|
|
5567
|
+
s: hsv.s,
|
|
5568
|
+
v: hsv.v,
|
|
5569
|
+
a: this._a
|
|
5570
|
+
};
|
|
5410
5571
|
},
|
|
5411
|
-
toHsvString: function () {
|
|
5572
|
+
toHsvString: function toHsvString() {
|
|
5412
5573
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
5413
5574
|
var h = Math.round(hsv.h * 360),
|
|
5414
5575
|
s = Math.round(hsv.s * 100),
|
|
5415
5576
|
v = Math.round(hsv.v * 100);
|
|
5416
|
-
return this._a == 1
|
|
5417
|
-
? "hsv(" + h + ", " + s + "%, " + v + "%)"
|
|
5418
|
-
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
5577
|
+
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
5419
5578
|
},
|
|
5420
|
-
toHsl: function () {
|
|
5579
|
+
toHsl: function toHsl() {
|
|
5421
5580
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
5422
|
-
return {
|
|
5581
|
+
return {
|
|
5582
|
+
h: hsl.h * 360,
|
|
5583
|
+
s: hsl.s,
|
|
5584
|
+
l: hsl.l,
|
|
5585
|
+
a: this._a
|
|
5586
|
+
};
|
|
5423
5587
|
},
|
|
5424
|
-
toHslString: function () {
|
|
5588
|
+
toHslString: function toHslString() {
|
|
5425
5589
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
5426
5590
|
var h = Math.round(hsl.h * 360),
|
|
5427
5591
|
s = Math.round(hsl.s * 100),
|
|
5428
5592
|
l = Math.round(hsl.l * 100);
|
|
5429
|
-
return this._a == 1
|
|
5430
|
-
? "hsl(" + h + ", " + s + "%, " + l + "%)"
|
|
5431
|
-
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
5593
|
+
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
5432
5594
|
},
|
|
5433
|
-
toHex: function (allow3Char) {
|
|
5595
|
+
toHex: function toHex(allow3Char) {
|
|
5434
5596
|
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
5435
5597
|
},
|
|
5436
|
-
toHexString: function (allow3Char) {
|
|
5598
|
+
toHexString: function toHexString(allow3Char) {
|
|
5437
5599
|
return "#" + this.toHex(allow3Char);
|
|
5438
5600
|
},
|
|
5439
|
-
toHex8: function (allow4Char) {
|
|
5601
|
+
toHex8: function toHex8(allow4Char) {
|
|
5440
5602
|
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
5441
5603
|
},
|
|
5442
|
-
toHex8String: function (allow4Char) {
|
|
5604
|
+
toHex8String: function toHex8String(allow4Char) {
|
|
5443
5605
|
return "#" + this.toHex8(allow4Char);
|
|
5444
5606
|
},
|
|
5445
|
-
toRgb: function () {
|
|
5607
|
+
toRgb: function toRgb() {
|
|
5446
5608
|
return {
|
|
5447
5609
|
r: Math.round(this._r),
|
|
5448
5610
|
g: Math.round(this._g),
|
|
5449
5611
|
b: Math.round(this._b),
|
|
5450
|
-
a: this._a
|
|
5612
|
+
a: this._a
|
|
5451
5613
|
};
|
|
5452
5614
|
},
|
|
5453
|
-
toRgbString: function () {
|
|
5454
|
-
return this._a == 1
|
|
5455
|
-
? "rgb(" +
|
|
5456
|
-
Math.round(this._r) +
|
|
5457
|
-
", " +
|
|
5458
|
-
Math.round(this._g) +
|
|
5459
|
-
", " +
|
|
5460
|
-
Math.round(this._b) +
|
|
5461
|
-
")"
|
|
5462
|
-
: "rgba(" +
|
|
5463
|
-
Math.round(this._r) +
|
|
5464
|
-
", " +
|
|
5465
|
-
Math.round(this._g) +
|
|
5466
|
-
", " +
|
|
5467
|
-
Math.round(this._b) +
|
|
5468
|
-
", " +
|
|
5469
|
-
this._roundA +
|
|
5470
|
-
")";
|
|
5615
|
+
toRgbString: function toRgbString() {
|
|
5616
|
+
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
5471
5617
|
},
|
|
5472
|
-
toPercentageRgb: function () {
|
|
5618
|
+
toPercentageRgb: function toPercentageRgb() {
|
|
5473
5619
|
return {
|
|
5474
5620
|
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
5475
5621
|
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
5476
5622
|
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
5477
|
-
a: this._a
|
|
5623
|
+
a: this._a
|
|
5478
5624
|
};
|
|
5479
5625
|
},
|
|
5480
|
-
toPercentageRgbString: function () {
|
|
5481
|
-
return this._a == 1
|
|
5482
|
-
? "rgb(" +
|
|
5483
|
-
Math.round(bound01(this._r, 255) * 100) +
|
|
5484
|
-
"%, " +
|
|
5485
|
-
Math.round(bound01(this._g, 255) * 100) +
|
|
5486
|
-
"%, " +
|
|
5487
|
-
Math.round(bound01(this._b, 255) * 100) +
|
|
5488
|
-
"%)"
|
|
5489
|
-
: "rgba(" +
|
|
5490
|
-
Math.round(bound01(this._r, 255) * 100) +
|
|
5491
|
-
"%, " +
|
|
5492
|
-
Math.round(bound01(this._g, 255) * 100) +
|
|
5493
|
-
"%, " +
|
|
5494
|
-
Math.round(bound01(this._b, 255) * 100) +
|
|
5495
|
-
"%, " +
|
|
5496
|
-
this._roundA +
|
|
5497
|
-
")";
|
|
5626
|
+
toPercentageRgbString: function toPercentageRgbString() {
|
|
5627
|
+
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
5498
5628
|
},
|
|
5499
|
-
toName: function () {
|
|
5629
|
+
toName: function toName() {
|
|
5500
5630
|
if (this._a === 0) {
|
|
5501
5631
|
return "transparent";
|
|
5502
5632
|
}
|
|
5503
|
-
|
|
5504
5633
|
if (this._a < 1) {
|
|
5505
5634
|
return false;
|
|
5506
5635
|
}
|
|
5507
|
-
|
|
5508
5636
|
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
5509
5637
|
},
|
|
5510
|
-
toFilter: function (secondColor) {
|
|
5638
|
+
toFilter: function toFilter(secondColor) {
|
|
5511
5639
|
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
5512
5640
|
var secondHex8String = hex8String;
|
|
5513
5641
|
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
5514
|
-
|
|
5515
5642
|
if (secondColor) {
|
|
5516
5643
|
var s = tinycolor(secondColor);
|
|
5517
5644
|
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
5518
5645
|
}
|
|
5519
|
-
|
|
5520
|
-
return (
|
|
5521
|
-
"progid:DXImageTransform.Microsoft.gradient(" +
|
|
5522
|
-
gradientType +
|
|
5523
|
-
"startColorstr=" +
|
|
5524
|
-
hex8String +
|
|
5525
|
-
",endColorstr=" +
|
|
5526
|
-
secondHex8String +
|
|
5527
|
-
")"
|
|
5528
|
-
);
|
|
5646
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
5529
5647
|
},
|
|
5530
|
-
toString: function (format) {
|
|
5648
|
+
toString: function toString(format) {
|
|
5531
5649
|
var formatSet = !!format;
|
|
5532
5650
|
format = format || this._format;
|
|
5533
|
-
|
|
5534
5651
|
var formattedString = false;
|
|
5535
5652
|
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
5536
|
-
var needsAlphaFormat =
|
|
5537
|
-
!formatSet &&
|
|
5538
|
-
hasAlpha &&
|
|
5539
|
-
(format === "hex" ||
|
|
5540
|
-
format === "hex6" ||
|
|
5541
|
-
format === "hex3" ||
|
|
5542
|
-
format === "hex4" ||
|
|
5543
|
-
format === "hex8" ||
|
|
5544
|
-
format === "name");
|
|
5545
|
-
|
|
5653
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
5546
5654
|
if (needsAlphaFormat) {
|
|
5547
5655
|
// Special case for "transparent", all other non-alpha formats
|
|
5548
5656
|
// will return rgba when there is transparency.
|
|
@@ -5578,14 +5686,12 @@
|
|
|
5578
5686
|
if (format === "hsv") {
|
|
5579
5687
|
formattedString = this.toHsvString();
|
|
5580
5688
|
}
|
|
5581
|
-
|
|
5582
5689
|
return formattedString || this.toHexString();
|
|
5583
5690
|
},
|
|
5584
|
-
clone: function () {
|
|
5691
|
+
clone: function clone() {
|
|
5585
5692
|
return tinycolor(this.toString());
|
|
5586
5693
|
},
|
|
5587
|
-
|
|
5588
|
-
_applyModification: function (fn, args) {
|
|
5694
|
+
_applyModification: function _applyModification(fn, args) {
|
|
5589
5695
|
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
5590
5696
|
this._r = color._r;
|
|
5591
5697
|
this._g = color._g;
|
|
@@ -5593,59 +5699,58 @@
|
|
|
5593
5699
|
this.setAlpha(color._a);
|
|
5594
5700
|
return this;
|
|
5595
5701
|
},
|
|
5596
|
-
lighten: function () {
|
|
5597
|
-
return this._applyModification(
|
|
5702
|
+
lighten: function lighten() {
|
|
5703
|
+
return this._applyModification(_lighten, arguments);
|
|
5598
5704
|
},
|
|
5599
|
-
brighten: function () {
|
|
5600
|
-
return this._applyModification(
|
|
5705
|
+
brighten: function brighten() {
|
|
5706
|
+
return this._applyModification(_brighten, arguments);
|
|
5601
5707
|
},
|
|
5602
|
-
darken: function () {
|
|
5603
|
-
return this._applyModification(
|
|
5708
|
+
darken: function darken() {
|
|
5709
|
+
return this._applyModification(_darken, arguments);
|
|
5604
5710
|
},
|
|
5605
|
-
desaturate: function () {
|
|
5606
|
-
return this._applyModification(
|
|
5711
|
+
desaturate: function desaturate() {
|
|
5712
|
+
return this._applyModification(_desaturate, arguments);
|
|
5607
5713
|
},
|
|
5608
|
-
saturate: function () {
|
|
5609
|
-
return this._applyModification(
|
|
5714
|
+
saturate: function saturate() {
|
|
5715
|
+
return this._applyModification(_saturate, arguments);
|
|
5610
5716
|
},
|
|
5611
|
-
greyscale: function () {
|
|
5612
|
-
return this._applyModification(
|
|
5717
|
+
greyscale: function greyscale() {
|
|
5718
|
+
return this._applyModification(_greyscale, arguments);
|
|
5613
5719
|
},
|
|
5614
|
-
spin: function () {
|
|
5615
|
-
return this._applyModification(
|
|
5720
|
+
spin: function spin() {
|
|
5721
|
+
return this._applyModification(_spin, arguments);
|
|
5616
5722
|
},
|
|
5617
|
-
|
|
5618
|
-
_applyCombination: function (fn, args) {
|
|
5723
|
+
_applyCombination: function _applyCombination(fn, args) {
|
|
5619
5724
|
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
5620
5725
|
},
|
|
5621
|
-
analogous: function () {
|
|
5622
|
-
return this._applyCombination(
|
|
5726
|
+
analogous: function analogous() {
|
|
5727
|
+
return this._applyCombination(_analogous, arguments);
|
|
5623
5728
|
},
|
|
5624
|
-
complement: function () {
|
|
5625
|
-
return this._applyCombination(
|
|
5729
|
+
complement: function complement() {
|
|
5730
|
+
return this._applyCombination(_complement, arguments);
|
|
5626
5731
|
},
|
|
5627
|
-
monochromatic: function () {
|
|
5628
|
-
return this._applyCombination(
|
|
5732
|
+
monochromatic: function monochromatic() {
|
|
5733
|
+
return this._applyCombination(_monochromatic, arguments);
|
|
5629
5734
|
},
|
|
5630
|
-
splitcomplement: function () {
|
|
5631
|
-
return this._applyCombination(
|
|
5735
|
+
splitcomplement: function splitcomplement() {
|
|
5736
|
+
return this._applyCombination(_splitcomplement, arguments);
|
|
5632
5737
|
},
|
|
5633
5738
|
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
5634
5739
|
// polyad: function (number) {
|
|
5635
5740
|
// return this._applyCombination(polyad, [number]);
|
|
5636
5741
|
// },
|
|
5637
|
-
triad: function () {
|
|
5742
|
+
triad: function triad() {
|
|
5638
5743
|
return this._applyCombination(polyad, [3]);
|
|
5639
5744
|
},
|
|
5640
|
-
tetrad: function () {
|
|
5745
|
+
tetrad: function tetrad() {
|
|
5641
5746
|
return this._applyCombination(polyad, [4]);
|
|
5642
|
-
}
|
|
5747
|
+
}
|
|
5643
5748
|
};
|
|
5644
5749
|
|
|
5645
5750
|
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
5646
5751
|
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
5647
5752
|
tinycolor.fromRatio = function (color, opts) {
|
|
5648
|
-
if (
|
|
5753
|
+
if (_typeof(color) == "object") {
|
|
5649
5754
|
var newColor = {};
|
|
5650
5755
|
for (var i in color) {
|
|
5651
5756
|
if (color.hasOwnProperty(i)) {
|
|
@@ -5658,7 +5763,6 @@
|
|
|
5658
5763
|
}
|
|
5659
5764
|
color = newColor;
|
|
5660
5765
|
}
|
|
5661
|
-
|
|
5662
5766
|
return tinycolor(color, opts);
|
|
5663
5767
|
};
|
|
5664
5768
|
|
|
@@ -5678,63 +5782,50 @@
|
|
|
5678
5782
|
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
5679
5783
|
//
|
|
5680
5784
|
function inputToRGB(color) {
|
|
5681
|
-
var rgb = {
|
|
5785
|
+
var rgb = {
|
|
5786
|
+
r: 0,
|
|
5787
|
+
g: 0,
|
|
5788
|
+
b: 0
|
|
5789
|
+
};
|
|
5682
5790
|
var a = 1;
|
|
5683
5791
|
var s = null;
|
|
5684
5792
|
var v = null;
|
|
5685
5793
|
var l = null;
|
|
5686
5794
|
var ok = false;
|
|
5687
5795
|
var format = false;
|
|
5688
|
-
|
|
5689
5796
|
if (typeof color == "string") {
|
|
5690
5797
|
color = stringInputToObject(color);
|
|
5691
5798
|
}
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
if (
|
|
5695
|
-
isValidCSSUnit(color.r) &&
|
|
5696
|
-
isValidCSSUnit(color.g) &&
|
|
5697
|
-
isValidCSSUnit(color.b)
|
|
5698
|
-
) {
|
|
5799
|
+
if (_typeof(color) == "object") {
|
|
5800
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
5699
5801
|
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
5700
5802
|
ok = true;
|
|
5701
5803
|
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
5702
|
-
} else if (
|
|
5703
|
-
isValidCSSUnit(color.h) &&
|
|
5704
|
-
isValidCSSUnit(color.s) &&
|
|
5705
|
-
isValidCSSUnit(color.v)
|
|
5706
|
-
) {
|
|
5804
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
5707
5805
|
s = convertToPercentage(color.s);
|
|
5708
5806
|
v = convertToPercentage(color.v);
|
|
5709
5807
|
rgb = hsvToRgb(color.h, s, v);
|
|
5710
5808
|
ok = true;
|
|
5711
5809
|
format = "hsv";
|
|
5712
|
-
} else if (
|
|
5713
|
-
isValidCSSUnit(color.h) &&
|
|
5714
|
-
isValidCSSUnit(color.s) &&
|
|
5715
|
-
isValidCSSUnit(color.l)
|
|
5716
|
-
) {
|
|
5810
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
5717
5811
|
s = convertToPercentage(color.s);
|
|
5718
5812
|
l = convertToPercentage(color.l);
|
|
5719
5813
|
rgb = hslToRgb(color.h, s, l);
|
|
5720
5814
|
ok = true;
|
|
5721
5815
|
format = "hsl";
|
|
5722
5816
|
}
|
|
5723
|
-
|
|
5724
5817
|
if (color.hasOwnProperty("a")) {
|
|
5725
5818
|
a = color.a;
|
|
5726
5819
|
}
|
|
5727
5820
|
}
|
|
5728
|
-
|
|
5729
5821
|
a = boundAlpha(a);
|
|
5730
|
-
|
|
5731
5822
|
return {
|
|
5732
5823
|
ok: ok,
|
|
5733
5824
|
format: color.format || format,
|
|
5734
5825
|
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
5735
5826
|
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
5736
5827
|
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
5737
|
-
a: a
|
|
5828
|
+
a: a
|
|
5738
5829
|
};
|
|
5739
5830
|
}
|
|
5740
5831
|
|
|
@@ -5753,7 +5844,7 @@
|
|
|
5753
5844
|
return {
|
|
5754
5845
|
r: bound01(r, 255) * 255,
|
|
5755
5846
|
g: bound01(g, 255) * 255,
|
|
5756
|
-
b: bound01(b, 255) * 255
|
|
5847
|
+
b: bound01(b, 255) * 255
|
|
5757
5848
|
};
|
|
5758
5849
|
}
|
|
5759
5850
|
|
|
@@ -5765,13 +5856,11 @@
|
|
|
5765
5856
|
r = bound01(r, 255);
|
|
5766
5857
|
g = bound01(g, 255);
|
|
5767
5858
|
b = bound01(b, 255);
|
|
5768
|
-
|
|
5769
5859
|
var max = Math.max(r, g, b),
|
|
5770
5860
|
min = Math.min(r, g, b);
|
|
5771
5861
|
var h,
|
|
5772
5862
|
s,
|
|
5773
5863
|
l = (max + min) / 2;
|
|
5774
|
-
|
|
5775
5864
|
if (max == min) {
|
|
5776
5865
|
h = s = 0; // achromatic
|
|
5777
5866
|
} else {
|
|
@@ -5788,11 +5877,13 @@
|
|
|
5788
5877
|
h = (r - g) / d + 4;
|
|
5789
5878
|
break;
|
|
5790
5879
|
}
|
|
5791
|
-
|
|
5792
5880
|
h /= 6;
|
|
5793
5881
|
}
|
|
5794
|
-
|
|
5795
|
-
|
|
5882
|
+
return {
|
|
5883
|
+
h: h,
|
|
5884
|
+
s: s,
|
|
5885
|
+
l: l
|
|
5886
|
+
};
|
|
5796
5887
|
}
|
|
5797
5888
|
|
|
5798
5889
|
// `hslToRgb`
|
|
@@ -5801,11 +5892,9 @@
|
|
|
5801
5892
|
// *Returns:* { r, g, b } in the set [0, 255]
|
|
5802
5893
|
function hslToRgb(h, s, l) {
|
|
5803
5894
|
var r, g, b;
|
|
5804
|
-
|
|
5805
5895
|
h = bound01(h, 360);
|
|
5806
5896
|
s = bound01(s, 100);
|
|
5807
5897
|
l = bound01(l, 100);
|
|
5808
|
-
|
|
5809
5898
|
function hue2rgb(p, q, t) {
|
|
5810
5899
|
if (t < 0) t += 1;
|
|
5811
5900
|
if (t > 1) t -= 1;
|
|
@@ -5814,7 +5903,6 @@
|
|
|
5814
5903
|
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
5815
5904
|
return p;
|
|
5816
5905
|
}
|
|
5817
|
-
|
|
5818
5906
|
if (s === 0) {
|
|
5819
5907
|
r = g = b = l; // achromatic
|
|
5820
5908
|
} else {
|
|
@@ -5824,8 +5912,11 @@
|
|
|
5824
5912
|
g = hue2rgb(p, q, h);
|
|
5825
5913
|
b = hue2rgb(p, q, h - 1 / 3);
|
|
5826
5914
|
}
|
|
5827
|
-
|
|
5828
|
-
|
|
5915
|
+
return {
|
|
5916
|
+
r: r * 255,
|
|
5917
|
+
g: g * 255,
|
|
5918
|
+
b: b * 255
|
|
5919
|
+
};
|
|
5829
5920
|
}
|
|
5830
5921
|
|
|
5831
5922
|
// `rgbToHsv`
|
|
@@ -5836,16 +5927,13 @@
|
|
|
5836
5927
|
r = bound01(r, 255);
|
|
5837
5928
|
g = bound01(g, 255);
|
|
5838
5929
|
b = bound01(b, 255);
|
|
5839
|
-
|
|
5840
5930
|
var max = Math.max(r, g, b),
|
|
5841
5931
|
min = Math.min(r, g, b);
|
|
5842
5932
|
var h,
|
|
5843
5933
|
s,
|
|
5844
5934
|
v = max;
|
|
5845
|
-
|
|
5846
5935
|
var d = max - min;
|
|
5847
5936
|
s = max === 0 ? 0 : d / max;
|
|
5848
|
-
|
|
5849
5937
|
if (max == min) {
|
|
5850
5938
|
h = 0; // achromatic
|
|
5851
5939
|
} else {
|
|
@@ -5862,7 +5950,11 @@
|
|
|
5862
5950
|
}
|
|
5863
5951
|
h /= 6;
|
|
5864
5952
|
}
|
|
5865
|
-
return {
|
|
5953
|
+
return {
|
|
5954
|
+
h: h,
|
|
5955
|
+
s: s,
|
|
5956
|
+
v: v
|
|
5957
|
+
};
|
|
5866
5958
|
}
|
|
5867
5959
|
|
|
5868
5960
|
// `hsvToRgb`
|
|
@@ -5873,7 +5965,6 @@
|
|
|
5873
5965
|
h = bound01(h, 360) * 6;
|
|
5874
5966
|
s = bound01(s, 100);
|
|
5875
5967
|
v = bound01(v, 100);
|
|
5876
|
-
|
|
5877
5968
|
var i = Math.floor(h),
|
|
5878
5969
|
f = h - i,
|
|
5879
5970
|
p = v * (1 - s),
|
|
@@ -5883,8 +5974,11 @@
|
|
|
5883
5974
|
r = [v, q, p, p, t, v][mod],
|
|
5884
5975
|
g = [t, v, v, q, p, p][mod],
|
|
5885
5976
|
b = [p, p, t, v, v, q][mod];
|
|
5886
|
-
|
|
5887
|
-
|
|
5977
|
+
return {
|
|
5978
|
+
r: r * 255,
|
|
5979
|
+
g: g * 255,
|
|
5980
|
+
b: b * 255
|
|
5981
|
+
};
|
|
5888
5982
|
}
|
|
5889
5983
|
|
|
5890
5984
|
// `rgbToHex`
|
|
@@ -5892,22 +5986,12 @@
|
|
|
5892
5986
|
// Assumes r, g, and b are contained in the set [0, 255]
|
|
5893
5987
|
// Returns a 3 or 6 character hex
|
|
5894
5988
|
function rgbToHex(r, g, b, allow3Char) {
|
|
5895
|
-
var hex = [
|
|
5896
|
-
pad2(Math.round(r).toString(16)),
|
|
5897
|
-
pad2(Math.round(g).toString(16)),
|
|
5898
|
-
pad2(Math.round(b).toString(16)),
|
|
5899
|
-
];
|
|
5989
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
5900
5990
|
|
|
5901
5991
|
// Return a 3 character hex if possible
|
|
5902
|
-
if (
|
|
5903
|
-
allow3Char &&
|
|
5904
|
-
hex[0].charAt(0) == hex[0].charAt(1) &&
|
|
5905
|
-
hex[1].charAt(0) == hex[1].charAt(1) &&
|
|
5906
|
-
hex[2].charAt(0) == hex[2].charAt(1)
|
|
5907
|
-
) {
|
|
5992
|
+
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
5908
5993
|
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
5909
5994
|
}
|
|
5910
|
-
|
|
5911
5995
|
return hex.join("");
|
|
5912
5996
|
}
|
|
5913
5997
|
|
|
@@ -5916,26 +6000,12 @@
|
|
|
5916
6000
|
// Assumes r, g, b are contained in the set [0, 255] and
|
|
5917
6001
|
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
5918
6002
|
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
5919
|
-
var hex = [
|
|
5920
|
-
pad2(Math.round(r).toString(16)),
|
|
5921
|
-
pad2(Math.round(g).toString(16)),
|
|
5922
|
-
pad2(Math.round(b).toString(16)),
|
|
5923
|
-
pad2(convertDecimalToHex(a)),
|
|
5924
|
-
];
|
|
6003
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
5925
6004
|
|
|
5926
6005
|
// Return a 4 character hex if possible
|
|
5927
|
-
if (
|
|
5928
|
-
|
|
5929
|
-
hex[0].charAt(0) == hex[0].charAt(1) &&
|
|
5930
|
-
hex[1].charAt(0) == hex[1].charAt(1) &&
|
|
5931
|
-
hex[2].charAt(0) == hex[2].charAt(1) &&
|
|
5932
|
-
hex[3].charAt(0) == hex[3].charAt(1)
|
|
5933
|
-
) {
|
|
5934
|
-
return (
|
|
5935
|
-
hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0)
|
|
5936
|
-
);
|
|
6006
|
+
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
6007
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
5937
6008
|
}
|
|
5938
|
-
|
|
5939
6009
|
return hex.join("");
|
|
5940
6010
|
}
|
|
5941
6011
|
|
|
@@ -5943,13 +6013,7 @@
|
|
|
5943
6013
|
// Converts an RGBA color to an ARGB Hex8 string
|
|
5944
6014
|
// Rarely used, but required for "toFilter()"
|
|
5945
6015
|
function rgbaToArgbHex(r, g, b, a) {
|
|
5946
|
-
var hex = [
|
|
5947
|
-
pad2(convertDecimalToHex(a)),
|
|
5948
|
-
pad2(Math.round(r).toString(16)),
|
|
5949
|
-
pad2(Math.round(g).toString(16)),
|
|
5950
|
-
pad2(Math.round(b).toString(16)),
|
|
5951
|
-
];
|
|
5952
|
-
|
|
6016
|
+
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
5953
6017
|
return hex.join("");
|
|
5954
6018
|
}
|
|
5955
6019
|
|
|
@@ -5959,12 +6023,11 @@
|
|
|
5959
6023
|
if (!color1 || !color2) return false;
|
|
5960
6024
|
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
5961
6025
|
};
|
|
5962
|
-
|
|
5963
6026
|
tinycolor.random = function () {
|
|
5964
6027
|
return tinycolor.fromRatio({
|
|
5965
6028
|
r: Math.random(),
|
|
5966
6029
|
g: Math.random(),
|
|
5967
|
-
b: Math.random()
|
|
6030
|
+
b: Math.random()
|
|
5968
6031
|
});
|
|
5969
6032
|
};
|
|
5970
6033
|
|
|
@@ -5973,35 +6036,31 @@
|
|
|
5973
6036
|
// Thanks to less.js for some of the basics here
|
|
5974
6037
|
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
5975
6038
|
|
|
5976
|
-
function
|
|
6039
|
+
function _desaturate(color, amount) {
|
|
5977
6040
|
amount = amount === 0 ? 0 : amount || 10;
|
|
5978
6041
|
var hsl = tinycolor(color).toHsl();
|
|
5979
6042
|
hsl.s -= amount / 100;
|
|
5980
6043
|
hsl.s = clamp01(hsl.s);
|
|
5981
6044
|
return tinycolor(hsl);
|
|
5982
6045
|
}
|
|
5983
|
-
|
|
5984
|
-
function saturate(color, amount) {
|
|
6046
|
+
function _saturate(color, amount) {
|
|
5985
6047
|
amount = amount === 0 ? 0 : amount || 10;
|
|
5986
6048
|
var hsl = tinycolor(color).toHsl();
|
|
5987
6049
|
hsl.s += amount / 100;
|
|
5988
6050
|
hsl.s = clamp01(hsl.s);
|
|
5989
6051
|
return tinycolor(hsl);
|
|
5990
6052
|
}
|
|
5991
|
-
|
|
5992
|
-
function greyscale(color) {
|
|
6053
|
+
function _greyscale(color) {
|
|
5993
6054
|
return tinycolor(color).desaturate(100);
|
|
5994
6055
|
}
|
|
5995
|
-
|
|
5996
|
-
function lighten(color, amount) {
|
|
6056
|
+
function _lighten(color, amount) {
|
|
5997
6057
|
amount = amount === 0 ? 0 : amount || 10;
|
|
5998
6058
|
var hsl = tinycolor(color).toHsl();
|
|
5999
6059
|
hsl.l += amount / 100;
|
|
6000
6060
|
hsl.l = clamp01(hsl.l);
|
|
6001
6061
|
return tinycolor(hsl);
|
|
6002
6062
|
}
|
|
6003
|
-
|
|
6004
|
-
function brighten(color, amount) {
|
|
6063
|
+
function _brighten(color, amount) {
|
|
6005
6064
|
amount = amount === 0 ? 0 : amount || 10;
|
|
6006
6065
|
var rgb = tinycolor(color).toRgb();
|
|
6007
6066
|
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
@@ -6009,8 +6068,7 @@
|
|
|
6009
6068
|
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
6010
6069
|
return tinycolor(rgb);
|
|
6011
6070
|
}
|
|
6012
|
-
|
|
6013
|
-
function darken(color, amount) {
|
|
6071
|
+
function _darken(color, amount) {
|
|
6014
6072
|
amount = amount === 0 ? 0 : amount || 10;
|
|
6015
6073
|
var hsl = tinycolor(color).toHsl();
|
|
6016
6074
|
hsl.l -= amount / 100;
|
|
@@ -6020,7 +6078,7 @@
|
|
|
6020
6078
|
|
|
6021
6079
|
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
6022
6080
|
// Values outside of this range will be wrapped into this range.
|
|
6023
|
-
function
|
|
6081
|
+
function _spin(color, amount) {
|
|
6024
6082
|
var hsl = tinycolor(color).toHsl();
|
|
6025
6083
|
var hue = (hsl.h + amount) % 360;
|
|
6026
6084
|
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
@@ -6032,12 +6090,11 @@
|
|
|
6032
6090
|
// Thanks to jQuery xColor for some of the ideas behind these
|
|
6033
6091
|
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
6034
6092
|
|
|
6035
|
-
function
|
|
6093
|
+
function _complement(color) {
|
|
6036
6094
|
var hsl = tinycolor(color).toHsl();
|
|
6037
6095
|
hsl.h = (hsl.h + 180) % 360;
|
|
6038
6096
|
return tinycolor(hsl);
|
|
6039
6097
|
}
|
|
6040
|
-
|
|
6041
6098
|
function polyad(color, number) {
|
|
6042
6099
|
if (isNaN(number) || number <= 0) {
|
|
6043
6100
|
throw new Error("Argument to polyad must be a positive number");
|
|
@@ -6046,38 +6103,40 @@
|
|
|
6046
6103
|
var result = [tinycolor(color)];
|
|
6047
6104
|
var step = 360 / number;
|
|
6048
6105
|
for (var i = 1; i < number; i++) {
|
|
6049
|
-
result.push(tinycolor({
|
|
6106
|
+
result.push(tinycolor({
|
|
6107
|
+
h: (hsl.h + i * step) % 360,
|
|
6108
|
+
s: hsl.s,
|
|
6109
|
+
l: hsl.l
|
|
6110
|
+
}));
|
|
6050
6111
|
}
|
|
6051
|
-
|
|
6052
6112
|
return result;
|
|
6053
6113
|
}
|
|
6054
|
-
|
|
6055
|
-
function splitcomplement(color) {
|
|
6114
|
+
function _splitcomplement(color) {
|
|
6056
6115
|
var hsl = tinycolor(color).toHsl();
|
|
6057
6116
|
var h = hsl.h;
|
|
6058
|
-
return [
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6117
|
+
return [tinycolor(color), tinycolor({
|
|
6118
|
+
h: (h + 72) % 360,
|
|
6119
|
+
s: hsl.s,
|
|
6120
|
+
l: hsl.l
|
|
6121
|
+
}), tinycolor({
|
|
6122
|
+
h: (h + 216) % 360,
|
|
6123
|
+
s: hsl.s,
|
|
6124
|
+
l: hsl.l
|
|
6125
|
+
})];
|
|
6126
|
+
}
|
|
6127
|
+
function _analogous(color, results, slices) {
|
|
6066
6128
|
results = results || 6;
|
|
6067
6129
|
slices = slices || 30;
|
|
6068
|
-
|
|
6069
6130
|
var hsl = tinycolor(color).toHsl();
|
|
6070
6131
|
var part = 360 / slices;
|
|
6071
6132
|
var ret = [tinycolor(color)];
|
|
6072
|
-
|
|
6073
|
-
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
|
|
6133
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
|
|
6074
6134
|
hsl.h = (hsl.h + part) % 360;
|
|
6075
6135
|
ret.push(tinycolor(hsl));
|
|
6076
6136
|
}
|
|
6077
6137
|
return ret;
|
|
6078
6138
|
}
|
|
6079
|
-
|
|
6080
|
-
function monochromatic(color, results) {
|
|
6139
|
+
function _monochromatic(color, results) {
|
|
6081
6140
|
results = results || 6;
|
|
6082
6141
|
var hsv = tinycolor(color).toHsv();
|
|
6083
6142
|
var h = hsv.h,
|
|
@@ -6085,12 +6144,14 @@
|
|
|
6085
6144
|
v = hsv.v;
|
|
6086
6145
|
var ret = [];
|
|
6087
6146
|
var modification = 1 / results;
|
|
6088
|
-
|
|
6089
6147
|
while (results--) {
|
|
6090
|
-
ret.push(tinycolor({
|
|
6148
|
+
ret.push(tinycolor({
|
|
6149
|
+
h: h,
|
|
6150
|
+
s: s,
|
|
6151
|
+
v: v
|
|
6152
|
+
}));
|
|
6091
6153
|
v = (v + modification) % 1;
|
|
6092
6154
|
}
|
|
6093
|
-
|
|
6094
6155
|
return ret;
|
|
6095
6156
|
}
|
|
6096
6157
|
|
|
@@ -6099,19 +6160,15 @@
|
|
|
6099
6160
|
|
|
6100
6161
|
tinycolor.mix = function (color1, color2, amount) {
|
|
6101
6162
|
amount = amount === 0 ? 0 : amount || 50;
|
|
6102
|
-
|
|
6103
6163
|
var rgb1 = tinycolor(color1).toRgb();
|
|
6104
6164
|
var rgb2 = tinycolor(color2).toRgb();
|
|
6105
|
-
|
|
6106
6165
|
var p = amount / 100;
|
|
6107
|
-
|
|
6108
6166
|
var rgba = {
|
|
6109
6167
|
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
6110
6168
|
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
6111
6169
|
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
6112
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
6170
|
+
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
6113
6171
|
};
|
|
6114
|
-
|
|
6115
6172
|
return tinycolor(rgba);
|
|
6116
6173
|
};
|
|
6117
6174
|
|
|
@@ -6124,10 +6181,7 @@
|
|
|
6124
6181
|
tinycolor.readability = function (color1, color2) {
|
|
6125
6182
|
var c1 = tinycolor(color1);
|
|
6126
6183
|
var c2 = tinycolor(color2);
|
|
6127
|
-
return (
|
|
6128
|
-
(Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
|
|
6129
|
-
(Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
|
|
6130
|
-
);
|
|
6184
|
+
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
6131
6185
|
};
|
|
6132
6186
|
|
|
6133
6187
|
// `isReadable`
|
|
@@ -6143,9 +6197,7 @@
|
|
|
6143
6197
|
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
6144
6198
|
var readability = tinycolor.readability(color1, color2);
|
|
6145
6199
|
var wcag2Parms, out;
|
|
6146
|
-
|
|
6147
6200
|
out = false;
|
|
6148
|
-
|
|
6149
6201
|
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
6150
6202
|
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
6151
6203
|
case "AAsmall":
|
|
@@ -6180,7 +6232,6 @@
|
|
|
6180
6232
|
includeFallbackColors = args.includeFallbackColors;
|
|
6181
6233
|
level = args.level;
|
|
6182
6234
|
size = args.size;
|
|
6183
|
-
|
|
6184
6235
|
for (var i = 0; i < colorList.length; i++) {
|
|
6185
6236
|
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
6186
6237
|
if (readability > bestScore) {
|
|
@@ -6188,14 +6239,10 @@
|
|
|
6188
6239
|
bestColor = tinycolor(colorList[i]);
|
|
6189
6240
|
}
|
|
6190
6241
|
}
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
size: size,
|
|
6196
|
-
}) ||
|
|
6197
|
-
!includeFallbackColors
|
|
6198
|
-
) {
|
|
6242
|
+
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
6243
|
+
level: level,
|
|
6244
|
+
size: size
|
|
6245
|
+
}) || !includeFallbackColors) {
|
|
6199
6246
|
return bestColor;
|
|
6200
6247
|
} else {
|
|
6201
6248
|
args.includeFallbackColors = false;
|
|
@@ -6206,7 +6253,7 @@
|
|
|
6206
6253
|
// Big List of Colors
|
|
6207
6254
|
// ------------------
|
|
6208
6255
|
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
6209
|
-
var names =
|
|
6256
|
+
var names = tinycolor.names = {
|
|
6210
6257
|
aliceblue: "f0f8ff",
|
|
6211
6258
|
antiquewhite: "faebd7",
|
|
6212
6259
|
aqua: "0ff",
|
|
@@ -6355,11 +6402,11 @@
|
|
|
6355
6402
|
white: "fff",
|
|
6356
6403
|
whitesmoke: "f5f5f5",
|
|
6357
6404
|
yellow: "ff0",
|
|
6358
|
-
yellowgreen: "9acd32"
|
|
6359
|
-
}
|
|
6405
|
+
yellowgreen: "9acd32"
|
|
6406
|
+
};
|
|
6360
6407
|
|
|
6361
6408
|
// Make it easy to access colors via `hexNames[hex]`
|
|
6362
|
-
var hexNames =
|
|
6409
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
6363
6410
|
|
|
6364
6411
|
// Utilities
|
|
6365
6412
|
// ---------
|
|
@@ -6378,18 +6425,15 @@
|
|
|
6378
6425
|
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
6379
6426
|
function boundAlpha(a) {
|
|
6380
6427
|
a = parseFloat(a);
|
|
6381
|
-
|
|
6382
6428
|
if (isNaN(a) || a < 0 || a > 1) {
|
|
6383
6429
|
a = 1;
|
|
6384
6430
|
}
|
|
6385
|
-
|
|
6386
6431
|
return a;
|
|
6387
6432
|
}
|
|
6388
6433
|
|
|
6389
6434
|
// Take input from [0, n] and return it as [0, 1]
|
|
6390
6435
|
function bound01(n, max) {
|
|
6391
6436
|
if (isOnePointZero(n)) n = "100%";
|
|
6392
|
-
|
|
6393
6437
|
var processPercent = isPercentage(n);
|
|
6394
6438
|
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
6395
6439
|
|
|
@@ -6404,7 +6448,7 @@
|
|
|
6404
6448
|
}
|
|
6405
6449
|
|
|
6406
6450
|
// Convert into [0, 1] range if it isn't already
|
|
6407
|
-
return
|
|
6451
|
+
return n % max / parseFloat(max);
|
|
6408
6452
|
}
|
|
6409
6453
|
|
|
6410
6454
|
// Force a number between 0 and 1
|
|
@@ -6438,7 +6482,6 @@
|
|
|
6438
6482
|
if (n <= 1) {
|
|
6439
6483
|
n = n * 100 + "%";
|
|
6440
6484
|
}
|
|
6441
|
-
|
|
6442
6485
|
return n;
|
|
6443
6486
|
}
|
|
6444
6487
|
|
|
@@ -6450,8 +6493,7 @@
|
|
|
6450
6493
|
function convertHexToDecimal(h) {
|
|
6451
6494
|
return parseIntFromHex(h) / 255;
|
|
6452
6495
|
}
|
|
6453
|
-
|
|
6454
|
-
var matchers = (function () {
|
|
6496
|
+
var matchers = function () {
|
|
6455
6497
|
// <http://www.w3.org/TR/css3-values/#integers>
|
|
6456
6498
|
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
6457
6499
|
|
|
@@ -6464,25 +6506,8 @@
|
|
|
6464
6506
|
// Actual matching.
|
|
6465
6507
|
// Parentheses and commas are optional, but not required.
|
|
6466
6508
|
// Whitespace can take the place of commas or opening paren
|
|
6467
|
-
var PERMISSIVE_MATCH3 =
|
|
6468
|
-
|
|
6469
|
-
CSS_UNIT +
|
|
6470
|
-
")[,|\\s]+(" +
|
|
6471
|
-
CSS_UNIT +
|
|
6472
|
-
")[,|\\s]+(" +
|
|
6473
|
-
CSS_UNIT +
|
|
6474
|
-
")\\s*\\)?";
|
|
6475
|
-
var PERMISSIVE_MATCH4 =
|
|
6476
|
-
"[\\s|\\(]+(" +
|
|
6477
|
-
CSS_UNIT +
|
|
6478
|
-
")[,|\\s]+(" +
|
|
6479
|
-
CSS_UNIT +
|
|
6480
|
-
")[,|\\s]+(" +
|
|
6481
|
-
CSS_UNIT +
|
|
6482
|
-
")[,|\\s]+(" +
|
|
6483
|
-
CSS_UNIT +
|
|
6484
|
-
")\\s*\\)?";
|
|
6485
|
-
|
|
6509
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
6510
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
6486
6511
|
return {
|
|
6487
6512
|
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
6488
6513
|
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
@@ -6494,9 +6519,9 @@
|
|
|
6494
6519
|
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
6495
6520
|
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
6496
6521
|
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
6497
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})
|
|
6522
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
6498
6523
|
};
|
|
6499
|
-
}
|
|
6524
|
+
}();
|
|
6500
6525
|
|
|
6501
6526
|
// `isValidCSSUnit`
|
|
6502
6527
|
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
@@ -6515,7 +6540,13 @@
|
|
|
6515
6540
|
color = names[color];
|
|
6516
6541
|
named = true;
|
|
6517
6542
|
} else if (color == "transparent") {
|
|
6518
|
-
return {
|
|
6543
|
+
return {
|
|
6544
|
+
r: 0,
|
|
6545
|
+
g: 0,
|
|
6546
|
+
b: 0,
|
|
6547
|
+
a: 0,
|
|
6548
|
+
format: "name"
|
|
6549
|
+
};
|
|
6519
6550
|
}
|
|
6520
6551
|
|
|
6521
6552
|
// Try to match string input using regular expressions.
|
|
@@ -6523,67 +6554,95 @@
|
|
|
6523
6554
|
// Just return an object and let the conversion functions handle that.
|
|
6524
6555
|
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
6525
6556
|
var match;
|
|
6526
|
-
if (
|
|
6527
|
-
return {
|
|
6557
|
+
if (match = matchers.rgb.exec(color)) {
|
|
6558
|
+
return {
|
|
6559
|
+
r: match[1],
|
|
6560
|
+
g: match[2],
|
|
6561
|
+
b: match[3]
|
|
6562
|
+
};
|
|
6528
6563
|
}
|
|
6529
|
-
if (
|
|
6530
|
-
return {
|
|
6564
|
+
if (match = matchers.rgba.exec(color)) {
|
|
6565
|
+
return {
|
|
6566
|
+
r: match[1],
|
|
6567
|
+
g: match[2],
|
|
6568
|
+
b: match[3],
|
|
6569
|
+
a: match[4]
|
|
6570
|
+
};
|
|
6531
6571
|
}
|
|
6532
|
-
if (
|
|
6533
|
-
return {
|
|
6572
|
+
if (match = matchers.hsl.exec(color)) {
|
|
6573
|
+
return {
|
|
6574
|
+
h: match[1],
|
|
6575
|
+
s: match[2],
|
|
6576
|
+
l: match[3]
|
|
6577
|
+
};
|
|
6534
6578
|
}
|
|
6535
|
-
if (
|
|
6536
|
-
return {
|
|
6579
|
+
if (match = matchers.hsla.exec(color)) {
|
|
6580
|
+
return {
|
|
6581
|
+
h: match[1],
|
|
6582
|
+
s: match[2],
|
|
6583
|
+
l: match[3],
|
|
6584
|
+
a: match[4]
|
|
6585
|
+
};
|
|
6537
6586
|
}
|
|
6538
|
-
if (
|
|
6539
|
-
return {
|
|
6587
|
+
if (match = matchers.hsv.exec(color)) {
|
|
6588
|
+
return {
|
|
6589
|
+
h: match[1],
|
|
6590
|
+
s: match[2],
|
|
6591
|
+
v: match[3]
|
|
6592
|
+
};
|
|
6540
6593
|
}
|
|
6541
|
-
if (
|
|
6542
|
-
return {
|
|
6594
|
+
if (match = matchers.hsva.exec(color)) {
|
|
6595
|
+
return {
|
|
6596
|
+
h: match[1],
|
|
6597
|
+
s: match[2],
|
|
6598
|
+
v: match[3],
|
|
6599
|
+
a: match[4]
|
|
6600
|
+
};
|
|
6543
6601
|
}
|
|
6544
|
-
if (
|
|
6602
|
+
if (match = matchers.hex8.exec(color)) {
|
|
6545
6603
|
return {
|
|
6546
6604
|
r: parseIntFromHex(match[1]),
|
|
6547
6605
|
g: parseIntFromHex(match[2]),
|
|
6548
6606
|
b: parseIntFromHex(match[3]),
|
|
6549
6607
|
a: convertHexToDecimal(match[4]),
|
|
6550
|
-
format: named ? "name" : "hex8"
|
|
6608
|
+
format: named ? "name" : "hex8"
|
|
6551
6609
|
};
|
|
6552
6610
|
}
|
|
6553
|
-
if (
|
|
6611
|
+
if (match = matchers.hex6.exec(color)) {
|
|
6554
6612
|
return {
|
|
6555
6613
|
r: parseIntFromHex(match[1]),
|
|
6556
6614
|
g: parseIntFromHex(match[2]),
|
|
6557
6615
|
b: parseIntFromHex(match[3]),
|
|
6558
|
-
format: named ? "name" : "hex"
|
|
6616
|
+
format: named ? "name" : "hex"
|
|
6559
6617
|
};
|
|
6560
6618
|
}
|
|
6561
|
-
if (
|
|
6619
|
+
if (match = matchers.hex4.exec(color)) {
|
|
6562
6620
|
return {
|
|
6563
6621
|
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
6564
6622
|
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
6565
6623
|
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
6566
6624
|
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
6567
|
-
format: named ? "name" : "hex8"
|
|
6625
|
+
format: named ? "name" : "hex8"
|
|
6568
6626
|
};
|
|
6569
6627
|
}
|
|
6570
|
-
if (
|
|
6628
|
+
if (match = matchers.hex3.exec(color)) {
|
|
6571
6629
|
return {
|
|
6572
6630
|
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
6573
6631
|
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
6574
6632
|
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
6575
|
-
format: named ? "name" : "hex"
|
|
6633
|
+
format: named ? "name" : "hex"
|
|
6576
6634
|
};
|
|
6577
6635
|
}
|
|
6578
|
-
|
|
6579
6636
|
return false;
|
|
6580
6637
|
}
|
|
6581
|
-
|
|
6582
6638
|
function validateWCAG2Parms(parms) {
|
|
6583
6639
|
// return valid WCAG2 parms for isReadable.
|
|
6584
6640
|
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
6585
6641
|
var level, size;
|
|
6586
|
-
parms = parms || {
|
|
6642
|
+
parms = parms || {
|
|
6643
|
+
level: "AA",
|
|
6644
|
+
size: "small"
|
|
6645
|
+
};
|
|
6587
6646
|
level = (parms.level || "AA").toUpperCase();
|
|
6588
6647
|
size = (parms.size || "small").toLowerCase();
|
|
6589
6648
|
if (level !== "AA" && level !== "AAA") {
|
|
@@ -6592,7 +6651,10 @@
|
|
|
6592
6651
|
if (size !== "small" && size !== "large") {
|
|
6593
6652
|
size = "small";
|
|
6594
6653
|
}
|
|
6595
|
-
return {
|
|
6654
|
+
return {
|
|
6655
|
+
level: level,
|
|
6656
|
+
size: size
|
|
6657
|
+
};
|
|
6596
6658
|
}
|
|
6597
6659
|
|
|
6598
6660
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -6600,17 +6662,15 @@
|
|
|
6600
6662
|
throw new TypeError("Cannot call a class as a function");
|
|
6601
6663
|
}
|
|
6602
6664
|
}
|
|
6603
|
-
|
|
6604
6665
|
function _defineProperties(target, props) {
|
|
6605
6666
|
for (var i = 0; i < props.length; i++) {
|
|
6606
6667
|
var descriptor = props[i];
|
|
6607
6668
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
6608
6669
|
descriptor.configurable = true;
|
|
6609
6670
|
if ("value" in descriptor) descriptor.writable = true;
|
|
6610
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
6671
|
+
Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
|
|
6611
6672
|
}
|
|
6612
6673
|
}
|
|
6613
|
-
|
|
6614
6674
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
6615
6675
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
6616
6676
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -6619,19 +6679,15 @@
|
|
|
6619
6679
|
});
|
|
6620
6680
|
return Constructor;
|
|
6621
6681
|
}
|
|
6622
|
-
|
|
6623
6682
|
function _toConsumableArray$1(arr) {
|
|
6624
6683
|
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
|
|
6625
6684
|
}
|
|
6626
|
-
|
|
6627
6685
|
function _arrayWithoutHoles$1(arr) {
|
|
6628
6686
|
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
|
|
6629
6687
|
}
|
|
6630
|
-
|
|
6631
6688
|
function _iterableToArray$1(iter) {
|
|
6632
6689
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6633
6690
|
}
|
|
6634
|
-
|
|
6635
6691
|
function _unsupportedIterableToArray$1(o, minLen) {
|
|
6636
6692
|
if (!o) return;
|
|
6637
6693
|
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
@@ -6640,53 +6696,54 @@
|
|
|
6640
6696
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
6641
6697
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
6642
6698
|
}
|
|
6643
|
-
|
|
6644
6699
|
function _arrayLikeToArray$1(arr, len) {
|
|
6645
6700
|
if (len == null || len > arr.length) len = arr.length;
|
|
6646
|
-
|
|
6647
6701
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
6648
|
-
|
|
6649
6702
|
return arr2;
|
|
6650
6703
|
}
|
|
6651
|
-
|
|
6652
6704
|
function _nonIterableSpread$1() {
|
|
6653
6705
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6654
6706
|
}
|
|
6707
|
+
function _toPrimitive$1(input, hint) {
|
|
6708
|
+
if (typeof input !== "object" || input === null) return input;
|
|
6709
|
+
var prim = input[Symbol.toPrimitive];
|
|
6710
|
+
if (prim !== undefined) {
|
|
6711
|
+
var res = prim.call(input, hint || "default");
|
|
6712
|
+
if (typeof res !== "object") return res;
|
|
6713
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
6714
|
+
}
|
|
6715
|
+
return (hint === "string" ? String : Number)(input);
|
|
6716
|
+
}
|
|
6717
|
+
function _toPropertyKey$1(arg) {
|
|
6718
|
+
var key = _toPrimitive$1(arg, "string");
|
|
6719
|
+
return typeof key === "symbol" ? key : String(key);
|
|
6720
|
+
}
|
|
6655
6721
|
|
|
6656
6722
|
var ENTROPY = 123; // Raise numbers to prevent collisions in lower indexes
|
|
6657
6723
|
|
|
6658
6724
|
var int2HexColor = function int2HexColor(num) {
|
|
6659
6725
|
return "#".concat(Math.min(num, Math.pow(2, 24)).toString(16).padStart(6, '0'));
|
|
6660
6726
|
};
|
|
6661
|
-
|
|
6662
6727
|
var rgb2Int = function rgb2Int(r, g, b) {
|
|
6663
6728
|
return (r << 16) + (g << 8) + b;
|
|
6664
6729
|
};
|
|
6665
|
-
|
|
6666
6730
|
var colorStr2Int = function colorStr2Int(str) {
|
|
6667
6731
|
var _tinyColor$toRgb = tinycolor(str).toRgb(),
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6732
|
+
r = _tinyColor$toRgb.r,
|
|
6733
|
+
g = _tinyColor$toRgb.g,
|
|
6734
|
+
b = _tinyColor$toRgb.b;
|
|
6672
6735
|
return rgb2Int(r, g, b);
|
|
6673
6736
|
};
|
|
6674
|
-
|
|
6675
6737
|
var checksum = function checksum(n, csBits) {
|
|
6676
6738
|
return n * ENTROPY % Math.pow(2, csBits);
|
|
6677
6739
|
};
|
|
6678
|
-
|
|
6679
6740
|
var _default = /*#__PURE__*/function () {
|
|
6680
6741
|
function _default() {
|
|
6681
6742
|
var csBits = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
|
|
6682
|
-
|
|
6683
6743
|
_classCallCheck(this, _default);
|
|
6684
|
-
|
|
6685
6744
|
this.csBits = csBits; // How many bits to reserve for checksum. Will eat away into the usable size of the registry.
|
|
6686
|
-
|
|
6687
6745
|
this.registry = ['__reserved for background__']; // indexed objects for rgb lookup;
|
|
6688
6746
|
}
|
|
6689
|
-
|
|
6690
6747
|
_createClass(_default, [{
|
|
6691
6748
|
key: "register",
|
|
6692
6749
|
value: function register(obj) {
|
|
@@ -6708,7 +6765,6 @@
|
|
|
6708
6765
|
if (!n) return null; // 0 index is reserved for background
|
|
6709
6766
|
|
|
6710
6767
|
var idx = n & Math.pow(2, 24 - this.csBits) - 1; // registry index
|
|
6711
|
-
|
|
6712
6768
|
var cs = n >> 24 - this.csBits & Math.pow(2, this.csBits) - 1; // extract bits reserved for checksum
|
|
6713
6769
|
|
|
6714
6770
|
if (checksum(idx, this.csBits) !== cs || idx >= this.registry.length) return null; // failed checksum or registry out of bounds
|
|
@@ -6716,7 +6772,6 @@
|
|
|
6716
6772
|
return this.registry[idx];
|
|
6717
6773
|
}
|
|
6718
6774
|
}]);
|
|
6719
|
-
|
|
6720
6775
|
return _default;
|
|
6721
6776
|
}();
|
|
6722
6777
|
|
|
@@ -6771,7 +6826,7 @@
|
|
|
6771
6826
|
}
|
|
6772
6827
|
|
|
6773
6828
|
function tree_add$2(d) {
|
|
6774
|
-
|
|
6829
|
+
const x = +this._x.call(null, d);
|
|
6775
6830
|
return add$2(this.cover(x), x, d);
|
|
6776
6831
|
}
|
|
6777
6832
|
|
|
@@ -6811,14 +6866,14 @@
|
|
|
6811
6866
|
}
|
|
6812
6867
|
|
|
6813
6868
|
function addAll$2(data) {
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6869
|
+
if (!Array.isArray(data)) data = Array.from(data);
|
|
6870
|
+
const n = data.length;
|
|
6871
|
+
const xz = new Float64Array(n);
|
|
6872
|
+
let x0 = Infinity,
|
|
6818
6873
|
x1 = -Infinity;
|
|
6819
6874
|
|
|
6820
6875
|
// Compute the points and their extent.
|
|
6821
|
-
for (i = 0; i < n; ++i) {
|
|
6876
|
+
for (let i = 0, x; i < n; ++i) {
|
|
6822
6877
|
if (isNaN(x = +this._x.call(null, data[i]))) continue;
|
|
6823
6878
|
xz[i] = x;
|
|
6824
6879
|
if (x < x0) x0 = x;
|
|
@@ -6832,7 +6887,7 @@
|
|
|
6832
6887
|
this.cover(x0).cover(x1);
|
|
6833
6888
|
|
|
6834
6889
|
// Add the new points.
|
|
6835
|
-
for (i = 0; i < n; ++i) {
|
|
6890
|
+
for (let i = 0; i < n; ++i) {
|
|
6836
6891
|
add$2(this, xz[i], data[i]);
|
|
6837
6892
|
}
|
|
6838
6893
|
|
|
@@ -7526,7 +7581,7 @@
|
|
|
7526
7581
|
treeProto$1.y = tree_y$1;
|
|
7527
7582
|
|
|
7528
7583
|
function tree_add(d) {
|
|
7529
|
-
|
|
7584
|
+
const x = +this._x.call(null, d),
|
|
7530
7585
|
y = +this._y.call(null, d),
|
|
7531
7586
|
z = +this._z.call(null, d);
|
|
7532
7587
|
return add(this.cover(x, y, z), x, y, z, d);
|
|
@@ -7584,14 +7639,12 @@
|
|
|
7584
7639
|
}
|
|
7585
7640
|
|
|
7586
7641
|
function addAll(data) {
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
zz = new Array(n),
|
|
7594
|
-
x0 = Infinity,
|
|
7642
|
+
if (!Array.isArray(data)) data = Array.from(data);
|
|
7643
|
+
const n = data.length;
|
|
7644
|
+
const xz = new Float64Array(n);
|
|
7645
|
+
const yz = new Float64Array(n);
|
|
7646
|
+
const zz = new Float64Array(n);
|
|
7647
|
+
let x0 = Infinity,
|
|
7595
7648
|
y0 = Infinity,
|
|
7596
7649
|
z0 = Infinity,
|
|
7597
7650
|
x1 = -Infinity,
|
|
@@ -7599,7 +7652,7 @@
|
|
|
7599
7652
|
z1 = -Infinity;
|
|
7600
7653
|
|
|
7601
7654
|
// Compute the points and their extent.
|
|
7602
|
-
for (i = 0; i < n; ++i) {
|
|
7655
|
+
for (let i = 0, d, x, y, z; i < n; ++i) {
|
|
7603
7656
|
if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d)) || isNaN(z = +this._z.call(null, d))) continue;
|
|
7604
7657
|
xz[i] = x;
|
|
7605
7658
|
yz[i] = y;
|
|
@@ -7619,7 +7672,7 @@
|
|
|
7619
7672
|
this.cover(x0, y0, z0).cover(x1, y1, z1);
|
|
7620
7673
|
|
|
7621
7674
|
// Add the new points.
|
|
7622
|
-
for (i = 0; i < n; ++i) {
|
|
7675
|
+
for (let i = 0; i < n; ++i) {
|
|
7623
7676
|
add(this, xz[i], yz[i], zz[i], data[i]);
|
|
7624
7677
|
}
|
|
7625
7678
|
|
|
@@ -9744,7 +9797,7 @@
|
|
|
9744
9797
|
getLUT(steps) {
|
|
9745
9798
|
this.verify();
|
|
9746
9799
|
steps = steps || 100;
|
|
9747
|
-
if (this._lut.length === steps) {
|
|
9800
|
+
if (this._lut.length === steps + 1) {
|
|
9748
9801
|
return this._lut;
|
|
9749
9802
|
}
|
|
9750
9803
|
this._lut = [];
|
|
@@ -10510,31 +10563,51 @@
|
|
|
10510
10563
|
}
|
|
10511
10564
|
}
|
|
10512
10565
|
|
|
10566
|
+
function _iterableToArrayLimit(arr, i) {
|
|
10567
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
10568
|
+
if (null != _i) {
|
|
10569
|
+
var _s,
|
|
10570
|
+
_e,
|
|
10571
|
+
_x,
|
|
10572
|
+
_r,
|
|
10573
|
+
_arr = [],
|
|
10574
|
+
_n = !0,
|
|
10575
|
+
_d = !1;
|
|
10576
|
+
try {
|
|
10577
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
10578
|
+
if (Object(_i) !== _i) return;
|
|
10579
|
+
_n = !1;
|
|
10580
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
10581
|
+
} catch (err) {
|
|
10582
|
+
_d = !0, _e = err;
|
|
10583
|
+
} finally {
|
|
10584
|
+
try {
|
|
10585
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
10586
|
+
} finally {
|
|
10587
|
+
if (_d) throw _e;
|
|
10588
|
+
}
|
|
10589
|
+
}
|
|
10590
|
+
return _arr;
|
|
10591
|
+
}
|
|
10592
|
+
}
|
|
10513
10593
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
10514
10594
|
if (source == null) return {};
|
|
10515
10595
|
var target = {};
|
|
10516
10596
|
var sourceKeys = Object.keys(source);
|
|
10517
10597
|
var key, i;
|
|
10518
|
-
|
|
10519
10598
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
10520
10599
|
key = sourceKeys[i];
|
|
10521
10600
|
if (excluded.indexOf(key) >= 0) continue;
|
|
10522
10601
|
target[key] = source[key];
|
|
10523
10602
|
}
|
|
10524
|
-
|
|
10525
10603
|
return target;
|
|
10526
10604
|
}
|
|
10527
|
-
|
|
10528
10605
|
function _objectWithoutProperties(source, excluded) {
|
|
10529
10606
|
if (source == null) return {};
|
|
10530
|
-
|
|
10531
10607
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
10532
|
-
|
|
10533
10608
|
var key, i;
|
|
10534
|
-
|
|
10535
10609
|
if (Object.getOwnPropertySymbols) {
|
|
10536
10610
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
10537
|
-
|
|
10538
10611
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
10539
10612
|
key = sourceSymbolKeys[i];
|
|
10540
10613
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -10542,60 +10615,23 @@
|
|
|
10542
10615
|
target[key] = source[key];
|
|
10543
10616
|
}
|
|
10544
10617
|
}
|
|
10545
|
-
|
|
10546
10618
|
return target;
|
|
10547
10619
|
}
|
|
10548
|
-
|
|
10549
10620
|
function _slicedToArray(arr, i) {
|
|
10550
10621
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
10551
10622
|
}
|
|
10552
|
-
|
|
10553
10623
|
function _toConsumableArray(arr) {
|
|
10554
10624
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
10555
10625
|
}
|
|
10556
|
-
|
|
10557
10626
|
function _arrayWithoutHoles(arr) {
|
|
10558
10627
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
10559
10628
|
}
|
|
10560
|
-
|
|
10561
10629
|
function _arrayWithHoles(arr) {
|
|
10562
10630
|
if (Array.isArray(arr)) return arr;
|
|
10563
10631
|
}
|
|
10564
|
-
|
|
10565
10632
|
function _iterableToArray(iter) {
|
|
10566
10633
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
10567
10634
|
}
|
|
10568
|
-
|
|
10569
|
-
function _iterableToArrayLimit(arr, i) {
|
|
10570
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
10571
|
-
|
|
10572
|
-
if (_i == null) return;
|
|
10573
|
-
var _arr = [];
|
|
10574
|
-
var _n = true;
|
|
10575
|
-
var _d = false;
|
|
10576
|
-
|
|
10577
|
-
var _s, _e;
|
|
10578
|
-
|
|
10579
|
-
try {
|
|
10580
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
10581
|
-
_arr.push(_s.value);
|
|
10582
|
-
|
|
10583
|
-
if (i && _arr.length === i) break;
|
|
10584
|
-
}
|
|
10585
|
-
} catch (err) {
|
|
10586
|
-
_d = true;
|
|
10587
|
-
_e = err;
|
|
10588
|
-
} finally {
|
|
10589
|
-
try {
|
|
10590
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
10591
|
-
} finally {
|
|
10592
|
-
if (_d) throw _e;
|
|
10593
|
-
}
|
|
10594
|
-
}
|
|
10595
|
-
|
|
10596
|
-
return _arr;
|
|
10597
|
-
}
|
|
10598
|
-
|
|
10599
10635
|
function _unsupportedIterableToArray(o, minLen) {
|
|
10600
10636
|
if (!o) return;
|
|
10601
10637
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -10604,39 +10640,29 @@
|
|
|
10604
10640
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
10605
10641
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
10606
10642
|
}
|
|
10607
|
-
|
|
10608
10643
|
function _arrayLikeToArray(arr, len) {
|
|
10609
10644
|
if (len == null || len > arr.length) len = arr.length;
|
|
10610
|
-
|
|
10611
10645
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10612
|
-
|
|
10613
10646
|
return arr2;
|
|
10614
10647
|
}
|
|
10615
|
-
|
|
10616
10648
|
function _nonIterableSpread() {
|
|
10617
10649
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10618
10650
|
}
|
|
10619
|
-
|
|
10620
10651
|
function _nonIterableRest() {
|
|
10621
10652
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10622
10653
|
}
|
|
10623
|
-
|
|
10624
10654
|
function _toPrimitive(input, hint) {
|
|
10625
10655
|
if (typeof input !== "object" || input === null) return input;
|
|
10626
10656
|
var prim = input[Symbol.toPrimitive];
|
|
10627
|
-
|
|
10628
10657
|
if (prim !== undefined) {
|
|
10629
10658
|
var res = prim.call(input, hint || "default");
|
|
10630
10659
|
if (typeof res !== "object") return res;
|
|
10631
10660
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10632
10661
|
}
|
|
10633
|
-
|
|
10634
10662
|
return (hint === "string" ? String : Number)(input);
|
|
10635
10663
|
}
|
|
10636
|
-
|
|
10637
10664
|
function _toPropertyKey(arg) {
|
|
10638
10665
|
var key = _toPrimitive(arg, "string");
|
|
10639
|
-
|
|
10640
10666
|
return typeof key === "symbol" ? key : String(key);
|
|
10641
10667
|
}
|
|
10642
10668
|
|
|
@@ -10656,25 +10682,21 @@
|
|
|
10656
10682
|
var itemVal = item;
|
|
10657
10683
|
keys.forEach(function (_ref, idx) {
|
|
10658
10684
|
var keyAccessor = _ref.keyAccessor,
|
|
10659
|
-
|
|
10685
|
+
isProp = _ref.isProp;
|
|
10660
10686
|
var key;
|
|
10661
|
-
|
|
10662
10687
|
if (isProp) {
|
|
10663
10688
|
var _itemVal = itemVal,
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10689
|
+
propVal = _itemVal[keyAccessor],
|
|
10690
|
+
rest = _objectWithoutProperties(_itemVal, [keyAccessor].map(_toPropertyKey));
|
|
10667
10691
|
key = propVal;
|
|
10668
10692
|
itemVal = rest;
|
|
10669
10693
|
} else {
|
|
10670
10694
|
key = keyAccessor(itemVal, idx);
|
|
10671
10695
|
}
|
|
10672
|
-
|
|
10673
10696
|
if (idx + 1 < keys.length) {
|
|
10674
10697
|
if (!iterObj.hasOwnProperty(key)) {
|
|
10675
10698
|
iterObj[key] = {};
|
|
10676
10699
|
}
|
|
10677
|
-
|
|
10678
10700
|
iterObj = iterObj[key];
|
|
10679
10701
|
} else {
|
|
10680
10702
|
// Leaf key
|
|
@@ -10682,7 +10704,6 @@
|
|
|
10682
10704
|
if (!iterObj.hasOwnProperty(key)) {
|
|
10683
10705
|
iterObj[key] = [];
|
|
10684
10706
|
}
|
|
10685
|
-
|
|
10686
10707
|
iterObj[key].push(itemVal);
|
|
10687
10708
|
} else {
|
|
10688
10709
|
iterObj[key] = itemVal;
|
|
@@ -10691,12 +10712,10 @@
|
|
|
10691
10712
|
});
|
|
10692
10713
|
return res;
|
|
10693
10714
|
}, {});
|
|
10694
|
-
|
|
10695
10715
|
if (multiItem instanceof Function) {
|
|
10696
10716
|
// Reduce leaf multiple values
|
|
10697
10717
|
(function reduce(node) {
|
|
10698
10718
|
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
10699
|
-
|
|
10700
10719
|
if (level === keys.length) {
|
|
10701
10720
|
Object.keys(node).forEach(function (k) {
|
|
10702
10721
|
return node[k] = multiItem(node[k]);
|
|
@@ -10707,18 +10726,14 @@
|
|
|
10707
10726
|
});
|
|
10708
10727
|
}
|
|
10709
10728
|
})(indexedResult); // IIFE
|
|
10710
|
-
|
|
10711
10729
|
}
|
|
10712
10730
|
|
|
10713
10731
|
var result = indexedResult;
|
|
10714
|
-
|
|
10715
10732
|
if (flattenKeys) {
|
|
10716
10733
|
// flatten into array
|
|
10717
10734
|
result = [];
|
|
10718
|
-
|
|
10719
10735
|
(function flatten(node) {
|
|
10720
10736
|
var accKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
10721
|
-
|
|
10722
10737
|
if (accKeys.length === keys.length) {
|
|
10723
10738
|
result.push({
|
|
10724
10739
|
keys: accKeys,
|
|
@@ -10727,21 +10742,18 @@
|
|
|
10727
10742
|
} else {
|
|
10728
10743
|
Object.entries(node).forEach(function (_ref2) {
|
|
10729
10744
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10745
|
+
key = _ref3[0],
|
|
10746
|
+
val = _ref3[1];
|
|
10733
10747
|
return flatten(val, [].concat(_toConsumableArray(accKeys), [key]));
|
|
10734
10748
|
});
|
|
10735
10749
|
}
|
|
10736
10750
|
})(indexedResult); //IIFE
|
|
10737
10751
|
|
|
10738
|
-
|
|
10739
10752
|
if (keyAccessors instanceof Array && keyAccessors.length === 0 && result.length === 1) {
|
|
10740
10753
|
// clear keys if there's no key accessors (single result)
|
|
10741
10754
|
result[0].keys = [];
|
|
10742
10755
|
}
|
|
10743
10756
|
}
|
|
10744
|
-
|
|
10745
10757
|
return result;
|
|
10746
10758
|
});
|
|
10747
10759
|
|
|
@@ -10853,7 +10865,7 @@
|
|
|
10853
10865
|
var targetNode = graph[targetId];
|
|
10854
10866
|
sourceNode.out.push(targetNode);
|
|
10855
10867
|
function getNodeId(node) {
|
|
10856
|
-
return _typeof(node) === 'object' ? idAccessor(node) : node;
|
|
10868
|
+
return _typeof$1(node) === 'object' ? idAccessor(node) : node;
|
|
10857
10869
|
}
|
|
10858
10870
|
});
|
|
10859
10871
|
var foundLoops = [];
|
|
@@ -10912,7 +10924,7 @@
|
|
|
10912
10924
|
var updDataPhotons = function updDataPhotons(_, state) {
|
|
10913
10925
|
if (!state.isShadow) {
|
|
10914
10926
|
// Add photon particles
|
|
10915
|
-
var linkParticlesAccessor =
|
|
10927
|
+
var linkParticlesAccessor = index$2(state.linkDirectionalParticles);
|
|
10916
10928
|
state.graphData.links.forEach(function (link) {
|
|
10917
10929
|
var numPhotons = Math.round(Math.abs(linkParticlesAccessor(link)));
|
|
10918
10930
|
if (numPhotons) {
|
|
@@ -11180,10 +11192,10 @@
|
|
|
11180
11192
|
}
|
|
11181
11193
|
}
|
|
11182
11194
|
function paintNodes() {
|
|
11183
|
-
var getVisibility =
|
|
11184
|
-
var getVal =
|
|
11185
|
-
var getColor =
|
|
11186
|
-
var getNodeCanvasObjectMode =
|
|
11195
|
+
var getVisibility = index$2(state.nodeVisibility);
|
|
11196
|
+
var getVal = index$2(state.nodeVal);
|
|
11197
|
+
var getColor = index$2(state.nodeColor);
|
|
11198
|
+
var getNodeCanvasObjectMode = index$2(state.nodeCanvasObjectMode);
|
|
11187
11199
|
var ctx = state.ctx;
|
|
11188
11200
|
|
|
11189
11201
|
// Draw wider nodes by 1px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
|
|
@@ -11215,12 +11227,12 @@
|
|
|
11215
11227
|
ctx.restore();
|
|
11216
11228
|
}
|
|
11217
11229
|
function paintLinks() {
|
|
11218
|
-
var getVisibility =
|
|
11219
|
-
var getColor =
|
|
11220
|
-
var getWidth =
|
|
11221
|
-
var getLineDash =
|
|
11222
|
-
var getCurvature =
|
|
11223
|
-
var getLinkCanvasObjectMode =
|
|
11230
|
+
var getVisibility = index$2(state.linkVisibility);
|
|
11231
|
+
var getColor = index$2(state.linkColor);
|
|
11232
|
+
var getWidth = index$2(state.linkWidth);
|
|
11233
|
+
var getLineDash = index$2(state.linkLineDash);
|
|
11234
|
+
var getCurvature = index$2(state.linkCurvature);
|
|
11235
|
+
var getLinkCanvasObjectMode = index$2(state.linkCanvasObjectMode);
|
|
11224
11236
|
var ctx = state.ctx;
|
|
11225
11237
|
|
|
11226
11238
|
// Draw wider lines by 2px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
|
|
@@ -11337,11 +11349,11 @@
|
|
|
11337
11349
|
function paintArrows() {
|
|
11338
11350
|
var ARROW_WH_RATIO = 1.6;
|
|
11339
11351
|
var ARROW_VLEN_RATIO = 0.2;
|
|
11340
|
-
var getLength =
|
|
11341
|
-
var getRelPos =
|
|
11342
|
-
var getVisibility =
|
|
11343
|
-
var getColor =
|
|
11344
|
-
var getNodeVal =
|
|
11352
|
+
var getLength = index$2(state.linkDirectionalArrowLength);
|
|
11353
|
+
var getRelPos = index$2(state.linkDirectionalArrowRelPos);
|
|
11354
|
+
var getVisibility = index$2(state.linkVisibility);
|
|
11355
|
+
var getColor = index$2(state.linkDirectionalArrowColor || state.linkColor);
|
|
11356
|
+
var getNodeVal = index$2(state.nodeVal);
|
|
11345
11357
|
var ctx = state.ctx;
|
|
11346
11358
|
ctx.save();
|
|
11347
11359
|
state.graphData.links.filter(getVisibility).forEach(function (link) {
|
|
@@ -11386,11 +11398,11 @@
|
|
|
11386
11398
|
ctx.restore();
|
|
11387
11399
|
}
|
|
11388
11400
|
function paintPhotons() {
|
|
11389
|
-
var getNumPhotons =
|
|
11390
|
-
var getSpeed =
|
|
11391
|
-
var getDiameter =
|
|
11392
|
-
var getVisibility =
|
|
11393
|
-
var getColor =
|
|
11401
|
+
var getNumPhotons = index$2(state.linkDirectionalParticles);
|
|
11402
|
+
var getSpeed = index$2(state.linkDirectionalParticleSpeed);
|
|
11403
|
+
var getDiameter = index$2(state.linkDirectionalParticleWidth);
|
|
11404
|
+
var getVisibility = index$2(state.linkVisibility);
|
|
11405
|
+
var getColor = index$2(state.linkDirectionalParticleColor || state.linkColor);
|
|
11394
11406
|
var ctx = state.ctx;
|
|
11395
11407
|
ctx.save();
|
|
11396
11408
|
state.graphData.links.filter(getVisibility).forEach(function (link) {
|
|
@@ -11473,11 +11485,11 @@
|
|
|
11473
11485
|
state.onUpdate();
|
|
11474
11486
|
if (state.nodeAutoColorBy !== null) {
|
|
11475
11487
|
// Auto add color to uncolored nodes
|
|
11476
|
-
autoColorObjects(state.graphData.nodes,
|
|
11488
|
+
autoColorObjects(state.graphData.nodes, index$2(state.nodeAutoColorBy), state.nodeColor);
|
|
11477
11489
|
}
|
|
11478
11490
|
if (state.linkAutoColorBy !== null) {
|
|
11479
11491
|
// Auto add color to uncolored links
|
|
11480
|
-
autoColorObjects(state.graphData.links,
|
|
11492
|
+
autoColorObjects(state.graphData.links, index$2(state.linkAutoColorBy), state.linkColor);
|
|
11481
11493
|
}
|
|
11482
11494
|
|
|
11483
11495
|
// parse links
|
|
@@ -11922,7 +11934,7 @@
|
|
|
11922
11934
|
var nodeFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
11923
11935
|
return true;
|
|
11924
11936
|
};
|
|
11925
|
-
var getVal =
|
|
11937
|
+
var getVal = index$2(state.nodeVal);
|
|
11926
11938
|
var getR = function getR(node) {
|
|
11927
11939
|
return Math.sqrt(Math.max(0, getVal(node) || 1)) * state.nodeRelSize;
|
|
11928
11940
|
};
|
|
@@ -12216,13 +12228,13 @@
|
|
|
12216
12228
|
|
|
12217
12229
|
//
|
|
12218
12230
|
|
|
12219
|
-
var refreshShadowCanvas = throttle
|
|
12231
|
+
var refreshShadowCanvas = throttle(function () {
|
|
12220
12232
|
// wipe canvas
|
|
12221
12233
|
clearCanvas(shadowCtx, state.width, state.height);
|
|
12222
12234
|
|
|
12223
12235
|
// Adjust link hover area
|
|
12224
12236
|
state.shadowGraph.linkWidth(function (l) {
|
|
12225
|
-
return
|
|
12237
|
+
return index$2(state.linkWidth)(l) + state.linkHoverPrecision;
|
|
12226
12238
|
});
|
|
12227
12239
|
|
|
12228
12240
|
// redraw
|
|
@@ -12255,7 +12267,7 @@
|
|
|
12255
12267
|
var _fn2 = state["on".concat(objType, "Hover")];
|
|
12256
12268
|
_fn2 && _fn2(obj.d, prevObjType === objType ? prevObj.d : null);
|
|
12257
12269
|
}
|
|
12258
|
-
var tooltipContent = obj ?
|
|
12270
|
+
var tooltipContent = obj ? index$2(state["".concat(obj.type.toLowerCase(), "Label")])(obj.d) || '' : '';
|
|
12259
12271
|
toolTipElem.style.visibility = tooltipContent ? 'visible' : 'hidden';
|
|
12260
12272
|
toolTipElem.innerHTML = tooltipContent;
|
|
12261
12273
|
|