@salty-css/react 0.0.1-alpha.179 → 0.0.1-alpha.180
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-CRNlgjJ5.js +67 -0
- package/element-factory-CixOWc4u.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.js +9 -9
- package/element-factory-C7JVLDq7.js +0 -67
- package/element-factory-D4kpeFoW.cjs +0 -1
@@ -0,0 +1,67 @@
|
|
1
|
+
import { forwardRef as C, createElement as g } from "react";
|
2
|
+
import { p, d as N } from "./parse-tokens-YUi047xd.js";
|
3
|
+
function K(s) {
|
4
|
+
var i, e, t = "";
|
5
|
+
if (typeof s == "string" || typeof s == "number") t += s;
|
6
|
+
else if (typeof s == "object") if (Array.isArray(s)) {
|
7
|
+
var d = s.length;
|
8
|
+
for (i = 0; i < d; i++) s[i] && (e = K(s[i])) && (t && (t += " "), t += e);
|
9
|
+
} else for (e in s) s[e] && (t && (t += " "), t += e);
|
10
|
+
return t;
|
11
|
+
}
|
12
|
+
function A() {
|
13
|
+
for (var s, i, e = 0, t = "", d = arguments.length; e < d; e++) (s = arguments[e]) && (i = K(s)) && (t && (t += " "), t += i);
|
14
|
+
return t;
|
15
|
+
}
|
16
|
+
const R = ["passProps"], x = (s, i, e, t) => {
|
17
|
+
const j = C(({
|
18
|
+
extend: r = s,
|
19
|
+
element: S = e.element,
|
20
|
+
className: O = "",
|
21
|
+
children: $,
|
22
|
+
passProps: u = e.passProps,
|
23
|
+
_vks: c = /* @__PURE__ */ new Set(),
|
24
|
+
...o
|
25
|
+
}, w) => {
|
26
|
+
const f = { passProps: u };
|
27
|
+
e.attr && Object.assign(f, e.attr), t && Object.assign(f, t), e.defaultProps && Object.assign(o, e.defaultProps), o && Object.assign(f, o);
|
28
|
+
const b = new Set(O.split(" ")), y = typeof r == "function" || typeof r == "object", h = y && "isStyled" in r, E = y ? r : S || r;
|
29
|
+
if (!E) throw new Error("No element provided");
|
30
|
+
const m = f.style || {};
|
31
|
+
f.style || (f.style = m), Object.entries(m).forEach(([n, a]) => {
|
32
|
+
const { result: l } = p(a);
|
33
|
+
m[n] = l;
|
34
|
+
}), e.propValueKeys && e.propValueKeys.forEach((n) => {
|
35
|
+
const a = `css-${n}`, l = o[a];
|
36
|
+
if (l === void 0) return;
|
37
|
+
const v = `--props-${N(n)}`;
|
38
|
+
m[v] = l, c && c.add(a);
|
39
|
+
}), e.variantKeys && e.variantKeys.forEach((n) => {
|
40
|
+
const [a, l] = n.split("=");
|
41
|
+
o[a] !== void 0 ? (b.add(`${a}-${o[a]}`), c && c.add(a)) : l !== void 0 && b.add(`${a}-${l}`);
|
42
|
+
}), c && (!y || !h) ? c.forEach((n) => {
|
43
|
+
if (!u) return delete f[n];
|
44
|
+
if (u !== !0 && !u.includes(n))
|
45
|
+
return delete f[n];
|
46
|
+
}) : h && Object.assign(f, { _vks: c }), h || R.forEach((n) => delete f[n]);
|
47
|
+
const V = A(i, ...b);
|
48
|
+
return g(
|
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: i,
|
62
|
+
toString: () => `.${i}`
|
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 $(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=$(s[n]))&&(t&&(t+=" "),t+=e)}else for(e in s)s[e]&&(t&&(t+=" "),t+=e);return t}function N(){for(var s,n,e=0,t="",o=arguments.length;e<o;e++)(s=arguments[e])&&(n=$(s))&&(t&&(t+=" "),t+=n);return t}const q=["passProps"],A=(s,n,e,t)=>{const o=({extend:u=s,element:S=e.element,className:w="",children:V,passProps:d=e.passProps,_vks:c=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(w.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{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 g=`--props-${O.dashCase(i)}`;m[g]=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(!d)return delete f[i];if(d!==!0&&!d.includes(i))return delete f[i]}):h&&Object.assign(f,{_vks:c}),h||q.forEach(i=>delete f[i]);const C=N(n,...b);return K.createElement(E,{element:y?S:void 0,className:C,ref:v,...f},V)},j=K.forwardRef(o);return Object.assign(j,{isStyled:!0,className:n,toString:()=>`.${n}`}),j};exports.elementFactory=A;
|
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.180",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -50,7 +50,7 @@
|
|
50
50
|
}
|
51
51
|
},
|
52
52
|
"dependencies": {
|
53
|
-
"@salty-css/core": "^0.0.1-alpha.
|
53
|
+
"@salty-css/core": "^0.0.1-alpha.180",
|
54
54
|
"clsx": ">=2.x",
|
55
55
|
"react": ">=19.x || >=18.3.x"
|
56
56
|
}
|
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-CixOWc4u.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 y=Object.defineProperty;var g=(e,t,s)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var c=(e,t,s)=>g(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-JzVmxd-u.cjs"),f=require("./parse-tokens-p68muVgG.cjs"),N=require("./element-factory-
|
1
|
+
"use strict";var y=Object.defineProperty;var g=(e,t,s)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var c=(e,t,s)=>g(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-JzVmxd-u.cjs"),f=require("./parse-tokens-p68muVgG.cjs"),N=require("./element-factory-CixOWc4u.cjs"),_=e=>Object.keys(e);class b{constructor(t,s){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}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: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 cssFileName(){return this._callerName?`c_${f.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?_(this._context.config.templates):[]}get css(){var n;const{base:t={},variants:s={},compoundVariants:r=[]}=this.params,i={...t,variants:s,compoundVariants:r};return u.parseStyles(i,`.${this.cssClassName}`,(n=this._context)==null?void 0:n.config)}get props(){const{element:t,variants:s={},compoundVariants:r=[],defaultVariants:i={},defaultProps:p={},passProps:n}=this.params,h=new Set([]),l=a=>{const o=i[a];o!==void 0?h.add(`${a}=${String(o)}`):h.add(a)};Object.keys(s).forEach(l),r.map(a=>Object.keys(a).forEach(l));const m=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);a&&a.forEach(o=>{const d=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");d&&m.add(d)})}return{element:t,variantKeys:[...h],propValueKeys:[...m],passProps:n,defaultProps:p,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:s,config:r,prod:i}=t;return this._isProd=i,this._callerName=s,this}}const $=(e,t)=>{const s=new b(e,t),r=N.elementFactory(e,s.cssClassName,s.props,{"data-unoptimized-client-component":!0});return Object.assign(r,{generator:s}),r};exports.styled=$;
|
package/styled.js
CHANGED
@@ -3,7 +3,7 @@ var f = (e, s, t) => s in e ? u(e, s, { enumerable: !0, configurable: !0, writab
|
|
3
3
|
var c = (e, s, t) => f(e, typeof s != "symbol" ? s + "" : s, t);
|
4
4
|
import { t as g, p as y } from "./parse-styles-lB6EJuGj.js";
|
5
5
|
import { d as N } from "./parse-tokens-YUi047xd.js";
|
6
|
-
import { e as _ } from "./element-factory-
|
6
|
+
import { e as _ } from "./element-factory-CRNlgjJ5.js";
|
7
7
|
const $ = (e) => Object.keys(e);
|
8
8
|
class b {
|
9
9
|
constructor(s, t) {
|
@@ -37,21 +37,21 @@ class b {
|
|
37
37
|
return (s = this._context) != null && s.config.templates ? $(this._context.config.templates) : [];
|
38
38
|
}
|
39
39
|
get css() {
|
40
|
-
var
|
40
|
+
var o;
|
41
41
|
const { base: s = {}, variants: t = {}, compoundVariants: r = [] } = this.params, i = { ...s, variants: t, compoundVariants: r };
|
42
|
-
return y(i, `.${this.cssClassName}`, (
|
42
|
+
return y(i, `.${this.cssClassName}`, (o = this._context) == null ? void 0 : o.config);
|
43
43
|
}
|
44
44
|
get props() {
|
45
|
-
const { element: s, variants: t = {}, compoundVariants: r = [], defaultVariants: i = {}, defaultProps: p = {}, passProps:
|
46
|
-
const
|
47
|
-
|
45
|
+
const { element: s, variants: t = {}, compoundVariants: r = [], defaultVariants: i = {}, defaultProps: p = {}, passProps: o } = this.params, h = /* @__PURE__ */ new Set([]), m = (a) => {
|
46
|
+
const n = i[a];
|
47
|
+
n !== void 0 ? h.add(`${a}=${String(n)}`) : h.add(a);
|
48
48
|
};
|
49
49
|
Object.keys(t).forEach(m), r.map((a) => Object.keys(a).forEach(m));
|
50
50
|
const l = /* @__PURE__ */ new Set([]);
|
51
51
|
if (this.params.base) {
|
52
52
|
const a = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
|
53
|
-
a && a.forEach((
|
54
|
-
const d =
|
53
|
+
a && a.forEach((n) => {
|
54
|
+
const d = n.replace(/\{props\.([\w\d]+)\}/gi, "$1");
|
55
55
|
d && l.add(d);
|
56
56
|
});
|
57
57
|
}
|
@@ -59,7 +59,7 @@ class b {
|
|
59
59
|
element: s,
|
60
60
|
variantKeys: [...h],
|
61
61
|
propValueKeys: [...l],
|
62
|
-
passProps:
|
62
|
+
passProps: o,
|
63
63
|
defaultProps: p,
|
64
64
|
attr: {
|
65
65
|
"data-component-name": this._isProd ? void 0 : this._callerName
|
@@ -1,67 +0,0 @@
|
|
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
|
-
};
|
@@ -1 +0,0 @@
|
|
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;
|