@salty-css/react 0.0.1-alpha.12 → 0.0.1-alpha.121

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
@@ -1,15 +1,91 @@
1
- # Salty Css
1
+ # Salty CSS - Kinda sweet but yet spicy CSS-in-JS library
2
2
 
3
- ## Basic usage example with Button
3
+ In the world of frontend dev is there anything saltier than CSS? Salty CSS is built to provide better developer experience for developers looking for performant and feature rich CSS-in-JS solutions.
4
4
 
5
- ### Initial requirements
5
+ ## Features
6
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`
7
+ - Build time compilation to achieve awesome runtime performance and minimal size
8
+ - Next.js, React Server Components, Vite and Webpack support
9
+ - Type safety with out of the box TypeScript and ESLint plugin
10
+ - Advanced CSS variables configuration to allow smooth token usage
11
+ - Style templates to create reusable styles easily
11
12
 
12
- ### Code examples
13
+ ## Get started
14
+
15
+ - Initialize: `npx salty-css init [directory]`
16
+ - Create component: `npx salty-css generate [filePath]`
17
+ - Build: `npx salty-css build [directory]`
18
+
19
+ ### Initialize
20
+
21
+ Fastest way to get started with any framework is [npx salty-css init [directory]](#initialize-salty-css-for-a-project) command
22
+
23
+ - Next.js → [Next.js guide](#nextjs) + [Next.js example app](https://github.com/margarita-form/salty-css-website)
24
+ - React → [React guide](#react) + [React example code](#code-examples)
25
+ - Vite → [Vite guide](#vite)
26
+ - Webpack → Guide coming soon
27
+ - ESLint → Guide coming soon
28
+
29
+ ### Salty CSS CLI
30
+
31
+ In your existing repository you can use `npx salty-css [command]` to initialize a project, generate components, update related packages and build required files.
32
+
33
+ - Initialize project → `npx salty-css init [directory]` - Installs required packages, detects framework in use and creates project files to the provided directory. Directory can be left blank if you want files to be created to the current directory.
34
+ - Generate component → `npx salty-css update [version]` - Update @salty-css packages in your repository. Default version is "latest". Additional options like `--dir`, `--tag`, `--name` and `--className` are also supported.
35
+ - Build files → `npx salty-css build [directory]` - Compile Salty CSS related files in your project. This should not be needed if you are using tools like Next.js or Vite
36
+
37
+ ### Guides
38
+
39
+ #### Next.js
40
+
41
+ In your existing Next.js repository you can run `npx salty-css init` to automatically configure Salty CSS.
42
+
43
+ ##### Manual configuration
44
+
45
+ 1. For Next.js support install `npm i @salty-css/next @salty-css/core @salty-css/react`
46
+ 2. Create `salty.config.ts` to your app directory
47
+ 3. Add Salty CSS plugin to next.js config
48
+
49
+ - **Next.js 15:** In `next.config.ts` add import for salty plugin `import { withSaltyCss } from '@salty-css/next';` and then add `withSaltyCss` to wrap your nextConfig export like so `export default withSaltyCss(nextConfig);`
50
+ - **Next.js 14 and older:** In `next.config.js` add import for salty plugin `const { withSaltyCss } = require('@salty-css/next');` and then add `withSaltyCss` to wrap your nextConfig export like so `module.exports = withSaltyCss(nextConfig);`
51
+
52
+ 4. Make sure that `salty.config.ts` and `next.config.ts` are in the same folder!
53
+ 5. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
54
+ 6. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
55
+
56
+ [Check out Next.js demo project](https://github.com/margarita-form/salty-css-website) or [react example code](#code-examples)
57
+
58
+ #### Vite
59
+
60
+ In your existing Vite repository you can run `npx salty-css init` to automatically configure Salty CSS.
61
+
62
+ ##### Manual configuration
63
+
64
+ 1. For Vite support install `npm i @salty-css/vite @salty-css/core`
65
+ 2. In `vite.config` add import for salty plugin `import { saltyPlugin } from '@salty-css/vite';` and then add `saltyPlugin(__dirname)` to your vite configuration plugins
66
+ 3. Make sure that `salty.config.ts` and `vite.config.ts` are in the same folder!
67
+ 4. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
68
+ 5. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
69
+
70
+ #### React
71
+
72
+ In your existing React repository you can run `npx salty-css init` to automatically configure Salty CSS.
73
+
74
+ ##### Manual configuration
75
+
76
+ 1. Install related dependencies: `npm i @salty-css/core @salty-css/react`
77
+ 2. Create `salty.config.ts` to your app directory
78
+ 3. Configure your build tool to support Salty CSS ([Vite](#vite) or Webpack) or after changes run `npx salty-css build`
79
+
80
+ [Check out react example code](#code-examples)
81
+
82
+ ### Create components
83
+
84
+ 1. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
85
+
86
+ ## Code examples
87
+
88
+ ### Basic usage example with Button
13
89
 
14
90
  **Salty config**
15
91
 
@@ -31,23 +107,6 @@ export const config = defineConfig({
31
107
  });
32
108
  ```
33
109
 
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
110
  **Wrapper** (`components/wrapper/wrapper.css.ts`)
52
111
 
53
112
  ```tsx
@@ -72,7 +131,7 @@ export const Button = styled('button', {
72
131
  padding: `0.6em 1.2em`,
73
132
  border: '1px solid currentColor',
74
133
  background: 'transparent',
75
- color: 'currentColor/40',
134
+ color: 'currentColor',
76
135
  cursor: 'pointer',
77
136
  transition: '200ms',
78
137
  textDecoration: 'none',
@@ -108,4 +167,21 @@ export const Button = styled('button', {
108
167
  });
109
168
  ```
110
169
 
170
+ **Your React component file**
171
+
172
+ ```tsx
173
+ import { Wrapper } from '../components/wrapper/wrapper.css';
174
+ import { Button } from '../components/button/button.css';
175
+
176
+ export const IndexPage = () => {
177
+ return (
178
+ <Wrapper>
179
+ <Button variant="solid" onClick={() => alert('It is a button.')}>
180
+ Outlined
181
+ </Button>
182
+ </Wrapper>
183
+ );
184
+ };
185
+ ```
186
+
111
187
  More examples coming soon
@@ -0,0 +1,67 @@
1
+ import { forwardRef as g, createElement as p } from "react";
2
+ import { p as N, d as A } from "./parse-tokens-YUi047xd.js";
3
+ function K(n) {
4
+ var s, e, t = "";
5
+ if (typeof n == "string" || typeof n == "number") t += n;
6
+ else if (typeof n == "object") if (Array.isArray(n)) {
7
+ var o = n.length;
8
+ for (s = 0; s < o; s++) n[s] && (e = K(n[s])) && (t && (t += " "), t += e);
9
+ } else for (e in n) n[e] && (t && (t += " "), t += e);
10
+ return t;
11
+ }
12
+ function R() {
13
+ for (var n, s, e = 0, t = "", o = arguments.length; e < o; e++) (n = arguments[e]) && (s = K(n)) && (t && (t += " "), t += s);
14
+ return t;
15
+ }
16
+ const F = ["passProps"], x = (n, s, e, t) => {
17
+ const j = g(({
18
+ extend: d = n,
19
+ element: S = e.element,
20
+ className: O = "",
21
+ children: $,
22
+ passProps: u = e.passProps,
23
+ _vks: c = /* @__PURE__ */ new Set(),
24
+ ...r
25
+ }, w) => {
26
+ const f = { passProps: u };
27
+ e.attr && Object.assign(f, e.attr), t && Object.assign(f, t), e.defaultProps && Object.assign(r, e.defaultProps), r && Object.assign(f, r);
28
+ const b = new Set(O.split(" ")), y = typeof d == "function" || typeof d == "object", h = y && "isStyled" in d, E = y ? d : S || d;
29
+ if (!E) throw new Error("No element provided");
30
+ const m = f.style || {};
31
+ f.style || (f.style = m), Object.entries(m).forEach(([i, a]) => {
32
+ const { result: l } = N(a);
33
+ m[i] = l;
34
+ }), e.propValueKeys && e.propValueKeys.forEach((i) => {
35
+ const a = `css-${i}`, l = r[a];
36
+ if (l === void 0) return;
37
+ const C = `--props-${A(i)}`;
38
+ m[C] = l, c && c.add(a);
39
+ }), e.variantKeys && e.variantKeys.forEach((i) => {
40
+ const [a, l] = i.split("=");
41
+ r[a] !== void 0 ? (b.add(`${a}-${r[a]}`), c && c.add(a)) : l !== void 0 && b.add(`${a}-${l}`);
42
+ }), c && (!y || !h) ? c.forEach((i) => {
43
+ if (!u) return delete f[i];
44
+ if (u !== !0 && !u.includes(i))
45
+ return delete f[i];
46
+ }) : h && Object.assign(f, { _vks: c }), h || F.forEach((i) => delete f[i]);
47
+ const V = R(s, ...b);
48
+ return p(
49
+ E,
50
+ {
51
+ element: y ? S : void 0,
52
+ className: V,
53
+ ref: w,
54
+ ...f
55
+ },
56
+ $
57
+ );
58
+ });
59
+ return Object.assign(j, {
60
+ isStyled: !0,
61
+ className: s,
62
+ toString: () => `.${s}`
63
+ }), j;
64
+ };
65
+ export {
66
+ x as e
67
+ };
@@ -0,0 +1 @@
1
+ "use strict";const K=require("react"),O=require("./parse-tokens-p68muVgG.cjs");function $(n){var s,e,t="";if(typeof n=="string"||typeof n=="number")t+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(s=0;s<u;s++)n[s]&&(e=$(n[s]))&&(t&&(t+=" "),t+=e)}else for(e in n)n[e]&&(t&&(t+=" "),t+=e);return t}function q(){for(var n,s,e=0,t="",u=arguments.length;e<u;e++)(n=arguments[e])&&(s=$(n))&&(t&&(t+=" "),t+=s);return t}const A=["passProps"],F=(n,s,e,t)=>{const u=({extend:d=n,element:S=e.element,className:w="",children:V,passProps:o=e.passProps,_vks:c=new Set,...r},C)=>{const f={passProps:o};e.attr&&Object.assign(f,e.attr),t&&Object.assign(f,t),e.defaultProps&&Object.assign(r,e.defaultProps),r&&Object.assign(f,r);const b=new Set(w.split(" ")),y=typeof d=="function"||typeof d=="object",h=y&&"isStyled"in d,E=y?d:S||d;if(!E)throw new Error("No element provided");const m=f.style||{};f.style||(f.style=m),Object.entries(m).forEach(([i,a])=>{const{result:l}=O.parseValueTokens(a);m[i]=l}),e.propValueKeys&&e.propValueKeys.forEach(i=>{const a=`css-${i}`,l=r[a];if(l===void 0)return;const N=`--props-${O.dashCase(i)}`;m[N]=l,c&&c.add(a)}),e.variantKeys&&e.variantKeys.forEach(i=>{const[a,l]=i.split("=");r[a]!==void 0?(b.add(`${a}-${r[a]}`),c&&c.add(a)):l!==void 0&&b.add(`${a}-${l}`)}),c&&(!y||!h)?c.forEach(i=>{if(!o)return delete f[i];if(o!==!0&&!o.includes(i))return delete f[i]}):h&&Object.assign(f,{_vks:c}),h||A.forEach(i=>delete f[i]);const g=q(s,...b);return K.createElement(E,{element:y?S:void 0,className:g,ref:C,...f},V)},j=K.forwardRef(u);return Object.assign(j,{isStyled:!0,className:s,toString:()=>`.${s}`}),j};exports.elementFactory=F;
@@ -1,2 +1,3 @@
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>) => import('react').ForwardRefExoticComponent<Omit<StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
1
+ import { GeneratorProps } from '@salty-css/core/generator';
2
+ import { StyledComponentProps, Tag } from '@salty-css/core/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>>;
package/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./parse-styles-CsUEXYf5.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-CyIjlKB3.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,7 +1,7 @@
1
- import { CssStyles, StyleValue } from '../../core/src/types';
1
+ import { CssStyles, StyleValue } from '@salty-css/core/types';
2
2
  type KeyframeKeys = number | 'from' | 'to' | `${number}%`;
3
3
  type Keyframes = {
4
- [key in KeyframeKeys]: CssStyles;
4
+ [key in KeyframeKeys]?: CssStyles;
5
5
  };
6
6
  interface KeyframesConfig {
7
7
  animationName?: string;
package/keyframes.js CHANGED
@@ -1,30 +1,33 @@
1
- import { t as b, p as c } from "./parse-styles-jRJiQaik.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-CjyvxVJD.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";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;
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;
package/media.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { OrNumber, OrString } from '../../core/src/types/util-types';
1
+ import { OrNumber, OrString } from '@salty-css/core/types/util-types';
2
2
  export declare class MediaQueryFactory {
3
3
  private base;
4
4
  constructor(base?: string);
package/media.js CHANGED
@@ -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.12",
3
+ "version": "0.0.1-alpha.121",
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
  },
@@ -39,5 +44,10 @@
39
44
  "import": "./media.js",
40
45
  "require": "./media.cjs"
41
46
  }
47
+ },
48
+ "dependencies": {
49
+ "@salty-css/core": "^0.0.1-alpha.121",
50
+ "clsx": ">=2.x",
51
+ "react": ">=19.x || >=18.3.x"
42
52
  }
43
53
  }
@@ -0,0 +1,89 @@
1
+ import { d as W, p as g } from "./parse-tokens-YUi047xd.js";
2
+ const E = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), H = (e, r) => {
3
+ let t = "", n;
4
+ for (n = Math.abs(e); n > 52; n = n / 52 | 0) t = E(n % 52) + t;
5
+ return t = E(n % 52) + t, t.length < r ? t = t.padStart(r, "a") : t.length > r && (t = t.slice(-r)), t;
6
+ }, M = (e, r) => {
7
+ let t = r.length;
8
+ for (; t; ) e = e * 33 ^ r.charCodeAt(--t);
9
+ return e;
10
+ }, x = (e, r = 5) => {
11
+ const t = M(5381, JSON.stringify(e)) >>> 0;
12
+ return H(t, r);
13
+ }, T = (e, r) => {
14
+ if (typeof e != "string") return { result: e };
15
+ if (!r) return { result: e };
16
+ const t = [];
17
+ return Object.values(r).forEach((n) => {
18
+ const { pattern: c, transform: $ } = n;
19
+ e = e.replace(c, (d) => {
20
+ const { value: i, css: m } = $(d);
21
+ return m && t.push(m), i;
22
+ });
23
+ }), { result: e, additionalCss: t };
24
+ }, a = (e, r, t, n) => {
25
+ if (!e) return "";
26
+ const c = [], $ = Object.entries(e).reduce((i, [m, s]) => {
27
+ const o = m.trim();
28
+ if (typeof s == "function" && (s = s()), typeof s == "object") {
29
+ if (!s) return i;
30
+ if (o === "variants")
31
+ return Object.entries(s).forEach(([p, f]) => {
32
+ f && Object.entries(f).forEach(([j, b]) => {
33
+ if (!b) return;
34
+ const l = `${r}.${p}-${j}`, S = a(b, l, t);
35
+ c.push(S);
36
+ });
37
+ }), i;
38
+ if (o === "defaultVariants")
39
+ return i;
40
+ if (o === "compoundVariants")
41
+ return s.forEach((p) => {
42
+ const { css: f, ...j } = p, b = Object.entries(j).reduce((S, [N, P]) => `${S}.${N}-${P}`, r), l = a(f, b, t);
43
+ c.push(l);
44
+ }), i;
45
+ if (o.startsWith("@")) {
46
+ const p = a(s, r, t), f = `${o} {
47
+ ${p.replace(`
48
+ `, `
49
+ `)}
50
+ }`;
51
+ return c.push(f), i;
52
+ }
53
+ const u = m.includes("&") ? o.replace("&", r) : o.startsWith(":") ? `${r}${o}` : `${r} ${o}`, h = a(s, u, t);
54
+ return c.push(h), i;
55
+ }
56
+ if (n != null && n.templates && n.templates[o]) {
57
+ const h = s.split(".").reduce((p, f) => p[f], n.templates[o]);
58
+ if (h) {
59
+ const p = a(h, "");
60
+ return `${i}${p}`;
61
+ }
62
+ return console.warn(`Template "${o}" with path of "${s}" was not found in config!`), i;
63
+ }
64
+ const V = o.startsWith("-") ? o : W(o), y = (u, h = ";") => i = `${i}${u}${h}`, O = (u) => y(`${V}:${u}`);
65
+ if (typeof s == "number") return O(s);
66
+ if (typeof s != "string")
67
+ if ("toString" in s) s = s.toString();
68
+ else return i;
69
+ const { modifiers: w } = n || {}, A = function* () {
70
+ yield g(s), yield T(s, w);
71
+ }();
72
+ for (const { result: u, additionalCss: h = [] } of A)
73
+ s = u, h.forEach((p) => {
74
+ const f = a(p, "");
75
+ y(f, "");
76
+ });
77
+ return O(s);
78
+ }, "");
79
+ if (!$) return c.join(`
80
+ `);
81
+ if (!r) return $;
82
+ let d = "";
83
+ return t !== void 0 ? d = `@layer l${t} { ${r} { ${$} } }` : d = `${r} { ${$} }`, [d, ...c].join(`
84
+ `);
85
+ };
86
+ export {
87
+ a as p,
88
+ x as t
89
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";const E=require("./parse-tokens-p68muVgG.cjs"),V=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,r)=>{let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=V(n%52)+t;return t=V(n%52)+t,t.length<r?t=t.padStart(r,"a"):t.length>r&&(t=t.slice(-r)),t},W=(e,r)=>{let t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return e},g=(e,r=5)=>{const t=W(5381,JSON.stringify(e))>>>0;return T(t,r)},k=(e,r)=>{if(typeof e!="string")return{result:e};if(!r)return{result:e};const t=[];return Object.values(r).forEach(n=>{const{pattern:c,transform:a}=n;e=e.replace(c,d=>{const{value:i,css:m}=a(d);return m&&t.push(m),i})}),{result:e,additionalCss:t}},$=(e,r,t,n)=>{if(!e)return"";const c=[],a=Object.entries(e).reduce((i,[m,s])=>{const o=m.trim();if(typeof s=="function"&&(s=s()),typeof s=="object"){if(!s)return i;if(o==="variants")return Object.entries(s).forEach(([p,f])=>{f&&Object.entries(f).forEach(([l,b])=>{if(!b)return;const S=`${r}.${p}-${l}`,j=$(b,S,t);c.push(j)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return s.forEach(p=>{const{css:f,...l}=p,b=Object.entries(l).reduce((j,[N,P])=>`${j}.${N}-${P}`,r),S=$(f,b,t);c.push(S)}),i;if(o.startsWith("@")){const p=$(s,r,t),f=`${o} {
2
+ ${p.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return c.push(f),i}const u=m.includes("&")?o.replace("&",r):o.startsWith(":")?`${r}${o}`:`${r} ${o}`,h=$(s,u,t);return c.push(h),i}if(n!=null&&n.templates&&n.templates[o]){const h=s.split(".").reduce((p,f)=>p[f],n.templates[o]);if(h){const p=$(h,"");return`${i}${p}`}return console.warn(`Template "${o}" with path of "${s}" was not found in config!`),i}const w=o.startsWith("-")?o:E.dashCase(o),y=(u,h=";")=>i=`${i}${u}${h}`,O=u=>y(`${w}:${u}`);if(typeof s=="number")return O(s);if(typeof s!="string")if("toString"in s)s=s.toString();else return i;const{modifiers:A}=n||{},H=function*(){yield E.parseValueTokens(s),yield k(s,A)}();for(const{result:u,additionalCss:h=[]}of H)s=u,h.forEach(p=>{const f=$(p,"");y(f,"")});return O(s)},"");if(!a)return c.join(`
6
+ `);if(!r)return a;let d="";return t!==void 0?d=`@layer l${t} { ${r} { ${a} } }`:d=`${r} { ${a} }`,[d,...c].join(`
7
+ `)};exports.parseStyles=$;exports.toHash=g;
@@ -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 l=require("./element-factory-BCMNslLa.cjs"),a=(e,t,n,o,r)=>l.elementFactory(e,t,o,r,{"data-component-name":n});exports.styledClient=a;
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,2 +1,3 @@
1
- import { Tag } from '../../core/src/types';
2
- export declare const styledClient: (tagName: Tag<any>, className: string, callerName?: string, element?: string, variantKeys?: string[]) => import('react').ForwardRefExoticComponent<Omit<import('../../core/src/types').StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
1
+ import { GeneratorProps } from '@salty-css/core/generator';
2
+ import { Tag } from '@salty-css/core/types';
3
+ export declare const styledClient: (tagName: Tag<any>, className: string, generatorProps: GeneratorProps) => 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 a } from "./element-factory-CwnAXm6m.js";
2
- const c = (e, t, n, o, r) => a(e, t, o, r, {
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
- c as styledClient
4
+ l as styledClient
7
5
  };
package/styled.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-CsUEXYf5.cjs"),o=require("./element-factory-BCMNslLa.cjs"),c=a=>Object.keys(a);class p{constructor(t,s){this.tagName=t,this.params=s}get hash(){return i.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?c(this._context.config.templates):[]}get css(){var r;const{base:t={},variants:s={},compoundVariants:e=[]}=this.params,n={...t,variants:s,compoundVariants:e};return i.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(e=>{var r;const n=(r=this.params.defaultVariants)==null?void 0:r[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=(a,t)=>{const s=new p(a,t),e=o.elementFactory(a,s.cssClassName,s.props.element,s.props.variantKeys,{"data-unoptimized-client-component":!0});return Object.assign(e,{generator:s}),e};exports.styled=h;
1
+ "use strict";var f=Object.defineProperty;var N=(s,t,e)=>t in s?f(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var o=(s,t,e)=>N(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-CyIjlKB3.cjs"),_=require("./parse-tokens-p68muVgG.cjs"),b=require("./element-factory-D4kpeFoW.cjs"),S=s=>Object.keys(s);class ${constructor(t,e){o(this,"_isProd");o(this,"_callerName");o(this,"_context");this.tagName=t,this.params=e}get hash(){return u.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:e}=this.params;return e&&t.push(e),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get cssFileName(){return this._callerName?`c_${_.dashCase(this._callerName)}-${this.hash}-${this.priority}.css`:`${this.hash}-${this.priority}.css`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?S(this._context.config.templates):[]}get css(){var n;const{base:t={},variants:e={},compoundVariants:a=[]}=this.params,i={...t,variants:e,compoundVariants:a};return u.parseStyles(i,`.${this.cssClassName}`,this.priority,(n=this._context)==null?void 0:n.config)}get props(){const{element:t,variants:e={},compoundVariants:a=[],defaultVariants:i={},defaultProps:n={},passProps:y}=this.params,c=new Set([]),p=r=>{const h=i[r];h!==void 0?c.add(`${r}=${String(h)}`):c.add(r)};Object.keys(e).forEach(p),a.map(r=>Object.keys(r).forEach(p));const l=new Set([]),m=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return m&&m.forEach((r,h,g)=>{const d=g.at(1);d&&l.add(d)}),{element:t,variantKeys:[...c],propValueKeys:[...l],passProps:y,defaultProps:n,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:e,config:a,prod:i}=t;return this._isProd=i,this._callerName=e,this}}const v=(s,t)=>{const e=new $(s,t),a=b.elementFactory(s,e.cssClassName,e.props,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:e}),a};exports.styled=v;
package/styled.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AllHTMLAttributes, ReactDOM, ReactNode } from 'react';
2
- import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams, CssRuntimeValues } 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) | CssRuntimeValues | VariantProps<STYLE_PARAMS> | (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,12 +1,19 @@
1
- import { t as i, p as o } from "./parse-styles-jRJiQaik.js";
2
- import { e as c } from "./element-factory-CwnAXm6m.js";
3
- const p = (a) => Object.keys(a);
4
- class m {
1
+ var y = Object.defineProperty;
2
+ var g = (e, t, s) => t in e ? y(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var o = (e, t, s) => g(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { t as N, p as _ } from "./parse-styles-CjyvxVJD.js";
5
+ import { d as $ } from "./parse-tokens-YUi047xd.js";
6
+ import { e as b } from "./element-factory-C7JVLDq7.js";
7
+ const x = (e) => Object.keys(e);
8
+ class V {
5
9
  constructor(t, s) {
10
+ o(this, "_isProd");
11
+ o(this, "_callerName");
12
+ o(this, "_context");
6
13
  this.tagName = t, this.params = s;
7
14
  }
8
15
  get hash() {
9
- return i(this.params.base || this.params);
16
+ return N(this.params.base || this.params);
10
17
  }
11
18
  get priority() {
12
19
  var t;
@@ -22,40 +29,53 @@ class m {
22
29
  get cssDisplayNameVar() {
23
30
  return `--${this.hash}-display-name: ${this._callerName};`;
24
31
  }
32
+ get cssFileName() {
33
+ return this._callerName ? `c_${$(this._callerName)}-${this.hash}-${this.priority}.css` : `${this.hash}-${this.priority}.css`;
34
+ }
25
35
  get templateKeys() {
26
36
  var t;
27
- return (t = this._context) != null && t.config.templates ? p(this._context.config.templates) : [];
37
+ return (t = this._context) != null && t.config.templates ? x(this._context.config.templates) : [];
28
38
  }
29
39
  get css() {
30
- var r;
31
- const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, n = { ...t, variants: s, compoundVariants: e };
32
- return o(n, `.${this.cssClassName}`, this.priority, (r = this._context) == null ? void 0 : r.config);
40
+ var n;
41
+ const { base: t = {}, variants: s = {}, compoundVariants: a = [] } = this.params, i = { ...t, variants: s, compoundVariants: a };
42
+ return _(i, `.${this.cssClassName}`, this.priority, (n = this._context) == null ? void 0 : n.config);
33
43
  }
34
44
  get props() {
35
- const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((e) => {
36
- var r;
37
- const n = (r = this.params.defaultVariants) == null ? void 0 : r[e];
38
- return n !== void 0 ? `${e}=${String(n)}` : e;
39
- }) : void 0;
40
- return {
45
+ const { element: t, variants: s = {}, compoundVariants: a = [], defaultVariants: i = {}, defaultProps: n = {}, passProps: u } = this.params, c = /* @__PURE__ */ new Set([]), p = (r) => {
46
+ const h = i[r];
47
+ h !== void 0 ? c.add(`${r}=${String(h)}`) : c.add(r);
48
+ };
49
+ Object.keys(s).forEach(p), a.map((r) => Object.keys(r).forEach(p));
50
+ const m = /* @__PURE__ */ new Set([]), l = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
51
+ return l && l.forEach((r, h, f) => {
52
+ const d = f.at(1);
53
+ d && m.add(d);
54
+ }), {
41
55
  element: t,
42
- variantKeys: s
56
+ variantKeys: [...c],
57
+ propValueKeys: [...m],
58
+ passProps: u,
59
+ defaultProps: n,
60
+ attr: {
61
+ "data-component-name": this._isProd ? void 0 : this._callerName
62
+ }
43
63
  };
44
64
  }
45
65
  _withBuildContext(t) {
46
66
  this._context = t;
47
- const { name: s, config: e } = t;
48
- return this._callerName = s, this;
67
+ const { name: s, config: a, prod: i } = t;
68
+ return this._isProd = i, this._callerName = s, this;
49
69
  }
50
70
  }
51
- const u = (a, t) => {
52
- const s = new m(a, t), e = c(a, s.cssClassName, s.props.element, s.props.variantKeys, {
71
+ const C = (e, t) => {
72
+ const s = new V(e, t), a = b(e, s.cssClassName, s.props, {
53
73
  "data-unoptimized-client-component": !0
54
74
  });
55
- return Object.assign(e, {
75
+ return Object.assign(a, {
56
76
  generator: s
57
- }), e;
77
+ }), a;
58
78
  };
59
79
  export {
60
- u as styled
80
+ C as styled
61
81
  };
@@ -1,6 +0,0 @@
1
- function t(e) {
2
- return e ? typeof e != "string" ? 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";function t(e){return e?typeof e!="string"?String(e):e.replace(/\s/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,n)=>(n>0?"-":"")+r.toLowerCase()):""}exports.dashCase=t;
@@ -1 +0,0 @@
1
- "use strict";const w=require("react"),N=require("./dash-case-BSxADP5V.cjs");function E(t){var n,o,e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){var f=t.length;for(n=0;n<f;n++)t[n]&&(o=E(t[n]))&&(e&&(e+=" "),e+=o)}else for(o in t)t[o]&&(e&&(e+=" "),e+=o);return e}function q(){for(var t,n,o=0,e="",f=arguments.length;o<f;o++)(t=arguments[o])&&(n=E(t))&&(e&&(e+=" "),e+=n);return e}const A=["passVariantProps"],F=(t,n,o,e,f)=>{const $=({extend:c=t,element:b=o,className:p="",children:C,passVariantProps:j,cssValues:u,_vks:a=new Set,...d},O)=>{const s={passVariantProps:j};f&&Object.assign(s,f),d&&Object.assign(s,d);const g=new Set(p.split(" ")),l=typeof c=="function"||typeof c=="object",m=l&&"isStyled"in c,S=l?c:b||c;if(!S)throw new Error("No element provided");u&&(console.log(u),s.style||(s.style={}),Object.entries(u).forEach(([i,r])=>{const y=`--${N.dashCase(i)}`;s.style[y]=r})),e&&e.forEach(i=>{const[r,y]=i.split("=");d[r]!==void 0?(g.add(`${r}-${d[r]}`),l?a&&a.add(r):delete s[r]):y!==void 0&&g.add(`${r}-${y}`)}),a&&(!l||!m&&!j)?a.forEach(i=>delete s[i]):m&&Object.assign(s,{_vks:a}),m||A.forEach(i=>delete s[i]);const v=q(n,...g);return w.createElement(S,{element:l?b:void 0,className:v,ref:O,...s},C)},h=w.forwardRef($);return Object.assign(h,{isStyled:!0,className:n,toString:()=>`.${n}`}),h};exports.elementFactory=F;
@@ -1,49 +0,0 @@
1
- import { forwardRef as C, createElement as v } from "react";
2
- import { d as N } from "./dash-case-BLMDQfZk.js";
3
- function S(t) {
4
- var o, n, e = "";
5
- if (typeof t == "string" || typeof t == "number") e += t;
6
- else if (typeof t == "object") if (Array.isArray(t)) {
7
- var f = t.length;
8
- for (o = 0; o < f; o++) t[o] && (n = S(t[o])) && (e && (e += " "), e += n);
9
- } else for (n in t) t[n] && (e && (e += " "), e += n);
10
- return e;
11
- }
12
- function A() {
13
- for (var t, o, n = 0, e = "", f = arguments.length; n < f; n++) (t = arguments[n]) && (o = S(t)) && (e && (e += " "), e += o);
14
- return e;
15
- }
16
- const K = ["passVariantProps"], x = (t, o, n, e, f) => {
17
- const b = C(({ extend: a = t, element: h = n, className: w = "", children: E, passVariantProps: j, cssValues: m, _vks: l = /* @__PURE__ */ new Set(), ...d }, $) => {
18
- const r = { passVariantProps: j };
19
- f && Object.assign(r, f), d && Object.assign(r, d);
20
- const g = new Set(w.split(" ")), c = typeof a == "function" || typeof a == "object", u = c && "isStyled" in a, p = c ? a : h || a;
21
- if (!p) throw new Error("No element provided");
22
- m && (console.log(m), r.style || (r.style = {}), Object.entries(m).forEach(([i, s]) => {
23
- const y = `--${N(i)}`;
24
- r.style[y] = s;
25
- })), e && e.forEach((i) => {
26
- const [s, y] = i.split("=");
27
- d[s] !== void 0 ? (g.add(`${s}-${d[s]}`), c ? l && l.add(s) : delete r[s]) : y !== void 0 && g.add(`${s}-${y}`);
28
- }), l && (!c || !u && !j) ? l.forEach((i) => delete r[i]) : u && Object.assign(r, { _vks: l }), u || K.forEach((i) => delete r[i]);
29
- const O = A(o, ...g);
30
- return v(
31
- p,
32
- {
33
- element: c ? h : void 0,
34
- className: O,
35
- ref: $,
36
- ...r
37
- },
38
- E
39
- );
40
- });
41
- return Object.assign(b, {
42
- isStyled: !0,
43
- className: o,
44
- toString: () => `.${o}`
45
- }), b;
46
- };
47
- export {
48
- x as e
49
- };
@@ -1,7 +0,0 @@
1
- "use strict";const V=require("./dash-case-BSxADP5V.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)=>{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 y=`${s}.${f}-${m}`,S=a(b,y,t);p.push(S)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return e.forEach(f=>{const{css:c,...m}=f,b=Object.entries(m).reduce((S,[H,N])=>`${S}.${H}-${N}`,s),y=a(c,b,t);p.push(y)}),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),j=(u,h=";")=>i=`${i}${u}${h}`,O=u=>j(`${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,"");j(c,"")});return O(e)},"");if(!$)return p.join(`
6
- `);if(!s)return $;let d="";return t!==void 0?d=`@layer l${t} { ${s} { ${$} } }`:d=`${s} { ${$} }`,[d,...p].join(`
7
- `)};exports.parseStyles=a;exports.toHash=W;
@@ -1,84 +0,0 @@
1
- import { d as V } from "./dash-case-BLMDQfZk.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
- const c = [], a = Object.entries(r).reduce((i, [m, e]) => {
26
- const o = m.trim();
27
- if (typeof e == "function" && (e = e()), typeof e == "object") {
28
- if (!e) return i;
29
- if (o === "variants")
30
- return Object.entries(e).forEach(([f, p]) => {
31
- p && Object.entries(p).forEach(([l, b]) => {
32
- if (!b) return;
33
- const j = `${s}.${f}-${l}`, y = $(b, j, t);
34
- c.push(y);
35
- });
36
- }), i;
37
- if (o === "defaultVariants")
38
- return i;
39
- if (o === "compoundVariants")
40
- return e.forEach((f) => {
41
- const { css: p, ...l } = f, b = Object.entries(l).reduce((y, [N, P]) => `${y}.${N}-${P}`, s), j = $(p, b, t);
42
- c.push(j);
43
- }), i;
44
- if (o.startsWith("@")) {
45
- const f = $(e, s, t), p = `${o} {
46
- ${f.replace(`
47
- `, `
48
- `)}
49
- }`;
50
- return c.push(p), i;
51
- }
52
- const u = m.includes("&") ? o.replace("&", s) : o.startsWith(":") ? `${s}${o}` : `${s} ${o}`, h = $(e, u, t);
53
- return c.push(h), i;
54
- }
55
- if (n != null && n.templates && n.templates[o]) {
56
- const h = e.split(".").reduce((p, l) => p[l], n.templates[o]), f = $(h, "");
57
- return `${i}${f}`;
58
- }
59
- const g = o.startsWith("-") ? o : V(o), S = (u, h = ";") => i = `${i}${u}${h}`, O = (u) => S(`${g}:${u}`);
60
- if (typeof e == "number") return O(e);
61
- if (typeof e != "string")
62
- if ("toString" in e) e = e.toString();
63
- else return i;
64
- const { modifiers: A } = n || {}, k = function* () {
65
- yield M(e), yield H(e, A);
66
- }();
67
- for (const { result: u, additionalCss: h = [] } of k)
68
- e = u, h.forEach((f) => {
69
- const p = $(f, "");
70
- S(p, "");
71
- });
72
- return O(e);
73
- }, "");
74
- if (!a) return c.join(`
75
- `);
76
- if (!s) return a;
77
- let d = "";
78
- return t !== void 0 ? d = `@layer l${t} { ${s} { ${a} } }` : d = `${s} { ${a} }`, [d, ...c].join(`
79
- `);
80
- };
81
- export {
82
- $ as p,
83
- x as t
84
- };