wj-elements 0.0.3 → 0.0.4

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 (66) hide show
  1. package/dist/router-links-e0087f84.js +146 -0
  2. package/dist/style.css +2 -2365
  3. package/dist/wj-aside.js +18 -22
  4. package/dist/wj-avatar.js +32 -49
  5. package/dist/wj-badge.js +18 -22
  6. package/dist/wj-breadcrumb.js +53 -103
  7. package/dist/wj-breadcrumbs.js +21 -36
  8. package/dist/wj-button-group.js +24 -36
  9. package/dist/wj-button.js +37 -80
  10. package/dist/wj-card-content.js +16 -18
  11. package/dist/wj-card-controls.js +16 -18
  12. package/dist/wj-card-header.js +16 -20
  13. package/dist/wj-card-subtitle.js +17 -19
  14. package/dist/wj-card-title.js +16 -18
  15. package/dist/wj-card.js +16 -20
  16. package/dist/wj-checkbox.js +24 -46
  17. package/dist/wj-chip.js +21 -39
  18. package/dist/wj-col.js +18 -32
  19. package/dist/wj-color-picker.js +503 -868
  20. package/dist/wj-container.js +18 -20
  21. package/dist/wj-copy-button.js +66 -112
  22. package/dist/wj-dialog.js +43 -67
  23. package/dist/wj-divider.js +16 -20
  24. package/dist/wj-dropdown.js +22 -31
  25. package/dist/wj-element.js +241 -416
  26. package/dist/wj-footer.js +16 -18
  27. package/dist/wj-form.js +16 -18
  28. package/dist/wj-grid.js +17 -21
  29. package/dist/wj-header.js +18 -22
  30. package/dist/wj-icon-picker.js +66 -107
  31. package/dist/wj-icon.js +67 -142
  32. package/dist/wj-img-comparer.js +43 -72
  33. package/dist/wj-img.js +21 -31
  34. package/dist/wj-infinite-scroll.js +49 -84
  35. package/dist/wj-input.js +67 -146
  36. package/dist/wj-item.js +19 -34
  37. package/dist/wj-label.js +19 -21
  38. package/dist/wj-list.js +17 -20
  39. package/dist/wj-main.js +16 -18
  40. package/dist/wj-master.js +331 -462
  41. package/dist/wj-menu-button.js +18 -21
  42. package/dist/wj-menu-item.js +67 -144
  43. package/dist/wj-menu-label.js +17 -21
  44. package/dist/wj-menu.js +20 -24
  45. package/dist/wj-popup.js +714 -1140
  46. package/dist/wj-progress-bar.js +42 -100
  47. package/dist/wj-radio-group.js +27 -38
  48. package/dist/wj-radio.js +24 -46
  49. package/dist/wj-route.js +8 -11
  50. package/dist/wj-router-link.js +19 -22
  51. package/dist/wj-router-outlet.js +71 -135
  52. package/dist/wj-routerx.js +641 -1121
  53. package/dist/wj-row.js +20 -22
  54. package/dist/wj-slider.js +55 -97
  55. package/dist/wj-split-view.js +45 -81
  56. package/dist/wj-store.js +110 -195
  57. package/dist/wj-textarea.js +39 -86
  58. package/dist/wj-thumbnail.js +17 -19
  59. package/dist/wj-toast.js +34 -88
  60. package/dist/wj-toggle.js +24 -42
  61. package/dist/wj-toolbar-action.js +16 -27
  62. package/dist/wj-toolbar.js +21 -26
  63. package/dist/wj-tooltip.js +27 -41
  64. package/dist/wj-visually-hidden.js +16 -18
  65. package/package.json +1 -1
  66. package/dist/router-links-26e4a166.js +0 -204
@@ -1,130 +1,94 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import WJElement from "./wj-element.js";
1
+ var N = Object.defineProperty;
2
+ var B = (t, r, e) => r in t ? N(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
+ var v = (t, r, e) => (B(t, typeof r != "symbol" ? r + "" : r, e), e);
4
+ import z from "./wj-element.js";
8
5
  import "./wj-store.js";
9
- function _typeof(obj) {
6
+ function S(t) {
10
7
  "@babel/helpers - typeof";
11
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
12
- return typeof obj2;
13
- } : function(obj2) {
14
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
15
- }, _typeof(obj);
16
- }
17
- var trimLeft = /^\s+/;
18
- var trimRight = /\s+$/;
19
- function tinycolor(color, opts) {
20
- color = color ? color : "";
21
- opts = opts || {};
22
- if (color instanceof tinycolor) {
23
- return color;
24
- }
25
- if (!(this instanceof tinycolor)) {
26
- return new tinycolor(color, opts);
27
- }
28
- var rgb = inputToRGB(color);
29
- 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;
30
- this._gradientType = opts.gradientType;
31
- if (this._r < 1)
32
- this._r = Math.round(this._r);
33
- if (this._g < 1)
34
- this._g = Math.round(this._g);
35
- if (this._b < 1)
36
- this._b = Math.round(this._b);
37
- this._ok = rgb.ok;
38
- }
39
- tinycolor.prototype = {
40
- isDark: function isDark() {
8
+ return S = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
9
+ return typeof r;
10
+ } : function(r) {
11
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
12
+ }, S(t);
13
+ }
14
+ var O = /^\s+/, G = /\s+$/;
15
+ function s(t, r) {
16
+ if (t = t || "", r = r || {}, t instanceof s)
17
+ return t;
18
+ if (!(this instanceof s))
19
+ return new s(t, r);
20
+ var e = $(t);
21
+ this._originalInput = t, this._r = e.r, this._g = e.g, this._b = e.b, this._a = e.a, this._roundA = Math.round(100 * this._a) / 100, this._format = r.format || e.format, this._gradientType = r.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 = e.ok;
22
+ }
23
+ s.prototype = {
24
+ isDark: function() {
41
25
  return this.getBrightness() < 128;
42
26
  },
43
- isLight: function isLight() {
27
+ isLight: function() {
44
28
  return !this.isDark();
45
29
  },
46
- isValid: function isValid() {
30
+ isValid: function() {
47
31
  return this._ok;
48
32
  },
49
- getOriginalInput: function getOriginalInput() {
33
+ getOriginalInput: function() {
50
34
  return this._originalInput;
51
35
  },
52
- getFormat: function getFormat() {
36
+ getFormat: function() {
53
37
  return this._format;
54
38
  },
55
- getAlpha: function getAlpha() {
39
+ getAlpha: function() {
56
40
  return this._a;
57
41
  },
58
- getBrightness: function getBrightness() {
59
- var rgb = this.toRgb();
60
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
42
+ getBrightness: function() {
43
+ var r = this.toRgb();
44
+ return (r.r * 299 + r.g * 587 + r.b * 114) / 1e3;
61
45
  },
62
- getLuminance: function getLuminance() {
63
- var rgb = this.toRgb();
64
- var RsRGB, GsRGB, BsRGB, R, G, B;
65
- RsRGB = rgb.r / 255;
66
- GsRGB = rgb.g / 255;
67
- BsRGB = rgb.b / 255;
68
- if (RsRGB <= 0.03928)
69
- R = RsRGB / 12.92;
70
- else
71
- R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
72
- if (GsRGB <= 0.03928)
73
- G = GsRGB / 12.92;
74
- else
75
- G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
76
- if (BsRGB <= 0.03928)
77
- B = BsRGB / 12.92;
78
- else
79
- B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
80
- return 0.2126 * R + 0.7152 * G + 0.0722 * B;
46
+ getLuminance: function() {
47
+ var r = this.toRgb(), e, a, i, n, o, h;
48
+ return e = r.r / 255, a = r.g / 255, i = r.b / 255, e <= 0.03928 ? n = e / 12.92 : n = Math.pow((e + 0.055) / 1.055, 2.4), a <= 0.03928 ? o = a / 12.92 : o = Math.pow((a + 0.055) / 1.055, 2.4), i <= 0.03928 ? h = i / 12.92 : h = Math.pow((i + 0.055) / 1.055, 2.4), 0.2126 * n + 0.7152 * o + 0.0722 * h;
81
49
  },
82
- setAlpha: function setAlpha(value) {
83
- this._a = boundAlpha(value);
84
- this._roundA = Math.round(100 * this._a) / 100;
85
- return this;
50
+ setAlpha: function(r) {
51
+ return this._a = D(r), this._roundA = Math.round(100 * this._a) / 100, this;
86
52
  },
87
- toHsv: function toHsv() {
88
- var hsv = rgbToHsv(this._r, this._g, this._b);
53
+ toHsv: function() {
54
+ var r = R(this._r, this._g, this._b);
89
55
  return {
90
- h: hsv.h * 360,
91
- s: hsv.s,
92
- v: hsv.v,
56
+ h: r.h * 360,
57
+ s: r.s,
58
+ v: r.v,
93
59
  a: this._a
94
60
  };
95
61
  },
96
- toHsvString: function toHsvString() {
97
- var hsv = rgbToHsv(this._r, this._g, this._b);
98
- var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
99
- return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
62
+ toHsvString: function() {
63
+ var r = R(this._r, this._g, this._b), e = Math.round(r.h * 360), a = Math.round(r.s * 100), i = Math.round(r.v * 100);
64
+ return this._a == 1 ? "hsv(" + e + ", " + a + "%, " + i + "%)" : "hsva(" + e + ", " + a + "%, " + i + "%, " + this._roundA + ")";
100
65
  },
101
- toHsl: function toHsl() {
102
- var hsl = rgbToHsl(this._r, this._g, this._b);
66
+ toHsl: function() {
67
+ var r = C(this._r, this._g, this._b);
103
68
  return {
104
- h: hsl.h * 360,
105
- s: hsl.s,
106
- l: hsl.l,
69
+ h: r.h * 360,
70
+ s: r.s,
71
+ l: r.l,
107
72
  a: this._a
108
73
  };
109
74
  },
110
- toHslString: function toHslString() {
111
- var hsl = rgbToHsl(this._r, this._g, this._b);
112
- var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
113
- return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
75
+ toHslString: function() {
76
+ var r = C(this._r, this._g, this._b), e = Math.round(r.h * 360), a = Math.round(r.s * 100), i = Math.round(r.l * 100);
77
+ return this._a == 1 ? "hsl(" + e + ", " + a + "%, " + i + "%)" : "hsla(" + e + ", " + a + "%, " + i + "%, " + this._roundA + ")";
114
78
  },
115
- toHex: function toHex(allow3Char) {
116
- return rgbToHex(this._r, this._g, this._b, allow3Char);
79
+ toHex: function(r) {
80
+ return E(this._r, this._g, this._b, r);
117
81
  },
118
- toHexString: function toHexString(allow3Char) {
119
- return "#" + this.toHex(allow3Char);
82
+ toHexString: function(r) {
83
+ return "#" + this.toHex(r);
120
84
  },
121
- toHex8: function toHex8(allow4Char) {
122
- return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
85
+ toHex8: function(r) {
86
+ return X(this._r, this._g, this._b, this._a, r);
123
87
  },
124
- toHex8String: function toHex8String(allow4Char) {
125
- return "#" + this.toHex8(allow4Char);
88
+ toHex8String: function(r) {
89
+ return "#" + this.toHex8(r);
126
90
  },
127
- toRgb: function toRgb() {
91
+ toRgb: function() {
128
92
  return {
129
93
  r: Math.round(this._r),
130
94
  g: Math.round(this._g),
@@ -132,513 +96,339 @@ tinycolor.prototype = {
132
96
  a: this._a
133
97
  };
134
98
  },
135
- toRgbString: function toRgbString() {
99
+ toRgbString: function() {
136
100
  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 + ")";
137
101
  },
138
- toPercentageRgb: function toPercentageRgb() {
102
+ toPercentageRgb: function() {
139
103
  return {
140
- r: Math.round(bound01(this._r, 255) * 100) + "%",
141
- g: Math.round(bound01(this._g, 255) * 100) + "%",
142
- b: Math.round(bound01(this._b, 255) * 100) + "%",
104
+ r: Math.round(u(this._r, 255) * 100) + "%",
105
+ g: Math.round(u(this._g, 255) * 100) + "%",
106
+ b: Math.round(u(this._b, 255) * 100) + "%",
143
107
  a: this._a
144
108
  };
145
109
  },
146
- toPercentageRgbString: function toPercentageRgbString() {
147
- 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
+ toPercentageRgbString: function() {
111
+ return this._a == 1 ? "rgb(" + Math.round(u(this._r, 255) * 100) + "%, " + Math.round(u(this._g, 255) * 100) + "%, " + Math.round(u(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(u(this._r, 255) * 100) + "%, " + Math.round(u(this._g, 255) * 100) + "%, " + Math.round(u(this._b, 255) * 100) + "%, " + this._roundA + ")";
148
112
  },
149
- toName: function toName() {
150
- if (this._a === 0) {
151
- return "transparent";
152
- }
153
- if (this._a < 1) {
154
- return false;
155
- }
156
- return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
113
+ toName: function() {
114
+ return this._a === 0 ? "transparent" : this._a < 1 ? !1 : ne[E(this._r, this._g, this._b, !0)] || !1;
157
115
  },
158
- toFilter: function toFilter(secondColor) {
159
- var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
160
- var secondHex8String = hex8String;
161
- var gradientType = this._gradientType ? "GradientType = 1, " : "";
162
- if (secondColor) {
163
- var s = tinycolor(secondColor);
164
- secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
116
+ toFilter: function(r) {
117
+ var e = "#" + L(this._r, this._g, this._b, this._a), a = e, i = this._gradientType ? "GradientType = 1, " : "";
118
+ if (r) {
119
+ var n = s(r);
120
+ a = "#" + L(n._r, n._g, n._b, n._a);
165
121
  }
166
- return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
122
+ return "progid:DXImageTransform.Microsoft.gradient(" + i + "startColorstr=" + e + ",endColorstr=" + a + ")";
167
123
  },
168
- toString: function toString(format) {
169
- var formatSet = !!format;
170
- format = format || this._format;
171
- var formattedString = false;
172
- var hasAlpha = this._a < 1 && this._a >= 0;
173
- var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
174
- if (needsAlphaFormat) {
175
- if (format === "name" && this._a === 0) {
176
- return this.toName();
177
- }
178
- return this.toRgbString();
179
- }
180
- if (format === "rgb") {
181
- formattedString = this.toRgbString();
182
- }
183
- if (format === "prgb") {
184
- formattedString = this.toPercentageRgbString();
185
- }
186
- if (format === "hex" || format === "hex6") {
187
- formattedString = this.toHexString();
188
- }
189
- if (format === "hex3") {
190
- formattedString = this.toHexString(true);
191
- }
192
- if (format === "hex4") {
193
- formattedString = this.toHex8String(true);
194
- }
195
- if (format === "hex8") {
196
- formattedString = this.toHex8String();
197
- }
198
- if (format === "name") {
199
- formattedString = this.toName();
200
- }
201
- if (format === "hsl") {
202
- formattedString = this.toHslString();
203
- }
204
- if (format === "hsv") {
205
- formattedString = this.toHsvString();
206
- }
207
- return formattedString || this.toHexString();
124
+ toString: function(r) {
125
+ var e = !!r;
126
+ r = r || this._format;
127
+ var a = !1, i = this._a < 1 && this._a >= 0, n = !e && i && (r === "hex" || r === "hex6" || r === "hex3" || r === "hex4" || r === "hex8" || r === "name");
128
+ return n ? r === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (r === "rgb" && (a = this.toRgbString()), r === "prgb" && (a = this.toPercentageRgbString()), (r === "hex" || r === "hex6") && (a = this.toHexString()), r === "hex3" && (a = this.toHexString(!0)), r === "hex4" && (a = this.toHex8String(!0)), r === "hex8" && (a = this.toHex8String()), r === "name" && (a = this.toName()), r === "hsl" && (a = this.toHslString()), r === "hsv" && (a = this.toHsvString()), a || this.toHexString());
208
129
  },
209
- clone: function clone() {
210
- return tinycolor(this.toString());
130
+ clone: function() {
131
+ return s(this.toString());
211
132
  },
212
- _applyModification: function _applyModification(fn, args) {
213
- var color = fn.apply(null, [this].concat([].slice.call(args)));
214
- this._r = color._r;
215
- this._g = color._g;
216
- this._b = color._b;
217
- this.setAlpha(color._a);
218
- return this;
133
+ _applyModification: function(r, e) {
134
+ var a = r.apply(null, [this].concat([].slice.call(e)));
135
+ return this._r = a._r, this._g = a._g, this._b = a._b, this.setAlpha(a._a), this;
219
136
  },
220
- lighten: function lighten() {
221
- return this._applyModification(_lighten, arguments);
137
+ lighten: function() {
138
+ return this._applyModification(K, arguments);
222
139
  },
223
- brighten: function brighten() {
224
- return this._applyModification(_brighten, arguments);
140
+ brighten: function() {
141
+ return this._applyModification(Z, arguments);
225
142
  },
226
- darken: function darken() {
227
- return this._applyModification(_darken, arguments);
143
+ darken: function() {
144
+ return this._applyModification(Q, arguments);
228
145
  },
229
- desaturate: function desaturate() {
230
- return this._applyModification(_desaturate, arguments);
146
+ desaturate: function() {
147
+ return this._applyModification(W, arguments);
231
148
  },
232
- saturate: function saturate() {
233
- return this._applyModification(_saturate, arguments);
149
+ saturate: function() {
150
+ return this._applyModification(Y, arguments);
234
151
  },
235
- greyscale: function greyscale() {
236
- return this._applyModification(_greyscale, arguments);
152
+ greyscale: function() {
153
+ return this._applyModification(J, arguments);
237
154
  },
238
- spin: function spin() {
239
- return this._applyModification(_spin, arguments);
155
+ spin: function() {
156
+ return this._applyModification(ee, arguments);
240
157
  },
241
- _applyCombination: function _applyCombination(fn, args) {
242
- return fn.apply(null, [this].concat([].slice.call(args)));
158
+ _applyCombination: function(r, e) {
159
+ return r.apply(null, [this].concat([].slice.call(e)));
243
160
  },
244
- analogous: function analogous() {
245
- return this._applyCombination(_analogous, arguments);
161
+ analogous: function() {
162
+ return this._applyCombination(ae, arguments);
246
163
  },
247
- complement: function complement() {
248
- return this._applyCombination(_complement, arguments);
164
+ complement: function() {
165
+ return this._applyCombination(te, arguments);
249
166
  },
250
- monochromatic: function monochromatic() {
251
- return this._applyCombination(_monochromatic, arguments);
167
+ monochromatic: function() {
168
+ return this._applyCombination(ie, arguments);
252
169
  },
253
- splitcomplement: function splitcomplement() {
254
- return this._applyCombination(_splitcomplement, arguments);
170
+ splitcomplement: function() {
171
+ return this._applyCombination(re, arguments);
255
172
  },
256
173
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
257
174
  // polyad: function (number) {
258
175
  // return this._applyCombination(polyad, [number]);
259
176
  // },
260
- triad: function triad() {
261
- return this._applyCombination(polyad, [3]);
177
+ triad: function() {
178
+ return this._applyCombination(T, [3]);
262
179
  },
263
- tetrad: function tetrad() {
264
- return this._applyCombination(polyad, [4]);
180
+ tetrad: function() {
181
+ return this._applyCombination(T, [4]);
265
182
  }
266
183
  };
267
- tinycolor.fromRatio = function(color, opts) {
268
- if (_typeof(color) == "object") {
269
- var newColor = {};
270
- for (var i in color) {
271
- if (color.hasOwnProperty(i)) {
272
- if (i === "a") {
273
- newColor[i] = color[i];
274
- } else {
275
- newColor[i] = convertToPercentage(color[i]);
276
- }
277
- }
278
- }
279
- color = newColor;
280
- }
281
- return tinycolor(color, opts);
184
+ s.fromRatio = function(t, r) {
185
+ if (S(t) == "object") {
186
+ var e = {};
187
+ for (var a in t)
188
+ t.hasOwnProperty(a) && (a === "a" ? e[a] = t[a] : e[a] = y(t[a]));
189
+ t = e;
190
+ }
191
+ return s(t, r);
282
192
  };
283
- function inputToRGB(color) {
284
- var rgb = {
193
+ function $(t) {
194
+ var r = {
285
195
  r: 0,
286
196
  g: 0,
287
197
  b: 0
288
- };
289
- var a = 1;
290
- var s = null;
291
- var v = null;
292
- var l = null;
293
- var ok = false;
294
- var format = false;
295
- if (typeof color == "string") {
296
- color = stringInputToObject(color);
297
- }
298
- if (_typeof(color) == "object") {
299
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
300
- rgb = rgbToRgb(color.r, color.g, color.b);
301
- ok = true;
302
- format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
303
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
304
- s = convertToPercentage(color.s);
305
- v = convertToPercentage(color.v);
306
- rgb = hsvToRgb(color.h, s, v);
307
- ok = true;
308
- format = "hsv";
309
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
310
- s = convertToPercentage(color.s);
311
- l = convertToPercentage(color.l);
312
- rgb = hslToRgb(color.h, s, l);
313
- ok = true;
314
- format = "hsl";
315
- }
316
- if (color.hasOwnProperty("a")) {
317
- a = color.a;
318
- }
319
- }
320
- a = boundAlpha(a);
321
- return {
322
- ok,
323
- format: color.format || format,
324
- r: Math.min(255, Math.max(rgb.r, 0)),
325
- g: Math.min(255, Math.max(rgb.g, 0)),
326
- b: Math.min(255, Math.max(rgb.b, 0)),
327
- a
198
+ }, e = 1, a = null, i = null, n = null, o = !1, h = !1;
199
+ return typeof t == "string" && (t = le(t)), S(t) == "object" && (m(t.r) && m(t.g) && m(t.b) ? (r = U(t.r, t.g, t.b), o = !0, h = String(t.r).substr(-1) === "%" ? "prgb" : "rgb") : m(t.h) && m(t.s) && m(t.v) ? (a = y(t.s), i = y(t.v), r = q(t.h, a, i), o = !0, h = "hsv") : m(t.h) && m(t.s) && m(t.l) && (a = y(t.s), n = y(t.l), r = V(t.h, a, n), o = !0, h = "hsl"), t.hasOwnProperty("a") && (e = t.a)), e = D(e), {
200
+ ok: o,
201
+ format: t.format || h,
202
+ r: Math.min(255, Math.max(r.r, 0)),
203
+ g: Math.min(255, Math.max(r.g, 0)),
204
+ b: Math.min(255, Math.max(r.b, 0)),
205
+ a: e
328
206
  };
329
207
  }
330
- function rgbToRgb(r, g, b) {
208
+ function U(t, r, e) {
331
209
  return {
332
- r: bound01(r, 255) * 255,
333
- g: bound01(g, 255) * 255,
334
- b: bound01(b, 255) * 255
210
+ r: u(t, 255) * 255,
211
+ g: u(r, 255) * 255,
212
+ b: u(e, 255) * 255
335
213
  };
336
214
  }
337
- function rgbToHsl(r, g, b) {
338
- r = bound01(r, 255);
339
- g = bound01(g, 255);
340
- b = bound01(b, 255);
341
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
342
- var h, s, l = (max + min) / 2;
343
- if (max == min) {
344
- h = s = 0;
345
- } else {
346
- var d = max - min;
347
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
348
- switch (max) {
349
- case r:
350
- h = (g - b) / d + (g < b ? 6 : 0);
215
+ function C(t, r, e) {
216
+ t = u(t, 255), r = u(r, 255), e = u(e, 255);
217
+ var a = Math.max(t, r, e), i = Math.min(t, r, e), n, o, h = (a + i) / 2;
218
+ if (a == i)
219
+ n = o = 0;
220
+ else {
221
+ var l = a - i;
222
+ switch (o = h > 0.5 ? l / (2 - a - i) : l / (a + i), a) {
223
+ case t:
224
+ n = (r - e) / l + (r < e ? 6 : 0);
351
225
  break;
352
- case g:
353
- h = (b - r) / d + 2;
226
+ case r:
227
+ n = (e - t) / l + 2;
354
228
  break;
355
- case b:
356
- h = (r - g) / d + 4;
229
+ case e:
230
+ n = (t - r) / l + 4;
357
231
  break;
358
232
  }
359
- h /= 6;
233
+ n /= 6;
360
234
  }
361
235
  return {
362
- h,
363
- s,
364
- l
236
+ h: n,
237
+ s: o,
238
+ l: h
365
239
  };
366
240
  }
367
- function hslToRgb(h, s, l) {
368
- var r, g, b;
369
- h = bound01(h, 360);
370
- s = bound01(s, 100);
371
- l = bound01(l, 100);
372
- function hue2rgb(p2, q2, t) {
373
- if (t < 0)
374
- t += 1;
375
- if (t > 1)
376
- t -= 1;
377
- if (t < 1 / 6)
378
- return p2 + (q2 - p2) * 6 * t;
379
- if (t < 1 / 2)
380
- return q2;
381
- if (t < 2 / 3)
382
- return p2 + (q2 - p2) * (2 / 3 - t) * 6;
383
- return p2;
241
+ function V(t, r, e) {
242
+ var a, i, n;
243
+ t = u(t, 360), r = u(r, 100), e = u(e, 100);
244
+ function o(d, g, c) {
245
+ return c < 0 && (c += 1), c > 1 && (c -= 1), c < 1 / 6 ? d + (g - d) * 6 * c : c < 1 / 2 ? g : c < 2 / 3 ? d + (g - d) * (2 / 3 - c) * 6 : d;
384
246
  }
385
- if (s === 0) {
386
- r = g = b = l;
387
- } else {
388
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
389
- var p = 2 * l - q;
390
- r = hue2rgb(p, q, h + 1 / 3);
391
- g = hue2rgb(p, q, h);
392
- b = hue2rgb(p, q, h - 1 / 3);
247
+ if (r === 0)
248
+ a = i = n = e;
249
+ else {
250
+ var h = e < 0.5 ? e * (1 + r) : e + r - e * r, l = 2 * e - h;
251
+ a = o(l, h, t + 1 / 3), i = o(l, h, t), n = o(l, h, t - 1 / 3);
393
252
  }
394
253
  return {
395
- r: r * 255,
396
- g: g * 255,
397
- b: b * 255
254
+ r: a * 255,
255
+ g: i * 255,
256
+ b: n * 255
398
257
  };
399
258
  }
400
- function rgbToHsv(r, g, b) {
401
- r = bound01(r, 255);
402
- g = bound01(g, 255);
403
- b = bound01(b, 255);
404
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
405
- var h, s, v = max;
406
- var d = max - min;
407
- s = max === 0 ? 0 : d / max;
408
- if (max == min) {
409
- h = 0;
410
- } else {
411
- switch (max) {
412
- case r:
413
- h = (g - b) / d + (g < b ? 6 : 0);
259
+ function R(t, r, e) {
260
+ t = u(t, 255), r = u(r, 255), e = u(e, 255);
261
+ var a = Math.max(t, r, e), i = Math.min(t, r, e), n, o, h = a, l = a - i;
262
+ if (o = a === 0 ? 0 : l / a, a == i)
263
+ n = 0;
264
+ else {
265
+ switch (a) {
266
+ case t:
267
+ n = (r - e) / l + (r < e ? 6 : 0);
414
268
  break;
415
- case g:
416
- h = (b - r) / d + 2;
269
+ case r:
270
+ n = (e - t) / l + 2;
417
271
  break;
418
- case b:
419
- h = (r - g) / d + 4;
272
+ case e:
273
+ n = (t - r) / l + 4;
420
274
  break;
421
275
  }
422
- h /= 6;
276
+ n /= 6;
423
277
  }
424
278
  return {
425
- h,
426
- s,
427
- v
279
+ h: n,
280
+ s: o,
281
+ v: h
428
282
  };
429
283
  }
430
- function hsvToRgb(h, s, v) {
431
- h = bound01(h, 360) * 6;
432
- s = bound01(s, 100);
433
- v = bound01(v, 100);
434
- 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];
284
+ function q(t, r, e) {
285
+ t = u(t, 360) * 6, r = u(r, 100), e = u(e, 100);
286
+ var a = Math.floor(t), i = t - a, n = e * (1 - r), o = e * (1 - i * r), h = e * (1 - (1 - i) * r), l = a % 6, d = [e, o, n, n, h, e][l], g = [h, e, e, o, n, n][l], c = [n, n, h, e, e, o][l];
435
287
  return {
436
- r: r * 255,
288
+ r: d * 255,
437
289
  g: g * 255,
438
- b: b * 255
290
+ b: c * 255
439
291
  };
440
292
  }
441
- function rgbToHex(r, g, b, allow3Char) {
442
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
443
- 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)) {
444
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
445
- }
446
- return hex.join("");
293
+ function E(t, r, e, a) {
294
+ var i = [b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16))];
295
+ return a && 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("");
447
296
  }
448
- function rgbaToHex(r, g, b, a, allow4Char) {
449
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
450
- 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)) {
451
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
452
- }
453
- return hex.join("");
297
+ function X(t, r, e, a, i) {
298
+ var n = [b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16)), b(I(a))];
299
+ return i && n[0].charAt(0) == n[0].charAt(1) && n[1].charAt(0) == n[1].charAt(1) && n[2].charAt(0) == n[2].charAt(1) && n[3].charAt(0) == n[3].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) + n[3].charAt(0) : n.join("");
454
300
  }
455
- function rgbaToArgbHex(r, g, b, a) {
456
- var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
457
- return hex.join("");
301
+ function L(t, r, e, a) {
302
+ var i = [b(I(a)), b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16))];
303
+ return i.join("");
458
304
  }
459
- tinycolor.equals = function(color1, color2) {
460
- if (!color1 || !color2)
461
- return false;
462
- return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
305
+ s.equals = function(t, r) {
306
+ return !t || !r ? !1 : s(t).toRgbString() == s(r).toRgbString();
463
307
  };
464
- tinycolor.random = function() {
465
- return tinycolor.fromRatio({
308
+ s.random = function() {
309
+ return s.fromRatio({
466
310
  r: Math.random(),
467
311
  g: Math.random(),
468
312
  b: Math.random()
469
313
  });
470
314
  };
471
- function _desaturate(color, amount) {
472
- amount = amount === 0 ? 0 : amount || 10;
473
- var hsl = tinycolor(color).toHsl();
474
- hsl.s -= amount / 100;
475
- hsl.s = clamp01(hsl.s);
476
- return tinycolor(hsl);
477
- }
478
- function _saturate(color, amount) {
479
- amount = amount === 0 ? 0 : amount || 10;
480
- var hsl = tinycolor(color).toHsl();
481
- hsl.s += amount / 100;
482
- hsl.s = clamp01(hsl.s);
483
- return tinycolor(hsl);
484
- }
485
- function _greyscale(color) {
486
- return tinycolor(color).desaturate(100);
487
- }
488
- function _lighten(color, amount) {
489
- amount = amount === 0 ? 0 : amount || 10;
490
- var hsl = tinycolor(color).toHsl();
491
- hsl.l += amount / 100;
492
- hsl.l = clamp01(hsl.l);
493
- return tinycolor(hsl);
494
- }
495
- function _brighten(color, amount) {
496
- amount = amount === 0 ? 0 : amount || 10;
497
- var rgb = tinycolor(color).toRgb();
498
- rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
499
- rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
500
- rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
501
- return tinycolor(rgb);
502
- }
503
- function _darken(color, amount) {
504
- amount = amount === 0 ? 0 : amount || 10;
505
- var hsl = tinycolor(color).toHsl();
506
- hsl.l -= amount / 100;
507
- hsl.l = clamp01(hsl.l);
508
- return tinycolor(hsl);
509
- }
510
- function _spin(color, amount) {
511
- var hsl = tinycolor(color).toHsl();
512
- var hue = (hsl.h + amount) % 360;
513
- hsl.h = hue < 0 ? 360 + hue : hue;
514
- return tinycolor(hsl);
515
- }
516
- function _complement(color) {
517
- var hsl = tinycolor(color).toHsl();
518
- hsl.h = (hsl.h + 180) % 360;
519
- return tinycolor(hsl);
520
- }
521
- function polyad(color, number) {
522
- if (isNaN(number) || number <= 0) {
315
+ function W(t, r) {
316
+ r = r === 0 ? 0 : r || 10;
317
+ var e = s(t).toHsl();
318
+ return e.s -= r / 100, e.s = M(e.s), s(e);
319
+ }
320
+ function Y(t, r) {
321
+ r = r === 0 ? 0 : r || 10;
322
+ var e = s(t).toHsl();
323
+ return e.s += r / 100, e.s = M(e.s), s(e);
324
+ }
325
+ function J(t) {
326
+ return s(t).desaturate(100);
327
+ }
328
+ function K(t, r) {
329
+ r = r === 0 ? 0 : r || 10;
330
+ var e = s(t).toHsl();
331
+ return e.l += r / 100, e.l = M(e.l), s(e);
332
+ }
333
+ function Z(t, r) {
334
+ r = r === 0 ? 0 : r || 10;
335
+ var e = s(t).toRgb();
336
+ return e.r = Math.max(0, Math.min(255, e.r - Math.round(255 * -(r / 100)))), e.g = Math.max(0, Math.min(255, e.g - Math.round(255 * -(r / 100)))), e.b = Math.max(0, Math.min(255, e.b - Math.round(255 * -(r / 100)))), s(e);
337
+ }
338
+ function Q(t, r) {
339
+ r = r === 0 ? 0 : r || 10;
340
+ var e = s(t).toHsl();
341
+ return e.l -= r / 100, e.l = M(e.l), s(e);
342
+ }
343
+ function ee(t, r) {
344
+ var e = s(t).toHsl(), a = (e.h + r) % 360;
345
+ return e.h = a < 0 ? 360 + a : a, s(e);
346
+ }
347
+ function te(t) {
348
+ var r = s(t).toHsl();
349
+ return r.h = (r.h + 180) % 360, s(r);
350
+ }
351
+ function T(t, r) {
352
+ if (isNaN(r) || r <= 0)
523
353
  throw new Error("Argument to polyad must be a positive number");
524
- }
525
- var hsl = tinycolor(color).toHsl();
526
- var result = [tinycolor(color)];
527
- var step = 360 / number;
528
- for (var i = 1; i < number; i++) {
529
- result.push(tinycolor({
530
- h: (hsl.h + i * step) % 360,
531
- s: hsl.s,
532
- l: hsl.l
354
+ for (var e = s(t).toHsl(), a = [s(t)], i = 360 / r, n = 1; n < r; n++)
355
+ a.push(s({
356
+ h: (e.h + n * i) % 360,
357
+ s: e.s,
358
+ l: e.l
533
359
  }));
534
- }
535
- return result;
360
+ return a;
536
361
  }
537
- function _splitcomplement(color) {
538
- var hsl = tinycolor(color).toHsl();
539
- var h = hsl.h;
540
- return [tinycolor(color), tinycolor({
541
- h: (h + 72) % 360,
542
- s: hsl.s,
543
- l: hsl.l
544
- }), tinycolor({
545
- h: (h + 216) % 360,
546
- s: hsl.s,
547
- l: hsl.l
362
+ function re(t) {
363
+ var r = s(t).toHsl(), e = r.h;
364
+ return [s(t), s({
365
+ h: (e + 72) % 360,
366
+ s: r.s,
367
+ l: r.l
368
+ }), s({
369
+ h: (e + 216) % 360,
370
+ s: r.s,
371
+ l: r.l
548
372
  })];
549
373
  }
550
- function _analogous(color, results, slices) {
551
- results = results || 6;
552
- slices = slices || 30;
553
- var hsl = tinycolor(color).toHsl();
554
- var part = 360 / slices;
555
- var ret = [tinycolor(color)];
556
- for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
557
- hsl.h = (hsl.h + part) % 360;
558
- ret.push(tinycolor(hsl));
559
- }
560
- return ret;
561
- }
562
- function _monochromatic(color, results) {
563
- results = results || 6;
564
- var hsv = tinycolor(color).toHsv();
565
- var h = hsv.h, s = hsv.s, v = hsv.v;
566
- var ret = [];
567
- var modification = 1 / results;
568
- while (results--) {
569
- ret.push(tinycolor({
570
- h,
571
- s,
572
- v
573
- }));
574
- v = (v + modification) % 1;
575
- }
576
- return ret;
374
+ function ae(t, r, e) {
375
+ r = r || 6, e = e || 30;
376
+ var a = s(t).toHsl(), i = 360 / e, n = [s(t)];
377
+ for (a.h = (a.h - (i * r >> 1) + 720) % 360; --r; )
378
+ a.h = (a.h + i) % 360, n.push(s(a));
379
+ return n;
577
380
  }
578
- tinycolor.mix = function(color1, color2, amount) {
579
- amount = amount === 0 ? 0 : amount || 50;
580
- var rgb1 = tinycolor(color1).toRgb();
581
- var rgb2 = tinycolor(color2).toRgb();
582
- var p = amount / 100;
583
- var rgba = {
584
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
585
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
586
- b: (rgb2.b - rgb1.b) * p + rgb1.b,
587
- a: (rgb2.a - rgb1.a) * p + rgb1.a
381
+ function ie(t, r) {
382
+ r = r || 6;
383
+ for (var e = s(t).toHsv(), a = e.h, i = e.s, n = e.v, o = [], h = 1 / r; r--; )
384
+ o.push(s({
385
+ h: a,
386
+ s: i,
387
+ v: n
388
+ })), n = (n + h) % 1;
389
+ return o;
390
+ }
391
+ s.mix = function(t, r, e) {
392
+ e = e === 0 ? 0 : e || 50;
393
+ var a = s(t).toRgb(), i = s(r).toRgb(), n = e / 100, o = {
394
+ r: (i.r - a.r) * n + a.r,
395
+ g: (i.g - a.g) * n + a.g,
396
+ b: (i.b - a.b) * n + a.b,
397
+ a: (i.a - a.a) * n + a.a
588
398
  };
589
- return tinycolor(rgba);
399
+ return s(o);
590
400
  };
591
- tinycolor.readability = function(color1, color2) {
592
- var c1 = tinycolor(color1);
593
- var c2 = tinycolor(color2);
594
- return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
401
+ s.readability = function(t, r) {
402
+ var e = s(t), a = s(r);
403
+ return (Math.max(e.getLuminance(), a.getLuminance()) + 0.05) / (Math.min(e.getLuminance(), a.getLuminance()) + 0.05);
595
404
  };
596
- tinycolor.isReadable = function(color1, color2, wcag2) {
597
- var readability = tinycolor.readability(color1, color2);
598
- var wcag2Parms, out;
599
- out = false;
600
- wcag2Parms = validateWCAG2Parms(wcag2);
601
- switch (wcag2Parms.level + wcag2Parms.size) {
405
+ s.isReadable = function(t, r, e) {
406
+ var a = s.readability(t, r), i, n;
407
+ switch (n = !1, i = ue(e), i.level + i.size) {
602
408
  case "AAsmall":
603
409
  case "AAAlarge":
604
- out = readability >= 4.5;
410
+ n = a >= 4.5;
605
411
  break;
606
412
  case "AAlarge":
607
- out = readability >= 3;
413
+ n = a >= 3;
608
414
  break;
609
415
  case "AAAsmall":
610
- out = readability >= 7;
416
+ n = a >= 7;
611
417
  break;
612
418
  }
613
- return out;
419
+ return n;
614
420
  };
615
- tinycolor.mostReadable = function(baseColor, colorList, args) {
616
- var bestColor = null;
617
- var bestScore = 0;
618
- var readability;
619
- var includeFallbackColors, level, size;
620
- args = args || {};
621
- includeFallbackColors = args.includeFallbackColors;
622
- level = args.level;
623
- size = args.size;
624
- for (var i = 0; i < colorList.length; i++) {
625
- readability = tinycolor.readability(baseColor, colorList[i]);
626
- if (readability > bestScore) {
627
- bestScore = readability;
628
- bestColor = tinycolor(colorList[i]);
629
- }
630
- }
631
- if (tinycolor.isReadable(baseColor, bestColor, {
632
- level,
633
- size
634
- }) || !includeFallbackColors) {
635
- return bestColor;
636
- } else {
637
- args.includeFallbackColors = false;
638
- return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
639
- }
421
+ s.mostReadable = function(t, r, e) {
422
+ var a = null, i = 0, n, o, h, l;
423
+ e = e || {}, o = e.includeFallbackColors, h = e.level, l = e.size;
424
+ for (var d = 0; d < r.length; d++)
425
+ n = s.readability(t, r[d]), n > i && (i = n, a = s(r[d]));
426
+ return s.isReadable(t, a, {
427
+ level: h,
428
+ size: l
429
+ }) || !o ? a : (e.includeFallbackColors = !1, s.mostReadable(t, ["#fff", "#000"], e));
640
430
  };
641
- var names = tinycolor.names = {
431
+ var j = s.names = {
642
432
  aliceblue: "f0f8ff",
643
433
  antiquewhite: "faebd7",
644
434
  aqua: "0ff",
@@ -788,94 +578,70 @@ var names = tinycolor.names = {
788
578
  whitesmoke: "f5f5f5",
789
579
  yellow: "ff0",
790
580
  yellowgreen: "9acd32"
791
- };
792
- var hexNames = tinycolor.hexNames = flip(names);
793
- function flip(o) {
794
- var flipped = {};
795
- for (var i in o) {
796
- if (o.hasOwnProperty(i)) {
797
- flipped[o[i]] = i;
798
- }
799
- }
800
- return flipped;
581
+ }, ne = s.hexNames = se(j);
582
+ function se(t) {
583
+ var r = {};
584
+ for (var e in t)
585
+ t.hasOwnProperty(e) && (r[t[e]] = e);
586
+ return r;
801
587
  }
802
- function boundAlpha(a) {
803
- a = parseFloat(a);
804
- if (isNaN(a) || a < 0 || a > 1) {
805
- a = 1;
806
- }
807
- return a;
588
+ function D(t) {
589
+ return t = parseFloat(t), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
808
590
  }
809
- function bound01(n, max) {
810
- if (isOnePointZero(n))
811
- n = "100%";
812
- var processPercent = isPercentage(n);
813
- n = Math.min(max, Math.max(0, parseFloat(n)));
814
- if (processPercent) {
815
- n = parseInt(n * max, 10) / 100;
816
- }
817
- if (Math.abs(n - max) < 1e-6) {
818
- return 1;
819
- }
820
- return n % max / parseFloat(max);
591
+ function u(t, r) {
592
+ oe(t) && (t = "100%");
593
+ var e = he(t);
594
+ return t = Math.min(r, Math.max(0, parseFloat(t))), e && (t = parseInt(t * r, 10) / 100), Math.abs(t - r) < 1e-6 ? 1 : t % r / parseFloat(r);
821
595
  }
822
- function clamp01(val) {
823
- return Math.min(1, Math.max(0, val));
596
+ function M(t) {
597
+ return Math.min(1, Math.max(0, t));
824
598
  }
825
- function parseIntFromHex(val) {
826
- return parseInt(val, 16);
599
+ function f(t) {
600
+ return parseInt(t, 16);
827
601
  }
828
- function isOnePointZero(n) {
829
- return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
602
+ function oe(t) {
603
+ return typeof t == "string" && t.indexOf(".") != -1 && parseFloat(t) === 1;
830
604
  }
831
- function isPercentage(n) {
832
- return typeof n === "string" && n.indexOf("%") != -1;
605
+ function he(t) {
606
+ return typeof t == "string" && t.indexOf("%") != -1;
833
607
  }
834
- function pad2(c) {
835
- return c.length == 1 ? "0" + c : "" + c;
608
+ function b(t) {
609
+ return t.length == 1 ? "0" + t : "" + t;
836
610
  }
837
- function convertToPercentage(n) {
838
- if (n <= 1) {
839
- n = n * 100 + "%";
840
- }
841
- return n;
611
+ function y(t) {
612
+ return t <= 1 && (t = t * 100 + "%"), t;
842
613
  }
843
- function convertDecimalToHex(d) {
844
- return Math.round(parseFloat(d) * 255).toString(16);
614
+ function I(t) {
615
+ return Math.round(parseFloat(t) * 255).toString(16);
845
616
  }
846
- function convertHexToDecimal(h) {
847
- return parseIntFromHex(h) / 255;
617
+ function F(t) {
618
+ return f(t) / 255;
848
619
  }
849
- var matchers = function() {
850
- var CSS_INTEGER = "[-\\+]?\\d+%?";
851
- var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
852
- var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
853
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
854
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
620
+ var p = function() {
621
+ var t = "[-\\+]?\\d+%?", r = "[-\\+]?\\d*\\.\\d+%?", e = "(?:" + r + ")|(?:" + t + ")", a = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?", i = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?";
855
622
  return {
856
- CSS_UNIT: new RegExp(CSS_UNIT),
857
- rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
858
- rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
859
- hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
860
- hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
861
- hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
862
- hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
623
+ CSS_UNIT: new RegExp(e),
624
+ rgb: new RegExp("rgb" + a),
625
+ rgba: new RegExp("rgba" + i),
626
+ hsl: new RegExp("hsl" + a),
627
+ hsla: new RegExp("hsla" + i),
628
+ hsv: new RegExp("hsv" + a),
629
+ hsva: new RegExp("hsva" + i),
863
630
  hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
864
631
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
865
632
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
866
633
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
867
634
  };
868
635
  }();
869
- function isValidCSSUnit(color) {
870
- return !!matchers.CSS_UNIT.exec(color);
871
- }
872
- function stringInputToObject(color) {
873
- color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
874
- var named = false;
875
- if (names[color]) {
876
- color = names[color];
877
- named = true;
878
- } else if (color == "transparent") {
636
+ function m(t) {
637
+ return !!p.CSS_UNIT.exec(t);
638
+ }
639
+ function le(t) {
640
+ t = t.replace(O, "").replace(G, "").toLowerCase();
641
+ var r = !1;
642
+ if (j[t])
643
+ t = j[t], r = !0;
644
+ else if (t == "transparent")
879
645
  return {
880
646
  r: 0,
881
647
  g: 0,
@@ -883,203 +649,130 @@ function stringInputToObject(color) {
883
649
  a: 0,
884
650
  format: "name"
885
651
  };
886
- }
887
- var match;
888
- if (match = matchers.rgb.exec(color)) {
889
- return {
890
- r: match[1],
891
- g: match[2],
892
- b: match[3]
893
- };
894
- }
895
- if (match = matchers.rgba.exec(color)) {
896
- return {
897
- r: match[1],
898
- g: match[2],
899
- b: match[3],
900
- a: match[4]
901
- };
902
- }
903
- if (match = matchers.hsl.exec(color)) {
904
- return {
905
- h: match[1],
906
- s: match[2],
907
- l: match[3]
908
- };
909
- }
910
- if (match = matchers.hsla.exec(color)) {
911
- return {
912
- h: match[1],
913
- s: match[2],
914
- l: match[3],
915
- a: match[4]
916
- };
917
- }
918
- if (match = matchers.hsv.exec(color)) {
919
- return {
920
- h: match[1],
921
- s: match[2],
922
- v: match[3]
923
- };
924
- }
925
- if (match = matchers.hsva.exec(color)) {
926
- return {
927
- h: match[1],
928
- s: match[2],
929
- v: match[3],
930
- a: match[4]
931
- };
932
- }
933
- if (match = matchers.hex8.exec(color)) {
934
- return {
935
- r: parseIntFromHex(match[1]),
936
- g: parseIntFromHex(match[2]),
937
- b: parseIntFromHex(match[3]),
938
- a: convertHexToDecimal(match[4]),
939
- format: named ? "name" : "hex8"
940
- };
941
- }
942
- if (match = matchers.hex6.exec(color)) {
943
- return {
944
- r: parseIntFromHex(match[1]),
945
- g: parseIntFromHex(match[2]),
946
- b: parseIntFromHex(match[3]),
947
- format: named ? "name" : "hex"
948
- };
949
- }
950
- if (match = matchers.hex4.exec(color)) {
951
- return {
952
- r: parseIntFromHex(match[1] + "" + match[1]),
953
- g: parseIntFromHex(match[2] + "" + match[2]),
954
- b: parseIntFromHex(match[3] + "" + match[3]),
955
- a: convertHexToDecimal(match[4] + "" + match[4]),
956
- format: named ? "name" : "hex8"
957
- };
958
- }
959
- if (match = matchers.hex3.exec(color)) {
960
- return {
961
- r: parseIntFromHex(match[1] + "" + match[1]),
962
- g: parseIntFromHex(match[2] + "" + match[2]),
963
- b: parseIntFromHex(match[3] + "" + match[3]),
964
- format: named ? "name" : "hex"
965
- };
966
- }
967
- return false;
968
- }
969
- function validateWCAG2Parms(parms) {
970
- var level, size;
971
- parms = parms || {
652
+ var e;
653
+ return (e = p.rgb.exec(t)) ? {
654
+ r: e[1],
655
+ g: e[2],
656
+ b: e[3]
657
+ } : (e = p.rgba.exec(t)) ? {
658
+ r: e[1],
659
+ g: e[2],
660
+ b: e[3],
661
+ a: e[4]
662
+ } : (e = p.hsl.exec(t)) ? {
663
+ h: e[1],
664
+ s: e[2],
665
+ l: e[3]
666
+ } : (e = p.hsla.exec(t)) ? {
667
+ h: e[1],
668
+ s: e[2],
669
+ l: e[3],
670
+ a: e[4]
671
+ } : (e = p.hsv.exec(t)) ? {
672
+ h: e[1],
673
+ s: e[2],
674
+ v: e[3]
675
+ } : (e = p.hsva.exec(t)) ? {
676
+ h: e[1],
677
+ s: e[2],
678
+ v: e[3],
679
+ a: e[4]
680
+ } : (e = p.hex8.exec(t)) ? {
681
+ r: f(e[1]),
682
+ g: f(e[2]),
683
+ b: f(e[3]),
684
+ a: F(e[4]),
685
+ format: r ? "name" : "hex8"
686
+ } : (e = p.hex6.exec(t)) ? {
687
+ r: f(e[1]),
688
+ g: f(e[2]),
689
+ b: f(e[3]),
690
+ format: r ? "name" : "hex"
691
+ } : (e = p.hex4.exec(t)) ? {
692
+ r: f(e[1] + "" + e[1]),
693
+ g: f(e[2] + "" + e[2]),
694
+ b: f(e[3] + "" + e[3]),
695
+ a: F(e[4] + "" + e[4]),
696
+ format: r ? "name" : "hex8"
697
+ } : (e = p.hex3.exec(t)) ? {
698
+ r: f(e[1] + "" + e[1]),
699
+ g: f(e[2] + "" + e[2]),
700
+ b: f(e[3] + "" + e[3]),
701
+ format: r ? "name" : "hex"
702
+ } : !1;
703
+ }
704
+ function ue(t) {
705
+ var r, e;
706
+ return t = t || {
972
707
  level: "AA",
973
708
  size: "small"
974
- };
975
- level = (parms.level || "AA").toUpperCase();
976
- size = (parms.size || "small").toLowerCase();
977
- if (level !== "AA" && level !== "AAA") {
978
- level = "AA";
979
- }
980
- if (size !== "small" && size !== "large") {
981
- size = "small";
982
- }
983
- return {
984
- level,
985
- size
709
+ }, r = (t.level || "AA").toUpperCase(), e = (t.size || "small").toLowerCase(), r !== "AA" && r !== "AAA" && (r = "AA"), e !== "small" && e !== "large" && (e = "small"), {
710
+ level: r,
711
+ size: e
986
712
  };
987
713
  }
988
- const styles = '/*!\n* direction.scss\n*/\n/* Skeleton Variables */\n/*\n[ Color Picker ]\n*/\n:host {\n --wj-color-picker-value: #ff0000;\n --wj-color-picker-radius: 4px;\n}\n.anchor {\n width: 1rem;\n height: 1rem;\n background: var(--wj-color-picker-value);\n}\n.picker {\n width: 200px;\n min-height: 90px;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.05), 0 5px 20px rgba(0, 0, 0, 0.1);\n border-radius: var(--wj-color-picker-radius);\n}\n.color-area {\n display: block;\n position: relative;\n height: 100px;\n color: var(--wj-color-picker-area);\n background-image: linear-gradient(rgba(0, 0, 0, 0), #000), linear-gradient(90deg, #fff, currentColor);\n cursor: crosshair;\n border-radius: var(--wj-color-picker-radius) var(--wj-color-picker-radius) 0 0;\n}\n.wrapper {\n display: inline-table;\n width: calc(100% - 2rem);\n margin: 1rem;\n}\n.hue {\n border-radius: 0.25rem;\n background-image: linear-gradient(to right, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%);\n width: 100%;\n height: 8px;\n margin: 0.75rem 0 1rem;\n}\n.hue::part(slider) {\n --wj-slider-color: transparent;\n --wj-slider-thumb-color: white;\n --wj-slider-thumb-shadow: 0 0 0 1px rgba(33, 33, 33, 0.14);\n --wj-slider-thumb-shadow-active: var(--wj-slider-thumb-shadow);\n --wj-slider-track-color: transparent;\n}\n.alpha-wrapper {\n border-radius: 0.25rem;\n width: 100%;\n height: 8px;\n margin: 0.75rem 0 1rem;\n background-image: repeating-linear-gradient(45deg, #aaa 25%, transparent 25%, transparent 75%, #aaa 75%, #aaa), repeating-linear-gradient(45deg, #aaa 25%, #fff 25%, #fff 75%, #aaa 75%, #aaa);\n background-position: 0 0, 4px 4px;\n background-size: 8px 8px;\n}\n.alpha {\n color: var(--wj-color-picker-value);\n display: block;\n height: 100%;\n width: 100%;\n border-radius: inherit;\n background-image: linear-gradient(90deg, rgba(0, 0, 0, 0), currentColor);\n}\n.alpha::part(slider) {\n --wj-slider-color: transparent;\n --wj-slider-thumb-color: white;\n --wj-slider-thumb-shadow: 0 0 0 1px rgba(33, 33, 33, 0.14);\n --wj-slider-thumb-shadow-active: var(--wj-slider-thumb-shadow);\n --wj-slider-track-color: transparent;\n --wj-slider-track-height: 8px;\n}\n.input-wrapper {\n display: grid;\n align-items: center;\n grid-template-columns: 1fr auto;\n}\n.color-preview {\n width: 30px !important;\n height: 30px !important;\n border-radius: 50%;\n position: relative;\n margin-right: 1rem;\n}\n.color-preview:before, .color-preview:after {\n content: "";\n position: absolute;\n height: 100%;\n width: 100%;\n left: 0;\n top: 0;\n border: 1px solid #fff;\n border-radius: 50%;\n}\n.color-preview:before {\n background-image: repeating-linear-gradient(45deg, #aaa 25%, transparent 25%, transparent 75%, #aaa 75%, #aaa), repeating-linear-gradient(45deg, #aaa 25%, #fff 25%, #fff 75%, #aaa 75%, #aaa);\n background-position: 0 0, 4px 4px;\n background-size: 8px 8px;\n}\n.color-preview:after {\n background: var(--wj-color-picker-value);\n}\nwj-input {\n --wj-input-border-radius: 1rem;\n --wj-input-margin-bottom: 0;\n}\nwj-input::part(input) {\n text-align: center;\n}\n.swatches {\n margin-top: 1rem;\n display: flex;\n justify-content: center;\n flex-wrap: wrap;\n}\n.swatch {\n background: var(--wj-color-picker-swatch);\n position: relative;\n width: 20px;\n height: 20px;\n margin: 0 4px 6px 4px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n color: inherit;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.marker {\n position: absolute;\n width: 12px;\n height: 12px;\n margin: -6px 0 0 -6px;\n border: 1px solid #fff;\n border-radius: 50%;\n background-color: var(--wj-color-picker-value);\n cursor: pointer;\n}';
989
- class ColorPicker extends WJElement {
714
+ const ce = `/*!
715
+ * direction.scss
716
+ */:host{--wj-color-picker-value: #ff0000;--wj-color-picker-radius: 4px}.anchor{width:1rem;height:1rem;background:var(--wj-color-picker-value)}.picker{width:200px;min-height:90px;box-shadow:0 0 5px #0000000d,0 5px 20px #0000001a;border-radius:var(--wj-color-picker-radius)}.color-area{display:block;position:relative;height:100px;color:var(--wj-color-picker-area);background-image:linear-gradient(rgba(0,0,0,0),#000),linear-gradient(90deg,#fff,currentColor);cursor:crosshair;border-radius:var(--wj-color-picker-radius) var(--wj-color-picker-radius) 0 0}.wrapper{display:inline-table;width:calc(100% - 2rem);margin:1rem}.hue{border-radius:.25rem;background-image:linear-gradient(to right,rgb(255,0,0) 0%,rgb(255,255,0) 17%,rgb(0,255,0) 33%,rgb(0,255,255) 50%,rgb(0,0,255) 67%,rgb(255,0,255) 83%,rgb(255,0,0) 100%);width:100%;height:8px;margin:.75rem 0 1rem}.hue::part(slider){--wj-slider-color: transparent;--wj-slider-thumb-color: white;--wj-slider-thumb-shadow: 0 0 0 1px rgba(33, 33, 33, .14);--wj-slider-thumb-shadow-active: var(--wj-slider-thumb-shadow);--wj-slider-track-color: transparent}.alpha-wrapper{border-radius:.25rem;width:100%;height:8px;margin:.75rem 0 1rem;background-image:repeating-linear-gradient(45deg,#aaa 25%,transparent 25%,transparent 75%,#aaa 75%,#aaa),repeating-linear-gradient(45deg,#aaa 25%,#fff 25%,#fff 75%,#aaa 75%,#aaa);background-position:0 0,4px 4px;background-size:8px 8px}.alpha{color:var(--wj-color-picker-value);display:block;height:100%;width:100%;border-radius:inherit;background-image:linear-gradient(90deg,rgba(0,0,0,0),currentColor)}.alpha::part(slider){--wj-slider-color: transparent;--wj-slider-thumb-color: white;--wj-slider-thumb-shadow: 0 0 0 1px rgba(33, 33, 33, .14);--wj-slider-thumb-shadow-active: var(--wj-slider-thumb-shadow);--wj-slider-track-color: transparent;--wj-slider-track-height: 8px}.input-wrapper{display:grid;align-items:center;grid-template-columns:1fr auto}.color-preview{width:30px!important;height:30px!important;border-radius:50%;position:relative;margin-right:1rem}.color-preview:before,.color-preview:after{content:"";position:absolute;height:100%;width:100%;left:0;top:0;border:1px solid #fff;border-radius:50%}.color-preview:before{background-image:repeating-linear-gradient(45deg,#aaa 25%,transparent 25%,transparent 75%,#aaa 75%,#aaa),repeating-linear-gradient(45deg,#aaa 25%,#fff 25%,#fff 75%,#aaa 75%,#aaa);background-position:0 0,4px 4px;background-size:8px 8px}.color-preview:after{background:var(--wj-color-picker-value)}wj-input{--wj-input-border-radius: 1rem;--wj-input-margin-bottom: 0}wj-input::part(input){text-align:center}.swatches{margin-top:1rem;display:flex;justify-content:center;flex-wrap:wrap}.swatch{background:var(--wj-color-picker-swatch);position:relative;width:20px;height:20px;margin:0 4px 6px;padding:0;border:0;border-radius:50%;color:inherit;white-space:nowrap;overflow:hidden;cursor:pointer}.marker{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border:1px solid #fff;border-radius:50%;background-color:var(--wj-color-picker-value);cursor:pointer}
717
+ `;
718
+ class de extends z {
990
719
  constructor() {
991
720
  super();
992
- __publicField(this, "className", "ColorPicker");
993
- __publicField(this, "moveMarker", (event) => {
994
- const pointer = this.getPointerPosition(event);
721
+ v(this, "className", "ColorPicker");
722
+ v(this, "moveMarker", (e) => {
723
+ const a = this.getPointerPosition(e);
995
724
  console.log("colorAreaDimension", this.colorAreaDimension);
996
- let x = pointer.pageX - this.colorAreaDimension.x;
997
- let y = pointer.pageY - this.colorAreaDimension.y;
998
- this.setColor(this.setColorAtPosition(x, y), "marker");
999
- this.setMarkerPosition(x, y);
725
+ let i = a.pageX - this.colorAreaDimension.x, n = a.pageY - this.colorAreaDimension.y;
726
+ this.setColor(this.setColorAtPosition(i, n), "marker"), this.setMarkerPosition(i, n);
1000
727
  });
1001
728
  /*
1002
729
  * @desc nanstavenie pozicie markera podla farby
1003
730
  * @param color
1004
731
  * @returns {{x: number, y: number}}
1005
732
  */
1006
- __publicField(this, "setMarkerPositionByColor", (color = "red") => {
1007
- let hsva = tinycolor(color).toHsv();
733
+ v(this, "setMarkerPositionByColor", (e = "red") => {
734
+ let a = s(e).toHsv();
1008
735
  return {
1009
- x: this.colorAreaDimension.width * hsva.s,
1010
- y: this.colorAreaDimension.height - this.colorAreaDimension.height * hsva.v
736
+ x: this.colorAreaDimension.width * a.s,
737
+ y: this.colorAreaDimension.height - this.colorAreaDimension.height * a.v
1011
738
  };
1012
739
  });
1013
740
  /*
1014
741
  * Set css variable color value
1015
742
  */
1016
- __publicField(this, "setColor", (color = null, type = "") => {
1017
- let currentColor = color;
1018
- if (currentColor === null && type === "") {
1019
- console.log("SOM NULL");
1020
- currentColor = tinycolor(this.input.value);
1021
- this.colorArea.style.setProperty("--wj-color-picker-area", currentColor.toHexString());
1022
- }
1023
- if (type === "marker") {
1024
- console.log("SOM MARKER");
1025
- this.alphaSlider.value = 100;
1026
- this.alphaSlider.style.setProperty("--wj-color-picker-value", currentColor.toHexString());
1027
- this.colorPreview.style.setProperty("--wj-color-picker-value", currentColor.toHex8String());
1028
- this.picker.style.setProperty("--wj-color-picker-value", currentColor.toHexString());
1029
- this.marker.style.setProperty("--wj-color-picker-value", currentColor.toHex8String());
743
+ v(this, "setColor", (e = null, a = "") => {
744
+ let i = e;
745
+ if (i === null && a === "" && (console.log("SOM NULL"), i = s(this.input.value), this.colorArea.style.setProperty("--wj-color-picker-area", i.toHexString())), a === "marker" && (console.log("SOM MARKER"), this.alphaSlider.value = 100, this.alphaSlider.style.setProperty("--wj-color-picker-value", i.toHexString()), this.colorPreview.style.setProperty("--wj-color-picker-value", i.toHex8String()), this.picker.style.setProperty("--wj-color-picker-value", i.toHexString()), this.marker.style.setProperty("--wj-color-picker-value", i.toHex8String())), a === "hue") {
746
+ let n = this.setColorAtPosition(this.markerPosition.x, this.markerPosition.y, this.alphaSlider.value);
747
+ i = s(this.getHSVA(this.hueSlider.value, this.alphaSlider.value)), this.colorPreview.style.setProperty("--wj-color-picker-value", n.toHex8String()), this.marker.style.setProperty("--wj-color-picker-value", n.toHexString()), this.alphaSlider.style.setProperty("--wj-color-picker-value", i.toHexString()), this.colorArea.style.setProperty("--wj-color-picker-area", i.toHexString()), this.input.value = n.toHex8String();
1030
748
  }
1031
- if (type === "hue") {
1032
- let markerColorByPosition = this.setColorAtPosition(this.markerPosition.x, this.markerPosition.y, this.alphaSlider.value);
1033
- currentColor = tinycolor(this.getHSVA(this.hueSlider.value, this.alphaSlider.value));
1034
- this.colorPreview.style.setProperty("--wj-color-picker-value", markerColorByPosition.toHex8String());
1035
- this.marker.style.setProperty("--wj-color-picker-value", markerColorByPosition.toHexString());
1036
- this.alphaSlider.style.setProperty("--wj-color-picker-value", currentColor.toHexString());
1037
- this.colorArea.style.setProperty("--wj-color-picker-area", currentColor.toHexString());
1038
- this.input.value = markerColorByPosition.toHex8String();
749
+ if (a === "alpha") {
750
+ i = s(this.input.value);
751
+ let n = i.toHsv();
752
+ n.a = this.alphaSlider.value / 100, i = s(n), this.colorPreview.style.setProperty("--wj-color-picker-value", i.toHex8String());
1039
753
  }
1040
- if (type === "alpha") {
1041
- currentColor = tinycolor(this.input.value);
1042
- let hsv = currentColor.toHsv();
1043
- hsv.a = this.alphaSlider.value / 100;
1044
- currentColor = tinycolor(hsv);
1045
- this.colorPreview.style.setProperty("--wj-color-picker-value", currentColor.toHex8String());
1046
- }
1047
- if (type === "swatch") {
1048
- this.colorPreview.style.setProperty("--wj-color-picker-value", currentColor.toHex8String());
1049
- this.marker.style.setProperty("--wj-color-picker-value", currentColor.toHexString());
1050
- this.alphaSlider.style.setProperty("--wj-color-picker-value", currentColor.toHexString());
1051
- this.colorArea.style.setProperty("--wj-color-picker-area", currentColor.toHex8String());
1052
- this.markerPosition = this.setMarkerPositionByColor(currentColor.toHex8String());
1053
- this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y);
1054
- }
1055
- this.input.value = currentColor.toHex8String();
1056
- this.anchor.style.setProperty("--wj-color-picker-value", currentColor.toHexString());
754
+ a === "swatch" && (this.colorPreview.style.setProperty("--wj-color-picker-value", i.toHex8String()), this.marker.style.setProperty("--wj-color-picker-value", i.toHexString()), this.alphaSlider.style.setProperty("--wj-color-picker-value", i.toHexString()), this.colorArea.style.setProperty("--wj-color-picker-area", i.toHex8String()), this.markerPosition = this.setMarkerPositionByColor(i.toHex8String()), this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y)), this.input.value = i.toHex8String(), this.anchor.style.setProperty("--wj-color-picker-value", i.toHexString());
1057
755
  });
1058
756
  /*
1059
757
  * Set hue sliders
1060
758
  */
1061
- __publicField(this, "setHue", (e) => {
1062
- this.hueSlider.value = e.detail.value;
1063
- this.setColor(null, "hue");
759
+ v(this, "setHue", (e) => {
760
+ this.hueSlider.value = e.detail.value, this.setColor(null, "hue");
1064
761
  });
1065
762
  /*
1066
763
  * Set alpha sliders
1067
764
  */
1068
- __publicField(this, "setAlpha", (e) => {
1069
- this.alphaSlider.value = e.detail.value;
1070
- this.setColor(null, "alpha");
765
+ v(this, "setAlpha", (e) => {
766
+ this.alphaSlider.value = e.detail.value, this.setColor(null, "alpha");
1071
767
  });
1072
768
  /*
1073
769
  * Get HSVA color order by hue and alpha
1074
770
  */
1075
- __publicField(this, "getHSVA", (hue, alpha) => {
1076
- return `hsva(${hue}, 100%, 100%, ${alpha / 100})`;
1077
- });
771
+ v(this, "getHSVA", (e, a) => `hsva(${e}, 100%, 100%, ${a / 100})`);
1078
772
  this._markerPosition = {
1079
773
  markerX: "0",
1080
774
  markerY: "0"
1081
- };
1082
- this._swatches = [
775
+ }, this._swatches = [
1083
776
  "#264653",
1084
777
  "#2a9d8f",
1085
778
  "#e9c46a",
@@ -1093,20 +786,20 @@ class ColorPicker extends WJElement {
1093
786
  "rgba(0,119,182,0.8)"
1094
787
  ];
1095
788
  }
1096
- set markerPosition(value) {
1097
- this._markerPosition = value;
789
+ set markerPosition(e) {
790
+ this._markerPosition = e;
1098
791
  }
1099
792
  get markerPosition() {
1100
793
  return this._markerPosition;
1101
794
  }
1102
- set swatches(value) {
1103
- this.setAttribute("swatches", value.split(","));
795
+ set swatches(e) {
796
+ this.setAttribute("swatches", e.split(","));
1104
797
  }
1105
798
  get swatches() {
1106
799
  return this._swatches;
1107
800
  }
1108
801
  static get cssStyleSheet() {
1109
- return styles;
802
+ return ce;
1110
803
  }
1111
804
  static get observedAttributes() {
1112
805
  return [];
@@ -1114,120 +807,66 @@ class ColorPicker extends WJElement {
1114
807
  setupAttributes() {
1115
808
  this.isShadowRoot = "open";
1116
809
  }
1117
- draw(context, store, params) {
1118
- let fragment = document.createDocumentFragment();
1119
- let native = document.createElement("div");
1120
- native.classList.add("native-color-picker");
1121
- let anchor = document.createElement("div");
1122
- anchor.setAttribute("slot", "anchor");
1123
- anchor.classList.add("anchor");
1124
- let picker = document.createElement("div");
1125
- picker.classList.add("picker");
1126
- let marker = document.createElement("div");
1127
- marker.classList.add("marker");
1128
- let colorArea = document.createElement("div");
1129
- colorArea.classList.add("color-area");
1130
- colorArea.addEventListener("click", this.moveMarker);
1131
- let wrapper = document.createElement("div");
1132
- wrapper.classList.add("wrapper");
1133
- let hueSlider = document.createElement("wj-slider");
1134
- hueSlider.setAttribute("min", "0");
1135
- hueSlider.setAttribute("max", "360");
1136
- hueSlider.classList.add("hue");
1137
- hueSlider.addEventListener("wj:slider-move", this.setHue);
1138
- let alphaWrapper = document.createElement("div");
1139
- alphaWrapper.classList.add("alpha-wrapper");
1140
- let alphaSlider = document.createElement("wj-slider");
1141
- alphaSlider.setAttribute("min", "0");
1142
- alphaSlider.setAttribute("max", "100");
1143
- alphaSlider.setAttribute("value", "50");
1144
- alphaSlider.classList.add("alpha");
1145
- alphaSlider.addEventListener("wj:slider-move", this.setAlpha);
1146
- let inputWrapper = document.createElement("div");
1147
- inputWrapper.classList.add("input-wrapper");
1148
- let colorPreview = document.createElement("div");
1149
- colorPreview.classList.add("color-preview");
1150
- let input = document.createElement("wj-input");
1151
- input.classList.add("input");
1152
- input.setAttribute("variant", "standard");
1153
- input.value = "#ff0000";
1154
- colorArea.appendChild(marker);
1155
- alphaWrapper.appendChild(alphaSlider);
1156
- inputWrapper.appendChild(colorPreview);
1157
- inputWrapper.appendChild(input);
1158
- wrapper.appendChild(hueSlider);
1159
- wrapper.appendChild(alphaWrapper);
1160
- wrapper.appendChild(inputWrapper);
1161
- picker.appendChild(colorArea);
1162
- picker.appendChild(wrapper);
1163
- this.createSwatches(wrapper);
1164
- let popup = document.createElement("wj-popup");
1165
- popup.setAttribute("placement", this.placement || "bottom-start");
1166
- popup.setAttribute("offset", this.offset);
1167
- popup.setAttribute("manual", "");
1168
- popup.appendChild(anchor);
1169
- popup.appendChild(picker);
1170
- native.appendChild(popup);
1171
- fragment.appendChild(native);
1172
- this.popup = popup;
1173
- this.anchor = anchor;
1174
- this.picker = picker;
1175
- this.marker = marker;
1176
- this.colorArea = colorArea;
1177
- this.hueSlider = hueSlider;
1178
- this.alphaSlider = alphaSlider;
1179
- this.colorPreview = colorPreview;
1180
- this.input = input;
1181
- return fragment;
1182
- }
1183
- createSwatches(node) {
810
+ draw(e, a, i) {
811
+ let n = document.createDocumentFragment(), o = document.createElement("div");
812
+ o.classList.add("native-color-picker");
813
+ let h = document.createElement("div");
814
+ h.setAttribute("slot", "anchor"), h.classList.add("anchor");
815
+ let l = document.createElement("div");
816
+ l.classList.add("picker");
817
+ let d = document.createElement("div");
818
+ d.classList.add("marker");
819
+ let g = document.createElement("div");
820
+ g.classList.add("color-area"), g.addEventListener("click", this.moveMarker);
821
+ let c = document.createElement("div");
822
+ c.classList.add("wrapper");
823
+ let x = document.createElement("wj-slider");
824
+ x.setAttribute("min", "0"), x.setAttribute("max", "360"), x.classList.add("hue"), x.addEventListener("wj:slider-move", this.setHue);
825
+ let H = document.createElement("div");
826
+ H.classList.add("alpha-wrapper");
827
+ let w = document.createElement("wj-slider");
828
+ w.setAttribute("min", "0"), w.setAttribute("max", "100"), w.setAttribute("value", "50"), w.classList.add("alpha"), w.addEventListener("wj:slider-move", this.setAlpha);
829
+ let A = document.createElement("div");
830
+ A.classList.add("input-wrapper");
831
+ let P = document.createElement("div");
832
+ P.classList.add("color-preview");
833
+ let _ = document.createElement("wj-input");
834
+ _.classList.add("input"), _.setAttribute("variant", "standard"), _.value = "#ff0000", g.appendChild(d), H.appendChild(w), A.appendChild(P), A.appendChild(_), c.appendChild(x), c.appendChild(H), c.appendChild(A), l.appendChild(g), l.appendChild(c), this.createSwatches(c);
835
+ let k = document.createElement("wj-popup");
836
+ return k.setAttribute("placement", this.placement || "bottom-start"), k.setAttribute("offset", this.offset), k.setAttribute("manual", ""), k.appendChild(h), k.appendChild(l), o.appendChild(k), n.appendChild(o), this.popup = k, this.anchor = h, this.picker = l, this.marker = d, this.colorArea = g, this.hueSlider = x, this.alphaSlider = w, this.colorPreview = P, this.input = _, n;
837
+ }
838
+ createSwatches(e) {
1184
839
  if (this.swatches.length === 0)
1185
840
  return;
1186
- let swatches = document.createElement("div");
1187
- swatches.classList.add("swatches");
1188
- this.swatches.forEach((swatch) => {
1189
- let button = document.createElement("button");
1190
- button.classList.add("swatch");
1191
- button.style.setProperty("--wj-color-picker-swatch", swatch);
1192
- button.addEventListener("click", (e) => {
1193
- this.setSliders(swatch);
1194
- this.setColor(tinycolor(swatch), "swatch");
1195
- });
1196
- swatches.appendChild(button);
1197
- });
1198
- node.appendChild(swatches);
1199
- }
1200
- setSliders(color) {
1201
- let hsva = tinycolor(color).toHsv();
1202
- this.hueSlider.value = hsva.h;
1203
- this.alphaSlider.value = hsva.a * 100;
841
+ let a = document.createElement("div");
842
+ a.classList.add("swatches"), this.swatches.forEach((i) => {
843
+ let n = document.createElement("button");
844
+ n.classList.add("swatch"), n.style.setProperty("--wj-color-picker-swatch", i), n.addEventListener("click", (o) => {
845
+ this.setSliders(i), this.setColor(s(i), "swatch");
846
+ }), a.appendChild(n);
847
+ }), e.appendChild(a);
848
+ }
849
+ setSliders(e) {
850
+ let a = s(e).toHsv();
851
+ this.hueSlider.value = a.h, this.alphaSlider.value = a.a * 100;
1204
852
  }
1205
853
  afterDraw() {
1206
- this.init = false;
1207
- this.addEventListener("wj:popup-show", (e) => {
1208
- if (!this.init) {
1209
- this.colorAreaDimension = {
1210
- width: this.colorArea.offsetWidth,
1211
- height: this.colorArea.offsetHeight,
1212
- x: this.colorArea.offsetLeft,
1213
- y: this.colorArea.offsetTop
1214
- };
1215
- this.markerPosition = this.setMarkerPositionByColor(this.input.value);
1216
- this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y);
1217
- if (this.input.value != "")
1218
- this.alphaSlider.value = 100;
1219
- this.setColor();
1220
- this.init = true;
1221
- }
854
+ this.init = !1, this.addEventListener("wj:popup-show", (e) => {
855
+ this.init || (this.colorAreaDimension = {
856
+ width: this.colorArea.offsetWidth,
857
+ height: this.colorArea.offsetHeight,
858
+ x: this.colorArea.offsetLeft,
859
+ y: this.colorArea.offsetTop
860
+ }, this.markerPosition = this.setMarkerPositionByColor(this.input.value), this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y), this.input.value != "" && (this.alphaSlider.value = 100), this.setColor(), this.init = !0);
1222
861
  });
1223
862
  }
1224
863
  disconnectedCallback() {
1225
- this.init = false;
864
+ this.init = !1;
1226
865
  }
1227
- getPointerPosition(event) {
866
+ getPointerPosition(e) {
1228
867
  return {
1229
- pageX: event.changedTouches ? event.changedTouches[0].pageX : event.pageX,
1230
- pageY: event.changedTouches ? event.changedTouches[0].pageY : event.pageY
868
+ pageX: e.changedTouches ? e.changedTouches[0].pageX : e.pageX,
869
+ pageY: e.changedTouches ? e.changedTouches[0].pageY : e.pageY
1231
870
  };
1232
871
  }
1233
872
  /*
@@ -1235,15 +874,11 @@ class ColorPicker extends WJElement {
1235
874
  * @param x
1236
875
  * @param y
1237
876
  */
1238
- setMarkerPosition(x, y) {
1239
- x = x < 0 ? 0 : x > this.colorAreaDimension.width ? this.colorAreaDimension.width : x;
1240
- y = y < 0 ? 0 : y > this.colorAreaDimension.height ? this.colorAreaDimension.height : y;
1241
- this.markerPosition = {
1242
- x,
1243
- y
1244
- };
1245
- this.marker.style.left = `${x}px`;
1246
- this.marker.style.top = `${y}px`;
877
+ setMarkerPosition(e, a) {
878
+ e = e < 0 ? 0 : e > this.colorAreaDimension.width ? this.colorAreaDimension.width : e, a = a < 0 ? 0 : a > this.colorAreaDimension.height ? this.colorAreaDimension.height : a, this.markerPosition = {
879
+ x: e,
880
+ y: a
881
+ }, this.marker.style.left = `${e}px`, this.marker.style.top = `${a}px`;
1247
882
  }
1248
883
  /*
1249
884
  * nastavenie farby podla pozicie markera
@@ -1251,18 +886,18 @@ class ColorPicker extends WJElement {
1251
886
  * @param y
1252
887
  * @returns {tinycolor}
1253
888
  */
1254
- setColorAtPosition(x, y, alpha = 100) {
1255
- console.log("x", x, "y", y, "alpha", alpha);
1256
- const hsva = {
889
+ setColorAtPosition(e, a, i = 100) {
890
+ console.log("x", e, "y", a, "alpha", i);
891
+ const n = {
1257
892
  h: this.hueSlider.value * 1,
1258
- s: x / this.colorAreaDimension.width * 100,
1259
- v: 100 - y / this.colorAreaDimension.height * 100,
1260
- a: alpha / 100
893
+ s: e / this.colorAreaDimension.width * 100,
894
+ v: 100 - a / this.colorAreaDimension.height * 100,
895
+ a: i / 100
1261
896
  };
1262
- return tinycolor(hsva);
897
+ return s(n);
1263
898
  }
1264
899
  }
1265
- customElements.get("wj-color-picker") || window.customElements.define("wj-color-picker", ColorPicker);
900
+ customElements.get("wj-color-picker") || window.customElements.define("wj-color-picker", de);
1266
901
  export {
1267
- ColorPicker
902
+ de as ColorPicker
1268
903
  };