@salty-css/react 0.0.1-alpha.99 → 0.0.1

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.
@@ -1,89 +0,0 @@
1
- import { d as W, p as g } from "./parse-tokens-DAW55Na6.js";
2
- const E = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), H = (e, r) => {
3
- let t = "", n;
4
- for (n = Math.abs(e); n > 52; n = n / 52 | 0) t = E(n % 52) + t;
5
- return t = E(n % 52) + t, t.length < r ? t = t.padStart(r, "a") : t.length > r && (t = t.slice(-r)), t;
6
- }, M = (e, r) => {
7
- let t = r.length;
8
- for (; t; ) e = e * 33 ^ r.charCodeAt(--t);
9
- return e;
10
- }, x = (e, r = 3) => {
11
- const t = M(5381, JSON.stringify(e)) >>> 0;
12
- return H(t, r);
13
- }, T = (e, r) => {
14
- if (typeof e != "string") return { result: e };
15
- if (!r) return { result: e };
16
- const t = [];
17
- return Object.values(r).forEach((n) => {
18
- const { pattern: c, transform: $ } = n;
19
- e = e.replace(c, (d) => {
20
- const { value: i, css: m } = $(d);
21
- return m && t.push(m), i;
22
- });
23
- }), { result: e, additionalCss: t };
24
- }, a = (e, r, t, n) => {
25
- if (!e) return "";
26
- const c = [], $ = Object.entries(e).reduce((i, [m, s]) => {
27
- const o = m.trim();
28
- if (typeof s == "function" && (s = s()), typeof s == "object") {
29
- if (!s) return i;
30
- if (o === "variants")
31
- return Object.entries(s).forEach(([p, f]) => {
32
- f && Object.entries(f).forEach(([j, b]) => {
33
- if (!b) return;
34
- const l = `${r}.${p}-${j}`, S = a(b, l, t);
35
- c.push(S);
36
- });
37
- }), i;
38
- if (o === "defaultVariants")
39
- return i;
40
- if (o === "compoundVariants")
41
- return s.forEach((p) => {
42
- const { css: f, ...j } = p, b = Object.entries(j).reduce((S, [N, P]) => `${S}.${N}-${P}`, r), l = a(f, b, t);
43
- c.push(l);
44
- }), i;
45
- if (o.startsWith("@")) {
46
- const p = a(s, r, t), f = `${o} {
47
- ${p.replace(`
48
- `, `
49
- `)}
50
- }`;
51
- return c.push(f), i;
52
- }
53
- const u = m.includes("&") ? o.replace("&", r) : o.startsWith(":") ? `${r}${o}` : `${r} ${o}`, h = a(s, u, t);
54
- return c.push(h), i;
55
- }
56
- if (n != null && n.templates && n.templates[o]) {
57
- const h = s.split(".").reduce((p, f) => p[f], n.templates[o]);
58
- if (h) {
59
- const p = a(h, "");
60
- return `${i}${p}`;
61
- }
62
- return console.warn(`Template "${o}" with path of "${s}" was not found in config!`), i;
63
- }
64
- const V = o.startsWith("-") ? o : W(o), y = (u, h = ";") => i = `${i}${u}${h}`, O = (u) => y(`${V}:${u}`);
65
- if (typeof s == "number") return O(s);
66
- if (typeof s != "string")
67
- if ("toString" in s) s = s.toString();
68
- else return i;
69
- const { modifiers: w } = n || {}, A = function* () {
70
- yield g(s), yield T(s, w);
71
- }();
72
- for (const { result: u, additionalCss: h = [] } of A)
73
- s = u, h.forEach((p) => {
74
- const f = a(p, "");
75
- y(f, "");
76
- });
77
- return O(s);
78
- }, "");
79
- if (!$) return c.join(`
80
- `);
81
- if (!r) return $;
82
- let d = "";
83
- return t !== void 0 ? d = `@layer l${t} { ${r} { ${$} } }` : d = `${r} { ${$} }`, [d, ...c].join(`
84
- `);
85
- };
86
- export {
87
- a as p,
88
- x as t
89
- };
@@ -1,7 +0,0 @@
1
- "use strict";const E=require("./parse-tokens-CRGUYhKC.cjs"),V=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,r)=>{let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=V(n%52)+t;return t=V(n%52)+t,t.length<r?t=t.padStart(r,"a"):t.length>r&&(t=t.slice(-r)),t},W=(e,r)=>{let t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return e},g=(e,r=3)=>{const t=W(5381,JSON.stringify(e))>>>0;return T(t,r)},k=(e,r)=>{if(typeof e!="string")return{result:e};if(!r)return{result:e};const t=[];return Object.values(r).forEach(n=>{const{pattern:c,transform:a}=n;e=e.replace(c,d=>{const{value:i,css:m}=a(d);return m&&t.push(m),i})}),{result:e,additionalCss:t}},$=(e,r,t,n)=>{if(!e)return"";const c=[],a=Object.entries(e).reduce((i,[m,s])=>{const o=m.trim();if(typeof s=="function"&&(s=s()),typeof s=="object"){if(!s)return i;if(o==="variants")return Object.entries(s).forEach(([p,f])=>{f&&Object.entries(f).forEach(([l,b])=>{if(!b)return;const S=`${r}.${p}-${l}`,j=$(b,S,t);c.push(j)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return s.forEach(p=>{const{css:f,...l}=p,b=Object.entries(l).reduce((j,[N,P])=>`${j}.${N}-${P}`,r),S=$(f,b,t);c.push(S)}),i;if(o.startsWith("@")){const p=$(s,r,t),f=`${o} {
2
- ${p.replace(`
3
- `,`
4
- `)}
5
- }`;return c.push(f),i}const u=m.includes("&")?o.replace("&",r):o.startsWith(":")?`${r}${o}`:`${r} ${o}`,h=$(s,u,t);return c.push(h),i}if(n!=null&&n.templates&&n.templates[o]){const h=s.split(".").reduce((p,f)=>p[f],n.templates[o]);if(h){const p=$(h,"");return`${i}${p}`}return console.warn(`Template "${o}" with path of "${s}" was not found in config!`),i}const w=o.startsWith("-")?o:E.dashCase(o),y=(u,h=";")=>i=`${i}${u}${h}`,O=u=>y(`${w}:${u}`);if(typeof s=="number")return O(s);if(typeof s!="string")if("toString"in s)s=s.toString();else return i;const{modifiers:A}=n||{},H=function*(){yield E.parseValueTokens(s),yield k(s,A)}();for(const{result:u,additionalCss:h=[]}of H)s=u,h.forEach(p=>{const f=$(p,"");y(f,"")});return O(s)},"");if(!a)return c.join(`
6
- `);if(!r)return a;let d="";return t!==void 0?d=`@layer l${t} { ${r} { ${a} } }`:d=`${r} { ${a} }`,[d,...c].join(`
7
- `)};exports.parseStyles=$;exports.toHash=g;
@@ -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,(t,s)=>(s>0?"-":"")+t.toLowerCase()):""}const a=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${r(n[1].replaceAll(".","-"))})`)}:{result:e};exports.dashCase=r;exports.parseValueTokens=a;
@@ -1,8 +0,0 @@
1
- function n(e) {
2
- return e ? typeof e != "string" ? n(String(e)) : e.replace(/\s/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, t) => (t > 0 ? "-" : "") + r.toLowerCase()) : "";
3
- }
4
- const o = (e) => typeof e != "string" ? { result: e } : /\{[^{}]+\}/g.test(e) ? { result: e.replace(/\{([^{}]+)\}/g, (...s) => `var(--${n(s[1].replaceAll(".", "-"))})`) } : { result: e };
5
- export {
6
- n as d,
7
- o as p
8
- };