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