@opencloud-eu/design-system
Version:
OpenCloud Design System is used to design OpenCloud UI components
124 lines (123 loc) • 2.93 kB
JavaScript
function l(t) {
t = t.startsWith("#") ? t : `#${t}`;
const n = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
return n ? [parseInt(n[1], 16), parseInt(n[2], 16), parseInt(n[3], 16)] : null;
}
function T(t) {
const [n, e, r] = t, s = n.toString(16).padStart(2, "0"), a = e.toString(16).padStart(2, "0"), o = r.toString(16).padStart(2, "0");
return `#${s}${a}${o}`;
}
function c(t, n) {
let e = t * (100 + n) / 100;
return e = e < 255 ? e : 255, e = Math.round(e), e.toString(16).length == 1 ? "0" + e.toString(16) : e.toString(16);
}
function i(t, n) {
const e = t[0], r = t[1], s = t[2];
return `#${c(e, n)}${c(r, n)}${c(s, n)}`;
}
function x(t) {
const n = t.map((e) => {
const r = e / 255;
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
});
return Number((0.2126 * n[0] + 0.7152 * n[1] + 0.0722 * n[2]).toFixed(3));
}
function f(t, n) {
const e = x(t), r = x(n);
return (Math.max(e, r) + 0.05) / (Math.min(e, r) + 0.05);
}
function S(t) {
let n = 0;
for (let e = 0; e < t.length; e++)
n = t.charCodeAt(e) + ((n << 5) - n);
return `#${(n & 16777215).toString(16).toUpperCase()}`;
}
function E(t, n, e) {
const r = f(t, n);
return Math.abs(e - r) <= 0.3 ? t : r < e ? E(
l(i(t, -1)),
n,
e
) : E(
l(i(t, 1)),
n,
e
);
}
function p(t) {
t = t.toLowerCase().replace(/\s/g, "");
const n = t.includes("rgba("), e = t.match(n ? /rgba?\(([^)]+)\)/ : /rgb?\(([^)]+)\)/);
if (!e)
return "#000000";
const r = e[1].split(",");
let s = "";
n && (s = Math.round(parseFloat(r.pop()) * 255).toString(16), s.length === 1 && (s = "0" + s));
const a = r.map((o) => {
const u = parseInt(o, 10).toString(16);
return u.length === 1 ? "0" + u : u;
}).join("");
return n ? `#${a}${s}` : `#${a}`;
}
function _(t) {
var r;
if (!t)
return "";
if (t.startsWith("#"))
return t;
const n = ((r = t.match(/var\(([^)]+)\)/)) == null ? void 0 : r[1]) || t, e = getComputedStyle(document.documentElement).getPropertyValue(n);
return e.startsWith("#") ? e : p(e);
}
const D = "thead-clicked", V = "highlight", I = "rowMounted", N = "contextmenuClicked", C = "itemDropped", M = "itemDroppedBreadcrumb", $ = "itemDragged", A = "fileDropped", P = "sort", O = [
"xsmall",
"small",
"medium",
"large",
"xlarge",
"xxlarge",
"xxxlarge"
];
let g = "";
const H = (t) => {
g = t;
}, L = () => g, h = {
xxxsmall: "xxxs",
xxsmall: "xxs",
xsmall: "xs",
small: "s",
medium: "m",
large: "l",
xlarge: "xl",
xxlarge: "xxl",
xxxlarge: "xxxl",
remove: "rm"
};
function U(t) {
return h[t];
}
let m = 0;
const W = (t = "") => (t = t || "", m += 1, t + m);
export {
O as A,
M as E,
U as a,
_ as b,
S as c,
E as d,
I as e,
N as f,
L as g,
l as h,
V as i,
$ as j,
C as k,
i as l,
x as m,
f as n,
p as o,
D as p,
A as q,
T as r,
H as s,
P as t,
W as u
};