@orchidui/dashboard 1.8.1-82 → 1.8.1-85
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.
- package/dist/Dashboard/Card/OcCard.js +2 -3
- package/dist/Dashboard/TextEditor/QuillEditor.js +1 -1
- package/dist/{OcCard-BFYO-xBE.js → OcCard-BpqC7suH.js} +1 -1
- package/dist/{OcLottieAnimation-cF06yacT.js → OcLottieAnimation-EBkAB8-y.js} +1 -1
- package/dist/{QuillEditor-DbGwG5RB.js → QuillEditor-BHWfmp5D.js} +689 -665
- package/dist/index.js +1848 -28
- package/package.json +1 -1
- package/dist/OcColorPicker-BZ3zytCj.js +0 -128
- package/dist/OcColorPickerPopup-sjvpeV8l.js +0 -1127
- package/dist/OcOnboardingProgressbar-BsqF90Gn.js +0 -77
- package/dist/OcTextEditor-BWOvVmgS.js +0 -522
- package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
|
@@ -1,1127 +0,0 @@
|
|
|
1
|
-
import { ref as k, watch as _, openBlock as $, createBlock as P, unref as U, withKeys as Ue, createElementBlock as C, createVNode as D, withCtx as K, createTextVNode as Z, inject as oe, createElementVNode as w, normalizeClass as J, normalizeStyle as W, onMounted as Ne, createCommentVNode as H, computed as lt, reactive as Le, provide as se, nextTick as at, Fragment as Re, renderList as Be, withDirectives as nt, vShow as rt } from "vue";
|
|
2
|
-
import { Input as ie, Select as st, Icon as ot, Slider as fe } from "@orchidui/core";
|
|
3
|
-
import { hslToRgb as He, hsl2Hex as De, rgb2Hex as Ee, rgbaToHex8 as it, hexToRgb as be, rgbToHue as ce, rgbToHsl as Xe, hex8ToRgba as ut, parseRgba as dt, parseRgb as ct } from "./Dashboard/ColorPicker/components/converters.js";
|
|
4
|
-
const pt = {
|
|
5
|
-
__name: "InputHex",
|
|
6
|
-
props: {
|
|
7
|
-
modelValue: {
|
|
8
|
-
type: String
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
emits: {
|
|
12
|
-
"update:modelValue": []
|
|
13
|
-
},
|
|
14
|
-
setup(i, { emit: V }) {
|
|
15
|
-
const c = i, f = V, o = k(""), I = (u) => {
|
|
16
|
-
o.value = u, o.value = `#${u.replace(/#/g, "")}`;
|
|
17
|
-
}, b = () => {
|
|
18
|
-
let u = o.value;
|
|
19
|
-
if (u === c.modelValue) return;
|
|
20
|
-
if (!/^#[0-9a-fA-F]+$/.test(u)) {
|
|
21
|
-
o.value = c.modelValue;
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
let a = u.replace(/#/g, "");
|
|
25
|
-
switch (a.length) {
|
|
26
|
-
case 0:
|
|
27
|
-
a = c.modelValue.replace("#", "");
|
|
28
|
-
break;
|
|
29
|
-
case 1:
|
|
30
|
-
case 2:
|
|
31
|
-
a = a.repeat(3);
|
|
32
|
-
break;
|
|
33
|
-
case 4:
|
|
34
|
-
case 5:
|
|
35
|
-
a = a.slice(0, 3);
|
|
36
|
-
break;
|
|
37
|
-
case 3:
|
|
38
|
-
case 6:
|
|
39
|
-
break;
|
|
40
|
-
default:
|
|
41
|
-
a = a.slice(0, 6);
|
|
42
|
-
}
|
|
43
|
-
o.value = `#${a.toUpperCase()}`, f("update:modelValue", o.value);
|
|
44
|
-
};
|
|
45
|
-
return _(
|
|
46
|
-
() => c.modelValue,
|
|
47
|
-
(u, a) => {
|
|
48
|
-
u !== a && (o.value = u);
|
|
49
|
-
},
|
|
50
|
-
{ immediate: !0 }
|
|
51
|
-
), (u, a) => ($(), P(U(ie), {
|
|
52
|
-
class: "w-[158px]",
|
|
53
|
-
placeholder: "#FFFFFF",
|
|
54
|
-
"model-value": o.value,
|
|
55
|
-
"onUpdate:modelValue": I,
|
|
56
|
-
onBlur: b,
|
|
57
|
-
onKeyup: Ue(b, ["enter"])
|
|
58
|
-
}, null, 8, ["model-value"]));
|
|
59
|
-
}
|
|
60
|
-
}, gt = { class: "grid grid-cols-3 gap-3" }, Me = {
|
|
61
|
-
__name: "InputRgbHsl",
|
|
62
|
-
props: {
|
|
63
|
-
inputType: {
|
|
64
|
-
default: "RGB",
|
|
65
|
-
type: String
|
|
66
|
-
},
|
|
67
|
-
rgbValue: {
|
|
68
|
-
type: Object
|
|
69
|
-
},
|
|
70
|
-
hslValue: {
|
|
71
|
-
type: Object
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
emits: {
|
|
75
|
-
"update-rgb-value": [],
|
|
76
|
-
"update-hsl-value": []
|
|
77
|
-
},
|
|
78
|
-
setup(i, { emit: V }) {
|
|
79
|
-
const c = i, f = V, o = k({
|
|
80
|
-
r: 0,
|
|
81
|
-
g: 0,
|
|
82
|
-
b: 0
|
|
83
|
-
}), I = k(), b = k(), u = k(), a = (S, y) => {
|
|
84
|
-
var N, B, Y;
|
|
85
|
-
let x = 255;
|
|
86
|
-
if (c.inputType == "HSL" && (x = 100, S == "r" && (x = 360)), !isNaN(parseInt(y))) {
|
|
87
|
-
if (S == "r") {
|
|
88
|
-
let E = parseInt(y);
|
|
89
|
-
E <= x && (o.value.r = E, c.inputType == "RGB" ? M("r") : j()), (N = I.value) == null || N.focus();
|
|
90
|
-
} else if (S == "g") {
|
|
91
|
-
let E = parseInt(y);
|
|
92
|
-
E <= x && (o.value.g = E, c.inputType == "RGB" ? M("g") : j()), (B = b.value) == null || B.focus();
|
|
93
|
-
} else if (S == "b") {
|
|
94
|
-
let E = parseInt(y);
|
|
95
|
-
E <= x && (o.value.b = E, c.inputType == "RGB" ? M("b") : j()), (Y = u.value) == null || Y.focus();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}, M = (S) => {
|
|
99
|
-
f("update-rgb-value", {
|
|
100
|
-
type: S,
|
|
101
|
-
value: {
|
|
102
|
-
r: parseInt(o.value.r),
|
|
103
|
-
g: parseInt(o.value.g),
|
|
104
|
-
b: parseInt(o.value.b)
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}, j = () => {
|
|
108
|
-
f("update-hsl-value", {
|
|
109
|
-
h: parseInt(o.value.r),
|
|
110
|
-
s: parseInt(o.value.g),
|
|
111
|
-
l: parseInt(o.value.b)
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
return c.inputType === "RGB" ? _(
|
|
115
|
-
() => c.rgbValue,
|
|
116
|
-
(S, y) => {
|
|
117
|
-
S !== y && (o.value = S);
|
|
118
|
-
},
|
|
119
|
-
{ immediate: !0, deep: !0 }
|
|
120
|
-
) : _(
|
|
121
|
-
() => c.hslValue,
|
|
122
|
-
(S) => {
|
|
123
|
-
o.value = {
|
|
124
|
-
r: S.h,
|
|
125
|
-
g: S.s,
|
|
126
|
-
b: S.l
|
|
127
|
-
};
|
|
128
|
-
},
|
|
129
|
-
{ immediate: !0, deep: !0 }
|
|
130
|
-
), (S, y) => ($(), C("div", gt, [
|
|
131
|
-
D(U(ie), {
|
|
132
|
-
ref_key: "rInputEl",
|
|
133
|
-
ref: I,
|
|
134
|
-
"model-value": o.value.r,
|
|
135
|
-
placeholder: "100",
|
|
136
|
-
"onUpdate:modelValue": y[0] || (y[0] = (x) => a("r", x))
|
|
137
|
-
}, null, 8, ["model-value"]),
|
|
138
|
-
D(U(ie), {
|
|
139
|
-
ref_key: "gInputEl",
|
|
140
|
-
ref: b,
|
|
141
|
-
"model-value": o.value.g,
|
|
142
|
-
placeholder: "100",
|
|
143
|
-
"onUpdate:modelValue": y[1] || (y[1] = (x) => a("g", x))
|
|
144
|
-
}, null, 8, ["model-value"]),
|
|
145
|
-
D(U(ie), {
|
|
146
|
-
ref_key: "bInputEl",
|
|
147
|
-
ref: u,
|
|
148
|
-
"model-value": o.value.b,
|
|
149
|
-
placeholder: "100",
|
|
150
|
-
"onUpdate:modelValue": y[2] || (y[2] = (x) => a("b", x))
|
|
151
|
-
}, null, 8, ["model-value"])
|
|
152
|
-
]));
|
|
153
|
-
}
|
|
154
|
-
}, vt = {
|
|
155
|
-
__name: "InputOpacity",
|
|
156
|
-
props: {
|
|
157
|
-
modelValue: {
|
|
158
|
-
type: Number
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
emits: {
|
|
162
|
-
"update:modelValue": []
|
|
163
|
-
},
|
|
164
|
-
setup(i, { emit: V }) {
|
|
165
|
-
const c = i, f = V, o = k(""), I = (u) => {
|
|
166
|
-
o.value = u;
|
|
167
|
-
}, b = () => {
|
|
168
|
-
let u = parseInt(o.value);
|
|
169
|
-
u && u <= 100 ? f("update:modelValue", u) : o.value = c.modelValue;
|
|
170
|
-
};
|
|
171
|
-
return _(
|
|
172
|
-
() => c.modelValue,
|
|
173
|
-
(u, a) => {
|
|
174
|
-
u !== a && (o.value = u);
|
|
175
|
-
},
|
|
176
|
-
{ immediate: !0 }
|
|
177
|
-
), (u, a) => ($(), P(U(ie), {
|
|
178
|
-
class: "w-[75px]",
|
|
179
|
-
placeholder: "100",
|
|
180
|
-
"model-value": o.value,
|
|
181
|
-
"onUpdate:modelValue": I,
|
|
182
|
-
onBlur: b,
|
|
183
|
-
onKeyup: Ue(b, ["enter"])
|
|
184
|
-
}, {
|
|
185
|
-
leading: K(() => a[0] || (a[0] = [
|
|
186
|
-
Z("%")
|
|
187
|
-
])),
|
|
188
|
-
_: 1
|
|
189
|
-
}, 8, ["model-value"]));
|
|
190
|
-
}
|
|
191
|
-
}, mt = {
|
|
192
|
-
__name: "SelectColorFormat",
|
|
193
|
-
props: {
|
|
194
|
-
modelValue: { default: "RGB", type: String }
|
|
195
|
-
},
|
|
196
|
-
emits: ["update:model-value"],
|
|
197
|
-
setup(i, { emit: V }) {
|
|
198
|
-
const f = k(i.modelValue), o = V, I = (b) => {
|
|
199
|
-
f.value = b, o("update:model-value", b);
|
|
200
|
-
};
|
|
201
|
-
return (b, u) => ($(), P(U(st), {
|
|
202
|
-
class: "!w-[80px]",
|
|
203
|
-
"model-value": f.value,
|
|
204
|
-
options: [
|
|
205
|
-
{
|
|
206
|
-
label: "HEX",
|
|
207
|
-
value: "HEX"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
label: "RGB",
|
|
211
|
-
value: "RGB"
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
label: "HSL",
|
|
215
|
-
value: "HSL"
|
|
216
|
-
}
|
|
217
|
-
],
|
|
218
|
-
"onUpdate:modelValue": I
|
|
219
|
-
}, null, 8, ["model-value"]));
|
|
220
|
-
}
|
|
221
|
-
}, ft = { class: "opacity-bar" }, bt = { class: "picker-opacity-slider opacity-bar-background" }, yt = ["value"], ht = {
|
|
222
|
-
__name: "SliderOpacity",
|
|
223
|
-
props: {
|
|
224
|
-
modelValue: { default: 0, type: Number }
|
|
225
|
-
},
|
|
226
|
-
emits: ["update:modelValue", "onInput"],
|
|
227
|
-
setup(i, { emit: V }) {
|
|
228
|
-
const c = oe("opacitySlider"), f = V, o = (I) => {
|
|
229
|
-
f("update:modelValue", parseInt(I.target.value)), f("onInput", I);
|
|
230
|
-
};
|
|
231
|
-
return (I, b) => ($(), C("div", ft, [
|
|
232
|
-
w("div", bt, [
|
|
233
|
-
w("input", {
|
|
234
|
-
ref_key: "opacitySlider",
|
|
235
|
-
ref: c,
|
|
236
|
-
value: i.modelValue,
|
|
237
|
-
class: "opacity__slider",
|
|
238
|
-
type: "range",
|
|
239
|
-
min: "0",
|
|
240
|
-
max: "100",
|
|
241
|
-
onInput: o
|
|
242
|
-
}, null, 40, yt)
|
|
243
|
-
])
|
|
244
|
-
]));
|
|
245
|
-
}
|
|
246
|
-
}, $t = {
|
|
247
|
-
__name: "SliderGradient",
|
|
248
|
-
props: {
|
|
249
|
-
gradientType: String
|
|
250
|
-
},
|
|
251
|
-
emits: ["onAddColor", "onMouseDown", "onDeleteColor"],
|
|
252
|
-
setup(i, { emit: V }) {
|
|
253
|
-
const c = oe("gradientBar"), f = k(), o = V, I = (y) => {
|
|
254
|
-
y.preventDefault();
|
|
255
|
-
}, b = k("left:0"), u = k(!1), a = (y) => {
|
|
256
|
-
o("onMouseDown", y);
|
|
257
|
-
}, M = () => {
|
|
258
|
-
let y = f.value.querySelector(".select");
|
|
259
|
-
b.value = y == null ? void 0 : y.getAttribute("style");
|
|
260
|
-
}, j = () => {
|
|
261
|
-
var x;
|
|
262
|
-
M(), (((x = f.value.querySelectorAll(".gradient-handle")) == null ? void 0 : x.length) ?? 2) > 2 ? u.value = !0 : u.value = !1;
|
|
263
|
-
}, S = (y) => {
|
|
264
|
-
u.value = !1, o("onAddColor", y);
|
|
265
|
-
};
|
|
266
|
-
return (y, x) => ($(), C("div", {
|
|
267
|
-
ref_key: "gradientSlider",
|
|
268
|
-
ref: f,
|
|
269
|
-
class: "relative h-[40px]",
|
|
270
|
-
onClick: j
|
|
271
|
-
}, [
|
|
272
|
-
w("button", {
|
|
273
|
-
type: "button",
|
|
274
|
-
class: J(["absolute top-[-18px] text-oc-accent-3 rounded-[4px] border-2 border-oc-gray-200 p-2 bg-oc-bg-light", u.value ? "" : "!hidden"]),
|
|
275
|
-
style: W(b.value),
|
|
276
|
-
onClick: x[0] || (x[0] = (N) => y.$emit("onDeleteColor"))
|
|
277
|
-
}, [
|
|
278
|
-
D(U(ot), {
|
|
279
|
-
name: "bin",
|
|
280
|
-
width: "14",
|
|
281
|
-
height: "14"
|
|
282
|
-
})
|
|
283
|
-
], 6),
|
|
284
|
-
w("div", {
|
|
285
|
-
class: J(["gradient-bar", {
|
|
286
|
-
"mt-[20px]": i.gradientType === "linear",
|
|
287
|
-
"mt-[12px]": i.gradientType === "radial"
|
|
288
|
-
}]),
|
|
289
|
-
onMousedown: a,
|
|
290
|
-
onDragstart: I
|
|
291
|
-
}, [
|
|
292
|
-
w("div", {
|
|
293
|
-
ref_key: "gradientBar",
|
|
294
|
-
ref: c,
|
|
295
|
-
class: "gradient-container",
|
|
296
|
-
onDblclick: S
|
|
297
|
-
}, null, 544)
|
|
298
|
-
], 34)
|
|
299
|
-
], 512));
|
|
300
|
-
}
|
|
301
|
-
}, xt = { class: "picker-hue" }, kt = ["value"], It = {
|
|
302
|
-
__name: "SliderHue",
|
|
303
|
-
props: {
|
|
304
|
-
modelValue: { default: 0, type: Number }
|
|
305
|
-
},
|
|
306
|
-
emits: ["update:modelValue", "onInput", "onChange"],
|
|
307
|
-
setup(i, { emit: V }) {
|
|
308
|
-
const c = V, f = (o) => {
|
|
309
|
-
c("update:modelValue", parseFloat(o.target.value)), c("onInput", o);
|
|
310
|
-
};
|
|
311
|
-
return (o, I) => ($(), C("div", xt, [
|
|
312
|
-
w("input", {
|
|
313
|
-
value: i.modelValue,
|
|
314
|
-
class: "picker-hue-range-slider",
|
|
315
|
-
type: "range",
|
|
316
|
-
min: "0",
|
|
317
|
-
max: "360",
|
|
318
|
-
step: "0.1",
|
|
319
|
-
onInput: f,
|
|
320
|
-
onChange: I[0] || (I[0] = (b) => o.$emit("onChange", b))
|
|
321
|
-
}, null, 40, kt)
|
|
322
|
-
]));
|
|
323
|
-
}
|
|
324
|
-
}, wt = { class: "px-2 mt-2" }, Vt = {
|
|
325
|
-
key: 1,
|
|
326
|
-
class: "grid grid-cols-2 gap-4 px-1"
|
|
327
|
-
}, Ct = {
|
|
328
|
-
__name: "GradientSettings",
|
|
329
|
-
props: {
|
|
330
|
-
mode: {
|
|
331
|
-
default: "gradient",
|
|
332
|
-
type: String
|
|
333
|
-
},
|
|
334
|
-
gradientType: { default: "linear", type: String },
|
|
335
|
-
angle: { default: 90, type: Number },
|
|
336
|
-
percentageX: { default: 50, type: Number },
|
|
337
|
-
percentageY: { default: 50, type: Number }
|
|
338
|
-
},
|
|
339
|
-
emits: ["update:angle", "update:percentageX", "update:percentageY", "onInput"],
|
|
340
|
-
setup(i, { emit: V }) {
|
|
341
|
-
const c = k(!1), f = k(!1);
|
|
342
|
-
Ne(() => {
|
|
343
|
-
c.value = !0, f.value = !0;
|
|
344
|
-
});
|
|
345
|
-
const o = V, I = (b, u) => {
|
|
346
|
-
let a = parseInt(b);
|
|
347
|
-
switch (u) {
|
|
348
|
-
case "angle":
|
|
349
|
-
b > 360 ? a = 360 : b < 0 && (a = 0), o("update:angle", a), o("onInput");
|
|
350
|
-
break;
|
|
351
|
-
case "percentageX":
|
|
352
|
-
b > 100 ? a = 100 : b < 0 && (a = 0), o("update:percentageX", a), o("onInput");
|
|
353
|
-
break;
|
|
354
|
-
case "percentageY":
|
|
355
|
-
b > 100 ? a = 100 : b < 0 && (a = 0), o("update:percentageY", a), o("onInput");
|
|
356
|
-
break;
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
return (b, u) => ($(), C("div", wt, [
|
|
360
|
-
i.gradientType == "linear" && c.value ? ($(), P(U(fe), {
|
|
361
|
-
key: 0,
|
|
362
|
-
label: "Angle",
|
|
363
|
-
"model-value": i.angle,
|
|
364
|
-
"min-limit": 0,
|
|
365
|
-
"max-limit": 360,
|
|
366
|
-
"onUpdate:modelValue": u[0] || (u[0] = (a) => I(a, "angle"))
|
|
367
|
-
}, {
|
|
368
|
-
"min-limit-label": K(() => u[3] || (u[3] = [
|
|
369
|
-
Z("0 ")
|
|
370
|
-
])),
|
|
371
|
-
"max-limit-label": K(() => u[4] || (u[4] = [
|
|
372
|
-
Z("360"),
|
|
373
|
-
w("span", null, "°", -1)
|
|
374
|
-
])),
|
|
375
|
-
_: 1
|
|
376
|
-
}, 8, ["model-value"])) : H("", !0),
|
|
377
|
-
i.gradientType == "radial" && f.value ? ($(), C("div", Vt, [
|
|
378
|
-
D(U(fe), {
|
|
379
|
-
label: "Position X",
|
|
380
|
-
"model-value": i.percentageX,
|
|
381
|
-
"min-limit": 0,
|
|
382
|
-
"max-limit": 100,
|
|
383
|
-
"onUpdate:modelValue": u[1] || (u[1] = (a) => I(a, "percentageX"))
|
|
384
|
-
}, {
|
|
385
|
-
"min-limit-label": K(() => u[5] || (u[5] = [
|
|
386
|
-
Z("0")
|
|
387
|
-
])),
|
|
388
|
-
"max-limit-label": K(() => u[6] || (u[6] = [
|
|
389
|
-
Z("100%")
|
|
390
|
-
])),
|
|
391
|
-
_: 1
|
|
392
|
-
}, 8, ["model-value"]),
|
|
393
|
-
D(U(fe), {
|
|
394
|
-
label: "Position Y",
|
|
395
|
-
"model-value": i.percentageY,
|
|
396
|
-
"min-limit": 0,
|
|
397
|
-
"max-limit": 100,
|
|
398
|
-
"onUpdate:modelValue": u[2] || (u[2] = (a) => I(a, "percentageY"))
|
|
399
|
-
}, {
|
|
400
|
-
"min-limit-label": K(() => u[7] || (u[7] = [
|
|
401
|
-
Z("0")
|
|
402
|
-
])),
|
|
403
|
-
"max-limit-label": K(() => u[8] || (u[8] = [
|
|
404
|
-
Z("100%")
|
|
405
|
-
])),
|
|
406
|
-
_: 1
|
|
407
|
-
}, 8, ["model-value"])
|
|
408
|
-
])) : H("", !0)
|
|
409
|
-
]));
|
|
410
|
-
}
|
|
411
|
-
}, St = {
|
|
412
|
-
__name: "PickerWrap",
|
|
413
|
-
emits: ["onMouseDown"],
|
|
414
|
-
setup(i) {
|
|
415
|
-
const V = oe("canvas"), c = oe("pickerWrap"), f = oe("pickerPointer"), o = (I) => {
|
|
416
|
-
I.preventDefault();
|
|
417
|
-
};
|
|
418
|
-
return (I, b) => ($(), C("div", {
|
|
419
|
-
ref_key: "pickerWrap",
|
|
420
|
-
ref: c,
|
|
421
|
-
class: "cp-picker-wrap",
|
|
422
|
-
onMousedown: b[0] || (b[0] = (u) => I.$emit("onMouseDown", u)),
|
|
423
|
-
onDragstart: o
|
|
424
|
-
}, [
|
|
425
|
-
w("canvas", {
|
|
426
|
-
ref_key: "canvas",
|
|
427
|
-
ref: V,
|
|
428
|
-
class: "colour-area"
|
|
429
|
-
}, null, 512),
|
|
430
|
-
b[1] || (b[1] = w("div", { class: "colour-area-mask" }, null, -1)),
|
|
431
|
-
w("div", {
|
|
432
|
-
ref_key: "pickerPointer",
|
|
433
|
-
ref: f,
|
|
434
|
-
class: "colour-area-point-circle"
|
|
435
|
-
}, null, 512)
|
|
436
|
-
], 544));
|
|
437
|
-
}
|
|
438
|
-
}, Tt = { class: "w-full flex justify-center" }, Lt = {
|
|
439
|
-
key: 1,
|
|
440
|
-
width: "28",
|
|
441
|
-
height: "28",
|
|
442
|
-
viewBox: "0 0 28 28",
|
|
443
|
-
fill: "none",
|
|
444
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
445
|
-
}, Rt = {
|
|
446
|
-
__name: "ColorType",
|
|
447
|
-
props: {
|
|
448
|
-
variant: String,
|
|
449
|
-
mode: {
|
|
450
|
-
default: "gradient",
|
|
451
|
-
type: String
|
|
452
|
-
},
|
|
453
|
-
gradientType: { default: "linear", type: String },
|
|
454
|
-
iconClasses: {
|
|
455
|
-
default: () => ({
|
|
456
|
-
linear: "",
|
|
457
|
-
radial: ""
|
|
458
|
-
}),
|
|
459
|
-
type: Object
|
|
460
|
-
},
|
|
461
|
-
modelValue: String
|
|
462
|
-
},
|
|
463
|
-
emits: ["onChangeMode"],
|
|
464
|
-
setup(i) {
|
|
465
|
-
return (V, c) => ($(), C("div", Tt, [
|
|
466
|
-
w("button", {
|
|
467
|
-
type: "button",
|
|
468
|
-
class: J(i.mode == "solid" ? "active" : ""),
|
|
469
|
-
style: { padding: "7px" },
|
|
470
|
-
onClick: c[0] || (c[0] = (f) => V.$emit("onChangeMode", "solid"))
|
|
471
|
-
}, [
|
|
472
|
-
i.modelValue && i.mode == "solid" ? ($(), C("div", {
|
|
473
|
-
key: 0,
|
|
474
|
-
class: "w-[28px] h-[28px] rounded-full border",
|
|
475
|
-
style: W(`background:${i.modelValue}`)
|
|
476
|
-
}, null, 4)) : ($(), C("svg", Lt, c[3] || (c[3] = [
|
|
477
|
-
w("g", { opacity: "0.5" }, [
|
|
478
|
-
w("path", {
|
|
479
|
-
d: "M0 14C0 6.26801 6.26801 0 14 0C21.732 0 28 6.26801 28 14C28 21.732 21.732 28 14 28C6.26801 28 0 21.732 0 14Z",
|
|
480
|
-
fill: "#03102F"
|
|
481
|
-
})
|
|
482
|
-
], -1)
|
|
483
|
-
])))
|
|
484
|
-
], 2),
|
|
485
|
-
w("button", {
|
|
486
|
-
type: "button",
|
|
487
|
-
class: J(i.gradientType == "linear" && i.mode != "solid" ? "active" : ""),
|
|
488
|
-
style: W(`${i.iconClasses.linear ? "" : "padding: 7px;"}`),
|
|
489
|
-
onClick: c[1] || (c[1] = (f) => V.$emit("onChangeMode", "linear"))
|
|
490
|
-
}, [
|
|
491
|
-
w("div", {
|
|
492
|
-
class: "w-[28px] h-[28px] rounded-full border",
|
|
493
|
-
style: W(
|
|
494
|
-
i.modelValue && i.gradientType == "linear" && i.mode != "solid" ? `background:${i.modelValue}` : `
|
|
495
|
-
background: linear-gradient(
|
|
496
|
-
180deg,
|
|
497
|
-
#03102f 0%,
|
|
498
|
-
rgba(3, 16, 47, 0) 100%
|
|
499
|
-
);
|
|
500
|
-
`
|
|
501
|
-
)
|
|
502
|
-
}, null, 4)
|
|
503
|
-
], 6),
|
|
504
|
-
w("button", {
|
|
505
|
-
type: "button",
|
|
506
|
-
class: J(i.gradientType == "radial" && i.mode != "solid" ? "active" : ""),
|
|
507
|
-
style: W(`${i.iconClasses.radial ? "" : "padding: 6px;"}`),
|
|
508
|
-
onClick: c[2] || (c[2] = (f) => V.$emit("onChangeMode", "radial"))
|
|
509
|
-
}, [
|
|
510
|
-
w("div", {
|
|
511
|
-
class: "w-[28px] h-[28px] rounded-full border",
|
|
512
|
-
style: W(
|
|
513
|
-
i.modelValue && i.gradientType == "radial" && i.mode != "solid" ? `background:${i.modelValue}` : "background: radial-gradient(circle at 50% 50%, rgb(255, 255, 255) 0%, rgb(3, 16, 47) 100%);"
|
|
514
|
-
)
|
|
515
|
-
}, null, 4)
|
|
516
|
-
], 6)
|
|
517
|
-
]));
|
|
518
|
-
}
|
|
519
|
-
}, Bt = ["cp-theme"], Ht = {
|
|
520
|
-
key: 0,
|
|
521
|
-
class: "flex justify-end border-b h-[46px] relative mt-[-5px] mb-5"
|
|
522
|
-
}, Dt = {
|
|
523
|
-
key: 1,
|
|
524
|
-
class: "grid items-center mb-5"
|
|
525
|
-
}, Et = { key: 2 }, Xt = { key: 0 }, Mt = { class: "ck-cp-local-color-conatiner" }, Ut = ["onClick"], Nt = { class: "flex items-center gap-2" }, Ot = { id: "ck-cp-target-background" }, Gt = { class: "flex gap-3" }, Pt = {
|
|
526
|
-
key: 0,
|
|
527
|
-
class: "w-full flex gap-3"
|
|
528
|
-
}, Yt = {
|
|
529
|
-
key: 4,
|
|
530
|
-
class: "ck-cp-local-color-conatiner"
|
|
531
|
-
}, Ft = ["onClick"], jt = {
|
|
532
|
-
__name: "OcColorPickerPopup",
|
|
533
|
-
props: {
|
|
534
|
-
modelValue: {
|
|
535
|
-
default: "",
|
|
536
|
-
type: String
|
|
537
|
-
},
|
|
538
|
-
type: { default: "HEX8", type: String },
|
|
539
|
-
inputType: { default: "HEX", type: String },
|
|
540
|
-
theme: { default: "light", type: String },
|
|
541
|
-
showColorList: { default: !0, type: Boolean },
|
|
542
|
-
showEyeDrop: { default: !0, type: Boolean },
|
|
543
|
-
showAlpha: { default: !0, type: Boolean },
|
|
544
|
-
showInputMenu: { default: !0, type: Boolean },
|
|
545
|
-
showInputSet: { default: !0, type: Boolean },
|
|
546
|
-
disabled: { default: !1, type: Boolean },
|
|
547
|
-
iconClasses: {
|
|
548
|
-
default: () => ({
|
|
549
|
-
linear: "",
|
|
550
|
-
radial: "",
|
|
551
|
-
ruler: "",
|
|
552
|
-
eyeDroper: "",
|
|
553
|
-
inputMenu: "",
|
|
554
|
-
save: "",
|
|
555
|
-
delete: ""
|
|
556
|
-
}),
|
|
557
|
-
type: Object
|
|
558
|
-
},
|
|
559
|
-
presetColors: Array,
|
|
560
|
-
variant: {
|
|
561
|
-
type: String,
|
|
562
|
-
default: "solid"
|
|
563
|
-
},
|
|
564
|
-
lastUsedColors: Array
|
|
565
|
-
},
|
|
566
|
-
emits: ["update:modelValue", "last-used-pick"],
|
|
567
|
-
setup(i, { emit: V }) {
|
|
568
|
-
const c = i, f = k(c.variant == "gradient" ? "gradient" : "solid"), o = k(null), I = V, b = k(c.modelValue), u = (t) => {
|
|
569
|
-
b.value = t, Y.value && I("update:modelValue", t);
|
|
570
|
-
}, a = k([
|
|
571
|
-
{ id: 1, r: 68, g: 71, b: 119, a: 100, percent: 0, hue: 0, select: !0 },
|
|
572
|
-
{ id: 2, r: 0, g: 0, b: 255, a: 100, percent: 100, hue: 0, select: !1 }
|
|
573
|
-
]), M = k(c.lastUsedColors);
|
|
574
|
-
_(
|
|
575
|
-
() => c.lastUsedColors,
|
|
576
|
-
() => {
|
|
577
|
-
M.value = c.lastUsedColors;
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
deep: !0
|
|
581
|
-
}
|
|
582
|
-
);
|
|
583
|
-
const j = lt(() => c.variant !== "gradient" ? M.value.filter((t) => !t.includes("linear") && !t.includes("radial")) : M.value), S = k(!1), y = k("linear"), x = Le({
|
|
584
|
-
angle: 90,
|
|
585
|
-
percentageX: 50,
|
|
586
|
-
percentageY: 50
|
|
587
|
-
}), N = k(""), B = k(c.inputType), Y = k(!1), E = k(), ue = k(), z = k(), O = k(), h = k(), L = Le({
|
|
588
|
-
h: 0,
|
|
589
|
-
s: 0,
|
|
590
|
-
l: 0
|
|
591
|
-
});
|
|
592
|
-
se("gradientBar", ue), se("canvas", z), se("pickerWrap", O), se("pickerPointer", h), se("opacitySlider", E);
|
|
593
|
-
let ee = 0, te = 0, ye = 0, he = 0, le = 0, ae = 0;
|
|
594
|
-
const Oe = (t) => {
|
|
595
|
-
!O.value || !h.value || (le = O.value.offsetHeight - h.value.offsetHeight, ae = O.value.offsetWidth - h.value.offsetWidth, ye = t.clientX - t.target.getBoundingClientRect().left, he = t.clientY - t.target.getBoundingClientRect().top, ee = ye - h.value.offsetWidth / 2, te = he - h.value.offsetHeight / 2, h.value.style.left = `${ee}px`, h.value.style.top = `${te}px`, pe(!1), Q(), window.addEventListener("mousemove", $e), window.addEventListener("mouseup", xe));
|
|
596
|
-
}, $e = (t) => {
|
|
597
|
-
t.preventDefault();
|
|
598
|
-
const e = O.value.getBoundingClientRect(), l = t.clientX - e.left - h.value.offsetWidth / 2, n = t.clientY - e.top - h.value.offsetHeight / 2;
|
|
599
|
-
l >= 0 && l <= ae ? (ee = l, h.value.style.left = `${l}px`) : 0 > l ? (ee = 0, h.value.style.left = "0px") : l > ae && (ee = ae, h.value.style.left = `${ae}px`), n >= 0 && n <= le ? (te = n, h.value.style.top = `${n}px`) : 0 > n ? (te = 0, h.value.style.top = "0px") : n > le && (te = le, h.value.style.top = `${le}px`), pe(!1), Q();
|
|
600
|
-
}, xe = () => {
|
|
601
|
-
window.removeEventListener("mousemove", $e), window.removeEventListener("mouseup", xe);
|
|
602
|
-
}, pe = (t) => {
|
|
603
|
-
if (!t) {
|
|
604
|
-
let e = Ge();
|
|
605
|
-
const l = He(F.value, e.s, e.l);
|
|
606
|
-
if (l) {
|
|
607
|
-
if (Y.value) {
|
|
608
|
-
let n = a.value.find((r) => r.select == !0);
|
|
609
|
-
n && (n.r = l.r, n.g = l.g, n.b = l.b);
|
|
610
|
-
}
|
|
611
|
-
q(), R();
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}, F = k(0), ge = async (t) => {
|
|
615
|
-
const { rgb: e } = De(F.value, 100, 50);
|
|
616
|
-
Se(e), setTimeout(() => {
|
|
617
|
-
pe(t), Q();
|
|
618
|
-
}, 0);
|
|
619
|
-
}, Ge = () => {
|
|
620
|
-
let t = { s: 0, l: 0 }, e = O.value.offsetWidth - h.value.offsetWidth, l = O.value.offsetHeight - h.value.offsetHeight, n = parseInt(h.value.style.left), s = 1 - parseInt(h.value.style.top) / l, p = n / e;
|
|
621
|
-
return t.l = s / 2 * (2 - p), t.s = s * p / (1 - Math.abs(2 * t.l - 1)), Number.isNaN(t.s) && (t.s = t.l), t.l = t.l > 1 ? 1 : t.l, t.s = t.s > 1 ? 1 : t.s, t;
|
|
622
|
-
}, ne = () => {
|
|
623
|
-
const t = a.value.find((e) => e.select == !0);
|
|
624
|
-
if (t) {
|
|
625
|
-
const { l: e, s: l } = Xe(t.r, t.g, t.b);
|
|
626
|
-
let n = e, r = l;
|
|
627
|
-
Number.isNaN(r) && (r = n);
|
|
628
|
-
let s = { x: 0, y: 0 }, p = O.value.offsetWidth - h.value.offsetWidth, m = O.value.offsetHeight - h.value.offsetHeight;
|
|
629
|
-
const [g, d] = 2 * n - 1 < 0 ? [
|
|
630
|
-
p * 2 * r / (1 + r),
|
|
631
|
-
m * (1 - n * (1 + r))
|
|
632
|
-
] : [
|
|
633
|
-
-p * 2 * (n - 1) * r / (n + r - n * r),
|
|
634
|
-
m * (n - 1) * (r - 1)
|
|
635
|
-
];
|
|
636
|
-
return s.x = g, s.y = d, s;
|
|
637
|
-
} else
|
|
638
|
-
return null;
|
|
639
|
-
}, Pe = () => {
|
|
640
|
-
const t = a.value.find((e) => e.select == !0);
|
|
641
|
-
t && (t.hue = F.value);
|
|
642
|
-
}, A = k(100), ke = (t) => {
|
|
643
|
-
if (c.showAlpha) {
|
|
644
|
-
const e = a.value.find((l) => l.select == !0);
|
|
645
|
-
e && (e.a = parseInt(t), R());
|
|
646
|
-
}
|
|
647
|
-
}, Ye = (t) => {
|
|
648
|
-
var l, n, r, s;
|
|
649
|
-
const e = (n = (l = o.value) == null ? void 0 : l.querySelector(".gradient-handle-content")) == null ? void 0 : n.getBoundingClientRect();
|
|
650
|
-
return t === 0 ? "0px" : t === 100 && e ? `${(((r = ue.value) == null ? void 0 : r.offsetWidth) || 0) - (e.width || 0)}px` : `${(((s = ue.value) == null ? void 0 : s.offsetWidth) || 0) * (t / 100) - ((e == null ? void 0 : e.width) || 0) / 2}px`;
|
|
651
|
-
};
|
|
652
|
-
let T = null, X = null;
|
|
653
|
-
const Ie = (t) => {
|
|
654
|
-
var n, r;
|
|
655
|
-
const l = t.target.offsetParent;
|
|
656
|
-
if ((n = l == null ? void 0 : l.id) != null && n.includes("clr-gb-")) {
|
|
657
|
-
const s = l.id.replace("clr-gb-", "");
|
|
658
|
-
X = l;
|
|
659
|
-
const p = a.value.find((m) => m.select == !0);
|
|
660
|
-
if (p && p.id != s) {
|
|
661
|
-
const m = (r = o.value) == null ? void 0 : r.querySelector(".gradient-handle.select");
|
|
662
|
-
m == null || m.classList.remove("select"), l.classList.add("select");
|
|
663
|
-
const g = a.value.findIndex((d) => d.select == !0);
|
|
664
|
-
for (let d = 0; d < a.value.length; d++) {
|
|
665
|
-
const v = a.value[d];
|
|
666
|
-
if (v.id == s) {
|
|
667
|
-
g != -1 && (a.value[g].select = !1), a.value[d].select = !0, A.value = v.a, re(v.r, v.g, v.b, v.hue, !0), q(), Q();
|
|
668
|
-
break;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
window.addEventListener("mousemove", we), window.addEventListener("mouseup", Fe);
|
|
673
|
-
}
|
|
674
|
-
}, Fe = () => {
|
|
675
|
-
window.removeEventListener("mousemove", we), window.removeEventListener("mouseup", Ie);
|
|
676
|
-
}, we = (t) => {
|
|
677
|
-
var s, p;
|
|
678
|
-
t.preventDefault();
|
|
679
|
-
const e = (p = (s = o.value) == null ? void 0 : s.querySelector(".gradient-handle-content")) == null ? void 0 : p.getBoundingClientRect(), l = T == null ? void 0 : T.getBoundingClientRect(), n = l.width - (e == null ? void 0 : e.width);
|
|
680
|
-
let r = t.clientX - (l.left || 0) - ((e == null ? void 0 : e.width) || 0) / 2;
|
|
681
|
-
if (r < 0 ? r = 0 : r > n && (r = n), X) {
|
|
682
|
-
X.style.left = `${r}px`;
|
|
683
|
-
const m = parseFloat((r / ((l == null ? void 0 : l.width) - (e == null ? void 0 : e.width)) * 100).toFixed(0)), g = a.value.find(
|
|
684
|
-
(d) => d.id == (X == null ? void 0 : X.id.replace("clr-gb-", ""))
|
|
685
|
-
);
|
|
686
|
-
g && (g.percent = m), R();
|
|
687
|
-
}
|
|
688
|
-
}, Ae = (t) => {
|
|
689
|
-
var m, g;
|
|
690
|
-
const e = T == null ? void 0 : T.getBoundingClientRect(), l = Math.round((t.clientX - ((e == null ? void 0 : e.left) || 0)) / ((e == null ? void 0 : e.width) || 1) * 100), n = a.value.findIndex((d) => d.select == !0), r = a.value[n], s = {
|
|
691
|
-
id: Date.now(),
|
|
692
|
-
r: r.r,
|
|
693
|
-
g: r.g,
|
|
694
|
-
b: r.b,
|
|
695
|
-
a: r.a,
|
|
696
|
-
percent: l,
|
|
697
|
-
hue: r.hue,
|
|
698
|
-
select: !0
|
|
699
|
-
};
|
|
700
|
-
a.value[n].select = !1;
|
|
701
|
-
const p = (m = o.value) == null ? void 0 : m.querySelector(".gradient-handle.select");
|
|
702
|
-
p == null || p.classList.remove("select"), a.value = [...a.value, s], Ce(s), X = (g = o.value) == null ? void 0 : g.querySelector(`#clr-gb-${s.id}`), R();
|
|
703
|
-
}, Ve = (t) => {
|
|
704
|
-
if (t.r == 0 && t.g == 0 && t.b == 0)
|
|
705
|
-
return !0;
|
|
706
|
-
if (t.r == 255 && t.g == 255 && t.b == 255)
|
|
707
|
-
return !0;
|
|
708
|
-
{
|
|
709
|
-
const e = z.value.getContext("2d", { willReadFrequently: !0 }), l = z.value.width, n = z.value.height, r = e.getImageData(0, 0, l, n).data, s = t.r, p = t.g, m = t.b;
|
|
710
|
-
for (let g = 0; g < n; g++)
|
|
711
|
-
for (let d = 0; d < l; d++) {
|
|
712
|
-
const v = (g * l + d) * 4, G = r[v], et = r[v + 1], tt = r[v + 2];
|
|
713
|
-
if (G === s && et === p && tt === m)
|
|
714
|
-
return !0;
|
|
715
|
-
}
|
|
716
|
-
return !1;
|
|
717
|
-
}
|
|
718
|
-
}, re = (t, e, l, n, r) => {
|
|
719
|
-
setTimeout(() => {
|
|
720
|
-
if (Ve({ r: t, g: e, b: l })) {
|
|
721
|
-
let s = ne();
|
|
722
|
-
s && (h.value.style.left = `${s.x}px`, h.value.style.top = `${s.y}px`);
|
|
723
|
-
} else {
|
|
724
|
-
let s = ne();
|
|
725
|
-
s && (h.value.style.left = `${s.x}px`, h.value.style.top = `${s.y}px`), F.value = n, ge(r);
|
|
726
|
-
}
|
|
727
|
-
}, 0);
|
|
728
|
-
}, ve = () => {
|
|
729
|
-
a.value.forEach((l) => Ce(l)), qe();
|
|
730
|
-
const t = a.value[0];
|
|
731
|
-
F.value = t.hue, ge(!0);
|
|
732
|
-
let e = ne();
|
|
733
|
-
e && (h.value.style.left = `${e.x}px`, h.value.style.top = `${e.y}px`), q(), R();
|
|
734
|
-
}, Ce = (t) => {
|
|
735
|
-
if (f.value == "gradient") {
|
|
736
|
-
let e = document.createElement("div");
|
|
737
|
-
e.id = `clr-gb-${t.id}`, e.classList.add("gradient-handle"), e.style.left = Ye(t.percent);
|
|
738
|
-
let l = document.createElement("div");
|
|
739
|
-
l.classList.add("gradient-handle-content"), t.select == !0 && e.classList.add("select"), e.appendChild(l), T && T.appendChild(e);
|
|
740
|
-
}
|
|
741
|
-
}, Se = (t) => {
|
|
742
|
-
const e = z.value.getContext("2d", { willReadFrequently: !0 }), l = z.value.width, n = z.value.height;
|
|
743
|
-
e.fillStyle = `rgb(${t[0]},${t[1]},${t[2]})`, e.fillRect(0, 0, l, n);
|
|
744
|
-
let r = e.createLinearGradient(0, 0, l - 12, 0);
|
|
745
|
-
r.addColorStop(0, "rgb(255,255,255)"), r.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = r, e.fillRect(0, 0, l, n);
|
|
746
|
-
let s = e.createLinearGradient(0, 0, 0, n);
|
|
747
|
-
s.addColorStop(0, "rgba(0,0,0,0)"), s.addColorStop(1, "rgb(0,0,0)"), e.fillStyle = s, e.fillRect(0, 0, l, n);
|
|
748
|
-
}, q = () => {
|
|
749
|
-
if (c.showAlpha) {
|
|
750
|
-
let t = a.value.find((e) => e.select == !0);
|
|
751
|
-
t && (E.value.style.background = ` linear-gradient(90deg,rgba(255, 255, 255, 0) 0%, rgba(${t.r}, ${t.g}, ${t.b}, 100) 97%)`);
|
|
752
|
-
}
|
|
753
|
-
}, R = () => {
|
|
754
|
-
var t;
|
|
755
|
-
if (f.value == "gradient") {
|
|
756
|
-
a.value.sort((r, s) => r.percent - s.percent);
|
|
757
|
-
let e = "linear-gradient(90deg, ", l;
|
|
758
|
-
if (y.value == "linear") {
|
|
759
|
-
l = `linear-gradient(${x.angle}deg, `;
|
|
760
|
-
for (let r = 0; r < a.value.length; r++) {
|
|
761
|
-
const { r: s, g: p, b: m, a: g, percent: d } = a.value[r];
|
|
762
|
-
a.value.length - 1 == r ? (e = e + `rgba(${s},${p},${m},${g / 100}) ${d}%)`, l = l + `rgba(${s},${p},${m},${g / 100}) ${d}%)`) : (e = e + `rgba(${s},${p},${m},${g / 100}) ${d}%, `, l = l + `rgba(${s},${p},${m},${g / 100}) ${d}%, `);
|
|
763
|
-
}
|
|
764
|
-
} else {
|
|
765
|
-
l = `radial-gradient(circle at ${x.percentageX}% ${x.percentageY}%, `;
|
|
766
|
-
for (let r = 0; r < a.value.length; r++) {
|
|
767
|
-
const { r: s, g: p, b: m, a: g, percent: d } = a.value[r];
|
|
768
|
-
a.value.length - 1 == r ? (e = e + `rgba(${s},${p},${m},${g / 100}) ${d}%)`, l = l + `rgba(${s},${p},${m},${g / 100}) ${d}%)`) : (e = e + `rgba(${s},${p},${m},${g / 100}) ${d}%, `, l = l + `rgba(${s},${p},${m},${g / 100}) ${d}%, `);
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
ue.value.style.backgroundImage = e;
|
|
772
|
-
let n = (t = o.value) == null ? void 0 : t.querySelector("#ck-cp-target-background");
|
|
773
|
-
n && (n.style.backgroundImage = l, Y.value && u(n.style.backgroundImage));
|
|
774
|
-
} else {
|
|
775
|
-
const { r: e, g: l, b: n, a: r } = a.value[0];
|
|
776
|
-
let s = "";
|
|
777
|
-
switch (c.type) {
|
|
778
|
-
case "HEX8":
|
|
779
|
-
s = it(e, l, n, r / 100);
|
|
780
|
-
break;
|
|
781
|
-
case "RGBA":
|
|
782
|
-
s = `rgba(${e},${l},${n},${r / 100})`;
|
|
783
|
-
break;
|
|
784
|
-
case "RGB":
|
|
785
|
-
s = `rgb(${e},${l},${n})`;
|
|
786
|
-
break;
|
|
787
|
-
case "HEX":
|
|
788
|
-
s = Ee(e, l, n);
|
|
789
|
-
break;
|
|
790
|
-
}
|
|
791
|
-
u(s);
|
|
792
|
-
}
|
|
793
|
-
}, qe = () => {
|
|
794
|
-
a.value.forEach((t) => {
|
|
795
|
-
t.hue = ce(t.r, t.g, t.b);
|
|
796
|
-
});
|
|
797
|
-
}, We = (t) => {
|
|
798
|
-
y.value = t, R();
|
|
799
|
-
}, je = () => {
|
|
800
|
-
var t, e;
|
|
801
|
-
if (a.value.length > 2) {
|
|
802
|
-
const l = a.value.findIndex((n) => n.select == !0);
|
|
803
|
-
if (l !== -1) {
|
|
804
|
-
const n = a.value[l].id;
|
|
805
|
-
a.value.splice(l, 1);
|
|
806
|
-
const r = (t = o.value) == null ? void 0 : t.querySelector(`#clr-gb-${n}`);
|
|
807
|
-
r == null || r.remove();
|
|
808
|
-
const s = a.value[0];
|
|
809
|
-
s && (s.select = !0, X = (e = o.value) == null ? void 0 : e.querySelector(`#clr-gb-${s.id}`), X == null || X.classList.add("select"), re(s.r, s.g, s.b, s.hue, !1), Q(), R());
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}, ze = () => {
|
|
813
|
-
var l;
|
|
814
|
-
const t = (l = o.value) == null ? void 0 : l.querySelector("#cp-btn-eyedropper");
|
|
815
|
-
t == null || t.classList.add("active"), new EyeDropper().open().then((n) => {
|
|
816
|
-
const { sRGBHex: r } = n, s = a.value.find((m) => m.select == !0), p = be(r);
|
|
817
|
-
if (p) {
|
|
818
|
-
const m = ce(p.r, p.g, p.b);
|
|
819
|
-
if (s && (s.hue = m, s.r = p.r, s.g = p.g, s.b = p.b), Ve(p)) {
|
|
820
|
-
const g = ne();
|
|
821
|
-
g && (h.value.style.left = `${g.x}px`, h.value.style.top = `${g.y}px`);
|
|
822
|
-
} else {
|
|
823
|
-
F.value = m;
|
|
824
|
-
const { rgb: g } = De(m, 100, 50);
|
|
825
|
-
Se(g);
|
|
826
|
-
const d = ne();
|
|
827
|
-
d && (h.value.style.left = `${d.x}px`, h.value.style.top = `${d.y}px`);
|
|
828
|
-
}
|
|
829
|
-
Q(), q(), R(), t == null || t.classList.remove("active");
|
|
830
|
-
}
|
|
831
|
-
}).catch(() => {
|
|
832
|
-
t == null || t.classList.remove("active");
|
|
833
|
-
});
|
|
834
|
-
}, Ke = (t) => {
|
|
835
|
-
const { value: e, type: l } = t;
|
|
836
|
-
if (l != "a") {
|
|
837
|
-
const n = a.value.find((r) => r.select == !0);
|
|
838
|
-
if (n) {
|
|
839
|
-
n.r = parseInt(e.r), n.g = parseInt(e.g), n.b = parseInt(e.b);
|
|
840
|
-
const r = ce(n.r, n.g, n.b);
|
|
841
|
-
n.hue = r, re(n.r, n.g, n.b, n.hue, !0), R(), q();
|
|
842
|
-
}
|
|
843
|
-
} else
|
|
844
|
-
A.value = e, R(), q();
|
|
845
|
-
}, Ze = (t) => {
|
|
846
|
-
L.h = t.h, L.s = t.s, L.l = t.l;
|
|
847
|
-
const e = a.value.find((l) => l.select == !0);
|
|
848
|
-
if (e && !Number.isNaN(L.h) && !Number.isNaN(L.s) && !Number.isNaN(L.l)) {
|
|
849
|
-
const { r: l, g: n, b: r } = He(L.h, L.s / 100, L.l / 100);
|
|
850
|
-
e.hue = L.h, e.r = l, e.g = n, e.b = r, re(e.r, e.g, e.b, e.hue, !0), R(), q();
|
|
851
|
-
}
|
|
852
|
-
}, Je = () => {
|
|
853
|
-
if (N.value) {
|
|
854
|
-
const t = be(N.value);
|
|
855
|
-
if (t) {
|
|
856
|
-
const e = ce(t.r, t.g, t.b), l = a.value.find((n) => n.select == !0);
|
|
857
|
-
l && (l.r = t.r, l.g = t.g, l.b = t.b, l.hue = e, re(t.r, t.g, t.b, l.hue, !0), R(), q(), de(B.value));
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}, Q = () => {
|
|
861
|
-
const t = a.value.find((e) => e.select == !0);
|
|
862
|
-
t && (N.value = Ee(t.r, t.g, t.b).toUpperCase()), de(B.value);
|
|
863
|
-
}, Te = (t) => {
|
|
864
|
-
I("last-used-pick", t);
|
|
865
|
-
};
|
|
866
|
-
window.EyeDropper && (S.value = !0);
|
|
867
|
-
const Qe = (t = "") => {
|
|
868
|
-
if (f.value == "gradient") {
|
|
869
|
-
let e = t.includes("linear") ? "linear" : "radial", l = [];
|
|
870
|
-
if (y.value = e, e == "linear") {
|
|
871
|
-
let n = /^linear-gradient\((.*)\)$/, r = t.replace(";", "").trim().match(n), s = /,\s*(?![^()]*\))/;
|
|
872
|
-
if (r) {
|
|
873
|
-
let p = r[1].split(s);
|
|
874
|
-
for (let m = 0; m < p.length; m++) {
|
|
875
|
-
const g = p[m];
|
|
876
|
-
let d = {
|
|
877
|
-
id: m,
|
|
878
|
-
r: 0,
|
|
879
|
-
g: 0,
|
|
880
|
-
b: 0,
|
|
881
|
-
a: 100,
|
|
882
|
-
percent: 100,
|
|
883
|
-
hue: 0,
|
|
884
|
-
select: !1
|
|
885
|
-
};
|
|
886
|
-
if (g.includes("deg"))
|
|
887
|
-
x.angle = parseInt(g.replace("deg", ""));
|
|
888
|
-
else if (g.includes("rgba")) {
|
|
889
|
-
let v = g.trim().replace(/rgba|\(|\)|%/g, "").replace(/,/g, " ").split(" ");
|
|
890
|
-
v = v.filter((G) => G.trim() !== ""), d.r = parseInt(v[0]), d.g = parseInt(v[1]), d.b = parseInt(v[2]), d.a = parseFloat(v[3]) * 100, d.percent = parseInt(v[4]), l.push(d);
|
|
891
|
-
} else if (g.includes("rgb")) {
|
|
892
|
-
let v = g.trim().replace(/rgb|\(|\)|%/g, "").replace(/,/g, " ").split(" ");
|
|
893
|
-
v = v.filter((G) => G.trim() !== ""), d.r = parseInt(v[0]), d.g = parseInt(v[1]), d.b = parseInt(v[2]), d.percent = parseInt(v[3]), l.push(d);
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
} else {
|
|
898
|
-
let n = /^radial-gradient\((.*)\)$/, r = t.replace(";", "").trim().match(n), s = /,\s*(?![^()]*\))/;
|
|
899
|
-
if (r) {
|
|
900
|
-
let p = r[1].split(s);
|
|
901
|
-
for (let m = 0; m < p.length; m++) {
|
|
902
|
-
const g = p[m];
|
|
903
|
-
let d = {
|
|
904
|
-
id: m,
|
|
905
|
-
r: 0,
|
|
906
|
-
g: 0,
|
|
907
|
-
b: 0,
|
|
908
|
-
a: 100,
|
|
909
|
-
percent: 100,
|
|
910
|
-
hue: 0,
|
|
911
|
-
select: !1
|
|
912
|
-
};
|
|
913
|
-
if (g.includes("circle at")) {
|
|
914
|
-
let v = g.replace("circle at ", "").replace(" ", "").replace(/%/g, " ").trim().split(" ");
|
|
915
|
-
x.percentageX = parseInt(v[0]), x.percentageY = parseInt(v[1]);
|
|
916
|
-
} else if (g.includes("rgba")) {
|
|
917
|
-
let v = g.replace(/rgba|\(|\)|%/g, "").replace(/,/g, " ").split(" ");
|
|
918
|
-
v = v.filter((G) => G.trim() !== ""), d.r = parseInt(v[0]), d.g = parseInt(v[1]), d.b = parseInt(v[2]), d.a = parseFloat(v[3]) * 100, d.percent = parseInt(v[4]), l.push(d);
|
|
919
|
-
} else if (g.includes("rgb")) {
|
|
920
|
-
let v = g.replace(/rgb|\(|\)|%/g, "").replace(/,/g, " ").split(" ");
|
|
921
|
-
v = v.filter((G) => G.trim() !== ""), d.r = parseInt(v[0]), d.g = parseInt(v[1]), d.b = parseInt(v[2]), d.percent = parseInt(v[3]), l.push(d);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
l.length > 1 && (a.value = l, a.value[0].select = !0, A.value = a.value[0].a);
|
|
927
|
-
} else if (t) {
|
|
928
|
-
let e = {
|
|
929
|
-
r: 0,
|
|
930
|
-
g: 0,
|
|
931
|
-
b: 0,
|
|
932
|
-
a: 0
|
|
933
|
-
};
|
|
934
|
-
if (t.includes("#"))
|
|
935
|
-
if (t.length >= 8)
|
|
936
|
-
e = ut(t);
|
|
937
|
-
else {
|
|
938
|
-
let l = be(t);
|
|
939
|
-
l ? (e.a = 1, e.r = l.r, e.g = l.g, e.b = l.b) : e = null;
|
|
940
|
-
}
|
|
941
|
-
else if (t.includes("rgb"))
|
|
942
|
-
if (t.includes("rgba"))
|
|
943
|
-
e = dt(t);
|
|
944
|
-
else {
|
|
945
|
-
let l = ct(t);
|
|
946
|
-
l ? (e.a = 1, e.r = l.r, e.g = l.g, e.b = l.b) : e = null;
|
|
947
|
-
}
|
|
948
|
-
e && (a.value[0].r = e.r, a.value[0].b = e.b, a.value[0].g = e.g, a.value[0].a = parseInt((e.a * 100).toFixed(0)), A.value = a.value[0].a, a.value[0].hue = 0);
|
|
949
|
-
}
|
|
950
|
-
}, de = (t) => {
|
|
951
|
-
const e = a.value.find((l) => l.select == !0);
|
|
952
|
-
if (e) {
|
|
953
|
-
switch (t) {
|
|
954
|
-
case "RGB":
|
|
955
|
-
break;
|
|
956
|
-
case "HSL": {
|
|
957
|
-
const { h: l, s: n, l: r } = Xe(e.r, e.g, e.b);
|
|
958
|
-
L.h = Math.round(l), L.s = Math.round(n * 100), L.l = Math.round(r * 100);
|
|
959
|
-
break;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
B.value = t;
|
|
963
|
-
}
|
|
964
|
-
}, me = (t) => {
|
|
965
|
-
t && Qe(t), ve();
|
|
966
|
-
};
|
|
967
|
-
_(
|
|
968
|
-
() => c.modelValue,
|
|
969
|
-
(t, e) => {
|
|
970
|
-
t !== e && t !== b.value && (a.value.forEach((l) => {
|
|
971
|
-
const n = T == null ? void 0 : T.querySelector(`#clr-gb-${l.id}`);
|
|
972
|
-
n == null || n.remove();
|
|
973
|
-
}), me(t));
|
|
974
|
-
}
|
|
975
|
-
);
|
|
976
|
-
const _e = (t) => {
|
|
977
|
-
a.value.forEach((e) => {
|
|
978
|
-
const l = T == null ? void 0 : T.querySelector(`#clr-gb-${e.id}`);
|
|
979
|
-
l == null || l.remove();
|
|
980
|
-
}), t !== "solid" ? (f.value = "gradient", setTimeout(() => {
|
|
981
|
-
var e;
|
|
982
|
-
T = (e = o.value) == null ? void 0 : e.querySelector(".gradient-bar"), We(t), ve();
|
|
983
|
-
}, 200)) : t === "solid" && (f.value = "solid", a.value = a.value.map((e) => (e.select = !1, e)), a.value[0].select = !0, setTimeout(() => {
|
|
984
|
-
me(c.modelValue);
|
|
985
|
-
}, 200));
|
|
986
|
-
};
|
|
987
|
-
return Ne(() => {
|
|
988
|
-
var t;
|
|
989
|
-
f.value = c.modelValue.includes("linear") || c.modelValue.includes("radial") ? "gradient" : "solid", f.value == "gradient" && (T = (t = o.value) == null ? void 0 : t.querySelector(".gradient-bar")), me(c.modelValue), de(B.value), at(() => {
|
|
990
|
-
Y.value = !0;
|
|
991
|
-
});
|
|
992
|
-
}), (t, e) => ($(), C("div", {
|
|
993
|
-
ref_key: "pickerTemplateRef",
|
|
994
|
-
ref: o,
|
|
995
|
-
class: J(["ck-cp-container", i.disabled ? "ck-cp-disabled " : ""]),
|
|
996
|
-
"cp-theme": i.theme
|
|
997
|
-
}, [
|
|
998
|
-
i.variant == "gradient" ? ($(), C("div", Ht, [
|
|
999
|
-
D(Rt, {
|
|
1000
|
-
class: "mr-auto",
|
|
1001
|
-
variant: i.variant,
|
|
1002
|
-
mode: f.value,
|
|
1003
|
-
"model-value": i.modelValue,
|
|
1004
|
-
iconClasses: i.iconClasses,
|
|
1005
|
-
gradientType: y.value,
|
|
1006
|
-
onOnChangeMode: _e
|
|
1007
|
-
}, null, 8, ["variant", "mode", "model-value", "iconClasses", "gradientType"])
|
|
1008
|
-
])) : H("", !0),
|
|
1009
|
-
f.value == "gradient" && i.variant == "gradient" ? ($(), C("div", Dt, [
|
|
1010
|
-
D($t, {
|
|
1011
|
-
gradientType: y.value,
|
|
1012
|
-
onOnAddColor: Ae,
|
|
1013
|
-
onOnMouseDown: Ie,
|
|
1014
|
-
onOnDeleteColor: je
|
|
1015
|
-
}, null, 8, ["gradientType"]),
|
|
1016
|
-
D(Ct, {
|
|
1017
|
-
percentageY: x.percentageY,
|
|
1018
|
-
"onUpdate:percentageY": e[0] || (e[0] = (l) => x.percentageY = l),
|
|
1019
|
-
angle: x.angle,
|
|
1020
|
-
"onUpdate:angle": e[1] || (e[1] = (l) => x.angle = l),
|
|
1021
|
-
percentageX: x.percentageX,
|
|
1022
|
-
"onUpdate:percentageX": e[2] || (e[2] = (l) => x.percentageX = l),
|
|
1023
|
-
inputType: B.value,
|
|
1024
|
-
mode: f.value,
|
|
1025
|
-
gradientType: y.value,
|
|
1026
|
-
onOnInput: R
|
|
1027
|
-
}, null, 8, ["percentageY", "angle", "percentageX", "inputType", "mode", "gradientType"])
|
|
1028
|
-
])) : ($(), C("div", Et, [
|
|
1029
|
-
i.presetColors ? ($(), C("div", Xt, [
|
|
1030
|
-
e[10] || (e[10] = w("div", { class: "text-oc-text-400 text-sm my-3 font-medium" }, "Choose color", -1)),
|
|
1031
|
-
w("div", Mt, [
|
|
1032
|
-
($(!0), C(Re, null, Be(i.presetColors, (l) => ($(), C("div", {
|
|
1033
|
-
key: `color-${l}`,
|
|
1034
|
-
class: "ck-cp-color-item !w-[32px] !h-[32px]",
|
|
1035
|
-
style: W(`background:${l}`),
|
|
1036
|
-
onClick: (n) => Te(l)
|
|
1037
|
-
}, null, 12, Ut))), 128))
|
|
1038
|
-
])
|
|
1039
|
-
])) : H("", !0)
|
|
1040
|
-
])),
|
|
1041
|
-
D(St, { onOnMouseDown: Oe }),
|
|
1042
|
-
w("div", Nt, [
|
|
1043
|
-
D(It, {
|
|
1044
|
-
class: J(S.value ? "max-w-[90%]" : ""),
|
|
1045
|
-
modelValue: F.value,
|
|
1046
|
-
"onUpdate:modelValue": e[3] || (e[3] = (l) => F.value = l),
|
|
1047
|
-
onOnInput: e[4] || (e[4] = (l) => ge(!1)),
|
|
1048
|
-
onOnChange: Pe
|
|
1049
|
-
}, null, 8, ["class", "modelValue"]),
|
|
1050
|
-
S.value ? ($(), C("button", {
|
|
1051
|
-
key: 0,
|
|
1052
|
-
id: "cp-btn-eyedropper",
|
|
1053
|
-
type: "button",
|
|
1054
|
-
class: "cp-btn",
|
|
1055
|
-
style: { padding: "7px" },
|
|
1056
|
-
onClick: ze
|
|
1057
|
-
}, e[11] || (e[11] = [
|
|
1058
|
-
w("svg", {
|
|
1059
|
-
version: "1.1",
|
|
1060
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1061
|
-
width: "32",
|
|
1062
|
-
height: "32",
|
|
1063
|
-
viewBox: "0 0 32 32"
|
|
1064
|
-
}, [
|
|
1065
|
-
w("path", { d: "M21.35 1.825l-6.344 6.35-0.588-0.588c-0.781-0.781-2.050-0.781-2.831 0s-0.781 2.050 0 2.831l10 10c0.781 0.781 2.050 0.781 2.831 0s0.781-2.050 0-2.831l-0.587-0.587 6.344-6.35c2.438-2.438 2.438-6.388 0-8.819s-6.387-2.438-8.819 0zM3.462 20.206c-0.938 0.938-1.462 2.212-1.462 3.538v2.65l-1.663 2.494c-0.531 0.794-0.425 1.85 0.25 2.525s1.731 0.781 2.525 0.25l2.494-1.663h2.65c1.325 0 2.6-0.525 3.537-1.462l7.544-7.544-2.831-2.831-7.544 7.544c-0.188 0.188-0.444 0.294-0.706 0.294h-2.256v-2.256c0-0.262 0.106-0.519 0.294-0.706l7.544-7.544-2.831-2.831-7.544 7.544z" })
|
|
1066
|
-
], -1)
|
|
1067
|
-
]))) : H("", !0)
|
|
1068
|
-
]),
|
|
1069
|
-
i.showAlpha ? ($(), P(ht, {
|
|
1070
|
-
key: 3,
|
|
1071
|
-
modelValue: A.value,
|
|
1072
|
-
"onUpdate:modelValue": e[5] || (e[5] = (l) => A.value = l),
|
|
1073
|
-
onOnInput: e[6] || (e[6] = (l) => ke(l.target.value))
|
|
1074
|
-
}, null, 8, ["modelValue"])) : H("", !0),
|
|
1075
|
-
nt(w("div", Ot, null, 512), [
|
|
1076
|
-
[rt, !1]
|
|
1077
|
-
]),
|
|
1078
|
-
w("div", Gt, [
|
|
1079
|
-
D(mt, {
|
|
1080
|
-
"model-value": B.value,
|
|
1081
|
-
"onUpdate:modelValue": de
|
|
1082
|
-
}, null, 8, ["model-value"]),
|
|
1083
|
-
Y.value && i.showInputSet ? ($(), C("div", Pt, [
|
|
1084
|
-
B.value == "HEX" ? ($(), P(pt, {
|
|
1085
|
-
key: 0,
|
|
1086
|
-
modelValue: N.value,
|
|
1087
|
-
"onUpdate:modelValue": [
|
|
1088
|
-
e[7] || (e[7] = (l) => N.value = l),
|
|
1089
|
-
Je
|
|
1090
|
-
]
|
|
1091
|
-
}, null, 8, ["modelValue"])) : H("", !0),
|
|
1092
|
-
B.value == "RGB" ? ($(), P(Me, {
|
|
1093
|
-
key: 1,
|
|
1094
|
-
"rgb-value": a.value.find((l) => l.select == !0),
|
|
1095
|
-
onUpdateRgbValue: Ke
|
|
1096
|
-
}, null, 8, ["rgb-value"])) : H("", !0),
|
|
1097
|
-
B.value == "HSL" ? ($(), P(Me, {
|
|
1098
|
-
key: 2,
|
|
1099
|
-
"input-type": "HSL",
|
|
1100
|
-
"hsl-value": L,
|
|
1101
|
-
onUpdateHslValue: Ze
|
|
1102
|
-
}, null, 8, ["hsl-value"])) : H("", !0),
|
|
1103
|
-
i.showAlpha ? ($(), P(vt, {
|
|
1104
|
-
key: 3,
|
|
1105
|
-
modelValue: A.value,
|
|
1106
|
-
"onUpdate:modelValue": [
|
|
1107
|
-
e[8] || (e[8] = (l) => A.value = l),
|
|
1108
|
-
e[9] || (e[9] = (l) => ke(l))
|
|
1109
|
-
]
|
|
1110
|
-
}, null, 8, ["modelValue"])) : H("", !0)
|
|
1111
|
-
])) : H("", !0)
|
|
1112
|
-
]),
|
|
1113
|
-
e[12] || (e[12] = w("div", { class: "text-oc-text-400 text-sm my-3 font-medium font-inter" }, "Last used", -1)),
|
|
1114
|
-
M.value.length > 0 && i.showColorList ? ($(), C("div", Yt, [
|
|
1115
|
-
($(!0), C(Re, null, Be(j.value, (l) => ($(), C("div", {
|
|
1116
|
-
key: `color-${l}`,
|
|
1117
|
-
class: "ck-cp-color-item !w-[32px] !h-[32px]",
|
|
1118
|
-
style: W(`background:${l}`),
|
|
1119
|
-
onClick: (n) => Te(l)
|
|
1120
|
-
}, null, 12, Ft))), 128))
|
|
1121
|
-
])) : H("", !0)
|
|
1122
|
-
], 10, Bt));
|
|
1123
|
-
}
|
|
1124
|
-
};
|
|
1125
|
-
export {
|
|
1126
|
-
jt as default
|
|
1127
|
-
};
|