UNPKG

@ownclouders/design-system

Version:

ownCloud Design System is based on VueDesign Systems and is used to design ownCloud UI components

118 lines (117 loc) 2.85 kB
function c(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 f(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 l(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 `#${l(e, n)}${l(r, n)}${l(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 g(t, n) { const e = x(t), r = x(n); return (Math.max(e, r) + 0.05) / (Math.min(e, r) + 0.05); } function T(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 = g(t, n); return Math.abs(e - r) <= 0.3 ? t : r < e ? E( c(i(t, -1)), n, e ) : E( c(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 S(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 _ = "thead-clicked", D = "highlight", V = "rowMounted", N = "contextmenuClicked", C = "itemDropped", I = "itemDroppedBreadcrumb", M = "itemDragged", $ = "fileDropped", A = "sort", O = [ "xsmall", "small", "medium", "large", "xlarge", "xxlarge", "xxxlarge" ], h = { xxxsmall: "xxxs", xxsmall: "xxs", xsmall: "xs", small: "s", medium: "m", large: "l", xlarge: "xl", xxlarge: "xxl", xxxlarge: "xxxl", remove: "rm" }; function H(t) { return h[t]; } let m = 0; const L = (t = "") => (t = t || "", m += 1, t + m); export { O as A, I as E, S as a, T as b, i as c, C as d, M as e, _ as f, H as g, c as h, D as i, V as j, N as k, A as l, x as m, g as n, p as o, $ as p, f as r, E as s, L as u };