mvframe 1.0.16 → 1.0.18

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.
Files changed (48) hide show
  1. package/dist/@ctrl.js +710 -0
  2. package/dist/@element-plus.js +659 -0
  3. package/dist/@floating-ui.js +997 -0
  4. package/dist/@sxzz.js +552 -0
  5. package/dist/@turf.js +1 -0
  6. package/dist/@visactor.js +55144 -0
  7. package/dist/@vue.js +30 -0
  8. package/dist/@vueuse.js +583 -0
  9. package/dist/Config.js +131 -109
  10. package/dist/async-validator.js +648 -0
  11. package/dist/composition.js +104 -96
  12. package/dist/css/cpt.css +1 -1
  13. package/dist/css/style.css +1 -1
  14. package/dist/cssfontparser.js +103 -0
  15. package/dist/d3-array.js +1 -0
  16. package/dist/d3-dsv.js +1 -0
  17. package/dist/d3-geo.js +1 -0
  18. package/dist/d3-hexbin.js +1 -0
  19. package/dist/d3-hierarchy.js +1 -0
  20. package/dist/dayjs.js +642 -0
  21. package/dist/element-plus.js +33909 -0
  22. package/dist/eventemitter3.js +113 -0
  23. package/dist/geobuf.js +1 -0
  24. package/dist/geojson-dissolve.js +1 -0
  25. package/dist/geojson-flatten.js +1 -0
  26. package/dist/geojson-linestring-dissolve.js +1 -0
  27. package/dist/gifuct-js.js +110 -0
  28. package/dist/ieee754.js +1 -0
  29. package/dist/index.js +15 -3007
  30. package/dist/js-binary-schema-parser.js +307 -0
  31. package/dist/lodash-es.js +1352 -0
  32. package/dist/lodash-unified.js +1 -0
  33. package/dist/lodash.js +597 -0
  34. package/dist/lottie-web.js +1 -0
  35. package/dist/maps.js +10 -0
  36. package/dist/memoize-one.js +36 -0
  37. package/dist/normalize-wheel-es.js +88 -0
  38. package/dist/pbf.js +1 -0
  39. package/dist/roughjs.js +1 -0
  40. package/dist/simple-statistics.js +1 -0
  41. package/dist/simplify-geojson.js +1 -0
  42. package/dist/simplify-geometry.js +1 -0
  43. package/dist/topojson-client.js +1 -0
  44. package/dist/topojson-server.js +1 -0
  45. package/dist/util.js +28 -26
  46. package/dist/vendor.js +5201 -0
  47. package/package.json +12 -4
  48. package/scripts/scaffold-app.js +70 -10
package/dist/@ctrl.js ADDED
@@ -0,0 +1,710 @@
1
+ function u(r, e) {
2
+ E(r) && (r = "100%");
3
+ const t = I(r);
4
+ return r = e === 360 ? r : Math.min(e, Math.max(0, parseFloat(r))), t && (r = parseInt(String(r * e), 10) / 100), Math.abs(r - e) < 1e-6 ? 1 : (e === 360 ? r = (r < 0 ? r % e + e : r % e) / parseFloat(String(e)) : r = r % e / parseFloat(String(e)), r);
5
+ }
6
+ function m(r) {
7
+ return Math.min(1, Math.max(0, r));
8
+ }
9
+ function E(r) {
10
+ return typeof r == "string" && r.indexOf(".") !== -1 && parseFloat(r) === 1;
11
+ }
12
+ function I(r) {
13
+ return typeof r == "string" && r.indexOf("%") !== -1;
14
+ }
15
+ function F(r) {
16
+ return r = parseFloat(r), (isNaN(r) || r < 0 || r > 1) && (r = 1), r;
17
+ }
18
+ function p(r) {
19
+ return Number(r) <= 1 ? `${Number(r) * 100}%` : r;
20
+ }
21
+ function l(r) {
22
+ return r.length === 1 ? "0" + r : String(r);
23
+ }
24
+ function B(r, e, t) {
25
+ return {
26
+ r: u(r, 255) * 255,
27
+ g: u(e, 255) * 255,
28
+ b: u(t, 255) * 255
29
+ };
30
+ }
31
+ function v(r, e, t) {
32
+ r = u(r, 255), e = u(e, 255), t = u(t, 255);
33
+ const n = Math.max(r, e, t), s = Math.min(r, e, t);
34
+ let a = 0, i = 0;
35
+ const h = (n + s) / 2;
36
+ if (n === s)
37
+ i = 0, a = 0;
38
+ else {
39
+ const o = n - s;
40
+ switch (i = h > 0.5 ? o / (2 - n - s) : o / (n + s), n) {
41
+ case r:
42
+ a = (e - t) / o + (e < t ? 6 : 0);
43
+ break;
44
+ case e:
45
+ a = (t - r) / o + 2;
46
+ break;
47
+ case t:
48
+ a = (r - e) / o + 4;
49
+ break;
50
+ }
51
+ a /= 6;
52
+ }
53
+ return { h: a, s: i, l: h };
54
+ }
55
+ function w(r, e, t) {
56
+ return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? r + (e - r) * (6 * t) : t < 1 / 2 ? e : t < 2 / 3 ? r + (e - r) * (2 / 3 - t) * 6 : r;
57
+ }
58
+ function q(r, e, t) {
59
+ let n, s, a;
60
+ if (r = u(r, 360), e = u(e, 100), t = u(t, 100), e === 0)
61
+ s = t, a = t, n = t;
62
+ else {
63
+ const i = t < 0.5 ? t * (1 + e) : t + e - t * e, h = 2 * t - i;
64
+ n = w(h, i, r + 1 / 3), s = w(h, i, r), a = w(h, i, r - 1 / 3);
65
+ }
66
+ return { r: n * 255, g: s * 255, b: a * 255 };
67
+ }
68
+ function A(r, e, t) {
69
+ r = u(r, 255), e = u(e, 255), t = u(t, 255);
70
+ const n = Math.max(r, e, t), s = Math.min(r, e, t);
71
+ let a = 0;
72
+ const i = n, h = n - s, o = n === 0 ? 0 : h / n;
73
+ if (n === s)
74
+ a = 0;
75
+ else {
76
+ switch (n) {
77
+ case r:
78
+ a = (e - t) / h + (e < t ? 6 : 0);
79
+ break;
80
+ case e:
81
+ a = (t - r) / h + 2;
82
+ break;
83
+ case t:
84
+ a = (r - e) / h + 4;
85
+ break;
86
+ }
87
+ a /= 6;
88
+ }
89
+ return { h: a, s: o, v: i };
90
+ }
91
+ function P(r, e, t) {
92
+ r = u(r, 360) * 6, e = u(e, 100), t = u(t, 100);
93
+ const n = Math.floor(r), s = r - n, a = t * (1 - e), i = t * (1 - s * e), h = t * (1 - (1 - s) * e), o = n % 6, x = [t, i, a, a, h, t][o], M = [h, t, t, i, a, a][o], N = [a, a, h, t, t, i][o];
94
+ return { r: x * 255, g: M * 255, b: N * 255 };
95
+ }
96
+ function H(r, e, t, n) {
97
+ const s = [
98
+ l(Math.round(r).toString(16)),
99
+ l(Math.round(e).toString(16)),
100
+ l(Math.round(t).toString(16))
101
+ ];
102
+ return n && s[0].startsWith(s[0].charAt(1)) && s[1].startsWith(s[1].charAt(1)) && s[2].startsWith(s[2].charAt(1)) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) : s.join("");
103
+ }
104
+ function j(r, e, t, n, s) {
105
+ const a = [
106
+ l(Math.round(r).toString(16)),
107
+ l(Math.round(e).toString(16)),
108
+ l(Math.round(t).toString(16)),
109
+ l(W(n))
110
+ ];
111
+ return s && a[0].startsWith(a[0].charAt(1)) && a[1].startsWith(a[1].charAt(1)) && a[2].startsWith(a[2].charAt(1)) && a[3].startsWith(a[3].charAt(1)) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) + a[3].charAt(0) : a.join("");
112
+ }
113
+ function O(r, e, t, n) {
114
+ const s = r / 100, a = e / 100, i = t / 100, h = n / 100, o = 255 * (1 - s) * (1 - h), x = 255 * (1 - a) * (1 - h), M = 255 * (1 - i) * (1 - h);
115
+ return { r: o, g: x, b: M };
116
+ }
117
+ function R(r, e, t) {
118
+ let n = 1 - r / 255, s = 1 - e / 255, a = 1 - t / 255, i = Math.min(n, s, a);
119
+ return i === 1 ? (n = 0, s = 0, a = 0) : (n = (n - i) / (1 - i) * 100, s = (s - i) / (1 - i) * 100, a = (a - i) / (1 - i) * 100), i *= 100, {
120
+ c: Math.round(n),
121
+ m: Math.round(s),
122
+ y: Math.round(a),
123
+ k: Math.round(i)
124
+ };
125
+ }
126
+ function W(r) {
127
+ return Math.round(parseFloat(r) * 255).toString(16);
128
+ }
129
+ function $(r) {
130
+ return c(r) / 255;
131
+ }
132
+ function c(r) {
133
+ return parseInt(r, 16);
134
+ }
135
+ function G(r) {
136
+ return {
137
+ r: r >> 16,
138
+ g: (r & 65280) >> 8,
139
+ b: r & 255
140
+ };
141
+ }
142
+ const y = {
143
+ aliceblue: "#f0f8ff",
144
+ antiquewhite: "#faebd7",
145
+ aqua: "#00ffff",
146
+ aquamarine: "#7fffd4",
147
+ azure: "#f0ffff",
148
+ beige: "#f5f5dc",
149
+ bisque: "#ffe4c4",
150
+ black: "#000000",
151
+ blanchedalmond: "#ffebcd",
152
+ blue: "#0000ff",
153
+ blueviolet: "#8a2be2",
154
+ brown: "#a52a2a",
155
+ burlywood: "#deb887",
156
+ cadetblue: "#5f9ea0",
157
+ chartreuse: "#7fff00",
158
+ chocolate: "#d2691e",
159
+ coral: "#ff7f50",
160
+ cornflowerblue: "#6495ed",
161
+ cornsilk: "#fff8dc",
162
+ crimson: "#dc143c",
163
+ cyan: "#00ffff",
164
+ darkblue: "#00008b",
165
+ darkcyan: "#008b8b",
166
+ darkgoldenrod: "#b8860b",
167
+ darkgray: "#a9a9a9",
168
+ darkgreen: "#006400",
169
+ darkgrey: "#a9a9a9",
170
+ darkkhaki: "#bdb76b",
171
+ darkmagenta: "#8b008b",
172
+ darkolivegreen: "#556b2f",
173
+ darkorange: "#ff8c00",
174
+ darkorchid: "#9932cc",
175
+ darkred: "#8b0000",
176
+ darksalmon: "#e9967a",
177
+ darkseagreen: "#8fbc8f",
178
+ darkslateblue: "#483d8b",
179
+ darkslategray: "#2f4f4f",
180
+ darkslategrey: "#2f4f4f",
181
+ darkturquoise: "#00ced1",
182
+ darkviolet: "#9400d3",
183
+ deeppink: "#ff1493",
184
+ deepskyblue: "#00bfff",
185
+ dimgray: "#696969",
186
+ dimgrey: "#696969",
187
+ dodgerblue: "#1e90ff",
188
+ firebrick: "#b22222",
189
+ floralwhite: "#fffaf0",
190
+ forestgreen: "#228b22",
191
+ fuchsia: "#ff00ff",
192
+ gainsboro: "#dcdcdc",
193
+ ghostwhite: "#f8f8ff",
194
+ goldenrod: "#daa520",
195
+ gold: "#ffd700",
196
+ gray: "#808080",
197
+ green: "#008000",
198
+ greenyellow: "#adff2f",
199
+ grey: "#808080",
200
+ honeydew: "#f0fff0",
201
+ hotpink: "#ff69b4",
202
+ indianred: "#cd5c5c",
203
+ indigo: "#4b0082",
204
+ ivory: "#fffff0",
205
+ khaki: "#f0e68c",
206
+ lavenderblush: "#fff0f5",
207
+ lavender: "#e6e6fa",
208
+ lawngreen: "#7cfc00",
209
+ lemonchiffon: "#fffacd",
210
+ lightblue: "#add8e6",
211
+ lightcoral: "#f08080",
212
+ lightcyan: "#e0ffff",
213
+ lightgoldenrodyellow: "#fafad2",
214
+ lightgray: "#d3d3d3",
215
+ lightgreen: "#90ee90",
216
+ lightgrey: "#d3d3d3",
217
+ lightpink: "#ffb6c1",
218
+ lightsalmon: "#ffa07a",
219
+ lightseagreen: "#20b2aa",
220
+ lightskyblue: "#87cefa",
221
+ lightslategray: "#778899",
222
+ lightslategrey: "#778899",
223
+ lightsteelblue: "#b0c4de",
224
+ lightyellow: "#ffffe0",
225
+ lime: "#00ff00",
226
+ limegreen: "#32cd32",
227
+ linen: "#faf0e6",
228
+ magenta: "#ff00ff",
229
+ maroon: "#800000",
230
+ mediumaquamarine: "#66cdaa",
231
+ mediumblue: "#0000cd",
232
+ mediumorchid: "#ba55d3",
233
+ mediumpurple: "#9370db",
234
+ mediumseagreen: "#3cb371",
235
+ mediumslateblue: "#7b68ee",
236
+ mediumspringgreen: "#00fa9a",
237
+ mediumturquoise: "#48d1cc",
238
+ mediumvioletred: "#c71585",
239
+ midnightblue: "#191970",
240
+ mintcream: "#f5fffa",
241
+ mistyrose: "#ffe4e1",
242
+ moccasin: "#ffe4b5",
243
+ navajowhite: "#ffdead",
244
+ navy: "#000080",
245
+ oldlace: "#fdf5e6",
246
+ olive: "#808000",
247
+ olivedrab: "#6b8e23",
248
+ orange: "#ffa500",
249
+ orangered: "#ff4500",
250
+ orchid: "#da70d6",
251
+ palegoldenrod: "#eee8aa",
252
+ palegreen: "#98fb98",
253
+ paleturquoise: "#afeeee",
254
+ palevioletred: "#db7093",
255
+ papayawhip: "#ffefd5",
256
+ peachpuff: "#ffdab9",
257
+ peru: "#cd853f",
258
+ pink: "#ffc0cb",
259
+ plum: "#dda0dd",
260
+ powderblue: "#b0e0e6",
261
+ purple: "#800080",
262
+ rebeccapurple: "#663399",
263
+ red: "#ff0000",
264
+ rosybrown: "#bc8f8f",
265
+ royalblue: "#4169e1",
266
+ saddlebrown: "#8b4513",
267
+ salmon: "#fa8072",
268
+ sandybrown: "#f4a460",
269
+ seagreen: "#2e8b57",
270
+ seashell: "#fff5ee",
271
+ sienna: "#a0522d",
272
+ silver: "#c0c0c0",
273
+ skyblue: "#87ceeb",
274
+ slateblue: "#6a5acd",
275
+ slategray: "#708090",
276
+ slategrey: "#708090",
277
+ snow: "#fffafa",
278
+ springgreen: "#00ff7f",
279
+ steelblue: "#4682b4",
280
+ tan: "#d2b48c",
281
+ teal: "#008080",
282
+ thistle: "#d8bfd8",
283
+ tomato: "#ff6347",
284
+ turquoise: "#40e0d0",
285
+ violet: "#ee82ee",
286
+ wheat: "#f5deb3",
287
+ white: "#ffffff",
288
+ whitesmoke: "#f5f5f5",
289
+ yellow: "#ffff00",
290
+ yellowgreen: "#9acd32"
291
+ };
292
+ function T(r) {
293
+ let e = { r: 0, g: 0, b: 0 }, t = 1, n = null, s = null, a = null, i = !1, h = !1;
294
+ return typeof r == "string" && (r = V(r)), typeof r == "object" && (g(r.r) && g(r.g) && g(r.b) ? (e = B(r.r, r.g, r.b), i = !0, h = String(r.r).substr(-1) === "%" ? "prgb" : "rgb") : g(r.h) && g(r.s) && g(r.v) ? (n = p(r.s), s = p(r.v), e = P(r.h, n, s), i = !0, h = "hsv") : g(r.h) && g(r.s) && g(r.l) ? (n = p(r.s), a = p(r.l), e = q(r.h, n, a), i = !0, h = "hsl") : g(r.c) && g(r.m) && g(r.y) && g(r.k) && (e = O(r.c, r.m, r.y, r.k), i = !0, h = "cmyk"), Object.prototype.hasOwnProperty.call(r, "a") && (t = r.a)), t = F(t), {
295
+ ok: i,
296
+ format: r.format || h,
297
+ r: Math.min(255, Math.max(e.r, 0)),
298
+ g: Math.min(255, Math.max(e.g, 0)),
299
+ b: Math.min(255, Math.max(e.b, 0)),
300
+ a: t
301
+ };
302
+ }
303
+ const U = "[-\\+]?\\d+%?", D = "[-\\+]?\\d*\\.\\d+%?", b = "(?:" + D + ")|(?:" + U + ")", S = "[\\s|\\(]+(" + b + ")[,|\\s]+(" + b + ")[,|\\s]+(" + b + ")\\s*\\)?", k = (
304
+ // eslint-disable-next-line prettier/prettier
305
+ "[\\s|\\(]+(" + b + ")[,|\\s]+(" + b + ")[,|\\s]+(" + b + ")[,|\\s]+(" + b + ")\\s*\\)?"
306
+ ), d = {
307
+ CSS_UNIT: new RegExp(b),
308
+ rgb: new RegExp("rgb" + S),
309
+ rgba: new RegExp("rgba" + k),
310
+ hsl: new RegExp("hsl" + S),
311
+ hsla: new RegExp("hsla" + k),
312
+ hsv: new RegExp("hsv" + S),
313
+ hsva: new RegExp("hsva" + k),
314
+ cmyk: new RegExp("cmyk" + k),
315
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
316
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
317
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
318
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
319
+ };
320
+ function V(r) {
321
+ if (r = r.trim().toLowerCase(), r.length === 0)
322
+ return !1;
323
+ let e = !1;
324
+ if (y[r])
325
+ r = y[r], e = !0;
326
+ else if (r === "transparent")
327
+ return { r: 0, g: 0, b: 0, a: 0, format: "name" };
328
+ let t = d.rgb.exec(r);
329
+ return t ? { r: t[1], g: t[2], b: t[3] } : (t = d.rgba.exec(r), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = d.hsl.exec(r), t ? { h: t[1], s: t[2], l: t[3] } : (t = d.hsla.exec(r), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = d.hsv.exec(r), t ? { h: t[1], s: t[2], v: t[3] } : (t = d.hsva.exec(r), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = d.cmyk.exec(r), t ? {
330
+ c: t[1],
331
+ m: t[2],
332
+ y: t[3],
333
+ k: t[4]
334
+ } : (t = d.hex8.exec(r), t ? {
335
+ r: c(t[1]),
336
+ g: c(t[2]),
337
+ b: c(t[3]),
338
+ a: $(t[4]),
339
+ format: e ? "name" : "hex8"
340
+ } : (t = d.hex6.exec(r), t ? {
341
+ r: c(t[1]),
342
+ g: c(t[2]),
343
+ b: c(t[3]),
344
+ format: e ? "name" : "hex"
345
+ } : (t = d.hex4.exec(r), t ? {
346
+ r: c(t[1] + t[1]),
347
+ g: c(t[2] + t[2]),
348
+ b: c(t[3] + t[3]),
349
+ a: $(t[4] + t[4]),
350
+ format: e ? "name" : "hex8"
351
+ } : (t = d.hex3.exec(r), t ? {
352
+ r: c(t[1] + t[1]),
353
+ g: c(t[2] + t[2]),
354
+ b: c(t[3] + t[3]),
355
+ format: e ? "name" : "hex"
356
+ } : !1))))))))));
357
+ }
358
+ function g(r) {
359
+ return typeof r == "number" ? !Number.isNaN(r) : d.CSS_UNIT.test(r);
360
+ }
361
+ class f {
362
+ constructor(e = "", t = {}) {
363
+ if (e instanceof f)
364
+ return e;
365
+ typeof e == "number" && (e = G(e)), this.originalInput = e;
366
+ const n = T(e);
367
+ 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.isValid = n.ok;
368
+ }
369
+ isDark() {
370
+ return this.getBrightness() < 128;
371
+ }
372
+ isLight() {
373
+ return !this.isDark();
374
+ }
375
+ /**
376
+ * Returns the perceived brightness of the color, from 0-255.
377
+ */
378
+ getBrightness() {
379
+ const e = this.toRgb();
380
+ return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
381
+ }
382
+ /**
383
+ * Returns the perceived luminance of a color, from 0-1.
384
+ */
385
+ getLuminance() {
386
+ const e = this.toRgb();
387
+ let t, n, s;
388
+ const a = e.r / 255, i = e.g / 255, h = e.b / 255;
389
+ return a <= 0.03928 ? t = a / 12.92 : t = Math.pow((a + 0.055) / 1.055, 2.4), i <= 0.03928 ? n = i / 12.92 : n = Math.pow((i + 0.055) / 1.055, 2.4), h <= 0.03928 ? s = h / 12.92 : s = Math.pow((h + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * n + 0.0722 * s;
390
+ }
391
+ /**
392
+ * Returns the alpha value of a color, from 0-1.
393
+ */
394
+ getAlpha() {
395
+ return this.a;
396
+ }
397
+ /**
398
+ * Sets the alpha value on the current color.
399
+ *
400
+ * @param alpha - The new alpha value. The accepted range is 0-1.
401
+ */
402
+ setAlpha(e) {
403
+ return this.a = F(e), this.roundA = Math.round(100 * this.a) / 100, this;
404
+ }
405
+ /**
406
+ * Returns whether the color is monochrome.
407
+ */
408
+ isMonochrome() {
409
+ const { s: e } = this.toHsl();
410
+ return e === 0;
411
+ }
412
+ /**
413
+ * Returns the object as a HSVA object.
414
+ */
415
+ toHsv() {
416
+ const e = A(this.r, this.g, this.b);
417
+ return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
418
+ }
419
+ /**
420
+ * Returns the hsva values interpolated into a string with the following format:
421
+ * "hsva(xxx, xxx, xxx, xx)".
422
+ */
423
+ toHsvString() {
424
+ const e = A(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), s = Math.round(e.v * 100);
425
+ return this.a === 1 ? `hsv(${t}, ${n}%, ${s}%)` : `hsva(${t}, ${n}%, ${s}%, ${this.roundA})`;
426
+ }
427
+ /**
428
+ * Returns the object as a HSLA object.
429
+ */
430
+ toHsl() {
431
+ const e = v(this.r, this.g, this.b);
432
+ return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
433
+ }
434
+ /**
435
+ * Returns the hsla values interpolated into a string with the following format:
436
+ * "hsla(xxx, xxx, xxx, xx)".
437
+ */
438
+ toHslString() {
439
+ const e = v(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), s = Math.round(e.l * 100);
440
+ return this.a === 1 ? `hsl(${t}, ${n}%, ${s}%)` : `hsla(${t}, ${n}%, ${s}%, ${this.roundA})`;
441
+ }
442
+ /**
443
+ * Returns the hex value of the color.
444
+ * @param allow3Char will shorten hex value to 3 char if possible
445
+ */
446
+ toHex(e = !1) {
447
+ return H(this.r, this.g, this.b, e);
448
+ }
449
+ /**
450
+ * Returns the hex value of the color -with a # prefixed.
451
+ * @param allow3Char will shorten hex value to 3 char if possible
452
+ */
453
+ toHexString(e = !1) {
454
+ return "#" + this.toHex(e);
455
+ }
456
+ /**
457
+ * Returns the hex 8 value of the color.
458
+ * @param allow4Char will shorten hex value to 4 char if possible
459
+ */
460
+ toHex8(e = !1) {
461
+ return j(this.r, this.g, this.b, this.a, e);
462
+ }
463
+ /**
464
+ * Returns the hex 8 value of the color -with a # prefixed.
465
+ * @param allow4Char will shorten hex value to 4 char if possible
466
+ */
467
+ toHex8String(e = !1) {
468
+ return "#" + this.toHex8(e);
469
+ }
470
+ /**
471
+ * Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
472
+ * @param allowShortChar will shorten hex value to 3 or 4 char if possible
473
+ */
474
+ toHexShortString(e = !1) {
475
+ return this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
476
+ }
477
+ /**
478
+ * Returns the object as a RGBA object.
479
+ */
480
+ toRgb() {
481
+ return {
482
+ r: Math.round(this.r),
483
+ g: Math.round(this.g),
484
+ b: Math.round(this.b),
485
+ a: this.a
486
+ };
487
+ }
488
+ /**
489
+ * Returns the RGBA values interpolated into a string with the following format:
490
+ * "RGBA(xxx, xxx, xxx, xx)".
491
+ */
492
+ toRgbString() {
493
+ const e = Math.round(this.r), t = Math.round(this.g), n = Math.round(this.b);
494
+ return this.a === 1 ? `rgb(${e}, ${t}, ${n})` : `rgba(${e}, ${t}, ${n}, ${this.roundA})`;
495
+ }
496
+ /**
497
+ * Returns the object as a RGBA object.
498
+ */
499
+ toPercentageRgb() {
500
+ const e = (t) => `${Math.round(u(t, 255) * 100)}%`;
501
+ return {
502
+ r: e(this.r),
503
+ g: e(this.g),
504
+ b: e(this.b),
505
+ a: this.a
506
+ };
507
+ }
508
+ /**
509
+ * Returns the RGBA relative values interpolated into a string
510
+ */
511
+ toPercentageRgbString() {
512
+ const e = (t) => Math.round(u(t, 255) * 100);
513
+ return this.a === 1 ? `rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)` : `rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`;
514
+ }
515
+ toCmyk() {
516
+ return {
517
+ ...R(this.r, this.g, this.b)
518
+ };
519
+ }
520
+ toCmykString() {
521
+ const { c: e, m: t, y: n, k: s } = R(this.r, this.g, this.b);
522
+ return `cmyk(${e}, ${t}, ${n}, ${s})`;
523
+ }
524
+ /**
525
+ * The 'real' name of the color -if there is one.
526
+ */
527
+ toName() {
528
+ if (this.a === 0)
529
+ return "transparent";
530
+ if (this.a < 1)
531
+ return !1;
532
+ const e = "#" + H(this.r, this.g, this.b, !1);
533
+ for (const [t, n] of Object.entries(y))
534
+ if (e === n)
535
+ return t;
536
+ return !1;
537
+ }
538
+ toString(e) {
539
+ const t = !!e;
540
+ e = e ?? this.format;
541
+ let n = !1;
542
+ const s = this.a < 1 && this.a >= 0;
543
+ return !t && s && (e.startsWith("hex") || 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()), e === "cmyk" && (n = this.toCmykString()), n || this.toHexString());
544
+ }
545
+ toNumber() {
546
+ return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
547
+ }
548
+ clone() {
549
+ return new f(this.toString());
550
+ }
551
+ /**
552
+ * Lighten the color a given amount. Providing 100 will always return white.
553
+ * @param amount - valid between 1-100
554
+ */
555
+ lighten(e = 10) {
556
+ const t = this.toHsl();
557
+ return t.l += e / 100, t.l = m(t.l), new f(t);
558
+ }
559
+ /**
560
+ * Brighten the color a given amount, from 0 to 100.
561
+ * @param amount - valid between 1-100
562
+ */
563
+ brighten(e = 10) {
564
+ const t = this.toRgb();
565
+ return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), new f(t);
566
+ }
567
+ /**
568
+ * Darken the color a given amount, from 0 to 100.
569
+ * Providing 100 will always return black.
570
+ * @param amount - valid between 1-100
571
+ */
572
+ darken(e = 10) {
573
+ const t = this.toHsl();
574
+ return t.l -= e / 100, t.l = m(t.l), new f(t);
575
+ }
576
+ /**
577
+ * Mix the color with pure white, from 0 to 100.
578
+ * Providing 0 will do nothing, providing 100 will always return white.
579
+ * @param amount - valid between 1-100
580
+ */
581
+ tint(e = 10) {
582
+ return this.mix("white", e);
583
+ }
584
+ /**
585
+ * Mix the color with pure black, from 0 to 100.
586
+ * Providing 0 will do nothing, providing 100 will always return black.
587
+ * @param amount - valid between 1-100
588
+ */
589
+ shade(e = 10) {
590
+ return this.mix("black", e);
591
+ }
592
+ /**
593
+ * Desaturate the color a given amount, from 0 to 100.
594
+ * Providing 100 will is the same as calling greyscale
595
+ * @param amount - valid between 1-100
596
+ */
597
+ desaturate(e = 10) {
598
+ const t = this.toHsl();
599
+ return t.s -= e / 100, t.s = m(t.s), new f(t);
600
+ }
601
+ /**
602
+ * Saturate the color a given amount, from 0 to 100.
603
+ * @param amount - valid between 1-100
604
+ */
605
+ saturate(e = 10) {
606
+ const t = this.toHsl();
607
+ return t.s += e / 100, t.s = m(t.s), new f(t);
608
+ }
609
+ /**
610
+ * Completely desaturates a color into greyscale.
611
+ * Same as calling `desaturate(100)`
612
+ */
613
+ greyscale() {
614
+ return this.desaturate(100);
615
+ }
616
+ /**
617
+ * Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
618
+ * Values outside of this range will be wrapped into this range.
619
+ */
620
+ spin(e) {
621
+ const t = this.toHsl(), n = (t.h + e) % 360;
622
+ return t.h = n < 0 ? 360 + n : n, new f(t);
623
+ }
624
+ /**
625
+ * Mix the current color a given amount with another color, from 0 to 100.
626
+ * 0 means no mixing (return current color).
627
+ */
628
+ mix(e, t = 50) {
629
+ const n = this.toRgb(), s = new f(e).toRgb(), a = t / 100, i = {
630
+ r: (s.r - n.r) * a + n.r,
631
+ g: (s.g - n.g) * a + n.g,
632
+ b: (s.b - n.b) * a + n.b,
633
+ a: (s.a - n.a) * a + n.a
634
+ };
635
+ return new f(i);
636
+ }
637
+ analogous(e = 6, t = 30) {
638
+ const n = this.toHsl(), s = 360 / t, a = [this];
639
+ for (n.h = (n.h - (s * e >> 1) + 720) % 360; --e; )
640
+ n.h = (n.h + s) % 360, a.push(new f(n));
641
+ return a;
642
+ }
643
+ /**
644
+ * taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
645
+ */
646
+ complement() {
647
+ const e = this.toHsl();
648
+ return e.h = (e.h + 180) % 360, new f(e);
649
+ }
650
+ monochromatic(e = 6) {
651
+ const t = this.toHsv(), { h: n } = t, { s } = t;
652
+ let { v: a } = t;
653
+ const i = [], h = 1 / e;
654
+ for (; e--; )
655
+ i.push(new f({ h: n, s, v: a })), a = (a + h) % 1;
656
+ return i;
657
+ }
658
+ splitcomplement() {
659
+ const e = this.toHsl(), { h: t } = e;
660
+ return [
661
+ this,
662
+ new f({ h: (t + 72) % 360, s: e.s, l: e.l }),
663
+ new f({ h: (t + 216) % 360, s: e.s, l: e.l })
664
+ ];
665
+ }
666
+ /**
667
+ * Compute how the color would appear on a background
668
+ */
669
+ onBackground(e) {
670
+ const t = this.toRgb(), n = new f(e).toRgb(), s = t.a + n.a * (1 - t.a);
671
+ return new f({
672
+ r: (t.r * t.a + n.r * n.a * (1 - t.a)) / s,
673
+ g: (t.g * t.a + n.g * n.a * (1 - t.a)) / s,
674
+ b: (t.b * t.a + n.b * n.a * (1 - t.a)) / s,
675
+ a: s
676
+ });
677
+ }
678
+ /**
679
+ * Alias for `polyad(3)`
680
+ */
681
+ triad() {
682
+ return this.polyad(3);
683
+ }
684
+ /**
685
+ * Alias for `polyad(4)`
686
+ */
687
+ tetrad() {
688
+ return this.polyad(4);
689
+ }
690
+ /**
691
+ * Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
692
+ * monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
693
+ */
694
+ polyad(e) {
695
+ const t = this.toHsl(), { h: n } = t, s = [this], a = 360 / e;
696
+ for (let i = 1; i < e; i++)
697
+ s.push(new f({ h: (n + i * a) % 360, s: t.s, l: t.l }));
698
+ return s;
699
+ }
700
+ /**
701
+ * compare color vs current color
702
+ */
703
+ equals(e) {
704
+ const t = new f(e);
705
+ return this.format === "cmyk" || t.format === "cmyk" ? this.toCmykString() === t.toCmykString() : this.toRgbString() === t.toRgbString();
706
+ }
707
+ }
708
+ export {
709
+ f as T
710
+ };