@luminescent/ui-qwik 6.8.3-qwikv2 → 6.9.0
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/LICENSE +661 -0
- package/lib/index.qwik.cjs +1747 -41
- package/lib/index.qwik.mjs +1748 -19
- package/lib-types/components/docs/Anchor.d.ts +4 -0
- package/lib-types/components/docs/Blobs.d.ts +4 -0
- package/lib-types/components/docs/ColorPicker.d.ts +4 -0
- package/lib-types/components/docs/Dropdown.d.ts +4 -0
- package/lib-types/components/docs/IconsLogos.d.ts +4 -0
- package/lib-types/components/docs/Nav.d.ts +4 -0
- package/lib-types/components/docs/NumberInput.d.ts +4 -0
- package/lib-types/components/docs/RangeInput.d.ts +4 -0
- package/lib-types/components/docs/SelectMenu.d.ts +4 -0
- package/lib-types/components/docs/Settings.d.ts +2 -0
- package/lib-types/components/docs/Sidebar.d.ts +4 -0
- package/lib-types/components/docs/Toggle.d.ts +4 -0
- package/lib-types/components/docs/lum-btn.d.ts +4 -0
- package/lib-types/components/docs/lum-card.d.ts +4 -0
- package/lib-types/components/docs/lum-classes.d.ts +4 -0
- package/lib-types/components/docs/lum-input.d.ts +4 -0
- package/{lib → lib-types}/components/elements/Anchor.d.ts +2 -2
- package/{lib → lib-types}/components/elements/Blobs.d.ts +1 -1
- package/{lib → lib-types}/components/elements/ColorPicker.d.ts +2 -2
- package/{lib → lib-types}/components/elements/Dropdown.d.ts +2 -2
- package/{lib → lib-types}/components/elements/Nav.d.ts +2 -2
- package/lib-types/components/elements/NumberInput.d.ts +21 -0
- package/{lib → lib-types}/components/elements/RangeInput.d.ts +3 -3
- package/{lib → lib-types}/components/elements/SelectMenu.d.ts +3 -3
- package/{lib → lib-types}/components/elements/Sidebar.d.ts +2 -2
- package/{lib → lib-types}/components/elements/Toggle.d.ts +2 -2
- package/lib-types/components/logos/Birdflop.d.ts +7 -0
- package/lib-types/components/logos/Discord.d.ts +2 -0
- package/lib-types/components/logos/Fabric.d.ts +2 -0
- package/lib-types/components/logos/Forge.d.ts +2 -0
- package/{lib → lib-types}/components/logos/IconProps.d.ts +1 -1
- package/lib-types/components/logos/Luminescent.d.ts +3 -0
- package/lib-types/components/logos/Paper.d.ts +2 -0
- package/lib-types/components/logos/Pterodactyl.d.ts +2 -0
- package/lib-types/components/logos/Purpur.d.ts +2 -0
- package/lib-types/components/logos/Velocity.d.ts +2 -0
- package/lib-types/components/logos/Waterfall.d.ts +2 -0
- package/{lib → lib-types}/components/logos.d.ts +3 -0
- package/lib-types/entry.dev.d.ts +2 -0
- package/lib-types/entry.ssr.d.ts +14 -0
- package/lib-types/root.d.ts +3 -0
- package/lib-types/svg/ChevronDown.d.ts +2 -0
- package/lib-types/svg/Link.d.ts +2 -0
- package/lib-types/svg/Menu.d.ts +2 -0
- package/{lib/svg/Shuffle.d.ts → lib-types/svg/Minus.d.ts} +1 -1
- package/lib-types/svg/Plus.d.ts +2 -0
- package/lib-types/svg/Shuffle.d.ts +2 -0
- package/package.json +35 -32
- package/tailwind.config.js +94 -0
- package/lib/components/docs/Anchor.d.ts +0 -4
- package/lib/components/docs/Blobs.d.ts +0 -4
- package/lib/components/docs/ColorPicker.d.ts +0 -4
- package/lib/components/docs/Dropdown.d.ts +0 -4
- package/lib/components/docs/IconsLogos.d.ts +0 -4
- package/lib/components/docs/Nav.d.ts +0 -4
- package/lib/components/docs/NumberInput.d.ts +0 -4
- package/lib/components/docs/RangeInput.d.ts +0 -4
- package/lib/components/docs/SelectMenu.d.ts +0 -4
- package/lib/components/docs/Settings.d.ts +0 -2
- package/lib/components/docs/Sidebar.d.ts +0 -4
- package/lib/components/docs/Toggle.d.ts +0 -4
- package/lib/components/docs/lum-btn.d.ts +0 -4
- package/lib/components/docs/lum-card.d.ts +0 -4
- package/lib/components/docs/lum-classes.d.ts +0 -4
- package/lib/components/docs/lum-input.d.ts +0 -4
- package/lib/components/elements/Anchor.qwik.cjs +0 -23
- package/lib/components/elements/Anchor.qwik.mjs +0 -23
- package/lib/components/elements/Blobs.qwik.cjs +0 -185
- package/lib/components/elements/Blobs.qwik.mjs +0 -184
- package/lib/components/elements/ColorPicker.qwik.cjs +0 -283
- package/lib/components/elements/ColorPicker.qwik.mjs +0 -283
- package/lib/components/elements/Dropdown.qwik.cjs +0 -28
- package/lib/components/elements/Dropdown.qwik.mjs +0 -28
- package/lib/components/elements/Nav.qwik.cjs +0 -80
- package/lib/components/elements/Nav.qwik.mjs +0 -80
- package/lib/components/elements/NumberInput.d.ts +0 -21
- package/lib/components/elements/NumberInput.qwik.cjs +0 -74
- package/lib/components/elements/NumberInput.qwik.mjs +0 -73
- package/lib/components/elements/RangeInput.qwik.cjs +0 -59
- package/lib/components/elements/RangeInput.qwik.mjs +0 -58
- package/lib/components/elements/SelectMenu.qwik.cjs +0 -109
- package/lib/components/elements/SelectMenu.qwik.mjs +0 -108
- package/lib/components/elements/Sidebar.qwik.cjs +0 -30
- package/lib/components/elements/Sidebar.qwik.mjs +0 -30
- package/lib/components/elements/Toggle.qwik.cjs +0 -31
- package/lib/components/elements/Toggle.qwik.mjs +0 -31
- package/lib/components/functions.qwik.cjs +0 -17
- package/lib/components/functions.qwik.mjs +0 -17
- package/lib/components/logos/Birdflop.d.ts +0 -10
- package/lib/components/logos/Birdflop.qwik.cjs +0 -66
- package/lib/components/logos/Birdflop.qwik.mjs +0 -67
- package/lib/components/logos/Fabric.d.ts +0 -5
- package/lib/components/logos/Fabric.qwik.cjs +0 -30
- package/lib/components/logos/Fabric.qwik.mjs +0 -31
- package/lib/components/logos/Forge.d.ts +0 -5
- package/lib/components/logos/Forge.qwik.cjs +0 -29
- package/lib/components/logos/Forge.qwik.mjs +0 -30
- package/lib/components/logos/Luminescent.d.ts +0 -9
- package/lib/components/logos/Luminescent.qwik.cjs +0 -123
- package/lib/components/logos/Luminescent.qwik.mjs +0 -122
- package/lib/components/logos/Paper.d.ts +0 -5
- package/lib/components/logos/Paper.qwik.cjs +0 -41
- package/lib/components/logos/Paper.qwik.mjs +0 -42
- package/lib/components/logos/Purpur.d.ts +0 -5
- package/lib/components/logos/Purpur.qwik.cjs +0 -75
- package/lib/components/logos/Purpur.qwik.mjs +0 -76
- package/lib/components/logos/Waterfall.d.ts +0 -5
- package/lib/components/logos/Waterfall.qwik.cjs +0 -20
- package/lib/components/logos/Waterfall.qwik.mjs +0 -21
- package/lib/svg/ChevronDown.d.ts +0 -2
- package/lib/svg/ChevronDown.qwik.cjs +0 -20
- package/lib/svg/ChevronDown.qwik.mjs +0 -21
- package/lib/svg/Link.d.ts +0 -2
- package/lib/svg/Link.qwik.cjs +0 -29
- package/lib/svg/Link.qwik.mjs +0 -30
- package/lib/svg/Menu.d.ts +0 -2
- package/lib/svg/Menu.qwik.cjs +0 -24
- package/lib/svg/Menu.qwik.mjs +0 -25
- package/lib/svg/Minus.d.ts +0 -2
- package/lib/svg/Minus.qwik.cjs +0 -20
- package/lib/svg/Minus.qwik.mjs +0 -21
- package/lib/svg/Plus.d.ts +0 -2
- package/lib/svg/Plus.qwik.cjs +0 -20
- package/lib/svg/Plus.qwik.mjs +0 -21
- package/lib/svg/Shuffle.qwik.cjs +0 -26
- package/lib/svg/Shuffle.qwik.mjs +0 -27
- package/lib/utils/color.qwik.cjs +0 -120
- package/lib/utils/color.qwik.mjs +0 -114
- /package/{lib → lib-types}/components/elements.d.ts +0 -0
- /package/{lib → lib-types}/components/functions.d.ts +0 -0
- /package/{lib → lib-types}/index.d.ts +0 -0
- /package/{lib → lib-types}/utils/color.d.ts +0 -0
package/lib/svg/Minus.qwik.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx } from "@qwik.dev/core/jsx-runtime";
|
|
2
|
-
import { component$ } from "@qwik.dev/core";
|
|
3
|
-
//#region src/svg/Minus.tsx
|
|
4
|
-
var Minus = component$(({ size, ...props }) => {
|
|
5
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
6
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
-
width: size,
|
|
8
|
-
height: size,
|
|
9
|
-
viewBox: "0 0 24 24",
|
|
10
|
-
fill: "none",
|
|
11
|
-
stroke: "currentColor",
|
|
12
|
-
"stroke-width": "2",
|
|
13
|
-
"stroke-linecap": "round",
|
|
14
|
-
"stroke-linejoin": "round",
|
|
15
|
-
class: "lucide lucide-minus-icon lucide-minus",
|
|
16
|
-
...props,
|
|
17
|
-
children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" })
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
//#endregion
|
|
21
|
-
export { Minus };
|
package/lib/svg/Plus.d.ts
DELETED
package/lib/svg/Plus.qwik.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
let _qwik_dev_core_jsx_runtime = require("@qwik.dev/core/jsx-runtime");
|
|
2
|
-
//#region src/svg/Plus.tsx
|
|
3
|
-
var Plus = (0, require("@qwik.dev/core").component$)(({ size, ...props }) => {
|
|
4
|
-
return /* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsxs)("svg", {
|
|
5
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
-
width: size,
|
|
7
|
-
height: size,
|
|
8
|
-
viewBox: "0 0 24 24",
|
|
9
|
-
fill: "none",
|
|
10
|
-
stroke: "currentColor",
|
|
11
|
-
"stroke-width": "2",
|
|
12
|
-
"stroke-linecap": "round",
|
|
13
|
-
"stroke-linejoin": "round",
|
|
14
|
-
class: "lucide lucide-plus-icon lucide-plus",
|
|
15
|
-
...props,
|
|
16
|
-
children: [/* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsx)("path", { d: "M5 12h14" }), /* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsx)("path", { d: "M12 5v14" })]
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
//#endregion
|
|
20
|
-
exports.Plus = Plus;
|
package/lib/svg/Plus.qwik.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "@qwik.dev/core/jsx-runtime";
|
|
2
|
-
import { component$ } from "@qwik.dev/core";
|
|
3
|
-
//#region src/svg/Plus.tsx
|
|
4
|
-
var Plus = component$(({ size, ...props }) => {
|
|
5
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
6
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
-
width: size,
|
|
8
|
-
height: size,
|
|
9
|
-
viewBox: "0 0 24 24",
|
|
10
|
-
fill: "none",
|
|
11
|
-
stroke: "currentColor",
|
|
12
|
-
"stroke-width": "2",
|
|
13
|
-
"stroke-linecap": "round",
|
|
14
|
-
"stroke-linejoin": "round",
|
|
15
|
-
class: "lucide lucide-plus-icon lucide-plus",
|
|
16
|
-
...props,
|
|
17
|
-
children: [/* @__PURE__ */ jsx("path", { d: "M5 12h14" }), /* @__PURE__ */ jsx("path", { d: "M12 5v14" })]
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
//#endregion
|
|
21
|
-
export { Plus };
|
package/lib/svg/Shuffle.qwik.cjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
let _qwik_dev_core_jsx_runtime = require("@qwik.dev/core/jsx-runtime");
|
|
2
|
-
//#region src/svg/Shuffle.tsx
|
|
3
|
-
var Shuffle = (0, require("@qwik.dev/core").component$)(({ size, ...props }) => {
|
|
4
|
-
return /* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsxs)("svg", {
|
|
5
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
-
width: size,
|
|
7
|
-
height: size,
|
|
8
|
-
viewBox: "0 0 24 24",
|
|
9
|
-
fill: "none",
|
|
10
|
-
stroke: "currentColor",
|
|
11
|
-
"stroke-width": "2",
|
|
12
|
-
"stroke-linecap": "round",
|
|
13
|
-
"stroke-linejoin": "round",
|
|
14
|
-
class: "lucide lucide-shuffle-icon lucide-shuffle",
|
|
15
|
-
...props,
|
|
16
|
-
children: [
|
|
17
|
-
/* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsx)("path", { d: "m18 14 4 4-4 4" }),
|
|
18
|
-
/* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsx)("path", { d: "m18 2 4 4-4 4" }),
|
|
19
|
-
/* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsx)("path", { d: "M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22" }),
|
|
20
|
-
/* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsx)("path", { d: "M2 6h1.972a4 4 0 0 1 3.6 2.2" }),
|
|
21
|
-
/* @__PURE__ */ (0, _qwik_dev_core_jsx_runtime.jsx)("path", { d: "M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45" })
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
//#endregion
|
|
26
|
-
exports.Shuffle = Shuffle;
|
package/lib/svg/Shuffle.qwik.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "@qwik.dev/core/jsx-runtime";
|
|
2
|
-
import { component$ } from "@qwik.dev/core";
|
|
3
|
-
//#region src/svg/Shuffle.tsx
|
|
4
|
-
var Shuffle = component$(({ size, ...props }) => {
|
|
5
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
6
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
-
width: size,
|
|
8
|
-
height: size,
|
|
9
|
-
viewBox: "0 0 24 24",
|
|
10
|
-
fill: "none",
|
|
11
|
-
stroke: "currentColor",
|
|
12
|
-
"stroke-width": "2",
|
|
13
|
-
"stroke-linecap": "round",
|
|
14
|
-
"stroke-linejoin": "round",
|
|
15
|
-
class: "lucide lucide-shuffle-icon lucide-shuffle",
|
|
16
|
-
...props,
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ jsx("path", { d: "m18 14 4 4-4 4" }),
|
|
19
|
-
/* @__PURE__ */ jsx("path", { d: "m18 2 4 4-4 4" }),
|
|
20
|
-
/* @__PURE__ */ jsx("path", { d: "M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22" }),
|
|
21
|
-
/* @__PURE__ */ jsx("path", { d: "M2 6h1.972a4 4 0 0 1 3.6 2.2" }),
|
|
22
|
-
/* @__PURE__ */ jsx("path", { d: "M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45" })
|
|
23
|
-
]
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
//#endregion
|
|
27
|
-
export { Shuffle };
|
package/lib/utils/color.qwik.cjs
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
//#region src/utils/color.ts
|
|
2
|
-
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
3
|
-
function getMousePosition(e) {
|
|
4
|
-
if (window.TouchEvent && e instanceof TouchEvent) {
|
|
5
|
-
const touch = e.touches[0];
|
|
6
|
-
return {
|
|
7
|
-
x: touch.clientX,
|
|
8
|
-
y: touch.clientY
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
const mouse = e;
|
|
12
|
-
return {
|
|
13
|
-
x: mouse.clientX,
|
|
14
|
-
y: mouse.clientY
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
var pad2 = (c) => c.length == 1 ? "0" + c : "" + c;
|
|
18
|
-
function getBrightness(color) {
|
|
19
|
-
const { r, g, b } = color;
|
|
20
|
-
return (r * 299 + g * 587 + b * 114) / 1e3;
|
|
21
|
-
}
|
|
22
|
-
function hexToRgba(hex) {
|
|
23
|
-
const num = parseInt(hex.replace("#", ""), 16);
|
|
24
|
-
if (num <= 16777215) return {
|
|
25
|
-
r: (num >> 16 & 255) / 255,
|
|
26
|
-
g: (num >> 8 & 255) / 255,
|
|
27
|
-
b: (num & 255) / 255
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
r: (num >> 24 & 255) / 255,
|
|
31
|
-
g: (num >> 16 & 255) / 255,
|
|
32
|
-
b: (num >> 8 & 255) / 255,
|
|
33
|
-
a: (num & 255) / 255
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function rgbToHex(color) {
|
|
37
|
-
const { r, g, b, a } = color;
|
|
38
|
-
return [
|
|
39
|
-
"#",
|
|
40
|
-
pad2(Math.round(r * 255).toString(16)),
|
|
41
|
-
pad2(Math.round(g * 255).toString(16)),
|
|
42
|
-
pad2(Math.round(b * 255).toString(16)),
|
|
43
|
-
a !== void 0 && a !== 1 ? pad2(Math.round(a * 255).toString(16)) : ""
|
|
44
|
-
].join("").toUpperCase();
|
|
45
|
-
}
|
|
46
|
-
function hsvToRgb(color) {
|
|
47
|
-
let { h } = color;
|
|
48
|
-
const { s, v, a } = color;
|
|
49
|
-
h *= 6;
|
|
50
|
-
const i = Math.floor(h);
|
|
51
|
-
const f = h - i;
|
|
52
|
-
const p = v * (1 - s);
|
|
53
|
-
const q = v * (1 - f * s);
|
|
54
|
-
const t = v * (1 - (1 - f) * s);
|
|
55
|
-
const mod = i % 6;
|
|
56
|
-
return {
|
|
57
|
-
r: [
|
|
58
|
-
v,
|
|
59
|
-
q,
|
|
60
|
-
p,
|
|
61
|
-
p,
|
|
62
|
-
t,
|
|
63
|
-
v
|
|
64
|
-
][mod],
|
|
65
|
-
g: [
|
|
66
|
-
t,
|
|
67
|
-
v,
|
|
68
|
-
v,
|
|
69
|
-
q,
|
|
70
|
-
p,
|
|
71
|
-
p
|
|
72
|
-
][mod],
|
|
73
|
-
b: [
|
|
74
|
-
p,
|
|
75
|
-
p,
|
|
76
|
-
t,
|
|
77
|
-
v,
|
|
78
|
-
v,
|
|
79
|
-
q
|
|
80
|
-
][mod],
|
|
81
|
-
a
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function rgbToHsv(color) {
|
|
85
|
-
const { r, g, b, a } = color;
|
|
86
|
-
const max = Math.max(r, g, b);
|
|
87
|
-
const min = Math.min(r, g, b);
|
|
88
|
-
const d = max - min;
|
|
89
|
-
const s = max === 0 ? 0 : d / max;
|
|
90
|
-
const v = max;
|
|
91
|
-
let h = 0;
|
|
92
|
-
if (max != min) {
|
|
93
|
-
switch (max) {
|
|
94
|
-
case r:
|
|
95
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
96
|
-
break;
|
|
97
|
-
case g:
|
|
98
|
-
h = (b - r) / d + 2;
|
|
99
|
-
break;
|
|
100
|
-
case b:
|
|
101
|
-
h = (r - g) / d + 4;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
h /= 6;
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
h,
|
|
108
|
-
s,
|
|
109
|
-
v,
|
|
110
|
-
a
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
exports.clamp = clamp;
|
|
115
|
-
exports.getBrightness = getBrightness;
|
|
116
|
-
exports.getMousePosition = getMousePosition;
|
|
117
|
-
exports.hexToRgba = hexToRgba;
|
|
118
|
-
exports.hsvToRgb = hsvToRgb;
|
|
119
|
-
exports.rgbToHex = rgbToHex;
|
|
120
|
-
exports.rgbToHsv = rgbToHsv;
|
package/lib/utils/color.qwik.mjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
//#region src/utils/color.ts
|
|
2
|
-
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
3
|
-
function getMousePosition(e) {
|
|
4
|
-
if (window.TouchEvent && e instanceof TouchEvent) {
|
|
5
|
-
const touch = e.touches[0];
|
|
6
|
-
return {
|
|
7
|
-
x: touch.clientX,
|
|
8
|
-
y: touch.clientY
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
const mouse = e;
|
|
12
|
-
return {
|
|
13
|
-
x: mouse.clientX,
|
|
14
|
-
y: mouse.clientY
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
var pad2 = (c) => c.length == 1 ? "0" + c : "" + c;
|
|
18
|
-
function getBrightness(color) {
|
|
19
|
-
const { r, g, b } = color;
|
|
20
|
-
return (r * 299 + g * 587 + b * 114) / 1e3;
|
|
21
|
-
}
|
|
22
|
-
function hexToRgba(hex) {
|
|
23
|
-
const num = parseInt(hex.replace("#", ""), 16);
|
|
24
|
-
if (num <= 16777215) return {
|
|
25
|
-
r: (num >> 16 & 255) / 255,
|
|
26
|
-
g: (num >> 8 & 255) / 255,
|
|
27
|
-
b: (num & 255) / 255
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
r: (num >> 24 & 255) / 255,
|
|
31
|
-
g: (num >> 16 & 255) / 255,
|
|
32
|
-
b: (num >> 8 & 255) / 255,
|
|
33
|
-
a: (num & 255) / 255
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function rgbToHex(color) {
|
|
37
|
-
const { r, g, b, a } = color;
|
|
38
|
-
return [
|
|
39
|
-
"#",
|
|
40
|
-
pad2(Math.round(r * 255).toString(16)),
|
|
41
|
-
pad2(Math.round(g * 255).toString(16)),
|
|
42
|
-
pad2(Math.round(b * 255).toString(16)),
|
|
43
|
-
a !== void 0 && a !== 1 ? pad2(Math.round(a * 255).toString(16)) : ""
|
|
44
|
-
].join("").toUpperCase();
|
|
45
|
-
}
|
|
46
|
-
function hsvToRgb(color) {
|
|
47
|
-
let { h } = color;
|
|
48
|
-
const { s, v, a } = color;
|
|
49
|
-
h *= 6;
|
|
50
|
-
const i = Math.floor(h);
|
|
51
|
-
const f = h - i;
|
|
52
|
-
const p = v * (1 - s);
|
|
53
|
-
const q = v * (1 - f * s);
|
|
54
|
-
const t = v * (1 - (1 - f) * s);
|
|
55
|
-
const mod = i % 6;
|
|
56
|
-
return {
|
|
57
|
-
r: [
|
|
58
|
-
v,
|
|
59
|
-
q,
|
|
60
|
-
p,
|
|
61
|
-
p,
|
|
62
|
-
t,
|
|
63
|
-
v
|
|
64
|
-
][mod],
|
|
65
|
-
g: [
|
|
66
|
-
t,
|
|
67
|
-
v,
|
|
68
|
-
v,
|
|
69
|
-
q,
|
|
70
|
-
p,
|
|
71
|
-
p
|
|
72
|
-
][mod],
|
|
73
|
-
b: [
|
|
74
|
-
p,
|
|
75
|
-
p,
|
|
76
|
-
t,
|
|
77
|
-
v,
|
|
78
|
-
v,
|
|
79
|
-
q
|
|
80
|
-
][mod],
|
|
81
|
-
a
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function rgbToHsv(color) {
|
|
85
|
-
const { r, g, b, a } = color;
|
|
86
|
-
const max = Math.max(r, g, b);
|
|
87
|
-
const min = Math.min(r, g, b);
|
|
88
|
-
const d = max - min;
|
|
89
|
-
const s = max === 0 ? 0 : d / max;
|
|
90
|
-
const v = max;
|
|
91
|
-
let h = 0;
|
|
92
|
-
if (max != min) {
|
|
93
|
-
switch (max) {
|
|
94
|
-
case r:
|
|
95
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
96
|
-
break;
|
|
97
|
-
case g:
|
|
98
|
-
h = (b - r) / d + 2;
|
|
99
|
-
break;
|
|
100
|
-
case b:
|
|
101
|
-
h = (r - g) / d + 4;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
h /= 6;
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
h,
|
|
108
|
-
s,
|
|
109
|
-
v,
|
|
110
|
-
a
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
export { clamp, getBrightness, getMousePosition, hexToRgba, hsvToRgb, rgbToHex, rgbToHsv };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|