@baishuyun/ui-base 2.3.0 → 2.3.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/dist/Card/Card-BE6v4I-A.js +69 -0
- package/dist/Card/index.js +3 -4
- package/dist/CheckBox/CheckBox--rXaUgMO.js +67 -0
- package/dist/CheckBox/CheckBox-Db8X-pw9.js +33 -0
- package/dist/CheckBox/index.js +4 -39
- package/dist/ColorPicker/ColorPicker-BBP-4-so.js +168 -0
- package/dist/ColorPicker/index.js +6 -5
- package/dist/DropDown/DropDown-CKXi9mXN.js +162 -0
- package/dist/DropDown/index.js +7 -4
- package/dist/Editor/Buttons--dMLPuk2.js +595 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +14 -8
- package/dist/Editor/constants/index.js +53 -20
- package/dist/Editor/index.js +518 -576
- package/dist/Icon/Icon-DppVOyPK.js +19 -0
- package/dist/Icon/index.js +2 -4
- package/dist/InputTag/InputTag-B6N5MZA2.js +139 -0
- package/dist/InputTag/index.js +3 -4
- package/dist/Loading/Loading-Bi5NO-Ky.js +15 -0
- package/dist/Loading/index.js +2 -4
- package/dist/Modal/Modal-FVJpbEgw.js +81 -0
- package/dist/Modal/index.js +3 -4
- package/dist/NotFoundContent/NotFoundContent-CTPpcZOt.js +9 -0
- package/dist/NotFoundContent/index.js +2 -4
- package/dist/Radio/Radio-dyoBNiKF.js +85 -0
- package/dist/Radio/index.js +2 -105
- package/dist/Segmented/Segmented-Dd8glDXI.js +62 -0
- package/dist/Segmented/index.js +2 -4
- package/dist/Select/Select-Bd2ECrB0.js +729 -0
- package/dist/Select/SelectInputSearch-CIXBNLFi.js +46 -0
- package/dist/Select/index.js +11 -6
- package/dist/Tabs/Tabs-C79GTyGd.js +410 -0
- package/dist/Tabs/index.js +6 -7
- package/dist/Tree/index.js +5 -4
- package/dist/Tree/utils/index.js +24 -39
- package/dist/components/Editor/context/EditorContainerContext.d.ts +8 -0
- package/dist/index.js +103 -81
- package/dist/style.css +2 -1
- package/dist/vendors/Tree-CQR9fvpA.js +231 -0
- package/dist/vendors/animations-C5JKFkz4.js +38 -0
- package/dist/vendors/clsx-DNOE4Gl8.js +16 -0
- package/dist/vendors/color-BPWy9DvT.js +12 -0
- package/dist/vendors/fuse.js-BKtvbTjL.js +877 -0
- package/dist/vendors/lexical-hZliMgDv.js +6439 -0
- package/dist/vendors/lodash-es-Bu9xU1fK.js +334 -0
- package/dist/vendors/simplebar-react-CFlS-Nm9.js +370 -0
- package/dist/vendors/tinycolor2-DToeAEPD.js +726 -0
- package/dist/vendors/useFloatingPortal-BA6P5GxV.js +45 -0
- package/dist/vendors/useLocale-BfT0V1j4.js +75 -0
- package/package.json +3 -3
- package/dist/Card/Card-Y1ISqAp9.js +0 -86
- package/dist/CheckBox/CheckBox-C9sXWSA5.js +0 -84
- package/dist/ColorPicker/ColorPicker-D0D5azon.js +0 -216
- package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
- package/dist/Editor/index-C0Rjz8DK.js +0 -846
- package/dist/Icon/Icon-CBlIwtp2.js +0 -24
- package/dist/InputTag/InputTag-C-rQUJnF.js +0 -155
- package/dist/Loading/Loading-CEB4PLUE.js +0 -9
- package/dist/Modal/Modal-z3TvEXwN.js +0 -80
- package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +0 -6
- package/dist/Segmented/Segmented-UgzW78Ey.js +0 -75
- package/dist/Select/Select-hwXXDuLU.js +0 -820
- package/dist/Select/SelectInputSearch-ChUpUgxa.js +0 -34
- package/dist/Tabs/TabSelect-DL8Bhehc.js +0 -445
- package/dist/vendors/Tree-CLEy-xqz.js +0 -235
- package/dist/vendors/clsx-OuTLNxxd.js +0 -16
- package/dist/vendors/color-VzwvCPhF.js +0 -21
- package/dist/vendors/fuse.js-D1DCbUBb.js +0 -1022
- package/dist/vendors/index-MTmG1Ezy.js +0 -15
- package/dist/vendors/lexical-DO7eMeC2.js +0 -5891
- package/dist/vendors/lodash-es-DFpaJB4Y.js +0 -305
- package/dist/vendors/simplebar-react-D68KzE44.js +0 -408
- package/dist/vendors/tinycolor2-Begv3Jc8.js +0 -711
- package/dist/vendors/useFloatingPortal-9VUFOAOG.js +0 -45
- package/dist/vendors/useLocale-DgqW9M3h.js +0 -47
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/tinycolor2@1.6.0/node_modules/tinycolor2/esm/tinycolor.js
|
|
2
|
+
function e(t) {
|
|
3
|
+
"@babel/helpers - typeof";
|
|
4
|
+
return e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
5
|
+
return typeof e;
|
|
6
|
+
} : function(e) {
|
|
7
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
8
|
+
}, e(t);
|
|
9
|
+
}
|
|
10
|
+
var t = /^\s+/, n = /\s+$/;
|
|
11
|
+
function r(e, t) {
|
|
12
|
+
if (e ||= "", t ||= {}, e instanceof r) return e;
|
|
13
|
+
if (!(this instanceof r)) return new r(e, t);
|
|
14
|
+
var n = i(e);
|
|
15
|
+
this._originalInput = e, this._r = n.r, this._g = n.g, this._b = n.b, this._a = n.a, this._roundA = Math.round(100 * this._a) / 100, this._format = t.format || n.format, this._gradientType = t.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = n.ok;
|
|
16
|
+
}
|
|
17
|
+
r.prototype = {
|
|
18
|
+
isDark: function() {
|
|
19
|
+
return this.getBrightness() < 128;
|
|
20
|
+
},
|
|
21
|
+
isLight: function() {
|
|
22
|
+
return !this.isDark();
|
|
23
|
+
},
|
|
24
|
+
isValid: function() {
|
|
25
|
+
return this._ok;
|
|
26
|
+
},
|
|
27
|
+
getOriginalInput: function() {
|
|
28
|
+
return this._originalInput;
|
|
29
|
+
},
|
|
30
|
+
getFormat: function() {
|
|
31
|
+
return this._format;
|
|
32
|
+
},
|
|
33
|
+
getAlpha: function() {
|
|
34
|
+
return this._a;
|
|
35
|
+
},
|
|
36
|
+
getBrightness: function() {
|
|
37
|
+
var e = this.toRgb();
|
|
38
|
+
return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
|
|
39
|
+
},
|
|
40
|
+
getLuminance: function() {
|
|
41
|
+
var e = this.toRgb(), t = e.r / 255, n = e.g / 255, r = e.b / 255, i = t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4, a = n <= .03928 ? n / 12.92 : ((n + .055) / 1.055) ** 2.4, o = r <= .03928 ? r / 12.92 : ((r + .055) / 1.055) ** 2.4;
|
|
42
|
+
return .2126 * i + .7152 * a + .0722 * o;
|
|
43
|
+
},
|
|
44
|
+
setAlpha: function(e) {
|
|
45
|
+
return this._a = O(e), this._roundA = Math.round(100 * this._a) / 100, this;
|
|
46
|
+
},
|
|
47
|
+
toHsv: function() {
|
|
48
|
+
var e = c(this._r, this._g, this._b);
|
|
49
|
+
return {
|
|
50
|
+
h: e.h * 360,
|
|
51
|
+
s: e.s,
|
|
52
|
+
v: e.v,
|
|
53
|
+
a: this._a
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
toHsvString: function() {
|
|
57
|
+
var e = c(this._r, this._g, this._b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), r = Math.round(e.v * 100);
|
|
58
|
+
return this._a == 1 ? "hsv(" + t + ", " + n + "%, " + r + "%)" : "hsva(" + t + ", " + n + "%, " + r + "%, " + this._roundA + ")";
|
|
59
|
+
},
|
|
60
|
+
toHsl: function() {
|
|
61
|
+
var e = o(this._r, this._g, this._b);
|
|
62
|
+
return {
|
|
63
|
+
h: e.h * 360,
|
|
64
|
+
s: e.s,
|
|
65
|
+
l: e.l,
|
|
66
|
+
a: this._a
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
toHslString: function() {
|
|
70
|
+
var e = o(this._r, this._g, this._b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), r = Math.round(e.l * 100);
|
|
71
|
+
return this._a == 1 ? "hsl(" + t + ", " + n + "%, " + r + "%)" : "hsla(" + t + ", " + n + "%, " + r + "%, " + this._roundA + ")";
|
|
72
|
+
},
|
|
73
|
+
toHex: function(e) {
|
|
74
|
+
return u(this._r, this._g, this._b, e);
|
|
75
|
+
},
|
|
76
|
+
toHexString: function(e) {
|
|
77
|
+
return "#" + this.toHex(e);
|
|
78
|
+
},
|
|
79
|
+
toHex8: function(e) {
|
|
80
|
+
return d(this._r, this._g, this._b, this._a, e);
|
|
81
|
+
},
|
|
82
|
+
toHex8String: function(e) {
|
|
83
|
+
return "#" + this.toHex8(e);
|
|
84
|
+
},
|
|
85
|
+
toRgb: function() {
|
|
86
|
+
return {
|
|
87
|
+
r: Math.round(this._r),
|
|
88
|
+
g: Math.round(this._g),
|
|
89
|
+
b: Math.round(this._b),
|
|
90
|
+
a: this._a
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
toRgbString: function() {
|
|
94
|
+
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 + ")";
|
|
95
|
+
},
|
|
96
|
+
toPercentageRgb: function() {
|
|
97
|
+
return {
|
|
98
|
+
r: Math.round(k(this._r, 255) * 100) + "%",
|
|
99
|
+
g: Math.round(k(this._g, 255) * 100) + "%",
|
|
100
|
+
b: Math.round(k(this._b, 255) * 100) + "%",
|
|
101
|
+
a: this._a
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
toPercentageRgbString: function() {
|
|
105
|
+
return this._a == 1 ? "rgb(" + Math.round(k(this._r, 255) * 100) + "%, " + Math.round(k(this._g, 255) * 100) + "%, " + Math.round(k(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(k(this._r, 255) * 100) + "%, " + Math.round(k(this._g, 255) * 100) + "%, " + Math.round(k(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
106
|
+
},
|
|
107
|
+
toName: function() {
|
|
108
|
+
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : E[u(this._r, this._g, this._b, !0)] || !1;
|
|
109
|
+
},
|
|
110
|
+
toFilter: function(e) {
|
|
111
|
+
var t = "#" + f(this._r, this._g, this._b, this._a), n = t, i = this._gradientType ? "GradientType = 1, " : "";
|
|
112
|
+
if (e) {
|
|
113
|
+
var a = r(e);
|
|
114
|
+
n = "#" + f(a._r, a._g, a._b, a._a);
|
|
115
|
+
}
|
|
116
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + i + "startColorstr=" + t + ",endColorstr=" + n + ")";
|
|
117
|
+
},
|
|
118
|
+
toString: function(e) {
|
|
119
|
+
var t = !!e;
|
|
120
|
+
e ||= this._format;
|
|
121
|
+
var n = !1, r = this._a < 1 && this._a >= 0;
|
|
122
|
+
return !t && r && (e === "hex" || e === "hex6" || e === "hex3" || e === "hex4" || e === "hex8" || e === "name") ? e === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (n = this.toRgbString()), e === "prgb" && (n = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (n = this.toHexString()), e === "hex3" && (n = this.toHexString(!0)), e === "hex4" && (n = this.toHex8String(!0)), e === "hex8" && (n = this.toHex8String()), e === "name" && (n = this.toName()), e === "hsl" && (n = this.toHslString()), e === "hsv" && (n = this.toHsvString()), n || this.toHexString());
|
|
123
|
+
},
|
|
124
|
+
clone: function() {
|
|
125
|
+
return r(this.toString());
|
|
126
|
+
},
|
|
127
|
+
_applyModification: function(e, t) {
|
|
128
|
+
var n = e.apply(null, [this].concat([].slice.call(t)));
|
|
129
|
+
return this._r = n._r, this._g = n._g, this._b = n._b, this.setAlpha(n._a), this;
|
|
130
|
+
},
|
|
131
|
+
lighten: function() {
|
|
132
|
+
return this._applyModification(g, arguments);
|
|
133
|
+
},
|
|
134
|
+
brighten: function() {
|
|
135
|
+
return this._applyModification(_, arguments);
|
|
136
|
+
},
|
|
137
|
+
darken: function() {
|
|
138
|
+
return this._applyModification(v, arguments);
|
|
139
|
+
},
|
|
140
|
+
desaturate: function() {
|
|
141
|
+
return this._applyModification(p, arguments);
|
|
142
|
+
},
|
|
143
|
+
saturate: function() {
|
|
144
|
+
return this._applyModification(m, arguments);
|
|
145
|
+
},
|
|
146
|
+
greyscale: function() {
|
|
147
|
+
return this._applyModification(h, arguments);
|
|
148
|
+
},
|
|
149
|
+
spin: function() {
|
|
150
|
+
return this._applyModification(y, arguments);
|
|
151
|
+
},
|
|
152
|
+
_applyCombination: function(e, t) {
|
|
153
|
+
return e.apply(null, [this].concat([].slice.call(t)));
|
|
154
|
+
},
|
|
155
|
+
analogous: function() {
|
|
156
|
+
return this._applyCombination(C, arguments);
|
|
157
|
+
},
|
|
158
|
+
complement: function() {
|
|
159
|
+
return this._applyCombination(b, arguments);
|
|
160
|
+
},
|
|
161
|
+
monochromatic: function() {
|
|
162
|
+
return this._applyCombination(w, arguments);
|
|
163
|
+
},
|
|
164
|
+
splitcomplement: function() {
|
|
165
|
+
return this._applyCombination(S, arguments);
|
|
166
|
+
},
|
|
167
|
+
triad: function() {
|
|
168
|
+
return this._applyCombination(x, [3]);
|
|
169
|
+
},
|
|
170
|
+
tetrad: function() {
|
|
171
|
+
return this._applyCombination(x, [4]);
|
|
172
|
+
}
|
|
173
|
+
}, r.fromRatio = function(t, n) {
|
|
174
|
+
if (e(t) == "object") {
|
|
175
|
+
var i = {};
|
|
176
|
+
for (var a in t) t.hasOwnProperty(a) && (a === "a" ? i[a] = t[a] : i[a] = F(t[a]));
|
|
177
|
+
t = i;
|
|
178
|
+
}
|
|
179
|
+
return r(t, n);
|
|
180
|
+
};
|
|
181
|
+
function i(t) {
|
|
182
|
+
var n = {
|
|
183
|
+
r: 0,
|
|
184
|
+
g: 0,
|
|
185
|
+
b: 0
|
|
186
|
+
}, r = 1, i = null, o = null, c = null, u = !1, d = !1;
|
|
187
|
+
return typeof t == "string" && (t = B(t)), e(t) == "object" && (z(t.r) && z(t.g) && z(t.b) ? (n = a(t.r, t.g, t.b), u = !0, d = String(t.r).substr(-1) === "%" ? "prgb" : "rgb") : z(t.h) && z(t.s) && z(t.v) ? (i = F(t.s), o = F(t.v), n = l(t.h, i, o), u = !0, d = "hsv") : z(t.h) && z(t.s) && z(t.l) && (i = F(t.s), c = F(t.l), n = s(t.h, i, c), u = !0, d = "hsl"), t.hasOwnProperty("a") && (r = t.a)), r = O(r), {
|
|
188
|
+
ok: u,
|
|
189
|
+
format: t.format || d,
|
|
190
|
+
r: Math.min(255, Math.max(n.r, 0)),
|
|
191
|
+
g: Math.min(255, Math.max(n.g, 0)),
|
|
192
|
+
b: Math.min(255, Math.max(n.b, 0)),
|
|
193
|
+
a: r
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function a(e, t, n) {
|
|
197
|
+
return {
|
|
198
|
+
r: k(e, 255) * 255,
|
|
199
|
+
g: k(t, 255) * 255,
|
|
200
|
+
b: k(n, 255) * 255
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function o(e, t, n) {
|
|
204
|
+
e = k(e, 255), t = k(t, 255), n = k(n, 255);
|
|
205
|
+
var r = Math.max(e, t, n), i = Math.min(e, t, n), a, o, s = (r + i) / 2;
|
|
206
|
+
if (r == i) a = o = 0;
|
|
207
|
+
else {
|
|
208
|
+
var c = r - i;
|
|
209
|
+
switch (o = s > .5 ? c / (2 - r - i) : c / (r + i), r) {
|
|
210
|
+
case e:
|
|
211
|
+
a = (t - n) / c + (t < n ? 6 : 0);
|
|
212
|
+
break;
|
|
213
|
+
case t:
|
|
214
|
+
a = (n - e) / c + 2;
|
|
215
|
+
break;
|
|
216
|
+
case n:
|
|
217
|
+
a = (e - t) / c + 4;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
a /= 6;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
h: a,
|
|
224
|
+
s: o,
|
|
225
|
+
l: s
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function s(e, t, n) {
|
|
229
|
+
var r, i, a;
|
|
230
|
+
e = k(e, 360), t = k(t, 100), n = k(n, 100);
|
|
231
|
+
function o(e, t, n) {
|
|
232
|
+
return n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
|
|
233
|
+
}
|
|
234
|
+
if (t === 0) r = i = a = n;
|
|
235
|
+
else {
|
|
236
|
+
var s = n < .5 ? n * (1 + t) : n + t - n * t, c = 2 * n - s;
|
|
237
|
+
r = o(c, s, e + 1 / 3), i = o(c, s, e), a = o(c, s, e - 1 / 3);
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
r: r * 255,
|
|
241
|
+
g: i * 255,
|
|
242
|
+
b: a * 255
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function c(e, t, n) {
|
|
246
|
+
e = k(e, 255), t = k(t, 255), n = k(n, 255);
|
|
247
|
+
var r = Math.max(e, t, n), i = Math.min(e, t, n), a, o, s = r, c = r - i;
|
|
248
|
+
if (o = r === 0 ? 0 : c / r, r == i) a = 0;
|
|
249
|
+
else {
|
|
250
|
+
switch (r) {
|
|
251
|
+
case e:
|
|
252
|
+
a = (t - n) / c + (t < n ? 6 : 0);
|
|
253
|
+
break;
|
|
254
|
+
case t:
|
|
255
|
+
a = (n - e) / c + 2;
|
|
256
|
+
break;
|
|
257
|
+
case n:
|
|
258
|
+
a = (e - t) / c + 4;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
a /= 6;
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
h: a,
|
|
265
|
+
s: o,
|
|
266
|
+
v: s
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function l(e, t, n) {
|
|
270
|
+
e = k(e, 360) * 6, t = k(t, 100), n = k(n, 100);
|
|
271
|
+
var r = Math.floor(e), i = e - r, a = n * (1 - t), o = n * (1 - i * t), s = n * (1 - (1 - i) * t), c = r % 6, l = [
|
|
272
|
+
n,
|
|
273
|
+
o,
|
|
274
|
+
a,
|
|
275
|
+
a,
|
|
276
|
+
s,
|
|
277
|
+
n
|
|
278
|
+
][c], u = [
|
|
279
|
+
s,
|
|
280
|
+
n,
|
|
281
|
+
n,
|
|
282
|
+
o,
|
|
283
|
+
a,
|
|
284
|
+
a
|
|
285
|
+
][c], d = [
|
|
286
|
+
a,
|
|
287
|
+
a,
|
|
288
|
+
s,
|
|
289
|
+
n,
|
|
290
|
+
n,
|
|
291
|
+
o
|
|
292
|
+
][c];
|
|
293
|
+
return {
|
|
294
|
+
r: l * 255,
|
|
295
|
+
g: u * 255,
|
|
296
|
+
b: d * 255
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function u(e, t, n, r) {
|
|
300
|
+
var i = [
|
|
301
|
+
P(Math.round(e).toString(16)),
|
|
302
|
+
P(Math.round(t).toString(16)),
|
|
303
|
+
P(Math.round(n).toString(16))
|
|
304
|
+
];
|
|
305
|
+
return r && i[0].charAt(0) == i[0].charAt(1) && i[1].charAt(0) == i[1].charAt(1) && i[2].charAt(0) == i[2].charAt(1) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) : i.join("");
|
|
306
|
+
}
|
|
307
|
+
function d(e, t, n, r, i) {
|
|
308
|
+
var a = [
|
|
309
|
+
P(Math.round(e).toString(16)),
|
|
310
|
+
P(Math.round(t).toString(16)),
|
|
311
|
+
P(Math.round(n).toString(16)),
|
|
312
|
+
P(I(r))
|
|
313
|
+
];
|
|
314
|
+
return i && a[0].charAt(0) == a[0].charAt(1) && a[1].charAt(0) == a[1].charAt(1) && a[2].charAt(0) == a[2].charAt(1) && a[3].charAt(0) == a[3].charAt(1) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) + a[3].charAt(0) : a.join("");
|
|
315
|
+
}
|
|
316
|
+
function f(e, t, n, r) {
|
|
317
|
+
return [
|
|
318
|
+
P(I(r)),
|
|
319
|
+
P(Math.round(e).toString(16)),
|
|
320
|
+
P(Math.round(t).toString(16)),
|
|
321
|
+
P(Math.round(n).toString(16))
|
|
322
|
+
].join("");
|
|
323
|
+
}
|
|
324
|
+
r.equals = function(e, t) {
|
|
325
|
+
return !e || !t ? !1 : r(e).toRgbString() == r(t).toRgbString();
|
|
326
|
+
}, r.random = function() {
|
|
327
|
+
return r.fromRatio({
|
|
328
|
+
r: Math.random(),
|
|
329
|
+
g: Math.random(),
|
|
330
|
+
b: Math.random()
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
function p(e, t) {
|
|
334
|
+
t = t === 0 ? 0 : t || 10;
|
|
335
|
+
var n = r(e).toHsl();
|
|
336
|
+
return n.s -= t / 100, n.s = A(n.s), r(n);
|
|
337
|
+
}
|
|
338
|
+
function m(e, t) {
|
|
339
|
+
t = t === 0 ? 0 : t || 10;
|
|
340
|
+
var n = r(e).toHsl();
|
|
341
|
+
return n.s += t / 100, n.s = A(n.s), r(n);
|
|
342
|
+
}
|
|
343
|
+
function h(e) {
|
|
344
|
+
return r(e).desaturate(100);
|
|
345
|
+
}
|
|
346
|
+
function g(e, t) {
|
|
347
|
+
t = t === 0 ? 0 : t || 10;
|
|
348
|
+
var n = r(e).toHsl();
|
|
349
|
+
return n.l += t / 100, n.l = A(n.l), r(n);
|
|
350
|
+
}
|
|
351
|
+
function _(e, t) {
|
|
352
|
+
t = t === 0 ? 0 : t || 10;
|
|
353
|
+
var n = r(e).toRgb();
|
|
354
|
+
return n.r = Math.max(0, Math.min(255, n.r - Math.round(255 * -(t / 100)))), n.g = Math.max(0, Math.min(255, n.g - Math.round(255 * -(t / 100)))), n.b = Math.max(0, Math.min(255, n.b - Math.round(255 * -(t / 100)))), r(n);
|
|
355
|
+
}
|
|
356
|
+
function v(e, t) {
|
|
357
|
+
t = t === 0 ? 0 : t || 10;
|
|
358
|
+
var n = r(e).toHsl();
|
|
359
|
+
return n.l -= t / 100, n.l = A(n.l), r(n);
|
|
360
|
+
}
|
|
361
|
+
function y(e, t) {
|
|
362
|
+
var n = r(e).toHsl(), i = (n.h + t) % 360;
|
|
363
|
+
return n.h = i < 0 ? 360 + i : i, r(n);
|
|
364
|
+
}
|
|
365
|
+
function b(e) {
|
|
366
|
+
var t = r(e).toHsl();
|
|
367
|
+
return t.h = (t.h + 180) % 360, r(t);
|
|
368
|
+
}
|
|
369
|
+
function x(e, t) {
|
|
370
|
+
if (isNaN(t) || t <= 0) throw Error("Argument to polyad must be a positive number");
|
|
371
|
+
for (var n = r(e).toHsl(), i = [r(e)], a = 360 / t, o = 1; o < t; o++) i.push(r({
|
|
372
|
+
h: (n.h + o * a) % 360,
|
|
373
|
+
s: n.s,
|
|
374
|
+
l: n.l
|
|
375
|
+
}));
|
|
376
|
+
return i;
|
|
377
|
+
}
|
|
378
|
+
function S(e) {
|
|
379
|
+
var t = r(e).toHsl(), n = t.h;
|
|
380
|
+
return [
|
|
381
|
+
r(e),
|
|
382
|
+
r({
|
|
383
|
+
h: (n + 72) % 360,
|
|
384
|
+
s: t.s,
|
|
385
|
+
l: t.l
|
|
386
|
+
}),
|
|
387
|
+
r({
|
|
388
|
+
h: (n + 216) % 360,
|
|
389
|
+
s: t.s,
|
|
390
|
+
l: t.l
|
|
391
|
+
})
|
|
392
|
+
];
|
|
393
|
+
}
|
|
394
|
+
function C(e, t, n) {
|
|
395
|
+
t ||= 6, n ||= 30;
|
|
396
|
+
var i = r(e).toHsl(), a = 360 / n, o = [r(e)];
|
|
397
|
+
for (i.h = (i.h - (a * t >> 1) + 720) % 360; --t;) i.h = (i.h + a) % 360, o.push(r(i));
|
|
398
|
+
return o;
|
|
399
|
+
}
|
|
400
|
+
function w(e, t) {
|
|
401
|
+
t ||= 6;
|
|
402
|
+
for (var n = r(e).toHsv(), i = n.h, a = n.s, o = n.v, s = [], c = 1 / t; t--;) s.push(r({
|
|
403
|
+
h: i,
|
|
404
|
+
s: a,
|
|
405
|
+
v: o
|
|
406
|
+
})), o = (o + c) % 1;
|
|
407
|
+
return s;
|
|
408
|
+
}
|
|
409
|
+
r.mix = function(e, t, n) {
|
|
410
|
+
n = n === 0 ? 0 : n || 50;
|
|
411
|
+
var i = r(e).toRgb(), a = r(t).toRgb(), o = n / 100;
|
|
412
|
+
return r({
|
|
413
|
+
r: (a.r - i.r) * o + i.r,
|
|
414
|
+
g: (a.g - i.g) * o + i.g,
|
|
415
|
+
b: (a.b - i.b) * o + i.b,
|
|
416
|
+
a: (a.a - i.a) * o + i.a
|
|
417
|
+
});
|
|
418
|
+
}, r.readability = function(e, t) {
|
|
419
|
+
var n = r(e), i = r(t);
|
|
420
|
+
return (Math.max(n.getLuminance(), i.getLuminance()) + .05) / (Math.min(n.getLuminance(), i.getLuminance()) + .05);
|
|
421
|
+
}, r.isReadable = function(e, t, n) {
|
|
422
|
+
var i = r.readability(e, t), a, o = !1;
|
|
423
|
+
switch (a = V(n), a.level + a.size) {
|
|
424
|
+
case "AAsmall":
|
|
425
|
+
case "AAAlarge":
|
|
426
|
+
o = i >= 4.5;
|
|
427
|
+
break;
|
|
428
|
+
case "AAlarge":
|
|
429
|
+
o = i >= 3;
|
|
430
|
+
break;
|
|
431
|
+
case "AAAsmall":
|
|
432
|
+
o = i >= 7;
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
return o;
|
|
436
|
+
}, r.mostReadable = function(e, t, n) {
|
|
437
|
+
var i = null, a = 0, o, s, c, l;
|
|
438
|
+
n ||= {}, s = n.includeFallbackColors, c = n.level, l = n.size;
|
|
439
|
+
for (var u = 0; u < t.length; u++) o = r.readability(e, t[u]), o > a && (a = o, i = r(t[u]));
|
|
440
|
+
return r.isReadable(e, i, {
|
|
441
|
+
level: c,
|
|
442
|
+
size: l
|
|
443
|
+
}) || !s ? i : (n.includeFallbackColors = !1, r.mostReadable(e, ["#fff", "#000"], n));
|
|
444
|
+
};
|
|
445
|
+
var T = r.names = {
|
|
446
|
+
aliceblue: "f0f8ff",
|
|
447
|
+
antiquewhite: "faebd7",
|
|
448
|
+
aqua: "0ff",
|
|
449
|
+
aquamarine: "7fffd4",
|
|
450
|
+
azure: "f0ffff",
|
|
451
|
+
beige: "f5f5dc",
|
|
452
|
+
bisque: "ffe4c4",
|
|
453
|
+
black: "000",
|
|
454
|
+
blanchedalmond: "ffebcd",
|
|
455
|
+
blue: "00f",
|
|
456
|
+
blueviolet: "8a2be2",
|
|
457
|
+
brown: "a52a2a",
|
|
458
|
+
burlywood: "deb887",
|
|
459
|
+
burntsienna: "ea7e5d",
|
|
460
|
+
cadetblue: "5f9ea0",
|
|
461
|
+
chartreuse: "7fff00",
|
|
462
|
+
chocolate: "d2691e",
|
|
463
|
+
coral: "ff7f50",
|
|
464
|
+
cornflowerblue: "6495ed",
|
|
465
|
+
cornsilk: "fff8dc",
|
|
466
|
+
crimson: "dc143c",
|
|
467
|
+
cyan: "0ff",
|
|
468
|
+
darkblue: "00008b",
|
|
469
|
+
darkcyan: "008b8b",
|
|
470
|
+
darkgoldenrod: "b8860b",
|
|
471
|
+
darkgray: "a9a9a9",
|
|
472
|
+
darkgreen: "006400",
|
|
473
|
+
darkgrey: "a9a9a9",
|
|
474
|
+
darkkhaki: "bdb76b",
|
|
475
|
+
darkmagenta: "8b008b",
|
|
476
|
+
darkolivegreen: "556b2f",
|
|
477
|
+
darkorange: "ff8c00",
|
|
478
|
+
darkorchid: "9932cc",
|
|
479
|
+
darkred: "8b0000",
|
|
480
|
+
darksalmon: "e9967a",
|
|
481
|
+
darkseagreen: "8fbc8f",
|
|
482
|
+
darkslateblue: "483d8b",
|
|
483
|
+
darkslategray: "2f4f4f",
|
|
484
|
+
darkslategrey: "2f4f4f",
|
|
485
|
+
darkturquoise: "00ced1",
|
|
486
|
+
darkviolet: "9400d3",
|
|
487
|
+
deeppink: "ff1493",
|
|
488
|
+
deepskyblue: "00bfff",
|
|
489
|
+
dimgray: "696969",
|
|
490
|
+
dimgrey: "696969",
|
|
491
|
+
dodgerblue: "1e90ff",
|
|
492
|
+
firebrick: "b22222",
|
|
493
|
+
floralwhite: "fffaf0",
|
|
494
|
+
forestgreen: "228b22",
|
|
495
|
+
fuchsia: "f0f",
|
|
496
|
+
gainsboro: "dcdcdc",
|
|
497
|
+
ghostwhite: "f8f8ff",
|
|
498
|
+
gold: "ffd700",
|
|
499
|
+
goldenrod: "daa520",
|
|
500
|
+
gray: "808080",
|
|
501
|
+
green: "008000",
|
|
502
|
+
greenyellow: "adff2f",
|
|
503
|
+
grey: "808080",
|
|
504
|
+
honeydew: "f0fff0",
|
|
505
|
+
hotpink: "ff69b4",
|
|
506
|
+
indianred: "cd5c5c",
|
|
507
|
+
indigo: "4b0082",
|
|
508
|
+
ivory: "fffff0",
|
|
509
|
+
khaki: "f0e68c",
|
|
510
|
+
lavender: "e6e6fa",
|
|
511
|
+
lavenderblush: "fff0f5",
|
|
512
|
+
lawngreen: "7cfc00",
|
|
513
|
+
lemonchiffon: "fffacd",
|
|
514
|
+
lightblue: "add8e6",
|
|
515
|
+
lightcoral: "f08080",
|
|
516
|
+
lightcyan: "e0ffff",
|
|
517
|
+
lightgoldenrodyellow: "fafad2",
|
|
518
|
+
lightgray: "d3d3d3",
|
|
519
|
+
lightgreen: "90ee90",
|
|
520
|
+
lightgrey: "d3d3d3",
|
|
521
|
+
lightpink: "ffb6c1",
|
|
522
|
+
lightsalmon: "ffa07a",
|
|
523
|
+
lightseagreen: "20b2aa",
|
|
524
|
+
lightskyblue: "87cefa",
|
|
525
|
+
lightslategray: "789",
|
|
526
|
+
lightslategrey: "789",
|
|
527
|
+
lightsteelblue: "b0c4de",
|
|
528
|
+
lightyellow: "ffffe0",
|
|
529
|
+
lime: "0f0",
|
|
530
|
+
limegreen: "32cd32",
|
|
531
|
+
linen: "faf0e6",
|
|
532
|
+
magenta: "f0f",
|
|
533
|
+
maroon: "800000",
|
|
534
|
+
mediumaquamarine: "66cdaa",
|
|
535
|
+
mediumblue: "0000cd",
|
|
536
|
+
mediumorchid: "ba55d3",
|
|
537
|
+
mediumpurple: "9370db",
|
|
538
|
+
mediumseagreen: "3cb371",
|
|
539
|
+
mediumslateblue: "7b68ee",
|
|
540
|
+
mediumspringgreen: "00fa9a",
|
|
541
|
+
mediumturquoise: "48d1cc",
|
|
542
|
+
mediumvioletred: "c71585",
|
|
543
|
+
midnightblue: "191970",
|
|
544
|
+
mintcream: "f5fffa",
|
|
545
|
+
mistyrose: "ffe4e1",
|
|
546
|
+
moccasin: "ffe4b5",
|
|
547
|
+
navajowhite: "ffdead",
|
|
548
|
+
navy: "000080",
|
|
549
|
+
oldlace: "fdf5e6",
|
|
550
|
+
olive: "808000",
|
|
551
|
+
olivedrab: "6b8e23",
|
|
552
|
+
orange: "ffa500",
|
|
553
|
+
orangered: "ff4500",
|
|
554
|
+
orchid: "da70d6",
|
|
555
|
+
palegoldenrod: "eee8aa",
|
|
556
|
+
palegreen: "98fb98",
|
|
557
|
+
paleturquoise: "afeeee",
|
|
558
|
+
palevioletred: "db7093",
|
|
559
|
+
papayawhip: "ffefd5",
|
|
560
|
+
peachpuff: "ffdab9",
|
|
561
|
+
peru: "cd853f",
|
|
562
|
+
pink: "ffc0cb",
|
|
563
|
+
plum: "dda0dd",
|
|
564
|
+
powderblue: "b0e0e6",
|
|
565
|
+
purple: "800080",
|
|
566
|
+
rebeccapurple: "663399",
|
|
567
|
+
red: "f00",
|
|
568
|
+
rosybrown: "bc8f8f",
|
|
569
|
+
royalblue: "4169e1",
|
|
570
|
+
saddlebrown: "8b4513",
|
|
571
|
+
salmon: "fa8072",
|
|
572
|
+
sandybrown: "f4a460",
|
|
573
|
+
seagreen: "2e8b57",
|
|
574
|
+
seashell: "fff5ee",
|
|
575
|
+
sienna: "a0522d",
|
|
576
|
+
silver: "c0c0c0",
|
|
577
|
+
skyblue: "87ceeb",
|
|
578
|
+
slateblue: "6a5acd",
|
|
579
|
+
slategray: "708090",
|
|
580
|
+
slategrey: "708090",
|
|
581
|
+
snow: "fffafa",
|
|
582
|
+
springgreen: "00ff7f",
|
|
583
|
+
steelblue: "4682b4",
|
|
584
|
+
tan: "d2b48c",
|
|
585
|
+
teal: "008080",
|
|
586
|
+
thistle: "d8bfd8",
|
|
587
|
+
tomato: "ff6347",
|
|
588
|
+
turquoise: "40e0d0",
|
|
589
|
+
violet: "ee82ee",
|
|
590
|
+
wheat: "f5deb3",
|
|
591
|
+
white: "fff",
|
|
592
|
+
whitesmoke: "f5f5f5",
|
|
593
|
+
yellow: "ff0",
|
|
594
|
+
yellowgreen: "9acd32"
|
|
595
|
+
}, E = r.hexNames = D(T);
|
|
596
|
+
function D(e) {
|
|
597
|
+
var t = {};
|
|
598
|
+
for (var n in e) e.hasOwnProperty(n) && (t[e[n]] = n);
|
|
599
|
+
return t;
|
|
600
|
+
}
|
|
601
|
+
function O(e) {
|
|
602
|
+
return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
|
|
603
|
+
}
|
|
604
|
+
function k(e, t) {
|
|
605
|
+
M(e) && (e = "100%");
|
|
606
|
+
var n = N(e);
|
|
607
|
+
return e = Math.min(t, Math.max(0, parseFloat(e))), n && (e = parseInt(e * t, 10) / 100), Math.abs(e - t) < 1e-6 ? 1 : e % t / parseFloat(t);
|
|
608
|
+
}
|
|
609
|
+
function A(e) {
|
|
610
|
+
return Math.min(1, Math.max(0, e));
|
|
611
|
+
}
|
|
612
|
+
function j(e) {
|
|
613
|
+
return parseInt(e, 16);
|
|
614
|
+
}
|
|
615
|
+
function M(e) {
|
|
616
|
+
return typeof e == "string" && e.indexOf(".") != -1 && parseFloat(e) === 1;
|
|
617
|
+
}
|
|
618
|
+
function N(e) {
|
|
619
|
+
return typeof e == "string" && e.indexOf("%") != -1;
|
|
620
|
+
}
|
|
621
|
+
function P(e) {
|
|
622
|
+
return e.length == 1 ? "0" + e : "" + e;
|
|
623
|
+
}
|
|
624
|
+
function F(e) {
|
|
625
|
+
return e <= 1 && (e = e * 100 + "%"), e;
|
|
626
|
+
}
|
|
627
|
+
function I(e) {
|
|
628
|
+
return Math.round(parseFloat(e) * 255).toString(16);
|
|
629
|
+
}
|
|
630
|
+
function L(e) {
|
|
631
|
+
return j(e) / 255;
|
|
632
|
+
}
|
|
633
|
+
var R = function() {
|
|
634
|
+
var e = "(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)", t = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?", n = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?";
|
|
635
|
+
return {
|
|
636
|
+
CSS_UNIT: new RegExp(e),
|
|
637
|
+
rgb: RegExp("rgb" + t),
|
|
638
|
+
rgba: RegExp("rgba" + n),
|
|
639
|
+
hsl: RegExp("hsl" + t),
|
|
640
|
+
hsla: RegExp("hsla" + n),
|
|
641
|
+
hsv: RegExp("hsv" + t),
|
|
642
|
+
hsva: RegExp("hsva" + n),
|
|
643
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
644
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
645
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
646
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
647
|
+
};
|
|
648
|
+
}();
|
|
649
|
+
function z(e) {
|
|
650
|
+
return !!R.CSS_UNIT.exec(e);
|
|
651
|
+
}
|
|
652
|
+
function B(e) {
|
|
653
|
+
e = e.replace(t, "").replace(n, "").toLowerCase();
|
|
654
|
+
var r = !1;
|
|
655
|
+
if (T[e]) e = T[e], r = !0;
|
|
656
|
+
else if (e == "transparent") return {
|
|
657
|
+
r: 0,
|
|
658
|
+
g: 0,
|
|
659
|
+
b: 0,
|
|
660
|
+
a: 0,
|
|
661
|
+
format: "name"
|
|
662
|
+
};
|
|
663
|
+
var i;
|
|
664
|
+
return (i = R.rgb.exec(e)) ? {
|
|
665
|
+
r: i[1],
|
|
666
|
+
g: i[2],
|
|
667
|
+
b: i[3]
|
|
668
|
+
} : (i = R.rgba.exec(e)) ? {
|
|
669
|
+
r: i[1],
|
|
670
|
+
g: i[2],
|
|
671
|
+
b: i[3],
|
|
672
|
+
a: i[4]
|
|
673
|
+
} : (i = R.hsl.exec(e)) ? {
|
|
674
|
+
h: i[1],
|
|
675
|
+
s: i[2],
|
|
676
|
+
l: i[3]
|
|
677
|
+
} : (i = R.hsla.exec(e)) ? {
|
|
678
|
+
h: i[1],
|
|
679
|
+
s: i[2],
|
|
680
|
+
l: i[3],
|
|
681
|
+
a: i[4]
|
|
682
|
+
} : (i = R.hsv.exec(e)) ? {
|
|
683
|
+
h: i[1],
|
|
684
|
+
s: i[2],
|
|
685
|
+
v: i[3]
|
|
686
|
+
} : (i = R.hsva.exec(e)) ? {
|
|
687
|
+
h: i[1],
|
|
688
|
+
s: i[2],
|
|
689
|
+
v: i[3],
|
|
690
|
+
a: i[4]
|
|
691
|
+
} : (i = R.hex8.exec(e)) ? {
|
|
692
|
+
r: j(i[1]),
|
|
693
|
+
g: j(i[2]),
|
|
694
|
+
b: j(i[3]),
|
|
695
|
+
a: L(i[4]),
|
|
696
|
+
format: r ? "name" : "hex8"
|
|
697
|
+
} : (i = R.hex6.exec(e)) ? {
|
|
698
|
+
r: j(i[1]),
|
|
699
|
+
g: j(i[2]),
|
|
700
|
+
b: j(i[3]),
|
|
701
|
+
format: r ? "name" : "hex"
|
|
702
|
+
} : (i = R.hex4.exec(e)) ? {
|
|
703
|
+
r: j(i[1] + "" + i[1]),
|
|
704
|
+
g: j(i[2] + "" + i[2]),
|
|
705
|
+
b: j(i[3] + "" + i[3]),
|
|
706
|
+
a: L(i[4] + "" + i[4]),
|
|
707
|
+
format: r ? "name" : "hex8"
|
|
708
|
+
} : (i = R.hex3.exec(e)) ? {
|
|
709
|
+
r: j(i[1] + "" + i[1]),
|
|
710
|
+
g: j(i[2] + "" + i[2]),
|
|
711
|
+
b: j(i[3] + "" + i[3]),
|
|
712
|
+
format: r ? "name" : "hex"
|
|
713
|
+
} : !1;
|
|
714
|
+
}
|
|
715
|
+
function V(e) {
|
|
716
|
+
var t, n;
|
|
717
|
+
return e ||= {
|
|
718
|
+
level: "AA",
|
|
719
|
+
size: "small"
|
|
720
|
+
}, t = (e.level || "AA").toUpperCase(), n = (e.size || "small").toLowerCase(), t !== "AA" && t !== "AAA" && (t = "AA"), n !== "small" && n !== "large" && (n = "small"), {
|
|
721
|
+
level: t,
|
|
722
|
+
size: n
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
//#endregion
|
|
726
|
+
export { r as t };
|