@salty-css/react 0.0.1-alpha.113 → 0.0.1-alpha.115
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 +49 -48
- package/{element-factory-Dupolv6C.js → element-factory-CsNOsWc4.js} +22 -22
- package/element-factory-oJLHawcF.cjs +1 -0
- package/package.json +2 -2
- package/styled-client.cjs +1 -1
- package/styled-client.js +1 -1
- package/styled.cjs +1 -1
- package/styled.d.ts +3 -3
- package/styled.js +24 -23
- package/element-factory-D1ozgqO7.cjs +0 -1
package/README.md
CHANGED
@@ -16,38 +16,31 @@ In the world of frontend dev is there anything saltier than CSS? Salty CSS is bu
|
|
16
16
|
- Create component: `npx salty-css generate [filePath]`
|
17
17
|
- Build: `npx salty-css build [directory]`
|
18
18
|
|
19
|
-
###
|
19
|
+
### Initialize
|
20
20
|
|
21
|
-
|
21
|
+
Fastest way to get started with any framework is [npx salty-css init [directory]](#initialize-salty-css-for-a-project) command
|
22
22
|
|
23
|
-
-
|
24
|
-
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
- [Core](https://www.npmjs.com/package/@salty-css/react) → `npm install @salty-css/core` (This package contains code for internal use)
|
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
|
29
28
|
|
30
|
-
###
|
29
|
+
### Salty CSS CLI
|
31
30
|
|
32
|
-
|
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.
|
33
32
|
|
34
|
-
|
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
|
35
36
|
|
36
|
-
|
37
|
+
### Guides
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
#### Build / Compile Salty CSS
|
41
|
-
|
42
|
-
If you want to manually build your project that can be done by running `npx salty-css build [directory]`. Directory is not required as CLI can use default directory defined in `.saltyrc.json`. Note that build generates css files but Vite / Webpack plugin is still required for full support.
|
43
|
-
|
44
|
-
#### Update Salty CSS packages
|
45
|
-
|
46
|
-
To ease the pain of package updates all Salty CSS packages can be updated with `npx salty-css update`
|
39
|
+
#### Next.js
|
47
40
|
|
48
|
-
|
41
|
+
In your existing Next.js repository you can run `npx salty-css init` to automatically configure Salty CSS.
|
49
42
|
|
50
|
-
|
43
|
+
##### Manual configuration
|
51
44
|
|
52
45
|
1. For Next.js support install `npm i @salty-css/next @salty-css/core @salty-css/react`
|
53
46
|
2. Create `salty.config.ts` to your app directory
|
@@ -62,15 +55,11 @@ To ease the pain of package updates all Salty CSS packages can be updated with `
|
|
62
55
|
|
63
56
|
[Check out Next.js demo project](https://github.com/margarita-form/salty-css-website) or [react example code](#code-examples)
|
64
57
|
|
65
|
-
####
|
66
|
-
|
67
|
-
1. Install related dependencies: `npm i @salty-css/core @salty-css/react`
|
68
|
-
2. Create `salty.config.ts` to your app directory
|
69
|
-
3. Configure your build tool to support Salty CSS ([Vite](#vite) or Webpack)
|
58
|
+
#### Vite
|
70
59
|
|
71
|
-
|
60
|
+
In your existing Vite repository you can run `npx salty-css init` to automatically configure Salty CSS.
|
72
61
|
|
73
|
-
|
62
|
+
##### Manual configuration
|
74
63
|
|
75
64
|
1. For Vite support install `npm i @salty-css/vite @salty-css/core`
|
76
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
|
@@ -78,6 +67,18 @@ To ease the pain of package updates all Salty CSS packages can be updated with `
|
|
78
67
|
4. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
|
79
68
|
5. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
|
80
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
|
+
|
81
82
|
### Create components
|
82
83
|
|
83
84
|
1. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
|
@@ -106,23 +107,6 @@ export const config = defineConfig({
|
|
106
107
|
});
|
107
108
|
```
|
108
109
|
|
109
|
-
**Your React component file**
|
110
|
-
|
111
|
-
```tsx
|
112
|
-
import { Wrapper } from '../components/wrapper/wrapper.css';
|
113
|
-
import { Button } from '../components/button/button.css';
|
114
|
-
|
115
|
-
export const IndexPage = () => {
|
116
|
-
return (
|
117
|
-
<Wrapper>
|
118
|
-
<Button variant="solid" onClick={() => alert('It is a button.')}>
|
119
|
-
Outlined
|
120
|
-
</Button>
|
121
|
-
</Wrapper>
|
122
|
-
);
|
123
|
-
};
|
124
|
-
```
|
125
|
-
|
126
110
|
**Wrapper** (`components/wrapper/wrapper.css.ts`)
|
127
111
|
|
128
112
|
```tsx
|
@@ -147,7 +131,7 @@ export const Button = styled('button', {
|
|
147
131
|
padding: `0.6em 1.2em`,
|
148
132
|
border: '1px solid currentColor',
|
149
133
|
background: 'transparent',
|
150
|
-
color: 'currentColor
|
134
|
+
color: 'currentColor',
|
151
135
|
cursor: 'pointer',
|
152
136
|
transition: '200ms',
|
153
137
|
textDecoration: 'none',
|
@@ -183,4 +167,21 @@ export const Button = styled('button', {
|
|
183
167
|
});
|
184
168
|
```
|
185
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
|
+
|
186
187
|
More examples coming soon
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { forwardRef as
|
2
|
-
import { p as
|
1
|
+
import { forwardRef as C, createElement as V } from "react";
|
2
|
+
import { p as N, d as A } from "./parse-tokens-DAW55Na6.js";
|
3
3
|
function K(n) {
|
4
4
|
var s, e, t = "";
|
5
5
|
if (typeof n == "string" || typeof n == "number") t += n;
|
@@ -9,43 +9,43 @@ function K(n) {
|
|
9
9
|
} else for (e in n) n[e] && (t && (t += " "), t += e);
|
10
10
|
return t;
|
11
11
|
}
|
12
|
-
function
|
12
|
+
function R() {
|
13
13
|
for (var n, s, e = 0, t = "", d = arguments.length; e < d; e++) (n = arguments[e]) && (s = K(n)) && (t && (t += " "), t += s);
|
14
14
|
return t;
|
15
15
|
}
|
16
|
-
const
|
17
|
-
const j =
|
18
|
-
extend:
|
16
|
+
const F = ["passVariantProps"], x = (n, s, e, t) => {
|
17
|
+
const j = C(({
|
18
|
+
extend: l = n,
|
19
19
|
element: S = e.element,
|
20
20
|
className: $ = "",
|
21
21
|
children: w,
|
22
22
|
passVariantProps: u,
|
23
|
-
_vks:
|
24
|
-
...
|
23
|
+
_vks: a = /* @__PURE__ */ new Set(),
|
24
|
+
...o
|
25
25
|
}, O) => {
|
26
26
|
const f = { passVariantProps: u };
|
27
|
-
e.attr && Object.assign(f, e.attr), t && Object.assign(f, t),
|
28
|
-
const b = new Set($.split(" ")), y = typeof
|
27
|
+
e.attr && Object.assign(f, e.attr), t && Object.assign(f, t), o && Object.assign(f, o);
|
28
|
+
const b = new Set($.split(" ")), y = typeof l == "function" || typeof l == "object", h = y && "isStyled" in l, E = y ? l : S || l;
|
29
29
|
if (!E) throw new Error("No element provided");
|
30
30
|
const m = f.style || {};
|
31
31
|
f.style || (f.style = m), Object.entries(m).forEach(([i, r]) => {
|
32
|
-
const { result:
|
33
|
-
m[i] =
|
32
|
+
const { result: c } = N(r);
|
33
|
+
m[i] = c;
|
34
34
|
}), e.propValueKeys && e.propValueKeys.forEach((i) => {
|
35
|
-
const r = `css-${i}`,
|
36
|
-
if (
|
37
|
-
const p = `--props-${
|
38
|
-
m[p] =
|
35
|
+
const r = `css-${i}`, c = o[r];
|
36
|
+
if (c === void 0) return;
|
37
|
+
const p = `--props-${A(i)}`;
|
38
|
+
m[p] = c, a && a.add(r);
|
39
39
|
}), e.variantKeys && e.variantKeys.forEach((i) => {
|
40
|
-
const [r,
|
41
|
-
|
42
|
-
}),
|
40
|
+
const [r, c] = i.split("=");
|
41
|
+
o[r] !== void 0 ? (b.add(`${r}-${o[r]}`), a && a.add(r)) : c !== void 0 && b.add(`${r}-${c}`);
|
42
|
+
}), a && (!y || !h) ? a.forEach((i) => {
|
43
43
|
if (!u) return delete f[i];
|
44
44
|
if (u !== !0 && !u.includes(i))
|
45
45
|
return delete f[i];
|
46
|
-
}) : h && Object.assign(f, { _vks:
|
47
|
-
const g =
|
48
|
-
return
|
46
|
+
}) : h && Object.assign(f, { _vks: a }), h || F.forEach((i) => delete f[i]);
|
47
|
+
const g = R(s, ...b);
|
48
|
+
return V(
|
49
49
|
E,
|
50
50
|
{
|
51
51
|
element: y ? S : void 0,
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const K=require("react"),$=require("./parse-tokens-CRGUYhKC.cjs");function w(n){var s,e,t="";if(typeof n=="string"||typeof n=="number")t+=n;else if(typeof n=="object")if(Array.isArray(n)){var l=n.length;for(s=0;s<l;s++)n[s]&&(e=w(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="",l=arguments.length;e<l;e++)(n=arguments[e])&&(s=w(n))&&(t&&(t+=" "),t+=s);return t}const A=["passVariantProps"],F=(n,s,e,t)=>{const l=({extend:o=n,element:S=e.element,className:O="",children:g,passVariantProps:d,_vks:c=new Set,...u},C)=>{const f={passVariantProps:d};e.attr&&Object.assign(f,e.attr),t&&Object.assign(f,t),u&&Object.assign(f,u);const b=new Set(O.split(" ")),y=typeof o=="function"||typeof o=="object",h=y&&"isStyled"in o,E=y?o:S||o;if(!E)throw new Error("No element provided");const m=f.style||{};f.style||(f.style=m),Object.entries(m).forEach(([i,r])=>{const{result:a}=$.parseValueTokens(r);m[i]=a}),e.propValueKeys&&e.propValueKeys.forEach(i=>{const r=`css-${i}`,a=u[r];if(a===void 0)return;const N=`--props-${$.dashCase(i)}`;m[N]=a,c&&c.add(r)}),e.variantKeys&&e.variantKeys.forEach(i=>{const[r,a]=i.split("=");u[r]!==void 0?(b.add(`${r}-${u[r]}`),c&&c.add(r)):a!==void 0&&b.add(`${r}-${a}`)}),c&&(!y||!h)?c.forEach(i=>{if(!d)return delete f[i];if(d!==!0&&!d.includes(i))return delete f[i]}):h&&Object.assign(f,{_vks:c}),h||A.forEach(i=>delete f[i]);const V=q(s,...b);return K.createElement(E,{element:y?S:void 0,className:V,ref:C,...f},g)},j=K.forwardRef(l);return Object.assign(j,{isStyled:!0,className:s,toString:()=>`.${s}`}),j};exports.elementFactory=F;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salty-css/react",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.115",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
}
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@salty-css/core": "^0.0.1-alpha.
|
49
|
+
"@salty-css/core": "^0.0.1-alpha.115",
|
50
50
|
"clsx": ">=2.x",
|
51
51
|
"react": ">=19.x || >=18.3.x"
|
52
52
|
}
|
package/styled-client.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-oJLHawcF.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
|
package/styled-client.js
CHANGED
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var y=Object.defineProperty;var g=(s,t,e)=>t in s?y(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var o=(s,t,e)=>g(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-DjwCLt3X.cjs"),f=require("./element-factory-oJLHawcF.cjs"),N=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 templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?N(this._context.config.templates):[]}get css(){var r;const{base:t={},variants:e={},compoundVariants:a=[]}=this.params,i={...t,variants:e,compoundVariants:a};return u.parseStyles(i,`.${this.cssClassName}`,this.priority,(r=this._context)==null?void 0:r.config)}get props(){const{element:t,variants:e={},compoundVariants:a=[],defaultVariants:i={}}=this.params,r=new Set([]),p=n=>{const c=i[n];c!==void 0?r.add(`${n}=${String(c)}`):r.add(n)};Object.keys(e).forEach(p),a.map(n=>Object.keys(n).forEach(p));const h=new Set([]),l=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return l&&l.forEach((n,c,d)=>{const m=d.at(1);m&&h.add(m)}),{element:t,variantKeys:[...r],propValueKeys:[...h],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 b=(s,t)=>{const e=new _(s,t),a=f.elementFactory(s,e.cssClassName,e.props,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:e}),a};exports.styled=b;
|
package/styled.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AllHTMLAttributes, JSX, ReactNode } from 'react';
|
2
|
-
import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams, ValueProps } 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 &
|
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
4
|
ref?: any;
|
5
|
-
} : object) & VariantProps<STYLE_PARAMS
|
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,10 +1,10 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var o = (e, t, s) =>
|
4
|
-
import { t as
|
5
|
-
import { e as
|
6
|
-
const
|
7
|
-
class
|
1
|
+
var u = Object.defineProperty;
|
2
|
+
var y = (e, t, s) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
3
|
+
var o = (e, t, s) => y(e, typeof t != "symbol" ? t + "" : t, s);
|
4
|
+
import { t as f, p as g } from "./parse-styles-CVYekczt.js";
|
5
|
+
import { e as N } from "./element-factory-CsNOsWc4.js";
|
6
|
+
const _ = (e) => Object.keys(e);
|
7
|
+
class b {
|
8
8
|
constructor(t, s) {
|
9
9
|
o(this, "_isProd");
|
10
10
|
o(this, "_callerName");
|
@@ -12,7 +12,7 @@ class d {
|
|
12
12
|
this.tagName = t, this.params = s;
|
13
13
|
}
|
14
14
|
get hash() {
|
15
|
-
return
|
15
|
+
return f(this.params.base || this.params);
|
16
16
|
}
|
17
17
|
get priority() {
|
18
18
|
var t;
|
@@ -30,26 +30,27 @@ class d {
|
|
30
30
|
}
|
31
31
|
get templateKeys() {
|
32
32
|
var t;
|
33
|
-
return (t = this._context) != null && t.config.templates ?
|
33
|
+
return (t = this._context) != null && t.config.templates ? _(this._context.config.templates) : [];
|
34
34
|
}
|
35
35
|
get css() {
|
36
36
|
var r;
|
37
37
|
const { base: t = {}, variants: s = {}, compoundVariants: a = [] } = this.params, i = { ...t, variants: s, compoundVariants: a };
|
38
|
-
return
|
38
|
+
return g(i, `.${this.cssClassName}`, this.priority, (r = this._context) == null ? void 0 : r.config);
|
39
39
|
}
|
40
40
|
get props() {
|
41
|
-
const { element: t } =
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
const { element: t, variants: s = {}, compoundVariants: a = [], defaultVariants: i = {} } = this.params, r = /* @__PURE__ */ new Set([]), p = (n) => {
|
42
|
+
const c = i[n];
|
43
|
+
c !== void 0 ? r.add(`${n}=${String(c)}`) : r.add(n);
|
44
|
+
};
|
45
|
+
Object.keys(s).forEach(p), a.map((n) => Object.keys(n).forEach(p));
|
46
|
+
const h = /* @__PURE__ */ new Set([]), m = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
|
47
|
+
return m && m.forEach((n, c, d) => {
|
48
|
+
const l = d.at(1);
|
49
|
+
l && h.add(l);
|
49
50
|
}), {
|
50
51
|
element: t,
|
51
|
-
variantKeys:
|
52
|
-
propValueKeys: [...
|
52
|
+
variantKeys: [...r],
|
53
|
+
propValueKeys: [...h],
|
53
54
|
attr: {
|
54
55
|
"data-component-name": this._isProd ? void 0 : this._callerName
|
55
56
|
}
|
@@ -61,8 +62,8 @@ class d {
|
|
61
62
|
return this._isProd = i, this._callerName = s, this;
|
62
63
|
}
|
63
64
|
}
|
64
|
-
const
|
65
|
-
const s = new
|
65
|
+
const K = (e, t) => {
|
66
|
+
const s = new b(e, t), a = N(e, s.cssClassName, s.props, {
|
66
67
|
"data-unoptimized-client-component": !0
|
67
68
|
});
|
68
69
|
return Object.assign(a, {
|
@@ -70,5 +71,5 @@ const v = (e, t) => {
|
|
70
71
|
}), a;
|
71
72
|
};
|
72
73
|
export {
|
73
|
-
|
74
|
+
K as styled
|
74
75
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const K=require("react"),$=require("./parse-tokens-CRGUYhKC.cjs");function w(n){var s,e,t="";if(typeof n=="string"||typeof n=="number")t+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(s=0;s<o;s++)n[s]&&(e=w(n[s]))&&(t&&(t+=" "),t+=e)}else for(e in n)n[e]&&(t&&(t+=" "),t+=e);return t}function N(){for(var n,s,e=0,t="",o=arguments.length;e<o;e++)(n=arguments[e])&&(s=w(n))&&(t&&(t+=" "),t+=s);return t}const q=["passVariantProps"],A=(n,s,e,t)=>{const o=({extend:l=n,element:S=e.element,className:O="",children:g,passVariantProps:d,_vks:f=new Set,...u},v)=>{const r={passVariantProps:d};e.attr&&Object.assign(r,e.attr),t&&Object.assign(r,t),u&&Object.assign(r,u);const b=new Set(O.split(" ")),y=typeof l=="function"||typeof l=="object",h=y&&"isStyled"in l,E=y?l:S||l;if(!E)throw new Error("No element provided");const m=r.style||{};r.style||(r.style=m),Object.entries(m).forEach(([i,c])=>{const{result:a}=$.parseValueTokens(c);m[i]=a}),e.propValueKeys&&e.propValueKeys.forEach(i=>{const c=`css-${i}`,a=u[c];if(a===void 0)return;const V=`--props-${$.dashCase(i)}`;m[V]=a,f&&f.add(c)}),e.variantKeys&&e.variantKeys.forEach(i=>{const[c,a]=i.split("=");u[c]!==void 0?(b.add(`${c}-${u[c]}`),f&&f.add(c)):a!==void 0&&b.add(`${c}-${a}`)}),f&&(!y||!h)?f.forEach(i=>{if(!d)return delete r[i];if(d!==!0&&!d.includes(i))return delete r[i]}):h&&Object.assign(r,{_vks:f}),h||q.forEach(i=>delete r[i]);const C=N(s,...b);return K.createElement(E,{element:y?S:void 0,className:C,ref:v,...r},g)},j=K.forwardRef(o);return Object.assign(j,{isStyled:!0,className:s,toString:()=>`.${s}`}),j};exports.elementFactory=A;
|