@salty-css/react 0.0.1-alpha.3 → 0.0.1-alpha.31

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  ### Initial requirements
6
6
 
7
7
  1. Add `saltyPlugin` to vite or webpack config from `@salty-css/vite` or `@salty-css/webpack`
8
- 2. Create `salty-config.ts` to the root of your project
8
+ 2. Create `salty.config.ts` to the root of your project
9
9
  3. Import global styles to any regular .css file from `saltygen/index.css` (does not exist during first run, cli command coming later)
10
10
  4. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
11
11
 
@@ -54,8 +54,10 @@ export const IndexPage = () => {
54
54
  import { styled } from '@salty-css/react/styled';
55
55
 
56
56
  export const Wrapper = styled('div', {
57
- display: 'block',
58
- padding: '2vw',
57
+ base: {
58
+ display: 'block',
59
+ padding: '2vw',
60
+ },
59
61
  });
60
62
  ```
61
63
 
@@ -65,22 +67,24 @@ export const Wrapper = styled('div', {
65
67
  import { styled } from '@salty-css/react/styled';
66
68
 
67
69
  export const Button = styled('button', {
68
- display: 'block',
69
- padding: `0.6em 1.2em`,
70
- border: '1px solid currentColor',
71
- background: 'transparent',
72
- color: 'currentColor/40',
73
- cursor: 'pointer',
74
- transition: '200ms',
75
- textDecoration: 'none',
76
- '&:hover': {
77
- background: 'black',
78
- borderColor: 'black',
79
- color: 'white',
80
- },
81
- '&:disabled': {
82
- opacity: 0.25,
83
- pointerEvents: 'none',
70
+ base: {
71
+ display: 'block',
72
+ padding: `0.6em 1.2em`,
73
+ border: '1px solid currentColor',
74
+ background: 'transparent',
75
+ color: 'currentColor/40',
76
+ cursor: 'pointer',
77
+ transition: '200ms',
78
+ textDecoration: 'none',
79
+ '&:hover': {
80
+ background: 'black',
81
+ borderColor: 'black',
82
+ color: 'white',
83
+ },
84
+ '&:disabled': {
85
+ opacity: 0.25,
86
+ pointerEvents: 'none',
87
+ },
84
88
  },
85
89
  variants: {
86
90
  variant: {
@@ -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,(n,t)=>(t>0?"-":"")+n.toLowerCase()):""}exports.dashCase=r;
@@ -0,0 +1,6 @@
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
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,59 @@
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
+ };
@@ -0,0 +1,3 @@
1
+ import { GeneratorProps } from '../../core/src/generator';
2
+ import { StyledComponentProps, Tag } from '../../core/src/types';
3
+ export declare const elementFactory: (tagName: Tag<any>, _className: string, _generatorProps: GeneratorProps, _additionalProps?: Record<PropertyKey, any>) => import('react').ForwardRefExoticComponent<Omit<StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./parse-styles-PkK9Yzyn.cjs"),b=({animationName:u,params:l,appendInitialStyles:m,...t})=>{const s=u||c.toHash(t),n=(r={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:a="0s",iterationCount:i="1",direction:S="normal",fillMode:d="forwards",playState:p="running"}={...l,...r},$=`${s} ${e} ${o} ${a} ${i} ${S} ${d} ${p}`;if(!m)return $;const g=c.parseStyles(t.from||t["0%"],"");return`${$};${g}`},y=Object.entries(t).reduce((r,[e,o])=>{const a=c.parseStyles(o,""),i=typeof e=="number"?`${e}%`:e;return`${r}${i}{${a}}`},""),f=`@keyframes ${s} {${y}}`;return Object.assign(n,{toString:n,isKeyframes:!0,animationName:s,css:f,keyframes:t}),n};exports.keyframes=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./parse-styles-SPT4zc_H.cjs"),b=({animationName:u,params:l,appendInitialStyles:m,...t})=>{const s=u||c.toHash(t),n=(r={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:a="0s",iterationCount:i="1",direction:S="normal",fillMode:d="forwards",playState:p="running"}={...l,...r},$=`${s} ${e} ${o} ${a} ${i} ${S} ${d} ${p}`;if(!m)return $;const g=c.parseStyles(t.from||t["0%"],"");return`${$};${g}`},y=Object.entries(t).reduce((r,[e,o])=>{const a=c.parseStyles(o,""),i=typeof e=="number"?`${e}%`:e;return`${r}${i}{${a}}`},""),f=`@keyframes ${s} {${y}}`;return Object.assign(n,{toString:n,isKeyframes:!0,animationName:s,css:f,keyframes:t}),n};exports.keyframes=b;
@@ -1,4 +1,4 @@
1
- import { t as b, p as c } from "./parse-styles-BRv2UFN0.js";
1
+ import { t as b, p as c } from "./parse-styles-T74HIH4_.js";
2
2
  const C = ({ animationName: m, params: u, appendInitialStyles: f, ...t }) => {
3
3
  const s = m || b(t), e = (r = {}) => {
4
4
  const {
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 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 h=new r;exports.MediaQueryFactory=r;exports.media=h;
@@ -1,35 +1,39 @@
1
- class n {
1
+ var o = Object.defineProperty;
2
+ var a = (s, t, e) => t in s ? o(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var i = (s, t, e) => a(s, typeof t != "symbol" ? t + "" : t, e);
4
+ class r {
2
5
  constructor(t = "@media") {
3
- this.base = t, this.next = (e) => {
4
- const s = new String(e);
5
- return Object.assign(s, {
6
+ i(this, "next", (t) => {
7
+ const e = new String(t);
8
+ return Object.assign(e, {
6
9
  get and() {
7
- return new n(`${e} and`);
10
+ return new r(`${t} and`);
8
11
  },
9
12
  get or() {
10
- return new n(`${e},`);
13
+ return new r(`${t},`);
11
14
  }
12
- }), s;
13
- };
15
+ }), e;
16
+ });
17
+ this.base = t;
14
18
  }
15
19
  custom(t) {
16
20
  return this.next(`${this.base} ${t}`);
17
21
  }
18
22
  minWidth(t) {
19
- const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (min-width: ${e})`;
20
- return this.next(s);
23
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-width: ${e})`;
24
+ return this.next(n);
21
25
  }
22
26
  maxWidth(t) {
23
- const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (max-width: ${e})`;
24
- return this.next(s);
27
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-width: ${e})`;
28
+ return this.next(n);
25
29
  }
26
30
  minHeight(t) {
27
- const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (min-height: ${e})`;
28
- return this.next(s);
31
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-height: ${e})`;
32
+ return this.next(n);
29
33
  }
30
34
  maxHeight(t) {
31
- const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (max-height: ${e})`;
32
- return this.next(s);
35
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-height: ${e})`;
36
+ return this.next(n);
33
37
  }
34
38
  get portrait() {
35
39
  const t = `${this.base} (orientation: portrait)`;
@@ -74,8 +78,8 @@ class n {
74
78
  return this.next(t);
75
79
  }
76
80
  }
77
- const r = new n();
81
+ const u = new r();
78
82
  export {
79
- n as MediaQueryFactory,
80
- r as media
83
+ r as MediaQueryFactory,
84
+ u as media
81
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.3",
3
+ "version": "0.0.1-alpha.31",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -15,10 +15,11 @@
15
15
  "url": "https://github.com/margarita-form/salty-css/issues"
16
16
  },
17
17
  "files": [
18
- "dist",
18
+ "**/*",
19
19
  "!**/*.tsbuildinfo"
20
20
  ],
21
21
  "nx": {
22
+ "sourceRoot": "libs/react/src",
22
23
  "name": "react"
23
24
  },
24
25
  "exports": {
@@ -38,5 +39,10 @@
38
39
  "import": "./media.js",
39
40
  "require": "./media.cjs"
40
41
  }
42
+ },
43
+ "dependencies": {
44
+ "@salty-css/core": "^0.0.1-alpha.31",
45
+ "clsx": ">=2.x",
46
+ "react": ">=19.x || >=18.3.x"
41
47
  }
42
48
  }
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,85 @@
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
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./element-factory-WgNOpLmJ.cjs"),l=(e,t,n="",o)=>r.elementFactory(e,t,o,{"data-component-name":n});exports.styledClient=l;
@@ -0,0 +1,3 @@
1
+ import { GeneratorProps } from '../../core/src/generator';
2
+ import { Tag } from '../../core/src/types';
3
+ export declare const styledClient: (tagName: Tag<any>, className: string, callerName: string | undefined, generatorProps: GeneratorProps) => import('react').ForwardRefExoticComponent<Omit<import('../../core/src/types').StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
@@ -0,0 +1,7 @@
1
+ import { e as r } from "./element-factory-uEk4VrqP.js";
2
+ const m = (e, t, n = "", o) => r(e, t, o, {
3
+ "data-component-name": n
4
+ });
5
+ export {
6
+ m as styledClient
7
+ };
package/styled.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var l=Object.defineProperty;var m=(e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var c=(e,t,s)=>m(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./parse-styles-SPT4zc_H.cjs"),u=require("./element-factory-WgNOpLmJ.cjs"),y=e=>Object.keys(e);class g{constructor(t,s){c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}get hash(){return h.toHash(this.params.base||this.params)}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.params;return s&&t.push(s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?y(this._context.config.templates):[]}get css(){var r;const{base:t={},variants:s={},compoundVariants:a=[]}=this.params,n={...t,variants:s,compoundVariants:a};return h.parseStyles(n,`.${this.cssClassName}`,this.priority,(r=this._context)==null?void 0:r.config)}get props(){const{element:t}=this.params,s=this.params.variants?Object.keys(this.params.variants).map(r=>{var i;const o=(i=this.params.defaultVariants)==null?void 0:i[r];return o!==void 0?`${r}=${String(o)}`:r}):void 0,a=new Set([]),n=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return n&&n.forEach((r,o,i)=>{const p=i.at(1);p&&a.add(p)}),{element:t,variantKeys:s,propValueKeys:[...a]}}_withBuildContext(t){this._context=t;const{name:s,config:a}=t;return this._callerName=s,this}}const f=(e,t)=>{const s=new g(e,t),a=u.elementFactory(e,s.cssClassName,s.props,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:s}),a};exports.styled=f;
package/styled.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { AllHTMLAttributes, ReactDOM, ReactNode } from 'react';
2
+ import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams, ValueProps } from '../../core/src/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 & ParentComponentProps<TAG>) | (TAG extends string ? {
4
+ ref: any;
5
+ } : never) | VariantProps<STYLE_PARAMS> | ValueProps | (TAG extends keyof ReactDOM ? ReactDOM[TAG] extends (...props: infer R) => any ? R[0] : TAG extends string ? AllHTMLAttributes<HTMLElement> : never : TAG extends string ? AllHTMLAttributes<HTMLElement> : never)) => ReactNode) & string;
package/styled.js ADDED
@@ -0,0 +1,70 @@
1
+ var m = Object.defineProperty;
2
+ var h = (e, t, s) => t in e ? m(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var c = (e, t, s) => h(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { t as l, p as u } from "./parse-styles-T74HIH4_.js";
5
+ import { e as g } from "./element-factory-uEk4VrqP.js";
6
+ const y = (e) => Object.keys(e);
7
+ class f {
8
+ constructor(t, s) {
9
+ c(this, "_callerName");
10
+ c(this, "_context");
11
+ this.tagName = t, this.params = s;
12
+ }
13
+ get hash() {
14
+ return l(this.params.base || this.params);
15
+ }
16
+ get priority() {
17
+ var t;
18
+ return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
19
+ }
20
+ get classNames() {
21
+ const t = [this.hash], { className: s } = this.params;
22
+ return s && t.push(s), t.join(" ");
23
+ }
24
+ get cssClassName() {
25
+ return this.hash;
26
+ }
27
+ get cssDisplayNameVar() {
28
+ return `--${this.hash}-display-name: ${this._callerName};`;
29
+ }
30
+ get templateKeys() {
31
+ var t;
32
+ return (t = this._context) != null && t.config.templates ? y(this._context.config.templates) : [];
33
+ }
34
+ get css() {
35
+ var r;
36
+ const { base: t = {}, variants: s = {}, compoundVariants: a = [] } = this.params, n = { ...t, variants: s, compoundVariants: a };
37
+ return u(n, `.${this.cssClassName}`, this.priority, (r = this._context) == null ? void 0 : r.config);
38
+ }
39
+ get props() {
40
+ const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((r) => {
41
+ var i;
42
+ const o = (i = this.params.defaultVariants) == null ? void 0 : i[r];
43
+ return o !== void 0 ? `${r}=${String(o)}` : r;
44
+ }) : void 0, a = /* @__PURE__ */ new Set([]), n = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
45
+ return n && n.forEach((r, o, i) => {
46
+ const p = i.at(1);
47
+ p && a.add(p);
48
+ }), {
49
+ element: t,
50
+ variantKeys: s,
51
+ propValueKeys: [...a]
52
+ };
53
+ }
54
+ _withBuildContext(t) {
55
+ this._context = t;
56
+ const { name: s, config: a } = t;
57
+ return this._callerName = s, this;
58
+ }
59
+ }
60
+ const _ = (e, t) => {
61
+ const s = new f(e, t), a = g(e, s.cssClassName, s.props, {
62
+ "data-unoptimized-client-component": !0
63
+ });
64
+ return Object.assign(a, {
65
+ generator: s
66
+ }), a;
67
+ };
68
+ export {
69
+ _ as styled
70
+ };
package/dist/README.md DELETED
@@ -1,107 +0,0 @@
1
- # Salty Css
2
-
3
- ## Basic usage example with Button
4
-
5
- ### Initial requirements
6
-
7
- 1. Add `saltyPlugin` to vite or webpack config from `@salty-css/vite` or `@salty-css/webpack`
8
- 2. Create `salty-config.ts` to the root of your project
9
- 3. Import global styles to any regular .css file from `saltygen/index.css` (does not exist during first run, cli command coming later)
10
- 4. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
11
-
12
- ### Code examples
13
-
14
- **Salty config**
15
-
16
- ```tsx
17
- import { defineConfig } from '@salty-css/core/config';
18
-
19
- export const config = defineConfig({
20
- variables: {
21
- colors: {
22
- brand: '#111',
23
- highlight: 'yellow',
24
- },
25
- },
26
- global: {
27
- html: {
28
- backgroundColor: '#f8f8f8',
29
- },
30
- },
31
- });
32
- ```
33
-
34
- **Your React component file**
35
-
36
- ```tsx
37
- import { Wrapper } from '../components/wrapper/wrapper.css';
38
- import { Button } from '../components/button/button.css';
39
-
40
- export const IndexPage = () => {
41
- return (
42
- <Wrapper>
43
- <Button variant="solid" onClick={() => alert('It is a button.')}>
44
- Outlined
45
- </Button>
46
- </Wrapper>
47
- );
48
- };
49
- ```
50
-
51
- **Wrapper** (`components/wrapper/wrapper.css.ts`)
52
-
53
- ```tsx
54
- import { styled } from '@salty-css/react/styled';
55
-
56
- export const Wrapper = styled('div', {
57
- display: 'block',
58
- padding: '2vw',
59
- });
60
- ```
61
-
62
- **Button** (`components/button/button.css.ts`)
63
-
64
- ```tsx
65
- import { styled } from '@salty-css/react/styled';
66
-
67
- export const Button = styled('button', {
68
- display: 'block',
69
- padding: `0.6em 1.2em`,
70
- border: '1px solid currentColor',
71
- background: 'transparent',
72
- color: 'currentColor/40',
73
- cursor: 'pointer',
74
- transition: '200ms',
75
- textDecoration: 'none',
76
- '&:hover': {
77
- background: 'black',
78
- borderColor: 'black',
79
- color: 'white',
80
- },
81
- '&:disabled': {
82
- opacity: 0.25,
83
- pointerEvents: 'none',
84
- },
85
- variants: {
86
- variant: {
87
- outlined: {
88
- // same as default styles
89
- },
90
- solid: {
91
- '&:not(:hover)': {
92
- background: 'black',
93
- borderColor: 'black',
94
- color: 'white',
95
- },
96
- '&:hover': {
97
- background: 'transparent',
98
- borderColor: 'currentColor',
99
- color: 'currentColor',
100
- },
101
- },
102
- },
103
- },
104
- });
105
- ```
106
-
107
- More examples coming soon
@@ -1,52 +0,0 @@
1
- import { createElement as w } from "react";
2
- function j(t) {
3
- var n, s, e = "";
4
- if (typeof t == "string" || typeof t == "number") e += t;
5
- else if (typeof t == "object") if (Array.isArray(t)) {
6
- var i = t.length;
7
- for (n = 0; n < i; n++) t[n] && (s = j(t[n])) && (e && (e += " "), e += s);
8
- } else for (s in t) t[s] && (e && (e += " "), e += s);
9
- return e;
10
- }
11
- function O() {
12
- for (var t, n, s = 0, e = "", i = arguments.length; s < i; s++) (t = arguments[s]) && (n = j(t)) && (e && (e += " "), e += n);
13
- return e;
14
- }
15
- const C = ["passVariantProps"], A = (t, n, s, e, i) => {
16
- const m = ({
17
- extend: c = t,
18
- element: g = s,
19
- className: p = "",
20
- children: E,
21
- passVariantProps: S,
22
- _vks: f = /* @__PURE__ */ new Set(),
23
- ...d
24
- }) => {
25
- const o = { passVariantProps: S };
26
- d && Object.assign(o, d), i && Object.assign(o, i);
27
- const u = new Set(p.split(" ")), l = typeof c == "function", y = l && "isStyled" in c, b = l ? c : g || c;
28
- if (!b) throw new Error("No element provided");
29
- e && e.forEach((a) => {
30
- const [r, h] = a.split("=");
31
- d[r] !== void 0 ? (u.add(`${r}-${d[r]}`), l ? f && f.add(r) : delete o[r]) : h !== void 0 && u.add(`${r}-${h}`);
32
- }), f && (!l || !y && !S) ? f.forEach((a) => delete o[a]) : y && Object.assign(o, { _vks: f }), y || C.forEach((a) => delete o[a]);
33
- const $ = O(n, ...u);
34
- return w(
35
- b,
36
- {
37
- element: l ? g : void 0,
38
- className: $,
39
- ...o
40
- },
41
- E
42
- );
43
- };
44
- return Object.assign(m, {
45
- isStyled: !0,
46
- className: n,
47
- toString: () => `.${n}`
48
- }), m;
49
- };
50
- export {
51
- A as e
52
- };
@@ -1 +0,0 @@
1
- "use strict";const w=require("react");function j(t){var n,s,e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(s=j(t[n]))&&(e&&(e+=" "),e+=s)}else for(s in t)t[s]&&(e&&(e+=" "),e+=s);return e}function O(){for(var t,n,s=0,e="",o=arguments.length;s<o;s++)(t=arguments[s])&&(n=j(t))&&(e&&(e+=" "),e+=n);return e}const C=["passVariantProps"],V=(t,n,s,e,o)=>{const g=({extend:a=t,element:m=s,className:E="",children:$,passVariantProps:S,_vks:c=new Set,...d})=>{const i={passVariantProps:S};d&&Object.assign(i,d),o&&Object.assign(i,o);const u=new Set(E.split(" ")),f=typeof a=="function",y=f&&"isStyled"in a,b=f?a:m||a;if(!b)throw new Error("No element provided");e&&e.forEach(l=>{const[r,h]=l.split("=");d[r]!==void 0?(u.add(`${r}-${d[r]}`),f?c&&c.add(r):delete i[r]):h!==void 0&&u.add(`${r}-${h}`)}),c&&(!f||!y&&!S)?c.forEach(l=>delete i[l]):y&&Object.assign(i,{_vks:c}),y||C.forEach(l=>delete i[l]);const p=O(n,...u);return w.createElement(b,{element:f?m:void 0,className:p,...i},$)};return Object.assign(g,{isStyled:!0,className:n,toString:()=>`.${n}`}),g};exports.elementFactory=V;
@@ -1,2 +0,0 @@
1
- import { StyledComponentProps, Tag } from '../../core/src/types';
2
- export declare const elementFactory: (tagName: Tag<any>, _className: string, _element?: string, _variantKeys?: string[], _additionalProps?: Record<PropertyKey, any>) => ({ extend, element, className, children, passVariantProps, _vks, ...props }: StyledComponentProps) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>;
package/dist/media.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class n{constructor(e="@media"){this.base=e,this.next=t=>{const s=new String(t);return Object.assign(s,{get and(){return new n(`${t} and`)},get or(){return new n(`${t},`)}}),s}}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-width: ${t})`;return this.next(s)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-width: ${t})`;return this.next(s)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-height: ${t})`;return this.next(s)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-height: ${t})`;return this.next(s)}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 r=new n;exports.MediaQueryFactory=n;exports.media=r;
package/dist/package.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.3",
4
- "main": "./dist/index.js",
5
- "module": "./dist/index.mjs",
6
- "typings": "./dist/index.d.ts",
7
- "type": "module",
8
- "license": "MIT",
9
- "private": false,
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "homepage": "https://github.com/margarita-form/salty-css",
14
- "bugs": {
15
- "url": "https://github.com/margarita-form/salty-css/issues"
16
- },
17
- "files": [
18
- "dist",
19
- "!**/*.tsbuildinfo"
20
- ],
21
- "nx": {
22
- "name": "react"
23
- },
24
- "exports": {
25
- "./styled": {
26
- "import": "./styled.js",
27
- "require": "./styled.cjs"
28
- },
29
- "./styled-client": {
30
- "import": "./styled-client.js",
31
- "require": "./styled-client.cjs"
32
- },
33
- "./keyframes": {
34
- "import": "./keyframes.js",
35
- "require": "./keyframes.cjs"
36
- },
37
- "./media": {
38
- "import": "./media.js",
39
- "require": "./media.cjs"
40
- }
41
- }
42
- }
@@ -1,87 +0,0 @@
1
- const j = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), P = (t, e) => {
2
- let r = "", n;
3
- for (n = Math.abs(t); n > 52; n = n / 52 | 0) r = j(n % 52) + r;
4
- return r = j(n % 52) + r, r.length < e ? r = r.padStart(e, "a") : r.length > e && (r = r.slice(-e)), r;
5
- }, T = (t, e) => {
6
- let r = e.length;
7
- for (; r; ) t = t * 33 ^ e.charCodeAt(--r);
8
- return t;
9
- }, M = (t, e = 3) => {
10
- const r = T(5381, JSON.stringify(t)) >>> 0;
11
- return P(r, e);
12
- };
13
- function O(t) {
14
- return t ? typeof t != "string" ? String(t) : t.replace(/\s/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (e, r) => (r > 0 ? "-" : "") + e.toLowerCase()) : "";
15
- }
16
- const W = (t, e) => {
17
- if (typeof t != "string") return { result: t };
18
- if (!e) return { result: t };
19
- const r = [];
20
- return Object.values(e).forEach((n) => {
21
- const { pattern: c, transform: h } = n;
22
- t = t.replace(c, (d) => {
23
- const { value: i, css: l } = h(d);
24
- return l && r.push(l), i;
25
- });
26
- }), { result: t, additionalCss: r };
27
- }, w = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${O(n[1].replaceAll(".", "-"))})`) } : { result: t }, $ = (t, e, r, n) => {
28
- const c = [], h = Object.entries(t).reduce((i, [l, s]) => {
29
- const o = l.trim();
30
- if (typeof s == "function" && (s = s()), typeof s == "object") {
31
- if (!s) return i;
32
- if (o === "variants")
33
- return Object.entries(s).forEach(([f, p]) => {
34
- p && Object.entries(p).forEach(([m, b]) => {
35
- if (!b) return;
36
- const y = `${e}.${f}-${m}`, A = $(b, y, r);
37
- c.push(A);
38
- });
39
- }), i;
40
- if (o === "defaultVariants")
41
- return i;
42
- if (o === "compoundVariants")
43
- return s.forEach((f) => {
44
- const { css: p, ...m } = f, b = Object.entries(m).reduce((A, [k, N]) => `${A}.${k}-${N}`, e), y = $(p, b, r);
45
- c.push(y);
46
- }), i;
47
- if (o.startsWith("@")) {
48
- const f = $(s, e, r), p = `${o} {
49
- ${f.replace(`
50
- `, `
51
- `)}
52
- }`;
53
- return c.push(p), i;
54
- }
55
- const u = l.includes("&") ? o.replace("&", e) : o.startsWith(":") ? `${e}${o}` : `${e} ${o}`, a = $(s, u, r);
56
- return c.push(a), i;
57
- }
58
- if (n != null && n.templates && n.templates[o]) {
59
- const a = s.split(".").reduce((p, m) => p[m], n.templates[o]), f = $(a, "");
60
- return `${i}${f}`;
61
- }
62
- const E = o.startsWith("-") ? o : O(o), S = (u, a = ";") => i = `${i}${u}${a}`, g = (u) => S(`${E}:${u}`);
63
- if (typeof s == "number") return g(s);
64
- if (typeof s != "string")
65
- if ("toString" in s) s = s.toString();
66
- else return i;
67
- const { modifiers: V } = n || {}, Z = function* () {
68
- yield w(s), yield W(s, V);
69
- }();
70
- for (const { result: u, additionalCss: a = [] } of Z)
71
- s = u, a.forEach((f) => {
72
- const p = $(f, "");
73
- S(p, "");
74
- });
75
- return g(s);
76
- }, "");
77
- if (!h) return c.join(`
78
- `);
79
- if (!e) return h;
80
- let d = "";
81
- return r !== void 0 ? d = `@layer l${r} { ${e} { ${h} } }` : d = `${e} { ${h} }`, [d, ...c].join(`
82
- `);
83
- };
84
- export {
85
- $ as p,
86
- M as t
87
- };
@@ -1,7 +0,0 @@
1
- "use strict";const j=t=>String.fromCharCode(t+(t>25?39:97)),N=(t,e)=>{let r="",n;for(n=Math.abs(t);n>52;n=n/52|0)r=j(n%52)+r;return r=j(n%52)+r,r.length<e?r=r.padStart(e,"a"):r.length>e&&(r=r.slice(-e)),r},P=(t,e)=>{let r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return t},T=(t,e=3)=>{const r=P(5381,JSON.stringify(t))>>>0;return N(r,e)};function O(t){return t?typeof t!="string"?String(t):t.replace(/\s/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(e,r)=>(r>0?"-":"")+e.toLowerCase()):""}const W=(t,e)=>{if(typeof t!="string")return{result:t};if(!e)return{result:t};const r=[];return Object.values(e).forEach(n=>{const{pattern:c,transform:$}=n;t=t.replace(c,d=>{const{value:i,css:l}=$(d);return l&&r.push(l),i})}),{result:t,additionalCss:r}},w=t=>typeof t!="string"?{result:t}:/\{[^{}]+\}/g.test(t)?{result:t.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${O(n[1].replaceAll(".","-"))})`)}:{result:t},a=(t,e,r,n)=>{const c=[],$=Object.entries(t).reduce((i,[l,s])=>{const o=l.trim();if(typeof s=="function"&&(s=s()),typeof s=="object"){if(!s)return i;if(o==="variants")return Object.entries(s).forEach(([f,p])=>{p&&Object.entries(p).forEach(([m,b])=>{if(!b)return;const y=`${e}.${f}-${m}`,S=a(b,y,r);c.push(S)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return s.forEach(f=>{const{css:p,...m}=f,b=Object.entries(m).reduce((S,[k,H])=>`${S}.${k}-${H}`,e),y=a(p,b,r);c.push(y)}),i;if(o.startsWith("@")){const f=a(s,e,r),p=`${o} {
2
- ${f.replace(`
3
- `,`
4
- `)}
5
- }`;return c.push(p),i}const u=l.includes("&")?o.replace("&",e):o.startsWith(":")?`${e}${o}`:`${e} ${o}`,h=a(s,u,r);return c.push(h),i}if(n!=null&&n.templates&&n.templates[o]){const h=s.split(".").reduce((p,m)=>p[m],n.templates[o]),f=a(h,"");return`${i}${f}`}const E=o.startsWith("-")?o:O(o),A=(u,h=";")=>i=`${i}${u}${h}`,g=u=>A(`${E}:${u}`);if(typeof s=="number")return g(s);if(typeof s!="string")if("toString"in s)s=s.toString();else return i;const{modifiers:V}=n||{},Z=function*(){yield w(s),yield W(s,V)}();for(const{result:u,additionalCss:h=[]}of Z)s=u,h.forEach(f=>{const p=a(f,"");A(p,"")});return g(s)},"");if(!$)return c.join(`
6
- `);if(!e)return $;let d="";return r!==void 0?d=`@layer l${r} { ${e} { ${$} } }`:d=`${e} { ${$} }`,[d,...c].join(`
7
- `)};exports.parseStyles=a;exports.toHash=T;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-DvBlAL2I.cjs"),a=(e,t,n,o,r)=>l.elementFactory(e,t,o,r,{"data-component-name":n});exports.styledClient=a;
@@ -1,2 +0,0 @@
1
- import { Tag } from '../../core/src/types';
2
- export declare const styledClient: (tagName: Tag<any>, className: string, callerName?: string, element?: string, variantKeys?: string[]) => ({ extend, element, className, children, passVariantProps, _vks, ...props }: import('../../core/src/types').StyledComponentProps) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>;
@@ -1,7 +0,0 @@
1
- import { e as a } from "./element-factory-CHdv47Y_.js";
2
- const c = (e, t, n, o, r) => a(e, t, o, r, {
3
- "data-component-name": n
4
- });
5
- export {
6
- c as styledClient
7
- };
package/dist/styled.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./parse-styles-PkK9Yzyn.cjs"),o=require("./element-factory-DvBlAL2I.cjs"),c=r=>Object.keys(r);class l{constructor(t,s,e){this.tagName=t,this.styles=s,this.options=e}get hash(){return a.toHash(this.styles)}get priority(){var t;return typeof this.tagName=="function"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.options;return s&&t.push(s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?c(this._context.config.templates):[]}get css(){var t;return a.parseStyles(this.styles,`.${this.cssClassName}`,this.priority,(t=this._context)==null?void 0:t.config)}get props(){const{element:t}=this.options,s=this.styles.variants?Object.keys(this.styles.variants).map(e=>{var i;const n=(i=this.styles.defaultVariants)==null?void 0:i[e];return n!==void 0?`${e}=${String(n)}`:e}):void 0;return{element:t,variantKeys:s}}_withBuildContext(t){this._context=t;const{name:s,config:e}=t;return this._callerName=s,this}}const h=(r,t,s={})=>{const e=new l(r,t,s),n=o.elementFactory(r,e.cssClassName,e.props.element,e.props.variantKeys,{"data-unoptimized-client-component":!0});return Object.assign(n,{generator:e}),n};exports.styled=h;
package/dist/styled.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { HTMLAttributes, ReactDOM, ReactNode } from 'react';
2
- import { Tag, StyledComponentProps, GeneratorOptions, CreateElementProps, VariantProps, ParentComponentProps, StyledParams } from '../../core/src/types';
3
- export declare const styled: <const PROPS extends StyledComponentProps, const TAG extends Tag<Required<PROPS>>, const PARAMS extends StyledParams>(tagName: TAG, styles: PARAMS, options?: GeneratorOptions) => (<T extends object>(props: (T & CreateElementProps & ParentComponentProps<TAG>) | VariantProps<STYLES> | (TAG extends keyof ReactDOM ? ReactDOM[TAG] extends (...props: infer R) => any ? R[0] : TAG extends string ? HTMLAttributes<HTMLElement> : never : TAG extends string ? HTMLAttributes<HTMLElement> : never)) => ReactNode) & string;
package/dist/styled.js DELETED
@@ -1,60 +0,0 @@
1
- import { t as a, p as o } from "./parse-styles-BRv2UFN0.js";
2
- import { e as c } from "./element-factory-CHdv47Y_.js";
3
- const h = (r) => Object.keys(r);
4
- class l {
5
- constructor(t, s, e) {
6
- this.tagName = t, this.styles = s, this.options = e;
7
- }
8
- get hash() {
9
- return a(this.styles);
10
- }
11
- get priority() {
12
- var t;
13
- return typeof this.tagName == "function" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
14
- }
15
- get classNames() {
16
- const t = [this.hash], { className: s } = this.options;
17
- return s && t.push(s), t.join(" ");
18
- }
19
- get cssClassName() {
20
- return this.hash;
21
- }
22
- get cssDisplayNameVar() {
23
- return `--${this.hash}-display-name: ${this._callerName};`;
24
- }
25
- get templateKeys() {
26
- var t;
27
- return (t = this._context) != null && t.config.templates ? h(this._context.config.templates) : [];
28
- }
29
- get css() {
30
- var t;
31
- return o(this.styles, `.${this.cssClassName}`, this.priority, (t = this._context) == null ? void 0 : t.config);
32
- }
33
- get props() {
34
- const { element: t } = this.options, s = this.styles.variants ? Object.keys(this.styles.variants).map((e) => {
35
- var i;
36
- const n = (i = this.styles.defaultVariants) == null ? void 0 : i[e];
37
- return n !== void 0 ? `${e}=${String(n)}` : e;
38
- }) : void 0;
39
- return {
40
- element: t,
41
- variantKeys: s
42
- };
43
- }
44
- _withBuildContext(t) {
45
- this._context = t;
46
- const { name: s, config: e } = t;
47
- return this._callerName = s, this;
48
- }
49
- }
50
- const u = (r, t, s = {}) => {
51
- const e = new l(r, t, s), n = c(r, e.cssClassName, e.props.element, e.props.variantKeys, {
52
- "data-unoptimized-client-component": !0
53
- });
54
- return Object.assign(n, {
55
- generator: e
56
- }), n;
57
- };
58
- export {
59
- u as styled
60
- };
File without changes
File without changes