@aurouscia/au-color-picker 0.4.5 → 0.4.6

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.
@@ -1 +1 @@
1
- .acpRingBody[data-v-505caf85]{position:relative}canvas[data-v-505caf85]{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}[data-v-0a96d036]{margin:0;padding:0}.acpSep[data-v-0a96d036]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-0a96d036]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-0a96d036]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-0a96d036]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-0a96d036]:hover{color:#000}.acpEntry[data-v-0a96d036]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-0a96d036]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-0a96d036]{position:relative;width:fit-content}.acp label[data-v-0a96d036]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-0a96d036]{cursor:pointer}.acpPackageName[data-v-0a96d036]{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-0a96d036]{display:flex;justify-content:space-between;align-items:center;padding:5px}.acpParams select[data-v-0a96d036],.acpParams input[data-v-0a96d036]{margin:0;padding:2px;display:block;font-size:16px;box-sizing:border-box;height:24px;line-height:24px}.acpParams select[data-v-0a96d036]{-webkit-user-select:none;user-select:none}.acpParams input[data-v-0a96d036]{text-align:center}.acpParams .acpSingleInput input[data-v-0a96d036]{width:120px}.acpParams .acpTripleInputs[data-v-0a96d036]{display:flex;justify-content:space-around}.acpParams .acpTripleInputs input[data-v-0a96d036]{width:40px}[data-v-2772e845]{margin:0;padding:0}.acpSep[data-v-2772e845]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-2772e845]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-2772e845]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-2772e845]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-2772e845]:hover{color:#000}.acpEntry[data-v-2772e845]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-2772e845]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-2772e845]{position:relative;width:fit-content}.acp label[data-v-2772e845]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-2772e845]{cursor:pointer}.acpNamedPresets[data-v-2772e845]{margin:5px;display:flex;flex-direction:column;gap:4px}.acpNamedPresets[data-v-2772e845]>*{display:flex;justify-content:flex-start;align-items:center;gap:5px}.acpNamedPresets>* .acpPresetName[data-v-2772e845]{color:#666}.acpNamedPresets>* .acpPresetName[data-v-2772e845]:hover{color:#000}
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-0a96d036]{margin:0;padding:0}.acpSep[data-v-0a96d036]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-0a96d036]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-0a96d036]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-0a96d036]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-0a96d036]:hover{color:#000}.acpEntry[data-v-0a96d036]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-0a96d036]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-0a96d036]{position:relative;width:fit-content}.acp label[data-v-0a96d036]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-0a96d036]{cursor:pointer}.acpPackageName[data-v-0a96d036]{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-0a96d036]{display:flex;justify-content:space-between;align-items:center;padding:5px}.acpParams select[data-v-0a96d036],.acpParams input[data-v-0a96d036]{margin:0;padding:2px;display:block;font-size:16px;box-sizing:border-box;height:24px;line-height:24px}.acpParams select[data-v-0a96d036]{-webkit-user-select:none;user-select:none}.acpParams input[data-v-0a96d036]{text-align:center}.acpParams .acpSingleInput input[data-v-0a96d036]{width:120px}.acpParams .acpTripleInputs[data-v-0a96d036]{display:flex;justify-content:space-around}.acpParams .acpTripleInputs input[data-v-0a96d036]{width:40px}[data-v-2772e845]{margin:0;padding:0}.acpSep[data-v-2772e845]{height:2px;border-radius:100px;flex-grow:0;flex-shrink:0;background-color:#ddd}.acpPresetBody[data-v-2772e845]{width:25px;height:25px;border-radius:1000px;cursor:pointer}.acpDoneBtn[data-v-2772e845]{display:flex;justify-content:center;align-items:center;margin:8px;-webkit-user-select:none;user-select:none}.acpDoneBtn button[data-v-2772e845]{background:none;border:none;font-weight:700;color:gray;font-size:16px;cursor:pointer}.acpDoneBtn button[data-v-2772e845]:hover{color:#000}.acpEntry[data-v-2772e845]{width:30px;height:30px;cursor:pointer;border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff}.acpPanel[data-v-2772e845]{border-radius:5px;box-shadow:0 0 5px #000;background-color:#fff;margin-top:3px;position:absolute}.acp[data-v-2772e845]{position:relative;width:fit-content}.acp label[data-v-2772e845]{-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer}.acp input[type=radio][data-v-2772e845]{cursor:pointer}.acpNamedPresets[data-v-2772e845]{margin:5px;display:flex;flex-direction:column;gap:4px}.acpNamedPresets[data-v-2772e845]>*{display:flex;justify-content:flex-start;align-items:center;gap:5px}.acpNamedPresets>* .acpPresetName[data-v-2772e845]{color:#666}.acpNamedPresets>* .acpPresetName[data-v-2772e845]:hover{color:#000}
@@ -1,124 +1,119 @@
1
- import { defineComponent as ee, ref as D, onMounted as ye, onUnmounted as me, openBlock as R, createElementBlock as _, normalizeStyle as Z, isRef as he, createElementVNode as i, computed as Y, onBeforeMount as re, watch as ue, normalizeClass as xe, unref as w, createVNode as ce, withDirectives as G, vModelSelect as Pe, createCommentVNode as J, vModelRadio as ne, Fragment as ke, renderList as Ce, toDisplayString as we } from "vue";
1
+ import { defineComponent as ee, ref as T, onMounted as ye, onUnmounted as me, openBlock as H, createElementBlock as _, normalizeStyle as Z, isRef as he, createElementVNode as i, computed as Y, onBeforeMount as re, watch as ue, normalizeClass as xe, unref as C, createVNode as ce, withDirectives as G, vModelSelect as Pe, createCommentVNode as J, vModelRadio as ne, Fragment as ke, renderList as Ce, toDisplayString as we } from "vue";
2
2
  import E from "color-convert";
3
- function Se(r, u) {
4
- const x = r.x - u.x, y = r.y - u.y;
5
- return x ** 2 + y ** 2;
3
+ function Se(f, g) {
4
+ const w = f.x - g.x, y = f.y - g.y;
5
+ return w ** 2 + y ** 2;
6
6
  }
7
- function Ie(r, u) {
8
- const x = r.x - u.x, y = r.y - u.y;
9
- return Math.atan2(y, x);
7
+ function Ie(f, g) {
8
+ const w = f.x - g.x, y = f.y - g.y;
9
+ return Math.atan2(y, w);
10
10
  }
11
- function Be(r) {
12
- let u = r, x = 0, y = 0;
13
- for (; u !== null; )
14
- x += u.offsetTop, y += u.offsetLeft, u = u.offsetParent;
15
- return { y: x, x: y };
16
- }
17
- const H = 400, U = 400, K = 200, Te = 200, oe = 190, se = 150, z = 200, ae = 16, le = 3, be = /* @__PURE__ */ ee({
11
+ const R = 400, z = 400, K = 200, Be = 200, oe = 190, se = 150, O = 200, ae = 16, le = 3, be = /* @__PURE__ */ ee({
18
12
  __name: "AuColorPickerRing",
19
13
  props: {
20
14
  initialHex: {}
21
15
  },
22
16
  emits: ["changed"],
23
- setup(r, { expose: u, emit: x }) {
24
- const y = D(), h = D();
25
- let v, f;
26
- const P = { x: 199, y: 199 }, V = (oe + se) / 2, N = oe ** 2, L = se ** 2, k = (H - z) / 2, B = k + z, S = D(0), M = D(100), T = D(100), A = r;
17
+ setup(f, { expose: g, emit: w }) {
18
+ const y = T(), h = T();
19
+ let u, c;
20
+ const x = { x: 199, y: 199 }, V = (oe + se) / 2, N = oe ** 2, L = se ** 2, P = (R - O) / 2, B = P + O, S = T(0), M = T(100), b = T(100), A = f;
27
21
  let m;
28
22
  function l() {
29
- var s, p;
30
- const n = (s = y.value) == null ? void 0 : s.getContext("2d"), o = (p = h.value) == null ? void 0 : p.getContext("2d");
23
+ var s, d;
24
+ const n = (s = y.value) == null ? void 0 : s.getContext("2d"), o = (d = h.value) == null ? void 0 : d.getContext("2d");
31
25
  if (!n || !o)
32
26
  throw Error("canvas context getting error");
33
27
  if (A.initialHex) {
34
- const C = E.hex.hsv(A.initialHex);
35
- S.value = C[0], M.value = C[1], T.value = C[2];
28
+ const k = E.hex.hsv(A.initialHex);
29
+ S.value = k[0], M.value = k[1], b.value = k[2];
36
30
  }
37
- v = n, f = o, m = v.getImageData(0, 0, H, U), a(), e(), F(), v.putImageData(m, 0, 0);
31
+ u = n, c = o, m = u.getImageData(0, 0, R, z), a(), e(), F(), u.putImageData(m, 0, 0);
38
32
  }
39
33
  function a() {
40
- for (let n = 0; n < H; n++)
41
- for (let o = 0; o < U; o++) {
34
+ for (let n = 0; n < R; n++)
35
+ for (let o = 0; o < z; o++) {
42
36
  const s = { x: n, y: o };
43
- if (g(s)) {
44
- const p = s.y * H * 4 + s.x * 4, C = d(s), q = E.hsv.rgb([C, 100, 100]);
45
- m.data[p] = q[0], m.data[p + 1] = q[1], m.data[p + 2] = q[2], m.data[p + 3] = 255;
37
+ if (p(s)) {
38
+ const d = s.y * R * 4 + s.x * 4, k = v(s), q = E.hsv.rgb([k, 100, 100]);
39
+ m.data[d] = q[0], m.data[d + 1] = q[1], m.data[d + 2] = q[2], m.data[d + 3] = 255;
46
40
  }
47
41
  }
48
42
  }
49
- function d(n) {
50
- return 360 * ((Ie(n, P) + Math.PI) / (2 * Math.PI));
43
+ function v(n) {
44
+ return 360 * ((Ie(n, x) + Math.PI) / (2 * Math.PI));
51
45
  }
52
- function g(n) {
53
- const o = Se(P, n);
46
+ function p(n) {
47
+ const o = Se(x, n);
54
48
  return o > L && o < N;
55
49
  }
56
50
  function e() {
57
- for (let n = 0; n < H; n++)
58
- for (let o = 0; o < U; o++) {
51
+ for (let n = 0; n < R; n++)
52
+ for (let o = 0; o < z; o++) {
59
53
  const s = { x: n, y: o };
60
- if (b(s)) {
61
- const p = s.y * H * 4 + s.x * 4, { s: C, v: q } = t(s), O = E.hsv.rgb([S.value, C, q]);
62
- m.data[p] = O[0], m.data[p + 1] = O[1], m.data[p + 2] = O[2], m.data[p + 3] = 255;
54
+ if (D(s)) {
55
+ const d = s.y * R * 4 + s.x * 4, { s: k, v: q } = t(s), U = E.hsv.rgb([S.value, k, q]);
56
+ m.data[d] = U[0], m.data[d + 1] = U[1], m.data[d + 2] = U[2], m.data[d + 3] = 255;
63
57
  }
64
58
  }
65
59
  }
66
60
  function t(n) {
67
- const o = n.x - k, s = n.y - k;
68
- let p = o / z, C = 1 - s / z;
69
- return p > 1 ? p = 1 : p < 0 && (p = 0), C > 1 ? C = 1 : C < 0 && (C = 0), { s: 100 * p, v: 100 * C };
61
+ const o = n.x - P, s = n.y - P;
62
+ let d = o / O, k = 1 - s / O;
63
+ return d > 1 ? d = 1 : d < 0 && (d = 0), k > 1 ? k = 1 : k < 0 && (k = 0), { s: 100 * d, v: 100 * k };
70
64
  }
71
- function b(n) {
72
- return !(n.x < k || n.x > B || n.y < k || n.y > B);
65
+ function D(n) {
66
+ return !(n.x < P || n.x > B || n.y < P || n.y > B);
73
67
  }
74
- let $ = !1, c = "none", I = !1;
68
+ let $ = !1, r = "none", I = !1;
75
69
  function X(n, o) {
76
70
  if ($ || o && !I)
77
71
  return;
78
72
  $ = !0;
79
- const s = fe(n);
80
- if (c === "none" && (b(s) ? c = "square" : g(s) && (c = "ring")), c === "ring" && (n.preventDefault(), S.value = d(s), e(), v.putImageData(m, 0, 0)), c === "square") {
73
+ const s = de(n);
74
+ if (r === "none" && (D(s) ? r = "square" : p(s) && (r = "ring")), r === "ring" && (n.preventDefault(), S.value = v(s), e(), u.putImageData(m, 0, 0)), r === "square") {
81
75
  n.preventDefault();
82
- const p = t(s);
83
- M.value = p.s, T.value = p.v;
76
+ const d = t(s);
77
+ M.value = d.s, b.value = d.v;
84
78
  }
85
- c !== "none" && F(!0), $ = !1;
79
+ r !== "none" && F(!0), $ = !1;
86
80
  }
87
81
  function j() {
88
- c = "none", I = !1;
82
+ r = "none", I = !1;
89
83
  }
90
- function fe(n) {
84
+ function de(n) {
91
85
  let o, s;
86
+ if (!y.value)
87
+ return { x: -1, y: -1 };
92
88
  if ("touches" in n) {
93
- o = n.touches[0].pageX, s = n.touches[0].pageY;
94
- const p = Be(y.value);
95
- o -= p.x, s -= p.y;
89
+ const d = y.value.getBoundingClientRect();
90
+ o = n.touches[0].clientX - d.left, s = n.touches[0].clientY - d.top;
96
91
  } else
97
92
  o = n.offsetX, s = n.offsetY;
98
- return o = o * H / K, s = s * H / K, { x: o, y: s };
93
+ return o = o * R / K, s = s * R / K, { x: o, y: s };
99
94
  }
100
95
  function F(n) {
101
96
  if (n) {
102
- const ge = E.hsv.hex([S.value, M.value, T.value]);
97
+ const ge = E.hsv.hex([S.value, M.value, b.value]);
103
98
  pe("changed", ge);
104
99
  }
105
- const o = (S.value / 360 * 2 + 1) * Math.PI, s = Math.cos(o) * V + H / 2, p = Math.sin(o) * V + U / 2, C = M.value / 100 * z + k, q = (1 - T.value / 100) * z + k;
106
- f.reset(), f.lineWidth = 4, f.strokeStyle = "black", f.beginPath(), f.arc(s, p, ae - 2, 0, 2 * Math.PI), f.stroke(), f.beginPath(), f.arc(s, p, le, 0, 2 * Math.PI), f.fill();
107
- const O = T.value > 50 ? "black" : "#ddd";
108
- f.strokeStyle = O, f.fillStyle = O, f.beginPath(), f.arc(C, q, ae - 2, 0, 2 * Math.PI), f.stroke(), f.beginPath(), f.arc(C, q, le, 0, 2 * Math.PI), f.fill();
100
+ const o = (S.value / 360 * 2 + 1) * Math.PI, s = Math.cos(o) * V + R / 2, d = Math.sin(o) * V + z / 2, k = M.value / 100 * O + P, q = (1 - b.value / 100) * O + P;
101
+ c.reset(), c.lineWidth = 4, c.strokeStyle = "black", c.beginPath(), c.arc(s, d, ae - 2, 0, 2 * Math.PI), c.stroke(), c.beginPath(), c.arc(s, d, le, 0, 2 * Math.PI), c.fill();
102
+ const U = b.value > 50 ? "black" : "#ddd";
103
+ c.strokeStyle = U, c.fillStyle = U, c.beginPath(), c.arc(k, q, ae - 2, 0, 2 * Math.PI), c.stroke(), c.beginPath(), c.arc(k, q, le, 0, 2 * Math.PI), c.fill();
109
104
  }
110
- function de(n) {
105
+ function fe(n) {
111
106
  const o = E.hex.hsv(n);
112
- S.value = o[0], M.value = o[1], T.value = o[2], e(), v.putImageData(m, 0, 0), F();
107
+ S.value = o[0], M.value = o[1], b.value = o[2], e(), u.putImageData(m, 0, 0), F();
113
108
  }
114
- const pe = x;
115
- return u({ enforceTo: de }), ye(() => {
109
+ const pe = w;
110
+ return g({ enforceTo: fe }), ye(() => {
116
111
  l(), window.addEventListener("touchend", j), window.addEventListener("mouseup", j);
117
112
  }), me(() => {
118
113
  window.removeEventListener("touchend", j), window.removeEventListener("mouseup", j);
119
- }), (n, o) => (R(), _("div", {
114
+ }), (n, o) => (H(), _("div", {
120
115
  class: "acpRingBody",
121
- style: Z({ width: K + "px", height: Te + "px" }),
116
+ style: Z({ width: K + "px", height: Be + "px" }),
122
117
  onTouchstart: X,
123
118
  onTouchmove: X,
124
119
  onTouchend: j,
@@ -128,64 +123,64 @@ const H = 400, U = 400, K = 200, Te = 200, oe = 190, se = 150, z = 200, ae = 16,
128
123
  })
129
124
  }, [
130
125
  i("canvas", {
131
- width: H,
132
- height: U,
126
+ width: R,
127
+ height: z,
133
128
  ref_key: "cvs",
134
129
  ref: y
135
130
  }, null, 512),
136
131
  i("canvas", {
137
- width: H,
138
- height: U,
132
+ width: R,
133
+ height: z,
139
134
  ref_key: "cursorCvs",
140
135
  ref: h
141
136
  }, null, 512)
142
137
  ], 36));
143
138
  }
144
- }), te = (r, u) => {
145
- const x = r.__vccOpts || r;
146
- for (const [y, h] of u)
147
- x[y] = h;
148
- return x;
149
- }, De = /* @__PURE__ */ te(be, [["__scopeId", "data-v-505caf85"]]);
150
- function Q(r) {
151
- return /^#([0-9A-F]{3}){1,2}$/i.test(r);
139
+ }), te = (f, g) => {
140
+ const w = f.__vccOpts || f;
141
+ for (const [y, h] of g)
142
+ w[y] = h;
143
+ return w;
144
+ }, De = /* @__PURE__ */ te(be, [["__scopeId", "data-v-82766bce"]]);
145
+ function Q(f) {
146
+ return /^#([0-9A-F]{3}){1,2}$/i.test(f);
152
147
  }
153
- function ve(r) {
154
- const u = D(!1), x = D("#ff0000"), y = Y(() => {
155
- let P = {};
156
- return u.value || (P.boxShadow = "none"), r.entryStyles && Object.assign(P, r.entryStyles), u.value && (P.transition = "0s", Object.assign(P, r.entryActiveStyles)), P.backgroundColor = x.value, r.pos === "right" ? P.right = "0px" : P.left = "0px", P;
148
+ function ve(f) {
149
+ const g = T(!1), w = T("#ff0000"), y = Y(() => {
150
+ let x = {};
151
+ return g.value || (x.boxShadow = "none"), f.entryStyles && Object.assign(x, f.entryStyles), g.value && (x.transition = "0s", Object.assign(x, f.entryActiveStyles)), x.backgroundColor = w.value, f.pos === "right" ? x.right = "0px" : x.left = "0px", x;
157
152
  });
158
153
  function h() {
159
- u.value = !1;
154
+ g.value = !1;
160
155
  }
161
- let v = 0;
162
- function f() {
163
- if (r.entryRespondDelay && (window.clearTimeout(v), !u.value)) {
164
- v = window.setTimeout(() => {
165
- u.value = !0;
166
- }, r.entryRespondDelay);
156
+ let u = 0;
157
+ function c() {
158
+ if (f.entryRespondDelay && (window.clearTimeout(u), !g.value)) {
159
+ u = window.setTimeout(() => {
160
+ g.value = !0;
161
+ }, f.entryRespondDelay);
167
162
  return;
168
163
  }
169
- u.value = !u.value;
164
+ g.value = !g.value;
170
165
  }
171
- return { hexValue: x, panelShow: u, closePanel: h, togglePanel: f, entryStylesActual: y };
166
+ return { hexValue: w, panelShow: g, closePanel: h, togglePanel: c, entryStylesActual: y };
172
167
  }
173
168
  function ie() {
174
169
  window.alert("https://www.npmjs.com/package/@aurouscia/au-color-picker");
175
170
  }
176
- function W(r) {
177
- return r.startsWith("#") ? r.toUpperCase() : "#" + r.toUpperCase();
171
+ function W(f) {
172
+ return f.startsWith("#") ? f.toUpperCase() : "#" + f.toUpperCase();
178
173
  }
179
- const Ne = { class: "acp" }, He = { class: "acpRing" }, Re = { class: "acpParams" }, _e = {
174
+ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams" }, He = {
180
175
  key: 0,
181
176
  class: "acpSingleInput"
182
- }, Me = ["value"], Ae = {
177
+ }, _e = ["value"], Me = {
183
178
  key: 1,
184
179
  class: "acpTripleInputs"
185
- }, $e = ["value"], Ee = ["value"], qe = ["value"], Ve = {
180
+ }, Ae = ["value"], $e = ["value"], Ee = ["value"], qe = {
186
181
  key: 2,
187
182
  class: "acpTripleInputs"
188
- }, Le = ["value"], Oe = ["value"], Ue = ["value"], ze = { class: "acpDoneBtn" }, We = /* @__PURE__ */ ee({
183
+ }, Ve = ["value"], Le = ["value"], Ue = ["value"], ze = { class: "acpDoneBtn" }, Oe = /* @__PURE__ */ ee({
189
184
  __name: "AuColorPicker",
190
185
  props: {
191
186
  initial: {},
@@ -199,140 +194,140 @@ const Ne = { class: "acp" }, He = { class: "acpRing" }, Re = { class: "acpParams
199
194
  showPackageName: { type: Boolean }
200
195
  },
201
196
  emits: ["change", "done"],
202
- setup(r, { expose: u, emit: x }) {
203
- const y = r, h = D(), { hexValue: v, panelShow: f, closePanel: P, togglePanel: V, entryStylesActual: N } = ve(y);
204
- function L(g) {
205
- v.value = W(g), m();
197
+ setup(f, { expose: g, emit: w }) {
198
+ const y = f, h = T(), { hexValue: u, panelShow: c, closePanel: x, togglePanel: V, entryStylesActual: N } = ve(y);
199
+ function L(p) {
200
+ u.value = W(p), m();
206
201
  }
207
- const k = D("hex"), B = Y(() => E.hex.rgb(v.value)), S = Y(() => E.hex.hsv(v.value));
208
- function M(g) {
202
+ const P = T("hex"), B = Y(() => E.hex.rgb(u.value)), S = Y(() => E.hex.hsv(u.value));
203
+ function M(p) {
209
204
  var t;
210
- const e = g.target;
205
+ const e = p.target;
211
206
  if ("value" in e) {
212
- const b = e.value;
213
- if (b && Q(b)) {
214
- v.value = W(b), (t = h.value) == null || t.enforceTo(v.value), m();
207
+ const D = e.value;
208
+ if (D && Q(D)) {
209
+ u.value = W(D), (t = h.value) == null || t.enforceTo(u.value), m();
215
210
  return;
216
211
  }
217
- e.value = v.value;
212
+ e.value = u.value;
218
213
  }
219
214
  }
220
- function T(g, e) {
221
- var b;
222
- const t = g.target;
215
+ function b(p, e) {
216
+ var D;
217
+ const t = p.target;
223
218
  if ("value" in t) {
224
219
  const $ = t.value;
225
220
  if ($) {
226
- let c = parseInt($);
227
- if (isNaN(c))
221
+ let r = parseInt($);
222
+ if (isNaN(r))
228
223
  t.value = "0";
229
224
  else {
230
- c > 255 ? c = 255 : c < 0 && (c = 0);
225
+ r > 255 ? r = 255 : r < 0 && (r = 0);
231
226
  const I = [...B.value];
232
- e == "r" ? I[0] = c : e == "g" ? I[1] = c : I[2] = c, v.value = W(E.rgb.hex(I)), (b = h.value) == null || b.enforceTo(v.value), t.value = c.toString(), m();
227
+ e == "r" ? I[0] = r : e == "g" ? I[1] = r : I[2] = r, u.value = W(E.rgb.hex(I)), (D = h.value) == null || D.enforceTo(u.value), t.value = r.toString(), m();
233
228
  return;
234
229
  }
235
230
  }
236
231
  }
237
232
  }
238
- function A(g, e) {
239
- var b;
240
- const t = g.target;
233
+ function A(p, e) {
234
+ var D;
235
+ const t = p.target;
241
236
  if ("value" in t) {
242
237
  const $ = t.value;
243
238
  if ($) {
244
- let c = parseInt($);
245
- if (isNaN(c))
239
+ let r = parseInt($);
240
+ if (isNaN(r))
246
241
  t.value = "0";
247
242
  else {
248
- e === "h" ? c > 359 && (c = 359) : c > 100 && (c = 100), c < 0 && (c = 0);
243
+ e === "h" ? r > 359 && (r = 359) : r > 100 && (r = 100), r < 0 && (r = 0);
249
244
  const I = [...S.value];
250
- e == "h" ? I[0] = c : e == "s" ? I[1] = c : I[2] = c, v.value = W(E.hsv.hex(I)), t.value = c.toString(), (b = h.value) == null || b.enforceTo(v.value), m();
245
+ e == "h" ? I[0] = r : e == "s" ? I[1] = r : I[2] = r, u.value = W(E.hsv.hex(I)), t.value = r.toString(), (D = h.value) == null || D.enforceTo(u.value), m();
251
246
  return;
252
247
  }
253
248
  }
254
249
  }
255
250
  }
256
251
  function m() {
257
- d("change", v.value);
252
+ v("change", u.value);
258
253
  }
259
254
  function l() {
260
- return v.value;
255
+ return u.value;
261
256
  }
262
- function a(g) {
257
+ function a(p) {
263
258
  var e;
264
- if (Q(g)) {
265
- const t = W(g);
266
- v.value = t, (e = h.value) == null || e.enforceTo(t);
259
+ if (Q(p)) {
260
+ const t = W(p);
261
+ u.value = t, (e = h.value) == null || e.enforceTo(t);
267
262
  }
268
263
  }
269
264
  re(() => {
270
265
  y.initial && a(y.initial);
271
266
  });
272
- const d = x;
273
- return u({ closePanel: P, getCurrentHex: l, enforceTo: a }), ue(f, (g) => {
274
- g === !1 && d("done", v.value);
275
- }), (g, e) => (R(), _("div", Ne, [
267
+ const v = w;
268
+ return g({ closePanel: x, getCurrentHex: l, enforceTo: a }), ue(c, (p) => {
269
+ p === !1 && v("done", u.value);
270
+ }), (p, e) => (H(), _("div", Te, [
276
271
  i("div", {
277
- class: xe(g.entryClassName || "acpEntry"),
278
- style: Z(w(N)),
272
+ class: xe(p.entryClassName || "acpEntry"),
273
+ style: Z(C(N)),
279
274
  onClick: e[0] || (e[0] = //@ts-ignore
280
- (...t) => w(V) && w(V)(...t))
275
+ (...t) => C(V) && C(V)(...t))
281
276
  }, null, 6),
282
- w(f) ? (R(), _("div", {
277
+ C(c) ? (H(), _("div", {
283
278
  key: 0,
284
279
  class: "acpPanel",
285
- style: Z({ zIndex: (g.panelBaseZIndex || 0) + 100 }),
286
- onClick: e[10] || (e[10] = (t) => g.panelClickStopPropagation && t.stopPropagation())
280
+ style: Z({ zIndex: (p.panelBaseZIndex || 0) + 100 }),
281
+ onClick: e[10] || (e[10] = (t) => p.panelClickStopPropagation && t.stopPropagation())
287
282
  }, [
288
- i("div", He, [
283
+ i("div", Ne, [
289
284
  ce(De, {
290
285
  ref_key: "ring",
291
286
  ref: h,
292
- "initial-hex": w(v),
287
+ "initial-hex": C(u),
293
288
  onChanged: L,
294
- "show-package-name": g.showPackageName
289
+ "show-package-name": p.showPackageName
295
290
  }, null, 8, ["initial-hex", "show-package-name"])
296
291
  ]),
297
292
  i("div", Re, [
298
293
  G(i("select", {
299
- "onUpdate:modelValue": e[1] || (e[1] = (t) => k.value = t)
294
+ "onUpdate:modelValue": e[1] || (e[1] = (t) => P.value = t)
300
295
  }, e[11] || (e[11] = [
301
296
  i("option", { value: "hex" }, "HEX", -1),
302
297
  i("option", { value: "rgb" }, "RGB", -1),
303
298
  i("option", { value: "hsv" }, "HSV", -1)
304
299
  ]), 512), [
305
- [Pe, k.value]
300
+ [Pe, P.value]
306
301
  ]),
307
- k.value == "hex" ? (R(), _("div", _e, [
302
+ P.value == "hex" ? (H(), _("div", He, [
308
303
  i("input", {
309
- value: w(v),
304
+ value: C(u),
310
305
  onBlur: M,
311
306
  spellcheck: "false",
312
307
  maxlength: "7"
313
- }, null, 40, Me)
314
- ])) : k.value == "rgb" ? (R(), _("div", Ae, [
308
+ }, null, 40, _e)
309
+ ])) : P.value == "rgb" ? (H(), _("div", Me, [
315
310
  i("input", {
316
311
  value: B.value[0],
317
- onBlur: e[2] || (e[2] = (t) => T(t, "r"))
318
- }, null, 40, $e),
312
+ onBlur: e[2] || (e[2] = (t) => b(t, "r"))
313
+ }, null, 40, Ae),
319
314
  i("input", {
320
315
  value: B.value[1],
321
- onBlur: e[3] || (e[3] = (t) => T(t, "g"))
322
- }, null, 40, Ee),
316
+ onBlur: e[3] || (e[3] = (t) => b(t, "g"))
317
+ }, null, 40, $e),
323
318
  i("input", {
324
319
  value: B.value[2],
325
- onBlur: e[4] || (e[4] = (t) => T(t, "b"))
326
- }, null, 40, qe)
327
- ])) : (R(), _("div", Ve, [
320
+ onBlur: e[4] || (e[4] = (t) => b(t, "b"))
321
+ }, null, 40, Ee)
322
+ ])) : (H(), _("div", qe, [
328
323
  i("input", {
329
324
  value: S.value[0],
330
325
  onBlur: e[5] || (e[5] = (t) => A(t, "h"))
331
- }, null, 40, Le),
326
+ }, null, 40, Ve),
332
327
  i("input", {
333
328
  value: S.value[1],
334
329
  onBlur: e[6] || (e[6] = (t) => A(t, "s"))
335
- }, null, 40, Oe),
330
+ }, null, 40, Le),
336
331
  i("input", {
337
332
  value: S.value[2],
338
333
  onBlur: e[7] || (e[7] = (t) => A(t, "v"))
@@ -342,19 +337,19 @@ const Ne = { class: "acp" }, He = { class: "acpRing" }, Re = { class: "acpParams
342
337
  i("div", ze, [
343
338
  i("button", {
344
339
  onClick: e[8] || (e[8] = //@ts-ignore
345
- (...t) => w(P) && w(P)(...t))
340
+ (...t) => C(x) && C(x)(...t))
346
341
  }, "OK")
347
342
  ]),
348
- g.showPackageName ? (R(), _("div", {
343
+ p.showPackageName ? (H(), _("div", {
349
344
  key: 0,
350
345
  class: "acpPackageName",
351
346
  onClick: e[9] || (e[9] = //@ts-ignore
352
- (...t) => w(ie) && w(ie)(...t))
347
+ (...t) => C(ie) && C(ie)(...t))
353
348
  }, " au-color-picker ")) : J("", !0)
354
349
  ], 4)) : J("", !0)
355
350
  ]));
356
351
  }
357
- }), Ze = /* @__PURE__ */ te(We, [["__scopeId", "data-v-0a96d036"]]), je = { class: "acp" }, Xe = { class: "acpNamedPresets" }, Fe = { for: "acpColorPresetCustom" }, Ke = ["for"], Ye = ["id", "value", "onClick"], Ge = { class: "acpPresetName" }, Je = { class: "acpDoneBtn" }, Qe = /* @__PURE__ */ ee({
352
+ }), We = /* @__PURE__ */ te(Oe, [["__scopeId", "data-v-0a96d036"]]), Ze = { class: "acp" }, je = { class: "acpNamedPresets" }, Xe = { for: "acpColorPresetCustom" }, Fe = ["for"], Ke = ["id", "value", "onClick"], Ye = { class: "acpPresetName" }, Ge = { class: "acpDoneBtn" }, Je = /* @__PURE__ */ ee({
358
353
  __name: "AuColorPickerPresetsNested",
359
354
  props: {
360
355
  initialSelectedPreset: {},
@@ -370,54 +365,54 @@ const Ne = { class: "acp" }, He = { class: "acpRing" }, Re = { class: "acpParams
370
365
  showPackageName: { type: Boolean }
371
366
  },
372
367
  emits: ["change", "done", "presetSwitched"],
373
- setup(r, { expose: u, emit: x }) {
374
- const y = r, { hexValue: h, panelShow: v, closePanel: f, togglePanel: P, entryStylesActual: V } = ve(y), N = D(), L = D(), k = D("#ff0000");
368
+ setup(f, { expose: g, emit: w }) {
369
+ const y = f, { hexValue: h, panelShow: u, closePanel: c, togglePanel: x, entryStylesActual: V } = ve(y), N = T(), L = T(), P = T("#ff0000");
375
370
  function B(l, a) {
376
- l ? (N.value = l.name, h.value = l.colorHex) : (N.value = void 0, h.value = k.value), a || S("presetSwitched", l == null ? void 0 : l.name);
371
+ l ? (N.value = l.name, h.value = l.colorHex) : (N.value = void 0, h.value = P.value), a || S("presetSwitched", l == null ? void 0 : l.name);
377
372
  }
378
- const S = x;
373
+ const S = w;
379
374
  function M(l) {
380
- h.value = l, k.value = l, S("change", l);
375
+ h.value = l, P.value = l, S("change", l);
381
376
  }
382
- function T(l) {
383
- h.value = l, k.value = l, f();
377
+ function b(l) {
378
+ h.value = l, P.value = l, c();
384
379
  }
385
380
  function A(l) {
386
381
  var a;
387
382
  if (Q(l)) {
388
- const d = W(l);
389
- k.value = d, (a = L.value) == null || a.enforceTo(d), N.value || (h.value = d);
383
+ const v = W(l);
384
+ P.value = v, (a = L.value) == null || a.enforceTo(v), N.value || (h.value = v);
390
385
  }
391
386
  }
392
387
  function m(l) {
393
- var d;
388
+ var v;
394
389
  l || B(void 0, !0);
395
- const a = (d = y.presets) == null ? void 0 : d.find((g) => g.name === l);
390
+ const a = (v = y.presets) == null ? void 0 : v.find((p) => p.name === l);
396
391
  a && B(a, !0);
397
392
  }
398
- return u({ closePanel: f, enforceCustomValueTo: A, enforcePresetTo: m }), ue(v, (l) => {
393
+ return g({ closePanel: c, enforceCustomValueTo: A, enforcePresetTo: m }), ue(u, (l) => {
399
394
  l === !1 && S("done", h.value);
400
395
  }), re(() => {
401
396
  y.initial && A(y.initial), y.initialSelectedPreset && m(y.initialSelectedPreset);
402
- }), (l, a) => (R(), _("div", je, [
397
+ }), (l, a) => (H(), _("div", Ze, [
403
398
  i("div", {
404
399
  class: "acpEntry",
405
- style: Z(w(V)),
400
+ style: Z(C(V)),
406
401
  onClick: a[0] || (a[0] = //@ts-ignore
407
- (...d) => w(P) && w(P)(...d))
402
+ (...v) => C(x) && C(x)(...v))
408
403
  }, null, 4),
409
- w(v) ? (R(), _("div", {
404
+ C(u) ? (H(), _("div", {
410
405
  key: 0,
411
406
  class: "acpPanel",
412
407
  style: Z({ zIndex: (l.panelBaseZIndex || 0) + 100 }),
413
- onClick: a[5] || (a[5] = (d) => l.panelClickStopPropagation && d.stopPropagation())
408
+ onClick: a[5] || (a[5] = (v) => l.panelClickStopPropagation && v.stopPropagation())
414
409
  }, [
415
- i("div", Xe, [
416
- i("label", Fe, [
417
- ce(Ze, {
418
- initial: k.value,
410
+ i("div", je, [
411
+ i("label", Xe, [
412
+ ce(We, {
413
+ initial: P.value,
419
414
  onChange: M,
420
- onDone: T,
415
+ onDone: b,
421
416
  "entry-class-name": "acpPresetBody",
422
417
  ref_key: "customPicker",
423
418
  ref: L,
@@ -428,47 +423,47 @@ const Ne = { class: "acp" }, He = { class: "acpRing" }, Re = { class: "acpParams
428
423
  type: "radio",
429
424
  id: "acpColorPresetCustom",
430
425
  value: void 0,
431
- "onUpdate:modelValue": a[1] || (a[1] = (d) => N.value = d),
432
- onClick: a[2] || (a[2] = (d) => B())
426
+ "onUpdate:modelValue": a[1] || (a[1] = (v) => N.value = v),
427
+ onClick: a[2] || (a[2] = (v) => B())
433
428
  }, null, 512), [
434
429
  [ne, N.value]
435
430
  ]),
436
431
  a[6] || (a[6] = i("div", { class: "acpPresetName" }, "自定义", -1))
437
432
  ]),
438
433
  a[7] || (a[7] = i("div", { class: "acpSep" }, null, -1)),
439
- (R(!0), _(ke, null, Ce(l.presets, (d) => (R(), _("label", {
440
- for: `acpColorPreset${d.name}`
434
+ (H(!0), _(ke, null, Ce(l.presets, (v) => (H(), _("label", {
435
+ for: `acpColorPreset${v.name}`
441
436
  }, [
442
437
  i("div", {
443
438
  class: "acpPresetBody",
444
- style: Z({ backgroundColor: d.colorHex })
439
+ style: Z({ backgroundColor: v.colorHex })
445
440
  }, null, 4),
446
441
  G(i("input", {
447
442
  name: "colorType",
448
443
  type: "radio",
449
- id: `acpColorPreset${d.name}`,
450
- value: d.name,
451
- "onUpdate:modelValue": a[3] || (a[3] = (g) => N.value = g),
452
- onClick: (g) => B(d)
453
- }, null, 8, Ye), [
444
+ id: `acpColorPreset${v.name}`,
445
+ value: v.name,
446
+ "onUpdate:modelValue": a[3] || (a[3] = (p) => N.value = p),
447
+ onClick: (p) => B(v)
448
+ }, null, 8, Ke), [
454
449
  [ne, N.value]
455
450
  ]),
456
- i("div", Ge, we(d.name), 1)
457
- ], 8, Ke))), 256)),
451
+ i("div", Ye, we(v.name), 1)
452
+ ], 8, Fe))), 256)),
458
453
  a[8] || (a[8] = i("div", { class: "acpSep" }, null, -1))
459
454
  ]),
460
- i("div", Je, [
455
+ i("div", Ge, [
461
456
  i("button", {
462
457
  onClick: a[4] || (a[4] = //@ts-ignore
463
- (...d) => w(f) && w(f)(...d))
458
+ (...v) => C(c) && C(c)(...v))
464
459
  }, "OK")
465
460
  ])
466
461
  ], 4)) : J("", !0)
467
462
  ]));
468
463
  }
469
- }), nt = /* @__PURE__ */ te(Qe, [["__scopeId", "data-v-2772e845"]]);
464
+ }), tt = /* @__PURE__ */ te(Je, [["__scopeId", "data-v-2772e845"]]);
470
465
  export {
471
- Ze as AuColorPicker,
472
- nt as AuColorPickerPresetsNested,
466
+ We as AuColorPicker,
467
+ tt as AuColorPickerPresetsNested,
473
468
  De as AuColorPickerRing
474
469
  };
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "color",
15
15
  "component"
16
16
  ],
17
- "version": "0.4.5",
17
+ "version": "0.4.6",
18
18
  "type": "module",
19
19
  "files": [
20
20
  "dist"