@salty-css/react 0.0.1-alpha.20 → 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 CHANGED
@@ -1 +1 @@
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
+ "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 CHANGED
@@ -1,22 +1 @@
1
- import { CssStyles, StyleValue } from '../../core/src/types';
2
- type KeyframeKeys = number | 'from' | 'to' | `${number}%`;
3
- type Keyframes = {
4
- [key in KeyframeKeys]: CssStyles;
5
- };
6
- interface KeyframesConfig {
7
- animationName?: string;
8
- appendInitialStyles?: boolean;
9
- params?: KeyframesParams;
10
- }
11
- interface KeyframesParams {
12
- duration?: string;
13
- delay?: string;
14
- iterationCount?: string | number;
15
- easing?: StyleValue<'animationTimingFunction'>;
16
- direction?: StyleValue<'animationDirection'>;
17
- fillMode?: StyleValue<'animationFillMode'>;
18
- playState?: StyleValue<'animationPlayState'>;
19
- }
20
- type KeyframesProps = Keyframes & KeyframesConfig;
21
- export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => string;
22
- export {};
1
+ export * from '@salty-css/core/css/keyframes';
package/keyframes.js CHANGED
@@ -1,30 +1,33 @@
1
- import { t as b, p as c } from "./parse-styles-T74HIH4_.js";
2
- const C = ({ animationName: m, params: u, appendInitialStyles: f, ...t }) => {
3
- const s = m || b(t), e = (r = {}) => {
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
4
  const {
5
5
  duration: n = "500ms",
6
- easing: o = "ease-in-out",
6
+ easing: r = "ease-in-out",
7
7
  delay: a = "0s",
8
8
  iterationCount: i = "1",
9
- direction: d = "normal",
10
- fillMode: y = "forwards",
9
+ direction: y = "normal",
10
+ fillMode: g = "forwards",
11
11
  playState: S = "running"
12
- } = { ...u, ...r }, $ = `${s} ${n} ${o} ${a} ${i} ${d} ${y} ${S}`;
13
- if (!f) return $;
14
- const g = c(t.from || t["0%"], "");
15
- return `${$};${g}`;
16
- }, l = Object.entries(t).reduce((r, [n, o]) => {
17
- const a = c(o, ""), i = typeof n == "number" ? `${n}%` : n;
18
- return `${r}${i}{${a}}`;
19
- }, ""), p = `@keyframes ${s} {${l}}`;
20
- return Object.assign(e, {
21
- toString: e,
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,
22
25
  isKeyframes: !0,
23
- animationName: s,
24
- css: p,
26
+ animationName: e,
27
+ css: d,
25
28
  keyframes: t
26
- }), e;
29
+ }), o;
27
30
  };
28
31
  export {
29
- C as keyframes
32
+ N as keyframes
30
33
  };
package/media.cjs CHANGED
@@ -1 +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
+ "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 CHANGED
@@ -1,71 +1 @@
1
- import { OrNumber, OrString } from '../../core/src/types/util-types';
2
- export declare class MediaQueryFactory {
3
- private base;
4
- constructor(base?: string);
5
- private next;
6
- custom(value: string): string & {
7
- and: MediaQueryFactory;
8
- or: MediaQueryFactory;
9
- };
10
- minWidth(width: OrString | OrNumber): string & {
11
- and: MediaQueryFactory;
12
- or: MediaQueryFactory;
13
- };
14
- maxWidth(width: OrString | OrNumber): string & {
15
- and: MediaQueryFactory;
16
- or: MediaQueryFactory;
17
- };
18
- minHeight(height: OrString | OrNumber): string & {
19
- and: MediaQueryFactory;
20
- or: MediaQueryFactory;
21
- };
22
- maxHeight(height: OrString | OrNumber): string & {
23
- and: MediaQueryFactory;
24
- or: MediaQueryFactory;
25
- };
26
- get portrait(): string & {
27
- and: MediaQueryFactory;
28
- or: MediaQueryFactory;
29
- };
30
- get landscape(): string & {
31
- and: MediaQueryFactory;
32
- or: MediaQueryFactory;
33
- };
34
- prefersColorScheme(scheme: 'dark' | 'light' | OrString): string & {
35
- and: MediaQueryFactory;
36
- or: MediaQueryFactory;
37
- };
38
- get dark(): string & {
39
- and: MediaQueryFactory;
40
- or: MediaQueryFactory;
41
- };
42
- get light(): string & {
43
- and: MediaQueryFactory;
44
- or: MediaQueryFactory;
45
- };
46
- get print(): string & {
47
- and: MediaQueryFactory;
48
- or: MediaQueryFactory;
49
- };
50
- get screen(): string & {
51
- and: MediaQueryFactory;
52
- or: MediaQueryFactory;
53
- };
54
- get speech(): string & {
55
- and: MediaQueryFactory;
56
- or: MediaQueryFactory;
57
- };
58
- get all(): string & {
59
- and: MediaQueryFactory;
60
- or: MediaQueryFactory;
61
- };
62
- get not(): string & {
63
- and: MediaQueryFactory;
64
- or: MediaQueryFactory;
65
- };
66
- get reducedMotion(): string & {
67
- and: MediaQueryFactory;
68
- or: MediaQueryFactory;
69
- };
70
- }
71
- export declare const media: MediaQueryFactory;
1
+ export * from '@salty-css/core/css/media';
package/media.js CHANGED
@@ -1,11 +1,14 @@
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);
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
4
  class r {
5
5
  constructor(t = "@media") {
6
6
  i(this, "next", (t) => {
7
7
  const e = new String(t);
8
8
  return Object.assign(e, {
9
+ get isMedia() {
10
+ return !0;
11
+ },
9
12
  get and() {
10
13
  return new r(`${t} and`);
11
14
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.20",
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,7 +10,12 @@
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
  },
@@ -23,6 +28,10 @@
23
28
  "name": "react"
24
29
  },
25
30
  "exports": {
31
+ ".": {
32
+ "import": "./index.js",
33
+ "require": "./index.cjs"
34
+ },
26
35
  "./styled": {
27
36
  "import": "./styled.js",
28
37
  "require": "./styled.cjs"
@@ -31,6 +40,10 @@
31
40
  "import": "./styled-client.js",
32
41
  "require": "./styled-client.cjs"
33
42
  },
43
+ "./class-name": {
44
+ "import": "./class-name.js",
45
+ "require": "./class-name.cjs"
46
+ },
34
47
  "./keyframes": {
35
48
  "import": "./keyframes.js",
36
49
  "require": "./keyframes.cjs"
@@ -38,11 +51,19 @@
38
51
  "./media": {
39
52
  "import": "./media.js",
40
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"
41
62
  }
42
63
  },
43
64
  "dependencies": {
44
- "@salty-css/core": "^0.0.1-alpha.20",
65
+ "@salty-css/core": "^0.0.1-alpha.200",
45
66
  "clsx": ">=2.x",
46
- "react": ">=18.3.x"
67
+ "react": ">=19.x || >=18.3.x"
47
68
  }
48
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;
package/styled-client.cjs CHANGED
@@ -1 +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;
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;
@@ -1,3 +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>>;
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>>;
package/styled-client.js CHANGED
@@ -1,7 +1,5 @@
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
- });
1
+ import { e as o } from "./element-factory-C7JVLDq7.js";
2
+ const l = (e, t, r) => o(e, t, r);
5
3
  export {
6
- m as styledClient
4
+ l as styledClient
7
5
  };
package/styled.cjs CHANGED
@@ -1 +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;
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 CHANGED
@@ -1,5 +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;
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 CHANGED
@@ -1,70 +1,47 @@
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);
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;
15
6
  }
16
7
  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};`;
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;
29
10
  }
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]
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
+ }
52
34
  };
53
- }
54
- _withBuildContext(t) {
55
- this._context = t;
56
- const { name: s, config: a } = t;
57
- return this._callerName = s, this;
58
35
  }
59
36
  }
60
- const _ = (e, t) => {
61
- const s = new f(e, t), a = g(e, s.cssClassName, s.props, {
37
+ const v = (n, e) => {
38
+ const t = new g(n, e), s = h(n, t.cssClassName, t.clientProps, {
62
39
  "data-unoptimized-client-component": !0
63
40
  });
64
- return Object.assign(a, {
65
- generator: s
66
- }), a;
41
+ return Object.assign(s, {
42
+ generator: t
43
+ }), s;
67
44
  };
68
45
  export {
69
- _ as styled
46
+ v as styled
70
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;
@@ -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;