@aurouscia/au-color-picker 1.0.0 → 1.0.2-dev.1
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/au-color-picker.css +1 -1
- package/dist/au-color-picker.es.js +272 -264
- package/package.json +1 -1
package/dist/au-color-picker.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.acpRingBody[data-v-
|
|
1
|
+
.acpRingBody[data-v-8fe5429e]{position:relative}canvas[data-v-8fe5429e]{position:absolute;inset:0;width:100%;height:100%}[data-v-dc351014]{margin:0;padding:0}.acpSep[data-v-dc351014]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-dc351014]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-dc351014]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-dc351014]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-dc351014]:hover{color:#000}.acpEntry[data-v-dc351014]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-dc351014]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-dc351014]{position:relative;width:fit-content}.acp label[data-v-dc351014]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-dc351014]{cursor:pointer}.acpPackageName[data-v-dc351014]{position:absolute;left:2px;bottom:3px;font-size:8px;color:#ccc;text-align:right;cursor:pointer;-webkit-user-select:none;user-select:none}.acpParams[data-v-dc351014]{display:flex;justify-content:space-between;align-items:center;padding:5px}.acpParams select[data-v-dc351014],.acpParams input[data-v-dc351014]{margin:0;padding:2px;display:block;font-size:16px;box-sizing:border-box;height:24px;line-height:24px}.acpParams select[data-v-dc351014]{-webkit-user-select:none;user-select:none}.acpParams input[data-v-dc351014]{text-align:center}.acpParams .acpSingleInput input[data-v-dc351014]{width:120px}.acpParams .acpTripleInputs[data-v-dc351014]{display:flex;justify-content:space-around}.acpParams .acpTripleInputs input[data-v-dc351014]{width:40px}[data-v-1e965bbc]{margin:0;padding:0}.acpSep[data-v-1e965bbc]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-1e965bbc]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-1e965bbc]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-1e965bbc]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-1e965bbc]:hover{color:#000}.acpEntry[data-v-1e965bbc]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-1e965bbc]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-1e965bbc]{position:relative;width:fit-content}.acp label[data-v-1e965bbc]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-1e965bbc]{cursor:pointer}.acpNamedPresets[data-v-1e965bbc]{margin:5px;display:flex;flex-direction:column;gap:4px}.acpNamedPresets[data-v-1e965bbc]>*{display:flex;justify-content:flex-start;align-items:center;gap:5px}.acpNamedPresets>* .acpPresetName[data-v-1e965bbc]{color:#666}.acpNamedPresets>* .acpPresetName[data-v-1e965bbc]:hover{color:#000}
|
|
@@ -1,182 +1,193 @@
|
|
|
1
|
-
import { defineComponent as te, ref as I, onMounted as ye, onUnmounted as xe, createElementBlock as
|
|
1
|
+
import { defineComponent as te, ref as I, onMounted as ye, onUnmounted as xe, createElementBlock as N, openBlock as R, normalizeStyle as j, isRef as he, createElementVNode as c, computed as F, onBeforeMount as ue, watch as W, createCommentVNode as J, unref as h, normalizeClass as Pe, createVNode as ce, withDirectives as Q, vModelSelect as ke, vModelRadio as oe, Fragment as Ce, renderList as Se, toDisplayString as we } from "vue";
|
|
2
2
|
import A from "color-convert";
|
|
3
|
-
function Ie(
|
|
4
|
-
const m =
|
|
3
|
+
function Ie(i, x) {
|
|
4
|
+
const m = i.x - x.x, t = i.y - x.y;
|
|
5
5
|
return m ** 2 + t ** 2;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
const m =
|
|
7
|
+
function Be(i, x) {
|
|
8
|
+
const m = i.x - x.x, t = i.y - x.y;
|
|
9
9
|
return Math.atan2(t, m);
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const T = 400, _ = 400, G = 200, Ve = 200, le = 190, se = 150, z = 200, ae = 16, ie = 3, be = /* @__PURE__ */ te({
|
|
12
12
|
__name: "AuColorPickerRing",
|
|
13
13
|
props: {
|
|
14
14
|
initialHex: {}
|
|
15
15
|
},
|
|
16
16
|
emits: ["changed"],
|
|
17
|
-
setup(
|
|
17
|
+
setup(i, { expose: x, emit: m }) {
|
|
18
18
|
const t = I(), g = I();
|
|
19
|
-
let
|
|
20
|
-
const
|
|
21
|
-
let
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
let u, d;
|
|
20
|
+
const k = { x: 199, y: 199 }, E = (le + se) / 2, $ = le ** 2, U = se ** 2, V = (T - z) / 2, H = V + z, P = I(0), S = I(100), w = I(100), b = i;
|
|
21
|
+
let l;
|
|
22
|
+
function r() {
|
|
23
|
+
try {
|
|
24
|
+
const n = t.value?.getContext("2d"), o = g.value?.getContext("2d");
|
|
25
|
+
if (!n || !o)
|
|
26
|
+
throw Error("canvas context getting error");
|
|
27
|
+
if (b.initialHex) {
|
|
28
|
+
const a = A.hex.hsv(b.initialHex);
|
|
29
|
+
P.value = a[0], S.value = a[1], w.value = a[2];
|
|
30
|
+
}
|
|
31
|
+
u = n, d = o, l = u.createImageData(T, _), p(), y(), Y(), createImageBitmap(l).then((a) => {
|
|
32
|
+
u.drawImage(a, 0, 0);
|
|
33
|
+
});
|
|
34
|
+
} catch (n) {
|
|
35
|
+
const o = document.createElement("div");
|
|
36
|
+
o.innerText = JSON.stringify(n), document.appendChild(o);
|
|
29
37
|
}
|
|
30
|
-
i = l, u = s, y = i.getImageData(0, 0, D, z), r(), x(), Y(), i.putImageData(y, 0, 0);
|
|
31
38
|
}
|
|
32
|
-
function
|
|
33
|
-
for (let
|
|
34
|
-
for (let
|
|
35
|
-
const a = { x:
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
+
function p() {
|
|
40
|
+
for (let n = 0; n < T; n++)
|
|
41
|
+
for (let o = 0; o < _; o++) {
|
|
42
|
+
const a = { x: n, y: o };
|
|
43
|
+
if (X(a)) {
|
|
44
|
+
const f = a.y * T * 4 + a.x * 4, B = D(a), q = A.hsv.rgb([B, 100, 100]);
|
|
45
|
+
l.data[f] = q[0], l.data[f + 1] = q[1], l.data[f + 2] = q[2], l.data[f + 3] = 255;
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
|
-
function
|
|
43
|
-
return 360 * ((
|
|
49
|
+
function D(n) {
|
|
50
|
+
return 360 * ((Be(n, k) + Math.PI) / (2 * Math.PI));
|
|
44
51
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
return
|
|
52
|
+
function X(n) {
|
|
53
|
+
const o = Ie(k, n);
|
|
54
|
+
return o > U && o < $;
|
|
48
55
|
}
|
|
49
|
-
function
|
|
50
|
-
for (let
|
|
51
|
-
for (let
|
|
52
|
-
const a = { x:
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
+
function y() {
|
|
57
|
+
for (let n = 0; n < T; n++)
|
|
58
|
+
for (let o = 0; o < _; o++) {
|
|
59
|
+
const a = { x: n, y: o };
|
|
60
|
+
if (s(a)) {
|
|
61
|
+
const f = a.y * T * 4 + a.x * 4, { s: B, v: q } = e(a), L = A.hsv.rgb([P.value, B, q]);
|
|
62
|
+
l.data[f] = L[0], l.data[f + 1] = L[1], l.data[f + 2] = L[2], l.data[f + 3] = 255;
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
|
-
function e(
|
|
60
|
-
const
|
|
61
|
-
let
|
|
62
|
-
return
|
|
66
|
+
function e(n) {
|
|
67
|
+
const o = n.x - V, a = n.y - V;
|
|
68
|
+
let f = o / z, B = 1 - a / z;
|
|
69
|
+
return f > 1 ? f = 1 : f < 0 && (f = 0), B > 1 ? B = 1 : B < 0 && (B = 0), { s: 100 * f, v: 100 * B };
|
|
63
70
|
}
|
|
64
|
-
function n
|
|
65
|
-
return !(
|
|
71
|
+
function s(n) {
|
|
72
|
+
return !(n.x < V || n.x > H || n.y < V || n.y > H);
|
|
66
73
|
}
|
|
67
|
-
let M = !1,
|
|
68
|
-
function K(
|
|
69
|
-
if (M ||
|
|
74
|
+
let M = !1, v = "none", C = I(!1);
|
|
75
|
+
function K(n, o) {
|
|
76
|
+
if (M || o && !C.value)
|
|
70
77
|
return;
|
|
71
78
|
M = !0;
|
|
72
|
-
const a = fe(
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
const a = fe(n);
|
|
80
|
+
if (v === "none" && (s(a) ? v = "square" : X(a) && (v = "ring")), v === "ring" && (n.preventDefault(), P.value = D(a), y(), createImageBitmap(l).then((f) => {
|
|
81
|
+
u.drawImage(f, 0, 0);
|
|
82
|
+
})), v === "square") {
|
|
83
|
+
n.preventDefault();
|
|
84
|
+
const f = e(a);
|
|
85
|
+
S.value = f.s, w.value = f.v;
|
|
77
86
|
}
|
|
78
|
-
|
|
87
|
+
v !== "none" && Y(!0), M = !1;
|
|
79
88
|
}
|
|
80
89
|
function Z() {
|
|
81
|
-
|
|
90
|
+
v = "none", C.value = !1;
|
|
82
91
|
}
|
|
83
|
-
function fe(
|
|
84
|
-
let
|
|
92
|
+
function fe(n) {
|
|
93
|
+
let o, a;
|
|
85
94
|
if (!t.value)
|
|
86
95
|
return { x: -1, y: -1 };
|
|
87
|
-
if ("touches" in
|
|
88
|
-
const
|
|
89
|
-
|
|
96
|
+
if ("touches" in n) {
|
|
97
|
+
const f = t.value.getBoundingClientRect();
|
|
98
|
+
o = n.touches[0].clientX - f.left, a = n.touches[0].clientY - f.top;
|
|
90
99
|
} else
|
|
91
|
-
|
|
92
|
-
return
|
|
100
|
+
o = n.offsetX, a = n.offsetY;
|
|
101
|
+
return o = o * T / G, a = a * T / G, { x: o, y: a };
|
|
93
102
|
}
|
|
94
|
-
function Y(
|
|
95
|
-
if (
|
|
96
|
-
const ge = A.hsv.hex([
|
|
103
|
+
function Y(n) {
|
|
104
|
+
if (n) {
|
|
105
|
+
const ge = A.hsv.hex([P.value, S.value, w.value]);
|
|
97
106
|
me("changed", ge);
|
|
98
107
|
}
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
108
|
+
const o = (P.value / 360 * 2 + 1) * Math.PI, a = Math.cos(o) * E + T / 2, f = Math.sin(o) * E + _ / 2, B = S.value / 100 * z + V, q = (1 - w.value / 100) * z + V;
|
|
109
|
+
d.reset(), d.lineWidth = 4, d.strokeStyle = "black", d.beginPath(), d.arc(a, f, ae - 2, 0, 2 * Math.PI), d.stroke(), d.beginPath(), d.arc(a, f, ie, 0, 2 * Math.PI), d.fill();
|
|
110
|
+
const L = w.value > 50 ? "black" : "#ddd";
|
|
111
|
+
d.strokeStyle = L, d.fillStyle = L, d.beginPath(), d.arc(B, q, ae - 2, 0, 2 * Math.PI), d.stroke(), d.beginPath(), d.arc(B, q, ie, 0, 2 * Math.PI), d.fill();
|
|
103
112
|
}
|
|
104
|
-
function pe(
|
|
105
|
-
const
|
|
106
|
-
|
|
113
|
+
function pe(n) {
|
|
114
|
+
const o = A.hex.hsv(n);
|
|
115
|
+
P.value = o[0], S.value = o[1], w.value = o[2], y(), createImageBitmap(l).then((a) => {
|
|
116
|
+
u.drawImage(a, 0, 0);
|
|
117
|
+
}), Y();
|
|
107
118
|
}
|
|
108
119
|
const me = m;
|
|
109
|
-
return
|
|
110
|
-
|
|
120
|
+
return x({ enforceTo: pe }), ye(() => {
|
|
121
|
+
r(), window.addEventListener("touchend", Z), window.addEventListener("mouseup", Z);
|
|
111
122
|
}), xe(() => {
|
|
112
123
|
window.removeEventListener("touchend", Z), window.removeEventListener("mouseup", Z);
|
|
113
|
-
}), (
|
|
124
|
+
}), (n, o) => (R(), N("div", {
|
|
114
125
|
class: "acpRingBody",
|
|
115
|
-
style:
|
|
126
|
+
style: j({ width: G + "px", height: Ve + "px" }),
|
|
116
127
|
onTouchstart: K,
|
|
117
128
|
onTouchmove: K,
|
|
118
129
|
onTouchend: Z,
|
|
119
|
-
onMousemove:
|
|
120
|
-
onMousedown:
|
|
121
|
-
K(a),
|
|
130
|
+
onMousemove: o[0] || (o[0] = (a) => K(a, !0)),
|
|
131
|
+
onMousedown: o[1] || (o[1] = (a) => {
|
|
132
|
+
K(a), he(C) ? C.value = !0 : C = !0;
|
|
122
133
|
})
|
|
123
134
|
}, [
|
|
124
|
-
|
|
125
|
-
width:
|
|
126
|
-
height:
|
|
135
|
+
c("canvas", {
|
|
136
|
+
width: T,
|
|
137
|
+
height: _,
|
|
127
138
|
ref_key: "cvs",
|
|
128
139
|
ref: t
|
|
129
140
|
}, null, 512),
|
|
130
|
-
|
|
131
|
-
width:
|
|
132
|
-
height:
|
|
141
|
+
c("canvas", {
|
|
142
|
+
width: T,
|
|
143
|
+
height: _,
|
|
133
144
|
ref_key: "cursorCvs",
|
|
134
145
|
ref: g
|
|
135
146
|
}, null, 512)
|
|
136
147
|
], 36));
|
|
137
148
|
}
|
|
138
|
-
}), ne = (
|
|
139
|
-
const m =
|
|
140
|
-
for (const [t, g] of
|
|
149
|
+
}), ne = (i, x) => {
|
|
150
|
+
const m = i.__vccOpts || i;
|
|
151
|
+
for (const [t, g] of x)
|
|
141
152
|
m[t] = g;
|
|
142
153
|
return m;
|
|
143
|
-
},
|
|
144
|
-
function ee(
|
|
145
|
-
return /^#([0-9A-F]{3}){1,2}$/i.test(
|
|
154
|
+
}, Te = /* @__PURE__ */ ne(be, [["__scopeId", "data-v-8fe5429e"]]);
|
|
155
|
+
function ee(i) {
|
|
156
|
+
return /^#([0-9A-F]{3}){1,2}$/i.test(i);
|
|
146
157
|
}
|
|
147
|
-
function de(
|
|
158
|
+
function de(i, x) {
|
|
148
159
|
const m = I(!1), t = F(() => {
|
|
149
|
-
let
|
|
150
|
-
return m.value || (
|
|
160
|
+
let k = {};
|
|
161
|
+
return m.value || (k.boxShadow = "none"), i.entryStyles && Object.assign(k, i.entryStyles), m.value && (k.transition = "0s", Object.assign(k, i.entryActiveStyles)), k.backgroundColor = x.value, k;
|
|
151
162
|
});
|
|
152
163
|
function g() {
|
|
153
164
|
m.value = !1;
|
|
154
165
|
}
|
|
155
|
-
let
|
|
156
|
-
function
|
|
157
|
-
if (
|
|
158
|
-
|
|
166
|
+
let u = 0;
|
|
167
|
+
function d() {
|
|
168
|
+
if (i.entryRespondDelay && (window.clearTimeout(u), !m.value)) {
|
|
169
|
+
u = window.setTimeout(() => {
|
|
159
170
|
m.value = !0;
|
|
160
|
-
},
|
|
171
|
+
}, i.entryRespondDelay);
|
|
161
172
|
return;
|
|
162
173
|
}
|
|
163
174
|
m.value = !m.value;
|
|
164
175
|
}
|
|
165
|
-
return { panelShow: m, closePanel: g, togglePanel:
|
|
176
|
+
return { panelShow: m, closePanel: g, togglePanel: d, entryStylesActual: t };
|
|
166
177
|
}
|
|
167
178
|
function re() {
|
|
168
179
|
window.alert("https://www.npmjs.com/package/@aurouscia/au-color-picker");
|
|
169
180
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
181
|
+
function O(i) {
|
|
182
|
+
return i.startsWith("#") ? i.toUpperCase() : "#" + i.toUpperCase();
|
|
172
183
|
}
|
|
173
|
-
function ve(
|
|
184
|
+
function ve(i) {
|
|
174
185
|
return {
|
|
175
186
|
panelStyles: F(() => {
|
|
176
|
-
const m =
|
|
187
|
+
const m = i.panelBaseZIndex;
|
|
177
188
|
let t, g;
|
|
178
|
-
const
|
|
179
|
-
return typeof
|
|
189
|
+
const u = i.pos;
|
|
190
|
+
return typeof u == "number" ? t = u + "px" : u == "left" ? g = "0px" : t = "0px", {
|
|
180
191
|
zIndex: (m || 0) + 100,
|
|
181
192
|
left: t,
|
|
182
193
|
right: g
|
|
@@ -184,7 +195,7 @@ function ve(o) {
|
|
|
184
195
|
})
|
|
185
196
|
};
|
|
186
197
|
}
|
|
187
|
-
const
|
|
198
|
+
const Ne = { class: "acp" }, Re = { class: "acpRing" }, De = { class: "acpParams" }, He = {
|
|
188
199
|
key: 0,
|
|
189
200
|
class: "acpSingleInput"
|
|
190
201
|
}, Me = ["value"], Ae = {
|
|
@@ -208,155 +219,155 @@ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams
|
|
|
208
219
|
showPackageName: { type: Boolean }
|
|
209
220
|
},
|
|
210
221
|
emits: ["done", "update:modelValue"],
|
|
211
|
-
setup(
|
|
212
|
-
const t =
|
|
213
|
-
function
|
|
214
|
-
|
|
222
|
+
setup(i, { expose: x, emit: m }) {
|
|
223
|
+
const t = i, g = I(), u = I("#ff0000"), { panelShow: d, closePanel: k, togglePanel: E, entryStylesActual: $ } = de(t, u), { panelStyles: U } = ve(t);
|
|
224
|
+
function V(y) {
|
|
225
|
+
u.value = O(y), r();
|
|
215
226
|
}
|
|
216
|
-
const H = I("hex"),
|
|
217
|
-
function
|
|
218
|
-
const e =
|
|
227
|
+
const H = I("hex"), P = F(() => A.hex.rgb(u.value)), S = F(() => A.hex.hsv(u.value));
|
|
228
|
+
function w(y) {
|
|
229
|
+
const e = y.target;
|
|
219
230
|
if ("value" in e) {
|
|
220
|
-
const
|
|
221
|
-
if (
|
|
222
|
-
|
|
231
|
+
const s = e.value;
|
|
232
|
+
if (s && ee(s)) {
|
|
233
|
+
u.value = O(s), g.value?.enforceTo(u.value), r();
|
|
223
234
|
return;
|
|
224
235
|
}
|
|
225
|
-
e.value =
|
|
236
|
+
e.value = u.value;
|
|
226
237
|
}
|
|
227
238
|
}
|
|
228
|
-
function b(
|
|
229
|
-
const
|
|
230
|
-
if ("value" in
|
|
231
|
-
const M =
|
|
239
|
+
function b(y, e) {
|
|
240
|
+
const s = y.target;
|
|
241
|
+
if ("value" in s) {
|
|
242
|
+
const M = s.value;
|
|
232
243
|
if (M) {
|
|
233
|
-
let
|
|
234
|
-
if (isNaN(
|
|
235
|
-
|
|
244
|
+
let v = parseInt(M);
|
|
245
|
+
if (isNaN(v))
|
|
246
|
+
s.value = "0";
|
|
236
247
|
else {
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
e == "r" ?
|
|
248
|
+
v > 255 ? v = 255 : v < 0 && (v = 0);
|
|
249
|
+
const C = [...P.value];
|
|
250
|
+
e == "r" ? C[0] = v : e == "g" ? C[1] = v : C[2] = v, u.value = O(A.rgb.hex(C)), g.value?.enforceTo(u.value), s.value = v.toString(), r();
|
|
240
251
|
return;
|
|
241
252
|
}
|
|
242
253
|
}
|
|
243
254
|
}
|
|
244
255
|
}
|
|
245
|
-
function y
|
|
246
|
-
const
|
|
247
|
-
if ("value" in
|
|
248
|
-
const M =
|
|
256
|
+
function l(y, e) {
|
|
257
|
+
const s = y.target;
|
|
258
|
+
if ("value" in s) {
|
|
259
|
+
const M = s.value;
|
|
249
260
|
if (M) {
|
|
250
|
-
let
|
|
251
|
-
if (isNaN(
|
|
252
|
-
|
|
261
|
+
let v = parseInt(M);
|
|
262
|
+
if (isNaN(v))
|
|
263
|
+
s.value = "0";
|
|
253
264
|
else {
|
|
254
|
-
e === "h" ?
|
|
255
|
-
const
|
|
256
|
-
e == "h" ?
|
|
265
|
+
e === "h" ? v > 359 && (v = 359) : v > 100 && (v = 100), v < 0 && (v = 0);
|
|
266
|
+
const C = [...S.value];
|
|
267
|
+
e == "h" ? C[0] = v : e == "s" ? C[1] = v : C[2] = v, u.value = O(A.hsv.hex(C)), s.value = v.toString(), g.value?.enforceTo(u.value), r();
|
|
257
268
|
return;
|
|
258
269
|
}
|
|
259
270
|
}
|
|
260
271
|
}
|
|
261
272
|
}
|
|
262
|
-
function c() {
|
|
263
|
-
q("update:modelValue", i.value);
|
|
264
|
-
}
|
|
265
273
|
function r() {
|
|
266
|
-
|
|
274
|
+
X("update:modelValue", u.value);
|
|
275
|
+
}
|
|
276
|
+
function p() {
|
|
277
|
+
return u.value;
|
|
267
278
|
}
|
|
268
|
-
function
|
|
269
|
-
if (ee(
|
|
270
|
-
const e =
|
|
271
|
-
|
|
279
|
+
function D(y) {
|
|
280
|
+
if (ee(y)) {
|
|
281
|
+
const e = O(y);
|
|
282
|
+
u.value = e, g.value?.enforceTo(e);
|
|
272
283
|
}
|
|
273
284
|
}
|
|
274
285
|
ue(() => {
|
|
275
|
-
t.modelValue ?
|
|
286
|
+
t.modelValue ? D(t.modelValue) : t.initial && D(t.initial);
|
|
276
287
|
});
|
|
277
|
-
const
|
|
278
|
-
return
|
|
279
|
-
|
|
280
|
-
}),
|
|
281
|
-
|
|
282
|
-
}), (
|
|
283
|
-
|
|
284
|
-
class:
|
|
285
|
-
style:
|
|
288
|
+
const X = m;
|
|
289
|
+
return x({ closePanel: k, getCurrentHex: p, enforceTo: D }), W(() => t.modelValue, (y) => {
|
|
290
|
+
y && y !== u.value && D(y);
|
|
291
|
+
}), W(d, (y) => {
|
|
292
|
+
y === !1 && X("done");
|
|
293
|
+
}), (y, e) => (R(), N("div", Ne, [
|
|
294
|
+
c("div", {
|
|
295
|
+
class: Pe(i.entryClassName || "acpEntry"),
|
|
296
|
+
style: j(h($)),
|
|
286
297
|
onClick: e[0] || (e[0] = //@ts-ignore
|
|
287
|
-
(...
|
|
298
|
+
(...s) => h(E) && h(E)(...s))
|
|
288
299
|
}, null, 6),
|
|
289
|
-
|
|
300
|
+
h(d) ? (R(), N("div", {
|
|
290
301
|
key: 0,
|
|
291
302
|
class: "acpPanel",
|
|
292
|
-
style:
|
|
293
|
-
onClick: e[10] || (e[10] = (
|
|
303
|
+
style: j(h(U)),
|
|
304
|
+
onClick: e[10] || (e[10] = (s) => i.panelClickStopPropagation && s.stopPropagation())
|
|
294
305
|
}, [
|
|
295
|
-
|
|
296
|
-
ce(
|
|
306
|
+
c("div", Re, [
|
|
307
|
+
ce(Te, {
|
|
297
308
|
ref_key: "ring",
|
|
298
309
|
ref: g,
|
|
299
|
-
"initial-hex":
|
|
300
|
-
onChanged:
|
|
301
|
-
"show-package-name":
|
|
310
|
+
"initial-hex": u.value,
|
|
311
|
+
onChanged: V,
|
|
312
|
+
"show-package-name": i.showPackageName
|
|
302
313
|
}, null, 8, ["initial-hex", "show-package-name"])
|
|
303
314
|
]),
|
|
304
|
-
|
|
305
|
-
Q(
|
|
306
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
315
|
+
c("div", De, [
|
|
316
|
+
Q(c("select", {
|
|
317
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => H.value = s)
|
|
307
318
|
}, [...e[11] || (e[11] = [
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
319
|
+
c("option", { value: "hex" }, "HEX", -1),
|
|
320
|
+
c("option", { value: "rgb" }, "RGB", -1),
|
|
321
|
+
c("option", { value: "hsv" }, "HSV", -1)
|
|
311
322
|
])], 512), [
|
|
312
323
|
[ke, H.value]
|
|
313
324
|
]),
|
|
314
|
-
H.value == "hex" ? (
|
|
315
|
-
|
|
316
|
-
value:
|
|
317
|
-
onBlur:
|
|
325
|
+
H.value == "hex" ? (R(), N("div", He, [
|
|
326
|
+
c("input", {
|
|
327
|
+
value: u.value,
|
|
328
|
+
onBlur: w,
|
|
318
329
|
spellcheck: "false",
|
|
319
330
|
maxlength: "7"
|
|
320
331
|
}, null, 40, Me)
|
|
321
|
-
])) : H.value == "rgb" ? (
|
|
322
|
-
|
|
323
|
-
value:
|
|
324
|
-
onBlur: e[2] || (e[2] = (
|
|
332
|
+
])) : H.value == "rgb" ? (R(), N("div", Ae, [
|
|
333
|
+
c("input", {
|
|
334
|
+
value: P.value[0],
|
|
335
|
+
onBlur: e[2] || (e[2] = (s) => b(s, "r"))
|
|
325
336
|
}, null, 40, Ee),
|
|
326
|
-
|
|
327
|
-
value:
|
|
328
|
-
onBlur: e[3] || (e[3] = (
|
|
337
|
+
c("input", {
|
|
338
|
+
value: P.value[1],
|
|
339
|
+
onBlur: e[3] || (e[3] = (s) => b(s, "g"))
|
|
329
340
|
}, null, 40, $e),
|
|
330
|
-
|
|
331
|
-
value:
|
|
332
|
-
onBlur: e[4] || (e[4] = (
|
|
341
|
+
c("input", {
|
|
342
|
+
value: P.value[2],
|
|
343
|
+
onBlur: e[4] || (e[4] = (s) => b(s, "b"))
|
|
333
344
|
}, null, 40, qe)
|
|
334
|
-
])) : (
|
|
335
|
-
|
|
336
|
-
value:
|
|
337
|
-
onBlur: e[5] || (e[5] = (
|
|
345
|
+
])) : (R(), N("div", Ue, [
|
|
346
|
+
c("input", {
|
|
347
|
+
value: S.value[0],
|
|
348
|
+
onBlur: e[5] || (e[5] = (s) => l(s, "h"))
|
|
338
349
|
}, null, 40, Le),
|
|
339
|
-
|
|
340
|
-
value:
|
|
341
|
-
onBlur: e[6] || (e[6] = (
|
|
350
|
+
c("input", {
|
|
351
|
+
value: S.value[1],
|
|
352
|
+
onBlur: e[6] || (e[6] = (s) => l(s, "s"))
|
|
342
353
|
}, null, 40, _e),
|
|
343
|
-
|
|
344
|
-
value:
|
|
345
|
-
onBlur: e[7] || (e[7] = (
|
|
354
|
+
c("input", {
|
|
355
|
+
value: S.value[2],
|
|
356
|
+
onBlur: e[7] || (e[7] = (s) => l(s, "v"))
|
|
346
357
|
}, null, 40, ze)
|
|
347
358
|
]))
|
|
348
359
|
]),
|
|
349
|
-
|
|
350
|
-
|
|
360
|
+
c("div", Oe, [
|
|
361
|
+
c("button", {
|
|
351
362
|
onClick: e[8] || (e[8] = //@ts-ignore
|
|
352
|
-
(...
|
|
363
|
+
(...s) => h(k) && h(k)(...s))
|
|
353
364
|
}, "OK")
|
|
354
365
|
]),
|
|
355
|
-
|
|
366
|
+
i.showPackageName ? (R(), N("div", {
|
|
356
367
|
key: 0,
|
|
357
368
|
class: "acpPackageName",
|
|
358
369
|
onClick: e[9] || (e[9] = //@ts-ignore
|
|
359
|
-
(...
|
|
370
|
+
(...s) => h(re) && h(re)(...s))
|
|
360
371
|
}, " au-color-picker ")) : J("", !0)
|
|
361
372
|
], 4)) : J("", !0)
|
|
362
373
|
]));
|
|
@@ -380,114 +391,111 @@ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams
|
|
|
380
391
|
showPackageName: { type: Boolean }
|
|
381
392
|
},
|
|
382
393
|
emits: ["done", "update:modelValue", "update:modelValueSelectedPreset"],
|
|
383
|
-
setup(
|
|
384
|
-
const t =
|
|
385
|
-
let
|
|
386
|
-
return g.value && (
|
|
387
|
-
}), { panelShow: E, closePanel: $, togglePanel:
|
|
388
|
-
function
|
|
389
|
-
g.value =
|
|
394
|
+
setup(i, { expose: x, emit: m }) {
|
|
395
|
+
const t = i, g = I(), u = I(), d = I("#ff0000"), k = F(() => {
|
|
396
|
+
let l = null;
|
|
397
|
+
return g.value && (l = t.presets?.find((p) => p.name == g.value)?.colorHex), l || d.value;
|
|
398
|
+
}), { panelShow: E, closePanel: $, togglePanel: U, entryStylesActual: V } = de(t, k), { panelStyles: H } = ve(t);
|
|
399
|
+
function P(l) {
|
|
400
|
+
g.value = l?.name, S("update:modelValueSelectedPreset", l?.name);
|
|
390
401
|
}
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
|
|
402
|
+
const S = m;
|
|
403
|
+
W(d, (l) => {
|
|
404
|
+
S("update:modelValue", l);
|
|
394
405
|
});
|
|
395
|
-
function
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
if (ee(c)) {
|
|
400
|
-
const r = W(c);
|
|
401
|
-
u.value = r, i.value?.enforceTo(r);
|
|
406
|
+
function w(l) {
|
|
407
|
+
if (ee(l)) {
|
|
408
|
+
const r = O(l);
|
|
409
|
+
d.value = r, u.value?.enforceTo(r);
|
|
402
410
|
}
|
|
403
411
|
}
|
|
404
|
-
function
|
|
405
|
-
|
|
406
|
-
const r = t.presets?.find((
|
|
407
|
-
r &&
|
|
412
|
+
function b(l) {
|
|
413
|
+
l || P(void 0);
|
|
414
|
+
const r = t.presets?.find((p) => p.name === l);
|
|
415
|
+
r && P(r);
|
|
408
416
|
}
|
|
409
|
-
return
|
|
410
|
-
|
|
411
|
-
}),
|
|
412
|
-
|
|
413
|
-
}),
|
|
414
|
-
|
|
417
|
+
return x({ closePanel: $, enforceCustomValueTo: w, enforcePresetTo: b }), W(E, (l) => {
|
|
418
|
+
l === !1 && S("done");
|
|
419
|
+
}), W(() => t.modelValue, (l) => {
|
|
420
|
+
l && w(l);
|
|
421
|
+
}), W(() => t.modelValueSelectedPreset, (l) => {
|
|
422
|
+
b(l);
|
|
415
423
|
}), ue(() => {
|
|
416
|
-
t.modelValue ?
|
|
417
|
-
}), (
|
|
418
|
-
|
|
424
|
+
t.modelValue ? w(t.modelValue) : t.initial && w(t.initial), t.modelValueSelectedPreset ? b(t.modelValueSelectedPreset) : t.initialSelectedPreset && b(t.initialSelectedPreset);
|
|
425
|
+
}), (l, r) => (R(), N("div", Xe, [
|
|
426
|
+
c("div", {
|
|
419
427
|
class: "acpEntry",
|
|
420
|
-
style:
|
|
428
|
+
style: j(h(V)),
|
|
421
429
|
onClick: r[0] || (r[0] = //@ts-ignore
|
|
422
|
-
(...
|
|
430
|
+
(...p) => h(U) && h(U)(...p))
|
|
423
431
|
}, null, 4),
|
|
424
|
-
|
|
432
|
+
h(E) ? (R(), N("div", {
|
|
425
433
|
key: 0,
|
|
426
434
|
class: "acpPanel",
|
|
427
|
-
style:
|
|
428
|
-
onClick: r[6] || (r[6] = (
|
|
435
|
+
style: j(h(H)),
|
|
436
|
+
onClick: r[6] || (r[6] = (p) => i.panelClickStopPropagation && p.stopPropagation())
|
|
429
437
|
}, [
|
|
430
|
-
|
|
431
|
-
|
|
438
|
+
c("div", Ze, [
|
|
439
|
+
c("label", {
|
|
432
440
|
for: "acpColorPresetCustom",
|
|
433
|
-
onClick: r[3] || (r[3] = (
|
|
441
|
+
onClick: r[3] || (r[3] = (p) => P(void 0))
|
|
434
442
|
}, [
|
|
435
443
|
ce(je, {
|
|
436
|
-
modelValue:
|
|
437
|
-
"onUpdate:modelValue": r[1] || (r[1] = (
|
|
438
|
-
onDone:
|
|
444
|
+
modelValue: d.value,
|
|
445
|
+
"onUpdate:modelValue": r[1] || (r[1] = (p) => d.value = p),
|
|
446
|
+
onDone: h($),
|
|
439
447
|
"entry-class-name": "acpPresetBody",
|
|
440
448
|
ref_key: "customPicker",
|
|
441
|
-
ref:
|
|
442
|
-
"show-package-name":
|
|
443
|
-
pos:
|
|
444
|
-
}, null, 8, ["modelValue", "show-package-name", "pos"]),
|
|
445
|
-
Q(
|
|
449
|
+
ref: u,
|
|
450
|
+
"show-package-name": i.showPackageName,
|
|
451
|
+
pos: i.posInternal
|
|
452
|
+
}, null, 8, ["modelValue", "onDone", "show-package-name", "pos"]),
|
|
453
|
+
Q(c("input", {
|
|
446
454
|
name: "colorType",
|
|
447
455
|
type: "radio",
|
|
448
456
|
id: "acpColorPresetCustom",
|
|
449
457
|
value: void 0,
|
|
450
|
-
"onUpdate:modelValue": r[2] || (r[2] = (
|
|
458
|
+
"onUpdate:modelValue": r[2] || (r[2] = (p) => g.value = p)
|
|
451
459
|
}, null, 512), [
|
|
452
460
|
[oe, g.value]
|
|
453
461
|
]),
|
|
454
|
-
r[7] || (r[7] =
|
|
462
|
+
r[7] || (r[7] = c("div", { class: "acpPresetName" }, "自定义", -1))
|
|
455
463
|
]),
|
|
456
|
-
r[8] || (r[8] =
|
|
457
|
-
(
|
|
458
|
-
for: `acpColorPreset${
|
|
459
|
-
onClick: (
|
|
460
|
-
key:
|
|
464
|
+
r[8] || (r[8] = c("div", { class: "acpSep" }, null, -1)),
|
|
465
|
+
(R(!0), N(Ce, null, Se(i.presets, (p) => (R(), N("label", {
|
|
466
|
+
for: `acpColorPreset${p.name}`,
|
|
467
|
+
onClick: (D) => P(p),
|
|
468
|
+
key: p.name
|
|
461
469
|
}, [
|
|
462
|
-
|
|
470
|
+
c("div", {
|
|
463
471
|
class: "acpPresetBody",
|
|
464
|
-
style:
|
|
472
|
+
style: j({ backgroundColor: p.colorHex })
|
|
465
473
|
}, null, 4),
|
|
466
|
-
Q(
|
|
474
|
+
Q(c("input", {
|
|
467
475
|
name: "colorType",
|
|
468
476
|
type: "radio",
|
|
469
|
-
id: `acpColorPreset${
|
|
470
|
-
value:
|
|
471
|
-
"onUpdate:modelValue": r[4] || (r[4] = (
|
|
477
|
+
id: `acpColorPreset${p.name}`,
|
|
478
|
+
value: p.name,
|
|
479
|
+
"onUpdate:modelValue": r[4] || (r[4] = (D) => g.value = D)
|
|
472
480
|
}, null, 8, Ke), [
|
|
473
481
|
[oe, g.value]
|
|
474
482
|
]),
|
|
475
|
-
|
|
483
|
+
c("div", Ye, we(p.name), 1)
|
|
476
484
|
], 8, Fe))), 128)),
|
|
477
|
-
r[9] || (r[9] =
|
|
485
|
+
r[9] || (r[9] = c("div", { class: "acpSep" }, null, -1))
|
|
478
486
|
]),
|
|
479
|
-
|
|
480
|
-
|
|
487
|
+
c("div", Ge, [
|
|
488
|
+
c("button", {
|
|
481
489
|
onClick: r[5] || (r[5] = //@ts-ignore
|
|
482
|
-
(...
|
|
490
|
+
(...p) => h($) && h($)(...p))
|
|
483
491
|
}, "OK")
|
|
484
492
|
])
|
|
485
493
|
], 4)) : J("", !0)
|
|
486
494
|
]));
|
|
487
495
|
}
|
|
488
|
-
}), tt = /* @__PURE__ */ ne(Je, [["__scopeId", "data-v-
|
|
496
|
+
}), tt = /* @__PURE__ */ ne(Je, [["__scopeId", "data-v-1e965bbc"]]);
|
|
489
497
|
export {
|
|
490
498
|
je as AuColorPicker,
|
|
491
499
|
tt as AuColorPickerPresetsNested,
|
|
492
|
-
|
|
500
|
+
Te as AuColorPickerRing
|
|
493
501
|
};
|