@salty-css/react 0.2.0-alpha.0 → 0.2.0-alpha.2
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/element-factory-13FoC0gV.cjs +1 -0
- package/element-factory-Dse2ZLfl.js +69 -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.js +1 -1
- package/element-factory-Ccd9WJOa.js +0 -68
- package/element-factory-CgP5yEab.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const K=require("react"),g=require("@salty-css/core/util"),A=require("@salty-css/core/parsers");function O(s){var i,e,t="";if(typeof s=="string"||typeof s=="number")t+=s;else if(typeof s=="object")if(Array.isArray(s)){var o=s.length;for(i=0;i<o;i++)s[i]&&(e=O(s[i]))&&(t&&(t+=" "),t+=e)}else for(e in s)s[e]&&(t&&(t+=" "),t+=e);return t}function F(){for(var s,i,e=0,t="",o=arguments.length;e<o;e++)(s=arguments[e])&&(i=O(s))&&(t&&(t+=" "),t+=i);return t}const R=["passProps"],T=(s,i="",e={},t)=>{const o=({extend:u=s,element:$,as:w,className:V="",children:q,passProps:d=e.passProps,_vks:l=new Set,...r},v)=>{const S=w??$??e.element,a={passProps:d};e.attr&&Object.assign(a,e.attr),t&&Object.assign(a,t),e.defaultProps&&Object.assign(r,e.defaultProps),r&&Object.assign(a,r);const b=new Set([...i.split(" "),...V.split(" ")]),y=typeof u=="function"||typeof u=="object",h=y&&"isStyled"in u,E=y?u:S||u;if(!E)throw new Error("No element provided");const m=a.style||{};a.style||(a.style=m),Object.entries(m).forEach(([n,c])=>{const f=A.parseVariableTokens(c);f&&(m[n]=f.transformed)}),e.propValueKeys&&e.propValueKeys.forEach(n=>{const c=`css-${n}`,f=r[c];if(f===void 0)return;const N=`--props-${g.dashCase(n)}`;m[N]=f,l&&l.add(c)}),e.variantKeys&&e.variantKeys.forEach(n=>{const[c,f]=n.split("=");r[c]!==void 0?(b.add(`${c}-${r[c]}`),l&&l.add(c)):f!==void 0&&b.add(`${c}-${f}`)}),l&&(!y||!h)?l.forEach(n=>{if(!d)return delete a[n];if(d!==!0&&!d.includes(n))return delete a[n]}):h&&Object.assign(a,{_vks:l}),h||R.forEach(n=>delete a[n]);const C=F(...b);return K.createElement(E,{element:y?S:void 0,className:C,ref:v,...a},q)},j=K.forwardRef(o);return Object.assign(j,{isStyled:!0,className:i,toString:()=>`.${e.hash}`}),j};exports.elementFactory=T;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { forwardRef as p, createElement as g } from "react";
|
|
2
|
+
import { dashCase as A } from "@salty-css/core/util";
|
|
3
|
+
import { parseVariableTokens as R } from "@salty-css/core/parsers";
|
|
4
|
+
function K(s) {
|
|
5
|
+
var n, e, t = "";
|
|
6
|
+
if (typeof s == "string" || typeof s == "number") t += s;
|
|
7
|
+
else if (typeof s == "object") if (Array.isArray(s)) {
|
|
8
|
+
var d = s.length;
|
|
9
|
+
for (n = 0; n < d; n++) s[n] && (e = K(s[n])) && (t && (t += " "), t += e);
|
|
10
|
+
} else for (e in s) s[e] && (t && (t += " "), t += e);
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
function q() {
|
|
14
|
+
for (var s, n, e = 0, t = "", d = arguments.length; e < d; e++) (s = arguments[e]) && (n = K(s)) && (t && (t += " "), t += n);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
const F = ["passProps"], D = (s, n = "", e = {}, t) => {
|
|
18
|
+
const j = p(({
|
|
19
|
+
extend: o = s,
|
|
20
|
+
element: O,
|
|
21
|
+
as: $,
|
|
22
|
+
className: w = "",
|
|
23
|
+
children: V,
|
|
24
|
+
passProps: u = e.passProps,
|
|
25
|
+
_vks: c = /* @__PURE__ */ new Set(),
|
|
26
|
+
...r
|
|
27
|
+
}, v) => {
|
|
28
|
+
const S = $ ?? O ?? e.element, f = { passProps: u };
|
|
29
|
+
e.attr && Object.assign(f, e.attr), t && Object.assign(f, t), e.defaultProps && Object.assign(r, e.defaultProps), r && Object.assign(f, r);
|
|
30
|
+
const b = /* @__PURE__ */ new Set([...n.split(" "), ...w.split(" ")]), m = typeof o == "function" || typeof o == "object", h = m && "isStyled" in o, E = m ? o : S || o;
|
|
31
|
+
if (!E) throw new Error("No element provided");
|
|
32
|
+
const y = f.style || {};
|
|
33
|
+
f.style || (f.style = y), Object.entries(y).forEach(([i, a]) => {
|
|
34
|
+
const l = R(a);
|
|
35
|
+
l && (y[i] = l.transformed);
|
|
36
|
+
}), e.propValueKeys && e.propValueKeys.forEach((i) => {
|
|
37
|
+
const a = `css-${i}`, l = r[a];
|
|
38
|
+
if (l === void 0) return;
|
|
39
|
+
const N = `--props-${A(i)}`;
|
|
40
|
+
y[N] = l, c && c.add(a);
|
|
41
|
+
}), e.variantKeys && e.variantKeys.forEach((i) => {
|
|
42
|
+
const [a, l] = i.split("=");
|
|
43
|
+
r[a] !== void 0 ? (b.add(`${a}-${r[a]}`), c && c.add(a)) : l !== void 0 && b.add(`${a}-${l}`);
|
|
44
|
+
}), c && (!m || !h) ? c.forEach((i) => {
|
|
45
|
+
if (!u) return delete f[i];
|
|
46
|
+
if (u !== !0 && !u.includes(i))
|
|
47
|
+
return delete f[i];
|
|
48
|
+
}) : h && Object.assign(f, { _vks: c }), h || F.forEach((i) => delete f[i]);
|
|
49
|
+
const C = q(...b);
|
|
50
|
+
return g(
|
|
51
|
+
E,
|
|
52
|
+
{
|
|
53
|
+
element: m ? S : void 0,
|
|
54
|
+
className: C,
|
|
55
|
+
ref: v,
|
|
56
|
+
...f
|
|
57
|
+
},
|
|
58
|
+
V
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
return Object.assign(j, {
|
|
62
|
+
isStyled: !0,
|
|
63
|
+
className: n,
|
|
64
|
+
toString: () => `.${e.hash}`
|
|
65
|
+
}), j;
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
D as e
|
|
69
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salty-css/react",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@salty-css/core": "0.2.0-alpha.
|
|
81
|
+
"@salty-css/core": "0.2.0-alpha.2",
|
|
82
82
|
"@testing-library/react": "^16.3.2",
|
|
83
83
|
"clsx": ">=2.x",
|
|
84
84
|
"react": ">=19.x || >=18.3.x"
|
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-13FoC0gV.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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@salty-css/core/generators"),s=require("./element-factory-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@salty-css/core/generators"),s=require("./element-factory-13FoC0gV.cjs"),c=(t,r)=>{const e=new o.StyledGenerator(t,r),n=s.elementFactory(t,e.cssClassName,e.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(n,{generator:e}),n};exports.styled=c;
|
package/styled.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyledGenerator as r } from "@salty-css/core/generators";
|
|
2
|
-
import { e as s } from "./element-factory-
|
|
2
|
+
import { e as s } from "./element-factory-Dse2ZLfl.js";
|
|
3
3
|
const i = (t, o) => {
|
|
4
4
|
const e = new r(t, o), n = s(t, e.cssClassName, e.clientProps, {
|
|
5
5
|
"data-unoptimized-client-component": !0
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { forwardRef as C, createElement as N } from "react";
|
|
2
|
-
import { dashCase as p } from "@salty-css/core/util";
|
|
3
|
-
import { parseVariableTokens as g } from "@salty-css/core/parsers";
|
|
4
|
-
function K(i) {
|
|
5
|
-
var n, e, t = "";
|
|
6
|
-
if (typeof i == "string" || typeof i == "number") t += i;
|
|
7
|
-
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
8
|
-
var d = i.length;
|
|
9
|
-
for (n = 0; n < d; n++) i[n] && (e = K(i[n])) && (t && (t += " "), t += e);
|
|
10
|
-
} else for (e in i) i[e] && (t && (t += " "), t += e);
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
13
|
-
function A() {
|
|
14
|
-
for (var i, n, e = 0, t = "", d = arguments.length; e < d; e++) (i = arguments[e]) && (n = K(i)) && (t && (t += " "), t += n);
|
|
15
|
-
return t;
|
|
16
|
-
}
|
|
17
|
-
const R = ["passProps"], z = (i, n = "", e = {}, t) => {
|
|
18
|
-
const j = C(({
|
|
19
|
-
extend: o = i,
|
|
20
|
-
element: S = e.element,
|
|
21
|
-
className: O = "",
|
|
22
|
-
children: $,
|
|
23
|
-
passProps: u = e.passProps,
|
|
24
|
-
_vks: l = /* @__PURE__ */ new Set(),
|
|
25
|
-
...r
|
|
26
|
-
}, w) => {
|
|
27
|
-
const f = { passProps: u };
|
|
28
|
-
e.attr && Object.assign(f, e.attr), t && Object.assign(f, t), e.defaultProps && Object.assign(r, e.defaultProps), r && Object.assign(f, r);
|
|
29
|
-
const b = /* @__PURE__ */ new Set([...n.split(" "), ...O.split(" ")]), y = typeof o == "function" || typeof o == "object", h = y && "isStyled" in o, E = y ? o : S || o;
|
|
30
|
-
if (!E) throw new Error("No element provided");
|
|
31
|
-
const m = f.style || {};
|
|
32
|
-
f.style || (f.style = m), Object.entries(m).forEach(([s, a]) => {
|
|
33
|
-
const c = g(a);
|
|
34
|
-
c && (m[s] = c.transformed);
|
|
35
|
-
}), e.propValueKeys && e.propValueKeys.forEach((s) => {
|
|
36
|
-
const a = `css-${s}`, c = r[a];
|
|
37
|
-
if (c === void 0) return;
|
|
38
|
-
const v = `--props-${p(s)}`;
|
|
39
|
-
m[v] = c, l && l.add(a);
|
|
40
|
-
}), e.variantKeys && e.variantKeys.forEach((s) => {
|
|
41
|
-
const [a, c] = s.split("=");
|
|
42
|
-
r[a] !== void 0 ? (b.add(`${a}-${r[a]}`), l && l.add(a)) : c !== void 0 && b.add(`${a}-${c}`);
|
|
43
|
-
}), l && (!y || !h) ? l.forEach((s) => {
|
|
44
|
-
if (!u) return delete f[s];
|
|
45
|
-
if (u !== !0 && !u.includes(s))
|
|
46
|
-
return delete f[s];
|
|
47
|
-
}) : h && Object.assign(f, { _vks: l }), h || R.forEach((s) => delete f[s]);
|
|
48
|
-
const V = A(...b);
|
|
49
|
-
return N(
|
|
50
|
-
E,
|
|
51
|
-
{
|
|
52
|
-
element: y ? S : void 0,
|
|
53
|
-
className: V,
|
|
54
|
-
ref: w,
|
|
55
|
-
...f
|
|
56
|
-
},
|
|
57
|
-
$
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
return Object.assign(j, {
|
|
61
|
-
isStyled: !0,
|
|
62
|
-
className: n,
|
|
63
|
-
toString: () => `.${e.hash}`
|
|
64
|
-
}), j;
|
|
65
|
-
};
|
|
66
|
-
export {
|
|
67
|
-
z as e
|
|
68
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const K=require("react"),C=require("@salty-css/core/util"),N=require("@salty-css/core/parsers");function O(s){var n,e,t="";if(typeof s=="string"||typeof s=="number")t+=s;else if(typeof s=="object")if(Array.isArray(s)){var o=s.length;for(n=0;n<o;n++)s[n]&&(e=O(s[n]))&&(t&&(t+=" "),t+=e)}else for(e in s)s[e]&&(t&&(t+=" "),t+=e);return t}function g(){for(var s,n,e=0,t="",o=arguments.length;e<o;e++)(s=arguments[e])&&(n=O(s))&&(t&&(t+=" "),t+=n);return t}const A=["passProps"],F=(s,n="",e={},t)=>{const o=({extend:u=s,element:S=e.element,className:$="",children:w,passProps:d=e.passProps,_vks:l=new Set,...r},V)=>{const f={passProps:d};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([...n.split(" "),...$.split(" ")]),y=typeof u=="function"||typeof u=="object",h=y&&"isStyled"in u,E=y?u:S||u;if(!E)throw new Error("No element provided");const m=f.style||{};f.style||(f.style=m),Object.entries(m).forEach(([i,a])=>{const c=N.parseVariableTokens(a);c&&(m[i]=c.transformed)}),e.propValueKeys&&e.propValueKeys.forEach(i=>{const a=`css-${i}`,c=r[a];if(c===void 0)return;const v=`--props-${C.dashCase(i)}`;m[v]=c,l&&l.add(a)}),e.variantKeys&&e.variantKeys.forEach(i=>{const[a,c]=i.split("=");r[a]!==void 0?(b.add(`${a}-${r[a]}`),l&&l.add(a)):c!==void 0&&b.add(`${a}-${c}`)}),l&&(!y||!h)?l.forEach(i=>{if(!d)return delete f[i];if(d!==!0&&!d.includes(i))return delete f[i]}):h&&Object.assign(f,{_vks:l}),h||A.forEach(i=>delete f[i]);const q=g(...b);return K.createElement(E,{element:y?S:void 0,className:q,ref:V,...f},w)},j=K.forwardRef(o);return Object.assign(j,{isStyled:!0,className:n,toString:()=>`.${e.hash}`}),j};exports.elementFactory=F;
|