force-graph 1.43.0 → 1.43.2
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 +869 -956
- package/dist/force-graph.js.map +1 -1
- package/dist/force-graph.min.js +3 -3
- package/dist/force-graph.mjs +2 -2
- package/package.json +16 -15
- package/src/force-graph.js +2 -2
package/dist/force-graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.43.
|
|
1
|
+
// Version 1.43.2 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
|
|
|
@@ -914,13 +914,13 @@
|
|
|
914
914
|
});
|
|
915
915
|
}
|
|
916
916
|
|
|
917
|
-
function remove
|
|
917
|
+
function remove() {
|
|
918
918
|
var parent = this.parentNode;
|
|
919
919
|
if (parent) parent.removeChild(this);
|
|
920
920
|
}
|
|
921
921
|
|
|
922
922
|
function selection_remove() {
|
|
923
|
-
return this.each(remove
|
|
923
|
+
return this.each(remove);
|
|
924
924
|
}
|
|
925
925
|
|
|
926
926
|
function selection_cloneShallow() {
|
|
@@ -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) {
|
|
@@ -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
|
|
@@ -3843,10 +4066,19 @@
|
|
|
3843
4066
|
* }, _.now());
|
|
3844
4067
|
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
3845
4068
|
*/
|
|
3846
|
-
var now$
|
|
3847
|
-
return root.Date.now();
|
|
4069
|
+
var now$1 = function() {
|
|
4070
|
+
return root$1.Date.now();
|
|
3848
4071
|
};
|
|
3849
4072
|
|
|
4073
|
+
var now$2 = now$1;
|
|
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
|
|
@@ -3901,7 +4133,7 @@
|
|
|
3901
4133
|
* // Cancel the trailing debounced invocation.
|
|
3902
4134
|
* jQuery(window).on('popstate', debounced.cancel);
|
|
3903
4135
|
*/
|
|
3904
|
-
function debounce
|
|
4136
|
+
function debounce(func, wait, options) {
|
|
3905
4137
|
var lastArgs,
|
|
3906
4138
|
lastThis,
|
|
3907
4139
|
maxWait,
|
|
@@ -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) {
|
|
@@ -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`
|
|
@@ -4078,151 +4316,32 @@
|
|
|
4078
4316
|
leading = 'leading' in options ? !!options.leading : leading;
|
|
4079
4317
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4080
4318
|
}
|
|
4081
|
-
return debounce
|
|
4319
|
+
return debounce(func, wait, {
|
|
4082
4320
|
'leading': leading,
|
|
4083
4321
|
'maxWait': wait,
|
|
4084
4322
|
'trailing': trailing
|
|
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,40 +4516,29 @@
|
|
|
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
|
-
var now;
|
|
4404
|
-
// Include a performance.now polyfill.
|
|
4405
|
-
// In node.js, use process.hrtime.
|
|
4406
|
-
// eslint-disable-next-line
|
|
4407
|
-
// @ts-ignore
|
|
4408
|
-
if (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) {
|
|
4409
|
-
now = function () {
|
|
4410
|
-
// eslint-disable-next-line
|
|
4411
|
-
// @ts-ignore
|
|
4412
|
-
var time = process.hrtime();
|
|
4413
|
-
// Convert [seconds, nanoseconds] to milliseconds.
|
|
4414
|
-
return time[0] * 1000 + time[1] / 1000000;
|
|
4415
|
-
};
|
|
4416
|
-
}
|
|
4417
|
-
// In a browser, use self.performance.now if it is available.
|
|
4418
|
-
else if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) {
|
|
4419
|
-
// This must be bound, because directly assigning this function
|
|
4420
|
-
// leads to an invocation exception in Chrome.
|
|
4421
|
-
now = self.performance.now.bind(self.performance);
|
|
4422
|
-
}
|
|
4423
|
-
// Use Date.now if it is available.
|
|
4424
|
-
else if (Date.now !== undefined) {
|
|
4425
|
-
now = Date.now;
|
|
4426
|
-
}
|
|
4427
|
-
// Otherwise, use 'new Date().getTime()'.
|
|
4428
|
-
else {
|
|
4429
|
-
now = function () {
|
|
4430
|
-
return new Date().getTime();
|
|
4431
|
-
};
|
|
4432
|
-
}
|
|
4433
|
-
var now$1 = now;
|
|
4541
|
+
var now = function () { return performance.now(); };
|
|
4434
4542
|
|
|
4435
4543
|
/**
|
|
4436
4544
|
* Controlling groups of tweens
|
|
@@ -4461,7 +4569,7 @@
|
|
|
4461
4569
|
delete this._tweensAddedDuringUpdate[tween.getId()];
|
|
4462
4570
|
};
|
|
4463
4571
|
Group.prototype.update = function (time, preserve) {
|
|
4464
|
-
if (time === void 0) { time = now
|
|
4572
|
+
if (time === void 0) { time = now(); }
|
|
4465
4573
|
if (preserve === void 0) { preserve = false; }
|
|
4466
4574
|
var tweenIds = Object.keys(this._tweens);
|
|
4467
4575
|
if (tweenIds.length === 0) {
|
|
@@ -4602,6 +4710,7 @@
|
|
|
4602
4710
|
this._valuesEnd = {};
|
|
4603
4711
|
this._valuesStartRepeat = {};
|
|
4604
4712
|
this._duration = 1000;
|
|
4713
|
+
this._isDynamic = false;
|
|
4605
4714
|
this._initialRepeat = 0;
|
|
4606
4715
|
this._repeat = 0;
|
|
4607
4716
|
this._yoyo = false;
|
|
@@ -4611,10 +4720,13 @@
|
|
|
4611
4720
|
this._startTime = 0;
|
|
4612
4721
|
this._easingFunction = Easing.Linear.None;
|
|
4613
4722
|
this._interpolationFunction = Interpolation.Linear;
|
|
4723
|
+
// eslint-disable-next-line
|
|
4614
4724
|
this._chainedTweens = [];
|
|
4615
4725
|
this._onStartCallbackFired = false;
|
|
4726
|
+
this._onEveryStartCallbackFired = false;
|
|
4616
4727
|
this._id = Sequence.nextId();
|
|
4617
4728
|
this._isChainStopped = false;
|
|
4729
|
+
this._propertiesAreSetUp = false;
|
|
4618
4730
|
this._goToEnd = false;
|
|
4619
4731
|
}
|
|
4620
4732
|
Tween.prototype.getId = function () {
|
|
@@ -4626,22 +4738,28 @@
|
|
|
4626
4738
|
Tween.prototype.isPaused = function () {
|
|
4627
4739
|
return this._isPaused;
|
|
4628
4740
|
};
|
|
4629
|
-
Tween.prototype.to = function (
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
this.
|
|
4635
|
-
|
|
4636
|
-
this._duration = duration;
|
|
4637
|
-
}
|
|
4741
|
+
Tween.prototype.to = function (target, duration) {
|
|
4742
|
+
if (duration === void 0) { duration = 1000; }
|
|
4743
|
+
if (this._isPlaying)
|
|
4744
|
+
throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
|
|
4745
|
+
this._valuesEnd = target;
|
|
4746
|
+
this._propertiesAreSetUp = false;
|
|
4747
|
+
this._duration = duration;
|
|
4638
4748
|
return this;
|
|
4639
4749
|
};
|
|
4640
|
-
Tween.prototype.duration = function (
|
|
4641
|
-
|
|
4750
|
+
Tween.prototype.duration = function (duration) {
|
|
4751
|
+
if (duration === void 0) { duration = 1000; }
|
|
4752
|
+
this._duration = duration;
|
|
4642
4753
|
return this;
|
|
4643
4754
|
};
|
|
4644
|
-
Tween.prototype.
|
|
4755
|
+
Tween.prototype.dynamic = function (dynamic) {
|
|
4756
|
+
if (dynamic === void 0) { dynamic = false; }
|
|
4757
|
+
this._isDynamic = dynamic;
|
|
4758
|
+
return this;
|
|
4759
|
+
};
|
|
4760
|
+
Tween.prototype.start = function (time, overrideStartingValues) {
|
|
4761
|
+
if (time === void 0) { time = now(); }
|
|
4762
|
+
if (overrideStartingValues === void 0) { overrideStartingValues = false; }
|
|
4645
4763
|
if (this._isPlaying) {
|
|
4646
4764
|
return this;
|
|
4647
4765
|
}
|
|
@@ -4660,13 +4778,27 @@
|
|
|
4660
4778
|
this._isPlaying = true;
|
|
4661
4779
|
this._isPaused = false;
|
|
4662
4780
|
this._onStartCallbackFired = false;
|
|
4781
|
+
this._onEveryStartCallbackFired = false;
|
|
4663
4782
|
this._isChainStopped = false;
|
|
4664
|
-
this._startTime = time
|
|
4783
|
+
this._startTime = time;
|
|
4665
4784
|
this._startTime += this._delayTime;
|
|
4666
|
-
|
|
4785
|
+
if (!this._propertiesAreSetUp || overrideStartingValues) {
|
|
4786
|
+
this._propertiesAreSetUp = true;
|
|
4787
|
+
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
|
4788
|
+
if (!this._isDynamic) {
|
|
4789
|
+
var tmp = {};
|
|
4790
|
+
for (var prop in this._valuesEnd)
|
|
4791
|
+
tmp[prop] = this._valuesEnd[prop];
|
|
4792
|
+
this._valuesEnd = tmp;
|
|
4793
|
+
}
|
|
4794
|
+
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
|
|
4795
|
+
}
|
|
4667
4796
|
return this;
|
|
4668
4797
|
};
|
|
4669
|
-
Tween.prototype.
|
|
4798
|
+
Tween.prototype.startFromCurrentValues = function (time) {
|
|
4799
|
+
return this.start(time, true);
|
|
4800
|
+
};
|
|
4801
|
+
Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
|
|
4670
4802
|
for (var property in _valuesEnd) {
|
|
4671
4803
|
var startValue = _object[property];
|
|
4672
4804
|
var startValueIsArray = Array.isArray(startValue);
|
|
@@ -4683,28 +4815,46 @@
|
|
|
4683
4815
|
if (endValues.length === 0) {
|
|
4684
4816
|
continue;
|
|
4685
4817
|
}
|
|
4686
|
-
//
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4818
|
+
// Handle an array of relative values.
|
|
4819
|
+
// Creates a local copy of the Array with the start value at the front
|
|
4820
|
+
var temp = [startValue];
|
|
4821
|
+
for (var i = 0, l = endValues.length; i < l; i += 1) {
|
|
4822
|
+
var value = this._handleRelativeValue(startValue, endValues[i]);
|
|
4823
|
+
if (isNaN(value)) {
|
|
4824
|
+
isInterpolationList = false;
|
|
4825
|
+
console.warn('Found invalid interpolation list. Skipping.');
|
|
4826
|
+
break;
|
|
4827
|
+
}
|
|
4828
|
+
temp.push(value);
|
|
4829
|
+
}
|
|
4830
|
+
if (isInterpolationList) {
|
|
4831
|
+
// if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
|
|
4832
|
+
_valuesEnd[property] = temp;
|
|
4833
|
+
// }
|
|
4834
|
+
}
|
|
4690
4835
|
}
|
|
4691
4836
|
// handle the deepness of the values
|
|
4692
4837
|
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
|
4693
4838
|
_valuesStart[property] = startValueIsArray ? [] : {};
|
|
4694
|
-
|
|
4695
|
-
for (var prop in
|
|
4696
|
-
|
|
4697
|
-
// @ts-ignore FIXME?
|
|
4698
|
-
_valuesStart[property][prop] = startValue[prop];
|
|
4839
|
+
var nestedObject = startValue;
|
|
4840
|
+
for (var prop in nestedObject) {
|
|
4841
|
+
_valuesStart[property][prop] = nestedObject[prop];
|
|
4699
4842
|
}
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4843
|
+
// TODO? repeat nested values? And yoyo? And array values?
|
|
4844
|
+
_valuesStartRepeat[property] = startValueIsArray ? [] : {};
|
|
4845
|
+
var endValues = _valuesEnd[property];
|
|
4846
|
+
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
|
4847
|
+
if (!this._isDynamic) {
|
|
4848
|
+
var tmp = {};
|
|
4849
|
+
for (var prop in endValues)
|
|
4850
|
+
tmp[prop] = endValues[prop];
|
|
4851
|
+
_valuesEnd[property] = endValues = tmp;
|
|
4852
|
+
}
|
|
4853
|
+
this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
|
|
4704
4854
|
}
|
|
4705
4855
|
else {
|
|
4706
|
-
// Save the starting value, but only once.
|
|
4707
|
-
if (typeof _valuesStart[property] === 'undefined') {
|
|
4856
|
+
// Save the starting value, but only once unless override is requested.
|
|
4857
|
+
if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
|
|
4708
4858
|
_valuesStart[property] = startValue;
|
|
4709
4859
|
}
|
|
4710
4860
|
if (!startValueIsArray) {
|
|
@@ -4746,7 +4896,7 @@
|
|
|
4746
4896
|
return this;
|
|
4747
4897
|
};
|
|
4748
4898
|
Tween.prototype.pause = function (time) {
|
|
4749
|
-
if (time === void 0) { time = now
|
|
4899
|
+
if (time === void 0) { time = now(); }
|
|
4750
4900
|
if (this._isPaused || !this._isPlaying) {
|
|
4751
4901
|
return this;
|
|
4752
4902
|
}
|
|
@@ -4757,7 +4907,7 @@
|
|
|
4757
4907
|
return this;
|
|
4758
4908
|
};
|
|
4759
4909
|
Tween.prototype.resume = function (time) {
|
|
4760
|
-
if (time === void 0) { time = now
|
|
4910
|
+
if (time === void 0) { time = now(); }
|
|
4761
4911
|
if (!this._isPaused || !this._isPlaying) {
|
|
4762
4912
|
return this;
|
|
4763
4913
|
}
|
|
@@ -4775,14 +4925,17 @@
|
|
|
4775
4925
|
return this;
|
|
4776
4926
|
};
|
|
4777
4927
|
Tween.prototype.group = function (group) {
|
|
4928
|
+
if (group === void 0) { group = mainGroup; }
|
|
4778
4929
|
this._group = group;
|
|
4779
4930
|
return this;
|
|
4780
4931
|
};
|
|
4781
4932
|
Tween.prototype.delay = function (amount) {
|
|
4933
|
+
if (amount === void 0) { amount = 0; }
|
|
4782
4934
|
this._delayTime = amount;
|
|
4783
4935
|
return this;
|
|
4784
4936
|
};
|
|
4785
4937
|
Tween.prototype.repeat = function (times) {
|
|
4938
|
+
if (times === void 0) { times = 0; }
|
|
4786
4939
|
this._initialRepeat = times;
|
|
4787
4940
|
this._repeat = times;
|
|
4788
4941
|
return this;
|
|
@@ -4792,17 +4945,21 @@
|
|
|
4792
4945
|
return this;
|
|
4793
4946
|
};
|
|
4794
4947
|
Tween.prototype.yoyo = function (yoyo) {
|
|
4948
|
+
if (yoyo === void 0) { yoyo = false; }
|
|
4795
4949
|
this._yoyo = yoyo;
|
|
4796
4950
|
return this;
|
|
4797
4951
|
};
|
|
4798
4952
|
Tween.prototype.easing = function (easingFunction) {
|
|
4953
|
+
if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
|
|
4799
4954
|
this._easingFunction = easingFunction;
|
|
4800
4955
|
return this;
|
|
4801
4956
|
};
|
|
4802
4957
|
Tween.prototype.interpolation = function (interpolationFunction) {
|
|
4958
|
+
if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
|
|
4803
4959
|
this._interpolationFunction = interpolationFunction;
|
|
4804
4960
|
return this;
|
|
4805
4961
|
};
|
|
4962
|
+
// eslint-disable-next-line
|
|
4806
4963
|
Tween.prototype.chain = function () {
|
|
4807
4964
|
var tweens = [];
|
|
4808
4965
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -4815,6 +4972,10 @@
|
|
|
4815
4972
|
this._onStartCallback = callback;
|
|
4816
4973
|
return this;
|
|
4817
4974
|
};
|
|
4975
|
+
Tween.prototype.onEveryStart = function (callback) {
|
|
4976
|
+
this._onEveryStartCallback = callback;
|
|
4977
|
+
return this;
|
|
4978
|
+
};
|
|
4818
4979
|
Tween.prototype.onUpdate = function (callback) {
|
|
4819
4980
|
this._onUpdateCallback = callback;
|
|
4820
4981
|
return this;
|
|
@@ -4837,7 +4998,7 @@
|
|
|
4837
4998
|
* it is still playing, just paused).
|
|
4838
4999
|
*/
|
|
4839
5000
|
Tween.prototype.update = function (time, autoStart) {
|
|
4840
|
-
if (time === void 0) { time = now
|
|
5001
|
+
if (time === void 0) { time = now(); }
|
|
4841
5002
|
if (autoStart === void 0) { autoStart = true; }
|
|
4842
5003
|
if (this._isPaused)
|
|
4843
5004
|
return true;
|
|
@@ -4848,7 +5009,7 @@
|
|
|
4848
5009
|
if (time > endTime)
|
|
4849
5010
|
return false;
|
|
4850
5011
|
if (autoStart)
|
|
4851
|
-
this.start(time);
|
|
5012
|
+
this.start(time, true);
|
|
4852
5013
|
}
|
|
4853
5014
|
this._goToEnd = false;
|
|
4854
5015
|
if (time < this._startTime) {
|
|
@@ -4860,6 +5021,12 @@
|
|
|
4860
5021
|
}
|
|
4861
5022
|
this._onStartCallbackFired = true;
|
|
4862
5023
|
}
|
|
5024
|
+
if (this._onEveryStartCallbackFired === false) {
|
|
5025
|
+
if (this._onEveryStartCallback) {
|
|
5026
|
+
this._onEveryStartCallback(this._object);
|
|
5027
|
+
}
|
|
5028
|
+
this._onEveryStartCallbackFired = true;
|
|
5029
|
+
}
|
|
4863
5030
|
elapsed = (time - this._startTime) / this._duration;
|
|
4864
5031
|
elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
|
|
4865
5032
|
var value = this._easingFunction(elapsed);
|
|
@@ -4898,6 +5065,7 @@
|
|
|
4898
5065
|
if (this._onRepeatCallback) {
|
|
4899
5066
|
this._onRepeatCallback(this._object);
|
|
4900
5067
|
}
|
|
5068
|
+
this._onEveryStartCallbackFired = false;
|
|
4901
5069
|
return true;
|
|
4902
5070
|
}
|
|
4903
5071
|
else {
|
|
@@ -4907,7 +5075,7 @@
|
|
|
4907
5075
|
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
|
4908
5076
|
// Make the chained tweens start exactly at the time they should,
|
|
4909
5077
|
// even if the `update()` method was called way past the duration of the tween
|
|
4910
|
-
this._chainedTweens[i].start(this._startTime + this._duration);
|
|
5078
|
+
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
|
4911
5079
|
}
|
|
4912
5080
|
this._isPlaying = false;
|
|
4913
5081
|
return false;
|
|
@@ -4953,9 +5121,7 @@
|
|
|
4953
5121
|
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
|
|
4954
5122
|
return start + parseFloat(end);
|
|
4955
5123
|
}
|
|
4956
|
-
|
|
4957
|
-
return parseFloat(end);
|
|
4958
|
-
}
|
|
5124
|
+
return parseFloat(end);
|
|
4959
5125
|
};
|
|
4960
5126
|
Tween.prototype._swapEndStartRepeatValues = function (property) {
|
|
4961
5127
|
var tmp = this._valuesStartRepeat[property];
|
|
@@ -4970,18 +5136,6 @@
|
|
|
4970
5136
|
};
|
|
4971
5137
|
return Tween;
|
|
4972
5138
|
}());
|
|
4973
|
-
|
|
4974
|
-
var VERSION = '18.6.4';
|
|
4975
|
-
|
|
4976
|
-
/**
|
|
4977
|
-
* Tween.js - Licensed under the MIT license
|
|
4978
|
-
* https://github.com/tweenjs/tween.js
|
|
4979
|
-
* ----------------------------------------------
|
|
4980
|
-
*
|
|
4981
|
-
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
|
4982
|
-
* Thank you all, you're awesome!
|
|
4983
|
-
*/
|
|
4984
|
-
var nextId = Sequence.nextId;
|
|
4985
5139
|
/**
|
|
4986
5140
|
* Controlling groups of tweens
|
|
4987
5141
|
*
|
|
@@ -4993,115 +5147,53 @@
|
|
|
4993
5147
|
// Modules and CommonJS, without build hacks, and so as not to break the
|
|
4994
5148
|
// existing API.
|
|
4995
5149
|
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5150
|
+
TWEEN.getAll.bind(TWEEN);
|
|
5151
|
+
TWEEN.removeAll.bind(TWEEN);
|
|
5152
|
+
TWEEN.add.bind(TWEEN);
|
|
5153
|
+
TWEEN.remove.bind(TWEEN);
|
|
5000
5154
|
var update = TWEEN.update.bind(TWEEN);
|
|
5001
|
-
var exports$1 = {
|
|
5002
|
-
Easing: Easing,
|
|
5003
|
-
Group: Group,
|
|
5004
|
-
Interpolation: Interpolation,
|
|
5005
|
-
now: now$1,
|
|
5006
|
-
Sequence: Sequence,
|
|
5007
|
-
nextId: nextId,
|
|
5008
|
-
Tween: Tween,
|
|
5009
|
-
VERSION: VERSION,
|
|
5010
|
-
getAll: getAll,
|
|
5011
|
-
removeAll: removeAll$3,
|
|
5012
|
-
add: add$3,
|
|
5013
|
-
remove: remove,
|
|
5014
|
-
update: update,
|
|
5015
|
-
};
|
|
5016
|
-
|
|
5017
|
-
var TWEEN$1 = exports$1;
|
|
5018
|
-
|
|
5019
|
-
/**
|
|
5020
|
-
* Returns a function, that, as long as it continues to be invoked, will not
|
|
5021
|
-
* be triggered. The function will be called after it stops being called for
|
|
5022
|
-
* N milliseconds. If `immediate` is passed, trigger the function on the
|
|
5023
|
-
* leading edge, instead of the trailing. The function also has a property 'clear'
|
|
5024
|
-
* that is a function which will clear the timer to prevent previously scheduled executions.
|
|
5025
|
-
*
|
|
5026
|
-
* @source underscore.js
|
|
5027
|
-
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
|
|
5028
|
-
* @param {Function} function to wrap
|
|
5029
|
-
* @param {Number} timeout in ms (`100`)
|
|
5030
|
-
* @param {Boolean} whether to execute at the beginning (`false`)
|
|
5031
|
-
* @api public
|
|
5032
|
-
*/
|
|
5033
|
-
|
|
5034
|
-
function debounce(func, wait, immediate){
|
|
5035
|
-
var timeout, args, context, timestamp, result;
|
|
5036
|
-
if (null == wait) wait = 100;
|
|
5037
5155
|
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5156
|
+
function _iterableToArrayLimit$1(arr, i) {
|
|
5157
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
5158
|
+
if (null != _i) {
|
|
5159
|
+
var _s,
|
|
5160
|
+
_e,
|
|
5161
|
+
_x,
|
|
5162
|
+
_r,
|
|
5163
|
+
_arr = [],
|
|
5164
|
+
_n = !0,
|
|
5165
|
+
_d = !1;
|
|
5166
|
+
try {
|
|
5167
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
5168
|
+
if (Object(_i) !== _i) return;
|
|
5169
|
+
_n = !1;
|
|
5170
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
5171
|
+
} catch (err) {
|
|
5172
|
+
_d = !0, _e = err;
|
|
5173
|
+
} finally {
|
|
5174
|
+
try {
|
|
5175
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
5176
|
+
} finally {
|
|
5177
|
+
if (_d) throw _e;
|
|
5048
5178
|
}
|
|
5049
5179
|
}
|
|
5180
|
+
return _arr;
|
|
5050
5181
|
}
|
|
5051
|
-
var debounced = function(){
|
|
5052
|
-
context = this;
|
|
5053
|
-
args = arguments;
|
|
5054
|
-
timestamp = Date.now();
|
|
5055
|
-
var callNow = immediate && !timeout;
|
|
5056
|
-
if (!timeout) timeout = setTimeout(later, wait);
|
|
5057
|
-
if (callNow) {
|
|
5058
|
-
result = func.apply(context, args);
|
|
5059
|
-
context = args = null;
|
|
5060
|
-
}
|
|
5061
|
-
|
|
5062
|
-
return result;
|
|
5063
|
-
};
|
|
5064
|
-
|
|
5065
|
-
debounced.clear = function() {
|
|
5066
|
-
if (timeout) {
|
|
5067
|
-
clearTimeout(timeout);
|
|
5068
|
-
timeout = null;
|
|
5069
|
-
}
|
|
5070
|
-
};
|
|
5071
|
-
|
|
5072
|
-
debounced.flush = function() {
|
|
5073
|
-
if (timeout) {
|
|
5074
|
-
result = func.apply(context, args);
|
|
5075
|
-
context = args = null;
|
|
5076
|
-
|
|
5077
|
-
clearTimeout(timeout);
|
|
5078
|
-
timeout = null;
|
|
5079
|
-
}
|
|
5080
|
-
};
|
|
5081
|
-
|
|
5082
|
-
return debounced;
|
|
5083
5182
|
}
|
|
5084
|
-
// Adds compatibility for ES modules
|
|
5085
|
-
debounce.debounce = debounce;
|
|
5086
|
-
|
|
5087
|
-
var debounce_1 = debounce;
|
|
5088
|
-
|
|
5089
5183
|
function _classCallCheck$1(instance, Constructor) {
|
|
5090
5184
|
if (!(instance instanceof Constructor)) {
|
|
5091
5185
|
throw new TypeError("Cannot call a class as a function");
|
|
5092
5186
|
}
|
|
5093
5187
|
}
|
|
5094
|
-
|
|
5095
5188
|
function _defineProperties$1(target, props) {
|
|
5096
5189
|
for (var i = 0; i < props.length; i++) {
|
|
5097
5190
|
var descriptor = props[i];
|
|
5098
5191
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
5099
5192
|
descriptor.configurable = true;
|
|
5100
5193
|
if ("value" in descriptor) descriptor.writable = true;
|
|
5101
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
5194
|
+
Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
|
|
5102
5195
|
}
|
|
5103
5196
|
}
|
|
5104
|
-
|
|
5105
5197
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
5106
5198
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
5107
5199
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
@@ -5110,45 +5202,12 @@
|
|
|
5110
5202
|
});
|
|
5111
5203
|
return Constructor;
|
|
5112
5204
|
}
|
|
5113
|
-
|
|
5114
5205
|
function _slicedToArray$1(arr, i) {
|
|
5115
5206
|
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$1();
|
|
5116
5207
|
}
|
|
5117
|
-
|
|
5118
5208
|
function _arrayWithHoles$1(arr) {
|
|
5119
5209
|
if (Array.isArray(arr)) return arr;
|
|
5120
5210
|
}
|
|
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
5211
|
function _unsupportedIterableToArray$2(o, minLen) {
|
|
5153
5212
|
if (!o) return;
|
|
5154
5213
|
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
|
|
@@ -5157,50 +5216,57 @@
|
|
|
5157
5216
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
5158
5217
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
|
|
5159
5218
|
}
|
|
5160
|
-
|
|
5161
5219
|
function _arrayLikeToArray$2(arr, len) {
|
|
5162
5220
|
if (len == null || len > arr.length) len = arr.length;
|
|
5163
|
-
|
|
5164
5221
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
5165
|
-
|
|
5166
5222
|
return arr2;
|
|
5167
5223
|
}
|
|
5168
|
-
|
|
5169
5224
|
function _nonIterableRest$1() {
|
|
5170
5225
|
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
5226
|
}
|
|
5227
|
+
function _toPrimitive$2(input, hint) {
|
|
5228
|
+
if (typeof input !== "object" || input === null) return input;
|
|
5229
|
+
var prim = input[Symbol.toPrimitive];
|
|
5230
|
+
if (prim !== undefined) {
|
|
5231
|
+
var res = prim.call(input, hint || "default");
|
|
5232
|
+
if (typeof res !== "object") return res;
|
|
5233
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5234
|
+
}
|
|
5235
|
+
return (hint === "string" ? String : Number)(input);
|
|
5236
|
+
}
|
|
5237
|
+
function _toPropertyKey$2(arg) {
|
|
5238
|
+
var key = _toPrimitive$2(arg, "string");
|
|
5239
|
+
return typeof key === "symbol" ? key : String(key);
|
|
5240
|
+
}
|
|
5172
5241
|
|
|
5173
5242
|
var Prop = /*#__PURE__*/_createClass$1(function Prop(name, _ref) {
|
|
5174
5243
|
var _ref$default = _ref["default"],
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5244
|
+
defaultVal = _ref$default === void 0 ? null : _ref$default,
|
|
5245
|
+
_ref$triggerUpdate = _ref.triggerUpdate,
|
|
5246
|
+
triggerUpdate = _ref$triggerUpdate === void 0 ? true : _ref$triggerUpdate,
|
|
5247
|
+
_ref$onChange = _ref.onChange,
|
|
5248
|
+
onChange = _ref$onChange === void 0 ? function (newVal, state) {} : _ref$onChange;
|
|
5181
5249
|
_classCallCheck$1(this, Prop);
|
|
5182
|
-
|
|
5183
5250
|
this.name = name;
|
|
5184
5251
|
this.defaultVal = defaultVal;
|
|
5185
5252
|
this.triggerUpdate = triggerUpdate;
|
|
5186
5253
|
this.onChange = onChange;
|
|
5187
5254
|
});
|
|
5188
|
-
|
|
5189
5255
|
function index$3 (_ref2) {
|
|
5190
5256
|
var _ref2$stateInit = _ref2.stateInit,
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5257
|
+
stateInit = _ref2$stateInit === void 0 ? function () {
|
|
5258
|
+
return {};
|
|
5259
|
+
} : _ref2$stateInit,
|
|
5260
|
+
_ref2$props = _ref2.props,
|
|
5261
|
+
rawProps = _ref2$props === void 0 ? {} : _ref2$props,
|
|
5262
|
+
_ref2$methods = _ref2.methods,
|
|
5263
|
+
methods = _ref2$methods === void 0 ? {} : _ref2$methods,
|
|
5264
|
+
_ref2$aliases = _ref2.aliases,
|
|
5265
|
+
aliases = _ref2$aliases === void 0 ? {} : _ref2$aliases,
|
|
5266
|
+
_ref2$init = _ref2.init,
|
|
5267
|
+
initFn = _ref2$init === void 0 ? function () {} : _ref2$init,
|
|
5268
|
+
_ref2$update = _ref2.update,
|
|
5269
|
+
updateFn = _ref2$update === void 0 ? function () {} : _ref2$update;
|
|
5204
5270
|
// Parse props into Prop instances
|
|
5205
5271
|
var props = Object.keys(rawProps).map(function (propName) {
|
|
5206
5272
|
return new Prop(propName, rawProps[propName]);
|
|
@@ -5208,98 +5274,94 @@
|
|
|
5208
5274
|
return function () {
|
|
5209
5275
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5210
5276
|
// Holds component state
|
|
5211
|
-
var state = Object.assign({}, stateInit instanceof Function ? stateInit(options) : stateInit,
|
|
5277
|
+
var state = Object.assign({}, stateInit instanceof Function ? stateInit(options) : stateInit,
|
|
5278
|
+
// Support plain objects for backwards compatibility
|
|
5212
5279
|
{
|
|
5213
5280
|
initialised: false
|
|
5214
|
-
});
|
|
5281
|
+
});
|
|
5215
5282
|
|
|
5216
|
-
|
|
5283
|
+
// keeps track of which props triggered an update
|
|
5284
|
+
var changedProps = {};
|
|
5217
5285
|
|
|
5286
|
+
// Component constructor
|
|
5218
5287
|
function comp(nodeElement) {
|
|
5219
5288
|
initStatic(nodeElement, options);
|
|
5220
5289
|
digest();
|
|
5221
5290
|
return comp;
|
|
5222
5291
|
}
|
|
5223
|
-
|
|
5224
5292
|
var initStatic = function initStatic(nodeElement, options) {
|
|
5225
5293
|
initFn.call(comp, nodeElement, state, options);
|
|
5226
5294
|
state.initialised = true;
|
|
5227
5295
|
};
|
|
5228
|
-
|
|
5229
|
-
var digest = debounce_1(function () {
|
|
5296
|
+
var digest = debounce(function () {
|
|
5230
5297
|
if (!state.initialised) {
|
|
5231
5298
|
return;
|
|
5232
5299
|
}
|
|
5233
|
-
|
|
5234
5300
|
updateFn.call(comp, state, changedProps);
|
|
5235
5301
|
changedProps = {};
|
|
5236
|
-
}, 1);
|
|
5302
|
+
}, 1);
|
|
5237
5303
|
|
|
5304
|
+
// Getter/setter methods
|
|
5238
5305
|
props.forEach(function (prop) {
|
|
5239
5306
|
comp[prop.name] = getSetProp(prop);
|
|
5240
|
-
|
|
5241
5307
|
function getSetProp(_ref3) {
|
|
5242
5308
|
var prop = _ref3.name,
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5309
|
+
_ref3$triggerUpdate = _ref3.triggerUpdate,
|
|
5310
|
+
redigest = _ref3$triggerUpdate === void 0 ? false : _ref3$triggerUpdate,
|
|
5311
|
+
_ref3$onChange = _ref3.onChange,
|
|
5312
|
+
onChange = _ref3$onChange === void 0 ? function (newVal, state) {} : _ref3$onChange,
|
|
5313
|
+
_ref3$defaultVal = _ref3.defaultVal,
|
|
5314
|
+
defaultVal = _ref3$defaultVal === void 0 ? null : _ref3$defaultVal;
|
|
5249
5315
|
return function (_) {
|
|
5250
5316
|
var curVal = state[prop];
|
|
5251
|
-
|
|
5252
5317
|
if (!arguments.length) {
|
|
5253
5318
|
return curVal;
|
|
5254
5319
|
} // Getter mode
|
|
5255
5320
|
|
|
5256
|
-
|
|
5257
5321
|
var val = _ === undefined ? defaultVal : _; // pick default if value passed is undefined
|
|
5258
|
-
|
|
5259
5322
|
state[prop] = val;
|
|
5260
|
-
onChange.call(comp, val, state, curVal);
|
|
5323
|
+
onChange.call(comp, val, state, curVal);
|
|
5261
5324
|
|
|
5325
|
+
// track changed props
|
|
5262
5326
|
!changedProps.hasOwnProperty(prop) && (changedProps[prop] = curVal);
|
|
5263
|
-
|
|
5264
5327
|
if (redigest) {
|
|
5265
5328
|
digest();
|
|
5266
5329
|
}
|
|
5267
|
-
|
|
5268
5330
|
return comp;
|
|
5269
5331
|
};
|
|
5270
5332
|
}
|
|
5271
|
-
});
|
|
5333
|
+
});
|
|
5272
5334
|
|
|
5335
|
+
// Other methods
|
|
5273
5336
|
Object.keys(methods).forEach(function (methodName) {
|
|
5274
5337
|
comp[methodName] = function () {
|
|
5275
5338
|
var _methods$methodName;
|
|
5276
|
-
|
|
5277
5339
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5278
5340
|
args[_key] = arguments[_key];
|
|
5279
5341
|
}
|
|
5280
|
-
|
|
5281
5342
|
return (_methods$methodName = methods[methodName]).call.apply(_methods$methodName, [comp, state].concat(args));
|
|
5282
5343
|
};
|
|
5283
|
-
});
|
|
5344
|
+
});
|
|
5284
5345
|
|
|
5346
|
+
// Link aliases
|
|
5285
5347
|
Object.entries(aliases).forEach(function (_ref4) {
|
|
5286
5348
|
var _ref5 = _slicedToArray$1(_ref4, 2),
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5349
|
+
alias = _ref5[0],
|
|
5350
|
+
target = _ref5[1];
|
|
5290
5351
|
return comp[alias] = comp[target];
|
|
5291
|
-
});
|
|
5352
|
+
});
|
|
5292
5353
|
|
|
5354
|
+
// Reset all component props to their default value
|
|
5293
5355
|
comp.resetProps = function () {
|
|
5294
5356
|
props.forEach(function (prop) {
|
|
5295
5357
|
comp[prop.name](prop.defaultVal);
|
|
5296
5358
|
});
|
|
5297
5359
|
return comp;
|
|
5298
|
-
};
|
|
5360
|
+
};
|
|
5299
5361
|
|
|
5362
|
+
//
|
|
5300
5363
|
|
|
5301
5364
|
comp.resetProps(); // Apply all prop defaults
|
|
5302
|
-
|
|
5303
5365
|
state._rerender = digest; // Expose digest method
|
|
5304
5366
|
|
|
5305
5367
|
return comp;
|
|
@@ -5307,7 +5369,7 @@
|
|
|
5307
5369
|
}
|
|
5308
5370
|
|
|
5309
5371
|
var index$2 = (function (p) {
|
|
5310
|
-
return p
|
|
5372
|
+
return typeof p === 'function' ? p // fn
|
|
5311
5373
|
: typeof p === 'string' ? function (obj) {
|
|
5312
5374
|
return obj[p];
|
|
5313
5375
|
} // property name
|
|
@@ -5316,15 +5378,22 @@
|
|
|
5316
5378
|
};
|
|
5317
5379
|
}); // constant
|
|
5318
5380
|
|
|
5319
|
-
|
|
5381
|
+
// This file is autogenerated. It's used to publish ESM to npm.
|
|
5382
|
+
function _typeof(obj) {
|
|
5383
|
+
"@babel/helpers - typeof";
|
|
5384
|
+
|
|
5385
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
5386
|
+
return typeof obj;
|
|
5387
|
+
} : function (obj) {
|
|
5388
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
5389
|
+
}, _typeof(obj);
|
|
5390
|
+
}
|
|
5320
5391
|
|
|
5321
|
-
// This file is autogenerated. It's used to publish ESM to npm.
|
|
5322
5392
|
// https://github.com/bgrins/TinyColor
|
|
5323
5393
|
// Brian Grinstead, MIT License
|
|
5324
5394
|
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5395
|
+
var trimLeft = /^\s+/;
|
|
5396
|
+
var trimRight = /\s+$/;
|
|
5328
5397
|
function tinycolor(color, opts) {
|
|
5329
5398
|
color = color ? color : "";
|
|
5330
5399
|
opts = opts || {};
|
|
@@ -5337,15 +5406,8 @@
|
|
|
5337
5406
|
if (!(this instanceof tinycolor)) {
|
|
5338
5407
|
return new tinycolor(color, opts);
|
|
5339
5408
|
}
|
|
5340
|
-
|
|
5341
5409
|
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);
|
|
5410
|
+
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
5411
|
this._gradientType = opts.gradientType;
|
|
5350
5412
|
|
|
5351
5413
|
// Don't let the range of [0,255] come back in [0,1].
|
|
@@ -5355,194 +5417,140 @@
|
|
|
5355
5417
|
if (this._r < 1) this._r = Math.round(this._r);
|
|
5356
5418
|
if (this._g < 1) this._g = Math.round(this._g);
|
|
5357
5419
|
if (this._b < 1) this._b = Math.round(this._b);
|
|
5358
|
-
|
|
5359
5420
|
this._ok = rgb.ok;
|
|
5360
5421
|
}
|
|
5361
|
-
|
|
5362
5422
|
tinycolor.prototype = {
|
|
5363
|
-
isDark: function () {
|
|
5423
|
+
isDark: function isDark() {
|
|
5364
5424
|
return this.getBrightness() < 128;
|
|
5365
5425
|
},
|
|
5366
|
-
isLight: function () {
|
|
5426
|
+
isLight: function isLight() {
|
|
5367
5427
|
return !this.isDark();
|
|
5368
5428
|
},
|
|
5369
|
-
isValid: function () {
|
|
5429
|
+
isValid: function isValid() {
|
|
5370
5430
|
return this._ok;
|
|
5371
5431
|
},
|
|
5372
|
-
getOriginalInput: function () {
|
|
5432
|
+
getOriginalInput: function getOriginalInput() {
|
|
5373
5433
|
return this._originalInput;
|
|
5374
5434
|
},
|
|
5375
|
-
getFormat: function () {
|
|
5435
|
+
getFormat: function getFormat() {
|
|
5376
5436
|
return this._format;
|
|
5377
5437
|
},
|
|
5378
|
-
getAlpha: function () {
|
|
5438
|
+
getAlpha: function getAlpha() {
|
|
5379
5439
|
return this._a;
|
|
5380
5440
|
},
|
|
5381
|
-
getBrightness: function () {
|
|
5441
|
+
getBrightness: function getBrightness() {
|
|
5382
5442
|
//http://www.w3.org/TR/AERT#color-contrast
|
|
5383
5443
|
var rgb = this.toRgb();
|
|
5384
5444
|
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
5385
5445
|
},
|
|
5386
|
-
getLuminance: function () {
|
|
5446
|
+
getLuminance: function getLuminance() {
|
|
5387
5447
|
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
5388
5448
|
var rgb = this.toRgb();
|
|
5389
5449
|
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
5390
5450
|
RsRGB = rgb.r / 255;
|
|
5391
5451
|
GsRGB = rgb.g / 255;
|
|
5392
5452
|
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);
|
|
5453
|
+
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
5454
|
+
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
5455
|
+
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
5400
5456
|
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
5401
5457
|
},
|
|
5402
|
-
setAlpha: function (value) {
|
|
5458
|
+
setAlpha: function setAlpha(value) {
|
|
5403
5459
|
this._a = boundAlpha(value);
|
|
5404
5460
|
this._roundA = Math.round(100 * this._a) / 100;
|
|
5405
5461
|
return this;
|
|
5406
5462
|
},
|
|
5407
|
-
toHsv: function () {
|
|
5463
|
+
toHsv: function toHsv() {
|
|
5408
5464
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
5409
|
-
return {
|
|
5465
|
+
return {
|
|
5466
|
+
h: hsv.h * 360,
|
|
5467
|
+
s: hsv.s,
|
|
5468
|
+
v: hsv.v,
|
|
5469
|
+
a: this._a
|
|
5470
|
+
};
|
|
5410
5471
|
},
|
|
5411
|
-
toHsvString: function () {
|
|
5472
|
+
toHsvString: function toHsvString() {
|
|
5412
5473
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
5413
5474
|
var h = Math.round(hsv.h * 360),
|
|
5414
5475
|
s = Math.round(hsv.s * 100),
|
|
5415
5476
|
v = Math.round(hsv.v * 100);
|
|
5416
|
-
return this._a == 1
|
|
5417
|
-
? "hsv(" + h + ", " + s + "%, " + v + "%)"
|
|
5418
|
-
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
5477
|
+
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
5419
5478
|
},
|
|
5420
|
-
toHsl: function () {
|
|
5479
|
+
toHsl: function toHsl() {
|
|
5421
5480
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
5422
|
-
return {
|
|
5481
|
+
return {
|
|
5482
|
+
h: hsl.h * 360,
|
|
5483
|
+
s: hsl.s,
|
|
5484
|
+
l: hsl.l,
|
|
5485
|
+
a: this._a
|
|
5486
|
+
};
|
|
5423
5487
|
},
|
|
5424
|
-
toHslString: function () {
|
|
5488
|
+
toHslString: function toHslString() {
|
|
5425
5489
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
5426
5490
|
var h = Math.round(hsl.h * 360),
|
|
5427
5491
|
s = Math.round(hsl.s * 100),
|
|
5428
5492
|
l = Math.round(hsl.l * 100);
|
|
5429
|
-
return this._a == 1
|
|
5430
|
-
? "hsl(" + h + ", " + s + "%, " + l + "%)"
|
|
5431
|
-
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
5493
|
+
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
5432
5494
|
},
|
|
5433
|
-
toHex: function (allow3Char) {
|
|
5495
|
+
toHex: function toHex(allow3Char) {
|
|
5434
5496
|
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
5435
5497
|
},
|
|
5436
|
-
toHexString: function (allow3Char) {
|
|
5498
|
+
toHexString: function toHexString(allow3Char) {
|
|
5437
5499
|
return "#" + this.toHex(allow3Char);
|
|
5438
5500
|
},
|
|
5439
|
-
toHex8: function (allow4Char) {
|
|
5501
|
+
toHex8: function toHex8(allow4Char) {
|
|
5440
5502
|
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
5441
5503
|
},
|
|
5442
|
-
toHex8String: function (allow4Char) {
|
|
5504
|
+
toHex8String: function toHex8String(allow4Char) {
|
|
5443
5505
|
return "#" + this.toHex8(allow4Char);
|
|
5444
5506
|
},
|
|
5445
|
-
toRgb: function () {
|
|
5507
|
+
toRgb: function toRgb() {
|
|
5446
5508
|
return {
|
|
5447
5509
|
r: Math.round(this._r),
|
|
5448
5510
|
g: Math.round(this._g),
|
|
5449
5511
|
b: Math.round(this._b),
|
|
5450
|
-
a: this._a
|
|
5512
|
+
a: this._a
|
|
5451
5513
|
};
|
|
5452
5514
|
},
|
|
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
|
-
")";
|
|
5515
|
+
toRgbString: function toRgbString() {
|
|
5516
|
+
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
5517
|
},
|
|
5472
|
-
toPercentageRgb: function () {
|
|
5518
|
+
toPercentageRgb: function toPercentageRgb() {
|
|
5473
5519
|
return {
|
|
5474
5520
|
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
5475
5521
|
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
5476
5522
|
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
5477
|
-
a: this._a
|
|
5523
|
+
a: this._a
|
|
5478
5524
|
};
|
|
5479
5525
|
},
|
|
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
|
-
")";
|
|
5526
|
+
toPercentageRgbString: function toPercentageRgbString() {
|
|
5527
|
+
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
5528
|
},
|
|
5499
|
-
toName: function () {
|
|
5529
|
+
toName: function toName() {
|
|
5500
5530
|
if (this._a === 0) {
|
|
5501
5531
|
return "transparent";
|
|
5502
5532
|
}
|
|
5503
|
-
|
|
5504
5533
|
if (this._a < 1) {
|
|
5505
5534
|
return false;
|
|
5506
5535
|
}
|
|
5507
|
-
|
|
5508
5536
|
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
5509
5537
|
},
|
|
5510
|
-
toFilter: function (secondColor) {
|
|
5538
|
+
toFilter: function toFilter(secondColor) {
|
|
5511
5539
|
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
5512
5540
|
var secondHex8String = hex8String;
|
|
5513
5541
|
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
5514
|
-
|
|
5515
5542
|
if (secondColor) {
|
|
5516
5543
|
var s = tinycolor(secondColor);
|
|
5517
5544
|
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
5518
5545
|
}
|
|
5519
|
-
|
|
5520
|
-
return (
|
|
5521
|
-
"progid:DXImageTransform.Microsoft.gradient(" +
|
|
5522
|
-
gradientType +
|
|
5523
|
-
"startColorstr=" +
|
|
5524
|
-
hex8String +
|
|
5525
|
-
",endColorstr=" +
|
|
5526
|
-
secondHex8String +
|
|
5527
|
-
")"
|
|
5528
|
-
);
|
|
5546
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
5529
5547
|
},
|
|
5530
|
-
toString: function (format) {
|
|
5548
|
+
toString: function toString(format) {
|
|
5531
5549
|
var formatSet = !!format;
|
|
5532
5550
|
format = format || this._format;
|
|
5533
|
-
|
|
5534
5551
|
var formattedString = false;
|
|
5535
5552
|
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
|
-
|
|
5553
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
5546
5554
|
if (needsAlphaFormat) {
|
|
5547
5555
|
// Special case for "transparent", all other non-alpha formats
|
|
5548
5556
|
// will return rgba when there is transparency.
|
|
@@ -5578,14 +5586,12 @@
|
|
|
5578
5586
|
if (format === "hsv") {
|
|
5579
5587
|
formattedString = this.toHsvString();
|
|
5580
5588
|
}
|
|
5581
|
-
|
|
5582
5589
|
return formattedString || this.toHexString();
|
|
5583
5590
|
},
|
|
5584
|
-
clone: function () {
|
|
5591
|
+
clone: function clone() {
|
|
5585
5592
|
return tinycolor(this.toString());
|
|
5586
5593
|
},
|
|
5587
|
-
|
|
5588
|
-
_applyModification: function (fn, args) {
|
|
5594
|
+
_applyModification: function _applyModification(fn, args) {
|
|
5589
5595
|
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
5590
5596
|
this._r = color._r;
|
|
5591
5597
|
this._g = color._g;
|
|
@@ -5593,59 +5599,58 @@
|
|
|
5593
5599
|
this.setAlpha(color._a);
|
|
5594
5600
|
return this;
|
|
5595
5601
|
},
|
|
5596
|
-
lighten: function () {
|
|
5597
|
-
return this._applyModification(
|
|
5602
|
+
lighten: function lighten() {
|
|
5603
|
+
return this._applyModification(_lighten, arguments);
|
|
5598
5604
|
},
|
|
5599
|
-
brighten: function () {
|
|
5600
|
-
return this._applyModification(
|
|
5605
|
+
brighten: function brighten() {
|
|
5606
|
+
return this._applyModification(_brighten, arguments);
|
|
5601
5607
|
},
|
|
5602
|
-
darken: function () {
|
|
5603
|
-
return this._applyModification(
|
|
5608
|
+
darken: function darken() {
|
|
5609
|
+
return this._applyModification(_darken, arguments);
|
|
5604
5610
|
},
|
|
5605
|
-
desaturate: function () {
|
|
5606
|
-
return this._applyModification(
|
|
5611
|
+
desaturate: function desaturate() {
|
|
5612
|
+
return this._applyModification(_desaturate, arguments);
|
|
5607
5613
|
},
|
|
5608
|
-
saturate: function () {
|
|
5609
|
-
return this._applyModification(
|
|
5614
|
+
saturate: function saturate() {
|
|
5615
|
+
return this._applyModification(_saturate, arguments);
|
|
5610
5616
|
},
|
|
5611
|
-
greyscale: function () {
|
|
5612
|
-
return this._applyModification(
|
|
5617
|
+
greyscale: function greyscale() {
|
|
5618
|
+
return this._applyModification(_greyscale, arguments);
|
|
5613
5619
|
},
|
|
5614
|
-
spin: function () {
|
|
5615
|
-
return this._applyModification(
|
|
5620
|
+
spin: function spin() {
|
|
5621
|
+
return this._applyModification(_spin, arguments);
|
|
5616
5622
|
},
|
|
5617
|
-
|
|
5618
|
-
_applyCombination: function (fn, args) {
|
|
5623
|
+
_applyCombination: function _applyCombination(fn, args) {
|
|
5619
5624
|
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
5620
5625
|
},
|
|
5621
|
-
analogous: function () {
|
|
5622
|
-
return this._applyCombination(
|
|
5626
|
+
analogous: function analogous() {
|
|
5627
|
+
return this._applyCombination(_analogous, arguments);
|
|
5623
5628
|
},
|
|
5624
|
-
complement: function () {
|
|
5625
|
-
return this._applyCombination(
|
|
5629
|
+
complement: function complement() {
|
|
5630
|
+
return this._applyCombination(_complement, arguments);
|
|
5626
5631
|
},
|
|
5627
|
-
monochromatic: function () {
|
|
5628
|
-
return this._applyCombination(
|
|
5632
|
+
monochromatic: function monochromatic() {
|
|
5633
|
+
return this._applyCombination(_monochromatic, arguments);
|
|
5629
5634
|
},
|
|
5630
|
-
splitcomplement: function () {
|
|
5631
|
-
return this._applyCombination(
|
|
5635
|
+
splitcomplement: function splitcomplement() {
|
|
5636
|
+
return this._applyCombination(_splitcomplement, arguments);
|
|
5632
5637
|
},
|
|
5633
5638
|
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
5634
5639
|
// polyad: function (number) {
|
|
5635
5640
|
// return this._applyCombination(polyad, [number]);
|
|
5636
5641
|
// },
|
|
5637
|
-
triad: function () {
|
|
5642
|
+
triad: function triad() {
|
|
5638
5643
|
return this._applyCombination(polyad, [3]);
|
|
5639
5644
|
},
|
|
5640
|
-
tetrad: function () {
|
|
5645
|
+
tetrad: function tetrad() {
|
|
5641
5646
|
return this._applyCombination(polyad, [4]);
|
|
5642
|
-
}
|
|
5647
|
+
}
|
|
5643
5648
|
};
|
|
5644
5649
|
|
|
5645
5650
|
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
5646
5651
|
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
5647
5652
|
tinycolor.fromRatio = function (color, opts) {
|
|
5648
|
-
if (
|
|
5653
|
+
if (_typeof(color) == "object") {
|
|
5649
5654
|
var newColor = {};
|
|
5650
5655
|
for (var i in color) {
|
|
5651
5656
|
if (color.hasOwnProperty(i)) {
|
|
@@ -5658,7 +5663,6 @@
|
|
|
5658
5663
|
}
|
|
5659
5664
|
color = newColor;
|
|
5660
5665
|
}
|
|
5661
|
-
|
|
5662
5666
|
return tinycolor(color, opts);
|
|
5663
5667
|
};
|
|
5664
5668
|
|
|
@@ -5678,63 +5682,50 @@
|
|
|
5678
5682
|
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
5679
5683
|
//
|
|
5680
5684
|
function inputToRGB(color) {
|
|
5681
|
-
var rgb = {
|
|
5685
|
+
var rgb = {
|
|
5686
|
+
r: 0,
|
|
5687
|
+
g: 0,
|
|
5688
|
+
b: 0
|
|
5689
|
+
};
|
|
5682
5690
|
var a = 1;
|
|
5683
5691
|
var s = null;
|
|
5684
5692
|
var v = null;
|
|
5685
5693
|
var l = null;
|
|
5686
5694
|
var ok = false;
|
|
5687
5695
|
var format = false;
|
|
5688
|
-
|
|
5689
5696
|
if (typeof color == "string") {
|
|
5690
5697
|
color = stringInputToObject(color);
|
|
5691
5698
|
}
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
if (
|
|
5695
|
-
isValidCSSUnit(color.r) &&
|
|
5696
|
-
isValidCSSUnit(color.g) &&
|
|
5697
|
-
isValidCSSUnit(color.b)
|
|
5698
|
-
) {
|
|
5699
|
+
if (_typeof(color) == "object") {
|
|
5700
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
5699
5701
|
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
5700
5702
|
ok = true;
|
|
5701
5703
|
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
5702
|
-
} else if (
|
|
5703
|
-
isValidCSSUnit(color.h) &&
|
|
5704
|
-
isValidCSSUnit(color.s) &&
|
|
5705
|
-
isValidCSSUnit(color.v)
|
|
5706
|
-
) {
|
|
5704
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
5707
5705
|
s = convertToPercentage(color.s);
|
|
5708
5706
|
v = convertToPercentage(color.v);
|
|
5709
5707
|
rgb = hsvToRgb(color.h, s, v);
|
|
5710
5708
|
ok = true;
|
|
5711
5709
|
format = "hsv";
|
|
5712
|
-
} else if (
|
|
5713
|
-
isValidCSSUnit(color.h) &&
|
|
5714
|
-
isValidCSSUnit(color.s) &&
|
|
5715
|
-
isValidCSSUnit(color.l)
|
|
5716
|
-
) {
|
|
5710
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
5717
5711
|
s = convertToPercentage(color.s);
|
|
5718
5712
|
l = convertToPercentage(color.l);
|
|
5719
5713
|
rgb = hslToRgb(color.h, s, l);
|
|
5720
5714
|
ok = true;
|
|
5721
5715
|
format = "hsl";
|
|
5722
5716
|
}
|
|
5723
|
-
|
|
5724
5717
|
if (color.hasOwnProperty("a")) {
|
|
5725
5718
|
a = color.a;
|
|
5726
5719
|
}
|
|
5727
5720
|
}
|
|
5728
|
-
|
|
5729
5721
|
a = boundAlpha(a);
|
|
5730
|
-
|
|
5731
5722
|
return {
|
|
5732
5723
|
ok: ok,
|
|
5733
5724
|
format: color.format || format,
|
|
5734
5725
|
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
5735
5726
|
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
5736
5727
|
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
5737
|
-
a: a
|
|
5728
|
+
a: a
|
|
5738
5729
|
};
|
|
5739
5730
|
}
|
|
5740
5731
|
|
|
@@ -5753,7 +5744,7 @@
|
|
|
5753
5744
|
return {
|
|
5754
5745
|
r: bound01(r, 255) * 255,
|
|
5755
5746
|
g: bound01(g, 255) * 255,
|
|
5756
|
-
b: bound01(b, 255) * 255
|
|
5747
|
+
b: bound01(b, 255) * 255
|
|
5757
5748
|
};
|
|
5758
5749
|
}
|
|
5759
5750
|
|
|
@@ -5765,13 +5756,11 @@
|
|
|
5765
5756
|
r = bound01(r, 255);
|
|
5766
5757
|
g = bound01(g, 255);
|
|
5767
5758
|
b = bound01(b, 255);
|
|
5768
|
-
|
|
5769
5759
|
var max = Math.max(r, g, b),
|
|
5770
5760
|
min = Math.min(r, g, b);
|
|
5771
5761
|
var h,
|
|
5772
5762
|
s,
|
|
5773
5763
|
l = (max + min) / 2;
|
|
5774
|
-
|
|
5775
5764
|
if (max == min) {
|
|
5776
5765
|
h = s = 0; // achromatic
|
|
5777
5766
|
} else {
|
|
@@ -5788,11 +5777,13 @@
|
|
|
5788
5777
|
h = (r - g) / d + 4;
|
|
5789
5778
|
break;
|
|
5790
5779
|
}
|
|
5791
|
-
|
|
5792
5780
|
h /= 6;
|
|
5793
5781
|
}
|
|
5794
|
-
|
|
5795
|
-
|
|
5782
|
+
return {
|
|
5783
|
+
h: h,
|
|
5784
|
+
s: s,
|
|
5785
|
+
l: l
|
|
5786
|
+
};
|
|
5796
5787
|
}
|
|
5797
5788
|
|
|
5798
5789
|
// `hslToRgb`
|
|
@@ -5801,11 +5792,9 @@
|
|
|
5801
5792
|
// *Returns:* { r, g, b } in the set [0, 255]
|
|
5802
5793
|
function hslToRgb(h, s, l) {
|
|
5803
5794
|
var r, g, b;
|
|
5804
|
-
|
|
5805
5795
|
h = bound01(h, 360);
|
|
5806
5796
|
s = bound01(s, 100);
|
|
5807
5797
|
l = bound01(l, 100);
|
|
5808
|
-
|
|
5809
5798
|
function hue2rgb(p, q, t) {
|
|
5810
5799
|
if (t < 0) t += 1;
|
|
5811
5800
|
if (t > 1) t -= 1;
|
|
@@ -5814,7 +5803,6 @@
|
|
|
5814
5803
|
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
5815
5804
|
return p;
|
|
5816
5805
|
}
|
|
5817
|
-
|
|
5818
5806
|
if (s === 0) {
|
|
5819
5807
|
r = g = b = l; // achromatic
|
|
5820
5808
|
} else {
|
|
@@ -5824,8 +5812,11 @@
|
|
|
5824
5812
|
g = hue2rgb(p, q, h);
|
|
5825
5813
|
b = hue2rgb(p, q, h - 1 / 3);
|
|
5826
5814
|
}
|
|
5827
|
-
|
|
5828
|
-
|
|
5815
|
+
return {
|
|
5816
|
+
r: r * 255,
|
|
5817
|
+
g: g * 255,
|
|
5818
|
+
b: b * 255
|
|
5819
|
+
};
|
|
5829
5820
|
}
|
|
5830
5821
|
|
|
5831
5822
|
// `rgbToHsv`
|
|
@@ -5836,16 +5827,13 @@
|
|
|
5836
5827
|
r = bound01(r, 255);
|
|
5837
5828
|
g = bound01(g, 255);
|
|
5838
5829
|
b = bound01(b, 255);
|
|
5839
|
-
|
|
5840
5830
|
var max = Math.max(r, g, b),
|
|
5841
5831
|
min = Math.min(r, g, b);
|
|
5842
5832
|
var h,
|
|
5843
5833
|
s,
|
|
5844
5834
|
v = max;
|
|
5845
|
-
|
|
5846
5835
|
var d = max - min;
|
|
5847
5836
|
s = max === 0 ? 0 : d / max;
|
|
5848
|
-
|
|
5849
5837
|
if (max == min) {
|
|
5850
5838
|
h = 0; // achromatic
|
|
5851
5839
|
} else {
|
|
@@ -5862,7 +5850,11 @@
|
|
|
5862
5850
|
}
|
|
5863
5851
|
h /= 6;
|
|
5864
5852
|
}
|
|
5865
|
-
return {
|
|
5853
|
+
return {
|
|
5854
|
+
h: h,
|
|
5855
|
+
s: s,
|
|
5856
|
+
v: v
|
|
5857
|
+
};
|
|
5866
5858
|
}
|
|
5867
5859
|
|
|
5868
5860
|
// `hsvToRgb`
|
|
@@ -5873,7 +5865,6 @@
|
|
|
5873
5865
|
h = bound01(h, 360) * 6;
|
|
5874
5866
|
s = bound01(s, 100);
|
|
5875
5867
|
v = bound01(v, 100);
|
|
5876
|
-
|
|
5877
5868
|
var i = Math.floor(h),
|
|
5878
5869
|
f = h - i,
|
|
5879
5870
|
p = v * (1 - s),
|
|
@@ -5883,8 +5874,11 @@
|
|
|
5883
5874
|
r = [v, q, p, p, t, v][mod],
|
|
5884
5875
|
g = [t, v, v, q, p, p][mod],
|
|
5885
5876
|
b = [p, p, t, v, v, q][mod];
|
|
5886
|
-
|
|
5887
|
-
|
|
5877
|
+
return {
|
|
5878
|
+
r: r * 255,
|
|
5879
|
+
g: g * 255,
|
|
5880
|
+
b: b * 255
|
|
5881
|
+
};
|
|
5888
5882
|
}
|
|
5889
5883
|
|
|
5890
5884
|
// `rgbToHex`
|
|
@@ -5892,22 +5886,12 @@
|
|
|
5892
5886
|
// Assumes r, g, and b are contained in the set [0, 255]
|
|
5893
5887
|
// Returns a 3 or 6 character hex
|
|
5894
5888
|
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
|
-
];
|
|
5889
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
5900
5890
|
|
|
5901
5891
|
// 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
|
-
) {
|
|
5892
|
+
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
5893
|
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
5909
5894
|
}
|
|
5910
|
-
|
|
5911
5895
|
return hex.join("");
|
|
5912
5896
|
}
|
|
5913
5897
|
|
|
@@ -5916,26 +5900,12 @@
|
|
|
5916
5900
|
// Assumes r, g, b are contained in the set [0, 255] and
|
|
5917
5901
|
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
5918
5902
|
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
|
-
];
|
|
5903
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
5925
5904
|
|
|
5926
5905
|
// 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
|
-
);
|
|
5906
|
+
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)) {
|
|
5907
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
5937
5908
|
}
|
|
5938
|
-
|
|
5939
5909
|
return hex.join("");
|
|
5940
5910
|
}
|
|
5941
5911
|
|
|
@@ -5943,13 +5913,7 @@
|
|
|
5943
5913
|
// Converts an RGBA color to an ARGB Hex8 string
|
|
5944
5914
|
// Rarely used, but required for "toFilter()"
|
|
5945
5915
|
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
|
-
|
|
5916
|
+
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
5953
5917
|
return hex.join("");
|
|
5954
5918
|
}
|
|
5955
5919
|
|
|
@@ -5959,12 +5923,11 @@
|
|
|
5959
5923
|
if (!color1 || !color2) return false;
|
|
5960
5924
|
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
5961
5925
|
};
|
|
5962
|
-
|
|
5963
5926
|
tinycolor.random = function () {
|
|
5964
5927
|
return tinycolor.fromRatio({
|
|
5965
5928
|
r: Math.random(),
|
|
5966
5929
|
g: Math.random(),
|
|
5967
|
-
b: Math.random()
|
|
5930
|
+
b: Math.random()
|
|
5968
5931
|
});
|
|
5969
5932
|
};
|
|
5970
5933
|
|
|
@@ -5973,35 +5936,31 @@
|
|
|
5973
5936
|
// Thanks to less.js for some of the basics here
|
|
5974
5937
|
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
5975
5938
|
|
|
5976
|
-
function
|
|
5939
|
+
function _desaturate(color, amount) {
|
|
5977
5940
|
amount = amount === 0 ? 0 : amount || 10;
|
|
5978
5941
|
var hsl = tinycolor(color).toHsl();
|
|
5979
5942
|
hsl.s -= amount / 100;
|
|
5980
5943
|
hsl.s = clamp01(hsl.s);
|
|
5981
5944
|
return tinycolor(hsl);
|
|
5982
5945
|
}
|
|
5983
|
-
|
|
5984
|
-
function saturate(color, amount) {
|
|
5946
|
+
function _saturate(color, amount) {
|
|
5985
5947
|
amount = amount === 0 ? 0 : amount || 10;
|
|
5986
5948
|
var hsl = tinycolor(color).toHsl();
|
|
5987
5949
|
hsl.s += amount / 100;
|
|
5988
5950
|
hsl.s = clamp01(hsl.s);
|
|
5989
5951
|
return tinycolor(hsl);
|
|
5990
5952
|
}
|
|
5991
|
-
|
|
5992
|
-
function greyscale(color) {
|
|
5953
|
+
function _greyscale(color) {
|
|
5993
5954
|
return tinycolor(color).desaturate(100);
|
|
5994
5955
|
}
|
|
5995
|
-
|
|
5996
|
-
function lighten(color, amount) {
|
|
5956
|
+
function _lighten(color, amount) {
|
|
5997
5957
|
amount = amount === 0 ? 0 : amount || 10;
|
|
5998
5958
|
var hsl = tinycolor(color).toHsl();
|
|
5999
5959
|
hsl.l += amount / 100;
|
|
6000
5960
|
hsl.l = clamp01(hsl.l);
|
|
6001
5961
|
return tinycolor(hsl);
|
|
6002
5962
|
}
|
|
6003
|
-
|
|
6004
|
-
function brighten(color, amount) {
|
|
5963
|
+
function _brighten(color, amount) {
|
|
6005
5964
|
amount = amount === 0 ? 0 : amount || 10;
|
|
6006
5965
|
var rgb = tinycolor(color).toRgb();
|
|
6007
5966
|
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
@@ -6009,8 +5968,7 @@
|
|
|
6009
5968
|
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
6010
5969
|
return tinycolor(rgb);
|
|
6011
5970
|
}
|
|
6012
|
-
|
|
6013
|
-
function darken(color, amount) {
|
|
5971
|
+
function _darken(color, amount) {
|
|
6014
5972
|
amount = amount === 0 ? 0 : amount || 10;
|
|
6015
5973
|
var hsl = tinycolor(color).toHsl();
|
|
6016
5974
|
hsl.l -= amount / 100;
|
|
@@ -6020,7 +5978,7 @@
|
|
|
6020
5978
|
|
|
6021
5979
|
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
6022
5980
|
// Values outside of this range will be wrapped into this range.
|
|
6023
|
-
function
|
|
5981
|
+
function _spin(color, amount) {
|
|
6024
5982
|
var hsl = tinycolor(color).toHsl();
|
|
6025
5983
|
var hue = (hsl.h + amount) % 360;
|
|
6026
5984
|
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
@@ -6032,12 +5990,11 @@
|
|
|
6032
5990
|
// Thanks to jQuery xColor for some of the ideas behind these
|
|
6033
5991
|
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
6034
5992
|
|
|
6035
|
-
function
|
|
5993
|
+
function _complement(color) {
|
|
6036
5994
|
var hsl = tinycolor(color).toHsl();
|
|
6037
5995
|
hsl.h = (hsl.h + 180) % 360;
|
|
6038
5996
|
return tinycolor(hsl);
|
|
6039
5997
|
}
|
|
6040
|
-
|
|
6041
5998
|
function polyad(color, number) {
|
|
6042
5999
|
if (isNaN(number) || number <= 0) {
|
|
6043
6000
|
throw new Error("Argument to polyad must be a positive number");
|
|
@@ -6046,38 +6003,40 @@
|
|
|
6046
6003
|
var result = [tinycolor(color)];
|
|
6047
6004
|
var step = 360 / number;
|
|
6048
6005
|
for (var i = 1; i < number; i++) {
|
|
6049
|
-
result.push(tinycolor({
|
|
6006
|
+
result.push(tinycolor({
|
|
6007
|
+
h: (hsl.h + i * step) % 360,
|
|
6008
|
+
s: hsl.s,
|
|
6009
|
+
l: hsl.l
|
|
6010
|
+
}));
|
|
6050
6011
|
}
|
|
6051
|
-
|
|
6052
6012
|
return result;
|
|
6053
6013
|
}
|
|
6054
|
-
|
|
6055
|
-
function splitcomplement(color) {
|
|
6014
|
+
function _splitcomplement(color) {
|
|
6056
6015
|
var hsl = tinycolor(color).toHsl();
|
|
6057
6016
|
var h = hsl.h;
|
|
6058
|
-
return [
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6017
|
+
return [tinycolor(color), tinycolor({
|
|
6018
|
+
h: (h + 72) % 360,
|
|
6019
|
+
s: hsl.s,
|
|
6020
|
+
l: hsl.l
|
|
6021
|
+
}), tinycolor({
|
|
6022
|
+
h: (h + 216) % 360,
|
|
6023
|
+
s: hsl.s,
|
|
6024
|
+
l: hsl.l
|
|
6025
|
+
})];
|
|
6026
|
+
}
|
|
6027
|
+
function _analogous(color, results, slices) {
|
|
6066
6028
|
results = results || 6;
|
|
6067
6029
|
slices = slices || 30;
|
|
6068
|
-
|
|
6069
6030
|
var hsl = tinycolor(color).toHsl();
|
|
6070
6031
|
var part = 360 / slices;
|
|
6071
6032
|
var ret = [tinycolor(color)];
|
|
6072
|
-
|
|
6073
|
-
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
|
|
6033
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
|
|
6074
6034
|
hsl.h = (hsl.h + part) % 360;
|
|
6075
6035
|
ret.push(tinycolor(hsl));
|
|
6076
6036
|
}
|
|
6077
6037
|
return ret;
|
|
6078
6038
|
}
|
|
6079
|
-
|
|
6080
|
-
function monochromatic(color, results) {
|
|
6039
|
+
function _monochromatic(color, results) {
|
|
6081
6040
|
results = results || 6;
|
|
6082
6041
|
var hsv = tinycolor(color).toHsv();
|
|
6083
6042
|
var h = hsv.h,
|
|
@@ -6085,12 +6044,14 @@
|
|
|
6085
6044
|
v = hsv.v;
|
|
6086
6045
|
var ret = [];
|
|
6087
6046
|
var modification = 1 / results;
|
|
6088
|
-
|
|
6089
6047
|
while (results--) {
|
|
6090
|
-
ret.push(tinycolor({
|
|
6048
|
+
ret.push(tinycolor({
|
|
6049
|
+
h: h,
|
|
6050
|
+
s: s,
|
|
6051
|
+
v: v
|
|
6052
|
+
}));
|
|
6091
6053
|
v = (v + modification) % 1;
|
|
6092
6054
|
}
|
|
6093
|
-
|
|
6094
6055
|
return ret;
|
|
6095
6056
|
}
|
|
6096
6057
|
|
|
@@ -6099,19 +6060,15 @@
|
|
|
6099
6060
|
|
|
6100
6061
|
tinycolor.mix = function (color1, color2, amount) {
|
|
6101
6062
|
amount = amount === 0 ? 0 : amount || 50;
|
|
6102
|
-
|
|
6103
6063
|
var rgb1 = tinycolor(color1).toRgb();
|
|
6104
6064
|
var rgb2 = tinycolor(color2).toRgb();
|
|
6105
|
-
|
|
6106
6065
|
var p = amount / 100;
|
|
6107
|
-
|
|
6108
6066
|
var rgba = {
|
|
6109
6067
|
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
6110
6068
|
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
6111
6069
|
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
6112
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
6070
|
+
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
6113
6071
|
};
|
|
6114
|
-
|
|
6115
6072
|
return tinycolor(rgba);
|
|
6116
6073
|
};
|
|
6117
6074
|
|
|
@@ -6124,10 +6081,7 @@
|
|
|
6124
6081
|
tinycolor.readability = function (color1, color2) {
|
|
6125
6082
|
var c1 = tinycolor(color1);
|
|
6126
6083
|
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
|
-
);
|
|
6084
|
+
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
6131
6085
|
};
|
|
6132
6086
|
|
|
6133
6087
|
// `isReadable`
|
|
@@ -6143,9 +6097,7 @@
|
|
|
6143
6097
|
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
6144
6098
|
var readability = tinycolor.readability(color1, color2);
|
|
6145
6099
|
var wcag2Parms, out;
|
|
6146
|
-
|
|
6147
6100
|
out = false;
|
|
6148
|
-
|
|
6149
6101
|
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
6150
6102
|
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
6151
6103
|
case "AAsmall":
|
|
@@ -6180,7 +6132,6 @@
|
|
|
6180
6132
|
includeFallbackColors = args.includeFallbackColors;
|
|
6181
6133
|
level = args.level;
|
|
6182
6134
|
size = args.size;
|
|
6183
|
-
|
|
6184
6135
|
for (var i = 0; i < colorList.length; i++) {
|
|
6185
6136
|
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
6186
6137
|
if (readability > bestScore) {
|
|
@@ -6188,14 +6139,10 @@
|
|
|
6188
6139
|
bestColor = tinycolor(colorList[i]);
|
|
6189
6140
|
}
|
|
6190
6141
|
}
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
size: size,
|
|
6196
|
-
}) ||
|
|
6197
|
-
!includeFallbackColors
|
|
6198
|
-
) {
|
|
6142
|
+
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
6143
|
+
level: level,
|
|
6144
|
+
size: size
|
|
6145
|
+
}) || !includeFallbackColors) {
|
|
6199
6146
|
return bestColor;
|
|
6200
6147
|
} else {
|
|
6201
6148
|
args.includeFallbackColors = false;
|
|
@@ -6206,7 +6153,7 @@
|
|
|
6206
6153
|
// Big List of Colors
|
|
6207
6154
|
// ------------------
|
|
6208
6155
|
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
6209
|
-
var names =
|
|
6156
|
+
var names = tinycolor.names = {
|
|
6210
6157
|
aliceblue: "f0f8ff",
|
|
6211
6158
|
antiquewhite: "faebd7",
|
|
6212
6159
|
aqua: "0ff",
|
|
@@ -6355,11 +6302,11 @@
|
|
|
6355
6302
|
white: "fff",
|
|
6356
6303
|
whitesmoke: "f5f5f5",
|
|
6357
6304
|
yellow: "ff0",
|
|
6358
|
-
yellowgreen: "9acd32"
|
|
6359
|
-
}
|
|
6305
|
+
yellowgreen: "9acd32"
|
|
6306
|
+
};
|
|
6360
6307
|
|
|
6361
6308
|
// Make it easy to access colors via `hexNames[hex]`
|
|
6362
|
-
var hexNames =
|
|
6309
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
6363
6310
|
|
|
6364
6311
|
// Utilities
|
|
6365
6312
|
// ---------
|
|
@@ -6378,18 +6325,15 @@
|
|
|
6378
6325
|
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
6379
6326
|
function boundAlpha(a) {
|
|
6380
6327
|
a = parseFloat(a);
|
|
6381
|
-
|
|
6382
6328
|
if (isNaN(a) || a < 0 || a > 1) {
|
|
6383
6329
|
a = 1;
|
|
6384
6330
|
}
|
|
6385
|
-
|
|
6386
6331
|
return a;
|
|
6387
6332
|
}
|
|
6388
6333
|
|
|
6389
6334
|
// Take input from [0, n] and return it as [0, 1]
|
|
6390
6335
|
function bound01(n, max) {
|
|
6391
6336
|
if (isOnePointZero(n)) n = "100%";
|
|
6392
|
-
|
|
6393
6337
|
var processPercent = isPercentage(n);
|
|
6394
6338
|
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
6395
6339
|
|
|
@@ -6404,7 +6348,7 @@
|
|
|
6404
6348
|
}
|
|
6405
6349
|
|
|
6406
6350
|
// Convert into [0, 1] range if it isn't already
|
|
6407
|
-
return
|
|
6351
|
+
return n % max / parseFloat(max);
|
|
6408
6352
|
}
|
|
6409
6353
|
|
|
6410
6354
|
// Force a number between 0 and 1
|
|
@@ -6438,7 +6382,6 @@
|
|
|
6438
6382
|
if (n <= 1) {
|
|
6439
6383
|
n = n * 100 + "%";
|
|
6440
6384
|
}
|
|
6441
|
-
|
|
6442
6385
|
return n;
|
|
6443
6386
|
}
|
|
6444
6387
|
|
|
@@ -6450,8 +6393,7 @@
|
|
|
6450
6393
|
function convertHexToDecimal(h) {
|
|
6451
6394
|
return parseIntFromHex(h) / 255;
|
|
6452
6395
|
}
|
|
6453
|
-
|
|
6454
|
-
var matchers = (function () {
|
|
6396
|
+
var matchers = function () {
|
|
6455
6397
|
// <http://www.w3.org/TR/css3-values/#integers>
|
|
6456
6398
|
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
6457
6399
|
|
|
@@ -6464,25 +6406,8 @@
|
|
|
6464
6406
|
// Actual matching.
|
|
6465
6407
|
// Parentheses and commas are optional, but not required.
|
|
6466
6408
|
// 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
|
-
|
|
6409
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
6410
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
6486
6411
|
return {
|
|
6487
6412
|
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
6488
6413
|
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
@@ -6494,9 +6419,9 @@
|
|
|
6494
6419
|
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
6495
6420
|
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
6496
6421
|
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})
|
|
6422
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
6498
6423
|
};
|
|
6499
|
-
}
|
|
6424
|
+
}();
|
|
6500
6425
|
|
|
6501
6426
|
// `isValidCSSUnit`
|
|
6502
6427
|
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
@@ -6515,7 +6440,13 @@
|
|
|
6515
6440
|
color = names[color];
|
|
6516
6441
|
named = true;
|
|
6517
6442
|
} else if (color == "transparent") {
|
|
6518
|
-
return {
|
|
6443
|
+
return {
|
|
6444
|
+
r: 0,
|
|
6445
|
+
g: 0,
|
|
6446
|
+
b: 0,
|
|
6447
|
+
a: 0,
|
|
6448
|
+
format: "name"
|
|
6449
|
+
};
|
|
6519
6450
|
}
|
|
6520
6451
|
|
|
6521
6452
|
// Try to match string input using regular expressions.
|
|
@@ -6523,67 +6454,95 @@
|
|
|
6523
6454
|
// Just return an object and let the conversion functions handle that.
|
|
6524
6455
|
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
6525
6456
|
var match;
|
|
6526
|
-
if (
|
|
6527
|
-
return {
|
|
6457
|
+
if (match = matchers.rgb.exec(color)) {
|
|
6458
|
+
return {
|
|
6459
|
+
r: match[1],
|
|
6460
|
+
g: match[2],
|
|
6461
|
+
b: match[3]
|
|
6462
|
+
};
|
|
6528
6463
|
}
|
|
6529
|
-
if (
|
|
6530
|
-
return {
|
|
6464
|
+
if (match = matchers.rgba.exec(color)) {
|
|
6465
|
+
return {
|
|
6466
|
+
r: match[1],
|
|
6467
|
+
g: match[2],
|
|
6468
|
+
b: match[3],
|
|
6469
|
+
a: match[4]
|
|
6470
|
+
};
|
|
6531
6471
|
}
|
|
6532
|
-
if (
|
|
6533
|
-
return {
|
|
6472
|
+
if (match = matchers.hsl.exec(color)) {
|
|
6473
|
+
return {
|
|
6474
|
+
h: match[1],
|
|
6475
|
+
s: match[2],
|
|
6476
|
+
l: match[3]
|
|
6477
|
+
};
|
|
6534
6478
|
}
|
|
6535
|
-
if (
|
|
6536
|
-
return {
|
|
6479
|
+
if (match = matchers.hsla.exec(color)) {
|
|
6480
|
+
return {
|
|
6481
|
+
h: match[1],
|
|
6482
|
+
s: match[2],
|
|
6483
|
+
l: match[3],
|
|
6484
|
+
a: match[4]
|
|
6485
|
+
};
|
|
6537
6486
|
}
|
|
6538
|
-
if (
|
|
6539
|
-
return {
|
|
6487
|
+
if (match = matchers.hsv.exec(color)) {
|
|
6488
|
+
return {
|
|
6489
|
+
h: match[1],
|
|
6490
|
+
s: match[2],
|
|
6491
|
+
v: match[3]
|
|
6492
|
+
};
|
|
6540
6493
|
}
|
|
6541
|
-
if (
|
|
6542
|
-
return {
|
|
6494
|
+
if (match = matchers.hsva.exec(color)) {
|
|
6495
|
+
return {
|
|
6496
|
+
h: match[1],
|
|
6497
|
+
s: match[2],
|
|
6498
|
+
v: match[3],
|
|
6499
|
+
a: match[4]
|
|
6500
|
+
};
|
|
6543
6501
|
}
|
|
6544
|
-
if (
|
|
6502
|
+
if (match = matchers.hex8.exec(color)) {
|
|
6545
6503
|
return {
|
|
6546
6504
|
r: parseIntFromHex(match[1]),
|
|
6547
6505
|
g: parseIntFromHex(match[2]),
|
|
6548
6506
|
b: parseIntFromHex(match[3]),
|
|
6549
6507
|
a: convertHexToDecimal(match[4]),
|
|
6550
|
-
format: named ? "name" : "hex8"
|
|
6508
|
+
format: named ? "name" : "hex8"
|
|
6551
6509
|
};
|
|
6552
6510
|
}
|
|
6553
|
-
if (
|
|
6511
|
+
if (match = matchers.hex6.exec(color)) {
|
|
6554
6512
|
return {
|
|
6555
6513
|
r: parseIntFromHex(match[1]),
|
|
6556
6514
|
g: parseIntFromHex(match[2]),
|
|
6557
6515
|
b: parseIntFromHex(match[3]),
|
|
6558
|
-
format: named ? "name" : "hex"
|
|
6516
|
+
format: named ? "name" : "hex"
|
|
6559
6517
|
};
|
|
6560
6518
|
}
|
|
6561
|
-
if (
|
|
6519
|
+
if (match = matchers.hex4.exec(color)) {
|
|
6562
6520
|
return {
|
|
6563
6521
|
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
6564
6522
|
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
6565
6523
|
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
6566
6524
|
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
6567
|
-
format: named ? "name" : "hex8"
|
|
6525
|
+
format: named ? "name" : "hex8"
|
|
6568
6526
|
};
|
|
6569
6527
|
}
|
|
6570
|
-
if (
|
|
6528
|
+
if (match = matchers.hex3.exec(color)) {
|
|
6571
6529
|
return {
|
|
6572
6530
|
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
6573
6531
|
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
6574
6532
|
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
6575
|
-
format: named ? "name" : "hex"
|
|
6533
|
+
format: named ? "name" : "hex"
|
|
6576
6534
|
};
|
|
6577
6535
|
}
|
|
6578
|
-
|
|
6579
6536
|
return false;
|
|
6580
6537
|
}
|
|
6581
|
-
|
|
6582
6538
|
function validateWCAG2Parms(parms) {
|
|
6583
6539
|
// return valid WCAG2 parms for isReadable.
|
|
6584
6540
|
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
6585
6541
|
var level, size;
|
|
6586
|
-
parms = parms || {
|
|
6542
|
+
parms = parms || {
|
|
6543
|
+
level: "AA",
|
|
6544
|
+
size: "small"
|
|
6545
|
+
};
|
|
6587
6546
|
level = (parms.level || "AA").toUpperCase();
|
|
6588
6547
|
size = (parms.size || "small").toLowerCase();
|
|
6589
6548
|
if (level !== "AA" && level !== "AAA") {
|
|
@@ -6592,7 +6551,10 @@
|
|
|
6592
6551
|
if (size !== "small" && size !== "large") {
|
|
6593
6552
|
size = "small";
|
|
6594
6553
|
}
|
|
6595
|
-
return {
|
|
6554
|
+
return {
|
|
6555
|
+
level: level,
|
|
6556
|
+
size: size
|
|
6557
|
+
};
|
|
6596
6558
|
}
|
|
6597
6559
|
|
|
6598
6560
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -6600,17 +6562,15 @@
|
|
|
6600
6562
|
throw new TypeError("Cannot call a class as a function");
|
|
6601
6563
|
}
|
|
6602
6564
|
}
|
|
6603
|
-
|
|
6604
6565
|
function _defineProperties(target, props) {
|
|
6605
6566
|
for (var i = 0; i < props.length; i++) {
|
|
6606
6567
|
var descriptor = props[i];
|
|
6607
6568
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
6608
6569
|
descriptor.configurable = true;
|
|
6609
6570
|
if ("value" in descriptor) descriptor.writable = true;
|
|
6610
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
6571
|
+
Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
|
|
6611
6572
|
}
|
|
6612
6573
|
}
|
|
6613
|
-
|
|
6614
6574
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
6615
6575
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
6616
6576
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -6619,19 +6579,15 @@
|
|
|
6619
6579
|
});
|
|
6620
6580
|
return Constructor;
|
|
6621
6581
|
}
|
|
6622
|
-
|
|
6623
6582
|
function _toConsumableArray$1(arr) {
|
|
6624
6583
|
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
|
|
6625
6584
|
}
|
|
6626
|
-
|
|
6627
6585
|
function _arrayWithoutHoles$1(arr) {
|
|
6628
6586
|
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
|
|
6629
6587
|
}
|
|
6630
|
-
|
|
6631
6588
|
function _iterableToArray$1(iter) {
|
|
6632
6589
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6633
6590
|
}
|
|
6634
|
-
|
|
6635
6591
|
function _unsupportedIterableToArray$1(o, minLen) {
|
|
6636
6592
|
if (!o) return;
|
|
6637
6593
|
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
@@ -6640,53 +6596,54 @@
|
|
|
6640
6596
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
6641
6597
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
6642
6598
|
}
|
|
6643
|
-
|
|
6644
6599
|
function _arrayLikeToArray$1(arr, len) {
|
|
6645
6600
|
if (len == null || len > arr.length) len = arr.length;
|
|
6646
|
-
|
|
6647
6601
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
6648
|
-
|
|
6649
6602
|
return arr2;
|
|
6650
6603
|
}
|
|
6651
|
-
|
|
6652
6604
|
function _nonIterableSpread$1() {
|
|
6653
6605
|
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
6606
|
}
|
|
6607
|
+
function _toPrimitive$1(input, hint) {
|
|
6608
|
+
if (typeof input !== "object" || input === null) return input;
|
|
6609
|
+
var prim = input[Symbol.toPrimitive];
|
|
6610
|
+
if (prim !== undefined) {
|
|
6611
|
+
var res = prim.call(input, hint || "default");
|
|
6612
|
+
if (typeof res !== "object") return res;
|
|
6613
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
6614
|
+
}
|
|
6615
|
+
return (hint === "string" ? String : Number)(input);
|
|
6616
|
+
}
|
|
6617
|
+
function _toPropertyKey$1(arg) {
|
|
6618
|
+
var key = _toPrimitive$1(arg, "string");
|
|
6619
|
+
return typeof key === "symbol" ? key : String(key);
|
|
6620
|
+
}
|
|
6655
6621
|
|
|
6656
6622
|
var ENTROPY = 123; // Raise numbers to prevent collisions in lower indexes
|
|
6657
6623
|
|
|
6658
6624
|
var int2HexColor = function int2HexColor(num) {
|
|
6659
6625
|
return "#".concat(Math.min(num, Math.pow(2, 24)).toString(16).padStart(6, '0'));
|
|
6660
6626
|
};
|
|
6661
|
-
|
|
6662
6627
|
var rgb2Int = function rgb2Int(r, g, b) {
|
|
6663
6628
|
return (r << 16) + (g << 8) + b;
|
|
6664
6629
|
};
|
|
6665
|
-
|
|
6666
6630
|
var colorStr2Int = function colorStr2Int(str) {
|
|
6667
6631
|
var _tinyColor$toRgb = tinycolor(str).toRgb(),
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6632
|
+
r = _tinyColor$toRgb.r,
|
|
6633
|
+
g = _tinyColor$toRgb.g,
|
|
6634
|
+
b = _tinyColor$toRgb.b;
|
|
6672
6635
|
return rgb2Int(r, g, b);
|
|
6673
6636
|
};
|
|
6674
|
-
|
|
6675
6637
|
var checksum = function checksum(n, csBits) {
|
|
6676
6638
|
return n * ENTROPY % Math.pow(2, csBits);
|
|
6677
6639
|
};
|
|
6678
|
-
|
|
6679
6640
|
var _default = /*#__PURE__*/function () {
|
|
6680
6641
|
function _default() {
|
|
6681
6642
|
var csBits = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
|
|
6682
|
-
|
|
6683
6643
|
_classCallCheck(this, _default);
|
|
6684
|
-
|
|
6685
6644
|
this.csBits = csBits; // How many bits to reserve for checksum. Will eat away into the usable size of the registry.
|
|
6686
|
-
|
|
6687
6645
|
this.registry = ['__reserved for background__']; // indexed objects for rgb lookup;
|
|
6688
6646
|
}
|
|
6689
|
-
|
|
6690
6647
|
_createClass(_default, [{
|
|
6691
6648
|
key: "register",
|
|
6692
6649
|
value: function register(obj) {
|
|
@@ -6708,7 +6665,6 @@
|
|
|
6708
6665
|
if (!n) return null; // 0 index is reserved for background
|
|
6709
6666
|
|
|
6710
6667
|
var idx = n & Math.pow(2, 24 - this.csBits) - 1; // registry index
|
|
6711
|
-
|
|
6712
6668
|
var cs = n >> 24 - this.csBits & Math.pow(2, this.csBits) - 1; // extract bits reserved for checksum
|
|
6713
6669
|
|
|
6714
6670
|
if (checksum(idx, this.csBits) !== cs || idx >= this.registry.length) return null; // failed checksum or registry out of bounds
|
|
@@ -6716,7 +6672,6 @@
|
|
|
6716
6672
|
return this.registry[idx];
|
|
6717
6673
|
}
|
|
6718
6674
|
}]);
|
|
6719
|
-
|
|
6720
6675
|
return _default;
|
|
6721
6676
|
}();
|
|
6722
6677
|
|
|
@@ -6771,7 +6726,7 @@
|
|
|
6771
6726
|
}
|
|
6772
6727
|
|
|
6773
6728
|
function tree_add$2(d) {
|
|
6774
|
-
|
|
6729
|
+
const x = +this._x.call(null, d);
|
|
6775
6730
|
return add$2(this.cover(x), x, d);
|
|
6776
6731
|
}
|
|
6777
6732
|
|
|
@@ -6811,14 +6766,14 @@
|
|
|
6811
6766
|
}
|
|
6812
6767
|
|
|
6813
6768
|
function addAll$2(data) {
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6769
|
+
if (!Array.isArray(data)) data = Array.from(data);
|
|
6770
|
+
const n = data.length;
|
|
6771
|
+
const xz = new Float64Array(n);
|
|
6772
|
+
let x0 = Infinity,
|
|
6818
6773
|
x1 = -Infinity;
|
|
6819
6774
|
|
|
6820
6775
|
// Compute the points and their extent.
|
|
6821
|
-
for (i = 0; i < n; ++i) {
|
|
6776
|
+
for (let i = 0, x; i < n; ++i) {
|
|
6822
6777
|
if (isNaN(x = +this._x.call(null, data[i]))) continue;
|
|
6823
6778
|
xz[i] = x;
|
|
6824
6779
|
if (x < x0) x0 = x;
|
|
@@ -6832,7 +6787,7 @@
|
|
|
6832
6787
|
this.cover(x0).cover(x1);
|
|
6833
6788
|
|
|
6834
6789
|
// Add the new points.
|
|
6835
|
-
for (i = 0; i < n; ++i) {
|
|
6790
|
+
for (let i = 0; i < n; ++i) {
|
|
6836
6791
|
add$2(this, xz[i], data[i]);
|
|
6837
6792
|
}
|
|
6838
6793
|
|
|
@@ -7526,7 +7481,7 @@
|
|
|
7526
7481
|
treeProto$1.y = tree_y$1;
|
|
7527
7482
|
|
|
7528
7483
|
function tree_add(d) {
|
|
7529
|
-
|
|
7484
|
+
const x = +this._x.call(null, d),
|
|
7530
7485
|
y = +this._y.call(null, d),
|
|
7531
7486
|
z = +this._z.call(null, d);
|
|
7532
7487
|
return add(this.cover(x, y, z), x, y, z, d);
|
|
@@ -7584,14 +7539,12 @@
|
|
|
7584
7539
|
}
|
|
7585
7540
|
|
|
7586
7541
|
function addAll(data) {
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
zz = new Array(n),
|
|
7594
|
-
x0 = Infinity,
|
|
7542
|
+
if (!Array.isArray(data)) data = Array.from(data);
|
|
7543
|
+
const n = data.length;
|
|
7544
|
+
const xz = new Float64Array(n);
|
|
7545
|
+
const yz = new Float64Array(n);
|
|
7546
|
+
const zz = new Float64Array(n);
|
|
7547
|
+
let x0 = Infinity,
|
|
7595
7548
|
y0 = Infinity,
|
|
7596
7549
|
z0 = Infinity,
|
|
7597
7550
|
x1 = -Infinity,
|
|
@@ -7599,7 +7552,7 @@
|
|
|
7599
7552
|
z1 = -Infinity;
|
|
7600
7553
|
|
|
7601
7554
|
// Compute the points and their extent.
|
|
7602
|
-
for (i = 0; i < n; ++i) {
|
|
7555
|
+
for (let i = 0, d, x, y, z; i < n; ++i) {
|
|
7603
7556
|
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
7557
|
xz[i] = x;
|
|
7605
7558
|
yz[i] = y;
|
|
@@ -7619,7 +7572,7 @@
|
|
|
7619
7572
|
this.cover(x0, y0, z0).cover(x1, y1, z1);
|
|
7620
7573
|
|
|
7621
7574
|
// Add the new points.
|
|
7622
|
-
for (i = 0; i < n; ++i) {
|
|
7575
|
+
for (let i = 0; i < n; ++i) {
|
|
7623
7576
|
add(this, xz[i], yz[i], zz[i], data[i]);
|
|
7624
7577
|
}
|
|
7625
7578
|
|
|
@@ -9515,6 +9468,7 @@
|
|
|
9515
9468
|
This code is MIT licensed.
|
|
9516
9469
|
**/
|
|
9517
9470
|
|
|
9471
|
+
|
|
9518
9472
|
// math-inlining.
|
|
9519
9473
|
const { abs, min, max, cos, sin, acos, sqrt } = Math;
|
|
9520
9474
|
const pi = Math.PI;
|
|
@@ -9744,7 +9698,7 @@
|
|
|
9744
9698
|
getLUT(steps) {
|
|
9745
9699
|
this.verify();
|
|
9746
9700
|
steps = steps || 100;
|
|
9747
|
-
if (this._lut.length === steps) {
|
|
9701
|
+
if (this._lut.length === steps + 1) {
|
|
9748
9702
|
return this._lut;
|
|
9749
9703
|
}
|
|
9750
9704
|
this._lut = [];
|
|
@@ -10510,31 +10464,51 @@
|
|
|
10510
10464
|
}
|
|
10511
10465
|
}
|
|
10512
10466
|
|
|
10467
|
+
function _iterableToArrayLimit(arr, i) {
|
|
10468
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
10469
|
+
if (null != _i) {
|
|
10470
|
+
var _s,
|
|
10471
|
+
_e,
|
|
10472
|
+
_x,
|
|
10473
|
+
_r,
|
|
10474
|
+
_arr = [],
|
|
10475
|
+
_n = !0,
|
|
10476
|
+
_d = !1;
|
|
10477
|
+
try {
|
|
10478
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
10479
|
+
if (Object(_i) !== _i) return;
|
|
10480
|
+
_n = !1;
|
|
10481
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
10482
|
+
} catch (err) {
|
|
10483
|
+
_d = !0, _e = err;
|
|
10484
|
+
} finally {
|
|
10485
|
+
try {
|
|
10486
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
10487
|
+
} finally {
|
|
10488
|
+
if (_d) throw _e;
|
|
10489
|
+
}
|
|
10490
|
+
}
|
|
10491
|
+
return _arr;
|
|
10492
|
+
}
|
|
10493
|
+
}
|
|
10513
10494
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
10514
10495
|
if (source == null) return {};
|
|
10515
10496
|
var target = {};
|
|
10516
10497
|
var sourceKeys = Object.keys(source);
|
|
10517
10498
|
var key, i;
|
|
10518
|
-
|
|
10519
10499
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
10520
10500
|
key = sourceKeys[i];
|
|
10521
10501
|
if (excluded.indexOf(key) >= 0) continue;
|
|
10522
10502
|
target[key] = source[key];
|
|
10523
10503
|
}
|
|
10524
|
-
|
|
10525
10504
|
return target;
|
|
10526
10505
|
}
|
|
10527
|
-
|
|
10528
10506
|
function _objectWithoutProperties(source, excluded) {
|
|
10529
10507
|
if (source == null) return {};
|
|
10530
|
-
|
|
10531
10508
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
10532
|
-
|
|
10533
10509
|
var key, i;
|
|
10534
|
-
|
|
10535
10510
|
if (Object.getOwnPropertySymbols) {
|
|
10536
10511
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
10537
|
-
|
|
10538
10512
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
10539
10513
|
key = sourceSymbolKeys[i];
|
|
10540
10514
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -10542,60 +10516,23 @@
|
|
|
10542
10516
|
target[key] = source[key];
|
|
10543
10517
|
}
|
|
10544
10518
|
}
|
|
10545
|
-
|
|
10546
10519
|
return target;
|
|
10547
10520
|
}
|
|
10548
|
-
|
|
10549
10521
|
function _slicedToArray(arr, i) {
|
|
10550
10522
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
10551
10523
|
}
|
|
10552
|
-
|
|
10553
10524
|
function _toConsumableArray(arr) {
|
|
10554
10525
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
10555
10526
|
}
|
|
10556
|
-
|
|
10557
10527
|
function _arrayWithoutHoles(arr) {
|
|
10558
10528
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
10559
10529
|
}
|
|
10560
|
-
|
|
10561
10530
|
function _arrayWithHoles(arr) {
|
|
10562
10531
|
if (Array.isArray(arr)) return arr;
|
|
10563
10532
|
}
|
|
10564
|
-
|
|
10565
10533
|
function _iterableToArray(iter) {
|
|
10566
10534
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
10567
10535
|
}
|
|
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
10536
|
function _unsupportedIterableToArray(o, minLen) {
|
|
10600
10537
|
if (!o) return;
|
|
10601
10538
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -10604,39 +10541,29 @@
|
|
|
10604
10541
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
10605
10542
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
10606
10543
|
}
|
|
10607
|
-
|
|
10608
10544
|
function _arrayLikeToArray(arr, len) {
|
|
10609
10545
|
if (len == null || len > arr.length) len = arr.length;
|
|
10610
|
-
|
|
10611
10546
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10612
|
-
|
|
10613
10547
|
return arr2;
|
|
10614
10548
|
}
|
|
10615
|
-
|
|
10616
10549
|
function _nonIterableSpread() {
|
|
10617
10550
|
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
10551
|
}
|
|
10619
|
-
|
|
10620
10552
|
function _nonIterableRest() {
|
|
10621
10553
|
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
10554
|
}
|
|
10623
|
-
|
|
10624
10555
|
function _toPrimitive(input, hint) {
|
|
10625
10556
|
if (typeof input !== "object" || input === null) return input;
|
|
10626
10557
|
var prim = input[Symbol.toPrimitive];
|
|
10627
|
-
|
|
10628
10558
|
if (prim !== undefined) {
|
|
10629
10559
|
var res = prim.call(input, hint || "default");
|
|
10630
10560
|
if (typeof res !== "object") return res;
|
|
10631
10561
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10632
10562
|
}
|
|
10633
|
-
|
|
10634
10563
|
return (hint === "string" ? String : Number)(input);
|
|
10635
10564
|
}
|
|
10636
|
-
|
|
10637
10565
|
function _toPropertyKey(arg) {
|
|
10638
10566
|
var key = _toPrimitive(arg, "string");
|
|
10639
|
-
|
|
10640
10567
|
return typeof key === "symbol" ? key : String(key);
|
|
10641
10568
|
}
|
|
10642
10569
|
|
|
@@ -10656,25 +10583,21 @@
|
|
|
10656
10583
|
var itemVal = item;
|
|
10657
10584
|
keys.forEach(function (_ref, idx) {
|
|
10658
10585
|
var keyAccessor = _ref.keyAccessor,
|
|
10659
|
-
|
|
10586
|
+
isProp = _ref.isProp;
|
|
10660
10587
|
var key;
|
|
10661
|
-
|
|
10662
10588
|
if (isProp) {
|
|
10663
10589
|
var _itemVal = itemVal,
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10590
|
+
propVal = _itemVal[keyAccessor],
|
|
10591
|
+
rest = _objectWithoutProperties(_itemVal, [keyAccessor].map(_toPropertyKey));
|
|
10667
10592
|
key = propVal;
|
|
10668
10593
|
itemVal = rest;
|
|
10669
10594
|
} else {
|
|
10670
10595
|
key = keyAccessor(itemVal, idx);
|
|
10671
10596
|
}
|
|
10672
|
-
|
|
10673
10597
|
if (idx + 1 < keys.length) {
|
|
10674
10598
|
if (!iterObj.hasOwnProperty(key)) {
|
|
10675
10599
|
iterObj[key] = {};
|
|
10676
10600
|
}
|
|
10677
|
-
|
|
10678
10601
|
iterObj = iterObj[key];
|
|
10679
10602
|
} else {
|
|
10680
10603
|
// Leaf key
|
|
@@ -10682,7 +10605,6 @@
|
|
|
10682
10605
|
if (!iterObj.hasOwnProperty(key)) {
|
|
10683
10606
|
iterObj[key] = [];
|
|
10684
10607
|
}
|
|
10685
|
-
|
|
10686
10608
|
iterObj[key].push(itemVal);
|
|
10687
10609
|
} else {
|
|
10688
10610
|
iterObj[key] = itemVal;
|
|
@@ -10691,12 +10613,10 @@
|
|
|
10691
10613
|
});
|
|
10692
10614
|
return res;
|
|
10693
10615
|
}, {});
|
|
10694
|
-
|
|
10695
10616
|
if (multiItem instanceof Function) {
|
|
10696
10617
|
// Reduce leaf multiple values
|
|
10697
10618
|
(function reduce(node) {
|
|
10698
10619
|
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
10699
|
-
|
|
10700
10620
|
if (level === keys.length) {
|
|
10701
10621
|
Object.keys(node).forEach(function (k) {
|
|
10702
10622
|
return node[k] = multiItem(node[k]);
|
|
@@ -10707,18 +10627,14 @@
|
|
|
10707
10627
|
});
|
|
10708
10628
|
}
|
|
10709
10629
|
})(indexedResult); // IIFE
|
|
10710
|
-
|
|
10711
10630
|
}
|
|
10712
10631
|
|
|
10713
10632
|
var result = indexedResult;
|
|
10714
|
-
|
|
10715
10633
|
if (flattenKeys) {
|
|
10716
10634
|
// flatten into array
|
|
10717
10635
|
result = [];
|
|
10718
|
-
|
|
10719
10636
|
(function flatten(node) {
|
|
10720
10637
|
var accKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
10721
|
-
|
|
10722
10638
|
if (accKeys.length === keys.length) {
|
|
10723
10639
|
result.push({
|
|
10724
10640
|
keys: accKeys,
|
|
@@ -10727,21 +10643,18 @@
|
|
|
10727
10643
|
} else {
|
|
10728
10644
|
Object.entries(node).forEach(function (_ref2) {
|
|
10729
10645
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10646
|
+
key = _ref3[0],
|
|
10647
|
+
val = _ref3[1];
|
|
10733
10648
|
return flatten(val, [].concat(_toConsumableArray(accKeys), [key]));
|
|
10734
10649
|
});
|
|
10735
10650
|
}
|
|
10736
10651
|
})(indexedResult); //IIFE
|
|
10737
10652
|
|
|
10738
|
-
|
|
10739
10653
|
if (keyAccessors instanceof Array && keyAccessors.length === 0 && result.length === 1) {
|
|
10740
10654
|
// clear keys if there's no key accessors (single result)
|
|
10741
10655
|
result[0].keys = [];
|
|
10742
10656
|
}
|
|
10743
10657
|
}
|
|
10744
|
-
|
|
10745
10658
|
return result;
|
|
10746
10659
|
});
|
|
10747
10660
|
|
|
@@ -10853,7 +10766,7 @@
|
|
|
10853
10766
|
var targetNode = graph[targetId];
|
|
10854
10767
|
sourceNode.out.push(targetNode);
|
|
10855
10768
|
function getNodeId(node) {
|
|
10856
|
-
return _typeof(node) === 'object' ? idAccessor(node) : node;
|
|
10769
|
+
return _typeof$1(node) === 'object' ? idAccessor(node) : node;
|
|
10857
10770
|
}
|
|
10858
10771
|
});
|
|
10859
10772
|
var foundLoops = [];
|
|
@@ -10912,7 +10825,7 @@
|
|
|
10912
10825
|
var updDataPhotons = function updDataPhotons(_, state) {
|
|
10913
10826
|
if (!state.isShadow) {
|
|
10914
10827
|
// Add photon particles
|
|
10915
|
-
var linkParticlesAccessor =
|
|
10828
|
+
var linkParticlesAccessor = index$2(state.linkDirectionalParticles);
|
|
10916
10829
|
state.graphData.links.forEach(function (link) {
|
|
10917
10830
|
var numPhotons = Math.round(Math.abs(linkParticlesAccessor(link)));
|
|
10918
10831
|
if (numPhotons) {
|
|
@@ -11180,10 +11093,10 @@
|
|
|
11180
11093
|
}
|
|
11181
11094
|
}
|
|
11182
11095
|
function paintNodes() {
|
|
11183
|
-
var getVisibility =
|
|
11184
|
-
var getVal =
|
|
11185
|
-
var getColor =
|
|
11186
|
-
var getNodeCanvasObjectMode =
|
|
11096
|
+
var getVisibility = index$2(state.nodeVisibility);
|
|
11097
|
+
var getVal = index$2(state.nodeVal);
|
|
11098
|
+
var getColor = index$2(state.nodeColor);
|
|
11099
|
+
var getNodeCanvasObjectMode = index$2(state.nodeCanvasObjectMode);
|
|
11187
11100
|
var ctx = state.ctx;
|
|
11188
11101
|
|
|
11189
11102
|
// Draw wider nodes by 1px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
|
|
@@ -11215,12 +11128,12 @@
|
|
|
11215
11128
|
ctx.restore();
|
|
11216
11129
|
}
|
|
11217
11130
|
function paintLinks() {
|
|
11218
|
-
var getVisibility =
|
|
11219
|
-
var getColor =
|
|
11220
|
-
var getWidth =
|
|
11221
|
-
var getLineDash =
|
|
11222
|
-
var getCurvature =
|
|
11223
|
-
var getLinkCanvasObjectMode =
|
|
11131
|
+
var getVisibility = index$2(state.linkVisibility);
|
|
11132
|
+
var getColor = index$2(state.linkColor);
|
|
11133
|
+
var getWidth = index$2(state.linkWidth);
|
|
11134
|
+
var getLineDash = index$2(state.linkLineDash);
|
|
11135
|
+
var getCurvature = index$2(state.linkCurvature);
|
|
11136
|
+
var getLinkCanvasObjectMode = index$2(state.linkCanvasObjectMode);
|
|
11224
11137
|
var ctx = state.ctx;
|
|
11225
11138
|
|
|
11226
11139
|
// Draw wider lines by 2px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
|
|
@@ -11337,11 +11250,11 @@
|
|
|
11337
11250
|
function paintArrows() {
|
|
11338
11251
|
var ARROW_WH_RATIO = 1.6;
|
|
11339
11252
|
var ARROW_VLEN_RATIO = 0.2;
|
|
11340
|
-
var getLength =
|
|
11341
|
-
var getRelPos =
|
|
11342
|
-
var getVisibility =
|
|
11343
|
-
var getColor =
|
|
11344
|
-
var getNodeVal =
|
|
11253
|
+
var getLength = index$2(state.linkDirectionalArrowLength);
|
|
11254
|
+
var getRelPos = index$2(state.linkDirectionalArrowRelPos);
|
|
11255
|
+
var getVisibility = index$2(state.linkVisibility);
|
|
11256
|
+
var getColor = index$2(state.linkDirectionalArrowColor || state.linkColor);
|
|
11257
|
+
var getNodeVal = index$2(state.nodeVal);
|
|
11345
11258
|
var ctx = state.ctx;
|
|
11346
11259
|
ctx.save();
|
|
11347
11260
|
state.graphData.links.filter(getVisibility).forEach(function (link) {
|
|
@@ -11386,11 +11299,11 @@
|
|
|
11386
11299
|
ctx.restore();
|
|
11387
11300
|
}
|
|
11388
11301
|
function paintPhotons() {
|
|
11389
|
-
var getNumPhotons =
|
|
11390
|
-
var getSpeed =
|
|
11391
|
-
var getDiameter =
|
|
11392
|
-
var getVisibility =
|
|
11393
|
-
var getColor =
|
|
11302
|
+
var getNumPhotons = index$2(state.linkDirectionalParticles);
|
|
11303
|
+
var getSpeed = index$2(state.linkDirectionalParticleSpeed);
|
|
11304
|
+
var getDiameter = index$2(state.linkDirectionalParticleWidth);
|
|
11305
|
+
var getVisibility = index$2(state.linkVisibility);
|
|
11306
|
+
var getColor = index$2(state.linkDirectionalParticleColor || state.linkColor);
|
|
11394
11307
|
var ctx = state.ctx;
|
|
11395
11308
|
ctx.save();
|
|
11396
11309
|
state.graphData.links.filter(getVisibility).forEach(function (link) {
|
|
@@ -11473,11 +11386,11 @@
|
|
|
11473
11386
|
state.onUpdate();
|
|
11474
11387
|
if (state.nodeAutoColorBy !== null) {
|
|
11475
11388
|
// Auto add color to uncolored nodes
|
|
11476
|
-
autoColorObjects(state.graphData.nodes,
|
|
11389
|
+
autoColorObjects(state.graphData.nodes, index$2(state.nodeAutoColorBy), state.nodeColor);
|
|
11477
11390
|
}
|
|
11478
11391
|
if (state.linkAutoColorBy !== null) {
|
|
11479
11392
|
// Auto add color to uncolored links
|
|
11480
|
-
autoColorObjects(state.graphData.links,
|
|
11393
|
+
autoColorObjects(state.graphData.links, index$2(state.linkAutoColorBy), state.linkColor);
|
|
11481
11394
|
}
|
|
11482
11395
|
|
|
11483
11396
|
// parse links
|
|
@@ -11842,7 +11755,7 @@
|
|
|
11842
11755
|
// no animation
|
|
11843
11756
|
setCenter(finalPos);
|
|
11844
11757
|
} else {
|
|
11845
|
-
new
|
|
11758
|
+
new Tween(getCenter()).to(finalPos, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(setCenter).start();
|
|
11846
11759
|
}
|
|
11847
11760
|
return this;
|
|
11848
11761
|
}
|
|
@@ -11875,11 +11788,11 @@
|
|
|
11875
11788
|
// no animation
|
|
11876
11789
|
setZoom(k);
|
|
11877
11790
|
} else {
|
|
11878
|
-
new
|
|
11791
|
+
new Tween({
|
|
11879
11792
|
k: getZoom()
|
|
11880
11793
|
}).to({
|
|
11881
11794
|
k: k
|
|
11882
|
-
}, transitionDuration).easing(
|
|
11795
|
+
}, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(function (_ref6) {
|
|
11883
11796
|
var k = _ref6.k;
|
|
11884
11797
|
return setZoom(k);
|
|
11885
11798
|
}).start();
|
|
@@ -11922,7 +11835,7 @@
|
|
|
11922
11835
|
var nodeFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
11923
11836
|
return true;
|
|
11924
11837
|
};
|
|
11925
|
-
var getVal =
|
|
11838
|
+
var getVal = index$2(state.nodeVal);
|
|
11926
11839
|
var getR = function getR(node) {
|
|
11927
11840
|
return Math.sqrt(Math.max(0, getVal(node) || 1)) * state.nodeRelSize;
|
|
11928
11841
|
};
|
|
@@ -12216,13 +12129,13 @@
|
|
|
12216
12129
|
|
|
12217
12130
|
//
|
|
12218
12131
|
|
|
12219
|
-
var refreshShadowCanvas = throttle
|
|
12132
|
+
var refreshShadowCanvas = throttle(function () {
|
|
12220
12133
|
// wipe canvas
|
|
12221
12134
|
clearCanvas(shadowCtx, state.width, state.height);
|
|
12222
12135
|
|
|
12223
12136
|
// Adjust link hover area
|
|
12224
12137
|
state.shadowGraph.linkWidth(function (l) {
|
|
12225
|
-
return
|
|
12138
|
+
return index$2(state.linkWidth)(l) + state.linkHoverPrecision;
|
|
12226
12139
|
});
|
|
12227
12140
|
|
|
12228
12141
|
// redraw
|
|
@@ -12255,7 +12168,7 @@
|
|
|
12255
12168
|
var _fn2 = state["on".concat(objType, "Hover")];
|
|
12256
12169
|
_fn2 && _fn2(obj.d, prevObjType === objType ? prevObj.d : null);
|
|
12257
12170
|
}
|
|
12258
|
-
var tooltipContent = obj ?
|
|
12171
|
+
var tooltipContent = obj ? index$2(state["".concat(obj.type.toLowerCase(), "Label")])(obj.d) || '' : '';
|
|
12259
12172
|
toolTipElem.style.visibility = tooltipContent ? 'visible' : 'hidden';
|
|
12260
12173
|
toolTipElem.innerHTML = tooltipContent;
|
|
12261
12174
|
|
|
@@ -12275,7 +12188,7 @@
|
|
|
12275
12188
|
state.forceGraph.globalScale(globalScale).tickFrame();
|
|
12276
12189
|
state.onRenderFramePost && state.onRenderFramePost(ctx, globalScale);
|
|
12277
12190
|
}
|
|
12278
|
-
|
|
12191
|
+
update(); // update canvas animation tweens
|
|
12279
12192
|
|
|
12280
12193
|
state.animationFrameRequestId = requestAnimationFrame(animate);
|
|
12281
12194
|
})();
|