@serenity-ui/styles
Advanced tools
Comparing version 0.1.14 to 0.1.15
@@ -17,2 +17,9 @@ import { JSX } from "solid-js/jsx-runtime"; | ||
/** | ||
* Handles the style strategy wether it needs to be extended or replaced. | ||
* @param args | ||
* @param strategy | ||
* @returns The handled style | ||
*/ | ||
export declare function s(strategy: 'extend' | 'replace', ...args: (string | false | undefined)[]): string | undefined; | ||
/** | ||
* Converts any value to a boolean HTML attribute | ||
@@ -19,0 +26,0 @@ * |
@@ -174,9 +174,12 @@ const c = { | ||
} | ||
function j(...e) { | ||
function k(...e) { | ||
return e.filter(Boolean).join(" "); | ||
} | ||
function E(e) { | ||
function E(e, ...t) { | ||
return e === "extend" ? k(...t) : t.filter(Boolean).pop() || void 0; | ||
} | ||
function z(e) { | ||
return e ? "" : void 0; | ||
} | ||
function z(e) { | ||
function F(e) { | ||
const t = {}; | ||
@@ -189,3 +192,3 @@ for (const r in e) { | ||
} | ||
const k = [ | ||
const w = [ | ||
"xl", | ||
@@ -197,8 +200,8 @@ "lg", | ||
]; | ||
function w(e) { | ||
return k.includes(e); | ||
function B(e) { | ||
return w.includes(e); | ||
} | ||
function v(e, t, r = "rem") { | ||
if (t != null) | ||
return typeof t == "number" ? t + r : w(t) ? m(e, t) : t; | ||
return typeof t == "number" ? t + r : B(t) ? m(e, t) : t; | ||
} | ||
@@ -208,7 +211,7 @@ function m(e, t) { | ||
} | ||
function F(e) { | ||
function _(e) { | ||
if (e) | ||
return m("shadow", e); | ||
} | ||
function _(e, t, r) { | ||
function U(e, t, r) { | ||
if (typeof e == "number") | ||
@@ -222,3 +225,3 @@ return e + r; | ||
} | ||
function U(e) { | ||
function Y(e) { | ||
const t = {}; | ||
@@ -248,3 +251,3 @@ for (const r in e) { | ||
} | ||
const Y = [ | ||
const Z = [ | ||
"m", | ||
@@ -311,3 +314,3 @@ "my", | ||
}; | ||
function Z(e, ...t) { | ||
function q(e, ...t) { | ||
const r = {}, n = []; | ||
@@ -335,3 +338,3 @@ for (const f in e) { | ||
} | ||
function B(e) { | ||
function H(e) { | ||
const [t, r, n] = p(e), f = (1 - Math.abs(2 * n - 1)) * r, i = t / 60, a = f * (1 - Math.abs(i % 2 - 1)), $ = n - f / 2; | ||
@@ -344,11 +347,11 @@ let o = 0, u = 0, l = 0; | ||
} | ||
function H(e, t) { | ||
function G(e, t) { | ||
let [r, n, f] = d(e); | ||
return r = Math.max(0, r - t), n = Math.max(0, n - t), f = Math.max(0, f - t), S(r, n, f); | ||
} | ||
function G(e, t) { | ||
function V(e, t) { | ||
let [r, n, f] = g(e); | ||
return r = Math.max(0, r - t), n = Math.max(0, n - t), f = Math.max(0, f - t), `rgb(${r}, ${n}, ${f})`; | ||
} | ||
function V(e, t) { | ||
function A(e, t) { | ||
const [r, n, f] = p(e), i = Math.max(0, f - t); | ||
@@ -360,7 +363,7 @@ return `hsl(${r}, ${n}%, ${i}%)`; | ||
if (e.startsWith("#")) | ||
return H(e, t); | ||
return G(e, t); | ||
if (e.startsWith("rgb")) | ||
return G(e, t); | ||
return V(e, t); | ||
if (e.startsWith("hsl")) | ||
return V(e, t); | ||
return A(e, t); | ||
} else | ||
@@ -370,11 +373,11 @@ return e; | ||
} | ||
function A(e, t) { | ||
function L(e, t) { | ||
let [r, n, f] = d(e); | ||
return r = Math.min(255, r + t), n = Math.min(255, n + t), f = Math.min(255, f + t), S(r, n, f); | ||
} | ||
function L(e, t) { | ||
function R(e, t) { | ||
let [r, n, f] = g(e); | ||
return r = Math.min(255, r + t), n = Math.min(255, n + t), f = Math.min(255, f + t), `rgb(${r}, ${n}, ${f})`; | ||
} | ||
function R(e, t) { | ||
function T(e, t) { | ||
let [r, n, f] = p(e); | ||
@@ -384,4 +387,4 @@ const i = Math.min(255, f + t); | ||
} | ||
function q(e, t) { | ||
return e.startsWith("#") ? A(e, t) : e.startsWith("rgb") ? L(e, t) : e.startsWith("hsl") ? R(e, t) : e; | ||
function P(e, t) { | ||
return e.startsWith("#") ? L(e, t) : e.startsWith("rgb") ? R(e, t) : e.startsWith("hsl") ? T(e, t) : e; | ||
} | ||
@@ -392,7 +395,7 @@ function M(e, t) { | ||
} | ||
function T(e, t) { | ||
function I(e, t) { | ||
const [r, n, f] = g(e); | ||
return `rgba(${r}, ${n}, ${f}, ${t})`; | ||
} | ||
function I(e, t) { | ||
function O(e, t) { | ||
const [r, n, f] = p(e); | ||
@@ -406,5 +409,5 @@ return `hsla(${r}, ${n}%, ${f}%, ${t})`; | ||
if (e.startsWith("rgb")) | ||
return T(e, t); | ||
return I(e, t); | ||
if (e.startsWith("hsl")) | ||
return I(e, t); | ||
return O(e, t); | ||
if (e.includes(".")) { | ||
@@ -418,3 +421,3 @@ const [n, f] = e.split("."), i = r[n][+f]; | ||
} | ||
function P(e, t = 6) { | ||
function J(e, t = 6) { | ||
var f; | ||
@@ -426,3 +429,3 @@ if (e.includes(".")) | ||
} | ||
function O(e) { | ||
function j(e) { | ||
let t, r, n; | ||
@@ -434,3 +437,3 @@ if (e.startsWith("#")) | ||
else if (e.startsWith("hsl")) | ||
[t, r, n] = B(e); | ||
[t, r, n] = H(e); | ||
else if (e.includes(".")) { | ||
@@ -445,14 +448,14 @@ const [i, a] = e.split("."); | ||
} | ||
function J(e, t, r) { | ||
function K(e, t, r) { | ||
return e < t ? t : e > r ? r : e; | ||
} | ||
function K(e) { | ||
function N(e) { | ||
return e.length === 1 ? `0${e}` : e; | ||
} | ||
const N = (e, t) => ({ | ||
const Q = (e, t) => ({ | ||
"text-color": b(e, t), | ||
"background-color": "#ffffff" | ||
}), Q = (e, t) => ({ | ||
}), X = (e, t) => ({ | ||
"text-color": b(e, t) | ||
}), X = (e, t, r = !0) => { | ||
}), D = (e, t, r = !0) => { | ||
const n = b(e, t), f = { | ||
@@ -463,3 +466,3 @@ "text-color": n, | ||
return r && (f["hover-color"] = h(n, 0.12, c)), f; | ||
}, D = (e, t, r = !0) => { | ||
}, ee = (e, t, r = !0) => { | ||
const n = b(e, t), f = { | ||
@@ -470,5 +473,5 @@ "text-color": n, | ||
return r && (f["hover-color"] = h(n, 0.12, c)), f; | ||
}, ee = (e, t, r = !0) => { | ||
}, te = (e, t, r = !0) => { | ||
const n = b(e, t), f = { | ||
"text-color": O(n) ? "#000" : "#fff", | ||
"text-color": j(n) ? "#000" : "#fff", | ||
"background-color": n | ||
@@ -480,3 +483,3 @@ }; | ||
}), f; | ||
}, te = (e, t, r = !0) => { | ||
}, re = (e, t, r = !0) => { | ||
const n = b(e, t), f = { | ||
@@ -488,43 +491,44 @@ "text-color": n | ||
export { | ||
Y as UTILITY_NAMES, | ||
Z as UTILITY_NAMES, | ||
C as UTILITY_PARSERS, | ||
E as b, | ||
z as b, | ||
S as buildHexFromRGB, | ||
Z as buildStyles, | ||
j as c, | ||
J as clamp, | ||
B as convertHSLToRGB, | ||
q as buildStyles, | ||
k as c, | ||
K as clamp, | ||
H as convertHSLToRGB, | ||
d as convertHexToRGB, | ||
y as darkenColor, | ||
V as darkenHSL, | ||
H as darkenHex, | ||
G as darkenRGB, | ||
A as darkenHSL, | ||
G as darkenHex, | ||
V as darkenRGB, | ||
p as getHSLValues, | ||
g as getRGBValues, | ||
P as getThemeColor, | ||
O as isColorLight, | ||
w as isSize, | ||
q as lightenColor, | ||
R as lightenHSL, | ||
A as lightenHex, | ||
L as lightenRGB, | ||
z as localVars, | ||
K as padZero, | ||
J as getThemeColor, | ||
j as isColorLight, | ||
B as isSize, | ||
P as lightenColor, | ||
T as lightenHSL, | ||
L as lightenHex, | ||
R as lightenRGB, | ||
F as localVars, | ||
N as padZero, | ||
b as resolveColor, | ||
ee as resolveFilledVariant, | ||
U as resolveGridCols, | ||
_ as resolveGridSpacing, | ||
te as resolveFilledVariant, | ||
Y as resolveGridCols, | ||
U as resolveGridSpacing, | ||
v as resolveLength, | ||
X as resolveLightVariant, | ||
D as resolveOutlineVariant, | ||
F as resolveShadow, | ||
D as resolveLightVariant, | ||
ee as resolveOutlineVariant, | ||
_ as resolveShadow, | ||
m as resolveSize, | ||
te as resolveSubtleVariant, | ||
Q as resolveTransparentVariant, | ||
N as resolveWhiteVariant, | ||
re as resolveSubtleVariant, | ||
X as resolveTransparentVariant, | ||
Q as resolveWhiteVariant, | ||
E as s, | ||
h as setColorOpacity, | ||
I as setHSLOpacity, | ||
O as setHSLOpacity, | ||
M as setHexOpacity, | ||
T as setRGBOpacity, | ||
I as setRGBOpacity, | ||
W as v | ||
}; |
@@ -38,3 +38,11 @@ import { JSX } from 'solid-js'; | ||
} | ||
export type SerenityBaseProps = UtilityStyleProps; | ||
interface SerenityDefaultProps { | ||
/** | ||
* Wether to extend or replace the default styles. | ||
* @default "extend" | ||
*/ | ||
stylesStrategy?: "extend" | "replace"; | ||
} | ||
export type SerenityBaseProps = UtilityStyleProps & SerenityDefaultProps; | ||
export {}; | ||
//# sourceMappingURL=props.d.ts.map |
{ | ||
"name": "@serenity-ui/styles", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/serenity-styles.umd.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71674
1272