@mcistudio/unoui-vue 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.
Files changed (187) hide show
  1. package/README.md +95 -0
  2. package/dist/alert/Alert.vue.d.ts +67 -0
  3. package/dist/alert/index.d.ts +40 -0
  4. package/dist/alert/index.js +2 -0
  5. package/dist/attrs.d.ts +11 -0
  6. package/dist/attrs.js +16 -0
  7. package/dist/attrs.js.map +1 -0
  8. package/dist/badge/Badge.vue.d.ts +57 -0
  9. package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
  10. package/dist/badge/index.d.ts +42 -0
  11. package/dist/badge/index.js +2 -0
  12. package/dist/build.d.ts +2 -0
  13. package/dist/button/Button.vue.d.ts +46 -0
  14. package/dist/button/ButtonGroup.vue.d.ts +13 -0
  15. package/dist/button/index.d.ts +13 -0
  16. package/dist/button/index.js +2 -0
  17. package/dist/checkbox/Checkbox.vue.d.ts +47 -0
  18. package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
  19. package/dist/checkbox/index.d.ts +30 -0
  20. package/dist/checkbox/index.js +2 -0
  21. package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
  22. package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
  23. package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
  24. package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
  25. package/dist/chunks/Table-DhXmuKQd.js +330 -0
  26. package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
  27. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  28. package/dist/chunks/alert-CczW_DKs.js +190 -0
  29. package/dist/chunks/alert-CczW_DKs.js.map +1 -0
  30. package/dist/chunks/badge-BHOZeImh.js +287 -0
  31. package/dist/chunks/badge-BHOZeImh.js.map +1 -0
  32. package/dist/chunks/button-pDObrN_X.js +168 -0
  33. package/dist/chunks/button-pDObrN_X.js.map +1 -0
  34. package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
  35. package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
  36. package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
  37. package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
  38. package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
  39. package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
  40. package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
  41. package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
  42. package/dist/chunks/dropdown-0l967g7D.js +329 -0
  43. package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
  44. package/dist/chunks/form-Qeqkd-HH.js +642 -0
  45. package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
  46. package/dist/chunks/input-BDOXVCrK.js +1281 -0
  47. package/dist/chunks/input-BDOXVCrK.js.map +1 -0
  48. package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
  49. package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
  50. package/dist/chunks/message-xPfuG0EX.js +107 -0
  51. package/dist/chunks/message-xPfuG0EX.js.map +1 -0
  52. package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
  53. package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
  54. package/dist/chunks/modal-D6l1iIvE.js +81 -0
  55. package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
  56. package/dist/chunks/pagination-Bc583AQX.js +265 -0
  57. package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
  58. package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
  59. package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
  60. package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
  61. package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
  62. package/dist/chunks/radio-DnYm59xH.js +477 -0
  63. package/dist/chunks/radio-DnYm59xH.js.map +1 -0
  64. package/dist/chunks/rate-0sme__Kb.js +309 -0
  65. package/dist/chunks/rate-0sme__Kb.js.map +1 -0
  66. package/dist/chunks/select-ChTfQM5u.js +417 -0
  67. package/dist/chunks/select-ChTfQM5u.js.map +1 -0
  68. package/dist/chunks/slider-C-W5GzTP.js +724 -0
  69. package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
  70. package/dist/chunks/splitter-CgfiXY65.js +524 -0
  71. package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
  72. package/dist/chunks/switch-BULGbODP.js +327 -0
  73. package/dist/chunks/switch-BULGbODP.js.map +1 -0
  74. package/dist/chunks/tab-Dxfg1_To.js +663 -0
  75. package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
  76. package/dist/chunks/tag-BYmNsrZC.js +167 -0
  77. package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
  78. package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
  79. package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
  80. package/dist/chunks/tooltip-DMhiAqto.js +242 -0
  81. package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
  82. package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
  83. package/dist/colorpicker/color.d.ts +56 -0
  84. package/dist/colorpicker/color.js +99 -0
  85. package/dist/colorpicker/color.js.map +1 -0
  86. package/dist/colorpicker/index.d.ts +12 -0
  87. package/dist/colorpicker/index.js +2 -0
  88. package/dist/config.d.ts +55 -0
  89. package/dist/config.js +260 -0
  90. package/dist/config.js.map +1 -0
  91. package/dist/datepicker/DatePicker.vue.d.ts +82 -0
  92. package/dist/datepicker/RangePicker.vue.d.ts +87 -0
  93. package/dist/datepicker/index.d.ts +59 -0
  94. package/dist/datepicker/index.js +2 -0
  95. package/dist/drawer/Drawer.vue.d.ts +86 -0
  96. package/dist/drawer/index.d.ts +23 -0
  97. package/dist/drawer/index.js +2 -0
  98. package/dist/dropdown/Dropdown.vue.d.ts +118 -0
  99. package/dist/dropdown/index.d.ts +2 -0
  100. package/dist/dropdown/index.js +2 -0
  101. package/dist/form/Form.vue.d.ts +170 -0
  102. package/dist/form/FormItem.vue.d.ts +83 -0
  103. package/dist/form/index.d.ts +176 -0
  104. package/dist/form/index.js +2 -0
  105. package/dist/index.d.ts +31 -0
  106. package/dist/index.js +32 -0
  107. package/dist/input/Autocomplete.vue.d.ts +121 -0
  108. package/dist/input/Input.vue.d.ts +142 -0
  109. package/dist/input/InputI18n.vue.d.ts +80 -0
  110. package/dist/input/InputTag.vue.d.ts +114 -0
  111. package/dist/input/index.d.ts +41 -0
  112. package/dist/input/index.js +2 -0
  113. package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
  114. package/dist/inputOtp/index.d.ts +21 -0
  115. package/dist/inputOtp/index.js +2 -0
  116. package/dist/message/MessageContainer.vue.d.ts +11 -0
  117. package/dist/message/index.d.ts +20 -0
  118. package/dist/message/index.js +2 -0
  119. package/dist/message/types.d.ts +25 -0
  120. package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
  121. package/dist/millercolumns/index.d.ts +39 -0
  122. package/dist/millercolumns/index.js +2 -0
  123. package/dist/modal/Modal.vue.d.ts +54 -0
  124. package/dist/modal/index.d.ts +2 -0
  125. package/dist/modal/index.js +2 -0
  126. package/dist/pagination/Pagination.vue.d.ts +70 -0
  127. package/dist/pagination/index.d.ts +12 -0
  128. package/dist/pagination/index.js +2 -0
  129. package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
  130. package/dist/popconfirm/index.d.ts +36 -0
  131. package/dist/popconfirm/index.js +2 -0
  132. package/dist/progress/Progress.vue.d.ts +64 -0
  133. package/dist/progress/index.d.ts +26 -0
  134. package/dist/progress/index.js +2 -0
  135. package/dist/qrcode/QRCode.vue.d.ts +87 -0
  136. package/dist/qrcode/index.d.ts +43 -0
  137. package/dist/qrcode/index.js +2 -0
  138. package/dist/qrcode/qr.d.ts +51 -0
  139. package/dist/qrcode/qrcodegen.d.ts +94 -0
  140. package/dist/radio/Radio.vue.d.ts +52 -0
  141. package/dist/radio/RadioGroup.vue.d.ts +44 -0
  142. package/dist/radio/index.d.ts +55 -0
  143. package/dist/radio/index.js +2 -0
  144. package/dist/rate/Rate.vue.d.ts +100 -0
  145. package/dist/rate/index.d.ts +38 -0
  146. package/dist/rate/index.js +2 -0
  147. package/dist/select/Select.vue.d.ts +129 -0
  148. package/dist/select/index.d.ts +33 -0
  149. package/dist/select/index.js +2 -0
  150. package/dist/skeleton/Skeleton.vue.d.ts +31 -0
  151. package/dist/skeleton/index.d.ts +2 -0
  152. package/dist/skeleton/index.js +2 -0
  153. package/dist/slider/Slider.vue.d.ts +81 -0
  154. package/dist/slider/index.d.ts +61 -0
  155. package/dist/slider/index.js +2 -0
  156. package/dist/splitter/Splitter.vue.d.ts +63 -0
  157. package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
  158. package/dist/splitter/index.d.ts +39 -0
  159. package/dist/splitter/index.js +2 -0
  160. package/dist/style.css +2 -0
  161. package/dist/switch/Switch.vue.d.ts +97 -0
  162. package/dist/switch/index.d.ts +31 -0
  163. package/dist/switch/index.js +2 -0
  164. package/dist/tab/TabPane.vue.d.ts +32 -0
  165. package/dist/tab/Tabs.vue.d.ts +87 -0
  166. package/dist/tab/index.d.ts +78 -0
  167. package/dist/tab/index.js +2 -0
  168. package/dist/table/Table.vue.d.ts +96 -0
  169. package/dist/table/index.d.ts +3 -0
  170. package/dist/table/index.js +2 -0
  171. package/dist/table/types.d.ts +35 -0
  172. package/dist/table/types.js +0 -0
  173. package/dist/tag/Tag.vue.d.ts +46 -0
  174. package/dist/tag/index.d.ts +11 -0
  175. package/dist/tag/index.js +2 -0
  176. package/dist/timepicker/TimePicker.vue.d.ts +92 -0
  177. package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
  178. package/dist/timepicker/index.d.ts +39 -0
  179. package/dist/timepicker/index.js +2 -0
  180. package/dist/tooltip/Tooltip.vue.d.ts +79 -0
  181. package/dist/tooltip/index.d.ts +14 -0
  182. package/dist/tooltip/index.js +2 -0
  183. package/dist/uno.d.ts +32 -0
  184. package/dist/uno.js +83 -0
  185. package/dist/uno.js.map +1 -0
  186. package/dist/utils/DnD.d.ts +38 -0
  187. package/package.json +115 -0
@@ -0,0 +1,594 @@
1
+ import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
+ import { getUiAttrStyle as t, getUiExposeAttrs as n } from "../attrs.js";
3
+ import { clampAlpha as r, clampHue as i, clampPercent as a, cloneHsba as o, colorToHsba as s, hsbToRgb as c, hsbaToCss as ee, normalizeDegree as te, normalizeRgba as ne, parseCssColor as re, rgbaToCss as l, rgbaToHex as ie } from "../colorpicker/color.js";
4
+ import { cva as ae } from "class-variance-authority";
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
+ import { clsx as _e } from "clsx";
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 = {
9
+ key: 0,
10
+ class: "flex h-10 items-center gap-1 border-b border-medium px-3"
11
+ }, xe = [
12
+ "title",
13
+ "aria-label",
14
+ "onClick"
15
+ ], Se = {
16
+ key: 1,
17
+ class: "border-b border-medium py-2"
18
+ }, Ce = {
19
+ "data-ui-colorpicker-gradient-row": "true",
20
+ class: "flex items-center mx-3"
21
+ }, we = [
22
+ "aria-label",
23
+ "onPointerdown",
24
+ "onKeydown"
25
+ ], Te = {
26
+ key: 0,
27
+ "data-ui-colorpicker-degree-group": "true",
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({
30
+ inheritAttrs: !1,
31
+ __name: "ColorPicker",
32
+ props: {
33
+ modelValue: { default: void 0 },
34
+ size: { default: "md" },
35
+ allowGradient: {
36
+ type: [Boolean, String],
37
+ default: !0
38
+ },
39
+ allowAlpha: {
40
+ type: [Boolean, String],
41
+ default: !0
42
+ },
43
+ disabled: {
44
+ type: Boolean,
45
+ default: !1
46
+ }
47
+ },
48
+ emits: ["update:modelValue", "changed"],
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({
51
+ h: 0,
52
+ s: 0,
53
+ b: 0,
54
+ a: 1
55
+ }), z = pe({
56
+ top: 0,
57
+ left: 0
58
+ }), Je = v(!1), Ye = 0, B = null, Xe = !1, Ze = null, Qe = "", V = null, $e = [
59
+ {
60
+ mode: "solid",
61
+ label: "纯色"
62
+ },
63
+ {
64
+ mode: "linear",
65
+ label: "线性渐变"
66
+ },
67
+ {
68
+ mode: "radial",
69
+ label: "径向渐变"
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(() => {
76
+ if (D.value === "solid") return H.value;
77
+ let e = L.value.find((e) => e.id === k.value) ?? L.value[0];
78
+ 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({
80
+ h: R.h,
81
+ s: 100,
82
+ b: 100,
83
+ 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(() => {
85
+ let e = ne({
86
+ ...H.value,
87
+ a: 1
88
+ });
89
+ 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({
91
+ size: m.size,
92
+ focused: E.value,
93
+ 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(() => ({
101
+ position: "fixed",
102
+ top: `${z.top}px`,
103
+ left: `${z.left}px`,
104
+ width: `${Pe}px`,
105
+ maxHeight: `calc(100vh - ${C * 2}px)`,
106
+ overflowY: "auto",
107
+ zIndex: 2e3
108
+ })), mt = u(() => ({
109
+ background: it.value,
110
+ height: "9rem"
111
+ })), ht = u(() => ({ gridTemplateColumns: "minmax(0, 1fr) 56px" })), gt = u(() => ({
112
+ left: `${R.s}%`,
113
+ top: `${100 - R.b}%`,
114
+ 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)` }));
116
+ x(() => m.modelValue, (e) => {
117
+ if (e && (e === Ze || Ot(e) === Qe)) {
118
+ Ze = null, Qe = "";
119
+ return;
120
+ }
121
+ Et(e);
122
+ }, {
123
+ deep: !0,
124
+ immediate: !0
125
+ }), x(E, (e) => {
126
+ e && It();
127
+ }), x(rt, (e) => {
128
+ qe.value || (F.value = e, I.value = !1);
129
+ }, { immediate: !0 }), x(U, (e) => {
130
+ !e && D.value !== "solid" && (D.value = "solid", J());
131
+ }), x(W, (e) => {
132
+ if (e) return;
133
+ let t = !1;
134
+ R.a !== 1 && (R.a = 1, t = !0), L.value.forEach((e) => {
135
+ e.color.a !== 1 && (e.color.a = 1, t = !0);
136
+ }), t && J();
137
+ });
138
+ function bt(e) {
139
+ return e === "solid" || e === "linear" || e === "radial";
140
+ }
141
+ function xt() {
142
+ return [...L.value].sort((e, t) => e.percent - t.percent);
143
+ }
144
+ function G(e) {
145
+ let t = Y(e);
146
+ R.h = t.h, R.s = t.s, R.b = t.b, R.a = t.a;
147
+ }
148
+ function K(e, t) {
149
+ return {
150
+ id: Ye++,
151
+ percent: a(e),
152
+ color: Y(t)
153
+ };
154
+ }
155
+ function St(e = R) {
156
+ return [K(0, e), K(100, e)];
157
+ }
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();
162
+ }
163
+ function wt() {
164
+ L.value.length >= 2 || (L.value = St(), k.value = L.value[0]?.id ?? null);
165
+ }
166
+ function Tt() {
167
+ if (D.value === "solid") return;
168
+ wt();
169
+ let e = L.value.find((e) => e.id === k.value) ?? L.value[0];
170
+ e && (k.value = e.id, G(e.color));
171
+ }
172
+ function q() {
173
+ if (D.value === "solid") return;
174
+ wt();
175
+ let e = L.value.find((e) => e.id === k.value);
176
+ e && (e.color = Y(R));
177
+ }
178
+ function Et(e) {
179
+ 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;
182
+ }
183
+ function Dt() {
184
+ if (D.value === "solid") {
185
+ let e = X(H.value);
186
+ return {
187
+ mode: "solid",
188
+ color: e,
189
+ hex: ie(e),
190
+ css: `background-color:${l(e)}`
191
+ };
192
+ }
193
+ let e = xt().map((e) => ({
194
+ percent: e.percent,
195
+ color: X(c(e.color))
196
+ })), t = e.map((e) => `${l(e.color)} ${e.percent}%`).join(",");
197
+ return D.value === "linear" ? {
198
+ mode: "linear",
199
+ degree: O.value,
200
+ gradients: e,
201
+ css: `background-image:linear-gradient(${O.value}deg,${t})`
202
+ } : {
203
+ mode: "radial",
204
+ gradients: e,
205
+ css: `background-image:radial-gradient(${t})`
206
+ };
207
+ }
208
+ function J() {
209
+ if (Xe) return;
210
+ let e = Dt();
211
+ Ze = e, Qe = Ot(e), ze("update:modelValue", e), ze("changed", e);
212
+ }
213
+ function Ot(e) {
214
+ return JSON.stringify(e);
215
+ }
216
+ function Y(e) {
217
+ let t = o(e);
218
+ return W.value || (t.a = 1), t;
219
+ }
220
+ function X(e) {
221
+ let t = ne(e);
222
+ return W.value || (t.a = 1), t;
223
+ }
224
+ function Z() {
225
+ V !== null && (window.clearTimeout(V), V = null);
226
+ }
227
+ function kt(e = {}) {
228
+ let t = re(F.value);
229
+ if (!t) return I.value = !0, null;
230
+ let n = X(t), r = ie(n), i = Y(s(n));
231
+ if (I.value = !1, e.formatInput && (F.value = r), G(i), D.value !== "solid") {
232
+ wt();
233
+ let e = L.value.find((e) => e.id === k.value) ?? L.value[0];
234
+ e && (k.value = e.id, e.color = i);
235
+ }
236
+ return J(), r;
237
+ }
238
+ function At() {
239
+ Z(), F.value = rt.value, I.value = !1;
240
+ }
241
+ function jt() {
242
+ Z(), V = window.setTimeout(() => {
243
+ V = null, kt();
244
+ }, Le);
245
+ }
246
+ function Mt(e) {
247
+ let t = e.target.value;
248
+ F.value = t;
249
+ let n = re(t);
250
+ I.value = t.trim() !== "" && !n, n ? jt() : Z();
251
+ }
252
+ function Nt(e) {
253
+ if (e.key === "Enter") {
254
+ e.preventDefault(), Z();
255
+ let t = kt({ formatInput: !0 });
256
+ t && e.target instanceof HTMLInputElement && (e.target.value = t);
257
+ return;
258
+ }
259
+ e.key === "Escape" && (e.preventDefault(), At());
260
+ }
261
+ function Pt() {
262
+ qe.value = !0;
263
+ }
264
+ function Ft(e) {
265
+ qe.value = !1, Z();
266
+ let t = kt({ formatInput: !0 });
267
+ t && e.target instanceof HTMLInputElement && (e.target.value = t);
268
+ }
269
+ function It() {
270
+ return ue(() => {
271
+ let e = w.value;
272
+ 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;
274
+ z.left = Math.max(C, Math.min(t.left, a)), z.top = o + n <= i - C ? o : Math.max(C, s);
275
+ });
276
+ }
277
+ function Lt(e) {
278
+ m.disabled || (E.value = e);
279
+ }
280
+ function Rt() {
281
+ Lt(!E.value);
282
+ }
283
+ function zt(e) {
284
+ m.disabled || e !== "solid" && !U.value || (D.value = e, D.value !== "solid" && Tt(), J());
285
+ }
286
+ function Bt(e) {
287
+ let t = He.value?.getBoundingClientRect();
288
+ 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
+ }
290
+ function Vt(e) {
291
+ let t = Ue.value?.getBoundingClientRect();
292
+ t && (R.h = Math.round(Q(e.clientX, t.left, t.width) * 360), q(), J());
293
+ }
294
+ function Ht(e) {
295
+ if (!W.value) return;
296
+ let t = We.value?.getBoundingClientRect();
297
+ t && (R.a = r(Q(e.clientX, t.left, t.width)), q(), J());
298
+ }
299
+ function Ut(e) {
300
+ let t = Ke.value?.getBoundingClientRect();
301
+ if (!t) return;
302
+ let n = t.left + t.width / 2, r = t.top + t.height / 2, a = Math.atan2(r - e.clientY, e.clientX - n);
303
+ O.value = i(90 - Math.floor(a * 180 / Math.PI)), J();
304
+ }
305
+ function Wt(e) {
306
+ return L.value.length > 2 && L.value.some((t) => t.id === e);
307
+ }
308
+ function Gt(e, t) {
309
+ return e.clientY < t.top - Re || e.clientY > t.bottom + Re;
310
+ }
311
+ function Kt(e, t) {
312
+ 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());
314
+ }
315
+ function Q(e, t, n) {
316
+ return !Number.isFinite(n) || n <= 0 ? 0 : Math.min(1, Math.max(0, (e - t) / n));
317
+ }
318
+ function $(e, t, n, r) {
319
+ if (m.disabled) return;
320
+ e.preventDefault(), B?.(), t(e);
321
+ let i = (e) => {
322
+ e.preventDefault(), t(e);
323
+ }, a = () => {
324
+ document.removeEventListener("pointermove", i), document.removeEventListener("pointerup", o), document.removeEventListener("pointercancel", s);
325
+ }, o = (e) => {
326
+ a(), B = null, n?.(e);
327
+ }, s = () => {
328
+ a(), B = null, r?.();
329
+ };
330
+ document.addEventListener("pointermove", i), document.addEventListener("pointerup", o), document.addEventListener("pointercancel", s), B = s;
331
+ }
332
+ function qt(e) {
333
+ $(e, Bt);
334
+ }
335
+ function Jt(e) {
336
+ M.value = !0, $(e, Vt, () => {
337
+ M.value = !1;
338
+ }, () => {
339
+ M.value = !1;
340
+ });
341
+ }
342
+ function Yt(e) {
343
+ N.value = !0, $(e, Ht, () => {
344
+ N.value = !1;
345
+ }, () => {
346
+ N.value = !1;
347
+ });
348
+ }
349
+ function Xt(e) {
350
+ P.value = !0, $(e, Ut, () => {
351
+ P.value = !1;
352
+ }, () => {
353
+ P.value = !1;
354
+ });
355
+ }
356
+ function Zt(e) {
357
+ if (!U.value || D.value === "solid" || L.value.length >= Ie) return;
358
+ let t = Ge.value?.getBoundingClientRect();
359
+ if (!t) return;
360
+ let n = K(Q(e.clientX, t.left, t.width) * 100, R);
361
+ L.value.push(n), k.value = n.id, J();
362
+ }
363
+ function Qt(e) {
364
+ m.disabled || Zt(e);
365
+ }
366
+ function $t(e, t) {
367
+ if (m.disabled) return;
368
+ 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;
371
+ }, () => {
372
+ A.value = null, j.value = null;
373
+ }));
374
+ }
375
+ function en(e, t) {
376
+ let n = L.value.find((e) => e.id === t);
377
+ !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
+ }
379
+ function tn(e = k.value) {
380
+ if (e === null || L.value.length <= 2) return;
381
+ j.value === e && (j.value = null);
382
+ let t = L.value.findIndex((t) => t.id === e);
383
+ if (t === -1) return;
384
+ L.value.splice(t, 1);
385
+ let n = L.value[Math.min(t, L.value.length - 1)];
386
+ k.value = n?.id ?? null, n && G(n.color), J();
387
+ }
388
+ async function nn() {
389
+ if (m.disabled || typeof window > "u") return;
390
+ let e = window.EyeDropper;
391
+ if (e) try {
392
+ G(s((await new e().open()).sRGBHex)), q(), J();
393
+ } catch {}
394
+ }
395
+ function rn(e) {
396
+ e.key === "Enter" || e.key === " " ? (e.preventDefault(), Rt()) : e.key === "Escape" && (E.value = !1);
397
+ }
398
+ function an(e) {
399
+ if (!E.value) return;
400
+ let t = e.target, n = w.value && !w.value.contains(t), r = T.value && !T.value.contains(t);
401
+ n && r && (E.value = !1);
402
+ }
403
+ function on(e) {
404
+ E.value && e.key === "Escape" && (E.value = !1);
405
+ }
406
+ function sn() {
407
+ E.value && It();
408
+ }
409
+ 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);
411
+ }), fe(() => {
412
+ B?.(), Z(), document.removeEventListener("pointerdown", an, !0), document.removeEventListener("keydown", on), document.removeEventListener("scroll", sn, !0), window.removeEventListener("resize", sn);
413
+ }), (r, i) => (_(), f("div", {
414
+ ref_key: "rootRef",
415
+ ref: w,
416
+ class: "relative inline-flex align-middle",
417
+ style: g(y(t)(y(Ve)))
418
+ }, [p("button", le(y(n)(y(Ve)), {
419
+ "data-ui-colorpicker": "true",
420
+ type: "button",
421
+ class: ut.value,
422
+ style: dt.value,
423
+ disabled: e.disabled,
424
+ "aria-expanded": E.value,
425
+ "aria-haspopup": "dialog",
426
+ "aria-label": "选择颜色",
427
+ onClick: Rt,
428
+ onKeydown: rn
429
+ }), [p("span", ye, [p("span", {
430
+ 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", {
433
+ key: 0,
434
+ ref_key: "panelRef",
435
+ ref: T,
436
+ role: "dialog",
437
+ "aria-label": "颜色选择器",
438
+ style: g(pt.value),
439
+ class: "ui-colorpicker-panel rounded-lg border border-medium bg-primary text-primary shadow-xl outline-none",
440
+ onContextmenu: i[0] ||= S(() => {}, ["prevent"]),
441
+ onPointerdown: i[1] ||= S(() => {}, ["stop"]),
442
+ onSelectstart: i[2] ||= S(() => {}, ["prevent"])
443
+ }, [
444
+ U.value ? (_(), f("div", be, [(_(), f(oe, null, me($e, (e) => p("button", {
445
+ key: e.mode,
446
+ type: "button",
447
+ title: e.label,
448
+ "aria-label": e.label,
449
+ class: "flex size-6 items-center justify-center rounded bg-transparent",
450
+ onClick: (t) => zt(e.mode)
451
+ }, [p("span", { class: h(["size-3.5 rounded-full border transition-[border-color,background,filter]", [
452
+ e.mode === D.value ? "border-[#ff7d3a]" : "border-[#7d7d7d] grayscale",
453
+ e.mode === "solid" ? e.mode === D.value ? "bg-[#ffc9b6]" : "bg-[#e2e2e2]" : "",
454
+ e.mode === "linear" ? e.mode === D.value ? "bg-[linear-gradient(180deg,#ffc9b6,#ff5011)]" : "bg-[linear-gradient(180deg,#ffffff,#999999)]" : "",
455
+ 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", {
458
+ class: "relative h-4 min-w-0 flex-1 rounded-full border border-medium ui-colorpicker-checker",
459
+ onPointerdown: Qt,
460
+ ref_key: "gradientBarRef",
461
+ ref: Ge
462
+ }, [p("div", {
463
+ class: "absolute inset-0 rounded-full",
464
+ style: g({ background: st.value })
465
+ }, null, 4), (_(!0), f(oe, null, me(L.value, (e) => (_(), f("button", {
466
+ key: e.id,
467
+ type: "button",
468
+ class: h(["ui-colorpicker-stop absolute top-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(100,116,139,0.75)] outline-none transition-[box-shadow,opacity,transform] hover:scale-125 focus-visible:ring-2 focus-visible:ring-brand/30", [
469
+ e.id === k.value ? "z-10 ring-2 ring-brand-500" : "",
470
+ e.id === A.value ? "scale-125" : "",
471
+ e.id === j.value ? "opacity-50" : ""
472
+ ]]),
473
+ style: g({
474
+ left: `${e.percent}%`,
475
+ background: y(ee)(e.color)
476
+ }),
477
+ "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", {
481
+ ref_key: "degreeRef",
482
+ ref: Ke,
483
+ "data-ui-colorpicker-degree": "true",
484
+ class: "relative size-6 overflow-visible rounded-full border border-strong bg-secondary",
485
+ onPointerdown: Xt
486
+ }, [p("span", {
487
+ "data-ui-colorpicker-degree-pointer": "true",
488
+ class: "pointer-events-none absolute left-1/2 top-1/2 size-0 origin-left",
489
+ style: g(yt.value)
490
+ }, [i[3] ||= p("span", {
491
+ "data-ui-colorpicker-degree-line": "true",
492
+ class: "absolute left-0 top-0 h-0.5 w-2.5 -translate-y-1/2 rounded-full bg-[var(--color-border-strong)]"
493
+ }, null, -1), p("span", {
494
+ "data-ui-colorpicker-degree-handle": "true",
495
+ 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
+ }, null, 2)], 4)], 544)])) : d("", !0)])])) : d("", !0),
497
+ p("div", De, [
498
+ p("div", {
499
+ ref_key: "paletteRef",
500
+ ref: He,
501
+ "data-ui-colorpicker-palette": "true",
502
+ class: "ui-colorpicker-palette relative overflow-hidden rounded-md border border-medium",
503
+ style: g(mt.value),
504
+ onPointerdown: qt
505
+ }, [
506
+ i[4] ||= p("div", { class: "ui-colorpicker-palette-layer ui-colorpicker-palette-light" }, null, -1),
507
+ i[5] ||= p("div", { class: "ui-colorpicker-palette-layer ui-colorpicker-palette-dark" }, null, -1),
508
+ p("span", {
509
+ 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)
511
+ }, null, 4)
512
+ ], 36),
513
+ p("div", Oe, [
514
+ p("button", {
515
+ type: "button",
516
+ 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,
518
+ "aria-label": "屏幕取色",
519
+ 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", {
523
+ ref_key: "hueBarRef",
524
+ ref: Ue,
525
+ class: "ui-colorpicker-huebar relative h-3 rounded-full border border-medium",
526
+ onPointerdown: Jt
527
+ }, [p("span", {
528
+ "data-ui-colorpicker-hue-handle": "true",
529
+ 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)
531
+ }, null, 6)], 544), W.value ? (_(), f("div", {
532
+ key: 0,
533
+ ref_key: "opacityBarRef",
534
+ ref: We,
535
+ "data-ui-colorpicker-opacity": "true",
536
+ class: "ui-colorpicker-checker relative h-3 rounded-full border border-medium",
537
+ onPointerdown: Yt
538
+ }, [p("div", {
539
+ class: "absolute inset-0 rounded-full",
540
+ style: g({ background: ct.value })
541
+ }, null, 4), p("span", {
542
+ "data-ui-colorpicker-opacity-handle": "true",
543
+ 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)
545
+ }, null, 6)], 544)) : d("", !0)]),
546
+ p("span", je, [p("span", {
547
+ class: "block h-full w-full rounded-full",
548
+ style: g({ background: lt.value })
549
+ }, null, 4)])
550
+ ]),
551
+ p("div", {
552
+ "data-ui-colorpicker-input-row": "true",
553
+ class: "ui-colorpicker-input-row grid items-center gap-2 text-xs",
554
+ style: g(ht.value)
555
+ }, [p("input", {
556
+ "data-ui-colorpicker-color-input": "true",
557
+ 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
+ value: F.value,
559
+ "aria-invalid": I.value,
560
+ 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)
566
+ ])
567
+ ], 36)) : d("", !0)]))], 4));
568
+ }
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", {
570
+ variants: {
571
+ 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"
575
+ },
576
+ focused: {
577
+ true: "border-brand ring-2 ring-brand/15",
578
+ false: "border-medium hover:border-brand/40"
579
+ },
580
+ disabled: {
581
+ true: "cursor-not-allowed bg-primary hover:border-medium",
582
+ false: "cursor-pointer"
583
+ }
584
+ },
585
+ defaultVariants: {
586
+ size: "md",
587
+ focused: !1,
588
+ disabled: !1
589
+ }
590
+ });
591
+ //#endregion
592
+ export { ze as n, Be as t };
593
+
594
+ //# sourceMappingURL=colorpicker-CcizUCQv.js.map