@cccsaurora/clue-ui 1.2.4-patch.275 → 1.2.5-dev.298
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/ActionForm-D6gYuFRR.js +5970 -0
- package/AnnotationDetails-Zx4pjBiN.js +175 -0
- package/AnnotationPreview-Dmz7taAU.js +188 -0
- package/ClueEnrichContext-CJEJxrgs.js +541 -0
- package/FlexOne-BSYAhhtG.js +9 -0
- package/_MapCache-WmuDdwuH.js +222 -0
- package/_Uint8Array-B7JqpgFX.js +128 -0
- package/_baseAssignValue-CGTuELqU.js +25 -0
- package/_baseClone-CkNrTyhm.js +283 -0
- package/_baseExtremum-kob8QXyt.js +18 -0
- package/_baseFlatten-jIR_sN_-.js +92 -0
- package/_baseGet-Bx3A4Qfp.js +108 -0
- package/_baseIsEqual-C5OTWzTk.js +208 -0
- package/_baseIteratee-avi7MX2o.js +126 -0
- package/_baseSlice-GAv_YFTT.js +20 -0
- package/_baseSum-D0WC1dN0.js +13 -0
- package/_baseUniq-BI9GIHMF.js +115 -0
- package/_commonjsHelpers-DWwsNxpa.js +8 -0
- package/_createAggregator-QD8MzKwe.js +63 -0
- package/_getPrototype-CU0j_POw.js +5 -0
- package/_getTag-Ckxxfr88.js +126 -0
- package/_isIterateeCall-Ds3sw2SF.js +17 -0
- package/_setToArray-CaPKQhcz.js +33 -0
- package/cloneDeep-DJrLSw8W.js +8 -0
- package/components/AnnotationBody.js +49 -35
- package/components/AnnotationDetailPopover.js +36 -30
- package/components/AnnotationDetails.js +7 -7
- package/components/AnnotationEntry.js +35 -35
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +110 -97
- package/components/EnrichedChip.js +130 -105
- package/components/EnrichedTypography.js +133 -107
- package/components/ErrorBoundary.js +28 -24
- package/components/RetryFailedEnrichments.js +10 -9
- package/components/SourcePicker.js +57 -49
- package/components/actions/ActionForm.js +4 -4
- package/components/actions/ExecutePopover.js +75 -59
- package/components/actions/ResultModal.js +4 -4
- package/components/actions/form/schemaAdapter.js +39 -23
- package/components/actions/formats/FileResult.js +86 -59
- package/components/actions/formats/index.js +21 -10
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +111 -91
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +261 -202
- package/components/display/graph/visualizations/Leaf.js +88 -69
- package/components/display/graph/visualizations/cloud/index.js +98 -81
- package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
- package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
- package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
- package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
- package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
- package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
- package/components/display/graph/visualizations/icons/index.js +14 -13
- package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
- package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
- package/components/display/graph/visualizations/tree/Triangle.js +13 -13
- package/components/display/graph/visualizations/tree/index.js +408 -306
- package/components/display/icons/Iconified.js +27 -12
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/index.js +8678 -5770
- package/components/enrichment/EnrichPopover.js +54 -46
- package/components/fetchers/Fetcher.js +158 -119
- package/components/fetchers/PreviewModal.js +20 -17
- package/components/fetchers/StatusChip.js +21 -17
- package/components/group/Entry.js +13 -11
- package/components/group/Group.js +13 -10
- package/components/group/GroupControl.js +76 -65
- package/components/stats/QueryStatus.js +43 -33
- package/countBy-c6S3dvSW.js +14 -0
- package/data/event.js +6 -4
- package/database/index.js +2 -2
- package/debounce-bV0h5FC5.js +92 -0
- package/get-DSsNkRQs.js +8 -0
- package/groupBy-xqz-n0Vd.js +14 -0
- package/hooks/ClueActionContext.d.ts +10 -2
- package/hooks/ClueActionContext.js +6 -6
- package/hooks/ClueComponentContext.js +29 -23
- package/hooks/ClueConfigProvider.js +14 -12
- package/hooks/ClueDatabaseContext.js +19 -13
- package/hooks/ClueEnrichContext.js +8 -8
- package/hooks/ClueFetcherContext.js +83 -56
- package/hooks/ClueGroupContext.js +17 -14
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +12 -10
- package/hooks/selectors.js +7 -7
- package/hooks/useActionResult.d.ts +1 -0
- package/hooks/useActionResult.js +3 -3
- package/hooks/useAnnotations.js +47 -31
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +6 -4
- package/hooks/useClueTypeConfig.js +3 -3
- package/hooks/useComparator.js +722 -435
- package/hooks/useErrors.js +22 -18
- package/hooks/useFetcherResult.d.ts +1 -0
- package/hooks/useFetcherResult.js +33 -24
- package/hooks/useMyHighlights.js +66 -36
- package/hooks/useMyLocalStorage.js +66 -37
- package/iconify-CXMreGTg.js +1782 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +85 -69
- package/icons/Context.js +77 -63
- package/icons/Opinion.js +76 -60
- package/icons/iconMap.js +2 -2
- package/identity-CPGTqrE4.js +6 -0
- package/index-AMfoEg_6.js +696 -0
- package/index-B6C2a_Lg.js +1172 -0
- package/index-C12gPw2W.js +17698 -0
- package/index-DCKkHTvx.js +15750 -0
- package/index-JcKyZeoY.js +465 -0
- package/isNil-CIubwp4T.js +6 -0
- package/isObject-FTY-5JQX.js +7 -0
- package/isObjectLike-OAgjjZye.js +48 -0
- package/isSymbol-Xd2FsJyp.js +8 -0
- package/last-CUCl67Im.js +7 -0
- package/main.js +60 -60
- package/maxBy-IKHzFrCS.js +8 -0
- package/package.json +1 -1
- package/sortBy-DfSj8IoJ.js +96 -0
- package/sumBy-D-hb_NY-.js +8 -0
- package/text/Frequency.js +42 -23
- package/toFinite-Bc55msYj.js +16 -0
- package/toNumber-DPxy1FBy.js +39 -0
- package/types/RunningActionData.d.ts +1 -0
- package/types/WithActionData.d.ts +1 -0
- package/useClueTypeConfig-Z1LFp01b.js +3289 -0
- package/utils/chain.js +92 -65
- package/utils/classificationParser.js +519 -256
- package/utils/constants.js +35 -10
- package/utils/graph.js +72 -45
- package/utils/hashUtil.js +7 -7
- package/utils/line.js +131 -81
- package/utils/loggerUtil.js +5 -3
- package/utils/sessionStorage.js +41 -27
- package/utils/time.js +423 -423
- package/utils/utils.js +9 -9
- package/utils/window.js +21 -10
- package/utils-HmNPuoDB.js +199 -0
- package/ActionForm-CwsfB99X.js +0 -4458
- package/AnnotationDetails-Bw2JdtTL.js +0 -160
- package/AnnotationPreview-BO7rVnOP.js +0 -140
- package/ClueEnrichContext-KqRuuWNS.js +0 -418
- package/FlexOne-BXWFOd1T.js +0 -6
- package/_MapCache-BiTi0iqu.js +0 -180
- package/_Uint8Array-BQNOM9Rr.js +0 -101
- package/_baseAssignValue-CNMLQZco.js +0 -20
- package/_baseClone-BnT-6pyM.js +0 -207
- package/_baseExtremum-Ca2EHgy2.js +0 -16
- package/_baseFlatten-Bfr_Molw.js +0 -72
- package/_baseGet-DSZygzyq.js +0 -79
- package/_baseIsEqual-VgvaAFZG.js +0 -147
- package/_baseIteratee-Dbfsw5z8.js +0 -95
- package/_baseSlice-M5RKzt1A.js +0 -10
- package/_baseSum-wEbgNeUs.js +0 -10
- package/_baseUniq-BJcj69PL.js +0 -79
- package/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/_createAggregator-k3TuAnxT.js +0 -53
- package/_getPrototype-Cr1Mk7BC.js +0 -5
- package/_getTag-CK2Sffaq.js +0 -90
- package/_isIterateeCall-DkJP7Rbx.js +0 -13
- package/_setToArray-C7yMOeww.js +0 -29
- package/cloneDeep-CF8TtLHr.js +0 -8
- package/countBy-CdYegFSu.js +0 -8
- package/debounce-DryYcbJ4.js +0 -56
- package/get-CH7kz5Ix.js +0 -8
- package/groupBy-br8xmD2R.js +0 -8
- package/iconify-BBckr5AQ.js +0 -1263
- package/identity-ByMq8VxU.js +0 -6
- package/index-BHAe_V9n.js +0 -12768
- package/index-BK-zfYhR.js +0 -358
- package/index-CA5CUNZO.js +0 -975
- package/index-Dj5C04IX.js +0 -568
- package/index-p5_wX7q1.js +0 -11729
- package/isNil-CjWwlQS3.js +0 -6
- package/isObject-B53jY8Qg.js +0 -7
- package/isObjectLike-BatpeCIi.js +0 -29
- package/isSymbol-C3_SC0Qp.js +0 -8
- package/last-7CdUxN0r.js +0 -7
- package/maxBy-Bc0dYHcO.js +0 -8
- package/sortBy-DY2JBf9n.js +0 -75
- package/sumBy-DuMASLPd.js +0 -8
- package/toFinite-BMy6GObD.js +0 -14
- package/toNumber-YVhnnJv4.js +0 -31
- package/useClueTypeConfig-Ct9Ygter.js +0 -2292
- package/utils-DmwSUrum.js +0 -129
package/hooks/useComparator.js
CHANGED
|
@@ -1,92 +1,116 @@
|
|
|
1
|
-
import { useTheme
|
|
2
|
-
import { g as
|
|
3
|
-
import { i as
|
|
4
|
-
function
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
import { g as get } from "../get-DSsNkRQs.js";
|
|
3
|
+
import { i as isNil } from "../isNil-CIubwp4T.js";
|
|
4
|
+
function _typeof(obj) {
|
|
5
5
|
"@babel/helpers - typeof";
|
|
6
|
-
return
|
|
7
|
-
return typeof
|
|
8
|
-
} : function(
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
}
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
7
|
+
return typeof obj2;
|
|
8
|
+
} : function(obj2) {
|
|
9
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
10
|
+
}, _typeof(obj);
|
|
11
|
+
}
|
|
12
|
+
var trimLeft = /^\s+/;
|
|
13
|
+
var trimRight = /\s+$/;
|
|
14
|
+
function tinycolor(color, opts) {
|
|
15
|
+
color = color ? color : "";
|
|
16
|
+
opts = opts || {};
|
|
17
|
+
if (color instanceof tinycolor) {
|
|
18
|
+
return color;
|
|
19
|
+
}
|
|
20
|
+
if (!(this instanceof tinycolor)) {
|
|
21
|
+
return new tinycolor(color, opts);
|
|
22
|
+
}
|
|
23
|
+
var rgb = inputToRGB(color);
|
|
24
|
+
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;
|
|
25
|
+
this._gradientType = opts.gradientType;
|
|
26
|
+
if (this._r < 1) this._r = Math.round(this._r);
|
|
27
|
+
if (this._g < 1) this._g = Math.round(this._g);
|
|
28
|
+
if (this._b < 1) this._b = Math.round(this._b);
|
|
29
|
+
this._ok = rgb.ok;
|
|
30
|
+
}
|
|
31
|
+
tinycolor.prototype = {
|
|
32
|
+
isDark: function isDark() {
|
|
23
33
|
return this.getBrightness() < 128;
|
|
24
34
|
},
|
|
25
|
-
isLight: function() {
|
|
35
|
+
isLight: function isLight() {
|
|
26
36
|
return !this.isDark();
|
|
27
37
|
},
|
|
28
|
-
isValid: function() {
|
|
38
|
+
isValid: function isValid() {
|
|
29
39
|
return this._ok;
|
|
30
40
|
},
|
|
31
|
-
getOriginalInput: function() {
|
|
41
|
+
getOriginalInput: function getOriginalInput() {
|
|
32
42
|
return this._originalInput;
|
|
33
43
|
},
|
|
34
|
-
getFormat: function() {
|
|
44
|
+
getFormat: function getFormat() {
|
|
35
45
|
return this._format;
|
|
36
46
|
},
|
|
37
|
-
getAlpha: function() {
|
|
47
|
+
getAlpha: function getAlpha() {
|
|
38
48
|
return this._a;
|
|
39
49
|
},
|
|
40
|
-
getBrightness: function() {
|
|
41
|
-
var
|
|
42
|
-
return (
|
|
50
|
+
getBrightness: function getBrightness() {
|
|
51
|
+
var rgb = this.toRgb();
|
|
52
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
43
53
|
},
|
|
44
|
-
getLuminance: function() {
|
|
45
|
-
var
|
|
46
|
-
|
|
54
|
+
getLuminance: function getLuminance() {
|
|
55
|
+
var rgb = this.toRgb();
|
|
56
|
+
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
57
|
+
RsRGB = rgb.r / 255;
|
|
58
|
+
GsRGB = rgb.g / 255;
|
|
59
|
+
BsRGB = rgb.b / 255;
|
|
60
|
+
if (RsRGB <= 0.03928) R = RsRGB / 12.92;
|
|
61
|
+
else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
62
|
+
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
|
|
63
|
+
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
64
|
+
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
|
|
65
|
+
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
66
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
47
67
|
},
|
|
48
|
-
setAlpha: function(
|
|
49
|
-
|
|
68
|
+
setAlpha: function setAlpha(value) {
|
|
69
|
+
this._a = boundAlpha(value);
|
|
70
|
+
this._roundA = Math.round(100 * this._a) / 100;
|
|
71
|
+
return this;
|
|
50
72
|
},
|
|
51
|
-
toHsv: function() {
|
|
52
|
-
var
|
|
73
|
+
toHsv: function toHsv() {
|
|
74
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
53
75
|
return {
|
|
54
|
-
h:
|
|
55
|
-
s:
|
|
56
|
-
v:
|
|
76
|
+
h: hsv.h * 360,
|
|
77
|
+
s: hsv.s,
|
|
78
|
+
v: hsv.v,
|
|
57
79
|
a: this._a
|
|
58
80
|
};
|
|
59
81
|
},
|
|
60
|
-
toHsvString: function() {
|
|
61
|
-
var
|
|
62
|
-
|
|
82
|
+
toHsvString: function toHsvString() {
|
|
83
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
84
|
+
var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
|
|
85
|
+
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
63
86
|
},
|
|
64
|
-
toHsl: function() {
|
|
65
|
-
var
|
|
87
|
+
toHsl: function toHsl() {
|
|
88
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
66
89
|
return {
|
|
67
|
-
h:
|
|
68
|
-
s:
|
|
69
|
-
l:
|
|
90
|
+
h: hsl.h * 360,
|
|
91
|
+
s: hsl.s,
|
|
92
|
+
l: hsl.l,
|
|
70
93
|
a: this._a
|
|
71
94
|
};
|
|
72
95
|
},
|
|
73
|
-
toHslString: function() {
|
|
74
|
-
var
|
|
75
|
-
|
|
96
|
+
toHslString: function toHslString() {
|
|
97
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
98
|
+
var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
|
|
99
|
+
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
76
100
|
},
|
|
77
|
-
toHex: function(
|
|
78
|
-
return
|
|
101
|
+
toHex: function toHex(allow3Char) {
|
|
102
|
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
79
103
|
},
|
|
80
|
-
toHexString: function(
|
|
81
|
-
return "#" + this.toHex(
|
|
104
|
+
toHexString: function toHexString(allow3Char) {
|
|
105
|
+
return "#" + this.toHex(allow3Char);
|
|
82
106
|
},
|
|
83
|
-
toHex8: function(
|
|
84
|
-
return
|
|
107
|
+
toHex8: function toHex8(allow4Char) {
|
|
108
|
+
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
85
109
|
},
|
|
86
|
-
toHex8String: function(
|
|
87
|
-
return "#" + this.toHex8(
|
|
110
|
+
toHex8String: function toHex8String(allow4Char) {
|
|
111
|
+
return "#" + this.toHex8(allow4Char);
|
|
88
112
|
},
|
|
89
|
-
toRgb: function() {
|
|
113
|
+
toRgb: function toRgb() {
|
|
90
114
|
return {
|
|
91
115
|
r: Math.round(this._r),
|
|
92
116
|
g: Math.round(this._g),
|
|
@@ -94,339 +118,507 @@ s.prototype = {
|
|
|
94
118
|
a: this._a
|
|
95
119
|
};
|
|
96
120
|
},
|
|
97
|
-
toRgbString: function() {
|
|
121
|
+
toRgbString: function toRgbString() {
|
|
98
122
|
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 + ")";
|
|
99
123
|
},
|
|
100
|
-
toPercentageRgb: function() {
|
|
124
|
+
toPercentageRgb: function toPercentageRgb() {
|
|
101
125
|
return {
|
|
102
|
-
r: Math.round(
|
|
103
|
-
g: Math.round(
|
|
104
|
-
b: Math.round(
|
|
126
|
+
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
127
|
+
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
128
|
+
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
105
129
|
a: this._a
|
|
106
130
|
};
|
|
107
131
|
},
|
|
108
|
-
toPercentageRgbString: function() {
|
|
109
|
-
return this._a == 1 ? "rgb(" + Math.round(
|
|
132
|
+
toPercentageRgbString: function toPercentageRgbString() {
|
|
133
|
+
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 + ")";
|
|
110
134
|
},
|
|
111
|
-
toName: function() {
|
|
112
|
-
|
|
135
|
+
toName: function toName() {
|
|
136
|
+
if (this._a === 0) {
|
|
137
|
+
return "transparent";
|
|
138
|
+
}
|
|
139
|
+
if (this._a < 1) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
113
143
|
},
|
|
114
|
-
toFilter: function(
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
144
|
+
toFilter: function toFilter(secondColor) {
|
|
145
|
+
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
146
|
+
var secondHex8String = hex8String;
|
|
147
|
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
148
|
+
if (secondColor) {
|
|
149
|
+
var s = tinycolor(secondColor);
|
|
150
|
+
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
119
151
|
}
|
|
120
|
-
return "progid:DXImageTransform.Microsoft.gradient(" +
|
|
152
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
121
153
|
},
|
|
122
|
-
toString: function(
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
var
|
|
126
|
-
|
|
154
|
+
toString: function toString(format) {
|
|
155
|
+
var formatSet = !!format;
|
|
156
|
+
format = format || this._format;
|
|
157
|
+
var formattedString = false;
|
|
158
|
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
159
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
160
|
+
if (needsAlphaFormat) {
|
|
161
|
+
if (format === "name" && this._a === 0) {
|
|
162
|
+
return this.toName();
|
|
163
|
+
}
|
|
164
|
+
return this.toRgbString();
|
|
165
|
+
}
|
|
166
|
+
if (format === "rgb") {
|
|
167
|
+
formattedString = this.toRgbString();
|
|
168
|
+
}
|
|
169
|
+
if (format === "prgb") {
|
|
170
|
+
formattedString = this.toPercentageRgbString();
|
|
171
|
+
}
|
|
172
|
+
if (format === "hex" || format === "hex6") {
|
|
173
|
+
formattedString = this.toHexString();
|
|
174
|
+
}
|
|
175
|
+
if (format === "hex3") {
|
|
176
|
+
formattedString = this.toHexString(true);
|
|
177
|
+
}
|
|
178
|
+
if (format === "hex4") {
|
|
179
|
+
formattedString = this.toHex8String(true);
|
|
180
|
+
}
|
|
181
|
+
if (format === "hex8") {
|
|
182
|
+
formattedString = this.toHex8String();
|
|
183
|
+
}
|
|
184
|
+
if (format === "name") {
|
|
185
|
+
formattedString = this.toName();
|
|
186
|
+
}
|
|
187
|
+
if (format === "hsl") {
|
|
188
|
+
formattedString = this.toHslString();
|
|
189
|
+
}
|
|
190
|
+
if (format === "hsv") {
|
|
191
|
+
formattedString = this.toHsvString();
|
|
192
|
+
}
|
|
193
|
+
return formattedString || this.toHexString();
|
|
127
194
|
},
|
|
128
|
-
clone: function() {
|
|
129
|
-
return
|
|
195
|
+
clone: function clone() {
|
|
196
|
+
return tinycolor(this.toString());
|
|
130
197
|
},
|
|
131
|
-
_applyModification: function(
|
|
132
|
-
var
|
|
133
|
-
|
|
198
|
+
_applyModification: function _applyModification(fn, args) {
|
|
199
|
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
200
|
+
this._r = color._r;
|
|
201
|
+
this._g = color._g;
|
|
202
|
+
this._b = color._b;
|
|
203
|
+
this.setAlpha(color._a);
|
|
204
|
+
return this;
|
|
134
205
|
},
|
|
135
|
-
lighten: function() {
|
|
136
|
-
return this._applyModification(
|
|
206
|
+
lighten: function lighten() {
|
|
207
|
+
return this._applyModification(_lighten, arguments);
|
|
137
208
|
},
|
|
138
|
-
brighten: function() {
|
|
139
|
-
return this._applyModification(
|
|
209
|
+
brighten: function brighten() {
|
|
210
|
+
return this._applyModification(_brighten, arguments);
|
|
140
211
|
},
|
|
141
|
-
darken: function() {
|
|
142
|
-
return this._applyModification(
|
|
212
|
+
darken: function darken() {
|
|
213
|
+
return this._applyModification(_darken, arguments);
|
|
143
214
|
},
|
|
144
|
-
desaturate: function() {
|
|
145
|
-
return this._applyModification(
|
|
215
|
+
desaturate: function desaturate() {
|
|
216
|
+
return this._applyModification(_desaturate, arguments);
|
|
146
217
|
},
|
|
147
|
-
saturate: function() {
|
|
148
|
-
return this._applyModification(
|
|
218
|
+
saturate: function saturate() {
|
|
219
|
+
return this._applyModification(_saturate, arguments);
|
|
149
220
|
},
|
|
150
|
-
greyscale: function() {
|
|
151
|
-
return this._applyModification(
|
|
221
|
+
greyscale: function greyscale() {
|
|
222
|
+
return this._applyModification(_greyscale, arguments);
|
|
152
223
|
},
|
|
153
|
-
spin: function() {
|
|
154
|
-
return this._applyModification(
|
|
224
|
+
spin: function spin() {
|
|
225
|
+
return this._applyModification(_spin, arguments);
|
|
155
226
|
},
|
|
156
|
-
_applyCombination: function(
|
|
157
|
-
return
|
|
227
|
+
_applyCombination: function _applyCombination(fn, args) {
|
|
228
|
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
158
229
|
},
|
|
159
|
-
analogous: function() {
|
|
160
|
-
return this._applyCombination(
|
|
230
|
+
analogous: function analogous() {
|
|
231
|
+
return this._applyCombination(_analogous, arguments);
|
|
161
232
|
},
|
|
162
|
-
complement: function() {
|
|
163
|
-
return this._applyCombination(
|
|
233
|
+
complement: function complement() {
|
|
234
|
+
return this._applyCombination(_complement, arguments);
|
|
164
235
|
},
|
|
165
|
-
monochromatic: function() {
|
|
166
|
-
return this._applyCombination(
|
|
236
|
+
monochromatic: function monochromatic() {
|
|
237
|
+
return this._applyCombination(_monochromatic, arguments);
|
|
167
238
|
},
|
|
168
|
-
splitcomplement: function() {
|
|
169
|
-
return this._applyCombination(
|
|
239
|
+
splitcomplement: function splitcomplement() {
|
|
240
|
+
return this._applyCombination(_splitcomplement, arguments);
|
|
170
241
|
},
|
|
171
242
|
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
172
243
|
// polyad: function (number) {
|
|
173
244
|
// return this._applyCombination(polyad, [number]);
|
|
174
245
|
// },
|
|
175
|
-
triad: function() {
|
|
176
|
-
return this._applyCombination(
|
|
246
|
+
triad: function triad() {
|
|
247
|
+
return this._applyCombination(polyad, [3]);
|
|
177
248
|
},
|
|
178
|
-
tetrad: function() {
|
|
179
|
-
return this._applyCombination(
|
|
249
|
+
tetrad: function tetrad() {
|
|
250
|
+
return this._applyCombination(polyad, [4]);
|
|
180
251
|
}
|
|
181
252
|
};
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
var
|
|
185
|
-
for (var
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
253
|
+
tinycolor.fromRatio = function(color, opts) {
|
|
254
|
+
if (_typeof(color) == "object") {
|
|
255
|
+
var newColor = {};
|
|
256
|
+
for (var i in color) {
|
|
257
|
+
if (color.hasOwnProperty(i)) {
|
|
258
|
+
if (i === "a") {
|
|
259
|
+
newColor[i] = color[i];
|
|
260
|
+
} else {
|
|
261
|
+
newColor[i] = convertToPercentage(color[i]);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
color = newColor;
|
|
266
|
+
}
|
|
267
|
+
return tinycolor(color, opts);
|
|
190
268
|
};
|
|
191
|
-
function
|
|
192
|
-
var
|
|
269
|
+
function inputToRGB(color) {
|
|
270
|
+
var rgb = {
|
|
193
271
|
r: 0,
|
|
194
272
|
g: 0,
|
|
195
273
|
b: 0
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
274
|
+
};
|
|
275
|
+
var a = 1;
|
|
276
|
+
var s = null;
|
|
277
|
+
var v = null;
|
|
278
|
+
var l = null;
|
|
279
|
+
var ok = false;
|
|
280
|
+
var format = false;
|
|
281
|
+
if (typeof color == "string") {
|
|
282
|
+
color = stringInputToObject(color);
|
|
283
|
+
}
|
|
284
|
+
if (_typeof(color) == "object") {
|
|
285
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
286
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
287
|
+
ok = true;
|
|
288
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
289
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
290
|
+
s = convertToPercentage(color.s);
|
|
291
|
+
v = convertToPercentage(color.v);
|
|
292
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
293
|
+
ok = true;
|
|
294
|
+
format = "hsv";
|
|
295
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
296
|
+
s = convertToPercentage(color.s);
|
|
297
|
+
l = convertToPercentage(color.l);
|
|
298
|
+
rgb = hslToRgb(color.h, s, l);
|
|
299
|
+
ok = true;
|
|
300
|
+
format = "hsl";
|
|
301
|
+
}
|
|
302
|
+
if (color.hasOwnProperty("a")) {
|
|
303
|
+
a = color.a;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
a = boundAlpha(a);
|
|
307
|
+
return {
|
|
308
|
+
ok,
|
|
309
|
+
format: color.format || format,
|
|
310
|
+
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
311
|
+
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
312
|
+
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
313
|
+
a
|
|
204
314
|
};
|
|
205
315
|
}
|
|
206
|
-
function
|
|
316
|
+
function rgbToRgb(r, g, b) {
|
|
207
317
|
return {
|
|
208
|
-
r:
|
|
209
|
-
g: g
|
|
210
|
-
b:
|
|
318
|
+
r: bound01(r, 255) * 255,
|
|
319
|
+
g: bound01(g, 255) * 255,
|
|
320
|
+
b: bound01(b, 255) * 255
|
|
211
321
|
};
|
|
212
322
|
}
|
|
213
|
-
function
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
323
|
+
function rgbToHsl(r, g, b) {
|
|
324
|
+
r = bound01(r, 255);
|
|
325
|
+
g = bound01(g, 255);
|
|
326
|
+
b = bound01(b, 255);
|
|
327
|
+
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
328
|
+
var h, s, l = (max + min) / 2;
|
|
329
|
+
if (max == min) {
|
|
330
|
+
h = s = 0;
|
|
331
|
+
} else {
|
|
332
|
+
var d = max - min;
|
|
333
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
334
|
+
switch (max) {
|
|
224
335
|
case r:
|
|
225
|
-
|
|
336
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
337
|
+
break;
|
|
338
|
+
case g:
|
|
339
|
+
h = (b - r) / d + 2;
|
|
226
340
|
break;
|
|
227
|
-
case
|
|
228
|
-
|
|
341
|
+
case b:
|
|
342
|
+
h = (r - g) / d + 4;
|
|
229
343
|
break;
|
|
230
344
|
}
|
|
231
|
-
|
|
345
|
+
h /= 6;
|
|
232
346
|
}
|
|
233
347
|
return {
|
|
234
|
-
h
|
|
235
|
-
s
|
|
236
|
-
l
|
|
348
|
+
h,
|
|
349
|
+
s,
|
|
350
|
+
l
|
|
237
351
|
};
|
|
238
352
|
}
|
|
239
|
-
function
|
|
240
|
-
var
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
353
|
+
function hslToRgb(h, s, l) {
|
|
354
|
+
var r, g, b;
|
|
355
|
+
h = bound01(h, 360);
|
|
356
|
+
s = bound01(s, 100);
|
|
357
|
+
l = bound01(l, 100);
|
|
358
|
+
function hue2rgb(p2, q2, t) {
|
|
359
|
+
if (t < 0) t += 1;
|
|
360
|
+
if (t > 1) t -= 1;
|
|
361
|
+
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
362
|
+
if (t < 1 / 2) return q2;
|
|
363
|
+
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
364
|
+
return p2;
|
|
244
365
|
}
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
else {
|
|
248
|
-
var
|
|
249
|
-
|
|
366
|
+
if (s === 0) {
|
|
367
|
+
r = g = b = l;
|
|
368
|
+
} else {
|
|
369
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
370
|
+
var p = 2 * l - q;
|
|
371
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
372
|
+
g = hue2rgb(p, q, h);
|
|
373
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
250
374
|
}
|
|
251
375
|
return {
|
|
252
|
-
r:
|
|
253
|
-
g:
|
|
254
|
-
b:
|
|
376
|
+
r: r * 255,
|
|
377
|
+
g: g * 255,
|
|
378
|
+
b: b * 255
|
|
255
379
|
};
|
|
256
380
|
}
|
|
257
|
-
function
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
381
|
+
function rgbToHsv(r, g, b) {
|
|
382
|
+
r = bound01(r, 255);
|
|
383
|
+
g = bound01(g, 255);
|
|
384
|
+
b = bound01(b, 255);
|
|
385
|
+
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
386
|
+
var h, s, v = max;
|
|
387
|
+
var d = max - min;
|
|
388
|
+
s = max === 0 ? 0 : d / max;
|
|
389
|
+
if (max == min) {
|
|
390
|
+
h = 0;
|
|
391
|
+
} else {
|
|
392
|
+
switch (max) {
|
|
267
393
|
case r:
|
|
268
|
-
|
|
394
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
395
|
+
break;
|
|
396
|
+
case g:
|
|
397
|
+
h = (b - r) / d + 2;
|
|
269
398
|
break;
|
|
270
|
-
case
|
|
271
|
-
|
|
399
|
+
case b:
|
|
400
|
+
h = (r - g) / d + 4;
|
|
272
401
|
break;
|
|
273
402
|
}
|
|
274
|
-
|
|
403
|
+
h /= 6;
|
|
275
404
|
}
|
|
276
405
|
return {
|
|
277
|
-
h
|
|
278
|
-
s
|
|
279
|
-
v
|
|
406
|
+
h,
|
|
407
|
+
s,
|
|
408
|
+
v
|
|
280
409
|
};
|
|
281
410
|
}
|
|
282
|
-
function
|
|
283
|
-
|
|
284
|
-
|
|
411
|
+
function hsvToRgb(h, s, v) {
|
|
412
|
+
h = bound01(h, 360) * 6;
|
|
413
|
+
s = bound01(s, 100);
|
|
414
|
+
v = bound01(v, 100);
|
|
415
|
+
var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
|
|
285
416
|
return {
|
|
286
|
-
r:
|
|
287
|
-
g:
|
|
288
|
-
b:
|
|
417
|
+
r: r * 255,
|
|
418
|
+
g: g * 255,
|
|
419
|
+
b: b * 255
|
|
289
420
|
};
|
|
290
421
|
}
|
|
291
|
-
function
|
|
292
|
-
var
|
|
293
|
-
|
|
422
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
423
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
424
|
+
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)) {
|
|
425
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
426
|
+
}
|
|
427
|
+
return hex.join("");
|
|
294
428
|
}
|
|
295
|
-
function
|
|
296
|
-
var
|
|
297
|
-
|
|
429
|
+
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
430
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
431
|
+
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)) {
|
|
432
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
433
|
+
}
|
|
434
|
+
return hex.join("");
|
|
298
435
|
}
|
|
299
|
-
function
|
|
300
|
-
var
|
|
301
|
-
return
|
|
436
|
+
function rgbaToArgbHex(r, g, b, a) {
|
|
437
|
+
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
438
|
+
return hex.join("");
|
|
302
439
|
}
|
|
303
|
-
|
|
304
|
-
|
|
440
|
+
tinycolor.equals = function(color1, color2) {
|
|
441
|
+
if (!color1 || !color2) return false;
|
|
442
|
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
305
443
|
};
|
|
306
|
-
|
|
307
|
-
return
|
|
444
|
+
tinycolor.random = function() {
|
|
445
|
+
return tinycolor.fromRatio({
|
|
308
446
|
r: Math.random(),
|
|
309
447
|
g: Math.random(),
|
|
310
448
|
b: Math.random()
|
|
311
449
|
});
|
|
312
450
|
};
|
|
313
|
-
function
|
|
314
|
-
|
|
315
|
-
var
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return
|
|
344
|
-
}
|
|
345
|
-
function
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
451
|
+
function _desaturate(color, amount) {
|
|
452
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
453
|
+
var hsl = tinycolor(color).toHsl();
|
|
454
|
+
hsl.s -= amount / 100;
|
|
455
|
+
hsl.s = clamp01(hsl.s);
|
|
456
|
+
return tinycolor(hsl);
|
|
457
|
+
}
|
|
458
|
+
function _saturate(color, amount) {
|
|
459
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
460
|
+
var hsl = tinycolor(color).toHsl();
|
|
461
|
+
hsl.s += amount / 100;
|
|
462
|
+
hsl.s = clamp01(hsl.s);
|
|
463
|
+
return tinycolor(hsl);
|
|
464
|
+
}
|
|
465
|
+
function _greyscale(color) {
|
|
466
|
+
return tinycolor(color).desaturate(100);
|
|
467
|
+
}
|
|
468
|
+
function _lighten(color, amount) {
|
|
469
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
470
|
+
var hsl = tinycolor(color).toHsl();
|
|
471
|
+
hsl.l += amount / 100;
|
|
472
|
+
hsl.l = clamp01(hsl.l);
|
|
473
|
+
return tinycolor(hsl);
|
|
474
|
+
}
|
|
475
|
+
function _brighten(color, amount) {
|
|
476
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
477
|
+
var rgb = tinycolor(color).toRgb();
|
|
478
|
+
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
479
|
+
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
480
|
+
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
481
|
+
return tinycolor(rgb);
|
|
482
|
+
}
|
|
483
|
+
function _darken(color, amount) {
|
|
484
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
485
|
+
var hsl = tinycolor(color).toHsl();
|
|
486
|
+
hsl.l -= amount / 100;
|
|
487
|
+
hsl.l = clamp01(hsl.l);
|
|
488
|
+
return tinycolor(hsl);
|
|
489
|
+
}
|
|
490
|
+
function _spin(color, amount) {
|
|
491
|
+
var hsl = tinycolor(color).toHsl();
|
|
492
|
+
var hue = (hsl.h + amount) % 360;
|
|
493
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
494
|
+
return tinycolor(hsl);
|
|
495
|
+
}
|
|
496
|
+
function _complement(color) {
|
|
497
|
+
var hsl = tinycolor(color).toHsl();
|
|
498
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
499
|
+
return tinycolor(hsl);
|
|
500
|
+
}
|
|
501
|
+
function polyad(color, number) {
|
|
502
|
+
if (isNaN(number) || number <= 0) {
|
|
351
503
|
throw new Error("Argument to polyad must be a positive number");
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
504
|
+
}
|
|
505
|
+
var hsl = tinycolor(color).toHsl();
|
|
506
|
+
var result = [tinycolor(color)];
|
|
507
|
+
var step = 360 / number;
|
|
508
|
+
for (var i = 1; i < number; i++) {
|
|
509
|
+
result.push(tinycolor({
|
|
510
|
+
h: (hsl.h + i * step) % 360,
|
|
511
|
+
s: hsl.s,
|
|
512
|
+
l: hsl.l
|
|
357
513
|
}));
|
|
358
|
-
|
|
514
|
+
}
|
|
515
|
+
return result;
|
|
359
516
|
}
|
|
360
|
-
function
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
517
|
+
function _splitcomplement(color) {
|
|
518
|
+
var hsl = tinycolor(color).toHsl();
|
|
519
|
+
var h = hsl.h;
|
|
520
|
+
return [tinycolor(color), tinycolor({
|
|
521
|
+
h: (h + 72) % 360,
|
|
522
|
+
s: hsl.s,
|
|
523
|
+
l: hsl.l
|
|
524
|
+
}), tinycolor({
|
|
525
|
+
h: (h + 216) % 360,
|
|
526
|
+
s: hsl.s,
|
|
527
|
+
l: hsl.l
|
|
370
528
|
})];
|
|
371
529
|
}
|
|
372
|
-
function
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
530
|
+
function _analogous(color, results, slices) {
|
|
531
|
+
results = results || 6;
|
|
532
|
+
slices = slices || 30;
|
|
533
|
+
var hsl = tinycolor(color).toHsl();
|
|
534
|
+
var part = 360 / slices;
|
|
535
|
+
var ret = [tinycolor(color)];
|
|
536
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
537
|
+
hsl.h = (hsl.h + part) % 360;
|
|
538
|
+
ret.push(tinycolor(hsl));
|
|
539
|
+
}
|
|
540
|
+
return ret;
|
|
378
541
|
}
|
|
379
|
-
function
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
542
|
+
function _monochromatic(color, results) {
|
|
543
|
+
results = results || 6;
|
|
544
|
+
var hsv = tinycolor(color).toHsv();
|
|
545
|
+
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
546
|
+
var ret = [];
|
|
547
|
+
var modification = 1 / results;
|
|
548
|
+
while (results--) {
|
|
549
|
+
ret.push(tinycolor({
|
|
550
|
+
h,
|
|
551
|
+
s,
|
|
552
|
+
v
|
|
553
|
+
}));
|
|
554
|
+
v = (v + modification) % 1;
|
|
555
|
+
}
|
|
556
|
+
return ret;
|
|
557
|
+
}
|
|
558
|
+
tinycolor.mix = function(color1, color2, amount) {
|
|
559
|
+
amount = amount === 0 ? 0 : amount || 50;
|
|
560
|
+
var rgb1 = tinycolor(color1).toRgb();
|
|
561
|
+
var rgb2 = tinycolor(color2).toRgb();
|
|
562
|
+
var p = amount / 100;
|
|
563
|
+
var rgba = {
|
|
564
|
+
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
565
|
+
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
566
|
+
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
567
|
+
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
396
568
|
};
|
|
397
|
-
return
|
|
569
|
+
return tinycolor(rgba);
|
|
398
570
|
};
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
|
|
571
|
+
tinycolor.readability = function(color1, color2) {
|
|
572
|
+
var c1 = tinycolor(color1);
|
|
573
|
+
var c2 = tinycolor(color2);
|
|
574
|
+
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
402
575
|
};
|
|
403
|
-
|
|
404
|
-
var
|
|
405
|
-
|
|
576
|
+
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
577
|
+
var readability = tinycolor.readability(color1, color2);
|
|
578
|
+
var wcag2Parms, out;
|
|
579
|
+
out = false;
|
|
580
|
+
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
581
|
+
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
406
582
|
case "AAsmall":
|
|
407
583
|
case "AAAlarge":
|
|
408
|
-
|
|
584
|
+
out = readability >= 4.5;
|
|
409
585
|
break;
|
|
410
586
|
case "AAlarge":
|
|
411
|
-
|
|
587
|
+
out = readability >= 3;
|
|
412
588
|
break;
|
|
413
589
|
case "AAAsmall":
|
|
414
|
-
|
|
590
|
+
out = readability >= 7;
|
|
415
591
|
break;
|
|
416
592
|
}
|
|
417
|
-
return
|
|
593
|
+
return out;
|
|
418
594
|
};
|
|
419
|
-
|
|
420
|
-
var
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
595
|
+
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
596
|
+
var bestColor = null;
|
|
597
|
+
var bestScore = 0;
|
|
598
|
+
var readability;
|
|
599
|
+
var includeFallbackColors, level, size;
|
|
600
|
+
args = args || {};
|
|
601
|
+
includeFallbackColors = args.includeFallbackColors;
|
|
602
|
+
level = args.level;
|
|
603
|
+
size = args.size;
|
|
604
|
+
for (var i = 0; i < colorList.length; i++) {
|
|
605
|
+
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
606
|
+
if (readability > bestScore) {
|
|
607
|
+
bestScore = readability;
|
|
608
|
+
bestColor = tinycolor(colorList[i]);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
612
|
+
level,
|
|
613
|
+
size
|
|
614
|
+
}) || !includeFallbackColors) {
|
|
615
|
+
return bestColor;
|
|
616
|
+
} else {
|
|
617
|
+
args.includeFallbackColors = false;
|
|
618
|
+
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
619
|
+
}
|
|
428
620
|
};
|
|
429
|
-
var
|
|
621
|
+
var names = tinycolor.names = {
|
|
430
622
|
aliceblue: "f0f8ff",
|
|
431
623
|
antiquewhite: "faebd7",
|
|
432
624
|
aqua: "0ff",
|
|
@@ -576,70 +768,93 @@ var S = s.names = {
|
|
|
576
768
|
whitesmoke: "f5f5f5",
|
|
577
769
|
yellow: "ff0",
|
|
578
770
|
yellowgreen: "9acd32"
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
771
|
+
};
|
|
772
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
773
|
+
function flip(o) {
|
|
774
|
+
var flipped = {};
|
|
775
|
+
for (var i in o) {
|
|
776
|
+
if (o.hasOwnProperty(i)) {
|
|
777
|
+
flipped[o[i]] = i;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return flipped;
|
|
585
781
|
}
|
|
586
|
-
function
|
|
587
|
-
|
|
782
|
+
function boundAlpha(a) {
|
|
783
|
+
a = parseFloat(a);
|
|
784
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
785
|
+
a = 1;
|
|
786
|
+
}
|
|
787
|
+
return a;
|
|
588
788
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
591
|
-
var
|
|
592
|
-
|
|
789
|
+
function bound01(n, max) {
|
|
790
|
+
if (isOnePointZero(n)) n = "100%";
|
|
791
|
+
var processPercent = isPercentage(n);
|
|
792
|
+
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
793
|
+
if (processPercent) {
|
|
794
|
+
n = parseInt(n * max, 10) / 100;
|
|
795
|
+
}
|
|
796
|
+
if (Math.abs(n - max) < 1e-6) {
|
|
797
|
+
return 1;
|
|
798
|
+
}
|
|
799
|
+
return n % max / parseFloat(max);
|
|
593
800
|
}
|
|
594
|
-
function
|
|
595
|
-
return Math.min(1, Math.max(0,
|
|
801
|
+
function clamp01(val) {
|
|
802
|
+
return Math.min(1, Math.max(0, val));
|
|
596
803
|
}
|
|
597
|
-
function
|
|
598
|
-
return parseInt(
|
|
804
|
+
function parseIntFromHex(val) {
|
|
805
|
+
return parseInt(val, 16);
|
|
599
806
|
}
|
|
600
|
-
function
|
|
601
|
-
return typeof
|
|
807
|
+
function isOnePointZero(n) {
|
|
808
|
+
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
|
|
602
809
|
}
|
|
603
|
-
function
|
|
604
|
-
return typeof
|
|
810
|
+
function isPercentage(n) {
|
|
811
|
+
return typeof n === "string" && n.indexOf("%") != -1;
|
|
605
812
|
}
|
|
606
|
-
function
|
|
607
|
-
return
|
|
813
|
+
function pad2(c) {
|
|
814
|
+
return c.length == 1 ? "0" + c : "" + c;
|
|
608
815
|
}
|
|
609
|
-
function
|
|
610
|
-
|
|
816
|
+
function convertToPercentage(n) {
|
|
817
|
+
if (n <= 1) {
|
|
818
|
+
n = n * 100 + "%";
|
|
819
|
+
}
|
|
820
|
+
return n;
|
|
611
821
|
}
|
|
612
|
-
function
|
|
613
|
-
return Math.round(parseFloat(
|
|
822
|
+
function convertDecimalToHex(d) {
|
|
823
|
+
return Math.round(parseFloat(d) * 255).toString(16);
|
|
614
824
|
}
|
|
615
|
-
function
|
|
616
|
-
return
|
|
825
|
+
function convertHexToDecimal(h) {
|
|
826
|
+
return parseIntFromHex(h) / 255;
|
|
617
827
|
}
|
|
618
|
-
var
|
|
619
|
-
var
|
|
828
|
+
var matchers = function() {
|
|
829
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
830
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
831
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
832
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
833
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
620
834
|
return {
|
|
621
|
-
CSS_UNIT: new RegExp(
|
|
622
|
-
rgb: new RegExp("rgb" +
|
|
623
|
-
rgba: new RegExp("rgba" +
|
|
624
|
-
hsl: new RegExp("hsl" +
|
|
625
|
-
hsla: new RegExp("hsla" +
|
|
626
|
-
hsv: new RegExp("hsv" +
|
|
627
|
-
hsva: new RegExp("hsva" +
|
|
835
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
836
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
837
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
838
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
839
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
840
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
841
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
628
842
|
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
629
843
|
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
630
844
|
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
631
845
|
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
632
846
|
};
|
|
633
847
|
}();
|
|
634
|
-
function
|
|
635
|
-
return !!
|
|
636
|
-
}
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
var
|
|
640
|
-
if (
|
|
641
|
-
|
|
642
|
-
|
|
848
|
+
function isValidCSSUnit(color) {
|
|
849
|
+
return !!matchers.CSS_UNIT.exec(color);
|
|
850
|
+
}
|
|
851
|
+
function stringInputToObject(color) {
|
|
852
|
+
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
853
|
+
var named = false;
|
|
854
|
+
if (names[color]) {
|
|
855
|
+
color = names[color];
|
|
856
|
+
named = true;
|
|
857
|
+
} else if (color == "transparent") {
|
|
643
858
|
return {
|
|
644
859
|
r: 0,
|
|
645
860
|
g: 0,
|
|
@@ -647,127 +862,199 @@ function st(t) {
|
|
|
647
862
|
a: 0,
|
|
648
863
|
format: "name"
|
|
649
864
|
};
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
865
|
+
}
|
|
866
|
+
var match;
|
|
867
|
+
if (match = matchers.rgb.exec(color)) {
|
|
868
|
+
return {
|
|
869
|
+
r: match[1],
|
|
870
|
+
g: match[2],
|
|
871
|
+
b: match[3]
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
if (match = matchers.rgba.exec(color)) {
|
|
875
|
+
return {
|
|
876
|
+
r: match[1],
|
|
877
|
+
g: match[2],
|
|
878
|
+
b: match[3],
|
|
879
|
+
a: match[4]
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
if (match = matchers.hsl.exec(color)) {
|
|
883
|
+
return {
|
|
884
|
+
h: match[1],
|
|
885
|
+
s: match[2],
|
|
886
|
+
l: match[3]
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
if (match = matchers.hsla.exec(color)) {
|
|
890
|
+
return {
|
|
891
|
+
h: match[1],
|
|
892
|
+
s: match[2],
|
|
893
|
+
l: match[3],
|
|
894
|
+
a: match[4]
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
if (match = matchers.hsv.exec(color)) {
|
|
898
|
+
return {
|
|
899
|
+
h: match[1],
|
|
900
|
+
s: match[2],
|
|
901
|
+
v: match[3]
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
if (match = matchers.hsva.exec(color)) {
|
|
905
|
+
return {
|
|
906
|
+
h: match[1],
|
|
907
|
+
s: match[2],
|
|
908
|
+
v: match[3],
|
|
909
|
+
a: match[4]
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
if (match = matchers.hex8.exec(color)) {
|
|
913
|
+
return {
|
|
914
|
+
r: parseIntFromHex(match[1]),
|
|
915
|
+
g: parseIntFromHex(match[2]),
|
|
916
|
+
b: parseIntFromHex(match[3]),
|
|
917
|
+
a: convertHexToDecimal(match[4]),
|
|
918
|
+
format: named ? "name" : "hex8"
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
if (match = matchers.hex6.exec(color)) {
|
|
922
|
+
return {
|
|
923
|
+
r: parseIntFromHex(match[1]),
|
|
924
|
+
g: parseIntFromHex(match[2]),
|
|
925
|
+
b: parseIntFromHex(match[3]),
|
|
926
|
+
format: named ? "name" : "hex"
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
if (match = matchers.hex4.exec(color)) {
|
|
930
|
+
return {
|
|
931
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
932
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
933
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
934
|
+
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
935
|
+
format: named ? "name" : "hex8"
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
if (match = matchers.hex3.exec(color)) {
|
|
939
|
+
return {
|
|
940
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
941
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
942
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
943
|
+
format: named ? "name" : "hex"
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
return false;
|
|
947
|
+
}
|
|
948
|
+
function validateWCAG2Parms(parms) {
|
|
949
|
+
var level, size;
|
|
950
|
+
parms = parms || {
|
|
705
951
|
level: "AA",
|
|
706
952
|
size: "small"
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
953
|
+
};
|
|
954
|
+
level = (parms.level || "AA").toUpperCase();
|
|
955
|
+
size = (parms.size || "small").toLowerCase();
|
|
956
|
+
if (level !== "AA" && level !== "AAA") {
|
|
957
|
+
level = "AA";
|
|
958
|
+
}
|
|
959
|
+
if (size !== "small" && size !== "large") {
|
|
960
|
+
size = "small";
|
|
961
|
+
}
|
|
962
|
+
return {
|
|
963
|
+
level,
|
|
964
|
+
size
|
|
710
965
|
};
|
|
711
966
|
}
|
|
712
|
-
const
|
|
713
|
-
const
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
967
|
+
const useComparator = () => {
|
|
968
|
+
const theme = useTheme();
|
|
969
|
+
const isBaseComparator = (comparator) => {
|
|
970
|
+
return !comparator.type;
|
|
971
|
+
};
|
|
972
|
+
const isNodeStyler = (comparator) => {
|
|
973
|
+
return comparator.type === "node";
|
|
974
|
+
};
|
|
975
|
+
const runOperator = (value1, operator, value2) => {
|
|
976
|
+
var _a, _b;
|
|
977
|
+
if (!operator || !value2) {
|
|
978
|
+
return true;
|
|
979
|
+
}
|
|
980
|
+
let result;
|
|
981
|
+
switch (operator) {
|
|
719
982
|
case "=": {
|
|
720
|
-
|
|
983
|
+
result = (isNil(value1) ? "" : value1).toString() == (value2 == null ? void 0 : value2.toString());
|
|
721
984
|
break;
|
|
722
985
|
}
|
|
723
986
|
case "<": {
|
|
724
|
-
|
|
987
|
+
result = parseFloat(value1) < parseFloat(value2);
|
|
725
988
|
break;
|
|
726
989
|
}
|
|
727
990
|
case ">": {
|
|
728
|
-
|
|
991
|
+
result = parseFloat(value1) > parseFloat(value2);
|
|
729
992
|
break;
|
|
730
993
|
}
|
|
731
994
|
case "!=": {
|
|
732
|
-
|
|
995
|
+
result = (value1 == null ? void 0 : value1.toString()) != (value2 == null ? void 0 : value2.toString());
|
|
733
996
|
break;
|
|
734
997
|
}
|
|
735
998
|
case "<=": {
|
|
736
|
-
|
|
999
|
+
result = parseInt(value1) <= parseInt(value2);
|
|
737
1000
|
break;
|
|
738
1001
|
}
|
|
739
1002
|
case ">=": {
|
|
740
|
-
|
|
1003
|
+
result = parseInt(value1) >= parseInt(value2);
|
|
741
1004
|
break;
|
|
742
1005
|
}
|
|
743
1006
|
case "~": {
|
|
744
|
-
const
|
|
745
|
-
|
|
1007
|
+
const strValue1 = ((_a = value1 == null ? void 0 : value1.toString) == null ? void 0 : _a.call(value1)) ?? "";
|
|
1008
|
+
const strValue2 = ((_b = value2.toString) == null ? void 0 : _b.call(value2)) ?? "";
|
|
1009
|
+
result = !!strValue1 && strValue1.toLowerCase().includes(strValue2.toLowerCase());
|
|
746
1010
|
break;
|
|
747
1011
|
}
|
|
748
|
-
default:
|
|
749
|
-
|
|
1012
|
+
default: {
|
|
1013
|
+
result = false;
|
|
1014
|
+
}
|
|
750
1015
|
}
|
|
751
|
-
return
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1016
|
+
return result;
|
|
1017
|
+
};
|
|
1018
|
+
const runBaseComparator = (comparator, node) => runOperator(get(node, comparator.field), comparator.operator, comparator.value);
|
|
1019
|
+
const runNodeComparator = (comparator, node) => {
|
|
1020
|
+
var _a;
|
|
1021
|
+
const nodeValue = get(node, comparator.field);
|
|
1022
|
+
if (!runOperator(nodeValue, comparator.operator, comparator.value)) {
|
|
756
1023
|
return {};
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
1024
|
+
}
|
|
1025
|
+
const styles = {};
|
|
1026
|
+
if (comparator.color) {
|
|
1027
|
+
const color = ((_a = theme.palette[comparator.color]) == null ? void 0 : _a.main) ?? comparator.color;
|
|
1028
|
+
styles.fill = color;
|
|
761
1029
|
try {
|
|
762
|
-
|
|
1030
|
+
styles.stroke = tinycolor(color).darken(10).toString();
|
|
763
1031
|
} catch {
|
|
764
|
-
|
|
1032
|
+
styles.stroke = color;
|
|
765
1033
|
}
|
|
766
1034
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
1035
|
+
if (comparator.size) {
|
|
1036
|
+
styles.strokeWidth = comparator.size;
|
|
1037
|
+
styles.fontSize = comparator.size;
|
|
1038
|
+
}
|
|
1039
|
+
return styles;
|
|
1040
|
+
};
|
|
1041
|
+
const runEdgeComparator = (_comparator, _source, _target) => {
|
|
1042
|
+
return {};
|
|
1043
|
+
};
|
|
1044
|
+
const runComparator = (comparator, nodeOrSource, target) => {
|
|
1045
|
+
if (isBaseComparator(comparator)) {
|
|
1046
|
+
return runBaseComparator(comparator, nodeOrSource);
|
|
1047
|
+
}
|
|
1048
|
+
if (isNodeStyler(comparator)) {
|
|
1049
|
+
return runNodeComparator(comparator, nodeOrSource);
|
|
1050
|
+
}
|
|
1051
|
+
return runEdgeComparator();
|
|
1052
|
+
};
|
|
1053
|
+
const runComparators = (comparators, nodeOrSource, target) => {
|
|
1054
|
+
return (comparators ?? []).map((comparator) => runComparator(comparator, nodeOrSource)).reduce((acc, val) => ({ ...acc, ...val }), {});
|
|
1055
|
+
};
|
|
1056
|
+
return { runComparators, runComparator };
|
|
770
1057
|
};
|
|
771
1058
|
export {
|
|
772
|
-
|
|
1059
|
+
useComparator as default
|
|
773
1060
|
};
|