@vuelor/picker 0.1.0-beta.1 → 0.2.0
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 +7 -2
- package/dist/components/ColorPickerCanvas.vue.d.ts +20 -0
- package/dist/components/ColorPickerEyeDropper.vue.d.ts +20 -0
- package/dist/components/ColorPickerInputHSB.vue.d.ts +18 -0
- package/dist/components/ColorPickerInputHSL.vue.d.ts +18 -0
- package/dist/components/ColorPickerInputHex.vue.d.ts +23 -0
- package/dist/components/ColorPickerInputRGB.vue.d.ts +18 -0
- package/dist/components/ColorPickerRoot.vue.d.ts +111 -0
- package/dist/components/ColorPickerSliderAlpha.vue.d.ts +12 -0
- package/dist/components/ColorPickerSliderBlue.vue.d.ts +12 -0
- package/dist/components/ColorPickerSliderGreen.vue.d.ts +12 -0
- package/dist/components/ColorPickerSliderHue.vue.d.ts +13 -0
- package/dist/components/ColorPickerSliderLightness.vue.d.ts +12 -0
- package/dist/components/ColorPickerSliderRed.vue.d.ts +12 -0
- package/dist/components/ColorPickerSliderSaturation.vue.d.ts +12 -0
- package/dist/components/ColorPickerSwatch.vue.d.ts +14 -0
- package/dist/composables/useColor.d.ts +60 -0
- package/dist/composables/useThumb.d.ts +7 -0
- package/dist/composables/useVModel.d.ts +5 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +723 -625
- package/dist/style.css +1 -1
- package/dist/theme/index.d.ts +70 -0
- package/dist/theme/tailwindcss.d.ts +30 -0
- package/dist/theme/vanillacss.d.ts +30 -0
- package/dist/utils/canvas.d.ts +2 -0
- package/dist/utils/color.d.ts +21 -0
- package/dist/utils/consts.d.ts +1 -0
- package/dist/utils/helpers.d.ts +2 -0
- package/dist/utils/parsers.d.ts +10 -0
- package/dist/utils/styles.d.ts +18 -0
- package/dist/utils/types.d.ts +37 -0
- package/package.json +13 -12
package/dist/index.js
CHANGED
|
@@ -1,31 +1,122 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { twMerge as
|
|
3
|
-
import { createContext as
|
|
4
|
-
|
|
1
|
+
import { ref as O, watch as te, computed as m, toRaw as j, defineComponent as V, createElementBlock as P, openBlock as y, normalizeClass as c, unref as l, renderSlot as T, onMounted as ne, onUnmounted as re, useTemplateRef as ue, watchEffect as ie, withModifiers as ce, normalizeStyle as x, createElementVNode as h, createBlock as A, createCommentVNode as W, withCtx as F, getCurrentInstance as de, createVNode as w } from "vue";
|
|
2
|
+
import { twMerge as ve } from "tailwind-merge";
|
|
3
|
+
import { createContext as pe, Primitive as ae, SliderRoot as L, SliderTrack as G, SliderThumb as N } from "reka-ui";
|
|
4
|
+
function _(a, e = 0, t = 1) {
|
|
5
|
+
return Math.max(e, Math.min(t, a));
|
|
6
|
+
}
|
|
7
|
+
function le(a, e = 1) {
|
|
8
|
+
const t = [];
|
|
9
|
+
let s = 0;
|
|
10
|
+
for (; s < a.length; )
|
|
11
|
+
t.push(a.substring(s, s + e)), s += e;
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function se(a) {
|
|
15
|
+
const { h: e, s: t, l: s } = a, u = s + t * Math.min(s, 1 - s), i = u === 0 ? 0 : 2 - 2 * s / u;
|
|
16
|
+
return { h: e, s: i, v: u };
|
|
17
|
+
}
|
|
18
|
+
function oe(a) {
|
|
19
|
+
const { h: e, s: t, v: s } = a, u = s - s * t / 2, i = u === 1 || u === 0 ? 0 : (s - u) / Math.min(u, 1 - u);
|
|
20
|
+
return { h: e, s: i, l: u };
|
|
21
|
+
}
|
|
22
|
+
function X(a) {
|
|
23
|
+
const { h: e, s: t, v: s } = a, u = (o) => {
|
|
24
|
+
const r = (o + e / 60) % 6;
|
|
25
|
+
return s - s * t * Math.max(Math.min(r, 4 - r, 1), 0);
|
|
26
|
+
}, i = [u(5), u(3), u(1)].map((o) => Math.round(o * 255));
|
|
27
|
+
return { r: i[0], g: i[1], b: i[2] };
|
|
28
|
+
}
|
|
29
|
+
function he(a) {
|
|
30
|
+
if (!a) return { h: 0, s: 1, v: 1 };
|
|
31
|
+
const e = a.r / 255, t = a.g / 255, s = a.b / 255, u = Math.max(e, t, s), i = Math.min(e, t, s);
|
|
32
|
+
let o = 0;
|
|
33
|
+
u !== i && (u === e ? o = 60 * (0 + (t - s) / (u - i)) : u === t ? o = 60 * (2 + (s - e) / (u - i)) : u === s && (o = 60 * (4 + (e - t) / (u - i)))), o < 0 && (o = o + 360);
|
|
34
|
+
const r = u === 0 ? 0 : (u - i) / u, n = [o, r, u];
|
|
35
|
+
return { h: n[0], s: n[1], v: n[2] };
|
|
36
|
+
}
|
|
37
|
+
const R = (a) => {
|
|
38
|
+
const e = Math.round(a).toString(16);
|
|
39
|
+
return ("00".substring(0, 2 - e.length) + e).toUpperCase();
|
|
40
|
+
};
|
|
41
|
+
function q(a) {
|
|
42
|
+
return `#${[
|
|
43
|
+
R(a.r),
|
|
44
|
+
R(a.g),
|
|
45
|
+
R(a.b)
|
|
46
|
+
].join("")}`;
|
|
47
|
+
}
|
|
48
|
+
function be(a) {
|
|
49
|
+
return `#${[
|
|
50
|
+
R(a.r),
|
|
51
|
+
R(a.g),
|
|
52
|
+
R(a.b),
|
|
53
|
+
R(a.a * 255)
|
|
54
|
+
].join("")}`;
|
|
55
|
+
}
|
|
56
|
+
function J(a) {
|
|
57
|
+
const e = le(a.slice(1), 2).map((t) => parseInt(t, 16));
|
|
58
|
+
return {
|
|
59
|
+
r: e[0],
|
|
60
|
+
g: e[1],
|
|
61
|
+
b: e[2]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function ot(a) {
|
|
65
|
+
const e = le(a.slice(1), 2).map((t) => parseInt(t, 16));
|
|
66
|
+
return {
|
|
67
|
+
r: e[0],
|
|
68
|
+
g: e[1],
|
|
69
|
+
b: e[2],
|
|
70
|
+
a: e[3] / 255
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function fe(a) {
|
|
74
|
+
return `rgba(${a.r}, ${a.g}, ${a.b}, ${a.a})`;
|
|
75
|
+
}
|
|
76
|
+
function me(a, e, t) {
|
|
77
|
+
const s = O(void 0);
|
|
78
|
+
return te(
|
|
79
|
+
() => a.modelValue,
|
|
80
|
+
(u) => {
|
|
81
|
+
u !== s.value && t(u);
|
|
82
|
+
},
|
|
83
|
+
{ immediate: !0 }
|
|
84
|
+
), m({
|
|
85
|
+
get: () => a.modelValue,
|
|
86
|
+
set: (u) => {
|
|
87
|
+
s.value = u, e("update:modelValue", u);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const ge = {
|
|
5
92
|
picker: {
|
|
6
93
|
root: "w-60 bg-white rounded-[13px] p-4 flex flex-col gap-2 shadow-vuelor-card"
|
|
7
94
|
},
|
|
8
95
|
dropper: {
|
|
9
|
-
base: "hover:bg-[#0000000d] rounded-[5px] focus-within:outline-1 focus-within:outline-[#0d99ff] p-1"
|
|
96
|
+
base: "enabled:hover:bg-[#0000000d] disabled:opacity-50 rounded-[5px] focus-within:outline-1 focus-within:outline-[#0d99ff] p-1"
|
|
10
97
|
},
|
|
11
98
|
shared: {
|
|
12
99
|
thumb: "block w-4 h-4 rounded-full border-4 border-white shadow-vuelor-thumb focus:outline-1 outline-[#0d99ff]"
|
|
13
100
|
},
|
|
14
101
|
canvas: {
|
|
15
|
-
root: "relative touch-none data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
102
|
+
root: "relative touch-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
16
103
|
area: "rounded-[5px] outline-1 outline-solid -outline-offset-1 outline-[#0000001a]"
|
|
17
104
|
},
|
|
18
105
|
slider: {
|
|
19
|
-
root: "relative h-4 w-full data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-4
|
|
20
|
-
track: "relative h-4 w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-4
|
|
106
|
+
root: "relative h-4 w-full flex items-center select-none touch-none data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-4 data-[orientation=vertical]:flex-col data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
107
|
+
track: "relative h-4 w-full shadow-vuelor-inner grow rounded-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-4"
|
|
21
108
|
},
|
|
22
109
|
input: {
|
|
23
|
-
group: "w-full flex gap-[1px] rounded-[5px] hover:outline-1 outline-[#e6e6e6] focus-within:outline-1 focus-within:outline-[#0d99ff] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
24
|
-
item: "flex flex-1 data-[alpha-input]:grow-0 items-center px-1
|
|
25
|
-
label: "select-none text-black text-[11px] opacity-40",
|
|
26
|
-
field: "w-full
|
|
110
|
+
group: "w-full flex gap-[1px] rounded-[5px] enabled:hover:outline-1 outline-[#e6e6e6] focus-within:outline-1 focus-within:outline-[#0d99ff] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
111
|
+
item: "flex flex-1 data-[before]:grow-0 data-[alpha-input]:grow-0 items-center px-1 gap-1 bg-[#f5f5f5] first:rounded-l-[5px] last:rounded-r-[5px]",
|
|
112
|
+
label: "select-none text-black text-[11px] opacity-40 data-[alpha-label]:block",
|
|
113
|
+
field: "w-full min-w-5 h-6 text-[11px] focus:outline-none"
|
|
114
|
+
},
|
|
115
|
+
swatch: {
|
|
116
|
+
base: "relative grow-0 h-4 w-4 rounded-[20%] overflow-hidden focus-within:outline-1 focus-within:outline-[#0d99ff] disabled:opacity-50",
|
|
117
|
+
alpha: "absolute top-0 right-0 h-full w-1/2"
|
|
27
118
|
}
|
|
28
|
-
},
|
|
119
|
+
}, ke = {
|
|
29
120
|
picker: {
|
|
30
121
|
root: "vuelor-picker-root"
|
|
31
122
|
},
|
|
@@ -48,23 +139,27 @@ const de = {
|
|
|
48
139
|
item: "vuelor-picker-input-item",
|
|
49
140
|
label: "vuelor-picker-input-label",
|
|
50
141
|
field: "vuelor-picker-input-field"
|
|
142
|
+
},
|
|
143
|
+
swatch: {
|
|
144
|
+
base: "vuelor-picker-swatch-base",
|
|
145
|
+
alpha: "vuelor-picker-swatch-alpha"
|
|
51
146
|
}
|
|
52
|
-
},
|
|
53
|
-
tailwindcss:
|
|
54
|
-
vanillacss:
|
|
147
|
+
}, $e = {
|
|
148
|
+
tailwindcss: ge,
|
|
149
|
+
vanillacss: ke
|
|
55
150
|
};
|
|
56
|
-
function
|
|
151
|
+
function Ce(a, e) {
|
|
57
152
|
return (...t) => {
|
|
58
153
|
const s = {};
|
|
59
154
|
for (const u of t) {
|
|
60
|
-
const i =
|
|
155
|
+
const i = a[u];
|
|
61
156
|
if (i)
|
|
62
157
|
for (const [o, r] of Object.entries(i))
|
|
63
158
|
s[o] = (...n) => {
|
|
64
|
-
const
|
|
65
|
-
return
|
|
159
|
+
const p = e?.[u]?.[o];
|
|
160
|
+
return ve(
|
|
66
161
|
r,
|
|
67
|
-
|
|
162
|
+
p,
|
|
68
163
|
...n.filter(Boolean)
|
|
69
164
|
);
|
|
70
165
|
};
|
|
@@ -72,63 +167,8 @@ function he(l, e) {
|
|
|
72
167
|
return s;
|
|
73
168
|
};
|
|
74
169
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
function be(l, e = 1) {
|
|
79
|
-
const t = [];
|
|
80
|
-
let s = 0;
|
|
81
|
-
for (; s < l.length; )
|
|
82
|
-
t.push(l.substring(s, s + e)), s += e;
|
|
83
|
-
return t;
|
|
84
|
-
}
|
|
85
|
-
function te(l) {
|
|
86
|
-
const { h: e, s: t, l: s } = l, u = s + t * Math.min(s, 1 - s), i = u === 0 ? 0 : 2 - 2 * s / u;
|
|
87
|
-
return { h: e, s: i, v: u };
|
|
88
|
-
}
|
|
89
|
-
function ae(l) {
|
|
90
|
-
const { h: e, s: t, v: s } = l, u = s - s * t / 2, i = u === 1 || u === 0 ? 0 : (s - u) / Math.min(u, 1 - u);
|
|
91
|
-
return { h: e, s: i, l: u };
|
|
92
|
-
}
|
|
93
|
-
function X(l) {
|
|
94
|
-
const { h: e, s: t, v: s } = l, u = (o) => {
|
|
95
|
-
const r = (o + e / 60) % 6;
|
|
96
|
-
return s - s * t * Math.max(Math.min(r, 4 - r, 1), 0);
|
|
97
|
-
}, i = [u(5), u(3), u(1)].map((o) => Math.round(o * 255));
|
|
98
|
-
return { r: i[0], g: i[1], b: i[2] };
|
|
99
|
-
}
|
|
100
|
-
function fe(l) {
|
|
101
|
-
if (!l) return { h: 0, s: 1, v: 1 };
|
|
102
|
-
const e = l.r / 255, t = l.g / 255, s = l.b / 255, u = Math.max(e, t, s), i = Math.min(e, t, s);
|
|
103
|
-
let o = 0;
|
|
104
|
-
u !== i && (u === e ? o = 60 * (0 + (t - s) / (u - i)) : u === t ? o = 60 * (2 + (s - e) / (u - i)) : u === s && (o = 60 * (4 + (e - t) / (u - i)))), o < 0 && (o = o + 360);
|
|
105
|
-
const r = u === 0 ? 0 : (u - i) / u, n = [o, r, u];
|
|
106
|
-
return { h: n[0], s: n[1], v: n[2] };
|
|
107
|
-
}
|
|
108
|
-
const O = (l) => {
|
|
109
|
-
const e = Math.round(l).toString(16);
|
|
110
|
-
return ("00".substring(0, 2 - e.length) + e).toUpperCase();
|
|
111
|
-
};
|
|
112
|
-
function Z(l) {
|
|
113
|
-
return `#${[
|
|
114
|
-
O(l.r),
|
|
115
|
-
O(l.g),
|
|
116
|
-
O(l.b)
|
|
117
|
-
].join("")}`;
|
|
118
|
-
}
|
|
119
|
-
function q(l) {
|
|
120
|
-
const e = be(l.slice(1), 2).map((t) => parseInt(t, 16));
|
|
121
|
-
return {
|
|
122
|
-
r: e[0],
|
|
123
|
-
g: e[1],
|
|
124
|
-
b: e[2]
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function ge(l) {
|
|
128
|
-
return `rgba(${l.r}, ${l.g}, ${l.b}, ${l.a})`;
|
|
129
|
-
}
|
|
130
|
-
function Y(l) {
|
|
131
|
-
const e = l.trim(), t = e.match(/^#?(?<r>[A-Fa-f0-9]{2})(?<g>[A-Fa-f0-9]{2})(?<b>[A-Fa-f0-9]{2})$/);
|
|
170
|
+
function Z(a) {
|
|
171
|
+
const e = a.trim(), t = e.match(/^#?(?<r>[A-Fa-f0-9]{2})(?<g>[A-Fa-f0-9]{2})(?<b>[A-Fa-f0-9]{2})$/);
|
|
132
172
|
if (t?.groups) {
|
|
133
173
|
const { r: o, g: r, b: n } = t.groups;
|
|
134
174
|
return {
|
|
@@ -150,28 +190,36 @@ function Y(l) {
|
|
|
150
190
|
}
|
|
151
191
|
const u = e.match(/^#?(?<r>[A-Fa-f0-9])(?<g>[A-Fa-f0-9])(?<b>[A-Fa-f0-9])$/);
|
|
152
192
|
if (u?.groups) {
|
|
153
|
-
const { r: o, g: r, b: n } = u.groups, d = o + o,
|
|
193
|
+
const { r: o, g: r, b: n } = u.groups, d = o + o, p = r + r, b = n + n;
|
|
154
194
|
return {
|
|
155
195
|
r: parseInt(d, 16),
|
|
156
|
-
g: parseInt(
|
|
196
|
+
g: parseInt(p, 16),
|
|
157
197
|
b: parseInt(b, 16),
|
|
158
198
|
a: 1
|
|
159
199
|
};
|
|
160
200
|
}
|
|
161
201
|
const i = e.match(/^#?(?<r>[A-Fa-f0-9])(?<g>[A-Fa-f0-9])(?<b>[A-Fa-f0-9])(?<a>[A-Fa-f0-9])$/);
|
|
162
202
|
if (i?.groups) {
|
|
163
|
-
const { r: o, g: r, b: n, a: d } = i.groups,
|
|
203
|
+
const { r: o, g: r, b: n, a: d } = i.groups, p = o + o, b = r + r, f = n + n, k = d + d;
|
|
164
204
|
return {
|
|
165
|
-
r: parseInt(
|
|
205
|
+
r: parseInt(p, 16),
|
|
166
206
|
g: parseInt(b, 16),
|
|
167
207
|
b: parseInt(f, 16),
|
|
168
|
-
a: parseInt(
|
|
208
|
+
a: parseInt(k, 16) / 255
|
|
169
209
|
};
|
|
170
210
|
}
|
|
171
|
-
return
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
function ye(a) {
|
|
214
|
+
return a ? a.substring(0, 7).replace("#", "") : null;
|
|
172
215
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
216
|
+
function xe(a) {
|
|
217
|
+
if (!a || a.length < 9) return 100;
|
|
218
|
+
const e = a.substring(7, 9).replace("#", "");
|
|
219
|
+
return Math.round(parseInt(e, 16) / 255 * 100);
|
|
220
|
+
}
|
|
221
|
+
function z(a) {
|
|
222
|
+
const e = /^([a-zA-Z]{3,4})\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+)%?)\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+)%?)\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+)%?)(?:\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+)%?))?\s*\)$/i, t = a.match(e);
|
|
175
223
|
if (!t) return null;
|
|
176
224
|
const [, s, u, i, o, r] = t;
|
|
177
225
|
return {
|
|
@@ -179,19 +227,19 @@ function N(l) {
|
|
|
179
227
|
values: [u, i, o, r].filter(Boolean)
|
|
180
228
|
};
|
|
181
229
|
}
|
|
182
|
-
function
|
|
183
|
-
return
|
|
230
|
+
function D(a) {
|
|
231
|
+
return a.endsWith("%") ? parseFloat(a) / 100 : parseFloat(a);
|
|
184
232
|
}
|
|
185
|
-
function
|
|
186
|
-
const e =
|
|
233
|
+
function Ve(a) {
|
|
234
|
+
const e = z(a);
|
|
187
235
|
return e && e.type?.toLowerCase() === "rgb" ? {
|
|
188
236
|
r: parseInt(e.values[0], 10),
|
|
189
237
|
g: parseInt(e.values[1], 10),
|
|
190
238
|
b: parseInt(e.values[2], 10)
|
|
191
239
|
} : { r: 255, g: 0, b: 0 };
|
|
192
240
|
}
|
|
193
|
-
function
|
|
194
|
-
const e =
|
|
241
|
+
function Se(a) {
|
|
242
|
+
const e = z(a);
|
|
195
243
|
return e && e.type?.toLowerCase() === "rgb" ? {
|
|
196
244
|
r: parseInt(e.values[0], 10),
|
|
197
245
|
g: parseInt(e.values[1], 10),
|
|
@@ -199,203 +247,205 @@ function ke(l) {
|
|
|
199
247
|
a: e.values[3] ? parseFloat(e.values[3]) : 1
|
|
200
248
|
} : { r: 255, g: 0, b: 0, a: 1 };
|
|
201
249
|
}
|
|
202
|
-
function
|
|
203
|
-
const e =
|
|
250
|
+
function we(a) {
|
|
251
|
+
const e = z(a);
|
|
204
252
|
return e && e.type?.toLowerCase() === "hsl" ? {
|
|
205
253
|
h: parseFloat(e.values[0]),
|
|
206
|
-
s:
|
|
207
|
-
l:
|
|
254
|
+
s: D(e.values[1]),
|
|
255
|
+
l: D(e.values[2])
|
|
208
256
|
} : { h: 0, s: 0, l: 0 };
|
|
209
257
|
}
|
|
210
|
-
function
|
|
211
|
-
const e =
|
|
258
|
+
function _e(a) {
|
|
259
|
+
const e = z(a);
|
|
212
260
|
return e && e.type?.toLowerCase() === "hsla" ? {
|
|
213
261
|
h: parseFloat(e.values[0]),
|
|
214
|
-
s:
|
|
215
|
-
l:
|
|
262
|
+
s: D(e.values[1]),
|
|
263
|
+
l: D(e.values[2]),
|
|
216
264
|
a: e.values[3] ? parseFloat(e.values[3]) : 1
|
|
217
265
|
} : { h: 0, s: 0, l: 0, a: 1 };
|
|
218
266
|
}
|
|
219
|
-
function
|
|
220
|
-
const e =
|
|
267
|
+
function He(a) {
|
|
268
|
+
const e = z(a);
|
|
221
269
|
return e && e.type?.toLowerCase() === "hsv" ? {
|
|
222
270
|
h: parseFloat(e.values[0]),
|
|
223
|
-
s:
|
|
224
|
-
v:
|
|
271
|
+
s: D(e.values[1]),
|
|
272
|
+
v: D(e.values[2])
|
|
225
273
|
} : { h: 0, s: 0, v: 0 };
|
|
226
274
|
}
|
|
227
|
-
function
|
|
228
|
-
const e =
|
|
275
|
+
function Be(a) {
|
|
276
|
+
const e = z(a);
|
|
229
277
|
return e && e.type?.toLowerCase() === "hsva" ? {
|
|
230
278
|
h: parseFloat(e.values[0]),
|
|
231
|
-
s:
|
|
232
|
-
v:
|
|
279
|
+
s: D(e.values[1]),
|
|
280
|
+
v: D(e.values[2]),
|
|
233
281
|
a: e.values[3] ? parseFloat(e.values[3]) : 1
|
|
234
282
|
} : { h: 0, s: 0, v: 0, a: 1 };
|
|
235
283
|
}
|
|
236
|
-
function
|
|
237
|
-
const e =
|
|
238
|
-
return { hsv: e, hsl: t, rgb:
|
|
284
|
+
function K(a) {
|
|
285
|
+
const e = he(a), t = oe(e);
|
|
286
|
+
return { hsv: e, hsl: t, rgb: a };
|
|
239
287
|
}
|
|
240
|
-
function
|
|
241
|
-
const e =
|
|
242
|
-
return { hsv: e, hsl:
|
|
288
|
+
function Q(a) {
|
|
289
|
+
const e = se(a), t = X(e);
|
|
290
|
+
return { hsv: e, hsl: a, rgb: t };
|
|
243
291
|
}
|
|
244
|
-
function
|
|
245
|
-
const e =
|
|
246
|
-
return { hsv:
|
|
292
|
+
function ee(a) {
|
|
293
|
+
const e = oe(a), t = X(a);
|
|
294
|
+
return { hsv: a, hsl: e, rgb: t };
|
|
247
295
|
}
|
|
248
|
-
function
|
|
249
|
-
const
|
|
296
|
+
function Ie() {
|
|
297
|
+
const a = O({
|
|
250
298
|
hsv: { h: 0, s: 0, v: 0 },
|
|
251
299
|
hsl: { h: 0, s: 0, l: 0 },
|
|
252
300
|
rgb: { r: 0, g: 0, b: 0 }
|
|
253
|
-
}), e =
|
|
254
|
-
get: () =>
|
|
255
|
-
set: (
|
|
256
|
-
}), s =
|
|
257
|
-
get: () => ({ ...
|
|
258
|
-
set: (
|
|
259
|
-
e.value = Math.round((
|
|
301
|
+
}), e = O(100), t = m({
|
|
302
|
+
get: () => a.value.rgb,
|
|
303
|
+
set: (v) => a.value = K(v)
|
|
304
|
+
}), s = m({
|
|
305
|
+
get: () => ({ ...a.value.rgb, a: e.value / 100 }),
|
|
306
|
+
set: (v) => {
|
|
307
|
+
e.value = Math.round((v.a ?? 1) * 100), a.value = K({ r: v.r, g: v.g, b: v.b });
|
|
260
308
|
}
|
|
261
|
-
}), u =
|
|
262
|
-
get: () =>
|
|
263
|
-
set: (
|
|
264
|
-
}), i =
|
|
265
|
-
get: () => ({ ...
|
|
266
|
-
set: (
|
|
267
|
-
e.value = Math.round((
|
|
309
|
+
}), u = m({
|
|
310
|
+
get: () => a.value.hsl,
|
|
311
|
+
set: (v) => a.value = Q(v)
|
|
312
|
+
}), i = m({
|
|
313
|
+
get: () => ({ ...a.value.hsl, a: e.value / 100 }),
|
|
314
|
+
set: (v) => {
|
|
315
|
+
e.value = Math.round((v.a ?? 1) * 100), a.value = Q({ h: v.h, s: v.s, l: v.l });
|
|
268
316
|
}
|
|
269
|
-
}), o =
|
|
270
|
-
get: () =>
|
|
271
|
-
set: (
|
|
272
|
-
}), r =
|
|
273
|
-
get: () => ({ ...
|
|
274
|
-
set: (
|
|
275
|
-
e.value = Math.round((
|
|
317
|
+
}), o = m({
|
|
318
|
+
get: () => a.value.hsv,
|
|
319
|
+
set: (v) => a.value = ee(v)
|
|
320
|
+
}), r = m({
|
|
321
|
+
get: () => ({ ...a.value.hsv, a: e.value / 100 }),
|
|
322
|
+
set: (v) => {
|
|
323
|
+
e.value = Math.round((v.a ?? 1) * 100), a.value = ee({ h: v.h, s: v.s, v: v.v });
|
|
276
324
|
}
|
|
277
|
-
}), n =
|
|
278
|
-
get: () =>
|
|
279
|
-
set: (
|
|
280
|
-
const
|
|
281
|
-
|
|
325
|
+
}), n = m({
|
|
326
|
+
get: () => q(a.value.rgb),
|
|
327
|
+
set: (v) => {
|
|
328
|
+
const C = J(v);
|
|
329
|
+
a.value = K(C);
|
|
282
330
|
}
|
|
283
|
-
}), d =
|
|
331
|
+
}), d = m({
|
|
284
332
|
get: () => {
|
|
285
|
-
const
|
|
286
|
-
return
|
|
333
|
+
const v = q(a.value.rgb), C = R(e.value / 100 * 255);
|
|
334
|
+
return v + C;
|
|
287
335
|
},
|
|
288
|
-
set: (
|
|
289
|
-
const
|
|
290
|
-
e.value = Math.round(
|
|
336
|
+
set: (v) => {
|
|
337
|
+
const C = J(v.slice(0, 7)), $ = v.slice(7, 9), I = $ ? parseInt($, 16) / 255 : 1;
|
|
338
|
+
e.value = Math.round(I * 100), a.value = K(C);
|
|
291
339
|
}
|
|
292
340
|
});
|
|
293
|
-
function
|
|
294
|
-
const { r:
|
|
295
|
-
return `rgb(${
|
|
341
|
+
function p() {
|
|
342
|
+
const { r: v, g: C, b: $ } = a.value.rgb;
|
|
343
|
+
return `rgb(${v}, ${C}, ${$})`;
|
|
296
344
|
}
|
|
297
345
|
function b() {
|
|
298
|
-
const { r:
|
|
299
|
-
return `rgba(${
|
|
346
|
+
const { r: v, g: C, b: $ } = a.value.rgb, I = (e.value / 100).toFixed(2);
|
|
347
|
+
return `rgba(${v}, ${C}, ${$}, ${I})`;
|
|
300
348
|
}
|
|
301
349
|
function f() {
|
|
302
|
-
const { h:
|
|
303
|
-
return `hsl(${
|
|
350
|
+
const { h: v, s: C, l: $ } = a.value.hsl, I = (C * 100).toFixed(1), E = ($ * 100).toFixed(1);
|
|
351
|
+
return `hsl(${v}, ${I}%, ${E}%)`;
|
|
304
352
|
}
|
|
305
|
-
function
|
|
306
|
-
const { h:
|
|
307
|
-
return `hsla(${
|
|
353
|
+
function k() {
|
|
354
|
+
const { h: v, s: C, l: $ } = a.value.hsl, I = (C * 100).toFixed(1), E = ($ * 100).toFixed(1), Y = (e.value / 100).toFixed(2);
|
|
355
|
+
return `hsla(${v}, ${I}%, ${E}%, ${Y})`;
|
|
308
356
|
}
|
|
309
|
-
function
|
|
310
|
-
const { h:
|
|
311
|
-
return `hsv(${
|
|
357
|
+
function B() {
|
|
358
|
+
const { h: v, s: C, v: $ } = a.value.hsv, I = (C * 100).toFixed(1), E = ($ * 100).toFixed(1);
|
|
359
|
+
return `hsv(${v}, ${I}%, ${E}%)`;
|
|
312
360
|
}
|
|
313
|
-
function
|
|
314
|
-
const { h:
|
|
315
|
-
return `hsva(${
|
|
361
|
+
function M() {
|
|
362
|
+
const { h: v, s: C, v: $ } = a.value.hsv, I = (C * 100).toFixed(1), E = ($ * 100).toFixed(1), Y = (e.value / 100).toFixed(2);
|
|
363
|
+
return `hsva(${v}, ${I}%, ${E}%, ${Y})`;
|
|
316
364
|
}
|
|
317
|
-
function
|
|
365
|
+
function g() {
|
|
318
366
|
return {
|
|
319
|
-
rgb:
|
|
320
|
-
rgba:
|
|
321
|
-
hsl:
|
|
322
|
-
hsla:
|
|
323
|
-
hsv:
|
|
324
|
-
hsva:
|
|
367
|
+
rgb: j(t.value),
|
|
368
|
+
rgba: j(s.value),
|
|
369
|
+
hsl: j(u.value),
|
|
370
|
+
hsla: j(i.value),
|
|
371
|
+
hsv: j(o.value),
|
|
372
|
+
hsva: j(r.value),
|
|
325
373
|
hex: n.value,
|
|
326
374
|
hexa: d.value
|
|
327
375
|
};
|
|
328
376
|
}
|
|
329
|
-
function
|
|
330
|
-
switch (
|
|
377
|
+
function H(v) {
|
|
378
|
+
switch (v) {
|
|
331
379
|
case "hex":
|
|
332
380
|
return n.value;
|
|
333
381
|
case "hexa":
|
|
334
382
|
return d.value;
|
|
335
383
|
case "rgb":
|
|
336
|
-
return
|
|
384
|
+
return p();
|
|
337
385
|
case "rgba":
|
|
338
386
|
return b();
|
|
339
387
|
case "hsl":
|
|
340
388
|
return f();
|
|
341
389
|
case "hsla":
|
|
342
|
-
return
|
|
390
|
+
return k();
|
|
343
391
|
case "hsv":
|
|
344
|
-
return
|
|
392
|
+
return B();
|
|
345
393
|
case "hsva":
|
|
346
|
-
return
|
|
394
|
+
return M();
|
|
347
395
|
case "object":
|
|
348
|
-
return
|
|
396
|
+
return g();
|
|
349
397
|
default:
|
|
350
398
|
return n.value;
|
|
351
399
|
}
|
|
352
400
|
}
|
|
353
|
-
function
|
|
354
|
-
switch (
|
|
401
|
+
function U(v, C) {
|
|
402
|
+
switch (C) {
|
|
355
403
|
case "hex": {
|
|
356
|
-
|
|
404
|
+
const $ = Z(v);
|
|
405
|
+
$ && (s.value = $);
|
|
357
406
|
break;
|
|
358
407
|
}
|
|
359
408
|
case "hexa": {
|
|
360
|
-
|
|
409
|
+
const $ = Z(v);
|
|
410
|
+
$ && (s.value = $);
|
|
361
411
|
break;
|
|
362
412
|
}
|
|
363
413
|
case "rgb": {
|
|
364
|
-
t.value =
|
|
414
|
+
t.value = Ve(v);
|
|
365
415
|
break;
|
|
366
416
|
}
|
|
367
417
|
case "rgba": {
|
|
368
|
-
s.value =
|
|
418
|
+
s.value = Se(v);
|
|
369
419
|
break;
|
|
370
420
|
}
|
|
371
421
|
case "hsl": {
|
|
372
|
-
u.value =
|
|
422
|
+
u.value = we(v);
|
|
373
423
|
break;
|
|
374
424
|
}
|
|
375
425
|
case "hsla": {
|
|
376
|
-
i.value =
|
|
426
|
+
i.value = _e(v);
|
|
377
427
|
break;
|
|
378
428
|
}
|
|
379
429
|
case "hsv": {
|
|
380
|
-
o.value =
|
|
430
|
+
o.value = He(v);
|
|
381
431
|
break;
|
|
382
432
|
}
|
|
383
433
|
case "hsva": {
|
|
384
|
-
r.value =
|
|
434
|
+
r.value = Be(v);
|
|
385
435
|
break;
|
|
386
436
|
}
|
|
387
437
|
case "object": {
|
|
388
|
-
|
|
389
|
-
hsv:
|
|
390
|
-
hsl:
|
|
391
|
-
rgb:
|
|
392
|
-
}, e.value = (
|
|
438
|
+
a.value = {
|
|
439
|
+
hsv: v.hsv,
|
|
440
|
+
hsl: v.hsl,
|
|
441
|
+
rgb: v.rgb
|
|
442
|
+
}, e.value = (v.hsva?.a ?? 1) * 100;
|
|
393
443
|
break;
|
|
394
444
|
}
|
|
395
445
|
}
|
|
396
446
|
}
|
|
397
447
|
return {
|
|
398
|
-
state:
|
|
448
|
+
state: a,
|
|
399
449
|
alpha: e,
|
|
400
450
|
rgb: t,
|
|
401
451
|
rgba: s,
|
|
@@ -405,33 +455,18 @@ function Ce() {
|
|
|
405
455
|
hsva: r,
|
|
406
456
|
hex: n,
|
|
407
457
|
hexa: d,
|
|
408
|
-
toRGBString:
|
|
458
|
+
toRGBString: p,
|
|
409
459
|
toRGBAString: b,
|
|
410
460
|
toHSLString: f,
|
|
411
|
-
toHSLAString:
|
|
412
|
-
toHSVString:
|
|
413
|
-
toHSVAString:
|
|
414
|
-
toObject:
|
|
415
|
-
toFormat:
|
|
416
|
-
fromFormat:
|
|
461
|
+
toHSLAString: k,
|
|
462
|
+
toHSVString: B,
|
|
463
|
+
toHSVAString: M,
|
|
464
|
+
toObject: g,
|
|
465
|
+
toFormat: H,
|
|
466
|
+
fromFormat: U
|
|
417
467
|
};
|
|
418
468
|
}
|
|
419
|
-
|
|
420
|
-
const s = W(void 0);
|
|
421
|
-
return ee(
|
|
422
|
-
() => l.modelValue,
|
|
423
|
-
(u) => {
|
|
424
|
-
u !== s.value && t(u);
|
|
425
|
-
},
|
|
426
|
-
{ immediate: !0 }
|
|
427
|
-
), g({
|
|
428
|
-
get: () => l.modelValue,
|
|
429
|
-
set: (u) => {
|
|
430
|
-
s.value = u, e("update:modelValue", u);
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
const [w, Ve] = ce("ColorPickerRoot"), Ye = /* @__PURE__ */ C({
|
|
469
|
+
const [S, Pe] = pe("ColorPickerRoot"), nt = /* @__PURE__ */ V({
|
|
435
470
|
__name: "ColorPickerRoot",
|
|
436
471
|
props: {
|
|
437
472
|
ui: {},
|
|
@@ -442,203 +477,205 @@ const [w, Ve] = ce("ColorPickerRoot"), Ye = /* @__PURE__ */ C({
|
|
|
442
477
|
modelValue: {},
|
|
443
478
|
format: { default: "hexa" }
|
|
444
479
|
},
|
|
445
|
-
emits: ["
|
|
446
|
-
setup(
|
|
447
|
-
const s =
|
|
480
|
+
emits: ["valueCommit", "update:modelValue"],
|
|
481
|
+
setup(a, { expose: e, emit: t }) {
|
|
482
|
+
const s = a, u = t, i = Ie(), o = me(s, u, (b) => {
|
|
448
483
|
b === null || s.format === "object" && typeof b != "object" || s.format !== "object" && typeof b == "object" ? i.hexa.value = s.defaultValue : i.fromFormat(b, s.format);
|
|
449
484
|
});
|
|
450
|
-
|
|
485
|
+
te(
|
|
451
486
|
() => [i.hexa.value, i.hsv.value],
|
|
452
487
|
() => o.value = i.toFormat(s.format)
|
|
453
488
|
);
|
|
454
|
-
const r =
|
|
455
|
-
return
|
|
489
|
+
const r = m(() => s.disabled), n = m(() => ["hexa", "rgba", "hsva", "object"].includes(s.format)), d = Ce($e[s.styling], s.ui), p = d("picker");
|
|
490
|
+
return Pe({
|
|
456
491
|
...i,
|
|
457
492
|
uiSlots: d,
|
|
458
493
|
disabled: r,
|
|
459
494
|
isAlphaEnabled: n,
|
|
460
|
-
|
|
461
|
-
s.disabled || u("
|
|
495
|
+
commitValue: () => {
|
|
496
|
+
s.disabled || u("valueCommit", i.toFormat(s.format));
|
|
462
497
|
}
|
|
463
498
|
}), e({
|
|
464
499
|
color: i
|
|
465
|
-
}), (b, f) => (
|
|
466
|
-
class: c(
|
|
500
|
+
}), (b, f) => (y(), P("div", {
|
|
501
|
+
class: c(l(p).root(s.class))
|
|
467
502
|
}, [
|
|
468
|
-
|
|
503
|
+
T(b.$slots, "default")
|
|
469
504
|
], 2));
|
|
470
505
|
}
|
|
471
506
|
});
|
|
472
|
-
function
|
|
473
|
-
const t =
|
|
474
|
-
|
|
475
|
-
const i =
|
|
476
|
-
i.addColorStop(0, "rgba(255,255,255,1)"), i.addColorStop(1, "rgba(255,255,255,0)"),
|
|
477
|
-
const o =
|
|
478
|
-
o.addColorStop(0, "rgba(0,0,0,0)"), o.addColorStop(1, "rgba(0,0,0,1)"),
|
|
507
|
+
function Ae(a, e) {
|
|
508
|
+
const t = a.canvas.width, s = a.canvas.height, u = `hsl(${e},100%,50%)`;
|
|
509
|
+
a.rect(0, 0, t, s), a.fillStyle = u, a.fillRect(0, 0, t, s);
|
|
510
|
+
const i = a.createLinearGradient(0, 0, t, 0);
|
|
511
|
+
i.addColorStop(0, "rgba(255,255,255,1)"), i.addColorStop(1, "rgba(255,255,255,0)"), a.fillStyle = i, a.fillRect(0, 0, t, s);
|
|
512
|
+
const o = a.createLinearGradient(0, 0, 0, s);
|
|
513
|
+
o.addColorStop(0, "rgba(0,0,0,0)"), o.addColorStop(1, "rgba(0,0,0,1)"), a.fillStyle = o, a.fillRect(0, 0, t, s);
|
|
479
514
|
}
|
|
480
|
-
function
|
|
481
|
-
const t =
|
|
482
|
-
|
|
483
|
-
const u =
|
|
515
|
+
function Fe(a, e) {
|
|
516
|
+
const t = a.canvas.width, s = a.canvas.height;
|
|
517
|
+
a.clearRect(0, 0, t, s);
|
|
518
|
+
const u = a.createLinearGradient(0, 0, t, 0), i = 12;
|
|
484
519
|
for (let n = 0; n <= i; n++) {
|
|
485
|
-
const d = n / i, { r:
|
|
486
|
-
u.addColorStop(d, `rgb(${
|
|
520
|
+
const d = n / i, { r: p, g: b, b: f } = X(se({ h: e, s: d, l: 0.5 }));
|
|
521
|
+
u.addColorStop(d, `rgb(${p} ${b} ${f})`);
|
|
487
522
|
}
|
|
488
|
-
|
|
489
|
-
let o =
|
|
490
|
-
o.addColorStop(0, "white"), o.addColorStop(0.5, "rgba(255,255,255,0)"),
|
|
491
|
-
let r =
|
|
492
|
-
r.addColorStop(0.5, "rgba(0,0,0,0)"), r.addColorStop(1, "black"),
|
|
523
|
+
a.fillStyle = u, a.fillRect(0, 0, t, s), a.globalCompositeOperation = "screen";
|
|
524
|
+
let o = a.createLinearGradient(0, 0, 0, s);
|
|
525
|
+
o.addColorStop(0, "white"), o.addColorStop(0.5, "rgba(255,255,255,0)"), a.fillStyle = o, a.fillRect(0, 0, t, s), a.globalCompositeOperation = "multiply";
|
|
526
|
+
let r = a.createLinearGradient(0, 0, 0, s);
|
|
527
|
+
r.addColorStop(0.5, "rgba(0,0,0,0)"), r.addColorStop(1, "black"), a.fillStyle = r, a.fillRect(0, 0, t, s), a.globalCompositeOperation = "source-over";
|
|
493
528
|
}
|
|
494
|
-
function
|
|
495
|
-
const t =
|
|
529
|
+
function Me(a, e) {
|
|
530
|
+
const t = S(), s = O({
|
|
496
531
|
top: 1,
|
|
497
532
|
left: 1,
|
|
498
533
|
width: 1,
|
|
499
534
|
height: 1
|
|
500
|
-
}), { hsl: u, hsv: i } = t, o =
|
|
535
|
+
}), { hsl: u, hsv: i } = t, o = m({
|
|
501
536
|
get: () => e.value === "HSV" ? 1 - i.value.v : 1 - u.value.l,
|
|
502
|
-
set: (
|
|
503
|
-
e.value === "HSV" ? i.value = { ...i.value, v: _(1 -
|
|
537
|
+
set: (g) => {
|
|
538
|
+
e.value === "HSV" ? i.value = { ...i.value, v: _(1 - g, 0, 1) } : u.value = { ...u.value, l: _(1 - g, 0, 1) };
|
|
504
539
|
}
|
|
505
|
-
}), r =
|
|
540
|
+
}), r = m({
|
|
506
541
|
get: () => e.value === "HSV" ? i.value.s : u.value.s,
|
|
507
|
-
set: (
|
|
508
|
-
e.value === "HSV" ? i.value = { ...i.value, s: _(
|
|
542
|
+
set: (g) => {
|
|
543
|
+
e.value === "HSV" ? i.value = { ...i.value, s: _(g, 0, 1) } : u.value = { ...u.value, s: _(g, 0, 1) };
|
|
509
544
|
}
|
|
510
|
-
}), n =
|
|
511
|
-
const
|
|
545
|
+
}), n = O(!1), d = m(() => {
|
|
546
|
+
const g = r.value * s.value.width, H = o.value * s.value.height;
|
|
512
547
|
return {
|
|
513
548
|
top: 0,
|
|
514
549
|
left: 0,
|
|
515
550
|
position: "absolute",
|
|
516
|
-
|
|
517
|
-
|
|
551
|
+
display: n.value ? void 0 : "none",
|
|
552
|
+
backgroundColor: fe({ ...t.rgba.value, a: 1 }),
|
|
553
|
+
transform: `translate3d(calc(-50% + ${g}px), calc(-50% + ${H}px), 0px)`
|
|
518
554
|
};
|
|
519
555
|
});
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
}),
|
|
523
|
-
window.removeEventListener("resize",
|
|
556
|
+
ne(() => {
|
|
557
|
+
p(), n.value = !0, window.addEventListener("resize", p);
|
|
558
|
+
}), re(() => {
|
|
559
|
+
window.removeEventListener("resize", p);
|
|
524
560
|
});
|
|
525
|
-
function
|
|
526
|
-
const
|
|
527
|
-
|
|
561
|
+
function p() {
|
|
562
|
+
const g = a.value;
|
|
563
|
+
g && (s.value = g.getBoundingClientRect());
|
|
528
564
|
}
|
|
529
|
-
function
|
|
530
|
-
document.addEventListener("pointermove",
|
|
565
|
+
function b(g) {
|
|
566
|
+
t.disabled.value || (document.addEventListener("pointermove", f), document.addEventListener("pointerup", k), p(), f(g));
|
|
531
567
|
}
|
|
532
|
-
function
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
r.value = _(U, 0, s.value.width) / s.value.width, o.value = _(
|
|
568
|
+
function f(g) {
|
|
569
|
+
g.preventDefault();
|
|
570
|
+
const H = g.clientY - s.value.top, U = g.clientX - s.value.left;
|
|
571
|
+
r.value = _(U, 0, s.value.width) / s.value.width, o.value = _(H, 0, s.value.height) / s.value.height;
|
|
536
572
|
}
|
|
537
|
-
function
|
|
538
|
-
document.removeEventListener("pointermove",
|
|
573
|
+
function k() {
|
|
574
|
+
document.removeEventListener("pointermove", f), document.removeEventListener("pointerup", k), t.commitValue();
|
|
539
575
|
}
|
|
540
|
-
function B(
|
|
541
|
-
|
|
542
|
-
|
|
576
|
+
function B(g) {
|
|
577
|
+
if (t.disabled.value) return;
|
|
578
|
+
const H = g.shiftKey ? 0.1 : 0.01;
|
|
579
|
+
switch (g.key) {
|
|
543
580
|
case "ArrowUp":
|
|
544
|
-
|
|
581
|
+
g.preventDefault(), o.value -= H, t.commitValue();
|
|
545
582
|
break;
|
|
546
583
|
case "ArrowDown":
|
|
547
|
-
|
|
584
|
+
g.preventDefault(), o.value += H, t.commitValue();
|
|
548
585
|
break;
|
|
549
586
|
case "ArrowLeft":
|
|
550
|
-
|
|
587
|
+
g.preventDefault(), r.value -= H, t.commitValue();
|
|
551
588
|
break;
|
|
552
589
|
case "ArrowRight":
|
|
553
|
-
|
|
590
|
+
g.preventDefault(), r.value += H, t.commitValue();
|
|
554
591
|
break;
|
|
555
592
|
}
|
|
556
593
|
}
|
|
557
|
-
function
|
|
558
|
-
|
|
559
|
-
|
|
594
|
+
function M(g) {
|
|
595
|
+
if (t.disabled.value) return;
|
|
596
|
+
const H = g.deltaY * 0.1, U = (t.hsv.value.h + H) % 360;
|
|
597
|
+
g.preventDefault(), t.hsv.value = {
|
|
560
598
|
...t.hsv.value,
|
|
561
599
|
h: U < 0 ? 360 : U
|
|
562
600
|
};
|
|
563
601
|
}
|
|
564
602
|
return {
|
|
565
|
-
thumbStyles:
|
|
566
|
-
handleWheel:
|
|
603
|
+
thumbStyles: d,
|
|
604
|
+
handleWheel: M,
|
|
567
605
|
handleKeyDown: B,
|
|
568
|
-
handlePointerDown:
|
|
606
|
+
handlePointerDown: b
|
|
569
607
|
};
|
|
570
608
|
}
|
|
571
|
-
const
|
|
609
|
+
const Re = ["data-disabled"], De = ["height", "width"], rt = /* @__PURE__ */ V({
|
|
572
610
|
__name: "ColorPickerCanvas",
|
|
573
611
|
props: {
|
|
574
612
|
type: { default: "HSV" },
|
|
575
613
|
height: { default: 208 },
|
|
576
614
|
width: { default: 208 },
|
|
615
|
+
wheel: { type: Boolean, default: !0 },
|
|
577
616
|
class: {},
|
|
578
617
|
ui: {}
|
|
579
618
|
},
|
|
580
|
-
setup(
|
|
581
|
-
const e =
|
|
619
|
+
setup(a) {
|
|
620
|
+
const e = S(), t = ue("canvasRef"), s = a, u = m(() => ({
|
|
582
621
|
position: "relative",
|
|
583
622
|
height: `${s.height}px`,
|
|
584
623
|
width: `${s.width}px`
|
|
585
624
|
}));
|
|
586
|
-
|
|
625
|
+
ie(() => {
|
|
587
626
|
const b = t.value?.getContext("2d");
|
|
588
627
|
if (b)
|
|
589
628
|
switch (s.type) {
|
|
590
629
|
case "HSL":
|
|
591
|
-
|
|
630
|
+
Fe(b, e.hsv.value.h);
|
|
592
631
|
break;
|
|
593
632
|
case "HSV":
|
|
594
|
-
|
|
633
|
+
Ae(b, e.hsv.value.h);
|
|
595
634
|
break;
|
|
596
635
|
}
|
|
597
636
|
});
|
|
598
|
-
const i =
|
|
637
|
+
const i = m(() => s.type), {
|
|
599
638
|
thumbStyles: o,
|
|
600
639
|
handleWheel: r,
|
|
601
640
|
handleKeyDown: n,
|
|
602
641
|
handlePointerDown: d
|
|
603
|
-
} =
|
|
604
|
-
return (b, f) => (
|
|
605
|
-
style:
|
|
606
|
-
class: c(
|
|
607
|
-
|
|
642
|
+
} = Me(t, i), p = e.uiSlots("canvas", "shared");
|
|
643
|
+
return (b, f) => (y(), P("div", {
|
|
644
|
+
style: x(u.value),
|
|
645
|
+
class: c(l(p).root(s.ui?.root, s.class)),
|
|
646
|
+
"data-disabled": l(e).disabled.value ? "" : null,
|
|
647
|
+
onContextmenu: f[0] || (f[0] = ce(() => {
|
|
608
648
|
}, ["prevent"])),
|
|
609
|
-
|
|
610
|
-
(...
|
|
611
|
-
|
|
612
|
-
(...
|
|
613
|
-
|
|
614
|
-
(...B) => a(d) && a(d)(...B))
|
|
649
|
+
onKeydown: f[1] || (f[1] = //@ts-ignore
|
|
650
|
+
(...k) => l(n) && l(n)(...k)),
|
|
651
|
+
onPointerdown: f[2] || (f[2] = //@ts-ignore
|
|
652
|
+
(...k) => l(d) && l(d)(...k)),
|
|
653
|
+
onWheel: f[3] || (f[3] = (k) => s.wheel && l(r)(k))
|
|
615
654
|
}, [
|
|
616
|
-
|
|
655
|
+
h("canvas", {
|
|
617
656
|
ref_key: "canvasRef",
|
|
618
657
|
ref: t,
|
|
619
658
|
height: s.height,
|
|
620
659
|
width: s.width,
|
|
621
|
-
class: c(
|
|
622
|
-
}, null, 10,
|
|
623
|
-
|
|
660
|
+
class: c(l(p).area(s.ui?.area))
|
|
661
|
+
}, null, 10, De),
|
|
662
|
+
h("span", {
|
|
624
663
|
tabindex: "0",
|
|
625
|
-
style:
|
|
626
|
-
class: c(
|
|
664
|
+
style: x(l(o)),
|
|
665
|
+
class: c(l(p).thumb(s.ui?.thumb))
|
|
627
666
|
}, null, 6)
|
|
628
|
-
],
|
|
667
|
+
], 46, Re));
|
|
629
668
|
}
|
|
630
|
-
}),
|
|
669
|
+
}), ut = /* @__PURE__ */ V({
|
|
631
670
|
__name: "ColorPickerEyeDropper",
|
|
632
671
|
props: {
|
|
633
|
-
class: {}
|
|
672
|
+
class: {},
|
|
673
|
+
as: { default: "button" },
|
|
674
|
+
asChild: { type: Boolean }
|
|
634
675
|
},
|
|
635
|
-
setup(
|
|
636
|
-
const e =
|
|
676
|
+
setup(a) {
|
|
677
|
+
const e = a, t = S(), s = m(() => typeof window < "u" && !!window.EyeDropper);
|
|
637
678
|
function u() {
|
|
638
|
-
if (!s.value) {
|
|
639
|
-
console.warn("EyeDropper API is not available in this environment.");
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
679
|
const o = window.EyeDropper;
|
|
643
680
|
new o().open().then((n) => {
|
|
644
681
|
t.hexa.value = n.sRGBHex;
|
|
@@ -647,389 +684,409 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
647
684
|
});
|
|
648
685
|
}
|
|
649
686
|
const i = t.uiSlots("dropper");
|
|
650
|
-
return (o, r) => s.value ? (
|
|
687
|
+
return (o, r) => s.value ? (y(), A(l(ae), {
|
|
651
688
|
key: 0,
|
|
652
|
-
|
|
689
|
+
as: e.as,
|
|
690
|
+
"as-child": e.asChild,
|
|
691
|
+
disabled: l(t).disabled.value,
|
|
692
|
+
class: c(l(i).base(e.class)),
|
|
653
693
|
onClick: u
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
|
|
694
|
+
}, {
|
|
695
|
+
default: F(() => [
|
|
696
|
+
T(o.$slots, "default")
|
|
697
|
+
]),
|
|
698
|
+
_: 3
|
|
699
|
+
}, 8, ["as", "as-child", "disabled", "class"])) : W("", !0);
|
|
657
700
|
}
|
|
658
|
-
}),
|
|
701
|
+
}), Ee = ["data-disabled"], Le = ["value", "disabled"], Ge = ["value", "disabled"], it = /* @__PURE__ */ V({
|
|
659
702
|
__name: "ColorPickerInputHex",
|
|
660
703
|
props: {
|
|
704
|
+
modelValue: {},
|
|
661
705
|
class: {},
|
|
662
706
|
ui: {}
|
|
663
707
|
},
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
708
|
+
emits: ["update:modelValue"],
|
|
709
|
+
setup(a, { emit: e }) {
|
|
710
|
+
const t = e, s = a, u = S(), i = de(), o = m(() => !!i?.vnode.props?.["onUpdate:modelValue"]), r = m(() => o.value ? ye(s.modelValue) : u.hex.value.replace("#", "")), n = m(() => o.value ? xe(s.modelValue) : u.alpha.value);
|
|
711
|
+
function d(f) {
|
|
712
|
+
const k = f.target, B = k.value ? Z(k.value) : null;
|
|
713
|
+
if (!B) {
|
|
714
|
+
k.value = r.value;
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
o.value ? t("update:modelValue", be(B)) : (u.rgba.value = B, u.commitValue());
|
|
669
718
|
}
|
|
670
|
-
function
|
|
671
|
-
const
|
|
672
|
-
|
|
719
|
+
function p(f) {
|
|
720
|
+
const k = f.target, B = parseInt(k.value, 10), M = isNaN(B) ? u.alpha.value : _(B, 0, 100);
|
|
721
|
+
u.alpha.value !== M ? (u.alpha.value = M, u.commitValue()) : k.value = M.toString();
|
|
673
722
|
}
|
|
674
|
-
const
|
|
675
|
-
return (
|
|
676
|
-
class: c(
|
|
723
|
+
const b = u.uiSlots("input");
|
|
724
|
+
return (f, k) => (y(), P("div", {
|
|
725
|
+
class: c(l(b).group(s.ui?.group, s.class)),
|
|
726
|
+
"data-disabled": l(u).disabled.value ? "" : null
|
|
677
727
|
}, [
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
class: c(a(i).item(e.ui?.item))
|
|
728
|
+
h("div", {
|
|
729
|
+
class: c(l(b).item(s.ui?.item))
|
|
681
730
|
}, [
|
|
682
|
-
|
|
683
|
-
|
|
731
|
+
T(f.$slots, "before"),
|
|
732
|
+
h("span", {
|
|
733
|
+
class: c(l(b).label(s.ui?.label))
|
|
684
734
|
}, "#", 2),
|
|
685
|
-
|
|
735
|
+
h("input", {
|
|
686
736
|
type: "text",
|
|
687
737
|
name: "hex",
|
|
688
738
|
"aria-label": "Hex",
|
|
689
|
-
value:
|
|
690
|
-
disabled:
|
|
691
|
-
class: c(
|
|
692
|
-
onBlur:
|
|
693
|
-
}, null, 42,
|
|
739
|
+
value: r.value,
|
|
740
|
+
disabled: l(u).disabled.value,
|
|
741
|
+
class: c(l(b).field(s.ui?.field)),
|
|
742
|
+
onBlur: d
|
|
743
|
+
}, null, 42, Le)
|
|
694
744
|
], 2),
|
|
695
|
-
|
|
745
|
+
l(u).isAlphaEnabled.value ? (y(), P("div", {
|
|
696
746
|
key: 0,
|
|
697
747
|
"data-alpha-input": "",
|
|
698
|
-
class: c(
|
|
748
|
+
class: c(l(b).item(s.ui?.item))
|
|
699
749
|
}, [
|
|
700
|
-
|
|
750
|
+
h("input", {
|
|
701
751
|
type: "text",
|
|
702
752
|
name: "opacity",
|
|
703
753
|
"aria-label": "Opacity",
|
|
704
|
-
value:
|
|
705
|
-
disabled:
|
|
706
|
-
class: c(
|
|
707
|
-
onBlur:
|
|
708
|
-
}, null, 42,
|
|
709
|
-
|
|
710
|
-
|
|
754
|
+
value: n.value,
|
|
755
|
+
disabled: l(u).disabled.value,
|
|
756
|
+
class: c(l(b).field(s.ui?.field)),
|
|
757
|
+
onBlur: p
|
|
758
|
+
}, null, 42, Ge),
|
|
759
|
+
h("span", {
|
|
760
|
+
"data-alpha-label": "",
|
|
761
|
+
class: c(l(b).label(s.ui?.label))
|
|
711
762
|
}, "%", 2)
|
|
712
|
-
], 2)) :
|
|
713
|
-
],
|
|
763
|
+
], 2)) : W("", !0)
|
|
764
|
+
], 10, Ee));
|
|
714
765
|
}
|
|
715
|
-
}),
|
|
766
|
+
}), Ne = ["data-disabled"], Ue = ["disabled", "value"], je = ["disabled", "value"], Te = ["disabled", "value"], ze = ["value", "disabled"], ct = /* @__PURE__ */ V({
|
|
716
767
|
__name: "ColorPickerInputRGB",
|
|
717
768
|
props: {
|
|
718
769
|
class: {},
|
|
719
770
|
ui: {}
|
|
720
771
|
},
|
|
721
|
-
setup(
|
|
722
|
-
const e =
|
|
772
|
+
setup(a) {
|
|
773
|
+
const e = a, t = S();
|
|
723
774
|
function s(r, n) {
|
|
724
|
-
const d = r.target,
|
|
775
|
+
const d = r.target, p = parseInt(d.value, 10), b = isNaN(p) ? t.rgb.value[n] : _(p, 0, 255);
|
|
725
776
|
t.rgb.value[n] !== b ? (t.rgb.value = {
|
|
726
777
|
...t.rgb.value,
|
|
727
778
|
[n]: b
|
|
728
|
-
}, t.
|
|
779
|
+
}, t.commitValue()) : d.value = b.toString();
|
|
729
780
|
}
|
|
730
781
|
function u(r) {
|
|
731
|
-
const n = r.target, d = parseInt(n.value, 10),
|
|
732
|
-
t.alpha.value !==
|
|
782
|
+
const n = r.target, d = parseInt(n.value, 10), p = isNaN(d) ? t.alpha.value : _(d, 0, 100);
|
|
783
|
+
t.alpha.value !== p ? (t.alpha.value = p, t.commitValue()) : n.value = p.toString();
|
|
733
784
|
}
|
|
734
785
|
const i = (r) => Math.round(r), o = t.uiSlots("input");
|
|
735
|
-
return (r, n) => (
|
|
736
|
-
class: c(
|
|
786
|
+
return (r, n) => (y(), P("div", {
|
|
787
|
+
class: c(l(o).group(e.ui?.group, e.class)),
|
|
788
|
+
"data-disabled": l(t).disabled.value ? "" : null
|
|
737
789
|
}, [
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
class: c(a(o).item(e.ui?.item))
|
|
790
|
+
h("div", {
|
|
791
|
+
class: c(l(o).item(e.ui?.item))
|
|
741
792
|
}, [
|
|
742
|
-
|
|
743
|
-
|
|
793
|
+
T(r.$slots, "before"),
|
|
794
|
+
h("span", {
|
|
795
|
+
class: c(l(o).label(e.ui?.label))
|
|
744
796
|
}, "R", 2),
|
|
745
|
-
|
|
797
|
+
h("input", {
|
|
746
798
|
type: "text",
|
|
747
799
|
name: "red",
|
|
748
800
|
"aria-label": "Red",
|
|
749
|
-
disabled:
|
|
750
|
-
class: c(
|
|
751
|
-
value: i(
|
|
801
|
+
disabled: l(t).disabled.value,
|
|
802
|
+
class: c(l(o).field(e.ui?.field)),
|
|
803
|
+
value: i(l(t).rgb.value.r),
|
|
752
804
|
onBlur: n[0] || (n[0] = (d) => s(d, "r"))
|
|
753
|
-
}, null, 42,
|
|
805
|
+
}, null, 42, Ue)
|
|
754
806
|
], 2),
|
|
755
|
-
|
|
756
|
-
class: c(
|
|
807
|
+
h("div", {
|
|
808
|
+
class: c(l(o).item(e.ui?.item))
|
|
757
809
|
}, [
|
|
758
|
-
|
|
759
|
-
class: c(
|
|
810
|
+
h("span", {
|
|
811
|
+
class: c(l(o).label(e.ui?.label))
|
|
760
812
|
}, "G", 2),
|
|
761
|
-
|
|
813
|
+
h("input", {
|
|
762
814
|
type: "text",
|
|
763
815
|
name: "green",
|
|
764
816
|
"aria-label": "Green",
|
|
765
|
-
disabled:
|
|
766
|
-
class: c(
|
|
767
|
-
value: i(
|
|
817
|
+
disabled: l(t).disabled.value,
|
|
818
|
+
class: c(l(o).field(e.ui?.field)),
|
|
819
|
+
value: i(l(t).rgb.value.g),
|
|
768
820
|
onBlur: n[1] || (n[1] = (d) => s(d, "g"))
|
|
769
|
-
}, null, 42,
|
|
821
|
+
}, null, 42, je)
|
|
770
822
|
], 2),
|
|
771
|
-
|
|
772
|
-
class: c(
|
|
823
|
+
h("div", {
|
|
824
|
+
class: c(l(o).item(e.ui?.item))
|
|
773
825
|
}, [
|
|
774
|
-
|
|
775
|
-
class: c(
|
|
826
|
+
h("span", {
|
|
827
|
+
class: c(l(o).label(e.ui?.label))
|
|
776
828
|
}, "B", 2),
|
|
777
|
-
|
|
829
|
+
h("input", {
|
|
778
830
|
type: "text",
|
|
779
831
|
name: "blue",
|
|
780
832
|
"aria-label": "Blue",
|
|
781
|
-
disabled:
|
|
782
|
-
class: c(
|
|
783
|
-
value: i(
|
|
833
|
+
disabled: l(t).disabled.value,
|
|
834
|
+
class: c(l(o).field(e.ui?.field)),
|
|
835
|
+
value: i(l(t).rgb.value.b),
|
|
784
836
|
onBlur: n[2] || (n[2] = (d) => s(d, "b"))
|
|
785
|
-
}, null, 42,
|
|
837
|
+
}, null, 42, Te)
|
|
786
838
|
], 2),
|
|
787
|
-
|
|
839
|
+
l(t).isAlphaEnabled.value ? (y(), P("div", {
|
|
788
840
|
key: 0,
|
|
789
841
|
"data-alpha-input": "",
|
|
790
|
-
class: c(
|
|
842
|
+
class: c(l(o).item(e.ui?.item))
|
|
791
843
|
}, [
|
|
792
|
-
|
|
844
|
+
h("input", {
|
|
793
845
|
type: "text",
|
|
794
846
|
name: "opacity",
|
|
795
847
|
"aria-label": "Opacity",
|
|
796
|
-
value:
|
|
797
|
-
disabled:
|
|
798
|
-
class: c(
|
|
848
|
+
value: l(t).alpha.value,
|
|
849
|
+
disabled: l(t).disabled.value,
|
|
850
|
+
class: c(l(o).field(e.ui?.field)),
|
|
799
851
|
onBlur: u
|
|
800
|
-
}, null, 42,
|
|
801
|
-
|
|
802
|
-
|
|
852
|
+
}, null, 42, ze),
|
|
853
|
+
h("span", {
|
|
854
|
+
"data-alpha-label": "",
|
|
855
|
+
class: c(l(o).label(e.ui?.label))
|
|
803
856
|
}, "%", 2)
|
|
804
|
-
], 2)) :
|
|
805
|
-
],
|
|
857
|
+
], 2)) : W("", !0)
|
|
858
|
+
], 10, Ne));
|
|
806
859
|
}
|
|
807
|
-
}),
|
|
860
|
+
}), Oe = ["data-disabled"], We = ["disabled", "value"], Ke = ["disabled", "value"], Ze = ["disabled", "value"], Ye = ["value", "disabled"], dt = /* @__PURE__ */ V({
|
|
808
861
|
__name: "ColorPickerInputHSL",
|
|
809
862
|
props: {
|
|
810
863
|
class: {},
|
|
811
864
|
ui: {}
|
|
812
865
|
},
|
|
813
|
-
setup(
|
|
814
|
-
const e =
|
|
866
|
+
setup(a) {
|
|
867
|
+
const e = a, t = S();
|
|
815
868
|
function s(r, n, d) {
|
|
816
|
-
const
|
|
869
|
+
const p = r.target, b = parseInt(p.value, 10), f = isNaN(b) ? t.hsl.value[n] : _(b, 0, d);
|
|
817
870
|
t.hsl.value[n] !== f ? (t.hsl.value = {
|
|
818
871
|
...t.hsl.value,
|
|
819
872
|
[n]: n === "h" ? f : f / 100
|
|
820
|
-
}, t.
|
|
873
|
+
}, t.commitValue()) : p.value = n !== "h" ? Math.round(f * 100).toString() : f.toString();
|
|
821
874
|
}
|
|
822
875
|
function u(r) {
|
|
823
|
-
const n = r.target, d = parseInt(n.value, 10),
|
|
824
|
-
t.alpha.value !==
|
|
876
|
+
const n = r.target, d = parseInt(n.value, 10), p = isNaN(d) ? t.alpha.value : _(d, 0, 100);
|
|
877
|
+
t.alpha.value !== p ? (t.alpha.value = p, t.commitValue()) : n.value = p.toString();
|
|
825
878
|
}
|
|
826
879
|
const i = (r) => Math.round(r * 100), o = t.uiSlots("input");
|
|
827
|
-
return (r, n) => (
|
|
828
|
-
class: c(
|
|
880
|
+
return (r, n) => (y(), P("div", {
|
|
881
|
+
class: c(l(o).group(e.ui?.group, e.class)),
|
|
882
|
+
"data-disabled": l(t).disabled.value ? "" : null
|
|
829
883
|
}, [
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
class: c(a(o).item(e.ui?.item))
|
|
884
|
+
h("div", {
|
|
885
|
+
class: c(l(o).item(e.ui?.item))
|
|
833
886
|
}, [
|
|
834
|
-
|
|
835
|
-
|
|
887
|
+
T(r.$slots, "before"),
|
|
888
|
+
h("span", {
|
|
889
|
+
class: c(l(o).label(e.ui?.label))
|
|
836
890
|
}, "H", 2),
|
|
837
|
-
|
|
891
|
+
h("input", {
|
|
838
892
|
type: "text",
|
|
839
893
|
name: "hue",
|
|
840
894
|
"aria-label": "Hue",
|
|
841
|
-
disabled:
|
|
842
|
-
class: c(
|
|
843
|
-
value: Math.round(
|
|
895
|
+
disabled: l(t).disabled.value,
|
|
896
|
+
class: c(l(o).field(e.ui?.field)),
|
|
897
|
+
value: Math.round(l(t).hsl.value.h),
|
|
844
898
|
onBlur: n[0] || (n[0] = (d) => s(d, "h", 360))
|
|
845
|
-
}, null, 42,
|
|
899
|
+
}, null, 42, We)
|
|
846
900
|
], 2),
|
|
847
|
-
|
|
848
|
-
class: c(
|
|
901
|
+
h("div", {
|
|
902
|
+
class: c(l(o).item(e.ui?.item))
|
|
849
903
|
}, [
|
|
850
|
-
|
|
851
|
-
class: c(
|
|
904
|
+
h("span", {
|
|
905
|
+
class: c(l(o).label(e.ui?.label))
|
|
852
906
|
}, "S", 2),
|
|
853
|
-
|
|
907
|
+
h("input", {
|
|
854
908
|
type: "text",
|
|
855
909
|
name: "saturation",
|
|
856
910
|
"aria-label": "Saturation",
|
|
857
|
-
disabled:
|
|
858
|
-
class: c(
|
|
859
|
-
value: i(
|
|
911
|
+
disabled: l(t).disabled.value,
|
|
912
|
+
class: c(l(o).field(e.ui?.field)),
|
|
913
|
+
value: i(l(t).hsl.value.s),
|
|
860
914
|
onBlur: n[1] || (n[1] = (d) => s(d, "s", 100))
|
|
861
|
-
}, null, 42,
|
|
915
|
+
}, null, 42, Ke)
|
|
862
916
|
], 2),
|
|
863
|
-
|
|
864
|
-
class: c(
|
|
917
|
+
h("div", {
|
|
918
|
+
class: c(l(o).item(e.ui?.item))
|
|
865
919
|
}, [
|
|
866
|
-
|
|
867
|
-
class: c(
|
|
920
|
+
h("span", {
|
|
921
|
+
class: c(l(o).label(e.ui?.label))
|
|
868
922
|
}, "L", 2),
|
|
869
|
-
|
|
923
|
+
h("input", {
|
|
870
924
|
type: "text",
|
|
871
925
|
name: "lightness",
|
|
872
926
|
"aria-label": "Lightness",
|
|
873
|
-
disabled:
|
|
874
|
-
class: c(
|
|
875
|
-
value: i(
|
|
927
|
+
disabled: l(t).disabled.value,
|
|
928
|
+
class: c(l(o).field(e.ui?.field)),
|
|
929
|
+
value: i(l(t).hsl.value.l),
|
|
876
930
|
onBlur: n[2] || (n[2] = (d) => s(d, "l", 100))
|
|
877
|
-
}, null, 42,
|
|
931
|
+
}, null, 42, Ze)
|
|
878
932
|
], 2),
|
|
879
|
-
|
|
933
|
+
l(t).isAlphaEnabled.value ? (y(), P("div", {
|
|
880
934
|
key: 0,
|
|
881
935
|
"data-alpha-input": "",
|
|
882
|
-
class: c(
|
|
936
|
+
class: c(l(o).item(e.ui?.item))
|
|
883
937
|
}, [
|
|
884
|
-
|
|
938
|
+
h("input", {
|
|
885
939
|
type: "text",
|
|
886
940
|
name: "opacity",
|
|
887
941
|
"aria-label": "Opacity",
|
|
888
|
-
value:
|
|
889
|
-
disabled:
|
|
890
|
-
class: c(
|
|
942
|
+
value: l(t).alpha.value,
|
|
943
|
+
disabled: l(t).disabled.value,
|
|
944
|
+
class: c(l(o).field(e.ui?.field)),
|
|
891
945
|
onBlur: u
|
|
892
|
-
}, null, 42,
|
|
893
|
-
|
|
894
|
-
|
|
946
|
+
}, null, 42, Ye),
|
|
947
|
+
h("span", {
|
|
948
|
+
"data-alpha-label": "",
|
|
949
|
+
class: c(l(o).label(e.ui?.label))
|
|
895
950
|
}, "%", 2)
|
|
896
|
-
], 2)) :
|
|
897
|
-
],
|
|
951
|
+
], 2)) : W("", !0)
|
|
952
|
+
], 10, Oe));
|
|
898
953
|
}
|
|
899
|
-
}),
|
|
954
|
+
}), Xe = ["data-disabled"], qe = ["disabled", "value"], Je = ["disabled", "value"], Qe = ["disabled", "value"], et = ["value", "disabled"], vt = /* @__PURE__ */ V({
|
|
900
955
|
__name: "ColorPickerInputHSB",
|
|
901
956
|
props: {
|
|
902
957
|
class: {},
|
|
903
958
|
ui: {}
|
|
904
959
|
},
|
|
905
|
-
setup(
|
|
906
|
-
const e =
|
|
960
|
+
setup(a) {
|
|
961
|
+
const e = a, t = S();
|
|
907
962
|
function s(r, n, d) {
|
|
908
|
-
const
|
|
963
|
+
const p = r.target, b = parseInt(p.value, 10), f = isNaN(b) ? t.hsv.value[n] : _(b, 0, d);
|
|
909
964
|
t.hsv.value[n] !== f ? (t.hsv.value = {
|
|
910
965
|
...t.hsv.value,
|
|
911
966
|
[n]: n === "h" ? f : f / 100
|
|
912
|
-
}, t.
|
|
967
|
+
}, t.commitValue()) : p.value = n !== "h" ? Math.round(f * 100).toString() : f.toString();
|
|
913
968
|
}
|
|
914
969
|
function u(r) {
|
|
915
|
-
const n = r.target, d = parseInt(n.value, 10),
|
|
916
|
-
t.alpha.value !==
|
|
970
|
+
const n = r.target, d = parseInt(n.value, 10), p = isNaN(d) ? t.alpha.value : _(d, 0, 100);
|
|
971
|
+
t.alpha.value !== p ? (t.alpha.value = p, t.commitValue()) : n.value = p.toString();
|
|
917
972
|
}
|
|
918
973
|
const i = (r) => Math.round(r * 100), o = t.uiSlots("input");
|
|
919
|
-
return (r, n) => (
|
|
920
|
-
class: c(
|
|
974
|
+
return (r, n) => (y(), P("div", {
|
|
975
|
+
class: c(l(o).group(e.ui?.group, e.class)),
|
|
976
|
+
"data-disabled": l(t).disabled.value ? "" : null
|
|
921
977
|
}, [
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
class: c(a(o).item(e.ui?.item))
|
|
978
|
+
h("div", {
|
|
979
|
+
class: c(l(o).item(e.ui?.item))
|
|
925
980
|
}, [
|
|
926
|
-
|
|
927
|
-
|
|
981
|
+
T(r.$slots, "before"),
|
|
982
|
+
h("span", {
|
|
983
|
+
class: c(l(o).label(e.ui?.label))
|
|
928
984
|
}, "H", 2),
|
|
929
|
-
|
|
985
|
+
h("input", {
|
|
930
986
|
type: "text",
|
|
931
987
|
name: "hue",
|
|
932
988
|
"aria-label": "Hue",
|
|
933
|
-
disabled:
|
|
934
|
-
class: c(
|
|
935
|
-
value: Math.round(
|
|
989
|
+
disabled: l(t).disabled.value,
|
|
990
|
+
class: c(l(o).field(e.ui?.field)),
|
|
991
|
+
value: Math.round(l(t).hsv.value.h),
|
|
936
992
|
onBlur: n[0] || (n[0] = (d) => s(d, "h", 360))
|
|
937
|
-
}, null, 42,
|
|
993
|
+
}, null, 42, qe)
|
|
938
994
|
], 2),
|
|
939
|
-
|
|
940
|
-
class: c(
|
|
995
|
+
h("div", {
|
|
996
|
+
class: c(l(o).item(e.ui?.item))
|
|
941
997
|
}, [
|
|
942
|
-
|
|
943
|
-
class: c(
|
|
998
|
+
h("span", {
|
|
999
|
+
class: c(l(o).label(e.ui?.label))
|
|
944
1000
|
}, "S", 2),
|
|
945
|
-
|
|
1001
|
+
h("input", {
|
|
946
1002
|
type: "text",
|
|
947
1003
|
name: "saturation",
|
|
948
1004
|
"aria-label": "Saturation",
|
|
949
|
-
disabled:
|
|
950
|
-
class: c(
|
|
951
|
-
value: i(
|
|
1005
|
+
disabled: l(t).disabled.value,
|
|
1006
|
+
class: c(l(o).field(e.ui?.field)),
|
|
1007
|
+
value: i(l(t).hsv.value.s),
|
|
952
1008
|
onBlur: n[1] || (n[1] = (d) => s(d, "s", 100))
|
|
953
|
-
}, null, 42,
|
|
1009
|
+
}, null, 42, Je)
|
|
954
1010
|
], 2),
|
|
955
|
-
|
|
956
|
-
class: c(
|
|
1011
|
+
h("div", {
|
|
1012
|
+
class: c(l(o).item(e.ui?.item))
|
|
957
1013
|
}, [
|
|
958
|
-
|
|
959
|
-
class: c(
|
|
1014
|
+
h("span", {
|
|
1015
|
+
class: c(l(o).label(e.ui?.label))
|
|
960
1016
|
}, "B", 2),
|
|
961
|
-
|
|
1017
|
+
h("input", {
|
|
962
1018
|
type: "text",
|
|
963
1019
|
name: "brightness",
|
|
964
1020
|
"aria-label": "Brightness",
|
|
965
|
-
disabled:
|
|
966
|
-
class: c(
|
|
967
|
-
value: i(
|
|
1021
|
+
disabled: l(t).disabled.value,
|
|
1022
|
+
class: c(l(o).field(e.ui?.field)),
|
|
1023
|
+
value: i(l(t).hsv.value.v),
|
|
968
1024
|
onBlur: n[2] || (n[2] = (d) => s(d, "v", 100))
|
|
969
|
-
}, null, 42,
|
|
1025
|
+
}, null, 42, Qe)
|
|
970
1026
|
], 2),
|
|
971
|
-
|
|
1027
|
+
l(t).isAlphaEnabled.value ? (y(), P("div", {
|
|
972
1028
|
key: 0,
|
|
973
1029
|
"data-alpha-input": "",
|
|
974
|
-
class: c(
|
|
1030
|
+
class: c(l(o).item(e.ui?.item))
|
|
975
1031
|
}, [
|
|
976
|
-
|
|
1032
|
+
h("input", {
|
|
977
1033
|
type: "text",
|
|
978
1034
|
name: "opacity",
|
|
979
1035
|
"aria-label": "Opacity",
|
|
980
|
-
value:
|
|
981
|
-
disabled:
|
|
982
|
-
class: c(
|
|
1036
|
+
value: l(t).alpha.value,
|
|
1037
|
+
disabled: l(t).disabled.value,
|
|
1038
|
+
class: c(l(o).field(e.ui?.field)),
|
|
983
1039
|
onBlur: u
|
|
984
|
-
}, null, 42,
|
|
985
|
-
|
|
986
|
-
|
|
1040
|
+
}, null, 42, et),
|
|
1041
|
+
h("span", {
|
|
1042
|
+
"data-alpha-label": "",
|
|
1043
|
+
class: c(l(o).label(e.ui?.label))
|
|
987
1044
|
}, "%", 2)
|
|
988
|
-
], 2)) :
|
|
989
|
-
],
|
|
1045
|
+
], 2)) : W("", !0)
|
|
1046
|
+
], 10, Xe));
|
|
990
1047
|
}
|
|
991
|
-
}),
|
|
1048
|
+
}), pt = /* @__PURE__ */ V({
|
|
992
1049
|
__name: "ColorPickerSliderAlpha",
|
|
993
1050
|
props: {
|
|
994
1051
|
class: {},
|
|
995
1052
|
orientation: { default: "horizontal" },
|
|
996
1053
|
ui: {}
|
|
997
1054
|
},
|
|
998
|
-
setup(
|
|
999
|
-
const e =
|
|
1055
|
+
setup(a) {
|
|
1056
|
+
const e = S(), t = m({
|
|
1000
1057
|
get: () => [e.alpha.value],
|
|
1001
1058
|
set: ([o]) => {
|
|
1002
1059
|
e.alpha.value = o;
|
|
1003
1060
|
}
|
|
1004
|
-
}), s =
|
|
1061
|
+
}), s = a, u = m(() => ({
|
|
1005
1062
|
background: [
|
|
1006
1063
|
`linear-gradient(${s.orientation === "vertical" ? "to top" : "to right"}, rgba(0, 0, 0, 0) 0%, ${e.hex.value} 100%)`,
|
|
1007
1064
|
"repeating-conic-gradient(#ddd 0% 25%, transparent 0% 50%) 50% / 8px 8px"
|
|
1008
1065
|
].join(",")
|
|
1009
1066
|
})), i = e.uiSlots("slider", "shared");
|
|
1010
|
-
return (o, r) => (
|
|
1067
|
+
return (o, r) => (y(), A(l(L), {
|
|
1011
1068
|
modelValue: t.value,
|
|
1012
1069
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => t.value = n),
|
|
1013
|
-
disabled:
|
|
1070
|
+
disabled: l(e).disabled.value,
|
|
1014
1071
|
orientation: s.orientation,
|
|
1015
|
-
class: c(
|
|
1016
|
-
|
|
1072
|
+
class: c(l(i).root(s.ui?.root, s.class)),
|
|
1073
|
+
onValueCommit: r[1] || (r[1] = (n) => l(e).commitValue())
|
|
1017
1074
|
}, {
|
|
1018
|
-
default:
|
|
1019
|
-
|
|
1020
|
-
style:
|
|
1021
|
-
class: c(
|
|
1075
|
+
default: F(() => [
|
|
1076
|
+
w(l(G), {
|
|
1077
|
+
style: x(u.value),
|
|
1078
|
+
class: c(l(i).track(s.ui?.track))
|
|
1022
1079
|
}, null, 8, ["style", "class"]),
|
|
1023
|
-
|
|
1024
|
-
style:
|
|
1025
|
-
class: c(
|
|
1080
|
+
w(l(N), {
|
|
1081
|
+
style: x({ backgroundColor: l(e).hexa.value }),
|
|
1082
|
+
class: c(l(i).thumb(s.ui?.thumb)),
|
|
1026
1083
|
"aria-label": "Opacity"
|
|
1027
1084
|
}, null, 8, ["style", "class"])
|
|
1028
1085
|
]),
|
|
1029
1086
|
_: 1
|
|
1030
1087
|
}, 8, ["modelValue", "disabled", "orientation", "class"]));
|
|
1031
1088
|
}
|
|
1032
|
-
}),
|
|
1089
|
+
}), ht = /* @__PURE__ */ V({
|
|
1033
1090
|
__name: "ColorPickerSliderHue",
|
|
1034
1091
|
props: {
|
|
1035
1092
|
class: {},
|
|
@@ -1037,8 +1094,8 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
1037
1094
|
orientation: { default: "horizontal" },
|
|
1038
1095
|
ui: {}
|
|
1039
1096
|
},
|
|
1040
|
-
setup(
|
|
1041
|
-
const e =
|
|
1097
|
+
setup(a) {
|
|
1098
|
+
const e = a, t = S(), s = m({
|
|
1042
1099
|
get: () => [t.hsv.value.h],
|
|
1043
1100
|
set: ([o]) => {
|
|
1044
1101
|
t.hsv.value = {
|
|
@@ -1046,40 +1103,40 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
1046
1103
|
h: o
|
|
1047
1104
|
};
|
|
1048
1105
|
}
|
|
1049
|
-
}), u =
|
|
1050
|
-
return (o, r) => (
|
|
1106
|
+
}), u = m(() => `linear-gradient(${e.orientation === "vertical" ? "to top" : "to right"}, red, yellow, lime, cyan, blue, magenta, red)`), i = t.uiSlots("slider", "shared");
|
|
1107
|
+
return (o, r) => (y(), A(l(L), {
|
|
1051
1108
|
modelValue: s.value,
|
|
1052
1109
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => s.value = n),
|
|
1053
|
-
disabled:
|
|
1110
|
+
disabled: l(t).disabled.value,
|
|
1054
1111
|
max: 360,
|
|
1055
1112
|
inverted: e.inverted,
|
|
1056
1113
|
orientation: e.orientation,
|
|
1057
|
-
class: c(
|
|
1058
|
-
|
|
1114
|
+
class: c(l(i).root(e.ui?.root, e.class)),
|
|
1115
|
+
onValueCommit: r[1] || (r[1] = (n) => l(t).commitValue())
|
|
1059
1116
|
}, {
|
|
1060
|
-
default:
|
|
1061
|
-
|
|
1062
|
-
style:
|
|
1063
|
-
class: c(
|
|
1117
|
+
default: F(() => [
|
|
1118
|
+
w(l(G), {
|
|
1119
|
+
style: x({ background: u.value }),
|
|
1120
|
+
class: c(l(i).track(e.ui?.track))
|
|
1064
1121
|
}, null, 8, ["style", "class"]),
|
|
1065
|
-
|
|
1122
|
+
w(l(N), {
|
|
1066
1123
|
"aria-label": "Hue",
|
|
1067
|
-
style:
|
|
1068
|
-
class: c(
|
|
1124
|
+
style: x({ background: `hsl(${l(t).hsv.value.h},100%,50%)` }),
|
|
1125
|
+
class: c(l(i).thumb(e.ui?.thumb))
|
|
1069
1126
|
}, null, 8, ["style", "class"])
|
|
1070
1127
|
]),
|
|
1071
1128
|
_: 1
|
|
1072
1129
|
}, 8, ["modelValue", "disabled", "inverted", "orientation", "class"]));
|
|
1073
1130
|
}
|
|
1074
|
-
}),
|
|
1131
|
+
}), bt = /* @__PURE__ */ V({
|
|
1075
1132
|
__name: "ColorPickerSliderSaturation",
|
|
1076
1133
|
props: {
|
|
1077
1134
|
class: {},
|
|
1078
1135
|
orientation: { default: "horizontal" },
|
|
1079
1136
|
ui: {}
|
|
1080
1137
|
},
|
|
1081
|
-
setup(
|
|
1082
|
-
const e =
|
|
1138
|
+
setup(a) {
|
|
1139
|
+
const e = a, t = S(), s = m({
|
|
1083
1140
|
get: () => [t.hsl.value.s],
|
|
1084
1141
|
set: ([o]) => {
|
|
1085
1142
|
t.hsl.value = {
|
|
@@ -1087,43 +1144,43 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
1087
1144
|
s: o
|
|
1088
1145
|
};
|
|
1089
1146
|
}
|
|
1090
|
-
}), u =
|
|
1147
|
+
}), u = m(() => {
|
|
1091
1148
|
const o = e.orientation === "vertical" ? "to top" : "to right", r = `hsl(${Math.floor(t.hsl.value.h)}, 0%, ${Math.floor(t.hsl.value.l * 100)}%)`, n = `hsl(${Math.floor(t.hsl.value.h)}, 100%, ${Math.floor(t.hsl.value.l * 100)}%)`;
|
|
1092
1149
|
return `linear-gradient(${o}, ${r}, ${n})`;
|
|
1093
1150
|
}), i = t.uiSlots("slider", "shared");
|
|
1094
|
-
return (o, r) => (
|
|
1151
|
+
return (o, r) => (y(), A(l(L), {
|
|
1095
1152
|
modelValue: s.value,
|
|
1096
1153
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => s.value = n),
|
|
1097
1154
|
max: 1,
|
|
1098
1155
|
step: 0.01,
|
|
1099
|
-
disabled:
|
|
1156
|
+
disabled: l(t).disabled.value,
|
|
1100
1157
|
orientation: e.orientation,
|
|
1101
|
-
class: c(
|
|
1102
|
-
|
|
1158
|
+
class: c(l(i).root(e.ui?.root, e.class)),
|
|
1159
|
+
onValueCommit: r[1] || (r[1] = (n) => l(t).commitValue())
|
|
1103
1160
|
}, {
|
|
1104
|
-
default:
|
|
1105
|
-
|
|
1106
|
-
style:
|
|
1107
|
-
class: c(
|
|
1161
|
+
default: F(() => [
|
|
1162
|
+
w(l(G), {
|
|
1163
|
+
style: x({ background: u.value }),
|
|
1164
|
+
class: c(l(i).track(e.ui?.track))
|
|
1108
1165
|
}, null, 8, ["style", "class"]),
|
|
1109
|
-
|
|
1166
|
+
w(l(N), {
|
|
1110
1167
|
"aria-label": "Saturation",
|
|
1111
|
-
style:
|
|
1112
|
-
class: c(
|
|
1168
|
+
style: x({ background: l(t).hex.value }),
|
|
1169
|
+
class: c(l(i).thumb(e.ui?.thumb))
|
|
1113
1170
|
}, null, 8, ["style", "class"])
|
|
1114
1171
|
]),
|
|
1115
1172
|
_: 1
|
|
1116
1173
|
}, 8, ["modelValue", "disabled", "orientation", "class"]));
|
|
1117
1174
|
}
|
|
1118
|
-
}),
|
|
1175
|
+
}), ft = /* @__PURE__ */ V({
|
|
1119
1176
|
__name: "ColorPickerSliderLightness",
|
|
1120
1177
|
props: {
|
|
1121
1178
|
class: {},
|
|
1122
1179
|
orientation: { default: "horizontal" },
|
|
1123
1180
|
ui: {}
|
|
1124
1181
|
},
|
|
1125
|
-
setup(
|
|
1126
|
-
const e =
|
|
1182
|
+
setup(a) {
|
|
1183
|
+
const e = a, t = S(), s = m({
|
|
1127
1184
|
get: () => [t.hsl.value.l],
|
|
1128
1185
|
set: ([o]) => {
|
|
1129
1186
|
t.hsl.value = {
|
|
@@ -1131,43 +1188,43 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
1131
1188
|
l: o
|
|
1132
1189
|
};
|
|
1133
1190
|
}
|
|
1134
|
-
}), u =
|
|
1191
|
+
}), u = m(() => {
|
|
1135
1192
|
const o = e.orientation === "vertical" ? "to top" : "to right", r = `hsl(${Math.floor(t.hsl.value.h)}, ${Math.floor(t.hsl.value.s * 100)}%, 50%)`;
|
|
1136
1193
|
return `linear-gradient(${o}, hsl(0, 0%, 0%), ${r}, hsl(0, 0%, 100%))`;
|
|
1137
1194
|
}), i = t.uiSlots("slider", "shared");
|
|
1138
|
-
return (o, r) => (
|
|
1195
|
+
return (o, r) => (y(), A(l(L), {
|
|
1139
1196
|
modelValue: s.value,
|
|
1140
1197
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => s.value = n),
|
|
1141
1198
|
max: 1,
|
|
1142
1199
|
step: 0.01,
|
|
1143
|
-
disabled:
|
|
1200
|
+
disabled: l(t).disabled.value,
|
|
1144
1201
|
orientation: e.orientation,
|
|
1145
|
-
class: c(
|
|
1146
|
-
|
|
1202
|
+
class: c(l(i).root(e.ui?.root, e.class)),
|
|
1203
|
+
onValueCommit: r[1] || (r[1] = (n) => l(t).commitValue())
|
|
1147
1204
|
}, {
|
|
1148
|
-
default:
|
|
1149
|
-
|
|
1150
|
-
style:
|
|
1151
|
-
class: c(
|
|
1205
|
+
default: F(() => [
|
|
1206
|
+
w(l(G), {
|
|
1207
|
+
style: x({ background: u.value }),
|
|
1208
|
+
class: c(l(i).track(e.ui?.track))
|
|
1152
1209
|
}, null, 8, ["style", "class"]),
|
|
1153
|
-
|
|
1210
|
+
w(l(N), {
|
|
1154
1211
|
"aria-label": "Lightness",
|
|
1155
|
-
style:
|
|
1156
|
-
class: c(
|
|
1212
|
+
style: x({ background: l(t).hex.value }),
|
|
1213
|
+
class: c(l(i).thumb(e.ui?.thumb))
|
|
1157
1214
|
}, null, 8, ["style", "class"])
|
|
1158
1215
|
]),
|
|
1159
1216
|
_: 1
|
|
1160
1217
|
}, 8, ["modelValue", "disabled", "orientation", "class"]));
|
|
1161
1218
|
}
|
|
1162
|
-
}),
|
|
1219
|
+
}), mt = /* @__PURE__ */ V({
|
|
1163
1220
|
__name: "ColorPickerSliderRed",
|
|
1164
1221
|
props: {
|
|
1165
1222
|
class: {},
|
|
1166
1223
|
orientation: { default: "horizontal" },
|
|
1167
1224
|
ui: {}
|
|
1168
1225
|
},
|
|
1169
|
-
setup(
|
|
1170
|
-
const e =
|
|
1226
|
+
setup(a) {
|
|
1227
|
+
const e = a, t = S(), s = m({
|
|
1171
1228
|
get: () => [t.rgb.value.r],
|
|
1172
1229
|
set: ([o]) => {
|
|
1173
1230
|
t.rgb.value = {
|
|
@@ -1175,42 +1232,42 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
1175
1232
|
r: o
|
|
1176
1233
|
};
|
|
1177
1234
|
}
|
|
1178
|
-
}), u =
|
|
1235
|
+
}), u = m(() => {
|
|
1179
1236
|
const o = e.orientation === "vertical" ? "to top" : "to right", r = `rgb(0, ${t.rgb.value.g}, ${t.rgb.value.b})`, n = `rgb(255, ${t.rgb.value.g}, ${t.rgb.value.b})`;
|
|
1180
1237
|
return `linear-gradient(${o}, ${r}, ${n})`;
|
|
1181
1238
|
}), i = t.uiSlots("slider", "shared");
|
|
1182
|
-
return (o, r) => (
|
|
1239
|
+
return (o, r) => (y(), A(l(L), {
|
|
1183
1240
|
modelValue: s.value,
|
|
1184
1241
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => s.value = n),
|
|
1185
|
-
disabled:
|
|
1242
|
+
disabled: l(t).disabled.value,
|
|
1186
1243
|
max: 255,
|
|
1187
1244
|
orientation: e.orientation,
|
|
1188
|
-
class: c(
|
|
1189
|
-
|
|
1245
|
+
class: c(l(i).root(e.ui?.root, e.class)),
|
|
1246
|
+
onValueCommit: r[1] || (r[1] = (n) => l(t).commitValue())
|
|
1190
1247
|
}, {
|
|
1191
|
-
default:
|
|
1192
|
-
|
|
1193
|
-
style:
|
|
1194
|
-
class: c(
|
|
1248
|
+
default: F(() => [
|
|
1249
|
+
w(l(G), {
|
|
1250
|
+
style: x({ background: u.value }),
|
|
1251
|
+
class: c(l(i).track(e.ui?.track))
|
|
1195
1252
|
}, null, 8, ["style", "class"]),
|
|
1196
|
-
|
|
1253
|
+
w(l(N), {
|
|
1197
1254
|
"aria-label": "Red",
|
|
1198
|
-
style:
|
|
1199
|
-
class: c(
|
|
1255
|
+
style: x({ background: l(t).hex.value }),
|
|
1256
|
+
class: c(l(i).thumb(e.ui?.thumb))
|
|
1200
1257
|
}, null, 8, ["style", "class"])
|
|
1201
1258
|
]),
|
|
1202
1259
|
_: 1
|
|
1203
1260
|
}, 8, ["modelValue", "disabled", "orientation", "class"]));
|
|
1204
1261
|
}
|
|
1205
|
-
}),
|
|
1262
|
+
}), gt = /* @__PURE__ */ V({
|
|
1206
1263
|
__name: "ColorPickerSliderGreen",
|
|
1207
1264
|
props: {
|
|
1208
1265
|
class: {},
|
|
1209
1266
|
orientation: { default: "horizontal" },
|
|
1210
1267
|
ui: {}
|
|
1211
1268
|
},
|
|
1212
|
-
setup(
|
|
1213
|
-
const e =
|
|
1269
|
+
setup(a) {
|
|
1270
|
+
const e = a, t = S(), s = m({
|
|
1214
1271
|
get: () => [t.rgb.value.g],
|
|
1215
1272
|
set: ([o]) => {
|
|
1216
1273
|
t.rgb.value = {
|
|
@@ -1218,42 +1275,42 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
1218
1275
|
g: o
|
|
1219
1276
|
};
|
|
1220
1277
|
}
|
|
1221
|
-
}), u =
|
|
1278
|
+
}), u = m(() => {
|
|
1222
1279
|
const o = e.orientation === "vertical" ? "to top" : "to right", r = `rgb(${t.rgb.value.r}, 0, ${t.rgb.value.b})`, n = `rgb(${t.rgb.value.r}, 255, ${t.rgb.value.b})`;
|
|
1223
1280
|
return `linear-gradient(${o}, ${r}, ${n})`;
|
|
1224
1281
|
}), i = t.uiSlots("slider", "shared");
|
|
1225
|
-
return (o, r) => (
|
|
1282
|
+
return (o, r) => (y(), A(l(L), {
|
|
1226
1283
|
modelValue: s.value,
|
|
1227
1284
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => s.value = n),
|
|
1228
|
-
disabled:
|
|
1285
|
+
disabled: l(t).disabled.value,
|
|
1229
1286
|
max: 255,
|
|
1230
1287
|
orientation: e.orientation,
|
|
1231
|
-
class: c(
|
|
1232
|
-
|
|
1288
|
+
class: c(l(i).root(e.ui?.root, e.class)),
|
|
1289
|
+
onValueCommit: r[1] || (r[1] = (n) => l(t).commitValue())
|
|
1233
1290
|
}, {
|
|
1234
|
-
default:
|
|
1235
|
-
|
|
1236
|
-
style:
|
|
1237
|
-
class: c(
|
|
1291
|
+
default: F(() => [
|
|
1292
|
+
w(l(G), {
|
|
1293
|
+
style: x({ background: u.value }),
|
|
1294
|
+
class: c(l(i).track(e.ui?.track))
|
|
1238
1295
|
}, null, 8, ["style", "class"]),
|
|
1239
|
-
|
|
1296
|
+
w(l(N), {
|
|
1240
1297
|
"aria-label": "Green",
|
|
1241
|
-
style:
|
|
1242
|
-
class: c(
|
|
1298
|
+
style: x({ background: l(t).hex.value }),
|
|
1299
|
+
class: c(l(i).thumb(e.ui?.thumb))
|
|
1243
1300
|
}, null, 8, ["style", "class"])
|
|
1244
1301
|
]),
|
|
1245
1302
|
_: 1
|
|
1246
1303
|
}, 8, ["modelValue", "disabled", "orientation", "class"]));
|
|
1247
1304
|
}
|
|
1248
|
-
}),
|
|
1305
|
+
}), kt = /* @__PURE__ */ V({
|
|
1249
1306
|
__name: "ColorPickerSliderBlue",
|
|
1250
1307
|
props: {
|
|
1251
1308
|
class: {},
|
|
1252
1309
|
orientation: { default: "horizontal" },
|
|
1253
1310
|
ui: {}
|
|
1254
1311
|
},
|
|
1255
|
-
setup(
|
|
1256
|
-
const e =
|
|
1312
|
+
setup(a) {
|
|
1313
|
+
const e = a, t = S(), s = m({
|
|
1257
1314
|
get: () => [t.rgb.value.b],
|
|
1258
1315
|
set: ([o]) => {
|
|
1259
1316
|
t.rgb.value = {
|
|
@@ -1261,47 +1318,88 @@ const He = ["height", "width"], Xe = /* @__PURE__ */ C({
|
|
|
1261
1318
|
b: o
|
|
1262
1319
|
};
|
|
1263
1320
|
}
|
|
1264
|
-
}), u =
|
|
1321
|
+
}), u = m(() => {
|
|
1265
1322
|
const o = e.orientation === "vertical" ? "to top" : "to right", r = `rgb(${t.rgb.value.r}, ${t.rgb.value.g}, 0)`, n = `rgb(${t.rgb.value.r}, ${t.rgb.value.g}, 255)`;
|
|
1266
1323
|
return `linear-gradient(${o}, ${r}, ${n})`;
|
|
1267
1324
|
}), i = t.uiSlots("slider", "shared");
|
|
1268
|
-
return (o, r) => (
|
|
1325
|
+
return (o, r) => (y(), A(l(L), {
|
|
1269
1326
|
modelValue: s.value,
|
|
1270
1327
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => s.value = n),
|
|
1271
|
-
disabled:
|
|
1328
|
+
disabled: l(t).disabled.value,
|
|
1272
1329
|
max: 255,
|
|
1273
1330
|
orientation: e.orientation,
|
|
1274
|
-
class: c(
|
|
1275
|
-
|
|
1331
|
+
class: c(l(i).root(e.ui?.root, e.class)),
|
|
1332
|
+
onValueCommit: r[1] || (r[1] = (n) => l(t).commitValue())
|
|
1276
1333
|
}, {
|
|
1277
|
-
default:
|
|
1278
|
-
|
|
1279
|
-
style:
|
|
1280
|
-
class: c(
|
|
1334
|
+
default: F(() => [
|
|
1335
|
+
w(l(G), {
|
|
1336
|
+
style: x({ background: u.value }),
|
|
1337
|
+
class: c(l(i).track(e.ui?.track))
|
|
1281
1338
|
}, null, 8, ["style", "class"]),
|
|
1282
|
-
|
|
1339
|
+
w(l(N), {
|
|
1283
1340
|
"aria-label": "Blue",
|
|
1284
|
-
style:
|
|
1285
|
-
class: c(
|
|
1341
|
+
style: x({ background: l(t).hex.value }),
|
|
1342
|
+
class: c(l(i).thumb(e.ui?.thumb))
|
|
1286
1343
|
}, null, 8, ["style", "class"])
|
|
1287
1344
|
]),
|
|
1288
1345
|
_: 1
|
|
1289
1346
|
}, 8, ["modelValue", "disabled", "orientation", "class"]));
|
|
1290
1347
|
}
|
|
1348
|
+
}), tt = "data:image/svg+xml;utf8,%3Csvg%20width%3D%226%22%20height%3D%226%22%20viewBox%3D%220%200%206%206%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M0%200H3V3H0V0Z%22%20fill%3D%22%23E1E1E1%22/%3E%3Cpath%20d%3D%22M3%200H6V3H3V0Z%22%20fill%3D%22white%22/%3E%3Cpath%20d%3D%22M3%203H6V6H3V3Z%22%20fill%3D%22%23E1E1E1%22/%3E%3Cpath%20d%3D%22M0%203H3V6H0V3Z%22%20fill%3D%22white%22/%3E%3C/svg%3E%0A", $t = /* @__PURE__ */ V({
|
|
1349
|
+
__name: "ColorPickerSwatch",
|
|
1350
|
+
props: {
|
|
1351
|
+
as: { default: "button" },
|
|
1352
|
+
value: {},
|
|
1353
|
+
class: {},
|
|
1354
|
+
ui: {}
|
|
1355
|
+
},
|
|
1356
|
+
setup(a) {
|
|
1357
|
+
const e = S(), t = a, s = m(() => Z(t.value) || e.rgba.value), u = e.uiSlots("swatch");
|
|
1358
|
+
return (i, o) => (y(), A(l(ae), {
|
|
1359
|
+
as: t.as,
|
|
1360
|
+
disabled: l(e).disabled.value,
|
|
1361
|
+
style: x({ backgroundColor: `rgb(${s.value.r}, ${s.value.g}, ${s.value.b})` }),
|
|
1362
|
+
class: c(l(u).base(t.ui?.base, t.class))
|
|
1363
|
+
}, {
|
|
1364
|
+
default: F(() => [
|
|
1365
|
+
h("span", {
|
|
1366
|
+
style: x({
|
|
1367
|
+
opacity: 1 - s.value.a,
|
|
1368
|
+
background: `url(${l(tt)})`
|
|
1369
|
+
}),
|
|
1370
|
+
class: c(l(u).alpha(t.ui?.alpha))
|
|
1371
|
+
}, null, 6)
|
|
1372
|
+
]),
|
|
1373
|
+
_: 1
|
|
1374
|
+
}, 8, ["as", "disabled", "style", "class"]));
|
|
1375
|
+
}
|
|
1291
1376
|
});
|
|
1292
1377
|
export {
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1378
|
+
rt as ColorPickerCanvas,
|
|
1379
|
+
ut as ColorPickerEyeDropper,
|
|
1380
|
+
vt as ColorPickerInputHSB,
|
|
1381
|
+
dt as ColorPickerInputHSL,
|
|
1382
|
+
it as ColorPickerInputHex,
|
|
1383
|
+
ct as ColorPickerInputRGB,
|
|
1384
|
+
nt as ColorPickerRoot,
|
|
1385
|
+
pt as ColorPickerSliderAlpha,
|
|
1386
|
+
kt as ColorPickerSliderBlue,
|
|
1387
|
+
gt as ColorPickerSliderGreen,
|
|
1388
|
+
ht as ColorPickerSliderHue,
|
|
1389
|
+
ft as ColorPickerSliderLightness,
|
|
1390
|
+
mt as ColorPickerSliderRed,
|
|
1391
|
+
bt as ColorPickerSliderSaturation,
|
|
1392
|
+
$t as ColorPickerSwatch,
|
|
1393
|
+
se as HSLtoHSV,
|
|
1394
|
+
oe as HSVtoHSL,
|
|
1395
|
+
X as HSVtoRGB,
|
|
1396
|
+
J as HexToRGB,
|
|
1397
|
+
ot as HexaToRGBA,
|
|
1398
|
+
fe as RGBAtoCSS,
|
|
1399
|
+
be as RGBAtoHexa,
|
|
1400
|
+
he as RGBtoHSV,
|
|
1401
|
+
q as RGBtoHex,
|
|
1402
|
+
S as injectColorPickerContext,
|
|
1403
|
+
R as toHex,
|
|
1404
|
+
me as useVModel
|
|
1307
1405
|
};
|