@mcistudio/unoui-vue 1.1.1 → 1.2.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/button/index.js +1 -1
- package/dist/checkbox/index.js +1 -1
- package/dist/chunks/{ImageEditor-DOGIATeD.js → ImageEditor-DRoD50TJ.js} +2 -2
- package/dist/chunks/{ImageEditor-DOGIATeD.js.map → ImageEditor-DRoD50TJ.js.map} +1 -1
- package/dist/chunks/{Table-SDKDGSur.js → Table-QvmJFoxl.js} +3 -3
- package/dist/chunks/{Table-SDKDGSur.js.map → Table-QvmJFoxl.js.map} +1 -1
- package/dist/chunks/{button-BDScl2qA.js → button-BBFPr3FH.js} +33 -32
- package/dist/chunks/button-BBFPr3FH.js.map +1 -0
- package/dist/chunks/{checkbox-9_0oR4kg.js → checkbox-wJpQHCeN.js} +2 -2
- package/dist/chunks/{checkbox-9_0oR4kg.js.map → checkbox-wJpQHCeN.js.map} +1 -1
- package/dist/chunks/{colorpicker-CcizUCQv.js → colorpicker-B-kSQ2Gh.js} +154 -158
- package/dist/chunks/colorpicker-B-kSQ2Gh.js.map +1 -0
- package/dist/chunks/control-BIl2ynWn.js +10 -0
- package/dist/chunks/control-BIl2ynWn.js.map +1 -0
- package/dist/chunks/datepicker-XNgIvgTe.js +1411 -0
- package/dist/chunks/datepicker-XNgIvgTe.js.map +1 -0
- package/dist/chunks/{dropdown-0l967g7D.js → dropdown-B4XuqfaI.js} +4 -4
- package/dist/chunks/dropdown-B4XuqfaI.js.map +1 -0
- package/dist/chunks/{form-Qeqkd-HH.js → form-CVJ4YMWA.js} +7 -7
- package/dist/chunks/{form-Qeqkd-HH.js.map → form-CVJ4YMWA.js.map} +1 -1
- package/dist/chunks/input-hIYHtcTj.js +1272 -0
- package/dist/chunks/input-hIYHtcTj.js.map +1 -0
- package/dist/chunks/{pagination-cndgtghb.js → pagination-xntyuczw.js} +38 -56
- package/dist/chunks/pagination-xntyuczw.js.map +1 -0
- package/dist/chunks/{popconfirm-Bp2mluJ5.js → popconfirm-DWmeebIf.js} +2 -2
- package/dist/chunks/{popconfirm-Bp2mluJ5.js.map → popconfirm-DWmeebIf.js.map} +1 -1
- package/dist/chunks/{radio-DnYm59xH.js → radio-DGt8o-UL.js} +12 -12
- package/dist/chunks/{radio-DnYm59xH.js.map → radio-DGt8o-UL.js.map} +1 -1
- package/dist/chunks/select-eZ9h_f58.js +462 -0
- package/dist/chunks/select-eZ9h_f58.js.map +1 -0
- package/dist/chunks/{switch-BULGbODP.js → switch-C6a6ga2G.js} +2 -2
- package/dist/chunks/{switch-BULGbODP.js.map → switch-C6a6ga2G.js.map} +1 -1
- package/dist/chunks/{timepicker-DFxwJePF.js → timepicker-BU9TRvFI.js} +326 -329
- package/dist/chunks/{timepicker-DFxwJePF.js.map → timepicker-BU9TRvFI.js.map} +1 -1
- package/dist/colorpicker/index.d.ts +4 -0
- package/dist/colorpicker/index.js +2 -2
- package/dist/control.d.ts +6 -0
- package/dist/datepicker/index.js +1 -1
- package/dist/dropdown/index.js +1 -1
- package/dist/form/index.js +1 -1
- package/dist/imageeditor/index.js +1 -1
- package/dist/index.js +31 -31
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.js +2 -2
- package/dist/modal/Modal.vue.d.ts +1 -1
- package/dist/pagination/index.js +1 -1
- package/dist/popconfirm/index.js +1 -1
- package/dist/radio/index.js +1 -1
- package/dist/select/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/timepicker/index.js +1 -1
- package/dist/uno.js +1 -0
- package/dist/uno.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/button-BDScl2qA.js.map +0 -1
- package/dist/chunks/colorpicker-CcizUCQv.js.map +0 -1
- package/dist/chunks/datepicker-wXIjngpq.js +0 -1414
- package/dist/chunks/datepicker-wXIjngpq.js.map +0 -1
- package/dist/chunks/dropdown-0l967g7D.js.map +0 -1
- package/dist/chunks/input-DhZ8Wu1m.js +0 -1281
- package/dist/chunks/input-DhZ8Wu1m.js.map +0 -1
- package/dist/chunks/pagination-cndgtghb.js.map +0 -1
- package/dist/chunks/select-ChTfQM5u.js +0 -417
- package/dist/chunks/select-ChTfQM5u.js.map +0 -1
|
@@ -5,28 +5,28 @@ import { cva as ae } from "class-variance-authority";
|
|
|
5
5
|
import { Fragment as oe, Teleport as se, computed as u, createBlock as ce, createCommentVNode as d, createElementBlock as f, createElementVNode as p, defineComponent as m, mergeProps as le, nextTick as ue, normalizeClass as h, normalizeStyle as g, onMounted as de, onUnmounted as fe, openBlock as _, reactive as pe, ref as v, renderList as me, toDisplayString as he, unref as y, useAttrs as ge, useTemplateRef as b, watch as x, withModifiers as S } from "vue";
|
|
6
6
|
import { clsx as _e } from "clsx";
|
|
7
7
|
//#region src/colorpicker/ColorPicker.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var ve = ["disabled", "aria-expanded"], ye = {
|
|
8
|
+
var ve = ["disabled", "aria-expanded"], ye = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "flex h-10 items-center gap-1 border-b border-medium px-3"
|
|
11
|
-
},
|
|
11
|
+
}, be = [
|
|
12
12
|
"title",
|
|
13
13
|
"aria-label",
|
|
14
14
|
"onClick"
|
|
15
|
-
],
|
|
15
|
+
], xe = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "border-b border-medium py-2"
|
|
18
|
-
},
|
|
18
|
+
}, Se = {
|
|
19
19
|
"data-ui-colorpicker-gradient-row": "true",
|
|
20
20
|
class: "flex items-center mx-3"
|
|
21
|
-
},
|
|
21
|
+
}, Ce = [
|
|
22
22
|
"aria-label",
|
|
23
23
|
"onPointerdown",
|
|
24
24
|
"onKeydown"
|
|
25
|
-
],
|
|
25
|
+
], we = {
|
|
26
26
|
key: 0,
|
|
27
27
|
"data-ui-colorpicker-degree-group": "true",
|
|
28
28
|
class: "flex shrink-0 items-center"
|
|
29
|
-
},
|
|
29
|
+
}, Te = { class: "min-w-9 text-right font-mono text-xs text-tertiary" }, Ee = { class: "grid gap-3 p-3" }, De = { class: "flex items-center gap-3" }, Oe = ["disabled"], ke = { class: "grid min-w-0 flex-1 gap-2" }, Ae = { class: "ui-colorpicker-checker size-8 shrink-0 overflow-hidden rounded-full border border-medium" }, je = ["value", "aria-invalid"], Me = { class: "rounded border border-medium bg-secondary px-2 py-1 text-right font-mono text-tertiary" }, Ne = 260, Pe = 4, C = 8, Fe = 10, Ie = 200, Le = 24, Re = /*#__PURE__*/ e(/* @__PURE__ */ m({
|
|
30
30
|
inheritAttrs: !1,
|
|
31
31
|
__name: "ColorPicker",
|
|
32
32
|
props: {
|
|
@@ -47,7 +47,7 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
47
47
|
},
|
|
48
48
|
emits: ["update:modelValue", "changed"],
|
|
49
49
|
setup(e, { emit: ae }) {
|
|
50
|
-
let m = e,
|
|
50
|
+
let m = e, Re = ae, Ve = ge(), w = b("rootRef"), T = b("panelRef"), He = b("paletteRef"), Ue = b("hueBarRef"), We = b("opacityBarRef"), Ge = b("gradientBarRef"), Ke = b("degreeRef"), E = v(!1), D = v("solid"), O = v(90), k = v(null), A = v(null), j = v(null), M = v(!1), N = v(!1), P = v(!1), F = v(""), I = v(!1), qe = v(!1), L = v([]), R = pe({
|
|
51
51
|
h: 0,
|
|
52
52
|
s: 0,
|
|
53
53
|
b: 0,
|
|
@@ -68,63 +68,53 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
68
68
|
mode: "radial",
|
|
69
69
|
label: "径向渐变"
|
|
70
70
|
}
|
|
71
|
-
], et = {
|
|
72
|
-
sm: "1.75rem",
|
|
73
|
-
md: "2rem",
|
|
74
|
-
lg: "2.25rem"
|
|
75
|
-
}, tt = (e, t) => e === void 0 ? t : e === "false" ? !1 : e === "true" || e === "" ? !0 : e, H = u(() => c(R)), nt = u(() => {
|
|
71
|
+
], et = (e, t) => e === void 0 ? t : e === "false" ? !1 : e === "true" || e === "" ? !0 : e, H = u(() => c(R)), tt = u(() => {
|
|
76
72
|
if (D.value === "solid") return H.value;
|
|
77
73
|
let e = L.value.find((e) => e.id === k.value) ?? L.value[0];
|
|
78
74
|
return e ? c(e.color) : H.value;
|
|
79
|
-
}),
|
|
75
|
+
}), nt = u(() => ie(X(tt.value))), U = u(() => et(m.allowGradient, !0)), W = u(() => et(m.allowAlpha, !0)), rt = u(() => l(c({
|
|
80
76
|
h: R.h,
|
|
81
77
|
s: 100,
|
|
82
78
|
b: 100,
|
|
83
79
|
a: 1
|
|
84
|
-
}))),
|
|
80
|
+
}))), it = u(() => bt().map((e) => `${ee(e.color)} ${e.percent}%`).join(",")), at = u(() => D.value === "linear" ? `linear-gradient(${O.value}deg,${it.value})` : D.value === "radial" ? `radial-gradient(circle,${it.value})` : l(H.value)), ot = u(() => `linear-gradient(to right,${it.value || `${l(H.value)} 0%,${l(H.value)} 100%`})`), st = u(() => {
|
|
85
81
|
let e = ne({
|
|
86
82
|
...H.value,
|
|
87
83
|
a: 1
|
|
88
84
|
});
|
|
89
85
|
return `linear-gradient(to right, rgba(${e.r},${e.g},${e.b},0), rgba(${e.r},${e.g},${e.b},1))`;
|
|
90
|
-
}),
|
|
86
|
+
}), ct = u(() => D.value === "solid" ? l(H.value) : at.value), lt = u(() => _e(Ve.class, ze({
|
|
91
87
|
size: m.size,
|
|
92
88
|
focused: E.value,
|
|
93
89
|
disabled: m.disabled
|
|
94
|
-
}))), dt = u(() => {
|
|
95
|
-
let e = et[m.size ?? "md"] ?? et.md;
|
|
96
|
-
return {
|
|
97
|
-
width: e,
|
|
98
|
-
height: e
|
|
99
|
-
};
|
|
100
|
-
}), ft = u(() => m.disabled || !Je.value), pt = u(() => ({
|
|
90
|
+
}))), ut = u(() => Be({ size: m.size })), dt = u(() => m.disabled || !Je.value), ft = u(() => ({
|
|
101
91
|
position: "fixed",
|
|
102
92
|
top: `${z.top}px`,
|
|
103
93
|
left: `${z.left}px`,
|
|
104
|
-
width: `${
|
|
94
|
+
width: `${Ne}px`,
|
|
105
95
|
maxHeight: `calc(100vh - ${C * 2}px)`,
|
|
106
96
|
overflowY: "auto",
|
|
107
97
|
zIndex: 2e3
|
|
108
|
-
})),
|
|
109
|
-
background:
|
|
98
|
+
})), pt = u(() => ({
|
|
99
|
+
background: rt.value,
|
|
110
100
|
height: "9rem"
|
|
111
|
-
})),
|
|
101
|
+
})), mt = u(() => ({ gridTemplateColumns: "minmax(0, 1fr) 56px" })), ht = u(() => ({
|
|
112
102
|
left: `${R.s}%`,
|
|
113
103
|
top: `${100 - R.b}%`,
|
|
114
104
|
backgroundColor: l(H.value)
|
|
115
|
-
})),
|
|
105
|
+
})), gt = u(() => ({ left: `${R.h / 360 * 100}%` })), _t = u(() => ({ left: `${R.a * 100}%` })), vt = u(() => ({ transform: `translateY(-50%) rotate(${O.value - 90}deg)` }));
|
|
116
106
|
x(() => m.modelValue, (e) => {
|
|
117
|
-
if (e && (e === Ze ||
|
|
107
|
+
if (e && (e === Ze || Dt(e) === Qe)) {
|
|
118
108
|
Ze = null, Qe = "";
|
|
119
109
|
return;
|
|
120
110
|
}
|
|
121
|
-
|
|
111
|
+
Tt(e);
|
|
122
112
|
}, {
|
|
123
113
|
deep: !0,
|
|
124
114
|
immediate: !0
|
|
125
115
|
}), x(E, (e) => {
|
|
126
|
-
e &&
|
|
127
|
-
}), x(
|
|
116
|
+
e && Ft();
|
|
117
|
+
}), x(nt, (e) => {
|
|
128
118
|
qe.value || (F.value = e, I.value = !1);
|
|
129
119
|
}, { immediate: !0 }), x(U, (e) => {
|
|
130
120
|
!e && D.value !== "solid" && (D.value = "solid", J());
|
|
@@ -135,10 +125,10 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
135
125
|
e.color.a !== 1 && (e.color.a = 1, t = !0);
|
|
136
126
|
}), t && J();
|
|
137
127
|
});
|
|
138
|
-
function
|
|
128
|
+
function yt(e) {
|
|
139
129
|
return e === "solid" || e === "linear" || e === "radial";
|
|
140
130
|
}
|
|
141
|
-
function
|
|
131
|
+
function bt() {
|
|
142
132
|
return [...L.value].sort((e, t) => e.percent - t.percent);
|
|
143
133
|
}
|
|
144
134
|
function G(e) {
|
|
@@ -152,35 +142,35 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
152
142
|
color: Y(t)
|
|
153
143
|
};
|
|
154
144
|
}
|
|
155
|
-
function
|
|
145
|
+
function xt(e = R) {
|
|
156
146
|
return [K(0, e), K(100, e)];
|
|
157
147
|
}
|
|
158
|
-
function
|
|
159
|
-
if (!e?.gradients?.length) return
|
|
160
|
-
let t = e.gradients.filter((e) => e && typeof e == "object").slice(0,
|
|
161
|
-
return t.length >= 2 ? t : t.length === 1 ? [t[0], K(100, t[0].color)] :
|
|
148
|
+
function St(e) {
|
|
149
|
+
if (!e?.gradients?.length) return xt();
|
|
150
|
+
let t = e.gradients.filter((e) => e && typeof e == "object").slice(0, Fe).map((e) => K(e.percent, s(e.color)));
|
|
151
|
+
return t.length >= 2 ? t : t.length === 1 ? [t[0], K(100, t[0].color)] : xt();
|
|
162
152
|
}
|
|
163
|
-
function
|
|
164
|
-
L.value.length >= 2 || (L.value =
|
|
153
|
+
function Ct() {
|
|
154
|
+
L.value.length >= 2 || (L.value = xt(), k.value = L.value[0]?.id ?? null);
|
|
165
155
|
}
|
|
166
|
-
function
|
|
156
|
+
function wt() {
|
|
167
157
|
if (D.value === "solid") return;
|
|
168
|
-
|
|
158
|
+
Ct();
|
|
169
159
|
let e = L.value.find((e) => e.id === k.value) ?? L.value[0];
|
|
170
160
|
e && (k.value = e.id, G(e.color));
|
|
171
161
|
}
|
|
172
162
|
function q() {
|
|
173
163
|
if (D.value === "solid") return;
|
|
174
|
-
|
|
164
|
+
Ct();
|
|
175
165
|
let e = L.value.find((e) => e.id === k.value);
|
|
176
166
|
e && (e.color = Y(R));
|
|
177
167
|
}
|
|
178
|
-
function
|
|
168
|
+
function Tt(e) {
|
|
179
169
|
Xe = !0;
|
|
180
|
-
let t = U.value &&
|
|
181
|
-
D.value = t, O.value = te(e?.degree), G(s(n)), L.value =
|
|
170
|
+
let t = U.value && yt(e?.mode) ? e.mode : "solid", n = e?.color ?? e?.gradients?.[0]?.color;
|
|
171
|
+
D.value = t, O.value = te(e?.degree), G(s(n)), L.value = St(e), k.value = L.value[0]?.id ?? null, t !== "solid" && wt(), Xe = !1;
|
|
182
172
|
}
|
|
183
|
-
function
|
|
173
|
+
function Et() {
|
|
184
174
|
if (D.value === "solid") {
|
|
185
175
|
let e = X(H.value);
|
|
186
176
|
return {
|
|
@@ -190,7 +180,7 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
190
180
|
css: `background-color:${l(e)}`
|
|
191
181
|
};
|
|
192
182
|
}
|
|
193
|
-
let e =
|
|
183
|
+
let e = bt().map((e) => ({
|
|
194
184
|
percent: e.percent,
|
|
195
185
|
color: X(c(e.color))
|
|
196
186
|
})), t = e.map((e) => `${l(e.color)} ${e.percent}%`).join(",");
|
|
@@ -207,10 +197,10 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
207
197
|
}
|
|
208
198
|
function J() {
|
|
209
199
|
if (Xe) return;
|
|
210
|
-
let e =
|
|
211
|
-
Ze = e, Qe =
|
|
200
|
+
let e = Et();
|
|
201
|
+
Ze = e, Qe = Dt(e), Re("update:modelValue", e), Re("changed", e);
|
|
212
202
|
}
|
|
213
|
-
function
|
|
203
|
+
function Dt(e) {
|
|
214
204
|
return JSON.stringify(e);
|
|
215
205
|
}
|
|
216
206
|
function Y(e) {
|
|
@@ -224,93 +214,93 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
224
214
|
function Z() {
|
|
225
215
|
V !== null && (window.clearTimeout(V), V = null);
|
|
226
216
|
}
|
|
227
|
-
function
|
|
217
|
+
function Ot(e = {}) {
|
|
228
218
|
let t = re(F.value);
|
|
229
219
|
if (!t) return I.value = !0, null;
|
|
230
220
|
let n = X(t), r = ie(n), i = Y(s(n));
|
|
231
221
|
if (I.value = !1, e.formatInput && (F.value = r), G(i), D.value !== "solid") {
|
|
232
|
-
|
|
222
|
+
Ct();
|
|
233
223
|
let e = L.value.find((e) => e.id === k.value) ?? L.value[0];
|
|
234
224
|
e && (k.value = e.id, e.color = i);
|
|
235
225
|
}
|
|
236
226
|
return J(), r;
|
|
237
227
|
}
|
|
238
|
-
function
|
|
239
|
-
Z(), F.value =
|
|
228
|
+
function kt() {
|
|
229
|
+
Z(), F.value = nt.value, I.value = !1;
|
|
240
230
|
}
|
|
241
|
-
function
|
|
231
|
+
function At() {
|
|
242
232
|
Z(), V = window.setTimeout(() => {
|
|
243
|
-
V = null,
|
|
244
|
-
},
|
|
233
|
+
V = null, Ot();
|
|
234
|
+
}, Ie);
|
|
245
235
|
}
|
|
246
|
-
function
|
|
236
|
+
function jt(e) {
|
|
247
237
|
let t = e.target.value;
|
|
248
238
|
F.value = t;
|
|
249
239
|
let n = re(t);
|
|
250
|
-
I.value = t.trim() !== "" && !n, n ?
|
|
240
|
+
I.value = t.trim() !== "" && !n, n ? At() : Z();
|
|
251
241
|
}
|
|
252
|
-
function
|
|
242
|
+
function Mt(e) {
|
|
253
243
|
if (e.key === "Enter") {
|
|
254
244
|
e.preventDefault(), Z();
|
|
255
|
-
let t =
|
|
245
|
+
let t = Ot({ formatInput: !0 });
|
|
256
246
|
t && e.target instanceof HTMLInputElement && (e.target.value = t);
|
|
257
247
|
return;
|
|
258
248
|
}
|
|
259
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
249
|
+
e.key === "Escape" && (e.preventDefault(), kt());
|
|
260
250
|
}
|
|
261
|
-
function
|
|
251
|
+
function Nt() {
|
|
262
252
|
qe.value = !0;
|
|
263
253
|
}
|
|
264
|
-
function
|
|
254
|
+
function Pt(e) {
|
|
265
255
|
qe.value = !1, Z();
|
|
266
|
-
let t =
|
|
256
|
+
let t = Ot({ formatInput: !0 });
|
|
267
257
|
t && e.target instanceof HTMLInputElement && (e.target.value = t);
|
|
268
258
|
}
|
|
269
|
-
function
|
|
259
|
+
function Ft() {
|
|
270
260
|
return ue(() => {
|
|
271
261
|
let e = w.value;
|
|
272
262
|
if (!e) return;
|
|
273
|
-
let t = e.getBoundingClientRect(), n = T.value?.offsetHeight || 360, r = window.innerWidth, i = window.innerHeight, a = r -
|
|
263
|
+
let t = e.getBoundingClientRect(), n = T.value?.offsetHeight || 360, r = window.innerWidth, i = window.innerHeight, a = r - Ne - C, o = t.bottom + Pe, s = t.top - n - Pe;
|
|
274
264
|
z.left = Math.max(C, Math.min(t.left, a)), z.top = o + n <= i - C ? o : Math.max(C, s);
|
|
275
265
|
});
|
|
276
266
|
}
|
|
277
|
-
function
|
|
267
|
+
function It(e) {
|
|
278
268
|
m.disabled || (E.value = e);
|
|
279
269
|
}
|
|
280
|
-
function
|
|
281
|
-
|
|
270
|
+
function Lt() {
|
|
271
|
+
It(!E.value);
|
|
282
272
|
}
|
|
283
|
-
function
|
|
284
|
-
m.disabled || e !== "solid" && !U.value || (D.value = e, D.value !== "solid" &&
|
|
273
|
+
function Rt(e) {
|
|
274
|
+
m.disabled || e !== "solid" && !U.value || (D.value = e, D.value !== "solid" && wt(), J());
|
|
285
275
|
}
|
|
286
|
-
function
|
|
276
|
+
function zt(e) {
|
|
287
277
|
let t = He.value?.getBoundingClientRect();
|
|
288
278
|
t && (R.s = a(Q(e.clientX, t.left, t.width) * 100), R.b = a((1 - Q(e.clientY, t.top, t.height)) * 100), q(), J());
|
|
289
279
|
}
|
|
290
|
-
function
|
|
280
|
+
function Bt(e) {
|
|
291
281
|
let t = Ue.value?.getBoundingClientRect();
|
|
292
282
|
t && (R.h = Math.round(Q(e.clientX, t.left, t.width) * 360), q(), J());
|
|
293
283
|
}
|
|
294
|
-
function
|
|
284
|
+
function Vt(e) {
|
|
295
285
|
if (!W.value) return;
|
|
296
286
|
let t = We.value?.getBoundingClientRect();
|
|
297
287
|
t && (R.a = r(Q(e.clientX, t.left, t.width)), q(), J());
|
|
298
288
|
}
|
|
299
|
-
function
|
|
289
|
+
function Ht(e) {
|
|
300
290
|
let t = Ke.value?.getBoundingClientRect();
|
|
301
291
|
if (!t) return;
|
|
302
292
|
let n = t.left + t.width / 2, r = t.top + t.height / 2, a = Math.atan2(r - e.clientY, e.clientX - n);
|
|
303
293
|
O.value = i(90 - Math.floor(a * 180 / Math.PI)), J();
|
|
304
294
|
}
|
|
305
|
-
function
|
|
295
|
+
function Ut(e) {
|
|
306
296
|
return L.value.length > 2 && L.value.some((t) => t.id === e);
|
|
307
297
|
}
|
|
308
|
-
function
|
|
309
|
-
return e.clientY < t.top -
|
|
298
|
+
function Wt(e, t) {
|
|
299
|
+
return e.clientY < t.top - Le || e.clientY > t.bottom + Le;
|
|
310
300
|
}
|
|
311
|
-
function
|
|
301
|
+
function Gt(e, t) {
|
|
312
302
|
let n = Ge.value?.getBoundingClientRect(), r = L.value.find((e) => e.id === t);
|
|
313
|
-
!n || !r || (r.percent = a(Q(e.clientX, n.left, n.width) * 100), j.value =
|
|
303
|
+
!n || !r || (r.percent = a(Q(e.clientX, n.left, n.width) * 100), j.value = Ut(t) && Wt(e, n) ? t : null, J());
|
|
314
304
|
}
|
|
315
305
|
function Q(e, t, n) {
|
|
316
306
|
return !Number.isFinite(n) || n <= 0 ? 0 : Math.min(1, Math.max(0, (e - t) / n));
|
|
@@ -329,54 +319,54 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
329
319
|
};
|
|
330
320
|
document.addEventListener("pointermove", i), document.addEventListener("pointerup", o), document.addEventListener("pointercancel", s), B = s;
|
|
331
321
|
}
|
|
332
|
-
function
|
|
333
|
-
$(e,
|
|
322
|
+
function Kt(e) {
|
|
323
|
+
$(e, zt);
|
|
334
324
|
}
|
|
335
|
-
function
|
|
336
|
-
M.value = !0, $(e,
|
|
325
|
+
function qt(e) {
|
|
326
|
+
M.value = !0, $(e, Bt, () => {
|
|
337
327
|
M.value = !1;
|
|
338
328
|
}, () => {
|
|
339
329
|
M.value = !1;
|
|
340
330
|
});
|
|
341
331
|
}
|
|
342
|
-
function
|
|
343
|
-
N.value = !0, $(e,
|
|
332
|
+
function Jt(e) {
|
|
333
|
+
N.value = !0, $(e, Vt, () => {
|
|
344
334
|
N.value = !1;
|
|
345
335
|
}, () => {
|
|
346
336
|
N.value = !1;
|
|
347
337
|
});
|
|
348
338
|
}
|
|
349
|
-
function
|
|
350
|
-
P.value = !0, $(e,
|
|
339
|
+
function Yt(e) {
|
|
340
|
+
P.value = !0, $(e, Ht, () => {
|
|
351
341
|
P.value = !1;
|
|
352
342
|
}, () => {
|
|
353
343
|
P.value = !1;
|
|
354
344
|
});
|
|
355
345
|
}
|
|
356
|
-
function
|
|
357
|
-
if (!U.value || D.value === "solid" || L.value.length >=
|
|
346
|
+
function Xt(e) {
|
|
347
|
+
if (!U.value || D.value === "solid" || L.value.length >= Fe) return;
|
|
358
348
|
let t = Ge.value?.getBoundingClientRect();
|
|
359
349
|
if (!t) return;
|
|
360
350
|
let n = K(Q(e.clientX, t.left, t.width) * 100, R);
|
|
361
351
|
L.value.push(n), k.value = n.id, J();
|
|
362
352
|
}
|
|
363
|
-
function
|
|
364
|
-
m.disabled ||
|
|
353
|
+
function Zt(e) {
|
|
354
|
+
m.disabled || Xt(e);
|
|
365
355
|
}
|
|
366
|
-
function
|
|
356
|
+
function Qt(e, t) {
|
|
367
357
|
if (m.disabled) return;
|
|
368
358
|
let n = L.value.find((e) => e.id === t);
|
|
369
|
-
n && (k.value = n.id, A.value = n.id, G(n.color), $(e, (e) =>
|
|
370
|
-
j.value === t &&
|
|
359
|
+
n && (k.value = n.id, A.value = n.id, G(n.color), $(e, (e) => Gt(e, t), () => {
|
|
360
|
+
j.value === t && en(t), A.value = null, j.value = null;
|
|
371
361
|
}, () => {
|
|
372
362
|
A.value = null, j.value = null;
|
|
373
363
|
}));
|
|
374
364
|
}
|
|
375
|
-
function
|
|
365
|
+
function $t(e, t) {
|
|
376
366
|
let n = L.value.find((e) => e.id === t);
|
|
377
367
|
!n || m.disabled || (e.key === "ArrowLeft" || e.key === "ArrowRight") && (e.preventDefault(), k.value = n.id, n.percent = a(n.percent + (e.key === "ArrowLeft" ? -1 : 1)), J());
|
|
378
368
|
}
|
|
379
|
-
function
|
|
369
|
+
function en(e = k.value) {
|
|
380
370
|
if (e === null || L.value.length <= 2) return;
|
|
381
371
|
j.value === e && (j.value = null);
|
|
382
372
|
let t = L.value.findIndex((t) => t.id === e);
|
|
@@ -385,31 +375,31 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
385
375
|
let n = L.value[Math.min(t, L.value.length - 1)];
|
|
386
376
|
k.value = n?.id ?? null, n && G(n.color), J();
|
|
387
377
|
}
|
|
388
|
-
async function
|
|
378
|
+
async function tn() {
|
|
389
379
|
if (m.disabled || typeof window > "u") return;
|
|
390
380
|
let e = window.EyeDropper;
|
|
391
381
|
if (e) try {
|
|
392
382
|
G(s((await new e().open()).sRGBHex)), q(), J();
|
|
393
383
|
} catch {}
|
|
394
384
|
}
|
|
395
|
-
function
|
|
396
|
-
e.key === "Enter" || e.key === " " ? (e.preventDefault(),
|
|
385
|
+
function nn(e) {
|
|
386
|
+
e.key === "Enter" || e.key === " " ? (e.preventDefault(), Lt()) : e.key === "Escape" && (E.value = !1);
|
|
397
387
|
}
|
|
398
|
-
function
|
|
388
|
+
function rn(e) {
|
|
399
389
|
if (!E.value) return;
|
|
400
390
|
let t = e.target, n = w.value && !w.value.contains(t), r = T.value && !T.value.contains(t);
|
|
401
391
|
n && r && (E.value = !1);
|
|
402
392
|
}
|
|
403
|
-
function
|
|
393
|
+
function an(e) {
|
|
404
394
|
E.value && e.key === "Escape" && (E.value = !1);
|
|
405
395
|
}
|
|
406
|
-
function
|
|
407
|
-
E.value &&
|
|
396
|
+
function on() {
|
|
397
|
+
E.value && Ft();
|
|
408
398
|
}
|
|
409
399
|
return de(() => {
|
|
410
|
-
Je.value = typeof window < "u" && "EyeDropper" in window, document.addEventListener("pointerdown",
|
|
400
|
+
Je.value = typeof window < "u" && "EyeDropper" in window, document.addEventListener("pointerdown", rn, !0), document.addEventListener("keydown", an), document.addEventListener("scroll", on, !0), window.addEventListener("resize", on);
|
|
411
401
|
}), fe(() => {
|
|
412
|
-
B?.(), Z(), document.removeEventListener("pointerdown",
|
|
402
|
+
B?.(), Z(), document.removeEventListener("pointerdown", rn, !0), document.removeEventListener("keydown", an), document.removeEventListener("scroll", on, !0), window.removeEventListener("resize", on);
|
|
413
403
|
}), (r, i) => (_(), f("div", {
|
|
414
404
|
ref_key: "rootRef",
|
|
415
405
|
ref: w,
|
|
@@ -418,50 +408,49 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
418
408
|
}, [p("button", le(y(n)(y(Ve)), {
|
|
419
409
|
"data-ui-colorpicker": "true",
|
|
420
410
|
type: "button",
|
|
421
|
-
class:
|
|
422
|
-
style: dt.value,
|
|
411
|
+
class: lt.value,
|
|
423
412
|
disabled: e.disabled,
|
|
424
413
|
"aria-expanded": E.value,
|
|
425
414
|
"aria-haspopup": "dialog",
|
|
426
415
|
"aria-label": "选择颜色",
|
|
427
|
-
onClick:
|
|
428
|
-
onKeydown:
|
|
429
|
-
}), [p("span",
|
|
416
|
+
onClick: Lt,
|
|
417
|
+
onKeydown: nn
|
|
418
|
+
}), [p("span", { class: h(ut.value) }, [p("span", {
|
|
430
419
|
class: "block h-full w-full rounded-[inherit]",
|
|
431
|
-
style: g({ background:
|
|
432
|
-
}, null, 4)])], 16, ve), (_(), ce(se, { to: "body" }, [E.value ? (_(), f("div", {
|
|
420
|
+
style: g({ background: ct.value })
|
|
421
|
+
}, null, 4)], 2)], 16, ve), (_(), ce(se, { to: "body" }, [E.value ? (_(), f("div", {
|
|
433
422
|
key: 0,
|
|
434
423
|
ref_key: "panelRef",
|
|
435
424
|
ref: T,
|
|
436
425
|
role: "dialog",
|
|
437
426
|
"aria-label": "颜色选择器",
|
|
438
|
-
style: g(
|
|
427
|
+
style: g(ft.value),
|
|
439
428
|
class: "ui-colorpicker-panel rounded-lg border border-medium bg-primary text-primary shadow-xl outline-none",
|
|
440
429
|
onContextmenu: i[0] ||= S(() => {}, ["prevent"]),
|
|
441
430
|
onPointerdown: i[1] ||= S(() => {}, ["stop"]),
|
|
442
431
|
onSelectstart: i[2] ||= S(() => {}, ["prevent"])
|
|
443
432
|
}, [
|
|
444
|
-
U.value ? (_(), f("div",
|
|
433
|
+
U.value ? (_(), f("div", ye, [(_(), f(oe, null, me($e, (e) => p("button", {
|
|
445
434
|
key: e.mode,
|
|
446
435
|
type: "button",
|
|
447
436
|
title: e.label,
|
|
448
437
|
"aria-label": e.label,
|
|
449
438
|
class: "flex size-6 items-center justify-center rounded bg-transparent",
|
|
450
|
-
onClick: (t) =>
|
|
439
|
+
onClick: (t) => Rt(e.mode)
|
|
451
440
|
}, [p("span", { class: h(["size-3.5 rounded-full border transition-[border-color,background,filter]", [
|
|
452
441
|
e.mode === D.value ? "border-[#ff7d3a]" : "border-[#7d7d7d] grayscale",
|
|
453
442
|
e.mode === "solid" ? e.mode === D.value ? "bg-[#ffc9b6]" : "bg-[#e2e2e2]" : "",
|
|
454
443
|
e.mode === "linear" ? e.mode === D.value ? "bg-[linear-gradient(180deg,#ffc9b6,#ff5011)]" : "bg-[linear-gradient(180deg,#ffffff,#999999)]" : "",
|
|
455
444
|
e.mode === "radial" ? e.mode === D.value ? "bg-[radial-gradient(circle,#ffc9b6,#ff5011)]" : "bg-[radial-gradient(circle,#ffffff,#999999)]" : ""
|
|
456
|
-
]]) }, null, 2)], 8,
|
|
457
|
-
U.value && D.value !== "solid" ? (_(), f("div",
|
|
445
|
+
]]) }, null, 2)], 8, be)), 64))])) : d("", !0),
|
|
446
|
+
U.value && D.value !== "solid" ? (_(), f("div", xe, [p("div", Se, [p("div", {
|
|
458
447
|
class: "relative h-4 min-w-0 flex-1 rounded-full border border-medium ui-colorpicker-checker",
|
|
459
|
-
onPointerdown:
|
|
448
|
+
onPointerdown: Zt,
|
|
460
449
|
ref_key: "gradientBarRef",
|
|
461
450
|
ref: Ge
|
|
462
451
|
}, [p("div", {
|
|
463
452
|
class: "absolute inset-0 rounded-full",
|
|
464
|
-
style: g({ background:
|
|
453
|
+
style: g({ background: ot.value })
|
|
465
454
|
}, null, 4), (_(!0), f(oe, null, me(L.value, (e) => (_(), f("button", {
|
|
466
455
|
key: e.id,
|
|
467
456
|
type: "button",
|
|
@@ -475,18 +464,18 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
475
464
|
background: y(ee)(e.color)
|
|
476
465
|
}),
|
|
477
466
|
"aria-label": `渐变节点 ${e.percent}%`,
|
|
478
|
-
onPointerdown: S((t) =>
|
|
479
|
-
onKeydown: (t) =>
|
|
480
|
-
}, null, 46,
|
|
467
|
+
onPointerdown: S((t) => Qt(t, e.id), ["stop"]),
|
|
468
|
+
onKeydown: (t) => $t(t, e.id)
|
|
469
|
+
}, null, 46, Ce))), 128))], 544), D.value === "linear" ? (_(), f("div", we, [p("span", Te, he(O.value) + "°", 1), p("div", {
|
|
481
470
|
ref_key: "degreeRef",
|
|
482
471
|
ref: Ke,
|
|
483
472
|
"data-ui-colorpicker-degree": "true",
|
|
484
473
|
class: "relative size-6 overflow-visible rounded-full border border-strong bg-secondary",
|
|
485
|
-
onPointerdown:
|
|
474
|
+
onPointerdown: Yt
|
|
486
475
|
}, [p("span", {
|
|
487
476
|
"data-ui-colorpicker-degree-pointer": "true",
|
|
488
477
|
class: "pointer-events-none absolute left-1/2 top-1/2 size-0 origin-left",
|
|
489
|
-
style: g(
|
|
478
|
+
style: g(vt.value)
|
|
490
479
|
}, [i[3] ||= p("span", {
|
|
491
480
|
"data-ui-colorpicker-degree-line": "true",
|
|
492
481
|
class: "absolute left-0 top-0 h-0.5 w-2.5 -translate-y-1/2 rounded-full bg-[var(--color-border-strong)]"
|
|
@@ -494,91 +483,91 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
494
483
|
"data-ui-colorpicker-degree-handle": "true",
|
|
495
484
|
class: h(["pointer-events-auto absolute left-2.5 top-0 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-strong bg-primary transition-[background-color,border-color,box-shadow,transform] hover:scale-125 hover:border-brand hover:bg-brand-50 hover:shadow-[0_0_0_2px_rgba(59,130,246,0.18)]", P.value ? "scale-125 border-brand bg-brand-50 shadow-[0_0_0_2px_rgba(59,130,246,0.18)]" : ""])
|
|
496
485
|
}, null, 2)], 4)], 544)])) : d("", !0)])])) : d("", !0),
|
|
497
|
-
p("div",
|
|
486
|
+
p("div", Ee, [
|
|
498
487
|
p("div", {
|
|
499
488
|
ref_key: "paletteRef",
|
|
500
489
|
ref: He,
|
|
501
490
|
"data-ui-colorpicker-palette": "true",
|
|
502
491
|
class: "ui-colorpicker-palette relative overflow-hidden rounded-md border border-medium",
|
|
503
|
-
style: g(
|
|
504
|
-
onPointerdown:
|
|
492
|
+
style: g(pt.value),
|
|
493
|
+
onPointerdown: Kt
|
|
505
494
|
}, [
|
|
506
495
|
i[4] ||= p("div", { class: "ui-colorpicker-palette-layer ui-colorpicker-palette-light" }, null, -1),
|
|
507
496
|
i[5] ||= p("div", { class: "ui-colorpicker-palette-layer ui-colorpicker-palette-dark" }, null, -1),
|
|
508
497
|
p("span", {
|
|
509
498
|
class: "ui-colorpicker-picker absolute size-3 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)]",
|
|
510
|
-
style: g(
|
|
499
|
+
style: g(ht.value)
|
|
511
500
|
}, null, 4)
|
|
512
501
|
], 36),
|
|
513
|
-
p("div",
|
|
502
|
+
p("div", De, [
|
|
514
503
|
p("button", {
|
|
515
504
|
type: "button",
|
|
516
505
|
class: "flex size-8 shrink-0 items-center justify-center rounded-md border border-medium bg-secondary text-tertiary transition-colors hover:border-brand/40 hover:text-brand disabled:cursor-not-allowed disabled:opacity-50",
|
|
517
|
-
disabled:
|
|
506
|
+
disabled: dt.value,
|
|
518
507
|
"aria-label": "屏幕取色",
|
|
519
508
|
title: "屏幕取色",
|
|
520
|
-
onClick:
|
|
521
|
-
}, [...i[6] ||= [p("span", { class: "i-lucide:pipette size-4" }, null, -1)]], 8,
|
|
522
|
-
p("div",
|
|
509
|
+
onClick: tn
|
|
510
|
+
}, [...i[6] ||= [p("span", { class: "i-lucide:pipette size-4" }, null, -1)]], 8, Oe),
|
|
511
|
+
p("div", ke, [p("div", {
|
|
523
512
|
ref_key: "hueBarRef",
|
|
524
513
|
ref: Ue,
|
|
525
514
|
class: "ui-colorpicker-huebar relative h-3 rounded-full border border-medium",
|
|
526
|
-
onPointerdown:
|
|
515
|
+
onPointerdown: qt
|
|
527
516
|
}, [p("span", {
|
|
528
517
|
"data-ui-colorpicker-hue-handle": "true",
|
|
529
518
|
class: h(["ui-colorpicker-bar-picker absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)] transition-transform hover:scale-125", M.value ? "scale-125" : ""]),
|
|
530
|
-
style: g(
|
|
519
|
+
style: g(gt.value)
|
|
531
520
|
}, null, 6)], 544), W.value ? (_(), f("div", {
|
|
532
521
|
key: 0,
|
|
533
522
|
ref_key: "opacityBarRef",
|
|
534
523
|
ref: We,
|
|
535
524
|
"data-ui-colorpicker-opacity": "true",
|
|
536
525
|
class: "ui-colorpicker-checker relative h-3 rounded-full border border-medium",
|
|
537
|
-
onPointerdown:
|
|
526
|
+
onPointerdown: Jt
|
|
538
527
|
}, [p("div", {
|
|
539
528
|
class: "absolute inset-0 rounded-full",
|
|
540
|
-
style: g({ background:
|
|
529
|
+
style: g({ background: st.value })
|
|
541
530
|
}, null, 4), p("span", {
|
|
542
531
|
"data-ui-colorpicker-opacity-handle": "true",
|
|
543
532
|
class: h(["ui-colorpicker-bar-picker absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)] transition-transform hover:scale-125", N.value ? "scale-125" : ""]),
|
|
544
|
-
style: g(
|
|
533
|
+
style: g(_t.value)
|
|
545
534
|
}, null, 6)], 544)) : d("", !0)]),
|
|
546
|
-
p("span",
|
|
535
|
+
p("span", Ae, [p("span", {
|
|
547
536
|
class: "block h-full w-full rounded-full",
|
|
548
|
-
style: g({ background:
|
|
537
|
+
style: g({ background: ct.value })
|
|
549
538
|
}, null, 4)])
|
|
550
539
|
]),
|
|
551
540
|
p("div", {
|
|
552
541
|
"data-ui-colorpicker-input-row": "true",
|
|
553
542
|
class: "ui-colorpicker-input-row grid items-center gap-2 text-xs",
|
|
554
|
-
style: g(
|
|
543
|
+
style: g(mt.value)
|
|
555
544
|
}, [p("input", {
|
|
556
545
|
"data-ui-colorpicker-color-input": "true",
|
|
557
546
|
class: h(["min-w-0 rounded border bg-secondary px-2 py-1 font-mono text-secondary outline-none transition-colors focus:border-brand", I.value ? "border-[#ff4d4f]" : "border-medium"]),
|
|
558
547
|
value: F.value,
|
|
559
548
|
"aria-invalid": I.value,
|
|
560
549
|
spellcheck: "false",
|
|
561
|
-
onFocus:
|
|
562
|
-
onInput:
|
|
563
|
-
onKeydown: S(
|
|
564
|
-
onBlur:
|
|
565
|
-
}, null, 42,
|
|
550
|
+
onFocus: Nt,
|
|
551
|
+
onInput: jt,
|
|
552
|
+
onKeydown: S(Mt, ["stop"]),
|
|
553
|
+
onBlur: Pt
|
|
554
|
+
}, null, 42, je), p("span", Me, he(W.value ? Math.round(R.a * 100) : 100) + "%", 1)], 4)
|
|
566
555
|
])
|
|
567
556
|
], 36)) : d("", !0)]))], 4));
|
|
568
557
|
}
|
|
569
|
-
}), [["__scopeId", "data-v-
|
|
558
|
+
}), [["__scopeId", "data-v-a4d587bb"]]), ze = ae("group/ui-colorpicker inline-flex shrink-0 items-center justify-center overflow-hidden border bg-primary align-middle transition-colors duration-150", {
|
|
570
559
|
variants: {
|
|
571
560
|
size: {
|
|
572
|
-
sm: "
|
|
573
|
-
md: "
|
|
574
|
-
lg: "
|
|
561
|
+
sm: "rounded-md p-1",
|
|
562
|
+
md: "rounded-md p-1",
|
|
563
|
+
lg: "rounded-md p-1.5"
|
|
575
564
|
},
|
|
576
565
|
focused: {
|
|
577
566
|
true: "border-brand ring-2 ring-brand/15",
|
|
578
|
-
false: "border-
|
|
567
|
+
false: "border-control hover:border-brand/40"
|
|
579
568
|
},
|
|
580
569
|
disabled: {
|
|
581
|
-
true: "cursor-not-allowed bg-primary hover:border-
|
|
570
|
+
true: "cursor-not-allowed bg-primary hover:border-control",
|
|
582
571
|
false: "cursor-pointer"
|
|
583
572
|
}
|
|
584
573
|
},
|
|
@@ -587,8 +576,15 @@ var ve = ["disabled", "aria-expanded"], ye = { class: "ui-colorpicker-checker bl
|
|
|
587
576
|
focused: !1,
|
|
588
577
|
disabled: !1
|
|
589
578
|
}
|
|
579
|
+
}), Be = ae("ui-colorpicker-checker block shrink-0 overflow-hidden rounded-[inherit]", {
|
|
580
|
+
variants: { size: {
|
|
581
|
+
sm: "size-5",
|
|
582
|
+
md: "size-6",
|
|
583
|
+
lg: "size-6"
|
|
584
|
+
} },
|
|
585
|
+
defaultVariants: { size: "md" }
|
|
590
586
|
});
|
|
591
587
|
//#endregion
|
|
592
|
-
export { ze as n, Be as t };
|
|
588
|
+
export { ze as n, Re as r, Be as t };
|
|
593
589
|
|
|
594
|
-
//# sourceMappingURL=colorpicker-
|
|
590
|
+
//# sourceMappingURL=colorpicker-B-kSQ2Gh.js.map
|