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