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