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

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