@ksojecki/purpose-ui 0.5.0 → 0.6.0-next.20261202011249
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/{SegmentedControl-C9KOemhZ.js → SegmentedControl-CnbjaHGg.js} +1 -1
- package/dist/color-BnAYrucv.js +68 -0
- package/dist/{css-Q_rQQfs0.js → css-DgOSEoqU.js} +1 -1
- package/dist/{derive-BdxPunlt.js → derive-coNJtb__.js} +170 -227
- package/dist/forms/ColorWheel/ColorWheel.d.ts +55 -0
- package/dist/forms/ColorWheel/WheelCanvas.d.ts +6 -0
- package/dist/forms/ColorWheel/index.d.ts +1 -0
- package/dist/forms/ColorWheel/useWheelDrag.d.ts +26 -0
- package/dist/forms/ColorWheel/wheelGeometry.d.ts +30 -0
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/index.js +481 -242
- package/dist/internal/theme-generator/color.d.ts +1 -0
- package/dist/theme-generator/cli.js +2 -2
- package/dist/theme-generator/index.js +3 -3
- package/dist/theming/index.js +4 -4
- package/package.json +1 -1
- package/skills/purpose-ui/SKILL.md +1 -0
- package/dist/hex-BZsMkL37.js +0 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./Button-T8UI5igR.js";
|
|
2
2
|
import { t } from "./classNames-x6JVYA2t.js";
|
|
3
3
|
import { i as n, r, t as i } from "./Field-CTaBbuE1.js";
|
|
4
|
-
import {
|
|
4
|
+
import { c as a, s as o } from "./color-BnAYrucv.js";
|
|
5
5
|
import { useId as s, useState as c } from "react";
|
|
6
6
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
7
|
// src/forms/Select.tsx
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { converter as e, formatHex as t, parse as n, wcagContrast as r } from "culori";
|
|
2
|
+
// src/internal/hex.ts
|
|
3
|
+
var i = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
4
|
+
function a(e) {
|
|
5
|
+
return typeof e == "string" && i.test(e);
|
|
6
|
+
}
|
|
7
|
+
function o(e) {
|
|
8
|
+
let t = e.replace("#", "").toLowerCase();
|
|
9
|
+
return `#${t.length === 3 ? [...t].map((e) => e + e).join("") : t}`;
|
|
10
|
+
}
|
|
11
|
+
// src/internal/theme-generator/color.ts
|
|
12
|
+
var s = e("oklch"), c = e("rgb");
|
|
13
|
+
function l(e) {
|
|
14
|
+
let t = s(n(e));
|
|
15
|
+
if (!t) throw Error(`Not a colour: ${e}`);
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
function u(e, t, n) {
|
|
19
|
+
let { r, g: i, b: a } = c({
|
|
20
|
+
mode: "oklch",
|
|
21
|
+
l: e,
|
|
22
|
+
c: t,
|
|
23
|
+
h: n
|
|
24
|
+
});
|
|
25
|
+
return [
|
|
26
|
+
r,
|
|
27
|
+
i,
|
|
28
|
+
a
|
|
29
|
+
].every((e) => e >= -1e-6 && e <= 1.000001);
|
|
30
|
+
}
|
|
31
|
+
function d(e, n, r) {
|
|
32
|
+
let i = 0, a = n;
|
|
33
|
+
if (!u(e, n, r)) {
|
|
34
|
+
for (let t = 0; t < 24; t += 1) {
|
|
35
|
+
let t = (i + a) / 2;
|
|
36
|
+
u(e, t, r) ? i = t : a = t;
|
|
37
|
+
}
|
|
38
|
+
a = i;
|
|
39
|
+
}
|
|
40
|
+
return t({
|
|
41
|
+
mode: "oklch",
|
|
42
|
+
l: e,
|
|
43
|
+
c: a,
|
|
44
|
+
h: r
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function f(e, t) {
|
|
48
|
+
return r(e, t);
|
|
49
|
+
}
|
|
50
|
+
function p(e, t, r) {
|
|
51
|
+
let i = c(n(e)), a = c(n(r));
|
|
52
|
+
if (!i || !a) throw Error(`Not a colour: ${e} or ${r}`);
|
|
53
|
+
return {
|
|
54
|
+
mode: "rgb",
|
|
55
|
+
r: i.r * t + a.r * (1 - t),
|
|
56
|
+
g: i.g * t + a.g * (1 - t),
|
|
57
|
+
b: i.b * t + a.b * (1 - t)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function m(e) {
|
|
61
|
+
return Math.round(Math.min(1, Math.max(0, e)) * 255);
|
|
62
|
+
}
|
|
63
|
+
function h(e, t) {
|
|
64
|
+
let r = c(n(e));
|
|
65
|
+
if (!r) throw Error(`Not a colour: ${e}`);
|
|
66
|
+
return `rgb(${m(r.r)} ${m(r.g)} ${m(r.b)} / ${t})`;
|
|
67
|
+
}
|
|
68
|
+
export { l as a, o as c, p as i, d as n, h as o, u as r, a as s, f as t };
|