@packyoung98/vcolor 0.0.2 → 0.0.3
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/dist/vcolor.css +2 -0
- package/dist/vcolor.js +1447 -0
- package/dist/vcolor.umd.cjs +1 -0
- package/package.json +1 -1
- package/dist/assets/index-B8OYYKxS.js +0 -1
- package/dist/assets/index-akQVHDRD.css +0 -1
- package/dist/index.html +0 -14
package/dist/vcolor.js
ADDED
|
@@ -0,0 +1,1447 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, mergeModels as c, nextTick as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, openBlock as p, readonly as m, ref as h, renderList as g, toDisplayString as _, unref as v, useModel as y, vModelText as ee, vShow as b, watch as x, withDirectives as S, withKeys as C } from "vue";
|
|
2
|
+
//#region src/utils/convert.ts
|
|
3
|
+
function w(e) {
|
|
4
|
+
return (e % 360 + 360) % 360;
|
|
5
|
+
}
|
|
6
|
+
function T(e, t, n) {
|
|
7
|
+
return Math.min(n, Math.max(t, e));
|
|
8
|
+
}
|
|
9
|
+
function E({ h: e, s: t, v: n, a: r }) {
|
|
10
|
+
e = w(e), t = T(t, 0, 100) / 100, n = T(n, 0, 100) / 100;
|
|
11
|
+
let i = n * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i, s = 0, c = 0, l = 0;
|
|
12
|
+
return e < 60 ? [s, c, l] = [
|
|
13
|
+
i,
|
|
14
|
+
a,
|
|
15
|
+
0
|
|
16
|
+
] : e < 120 ? [s, c, l] = [
|
|
17
|
+
a,
|
|
18
|
+
i,
|
|
19
|
+
0
|
|
20
|
+
] : e < 180 ? [s, c, l] = [
|
|
21
|
+
0,
|
|
22
|
+
i,
|
|
23
|
+
a
|
|
24
|
+
] : e < 240 ? [s, c, l] = [
|
|
25
|
+
0,
|
|
26
|
+
a,
|
|
27
|
+
i
|
|
28
|
+
] : e < 300 ? [s, c, l] = [
|
|
29
|
+
a,
|
|
30
|
+
0,
|
|
31
|
+
i
|
|
32
|
+
] : [s, c, l] = [
|
|
33
|
+
i,
|
|
34
|
+
0,
|
|
35
|
+
a
|
|
36
|
+
], {
|
|
37
|
+
r: Math.round((s + o) * 255),
|
|
38
|
+
g: Math.round((c + o) * 255),
|
|
39
|
+
b: Math.round((l + o) * 255),
|
|
40
|
+
a: r
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function D({ r: e, g: t, b: n, a: r }) {
|
|
44
|
+
e /= 255, t /= 255, n /= 255;
|
|
45
|
+
let i = Math.max(e, t, n), a = i - Math.min(e, t, n), o = 0;
|
|
46
|
+
a !== 0 && (o = i === e ? (t - n) / a % 6 : i === t ? (n - e) / a + 2 : (e - t) / a + 4, o = w(o * 60));
|
|
47
|
+
let s = i === 0 ? 0 : a / i, c = i;
|
|
48
|
+
return {
|
|
49
|
+
h: o,
|
|
50
|
+
s: s * 100,
|
|
51
|
+
v: c * 100,
|
|
52
|
+
a: r
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function O({ r: e, g: t, b: n, a: r }) {
|
|
56
|
+
e /= 255, t /= 255, n /= 255;
|
|
57
|
+
let i = Math.max(e, t, n), a = Math.min(e, t, n), o = i - a, s = 0;
|
|
58
|
+
o !== 0 && (s = i === e ? (t - n) / o % 6 : i === t ? (n - e) / o + 2 : (e - t) / o + 4, s = w(s * 60));
|
|
59
|
+
let c = (i + a) / 2, l = o === 0 ? 0 : o / (1 - Math.abs(2 * c - 1));
|
|
60
|
+
return {
|
|
61
|
+
h: s,
|
|
62
|
+
s: l * 100,
|
|
63
|
+
l: c * 100,
|
|
64
|
+
a: r
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function k({ h: e, s: t, l: n, a: r }) {
|
|
68
|
+
e = w(e), t = T(t, 0, 100) / 100, n = T(n, 0, 100) / 100;
|
|
69
|
+
let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s = 0, c = 0, l = 0;
|
|
70
|
+
return e < 60 ? [s, c, l] = [
|
|
71
|
+
i,
|
|
72
|
+
a,
|
|
73
|
+
0
|
|
74
|
+
] : e < 120 ? [s, c, l] = [
|
|
75
|
+
a,
|
|
76
|
+
i,
|
|
77
|
+
0
|
|
78
|
+
] : e < 180 ? [s, c, l] = [
|
|
79
|
+
0,
|
|
80
|
+
i,
|
|
81
|
+
a
|
|
82
|
+
] : e < 240 ? [s, c, l] = [
|
|
83
|
+
0,
|
|
84
|
+
a,
|
|
85
|
+
i
|
|
86
|
+
] : e < 300 ? [s, c, l] = [
|
|
87
|
+
a,
|
|
88
|
+
0,
|
|
89
|
+
i
|
|
90
|
+
] : [s, c, l] = [
|
|
91
|
+
i,
|
|
92
|
+
0,
|
|
93
|
+
a
|
|
94
|
+
], {
|
|
95
|
+
r: Math.round((s + o) * 255),
|
|
96
|
+
g: Math.round((c + o) * 255),
|
|
97
|
+
b: Math.round((l + o) * 255),
|
|
98
|
+
a: r
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function A({ r: e, g: t, b: n, a: r }) {
|
|
102
|
+
let i = (e) => T(Math.round(e), 0, 255).toString(16).padStart(2, "0"), a = `#${i(e)}${i(t)}${i(n)}`;
|
|
103
|
+
return r < 1 && (a += i(Math.round(r * 255))), a.toUpperCase();
|
|
104
|
+
}
|
|
105
|
+
function j(e) {
|
|
106
|
+
let t = e.trim().replace(/^#/, "");
|
|
107
|
+
(t.length === 3 || t.length === 4) && (t = t.split("").map((e) => e + e).join(""));
|
|
108
|
+
let n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), a = t.length === 8 ? parseInt(t.slice(6, 8), 16) / 255 : 1;
|
|
109
|
+
return {
|
|
110
|
+
r: Number.isNaN(n) ? 0 : n,
|
|
111
|
+
g: Number.isNaN(r) ? 0 : r,
|
|
112
|
+
b: Number.isNaN(i) ? 0 : i,
|
|
113
|
+
a: Number.isNaN(a) ? 1 : a
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/composables/useColor.ts
|
|
118
|
+
function M(e = "#000000") {
|
|
119
|
+
let n = h(D(j(e))), r = t(() => E(n.value)), i = t(() => O(r.value)), a = t(() => A(r.value));
|
|
120
|
+
function o(e) {
|
|
121
|
+
n.value = { ...e };
|
|
122
|
+
}
|
|
123
|
+
function s(e) {
|
|
124
|
+
n.value = D(e);
|
|
125
|
+
}
|
|
126
|
+
function c(e) {
|
|
127
|
+
n.value = D(k(e));
|
|
128
|
+
}
|
|
129
|
+
function l(e) {
|
|
130
|
+
n.value = D(j(e));
|
|
131
|
+
}
|
|
132
|
+
function u(e) {
|
|
133
|
+
n.value = {
|
|
134
|
+
...n.value,
|
|
135
|
+
h: e
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function d(e, t) {
|
|
139
|
+
n.value = {
|
|
140
|
+
...n.value,
|
|
141
|
+
s: e,
|
|
142
|
+
v: t
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function f(e) {
|
|
146
|
+
n.value = {
|
|
147
|
+
...n.value,
|
|
148
|
+
a: e
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
hsva: n,
|
|
153
|
+
rgba: r,
|
|
154
|
+
hsla: i,
|
|
155
|
+
hex: a,
|
|
156
|
+
setFromHsva: o,
|
|
157
|
+
setFromRgba: s,
|
|
158
|
+
setFromHsla: c,
|
|
159
|
+
setFromHex: l,
|
|
160
|
+
setHue: u,
|
|
161
|
+
setSaturation: d,
|
|
162
|
+
setAlpha: f
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/utils/format.ts
|
|
167
|
+
function N(e, t, n = !1) {
|
|
168
|
+
let r = n ? 1 : e.a, i = E({
|
|
169
|
+
...e,
|
|
170
|
+
a: r
|
|
171
|
+
});
|
|
172
|
+
if (t === "rgb") return i;
|
|
173
|
+
if (t === "hsl") {
|
|
174
|
+
let e = O(i);
|
|
175
|
+
return {
|
|
176
|
+
h: Math.round(e.h),
|
|
177
|
+
s: Math.round(e.s),
|
|
178
|
+
l: Math.round(e.l),
|
|
179
|
+
a: e.a
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return A(i);
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/composables/usePicker.ts
|
|
186
|
+
function P(e, t) {
|
|
187
|
+
t != null && (typeof t == "string" ? e.setFromHex(t) : "v" in t ? e.setFromHsva(t) : "l" in t ? e.setFromHsla(t) : e.setFromRgba(t));
|
|
188
|
+
}
|
|
189
|
+
function F(e, t, n, r) {
|
|
190
|
+
let i = M(typeof e.value == "string" ? e.value : "#FF5733");
|
|
191
|
+
P(i, e.value);
|
|
192
|
+
function a() {
|
|
193
|
+
return N(i.hsva.value, n(), r());
|
|
194
|
+
}
|
|
195
|
+
x(e, (e) => {
|
|
196
|
+
JSON.stringify(e) !== JSON.stringify(a()) && P(i, e);
|
|
197
|
+
});
|
|
198
|
+
function o() {
|
|
199
|
+
let n = a();
|
|
200
|
+
e.value = n, t("input", n);
|
|
201
|
+
}
|
|
202
|
+
function s() {
|
|
203
|
+
let n = a();
|
|
204
|
+
e.value = n, t("change", n);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
...i,
|
|
208
|
+
output: a,
|
|
209
|
+
input: o,
|
|
210
|
+
change: s
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/composables/useEyeDropper.ts
|
|
215
|
+
function I() {
|
|
216
|
+
let e = h(typeof window < "u" && "EyeDropper" in window), t = h("");
|
|
217
|
+
async function n() {
|
|
218
|
+
if (!e.value || !window.EyeDropper) return null;
|
|
219
|
+
try {
|
|
220
|
+
let e = await new window.EyeDropper().open();
|
|
221
|
+
return t.value = e.sRGBHex, e.sRGBHex;
|
|
222
|
+
} catch {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
isSupported: e,
|
|
228
|
+
sRGBHex: t,
|
|
229
|
+
open: n
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/composables/useDrag.ts
|
|
234
|
+
function L(e) {
|
|
235
|
+
return Math.min(1, Math.max(0, e));
|
|
236
|
+
}
|
|
237
|
+
function R(e, t) {
|
|
238
|
+
let n = h(null);
|
|
239
|
+
function r(t) {
|
|
240
|
+
let r = n.value;
|
|
241
|
+
if (!r) return;
|
|
242
|
+
let i = r.getBoundingClientRect();
|
|
243
|
+
e(L((t.clientX - i.left) / i.width), L((t.clientY - i.top) / i.height));
|
|
244
|
+
}
|
|
245
|
+
function i() {
|
|
246
|
+
window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), t?.();
|
|
247
|
+
}
|
|
248
|
+
function a(e) {
|
|
249
|
+
e.preventDefault(), n.value?.focus?.(), r(e), window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
|
|
250
|
+
}
|
|
251
|
+
return f(i), {
|
|
252
|
+
target: n,
|
|
253
|
+
down: a
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/components/primitives/Saturation.vue?vue&type=script&setup=true&lang.ts
|
|
258
|
+
var te = ["aria-valuetext"], z = /* @__PURE__ */ s({
|
|
259
|
+
__name: "Saturation",
|
|
260
|
+
props: {
|
|
261
|
+
hue: {},
|
|
262
|
+
saturation: {},
|
|
263
|
+
value: {}
|
|
264
|
+
},
|
|
265
|
+
emits: ["input", "change"],
|
|
266
|
+
setup(e, { emit: n }) {
|
|
267
|
+
let r = e, o = n, s = t(() => `hsl(${r.hue}, 100%, 50%)`), c = t(() => `${r.saturation}%`), l = t(() => `${100 - r.value}%`), { target: u, down: f } = R((e, t) => o("input", {
|
|
268
|
+
s: Math.round(e * 100),
|
|
269
|
+
v: Math.round((1 - t) * 100)
|
|
270
|
+
}), () => o("change"));
|
|
271
|
+
function m(e) {
|
|
272
|
+
let t = r.saturation, n = r.value;
|
|
273
|
+
switch (e.key) {
|
|
274
|
+
case "ArrowLeft":
|
|
275
|
+
--t;
|
|
276
|
+
break;
|
|
277
|
+
case "ArrowRight":
|
|
278
|
+
t += 1;
|
|
279
|
+
break;
|
|
280
|
+
case "ArrowUp":
|
|
281
|
+
n += 1;
|
|
282
|
+
break;
|
|
283
|
+
case "ArrowDown":
|
|
284
|
+
--n;
|
|
285
|
+
break;
|
|
286
|
+
default: return;
|
|
287
|
+
}
|
|
288
|
+
e.preventDefault(), o("input", {
|
|
289
|
+
s: Math.min(100, Math.max(0, t)),
|
|
290
|
+
v: Math.min(100, Math.max(0, n))
|
|
291
|
+
}), o("change");
|
|
292
|
+
}
|
|
293
|
+
return (t, n) => (p(), i("div", {
|
|
294
|
+
class: "vc-saturation",
|
|
295
|
+
ref: "target",
|
|
296
|
+
style: d({ background: s.value }),
|
|
297
|
+
onPointerdown: n[0] ||= (...e) => v(f) && v(f)(...e),
|
|
298
|
+
onKeydown: m,
|
|
299
|
+
tabindex: "0",
|
|
300
|
+
role: "slider",
|
|
301
|
+
"aria-label": "채도/명도 (saturation/value)",
|
|
302
|
+
"aria-valuetext": `S ${Math.round(e.saturation)}, V ${Math.round(e.value)}`
|
|
303
|
+
}, [
|
|
304
|
+
n[1] ||= a("div", { class: "vc-saturation__white" }, null, -1),
|
|
305
|
+
n[2] ||= a("div", { class: "vc-saturation__black" }, null, -1),
|
|
306
|
+
a("div", {
|
|
307
|
+
class: "vc-saturation__pointer",
|
|
308
|
+
style: d({
|
|
309
|
+
left: c.value,
|
|
310
|
+
top: l.value
|
|
311
|
+
})
|
|
312
|
+
}, null, 4)
|
|
313
|
+
], 44, te));
|
|
314
|
+
}
|
|
315
|
+
}), ne = ["aria-valuenow"], B = /* @__PURE__ */ s({
|
|
316
|
+
__name: "Hue",
|
|
317
|
+
props: { hue: {} },
|
|
318
|
+
emits: ["input", "change"],
|
|
319
|
+
setup(e, { emit: n }) {
|
|
320
|
+
let r = e, o = n, s = t(() => `${r.hue / 360 * 100}%`), { target: c, down: l } = R((e) => o("input", Math.round(e * 360)), () => o("change"));
|
|
321
|
+
function u(e) {
|
|
322
|
+
let t = r.hue;
|
|
323
|
+
switch (e.key) {
|
|
324
|
+
case "ArrowLeft":
|
|
325
|
+
case "ArrowDown":
|
|
326
|
+
--t;
|
|
327
|
+
break;
|
|
328
|
+
case "ArrowRight":
|
|
329
|
+
case "ArrowUp":
|
|
330
|
+
t += 1;
|
|
331
|
+
break;
|
|
332
|
+
case "PageDown":
|
|
333
|
+
t -= 10;
|
|
334
|
+
break;
|
|
335
|
+
case "PageUp":
|
|
336
|
+
t += 10;
|
|
337
|
+
break;
|
|
338
|
+
case "Home":
|
|
339
|
+
t = 0;
|
|
340
|
+
break;
|
|
341
|
+
case "End":
|
|
342
|
+
t = 360;
|
|
343
|
+
break;
|
|
344
|
+
default: return;
|
|
345
|
+
}
|
|
346
|
+
e.preventDefault(), o("input", Math.min(360, Math.max(0, t))), o("change");
|
|
347
|
+
}
|
|
348
|
+
return (t, n) => (p(), i("div", {
|
|
349
|
+
class: "vc-hue",
|
|
350
|
+
ref: "target",
|
|
351
|
+
onPointerdown: n[0] ||= (...e) => v(l) && v(l)(...e),
|
|
352
|
+
onKeydown: u,
|
|
353
|
+
tabindex: "0",
|
|
354
|
+
role: "slider",
|
|
355
|
+
"aria-label": "색조 (hue)",
|
|
356
|
+
"aria-valuemin": 0,
|
|
357
|
+
"aria-valuemax": 360,
|
|
358
|
+
"aria-valuenow": Math.round(e.hue)
|
|
359
|
+
}, [a("div", {
|
|
360
|
+
class: "vc-hue__pointer",
|
|
361
|
+
style: d({ left: s.value })
|
|
362
|
+
}, null, 4)], 40, ne));
|
|
363
|
+
}
|
|
364
|
+
}), re = ["aria-valuenow"], ie = { class: "vc-alpha__track" }, V = /* @__PURE__ */ s({
|
|
365
|
+
__name: "Alpha",
|
|
366
|
+
props: { rgba: {} },
|
|
367
|
+
emits: ["input", "change"],
|
|
368
|
+
setup(e, { emit: n }) {
|
|
369
|
+
let r = e, o = n, s = t(() => {
|
|
370
|
+
let { r: e, g: t, b: n } = r.rgba;
|
|
371
|
+
return `linear-gradient(to right, rgba(${e},${t},${n},0), rgba(${e},${t},${n},1))`;
|
|
372
|
+
}), c = t(() => `${r.rgba.a * 100}%`), { target: l, down: u } = R((e) => o("input", Math.round(e * 100) / 100), () => o("change"));
|
|
373
|
+
function f(e) {
|
|
374
|
+
let t = r.rgba.a;
|
|
375
|
+
switch (e.key) {
|
|
376
|
+
case "ArrowLeft":
|
|
377
|
+
case "ArrowDown":
|
|
378
|
+
t -= .05;
|
|
379
|
+
break;
|
|
380
|
+
case "ArrowRight":
|
|
381
|
+
case "ArrowUp":
|
|
382
|
+
t += .05;
|
|
383
|
+
break;
|
|
384
|
+
case "Home":
|
|
385
|
+
t = 0;
|
|
386
|
+
break;
|
|
387
|
+
case "End":
|
|
388
|
+
t = 1;
|
|
389
|
+
break;
|
|
390
|
+
default: return;
|
|
391
|
+
}
|
|
392
|
+
e.preventDefault(), t = Math.min(1, Math.max(0, Math.round(t * 100) / 100)), o("input", t), o("change");
|
|
393
|
+
}
|
|
394
|
+
return (t, n) => (p(), i("div", {
|
|
395
|
+
class: "vc-alpha",
|
|
396
|
+
ref: "target",
|
|
397
|
+
onPointerdown: n[0] ||= (...e) => v(u) && v(u)(...e),
|
|
398
|
+
onKeydown: f,
|
|
399
|
+
tabindex: "0",
|
|
400
|
+
role: "slider",
|
|
401
|
+
"aria-label": "투명도 (alpha)",
|
|
402
|
+
"aria-valuemin": 0,
|
|
403
|
+
"aria-valuemax": 1,
|
|
404
|
+
"aria-valuenow": e.rgba.a
|
|
405
|
+
}, [a("div", ie, [n[1] ||= a("div", { class: "vc-alpha__checker" }, null, -1), a("div", {
|
|
406
|
+
class: "vc-alpha__grad",
|
|
407
|
+
style: d({ background: s.value })
|
|
408
|
+
}, null, 4)]), a("div", {
|
|
409
|
+
class: "vc-alpha__pointer",
|
|
410
|
+
style: d({ left: c.value })
|
|
411
|
+
}, null, 4)], 40, re));
|
|
412
|
+
}
|
|
413
|
+
}), ae = { class: "vc-input" }, oe = ["value"], se = { class: "vc-input__label" }, H = /* @__PURE__ */ s({
|
|
414
|
+
__name: "EditableInput",
|
|
415
|
+
props: {
|
|
416
|
+
label: {},
|
|
417
|
+
modelValue: {}
|
|
418
|
+
},
|
|
419
|
+
emits: ["update:modelValue", "change"],
|
|
420
|
+
setup(e, { emit: t }) {
|
|
421
|
+
let n = e, r = t, o = h(String(n.modelValue)), s = h(!1);
|
|
422
|
+
x(() => n.modelValue, (e) => {
|
|
423
|
+
s.value || (o.value = String(e));
|
|
424
|
+
});
|
|
425
|
+
function c(e) {
|
|
426
|
+
o.value = e.target.value;
|
|
427
|
+
}
|
|
428
|
+
function u() {
|
|
429
|
+
s.value = !0;
|
|
430
|
+
}
|
|
431
|
+
async function d() {
|
|
432
|
+
s.value = !1, r("update:modelValue", o.value), r("change"), await l(), o.value = String(n.modelValue);
|
|
433
|
+
}
|
|
434
|
+
function f(e) {
|
|
435
|
+
e.target.blur();
|
|
436
|
+
}
|
|
437
|
+
return (t, n) => (p(), i("label", ae, [a("input", {
|
|
438
|
+
class: "vc-input__field",
|
|
439
|
+
value: o.value,
|
|
440
|
+
onInput: c,
|
|
441
|
+
onFocus: u,
|
|
442
|
+
onBlur: d,
|
|
443
|
+
onKeyup: C(f, ["enter"])
|
|
444
|
+
}, null, 40, oe), a("span", se, _(e.label), 1)]));
|
|
445
|
+
}
|
|
446
|
+
}), U = { class: "vc-chrome__body" }, W = { class: "vc-chrome__sliders" }, G = { class: "vc-chrome__fields" }, K = { class: "vc-input vc-input--wide" }, ce = {
|
|
447
|
+
key: 3,
|
|
448
|
+
class: "vc-chrome__switch"
|
|
449
|
+
}, le = { class: "vc-chrome__mode" }, ue = /* @__PURE__ */ s({
|
|
450
|
+
__name: "ChromePicker",
|
|
451
|
+
props: /*@__PURE__*/ c({
|
|
452
|
+
format: { default: "hex" },
|
|
453
|
+
disableAlpha: {
|
|
454
|
+
type: Boolean,
|
|
455
|
+
default: !1
|
|
456
|
+
},
|
|
457
|
+
width: { default: "var(--vc-width, 240px)" },
|
|
458
|
+
inputFormats: { default: () => [
|
|
459
|
+
"hex",
|
|
460
|
+
"rgb",
|
|
461
|
+
"hsl"
|
|
462
|
+
] }
|
|
463
|
+
}, {
|
|
464
|
+
modelValue: {},
|
|
465
|
+
modelModifiers: {}
|
|
466
|
+
}),
|
|
467
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
468
|
+
setup(s, { emit: c }) {
|
|
469
|
+
let l = y(s, "modelValue"), u = s, f = F(l, c, () => u.format, () => u.disableAlpha), m = I();
|
|
470
|
+
async function g() {
|
|
471
|
+
let e = await m.open();
|
|
472
|
+
e && (f.setFromHex(e), f.input(), f.change());
|
|
473
|
+
}
|
|
474
|
+
let b = h(u.inputFormats.includes(u.format) ? u.format : u.inputFormats[0] ?? "hex"), w = t(() => u.inputFormats.length > 1);
|
|
475
|
+
function T(e) {
|
|
476
|
+
let t = u.inputFormats;
|
|
477
|
+
b.value = t[(t.indexOf(b.value) + e + t.length) % t.length];
|
|
478
|
+
}
|
|
479
|
+
let E = h(f.hex.value), D = h(!1);
|
|
480
|
+
x(() => f.hex.value, (e) => {
|
|
481
|
+
D.value || (E.value = e);
|
|
482
|
+
});
|
|
483
|
+
function O() {
|
|
484
|
+
D.value = !1;
|
|
485
|
+
let e = E.value.trim().replace(/[^0-9a-fA-F]/g, "").slice(0, 8);
|
|
486
|
+
f.setFromHex("#" + e), f.input(), E.value = f.hex.value;
|
|
487
|
+
}
|
|
488
|
+
function k(e, t) {
|
|
489
|
+
return Math.max(0, Math.min(t, Math.round(+e || 0)));
|
|
490
|
+
}
|
|
491
|
+
function A(e, t) {
|
|
492
|
+
f.setFromRgba({
|
|
493
|
+
...f.rgba.value,
|
|
494
|
+
[e]: k(t, 255)
|
|
495
|
+
}), f.input();
|
|
496
|
+
}
|
|
497
|
+
function j(e, t) {
|
|
498
|
+
f.setFromHsla({
|
|
499
|
+
...f.hsla.value,
|
|
500
|
+
[e]: k(t, e === "h" ? 360 : 100)
|
|
501
|
+
}), f.input();
|
|
502
|
+
}
|
|
503
|
+
function M(e) {
|
|
504
|
+
f.setAlpha(Math.max(0, Math.min(1, +e || 0))), f.input();
|
|
505
|
+
}
|
|
506
|
+
let N = t(() => Math.round(f.rgba.value.a * 100) / 100), P = t(() => ({
|
|
507
|
+
h: Math.round(f.hsla.value.h),
|
|
508
|
+
s: Math.round(f.hsla.value.s),
|
|
509
|
+
l: Math.round(f.hsla.value.l)
|
|
510
|
+
})), L = t(() => ({ background: f.hex.value }));
|
|
511
|
+
return (t, c) => (p(), i("div", {
|
|
512
|
+
class: "vc-chrome",
|
|
513
|
+
style: d({ width: s.width })
|
|
514
|
+
}, [
|
|
515
|
+
o(z, {
|
|
516
|
+
hue: v(f).hsva.value.h,
|
|
517
|
+
saturation: v(f).hsva.value.s,
|
|
518
|
+
value: v(f).hsva.value.v,
|
|
519
|
+
onInput: c[0] ||= (e) => {
|
|
520
|
+
v(f).setSaturation(e.s, e.v), v(f).input();
|
|
521
|
+
},
|
|
522
|
+
onChange: c[1] ||= (e) => v(f).change()
|
|
523
|
+
}, null, 8, [
|
|
524
|
+
"hue",
|
|
525
|
+
"saturation",
|
|
526
|
+
"value"
|
|
527
|
+
]),
|
|
528
|
+
a("div", U, [
|
|
529
|
+
a("div", {
|
|
530
|
+
class: "vc-chrome__preview",
|
|
531
|
+
style: d(L.value)
|
|
532
|
+
}, null, 4),
|
|
533
|
+
v(m).isSupported ? (p(), i("button", {
|
|
534
|
+
key: 0,
|
|
535
|
+
type: "button",
|
|
536
|
+
class: "vc-chrome__eyedropper",
|
|
537
|
+
"aria-label": "스포이드로 화면 색 추출",
|
|
538
|
+
title: "스포이드",
|
|
539
|
+
onClick: g
|
|
540
|
+
}, [...c[16] ||= [a("svg", {
|
|
541
|
+
width: "16",
|
|
542
|
+
height: "16",
|
|
543
|
+
viewBox: "0 0 24 24",
|
|
544
|
+
fill: "none",
|
|
545
|
+
stroke: "currentColor",
|
|
546
|
+
"stroke-width": "2",
|
|
547
|
+
"stroke-linecap": "round",
|
|
548
|
+
"stroke-linejoin": "round"
|
|
549
|
+
}, [a("path", { d: "M11 7l6 6" }), a("path", { d: "M4 16l11.7 -11.7a2.41 2.41 0 0 1 3.4 3.4l-11.7 11.7l-4 1l1 -4z" })], -1)]])) : r("", !0),
|
|
550
|
+
a("div", W, [o(B, {
|
|
551
|
+
hue: v(f).hsva.value.h,
|
|
552
|
+
onInput: c[2] ||= (e) => {
|
|
553
|
+
v(f).setHue(e), v(f).input();
|
|
554
|
+
},
|
|
555
|
+
onChange: c[3] ||= (e) => v(f).change()
|
|
556
|
+
}, null, 8, ["hue"]), s.disableAlpha ? r("", !0) : (p(), n(V, {
|
|
557
|
+
key: 0,
|
|
558
|
+
rgba: v(f).rgba.value,
|
|
559
|
+
onInput: c[4] ||= (e) => {
|
|
560
|
+
v(f).setAlpha(e), v(f).input();
|
|
561
|
+
},
|
|
562
|
+
onChange: c[5] ||= (e) => v(f).change()
|
|
563
|
+
}, null, 8, ["rgba"]))])
|
|
564
|
+
]),
|
|
565
|
+
a("div", G, [b.value === "hex" ? (p(), i(e, { key: 0 }, [a("label", K, [S(a("input", {
|
|
566
|
+
class: "vc-input__field",
|
|
567
|
+
"onUpdate:modelValue": c[6] ||= (e) => E.value = e,
|
|
568
|
+
onFocus: c[7] ||= (e) => D.value = !0,
|
|
569
|
+
onChange: O,
|
|
570
|
+
onKeyup: C(O, ["enter"])
|
|
571
|
+
}, null, 544), [[ee, E.value]]), c[17] ||= a("span", { class: "vc-input__label" }, "hex", -1)]), s.disableAlpha ? r("", !0) : (p(), n(H, {
|
|
572
|
+
key: 0,
|
|
573
|
+
label: "a",
|
|
574
|
+
modelValue: N.value,
|
|
575
|
+
"onUpdate:modelValue": M
|
|
576
|
+
}, null, 8, ["modelValue"]))], 64)) : b.value === "rgb" ? (p(), i(e, { key: 1 }, [
|
|
577
|
+
o(H, {
|
|
578
|
+
label: "r",
|
|
579
|
+
modelValue: v(f).rgba.value.r,
|
|
580
|
+
"onUpdate:modelValue": c[8] ||= (e) => A("r", e)
|
|
581
|
+
}, null, 8, ["modelValue"]),
|
|
582
|
+
o(H, {
|
|
583
|
+
label: "g",
|
|
584
|
+
modelValue: v(f).rgba.value.g,
|
|
585
|
+
"onUpdate:modelValue": c[9] ||= (e) => A("g", e)
|
|
586
|
+
}, null, 8, ["modelValue"]),
|
|
587
|
+
o(H, {
|
|
588
|
+
label: "b",
|
|
589
|
+
modelValue: v(f).rgba.value.b,
|
|
590
|
+
"onUpdate:modelValue": c[10] ||= (e) => A("b", e)
|
|
591
|
+
}, null, 8, ["modelValue"]),
|
|
592
|
+
s.disableAlpha ? r("", !0) : (p(), n(H, {
|
|
593
|
+
key: 0,
|
|
594
|
+
label: "a",
|
|
595
|
+
modelValue: N.value,
|
|
596
|
+
"onUpdate:modelValue": M
|
|
597
|
+
}, null, 8, ["modelValue"]))
|
|
598
|
+
], 64)) : (p(), i(e, { key: 2 }, [
|
|
599
|
+
o(H, {
|
|
600
|
+
label: "h",
|
|
601
|
+
modelValue: P.value.h,
|
|
602
|
+
"onUpdate:modelValue": c[11] ||= (e) => j("h", e)
|
|
603
|
+
}, null, 8, ["modelValue"]),
|
|
604
|
+
o(H, {
|
|
605
|
+
label: "s",
|
|
606
|
+
modelValue: P.value.s,
|
|
607
|
+
"onUpdate:modelValue": c[12] ||= (e) => j("s", e)
|
|
608
|
+
}, null, 8, ["modelValue"]),
|
|
609
|
+
o(H, {
|
|
610
|
+
label: "l",
|
|
611
|
+
modelValue: P.value.l,
|
|
612
|
+
"onUpdate:modelValue": c[13] ||= (e) => j("l", e)
|
|
613
|
+
}, null, 8, ["modelValue"]),
|
|
614
|
+
s.disableAlpha ? r("", !0) : (p(), n(H, {
|
|
615
|
+
key: 0,
|
|
616
|
+
label: "a",
|
|
617
|
+
modelValue: N.value,
|
|
618
|
+
"onUpdate:modelValue": M
|
|
619
|
+
}, null, 8, ["modelValue"]))
|
|
620
|
+
], 64)), w.value ? (p(), i("div", ce, [a("button", {
|
|
621
|
+
type: "button",
|
|
622
|
+
class: "vc-chrome__chev",
|
|
623
|
+
"aria-label": "이전 포맷",
|
|
624
|
+
onClick: c[14] ||= (e) => T(-1)
|
|
625
|
+
}, " ▲ "), a("button", {
|
|
626
|
+
type: "button",
|
|
627
|
+
class: "vc-chrome__chev",
|
|
628
|
+
"aria-label": "다음 포맷",
|
|
629
|
+
onClick: c[15] ||= (e) => T(1)
|
|
630
|
+
}, " ▼ ")])) : r("", !0)]),
|
|
631
|
+
a("div", le, _(b.value.toUpperCase()), 1)
|
|
632
|
+
], 4));
|
|
633
|
+
}
|
|
634
|
+
}), q = [
|
|
635
|
+
"#D0021B",
|
|
636
|
+
"#F5A623",
|
|
637
|
+
"#F8E71C",
|
|
638
|
+
"#8B572A",
|
|
639
|
+
"#7ED321",
|
|
640
|
+
"#417505",
|
|
641
|
+
"#BD10E0",
|
|
642
|
+
"#9013FE",
|
|
643
|
+
"#4A90E2",
|
|
644
|
+
"#50E3C2",
|
|
645
|
+
"#B8E986",
|
|
646
|
+
"#000000",
|
|
647
|
+
"#4A4A4A",
|
|
648
|
+
"#9B9B9B",
|
|
649
|
+
"#FFFFFF"
|
|
650
|
+
], de = [
|
|
651
|
+
"#F44336",
|
|
652
|
+
"#E91E63",
|
|
653
|
+
"#9C27B0",
|
|
654
|
+
"#673AB7",
|
|
655
|
+
"#3F51B5",
|
|
656
|
+
"#2196F3",
|
|
657
|
+
"#03A9F4",
|
|
658
|
+
"#00BCD4",
|
|
659
|
+
"#009688",
|
|
660
|
+
"#4CAF50",
|
|
661
|
+
"#8BC34A",
|
|
662
|
+
"#CDDC39",
|
|
663
|
+
"#FFEB3B",
|
|
664
|
+
"#FFC107",
|
|
665
|
+
"#FF9800",
|
|
666
|
+
"#FF5722",
|
|
667
|
+
"#795548",
|
|
668
|
+
"#607D8B"
|
|
669
|
+
], J = [
|
|
670
|
+
"#4D4D4D",
|
|
671
|
+
"#999999",
|
|
672
|
+
"#FFFFFF",
|
|
673
|
+
"#F44E3B",
|
|
674
|
+
"#FE9200",
|
|
675
|
+
"#FCDC00",
|
|
676
|
+
"#DBDF00",
|
|
677
|
+
"#A4DD00",
|
|
678
|
+
"#68CCCA",
|
|
679
|
+
"#73D8FF",
|
|
680
|
+
"#AEA1FF",
|
|
681
|
+
"#FDA1FF",
|
|
682
|
+
"#333333",
|
|
683
|
+
"#808080",
|
|
684
|
+
"#CCCCCC",
|
|
685
|
+
"#D33115",
|
|
686
|
+
"#E27300",
|
|
687
|
+
"#FCC400",
|
|
688
|
+
"#B0BC00",
|
|
689
|
+
"#68BC00",
|
|
690
|
+
"#16A5A5",
|
|
691
|
+
"#009CE0",
|
|
692
|
+
"#7B64FF",
|
|
693
|
+
"#FA28FF"
|
|
694
|
+
], Y = [
|
|
695
|
+
"#FF6900",
|
|
696
|
+
"#FCB900",
|
|
697
|
+
"#7BDCB5",
|
|
698
|
+
"#00D084",
|
|
699
|
+
"#8ED1FC",
|
|
700
|
+
"#0693E3",
|
|
701
|
+
"#ABB8C3",
|
|
702
|
+
"#EB144C",
|
|
703
|
+
"#F78DA7",
|
|
704
|
+
"#9900EF"
|
|
705
|
+
], X = Array.from({ length: 15 }, (e, t) => {
|
|
706
|
+
let n = Math.round(t / 14 * 255).toString(16).padStart(2, "0");
|
|
707
|
+
return `#${n}${n}${n}`.toUpperCase();
|
|
708
|
+
}), Z = [
|
|
709
|
+
[
|
|
710
|
+
"#FFEBEE",
|
|
711
|
+
"#FFCDD2",
|
|
712
|
+
"#E57373",
|
|
713
|
+
"#F44336",
|
|
714
|
+
"#D32F2F",
|
|
715
|
+
"#B71C1C"
|
|
716
|
+
],
|
|
717
|
+
[
|
|
718
|
+
"#F3E5F5",
|
|
719
|
+
"#CE93D8",
|
|
720
|
+
"#AB47BC",
|
|
721
|
+
"#9C27B0",
|
|
722
|
+
"#7B1FA2",
|
|
723
|
+
"#4A148C"
|
|
724
|
+
],
|
|
725
|
+
[
|
|
726
|
+
"#E3F2FD",
|
|
727
|
+
"#90CAF9",
|
|
728
|
+
"#42A5F5",
|
|
729
|
+
"#2196F3",
|
|
730
|
+
"#1976D2",
|
|
731
|
+
"#0D47A1"
|
|
732
|
+
],
|
|
733
|
+
[
|
|
734
|
+
"#E0F2F1",
|
|
735
|
+
"#80CBC4",
|
|
736
|
+
"#26A69A",
|
|
737
|
+
"#009688",
|
|
738
|
+
"#00796B",
|
|
739
|
+
"#004D40"
|
|
740
|
+
],
|
|
741
|
+
[
|
|
742
|
+
"#E8F5E9",
|
|
743
|
+
"#A5D6A7",
|
|
744
|
+
"#66BB6A",
|
|
745
|
+
"#4CAF50",
|
|
746
|
+
"#388E3C",
|
|
747
|
+
"#1B5E20"
|
|
748
|
+
],
|
|
749
|
+
[
|
|
750
|
+
"#FFFDE7",
|
|
751
|
+
"#FFF59D",
|
|
752
|
+
"#FFEE58",
|
|
753
|
+
"#FFEB3B",
|
|
754
|
+
"#FBC02D",
|
|
755
|
+
"#F57F17"
|
|
756
|
+
],
|
|
757
|
+
[
|
|
758
|
+
"#FFF3E0",
|
|
759
|
+
"#FFCC80",
|
|
760
|
+
"#FFA726",
|
|
761
|
+
"#FF9800",
|
|
762
|
+
"#F57C00",
|
|
763
|
+
"#E65100"
|
|
764
|
+
],
|
|
765
|
+
[
|
|
766
|
+
"#EFEBE9",
|
|
767
|
+
"#BCAAA4",
|
|
768
|
+
"#8D6E63",
|
|
769
|
+
"#795548",
|
|
770
|
+
"#5D4037",
|
|
771
|
+
"#3E2723"
|
|
772
|
+
]
|
|
773
|
+
], fe = ["aria-label"], Q = /* @__PURE__ */ s({
|
|
774
|
+
__name: "Swatch",
|
|
775
|
+
props: {
|
|
776
|
+
color: {},
|
|
777
|
+
active: { type: Boolean }
|
|
778
|
+
},
|
|
779
|
+
emits: ["select"],
|
|
780
|
+
setup(e, { emit: t }) {
|
|
781
|
+
let n = t;
|
|
782
|
+
return (t, r) => (p(), i("button", {
|
|
783
|
+
class: u(["vc-swatch", { "is-active": e.active }]),
|
|
784
|
+
style: d({ background: e.color }),
|
|
785
|
+
type: "button",
|
|
786
|
+
"aria-label": e.color,
|
|
787
|
+
onClick: r[0] ||= (t) => n("select", e.color)
|
|
788
|
+
}, null, 14, fe));
|
|
789
|
+
}
|
|
790
|
+
}), pe = { class: "vc-sketch__controls" }, me = { class: "vc-sketch__sliders" }, he = { class: "vc-sketch__field" }, ge = { class: "vc-sketch__presets" }, _e = /* @__PURE__ */ s({
|
|
791
|
+
__name: "SketchPicker",
|
|
792
|
+
props: /*@__PURE__*/ c({
|
|
793
|
+
format: { default: "hex" },
|
|
794
|
+
disableAlpha: {
|
|
795
|
+
type: Boolean,
|
|
796
|
+
default: !1
|
|
797
|
+
},
|
|
798
|
+
presetColors: { default: () => q },
|
|
799
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
800
|
+
}, {
|
|
801
|
+
modelValue: {},
|
|
802
|
+
modelModifiers: {}
|
|
803
|
+
}),
|
|
804
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
805
|
+
setup(s, { emit: c }) {
|
|
806
|
+
let l = y(s, "modelValue"), u = s, f = F(l, c, () => u.format, () => u.disableAlpha), m = t(() => ({ background: f.hex.value }));
|
|
807
|
+
function h(e) {
|
|
808
|
+
f.setFromHex(e), f.input(), f.change();
|
|
809
|
+
}
|
|
810
|
+
function _(e) {
|
|
811
|
+
f.setFromHex(e), f.input();
|
|
812
|
+
}
|
|
813
|
+
return (t, c) => (p(), i("div", {
|
|
814
|
+
class: "vc-sketch",
|
|
815
|
+
style: d({ width: s.width })
|
|
816
|
+
}, [
|
|
817
|
+
o(z, {
|
|
818
|
+
hue: v(f).hsva.value.h,
|
|
819
|
+
saturation: v(f).hsva.value.s,
|
|
820
|
+
value: v(f).hsva.value.v,
|
|
821
|
+
onInput: c[0] ||= (e) => {
|
|
822
|
+
v(f).setSaturation(e.s, e.v), v(f).input();
|
|
823
|
+
},
|
|
824
|
+
onChange: c[1] ||= (e) => v(f).change()
|
|
825
|
+
}, null, 8, [
|
|
826
|
+
"hue",
|
|
827
|
+
"saturation",
|
|
828
|
+
"value"
|
|
829
|
+
]),
|
|
830
|
+
a("div", pe, [a("div", me, [o(B, {
|
|
831
|
+
hue: v(f).hsva.value.h,
|
|
832
|
+
onInput: c[2] ||= (e) => {
|
|
833
|
+
v(f).setHue(e), v(f).input();
|
|
834
|
+
},
|
|
835
|
+
onChange: c[3] ||= (e) => v(f).change()
|
|
836
|
+
}, null, 8, ["hue"]), s.disableAlpha ? r("", !0) : (p(), n(V, {
|
|
837
|
+
key: 0,
|
|
838
|
+
rgba: v(f).rgba.value,
|
|
839
|
+
onInput: c[4] ||= (e) => {
|
|
840
|
+
v(f).setAlpha(e), v(f).input();
|
|
841
|
+
},
|
|
842
|
+
onChange: c[5] ||= (e) => v(f).change()
|
|
843
|
+
}, null, 8, ["rgba"]))]), a("div", {
|
|
844
|
+
class: "vc-sketch__preview",
|
|
845
|
+
style: d(m.value)
|
|
846
|
+
}, null, 4)]),
|
|
847
|
+
a("div", he, [o(H, {
|
|
848
|
+
label: "hex",
|
|
849
|
+
modelValue: v(f).hex.value,
|
|
850
|
+
"onUpdate:modelValue": _
|
|
851
|
+
}, null, 8, ["modelValue"])]),
|
|
852
|
+
a("div", ge, [(p(!0), i(e, null, g(s.presetColors, (e) => (p(), n(Q, {
|
|
853
|
+
key: e,
|
|
854
|
+
color: e,
|
|
855
|
+
onSelect: h
|
|
856
|
+
}, null, 8, ["color"]))), 128))])
|
|
857
|
+
], 4));
|
|
858
|
+
}
|
|
859
|
+
}), ve = { class: "vc-ps__main" }, ye = { class: "vc-ps__hue" }, be = { class: "vc-ps__side" }, xe = { class: "vc-ps__compare" }, Se = /* @__PURE__ */ s({
|
|
860
|
+
__name: "PhotoshopPicker",
|
|
861
|
+
props: /*@__PURE__*/ c({
|
|
862
|
+
format: { default: "hex" },
|
|
863
|
+
disableAlpha: {
|
|
864
|
+
type: Boolean,
|
|
865
|
+
default: !1
|
|
866
|
+
},
|
|
867
|
+
width: { default: "var(--vc-width, 280px)" }
|
|
868
|
+
}, {
|
|
869
|
+
modelValue: {},
|
|
870
|
+
modelModifiers: {}
|
|
871
|
+
}),
|
|
872
|
+
emits: /*@__PURE__*/ c([
|
|
873
|
+
"change",
|
|
874
|
+
"input",
|
|
875
|
+
"ok",
|
|
876
|
+
"cancel"
|
|
877
|
+
], ["update:modelValue"]),
|
|
878
|
+
setup(e, { emit: n }) {
|
|
879
|
+
let r = y(e, "modelValue"), s = e, c = n, l = F(r, c, () => s.format, () => s.disableAlpha), u = h(A({
|
|
880
|
+
...l.rgba.value,
|
|
881
|
+
a: 1
|
|
882
|
+
})), f = t(() => l.hex.value);
|
|
883
|
+
function m() {
|
|
884
|
+
c("ok", l.output()), u.value = l.hex.value;
|
|
885
|
+
}
|
|
886
|
+
function g() {
|
|
887
|
+
l.setFromHex(u.value), l.input(), c("cancel");
|
|
888
|
+
}
|
|
889
|
+
return (t, n) => (p(), i("div", {
|
|
890
|
+
class: "vc-ps",
|
|
891
|
+
style: d({ width: e.width })
|
|
892
|
+
}, [a("div", ve, [o(z, {
|
|
893
|
+
class: "vc-ps__sat",
|
|
894
|
+
hue: v(l).hsva.value.h,
|
|
895
|
+
saturation: v(l).hsva.value.s,
|
|
896
|
+
value: v(l).hsva.value.v,
|
|
897
|
+
onInput: n[0] ||= (e) => {
|
|
898
|
+
v(l).setSaturation(e.s, e.v), v(l).input();
|
|
899
|
+
},
|
|
900
|
+
onChange: n[1] ||= (e) => v(l).change()
|
|
901
|
+
}, null, 8, [
|
|
902
|
+
"hue",
|
|
903
|
+
"saturation",
|
|
904
|
+
"value"
|
|
905
|
+
]), a("div", ye, [o(B, {
|
|
906
|
+
hue: v(l).hsva.value.h,
|
|
907
|
+
onInput: n[2] ||= (e) => {
|
|
908
|
+
v(l).setHue(e), v(l).input();
|
|
909
|
+
},
|
|
910
|
+
onChange: n[3] ||= (e) => v(l).change()
|
|
911
|
+
}, null, 8, ["hue"])])]), a("div", be, [
|
|
912
|
+
a("div", xe, [a("div", {
|
|
913
|
+
class: "vc-ps__swatch",
|
|
914
|
+
style: d({ background: f.value })
|
|
915
|
+
}, [...n[4] ||= [a("span", null, "new", -1)]], 4), a("div", {
|
|
916
|
+
class: "vc-ps__swatch",
|
|
917
|
+
style: d({ background: u.value })
|
|
918
|
+
}, [...n[5] ||= [a("span", null, "current", -1)]], 4)]),
|
|
919
|
+
a("button", {
|
|
920
|
+
type: "button",
|
|
921
|
+
class: "vc-ps__btn vc-ps__btn--ok",
|
|
922
|
+
onClick: m
|
|
923
|
+
}, " OK "),
|
|
924
|
+
a("button", {
|
|
925
|
+
type: "button",
|
|
926
|
+
class: "vc-ps__btn",
|
|
927
|
+
onClick: g
|
|
928
|
+
}, "Cancel")
|
|
929
|
+
])], 4));
|
|
930
|
+
}
|
|
931
|
+
}), Ce = { class: "vc-compact__grid" }, we = { class: "vc-compact__field" }, Te = /* @__PURE__ */ s({
|
|
932
|
+
__name: "CompactPicker",
|
|
933
|
+
props: /*@__PURE__*/ c({
|
|
934
|
+
format: { default: "hex" },
|
|
935
|
+
presetColors: { default: () => J },
|
|
936
|
+
columns: {},
|
|
937
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
938
|
+
}, {
|
|
939
|
+
modelValue: {},
|
|
940
|
+
modelModifiers: {}
|
|
941
|
+
}),
|
|
942
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
943
|
+
setup(r, { emit: s }) {
|
|
944
|
+
let c = y(r, "modelValue"), l = r, u = F(c, s, () => l.format, () => !0), f = t(() => Array.isArray(l.presetColors[0]) ? l.presetColors.flat() : l.presetColors);
|
|
945
|
+
function m(e) {
|
|
946
|
+
u.setFromHex(e), u.input(), u.change();
|
|
947
|
+
}
|
|
948
|
+
function h(e) {
|
|
949
|
+
u.setFromHex(e), u.input();
|
|
950
|
+
}
|
|
951
|
+
return (t, s) => (p(), i("div", {
|
|
952
|
+
class: "vc-compact",
|
|
953
|
+
style: d({
|
|
954
|
+
width: r.width,
|
|
955
|
+
...r.columns == null ? {} : { "--vc-swatch-columns": r.columns }
|
|
956
|
+
})
|
|
957
|
+
}, [a("div", Ce, [(p(!0), i(e, null, g(f.value, (e) => (p(), n(Q, {
|
|
958
|
+
key: e,
|
|
959
|
+
color: e,
|
|
960
|
+
active: e.toUpperCase() === v(u).hex.value.toUpperCase(),
|
|
961
|
+
onSelect: m
|
|
962
|
+
}, null, 8, ["color", "active"]))), 128))]), a("div", we, [a("div", {
|
|
963
|
+
class: "vc-compact__preview",
|
|
964
|
+
style: d({ background: v(u).hex.value })
|
|
965
|
+
}, null, 4), o(H, {
|
|
966
|
+
label: "hex",
|
|
967
|
+
modelValue: v(u).hex.value,
|
|
968
|
+
"onUpdate:modelValue": h
|
|
969
|
+
}, null, 8, ["modelValue"])])], 4));
|
|
970
|
+
}
|
|
971
|
+
}), Ee = /* @__PURE__ */ s({
|
|
972
|
+
__name: "GrayscalePicker",
|
|
973
|
+
props: /*@__PURE__*/ c({
|
|
974
|
+
format: { default: "hex" },
|
|
975
|
+
presetColors: { default: () => X },
|
|
976
|
+
columns: {},
|
|
977
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
978
|
+
}, {
|
|
979
|
+
modelValue: {},
|
|
980
|
+
modelModifiers: {}
|
|
981
|
+
}),
|
|
982
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
983
|
+
setup(r, { emit: a }) {
|
|
984
|
+
let o = y(r, "modelValue"), s = r, c = F(o, a, () => s.format, () => !0), l = t(() => Array.isArray(s.presetColors[0]) ? s.presetColors.flat() : s.presetColors);
|
|
985
|
+
function u(e) {
|
|
986
|
+
c.setFromHex(e), c.input(), c.change();
|
|
987
|
+
}
|
|
988
|
+
return (t, a) => (p(), i("div", {
|
|
989
|
+
class: "vc-gray",
|
|
990
|
+
style: d({
|
|
991
|
+
width: r.width,
|
|
992
|
+
...r.columns == null ? {} : { "--vc-swatch-columns": r.columns }
|
|
993
|
+
})
|
|
994
|
+
}, [(p(!0), i(e, null, g(l.value, (e) => (p(), n(Q, {
|
|
995
|
+
key: e,
|
|
996
|
+
color: e,
|
|
997
|
+
active: e.toUpperCase() === v(c).hex.value.toUpperCase(),
|
|
998
|
+
onSelect: u
|
|
999
|
+
}, null, 8, ["color", "active"]))), 128))], 4));
|
|
1000
|
+
}
|
|
1001
|
+
}), De = { class: "vc-material__rgb" }, Oe = /* @__PURE__ */ s({
|
|
1002
|
+
__name: "MaterialPicker",
|
|
1003
|
+
props: /*@__PURE__*/ c({
|
|
1004
|
+
format: { default: "hex" },
|
|
1005
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
1006
|
+
}, {
|
|
1007
|
+
modelValue: {},
|
|
1008
|
+
modelModifiers: {}
|
|
1009
|
+
}),
|
|
1010
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1011
|
+
setup(e, { emit: t }) {
|
|
1012
|
+
let n = y(e, "modelValue"), r = e, s = F(n, t, () => r.format, () => !0);
|
|
1013
|
+
function c(e) {
|
|
1014
|
+
s.setFromHex(e), s.input();
|
|
1015
|
+
}
|
|
1016
|
+
function l(e) {
|
|
1017
|
+
return Math.max(0, Math.min(255, Math.round(+e || 0)));
|
|
1018
|
+
}
|
|
1019
|
+
function u(e, t) {
|
|
1020
|
+
s.setFromRgba({
|
|
1021
|
+
...s.rgba.value,
|
|
1022
|
+
[e]: l(t)
|
|
1023
|
+
}), s.input();
|
|
1024
|
+
}
|
|
1025
|
+
return (t, n) => (p(), i("div", {
|
|
1026
|
+
class: "vc-material",
|
|
1027
|
+
style: d({
|
|
1028
|
+
width: e.width,
|
|
1029
|
+
borderTopColor: v(s).hex.value
|
|
1030
|
+
})
|
|
1031
|
+
}, [o(H, {
|
|
1032
|
+
class: "vc-material__hex",
|
|
1033
|
+
label: "hex",
|
|
1034
|
+
modelValue: v(s).hex.value,
|
|
1035
|
+
"onUpdate:modelValue": c
|
|
1036
|
+
}, null, 8, ["modelValue"]), a("div", De, [
|
|
1037
|
+
o(H, {
|
|
1038
|
+
label: "r",
|
|
1039
|
+
modelValue: v(s).rgba.value.r,
|
|
1040
|
+
"onUpdate:modelValue": n[0] ||= (e) => u("r", e)
|
|
1041
|
+
}, null, 8, ["modelValue"]),
|
|
1042
|
+
o(H, {
|
|
1043
|
+
label: "g",
|
|
1044
|
+
modelValue: v(s).rgba.value.g,
|
|
1045
|
+
"onUpdate:modelValue": n[1] ||= (e) => u("g", e)
|
|
1046
|
+
}, null, 8, ["modelValue"]),
|
|
1047
|
+
o(H, {
|
|
1048
|
+
label: "b",
|
|
1049
|
+
modelValue: v(s).rgba.value.b,
|
|
1050
|
+
"onUpdate:modelValue": n[2] ||= (e) => u("b", e)
|
|
1051
|
+
}, null, 8, ["modelValue"])
|
|
1052
|
+
])], 4));
|
|
1053
|
+
}
|
|
1054
|
+
}), ke = { class: "vc-twitter__swatches" }, Ae = { class: "vc-twitter__field" }, je = /* @__PURE__ */ s({
|
|
1055
|
+
__name: "TwitterPicker",
|
|
1056
|
+
props: /*@__PURE__*/ c({
|
|
1057
|
+
format: { default: "hex" },
|
|
1058
|
+
presetColors: { default: () => Y },
|
|
1059
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
1060
|
+
}, {
|
|
1061
|
+
modelValue: {},
|
|
1062
|
+
modelModifiers: {}
|
|
1063
|
+
}),
|
|
1064
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1065
|
+
setup(r, { emit: s }) {
|
|
1066
|
+
let c = y(r, "modelValue"), l = r, u = F(c, s, () => l.format, () => !0), f = t(() => Array.isArray(l.presetColors[0]) ? l.presetColors.flat() : l.presetColors);
|
|
1067
|
+
function m(e) {
|
|
1068
|
+
u.setFromHex(e), u.input(), u.change();
|
|
1069
|
+
}
|
|
1070
|
+
function h(e) {
|
|
1071
|
+
u.setFromHex(e), u.input();
|
|
1072
|
+
}
|
|
1073
|
+
return (t, s) => (p(), i("div", {
|
|
1074
|
+
class: "vc-twitter",
|
|
1075
|
+
style: d({ width: r.width })
|
|
1076
|
+
}, [a("div", ke, [(p(!0), i(e, null, g(f.value, (e) => (p(), n(Q, {
|
|
1077
|
+
key: e,
|
|
1078
|
+
color: e,
|
|
1079
|
+
onSelect: m
|
|
1080
|
+
}, null, 8, ["color"]))), 128))]), a("div", Ae, [s[1] ||= a("span", { class: "vc-twitter__hash" }, "#", -1), o(H, {
|
|
1081
|
+
label: "",
|
|
1082
|
+
modelValue: v(u).hex.value.replace("#", ""),
|
|
1083
|
+
"onUpdate:modelValue": s[0] ||= (e) => h("#" + e)
|
|
1084
|
+
}, null, 8, ["modelValue"])])], 4));
|
|
1085
|
+
}
|
|
1086
|
+
}), Me = {
|
|
1087
|
+
key: 1,
|
|
1088
|
+
class: "vc-swatches__grid"
|
|
1089
|
+
}, Ne = /* @__PURE__ */ s({
|
|
1090
|
+
__name: "SwatchesPicker",
|
|
1091
|
+
props: /*@__PURE__*/ c({
|
|
1092
|
+
format: { default: "hex" },
|
|
1093
|
+
presetColors: { default: () => Z },
|
|
1094
|
+
columns: {},
|
|
1095
|
+
width: { default: "var(--vc-width, 260px)" }
|
|
1096
|
+
}, {
|
|
1097
|
+
modelValue: {},
|
|
1098
|
+
modelModifiers: {}
|
|
1099
|
+
}),
|
|
1100
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1101
|
+
setup(r, { emit: a }) {
|
|
1102
|
+
let o = y(r, "modelValue"), s = r, c = F(o, a, () => s.format, () => !0), l = t(() => Array.isArray(s.presetColors[0])), u = t(() => l.value ? s.presetColors : []);
|
|
1103
|
+
function f(e) {
|
|
1104
|
+
c.setFromHex(e), c.input(), c.change();
|
|
1105
|
+
}
|
|
1106
|
+
function m(e) {
|
|
1107
|
+
return e.toUpperCase() === c.hex.value.toUpperCase();
|
|
1108
|
+
}
|
|
1109
|
+
return (t, a) => (p(), i("div", {
|
|
1110
|
+
class: "vc-swatches",
|
|
1111
|
+
style: d({
|
|
1112
|
+
width: r.width,
|
|
1113
|
+
...r.columns == null ? {} : { "--vc-swatch-columns": r.columns }
|
|
1114
|
+
})
|
|
1115
|
+
}, [l.value ? (p(!0), i(e, { key: 0 }, g(u.value, (t, r) => (p(), i("div", {
|
|
1116
|
+
key: r,
|
|
1117
|
+
class: "vc-swatches__row"
|
|
1118
|
+
}, [(p(!0), i(e, null, g(t, (e) => (p(), n(Q, {
|
|
1119
|
+
key: e,
|
|
1120
|
+
color: e,
|
|
1121
|
+
active: m(e),
|
|
1122
|
+
onSelect: f
|
|
1123
|
+
}, null, 8, ["color", "active"]))), 128))]))), 128)) : (p(), i("div", Me, [(p(!0), i(e, null, g(r.presetColors, (e) => (p(), n(Q, {
|
|
1124
|
+
key: e,
|
|
1125
|
+
color: e,
|
|
1126
|
+
active: m(e),
|
|
1127
|
+
onSelect: f
|
|
1128
|
+
}, null, 8, ["color", "active"]))), 128))]))], 4));
|
|
1129
|
+
}
|
|
1130
|
+
}), Pe = /* @__PURE__ */ s({
|
|
1131
|
+
__name: "HueSlider",
|
|
1132
|
+
props: /*@__PURE__*/ c({ width: { default: "var(--vc-width, 240px)" } }, {
|
|
1133
|
+
modelValue: { default: 0 },
|
|
1134
|
+
modelModifiers: {}
|
|
1135
|
+
}),
|
|
1136
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1137
|
+
setup(e, { emit: t }) {
|
|
1138
|
+
let n = y(e, "modelValue"), r = e, a = t;
|
|
1139
|
+
function s(e) {
|
|
1140
|
+
n.value = e, a("input", e);
|
|
1141
|
+
}
|
|
1142
|
+
function c() {
|
|
1143
|
+
a("change", n.value ?? 0);
|
|
1144
|
+
}
|
|
1145
|
+
return (e, t) => (p(), i("div", {
|
|
1146
|
+
class: "vc-hue-slider",
|
|
1147
|
+
style: d({ width: r.width })
|
|
1148
|
+
}, [o(B, {
|
|
1149
|
+
hue: n.value ?? 0,
|
|
1150
|
+
onInput: s,
|
|
1151
|
+
onChange: c
|
|
1152
|
+
}, null, 8, ["hue"])], 4));
|
|
1153
|
+
}
|
|
1154
|
+
}), Fe = { class: "vc-slider__row" }, Ie = { class: "vc-slider__row" }, Le = ["value"], Re = {
|
|
1155
|
+
key: 0,
|
|
1156
|
+
class: "vc-slider__row"
|
|
1157
|
+
}, ze = /* @__PURE__ */ s({
|
|
1158
|
+
__name: "SliderPicker",
|
|
1159
|
+
props: /*@__PURE__*/ c({
|
|
1160
|
+
format: { default: "hex" },
|
|
1161
|
+
disableAlpha: {
|
|
1162
|
+
type: Boolean,
|
|
1163
|
+
default: !1
|
|
1164
|
+
},
|
|
1165
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
1166
|
+
}, {
|
|
1167
|
+
modelValue: {},
|
|
1168
|
+
modelModifiers: {}
|
|
1169
|
+
}),
|
|
1170
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1171
|
+
setup(e, { emit: t }) {
|
|
1172
|
+
let n = y(e, "modelValue"), s = e, c = F(n, t, () => s.format, () => s.disableAlpha);
|
|
1173
|
+
function l(e) {
|
|
1174
|
+
let t = +e.target.value;
|
|
1175
|
+
c.setFromHsla({
|
|
1176
|
+
...c.hsla.value,
|
|
1177
|
+
l: t
|
|
1178
|
+
}), c.input();
|
|
1179
|
+
}
|
|
1180
|
+
return (t, n) => (p(), i("div", {
|
|
1181
|
+
class: "vc-slider",
|
|
1182
|
+
style: d({ width: e.width })
|
|
1183
|
+
}, [
|
|
1184
|
+
a("div", Fe, [n[5] ||= a("span", { class: "vc-slider__label" }, "H", -1), o(B, {
|
|
1185
|
+
hue: v(c).hsva.value.h,
|
|
1186
|
+
onInput: n[0] ||= (e) => {
|
|
1187
|
+
v(c).setHue(e), v(c).input();
|
|
1188
|
+
},
|
|
1189
|
+
onChange: n[1] ||= (e) => v(c).change()
|
|
1190
|
+
}, null, 8, ["hue"])]),
|
|
1191
|
+
a("div", Ie, [n[6] ||= a("span", { class: "vc-slider__label" }, "L", -1), a("input", {
|
|
1192
|
+
class: "vc-slider__range",
|
|
1193
|
+
type: "range",
|
|
1194
|
+
min: "0",
|
|
1195
|
+
max: "100",
|
|
1196
|
+
value: v(c).hsla.value.l,
|
|
1197
|
+
onInput: l,
|
|
1198
|
+
onChange: n[2] ||= (e) => v(c).change()
|
|
1199
|
+
}, null, 40, Le)]),
|
|
1200
|
+
e.disableAlpha ? r("", !0) : (p(), i("div", Re, [n[7] ||= a("span", { class: "vc-slider__label" }, "A", -1), o(V, {
|
|
1201
|
+
rgba: v(c).rgba.value,
|
|
1202
|
+
onInput: n[3] ||= (e) => {
|
|
1203
|
+
v(c).setAlpha(e), v(c).input();
|
|
1204
|
+
},
|
|
1205
|
+
onChange: n[4] ||= (e) => v(c).change()
|
|
1206
|
+
}, null, 8, ["rgba"])]))
|
|
1207
|
+
], 4));
|
|
1208
|
+
}
|
|
1209
|
+
}), Be = { class: "vc-sliders__label" }, Ve = [
|
|
1210
|
+
"max",
|
|
1211
|
+
"step",
|
|
1212
|
+
"value",
|
|
1213
|
+
"onInput"
|
|
1214
|
+
], $ = { class: "vc-sliders__value" }, He = /* @__PURE__ */ s({
|
|
1215
|
+
__name: "RGBASliders",
|
|
1216
|
+
props: /*@__PURE__*/ c({
|
|
1217
|
+
format: { default: "rgb" },
|
|
1218
|
+
disableAlpha: {
|
|
1219
|
+
type: Boolean,
|
|
1220
|
+
default: !1
|
|
1221
|
+
},
|
|
1222
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
1223
|
+
}, {
|
|
1224
|
+
modelValue: {},
|
|
1225
|
+
modelModifiers: {}
|
|
1226
|
+
}),
|
|
1227
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1228
|
+
setup(t, { emit: n }) {
|
|
1229
|
+
let r = y(t, "modelValue"), o = t, s = F(r, n, () => o.format, () => o.disableAlpha), c = [
|
|
1230
|
+
{
|
|
1231
|
+
key: "r",
|
|
1232
|
+
max: 255,
|
|
1233
|
+
step: 1
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
key: "g",
|
|
1237
|
+
max: 255,
|
|
1238
|
+
step: 1
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
key: "b",
|
|
1242
|
+
max: 255,
|
|
1243
|
+
step: 1
|
|
1244
|
+
},
|
|
1245
|
+
{
|
|
1246
|
+
key: "a",
|
|
1247
|
+
max: 1,
|
|
1248
|
+
step: .01
|
|
1249
|
+
}
|
|
1250
|
+
];
|
|
1251
|
+
function l(e) {
|
|
1252
|
+
return s.rgba.value[e];
|
|
1253
|
+
}
|
|
1254
|
+
function u(e, t) {
|
|
1255
|
+
let n = +t.target.value;
|
|
1256
|
+
s.setFromRgba({
|
|
1257
|
+
...s.rgba.value,
|
|
1258
|
+
[e]: n
|
|
1259
|
+
}), s.input();
|
|
1260
|
+
}
|
|
1261
|
+
return (n, r) => (p(), i("div", {
|
|
1262
|
+
class: "vc-sliders",
|
|
1263
|
+
style: d({ width: t.width })
|
|
1264
|
+
}, [(p(), i(e, null, g(c, (e) => S(a("div", {
|
|
1265
|
+
class: "vc-sliders__row",
|
|
1266
|
+
key: e.key
|
|
1267
|
+
}, [
|
|
1268
|
+
a("span", Be, _(e.key.toUpperCase()), 1),
|
|
1269
|
+
a("input", {
|
|
1270
|
+
class: "vc-sliders__range",
|
|
1271
|
+
type: "range",
|
|
1272
|
+
min: 0,
|
|
1273
|
+
max: e.max,
|
|
1274
|
+
step: e.step,
|
|
1275
|
+
value: l(e.key),
|
|
1276
|
+
onInput: (t) => u(e.key, t),
|
|
1277
|
+
onChange: r[0] ||= (e) => v(s).change()
|
|
1278
|
+
}, null, 40, Ve),
|
|
1279
|
+
a("span", $, _(e.key === "a" ? l(e.key).toFixed(2) : Math.round(l(e.key))), 1)
|
|
1280
|
+
]), [[b, e.key !== "a" || !t.disableAlpha]])), 64))], 4));
|
|
1281
|
+
}
|
|
1282
|
+
}), Ue = { class: "vc-sliders__label" }, We = [
|
|
1283
|
+
"max",
|
|
1284
|
+
"step",
|
|
1285
|
+
"value",
|
|
1286
|
+
"onInput"
|
|
1287
|
+
], Ge = { class: "vc-sliders__value" }, Ke = /* @__PURE__ */ s({
|
|
1288
|
+
__name: "HSVSliders",
|
|
1289
|
+
props: /*@__PURE__*/ c({
|
|
1290
|
+
format: { default: "hex" },
|
|
1291
|
+
disableAlpha: {
|
|
1292
|
+
type: Boolean,
|
|
1293
|
+
default: !1
|
|
1294
|
+
},
|
|
1295
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
1296
|
+
}, {
|
|
1297
|
+
modelValue: {},
|
|
1298
|
+
modelModifiers: {}
|
|
1299
|
+
}),
|
|
1300
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1301
|
+
setup(t, { emit: n }) {
|
|
1302
|
+
let r = y(t, "modelValue"), o = t, s = F(r, n, () => o.format, () => o.disableAlpha), c = [
|
|
1303
|
+
{
|
|
1304
|
+
key: "h",
|
|
1305
|
+
max: 360,
|
|
1306
|
+
step: 1
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
key: "s",
|
|
1310
|
+
max: 100,
|
|
1311
|
+
step: 1
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
key: "v",
|
|
1315
|
+
max: 100,
|
|
1316
|
+
step: 1
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
key: "a",
|
|
1320
|
+
max: 1,
|
|
1321
|
+
step: .01
|
|
1322
|
+
}
|
|
1323
|
+
];
|
|
1324
|
+
function l(e) {
|
|
1325
|
+
return s.hsva.value[e];
|
|
1326
|
+
}
|
|
1327
|
+
function u(e, t) {
|
|
1328
|
+
let n = +t.target.value;
|
|
1329
|
+
s.setFromHsva({
|
|
1330
|
+
...s.hsva.value,
|
|
1331
|
+
[e]: n
|
|
1332
|
+
}), s.input();
|
|
1333
|
+
}
|
|
1334
|
+
return (n, r) => (p(), i("div", {
|
|
1335
|
+
class: "vc-sliders",
|
|
1336
|
+
style: d({ width: t.width })
|
|
1337
|
+
}, [(p(), i(e, null, g(c, (e) => S(a("div", {
|
|
1338
|
+
class: "vc-sliders__row",
|
|
1339
|
+
key: e.key
|
|
1340
|
+
}, [
|
|
1341
|
+
a("span", Ue, _(e.key.toUpperCase()), 1),
|
|
1342
|
+
a("input", {
|
|
1343
|
+
class: "vc-sliders__range",
|
|
1344
|
+
type: "range",
|
|
1345
|
+
min: 0,
|
|
1346
|
+
max: e.max,
|
|
1347
|
+
step: e.step,
|
|
1348
|
+
value: l(e.key),
|
|
1349
|
+
onInput: (t) => u(e.key, t),
|
|
1350
|
+
onChange: r[0] ||= (e) => v(s).change()
|
|
1351
|
+
}, null, 40, We),
|
|
1352
|
+
a("span", Ge, _(e.key === "a" ? l(e.key).toFixed(2) : Math.round(l(e.key))), 1)
|
|
1353
|
+
]), [[b, e.key !== "a" || !t.disableAlpha]])), 64))], 4));
|
|
1354
|
+
}
|
|
1355
|
+
}), qe = { class: "vc-sliders__label" }, Je = [
|
|
1356
|
+
"max",
|
|
1357
|
+
"step",
|
|
1358
|
+
"value",
|
|
1359
|
+
"onInput"
|
|
1360
|
+
], Ye = { class: "vc-sliders__value" }, Xe = /* @__PURE__ */ s({
|
|
1361
|
+
__name: "HSLSliders",
|
|
1362
|
+
props: /*@__PURE__*/ c({
|
|
1363
|
+
format: { default: "hsl" },
|
|
1364
|
+
disableAlpha: {
|
|
1365
|
+
type: Boolean,
|
|
1366
|
+
default: !1
|
|
1367
|
+
},
|
|
1368
|
+
width: { default: "var(--vc-width, 240px)" }
|
|
1369
|
+
}, {
|
|
1370
|
+
modelValue: {},
|
|
1371
|
+
modelModifiers: {}
|
|
1372
|
+
}),
|
|
1373
|
+
emits: /*@__PURE__*/ c(["change", "input"], ["update:modelValue"]),
|
|
1374
|
+
setup(t, { emit: n }) {
|
|
1375
|
+
let r = y(t, "modelValue"), o = t, s = F(r, n, () => o.format, () => o.disableAlpha), c = [
|
|
1376
|
+
{
|
|
1377
|
+
key: "h",
|
|
1378
|
+
max: 360,
|
|
1379
|
+
step: 1
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
key: "s",
|
|
1383
|
+
max: 100,
|
|
1384
|
+
step: 1
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
key: "l",
|
|
1388
|
+
max: 100,
|
|
1389
|
+
step: 1
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
key: "a",
|
|
1393
|
+
max: 1,
|
|
1394
|
+
step: .01
|
|
1395
|
+
}
|
|
1396
|
+
];
|
|
1397
|
+
function l(e) {
|
|
1398
|
+
return s.hsla.value[e];
|
|
1399
|
+
}
|
|
1400
|
+
function u(e, t) {
|
|
1401
|
+
let n = +t.target.value;
|
|
1402
|
+
s.setFromHsla({
|
|
1403
|
+
...s.hsla.value,
|
|
1404
|
+
[e]: n
|
|
1405
|
+
}), s.input();
|
|
1406
|
+
}
|
|
1407
|
+
return (n, r) => (p(), i("div", {
|
|
1408
|
+
class: "vc-sliders",
|
|
1409
|
+
style: d({ width: t.width })
|
|
1410
|
+
}, [(p(), i(e, null, g(c, (e) => S(a("div", {
|
|
1411
|
+
class: "vc-sliders__row",
|
|
1412
|
+
key: e.key
|
|
1413
|
+
}, [
|
|
1414
|
+
a("span", qe, _(e.key.toUpperCase()), 1),
|
|
1415
|
+
a("input", {
|
|
1416
|
+
class: "vc-sliders__range",
|
|
1417
|
+
type: "range",
|
|
1418
|
+
min: 0,
|
|
1419
|
+
max: e.max,
|
|
1420
|
+
step: e.step,
|
|
1421
|
+
value: l(e.key),
|
|
1422
|
+
onInput: (t) => u(e.key, t),
|
|
1423
|
+
onChange: r[0] ||= (e) => v(s).change()
|
|
1424
|
+
}, null, 40, Je),
|
|
1425
|
+
a("span", Ye, _(e.key === "a" ? l(e.key).toFixed(2) : Math.round(l(e.key))), 1)
|
|
1426
|
+
]), [[b, e.key !== "a" || !t.disableAlpha]])), 64))], 4));
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
//#endregion
|
|
1430
|
+
//#region src/composables/useColorHistory.ts
|
|
1431
|
+
function Ze(e = 8) {
|
|
1432
|
+
let t = h([]);
|
|
1433
|
+
function n(n) {
|
|
1434
|
+
let r = n.toUpperCase();
|
|
1435
|
+
t.value = [r, ...t.value.filter((e) => e !== r)].slice(0, e);
|
|
1436
|
+
}
|
|
1437
|
+
function r() {
|
|
1438
|
+
t.value = [];
|
|
1439
|
+
}
|
|
1440
|
+
return {
|
|
1441
|
+
history: m(t),
|
|
1442
|
+
add: n,
|
|
1443
|
+
clear: r
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
//#endregion
|
|
1447
|
+
export { V as Alpha, J as COMPACT_PRESETS, ue as ChromePicker, Te as CompactPicker, q as DEFAULT_PRESETS, H as EditableInput, X as GRAYSCALE_PRESETS, Ee as GrayscalePicker, Xe as HSLSliders, Ke as HSVSliders, B as Hue, Pe as HueSlider, Z as MATERIAL_GRID, de as MATERIAL_PRESETS, Oe as MaterialPicker, Se as PhotoshopPicker, He as RGBASliders, z as Saturation, _e as SketchPicker, ze as SliderPicker, Q as Swatch, Ne as SwatchesPicker, Y as TWITTER_PRESETS, je as TwitterPicker, j as hexToRgb, k as hslToRgb, E as hsvToRgb, A as rgbToHex, O as rgbToHsl, D as rgbToHsv, M as useColor, Ze as useColorHistory, R as useDrag, I as useEyeDropper };
|