@aurouscia/au-color-picker 0.5.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,17 +19,19 @@ import { AuColorPickerPresetsNested } from '@aurouscia/au-color-picker';
19
19
  ### 仅自定义
20
20
  ```vue
21
21
  <AuColorPicker
22
- :initial="初始值"
23
- @change="值变化回调"
24
- @done="面板关闭回调"
22
+ v-model="'绑定颜色值'"
23
+ :initial="'初始值(优先级低于v-model)'"
24
+ @done="'面板关闭回调'"
25
25
  ></AuColorPicker>
26
26
  ```
27
27
 
28
28
  ### 预设+自定义
29
+ ⚠️注意:“选中的预设”是与“自定义颜色”独立的两个状态
30
+ 这使得模型的颜色可以依赖于系统全局配置(预设的颜色)
29
31
  ```ts
30
32
  const presets:NamedPreset[] = [
31
33
  {
32
- name: '水系',
34
+ name: '水系', //名称不可重复
33
35
  colorHex: '#c3e5eb'
34
36
  },
35
37
  {
@@ -40,16 +42,16 @@ const presets:NamedPreset[] = [
40
42
  ```
41
43
  ```vue
42
44
  <AuColorPickerPresetsNested
43
- :initial="初始值"
44
- :presets="预设列表"
45
- :initial-selected-preset="初始选择预设"
46
- @change="值变化回调" @done="面板关闭回调"
47
- @presetSwitched="预设切换回调"
45
+ :presets="'预设列表'"
46
+ v-model="'绑定颜色值'"
47
+ :initial="'初始值(优先级低于v-model)'"
48
+ v-model:model-value-selected-preset="'绑定预设name'"
49
+ :initial-selected-preset="'初始选择预设(优先级低于v-model)'"
50
+ @done="'面板关闭回调'"
48
51
  ></AuColorPickerPresetsNested>
49
52
  ```
50
53
 
51
- ### 覆盖当前值
52
- 覆盖值并不会触发回调
54
+ ### 覆盖当前值(旧版,新版直接赋值v-model)
53
55
  ```ts
54
56
  const picker = ref<InstanceType<typeof AuColorPicker>>()
55
57
  const pickerNested = ref<InstanceType<typeof AuColorPickerPresetsNested>>()
@@ -75,7 +77,7 @@ export interface PickerProps{
75
77
  panelBaseZIndex?:number //面板的zIndex基础值
76
78
  entryRespondDelay?:number //入口按钮点击后,面板展开的延迟(ms)
77
79
  panelClickStopPropagation?:boolean //面板点击是否阻止冒泡
78
- showPackageName?:boolean //是否显示包名(帮我打广告)
80
+ showPackageName?:boolean //是否显示包名
79
81
  }
80
82
 
81
83
  //AuColorPickerPresetsNested的属性
@@ -1 +1 @@
1
- .acpRingBody[data-v-82766bce]{position:relative}canvas[data-v-82766bce]{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}[data-v-05bd433d]{margin:0;padding:0}.acpSep[data-v-05bd433d]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-05bd433d]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-05bd433d]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-05bd433d]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-05bd433d]:hover{color:#000}.acpEntry[data-v-05bd433d]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-05bd433d]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-05bd433d]{position:relative;width:fit-content}.acp label[data-v-05bd433d]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-05bd433d]{cursor:pointer}.acpPackageName[data-v-05bd433d]{position:absolute;left:2px;bottom:3px;font-size:8px;color:#ccc;text-align:right;cursor:pointer;-webkit-user-select:none;user-select:none}.acpParams[data-v-05bd433d]{display:flex;justify-content:space-between;align-items:center;padding:5px}.acpParams select[data-v-05bd433d],.acpParams input[data-v-05bd433d]{margin:0;padding:2px;display:block;font-size:16px;box-sizing:border-box;height:24px;line-height:24px}.acpParams select[data-v-05bd433d]{-webkit-user-select:none;user-select:none}.acpParams input[data-v-05bd433d]{text-align:center}.acpParams .acpSingleInput input[data-v-05bd433d]{width:120px}.acpParams .acpTripleInputs[data-v-05bd433d]{display:flex;justify-content:space-around}.acpParams .acpTripleInputs input[data-v-05bd433d]{width:40px}[data-v-e4dbdc46]{margin:0;padding:0}.acpSep[data-v-e4dbdc46]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-e4dbdc46]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-e4dbdc46]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-e4dbdc46]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-e4dbdc46]:hover{color:#000}.acpEntry[data-v-e4dbdc46]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-e4dbdc46]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-e4dbdc46]{position:relative;width:fit-content}.acp label[data-v-e4dbdc46]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-e4dbdc46]{cursor:pointer}.acpNamedPresets[data-v-e4dbdc46]{margin:5px;display:flex;flex-direction:column;gap:4px}.acpNamedPresets[data-v-e4dbdc46]>*{display:flex;justify-content:flex-start;align-items:center;gap:5px}.acpNamedPresets>* .acpPresetName[data-v-e4dbdc46]{color:#666}.acpNamedPresets>* .acpPresetName[data-v-e4dbdc46]:hover{color:#000}
1
+ .acpRingBody[data-v-183d2118]{position:relative}canvas[data-v-183d2118]{position:absolute;inset:0;width:100%;height:100%}[data-v-dc351014]{margin:0;padding:0}.acpSep[data-v-dc351014]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-dc351014]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-dc351014]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-dc351014]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-dc351014]:hover{color:#000}.acpEntry[data-v-dc351014]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-dc351014]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-dc351014]{position:relative;width:fit-content}.acp label[data-v-dc351014]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-dc351014]{cursor:pointer}.acpPackageName[data-v-dc351014]{position:absolute;left:2px;bottom:3px;font-size:8px;color:#ccc;text-align:right;cursor:pointer;-webkit-user-select:none;user-select:none}.acpParams[data-v-dc351014]{display:flex;justify-content:space-between;align-items:center;padding:5px}.acpParams select[data-v-dc351014],.acpParams input[data-v-dc351014]{margin:0;padding:2px;display:block;font-size:16px;box-sizing:border-box;height:24px;line-height:24px}.acpParams select[data-v-dc351014]{-webkit-user-select:none;user-select:none}.acpParams input[data-v-dc351014]{text-align:center}.acpParams .acpSingleInput input[data-v-dc351014]{width:120px}.acpParams .acpTripleInputs[data-v-dc351014]{display:flex;justify-content:space-around}.acpParams .acpTripleInputs input[data-v-dc351014]{width:40px}[data-v-6d20c9c4]{margin:0;padding:0}.acpSep[data-v-6d20c9c4]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-6d20c9c4]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-6d20c9c4]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-6d20c9c4]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-6d20c9c4]:hover{color:#000}.acpEntry[data-v-6d20c9c4]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-6d20c9c4]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-6d20c9c4]{position:relative;width:fit-content}.acp label[data-v-6d20c9c4]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-6d20c9c4]{cursor:pointer}.acpNamedPresets[data-v-6d20c9c4]{margin:5px;display:flex;flex-direction:column;gap:4px}.acpNamedPresets[data-v-6d20c9c4]>*{display:flex;justify-content:flex-start;align-items:center;gap:5px}.acpNamedPresets>* .acpPresetName[data-v-6d20c9c4]{color:#666}.acpNamedPresets>* .acpPresetName[data-v-6d20c9c4]:hover{color:#000}
@@ -1,202 +1,202 @@
1
- import { defineComponent as ee, ref as N, onMounted as me, onUnmounted as he, createElementBlock as _, openBlock as M, normalizeStyle as j, isRef as xe, createElementVNode as r, computed as F, onBeforeMount as re, watch as ue, createCommentVNode as G, unref as x, normalizeClass as Pe, createVNode as ce, withDirectives as J, vModelSelect as ke, vModelRadio as ne, Fragment as Ce, renderList as Se, toDisplayString as we } from "vue";
2
- import E from "color-convert";
3
- function Ie(u, y) {
4
- const P = u.x - y.x, c = u.y - y.y;
5
- return P ** 2 + c ** 2;
1
+ import { defineComponent as te, ref as I, onMounted as ye, onUnmounted as xe, createElementBlock as T, openBlock as N, normalizeStyle as X, isRef as Pe, createElementVNode as v, computed as F, onBeforeMount as ue, watch as j, createCommentVNode as J, unref as k, normalizeClass as he, createVNode as ce, withDirectives as Q, vModelSelect as ke, vModelRadio as oe, Fragment as Ce, renderList as Se, toDisplayString as we } from "vue";
2
+ import A from "color-convert";
3
+ function Ie(o, P) {
4
+ const m = o.x - P.x, t = o.y - P.y;
5
+ return m ** 2 + t ** 2;
6
6
  }
7
- function be(u, y) {
8
- const P = u.x - y.x, c = u.y - y.y;
9
- return Math.atan2(c, P);
7
+ function Ve(o, P) {
8
+ const m = o.x - P.x, t = o.y - P.y;
9
+ return Math.atan2(t, m);
10
10
  }
11
- const H = 400, z = 400, Y = 200, Be = 200, oe = 190, se = 150, O = 200, ae = 16, le = 3, De = /* @__PURE__ */ ee({
11
+ const D = 400, z = 400, G = 200, Be = 200, le = 190, se = 150, O = 200, ae = 16, ie = 3, be = /* @__PURE__ */ te({
12
12
  __name: "AuColorPickerRing",
13
13
  props: {
14
14
  initialHex: {}
15
15
  },
16
16
  emits: ["changed"],
17
- setup(u, { expose: y, emit: P }) {
18
- const c = N(), m = N();
19
- let a, v;
20
- const k = { x: 199, y: 199 }, L = (oe + se) / 2, X = oe ** 2, R = se ** 2, T = (H - O) / 2, b = T + O, C = N(0), w = N(100), A = N(100), q = u;
21
- let h;
22
- function $() {
23
- var s, f;
24
- const n = (s = c.value) == null ? void 0 : s.getContext("2d"), o = (f = m.value) == null ? void 0 : f.getContext("2d");
25
- if (!n || !o)
17
+ setup(o, { expose: P, emit: m }) {
18
+ const t = I(), g = I();
19
+ let i, u;
20
+ const C = { x: 199, y: 199 }, E = (le + se) / 2, $ = le ** 2, L = se ** 2, B = (D - O) / 2, H = B + O, h = I(0), w = I(100), R = I(100), b = o;
21
+ let y;
22
+ function c() {
23
+ const l = t.value?.getContext("2d"), s = g.value?.getContext("2d");
24
+ if (!l || !s)
26
25
  throw Error("canvas context getting error");
27
- if (q.initialHex) {
28
- const S = E.hex.hsv(q.initialHex);
29
- C.value = S[0], w.value = S[1], A.value = S[2];
26
+ if (b.initialHex) {
27
+ const a = A.hex.hsv(b.initialHex);
28
+ h.value = a[0], w.value = a[1], R.value = a[2];
30
29
  }
31
- a = n, v = o, h = a.getImageData(0, 0, H, z), i(), g(), K(), a.putImageData(h, 0, 0);
30
+ i = l, u = s, y = i.getImageData(0, 0, D, z), r(), x(), Y(), i.putImageData(y, 0, 0);
32
31
  }
33
- function i() {
34
- for (let n = 0; n < H; n++)
35
- for (let o = 0; o < z; o++) {
36
- const s = { x: n, y: o };
37
- if (d(s)) {
38
- const f = s.y * H * 4 + s.x * 4, S = l(s), V = E.hsv.rgb([S, 100, 100]);
39
- h.data[f] = V[0], h.data[f + 1] = V[1], h.data[f + 2] = V[2], h.data[f + 3] = 255;
32
+ function r() {
33
+ for (let l = 0; l < D; l++)
34
+ for (let s = 0; s < z; s++) {
35
+ const a = { x: l, y: s };
36
+ if (q(a)) {
37
+ const p = a.y * D * 4 + a.x * 4, V = d(a), U = A.hsv.rgb([V, 100, 100]);
38
+ y.data[p] = U[0], y.data[p + 1] = U[1], y.data[p + 2] = U[2], y.data[p + 3] = 255;
40
39
  }
41
40
  }
42
41
  }
43
- function l(n) {
44
- return 360 * ((be(n, k) + Math.PI) / (2 * Math.PI));
42
+ function d(l) {
43
+ return 360 * ((Ve(l, C) + Math.PI) / (2 * Math.PI));
45
44
  }
46
- function d(n) {
47
- const o = Ie(k, n);
48
- return o > R && o < X;
45
+ function q(l) {
46
+ const s = Ie(C, l);
47
+ return s > L && s < $;
49
48
  }
50
- function g() {
51
- for (let n = 0; n < H; n++)
52
- for (let o = 0; o < z; o++) {
53
- const s = { x: n, y: o };
54
- if (t(s)) {
55
- const f = s.y * H * 4 + s.x * 4, { s: S, v: V } = e(s), U = E.hsv.rgb([C.value, S, V]);
56
- h.data[f] = U[0], h.data[f + 1] = U[1], h.data[f + 2] = U[2], h.data[f + 3] = 255;
49
+ function x() {
50
+ for (let l = 0; l < D; l++)
51
+ for (let s = 0; s < z; s++) {
52
+ const a = { x: l, y: s };
53
+ if (n(a)) {
54
+ const p = a.y * D * 4 + a.x * 4, { s: V, v: U } = e(a), _ = A.hsv.rgb([h.value, V, U]);
55
+ y.data[p] = _[0], y.data[p + 1] = _[1], y.data[p + 2] = _[2], y.data[p + 3] = 255;
57
56
  }
58
57
  }
59
58
  }
60
- function e(n) {
61
- const o = n.x - T, s = n.y - T;
62
- let f = o / O, S = 1 - s / O;
63
- return f > 1 ? f = 1 : f < 0 && (f = 0), S > 1 ? S = 1 : S < 0 && (S = 0), { s: 100 * f, v: 100 * S };
59
+ function e(l) {
60
+ const s = l.x - B, a = l.y - B;
61
+ let p = s / O, V = 1 - a / O;
62
+ return p > 1 ? p = 1 : p < 0 && (p = 0), V > 1 ? V = 1 : V < 0 && (V = 0), { s: 100 * p, v: 100 * V };
64
63
  }
65
- function t(n) {
66
- return !(n.x < T || n.x > b || n.y < T || n.y > b);
64
+ function n(l) {
65
+ return !(l.x < B || l.x > H || l.y < B || l.y > H);
67
66
  }
68
- let B = !1, D = "none", p = !1;
69
- function I(n, o) {
70
- if (B || o && !p)
67
+ let M = !1, f = "none", S = I(!1);
68
+ function K(l, s) {
69
+ if (M || s && !S.value)
71
70
  return;
72
- B = !0;
73
- const s = fe(n);
74
- if (D === "none" && (t(s) ? D = "square" : d(s) && (D = "ring")), D === "ring" && (n.preventDefault(), C.value = l(s), g(), a.putImageData(h, 0, 0)), D === "square") {
75
- n.preventDefault();
76
- const f = e(s);
77
- w.value = f.s, A.value = f.v;
71
+ M = !0;
72
+ const a = fe(l);
73
+ if (f === "none" && (n(a) ? f = "square" : q(a) && (f = "ring")), f === "ring" && (l.preventDefault(), h.value = d(a), x(), i.putImageData(y, 0, 0)), f === "square") {
74
+ l.preventDefault();
75
+ const p = e(a);
76
+ w.value = p.s, R.value = p.v;
78
77
  }
79
- D !== "none" && K(!0), B = !1;
78
+ f !== "none" && Y(!0), M = !1;
80
79
  }
81
80
  function Z() {
82
- D = "none", p = !1;
81
+ f = "none", S.value = !1;
83
82
  }
84
- function fe(n) {
85
- let o, s;
86
- if (!c.value)
83
+ function fe(l) {
84
+ let s, a;
85
+ if (!t.value)
87
86
  return { x: -1, y: -1 };
88
- if ("touches" in n) {
89
- const f = c.value.getBoundingClientRect();
90
- o = n.touches[0].clientX - f.left, s = n.touches[0].clientY - f.top;
87
+ if ("touches" in l) {
88
+ const p = t.value.getBoundingClientRect();
89
+ s = l.touches[0].clientX - p.left, a = l.touches[0].clientY - p.top;
91
90
  } else
92
- o = n.offsetX, s = n.offsetY;
93
- return o = o * H / Y, s = s * H / Y, { x: o, y: s };
91
+ s = l.offsetX, a = l.offsetY;
92
+ return s = s * D / G, a = a * D / G, { x: s, y: a };
94
93
  }
95
- function K(n) {
96
- if (n) {
97
- const ye = E.hsv.hex([C.value, w.value, A.value]);
98
- ge("changed", ye);
94
+ function Y(l) {
95
+ if (l) {
96
+ const ge = A.hsv.hex([h.value, w.value, R.value]);
97
+ me("changed", ge);
99
98
  }
100
- const o = (C.value / 360 * 2 + 1) * Math.PI, s = Math.cos(o) * L + H / 2, f = Math.sin(o) * L + z / 2, S = w.value / 100 * O + T, V = (1 - A.value / 100) * O + T;
101
- v.reset(), v.lineWidth = 4, v.strokeStyle = "black", v.beginPath(), v.arc(s, f, ae - 2, 0, 2 * Math.PI), v.stroke(), v.beginPath(), v.arc(s, f, le, 0, 2 * Math.PI), v.fill();
102
- const U = A.value > 50 ? "black" : "#ddd";
103
- v.strokeStyle = U, v.fillStyle = U, v.beginPath(), v.arc(S, V, ae - 2, 0, 2 * Math.PI), v.stroke(), v.beginPath(), v.arc(S, V, le, 0, 2 * Math.PI), v.fill();
99
+ const s = (h.value / 360 * 2 + 1) * Math.PI, a = Math.cos(s) * E + D / 2, p = Math.sin(s) * E + z / 2, V = w.value / 100 * O + B, U = (1 - R.value / 100) * O + B;
100
+ u.reset(), u.lineWidth = 4, u.strokeStyle = "black", u.beginPath(), u.arc(a, p, ae - 2, 0, 2 * Math.PI), u.stroke(), u.beginPath(), u.arc(a, p, ie, 0, 2 * Math.PI), u.fill();
101
+ const _ = R.value > 50 ? "black" : "#ddd";
102
+ u.strokeStyle = _, u.fillStyle = _, u.beginPath(), u.arc(V, U, ae - 2, 0, 2 * Math.PI), u.stroke(), u.beginPath(), u.arc(V, U, ie, 0, 2 * Math.PI), u.fill();
104
103
  }
105
- function pe(n) {
106
- const o = E.hex.hsv(n);
107
- C.value = o[0], w.value = o[1], A.value = o[2], g(), a.putImageData(h, 0, 0), K();
104
+ function pe(l) {
105
+ const s = A.hex.hsv(l);
106
+ h.value = s[0], w.value = s[1], R.value = s[2], x(), i.putImageData(y, 0, 0), Y();
108
107
  }
109
- const ge = P;
110
- return y({ enforceTo: pe }), me(() => {
111
- $(), window.addEventListener("touchend", Z), window.addEventListener("mouseup", Z);
112
- }), he(() => {
108
+ const me = m;
109
+ return P({ enforceTo: pe }), ye(() => {
110
+ c(), window.addEventListener("touchend", Z), window.addEventListener("mouseup", Z);
111
+ }), xe(() => {
113
112
  window.removeEventListener("touchend", Z), window.removeEventListener("mouseup", Z);
114
- }), (n, o) => (M(), _("div", {
113
+ }), (l, s) => (N(), T("div", {
115
114
  class: "acpRingBody",
116
- style: j({ width: Y + "px", height: Be + "px" }),
117
- onTouchstart: I,
118
- onTouchmove: I,
115
+ style: X({ width: G + "px", height: Be + "px" }),
116
+ onTouchstart: K,
117
+ onTouchmove: K,
119
118
  onTouchend: Z,
120
- onMousemove: o[0] || (o[0] = (s) => I(s, !0)),
121
- onMousedown: o[1] || (o[1] = (s) => {
122
- I(s), xe(p) ? p.value = !0 : p = !0;
119
+ onMousemove: s[0] || (s[0] = (a) => K(a, !0)),
120
+ onMousedown: s[1] || (s[1] = (a) => {
121
+ K(a), Pe(S) ? S.value = !0 : S = !0;
123
122
  })
124
123
  }, [
125
- r("canvas", {
126
- width: H,
124
+ v("canvas", {
125
+ width: D,
127
126
  height: z,
128
127
  ref_key: "cvs",
129
- ref: c
128
+ ref: t
130
129
  }, null, 512),
131
- r("canvas", {
132
- width: H,
130
+ v("canvas", {
131
+ width: D,
133
132
  height: z,
134
133
  ref_key: "cursorCvs",
135
- ref: m
134
+ ref: g
136
135
  }, null, 512)
137
136
  ], 36));
138
137
  }
139
- }), te = (u, y) => {
140
- const P = u.__vccOpts || u;
141
- for (const [c, m] of y)
142
- P[c] = m;
143
- return P;
144
- }, Te = /* @__PURE__ */ te(De, [["__scopeId", "data-v-82766bce"]]);
145
- function Q(u) {
146
- return /^#([0-9A-F]{3}){1,2}$/i.test(u);
138
+ }), ne = (o, P) => {
139
+ const m = o.__vccOpts || o;
140
+ for (const [t, g] of P)
141
+ m[t] = g;
142
+ return m;
143
+ }, De = /* @__PURE__ */ ne(be, [["__scopeId", "data-v-183d2118"]]);
144
+ function ee(o) {
145
+ return /^#([0-9A-F]{3}){1,2}$/i.test(o);
147
146
  }
148
- function ve(u) {
149
- const y = N(!1), P = N("#ff0000"), c = F(() => {
150
- let k = {};
151
- return y.value || (k.boxShadow = "none"), u.entryStyles && Object.assign(k, u.entryStyles), y.value && (k.transition = "0s", Object.assign(k, u.entryActiveStyles)), k.backgroundColor = P.value, k;
147
+ function de(o, P) {
148
+ const m = I(!1), t = F(() => {
149
+ let C = {};
150
+ return m.value || (C.boxShadow = "none"), o.entryStyles && Object.assign(C, o.entryStyles), m.value && (C.transition = "0s", Object.assign(C, o.entryActiveStyles)), C.backgroundColor = P.value, C;
152
151
  });
153
- function m() {
154
- y.value = !1;
152
+ function g() {
153
+ m.value = !1;
155
154
  }
156
- let a = 0;
157
- function v() {
158
- if (u.entryRespondDelay && (window.clearTimeout(a), !y.value)) {
159
- a = window.setTimeout(() => {
160
- y.value = !0;
161
- }, u.entryRespondDelay);
155
+ let i = 0;
156
+ function u() {
157
+ if (o.entryRespondDelay && (window.clearTimeout(i), !m.value)) {
158
+ i = window.setTimeout(() => {
159
+ m.value = !0;
160
+ }, o.entryRespondDelay);
162
161
  return;
163
162
  }
164
- y.value = !y.value;
163
+ m.value = !m.value;
165
164
  }
166
- return { hexValue: P, panelShow: y, closePanel: m, togglePanel: v, entryStylesActual: c };
165
+ return { panelShow: m, closePanel: g, togglePanel: u, entryStylesActual: t };
167
166
  }
168
- function ie() {
167
+ function re() {
169
168
  window.alert("https://www.npmjs.com/package/@aurouscia/au-color-picker");
170
169
  }
171
- function W(u) {
172
- return u.startsWith("#") ? u.toUpperCase() : "#" + u.toUpperCase();
170
+ function W(o) {
171
+ return o.startsWith("#") ? o.toUpperCase() : "#" + o.toUpperCase();
173
172
  }
174
- function de(u) {
173
+ function ve(o) {
175
174
  return {
176
175
  panelStyles: F(() => {
177
- const P = u.panelBaseZIndex;
178
- let c, m;
179
- const a = u.pos;
180
- return typeof a == "number" ? c = a + "px" : a == "left" ? m = "0px" : c = "0px", {
181
- zIndex: (P || 0) + 100,
182
- left: c,
183
- right: m
176
+ const m = o.panelBaseZIndex;
177
+ let t, g;
178
+ const i = o.pos;
179
+ return typeof i == "number" ? t = i + "px" : i == "left" ? g = "0px" : t = "0px", {
180
+ zIndex: (m || 0) + 100,
181
+ left: t,
182
+ right: g
184
183
  };
185
184
  })
186
185
  };
187
186
  }
188
- const Ne = { class: "acp" }, Re = { class: "acpRing" }, He = { class: "acpParams" }, _e = {
187
+ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams" }, He = {
189
188
  key: 0,
190
189
  class: "acpSingleInput"
191
190
  }, Me = ["value"], Ae = {
192
191
  key: 1,
193
192
  class: "acpTripleInputs"
194
- }, $e = ["value"], Ee = ["value"], qe = ["value"], Ve = {
193
+ }, Ee = ["value"], $e = ["value"], qe = ["value"], Ue = {
195
194
  key: 2,
196
195
  class: "acpTripleInputs"
197
- }, Le = ["value"], Ue = ["value"], ze = ["value"], Oe = { class: "acpDoneBtn" }, We = /* @__PURE__ */ ee({
196
+ }, Le = ["value"], _e = ["value"], ze = ["value"], Oe = { class: "acpDoneBtn" }, We = /* @__PURE__ */ te({
198
197
  __name: "AuColorPicker",
199
198
  props: {
199
+ modelValue: {},
200
200
  initial: {},
201
201
  entryStyles: {},
202
202
  entryActiveStyles: {},
@@ -207,168 +207,168 @@ const Ne = { class: "acp" }, Re = { class: "acpRing" }, He = { class: "acpParams
207
207
  panelClickStopPropagation: { type: Boolean },
208
208
  showPackageName: { type: Boolean }
209
209
  },
210
- emits: ["change", "done"],
211
- setup(u, { expose: y, emit: P }) {
212
- const c = u, m = N(), { hexValue: a, panelShow: v, closePanel: k, togglePanel: L, entryStylesActual: X } = ve(c), { panelStyles: R } = de(c);
213
- function T(g) {
214
- a.value = W(g), $();
210
+ emits: ["done", "update:modelValue"],
211
+ setup(o, { expose: P, emit: m }) {
212
+ const t = o, g = I(), i = I("#ff0000"), { panelShow: u, closePanel: C, togglePanel: E, entryStylesActual: $ } = de(t, i), { panelStyles: L } = ve(t);
213
+ function B(x) {
214
+ i.value = W(x), c();
215
215
  }
216
- const b = N("hex"), C = F(() => E.hex.rgb(a.value)), w = F(() => E.hex.hsv(a.value));
217
- function A(g) {
218
- var t;
219
- const e = g.target;
216
+ const H = I("hex"), h = F(() => A.hex.rgb(i.value)), w = F(() => A.hex.hsv(i.value));
217
+ function R(x) {
218
+ const e = x.target;
220
219
  if ("value" in e) {
221
- const B = e.value;
222
- if (B && Q(B)) {
223
- a.value = W(B), (t = m.value) == null || t.enforceTo(a.value), $();
220
+ const n = e.value;
221
+ if (n && ee(n)) {
222
+ i.value = W(n), g.value?.enforceTo(i.value), c();
224
223
  return;
225
224
  }
226
- e.value = a.value;
225
+ e.value = i.value;
227
226
  }
228
227
  }
229
- function q(g, e) {
230
- var B;
231
- const t = g.target;
232
- if ("value" in t) {
233
- const D = t.value;
234
- if (D) {
235
- let p = parseInt(D);
236
- if (isNaN(p))
237
- t.value = "0";
228
+ function b(x, e) {
229
+ const n = x.target;
230
+ if ("value" in n) {
231
+ const M = n.value;
232
+ if (M) {
233
+ let f = parseInt(M);
234
+ if (isNaN(f))
235
+ n.value = "0";
238
236
  else {
239
- p > 255 ? p = 255 : p < 0 && (p = 0);
240
- const I = [...C.value];
241
- e == "r" ? I[0] = p : e == "g" ? I[1] = p : I[2] = p, a.value = W(E.rgb.hex(I)), (B = m.value) == null || B.enforceTo(a.value), t.value = p.toString(), $();
237
+ f > 255 ? f = 255 : f < 0 && (f = 0);
238
+ const S = [...h.value];
239
+ e == "r" ? S[0] = f : e == "g" ? S[1] = f : S[2] = f, i.value = W(A.rgb.hex(S)), g.value?.enforceTo(i.value), n.value = f.toString(), c();
242
240
  return;
243
241
  }
244
242
  }
245
243
  }
246
244
  }
247
- function h(g, e) {
248
- var B;
249
- const t = g.target;
250
- if ("value" in t) {
251
- const D = t.value;
252
- if (D) {
253
- let p = parseInt(D);
254
- if (isNaN(p))
255
- t.value = "0";
245
+ function y(x, e) {
246
+ const n = x.target;
247
+ if ("value" in n) {
248
+ const M = n.value;
249
+ if (M) {
250
+ let f = parseInt(M);
251
+ if (isNaN(f))
252
+ n.value = "0";
256
253
  else {
257
- e === "h" ? p > 359 && (p = 359) : p > 100 && (p = 100), p < 0 && (p = 0);
258
- const I = [...w.value];
259
- e == "h" ? I[0] = p : e == "s" ? I[1] = p : I[2] = p, a.value = W(E.hsv.hex(I)), t.value = p.toString(), (B = m.value) == null || B.enforceTo(a.value), $();
254
+ e === "h" ? f > 359 && (f = 359) : f > 100 && (f = 100), f < 0 && (f = 0);
255
+ const S = [...w.value];
256
+ e == "h" ? S[0] = f : e == "s" ? S[1] = f : S[2] = f, i.value = W(A.hsv.hex(S)), n.value = f.toString(), g.value?.enforceTo(i.value), c();
260
257
  return;
261
258
  }
262
259
  }
263
260
  }
264
261
  }
265
- function $() {
266
- d("change", a.value);
262
+ function c() {
263
+ q("update:modelValue", i.value);
267
264
  }
268
- function i() {
269
- return a.value;
265
+ function r() {
266
+ return i.value;
270
267
  }
271
- function l(g) {
272
- var e;
273
- if (Q(g)) {
274
- const t = W(g);
275
- a.value = t, (e = m.value) == null || e.enforceTo(t);
268
+ function d(x) {
269
+ if (ee(x)) {
270
+ const e = W(x);
271
+ i.value = e, g.value?.enforceTo(e);
276
272
  }
277
273
  }
278
- re(() => {
279
- c.initial && l(c.initial);
274
+ ue(() => {
275
+ t.modelValue ? d(t.modelValue) : t.initial && d(t.initial);
280
276
  });
281
- const d = P;
282
- return y({ closePanel: k, getCurrentHex: i, enforceTo: l }), ue(v, (g) => {
283
- g === !1 && d("done", a.value);
284
- }), (g, e) => (M(), _("div", Ne, [
285
- r("div", {
286
- class: Pe(g.entryClassName || "acpEntry"),
287
- style: j(x(X)),
277
+ const q = m;
278
+ return P({ closePanel: C, getCurrentHex: r, enforceTo: d }), j(() => t.modelValue, (x) => {
279
+ x && x !== i.value && d(x);
280
+ }), j(u, (x) => {
281
+ x === !1 && q("done");
282
+ }), (x, e) => (N(), T("div", Te, [
283
+ v("div", {
284
+ class: he(o.entryClassName || "acpEntry"),
285
+ style: X(k($)),
288
286
  onClick: e[0] || (e[0] = //@ts-ignore
289
- (...t) => x(L) && x(L)(...t))
287
+ (...n) => k(E) && k(E)(...n))
290
288
  }, null, 6),
291
- x(v) ? (M(), _("div", {
289
+ k(u) ? (N(), T("div", {
292
290
  key: 0,
293
291
  class: "acpPanel",
294
- style: j(x(R)),
295
- onClick: e[10] || (e[10] = (t) => g.panelClickStopPropagation && t.stopPropagation())
292
+ style: X(k(L)),
293
+ onClick: e[10] || (e[10] = (n) => o.panelClickStopPropagation && n.stopPropagation())
296
294
  }, [
297
- r("div", Re, [
298
- ce(Te, {
295
+ v("div", Ne, [
296
+ ce(De, {
299
297
  ref_key: "ring",
300
- ref: m,
301
- "initial-hex": x(a),
302
- onChanged: T,
303
- "show-package-name": g.showPackageName
298
+ ref: g,
299
+ "initial-hex": i.value,
300
+ onChanged: B,
301
+ "show-package-name": o.showPackageName
304
302
  }, null, 8, ["initial-hex", "show-package-name"])
305
303
  ]),
306
- r("div", He, [
307
- J(r("select", {
308
- "onUpdate:modelValue": e[1] || (e[1] = (t) => b.value = t)
309
- }, e[11] || (e[11] = [
310
- r("option", { value: "hex" }, "HEX", -1),
311
- r("option", { value: "rgb" }, "RGB", -1),
312
- r("option", { value: "hsv" }, "HSV", -1)
313
- ]), 512), [
314
- [ke, b.value]
304
+ v("div", Re, [
305
+ Q(v("select", {
306
+ "onUpdate:modelValue": e[1] || (e[1] = (n) => H.value = n)
307
+ }, [...e[11] || (e[11] = [
308
+ v("option", { value: "hex" }, "HEX", -1),
309
+ v("option", { value: "rgb" }, "RGB", -1),
310
+ v("option", { value: "hsv" }, "HSV", -1)
311
+ ])], 512), [
312
+ [ke, H.value]
315
313
  ]),
316
- b.value == "hex" ? (M(), _("div", _e, [
317
- r("input", {
318
- value: x(a),
319
- onBlur: A,
314
+ H.value == "hex" ? (N(), T("div", He, [
315
+ v("input", {
316
+ value: i.value,
317
+ onBlur: R,
320
318
  spellcheck: "false",
321
319
  maxlength: "7"
322
320
  }, null, 40, Me)
323
- ])) : b.value == "rgb" ? (M(), _("div", Ae, [
324
- r("input", {
325
- value: C.value[0],
326
- onBlur: e[2] || (e[2] = (t) => q(t, "r"))
327
- }, null, 40, $e),
328
- r("input", {
329
- value: C.value[1],
330
- onBlur: e[3] || (e[3] = (t) => q(t, "g"))
321
+ ])) : H.value == "rgb" ? (N(), T("div", Ae, [
322
+ v("input", {
323
+ value: h.value[0],
324
+ onBlur: e[2] || (e[2] = (n) => b(n, "r"))
331
325
  }, null, 40, Ee),
332
- r("input", {
333
- value: C.value[2],
334
- onBlur: e[4] || (e[4] = (t) => q(t, "b"))
326
+ v("input", {
327
+ value: h.value[1],
328
+ onBlur: e[3] || (e[3] = (n) => b(n, "g"))
329
+ }, null, 40, $e),
330
+ v("input", {
331
+ value: h.value[2],
332
+ onBlur: e[4] || (e[4] = (n) => b(n, "b"))
335
333
  }, null, 40, qe)
336
- ])) : (M(), _("div", Ve, [
337
- r("input", {
334
+ ])) : (N(), T("div", Ue, [
335
+ v("input", {
338
336
  value: w.value[0],
339
- onBlur: e[5] || (e[5] = (t) => h(t, "h"))
337
+ onBlur: e[5] || (e[5] = (n) => y(n, "h"))
340
338
  }, null, 40, Le),
341
- r("input", {
339
+ v("input", {
342
340
  value: w.value[1],
343
- onBlur: e[6] || (e[6] = (t) => h(t, "s"))
344
- }, null, 40, Ue),
345
- r("input", {
341
+ onBlur: e[6] || (e[6] = (n) => y(n, "s"))
342
+ }, null, 40, _e),
343
+ v("input", {
346
344
  value: w.value[2],
347
- onBlur: e[7] || (e[7] = (t) => h(t, "v"))
345
+ onBlur: e[7] || (e[7] = (n) => y(n, "v"))
348
346
  }, null, 40, ze)
349
347
  ]))
350
348
  ]),
351
- r("div", Oe, [
352
- r("button", {
349
+ v("div", Oe, [
350
+ v("button", {
353
351
  onClick: e[8] || (e[8] = //@ts-ignore
354
- (...t) => x(k) && x(k)(...t))
352
+ (...n) => k(C) && k(C)(...n))
355
353
  }, "OK")
356
354
  ]),
357
- g.showPackageName ? (M(), _("div", {
355
+ o.showPackageName ? (N(), T("div", {
358
356
  key: 0,
359
357
  class: "acpPackageName",
360
358
  onClick: e[9] || (e[9] = //@ts-ignore
361
- (...t) => x(ie) && x(ie)(...t))
362
- }, " au-color-picker ")) : G("", !0)
363
- ], 4)) : G("", !0)
359
+ (...n) => k(re) && k(re)(...n))
360
+ }, " au-color-picker ")) : J("", !0)
361
+ ], 4)) : J("", !0)
364
362
  ]));
365
363
  }
366
- }), je = /* @__PURE__ */ te(We, [["__scopeId", "data-v-05bd433d"]]), Xe = { class: "acp" }, Ze = { class: "acpNamedPresets" }, Fe = { for: "acpColorPresetCustom" }, Ke = ["for"], Ye = ["id", "value", "onClick"], Ge = { class: "acpPresetName" }, Je = { class: "acpDoneBtn" }, Qe = /* @__PURE__ */ ee({
364
+ }), je = /* @__PURE__ */ ne(We, [["__scopeId", "data-v-dc351014"]]), Xe = { class: "acp" }, Ze = { class: "acpNamedPresets" }, Fe = ["for", "onClick"], Ke = ["id", "value"], Ye = { class: "acpPresetName" }, Ge = { class: "acpDoneBtn" }, Je = /* @__PURE__ */ te({
367
365
  __name: "AuColorPickerPresetsNested",
368
366
  props: {
367
+ modelValueSelectedPreset: {},
369
368
  initialSelectedPreset: {},
370
369
  presets: {},
371
370
  posInternal: {},
371
+ modelValue: {},
372
372
  initial: {},
373
373
  entryStyles: {},
374
374
  entryActiveStyles: {},
@@ -379,107 +379,115 @@ const Ne = { class: "acp" }, Re = { class: "acpRing" }, He = { class: "acpParams
379
379
  panelClickStopPropagation: { type: Boolean },
380
380
  showPackageName: { type: Boolean }
381
381
  },
382
- emits: ["change", "done", "presetSwitched"],
383
- setup(u, { expose: y, emit: P }) {
384
- const c = u, { hexValue: m, panelShow: a, closePanel: v, togglePanel: k, entryStylesActual: L } = ve(c), { panelStyles: X } = de(c), R = N(), T = N(), b = N("#ff0000");
385
- function C(i, l) {
386
- i ? (R.value = i.name, m.value = i.colorHex) : (R.value = void 0, m.value = b.value), l || w("presetSwitched", i == null ? void 0 : i.name);
387
- }
388
- const w = P;
389
- function A(i) {
390
- m.value = i, b.value = i, w("change", i);
382
+ emits: ["done", "update:modelValue", "update:modelValueSelectedPreset"],
383
+ setup(o, { expose: P, emit: m }) {
384
+ const t = o, g = I(), i = I(), u = I("#ff0000"), C = F(() => {
385
+ let c = null;
386
+ return g.value && (c = t.presets?.find((d) => d.name == g.value)?.colorHex), c || u.value;
387
+ }), { panelShow: E, closePanel: $, togglePanel: L, entryStylesActual: B } = de(t, C), { panelStyles: H } = ve(t);
388
+ function h(c) {
389
+ g.value = c?.name, w("update:modelValueSelectedPreset", c?.name);
391
390
  }
392
- function q(i) {
393
- m.value = i, b.value = i, v();
391
+ const w = m;
392
+ j(u, (c) => {
393
+ w("update:modelValue", c);
394
+ });
395
+ function R(c) {
396
+ u.value = c, $();
394
397
  }
395
- function h(i) {
396
- var l;
397
- if (Q(i)) {
398
- const d = W(i);
399
- b.value = d, (l = T.value) == null || l.enforceTo(d), R.value || (m.value = d);
398
+ function b(c) {
399
+ if (ee(c)) {
400
+ const r = W(c);
401
+ u.value = r, i.value?.enforceTo(r);
400
402
  }
401
403
  }
402
- function $(i) {
403
- var d;
404
- i || C(void 0, !0);
405
- const l = (d = c.presets) == null ? void 0 : d.find((g) => g.name === i);
406
- l && C(l, !0);
404
+ function y(c) {
405
+ c || h(void 0);
406
+ const r = t.presets?.find((d) => d.name === c);
407
+ r && h(r);
407
408
  }
408
- return y({ closePanel: v, enforceCustomValueTo: h, enforcePresetTo: $ }), ue(a, (i) => {
409
- i === !1 && w("done", m.value);
410
- }), re(() => {
411
- c.initial && h(c.initial), c.initialSelectedPreset && $(c.initialSelectedPreset);
412
- }), (i, l) => (M(), _("div", Xe, [
413
- r("div", {
409
+ return P({ closePanel: $, enforceCustomValueTo: b, enforcePresetTo: y }), j(E, (c) => {
410
+ c === !1 && w("done");
411
+ }), j(() => t.modelValue, (c) => {
412
+ c && b(c);
413
+ }), j(() => t.modelValueSelectedPreset, (c) => {
414
+ y(c);
415
+ }), ue(() => {
416
+ t.modelValue ? b(t.modelValue) : t.initial && b(t.initial), t.modelValueSelectedPreset ? y(t.modelValueSelectedPreset) : t.initialSelectedPreset && y(t.initialSelectedPreset);
417
+ }), (c, r) => (N(), T("div", Xe, [
418
+ v("div", {
414
419
  class: "acpEntry",
415
- style: j(x(L)),
416
- onClick: l[0] || (l[0] = //@ts-ignore
417
- (...d) => x(k) && x(k)(...d))
420
+ style: X(k(B)),
421
+ onClick: r[0] || (r[0] = //@ts-ignore
422
+ (...d) => k(L) && k(L)(...d))
418
423
  }, null, 4),
419
- x(a) ? (M(), _("div", {
424
+ k(E) ? (N(), T("div", {
420
425
  key: 0,
421
426
  class: "acpPanel",
422
- style: j(x(X)),
423
- onClick: l[5] || (l[5] = (d) => i.panelClickStopPropagation && d.stopPropagation())
427
+ style: X(k(H)),
428
+ onClick: r[6] || (r[6] = (d) => o.panelClickStopPropagation && d.stopPropagation())
424
429
  }, [
425
- r("div", Ze, [
426
- r("label", Fe, [
430
+ v("div", Ze, [
431
+ v("label", {
432
+ for: "acpColorPresetCustom",
433
+ onClick: r[3] || (r[3] = (d) => h(void 0))
434
+ }, [
427
435
  ce(je, {
428
- initial: b.value,
429
- onChange: A,
430
- onDone: q,
436
+ modelValue: u.value,
437
+ "onUpdate:modelValue": r[1] || (r[1] = (d) => u.value = d),
438
+ onDone: R,
431
439
  "entry-class-name": "acpPresetBody",
432
440
  ref_key: "customPicker",
433
- ref: T,
434
- "show-package-name": i.showPackageName,
435
- pos: i.posInternal
436
- }, null, 8, ["initial", "show-package-name", "pos"]),
437
- J(r("input", {
441
+ ref: i,
442
+ "show-package-name": o.showPackageName,
443
+ pos: o.posInternal
444
+ }, null, 8, ["modelValue", "show-package-name", "pos"]),
445
+ Q(v("input", {
438
446
  name: "colorType",
439
447
  type: "radio",
440
448
  id: "acpColorPresetCustom",
441
449
  value: void 0,
442
- "onUpdate:modelValue": l[1] || (l[1] = (d) => R.value = d),
443
- onClick: l[2] || (l[2] = (d) => C())
450
+ "onUpdate:modelValue": r[2] || (r[2] = (d) => g.value = d)
444
451
  }, null, 512), [
445
- [ne, R.value]
452
+ [oe, g.value]
446
453
  ]),
447
- l[6] || (l[6] = r("div", { class: "acpPresetName" }, "自定义", -1))
454
+ r[7] || (r[7] = v("div", { class: "acpPresetName" }, "自定义", -1))
448
455
  ]),
449
- l[7] || (l[7] = r("div", { class: "acpSep" }, null, -1)),
450
- (M(!0), _(Ce, null, Se(i.presets, (d) => (M(), _("label", {
451
- for: `acpColorPreset${d.name}`
456
+ r[8] || (r[8] = v("div", { class: "acpSep" }, null, -1)),
457
+ (N(!0), T(Ce, null, Se(o.presets, (d) => (N(), T("label", {
458
+ for: `acpColorPreset${d.name}`,
459
+ onClick: (q) => h(d),
460
+ key: d.name
452
461
  }, [
453
- r("div", {
462
+ v("div", {
454
463
  class: "acpPresetBody",
455
- style: j({ backgroundColor: d.colorHex })
464
+ style: X({ backgroundColor: d.colorHex })
456
465
  }, null, 4),
457
- J(r("input", {
466
+ Q(v("input", {
458
467
  name: "colorType",
459
468
  type: "radio",
460
469
  id: `acpColorPreset${d.name}`,
461
470
  value: d.name,
462
- "onUpdate:modelValue": l[3] || (l[3] = (g) => R.value = g),
463
- onClick: (g) => C(d)
464
- }, null, 8, Ye), [
465
- [ne, R.value]
471
+ "onUpdate:modelValue": r[4] || (r[4] = (q) => g.value = q)
472
+ }, null, 8, Ke), [
473
+ [oe, g.value]
466
474
  ]),
467
- r("div", Ge, we(d.name), 1)
468
- ], 8, Ke))), 256)),
469
- l[8] || (l[8] = r("div", { class: "acpSep" }, null, -1))
475
+ v("div", Ye, we(d.name), 1)
476
+ ], 8, Fe))), 128)),
477
+ r[9] || (r[9] = v("div", { class: "acpSep" }, null, -1))
470
478
  ]),
471
- r("div", Je, [
472
- r("button", {
473
- onClick: l[4] || (l[4] = //@ts-ignore
474
- (...d) => x(v) && x(v)(...d))
479
+ v("div", Ge, [
480
+ v("button", {
481
+ onClick: r[5] || (r[5] = //@ts-ignore
482
+ (...d) => k($) && k($)(...d))
475
483
  }, "OK")
476
484
  ])
477
- ], 4)) : G("", !0)
485
+ ], 4)) : J("", !0)
478
486
  ]));
479
487
  }
480
- }), nt = /* @__PURE__ */ te(Qe, [["__scopeId", "data-v-e4dbdc46"]]);
488
+ }), tt = /* @__PURE__ */ ne(Je, [["__scopeId", "data-v-6d20c9c4"]]);
481
489
  export {
482
490
  je as AuColorPicker,
483
- nt as AuColorPickerPresetsNested,
484
- Te as AuColorPickerRing
491
+ tt as AuColorPickerPresetsNested,
492
+ De as AuColorPickerRing
485
493
  };
@@ -7,11 +7,11 @@ declare const _default: import('vue').DefineComponent<PickerProps, {
7
7
  getCurrentHex: typeof getCurrentHex;
8
8
  enforceTo: typeof enforceTo;
9
9
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
10
- done: (hexStr: string) => any;
11
- change: (hexStr: string) => any;
10
+ done: () => any;
11
+ "update:modelValue": (hexStr: string) => any;
12
12
  }, string, import('vue').PublicProps, Readonly<PickerProps> & Readonly<{
13
- onDone?: ((hexStr: string) => any) | undefined;
14
- onChange?: ((hexStr: string) => any) | undefined;
13
+ onDone?: (() => any) | undefined;
14
+ "onUpdate:modelValue"?: ((hexStr: string) => any) | undefined;
15
15
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
16
16
  ring: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
17
17
  initialHex?: string;
@@ -6,24 +6,24 @@ declare const _default: import('vue').DefineComponent<PickerWithPresetsProps, {
6
6
  enforceCustomValueTo: typeof enforceCustomValueTo;
7
7
  enforcePresetTo: typeof enforcePresetTo;
8
8
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
9
- done: (hexStr: string) => any;
10
- change: (hexStr: string) => any;
11
- presetSwitched: (name: string | undefined) => any;
9
+ done: () => any;
10
+ "update:modelValue": (hexStr: string) => any;
11
+ "update:modelValueSelectedPreset": (name: string | undefined) => any;
12
12
  }, string, import('vue').PublicProps, Readonly<PickerWithPresetsProps> & Readonly<{
13
- onDone?: ((hexStr: string) => any) | undefined;
14
- onChange?: ((hexStr: string) => any) | undefined;
15
- onPresetSwitched?: ((name: string | undefined) => any) | undefined;
13
+ onDone?: (() => any) | undefined;
14
+ "onUpdate:modelValue"?: ((hexStr: string) => any) | undefined;
15
+ "onUpdate:modelValueSelectedPreset"?: ((name: string | undefined) => any) | undefined;
16
16
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
17
17
  customPicker: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').PickerProps> & Readonly<{
18
- onDone?: ((hexStr: string) => any) | undefined;
19
- onChange?: ((hexStr: string) => any) | undefined;
18
+ onDone?: (() => any) | undefined;
19
+ "onUpdate:modelValue"?: ((hexStr: string) => any) | undefined;
20
20
  }>, {
21
21
  closePanel: () => void;
22
22
  getCurrentHex: () => string;
23
23
  enforceTo: (newHexValue: string) => void;
24
24
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
25
- done: (hexStr: string) => any;
26
- change: (hexStr: string) => any;
25
+ done: () => any;
26
+ "update:modelValue": (hexStr: string) => any;
27
27
  }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
28
28
  ring: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
29
29
  initialHex?: string;
@@ -58,8 +58,8 @@ declare const _default: import('vue').DefineComponent<PickerWithPresetsProps, {
58
58
  M: {};
59
59
  Defaults: {};
60
60
  }, Readonly<import('..').PickerProps> & Readonly<{
61
- onDone?: ((hexStr: string) => any) | undefined;
62
- onChange?: ((hexStr: string) => any) | undefined;
61
+ onDone?: (() => any) | undefined;
62
+ "onUpdate:modelValue"?: ((hexStr: string) => any) | undefined;
63
63
  }>, {
64
64
  closePanel: () => void;
65
65
  getCurrentHex: () => string;
@@ -1,6 +1,7 @@
1
1
  import { CSSProperties } from 'vue';
2
2
  type Pos = 'left' | 'right' | number;
3
3
  export interface PickerProps {
4
+ modelValue?: string;
4
5
  initial?: string;
5
6
  entryStyles?: CSSProperties;
6
7
  entryActiveStyles?: CSSProperties;
@@ -12,6 +13,7 @@ export interface PickerProps {
12
13
  showPackageName?: boolean;
13
14
  }
14
15
  export interface PickerWithPresetsProps extends PickerProps {
16
+ modelValueSelectedPreset?: string;
15
17
  initialSelectedPreset?: string;
16
18
  presets?: NamedPreset[];
17
19
  posInternal?: Pos;
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@aurouscia/au-color-picker",
3
+ "version": "1.0.0",
3
4
  "author": {
4
5
  "name": "Au"
5
6
  },
6
7
  "license": "MIT",
7
8
  "repository": {
8
9
  "type": "git",
9
- "url": "https://gitee.com/au114514/au-color-picker"
10
+ "url": "https://gitee.com/au114514/au-npm-pkgs",
11
+ "directory": "packages/au-color-picker"
10
12
  },
11
13
  "description": "vue3颜色选择器组件",
12
14
  "keywords": [
@@ -14,7 +16,6 @@
14
16
  "color",
15
17
  "component"
16
18
  ],
17
- "version": "0.5.1",
18
19
  "type": "module",
19
20
  "files": [
20
21
  "dist"
@@ -36,16 +37,16 @@
36
37
  "prepack": "npm run build"
37
38
  },
38
39
  "dependencies": {
39
- "color-convert": "^2.0.1",
40
- "vue": "^3.5.16"
40
+ "color-convert": "^3.1.2",
41
+ "vue": "^3.5.22"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@types/color-convert": "^2.0.4",
44
- "@types/node": "^22.15.29",
45
- "@vitejs/plugin-vue": "^5.2.4",
46
- "sass": "^1.89.1",
47
- "typescript": "^5.8.3",
48
- "vite": "^6.3.5",
45
+ "@types/node": "^24.9.2",
46
+ "@vitejs/plugin-vue": "^6.0.1",
47
+ "sass": "^1.93.3",
48
+ "typescript": "^5.9.3",
49
+ "vite": "^7.1.12",
49
50
  "vite-plugin-dts": "^4.5.4"
50
51
  }
51
52
  }