@aurouscia/au-color-picker 1.0.2-dev.1 → 1.0.2-dev.3

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