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

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