@salty-css/react 0.0.1-alpha.24 → 0.0.1-alpha.240

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.
@@ -0,0 +1,46 @@
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 h, p as m } from "./parse-styles-WRUkAmCD.js";
5
+ import { d as n } from "./parse-tokens-CssTiO78.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
+ return h(this.params.base || this.params);
19
+ }
20
+ get cssClassName() {
21
+ return this.hash;
22
+ }
23
+ get classNames() {
24
+ const s = /* @__PURE__ */ new Set([this.cssClassName]), { className: t } = this.params;
25
+ 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(" ");
26
+ }
27
+ get cssFileName() {
28
+ const { callerName: s } = this.buildContext;
29
+ return s ? `cl_${n(s)}-${this.hash}.css` : `${this.hash}.css`;
30
+ }
31
+ get css() {
32
+ const { base: s = {}, variants: t = {}, compoundVariants: e = [] } = this.params, { config: r } = this.buildContext, i = { ...s, variants: t, compoundVariants: e };
33
+ return m(i, `.${this.cssClassName}`, r, this.isRoot);
34
+ }
35
+ getTemplateClasses(s = this.buildContext.config) {
36
+ if (!(s != null && s.templates) || !this.params.base || this.priority > 0) return [];
37
+ const t = Object.keys(s.templates);
38
+ return Object.entries(this.params.base).reduce((e, [r, i]) => (t.includes(r) && e.push("t_" + h(n(`${r}-${i}`), 4)), e), []);
39
+ }
40
+ _withBuildContext(s) {
41
+ return this.buildContext = s, this;
42
+ }
43
+ }
44
+ export {
45
+ C as S
46
+ };
@@ -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;
@@ -1,6 +0,0 @@
1
- function t(e) {
2
- return e ? typeof e != "string" ? t(String(e)) : e.replace(/\s/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, n) => (n > 0 ? "-" : "") + r.toLowerCase()) : "";
3
- }
4
- export {
5
- t as d
6
- };
@@ -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;
@@ -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
- };