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