@mcistudio/unoui-vue 1.1.0 → 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.
Files changed (65) hide show
  1. package/dist/button/index.js +1 -1
  2. package/dist/checkbox/index.js +1 -1
  3. package/dist/chunks/{ImageEditor-CahA7Ut7.js → ImageEditor-DRoD50TJ.js} +2 -2
  4. package/dist/chunks/{ImageEditor-CahA7Ut7.js.map → ImageEditor-DRoD50TJ.js.map} +1 -1
  5. package/dist/chunks/{Table-DhXmuKQd.js → Table-QvmJFoxl.js} +3 -3
  6. package/dist/chunks/{Table-DhXmuKQd.js.map → Table-QvmJFoxl.js.map} +1 -1
  7. package/dist/chunks/{button-pDObrN_X.js → button-BBFPr3FH.js} +34 -33
  8. package/dist/chunks/{button-pDObrN_X.js.map → button-BBFPr3FH.js.map} +1 -1
  9. package/dist/chunks/{checkbox-9_0oR4kg.js → checkbox-wJpQHCeN.js} +2 -2
  10. package/dist/chunks/{checkbox-9_0oR4kg.js.map → checkbox-wJpQHCeN.js.map} +1 -1
  11. package/dist/chunks/{colorpicker-CcizUCQv.js → colorpicker-B-kSQ2Gh.js} +154 -158
  12. package/dist/chunks/colorpicker-B-kSQ2Gh.js.map +1 -0
  13. package/dist/chunks/control-BIl2ynWn.js +10 -0
  14. package/dist/chunks/control-BIl2ynWn.js.map +1 -0
  15. package/dist/chunks/datepicker-XNgIvgTe.js +1411 -0
  16. package/dist/chunks/datepicker-XNgIvgTe.js.map +1 -0
  17. package/dist/chunks/{dropdown-0l967g7D.js → dropdown-B4XuqfaI.js} +4 -4
  18. package/dist/chunks/dropdown-B4XuqfaI.js.map +1 -0
  19. package/dist/chunks/{form-Qeqkd-HH.js → form-CVJ4YMWA.js} +7 -7
  20. package/dist/chunks/{form-Qeqkd-HH.js.map → form-CVJ4YMWA.js.map} +1 -1
  21. package/dist/chunks/input-hIYHtcTj.js +1272 -0
  22. package/dist/chunks/input-hIYHtcTj.js.map +1 -0
  23. package/dist/chunks/{pagination-Bc583AQX.js → pagination-xntyuczw.js} +38 -56
  24. package/dist/chunks/pagination-xntyuczw.js.map +1 -0
  25. package/dist/chunks/{popconfirm-D6lUfSxG.js → popconfirm-DWmeebIf.js} +2 -2
  26. package/dist/chunks/{popconfirm-D6lUfSxG.js.map → popconfirm-DWmeebIf.js.map} +1 -1
  27. package/dist/chunks/{radio-DnYm59xH.js → radio-DGt8o-UL.js} +12 -12
  28. package/dist/chunks/{radio-DnYm59xH.js.map → radio-DGt8o-UL.js.map} +1 -1
  29. package/dist/chunks/select-eZ9h_f58.js +462 -0
  30. package/dist/chunks/select-eZ9h_f58.js.map +1 -0
  31. package/dist/chunks/{switch-BULGbODP.js → switch-C6a6ga2G.js} +2 -2
  32. package/dist/chunks/{switch-BULGbODP.js.map → switch-C6a6ga2G.js.map} +1 -1
  33. package/dist/chunks/{timepicker-DsGIdcf8.js → timepicker-BU9TRvFI.js} +326 -329
  34. package/dist/chunks/{timepicker-DsGIdcf8.js.map → timepicker-BU9TRvFI.js.map} +1 -1
  35. package/dist/colorpicker/index.d.ts +4 -0
  36. package/dist/colorpicker/index.js +2 -2
  37. package/dist/control.d.ts +6 -0
  38. package/dist/datepicker/index.js +1 -1
  39. package/dist/dropdown/index.js +1 -1
  40. package/dist/form/index.js +1 -1
  41. package/dist/imageeditor/index.js +1 -1
  42. package/dist/index.js +31 -31
  43. package/dist/input/index.d.ts +4 -0
  44. package/dist/input/index.js +2 -2
  45. package/dist/modal/Modal.vue.d.ts +1 -1
  46. package/dist/pagination/index.js +1 -1
  47. package/dist/popconfirm/index.js +1 -1
  48. package/dist/radio/index.js +1 -1
  49. package/dist/select/index.js +1 -1
  50. package/dist/style.css +1 -1
  51. package/dist/switch/index.js +1 -1
  52. package/dist/table/index.js +1 -1
  53. package/dist/timepicker/index.js +1 -1
  54. package/dist/uno.js +1 -0
  55. package/dist/uno.js.map +1 -1
  56. package/package.json +1 -1
  57. package/dist/chunks/colorpicker-CcizUCQv.js.map +0 -1
  58. package/dist/chunks/datepicker-Cy808x7X.js +0 -1414
  59. package/dist/chunks/datepicker-Cy808x7X.js.map +0 -1
  60. package/dist/chunks/dropdown-0l967g7D.js.map +0 -1
  61. package/dist/chunks/input-BDOXVCrK.js +0 -1281
  62. package/dist/chunks/input-BDOXVCrK.js.map +0 -1
  63. package/dist/chunks/pagination-Bc583AQX.js.map +0 -1
  64. package/dist/chunks/select-ChTfQM5u.js +0 -417
  65. 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 = { class: "ui-colorpicker-checker block h-full w-full overflow-hidden rounded-[inherit]" }, be = {
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
- }, xe = [
11
+ }, be = [
12
12
  "title",
13
13
  "aria-label",
14
14
  "onClick"
15
- ], Se = {
15
+ ], xe = {
16
16
  key: 1,
17
17
  class: "border-b border-medium py-2"
18
- }, Ce = {
18
+ }, Se = {
19
19
  "data-ui-colorpicker-gradient-row": "true",
20
20
  class: "flex items-center mx-3"
21
- }, we = [
21
+ }, Ce = [
22
22
  "aria-label",
23
23
  "onPointerdown",
24
24
  "onKeydown"
25
- ], Te = {
25
+ ], we = {
26
26
  key: 0,
27
27
  "data-ui-colorpicker-degree-group": "true",
28
28
  class: "flex shrink-0 items-center"
29
- }, Ee = { class: "min-w-9 text-right font-mono text-xs text-tertiary" }, De = { class: "grid gap-3 p-3" }, Oe = { class: "flex items-center gap-3" }, ke = ["disabled"], Ae = { class: "grid min-w-0 flex-1 gap-2" }, je = { class: "ui-colorpicker-checker size-8 shrink-0 overflow-hidden rounded-full border border-medium" }, Me = ["value", "aria-invalid"], Ne = { class: "rounded border border-medium bg-secondary px-2 py-1 text-right font-mono text-tertiary" }, Pe = 260, Fe = 4, C = 8, Ie = 10, Le = 200, Re = 24, ze = /*#__PURE__*/ e(/* @__PURE__ */ m({
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, ze = 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({
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
- }), rt = u(() => ie(X(nt.value))), U = u(() => tt(m.allowGradient, !0)), W = u(() => tt(m.allowAlpha, !0)), it = u(() => l(c({
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
- }))), at = u(() => xt().map((e) => `${ee(e.color)} ${e.percent}%`).join(",")), ot = u(() => D.value === "linear" ? `linear-gradient(${O.value}deg,${at.value})` : D.value === "radial" ? `radial-gradient(circle,${at.value})` : l(H.value)), st = u(() => `linear-gradient(to right,${at.value || `${l(H.value)} 0%,${l(H.value)} 100%`})`), ct = u(() => {
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
- }), lt = u(() => D.value === "solid" ? l(H.value) : ot.value), ut = u(() => _e(Ve.class, Be({
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: `${Pe}px`,
94
+ width: `${Ne}px`,
105
95
  maxHeight: `calc(100vh - ${C * 2}px)`,
106
96
  overflowY: "auto",
107
97
  zIndex: 2e3
108
- })), mt = u(() => ({
109
- background: it.value,
98
+ })), pt = u(() => ({
99
+ background: rt.value,
110
100
  height: "9rem"
111
- })), ht = u(() => ({ gridTemplateColumns: "minmax(0, 1fr) 56px" })), gt = u(() => ({
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
- })), _t = u(() => ({ left: `${R.h / 360 * 100}%` })), vt = u(() => ({ left: `${R.a * 100}%` })), yt = u(() => ({ transform: `translateY(-50%) rotate(${O.value - 90}deg)` }));
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 || Ot(e) === Qe)) {
107
+ if (e && (e === Ze || Dt(e) === Qe)) {
118
108
  Ze = null, Qe = "";
119
109
  return;
120
110
  }
121
- Et(e);
111
+ Tt(e);
122
112
  }, {
123
113
  deep: !0,
124
114
  immediate: !0
125
115
  }), x(E, (e) => {
126
- e && It();
127
- }), x(rt, (e) => {
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 bt(e) {
128
+ function yt(e) {
139
129
  return e === "solid" || e === "linear" || e === "radial";
140
130
  }
141
- function xt() {
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 St(e = R) {
145
+ function xt(e = R) {
156
146
  return [K(0, e), K(100, e)];
157
147
  }
158
- function Ct(e) {
159
- if (!e?.gradients?.length) return St();
160
- let t = e.gradients.filter((e) => e && typeof e == "object").slice(0, Ie).map((e) => K(e.percent, s(e.color)));
161
- return t.length >= 2 ? t : t.length === 1 ? [t[0], K(100, t[0].color)] : St();
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 wt() {
164
- L.value.length >= 2 || (L.value = St(), k.value = L.value[0]?.id ?? null);
153
+ function Ct() {
154
+ L.value.length >= 2 || (L.value = xt(), k.value = L.value[0]?.id ?? null);
165
155
  }
166
- function Tt() {
156
+ function wt() {
167
157
  if (D.value === "solid") return;
168
- wt();
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
- wt();
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 Et(e) {
168
+ function Tt(e) {
179
169
  Xe = !0;
180
- let t = U.value && bt(e?.mode) ? e.mode : "solid", n = e?.color ?? e?.gradients?.[0]?.color;
181
- D.value = t, O.value = te(e?.degree), G(s(n)), L.value = Ct(e), k.value = L.value[0]?.id ?? null, t !== "solid" && Tt(), Xe = !1;
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 Dt() {
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 = xt().map((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 = Dt();
211
- Ze = e, Qe = Ot(e), ze("update:modelValue", e), ze("changed", e);
200
+ let e = Et();
201
+ Ze = e, Qe = Dt(e), Re("update:modelValue", e), Re("changed", e);
212
202
  }
213
- function Ot(e) {
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 kt(e = {}) {
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
- wt();
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 At() {
239
- Z(), F.value = rt.value, I.value = !1;
228
+ function kt() {
229
+ Z(), F.value = nt.value, I.value = !1;
240
230
  }
241
- function jt() {
231
+ function At() {
242
232
  Z(), V = window.setTimeout(() => {
243
- V = null, kt();
244
- }, Le);
233
+ V = null, Ot();
234
+ }, Ie);
245
235
  }
246
- function Mt(e) {
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 ? jt() : Z();
240
+ I.value = t.trim() !== "" && !n, n ? At() : Z();
251
241
  }
252
- function Nt(e) {
242
+ function Mt(e) {
253
243
  if (e.key === "Enter") {
254
244
  e.preventDefault(), Z();
255
- let t = kt({ formatInput: !0 });
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(), At());
249
+ e.key === "Escape" && (e.preventDefault(), kt());
260
250
  }
261
- function Pt() {
251
+ function Nt() {
262
252
  qe.value = !0;
263
253
  }
264
- function Ft(e) {
254
+ function Pt(e) {
265
255
  qe.value = !1, Z();
266
- let t = kt({ formatInput: !0 });
256
+ let t = Ot({ formatInput: !0 });
267
257
  t && e.target instanceof HTMLInputElement && (e.target.value = t);
268
258
  }
269
- function It() {
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 - Pe - C, o = t.bottom + Fe, s = t.top - n - Fe;
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 Lt(e) {
267
+ function It(e) {
278
268
  m.disabled || (E.value = e);
279
269
  }
280
- function Rt() {
281
- Lt(!E.value);
270
+ function Lt() {
271
+ It(!E.value);
282
272
  }
283
- function zt(e) {
284
- m.disabled || e !== "solid" && !U.value || (D.value = e, D.value !== "solid" && Tt(), J());
273
+ function Rt(e) {
274
+ m.disabled || e !== "solid" && !U.value || (D.value = e, D.value !== "solid" && wt(), J());
285
275
  }
286
- function Bt(e) {
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 Vt(e) {
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 Ht(e) {
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 Ut(e) {
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 Wt(e) {
295
+ function Ut(e) {
306
296
  return L.value.length > 2 && L.value.some((t) => t.id === e);
307
297
  }
308
- function Gt(e, t) {
309
- return e.clientY < t.top - Re || e.clientY > t.bottom + Re;
298
+ function Wt(e, t) {
299
+ return e.clientY < t.top - Le || e.clientY > t.bottom + Le;
310
300
  }
311
- function Kt(e, t) {
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 = Wt(t) && Gt(e, n) ? t : null, J());
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 qt(e) {
333
- $(e, Bt);
322
+ function Kt(e) {
323
+ $(e, zt);
334
324
  }
335
- function Jt(e) {
336
- M.value = !0, $(e, Vt, () => {
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 Yt(e) {
343
- N.value = !0, $(e, Ht, () => {
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 Xt(e) {
350
- P.value = !0, $(e, Ut, () => {
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 Zt(e) {
357
- if (!U.value || D.value === "solid" || L.value.length >= Ie) return;
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 Qt(e) {
364
- m.disabled || Zt(e);
353
+ function Zt(e) {
354
+ m.disabled || Xt(e);
365
355
  }
366
- function $t(e, t) {
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) => Kt(e, t), () => {
370
- j.value === t && tn(t), A.value = null, j.value = null;
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 en(e, t) {
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 tn(e = k.value) {
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 nn() {
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 rn(e) {
396
- e.key === "Enter" || e.key === " " ? (e.preventDefault(), Rt()) : e.key === "Escape" && (E.value = !1);
385
+ function nn(e) {
386
+ e.key === "Enter" || e.key === " " ? (e.preventDefault(), Lt()) : e.key === "Escape" && (E.value = !1);
397
387
  }
398
- function an(e) {
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 on(e) {
393
+ function an(e) {
404
394
  E.value && e.key === "Escape" && (E.value = !1);
405
395
  }
406
- function sn() {
407
- E.value && It();
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", an, !0), document.addEventListener("keydown", on), document.addEventListener("scroll", sn, !0), window.addEventListener("resize", sn);
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", an, !0), document.removeEventListener("keydown", on), document.removeEventListener("scroll", sn, !0), window.removeEventListener("resize", sn);
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: ut.value,
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: Rt,
428
- onKeydown: rn
429
- }), [p("span", ye, [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: lt.value })
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(pt.value),
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", be, [(_(), f(oe, null, me($e, (e) => p("button", {
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) => zt(e.mode)
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, xe)), 64))])) : d("", !0),
457
- U.value && D.value !== "solid" ? (_(), f("div", Se, [p("div", Ce, [p("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: Qt,
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: st.value })
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) => $t(t, e.id), ["stop"]),
479
- onKeydown: (t) => en(t, e.id)
480
- }, null, 46, we))), 128))], 544), D.value === "linear" ? (_(), f("div", Te, [p("span", Ee, he(O.value) + "°", 1), p("div", {
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: Xt
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(yt.value)
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", De, [
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(mt.value),
504
- onPointerdown: qt
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(gt.value)
499
+ style: g(ht.value)
511
500
  }, null, 4)
512
501
  ], 36),
513
- p("div", Oe, [
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: ft.value,
506
+ disabled: dt.value,
518
507
  "aria-label": "屏幕取色",
519
508
  title: "屏幕取色",
520
- onClick: nn
521
- }, [...i[6] ||= [p("span", { class: "i-lucide:pipette size-4" }, null, -1)]], 8, ke),
522
- p("div", Ae, [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: Jt
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(_t.value)
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: Yt
526
+ onPointerdown: Jt
538
527
  }, [p("div", {
539
528
  class: "absolute inset-0 rounded-full",
540
- style: g({ background: ct.value })
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(vt.value)
533
+ style: g(_t.value)
545
534
  }, null, 6)], 544)) : d("", !0)]),
546
- p("span", je, [p("span", {
535
+ p("span", Ae, [p("span", {
547
536
  class: "block h-full w-full rounded-full",
548
- style: g({ background: lt.value })
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(ht.value)
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: Pt,
562
- onInput: Mt,
563
- onKeydown: S(Nt, ["stop"]),
564
- onBlur: Ft
565
- }, null, 42, Me), p("span", Ne, he(W.value ? Math.round(R.a * 100) : 100) + "%", 1)], 4)
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-df64fbfc"]]), Be = ae("group/ui-colorpicker inline-flex shrink-0 items-center justify-center overflow-hidden border bg-primary align-middle transition-colors duration-150", {
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: "h-7 w-7 rounded-md p-1",
573
- md: "h-8 w-8 rounded-md p-1",
574
- lg: "h-9 w-9 rounded-md p-1.5"
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-medium hover:border-brand/40"
567
+ false: "border-control hover:border-brand/40"
579
568
  },
580
569
  disabled: {
581
- true: "cursor-not-allowed bg-primary hover:border-medium",
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-CcizUCQv.js.map
590
+ //# sourceMappingURL=colorpicker-B-kSQ2Gh.js.map