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

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