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