@aurouscia/au-color-picker 1.0.0 → 1.0.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-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,182 +1,182 @@
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 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
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(l, x) {
4
+ const m = l.x - x.x, t = l.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 Ve(l, x) {
8
+ const m = l.x - x.x, t = l.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 D = 400, _ = 400, G = 200, be = 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(l, { 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)
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
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];
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];
29
29
  }
30
- i = l, u = s, y = i.getImageData(0, 0, D, z), r(), x(), Y(), i.putImageData(y, 0, 0);
30
+ u = s, d = a, n = u.getImageData(0, 0, D, _), f(), y(), Y(), u.putImageData(n, 0, 0);
31
31
  }
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;
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
39
  }
40
40
  }
41
41
  }
42
- function d(l) {
43
- return 360 * ((Ve(l, C) + Math.PI) / (2 * Math.PI));
42
+ function R(s) {
43
+ return 360 * ((Ve(s, k) + Math.PI) / (2 * Math.PI));
44
44
  }
45
- function q(l) {
46
- const s = Ie(C, l);
47
- return s > L && s < $;
45
+ function X(s) {
46
+ const a = Ie(k, s);
47
+ return a > U && a < $;
48
48
  }
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;
49
+ 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;
56
56
  }
57
57
  }
58
58
  }
59
- function e(l) {
60
- const s = l.x - B, a = l.y - B;
61
- let p = s / O, V = 1 - a / O;
59
+ function e(s) {
60
+ const a = s.x - b, r = s.y - b;
61
+ let p = a / z, V = 1 - r / z;
62
62
  return p > 1 ? p = 1 : p < 0 && (p = 0), V > 1 ? V = 1 : V < 0 && (V = 0), { s: 100 * p, v: 100 * V };
63
63
  }
64
- function n(l) {
65
- return !(l.x < B || l.x > H || l.y < B || l.y > H);
64
+ function o(s) {
65
+ return !(s.x < b || s.x > H || s.y < b || s.y > H);
66
66
  }
67
- let M = !1, f = "none", S = I(!1);
68
- function K(l, s) {
69
- if (M || s && !S.value)
67
+ let M = !1, v = "none", C = I(!1);
68
+ function K(s, a) {
69
+ if (M || a && !C.value)
70
70
  return;
71
71
  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;
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;
77
77
  }
78
- f !== "none" && Y(!0), M = !1;
78
+ v !== "none" && Y(!0), M = !1;
79
79
  }
80
80
  function Z() {
81
- f = "none", S.value = !1;
81
+ v = "none", C.value = !1;
82
82
  }
83
- function fe(l) {
84
- let s, a;
83
+ function fe(s) {
84
+ let a, r;
85
85
  if (!t.value)
86
86
  return { x: -1, y: -1 };
87
- if ("touches" in l) {
87
+ if ("touches" in s) {
88
88
  const p = t.value.getBoundingClientRect();
89
- s = l.touches[0].clientX - p.left, a = l.touches[0].clientY - p.top;
89
+ a = s.touches[0].clientX - p.left, r = s.touches[0].clientY - p.top;
90
90
  } else
91
- s = l.offsetX, a = l.offsetY;
92
- return s = s * D / G, a = a * D / G, { x: s, y: a };
91
+ a = s.offsetX, r = s.offsetY;
92
+ return a = a * D / G, r = r * D / G, { x: a, y: r };
93
93
  }
94
- function Y(l) {
95
- if (l) {
96
- const ge = A.hsv.hex([h.value, w.value, R.value]);
94
+ function Y(s) {
95
+ if (s) {
96
+ const ge = A.hsv.hex([h.value, S.value, w.value]);
97
97
  me("changed", ge);
98
98
  }
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();
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();
101
+ 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();
103
103
  }
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();
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();
107
107
  }
108
108
  const me = m;
109
- return P({ enforceTo: pe }), ye(() => {
110
- c(), window.addEventListener("touchend", Z), window.addEventListener("mouseup", Z);
109
+ return x({ enforceTo: pe }), ye(() => {
110
+ i(), window.addEventListener("touchend", Z), window.addEventListener("mouseup", Z);
111
111
  }), xe(() => {
112
112
  window.removeEventListener("touchend", Z), window.removeEventListener("mouseup", Z);
113
- }), (l, s) => (N(), T("div", {
113
+ }), (s, a) => (N(), T("div", {
114
114
  class: "acpRingBody",
115
- style: X({ width: G + "px", height: Be + "px" }),
115
+ style: j({ width: G + "px", height: be + "px" }),
116
116
  onTouchstart: K,
117
117
  onTouchmove: K,
118
118
  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;
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;
122
122
  })
123
123
  }, [
124
- v("canvas", {
124
+ c("canvas", {
125
125
  width: D,
126
- height: z,
126
+ height: _,
127
127
  ref_key: "cvs",
128
128
  ref: t
129
129
  }, null, 512),
130
- v("canvas", {
130
+ c("canvas", {
131
131
  width: D,
132
- height: z,
132
+ height: _,
133
133
  ref_key: "cursorCvs",
134
134
  ref: g
135
135
  }, null, 512)
136
136
  ], 36));
137
137
  }
138
- }), ne = (o, P) => {
139
- const m = o.__vccOpts || o;
140
- for (const [t, g] of P)
138
+ }), ne = (l, x) => {
139
+ const m = l.__vccOpts || l;
140
+ for (const [t, g] of x)
141
141
  m[t] = g;
142
142
  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);
143
+ }, De = /* @__PURE__ */ ne(Be, [["__scopeId", "data-v-183d2118"]]);
144
+ function ee(l) {
145
+ return /^#([0-9A-F]{3}){1,2}$/i.test(l);
146
146
  }
147
- function de(o, P) {
147
+ function de(l, x) {
148
148
  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;
149
+ 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;
151
151
  });
152
152
  function g() {
153
153
  m.value = !1;
154
154
  }
155
- let i = 0;
156
- function u() {
157
- if (o.entryRespondDelay && (window.clearTimeout(i), !m.value)) {
158
- i = window.setTimeout(() => {
155
+ let u = 0;
156
+ function d() {
157
+ if (l.entryRespondDelay && (window.clearTimeout(u), !m.value)) {
158
+ u = window.setTimeout(() => {
159
159
  m.value = !0;
160
- }, o.entryRespondDelay);
160
+ }, l.entryRespondDelay);
161
161
  return;
162
162
  }
163
163
  m.value = !m.value;
164
164
  }
165
- return { panelShow: m, closePanel: g, togglePanel: u, entryStylesActual: t };
165
+ return { panelShow: m, closePanel: g, togglePanel: d, entryStylesActual: t };
166
166
  }
167
167
  function re() {
168
168
  window.alert("https://www.npmjs.com/package/@aurouscia/au-color-picker");
169
169
  }
170
- function W(o) {
171
- return o.startsWith("#") ? o.toUpperCase() : "#" + o.toUpperCase();
170
+ function O(l) {
171
+ return l.startsWith("#") ? l.toUpperCase() : "#" + l.toUpperCase();
172
172
  }
173
- function ve(o) {
173
+ function ve(l) {
174
174
  return {
175
175
  panelStyles: F(() => {
176
- const m = o.panelBaseZIndex;
176
+ const m = l.panelBaseZIndex;
177
177
  let t, g;
178
- const i = o.pos;
179
- return typeof i == "number" ? t = i + "px" : i == "left" ? g = "0px" : t = "0px", {
178
+ const u = l.pos;
179
+ return typeof u == "number" ? t = u + "px" : u == "left" ? g = "0px" : t = "0px", {
180
180
  zIndex: (m || 0) + 100,
181
181
  left: t,
182
182
  right: g
@@ -208,155 +208,155 @@ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams
208
208
  showPackageName: { type: Boolean }
209
209
  },
210
210
  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();
211
+ setup(l, { expose: x, emit: m }) {
212
+ const t = l, g = I(), u = I("#ff0000"), { panelShow: d, closePanel: k, togglePanel: E, entryStylesActual: $ } = de(t, u), { panelStyles: U } = ve(t);
213
+ function b(y) {
214
+ u.value = O(y), i();
215
215
  }
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;
216
+ const H = I("hex"), h = F(() => A.hex.rgb(u.value)), S = F(() => A.hex.hsv(u.value));
217
+ function w(y) {
218
+ const e = y.target;
219
219
  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();
220
+ const o = e.value;
221
+ if (o && ee(o)) {
222
+ u.value = O(o), g.value?.enforceTo(u.value), i();
223
223
  return;
224
224
  }
225
- e.value = i.value;
225
+ e.value = u.value;
226
226
  }
227
227
  }
228
- function b(x, e) {
229
- const n = x.target;
230
- if ("value" in n) {
231
- const M = n.value;
228
+ function B(y, e) {
229
+ const o = y.target;
230
+ if ("value" in o) {
231
+ const M = o.value;
232
232
  if (M) {
233
- let f = parseInt(M);
234
- if (isNaN(f))
235
- n.value = "0";
233
+ let v = parseInt(M);
234
+ if (isNaN(v))
235
+ o.value = "0";
236
236
  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();
237
+ 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();
240
240
  return;
241
241
  }
242
242
  }
243
243
  }
244
244
  }
245
- function y(x, e) {
246
- const n = x.target;
247
- if ("value" in n) {
248
- const M = n.value;
245
+ function n(y, e) {
246
+ const o = y.target;
247
+ if ("value" in o) {
248
+ const M = o.value;
249
249
  if (M) {
250
- let f = parseInt(M);
251
- if (isNaN(f))
252
- n.value = "0";
250
+ let v = parseInt(M);
251
+ if (isNaN(v))
252
+ o.value = "0";
253
253
  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();
254
+ e === "h" ? v > 359 && (v = 359) : v > 100 && (v = 100), v < 0 && (v = 0);
255
+ 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();
257
257
  return;
258
258
  }
259
259
  }
260
260
  }
261
261
  }
262
- function c() {
263
- q("update:modelValue", i.value);
262
+ function i() {
263
+ X("update:modelValue", u.value);
264
264
  }
265
- function r() {
266
- return i.value;
265
+ function f() {
266
+ return u.value;
267
267
  }
268
- function d(x) {
269
- if (ee(x)) {
270
- const e = W(x);
271
- i.value = e, g.value?.enforceTo(e);
268
+ function R(y) {
269
+ if (ee(y)) {
270
+ const e = O(y);
271
+ u.value = e, g.value?.enforceTo(e);
272
272
  }
273
273
  }
274
274
  ue(() => {
275
- t.modelValue ? d(t.modelValue) : t.initial && d(t.initial);
275
+ t.modelValue ? R(t.modelValue) : t.initial && R(t.initial);
276
276
  });
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($)),
277
+ const X = m;
278
+ return x({ closePanel: k, getCurrentHex: f, enforceTo: R }), W(() => t.modelValue, (y) => {
279
+ y && y !== u.value && R(y);
280
+ }), W(d, (y) => {
281
+ y === !1 && X("done");
282
+ }), (y, e) => (N(), T("div", Te, [
283
+ c("div", {
284
+ class: he(l.entryClassName || "acpEntry"),
285
+ style: j(P($)),
286
286
  onClick: e[0] || (e[0] = //@ts-ignore
287
- (...n) => k(E) && k(E)(...n))
287
+ (...o) => P(E) && P(E)(...o))
288
288
  }, null, 6),
289
- k(u) ? (N(), T("div", {
289
+ P(d) ? (N(), T("div", {
290
290
  key: 0,
291
291
  class: "acpPanel",
292
- style: X(k(L)),
293
- onClick: e[10] || (e[10] = (n) => o.panelClickStopPropagation && n.stopPropagation())
292
+ style: j(P(U)),
293
+ onClick: e[10] || (e[10] = (o) => l.panelClickStopPropagation && o.stopPropagation())
294
294
  }, [
295
- v("div", Ne, [
295
+ c("div", Ne, [
296
296
  ce(De, {
297
297
  ref_key: "ring",
298
298
  ref: g,
299
- "initial-hex": i.value,
300
- onChanged: B,
301
- "show-package-name": o.showPackageName
299
+ "initial-hex": u.value,
300
+ onChanged: b,
301
+ "show-package-name": l.showPackageName
302
302
  }, null, 8, ["initial-hex", "show-package-name"])
303
303
  ]),
304
- v("div", Re, [
305
- Q(v("select", {
306
- "onUpdate:modelValue": e[1] || (e[1] = (n) => H.value = n)
304
+ c("div", Re, [
305
+ Q(c("select", {
306
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => H.value = o)
307
307
  }, [...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)
308
+ c("option", { value: "hex" }, "HEX", -1),
309
+ c("option", { value: "rgb" }, "RGB", -1),
310
+ c("option", { value: "hsv" }, "HSV", -1)
311
311
  ])], 512), [
312
312
  [ke, H.value]
313
313
  ]),
314
314
  H.value == "hex" ? (N(), T("div", He, [
315
- v("input", {
316
- value: i.value,
317
- onBlur: R,
315
+ c("input", {
316
+ value: u.value,
317
+ onBlur: w,
318
318
  spellcheck: "false",
319
319
  maxlength: "7"
320
320
  }, null, 40, Me)
321
321
  ])) : H.value == "rgb" ? (N(), T("div", Ae, [
322
- v("input", {
322
+ c("input", {
323
323
  value: h.value[0],
324
- onBlur: e[2] || (e[2] = (n) => b(n, "r"))
324
+ onBlur: e[2] || (e[2] = (o) => B(o, "r"))
325
325
  }, null, 40, Ee),
326
- v("input", {
326
+ c("input", {
327
327
  value: h.value[1],
328
- onBlur: e[3] || (e[3] = (n) => b(n, "g"))
328
+ onBlur: e[3] || (e[3] = (o) => B(o, "g"))
329
329
  }, null, 40, $e),
330
- v("input", {
330
+ c("input", {
331
331
  value: h.value[2],
332
- onBlur: e[4] || (e[4] = (n) => b(n, "b"))
332
+ onBlur: e[4] || (e[4] = (o) => B(o, "b"))
333
333
  }, null, 40, qe)
334
334
  ])) : (N(), T("div", Ue, [
335
- v("input", {
336
- value: w.value[0],
337
- onBlur: e[5] || (e[5] = (n) => y(n, "h"))
335
+ c("input", {
336
+ value: S.value[0],
337
+ onBlur: e[5] || (e[5] = (o) => n(o, "h"))
338
338
  }, null, 40, Le),
339
- v("input", {
340
- value: w.value[1],
341
- onBlur: e[6] || (e[6] = (n) => y(n, "s"))
339
+ c("input", {
340
+ value: S.value[1],
341
+ onBlur: e[6] || (e[6] = (o) => n(o, "s"))
342
342
  }, null, 40, _e),
343
- v("input", {
344
- value: w.value[2],
345
- onBlur: e[7] || (e[7] = (n) => y(n, "v"))
343
+ c("input", {
344
+ value: S.value[2],
345
+ onBlur: e[7] || (e[7] = (o) => n(o, "v"))
346
346
  }, null, 40, ze)
347
347
  ]))
348
348
  ]),
349
- v("div", Oe, [
350
- v("button", {
349
+ c("div", Oe, [
350
+ c("button", {
351
351
  onClick: e[8] || (e[8] = //@ts-ignore
352
- (...n) => k(C) && k(C)(...n))
352
+ (...o) => P(k) && P(k)(...o))
353
353
  }, "OK")
354
354
  ]),
355
- o.showPackageName ? (N(), T("div", {
355
+ l.showPackageName ? (N(), T("div", {
356
356
  key: 0,
357
357
  class: "acpPackageName",
358
358
  onClick: e[9] || (e[9] = //@ts-ignore
359
- (...n) => k(re) && k(re)(...n))
359
+ (...o) => P(re) && P(re)(...o))
360
360
  }, " au-color-picker ")) : J("", !0)
361
361
  ], 4)) : J("", !0)
362
362
  ]));
@@ -380,112 +380,109 @@ const Te = { class: "acp" }, Ne = { class: "acpRing" }, Re = { class: "acpParams
380
380
  showPackageName: { type: Boolean }
381
381
  },
382
382
  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);
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);
390
390
  }
391
- const w = m;
392
- j(u, (c) => {
393
- w("update:modelValue", c);
391
+ const S = m;
392
+ W(d, (n) => {
393
+ S("update:modelValue", n);
394
394
  });
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);
395
+ function w(n) {
396
+ if (ee(n)) {
397
+ const i = O(n);
398
+ d.value = i, u.value?.enforceTo(i);
402
399
  }
403
400
  }
404
- function y(c) {
405
- c || h(void 0);
406
- const r = t.presets?.find((d) => d.name === c);
407
- r && h(r);
401
+ function B(n) {
402
+ n || h(void 0);
403
+ const i = t.presets?.find((f) => f.name === n);
404
+ i && h(i);
408
405
  }
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);
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);
415
412
  }), 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", {
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, [
415
+ c("div", {
419
416
  class: "acpEntry",
420
- style: X(k(B)),
421
- onClick: r[0] || (r[0] = //@ts-ignore
422
- (...d) => k(L) && k(L)(...d))
417
+ style: j(P(b)),
418
+ onClick: i[0] || (i[0] = //@ts-ignore
419
+ (...f) => P(U) && P(U)(...f))
423
420
  }, null, 4),
424
- k(E) ? (N(), T("div", {
421
+ P(E) ? (N(), T("div", {
425
422
  key: 0,
426
423
  class: "acpPanel",
427
- style: X(k(H)),
428
- onClick: r[6] || (r[6] = (d) => o.panelClickStopPropagation && d.stopPropagation())
424
+ style: j(P(H)),
425
+ onClick: i[6] || (i[6] = (f) => l.panelClickStopPropagation && f.stopPropagation())
429
426
  }, [
430
- v("div", Ze, [
431
- v("label", {
427
+ c("div", Ze, [
428
+ c("label", {
432
429
  for: "acpColorPresetCustom",
433
- onClick: r[3] || (r[3] = (d) => h(void 0))
430
+ onClick: i[3] || (i[3] = (f) => h(void 0))
434
431
  }, [
435
432
  ce(je, {
436
- modelValue: u.value,
437
- "onUpdate:modelValue": r[1] || (r[1] = (d) => u.value = d),
438
- onDone: R,
433
+ modelValue: d.value,
434
+ "onUpdate:modelValue": i[1] || (i[1] = (f) => d.value = f),
435
+ onDone: P($),
439
436
  "entry-class-name": "acpPresetBody",
440
437
  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", {
438
+ ref: u,
439
+ "show-package-name": l.showPackageName,
440
+ pos: l.posInternal
441
+ }, null, 8, ["modelValue", "onDone", "show-package-name", "pos"]),
442
+ Q(c("input", {
446
443
  name: "colorType",
447
444
  type: "radio",
448
445
  id: "acpColorPresetCustom",
449
446
  value: void 0,
450
- "onUpdate:modelValue": r[2] || (r[2] = (d) => g.value = d)
447
+ "onUpdate:modelValue": i[2] || (i[2] = (f) => g.value = f)
451
448
  }, null, 512), [
452
449
  [oe, g.value]
453
450
  ]),
454
- r[7] || (r[7] = v("div", { class: "acpPresetName" }, "自定义", -1))
451
+ i[7] || (i[7] = c("div", { class: "acpPresetName" }, "自定义", -1))
455
452
  ]),
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
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
461
458
  }, [
462
- v("div", {
459
+ c("div", {
463
460
  class: "acpPresetBody",
464
- style: X({ backgroundColor: d.colorHex })
461
+ style: j({ backgroundColor: f.colorHex })
465
462
  }, null, 4),
466
- Q(v("input", {
463
+ Q(c("input", {
467
464
  name: "colorType",
468
465
  type: "radio",
469
- id: `acpColorPreset${d.name}`,
470
- value: d.name,
471
- "onUpdate:modelValue": r[4] || (r[4] = (q) => g.value = q)
466
+ id: `acpColorPreset${f.name}`,
467
+ value: f.name,
468
+ "onUpdate:modelValue": i[4] || (i[4] = (R) => g.value = R)
472
469
  }, null, 8, Ke), [
473
470
  [oe, g.value]
474
471
  ]),
475
- v("div", Ye, we(d.name), 1)
472
+ c("div", Ye, we(f.name), 1)
476
473
  ], 8, Fe))), 128)),
477
- r[9] || (r[9] = v("div", { class: "acpSep" }, null, -1))
474
+ i[9] || (i[9] = c("div", { class: "acpSep" }, null, -1))
478
475
  ]),
479
- v("div", Ge, [
480
- v("button", {
481
- onClick: r[5] || (r[5] = //@ts-ignore
482
- (...d) => k($) && k($)(...d))
476
+ c("div", Ge, [
477
+ c("button", {
478
+ onClick: i[5] || (i[5] = //@ts-ignore
479
+ (...f) => P($) && P($)(...f))
483
480
  }, "OK")
484
481
  ])
485
482
  ], 4)) : J("", !0)
486
483
  ]));
487
484
  }
488
- }), tt = /* @__PURE__ */ ne(Je, [["__scopeId", "data-v-6d20c9c4"]]);
485
+ }), tt = /* @__PURE__ */ ne(Je, [["__scopeId", "data-v-1e965bbc"]]);
489
486
  export {
490
487
  je as AuColorPicker,
491
488
  tt as AuColorPickerPresetsNested,
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.1",
4
4
  "author": {
5
5
  "name": "Au"
6
6
  },