wj-elements 0.0.5 → 0.0.6

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 (71) hide show
  1. package/dist/animation-2266bd6e.js +103 -0
  2. package/dist/localize-762a9f0f.js +43 -0
  3. package/dist/wj-animation.js +6 -0
  4. package/dist/wj-aside.js +8 -10
  5. package/dist/wj-avatar.js +19 -21
  6. package/dist/wj-badge.js +16 -16
  7. package/dist/wj-breadcrumb.js +7 -11
  8. package/dist/wj-breadcrumbs.js +5 -7
  9. package/dist/wj-button-group.js +11 -13
  10. package/dist/wj-button.js +36 -39
  11. package/dist/wj-card-content.js +11 -13
  12. package/dist/wj-card-controls.js +6 -8
  13. package/dist/wj-card-header.js +11 -13
  14. package/dist/wj-card-subtitle.js +9 -11
  15. package/dist/wj-card-title.js +7 -9
  16. package/dist/wj-card.js +13 -15
  17. package/dist/wj-carousel-item.js +32 -0
  18. package/dist/wj-carousel.js +178 -0
  19. package/dist/wj-checkbox.js +11 -11
  20. package/dist/wj-chip.js +17 -17
  21. package/dist/wj-col.js +11 -12
  22. package/dist/wj-color-picker.js +192 -179
  23. package/dist/wj-container.js +7 -9
  24. package/dist/wj-copy-button.js +1 -3
  25. package/dist/wj-dialog.js +20 -22
  26. package/dist/wj-divider.js +7 -9
  27. package/dist/wj-dropdown.js +10 -14
  28. package/dist/wj-element.js +9 -9
  29. package/dist/wj-file-upload-item.js +63 -0
  30. package/dist/wj-file-upload.js +221 -0
  31. package/dist/wj-footer.js +9 -11
  32. package/dist/wj-form.js +6 -8
  33. package/dist/wj-format-digital.js +51 -0
  34. package/dist/wj-grid.js +9 -10
  35. package/dist/wj-header.js +9 -11
  36. package/dist/wj-icon-picker.js +78 -58
  37. package/dist/wj-icon.js +45 -48
  38. package/dist/wj-img-comparer.js +12 -14
  39. package/dist/wj-img.js +14 -16
  40. package/dist/wj-infinite-scroll.js +27 -22
  41. package/dist/wj-input-file.js +47 -0
  42. package/dist/wj-input.js +30 -23
  43. package/dist/wj-item.js +1 -3
  44. package/dist/wj-label.js +10 -10
  45. package/dist/wj-list.js +1 -3
  46. package/dist/wj-main.js +1 -3
  47. package/dist/wj-masonry.js +71518 -0
  48. package/dist/wj-master.js +287 -253
  49. package/dist/wj-menu-button.js +10 -12
  50. package/dist/wj-menu-item.js +49 -46
  51. package/dist/wj-menu-label.js +2 -2
  52. package/dist/wj-menu.js +8 -10
  53. package/dist/wj-popup.js +89 -88
  54. package/dist/wj-progress-bar.js +14 -16
  55. package/dist/wj-radio-group.js +5 -7
  56. package/dist/wj-radio.js +13 -15
  57. package/dist/wj-rate.js +127 -0
  58. package/dist/wj-relative-time.js +50 -0
  59. package/dist/wj-router-link.js +11 -13
  60. package/dist/wj-row.js +11 -12
  61. package/dist/wj-slider.js +6 -6
  62. package/dist/wj-split-view.js +1 -3
  63. package/dist/wj-textarea.js +17 -19
  64. package/dist/wj-thumbnail.js +12 -14
  65. package/dist/wj-toast.js +1 -1
  66. package/dist/wj-toggle.js +9 -9
  67. package/dist/wj-toolbar.js +13 -15
  68. package/dist/wj-tooltip.js +16 -18
  69. package/dist/wj-visually-hidden.js +6 -8
  70. package/package.json +1 -1
  71. package/dist/style.css +0 -3
@@ -1,7 +1,7 @@
1
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";
2
+ var z = (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) => (z(t, typeof r != "symbol" ? r + "" : r, e), e);
4
+ import B, { event as G } from "./wj-element.js";
5
5
  import "./wj-store.js";
6
6
  function S(t) {
7
7
  "@babel/helpers - typeof";
@@ -11,13 +11,13 @@ function S(t) {
11
11
  return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
12
12
  }, S(t);
13
13
  }
14
- var O = /^\s+/, G = /\s+$/;
14
+ var O = /^\s+/, $ = /\s+$/;
15
15
  function s(t, r) {
16
16
  if (t = t || "", r = r || {}, t instanceof s)
17
17
  return t;
18
18
  if (!(this instanceof s))
19
19
  return new s(t, r);
20
- var e = $(t);
20
+ var e = V(t);
21
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
22
  }
23
23
  s.prototype = {
@@ -44,8 +44,8 @@ s.prototype = {
44
44
  return (r.r * 299 + r.g * 587 + r.b * 114) / 1e3;
45
45
  },
46
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;
47
+ var r = this.toRgb(), e, i, a, n, o, h;
48
+ return e = r.r / 255, i = r.g / 255, a = r.b / 255, e <= 0.03928 ? n = e / 12.92 : n = Math.pow((e + 0.055) / 1.055, 2.4), i <= 0.03928 ? o = i / 12.92 : o = Math.pow((i + 0.055) / 1.055, 2.4), a <= 0.03928 ? h = a / 12.92 : h = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * n + 0.7152 * o + 0.0722 * h;
49
49
  },
50
50
  setAlpha: function(r) {
51
51
  return this._a = D(r), this._roundA = Math.round(100 * this._a) / 100, this;
@@ -60,8 +60,8 @@ s.prototype = {
60
60
  };
61
61
  },
62
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 + ")";
63
+ var r = R(this._r, this._g, this._b), e = Math.round(r.h * 360), i = Math.round(r.s * 100), a = Math.round(r.v * 100);
64
+ return this._a == 1 ? "hsv(" + e + ", " + i + "%, " + a + "%)" : "hsva(" + e + ", " + i + "%, " + a + "%, " + this._roundA + ")";
65
65
  },
66
66
  toHsl: function() {
67
67
  var r = C(this._r, this._g, this._b);
@@ -73,8 +73,8 @@ s.prototype = {
73
73
  };
74
74
  },
75
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 + ")";
76
+ var r = C(this._r, this._g, this._b), e = Math.round(r.h * 360), i = Math.round(r.s * 100), a = Math.round(r.l * 100);
77
+ return this._a == 1 ? "hsl(" + e + ", " + i + "%, " + a + "%)" : "hsla(" + e + ", " + i + "%, " + a + "%, " + this._roundA + ")";
78
78
  },
79
79
  toHex: function(r) {
80
80
  return E(this._r, this._g, this._b, r);
@@ -83,7 +83,7 @@ s.prototype = {
83
83
  return "#" + this.toHex(r);
84
84
  },
85
85
  toHex8: function(r) {
86
- return X(this._r, this._g, this._b, this._a, r);
86
+ return W(this._r, this._g, this._b, this._a, r);
87
87
  },
88
88
  toHex8String: function(r) {
89
89
  return "#" + this.toHex8(r);
@@ -111,49 +111,49 @@ s.prototype = {
111
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 + ")";
112
112
  },
113
113
  toName: function() {
114
- return this._a === 0 ? "transparent" : this._a < 1 ? !1 : ne[E(this._r, this._g, this._b, !0)] || !1;
114
+ return this._a === 0 ? "transparent" : this._a < 1 ? !1 : se[E(this._r, this._g, this._b, !0)] || !1;
115
115
  },
116
116
  toFilter: function(r) {
117
- var e = "#" + L(this._r, this._g, this._b, this._a), a = e, i = this._gradientType ? "GradientType = 1, " : "";
117
+ var e = "#" + T(this._r, this._g, this._b, this._a), i = e, a = this._gradientType ? "GradientType = 1, " : "";
118
118
  if (r) {
119
119
  var n = s(r);
120
- a = "#" + L(n._r, n._g, n._b, n._a);
120
+ i = "#" + T(n._r, n._g, n._b, n._a);
121
121
  }
122
- return "progid:DXImageTransform.Microsoft.gradient(" + i + "startColorstr=" + e + ",endColorstr=" + a + ")";
122
+ return "progid:DXImageTransform.Microsoft.gradient(" + a + "startColorstr=" + e + ",endColorstr=" + i + ")";
123
123
  },
124
124
  toString: function(r) {
125
125
  var e = !!r;
126
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());
127
+ var i = !1, a = this._a < 1 && this._a >= 0, n = !e && a && (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" && (i = this.toRgbString()), r === "prgb" && (i = this.toPercentageRgbString()), (r === "hex" || r === "hex6") && (i = this.toHexString()), r === "hex3" && (i = this.toHexString(!0)), r === "hex4" && (i = this.toHex8String(!0)), r === "hex8" && (i = this.toHex8String()), r === "name" && (i = this.toName()), r === "hsl" && (i = this.toHslString()), r === "hsv" && (i = this.toHsvString()), i || this.toHexString());
129
129
  },
130
130
  clone: function() {
131
131
  return s(this.toString());
132
132
  },
133
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;
134
+ var i = r.apply(null, [this].concat([].slice.call(e)));
135
+ return this._r = i._r, this._g = i._g, this._b = i._b, this.setAlpha(i._a), this;
136
136
  },
137
137
  lighten: function() {
138
138
  return this._applyModification(K, arguments);
139
139
  },
140
140
  brighten: function() {
141
- return this._applyModification(Z, arguments);
141
+ return this._applyModification(Q, arguments);
142
142
  },
143
143
  darken: function() {
144
- return this._applyModification(Q, arguments);
144
+ return this._applyModification(ee, arguments);
145
145
  },
146
146
  desaturate: function() {
147
- return this._applyModification(W, arguments);
147
+ return this._applyModification(Y, arguments);
148
148
  },
149
149
  saturate: function() {
150
- return this._applyModification(Y, arguments);
150
+ return this._applyModification(J, arguments);
151
151
  },
152
152
  greyscale: function() {
153
- return this._applyModification(J, arguments);
153
+ return this._applyModification(Z, arguments);
154
154
  },
155
155
  spin: function() {
156
- return this._applyModification(ee, arguments);
156
+ return this._applyModification(te, arguments);
157
157
  },
158
158
  _applyCombination: function(r, e) {
159
159
  return r.apply(null, [this].concat([].slice.call(e)));
@@ -162,41 +162,41 @@ s.prototype = {
162
162
  return this._applyCombination(ae, arguments);
163
163
  },
164
164
  complement: function() {
165
- return this._applyCombination(te, arguments);
165
+ return this._applyCombination(re, arguments);
166
166
  },
167
167
  monochromatic: function() {
168
- return this._applyCombination(ie, arguments);
168
+ return this._applyCombination(ne, arguments);
169
169
  },
170
170
  splitcomplement: function() {
171
- return this._applyCombination(re, arguments);
171
+ return this._applyCombination(ie, arguments);
172
172
  },
173
173
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
174
174
  // polyad: function (number) {
175
175
  // return this._applyCombination(polyad, [number]);
176
176
  // },
177
177
  triad: function() {
178
- return this._applyCombination(T, [3]);
178
+ return this._applyCombination(F, [3]);
179
179
  },
180
180
  tetrad: function() {
181
- return this._applyCombination(T, [4]);
181
+ return this._applyCombination(F, [4]);
182
182
  }
183
183
  };
184
184
  s.fromRatio = function(t, r) {
185
185
  if (S(t) == "object") {
186
186
  var e = {};
187
- for (var a in t)
188
- t.hasOwnProperty(a) && (a === "a" ? e[a] = t[a] : e[a] = y(t[a]));
187
+ for (var i in t)
188
+ t.hasOwnProperty(i) && (i === "a" ? e[i] = t[i] : e[i] = y(t[i]));
189
189
  t = e;
190
190
  }
191
191
  return s(t, r);
192
192
  };
193
- function $(t) {
193
+ function V(t) {
194
194
  var r = {
195
195
  r: 0,
196
196
  g: 0,
197
197
  b: 0
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), {
198
+ }, e = 1, i = null, a = null, n = null, o = !1, h = !1;
199
+ return typeof t == "string" && (t = ue(t)), S(t) == "object" && (m(t.r) && m(t.g) && m(t.b) ? (r = q(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) ? (i = y(t.s), a = y(t.v), r = X(t.h, i, a), o = !0, h = "hsv") : m(t.h) && m(t.s) && m(t.l) && (i = y(t.s), n = y(t.l), r = U(t.h, i, n), o = !0, h = "hsl"), t.hasOwnProperty("a") && (e = t.a)), e = D(e), {
200
200
  ok: o,
201
201
  format: t.format || h,
202
202
  r: Math.min(255, Math.max(r.r, 0)),
@@ -205,7 +205,7 @@ function $(t) {
205
205
  a: e
206
206
  };
207
207
  }
208
- function U(t, r, e) {
208
+ function q(t, r, e) {
209
209
  return {
210
210
  r: u(t, 255) * 255,
211
211
  g: u(r, 255) * 255,
@@ -214,12 +214,12 @@ function U(t, r, e) {
214
214
  }
215
215
  function C(t, r, e) {
216
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)
217
+ var i = Math.max(t, r, e), a = Math.min(t, r, e), n, o, h = (i + a) / 2;
218
+ if (i == a)
219
219
  n = o = 0;
220
220
  else {
221
- var l = a - i;
222
- switch (o = h > 0.5 ? l / (2 - a - i) : l / (a + i), a) {
221
+ var l = i - a;
222
+ switch (o = h > 0.5 ? l / (2 - i - a) : l / (i + a), i) {
223
223
  case t:
224
224
  n = (r - e) / l + (r < e ? 6 : 0);
225
225
  break;
@@ -238,31 +238,31 @@ function C(t, r, e) {
238
238
  l: h
239
239
  };
240
240
  }
241
- function V(t, r, e) {
242
- var a, i, n;
241
+ function U(t, r, e) {
242
+ var i, a, n;
243
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;
244
+ function o(c, g, d) {
245
+ return d < 0 && (d += 1), d > 1 && (d -= 1), d < 1 / 6 ? c + (g - c) * 6 * d : d < 1 / 2 ? g : d < 2 / 3 ? c + (g - c) * (2 / 3 - d) * 6 : c;
246
246
  }
247
247
  if (r === 0)
248
- a = i = n = e;
248
+ i = a = n = e;
249
249
  else {
250
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);
251
+ i = o(l, h, t + 1 / 3), a = o(l, h, t), n = o(l, h, t - 1 / 3);
252
252
  }
253
253
  return {
254
- r: a * 255,
255
- g: i * 255,
254
+ r: i * 255,
255
+ g: a * 255,
256
256
  b: n * 255
257
257
  };
258
258
  }
259
259
  function R(t, r, e) {
260
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)
261
+ var i = Math.max(t, r, e), a = Math.min(t, r, e), n, o, h = i, l = i - a;
262
+ if (o = i === 0 ? 0 : l / i, i == a)
263
263
  n = 0;
264
264
  else {
265
- switch (a) {
265
+ switch (i) {
266
266
  case t:
267
267
  n = (r - e) / l + (r < e ? 6 : 0);
268
268
  break;
@@ -281,26 +281,26 @@ function R(t, r, e) {
281
281
  v: h
282
282
  };
283
283
  }
284
- function q(t, r, e) {
284
+ function X(t, r, e) {
285
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];
286
+ var i = Math.floor(t), a = t - i, n = e * (1 - r), o = e * (1 - a * r), h = e * (1 - (1 - a) * r), l = i % 6, c = [e, o, n, n, h, e][l], g = [h, e, e, o, n, n][l], d = [n, n, h, e, e, o][l];
287
287
  return {
288
- r: d * 255,
288
+ r: c * 255,
289
289
  g: g * 255,
290
- b: c * 255
290
+ b: d * 255
291
291
  };
292
292
  }
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("");
293
+ function E(t, r, e, i) {
294
+ var a = [b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16))];
295
+ return i && a[0].charAt(0) == a[0].charAt(1) && a[1].charAt(0) == a[1].charAt(1) && a[2].charAt(0) == a[2].charAt(1) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) : a.join("");
296
296
  }
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("");
297
+ function W(t, r, e, i, a) {
298
+ var n = [b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16)), b(I(i))];
299
+ return a && 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("");
300
300
  }
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("");
301
+ function T(t, r, e, i) {
302
+ var a = [b(I(i)), b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16))];
303
+ return a.join("");
304
304
  }
305
305
  s.equals = function(t, r) {
306
306
  return !t || !r ? !1 : s(t).toRgbString() == s(r).toRgbString();
@@ -312,17 +312,17 @@ s.random = function() {
312
312
  b: Math.random()
313
313
  });
314
314
  };
315
- function W(t, r) {
315
+ function Y(t, r) {
316
316
  r = r === 0 ? 0 : r || 10;
317
317
  var e = s(t).toHsl();
318
318
  return e.s -= r / 100, e.s = M(e.s), s(e);
319
319
  }
320
- function Y(t, r) {
320
+ function J(t, r) {
321
321
  r = r === 0 ? 0 : r || 10;
322
322
  var e = s(t).toHsl();
323
323
  return e.s += r / 100, e.s = M(e.s), s(e);
324
324
  }
325
- function J(t) {
325
+ function Z(t) {
326
326
  return s(t).desaturate(100);
327
327
  }
328
328
  function K(t, r) {
@@ -330,36 +330,36 @@ function K(t, r) {
330
330
  var e = s(t).toHsl();
331
331
  return e.l += r / 100, e.l = M(e.l), s(e);
332
332
  }
333
- function Z(t, r) {
333
+ function Q(t, r) {
334
334
  r = r === 0 ? 0 : r || 10;
335
335
  var e = s(t).toRgb();
336
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
337
  }
338
- function Q(t, r) {
338
+ function ee(t, r) {
339
339
  r = r === 0 ? 0 : r || 10;
340
340
  var e = s(t).toHsl();
341
341
  return e.l -= r / 100, e.l = M(e.l), s(e);
342
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);
343
+ function te(t, r) {
344
+ var e = s(t).toHsl(), i = (e.h + r) % 360;
345
+ return e.h = i < 0 ? 360 + i : i, s(e);
346
346
  }
347
- function te(t) {
347
+ function re(t) {
348
348
  var r = s(t).toHsl();
349
349
  return r.h = (r.h + 180) % 360, s(r);
350
350
  }
351
- function T(t, r) {
351
+ function F(t, r) {
352
352
  if (isNaN(r) || r <= 0)
353
353
  throw new Error("Argument to polyad must be a positive number");
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,
354
+ for (var e = s(t).toHsl(), i = [s(t)], a = 360 / r, n = 1; n < r; n++)
355
+ i.push(s({
356
+ h: (e.h + n * a) % 360,
357
357
  s: e.s,
358
358
  l: e.l
359
359
  }));
360
- return a;
360
+ return i;
361
361
  }
362
- function re(t) {
362
+ function ie(t) {
363
363
  var r = s(t).toHsl(), e = r.h;
364
364
  return [s(t), s({
365
365
  h: (e + 72) % 360,
@@ -373,60 +373,60 @@ function re(t) {
373
373
  }
374
374
  function ae(t, r, e) {
375
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));
376
+ var i = s(t).toHsl(), a = 360 / e, n = [s(t)];
377
+ for (i.h = (i.h - (a * r >> 1) + 720) % 360; --r; )
378
+ i.h = (i.h + a) % 360, n.push(s(i));
379
379
  return n;
380
380
  }
381
- function ie(t, r) {
381
+ function ne(t, r) {
382
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--; )
383
+ for (var e = s(t).toHsv(), i = e.h, a = e.s, n = e.v, o = [], h = 1 / r; r--; )
384
384
  o.push(s({
385
- h: a,
386
- s: i,
385
+ h: i,
386
+ s: a,
387
387
  v: n
388
388
  })), n = (n + h) % 1;
389
389
  return o;
390
390
  }
391
391
  s.mix = function(t, r, e) {
392
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
393
+ var i = s(t).toRgb(), a = s(r).toRgb(), n = e / 100, o = {
394
+ r: (a.r - i.r) * n + i.r,
395
+ g: (a.g - i.g) * n + i.g,
396
+ b: (a.b - i.b) * n + i.b,
397
+ a: (a.a - i.a) * n + i.a
398
398
  };
399
399
  return s(o);
400
400
  };
401
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);
402
+ var e = s(t), i = s(r);
403
+ return (Math.max(e.getLuminance(), i.getLuminance()) + 0.05) / (Math.min(e.getLuminance(), i.getLuminance()) + 0.05);
404
404
  };
405
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) {
406
+ var i = s.readability(t, r), a, n;
407
+ switch (n = !1, a = de(e), a.level + a.size) {
408
408
  case "AAsmall":
409
409
  case "AAAlarge":
410
- n = a >= 4.5;
410
+ n = i >= 4.5;
411
411
  break;
412
412
  case "AAlarge":
413
- n = a >= 3;
413
+ n = i >= 3;
414
414
  break;
415
415
  case "AAAsmall":
416
- n = a >= 7;
416
+ n = i >= 7;
417
417
  break;
418
418
  }
419
419
  return n;
420
420
  };
421
421
  s.mostReadable = function(t, r, e) {
422
- var a = null, i = 0, n, o, h, l;
422
+ var i = null, a = 0, n, o, h, l;
423
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, {
424
+ for (var c = 0; c < r.length; c++)
425
+ n = s.readability(t, r[c]), n > a && (a = n, i = s(r[c]));
426
+ return s.isReadable(t, i, {
427
427
  level: h,
428
428
  size: l
429
- }) || !o ? a : (e.includeFallbackColors = !1, s.mostReadable(t, ["#fff", "#000"], e));
429
+ }) || !o ? i : (e.includeFallbackColors = !1, s.mostReadable(t, ["#fff", "#000"], e));
430
430
  };
431
431
  var j = s.names = {
432
432
  aliceblue: "f0f8ff",
@@ -578,8 +578,8 @@ var j = s.names = {
578
578
  whitesmoke: "f5f5f5",
579
579
  yellow: "ff0",
580
580
  yellowgreen: "9acd32"
581
- }, ne = s.hexNames = se(j);
582
- function se(t) {
581
+ }, se = s.hexNames = oe(j);
582
+ function oe(t) {
583
583
  var r = {};
584
584
  for (var e in t)
585
585
  t.hasOwnProperty(e) && (r[t[e]] = e);
@@ -589,8 +589,8 @@ function D(t) {
589
589
  return t = parseFloat(t), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
590
590
  }
591
591
  function u(t, r) {
592
- oe(t) && (t = "100%");
593
- var e = he(t);
592
+ he(t) && (t = "100%");
593
+ var e = le(t);
594
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);
595
595
  }
596
596
  function M(t) {
@@ -599,10 +599,10 @@ function M(t) {
599
599
  function f(t) {
600
600
  return parseInt(t, 16);
601
601
  }
602
- function oe(t) {
602
+ function he(t) {
603
603
  return typeof t == "string" && t.indexOf(".") != -1 && parseFloat(t) === 1;
604
604
  }
605
- function he(t) {
605
+ function le(t) {
606
606
  return typeof t == "string" && t.indexOf("%") != -1;
607
607
  }
608
608
  function b(t) {
@@ -614,19 +614,19 @@ function y(t) {
614
614
  function I(t) {
615
615
  return Math.round(parseFloat(t) * 255).toString(16);
616
616
  }
617
- function F(t) {
617
+ function L(t) {
618
618
  return f(t) / 255;
619
619
  }
620
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*\\)?";
621
+ var t = "[-\\+]?\\d+%?", r = "[-\\+]?\\d*\\.\\d+%?", e = "(?:" + r + ")|(?:" + t + ")", i = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?", a = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?";
622
622
  return {
623
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),
624
+ rgb: new RegExp("rgb" + i),
625
+ rgba: new RegExp("rgba" + a),
626
+ hsl: new RegExp("hsl" + i),
627
+ hsla: new RegExp("hsla" + a),
628
+ hsv: new RegExp("hsv" + i),
629
+ hsva: new RegExp("hsva" + a),
630
630
  hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
631
631
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
632
632
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
@@ -636,8 +636,8 @@ var p = function() {
636
636
  function m(t) {
637
637
  return !!p.CSS_UNIT.exec(t);
638
638
  }
639
- function le(t) {
640
- t = t.replace(O, "").replace(G, "").toLowerCase();
639
+ function ue(t) {
640
+ t = t.replace(O, "").replace($, "").toLowerCase();
641
641
  var r = !1;
642
642
  if (j[t])
643
643
  t = j[t], r = !0;
@@ -681,7 +681,7 @@ function le(t) {
681
681
  r: f(e[1]),
682
682
  g: f(e[2]),
683
683
  b: f(e[3]),
684
- a: F(e[4]),
684
+ a: L(e[4]),
685
685
  format: r ? "name" : "hex8"
686
686
  } : (e = p.hex6.exec(t)) ? {
687
687
  r: f(e[1]),
@@ -692,7 +692,7 @@ function le(t) {
692
692
  r: f(e[1] + "" + e[1]),
693
693
  g: f(e[2] + "" + e[2]),
694
694
  b: f(e[3] + "" + e[3]),
695
- a: F(e[4] + "" + e[4]),
695
+ a: L(e[4] + "" + e[4]),
696
696
  format: r ? "name" : "hex8"
697
697
  } : (e = p.hex3.exec(t)) ? {
698
698
  r: f(e[1] + "" + e[1]),
@@ -701,7 +701,7 @@ function le(t) {
701
701
  format: r ? "name" : "hex"
702
702
  } : !1;
703
703
  }
704
- function ue(t) {
704
+ function de(t) {
705
705
  var r, e;
706
706
  return t = t || {
707
707
  level: "AA",
@@ -711,19 +711,17 @@ function ue(t) {
711
711
  size: e
712
712
  };
713
713
  }
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}
714
+ const ce = `:host{--wj-color-picker-value: #ff0000;--wj-color-picker-size: 1rem;--wj-color-picker-radius: 4px}.anchor{width:var(--wj-color-picker-size);height:var(--wj-color-picker-size);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-border-radius-small);border-width:1px;border-style:var(--wj-border-style);border-color:var(--wj-border-color);background:var(--wj-background)}.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;border-bottom:1px solid var(--wj-border-color)}.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 var(--wj-border-color);--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 var(--wj-border-color);--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
715
  `;
718
- class de extends z {
716
+ class fe extends B {
719
717
  constructor() {
720
718
  super();
721
719
  v(this, "className", "ColorPicker");
722
720
  v(this, "moveMarker", (e) => {
723
- const a = this.getPointerPosition(e);
724
- console.log("colorAreaDimension", this.colorAreaDimension);
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);
721
+ this.colorAreaDimension = this.dimension();
722
+ const i = this.getPointerPosition(e);
723
+ let a = i.pageX - this.colorAreaDimension.x, n = i.pageY - this.colorAreaDimension.y;
724
+ this.setColor(this.setColorAtPosition(a, n), "marker"), this.setMarkerPosition(a, n);
727
725
  });
728
726
  /*
729
727
  * @desc nanstavenie pozicie markera podla farby
@@ -731,27 +729,38 @@ class de extends z {
731
729
  * @returns {{x: number, y: number}}
732
730
  */
733
731
  v(this, "setMarkerPositionByColor", (e = "red") => {
734
- let a = s(e).toHsv();
732
+ let i = s(e).toHsv();
735
733
  return {
736
- x: this.colorAreaDimension.width * a.s,
737
- y: this.colorAreaDimension.height - this.colorAreaDimension.height * a.v
734
+ x: this.colorAreaDimension.width * i.s,
735
+ y: this.colorAreaDimension.height - this.colorAreaDimension.height * i.v
738
736
  };
739
737
  });
740
738
  /*
741
739
  * Set css variable color value
742
740
  */
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") {
741
+ v(this, "setColor", (e = null, i = "") => {
742
+ let a = e;
743
+ if (a === null && i === "" && (a = s(this.input.value), this.colorArea.style.setProperty("--wj-color-picker-area", a.toHexString())), i === "marker" && (this.alphaSlider.value = 100, this.alphaSlider.style.setProperty("--wj-color-picker-value", a.toHexString()), this.colorPreview.style.setProperty("--wj-color-picker-value", a.toHex8String()), this.picker.style.setProperty("--wj-color-picker-value", a.toHexString()), this.marker.style.setProperty("--wj-color-picker-value", a.toHex8String())), i === "hue") {
746
744
  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();
745
+ a = 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", a.toHexString()), this.colorArea.style.setProperty("--wj-color-picker-area", a.toHexString()), this.input.value = n.toHex8String();
748
746
  }
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());
747
+ if (i === "alpha") {
748
+ a = s(this.input.value);
749
+ let n = a.toHsv();
750
+ n.a = this.alphaSlider.value / 100, a = s(n), this.colorPreview.style.setProperty("--wj-color-picker-value", a.toHex8String());
753
751
  }
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());
752
+ i === "swatch" && (this.colorPreview.style.setProperty("--wj-color-picker-value", a.toHex8String()), this.marker.style.setProperty("--wj-color-picker-value", a.toHexString()), this.alphaSlider.style.setProperty("--wj-color-picker-value", a.toHexString()), this.colorArea.style.setProperty("--wj-color-picker-area", a.toHex8String()), this.markerPosition = this.setMarkerPositionByColor(a.toHex8String()), this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y)), this.input.value = a.toHex8String(), this.anchor.style.setProperty("--wj-color-picker-value", a.toHexString()), this.value = {
753
+ hex8: a.toHex8String(),
754
+ hex: a.toHexString(),
755
+ rgb: a.toRgbString(),
756
+ rgba: a.toRgbString(),
757
+ hsl: a.toHslString(),
758
+ hsla: a.toHslString(),
759
+ hsv: a.toHsvString(),
760
+ hsva: a.toHsvString(),
761
+ name: a.toName(),
762
+ format: a.getFormat()
763
+ }, G.dispatchCustomEvent(this, "wj-color-picker:select", this.value);
755
764
  });
756
765
  /*
757
766
  * Set hue sliders
@@ -768,7 +777,7 @@ class de extends z {
768
777
  /*
769
778
  * Get HSVA color order by hue and alpha
770
779
  */
771
- v(this, "getHSVA", (e, a) => `hsva(${e}, 100%, 100%, ${a / 100})`);
780
+ v(this, "getHSVA", (e, i) => `hsva(${e}, 100%, 100%, ${i / 100})`);
772
781
  this._markerPosition = {
773
782
  markerX: "0",
774
783
  markerY: "0"
@@ -807,19 +816,19 @@ class de extends z {
807
816
  setupAttributes() {
808
817
  this.isShadowRoot = "open";
809
818
  }
810
- draw(e, a, i) {
819
+ draw(e, i, a) {
811
820
  let n = document.createDocumentFragment(), o = document.createElement("div");
812
821
  o.classList.add("native-color-picker");
813
822
  let h = document.createElement("div");
814
- h.setAttribute("slot", "anchor"), h.classList.add("anchor");
823
+ h.setAttribute("slot", "anchor"), h.setAttribute("part", "anchor"), h.classList.add("anchor");
815
824
  let l = document.createElement("div");
816
825
  l.classList.add("picker");
817
- let d = document.createElement("div");
818
- d.classList.add("marker");
826
+ let c = document.createElement("div");
827
+ c.classList.add("marker");
819
828
  let g = document.createElement("div");
820
829
  g.classList.add("color-area"), g.addEventListener("click", this.moveMarker);
821
- let c = document.createElement("div");
822
- c.classList.add("wrapper");
830
+ let d = document.createElement("div");
831
+ d.classList.add("wrapper");
823
832
  let x = document.createElement("wj-slider");
824
833
  x.setAttribute("min", "0"), x.setAttribute("max", "360"), x.classList.add("hue"), x.addEventListener("wj:slider-move", this.setHue);
825
834
  let H = document.createElement("div");
@@ -831,42 +840,47 @@ class de extends z {
831
840
  let P = document.createElement("div");
832
841
  P.classList.add("color-preview");
833
842
  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);
843
+ _.classList.add("input"), _.setAttribute("variant", "standard"), _.value = "#ff0000", g.appendChild(c), H.appendChild(w), A.appendChild(P), A.appendChild(_), d.appendChild(x), d.appendChild(H), d.appendChild(A), l.appendChild(g), l.appendChild(d), this.createSwatches(d);
835
844
  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;
845
+ 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 = c, this.colorArea = g, this.hueSlider = x, this.alphaSlider = w, this.colorPreview = P, this.input = _, n;
837
846
  }
838
847
  createSwatches(e) {
839
848
  if (this.swatches.length === 0)
840
849
  return;
841
- let a = document.createElement("div");
842
- a.classList.add("swatches"), this.swatches.forEach((i) => {
850
+ let i = document.createElement("div");
851
+ i.classList.add("swatches"), this.swatches.forEach((a) => {
843
852
  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);
853
+ n.classList.add("swatch"), n.style.setProperty("--wj-color-picker-swatch", a), n.addEventListener("click", (o) => {
854
+ this.setSliders(a), this.setColor(s(a), "swatch");
855
+ }), i.appendChild(n);
856
+ }), e.appendChild(i);
848
857
  }
849
858
  setSliders(e) {
850
- let a = s(e).toHsv();
851
- this.hueSlider.value = a.h, this.alphaSlider.value = a.a * 100;
859
+ let i = s(e).toHsv();
860
+ this.hueSlider.value = i.h, this.alphaSlider.value = i.a * 100;
852
861
  }
853
862
  afterDraw() {
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);
863
+ this.init = !1, this.addEventListener("wj-popup:show", (e) => {
864
+ this.init || (window.setTimeout(() => {
865
+ this.colorAreaDimension = this.dimension(), this.markerPosition = this.setMarkerPositionByColor(this.input.value), this.setMarkerPosition(this.markerPosition.x, this.markerPosition.y), this.input.value != "" && (this.alphaSlider.value = 100), this.setColor();
866
+ }, 0), this.init = !0);
861
867
  });
862
868
  }
869
+ dimension() {
870
+ return {
871
+ width: this.colorArea.offsetWidth,
872
+ height: this.colorArea.offsetHeight,
873
+ x: this.colorArea.offsetLeft,
874
+ y: this.colorArea.offsetTop
875
+ };
876
+ }
863
877
  disconnectedCallback() {
864
878
  this.init = !1;
865
879
  }
866
880
  getPointerPosition(e) {
867
881
  return {
868
- pageX: e.changedTouches ? e.changedTouches[0].pageX : e.pageX,
869
- pageY: e.changedTouches ? e.changedTouches[0].pageY : e.pageY
882
+ pageX: e.changedTouches ? e.changedTouches[0].pageX : e.clientX,
883
+ pageY: e.changedTouches ? e.changedTouches[0].pageY : e.clientY
870
884
  };
871
885
  }
872
886
  /*
@@ -874,11 +888,11 @@ class de extends z {
874
888
  * @param x
875
889
  * @param y
876
890
  */
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 = {
891
+ setMarkerPosition(e, i) {
892
+ e = e < 0 ? 0 : e > this.colorAreaDimension.width ? this.colorAreaDimension.width : e, i = i < 0 ? 0 : i > this.colorAreaDimension.height ? this.colorAreaDimension.height : i, this.markerPosition = {
879
893
  x: e,
880
- y: a
881
- }, this.marker.style.left = `${e}px`, this.marker.style.top = `${a}px`;
894
+ y: i
895
+ }, this.marker.style.left = `${e}px`, this.marker.style.top = `${i}px`;
882
896
  }
883
897
  /*
884
898
  * nastavenie farby podla pozicie markera
@@ -886,18 +900,17 @@ class de extends z {
886
900
  * @param y
887
901
  * @returns {tinycolor}
888
902
  */
889
- setColorAtPosition(e, a, i = 100) {
890
- console.log("x", e, "y", a, "alpha", i);
903
+ setColorAtPosition(e, i, a = 100) {
891
904
  const n = {
892
905
  h: this.hueSlider.value * 1,
893
906
  s: e / this.colorAreaDimension.width * 100,
894
- v: 100 - a / this.colorAreaDimension.height * 100,
895
- a: i / 100
907
+ v: 100 - i / this.colorAreaDimension.height * 100,
908
+ a: a / 100
896
909
  };
897
910
  return s(n);
898
911
  }
899
912
  }
900
- customElements.get("wj-color-picker") || window.customElements.define("wj-color-picker", de);
913
+ customElements.get("wj-color-picker") || window.customElements.define("wj-color-picker", fe);
901
914
  export {
902
- de as ColorPicker
915
+ fe as ColorPicker
903
916
  };