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