@salty-css/react 0.0.1-alpha.2 → 0.0.1-alpha.200

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/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./keyframes.cjs"),n=require("./media.cjs"),a=r=>`{${r}}`,o=(...r)=>r.flat().reduce((t,e)=>e!=null&&e._current?{...t,...e._current}:{...t,...e},{});exports.keyframes=u.keyframes;exports.MediaQueryFactory=n.MediaQueryFactory;exports.media=n.media;exports.mergeStyles=o;exports.token=a;
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@salty-css/core/css';
package/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { keyframes as m } from "./keyframes.js";
2
+ import { MediaQueryFactory as c, media as d } from "./media.js";
3
+ const n = (e) => `{${e}}`, t = (...e) => e.flat().reduce((o, r) => r != null && r._current ? { ...o, ...r._current } : { ...o, ...r }, {});
4
+ export {
5
+ c as MediaQueryFactory,
6
+ m as keyframes,
7
+ d as media,
8
+ t as mergeStyles,
9
+ n as token
10
+ };
package/keyframes.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-hwxJnxKJ.cjs"),j=({animationName:m,params:l,appendInitialStyles:f,...t})=>{const r=m||u.toHash(t),o=(n={})=>{const{duration:e="500ms",easing:s="ease-in-out",delay:a="0s",iterationCount:i="1",direction:d="normal",fillMode:g="forwards",playState:p="running"}={...l,...n},c=`${r} ${e} ${s} ${a} ${i} ${d} ${g} ${p}`;if(!f)return c;const $=t.from||t["0%"];if(!$)return c;const b=u.parseStyles($,"");return`${c};${b}`},y=Object.entries(t).reduce((n,[e,s])=>{if(!s)return n;const a=u.parseStyles(s,""),i=typeof e=="number"?`${e}%`:e;return`${n}${i}{${a}}`},""),S=`@keyframes ${r} {${y}}`;return Object.assign(o,{toString:o,isKeyframes:!0,animationName:r,css:S,keyframes:t}),o};exports.keyframes=j;
package/keyframes.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@salty-css/core/css/keyframes';
package/keyframes.js ADDED
@@ -0,0 +1,33 @@
1
+ import { t as j, p as m } from "./parse-styles-p4rBqcpk.js";
2
+ const N = ({ animationName: u, params: f, appendInitialStyles: l, ...t }) => {
3
+ const e = u || j(t), o = (s = {}) => {
4
+ const {
5
+ duration: n = "500ms",
6
+ easing: r = "ease-in-out",
7
+ delay: a = "0s",
8
+ iterationCount: i = "1",
9
+ direction: y = "normal",
10
+ fillMode: g = "forwards",
11
+ playState: S = "running"
12
+ } = { ...f, ...s }, $ = `${e} ${n} ${r} ${a} ${i} ${y} ${g} ${S}`;
13
+ if (!l) return $;
14
+ const c = t.from || t["0%"];
15
+ if (!c) return $;
16
+ const b = m(c, "");
17
+ return `${$};${b}`;
18
+ }, p = Object.entries(t).reduce((s, [n, r]) => {
19
+ if (!r) return s;
20
+ const a = m(r, ""), i = typeof n == "number" ? `${n}%` : n;
21
+ return `${s}${i}{${a}}`;
22
+ }, ""), d = `@keyframes ${e} {${p}}`;
23
+ return Object.assign(o, {
24
+ toString: o,
25
+ isKeyframes: !0,
26
+ animationName: e,
27
+ css: d,
28
+ keyframes: t
29
+ }), o;
30
+ };
31
+ export {
32
+ N as keyframes
33
+ };
package/media.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var o=(s,e,t)=>e in s?a(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>o(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{constructor(e="@media"){i(this,"next",e=>{const t=new String(e);return Object.assign(t,{get isMedia(){return!0},get and(){return new r(`${e} and`)},get or(){return new r(`${e},`)}}),t});this.base=e}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-width: ${t})`;return this.next(n)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-width: ${t})`;return this.next(n)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-height: ${t})`;return this.next(n)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-height: ${t})`;return this.next(n)}get portrait(){const e=`${this.base} (orientation: portrait)`;return this.next(e)}get landscape(){const e=`${this.base} (orientation: landscape)`;return this.next(e)}prefersColorScheme(e){const t=`${this.base} (prefers-color-scheme: ${e})`;return this.next(t)}get dark(){return this.prefersColorScheme("dark")}get light(){return this.prefersColorScheme("light")}get print(){const e=`${this.base} print`;return this.next(e)}get screen(){const e=`${this.base} screen`;return this.next(e)}get speech(){const e=`${this.base} speech`;return this.next(e)}get all(){const e=`${this.base} all`;return this.next(e)}get not(){const e=`${this.base} not`;return this.next(e)}get reducedMotion(){const e=`${this.base} (prefers-reduced-motion: reduce)`;return this.next(e)}}const u=new r;exports.MediaQueryFactory=r;exports.media=u;
package/media.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@salty-css/core/css/media';
package/media.js ADDED
@@ -0,0 +1,88 @@
1
+ var a = Object.defineProperty;
2
+ var o = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var i = (s, t, e) => o(s, typeof t != "symbol" ? t + "" : t, e);
4
+ class r {
5
+ constructor(t = "@media") {
6
+ i(this, "next", (t) => {
7
+ const e = new String(t);
8
+ return Object.assign(e, {
9
+ get isMedia() {
10
+ return !0;
11
+ },
12
+ get and() {
13
+ return new r(`${t} and`);
14
+ },
15
+ get or() {
16
+ return new r(`${t},`);
17
+ }
18
+ }), e;
19
+ });
20
+ this.base = t;
21
+ }
22
+ custom(t) {
23
+ return this.next(`${this.base} ${t}`);
24
+ }
25
+ minWidth(t) {
26
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-width: ${e})`;
27
+ return this.next(n);
28
+ }
29
+ maxWidth(t) {
30
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-width: ${e})`;
31
+ return this.next(n);
32
+ }
33
+ minHeight(t) {
34
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-height: ${e})`;
35
+ return this.next(n);
36
+ }
37
+ maxHeight(t) {
38
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-height: ${e})`;
39
+ return this.next(n);
40
+ }
41
+ get portrait() {
42
+ const t = `${this.base} (orientation: portrait)`;
43
+ return this.next(t);
44
+ }
45
+ get landscape() {
46
+ const t = `${this.base} (orientation: landscape)`;
47
+ return this.next(t);
48
+ }
49
+ prefersColorScheme(t) {
50
+ const e = `${this.base} (prefers-color-scheme: ${t})`;
51
+ return this.next(e);
52
+ }
53
+ get dark() {
54
+ return this.prefersColorScheme("dark");
55
+ }
56
+ get light() {
57
+ return this.prefersColorScheme("light");
58
+ }
59
+ get print() {
60
+ const t = `${this.base} print`;
61
+ return this.next(t);
62
+ }
63
+ get screen() {
64
+ const t = `${this.base} screen`;
65
+ return this.next(t);
66
+ }
67
+ get speech() {
68
+ const t = `${this.base} speech`;
69
+ return this.next(t);
70
+ }
71
+ get all() {
72
+ const t = `${this.base} all`;
73
+ return this.next(t);
74
+ }
75
+ get not() {
76
+ const t = `${this.base} not`;
77
+ return this.next(t);
78
+ }
79
+ get reducedMotion() {
80
+ const t = `${this.base} (prefers-reduced-motion: reduce)`;
81
+ return this.next(t);
82
+ }
83
+ }
84
+ const u = new r();
85
+ export {
86
+ r as MediaQueryFactory,
87
+ u as media
88
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.200",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -10,18 +10,28 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "homepage": "https://github.com/margarita-form/salty-css",
13
+ "description": "React library for Salty CSS",
14
+ "homepage": "https://salty-css.dev/",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/margarita-form/salty-css.git"
18
+ },
14
19
  "bugs": {
15
20
  "url": "https://github.com/margarita-form/salty-css/issues"
16
21
  },
17
22
  "files": [
18
- "dist",
23
+ "**/*",
19
24
  "!**/*.tsbuildinfo"
20
25
  ],
21
26
  "nx": {
27
+ "sourceRoot": "libs/react/src",
22
28
  "name": "react"
23
29
  },
24
30
  "exports": {
31
+ ".": {
32
+ "import": "./index.js",
33
+ "require": "./index.cjs"
34
+ },
25
35
  "./styled": {
26
36
  "import": "./styled.js",
27
37
  "require": "./styled.cjs"
@@ -30,6 +40,10 @@
30
40
  "import": "./styled-client.js",
31
41
  "require": "./styled-client.cjs"
32
42
  },
43
+ "./class-name": {
44
+ "import": "./class-name.js",
45
+ "require": "./class-name.cjs"
46
+ },
33
47
  "./keyframes": {
34
48
  "import": "./keyframes.js",
35
49
  "require": "./keyframes.cjs"
@@ -37,6 +51,19 @@
37
51
  "./media": {
38
52
  "import": "./media.js",
39
53
  "require": "./media.cjs"
54
+ },
55
+ "./config": {
56
+ "import": "./config.js",
57
+ "require": "./config.cjs"
58
+ },
59
+ "./helpers": {
60
+ "import": "./helpers.js",
61
+ "require": "./helpers.cjs"
40
62
  }
63
+ },
64
+ "dependencies": {
65
+ "@salty-css/core": "^0.0.1-alpha.200",
66
+ "clsx": ">=2.x",
67
+ "react": ">=19.x || >=18.3.x"
41
68
  }
42
69
  }
@@ -0,0 +1,7 @@
1
+ "use strict";const y=require("./parse-tokens-p68muVgG.cjs"),z=(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:j}=n;r=r.replace(p,o=>{const{value:$,css:e}=j(o);return e&&t.push(e),$})}),{result:r,additionalCss:t}},E=r=>String.fromCharCode(r+(r>25?39:97)),A=(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},C=(r,s)=>{let t=s.length;for(;t;)r=r*33^s.charCodeAt(--t);return r},H=(r,s=5)=>{const t=C(5381,JSON.stringify(r))>>>0;return A(t,s)},M=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],T=(r,s,t)=>{if(M.some(p=>typeof p=="string"?p===r:p.test(r))){const p=(t==null?void 0:t.defaultUnit)||"px";return`${s}${p}`}return`${s}`},U=["Webkit","Moz","ms","O"],q=r=>r.startsWith("-")?r:U.some(s=>r.startsWith(s))?`-${y.dashCase(r)}`:y.dashCase(r),c=(r,s,t)=>{if(!r)return"";const n=[],p=Object.entries(r).reduce((o,[$,e])=>{var P;const i=$.trim(),w=q(i),O=(h,f=";")=>o=`${o}${h}${f}`,b=h=>O(`${w}:${h}`);if(typeof e=="function"&&(e=e()),typeof e=="object"){if(!e)return o;if(e.isColor)return b(e.toString()),o;if(i==="variants")return Object.entries(e).forEach(([u,a])=>{a&&Object.entries(a).forEach(([d,m])=>{if(!m)return;const l=`${s}.${u}-${d}`,S=c(m,l,t);n.push(S)})}),o;if(i==="defaultVariants")return o;if(i==="compoundVariants")return e.forEach(u=>{const{css:a,...d}=u,m=Object.entries(d).reduce((S,[N,x])=>`${S}.${N}-${x}`,s),l=c(a,m,t);n.push(l)}),o;if(i.startsWith("@")){const u=((P=t==null?void 0:t.mediaQueries)==null?void 0:P[i])||i,a=c(e,s,t),d=`${u} {
2
+ ${a.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return n.push(d),o}const h=$.includes("&")?i.replace("&",s):i.startsWith(":")?`${s}${i}`:`${s} ${i}`,f=c(e,h,t);return n.push(f),o}if(t!=null&&t.templates&&t.templates[i]){const f=e.split(".").reduce((u,a)=>u[a],t.templates[i]);if(f){const u=c(f,"");return`${o}${u}`}return console.warn(`Template "${i}" with path of "${e}" was not found in config!`),o}if(typeof e=="number"){const h=T(w,e,t);return b(h)}if(typeof e!="string")if("toString"in e)e=e.toString();else return o;const{modifiers:V}=t||{},W=function*(){yield y.parseValueTokens(e),yield z(e,V)}();for(const{result:h,additionalCss:f=[]}of W)e=h,f.forEach(u=>{const a=c(u,"");O(a,"")});return b(e)},"");return p?s?[`${s} { ${p} }`,...n].join(`
6
+ `):p:n.join(`
7
+ `)};exports.parseStyles=c;exports.toHash=H;
@@ -0,0 +1,118 @@
1
+ import { d as P, p as z } from "./parse-tokens-YUi047xd.js";
2
+ const A = (r, s) => {
3
+ if (typeof r != "string") return { result: r };
4
+ if (!s) return { result: r };
5
+ const t = [];
6
+ return Object.values(s).forEach((n) => {
7
+ const { pattern: p, transform: j } = n;
8
+ r = r.replace(p, (o) => {
9
+ const { value: $, css: e } = j(o);
10
+ return e && t.push(e), $;
11
+ });
12
+ }), { result: r, additionalCss: t };
13
+ }, E = (r) => String.fromCharCode(r + (r > 25 ? 39 : 97)), M = (r, s) => {
14
+ let t = "", n;
15
+ for (n = Math.abs(r); n > 52; n = n / 52 | 0) t = E(n % 52) + t;
16
+ return t = E(n % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
17
+ }, U = (r, s) => {
18
+ let t = s.length;
19
+ for (; t; ) r = r * 33 ^ s.charCodeAt(--t);
20
+ return r;
21
+ }, _ = (r, s = 5) => {
22
+ const t = U(5381, JSON.stringify(r)) >>> 0;
23
+ return M(t, s);
24
+ }, C = [
25
+ "top",
26
+ "right",
27
+ "bottom",
28
+ "left",
29
+ "min-width",
30
+ /.*width.*/,
31
+ /^[^line]*height.*/,
32
+ // Exclude line-height
33
+ /padding.*/,
34
+ /margin.*/,
35
+ /border.*/,
36
+ /inset.*/,
37
+ /.*radius.*/,
38
+ /.*spacing.*/,
39
+ /.*gap.*/,
40
+ /.*indent.*/,
41
+ /.*offset.*/,
42
+ /.*size.*/,
43
+ /.*thickness.*/,
44
+ /.*font-size.*/
45
+ ], H = (r, s, t) => {
46
+ if (C.some((p) => typeof p == "string" ? p === r : p.test(r))) {
47
+ const p = (t == null ? void 0 : t.defaultUnit) || "px";
48
+ return `${s}${p}`;
49
+ }
50
+ return `${s}`;
51
+ }, Q = ["Webkit", "Moz", "ms", "O"], T = (r) => r.startsWith("-") ? r : Q.some((s) => r.startsWith(s)) ? `-${P(r)}` : P(r), d = (r, s, t) => {
52
+ if (!r) return "";
53
+ const n = [], p = Object.entries(r).reduce((o, [$, e]) => {
54
+ var O;
55
+ const i = $.trim(), y = T(i), w = (f, a = ";") => o = `${o}${f}${a}`, b = (f) => w(`${y}:${f}`);
56
+ if (typeof e == "function" && (e = e()), typeof e == "object") {
57
+ if (!e) return o;
58
+ if (e.isColor)
59
+ return b(e.toString()), o;
60
+ if (i === "variants")
61
+ return Object.entries(e).forEach(([u, h]) => {
62
+ h && Object.entries(h).forEach(([c, m]) => {
63
+ if (!m) return;
64
+ const l = `${s}.${u}-${c}`, S = d(m, l, t);
65
+ n.push(S);
66
+ });
67
+ }), o;
68
+ if (i === "defaultVariants")
69
+ return o;
70
+ if (i === "compoundVariants")
71
+ return e.forEach((u) => {
72
+ const { css: h, ...c } = u, m = Object.entries(c).reduce((S, [x, N]) => `${S}.${x}-${N}`, s), l = d(h, m, t);
73
+ n.push(l);
74
+ }), o;
75
+ if (i.startsWith("@")) {
76
+ const u = ((O = t == null ? void 0 : t.mediaQueries) == null ? void 0 : O[i]) || i, h = d(e, s, t), c = `${u} {
77
+ ${h.replace(`
78
+ `, `
79
+ `)}
80
+ }`;
81
+ return n.push(c), o;
82
+ }
83
+ const f = $.includes("&") ? i.replace("&", s) : i.startsWith(":") ? `${s}${i}` : `${s} ${i}`, a = d(e, f, t);
84
+ return n.push(a), o;
85
+ }
86
+ if (t != null && t.templates && t.templates[i]) {
87
+ const a = e.split(".").reduce((u, h) => u[h], t.templates[i]);
88
+ if (a) {
89
+ const u = d(a, "");
90
+ return `${o}${u}`;
91
+ }
92
+ return console.warn(`Template "${i}" with path of "${e}" was not found in config!`), o;
93
+ }
94
+ if (typeof e == "number") {
95
+ const f = H(y, e, t);
96
+ return b(f);
97
+ }
98
+ if (typeof e != "string")
99
+ if ("toString" in e) e = e.toString();
100
+ else return o;
101
+ const { modifiers: V } = t || {}, W = function* () {
102
+ yield z(e), yield A(e, V);
103
+ }();
104
+ for (const { result: f, additionalCss: a = [] } of W)
105
+ e = f, a.forEach((u) => {
106
+ const h = d(u, "");
107
+ w(h, "");
108
+ });
109
+ return b(e);
110
+ }, "");
111
+ return p ? s ? [`${s} { ${p} }`, ...n].join(`
112
+ `) : p : n.join(`
113
+ `);
114
+ };
115
+ export {
116
+ d as p,
117
+ _ as t
118
+ };
@@ -0,0 +1,8 @@
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
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-D4kpeFoW.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
@@ -0,0 +1,3 @@
1
+ import { StyledGeneratorClientProps } from '@salty-css/core/generators';
2
+ import { Tag } from '@salty-css/core/types';
3
+ export declare const styledClient: (tagName: Tag<any>, className: string, generatorProps: StyledGeneratorClientProps) => import('react').ForwardRefExoticComponent<Omit<import('@salty-css/core/types').StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
@@ -0,0 +1,5 @@
1
+ import { e as o } from "./element-factory-C7JVLDq7.js";
2
+ const l = (e, t, r) => o(e, t, r);
3
+ export {
4
+ l as styledClient
5
+ };
package/styled.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-DAkA4JnC.cjs"),g=require("./element-factory-D4kpeFoW.cjs");class h extends m.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((e=this.tagName.generator)==null?void 0:e.priority)||0)+1:0}get clientProps(){const{element:e,variants:t={},compoundVariants:a=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:f}=this.buildContext,o=new Set([]),i=s=>{const r=d[s];r!==void 0?o.add(`${s}=${String(r)}`):o.add(s)};Object.keys(t).forEach(i),a.map(s=>Object.keys(s).forEach(i));const c=new Set([]);if(this.params.base){const s=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);s&&s.forEach(r=>{const p=r.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&c.add(p)})}return{element:e,variantKeys:[...o],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":f?void 0:y}}}}const b=(n,e)=>{const t=new h(n,e),a=g.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:t}),a};exports.styled=b;
package/styled.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { AllHTMLAttributes, JSX, ReactNode } from 'react';
2
+ import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams, ValueProps, Merge } from '@salty-css/core/types';
3
+ export declare const styled: <const PROPS extends StyledComponentProps, const TAG extends Tag<Required<PROPS>>, const STYLE_PARAMS extends StyledParams>(tagName: TAG, params: STYLE_PARAMS) => ((props: CreateElementProps & (TAG extends string ? {
4
+ ref?: any;
5
+ } : object) & Merge<ParentComponentProps<TAG> | VariantProps<STYLE_PARAMS>> & ValueProps & Omit<TAG extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[TAG] : TAG extends string ? AllHTMLAttributes<HTMLElement> : object, keyof CreateElementProps>) => ReactNode) & string;
package/styled.js ADDED
@@ -0,0 +1,47 @@
1
+ import { S as y } from "./styles-generator-Bae0y6su.js";
2
+ import { e as h } from "./element-factory-C7JVLDq7.js";
3
+ class g extends y {
4
+ constructor(e, t) {
5
+ super(t), this.tagName = e, this._params = t;
6
+ }
7
+ get priority() {
8
+ var e;
9
+ return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((e = this.tagName.generator) == null ? void 0 : e.priority) || 0) + 1 : 0;
10
+ }
11
+ get clientProps() {
12
+ const { element: e, variants: t = {}, compoundVariants: s = [], defaultVariants: d = {}, defaultProps: l = {}, passProps: f } = this.params, { callerName: m, isProduction: u } = this.buildContext, o = /* @__PURE__ */ new Set([]), i = (a) => {
13
+ const r = d[a];
14
+ r !== void 0 ? o.add(`${a}=${String(r)}`) : o.add(a);
15
+ };
16
+ Object.keys(t).forEach(i), s.map((a) => Object.keys(a).forEach(i));
17
+ const c = /* @__PURE__ */ new Set([]);
18
+ if (this.params.base) {
19
+ const a = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
20
+ a && a.forEach((r) => {
21
+ const p = r.replace(/\{props\.([\w\d]+)\}/gi, "$1");
22
+ p && c.add(p);
23
+ });
24
+ }
25
+ return {
26
+ element: e,
27
+ variantKeys: [...o],
28
+ propValueKeys: [...c],
29
+ passProps: f,
30
+ defaultProps: l,
31
+ attr: {
32
+ "data-component-name": u ? void 0 : m
33
+ }
34
+ };
35
+ }
36
+ }
37
+ const v = (n, e) => {
38
+ const t = new g(n, e), s = h(n, t.cssClassName, t.clientProps, {
39
+ "data-unoptimized-client-component": !0
40
+ });
41
+ return Object.assign(s, {
42
+ generator: t
43
+ }), s;
44
+ };
45
+ export {
46
+ v as styled
47
+ };
@@ -0,0 +1,35 @@
1
+ var o = Object.defineProperty;
2
+ var n = (a, s, t) => s in a ? o(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
+ var e = (a, s, t) => n(a, typeof s != "symbol" ? s + "" : s, t);
4
+ import { t as c, p as l } from "./parse-styles-p4rBqcpk.js";
5
+ import { d as m } from "./parse-tokens-YUi047xd.js";
6
+ class f {
7
+ constructor(s) {
8
+ e(this, "buildContext", {});
9
+ this.params = s;
10
+ }
11
+ get hash() {
12
+ return c(this.params.base || this.params);
13
+ }
14
+ get cssClassName() {
15
+ return this.hash;
16
+ }
17
+ get classNames() {
18
+ const s = [this.hash], { className: t } = this.params;
19
+ return typeof t == "string" && s.push(t), typeof t == "object" && s.push(...t), s.join(" ");
20
+ }
21
+ get cssFileName() {
22
+ const { callerName: s } = this.buildContext;
23
+ return s ? `cl_${m(s)}-${this.hash}.css` : `${this.hash}.css`;
24
+ }
25
+ get css() {
26
+ const { base: s = {}, variants: t = {}, compoundVariants: r = [] } = this.params, { config: i } = this.buildContext, h = { ...s, variants: t, compoundVariants: r };
27
+ return l(h, `.${this.cssClassName}`, i);
28
+ }
29
+ _withBuildContext(s) {
30
+ return this.buildContext = s, this;
31
+ }
32
+ }
33
+ export {
34
+ f as S
35
+ };
@@ -0,0 +1 @@
1
+ "use strict";var h=Object.defineProperty;var o=(e,s,t)=>s in e?h(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var a=(e,s,t)=>o(e,typeof s!="symbol"?s+"":s,t);const r=require("./parse-styles-hwxJnxKJ.cjs"),l=require("./parse-tokens-p68muVgG.cjs");class u{constructor(s){a(this,"buildContext",{});this.params=s}get hash(){return r.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${l.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,{config:n}=this.buildContext,c={...s,variants:t,compoundVariants:i};return r.parseStyles(c,`.${this.cssClassName}`,n)}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;