sun-select-color 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/customPalette.png +0 -0
- package/dist/style.css +1 -1
- package/dist/sun-select-color.es.js +1386 -69
- package/dist/sun-select-color.es.js.map +1 -1
- package/dist/sun-select-color.umd.js +4 -2
- package/dist/sun-select-color.umd.js.map +1 -1
- package/package.json +6 -2
- package/public/customPalette.png +0 -0
|
@@ -1,5 +1,1288 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { createElementBlock as f, openBlock as p, normalizeStyle as x, resolveComponent as D, createElementVNode as h, createVNode as C, withDirectives as fe, vModelText as pe, toDisplayString as K, normalizeClass as le, createCommentVNode as S, Fragment as Z, renderList as he, ref as V, computed as T, watch as R, onMounted as te, onBeforeUnmount as ge, withModifiers as P, unref as re, nextTick as ve } from "vue";
|
|
2
|
+
const Fe = "";
|
|
3
|
+
function B(e, t) {
|
|
4
|
+
t === void 0 && (t = {});
|
|
5
|
+
var r = t.insertAt;
|
|
6
|
+
if (!(!e || typeof document > "u")) {
|
|
7
|
+
var n = document.head || document.getElementsByTagName("head")[0], i = document.createElement("style");
|
|
8
|
+
i.type = "text/css", r === "top" && n.firstChild ? n.insertBefore(i, n.firstChild) : n.appendChild(i), i.styleSheet ? i.styleSheet.cssText = e : i.appendChild(document.createTextNode(e));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const _ = function(e, t) {
|
|
12
|
+
const { componentPrefix: r = Fe } = t || {};
|
|
13
|
+
e.component(`${r}${this.name}`, this);
|
|
14
|
+
}, W = {};
|
|
15
|
+
var H = {
|
|
16
|
+
name: "Checkboard",
|
|
17
|
+
props: {
|
|
18
|
+
size: {
|
|
19
|
+
type: [Number, String],
|
|
20
|
+
default: 8
|
|
21
|
+
},
|
|
22
|
+
white: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "#fff"
|
|
25
|
+
},
|
|
26
|
+
grey: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "#e6e6e6"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
computed: {
|
|
32
|
+
bgStyle() {
|
|
33
|
+
return {
|
|
34
|
+
"background-image": `url(${me(this.white, this.grey, this.size)})`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function be(e, t, r) {
|
|
40
|
+
if (typeof document > "u")
|
|
41
|
+
return null;
|
|
42
|
+
const n = document.createElement("canvas");
|
|
43
|
+
n.width = n.height = r * 2;
|
|
44
|
+
const i = n.getContext("2d");
|
|
45
|
+
return i ? (i.fillStyle = e, i.fillRect(0, 0, n.width, n.height), i.fillStyle = t, i.fillRect(0, 0, r, r), i.translate(r, r), i.fillRect(0, 0, r, r), n.toDataURL()) : null;
|
|
46
|
+
}
|
|
47
|
+
function me(e, t, r) {
|
|
48
|
+
const n = `${e},${t},${r}`;
|
|
49
|
+
if (W[n])
|
|
50
|
+
return W[n];
|
|
51
|
+
const i = be(e, t, r);
|
|
52
|
+
return W[n] = i, i;
|
|
53
|
+
}
|
|
54
|
+
function Ce(e, t, r, n, i, a) {
|
|
55
|
+
return p(), f(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
class: "vc-checkerboard",
|
|
59
|
+
style: x(a.bgStyle)
|
|
60
|
+
},
|
|
61
|
+
null,
|
|
62
|
+
4
|
|
63
|
+
/* STYLE */
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
var xe = ".vc-checkerboard{background-size:contain;bottom:0;left:0;position:absolute;right:0;top:0}";
|
|
67
|
+
B(xe);
|
|
68
|
+
H.render = Ce;
|
|
69
|
+
H.__file = "src/components/checkboard/checkboard.vue";
|
|
70
|
+
H.install = _;
|
|
71
|
+
var I = {
|
|
72
|
+
name: "Alpha",
|
|
73
|
+
components: {
|
|
74
|
+
Checkboard: H
|
|
75
|
+
},
|
|
76
|
+
props: {
|
|
77
|
+
value: Object,
|
|
78
|
+
onChange: Function
|
|
79
|
+
},
|
|
80
|
+
computed: {
|
|
81
|
+
colors() {
|
|
82
|
+
return this.value;
|
|
83
|
+
},
|
|
84
|
+
gradientColor() {
|
|
85
|
+
const { rgba: e } = this.colors, t = [e.r, e.g, e.b].join(",");
|
|
86
|
+
return `linear-gradient(to right, rgba(${t}, 0) 0%, rgba(${t}, 1) 100%)`;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
handleChange(e, t) {
|
|
91
|
+
!t && e.preventDefault();
|
|
92
|
+
const { container: r } = this.$refs;
|
|
93
|
+
if (!r)
|
|
94
|
+
return;
|
|
95
|
+
const n = r.clientWidth, i = r.getBoundingClientRect().left + window.pageXOffset, o = (e.pageX || (e.touches ? e.touches[0].pageX : 0)) - i;
|
|
96
|
+
let s;
|
|
97
|
+
o < 0 ? s = 0 : o > n ? s = 1 : s = Math.round(o * 100 / n) / 100, this.colors.a !== s && this.$emit("change", {
|
|
98
|
+
h: this.colors.hsl.h,
|
|
99
|
+
s: this.colors.hsl.s,
|
|
100
|
+
l: this.colors.hsl.l,
|
|
101
|
+
a: s,
|
|
102
|
+
source: "rgba"
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
handleMouseDown(e) {
|
|
106
|
+
this.handleChange(e, !0), window.addEventListener("mousemove", this.handleChange), window.addEventListener("mouseup", this.handleMouseUp);
|
|
107
|
+
},
|
|
108
|
+
handleMouseUp() {
|
|
109
|
+
this.unbindEventListeners();
|
|
110
|
+
},
|
|
111
|
+
unbindEventListeners() {
|
|
112
|
+
window.removeEventListener("mousemove", this.handleChange), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const Ee = { class: "vc-alpha" }, we = { class: "vc-alpha-checkboard-wrap" }, ke = /* @__PURE__ */ h(
|
|
117
|
+
"div",
|
|
118
|
+
{ class: "vc-alpha-picker" },
|
|
119
|
+
null,
|
|
120
|
+
-1
|
|
121
|
+
/* HOISTED */
|
|
122
|
+
), ye = [
|
|
123
|
+
ke
|
|
124
|
+
];
|
|
125
|
+
function Ae(e, t, r, n, i, a) {
|
|
126
|
+
const o = D("Checkboard");
|
|
127
|
+
return p(), f("div", Ee, [
|
|
128
|
+
h("div", we, [
|
|
129
|
+
C(o)
|
|
130
|
+
]),
|
|
131
|
+
h(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
class: "vc-alpha-gradient",
|
|
135
|
+
style: x({ background: a.gradientColor })
|
|
136
|
+
},
|
|
137
|
+
null,
|
|
138
|
+
4
|
|
139
|
+
/* STYLE */
|
|
140
|
+
),
|
|
141
|
+
h(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
ref: "container",
|
|
145
|
+
class: "vc-alpha-container",
|
|
146
|
+
onMousedown: t[0] || (t[0] = (...s) => a.handleMouseDown && a.handleMouseDown(...s)),
|
|
147
|
+
onTouchmove: t[1] || (t[1] = (...s) => a.handleChange && a.handleChange(...s)),
|
|
148
|
+
onTouchstart: t[2] || (t[2] = (...s) => a.handleChange && a.handleChange(...s))
|
|
149
|
+
},
|
|
150
|
+
[
|
|
151
|
+
h(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
class: "vc-alpha-pointer",
|
|
155
|
+
style: x({ left: `${a.colors.a * 100}%` })
|
|
156
|
+
},
|
|
157
|
+
ye,
|
|
158
|
+
4
|
|
159
|
+
/* STYLE */
|
|
160
|
+
)
|
|
161
|
+
],
|
|
162
|
+
544
|
|
163
|
+
/* HYDRATE_EVENTS, NEED_PATCH */
|
|
164
|
+
)
|
|
165
|
+
]);
|
|
166
|
+
}
|
|
167
|
+
var De = ".vc-alpha,.vc-alpha-checkboard-wrap{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-checkboard-wrap{overflow:hidden}.vc-alpha-gradient{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-container{cursor:pointer;height:100%;margin:0 3px;position:relative;z-index:2}.vc-alpha-pointer{position:absolute;z-index:2}.vc-alpha-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}";
|
|
168
|
+
B(De);
|
|
169
|
+
I.render = Ae;
|
|
170
|
+
I.__file = "src/components/alpha/alpha.vue";
|
|
171
|
+
I.install = _;
|
|
172
|
+
function v(e, t) {
|
|
173
|
+
Be(e) && (e = "100%");
|
|
174
|
+
var r = _e(e);
|
|
175
|
+
return e = t === 360 ? e : Math.min(t, Math.max(0, parseFloat(e))), r && (e = parseInt(String(e * t), 10) / 100), Math.abs(e - t) < 1e-6 ? 1 : (t === 360 ? e = (e < 0 ? e % t + t : e % t) / parseFloat(String(t)) : e = e % t / parseFloat(String(t)), e);
|
|
176
|
+
}
|
|
177
|
+
function $(e) {
|
|
178
|
+
return Math.min(1, Math.max(0, e));
|
|
179
|
+
}
|
|
180
|
+
function Be(e) {
|
|
181
|
+
return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1;
|
|
182
|
+
}
|
|
183
|
+
function _e(e) {
|
|
184
|
+
return typeof e == "string" && e.indexOf("%") !== -1;
|
|
185
|
+
}
|
|
186
|
+
function ce(e) {
|
|
187
|
+
return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
|
|
188
|
+
}
|
|
189
|
+
function L(e) {
|
|
190
|
+
return e <= 1 ? "".concat(Number(e) * 100, "%") : e;
|
|
191
|
+
}
|
|
192
|
+
function A(e) {
|
|
193
|
+
return e.length === 1 ? "0" + e : String(e);
|
|
194
|
+
}
|
|
195
|
+
function Me(e, t, r) {
|
|
196
|
+
return {
|
|
197
|
+
r: v(e, 255) * 255,
|
|
198
|
+
g: v(t, 255) * 255,
|
|
199
|
+
b: v(r, 255) * 255
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function ne(e, t, r) {
|
|
203
|
+
e = v(e, 255), t = v(t, 255), r = v(r, 255);
|
|
204
|
+
var n = Math.max(e, t, r), i = Math.min(e, t, r), a = 0, o = 0, s = (n + i) / 2;
|
|
205
|
+
if (n === i)
|
|
206
|
+
o = 0, a = 0;
|
|
207
|
+
else {
|
|
208
|
+
var c = n - i;
|
|
209
|
+
switch (o = s > 0.5 ? c / (2 - n - i) : c / (n + i), n) {
|
|
210
|
+
case e:
|
|
211
|
+
a = (t - r) / c + (t < r ? 6 : 0);
|
|
212
|
+
break;
|
|
213
|
+
case t:
|
|
214
|
+
a = (r - e) / c + 2;
|
|
215
|
+
break;
|
|
216
|
+
case r:
|
|
217
|
+
a = (e - t) / c + 4;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
a /= 6;
|
|
221
|
+
}
|
|
222
|
+
return { h: a, s: o, l: s };
|
|
223
|
+
}
|
|
224
|
+
function X(e, t, r) {
|
|
225
|
+
return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? e + (t - e) * (6 * r) : r < 1 / 2 ? t : r < 2 / 3 ? e + (t - e) * (2 / 3 - r) * 6 : e;
|
|
226
|
+
}
|
|
227
|
+
function Se(e, t, r) {
|
|
228
|
+
var n, i, a;
|
|
229
|
+
if (e = v(e, 360), t = v(t, 100), r = v(r, 100), t === 0)
|
|
230
|
+
i = r, a = r, n = r;
|
|
231
|
+
else {
|
|
232
|
+
var o = r < 0.5 ? r * (1 + t) : r + t - r * t, s = 2 * r - o;
|
|
233
|
+
n = X(s, o, e + 1 / 3), i = X(s, o, e), a = X(s, o, e - 1 / 3);
|
|
234
|
+
}
|
|
235
|
+
return { r: n * 255, g: i * 255, b: a * 255 };
|
|
236
|
+
}
|
|
237
|
+
function ae(e, t, r) {
|
|
238
|
+
e = v(e, 255), t = v(t, 255), r = v(r, 255);
|
|
239
|
+
var n = Math.max(e, t, r), i = Math.min(e, t, r), a = 0, o = n, s = n - i, c = n === 0 ? 0 : s / n;
|
|
240
|
+
if (n === i)
|
|
241
|
+
a = 0;
|
|
242
|
+
else {
|
|
243
|
+
switch (n) {
|
|
244
|
+
case e:
|
|
245
|
+
a = (t - r) / s + (t < r ? 6 : 0);
|
|
246
|
+
break;
|
|
247
|
+
case t:
|
|
248
|
+
a = (r - e) / s + 2;
|
|
249
|
+
break;
|
|
250
|
+
case r:
|
|
251
|
+
a = (e - t) / s + 4;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
a /= 6;
|
|
255
|
+
}
|
|
256
|
+
return { h: a, s: c, v: o };
|
|
257
|
+
}
|
|
258
|
+
function He(e, t, r) {
|
|
259
|
+
e = v(e, 360) * 6, t = v(t, 100), r = v(r, 100);
|
|
260
|
+
var n = Math.floor(e), i = e - n, a = r * (1 - t), o = r * (1 - i * t), s = r * (1 - (1 - i) * t), c = n % 6, F = [r, o, a, a, s, r][c], g = [s, r, r, o, a, a][c], u = [a, a, s, r, r, o][c];
|
|
261
|
+
return { r: F * 255, g: g * 255, b: u * 255 };
|
|
262
|
+
}
|
|
263
|
+
function ie(e, t, r, n) {
|
|
264
|
+
var i = [
|
|
265
|
+
A(Math.round(e).toString(16)),
|
|
266
|
+
A(Math.round(t).toString(16)),
|
|
267
|
+
A(Math.round(r).toString(16))
|
|
268
|
+
];
|
|
269
|
+
return n && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) : i.join("");
|
|
270
|
+
}
|
|
271
|
+
function Te(e, t, r, n, i) {
|
|
272
|
+
var a = [
|
|
273
|
+
A(Math.round(e).toString(16)),
|
|
274
|
+
A(Math.round(t).toString(16)),
|
|
275
|
+
A(Math.round(r).toString(16)),
|
|
276
|
+
A(Re(n))
|
|
277
|
+
];
|
|
278
|
+
return i && a[0].startsWith(a[0].charAt(1)) && a[1].startsWith(a[1].charAt(1)) && a[2].startsWith(a[2].charAt(1)) && a[3].startsWith(a[3].charAt(1)) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) + a[3].charAt(0) : a.join("");
|
|
279
|
+
}
|
|
280
|
+
function Re(e) {
|
|
281
|
+
return Math.round(parseFloat(e) * 255).toString(16);
|
|
282
|
+
}
|
|
283
|
+
function oe(e) {
|
|
284
|
+
return b(e) / 255;
|
|
285
|
+
}
|
|
286
|
+
function b(e) {
|
|
287
|
+
return parseInt(e, 16);
|
|
288
|
+
}
|
|
289
|
+
function $e(e) {
|
|
290
|
+
return {
|
|
291
|
+
r: e >> 16,
|
|
292
|
+
g: (e & 65280) >> 8,
|
|
293
|
+
b: e & 255
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
var J = {
|
|
297
|
+
aliceblue: "#f0f8ff",
|
|
298
|
+
antiquewhite: "#faebd7",
|
|
299
|
+
aqua: "#00ffff",
|
|
300
|
+
aquamarine: "#7fffd4",
|
|
301
|
+
azure: "#f0ffff",
|
|
302
|
+
beige: "#f5f5dc",
|
|
303
|
+
bisque: "#ffe4c4",
|
|
304
|
+
black: "#000000",
|
|
305
|
+
blanchedalmond: "#ffebcd",
|
|
306
|
+
blue: "#0000ff",
|
|
307
|
+
blueviolet: "#8a2be2",
|
|
308
|
+
brown: "#a52a2a",
|
|
309
|
+
burlywood: "#deb887",
|
|
310
|
+
cadetblue: "#5f9ea0",
|
|
311
|
+
chartreuse: "#7fff00",
|
|
312
|
+
chocolate: "#d2691e",
|
|
313
|
+
coral: "#ff7f50",
|
|
314
|
+
cornflowerblue: "#6495ed",
|
|
315
|
+
cornsilk: "#fff8dc",
|
|
316
|
+
crimson: "#dc143c",
|
|
317
|
+
cyan: "#00ffff",
|
|
318
|
+
darkblue: "#00008b",
|
|
319
|
+
darkcyan: "#008b8b",
|
|
320
|
+
darkgoldenrod: "#b8860b",
|
|
321
|
+
darkgray: "#a9a9a9",
|
|
322
|
+
darkgreen: "#006400",
|
|
323
|
+
darkgrey: "#a9a9a9",
|
|
324
|
+
darkkhaki: "#bdb76b",
|
|
325
|
+
darkmagenta: "#8b008b",
|
|
326
|
+
darkolivegreen: "#556b2f",
|
|
327
|
+
darkorange: "#ff8c00",
|
|
328
|
+
darkorchid: "#9932cc",
|
|
329
|
+
darkred: "#8b0000",
|
|
330
|
+
darksalmon: "#e9967a",
|
|
331
|
+
darkseagreen: "#8fbc8f",
|
|
332
|
+
darkslateblue: "#483d8b",
|
|
333
|
+
darkslategray: "#2f4f4f",
|
|
334
|
+
darkslategrey: "#2f4f4f",
|
|
335
|
+
darkturquoise: "#00ced1",
|
|
336
|
+
darkviolet: "#9400d3",
|
|
337
|
+
deeppink: "#ff1493",
|
|
338
|
+
deepskyblue: "#00bfff",
|
|
339
|
+
dimgray: "#696969",
|
|
340
|
+
dimgrey: "#696969",
|
|
341
|
+
dodgerblue: "#1e90ff",
|
|
342
|
+
firebrick: "#b22222",
|
|
343
|
+
floralwhite: "#fffaf0",
|
|
344
|
+
forestgreen: "#228b22",
|
|
345
|
+
fuchsia: "#ff00ff",
|
|
346
|
+
gainsboro: "#dcdcdc",
|
|
347
|
+
ghostwhite: "#f8f8ff",
|
|
348
|
+
goldenrod: "#daa520",
|
|
349
|
+
gold: "#ffd700",
|
|
350
|
+
gray: "#808080",
|
|
351
|
+
green: "#008000",
|
|
352
|
+
greenyellow: "#adff2f",
|
|
353
|
+
grey: "#808080",
|
|
354
|
+
honeydew: "#f0fff0",
|
|
355
|
+
hotpink: "#ff69b4",
|
|
356
|
+
indianred: "#cd5c5c",
|
|
357
|
+
indigo: "#4b0082",
|
|
358
|
+
ivory: "#fffff0",
|
|
359
|
+
khaki: "#f0e68c",
|
|
360
|
+
lavenderblush: "#fff0f5",
|
|
361
|
+
lavender: "#e6e6fa",
|
|
362
|
+
lawngreen: "#7cfc00",
|
|
363
|
+
lemonchiffon: "#fffacd",
|
|
364
|
+
lightblue: "#add8e6",
|
|
365
|
+
lightcoral: "#f08080",
|
|
366
|
+
lightcyan: "#e0ffff",
|
|
367
|
+
lightgoldenrodyellow: "#fafad2",
|
|
368
|
+
lightgray: "#d3d3d3",
|
|
369
|
+
lightgreen: "#90ee90",
|
|
370
|
+
lightgrey: "#d3d3d3",
|
|
371
|
+
lightpink: "#ffb6c1",
|
|
372
|
+
lightsalmon: "#ffa07a",
|
|
373
|
+
lightseagreen: "#20b2aa",
|
|
374
|
+
lightskyblue: "#87cefa",
|
|
375
|
+
lightslategray: "#778899",
|
|
376
|
+
lightslategrey: "#778899",
|
|
377
|
+
lightsteelblue: "#b0c4de",
|
|
378
|
+
lightyellow: "#ffffe0",
|
|
379
|
+
lime: "#00ff00",
|
|
380
|
+
limegreen: "#32cd32",
|
|
381
|
+
linen: "#faf0e6",
|
|
382
|
+
magenta: "#ff00ff",
|
|
383
|
+
maroon: "#800000",
|
|
384
|
+
mediumaquamarine: "#66cdaa",
|
|
385
|
+
mediumblue: "#0000cd",
|
|
386
|
+
mediumorchid: "#ba55d3",
|
|
387
|
+
mediumpurple: "#9370db",
|
|
388
|
+
mediumseagreen: "#3cb371",
|
|
389
|
+
mediumslateblue: "#7b68ee",
|
|
390
|
+
mediumspringgreen: "#00fa9a",
|
|
391
|
+
mediumturquoise: "#48d1cc",
|
|
392
|
+
mediumvioletred: "#c71585",
|
|
393
|
+
midnightblue: "#191970",
|
|
394
|
+
mintcream: "#f5fffa",
|
|
395
|
+
mistyrose: "#ffe4e1",
|
|
396
|
+
moccasin: "#ffe4b5",
|
|
397
|
+
navajowhite: "#ffdead",
|
|
398
|
+
navy: "#000080",
|
|
399
|
+
oldlace: "#fdf5e6",
|
|
400
|
+
olive: "#808000",
|
|
401
|
+
olivedrab: "#6b8e23",
|
|
402
|
+
orange: "#ffa500",
|
|
403
|
+
orangered: "#ff4500",
|
|
404
|
+
orchid: "#da70d6",
|
|
405
|
+
palegoldenrod: "#eee8aa",
|
|
406
|
+
palegreen: "#98fb98",
|
|
407
|
+
paleturquoise: "#afeeee",
|
|
408
|
+
palevioletred: "#db7093",
|
|
409
|
+
papayawhip: "#ffefd5",
|
|
410
|
+
peachpuff: "#ffdab9",
|
|
411
|
+
peru: "#cd853f",
|
|
412
|
+
pink: "#ffc0cb",
|
|
413
|
+
plum: "#dda0dd",
|
|
414
|
+
powderblue: "#b0e0e6",
|
|
415
|
+
purple: "#800080",
|
|
416
|
+
rebeccapurple: "#663399",
|
|
417
|
+
red: "#ff0000",
|
|
418
|
+
rosybrown: "#bc8f8f",
|
|
419
|
+
royalblue: "#4169e1",
|
|
420
|
+
saddlebrown: "#8b4513",
|
|
421
|
+
salmon: "#fa8072",
|
|
422
|
+
sandybrown: "#f4a460",
|
|
423
|
+
seagreen: "#2e8b57",
|
|
424
|
+
seashell: "#fff5ee",
|
|
425
|
+
sienna: "#a0522d",
|
|
426
|
+
silver: "#c0c0c0",
|
|
427
|
+
skyblue: "#87ceeb",
|
|
428
|
+
slateblue: "#6a5acd",
|
|
429
|
+
slategray: "#708090",
|
|
430
|
+
slategrey: "#708090",
|
|
431
|
+
snow: "#fffafa",
|
|
432
|
+
springgreen: "#00ff7f",
|
|
433
|
+
steelblue: "#4682b4",
|
|
434
|
+
tan: "#d2b48c",
|
|
435
|
+
teal: "#008080",
|
|
436
|
+
thistle: "#d8bfd8",
|
|
437
|
+
tomato: "#ff6347",
|
|
438
|
+
turquoise: "#40e0d0",
|
|
439
|
+
violet: "#ee82ee",
|
|
440
|
+
wheat: "#f5deb3",
|
|
441
|
+
white: "#ffffff",
|
|
442
|
+
whitesmoke: "#f5f5f5",
|
|
443
|
+
yellow: "#ffff00",
|
|
444
|
+
yellowgreen: "#9acd32"
|
|
445
|
+
};
|
|
446
|
+
function Le(e) {
|
|
447
|
+
var t = { r: 0, g: 0, b: 0 }, r = 1, n = null, i = null, a = null, o = !1, s = !1;
|
|
448
|
+
return typeof e == "string" && (e = Oe(e)), typeof e == "object" && (w(e.r) && w(e.g) && w(e.b) ? (t = Me(e.r, e.g, e.b), o = !0, s = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : w(e.h) && w(e.s) && w(e.v) ? (n = L(e.s), i = L(e.v), t = He(e.h, n, i), o = !0, s = "hsv") : w(e.h) && w(e.s) && w(e.l) && (n = L(e.s), a = L(e.l), t = Se(e.h, n, a), o = !0, s = "hsl"), Object.prototype.hasOwnProperty.call(e, "a") && (r = e.a)), r = ce(r), {
|
|
449
|
+
ok: o,
|
|
450
|
+
format: e.format || s,
|
|
451
|
+
r: Math.min(255, Math.max(t.r, 0)),
|
|
452
|
+
g: Math.min(255, Math.max(t.g, 0)),
|
|
453
|
+
b: Math.min(255, Math.max(t.b, 0)),
|
|
454
|
+
a: r
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
var Ie = "[-\\+]?\\d+%?", Ne = "[-\\+]?\\d*\\.\\d+%?", y = "(?:".concat(Ne, ")|(?:").concat(Ie, ")"), j = "[\\s|\\(]+(".concat(y, ")[,|\\s]+(").concat(y, ")[,|\\s]+(").concat(y, ")\\s*\\)?"), Y = "[\\s|\\(]+(".concat(y, ")[,|\\s]+(").concat(y, ")[,|\\s]+(").concat(y, ")[,|\\s]+(").concat(y, ")\\s*\\)?"), E = {
|
|
458
|
+
CSS_UNIT: new RegExp(y),
|
|
459
|
+
rgb: new RegExp("rgb" + j),
|
|
460
|
+
rgba: new RegExp("rgba" + Y),
|
|
461
|
+
hsl: new RegExp("hsl" + j),
|
|
462
|
+
hsla: new RegExp("hsla" + Y),
|
|
463
|
+
hsv: new RegExp("hsv" + j),
|
|
464
|
+
hsva: new RegExp("hsva" + Y),
|
|
465
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
466
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
467
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
468
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
469
|
+
};
|
|
470
|
+
function Oe(e) {
|
|
471
|
+
if (e = e.trim().toLowerCase(), e.length === 0)
|
|
472
|
+
return !1;
|
|
473
|
+
var t = !1;
|
|
474
|
+
if (J[e])
|
|
475
|
+
e = J[e], t = !0;
|
|
476
|
+
else if (e === "transparent")
|
|
477
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
478
|
+
var r = E.rgb.exec(e);
|
|
479
|
+
return r ? { r: r[1], g: r[2], b: r[3] } : (r = E.rgba.exec(e), r ? { r: r[1], g: r[2], b: r[3], a: r[4] } : (r = E.hsl.exec(e), r ? { h: r[1], s: r[2], l: r[3] } : (r = E.hsla.exec(e), r ? { h: r[1], s: r[2], l: r[3], a: r[4] } : (r = E.hsv.exec(e), r ? { h: r[1], s: r[2], v: r[3] } : (r = E.hsva.exec(e), r ? { h: r[1], s: r[2], v: r[3], a: r[4] } : (r = E.hex8.exec(e), r ? {
|
|
480
|
+
r: b(r[1]),
|
|
481
|
+
g: b(r[2]),
|
|
482
|
+
b: b(r[3]),
|
|
483
|
+
a: oe(r[4]),
|
|
484
|
+
format: t ? "name" : "hex8"
|
|
485
|
+
} : (r = E.hex6.exec(e), r ? {
|
|
486
|
+
r: b(r[1]),
|
|
487
|
+
g: b(r[2]),
|
|
488
|
+
b: b(r[3]),
|
|
489
|
+
format: t ? "name" : "hex"
|
|
490
|
+
} : (r = E.hex4.exec(e), r ? {
|
|
491
|
+
r: b(r[1] + r[1]),
|
|
492
|
+
g: b(r[2] + r[2]),
|
|
493
|
+
b: b(r[3] + r[3]),
|
|
494
|
+
a: oe(r[4] + r[4]),
|
|
495
|
+
format: t ? "name" : "hex8"
|
|
496
|
+
} : (r = E.hex3.exec(e), r ? {
|
|
497
|
+
r: b(r[1] + r[1]),
|
|
498
|
+
g: b(r[2] + r[2]),
|
|
499
|
+
b: b(r[3] + r[3]),
|
|
500
|
+
format: t ? "name" : "hex"
|
|
501
|
+
} : !1)))))))));
|
|
502
|
+
}
|
|
503
|
+
function w(e) {
|
|
504
|
+
return !!E.CSS_UNIT.exec(String(e));
|
|
505
|
+
}
|
|
506
|
+
var ze = (
|
|
507
|
+
/** @class */
|
|
508
|
+
function() {
|
|
509
|
+
function e(t, r) {
|
|
510
|
+
t === void 0 && (t = ""), r === void 0 && (r = {});
|
|
511
|
+
var n;
|
|
512
|
+
if (t instanceof e)
|
|
513
|
+
return t;
|
|
514
|
+
typeof t == "number" && (t = $e(t)), this.originalInput = t;
|
|
515
|
+
var i = Le(t);
|
|
516
|
+
this.originalInput = t, this.r = i.r, this.g = i.g, this.b = i.b, this.a = i.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (n = r.format) !== null && n !== void 0 ? n : i.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.isValid = i.ok;
|
|
517
|
+
}
|
|
518
|
+
return e.prototype.isDark = function() {
|
|
519
|
+
return this.getBrightness() < 128;
|
|
520
|
+
}, e.prototype.isLight = function() {
|
|
521
|
+
return !this.isDark();
|
|
522
|
+
}, e.prototype.getBrightness = function() {
|
|
523
|
+
var t = this.toRgb();
|
|
524
|
+
return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
|
|
525
|
+
}, e.prototype.getLuminance = function() {
|
|
526
|
+
var t = this.toRgb(), r, n, i, a = t.r / 255, o = t.g / 255, s = t.b / 255;
|
|
527
|
+
return a <= 0.03928 ? r = a / 12.92 : r = Math.pow((a + 0.055) / 1.055, 2.4), o <= 0.03928 ? n = o / 12.92 : n = Math.pow((o + 0.055) / 1.055, 2.4), s <= 0.03928 ? i = s / 12.92 : i = Math.pow((s + 0.055) / 1.055, 2.4), 0.2126 * r + 0.7152 * n + 0.0722 * i;
|
|
528
|
+
}, e.prototype.getAlpha = function() {
|
|
529
|
+
return this.a;
|
|
530
|
+
}, e.prototype.setAlpha = function(t) {
|
|
531
|
+
return this.a = ce(t), this.roundA = Math.round(100 * this.a) / 100, this;
|
|
532
|
+
}, e.prototype.isMonochrome = function() {
|
|
533
|
+
var t = this.toHsl().s;
|
|
534
|
+
return t === 0;
|
|
535
|
+
}, e.prototype.toHsv = function() {
|
|
536
|
+
var t = ae(this.r, this.g, this.b);
|
|
537
|
+
return { h: t.h * 360, s: t.s, v: t.v, a: this.a };
|
|
538
|
+
}, e.prototype.toHsvString = function() {
|
|
539
|
+
var t = ae(this.r, this.g, this.b), r = Math.round(t.h * 360), n = Math.round(t.s * 100), i = Math.round(t.v * 100);
|
|
540
|
+
return this.a === 1 ? "hsv(".concat(r, ", ").concat(n, "%, ").concat(i, "%)") : "hsva(".concat(r, ", ").concat(n, "%, ").concat(i, "%, ").concat(this.roundA, ")");
|
|
541
|
+
}, e.prototype.toHsl = function() {
|
|
542
|
+
var t = ne(this.r, this.g, this.b);
|
|
543
|
+
return { h: t.h * 360, s: t.s, l: t.l, a: this.a };
|
|
544
|
+
}, e.prototype.toHslString = function() {
|
|
545
|
+
var t = ne(this.r, this.g, this.b), r = Math.round(t.h * 360), n = Math.round(t.s * 100), i = Math.round(t.l * 100);
|
|
546
|
+
return this.a === 1 ? "hsl(".concat(r, ", ").concat(n, "%, ").concat(i, "%)") : "hsla(".concat(r, ", ").concat(n, "%, ").concat(i, "%, ").concat(this.roundA, ")");
|
|
547
|
+
}, e.prototype.toHex = function(t) {
|
|
548
|
+
return t === void 0 && (t = !1), ie(this.r, this.g, this.b, t);
|
|
549
|
+
}, e.prototype.toHexString = function(t) {
|
|
550
|
+
return t === void 0 && (t = !1), "#" + this.toHex(t);
|
|
551
|
+
}, e.prototype.toHex8 = function(t) {
|
|
552
|
+
return t === void 0 && (t = !1), Te(this.r, this.g, this.b, this.a, t);
|
|
553
|
+
}, e.prototype.toHex8String = function(t) {
|
|
554
|
+
return t === void 0 && (t = !1), "#" + this.toHex8(t);
|
|
555
|
+
}, e.prototype.toHexShortString = function(t) {
|
|
556
|
+
return t === void 0 && (t = !1), this.a === 1 ? this.toHexString(t) : this.toHex8String(t);
|
|
557
|
+
}, e.prototype.toRgb = function() {
|
|
558
|
+
return {
|
|
559
|
+
r: Math.round(this.r),
|
|
560
|
+
g: Math.round(this.g),
|
|
561
|
+
b: Math.round(this.b),
|
|
562
|
+
a: this.a
|
|
563
|
+
};
|
|
564
|
+
}, e.prototype.toRgbString = function() {
|
|
565
|
+
var t = Math.round(this.r), r = Math.round(this.g), n = Math.round(this.b);
|
|
566
|
+
return this.a === 1 ? "rgb(".concat(t, ", ").concat(r, ", ").concat(n, ")") : "rgba(".concat(t, ", ").concat(r, ", ").concat(n, ", ").concat(this.roundA, ")");
|
|
567
|
+
}, e.prototype.toPercentageRgb = function() {
|
|
568
|
+
var t = function(r) {
|
|
569
|
+
return "".concat(Math.round(v(r, 255) * 100), "%");
|
|
570
|
+
};
|
|
571
|
+
return {
|
|
572
|
+
r: t(this.r),
|
|
573
|
+
g: t(this.g),
|
|
574
|
+
b: t(this.b),
|
|
575
|
+
a: this.a
|
|
576
|
+
};
|
|
577
|
+
}, e.prototype.toPercentageRgbString = function() {
|
|
578
|
+
var t = function(r) {
|
|
579
|
+
return Math.round(v(r, 255) * 100);
|
|
580
|
+
};
|
|
581
|
+
return this.a === 1 ? "rgb(".concat(t(this.r), "%, ").concat(t(this.g), "%, ").concat(t(this.b), "%)") : "rgba(".concat(t(this.r), "%, ").concat(t(this.g), "%, ").concat(t(this.b), "%, ").concat(this.roundA, ")");
|
|
582
|
+
}, e.prototype.toName = function() {
|
|
583
|
+
if (this.a === 0)
|
|
584
|
+
return "transparent";
|
|
585
|
+
if (this.a < 1)
|
|
586
|
+
return !1;
|
|
587
|
+
for (var t = "#" + ie(this.r, this.g, this.b, !1), r = 0, n = Object.entries(J); r < n.length; r++) {
|
|
588
|
+
var i = n[r], a = i[0], o = i[1];
|
|
589
|
+
if (t === o)
|
|
590
|
+
return a;
|
|
591
|
+
}
|
|
592
|
+
return !1;
|
|
593
|
+
}, e.prototype.toString = function(t) {
|
|
594
|
+
var r = !!t;
|
|
595
|
+
t = t ?? this.format;
|
|
596
|
+
var n = !1, i = this.a < 1 && this.a >= 0, a = !r && i && (t.startsWith("hex") || t === "name");
|
|
597
|
+
return a ? t === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (n = this.toRgbString()), t === "prgb" && (n = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (n = this.toHexString()), t === "hex3" && (n = this.toHexString(!0)), t === "hex4" && (n = this.toHex8String(!0)), t === "hex8" && (n = this.toHex8String()), t === "name" && (n = this.toName()), t === "hsl" && (n = this.toHslString()), t === "hsv" && (n = this.toHsvString()), n || this.toHexString());
|
|
598
|
+
}, e.prototype.toNumber = function() {
|
|
599
|
+
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
600
|
+
}, e.prototype.clone = function() {
|
|
601
|
+
return new e(this.toString());
|
|
602
|
+
}, e.prototype.lighten = function(t) {
|
|
603
|
+
t === void 0 && (t = 10);
|
|
604
|
+
var r = this.toHsl();
|
|
605
|
+
return r.l += t / 100, r.l = $(r.l), new e(r);
|
|
606
|
+
}, e.prototype.brighten = function(t) {
|
|
607
|
+
t === void 0 && (t = 10);
|
|
608
|
+
var r = this.toRgb();
|
|
609
|
+
return r.r = Math.max(0, Math.min(255, r.r - Math.round(255 * -(t / 100)))), r.g = Math.max(0, Math.min(255, r.g - Math.round(255 * -(t / 100)))), r.b = Math.max(0, Math.min(255, r.b - Math.round(255 * -(t / 100)))), new e(r);
|
|
610
|
+
}, e.prototype.darken = function(t) {
|
|
611
|
+
t === void 0 && (t = 10);
|
|
612
|
+
var r = this.toHsl();
|
|
613
|
+
return r.l -= t / 100, r.l = $(r.l), new e(r);
|
|
614
|
+
}, e.prototype.tint = function(t) {
|
|
615
|
+
return t === void 0 && (t = 10), this.mix("white", t);
|
|
616
|
+
}, e.prototype.shade = function(t) {
|
|
617
|
+
return t === void 0 && (t = 10), this.mix("black", t);
|
|
618
|
+
}, e.prototype.desaturate = function(t) {
|
|
619
|
+
t === void 0 && (t = 10);
|
|
620
|
+
var r = this.toHsl();
|
|
621
|
+
return r.s -= t / 100, r.s = $(r.s), new e(r);
|
|
622
|
+
}, e.prototype.saturate = function(t) {
|
|
623
|
+
t === void 0 && (t = 10);
|
|
624
|
+
var r = this.toHsl();
|
|
625
|
+
return r.s += t / 100, r.s = $(r.s), new e(r);
|
|
626
|
+
}, e.prototype.greyscale = function() {
|
|
627
|
+
return this.desaturate(100);
|
|
628
|
+
}, e.prototype.spin = function(t) {
|
|
629
|
+
var r = this.toHsl(), n = (r.h + t) % 360;
|
|
630
|
+
return r.h = n < 0 ? 360 + n : n, new e(r);
|
|
631
|
+
}, e.prototype.mix = function(t, r) {
|
|
632
|
+
r === void 0 && (r = 50);
|
|
633
|
+
var n = this.toRgb(), i = new e(t).toRgb(), a = r / 100, o = {
|
|
634
|
+
r: (i.r - n.r) * a + n.r,
|
|
635
|
+
g: (i.g - n.g) * a + n.g,
|
|
636
|
+
b: (i.b - n.b) * a + n.b,
|
|
637
|
+
a: (i.a - n.a) * a + n.a
|
|
638
|
+
};
|
|
639
|
+
return new e(o);
|
|
640
|
+
}, e.prototype.analogous = function(t, r) {
|
|
641
|
+
t === void 0 && (t = 6), r === void 0 && (r = 30);
|
|
642
|
+
var n = this.toHsl(), i = 360 / r, a = [this];
|
|
643
|
+
for (n.h = (n.h - (i * t >> 1) + 720) % 360; --t; )
|
|
644
|
+
n.h = (n.h + i) % 360, a.push(new e(n));
|
|
645
|
+
return a;
|
|
646
|
+
}, e.prototype.complement = function() {
|
|
647
|
+
var t = this.toHsl();
|
|
648
|
+
return t.h = (t.h + 180) % 360, new e(t);
|
|
649
|
+
}, e.prototype.monochromatic = function(t) {
|
|
650
|
+
t === void 0 && (t = 6);
|
|
651
|
+
for (var r = this.toHsv(), n = r.h, i = r.s, a = r.v, o = [], s = 1 / t; t--; )
|
|
652
|
+
o.push(new e({ h: n, s: i, v: a })), a = (a + s) % 1;
|
|
653
|
+
return o;
|
|
654
|
+
}, e.prototype.splitcomplement = function() {
|
|
655
|
+
var t = this.toHsl(), r = t.h;
|
|
656
|
+
return [
|
|
657
|
+
this,
|
|
658
|
+
new e({ h: (r + 72) % 360, s: t.s, l: t.l }),
|
|
659
|
+
new e({ h: (r + 216) % 360, s: t.s, l: t.l })
|
|
660
|
+
];
|
|
661
|
+
}, e.prototype.onBackground = function(t) {
|
|
662
|
+
var r = this.toRgb(), n = new e(t).toRgb(), i = r.a + n.a * (1 - r.a);
|
|
663
|
+
return new e({
|
|
664
|
+
r: (r.r * r.a + n.r * n.a * (1 - r.a)) / i,
|
|
665
|
+
g: (r.g * r.a + n.g * n.a * (1 - r.a)) / i,
|
|
666
|
+
b: (r.b * r.a + n.b * n.a * (1 - r.a)) / i,
|
|
667
|
+
a: i
|
|
668
|
+
});
|
|
669
|
+
}, e.prototype.triad = function() {
|
|
670
|
+
return this.polyad(3);
|
|
671
|
+
}, e.prototype.tetrad = function() {
|
|
672
|
+
return this.polyad(4);
|
|
673
|
+
}, e.prototype.polyad = function(t) {
|
|
674
|
+
for (var r = this.toHsl(), n = r.h, i = [this], a = 360 / t, o = 1; o < t; o++)
|
|
675
|
+
i.push(new e({ h: (n + o * a) % 360, s: r.s, l: r.l }));
|
|
676
|
+
return i;
|
|
677
|
+
}, e.prototype.equals = function(t) {
|
|
678
|
+
return this.toRgbString() === new e(t).toRgbString();
|
|
679
|
+
}, e;
|
|
680
|
+
}()
|
|
681
|
+
);
|
|
682
|
+
function k(...e) {
|
|
683
|
+
return new ze(...e);
|
|
684
|
+
}
|
|
685
|
+
function G(e, t) {
|
|
686
|
+
const r = e && e.a;
|
|
687
|
+
let n;
|
|
688
|
+
e && e.hsl ? n = k(e.hsl) : e && e.hex && e.hex.length > 0 ? n = k(e.hex) : e && e.hsv ? n = k(e.hsv) : e && e.rgba ? n = k(e.rgba) : e && e.rgb ? n = k(e.rgb) : n = k(e), n && (n._a === void 0 || n._a === null) && n.setAlpha(r || n.getAlpha());
|
|
689
|
+
const i = n.toHsl(), a = n.toHsv();
|
|
690
|
+
return i.s === 0 && (a.h = i.h = e.h || e.hsl && e.hsl.h || t || 0), a.v < 0.0164 && (a.h = e.h || e.hsv && e.hsv.h || 0, a.s = e.s || e.hsv && e.hsv.s || 0), i.l < 0.01 && (i.h = e.h || e.hsl && e.hsl.h || 0, i.s = e.s || e.hsl && e.hsl.s || 0), {
|
|
691
|
+
hsl: i,
|
|
692
|
+
hex: n.toHexString().toUpperCase(),
|
|
693
|
+
hex8: n.toHex8String().toUpperCase(),
|
|
694
|
+
rgba: n.toRgb(),
|
|
695
|
+
hsv: a,
|
|
696
|
+
oldHue: e.h || t || i.h,
|
|
697
|
+
source: e.source,
|
|
698
|
+
a: n.getAlpha()
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
var Ue = {
|
|
702
|
+
model: {
|
|
703
|
+
prop: "modelValue",
|
|
704
|
+
event: "update:modelValue"
|
|
705
|
+
},
|
|
706
|
+
props: ["modelValue"],
|
|
707
|
+
data() {
|
|
708
|
+
return {
|
|
709
|
+
val: G(this.modelValue)
|
|
710
|
+
};
|
|
711
|
+
},
|
|
712
|
+
computed: {
|
|
713
|
+
colors: {
|
|
714
|
+
get() {
|
|
715
|
+
return this.val;
|
|
716
|
+
},
|
|
717
|
+
set(e) {
|
|
718
|
+
this.val = e, this.$emit("update:modelValue", e);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
watch: {
|
|
723
|
+
modelValue(e) {
|
|
724
|
+
this.val = G(e);
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
methods: {
|
|
728
|
+
colorChange(e, t) {
|
|
729
|
+
this.oldHue = this.colors.hsl.h, this.colors = G(e, t || this.oldHue);
|
|
730
|
+
},
|
|
731
|
+
isValidHex(e) {
|
|
732
|
+
return k(e).isValid;
|
|
733
|
+
},
|
|
734
|
+
simpleCheckForValidColor(e) {
|
|
735
|
+
const t = ["r", "g", "b", "a", "h", "s", "l", "v"];
|
|
736
|
+
let r = 0, n = 0;
|
|
737
|
+
for (let i = 0; i < t.length; i++) {
|
|
738
|
+
const a = t[i];
|
|
739
|
+
e[a] && (r++, isNaN(e[a]) || n++);
|
|
740
|
+
}
|
|
741
|
+
if (r === n)
|
|
742
|
+
return e;
|
|
743
|
+
},
|
|
744
|
+
paletteUpperCase(e) {
|
|
745
|
+
return e.map((t) => t.toUpperCase());
|
|
746
|
+
},
|
|
747
|
+
isTransparent(e) {
|
|
748
|
+
return k(e).getAlpha() === 0;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}, N = {
|
|
752
|
+
name: "EditableInput",
|
|
753
|
+
props: {
|
|
754
|
+
label: String,
|
|
755
|
+
labelText: String,
|
|
756
|
+
desc: String,
|
|
757
|
+
value: [String, Number],
|
|
758
|
+
max: Number,
|
|
759
|
+
min: Number,
|
|
760
|
+
arrowOffset: {
|
|
761
|
+
type: Number,
|
|
762
|
+
default: 1
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
computed: {
|
|
766
|
+
val: {
|
|
767
|
+
get() {
|
|
768
|
+
return this.value;
|
|
769
|
+
},
|
|
770
|
+
set(e) {
|
|
771
|
+
if (this.max !== void 0 && +e > this.max)
|
|
772
|
+
this.$refs.input.value = this.max;
|
|
773
|
+
else
|
|
774
|
+
return e;
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
labelId() {
|
|
778
|
+
return `input__label__${this.label}__${Math.random().toString().slice(2, 5)}`;
|
|
779
|
+
},
|
|
780
|
+
labelSpanText() {
|
|
781
|
+
return this.labelText || this.label;
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
methods: {
|
|
785
|
+
update(e) {
|
|
786
|
+
this.handleChange(e.target.value);
|
|
787
|
+
},
|
|
788
|
+
handleChange(e) {
|
|
789
|
+
const t = {};
|
|
790
|
+
t[this.label] = e, t.hex === void 0 && t["#"] === void 0 ? this.$emit("change", t) : e.length > 5 && this.$emit("change", t);
|
|
791
|
+
},
|
|
792
|
+
// **** unused
|
|
793
|
+
// handleBlur (e) {
|
|
794
|
+
// console.log(e)
|
|
795
|
+
// },
|
|
796
|
+
handleKeyDown(e) {
|
|
797
|
+
let { val: t } = this;
|
|
798
|
+
const r = Number(t);
|
|
799
|
+
if (r) {
|
|
800
|
+
const n = this.arrowOffset || 1;
|
|
801
|
+
e.keyCode === 38 && (t = r + n, this.handleChange(t), e.preventDefault()), e.keyCode === 40 && (t = r - n, this.handleChange(t), e.preventDefault());
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
// **** unused
|
|
805
|
+
// handleDrag (e) {
|
|
806
|
+
// console.log(e)
|
|
807
|
+
// },
|
|
808
|
+
// handleMouseDown (e) {
|
|
809
|
+
// console.log(e)
|
|
810
|
+
// }
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
const Ve = { class: "vc-editable-input" }, Pe = ["aria-labelledby"], We = ["id", "for"], Xe = { class: "vc-input__desc" };
|
|
814
|
+
function je(e, t, r, n, i, a) {
|
|
815
|
+
return p(), f("div", Ve, [
|
|
816
|
+
fe(h("input", {
|
|
817
|
+
ref: "input",
|
|
818
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => a.val = o),
|
|
819
|
+
"aria-labelledby": a.labelId,
|
|
820
|
+
class: "vc-input__input",
|
|
821
|
+
onKeydown: t[1] || (t[1] = (...o) => a.handleKeyDown && a.handleKeyDown(...o)),
|
|
822
|
+
onInput: t[2] || (t[2] = (...o) => a.update && a.update(...o))
|
|
823
|
+
}, null, 40, Pe), [
|
|
824
|
+
[pe, a.val]
|
|
825
|
+
]),
|
|
826
|
+
h("span", {
|
|
827
|
+
id: a.labelId,
|
|
828
|
+
for: r.label,
|
|
829
|
+
class: "vc-input__label"
|
|
830
|
+
}, K(a.labelSpanText), 9, We),
|
|
831
|
+
h(
|
|
832
|
+
"span",
|
|
833
|
+
Xe,
|
|
834
|
+
K(r.desc),
|
|
835
|
+
1
|
|
836
|
+
/* TEXT */
|
|
837
|
+
)
|
|
838
|
+
]);
|
|
839
|
+
}
|
|
840
|
+
var Ye = ".vc-editable-input{position:relative}.vc-input__input{border:0;outline:none;padding:0}.vc-input__label{text-transform:capitalize}";
|
|
841
|
+
B(Ye);
|
|
842
|
+
N.render = je;
|
|
843
|
+
N.__file = "src/components/editable-input/editable-input.vue";
|
|
844
|
+
N.install = _;
|
|
845
|
+
function q(e, t, r) {
|
|
846
|
+
return t < r ? e < t ? t : e > r ? r : e : e < r ? r : e > t ? t : e;
|
|
847
|
+
}
|
|
848
|
+
var O = {
|
|
849
|
+
name: "Saturation",
|
|
850
|
+
props: {
|
|
851
|
+
value: Object
|
|
852
|
+
},
|
|
853
|
+
computed: {
|
|
854
|
+
colors() {
|
|
855
|
+
return this.value;
|
|
856
|
+
},
|
|
857
|
+
bgColor() {
|
|
858
|
+
return `hsl(${this.colors.hsv.h}, 100%, 50%)`;
|
|
859
|
+
},
|
|
860
|
+
pointerTop() {
|
|
861
|
+
return `${-(this.colors.hsv.v * 100) + 1 + 100}%`;
|
|
862
|
+
},
|
|
863
|
+
pointerLeft() {
|
|
864
|
+
return `${this.colors.hsv.s * 100}%`;
|
|
865
|
+
}
|
|
866
|
+
},
|
|
867
|
+
methods: {
|
|
868
|
+
handleChange(e, t) {
|
|
869
|
+
!t && e.preventDefault();
|
|
870
|
+
const { container: r } = this.$refs;
|
|
871
|
+
if (!r)
|
|
872
|
+
return;
|
|
873
|
+
const n = r.clientWidth, i = r.clientHeight, a = r.getBoundingClientRect().left + window.pageXOffset, o = r.getBoundingClientRect().top + window.pageYOffset, s = e.pageX || (e.touches ? e.touches[0].pageX : 0), c = e.pageY || (e.touches ? e.touches[0].pageY : 0), F = q(s - a, 0, n), g = q(c - o, 0, i), u = F / n, m = q(-(g / i) + 1, 0, 1);
|
|
874
|
+
this.onChange({
|
|
875
|
+
h: this.colors.hsv.h,
|
|
876
|
+
s: u,
|
|
877
|
+
v: m,
|
|
878
|
+
a: this.colors.hsv.a,
|
|
879
|
+
source: "hsva"
|
|
880
|
+
});
|
|
881
|
+
},
|
|
882
|
+
onChange(e) {
|
|
883
|
+
this.$emit("change", e);
|
|
884
|
+
},
|
|
885
|
+
handleMouseDown(e) {
|
|
886
|
+
window.addEventListener("mousemove", this.handleChange), window.addEventListener("mouseup", this.handleChange), window.addEventListener("mouseup", this.handleMouseUp);
|
|
887
|
+
},
|
|
888
|
+
handleMouseUp(e) {
|
|
889
|
+
this.unbindEventListeners();
|
|
890
|
+
},
|
|
891
|
+
unbindEventListeners() {
|
|
892
|
+
window.removeEventListener("mousemove", this.handleChange), window.removeEventListener("mouseup", this.handleChange), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
const Ge = /* @__PURE__ */ h(
|
|
897
|
+
"div",
|
|
898
|
+
{ class: "vc-saturation--white" },
|
|
899
|
+
null,
|
|
900
|
+
-1
|
|
901
|
+
/* HOISTED */
|
|
902
|
+
), qe = /* @__PURE__ */ h(
|
|
903
|
+
"div",
|
|
904
|
+
{ class: "vc-saturation--black" },
|
|
905
|
+
null,
|
|
906
|
+
-1
|
|
907
|
+
/* HOISTED */
|
|
908
|
+
), Ke = /* @__PURE__ */ h(
|
|
909
|
+
"div",
|
|
910
|
+
{ class: "vc-saturation-circle" },
|
|
911
|
+
null,
|
|
912
|
+
-1
|
|
913
|
+
/* HOISTED */
|
|
914
|
+
), Ze = [
|
|
915
|
+
Ke
|
|
916
|
+
];
|
|
917
|
+
function Je(e, t, r, n, i, a) {
|
|
918
|
+
return p(), f(
|
|
919
|
+
"div",
|
|
920
|
+
{
|
|
921
|
+
ref: "container",
|
|
922
|
+
class: "vc-saturation",
|
|
923
|
+
style: x({ background: a.bgColor }),
|
|
924
|
+
onMousedown: t[0] || (t[0] = (...o) => a.handleMouseDown && a.handleMouseDown(...o)),
|
|
925
|
+
onTouchmove: t[1] || (t[1] = (...o) => a.handleChange && a.handleChange(...o)),
|
|
926
|
+
onTouchstart: t[2] || (t[2] = (...o) => a.handleChange && a.handleChange(...o))
|
|
927
|
+
},
|
|
928
|
+
[
|
|
929
|
+
Ge,
|
|
930
|
+
qe,
|
|
931
|
+
h(
|
|
932
|
+
"div",
|
|
933
|
+
{
|
|
934
|
+
class: "vc-saturation-pointer",
|
|
935
|
+
style: x({ top: a.pointerTop, left: a.pointerLeft })
|
|
936
|
+
},
|
|
937
|
+
Ze,
|
|
938
|
+
4
|
|
939
|
+
/* STYLE */
|
|
940
|
+
)
|
|
941
|
+
],
|
|
942
|
+
36
|
|
943
|
+
/* STYLE, HYDRATE_EVENTS */
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
var Qe = ".vc-saturation,.vc-saturation--black,.vc-saturation--white{bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0}.vc-saturation--white{background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.vc-saturation--black{background:linear-gradient(0deg,#000,transparent)}.vc-saturation-pointer{cursor:pointer;position:absolute}.vc-saturation-circle{border-radius:50%;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px rgba(0,0,0,.3),0 0 1px 2px rgba(0,0,0,.4);cursor:head;height:4px;transform:translate(-2px,-2px);width:4px}";
|
|
947
|
+
B(Qe);
|
|
948
|
+
O.render = Je;
|
|
949
|
+
O.__file = "src/components/saturation/saturation.vue";
|
|
950
|
+
O.install = _;
|
|
951
|
+
var z = {
|
|
952
|
+
name: "Hue",
|
|
953
|
+
props: {
|
|
954
|
+
value: Object,
|
|
955
|
+
direction: {
|
|
956
|
+
type: String,
|
|
957
|
+
// [horizontal | vertical]
|
|
958
|
+
default: "horizontal"
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
data() {
|
|
962
|
+
return {
|
|
963
|
+
oldHue: 0,
|
|
964
|
+
pullDirection: ""
|
|
965
|
+
};
|
|
966
|
+
},
|
|
967
|
+
computed: {
|
|
968
|
+
colors() {
|
|
969
|
+
return this.value;
|
|
970
|
+
},
|
|
971
|
+
directionClass() {
|
|
972
|
+
return {
|
|
973
|
+
"vc-hue--horizontal": this.direction === "horizontal",
|
|
974
|
+
"vc-hue--vertical": this.direction === "vertical"
|
|
975
|
+
};
|
|
976
|
+
},
|
|
977
|
+
pointerTop() {
|
|
978
|
+
return this.direction === "vertical" ? this.colors.hsl.h === 0 && this.pullDirection === "right" ? 0 : `${-(this.colors.hsl.h * 100 / 360) + 100}%` : 0;
|
|
979
|
+
},
|
|
980
|
+
pointerLeft() {
|
|
981
|
+
return this.direction === "vertical" ? 0 : this.colors.hsl.h === 0 && this.pullDirection === "right" ? "100%" : `${this.colors.hsl.h * 100 / 360}%`;
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
watch: {
|
|
985
|
+
value: {
|
|
986
|
+
handler(e, t) {
|
|
987
|
+
const { h: r } = e.hsl;
|
|
988
|
+
r !== 0 && r - this.oldHue > 0 && (this.pullDirection = "right"), r !== 0 && r - this.oldHue < 0 && (this.pullDirection = "left"), this.oldHue = r;
|
|
989
|
+
},
|
|
990
|
+
deep: !0,
|
|
991
|
+
immediate: !0
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
methods: {
|
|
995
|
+
handleChange(e, t) {
|
|
996
|
+
!t && e.preventDefault();
|
|
997
|
+
const { container: r } = this.$refs;
|
|
998
|
+
if (!r)
|
|
999
|
+
return;
|
|
1000
|
+
const n = r.clientWidth, i = r.clientHeight, a = r.getBoundingClientRect().left + window.pageXOffset, o = r.getBoundingClientRect().top + window.pageYOffset, s = e.pageX || (e.touches ? e.touches[0].pageX : 0), c = e.pageY || (e.touches ? e.touches[0].pageY : 0), F = s - a, g = c - o;
|
|
1001
|
+
let u, m;
|
|
1002
|
+
this.direction === "vertical" ? (g < 0 ? u = 360 : g > i ? u = 0 : (m = -(g * 100 / i) + 100, u = 360 * m / 100), this.colors.hsl.h !== u && this.$emit("change", {
|
|
1003
|
+
h: u,
|
|
1004
|
+
s: this.colors.hsl.s,
|
|
1005
|
+
l: this.colors.hsl.l,
|
|
1006
|
+
a: this.colors.hsl.a,
|
|
1007
|
+
source: "hsl"
|
|
1008
|
+
})) : (F < 0 ? u = 0 : F > n ? u = 360 : (m = F * 100 / n, u = 360 * m / 100), this.colors.hsl.h !== u && this.$emit("change", {
|
|
1009
|
+
h: u,
|
|
1010
|
+
s: this.colors.hsl.s,
|
|
1011
|
+
l: this.colors.hsl.l,
|
|
1012
|
+
a: this.colors.hsl.a,
|
|
1013
|
+
source: "hsl"
|
|
1014
|
+
}));
|
|
1015
|
+
},
|
|
1016
|
+
handleMouseDown(e) {
|
|
1017
|
+
this.handleChange(e, !0), window.addEventListener("mousemove", this.handleChange), window.addEventListener("mouseup", this.handleChange), window.addEventListener("mouseup", this.handleMouseUp);
|
|
1018
|
+
},
|
|
1019
|
+
handleMouseUp(e) {
|
|
1020
|
+
this.unbindEventListeners();
|
|
1021
|
+
},
|
|
1022
|
+
unbindEventListeners() {
|
|
1023
|
+
window.removeEventListener("mousemove", this.handleChange), window.removeEventListener("mouseup", this.handleChange), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
const et = ["aria-valuenow"], tt = /* @__PURE__ */ h(
|
|
1028
|
+
"div",
|
|
1029
|
+
{ class: "vc-hue-picker" },
|
|
1030
|
+
null,
|
|
1031
|
+
-1
|
|
1032
|
+
/* HOISTED */
|
|
1033
|
+
), rt = [
|
|
1034
|
+
tt
|
|
1035
|
+
];
|
|
1036
|
+
function nt(e, t, r, n, i, a) {
|
|
1037
|
+
return p(), f(
|
|
1038
|
+
"div",
|
|
1039
|
+
{
|
|
1040
|
+
class: le(["vc-hue", [a.directionClass]])
|
|
1041
|
+
},
|
|
1042
|
+
[
|
|
1043
|
+
h("div", {
|
|
1044
|
+
ref: "container",
|
|
1045
|
+
class: "vc-hue-container",
|
|
1046
|
+
role: "slider",
|
|
1047
|
+
"aria-valuenow": a.colors.hsl.h,
|
|
1048
|
+
"aria-valuemin": "0",
|
|
1049
|
+
"aria-valuemax": "360",
|
|
1050
|
+
onMousedown: t[0] || (t[0] = (...o) => a.handleMouseDown && a.handleMouseDown(...o)),
|
|
1051
|
+
onTouchmove: t[1] || (t[1] = (...o) => a.handleChange && a.handleChange(...o)),
|
|
1052
|
+
onTouchstart: t[2] || (t[2] = (...o) => a.handleChange && a.handleChange(...o))
|
|
1053
|
+
}, [
|
|
1054
|
+
h(
|
|
1055
|
+
"div",
|
|
1056
|
+
{
|
|
1057
|
+
class: "vc-hue-pointer",
|
|
1058
|
+
style: x({ top: a.pointerTop, left: a.pointerLeft }),
|
|
1059
|
+
role: "presentation"
|
|
1060
|
+
},
|
|
1061
|
+
rt,
|
|
1062
|
+
4
|
|
1063
|
+
/* STYLE */
|
|
1064
|
+
)
|
|
1065
|
+
], 40, et)
|
|
1066
|
+
],
|
|
1067
|
+
2
|
|
1068
|
+
/* CLASS */
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
var at = ".vc-hue{border-radius:2px;bottom:0;left:0;position:absolute;right:0;top:0}.vc-hue--horizontal{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue--vertical{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue-container{cursor:pointer;height:100%;margin:0 2px;position:relative}.vc-hue-pointer{position:absolute;z-index:2}.vc-hue-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}";
|
|
1072
|
+
B(at);
|
|
1073
|
+
z.render = nt;
|
|
1074
|
+
z.__file = "src/components/hue/hue.vue";
|
|
1075
|
+
z.install = _;
|
|
1076
|
+
const it = [
|
|
1077
|
+
"#D0021B",
|
|
1078
|
+
"#F5A623",
|
|
1079
|
+
"#F8E71C",
|
|
1080
|
+
"#8B572A",
|
|
1081
|
+
"#7ED321",
|
|
1082
|
+
"#417505",
|
|
1083
|
+
"#BD10E0",
|
|
1084
|
+
"#9013FE",
|
|
1085
|
+
"#4A90E2",
|
|
1086
|
+
"#50E3C2",
|
|
1087
|
+
"#B8E986",
|
|
1088
|
+
"#000000",
|
|
1089
|
+
"#4A4A4A",
|
|
1090
|
+
"#9B9B9B",
|
|
1091
|
+
"#FFFFFF",
|
|
1092
|
+
"rgba(0,0,0,0)"
|
|
1093
|
+
];
|
|
1094
|
+
var U = {
|
|
1095
|
+
name: "Sketch",
|
|
1096
|
+
components: {
|
|
1097
|
+
Saturation: O,
|
|
1098
|
+
Hue: z,
|
|
1099
|
+
Alpha: I,
|
|
1100
|
+
EdIn: N,
|
|
1101
|
+
Checkboard: H
|
|
1102
|
+
},
|
|
1103
|
+
mixins: [Ue],
|
|
1104
|
+
props: {
|
|
1105
|
+
presetColors: {
|
|
1106
|
+
type: Array,
|
|
1107
|
+
default() {
|
|
1108
|
+
return it;
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
disableAlpha: {
|
|
1112
|
+
type: Boolean,
|
|
1113
|
+
default: !1
|
|
1114
|
+
},
|
|
1115
|
+
disableFields: {
|
|
1116
|
+
type: Boolean,
|
|
1117
|
+
default: !1
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
computed: {
|
|
1121
|
+
hex() {
|
|
1122
|
+
let e;
|
|
1123
|
+
return this.colors.a < 1 ? e = this.colors.hex8 : e = this.colors.hex, e.replace("#", "");
|
|
1124
|
+
},
|
|
1125
|
+
activeColor() {
|
|
1126
|
+
const { rgba: e } = this.colors;
|
|
1127
|
+
return `rgba(${[e.r, e.g, e.b, e.a].join(",")})`;
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
methods: {
|
|
1131
|
+
handlePreset(e) {
|
|
1132
|
+
this.colorChange(e);
|
|
1133
|
+
},
|
|
1134
|
+
childChange(e) {
|
|
1135
|
+
this.colorChange(e);
|
|
1136
|
+
},
|
|
1137
|
+
inputChange(e) {
|
|
1138
|
+
e && (e.hex ? this.isValidHex(e.hex) && this.colorChange({
|
|
1139
|
+
hex: e.hex,
|
|
1140
|
+
source: "hex"
|
|
1141
|
+
}) : (e.r || e.g || e.b || e.a) && this.colorChange({
|
|
1142
|
+
r: e.r || this.colors.rgba.r,
|
|
1143
|
+
g: e.g || this.colors.rgba.g,
|
|
1144
|
+
b: e.b || this.colors.rgba.b,
|
|
1145
|
+
a: e.a || this.colors.rgba.a,
|
|
1146
|
+
source: "rgba"
|
|
1147
|
+
}));
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
const ot = { class: "vc-sketch-saturation-wrap" }, st = { class: "vc-sketch-controls" }, lt = { class: "vc-sketch-sliders" }, ht = { class: "vc-sketch-hue-wrap" }, ct = {
|
|
1152
|
+
key: 0,
|
|
1153
|
+
class: "vc-sketch-alpha-wrap"
|
|
1154
|
+
}, ut = { class: "vc-sketch-color-wrap" }, dt = ["aria-label"], ft = {
|
|
1155
|
+
key: 0,
|
|
1156
|
+
class: "vc-sketch-field"
|
|
1157
|
+
}, pt = { class: "vc-sketch-field--double" }, gt = { class: "vc-sketch-field--single" }, vt = { class: "vc-sketch-field--single" }, Ft = { class: "vc-sketch-field--single" }, bt = {
|
|
1158
|
+
key: 0,
|
|
1159
|
+
class: "vc-sketch-field--single"
|
|
1160
|
+
}, mt = {
|
|
1161
|
+
class: "vc-sketch-presets",
|
|
1162
|
+
role: "group",
|
|
1163
|
+
"aria-label": "A color preset, pick one to set as current color"
|
|
1164
|
+
}, Ct = ["aria-label", "onClick"], xt = ["aria-label", "onClick"];
|
|
1165
|
+
function Et(e, t, r, n, i, a) {
|
|
1166
|
+
const o = D("Saturation"), s = D("Hue"), c = D("Alpha"), F = D("Checkboard"), g = D("EdIn");
|
|
1167
|
+
return p(), f(
|
|
1168
|
+
"div",
|
|
1169
|
+
{
|
|
1170
|
+
role: "application",
|
|
1171
|
+
"aria-label": "Sketch color picker",
|
|
1172
|
+
class: le(["vc-sketch", [r.disableAlpha ? "vc-sketch__disable-alpha" : ""]])
|
|
1173
|
+
},
|
|
1174
|
+
[
|
|
1175
|
+
h("div", ot, [
|
|
1176
|
+
C(o, {
|
|
1177
|
+
value: e.colors,
|
|
1178
|
+
onChange: a.childChange
|
|
1179
|
+
}, null, 8, ["value", "onChange"])
|
|
1180
|
+
]),
|
|
1181
|
+
h("div", st, [
|
|
1182
|
+
h("div", lt, [
|
|
1183
|
+
h("div", ht, [
|
|
1184
|
+
C(s, {
|
|
1185
|
+
value: e.colors,
|
|
1186
|
+
onChange: a.childChange
|
|
1187
|
+
}, null, 8, ["value", "onChange"])
|
|
1188
|
+
]),
|
|
1189
|
+
r.disableAlpha ? S("v-if", !0) : (p(), f("div", ct, [
|
|
1190
|
+
C(c, {
|
|
1191
|
+
value: e.colors,
|
|
1192
|
+
onChange: a.childChange
|
|
1193
|
+
}, null, 8, ["value", "onChange"])
|
|
1194
|
+
]))
|
|
1195
|
+
]),
|
|
1196
|
+
h("div", ut, [
|
|
1197
|
+
h("div", {
|
|
1198
|
+
"aria-label": `Current color is ${a.activeColor}`,
|
|
1199
|
+
class: "vc-sketch-active-color",
|
|
1200
|
+
style: x({ background: a.activeColor })
|
|
1201
|
+
}, null, 12, dt),
|
|
1202
|
+
C(F)
|
|
1203
|
+
])
|
|
1204
|
+
]),
|
|
1205
|
+
r.disableFields ? S("v-if", !0) : (p(), f("div", ft, [
|
|
1206
|
+
S(" rgba "),
|
|
1207
|
+
h("div", pt, [
|
|
1208
|
+
C(g, {
|
|
1209
|
+
label: "hex",
|
|
1210
|
+
value: a.hex,
|
|
1211
|
+
onChange: a.inputChange
|
|
1212
|
+
}, null, 8, ["value", "onChange"])
|
|
1213
|
+
]),
|
|
1214
|
+
h("div", gt, [
|
|
1215
|
+
C(g, {
|
|
1216
|
+
label: "r",
|
|
1217
|
+
value: e.colors.rgba.r,
|
|
1218
|
+
onChange: a.inputChange
|
|
1219
|
+
}, null, 8, ["value", "onChange"])
|
|
1220
|
+
]),
|
|
1221
|
+
h("div", vt, [
|
|
1222
|
+
C(g, {
|
|
1223
|
+
label: "g",
|
|
1224
|
+
value: e.colors.rgba.g,
|
|
1225
|
+
onChange: a.inputChange
|
|
1226
|
+
}, null, 8, ["value", "onChange"])
|
|
1227
|
+
]),
|
|
1228
|
+
h("div", Ft, [
|
|
1229
|
+
C(g, {
|
|
1230
|
+
label: "b",
|
|
1231
|
+
value: e.colors.rgba.b,
|
|
1232
|
+
onChange: a.inputChange
|
|
1233
|
+
}, null, 8, ["value", "onChange"])
|
|
1234
|
+
]),
|
|
1235
|
+
r.disableAlpha ? S("v-if", !0) : (p(), f("div", bt, [
|
|
1236
|
+
C(g, {
|
|
1237
|
+
label: "a",
|
|
1238
|
+
value: e.colors.a,
|
|
1239
|
+
"arrow-offset": 0.01,
|
|
1240
|
+
max: 1,
|
|
1241
|
+
onChange: a.inputChange
|
|
1242
|
+
}, null, 8, ["value", "arrow-offset", "onChange"])
|
|
1243
|
+
]))
|
|
1244
|
+
])),
|
|
1245
|
+
h("div", mt, [
|
|
1246
|
+
(p(!0), f(
|
|
1247
|
+
Z,
|
|
1248
|
+
null,
|
|
1249
|
+
he(r.presetColors, (u) => (p(), f(
|
|
1250
|
+
Z,
|
|
1251
|
+
null,
|
|
1252
|
+
[
|
|
1253
|
+
e.isTransparent(u) ? (p(), f("div", {
|
|
1254
|
+
key: u,
|
|
1255
|
+
"aria-label": `Color:${u}`,
|
|
1256
|
+
class: "vc-sketch-presets-color",
|
|
1257
|
+
onClick: (m) => a.handlePreset(u)
|
|
1258
|
+
}, [
|
|
1259
|
+
C(F)
|
|
1260
|
+
], 8, xt)) : (p(), f("div", {
|
|
1261
|
+
key: `!${u}`,
|
|
1262
|
+
class: "vc-sketch-presets-color",
|
|
1263
|
+
"aria-label": `Color:${u}`,
|
|
1264
|
+
style: x({ background: u }),
|
|
1265
|
+
onClick: (m) => a.handlePreset(u)
|
|
1266
|
+
}, null, 12, Ct))
|
|
1267
|
+
],
|
|
1268
|
+
64
|
|
1269
|
+
/* STABLE_FRAGMENT */
|
|
1270
|
+
))),
|
|
1271
|
+
256
|
|
1272
|
+
/* UNKEYED_FRAGMENT */
|
|
1273
|
+
))
|
|
1274
|
+
])
|
|
1275
|
+
],
|
|
1276
|
+
2
|
|
1277
|
+
/* CLASS */
|
|
1278
|
+
);
|
|
1279
|
+
}
|
|
1280
|
+
var wt = ".vc-sketch{background:#fff;border-radius:4px;box-shadow:0 0 0 1px rgba(0,0,0,.15),0 8px 16px rgba(0,0,0,.15);box-sizing:initial;padding:10px 10px 0;position:relative;width:200px}.vc-sketch-saturation-wrap{overflow:hidden;padding-bottom:75%;position:relative;width:100%}.vc-sketch-controls{display:flex}.vc-sketch-sliders{flex:1;padding:4px 0}.vc-sketch-sliders .vc-alpha-gradient,.vc-sketch-sliders .vc-hue{border-radius:2px}.vc-sketch-alpha-wrap,.vc-sketch-hue-wrap{height:10px;position:relative}.vc-sketch-alpha-wrap{margin-top:4px;overflow:hidden}.vc-sketch-color-wrap{border-radius:3px;height:24px;margin-left:4px;margin-top:4px;position:relative;width:24px}.vc-sketch-active-color{border-radius:2px;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),inset 0 0 4px rgba(0,0,0,.25);left:0;position:absolute;right:0;top:0;z-index:2}.vc-sketch-color-wrap .vc-checkerboard{background-size:auto}.vc-sketch-field{display:flex;padding-top:4px}.vc-sketch-field .vc-input__input{border:none;box-shadow:inset 0 0 0 1px #ccc;font-size:10px;padding:4px 0 3px 10%;width:90%}.vc-sketch-field .vc-input__label{color:#222;display:block;font-size:11px;padding-bottom:4px;padding-top:3px;text-align:center;text-transform:capitalize}.vc-sketch-field--single{flex:1;padding-left:6px}.vc-sketch-field--double{flex:2}.vc-sketch-presets{border-top:1px solid #eee;margin-left:-10px;margin-right:-10px;padding-left:10px;padding-top:10px}.vc-sketch-presets-color{cursor:pointer;display:inline-block;height:16px;margin:0 10px 10px 0;overflow:hidden;position:relative;vertical-align:top;width:16px}.vc-sketch-presets-color,.vc-sketch-presets-color .vc-checkerboard{border-radius:3px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}.vc-sketch__disable-alpha .vc-sketch-color-wrap{height:10px}";
|
|
1281
|
+
B(wt);
|
|
1282
|
+
U.render = Et;
|
|
1283
|
+
U.__file = "src/components/sketch/sketch.vue";
|
|
1284
|
+
U.install = _;
|
|
1285
|
+
const se = [
|
|
3
1286
|
"#ffffff",
|
|
4
1287
|
"#f5f5f5",
|
|
5
1288
|
"#d9d9d9",
|
|
@@ -144,7 +1427,7 @@ const L = [
|
|
|
144
1427
|
"#FF2056",
|
|
145
1428
|
"#EC253F",
|
|
146
1429
|
"#C71D36"
|
|
147
|
-
],
|
|
1430
|
+
], kt = {
|
|
148
1431
|
"#ffffff": "纯白",
|
|
149
1432
|
"#f5f5f5": "浅灰",
|
|
150
1433
|
"#d9d9d9": "中灰",
|
|
@@ -289,7 +1572,7 @@ const L = [
|
|
|
289
1572
|
"#FF2056": "深红",
|
|
290
1573
|
"#EC253F": "深红1",
|
|
291
1574
|
"#C71D36": "深红2"
|
|
292
|
-
},
|
|
1575
|
+
}, yt = [
|
|
293
1576
|
"#ffffff",
|
|
294
1577
|
"#f5f5f5",
|
|
295
1578
|
"#eeeeee",
|
|
@@ -306,7 +1589,7 @@ const L = [
|
|
|
306
1589
|
"#262626",
|
|
307
1590
|
"#1a1a1a",
|
|
308
1591
|
"#000000"
|
|
309
|
-
],
|
|
1592
|
+
], At = {
|
|
310
1593
|
"#ffffff": "纯白",
|
|
311
1594
|
"#f5f5f5": "浅灰",
|
|
312
1595
|
"#eeeeee": "极浅灰",
|
|
@@ -323,7 +1606,7 @@ const L = [
|
|
|
323
1606
|
"#262626": "深灰",
|
|
324
1607
|
"#1a1a1a": "近黑",
|
|
325
1608
|
"#000000": "纯黑"
|
|
326
|
-
},
|
|
1609
|
+
}, Dt = [
|
|
327
1610
|
"#FB2C36",
|
|
328
1611
|
"#FF692A",
|
|
329
1612
|
"#FE9A37",
|
|
@@ -340,7 +1623,7 @@ const L = [
|
|
|
340
1623
|
"#AD46FF",
|
|
341
1624
|
"#E12AFB",
|
|
342
1625
|
"#F6339A"
|
|
343
|
-
],
|
|
1626
|
+
], Bt = {
|
|
344
1627
|
"#FB2C36": "鲜红",
|
|
345
1628
|
"#FF692A": "橙红",
|
|
346
1629
|
"#FE9A37": "深黄",
|
|
@@ -357,52 +1640,75 @@ const L = [
|
|
|
357
1640
|
"#AD46FF": "深紫1",
|
|
358
1641
|
"#E12AFB": "深粉紫",
|
|
359
1642
|
"#F6339A": "深粉红"
|
|
360
|
-
},
|
|
361
|
-
const
|
|
362
|
-
for (const [
|
|
363
|
-
|
|
364
|
-
return
|
|
365
|
-
},
|
|
1643
|
+
}, _t = () => '<svg t="1760602465263" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1846" width="16" height="16"><path d="M512 704c8.288 0 15.776-3.232 21.456-8.4l0.064 0.08 352-320-0.08-0.08c6.448-5.856 10.56-14.208 10.56-23.6a32 32 0 0 0-32-32c-8.288 0-15.76 3.232-21.456 8.4l-0.08-0.08L512 628.752 181.536 328.32l-0.08 0.08A31.776 31.776 0 0 0 160 320a32 32 0 0 0-32 32c0 9.376 4.112 17.744 10.544 23.6l-0.08 0.08 352 320 0.08-0.08c5.68 5.168 13.168 8.4 21.456 8.4z" p-id="1847"></path></svg>', Mt = (e, t) => {
|
|
1644
|
+
const r = e.__vccOpts || e;
|
|
1645
|
+
for (const [n, i] of t)
|
|
1646
|
+
r[n] = i;
|
|
1647
|
+
return r;
|
|
1648
|
+
}, St = { class: "ssc-color" }, Ht = { class: "label" }, Tt = ["innerHTML"], Rt = {
|
|
1649
|
+
key: 0,
|
|
1650
|
+
class: "grid"
|
|
1651
|
+
}, $t = ["onClick"], Lt = {
|
|
1652
|
+
key: 1,
|
|
1653
|
+
class: "custom-palette"
|
|
1654
|
+
}, It = {
|
|
366
1655
|
__name: "ColorPicker",
|
|
367
1656
|
props: {
|
|
368
1657
|
type: { type: String, default: "colorAll" },
|
|
369
|
-
// colorAll colorOne colorTwo
|
|
1658
|
+
// colorAll colorOne colorTwo customPalette
|
|
370
1659
|
color: { type: String, default: "" },
|
|
371
1660
|
width: { type: String, default: "100%" },
|
|
372
1661
|
height: { type: String, default: "auto" }
|
|
373
1662
|
},
|
|
374
|
-
emits: ["change"],
|
|
375
|
-
setup(
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
1663
|
+
emits: ["change", "update:color"],
|
|
1664
|
+
setup(e, { emit: t }) {
|
|
1665
|
+
const r = e, n = t, i = V(!1), a = T(() => r.type === "customPalette"), o = T(() => a.value ? se : r.type === "colorOne" ? yt : r.type === "colorTwo" ? Dt : se), s = T(() => a.value ? {} : r.type === "colorOne" ? At : r.type === "colorTwo" ? Bt : kt), c = V(""), F = V("#1677ff");
|
|
1666
|
+
let g = !1;
|
|
1667
|
+
R(() => r.color, (l) => {
|
|
1668
|
+
var d;
|
|
1669
|
+
typeof l == "string" && l !== c.value && (c.value = l || ((d = o.value) == null ? void 0 : d[0]) || "#000000");
|
|
380
1670
|
});
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
1671
|
+
const u = T(() => a.value ? "" : s.value[c.value] || "自定义"), m = (l) => {
|
|
1672
|
+
a.value && (g = !0, F.value = l, ve(() => {
|
|
1673
|
+
g = !1;
|
|
1674
|
+
}));
|
|
1675
|
+
};
|
|
1676
|
+
te(() => {
|
|
1677
|
+
var l;
|
|
1678
|
+
if (r.color)
|
|
1679
|
+
c.value = r.color;
|
|
386
1680
|
else {
|
|
387
|
-
const
|
|
388
|
-
|
|
1681
|
+
const d = ((l = o.value) == null ? void 0 : l[0]) || "#000000";
|
|
1682
|
+
c.value = d;
|
|
389
1683
|
}
|
|
1684
|
+
a.value && m(c.value);
|
|
1685
|
+
}), R(c, (l) => {
|
|
1686
|
+
a.value && m(l);
|
|
1687
|
+
}), R(a, (l) => {
|
|
1688
|
+
l && m(c.value);
|
|
1689
|
+
}), R(F, (l) => {
|
|
1690
|
+
if (!a.value || g) return;
|
|
1691
|
+
const d = typeof l == "string" ? l : l == null ? void 0 : l.hex;
|
|
1692
|
+
d && Q(ue(d), !1);
|
|
390
1693
|
});
|
|
391
|
-
function
|
|
392
|
-
|
|
1694
|
+
function ue(l) {
|
|
1695
|
+
return typeof l != "string" ? "" : (l.startsWith("#") ? l : `#${l}`).slice(0, 7);
|
|
1696
|
+
}
|
|
1697
|
+
function Q(l, d = !0) {
|
|
1698
|
+
c.value = l, d && (i.value = !1), n("change", l), n("update:color", l);
|
|
393
1699
|
}
|
|
394
|
-
function
|
|
395
|
-
|
|
1700
|
+
function de() {
|
|
1701
|
+
i.value = !i.value;
|
|
396
1702
|
}
|
|
397
|
-
const
|
|
398
|
-
|
|
1703
|
+
const ee = () => {
|
|
1704
|
+
i.value = !1;
|
|
399
1705
|
};
|
|
400
|
-
return
|
|
401
|
-
document.addEventListener("click",
|
|
402
|
-
const
|
|
403
|
-
if (!document.getElementById(
|
|
404
|
-
const
|
|
405
|
-
|
|
1706
|
+
return te(() => {
|
|
1707
|
+
document.addEventListener("click", ee);
|
|
1708
|
+
const l = "sun-select-color-style";
|
|
1709
|
+
if (!document.getElementById(l)) {
|
|
1710
|
+
const d = document.createElement("style");
|
|
1711
|
+
d.id = l, d.textContent = `
|
|
406
1712
|
.ssc-color .select{position:relative;width:100%;min-width:200px;height:32px;display:flex;align-items:center;border:1px solid #e0e0ff;border-radius:6px;padding:0 12px;cursor:pointer;box-shadow:0 1px 0 rgba(0,0,0,0.02);font-size:14px}
|
|
407
1713
|
.ssc-color .select:hover{border-color:#4096ff}
|
|
408
1714
|
.ssc-color .swatch{width:16px;height:16px;border-radius:4px;border:1px solid #e0e0e0;margin-right:8px}
|
|
@@ -414,52 +1720,63 @@ const L = [
|
|
|
414
1720
|
.ssc-color .panel::-webkit-scrollbar-track{background:transparent}
|
|
415
1721
|
.ssc-color .grid{display:grid;grid-template-columns:repeat(8,1fr);gap:6px}
|
|
416
1722
|
.ssc-color .chip{width:100%;height:26px;border-radius:6px;border:1px solid #fff;cursor:pointer;display:inline-block}
|
|
417
|
-
|
|
1723
|
+
.ssc-color .custom-palette{width:100%}
|
|
1724
|
+
.ssc-color .custom-palette .vc-sketch{width:100%}
|
|
1725
|
+
`, document.head.appendChild(d);
|
|
418
1726
|
}
|
|
419
|
-
}),
|
|
420
|
-
|
|
1727
|
+
}), ge(() => document.removeEventListener("click", ee)), (l, d) => (p(), f("div", St, [
|
|
1728
|
+
h("div", {
|
|
421
1729
|
class: "select",
|
|
422
|
-
onClick:
|
|
423
|
-
style:
|
|
424
|
-
width:
|
|
1730
|
+
onClick: P(de, ["stop"]),
|
|
1731
|
+
style: x({
|
|
1732
|
+
width: r.width
|
|
425
1733
|
})
|
|
426
1734
|
}, [
|
|
427
|
-
|
|
1735
|
+
h("span", {
|
|
428
1736
|
class: "swatch",
|
|
429
|
-
style:
|
|
1737
|
+
style: x({ backgroundColor: c.value })
|
|
430
1738
|
}, null, 4),
|
|
431
|
-
|
|
432
|
-
|
|
1739
|
+
h("span", Ht, K(u.value), 1),
|
|
1740
|
+
h("div", {
|
|
433
1741
|
class: "arrow",
|
|
434
|
-
innerHTML:
|
|
435
|
-
}, null, 8,
|
|
436
|
-
|
|
1742
|
+
innerHTML: re(_t)()
|
|
1743
|
+
}, null, 8, Tt),
|
|
1744
|
+
i.value ? (p(), f("div", {
|
|
437
1745
|
key: 0,
|
|
438
1746
|
class: "panel",
|
|
439
|
-
style:
|
|
440
|
-
height:
|
|
441
|
-
})
|
|
1747
|
+
style: x({
|
|
1748
|
+
height: a.value ? "auto" : r.height
|
|
1749
|
+
}),
|
|
1750
|
+
onClick: d[1] || (d[1] = P(() => {
|
|
1751
|
+
}, ["stop"]))
|
|
442
1752
|
}, [
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
1753
|
+
a.value ? (p(), f("div", Lt, [
|
|
1754
|
+
C(re(U), {
|
|
1755
|
+
modelValue: F.value,
|
|
1756
|
+
"onUpdate:modelValue": d[0] || (d[0] = (M) => F.value = M),
|
|
1757
|
+
class: "custom-component",
|
|
1758
|
+
"disable-alpha": !0
|
|
1759
|
+
}, null, 8, ["modelValue"])
|
|
1760
|
+
])) : (p(), f("div", Rt, [
|
|
1761
|
+
(p(!0), f(Z, null, he(o.value, (M) => (p(), f("span", {
|
|
1762
|
+
key: M,
|
|
446
1763
|
class: "chip",
|
|
447
|
-
style:
|
|
448
|
-
onClick:
|
|
449
|
-
}, null, 12, $))), 128))
|
|
450
|
-
])
|
|
451
|
-
], 4)) :
|
|
1764
|
+
style: x({ backgroundColor: M }),
|
|
1765
|
+
onClick: P((Ot) => Q(M), ["stop"])
|
|
1766
|
+
}, null, 12, $t))), 128))
|
|
1767
|
+
]))
|
|
1768
|
+
], 4)) : S("", !0)
|
|
452
1769
|
], 4)
|
|
453
1770
|
]));
|
|
454
1771
|
}
|
|
455
|
-
},
|
|
456
|
-
install(
|
|
457
|
-
const
|
|
458
|
-
|
|
1772
|
+
}, Nt = /* @__PURE__ */ Mt(It, [["__scopeId", "data-v-6b4fe802"]]), Ut = {
|
|
1773
|
+
install(e, t = {}) {
|
|
1774
|
+
const r = t.prefix || "";
|
|
1775
|
+
e.component(`${r}ColorPicker`, Nt);
|
|
459
1776
|
}
|
|
460
1777
|
};
|
|
461
1778
|
export {
|
|
462
|
-
|
|
463
|
-
|
|
1779
|
+
Nt as ColorPicker,
|
|
1780
|
+
Ut as default
|
|
464
1781
|
};
|
|
465
1782
|
//# sourceMappingURL=sun-select-color.es.js.map
|