@salty-css/react 0.0.1-alpha.26 → 0.0.1-alpha.260
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/README.md +469 -26
- package/class-name-client.cjs +1 -0
- package/class-name-client.d.ts +7 -0
- package/class-name-client.js +15 -0
- package/class-name.cjs +1 -0
- package/class-name.d.ts +10 -0
- package/class-name.js +25 -0
- package/config.cjs +1 -0
- package/config.d.ts +1 -0
- package/config.js +78 -0
- package/element-factory-DrGBPkh2.js +67 -0
- package/element-factory-Dt_Z9aHy.cjs +1 -0
- package/element-factory.d.ts +3 -3
- package/helpers.cjs +1 -0
- package/helpers.d.ts +1 -0
- package/helpers.js +1154 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/index.js +11 -0
- package/keyframes.cjs +1 -1
- package/keyframes.d.ts +1 -22
- package/keyframes.js +22 -19
- package/media.cjs +1 -1
- package/media.d.ts +1 -71
- package/media.js +6 -3
- package/package.json +29 -4
- package/parse-styles-BRbiYmZ_.js +155 -0
- package/parse-styles-BU5fcwDA.cjs +5 -0
- package/parse-tokens-BnDwbP7V.cjs +1 -0
- package/parse-tokens-Cbbbt7eO.js +12 -0
- package/styled-client.cjs +1 -1
- package/styled-client.d.ts +3 -3
- package/styled-client.js +3 -5
- package/styled.cjs +1 -1
- package/styled.d.ts +5 -5
- package/styled.js +37 -59
- package/styles-generator-Cz2vkKB0.js +47 -0
- package/styles-generator-E48FU2R-.cjs +1 -0
- package/viewport-clamp-BOc-8Oph.js +7 -0
- package/viewport-clamp-kY8JqYzm.cjs +1 -0
- package/dash-case-B_odFlTl.cjs +0 -1
- package/dash-case-CGJ_UIZz.js +0 -6
- package/element-factory-WgNOpLmJ.cjs +0 -1
- package/element-factory-uEk4VrqP.js +0 -59
- package/parse-styles-SPT4zc_H.cjs +0 -7
- package/parse-styles-T74HIH4_.js +0 -85
@@ -0,0 +1,47 @@
|
|
1
|
+
var c = Object.defineProperty;
|
2
|
+
var l = (a, s, t) => s in a ? c(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
3
|
+
var o = (a, s, t) => l(a, typeof s != "symbol" ? s + "" : s, t);
|
4
|
+
import { t as n, p as d } from "./parse-styles-BRbiYmZ_.js";
|
5
|
+
import { d as h } from "./parse-tokens-Cbbbt7eO.js";
|
6
|
+
class C {
|
7
|
+
constructor(s) {
|
8
|
+
o(this, "buildContext", {});
|
9
|
+
this.params = s;
|
10
|
+
}
|
11
|
+
get priority() {
|
12
|
+
return 0;
|
13
|
+
}
|
14
|
+
get isRoot() {
|
15
|
+
return this.priority === 0;
|
16
|
+
}
|
17
|
+
get hash() {
|
18
|
+
const { base: s, variants: t, compoundVariants: e } = this.params;
|
19
|
+
return n({ base: s, variants: t, compoundVariants: e });
|
20
|
+
}
|
21
|
+
get cssClassName() {
|
22
|
+
return this.hash;
|
23
|
+
}
|
24
|
+
get classNames() {
|
25
|
+
const s = /* @__PURE__ */ new Set([this.cssClassName]), { className: t } = this.params;
|
26
|
+
return typeof t == "string" && s.add(t), typeof t == "object" && t.forEach((e) => s.add(e)), this.getTemplateClasses().forEach((e) => s.add(e)), this.buildContext.classNames && this.buildContext.classNames.forEach((e) => s.add(e)), [...s].join(" ");
|
27
|
+
}
|
28
|
+
get cssFileName() {
|
29
|
+
const { callerName: s } = this.buildContext;
|
30
|
+
return s ? `cl_${h(s)}-${this.hash}.css` : `${this.hash}.css`;
|
31
|
+
}
|
32
|
+
get css() {
|
33
|
+
const { base: s = {}, variants: t = {}, compoundVariants: e = [] } = this.params, { config: r } = this.buildContext, i = { ...s, variants: t, compoundVariants: e };
|
34
|
+
return d(i, `.${this.cssClassName}`, r, this.isRoot);
|
35
|
+
}
|
36
|
+
getTemplateClasses(s = this.buildContext.config) {
|
37
|
+
if (!(s != null && s.templates) || !this.params.base || this.priority > 0) return [];
|
38
|
+
const t = Object.keys(s.templates);
|
39
|
+
return Object.entries(this.params.base).reduce((e, [r, i]) => (t.includes(r) && e.push("t_" + n(h(`${r}-${i}`), 4)), e), []);
|
40
|
+
}
|
41
|
+
_withBuildContext(s) {
|
42
|
+
return this.buildContext = s, this;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
export {
|
46
|
+
C as S
|
47
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";var c=Object.defineProperty;var l=(a,s,t)=>s in a?c(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var o=(a,s,t)=>l(a,typeof s!="symbol"?s+"":s,t);const n=require("./parse-styles-BU5fcwDA.cjs"),h=require("./parse-tokens-BnDwbP7V.cjs");class u{constructor(s){o(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:s,variants:t,compoundVariants:e}=this.params;return n.toHash({base:s,variants:t,compoundVariants:e})}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${h.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[]}=this.params,{config:r}=this.buildContext,i={...s,variants:t,compoundVariants:e};return n.parseAndJoinStyles(i,`.${this.cssClassName}`,r,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[r,i])=>(t.includes(r)&&e.push("t_"+n.toHash(h.dashCase(`${r}-${i}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
const p = (e) => (t) => {
|
2
|
+
const { screenSize: n, axis: i = "horizontal", minMultiplier: a = 0.5, maxMultiplier: r = 1.5 } = e, o = Math.round(t / n * 1e4) / 100, l = i === "vertical" ? "vh" : "vw", c = Math.round(a * t), s = Math.round(r * t);
|
3
|
+
return `clamp(${c}px, ${o}${l}, ${s}px)`;
|
4
|
+
};
|
5
|
+
export {
|
6
|
+
p as d
|
7
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const p=e=>t=>{const{screenSize:i,axis:n="horizontal",minMultiplier:r=.5,maxMultiplier:a=1.5}=e,o=Math.round(t/i*1e4)/100,l=n==="vertical"?"vh":"vw",c=Math.round(r*t),s=Math.round(a*t);return`clamp(${c}px, ${o}${l}, ${s}px)`};exports.defineViewportClamp=p;
|
package/dash-case-B_odFlTl.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";function r(e){return e?typeof e!="string"?r(String(e)):e.replace(/\s/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(n,t)=>(t>0?"-":"")+n.toLowerCase()):""}exports.dashCase=r;
|
package/dash-case-CGJ_UIZz.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const K=require("react"),C=require("./dash-case-B_odFlTl.cjs");function $(t){var n,s,e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){var c=t.length;for(n=0;n<c;n++)t[n]&&(s=$(t[n]))&&(e&&(e+=" "),e+=s)}else for(s in t)t[s]&&(e&&(e+=" "),e+=s);return e}function V(){for(var t,n,s=0,e="",c=arguments.length;s<c;s++)(t=arguments[s])&&(n=$(t))&&(e&&(e+=" "),e+=n);return e}const O=["passVariantProps"],N=(t,n,s,e)=>{const c=({extend:f=t,element:b=s.element,className:g="",children:v,passVariantProps:S,_vks:r=new Set,...l},w)=>{const i={passVariantProps:S};e&&Object.assign(i,e),l&&Object.assign(i,l);const u=new Set(g.split(" ")),y=typeof f=="function"||typeof f=="object",m=y&&"isStyled"in f,j=y?f:b||f;if(!j)throw new Error("No element provided");s.propValueKeys&&(i.style||(i.style={}),s.propValueKeys.forEach(a=>{const o=`css-${a}`,d=l[o];if(d===void 0)return;const p=`--props-${C.dashCase(a)}`;i.style[p]=d,r&&r.add(o)})),s.variantKeys&&s.variantKeys.forEach(a=>{const[o,d]=a.split("=");l[o]!==void 0?(u.add(`${o}-${l[o]}`),r&&r.add(o)):d!==void 0&&u.add(`${o}-${d}`)}),r&&(!y||!m&&!S)?r.forEach(a=>delete i[a]):m&&Object.assign(i,{_vks:r}),m||O.forEach(a=>delete i[a]);const E=V(n,...u);return K.createElement(j,{element:y?b:void 0,className:E,ref:w,...i},v)},h=K.forwardRef(c);return Object.assign(h,{isStyled:!0,className:n,toString:()=>`.${n}`}),h};exports.elementFactory=N;
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { forwardRef as E, createElement as V } from "react";
|
2
|
-
import { d as C } from "./dash-case-CGJ_UIZz.js";
|
3
|
-
function j(t) {
|
4
|
-
var n, s, e = "";
|
5
|
-
if (typeof t == "string" || typeof t == "number") e += t;
|
6
|
-
else if (typeof t == "object") if (Array.isArray(t)) {
|
7
|
-
var d = t.length;
|
8
|
-
for (n = 0; n < d; n++) t[n] && (s = j(t[n])) && (e && (e += " "), e += s);
|
9
|
-
} else for (s in t) t[s] && (e && (e += " "), e += s);
|
10
|
-
return e;
|
11
|
-
}
|
12
|
-
function O() {
|
13
|
-
for (var t, n, s = 0, e = "", d = arguments.length; s < d; s++) (t = arguments[s]) && (n = j(t)) && (e && (e += " "), e += n);
|
14
|
-
return e;
|
15
|
-
}
|
16
|
-
const N = ["passVariantProps"], q = (t, n, s, e) => {
|
17
|
-
const h = E(({
|
18
|
-
extend: r = t,
|
19
|
-
element: b = s.element,
|
20
|
-
className: K = "",
|
21
|
-
children: $,
|
22
|
-
passVariantProps: p,
|
23
|
-
_vks: f = /* @__PURE__ */ new Set(),
|
24
|
-
...c
|
25
|
-
}, g) => {
|
26
|
-
const i = { passVariantProps: p };
|
27
|
-
e && Object.assign(i, e), c && Object.assign(i, c);
|
28
|
-
const u = new Set(K.split(" ")), y = typeof r == "function" || typeof r == "object", m = y && "isStyled" in r, S = y ? r : b || r;
|
29
|
-
if (!S) throw new Error("No element provided");
|
30
|
-
s.propValueKeys && (i.style || (i.style = {}), s.propValueKeys.forEach((o) => {
|
31
|
-
const a = `css-${o}`, l = c[a];
|
32
|
-
if (l === void 0) return;
|
33
|
-
const w = `--props-${C(o)}`;
|
34
|
-
i.style[w] = l, f && f.add(a);
|
35
|
-
})), s.variantKeys && s.variantKeys.forEach((o) => {
|
36
|
-
const [a, l] = o.split("=");
|
37
|
-
c[a] !== void 0 ? (u.add(`${a}-${c[a]}`), f && f.add(a)) : l !== void 0 && u.add(`${a}-${l}`);
|
38
|
-
}), f && (!y || !m && !p) ? f.forEach((o) => delete i[o]) : m && Object.assign(i, { _vks: f }), m || N.forEach((o) => delete i[o]);
|
39
|
-
const v = O(n, ...u);
|
40
|
-
return V(
|
41
|
-
S,
|
42
|
-
{
|
43
|
-
element: y ? b : void 0,
|
44
|
-
className: v,
|
45
|
-
ref: g,
|
46
|
-
...i
|
47
|
-
},
|
48
|
-
$
|
49
|
-
);
|
50
|
-
});
|
51
|
-
return Object.assign(h, {
|
52
|
-
isStyled: !0,
|
53
|
-
className: n,
|
54
|
-
toString: () => `.${n}`
|
55
|
-
}), h;
|
56
|
-
};
|
57
|
-
export {
|
58
|
-
q as e
|
59
|
-
};
|
@@ -1,7 +0,0 @@
|
|
1
|
-
"use strict";const V=require("./dash-case-B_odFlTl.cjs"),E=r=>String.fromCharCode(r+(r>25?39:97)),P=(r,s)=>{let t="",n;for(n=Math.abs(r);n>52;n=n/52|0)t=E(n%52)+t;return t=E(n%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(r,s)=>{let t=s.length;for(;t;)r=r*33^s.charCodeAt(--t);return r},W=(r,s=3)=>{const t=T(5381,JSON.stringify(r))>>>0;return P(t,s)},q=(r,s)=>{if(typeof r!="string")return{result:r};if(!s)return{result:r};const t=[];return Object.values(s).forEach(n=>{const{pattern:p,transform:$}=n;r=r.replace(p,d=>{const{value:i,css:l}=$(d);return l&&t.push(l),i})}),{result:r,additionalCss:t}},M=r=>typeof r!="string"?{result:r}:/\{[^{}]+\}/g.test(r)?{result:r.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V.dashCase(n[1].replaceAll(".","-"))})`)}:{result:r},a=(r,s,t,n)=>{if(!r)return"";const p=[],$=Object.entries(r).reduce((i,[l,e])=>{const o=l.trim();if(typeof e=="function"&&(e=e()),typeof e=="object"){if(!e)return i;if(o==="variants")return Object.entries(e).forEach(([f,c])=>{c&&Object.entries(c).forEach(([m,b])=>{if(!b)return;const S=`${s}.${f}-${m}`,j=a(b,S,t);p.push(j)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return e.forEach(f=>{const{css:c,...m}=f,b=Object.entries(m).reduce((j,[H,N])=>`${j}.${H}-${N}`,s),S=a(c,b,t);p.push(S)}),i;if(o.startsWith("@")){const f=a(e,s,t),c=`${o} {
|
2
|
-
${f.replace(`
|
3
|
-
`,`
|
4
|
-
`)}
|
5
|
-
}`;return p.push(c),i}const u=l.includes("&")?o.replace("&",s):o.startsWith(":")?`${s}${o}`:`${s} ${o}`,h=a(e,u,t);return p.push(h),i}if(n!=null&&n.templates&&n.templates[o]){const h=e.split(".").reduce((c,m)=>c[m],n.templates[o]),f=a(h,"");return`${i}${f}`}const g=o.startsWith("-")?o:V.dashCase(o),y=(u,h=";")=>i=`${i}${u}${h}`,O=u=>y(`${g}:${u}`);if(typeof e=="number")return O(e);if(typeof e!="string")if("toString"in e)e=e.toString();else return i;const{modifiers:A}=n||{},k=function*(){yield M(e),yield q(e,A)}();for(const{result:u,additionalCss:h=[]}of k)e=u,h.forEach(f=>{const c=a(f,"");y(c,"")});return O(e)},"");if(!$)return p.join(`
|
6
|
-
`);if(!s)return $;let d="";return t!==void 0?d=`@layer l${t} { ${s} { ${$} } }`:d=`${s} { ${$} }`,[d,...p].join(`
|
7
|
-
`)};exports.parseStyles=a;exports.toHash=W;
|
package/parse-styles-T74HIH4_.js
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
import { d as V } from "./dash-case-CGJ_UIZz.js";
|
2
|
-
const E = (r) => String.fromCharCode(r + (r > 25 ? 39 : 97)), T = (r, s) => {
|
3
|
-
let t = "", n;
|
4
|
-
for (n = Math.abs(r); n > 52; n = n / 52 | 0) t = E(n % 52) + t;
|
5
|
-
return t = E(n % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
|
6
|
-
}, W = (r, s) => {
|
7
|
-
let t = s.length;
|
8
|
-
for (; t; ) r = r * 33 ^ s.charCodeAt(--t);
|
9
|
-
return r;
|
10
|
-
}, x = (r, s = 3) => {
|
11
|
-
const t = W(5381, JSON.stringify(r)) >>> 0;
|
12
|
-
return T(t, s);
|
13
|
-
}, H = (r, s) => {
|
14
|
-
if (typeof r != "string") return { result: r };
|
15
|
-
if (!s) return { result: r };
|
16
|
-
const t = [];
|
17
|
-
return Object.values(s).forEach((n) => {
|
18
|
-
const { pattern: c, transform: a } = n;
|
19
|
-
r = r.replace(c, (d) => {
|
20
|
-
const { value: i, css: m } = a(d);
|
21
|
-
return m && t.push(m), i;
|
22
|
-
});
|
23
|
-
}), { result: r, additionalCss: t };
|
24
|
-
}, M = (r) => typeof r != "string" ? { result: r } : /\{[^{}]+\}/g.test(r) ? { result: r.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) } : { result: r }, $ = (r, s, t, n) => {
|
25
|
-
if (!r) return "";
|
26
|
-
const c = [], a = Object.entries(r).reduce((i, [m, e]) => {
|
27
|
-
const o = m.trim();
|
28
|
-
if (typeof e == "function" && (e = e()), typeof e == "object") {
|
29
|
-
if (!e) return i;
|
30
|
-
if (o === "variants")
|
31
|
-
return Object.entries(e).forEach(([f, p]) => {
|
32
|
-
p && Object.entries(p).forEach(([l, b]) => {
|
33
|
-
if (!b) return;
|
34
|
-
const j = `${s}.${f}-${l}`, S = $(b, j, t);
|
35
|
-
c.push(S);
|
36
|
-
});
|
37
|
-
}), i;
|
38
|
-
if (o === "defaultVariants")
|
39
|
-
return i;
|
40
|
-
if (o === "compoundVariants")
|
41
|
-
return e.forEach((f) => {
|
42
|
-
const { css: p, ...l } = f, b = Object.entries(l).reduce((S, [N, P]) => `${S}.${N}-${P}`, s), j = $(p, b, t);
|
43
|
-
c.push(j);
|
44
|
-
}), i;
|
45
|
-
if (o.startsWith("@")) {
|
46
|
-
const f = $(e, s, t), p = `${o} {
|
47
|
-
${f.replace(`
|
48
|
-
`, `
|
49
|
-
`)}
|
50
|
-
}`;
|
51
|
-
return c.push(p), i;
|
52
|
-
}
|
53
|
-
const u = m.includes("&") ? o.replace("&", s) : o.startsWith(":") ? `${s}${o}` : `${s} ${o}`, h = $(e, u, t);
|
54
|
-
return c.push(h), i;
|
55
|
-
}
|
56
|
-
if (n != null && n.templates && n.templates[o]) {
|
57
|
-
const h = e.split(".").reduce((p, l) => p[l], n.templates[o]), f = $(h, "");
|
58
|
-
return `${i}${f}`;
|
59
|
-
}
|
60
|
-
const g = o.startsWith("-") ? o : V(o), y = (u, h = ";") => i = `${i}${u}${h}`, O = (u) => y(`${g}:${u}`);
|
61
|
-
if (typeof e == "number") return O(e);
|
62
|
-
if (typeof e != "string")
|
63
|
-
if ("toString" in e) e = e.toString();
|
64
|
-
else return i;
|
65
|
-
const { modifiers: A } = n || {}, k = function* () {
|
66
|
-
yield M(e), yield H(e, A);
|
67
|
-
}();
|
68
|
-
for (const { result: u, additionalCss: h = [] } of k)
|
69
|
-
e = u, h.forEach((f) => {
|
70
|
-
const p = $(f, "");
|
71
|
-
y(p, "");
|
72
|
-
});
|
73
|
-
return O(e);
|
74
|
-
}, "");
|
75
|
-
if (!a) return c.join(`
|
76
|
-
`);
|
77
|
-
if (!s) return a;
|
78
|
-
let d = "";
|
79
|
-
return t !== void 0 ? d = `@layer l${t} { ${s} { ${a} } }` : d = `${s} { ${a} }`, [d, ...c].join(`
|
80
|
-
`);
|
81
|
-
};
|
82
|
-
export {
|
83
|
-
$ as p,
|
84
|
-
x as t
|
85
|
-
};
|