@aurouscia/au-color-picker 0.3.0 → 0.4.1

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