wj-elements 0.1.48 → 0.1.49

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 (98) hide show
  1. package/dist/custom-elements.json +14058 -0
  2. package/dist/dark.css +1 -0
  3. package/dist/light.css +1 -0
  4. package/dist/localize.js +45 -0
  5. package/dist/popup.element-CWsSOxs2.js +1072 -0
  6. package/dist/router-links-FtZbFUto.js +146 -0
  7. package/dist/styles.css +1 -0
  8. package/dist/web-types.json +3122 -0
  9. package/dist/wje-accordion-item.js +88 -0
  10. package/dist/wje-accordion.js +79 -0
  11. package/dist/wje-animation.js +121 -0
  12. package/dist/wje-aside.js +55 -0
  13. package/dist/wje-avatar.js +77 -0
  14. package/dist/wje-badge.js +50 -0
  15. package/dist/wje-breadcrumb.js +148 -0
  16. package/dist/wje-breadcrumbs.js +67 -0
  17. package/dist/wje-button-group.js +78 -0
  18. package/dist/wje-button.js +207 -0
  19. package/dist/wje-card-content.js +48 -0
  20. package/dist/wje-card-controls.js +48 -0
  21. package/dist/wje-card-header.js +47 -0
  22. package/dist/wje-card-subtitle.js +55 -0
  23. package/dist/wje-card-title.js +55 -0
  24. package/dist/wje-card.js +50 -0
  25. package/dist/wje-carousel-item.js +33 -0
  26. package/dist/wje-carousel.js +177 -0
  27. package/dist/wje-checkbox.js +96 -0
  28. package/dist/wje-chip.js +32 -0
  29. package/dist/wje-col.js +27 -0
  30. package/dist/wje-color-picker.js +953 -0
  31. package/dist/wje-container.js +57 -0
  32. package/dist/wje-copy-button.js +170 -0
  33. package/dist/wje-dialog.js +86 -0
  34. package/dist/wje-divider.js +53 -0
  35. package/dist/wje-dropdown.js +114 -0
  36. package/dist/wje-element.js +453 -0
  37. package/dist/wje-fetchAndParseCSS.js +40 -0
  38. package/dist/wje-file-upload-item.js +115 -0
  39. package/dist/wje-file-upload.js +297 -0
  40. package/dist/wje-footer.js +56 -0
  41. package/dist/wje-form.js +28 -0
  42. package/dist/wje-format-digital.js +85 -0
  43. package/dist/wje-grid.js +28 -0
  44. package/dist/wje-header.js +58 -0
  45. package/dist/wje-icon-picker.js +221 -0
  46. package/dist/wje-icon.js +119 -0
  47. package/dist/wje-img-comparer.js +111 -0
  48. package/dist/wje-img.js +58 -0
  49. package/dist/wje-infinite-scroll.js +201 -0
  50. package/dist/wje-inline-edit.js +145 -0
  51. package/dist/wje-input-file.js +85 -0
  52. package/dist/wje-input.js +334 -0
  53. package/dist/wje-item.js +45 -0
  54. package/dist/wje-label.js +67 -0
  55. package/dist/wje-list.js +53 -0
  56. package/dist/wje-main.js +56 -0
  57. package/dist/wje-masonry.js +218 -0
  58. package/dist/wje-master.js +423 -0
  59. package/dist/wje-menu-button.js +65 -0
  60. package/dist/wje-menu-item.js +230 -0
  61. package/dist/wje-menu-label.js +57 -0
  62. package/dist/wje-menu.js +74 -0
  63. package/dist/wje-option.js +99 -0
  64. package/dist/wje-options.js +63 -0
  65. package/dist/wje-popup.js +5 -0
  66. package/dist/wje-progress-bar.js +161 -0
  67. package/dist/wje-qr-code.js +2332 -0
  68. package/dist/wje-radio-group.js +101 -0
  69. package/dist/wje-radio.js +46 -0
  70. package/dist/wje-rate.js +260 -0
  71. package/dist/wje-relative-time.js +85 -0
  72. package/dist/wje-reorder-dropzone.js +27 -0
  73. package/dist/wje-reorder-handle.js +115 -0
  74. package/dist/wje-reorder-item.js +32 -0
  75. package/dist/wje-reorder.js +138 -0
  76. package/dist/wje-route.js +46 -0
  77. package/dist/wje-router-link.js +64 -0
  78. package/dist/wje-router-outlet.js +127 -0
  79. package/dist/wje-routerx.js +1088 -0
  80. package/dist/wje-row.js +58 -0
  81. package/dist/wje-select.js +242 -0
  82. package/dist/wje-slider.js +177 -0
  83. package/dist/wje-sliding-container.js +277 -0
  84. package/dist/wje-split-view.js +112 -0
  85. package/dist/wje-status.js +54 -0
  86. package/dist/wje-store.js +192 -0
  87. package/dist/wje-tab-group.js +107 -0
  88. package/dist/wje-tab-panel.js +52 -0
  89. package/dist/wje-tab.js +59 -0
  90. package/dist/wje-textarea.js +116 -0
  91. package/dist/wje-thumbnail.js +64 -0
  92. package/dist/wje-toast.js +76 -0
  93. package/dist/wje-toggle.js +94 -0
  94. package/dist/wje-toolbar-action.js +63 -0
  95. package/dist/wje-toolbar.js +61 -0
  96. package/dist/wje-tooltip.js +116 -0
  97. package/dist/wje-visually-hidden.js +56 -0
  98. package/package.json +1 -1
@@ -0,0 +1,953 @@
1
+ var z = Object.defineProperty;
2
+ var B = (t, r, e) => r in t ? z(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 D, { event as G } from "./wje-element.js";
5
+ function S(t) {
6
+ "@babel/helpers - typeof";
7
+ return S = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
8
+ return typeof r;
9
+ } : function(r) {
10
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
11
+ }, S(t);
12
+ }
13
+ var O = /^\s+/, $ = /\s+$/;
14
+ function s(t, r) {
15
+ if (t = t || "", r = r || {}, t instanceof s)
16
+ return t;
17
+ if (!(this instanceof s))
18
+ return new s(t, r);
19
+ var e = V(t);
20
+ 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;
21
+ }
22
+ s.prototype = {
23
+ isDark: function() {
24
+ return this.getBrightness() < 128;
25
+ },
26
+ isLight: function() {
27
+ return !this.isDark();
28
+ },
29
+ isValid: function() {
30
+ return this._ok;
31
+ },
32
+ getOriginalInput: function() {
33
+ return this._originalInput;
34
+ },
35
+ getFormat: function() {
36
+ return this._format;
37
+ },
38
+ getAlpha: function() {
39
+ return this._a;
40
+ },
41
+ getBrightness: function() {
42
+ var r = this.toRgb();
43
+ return (r.r * 299 + r.g * 587 + r.b * 114) / 1e3;
44
+ },
45
+ getLuminance: function() {
46
+ var r = this.toRgb(), e, i, a, n, o, h;
47
+ 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;
48
+ },
49
+ setAlpha: function(r) {
50
+ return this._a = I(r), this._roundA = Math.round(100 * this._a) / 100, this;
51
+ },
52
+ toHsv: function() {
53
+ var r = R(this._r, this._g, this._b);
54
+ return {
55
+ h: r.h * 360,
56
+ s: r.s,
57
+ v: r.v,
58
+ a: this._a
59
+ };
60
+ },
61
+ toHsvString: function() {
62
+ 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);
63
+ return this._a == 1 ? "hsv(" + e + ", " + i + "%, " + a + "%)" : "hsva(" + e + ", " + i + "%, " + a + "%, " + this._roundA + ")";
64
+ },
65
+ toHsl: function() {
66
+ var r = C(this._r, this._g, this._b);
67
+ return {
68
+ h: r.h * 360,
69
+ s: r.s,
70
+ l: r.l,
71
+ a: this._a
72
+ };
73
+ },
74
+ toHslString: function() {
75
+ 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);
76
+ return this._a == 1 ? "hsl(" + e + ", " + i + "%, " + a + "%)" : "hsla(" + e + ", " + i + "%, " + a + "%, " + this._roundA + ")";
77
+ },
78
+ toHex: function(r) {
79
+ return E(this._r, this._g, this._b, r);
80
+ },
81
+ toHexString: function(r) {
82
+ return "#" + this.toHex(r);
83
+ },
84
+ toHex8: function(r) {
85
+ return W(this._r, this._g, this._b, this._a, r);
86
+ },
87
+ toHex8String: function(r) {
88
+ return "#" + this.toHex8(r);
89
+ },
90
+ toRgb: function() {
91
+ return {
92
+ r: Math.round(this._r),
93
+ g: Math.round(this._g),
94
+ b: Math.round(this._b),
95
+ a: this._a
96
+ };
97
+ },
98
+ toRgbString: function() {
99
+ 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 + ")";
100
+ },
101
+ toPercentageRgb: function() {
102
+ return {
103
+ r: Math.round(u(this._r, 255) * 100) + "%",
104
+ g: Math.round(u(this._g, 255) * 100) + "%",
105
+ b: Math.round(u(this._b, 255) * 100) + "%",
106
+ a: this._a
107
+ };
108
+ },
109
+ toPercentageRgbString: function() {
110
+ 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 + ")";
111
+ },
112
+ toName: function() {
113
+ return this._a === 0 ? "transparent" : this._a < 1 ? !1 : se[E(this._r, this._g, this._b, !0)] || !1;
114
+ },
115
+ toFilter: function(r) {
116
+ var e = "#" + T(this._r, this._g, this._b, this._a), i = e, a = this._gradientType ? "GradientType = 1, " : "";
117
+ if (r) {
118
+ var n = s(r);
119
+ i = "#" + T(n._r, n._g, n._b, n._a);
120
+ }
121
+ return "progid:DXImageTransform.Microsoft.gradient(" + a + "startColorstr=" + e + ",endColorstr=" + i + ")";
122
+ },
123
+ toString: function(r) {
124
+ var e = !!r;
125
+ r = r || this._format;
126
+ 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");
127
+ 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());
128
+ },
129
+ clone: function() {
130
+ return s(this.toString());
131
+ },
132
+ _applyModification: function(r, e) {
133
+ var i = r.apply(null, [this].concat([].slice.call(e)));
134
+ return this._r = i._r, this._g = i._g, this._b = i._b, this.setAlpha(i._a), this;
135
+ },
136
+ lighten: function() {
137
+ return this._applyModification(K, arguments);
138
+ },
139
+ brighten: function() {
140
+ return this._applyModification(Q, arguments);
141
+ },
142
+ darken: function() {
143
+ return this._applyModification(ee, arguments);
144
+ },
145
+ desaturate: function() {
146
+ return this._applyModification(Y, arguments);
147
+ },
148
+ saturate: function() {
149
+ return this._applyModification(J, arguments);
150
+ },
151
+ greyscale: function() {
152
+ return this._applyModification(Z, arguments);
153
+ },
154
+ spin: function() {
155
+ return this._applyModification(te, arguments);
156
+ },
157
+ _applyCombination: function(r, e) {
158
+ return r.apply(null, [this].concat([].slice.call(e)));
159
+ },
160
+ analogous: function() {
161
+ return this._applyCombination(ae, arguments);
162
+ },
163
+ complement: function() {
164
+ return this._applyCombination(re, arguments);
165
+ },
166
+ monochromatic: function() {
167
+ return this._applyCombination(ne, arguments);
168
+ },
169
+ splitcomplement: function() {
170
+ return this._applyCombination(ie, arguments);
171
+ },
172
+ // Disabled until https://github.com/bgrins/TinyColor/issues/254
173
+ // polyad: function (number) {
174
+ // return this._applyCombination(polyad, [number]);
175
+ // },
176
+ triad: function() {
177
+ return this._applyCombination(F, [3]);
178
+ },
179
+ tetrad: function() {
180
+ return this._applyCombination(F, [4]);
181
+ }
182
+ };
183
+ s.fromRatio = function(t, r) {
184
+ if (S(t) == "object") {
185
+ var e = {};
186
+ for (var i in t)
187
+ t.hasOwnProperty(i) && (i === "a" ? e[i] = t[i] : e[i] = y(t[i]));
188
+ t = e;
189
+ }
190
+ return s(t, r);
191
+ };
192
+ function V(t) {
193
+ var r = {
194
+ r: 0,
195
+ g: 0,
196
+ b: 0
197
+ }, e = 1, i = null, a = null, n = null, o = !1, h = !1;
198
+ 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 = I(e), {
199
+ ok: o,
200
+ format: t.format || h,
201
+ r: Math.min(255, Math.max(r.r, 0)),
202
+ g: Math.min(255, Math.max(r.g, 0)),
203
+ b: Math.min(255, Math.max(r.b, 0)),
204
+ a: e
205
+ };
206
+ }
207
+ function q(t, r, e) {
208
+ return {
209
+ r: u(t, 255) * 255,
210
+ g: u(r, 255) * 255,
211
+ b: u(e, 255) * 255
212
+ };
213
+ }
214
+ function C(t, r, e) {
215
+ t = u(t, 255), r = u(r, 255), e = u(e, 255);
216
+ var i = Math.max(t, r, e), a = Math.min(t, r, e), n, o, h = (i + a) / 2;
217
+ if (i == a)
218
+ n = o = 0;
219
+ else {
220
+ var l = i - a;
221
+ switch (o = h > 0.5 ? l / (2 - i - a) : l / (i + a), i) {
222
+ case t:
223
+ n = (r - e) / l + (r < e ? 6 : 0);
224
+ break;
225
+ case r:
226
+ n = (e - t) / l + 2;
227
+ break;
228
+ case e:
229
+ n = (t - r) / l + 4;
230
+ break;
231
+ }
232
+ n /= 6;
233
+ }
234
+ return {
235
+ h: n,
236
+ s: o,
237
+ l: h
238
+ };
239
+ }
240
+ function U(t, r, e) {
241
+ var i, a, n;
242
+ t = u(t, 360), r = u(r, 100), e = u(e, 100);
243
+ function o(c, p, d) {
244
+ return d < 0 && (d += 1), d > 1 && (d -= 1), d < 1 / 6 ? c + (p - c) * 6 * d : d < 1 / 2 ? p : d < 2 / 3 ? c + (p - c) * (2 / 3 - d) * 6 : c;
245
+ }
246
+ if (r === 0)
247
+ i = a = n = e;
248
+ else {
249
+ var h = e < 0.5 ? e * (1 + r) : e + r - e * r, l = 2 * e - h;
250
+ i = o(l, h, t + 1 / 3), a = o(l, h, t), n = o(l, h, t - 1 / 3);
251
+ }
252
+ return {
253
+ r: i * 255,
254
+ g: a * 255,
255
+ b: n * 255
256
+ };
257
+ }
258
+ function R(t, r, e) {
259
+ t = u(t, 255), r = u(r, 255), e = u(e, 255);
260
+ var i = Math.max(t, r, e), a = Math.min(t, r, e), n, o, h = i, l = i - a;
261
+ if (o = i === 0 ? 0 : l / i, i == a)
262
+ n = 0;
263
+ else {
264
+ switch (i) {
265
+ case t:
266
+ n = (r - e) / l + (r < e ? 6 : 0);
267
+ break;
268
+ case r:
269
+ n = (e - t) / l + 2;
270
+ break;
271
+ case e:
272
+ n = (t - r) / l + 4;
273
+ break;
274
+ }
275
+ n /= 6;
276
+ }
277
+ return {
278
+ h: n,
279
+ s: o,
280
+ v: h
281
+ };
282
+ }
283
+ function X(t, r, e) {
284
+ t = u(t, 360) * 6, r = u(r, 100), e = u(e, 100);
285
+ 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], p = [h, e, e, o, n, n][l], d = [n, n, h, e, e, o][l];
286
+ return {
287
+ r: c * 255,
288
+ g: p * 255,
289
+ b: d * 255
290
+ };
291
+ }
292
+ function E(t, r, e, i) {
293
+ var a = [b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16))];
294
+ 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("");
295
+ }
296
+ function W(t, r, e, i, a) {
297
+ var n = [b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16)), b(N(i))];
298
+ 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("");
299
+ }
300
+ function T(t, r, e, i) {
301
+ var a = [b(N(i)), b(Math.round(t).toString(16)), b(Math.round(r).toString(16)), b(Math.round(e).toString(16))];
302
+ return a.join("");
303
+ }
304
+ s.equals = function(t, r) {
305
+ return !t || !r ? !1 : s(t).toRgbString() == s(r).toRgbString();
306
+ };
307
+ s.random = function() {
308
+ return s.fromRatio({
309
+ r: Math.random(),
310
+ g: Math.random(),
311
+ b: Math.random()
312
+ });
313
+ };
314
+ function Y(t, r) {
315
+ r = r === 0 ? 0 : r || 10;
316
+ var e = s(t).toHsl();
317
+ return e.s -= r / 100, e.s = M(e.s), s(e);
318
+ }
319
+ function J(t, r) {
320
+ r = r === 0 ? 0 : r || 10;
321
+ var e = s(t).toHsl();
322
+ return e.s += r / 100, e.s = M(e.s), s(e);
323
+ }
324
+ function Z(t) {
325
+ return s(t).desaturate(100);
326
+ }
327
+ function K(t, r) {
328
+ r = r === 0 ? 0 : r || 10;
329
+ var e = s(t).toHsl();
330
+ return e.l += r / 100, e.l = M(e.l), s(e);
331
+ }
332
+ function Q(t, r) {
333
+ r = r === 0 ? 0 : r || 10;
334
+ var e = s(t).toRgb();
335
+ 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);
336
+ }
337
+ function ee(t, r) {
338
+ r = r === 0 ? 0 : r || 10;
339
+ var e = s(t).toHsl();
340
+ return e.l -= r / 100, e.l = M(e.l), s(e);
341
+ }
342
+ function te(t, r) {
343
+ var e = s(t).toHsl(), i = (e.h + r) % 360;
344
+ return e.h = i < 0 ? 360 + i : i, s(e);
345
+ }
346
+ function re(t) {
347
+ var r = s(t).toHsl();
348
+ return r.h = (r.h + 180) % 360, s(r);
349
+ }
350
+ function F(t, r) {
351
+ if (isNaN(r) || r <= 0)
352
+ throw new Error("Argument to polyad must be a positive number");
353
+ for (var e = s(t).toHsl(), i = [s(t)], a = 360 / r, n = 1; n < r; n++)
354
+ i.push(s({
355
+ h: (e.h + n * a) % 360,
356
+ s: e.s,
357
+ l: e.l
358
+ }));
359
+ return i;
360
+ }
361
+ function ie(t) {
362
+ var r = s(t).toHsl(), e = r.h;
363
+ return [s(t), s({
364
+ h: (e + 72) % 360,
365
+ s: r.s,
366
+ l: r.l
367
+ }), s({
368
+ h: (e + 216) % 360,
369
+ s: r.s,
370
+ l: r.l
371
+ })];
372
+ }
373
+ function ae(t, r, e) {
374
+ r = r || 6, e = e || 30;
375
+ var i = s(t).toHsl(), a = 360 / e, n = [s(t)];
376
+ for (i.h = (i.h - (a * r >> 1) + 720) % 360; --r; )
377
+ i.h = (i.h + a) % 360, n.push(s(i));
378
+ return n;
379
+ }
380
+ function ne(t, r) {
381
+ r = r || 6;
382
+ for (var e = s(t).toHsv(), i = e.h, a = e.s, n = e.v, o = [], h = 1 / r; r--; )
383
+ o.push(s({
384
+ h: i,
385
+ s: a,
386
+ v: n
387
+ })), n = (n + h) % 1;
388
+ return o;
389
+ }
390
+ s.mix = function(t, r, e) {
391
+ e = e === 0 ? 0 : e || 50;
392
+ var i = s(t).toRgb(), a = s(r).toRgb(), n = e / 100, o = {
393
+ r: (a.r - i.r) * n + i.r,
394
+ g: (a.g - i.g) * n + i.g,
395
+ b: (a.b - i.b) * n + i.b,
396
+ a: (a.a - i.a) * n + i.a
397
+ };
398
+ return s(o);
399
+ };
400
+ s.readability = function(t, r) {
401
+ var e = s(t), i = s(r);
402
+ return (Math.max(e.getLuminance(), i.getLuminance()) + 0.05) / (Math.min(e.getLuminance(), i.getLuminance()) + 0.05);
403
+ };
404
+ s.isReadable = function(t, r, e) {
405
+ var i = s.readability(t, r), a, n;
406
+ switch (n = !1, a = de(e), a.level + a.size) {
407
+ case "AAsmall":
408
+ case "AAAlarge":
409
+ n = i >= 4.5;
410
+ break;
411
+ case "AAlarge":
412
+ n = i >= 3;
413
+ break;
414
+ case "AAAsmall":
415
+ n = i >= 7;
416
+ break;
417
+ }
418
+ return n;
419
+ };
420
+ s.mostReadable = function(t, r, e) {
421
+ var i = null, a = 0, n, o, h, l;
422
+ e = e || {}, o = e.includeFallbackColors, h = e.level, l = e.size;
423
+ for (var c = 0; c < r.length; c++)
424
+ n = s.readability(t, r[c]), n > a && (a = n, i = s(r[c]));
425
+ return s.isReadable(t, i, {
426
+ level: h,
427
+ size: l
428
+ }) || !o ? i : (e.includeFallbackColors = !1, s.mostReadable(t, ["#fff", "#000"], e));
429
+ };
430
+ var j = s.names = {
431
+ aliceblue: "f0f8ff",
432
+ antiquewhite: "faebd7",
433
+ aqua: "0ff",
434
+ aquamarine: "7fffd4",
435
+ azure: "f0ffff",
436
+ beige: "f5f5dc",
437
+ bisque: "ffe4c4",
438
+ black: "000",
439
+ blanchedalmond: "ffebcd",
440
+ blue: "00f",
441
+ blueviolet: "8a2be2",
442
+ brown: "a52a2a",
443
+ burlywood: "deb887",
444
+ burntsienna: "ea7e5d",
445
+ cadetblue: "5f9ea0",
446
+ chartreuse: "7fff00",
447
+ chocolate: "d2691e",
448
+ coral: "ff7f50",
449
+ cornflowerblue: "6495ed",
450
+ cornsilk: "fff8dc",
451
+ crimson: "dc143c",
452
+ cyan: "0ff",
453
+ darkblue: "00008b",
454
+ darkcyan: "008b8b",
455
+ darkgoldenrod: "b8860b",
456
+ darkgray: "a9a9a9",
457
+ darkgreen: "006400",
458
+ darkgrey: "a9a9a9",
459
+ darkkhaki: "bdb76b",
460
+ darkmagenta: "8b008b",
461
+ darkolivegreen: "556b2f",
462
+ darkorange: "ff8c00",
463
+ darkorchid: "9932cc",
464
+ darkred: "8b0000",
465
+ darksalmon: "e9967a",
466
+ darkseagreen: "8fbc8f",
467
+ darkslateblue: "483d8b",
468
+ darkslategray: "2f4f4f",
469
+ darkslategrey: "2f4f4f",
470
+ darkturquoise: "00ced1",
471
+ darkviolet: "9400d3",
472
+ deeppink: "ff1493",
473
+ deepskyblue: "00bfff",
474
+ dimgray: "696969",
475
+ dimgrey: "696969",
476
+ dodgerblue: "1e90ff",
477
+ firebrick: "b22222",
478
+ floralwhite: "fffaf0",
479
+ forestgreen: "228b22",
480
+ fuchsia: "f0f",
481
+ gainsboro: "dcdcdc",
482
+ ghostwhite: "f8f8ff",
483
+ gold: "ffd700",
484
+ goldenrod: "daa520",
485
+ gray: "808080",
486
+ green: "008000",
487
+ greenyellow: "adff2f",
488
+ grey: "808080",
489
+ honeydew: "f0fff0",
490
+ hotpink: "ff69b4",
491
+ indianred: "cd5c5c",
492
+ indigo: "4b0082",
493
+ ivory: "fffff0",
494
+ khaki: "f0e68c",
495
+ lavender: "e6e6fa",
496
+ lavenderblush: "fff0f5",
497
+ lawngreen: "7cfc00",
498
+ lemonchiffon: "fffacd",
499
+ lightblue: "add8e6",
500
+ lightcoral: "f08080",
501
+ lightcyan: "e0ffff",
502
+ lightgoldenrodyellow: "fafad2",
503
+ lightgray: "d3d3d3",
504
+ lightgreen: "90ee90",
505
+ lightgrey: "d3d3d3",
506
+ lightpink: "ffb6c1",
507
+ lightsalmon: "ffa07a",
508
+ lightseagreen: "20b2aa",
509
+ lightskyblue: "87cefa",
510
+ lightslategray: "789",
511
+ lightslategrey: "789",
512
+ lightsteelblue: "b0c4de",
513
+ lightyellow: "ffffe0",
514
+ lime: "0f0",
515
+ limegreen: "32cd32",
516
+ linen: "faf0e6",
517
+ magenta: "f0f",
518
+ maroon: "800000",
519
+ mediumaquamarine: "66cdaa",
520
+ mediumblue: "0000cd",
521
+ mediumorchid: "ba55d3",
522
+ mediumpurple: "9370db",
523
+ mediumseagreen: "3cb371",
524
+ mediumslateblue: "7b68ee",
525
+ mediumspringgreen: "00fa9a",
526
+ mediumturquoise: "48d1cc",
527
+ mediumvioletred: "c71585",
528
+ midnightblue: "191970",
529
+ mintcream: "f5fffa",
530
+ mistyrose: "ffe4e1",
531
+ moccasin: "ffe4b5",
532
+ navajowhite: "ffdead",
533
+ navy: "000080",
534
+ oldlace: "fdf5e6",
535
+ olive: "808000",
536
+ olivedrab: "6b8e23",
537
+ orange: "ffa500",
538
+ orangered: "ff4500",
539
+ orchid: "da70d6",
540
+ palegoldenrod: "eee8aa",
541
+ palegreen: "98fb98",
542
+ paleturquoise: "afeeee",
543
+ palevioletred: "db7093",
544
+ papayawhip: "ffefd5",
545
+ peachpuff: "ffdab9",
546
+ peru: "cd853f",
547
+ pink: "ffc0cb",
548
+ plum: "dda0dd",
549
+ powderblue: "b0e0e6",
550
+ purple: "800080",
551
+ rebeccapurple: "663399",
552
+ red: "f00",
553
+ rosybrown: "bc8f8f",
554
+ royalblue: "4169e1",
555
+ saddlebrown: "8b4513",
556
+ salmon: "fa8072",
557
+ sandybrown: "f4a460",
558
+ seagreen: "2e8b57",
559
+ seashell: "fff5ee",
560
+ sienna: "a0522d",
561
+ silver: "c0c0c0",
562
+ skyblue: "87ceeb",
563
+ slateblue: "6a5acd",
564
+ slategray: "708090",
565
+ slategrey: "708090",
566
+ snow: "fffafa",
567
+ springgreen: "00ff7f",
568
+ steelblue: "4682b4",
569
+ tan: "d2b48c",
570
+ teal: "008080",
571
+ thistle: "d8bfd8",
572
+ tomato: "ff6347",
573
+ turquoise: "40e0d0",
574
+ violet: "ee82ee",
575
+ wheat: "f5deb3",
576
+ white: "fff",
577
+ whitesmoke: "f5f5f5",
578
+ yellow: "ff0",
579
+ yellowgreen: "9acd32"
580
+ }, se = s.hexNames = oe(j);
581
+ function oe(t) {
582
+ var r = {};
583
+ for (var e in t)
584
+ t.hasOwnProperty(e) && (r[t[e]] = e);
585
+ return r;
586
+ }
587
+ function I(t) {
588
+ return t = parseFloat(t), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
589
+ }
590
+ function u(t, r) {
591
+ he(t) && (t = "100%");
592
+ var e = le(t);
593
+ 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);
594
+ }
595
+ function M(t) {
596
+ return Math.min(1, Math.max(0, t));
597
+ }
598
+ function f(t) {
599
+ return parseInt(t, 16);
600
+ }
601
+ function he(t) {
602
+ return typeof t == "string" && t.indexOf(".") != -1 && parseFloat(t) === 1;
603
+ }
604
+ function le(t) {
605
+ return typeof t == "string" && t.indexOf("%") != -1;
606
+ }
607
+ function b(t) {
608
+ return t.length == 1 ? "0" + t : "" + t;
609
+ }
610
+ function y(t) {
611
+ return t <= 1 && (t = t * 100 + "%"), t;
612
+ }
613
+ function N(t) {
614
+ return Math.round(parseFloat(t) * 255).toString(16);
615
+ }
616
+ function L(t) {
617
+ return f(t) / 255;
618
+ }
619
+ var g = function() {
620
+ 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*\\)?";
621
+ return {
622
+ CSS_UNIT: new RegExp(e),
623
+ rgb: new RegExp("rgb" + i),
624
+ rgba: new RegExp("rgba" + a),
625
+ hsl: new RegExp("hsl" + i),
626
+ hsla: new RegExp("hsla" + a),
627
+ hsv: new RegExp("hsv" + i),
628
+ hsva: new RegExp("hsva" + a),
629
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
630
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
631
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
632
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
633
+ };
634
+ }();
635
+ function m(t) {
636
+ return !!g.CSS_UNIT.exec(t);
637
+ }
638
+ function ue(t) {
639
+ t = t.replace(O, "").replace($, "").toLowerCase();
640
+ var r = !1;
641
+ if (j[t])
642
+ t = j[t], r = !0;
643
+ else if (t == "transparent")
644
+ return {
645
+ r: 0,
646
+ g: 0,
647
+ b: 0,
648
+ a: 0,
649
+ format: "name"
650
+ };
651
+ var e;
652
+ return (e = g.rgb.exec(t)) ? {
653
+ r: e[1],
654
+ g: e[2],
655
+ b: e[3]
656
+ } : (e = g.rgba.exec(t)) ? {
657
+ r: e[1],
658
+ g: e[2],
659
+ b: e[3],
660
+ a: e[4]
661
+ } : (e = g.hsl.exec(t)) ? {
662
+ h: e[1],
663
+ s: e[2],
664
+ l: e[3]
665
+ } : (e = g.hsla.exec(t)) ? {
666
+ h: e[1],
667
+ s: e[2],
668
+ l: e[3],
669
+ a: e[4]
670
+ } : (e = g.hsv.exec(t)) ? {
671
+ h: e[1],
672
+ s: e[2],
673
+ v: e[3]
674
+ } : (e = g.hsva.exec(t)) ? {
675
+ h: e[1],
676
+ s: e[2],
677
+ v: e[3],
678
+ a: e[4]
679
+ } : (e = g.hex8.exec(t)) ? {
680
+ r: f(e[1]),
681
+ g: f(e[2]),
682
+ b: f(e[3]),
683
+ a: L(e[4]),
684
+ format: r ? "name" : "hex8"
685
+ } : (e = g.hex6.exec(t)) ? {
686
+ r: f(e[1]),
687
+ g: f(e[2]),
688
+ b: f(e[3]),
689
+ format: r ? "name" : "hex"
690
+ } : (e = g.hex4.exec(t)) ? {
691
+ r: f(e[1] + "" + e[1]),
692
+ g: f(e[2] + "" + e[2]),
693
+ b: f(e[3] + "" + e[3]),
694
+ a: L(e[4] + "" + e[4]),
695
+ format: r ? "name" : "hex8"
696
+ } : (e = g.hex3.exec(t)) ? {
697
+ r: f(e[1] + "" + e[1]),
698
+ g: f(e[2] + "" + e[2]),
699
+ b: f(e[3] + "" + e[3]),
700
+ format: r ? "name" : "hex"
701
+ } : !1;
702
+ }
703
+ function de(t) {
704
+ var r, e;
705
+ return t = t || {
706
+ level: "AA",
707
+ size: "small"
708
+ }, r = (t.level || "AA").toUpperCase(), e = (t.size || "small").toLowerCase(), r !== "AA" && r !== "AAA" && (r = "AA"), e !== "small" && e !== "large" && (e = "small"), {
709
+ level: r,
710
+ size: e
711
+ };
712
+ }
713
+ const ce = ':host{--wje-color-picker-value: #ff0000;--wje-color-picker-size: 1rem;--wje-color-picker-radius: 4px}.anchor{width:var(--wje-color-picker-size);height:var(--wje-color-picker-size);background:var(--wje-color-picker-value)}.picker{width:200px;min-height:90px;box-shadow:0 0 5px #0000000d,0 5px 20px #0000001a;border-radius:var(--wje-border-radius-small);border-width:1px;border-style:var(--wje-border-style);border-color:var(--wje-border-color);background:var(--wje-background)}.color-area{display:block;position:relative;height:100px;color:var(--wje-color-picker-area);background-image:linear-gradient(#0000,#000),linear-gradient(90deg,#fff,currentColor);cursor:crosshair;border-radius:var(--wje-color-picker-radius) var(--wje-color-picker-radius) 0 0;border-bottom:1px solid var(--wje-border-color)}.wrapper{display:inline-table;width:calc(100% - 2rem);margin:1rem}.hue{border-radius:.25rem;background-image:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red);width:100%;height:8px;margin:.75rem 0 1rem}.hue::part(slider){--wje-slider-color: transparent;--wje-slider-thumb-color: white;--wje-slider-thumb-shadow: 0 0 0 1px var(--wje-border-color);--wje-slider-thumb-shadow-active: var(--wje-slider-thumb-shadow);--wje-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(--wje-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){--wje-slider-color: transparent;--wje-slider-thumb-color: white;--wje-slider-thumb-shadow: 0 0 0 1px var(--wje-border-color);--wje-slider-thumb-shadow-active: var(--wje-slider-thumb-shadow);--wje-slider-track-color: transparent;--wje-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(--wje-color-picker-value)}wje-input{--wje-input-border-radius: 1rem;--wje-input-margin-bottom: 0}wje-input::part(input){text-align:center}.swatches{margin-top:1rem;display:flex;justify-content:center;flex-wrap:wrap}.swatch{background:var(--wje-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(--wje-color-picker-value);cursor:pointer}';
714
+ class fe extends D {
715
+ /**
716
+ * ColorPicker constructor.
717
+ */
718
+ constructor() {
719
+ super();
720
+ v(this, "className", "ColorPicker");
721
+ v(this, "moveMarker", (e) => {
722
+ this.colorAreaDimension = this.dimension();
723
+ const i = this.getPointerPosition(e);
724
+ let a = i.pageX - this.colorAreaDimension.x, n = i.pageY - this.colorAreaDimension.y;
725
+ this.setColor(this.setColorAtPosition(a, n), "marker"), this.setMarkerPosition(a, n);
726
+ });
727
+ /*
728
+ * @desc nanstavenie pozicie markera podla farby
729
+ * @param color
730
+ * @returns {{x: number, y: number}}
731
+ */
732
+ v(this, "setMarkerPositionByColor", (e = "red") => {
733
+ let i = s(e).toHsv();
734
+ return {
735
+ x: this.colorAreaDimension.width * i.s,
736
+ y: this.colorAreaDimension.height - this.colorAreaDimension.height * i.v
737
+ };
738
+ });
739
+ /*
740
+ * Set css variable color value
741
+ */
742
+ v(this, "setColor", (e = null, i = "") => {
743
+ let a = e;
744
+ if (a === null && i === "" && (a = s(this.input.value), this.colorArea.style.setProperty("--wje-color-picker-area", a.toHexString())), i === "marker" && (this.alphaSlider.value = 100, this.alphaSlider.style.setProperty("--wje-color-picker-value", a.toHexString()), this.colorPreview.style.setProperty("--wje-color-picker-value", a.toHex8String()), this.picker.style.setProperty("--wje-color-picker-value", a.toHexString()), this.marker.style.setProperty("--wje-color-picker-value", a.toHex8String())), i === "hue") {
745
+ let n = this.setColorAtPosition(this.markerPosition.x, this.markerPosition.y, this.alphaSlider.value);
746
+ a = s(this.getHSVA(this.hueSlider.value, this.alphaSlider.value)), this.colorPreview.style.setProperty("--wje-color-picker-value", n.toHex8String()), this.marker.style.setProperty("--wje-color-picker-value", n.toHexString()), this.alphaSlider.style.setProperty("--wje-color-picker-value", a.toHexString()), this.colorArea.style.setProperty("--wje-color-picker-area", a.toHexString()), this.input.value = n.toHex8String();
747
+ }
748
+ if (i === "alpha") {
749
+ a = s(this.input.value);
750
+ let n = a.toHsv();
751
+ n.a = this.alphaSlider.value / 100, a = s(n), this.colorPreview.style.setProperty("--wje-color-picker-value", a.toHex8String());
752
+ }
753
+ i === "swatch" && (this.colorPreview.style.setProperty("--wje-color-picker-value", a.toHex8String()), this.marker.style.setProperty("--wje-color-picker-value", a.toHexString()), this.alphaSlider.style.setProperty("--wje-color-picker-value", a.toHexString()), this.colorArea.style.setProperty("--wje-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("--wje-color-picker-value", a.toHexString()), this.value = {
754
+ hex8: a.toHex8String(),
755
+ hex: a.toHexString(),
756
+ rgb: a.toRgbString(),
757
+ rgba: a.toRgbString(),
758
+ hsl: a.toHslString(),
759
+ hsla: a.toHslString(),
760
+ hsv: a.toHsvString(),
761
+ hsva: a.toHsvString(),
762
+ name: a.toName(),
763
+ format: a.getFormat()
764
+ }, G.dispatchCustomEvent(this, "wje-color-picker:select", this.value);
765
+ });
766
+ /*
767
+ * Set hue sliders
768
+ */
769
+ v(this, "setHue", (e) => {
770
+ this.hueSlider.value = e.detail.value, this.setColor(null, "hue");
771
+ });
772
+ /*
773
+ * Set alpha sliders
774
+ */
775
+ v(this, "setAlpha", (e) => {
776
+ this.alphaSlider.value = e.detail.value, this.setColor(null, "alpha");
777
+ });
778
+ /*
779
+ * Get HSVA color order by hue and alpha
780
+ */
781
+ v(this, "getHSVA", (e, i) => `hsva(${e}, 100%, 100%, ${i / 100})`);
782
+ this._markerPosition = {
783
+ markerX: "0",
784
+ markerY: "0"
785
+ }, this._swatches = [
786
+ "#264653",
787
+ "#2a9d8f",
788
+ "#e9c46a",
789
+ "rgb(244,162,97)",
790
+ "#e76f51",
791
+ "#d62828",
792
+ "navy",
793
+ "#07b",
794
+ "#0096c7",
795
+ "#00b4d880",
796
+ "rgba(0,119,182,0.8)"
797
+ ];
798
+ }
799
+ /**
800
+ * Setter for the marker position.
801
+ * @param {Object} value - The new marker position.
802
+ */
803
+ set markerPosition(e) {
804
+ this._markerPosition = e;
805
+ }
806
+ /**
807
+ * Getter for the marker position.
808
+ * @returns {Object} The current marker position.
809
+ */
810
+ get markerPosition() {
811
+ return this._markerPosition;
812
+ }
813
+ /**
814
+ * Setter for the color swatches.
815
+ * @param {string} value - The new color swatches.
816
+ */
817
+ set swatches(e) {
818
+ this.setAttribute("swatches", e.split(","));
819
+ }
820
+ /**
821
+ * Getter for the color swatches.
822
+ * @returns {Array} The current color swatches.
823
+ */
824
+ get swatches() {
825
+ return this._swatches;
826
+ }
827
+ /**
828
+ * Getter for the CSS stylesheet.
829
+ * @returns {Object} The styles object.
830
+ * @static
831
+ */
832
+ static get cssStyleSheet() {
833
+ return ce;
834
+ }
835
+ /**
836
+ * Getter for the observed attributes.
837
+ * @returns {Array} An empty array.
838
+ * @static
839
+ */
840
+ static get observedAttributes() {
841
+ return [];
842
+ }
843
+ /**
844
+ * Sets up the attributes for the ColorPicker.
845
+ */
846
+ setupAttributes() {
847
+ this.isShadowRoot = "open";
848
+ }
849
+ /**
850
+ * Draws the ColorPicker.
851
+ * @param {Object} context - The context to draw in.
852
+ * @param {Object} store - The store to use.
853
+ * @param {Object} params - The parameters to use.
854
+ * @returns {DocumentFragment} The created document fragment.
855
+ */
856
+ draw(e, i, a) {
857
+ let n = document.createDocumentFragment(), o = document.createElement("div");
858
+ o.classList.add("native-color-picker");
859
+ let h = document.createElement("div");
860
+ h.setAttribute("slot", "anchor"), h.setAttribute("part", "anchor"), h.classList.add("anchor");
861
+ let l = document.createElement("div");
862
+ l.classList.add("picker");
863
+ let c = document.createElement("div");
864
+ c.classList.add("marker");
865
+ let p = document.createElement("div");
866
+ p.classList.add("color-area"), p.addEventListener("click", this.moveMarker);
867
+ let d = document.createElement("div");
868
+ d.classList.add("wrapper");
869
+ let x = document.createElement("wje-slider");
870
+ x.setAttribute("min", "0"), x.setAttribute("max", "360"), x.classList.add("hue"), x.addEventListener("wje:slider-move", this.setHue);
871
+ let H = document.createElement("div");
872
+ H.classList.add("alpha-wrapper");
873
+ let w = document.createElement("wje-slider");
874
+ w.setAttribute("min", "0"), w.setAttribute("max", "100"), w.setAttribute("value", "50"), w.classList.add("alpha"), w.addEventListener("wje:slider-move", this.setAlpha);
875
+ let A = document.createElement("div");
876
+ A.classList.add("input-wrapper");
877
+ let P = document.createElement("div");
878
+ P.classList.add("color-preview");
879
+ let _ = document.createElement("wje-input");
880
+ _.classList.add("input"), _.setAttribute("variant", "standard"), _.value = "#ff0000", p.appendChild(c), H.appendChild(w), A.appendChild(P), A.appendChild(_), d.appendChild(x), d.appendChild(H), d.appendChild(A), l.appendChild(p), l.appendChild(d), this.createSwatches(d);
881
+ let k = document.createElement("wje-popup");
882
+ 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 = p, this.hueSlider = x, this.alphaSlider = w, this.colorPreview = P, this.input = _, n;
883
+ }
884
+ createSwatches(e) {
885
+ if (this.swatches.length === 0)
886
+ return;
887
+ let i = document.createElement("div");
888
+ i.classList.add("swatches"), this.swatches.forEach((a) => {
889
+ let n = document.createElement("button");
890
+ n.classList.add("swatch"), n.style.setProperty("--wje-color-picker-swatch", a), n.addEventListener("click", (o) => {
891
+ this.setSliders(a), this.setColor(s(a), "swatch");
892
+ }), i.appendChild(n);
893
+ }), e.appendChild(i);
894
+ }
895
+ setSliders(e) {
896
+ let i = s(e).toHsv();
897
+ this.hueSlider.value = i.h, this.alphaSlider.value = i.a * 100;
898
+ }
899
+ afterDraw() {
900
+ this.init = !1, this.addEventListener("wje-popup:show", (e) => {
901
+ this.init || (window.setTimeout(() => {
902
+ 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();
903
+ }, 0), this.init = !0);
904
+ });
905
+ }
906
+ dimension() {
907
+ return {
908
+ width: this.colorArea.offsetWidth,
909
+ height: this.colorArea.offsetHeight,
910
+ x: this.colorArea.offsetLeft,
911
+ y: this.colorArea.offsetTop
912
+ };
913
+ }
914
+ disconnectedCallback() {
915
+ this.init = !1;
916
+ }
917
+ getPointerPosition(e) {
918
+ return {
919
+ pageX: e.changedTouches ? e.changedTouches[0].pageX : e.clientX,
920
+ pageY: e.changedTouches ? e.changedTouches[0].pageY : e.clientY
921
+ };
922
+ }
923
+ /*
924
+ * Nastavi poziu markera
925
+ * @param x
926
+ * @param y
927
+ */
928
+ setMarkerPosition(e, i) {
929
+ 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 = {
930
+ x: e,
931
+ y: i
932
+ }, this.marker.style.left = `${e}px`, this.marker.style.top = `${i}px`;
933
+ }
934
+ /*
935
+ * nastavenie farby podla pozicie markera
936
+ * @param x
937
+ * @param y
938
+ * @returns {tinycolor}
939
+ */
940
+ setColorAtPosition(e, i, a = 100) {
941
+ const n = {
942
+ h: this.hueSlider.value * 1,
943
+ s: e / this.colorAreaDimension.width * 100,
944
+ v: 100 - i / this.colorAreaDimension.height * 100,
945
+ a: a / 100
946
+ };
947
+ return s(n);
948
+ }
949
+ }
950
+ D.define("wje-color-picker", fe);
951
+ export {
952
+ fe as default
953
+ };