@aurouscia/au-color-picker 1.0.1 → 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 +205 -194
- 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,163 +1,174 @@
|
|
|
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
19
|
let u, d;
|
|
20
|
-
const k = { x: 199, y: 199 }, E = (le + se) / 2, $ = le ** 2, U = se ** 2,
|
|
21
|
-
let
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
u = s, d = a, n = u.getImageData(0, 0, D, _), f(), y(), Y(), u.putImageData(n, 0, 0);
|
|
31
38
|
}
|
|
32
|
-
function
|
|
33
|
-
for (let
|
|
34
|
-
for (let
|
|
35
|
-
const
|
|
36
|
-
if (X(
|
|
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 X(
|
|
46
|
-
const
|
|
47
|
-
return
|
|
52
|
+
function X(n) {
|
|
53
|
+
const o = Ie(k, n);
|
|
54
|
+
return o > U && o < $;
|
|
48
55
|
}
|
|
49
56
|
function y() {
|
|
50
|
-
for (let
|
|
51
|
-
for (let
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
|
|
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
|
|
65
|
-
return !(
|
|
71
|
+
function s(n) {
|
|
72
|
+
return !(n.x < V || n.x > H || n.y < V || n.y > H);
|
|
66
73
|
}
|
|
67
74
|
let M = !1, v = "none", C = I(!1);
|
|
68
|
-
function K(
|
|
69
|
-
if (M ||
|
|
75
|
+
function K(n, o) {
|
|
76
|
+
if (M || o && !C.value)
|
|
70
77
|
return;
|
|
71
78
|
M = !0;
|
|
72
|
-
const
|
|
73
|
-
if (v === "none" && (
|
|
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
|
-
d.reset(), d.lineWidth = 4, d.strokeStyle = "black", d.beginPath(), d.arc(
|
|
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();
|
|
101
110
|
const L = w.value > 50 ? "black" : "#ddd";
|
|
102
|
-
d.strokeStyle = L, d.fillStyle = L, d.beginPath(), d.arc(
|
|
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
120
|
return x({ enforceTo: pe }), ye(() => {
|
|
110
|
-
|
|
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: j({ width: G + "px", height:
|
|
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(
|
|
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
135
|
c("canvas", {
|
|
125
|
-
width:
|
|
136
|
+
width: T,
|
|
126
137
|
height: _,
|
|
127
138
|
ref_key: "cvs",
|
|
128
139
|
ref: t
|
|
129
140
|
}, null, 512),
|
|
130
141
|
c("canvas", {
|
|
131
|
-
width:
|
|
142
|
+
width: T,
|
|
132
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 =
|
|
149
|
+
}), ne = (i, x) => {
|
|
150
|
+
const m = i.__vccOpts || i;
|
|
140
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
160
|
let k = {};
|
|
150
|
-
return m.value || (k.boxShadow = "none"),
|
|
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
166
|
let u = 0;
|
|
156
167
|
function d() {
|
|
157
|
-
if (
|
|
168
|
+
if (i.entryRespondDelay && (window.clearTimeout(u), !m.value)) {
|
|
158
169
|
u = window.setTimeout(() => {
|
|
159
170
|
m.value = !0;
|
|
160
|
-
},
|
|
171
|
+
}, i.entryRespondDelay);
|
|
161
172
|
return;
|
|
162
173
|
}
|
|
163
174
|
m.value = !m.value;
|
|
@@ -167,15 +178,15 @@ function de(l, x) {
|
|
|
167
178
|
function re() {
|
|
168
179
|
window.alert("https://www.npmjs.com/package/@aurouscia/au-color-picker");
|
|
169
180
|
}
|
|
170
|
-
function O(
|
|
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 u =
|
|
189
|
+
const u = i.pos;
|
|
179
190
|
return typeof u == "number" ? t = u + "px" : u == "left" ? g = "0px" : t = "0px", {
|
|
180
191
|
zIndex: (m || 0) + 100,
|
|
181
192
|
left: t,
|
|
@@ -184,7 +195,7 @@ function ve(l) {
|
|
|
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,102 +219,102 @@ 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
|
-
u.value = O(y),
|
|
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"),
|
|
227
|
+
const H = I("hex"), P = F(() => A.hex.rgb(u.value)), S = F(() => A.hex.hsv(u.value));
|
|
217
228
|
function w(y) {
|
|
218
229
|
const e = y.target;
|
|
219
230
|
if ("value" in e) {
|
|
220
|
-
const
|
|
221
|
-
if (
|
|
222
|
-
u.value = O(
|
|
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
236
|
e.value = u.value;
|
|
226
237
|
}
|
|
227
238
|
}
|
|
228
|
-
function
|
|
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
244
|
let v = parseInt(M);
|
|
234
245
|
if (isNaN(v))
|
|
235
|
-
|
|
246
|
+
s.value = "0";
|
|
236
247
|
else {
|
|
237
248
|
v > 255 ? v = 255 : v < 0 && (v = 0);
|
|
238
|
-
const C = [...
|
|
239
|
-
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),
|
|
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
|
|
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
261
|
let v = parseInt(M);
|
|
251
262
|
if (isNaN(v))
|
|
252
|
-
|
|
263
|
+
s.value = "0";
|
|
253
264
|
else {
|
|
254
265
|
e === "h" ? v > 359 && (v = 359) : v > 100 && (v = 100), v < 0 && (v = 0);
|
|
255
266
|
const C = [...S.value];
|
|
256
|
-
e == "h" ? C[0] = v : e == "s" ? C[1] = v : C[2] = v, u.value = O(A.hsv.hex(C)),
|
|
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
|
|
273
|
+
function r() {
|
|
263
274
|
X("update:modelValue", u.value);
|
|
264
275
|
}
|
|
265
|
-
function
|
|
276
|
+
function p() {
|
|
266
277
|
return u.value;
|
|
267
278
|
}
|
|
268
|
-
function
|
|
279
|
+
function D(y) {
|
|
269
280
|
if (ee(y)) {
|
|
270
281
|
const e = O(y);
|
|
271
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
288
|
const X = m;
|
|
278
|
-
return x({ closePanel: k, getCurrentHex:
|
|
279
|
-
y && y !== u.value &&
|
|
289
|
+
return x({ closePanel: k, getCurrentHex: p, enforceTo: D }), W(() => t.modelValue, (y) => {
|
|
290
|
+
y && y !== u.value && D(y);
|
|
280
291
|
}), W(d, (y) => {
|
|
281
292
|
y === !1 && X("done");
|
|
282
|
-
}), (y, e) => (
|
|
293
|
+
}), (y, e) => (R(), N("div", Ne, [
|
|
283
294
|
c("div", {
|
|
284
|
-
class:
|
|
285
|
-
style: j(
|
|
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: j(
|
|
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
|
-
c("div",
|
|
296
|
-
ce(
|
|
306
|
+
c("div", Re, [
|
|
307
|
+
ce(Te, {
|
|
297
308
|
ref_key: "ring",
|
|
298
309
|
ref: g,
|
|
299
310
|
"initial-hex": u.value,
|
|
300
|
-
onChanged:
|
|
301
|
-
"show-package-name":
|
|
311
|
+
onChanged: V,
|
|
312
|
+
"show-package-name": i.showPackageName
|
|
302
313
|
}, null, 8, ["initial-hex", "show-package-name"])
|
|
303
314
|
]),
|
|
304
|
-
c("div",
|
|
315
|
+
c("div", De, [
|
|
305
316
|
Q(c("select", {
|
|
306
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
317
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => H.value = s)
|
|
307
318
|
}, [...e[11] || (e[11] = [
|
|
308
319
|
c("option", { value: "hex" }, "HEX", -1),
|
|
309
320
|
c("option", { value: "rgb" }, "RGB", -1),
|
|
@@ -311,52 +322,52 @@ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams
|
|
|
311
322
|
])], 512), [
|
|
312
323
|
[ke, H.value]
|
|
313
324
|
]),
|
|
314
|
-
H.value == "hex" ? (
|
|
325
|
+
H.value == "hex" ? (R(), N("div", He, [
|
|
315
326
|
c("input", {
|
|
316
327
|
value: u.value,
|
|
317
328
|
onBlur: w,
|
|
318
329
|
spellcheck: "false",
|
|
319
330
|
maxlength: "7"
|
|
320
331
|
}, null, 40, Me)
|
|
321
|
-
])) : H.value == "rgb" ? (
|
|
332
|
+
])) : H.value == "rgb" ? (R(), N("div", Ae, [
|
|
322
333
|
c("input", {
|
|
323
|
-
value:
|
|
324
|
-
onBlur: e[2] || (e[2] = (
|
|
334
|
+
value: P.value[0],
|
|
335
|
+
onBlur: e[2] || (e[2] = (s) => b(s, "r"))
|
|
325
336
|
}, null, 40, Ee),
|
|
326
337
|
c("input", {
|
|
327
|
-
value:
|
|
328
|
-
onBlur: e[3] || (e[3] = (
|
|
338
|
+
value: P.value[1],
|
|
339
|
+
onBlur: e[3] || (e[3] = (s) => b(s, "g"))
|
|
329
340
|
}, null, 40, $e),
|
|
330
341
|
c("input", {
|
|
331
|
-
value:
|
|
332
|
-
onBlur: e[4] || (e[4] = (
|
|
342
|
+
value: P.value[2],
|
|
343
|
+
onBlur: e[4] || (e[4] = (s) => b(s, "b"))
|
|
333
344
|
}, null, 40, qe)
|
|
334
|
-
])) : (
|
|
345
|
+
])) : (R(), N("div", Ue, [
|
|
335
346
|
c("input", {
|
|
336
347
|
value: S.value[0],
|
|
337
|
-
onBlur: e[5] || (e[5] = (
|
|
348
|
+
onBlur: e[5] || (e[5] = (s) => l(s, "h"))
|
|
338
349
|
}, null, 40, Le),
|
|
339
350
|
c("input", {
|
|
340
351
|
value: S.value[1],
|
|
341
|
-
onBlur: e[6] || (e[6] = (
|
|
352
|
+
onBlur: e[6] || (e[6] = (s) => l(s, "s"))
|
|
342
353
|
}, null, 40, _e),
|
|
343
354
|
c("input", {
|
|
344
355
|
value: S.value[2],
|
|
345
|
-
onBlur: e[7] || (e[7] = (
|
|
356
|
+
onBlur: e[7] || (e[7] = (s) => l(s, "v"))
|
|
346
357
|
}, null, 40, ze)
|
|
347
358
|
]))
|
|
348
359
|
]),
|
|
349
360
|
c("div", Oe, [
|
|
350
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,103 +391,103 @@ 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: U, entryStylesActual:
|
|
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
402
|
const S = m;
|
|
392
|
-
W(d, (
|
|
393
|
-
S("update:modelValue",
|
|
403
|
+
W(d, (l) => {
|
|
404
|
+
S("update:modelValue", l);
|
|
394
405
|
});
|
|
395
|
-
function w(
|
|
396
|
-
if (ee(
|
|
397
|
-
const
|
|
398
|
-
d.value =
|
|
406
|
+
function w(l) {
|
|
407
|
+
if (ee(l)) {
|
|
408
|
+
const r = O(l);
|
|
409
|
+
d.value = r, u.value?.enforceTo(r);
|
|
399
410
|
}
|
|
400
411
|
}
|
|
401
|
-
function
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
|
|
412
|
+
function b(l) {
|
|
413
|
+
l || P(void 0);
|
|
414
|
+
const r = t.presets?.find((p) => p.name === l);
|
|
415
|
+
r && P(r);
|
|
405
416
|
}
|
|
406
|
-
return x({ closePanel: $, enforceCustomValueTo: w, enforcePresetTo:
|
|
407
|
-
|
|
408
|
-
}), W(() => t.modelValue, (
|
|
409
|
-
|
|
410
|
-
}), W(() => t.modelValueSelectedPreset, (
|
|
411
|
-
|
|
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);
|
|
412
423
|
}), ue(() => {
|
|
413
|
-
t.modelValue ? w(t.modelValue) : t.initial && w(t.initial), t.modelValueSelectedPreset ?
|
|
414
|
-
}), (
|
|
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, [
|
|
415
426
|
c("div", {
|
|
416
427
|
class: "acpEntry",
|
|
417
|
-
style: j(
|
|
418
|
-
onClick:
|
|
419
|
-
(...
|
|
428
|
+
style: j(h(V)),
|
|
429
|
+
onClick: r[0] || (r[0] = //@ts-ignore
|
|
430
|
+
(...p) => h(U) && h(U)(...p))
|
|
420
431
|
}, null, 4),
|
|
421
|
-
|
|
432
|
+
h(E) ? (R(), N("div", {
|
|
422
433
|
key: 0,
|
|
423
434
|
class: "acpPanel",
|
|
424
|
-
style: j(
|
|
425
|
-
onClick:
|
|
435
|
+
style: j(h(H)),
|
|
436
|
+
onClick: r[6] || (r[6] = (p) => i.panelClickStopPropagation && p.stopPropagation())
|
|
426
437
|
}, [
|
|
427
438
|
c("div", Ze, [
|
|
428
439
|
c("label", {
|
|
429
440
|
for: "acpColorPresetCustom",
|
|
430
|
-
onClick:
|
|
441
|
+
onClick: r[3] || (r[3] = (p) => P(void 0))
|
|
431
442
|
}, [
|
|
432
443
|
ce(je, {
|
|
433
444
|
modelValue: d.value,
|
|
434
|
-
"onUpdate:modelValue":
|
|
435
|
-
onDone:
|
|
445
|
+
"onUpdate:modelValue": r[1] || (r[1] = (p) => d.value = p),
|
|
446
|
+
onDone: h($),
|
|
436
447
|
"entry-class-name": "acpPresetBody",
|
|
437
448
|
ref_key: "customPicker",
|
|
438
449
|
ref: u,
|
|
439
|
-
"show-package-name":
|
|
440
|
-
pos:
|
|
450
|
+
"show-package-name": i.showPackageName,
|
|
451
|
+
pos: i.posInternal
|
|
441
452
|
}, null, 8, ["modelValue", "onDone", "show-package-name", "pos"]),
|
|
442
453
|
Q(c("input", {
|
|
443
454
|
name: "colorType",
|
|
444
455
|
type: "radio",
|
|
445
456
|
id: "acpColorPresetCustom",
|
|
446
457
|
value: void 0,
|
|
447
|
-
"onUpdate:modelValue":
|
|
458
|
+
"onUpdate:modelValue": r[2] || (r[2] = (p) => g.value = p)
|
|
448
459
|
}, null, 512), [
|
|
449
460
|
[oe, g.value]
|
|
450
461
|
]),
|
|
451
|
-
|
|
462
|
+
r[7] || (r[7] = c("div", { class: "acpPresetName" }, "自定义", -1))
|
|
452
463
|
]),
|
|
453
|
-
|
|
454
|
-
(
|
|
455
|
-
for: `acpColorPreset${
|
|
456
|
-
onClick: (
|
|
457
|
-
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
|
|
458
469
|
}, [
|
|
459
470
|
c("div", {
|
|
460
471
|
class: "acpPresetBody",
|
|
461
|
-
style: j({ backgroundColor:
|
|
472
|
+
style: j({ backgroundColor: p.colorHex })
|
|
462
473
|
}, null, 4),
|
|
463
474
|
Q(c("input", {
|
|
464
475
|
name: "colorType",
|
|
465
476
|
type: "radio",
|
|
466
|
-
id: `acpColorPreset${
|
|
467
|
-
value:
|
|
468
|
-
"onUpdate:modelValue":
|
|
477
|
+
id: `acpColorPreset${p.name}`,
|
|
478
|
+
value: p.name,
|
|
479
|
+
"onUpdate:modelValue": r[4] || (r[4] = (D) => g.value = D)
|
|
469
480
|
}, null, 8, Ke), [
|
|
470
481
|
[oe, g.value]
|
|
471
482
|
]),
|
|
472
|
-
c("div", Ye, we(
|
|
483
|
+
c("div", Ye, we(p.name), 1)
|
|
473
484
|
], 8, Fe))), 128)),
|
|
474
|
-
|
|
485
|
+
r[9] || (r[9] = c("div", { class: "acpSep" }, null, -1))
|
|
475
486
|
]),
|
|
476
487
|
c("div", Ge, [
|
|
477
488
|
c("button", {
|
|
478
|
-
onClick:
|
|
479
|
-
(...
|
|
489
|
+
onClick: r[5] || (r[5] = //@ts-ignore
|
|
490
|
+
(...p) => h($) && h($)(...p))
|
|
480
491
|
}, "OK")
|
|
481
492
|
])
|
|
482
493
|
], 4)) : J("", !0)
|
|
@@ -486,5 +497,5 @@ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams
|
|
|
486
497
|
export {
|
|
487
498
|
je as AuColorPicker,
|
|
488
499
|
tt as AuColorPickerPresetsNested,
|
|
489
|
-
|
|
500
|
+
Te as AuColorPickerRing
|
|
490
501
|
};
|