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