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