@salty-css/react 0.0.1-alpha.116 → 0.0.1-alpha.118
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-C7JVLDq7.js +67 -0
- package/element-factory-D4kpeFoW.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 +29 -27
- package/element-factory-BOcdTbTj.cjs +0 -1
- package/element-factory-CKdPyEh1.js +0 -67
@@ -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;
|
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.118",
|
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.118",
|
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-D4kpeFoW.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 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 d=require("./parse-styles-C52S0WXA.cjs"),_=require("./element-factory-D4kpeFoW.cjs"),b=s=>Object.keys(s);class S{constructor(t,e){o(this,"_isProd");o(this,"_callerName");o(this,"_context");this.tagName=t,this.params=e}get hash(){return d.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?b(this._context.config.templates):[]}get css(){var i;const{base:t={},variants:e={},compoundVariants:a=[]}=this.params,n={...t,variants:e,compoundVariants:a};return d.parseStyles(n,`.${this.cssClassName}`,this.priority,(i=this._context)==null?void 0:i.config)}get props(){const{element:t,variants:e={},compoundVariants:a=[],defaultVariants:n={},defaultProps:i={},passProps:y}=this.params,c=new Set([]),l=r=>{const p=n[r];p!==void 0?c.add(`${r}=${String(p)}`):c.add(r)};Object.keys(e).forEach(l),a.map(r=>Object.keys(r).forEach(l));const h=new Set([]),m=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return m&&m.forEach((r,p,g)=>{const u=g.at(1);u&&h.add(u)}),{element:t,variantKeys:[...c],propValueKeys:[...h],passProps:y,defaultProps:i,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:e,config:a,prod:n}=t;return this._isProd=n,this._callerName=e,this}}const v=(s,t)=>{const e=new S(s,t),a=_.elementFactory(s,e.cssClassName,e.props,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:e}),a};exports.styled=v;
|
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 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-b5rqGu2w.js";
|
5
|
+
import { e as b } from "./element-factory-C7JVLDq7.js";
|
6
|
+
const x = (e) => Object.keys(e);
|
7
|
+
class V {
|
8
8
|
constructor(t, s) {
|
9
9
|
o(this, "_isProd");
|
10
10
|
o(this, "_callerName");
|
@@ -12,7 +12,7 @@ class b {
|
|
12
12
|
this.tagName = t, this.params = s;
|
13
13
|
}
|
14
14
|
get hash() {
|
15
|
-
return
|
15
|
+
return N(this.params.base || this.params);
|
16
16
|
}
|
17
17
|
get priority() {
|
18
18
|
var t;
|
@@ -30,27 +30,29 @@ class b {
|
|
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 ? x(this._context.config.templates) : [];
|
34
34
|
}
|
35
35
|
get css() {
|
36
|
-
var
|
37
|
-
const { base: t = {}, variants: s = {}, compoundVariants: a = [] } = this.params,
|
38
|
-
return
|
36
|
+
var i;
|
37
|
+
const { base: t = {}, variants: s = {}, compoundVariants: a = [] } = this.params, n = { ...t, variants: s, compoundVariants: a };
|
38
|
+
return _(n, `.${this.cssClassName}`, this.priority, (i = this._context) == null ? void 0 : i.config);
|
39
39
|
}
|
40
40
|
get props() {
|
41
|
-
const { element: t, variants: s = {}, compoundVariants: a = [], defaultVariants: i = {} } = this.params,
|
42
|
-
const
|
43
|
-
|
41
|
+
const { element: t, variants: s = {}, compoundVariants: a = [], defaultVariants: n = {}, defaultProps: i = {}, passProps: u } = this.params, c = /* @__PURE__ */ new Set([]), h = (r) => {
|
42
|
+
const p = n[r];
|
43
|
+
p !== void 0 ? c.add(`${r}=${String(p)}`) : c.add(r);
|
44
44
|
};
|
45
|
-
Object.keys(s).forEach(
|
46
|
-
const
|
47
|
-
return
|
48
|
-
const
|
49
|
-
|
45
|
+
Object.keys(s).forEach(h), a.map((r) => Object.keys(r).forEach(h));
|
46
|
+
const m = /* @__PURE__ */ new Set([]), l = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
|
47
|
+
return l && l.forEach((r, p, f) => {
|
48
|
+
const d = f.at(1);
|
49
|
+
d && m.add(d);
|
50
50
|
}), {
|
51
51
|
element: t,
|
52
|
-
variantKeys: [...
|
53
|
-
propValueKeys: [...
|
52
|
+
variantKeys: [...c],
|
53
|
+
propValueKeys: [...m],
|
54
|
+
passProps: u,
|
55
|
+
defaultProps: i,
|
54
56
|
attr: {
|
55
57
|
"data-component-name": this._isProd ? void 0 : this._callerName
|
56
58
|
}
|
@@ -58,12 +60,12 @@ class b {
|
|
58
60
|
}
|
59
61
|
_withBuildContext(t) {
|
60
62
|
this._context = t;
|
61
|
-
const { name: s, config: a, prod:
|
62
|
-
return this._isProd =
|
63
|
+
const { name: s, config: a, prod: n } = t;
|
64
|
+
return this._isProd = n, this._callerName = s, this;
|
63
65
|
}
|
64
66
|
}
|
65
|
-
const
|
66
|
-
const s = new
|
67
|
+
const j = (e, t) => {
|
68
|
+
const s = new V(e, t), a = b(e, s.cssClassName, s.props, {
|
67
69
|
"data-unoptimized-client-component": !0
|
68
70
|
});
|
69
71
|
return Object.assign(a, {
|
@@ -71,5 +73,5 @@ const K = (e, t) => {
|
|
71
73
|
}), a;
|
72
74
|
};
|
73
75
|
export {
|
74
|
-
|
76
|
+
j as styled
|
75
77
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const K=require("react"),$=require("./parse-tokens-p68muVgG.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;
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import { forwardRef as C, createElement as V } 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 d = n.length;
|
8
|
-
for (s = 0; s < d; 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 = "", d = arguments.length; e < d; e++) (n = arguments[e]) && (s = K(n)) && (t && (t += " "), t += s);
|
14
|
-
return t;
|
15
|
-
}
|
16
|
-
const F = ["passVariantProps"], x = (n, s, e, t) => {
|
17
|
-
const j = C(({
|
18
|
-
extend: l = n,
|
19
|
-
element: S = e.element,
|
20
|
-
className: $ = "",
|
21
|
-
children: w,
|
22
|
-
passVariantProps: u,
|
23
|
-
_vks: a = /* @__PURE__ */ new Set(),
|
24
|
-
...o
|
25
|
-
}, O) => {
|
26
|
-
const f = { passVariantProps: u };
|
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
|
-
if (!E) throw new Error("No element provided");
|
30
|
-
const m = f.style || {};
|
31
|
-
f.style || (f.style = m), Object.entries(m).forEach(([i, r]) => {
|
32
|
-
const { result: c } = N(r);
|
33
|
-
m[i] = c;
|
34
|
-
}), e.propValueKeys && e.propValueKeys.forEach((i) => {
|
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
|
-
}), e.variantKeys && e.variantKeys.forEach((i) => {
|
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
|
-
if (!u) return delete f[i];
|
44
|
-
if (u !== !0 && !u.includes(i))
|
45
|
-
return delete f[i];
|
46
|
-
}) : h && Object.assign(f, { _vks: a }), h || F.forEach((i) => delete f[i]);
|
47
|
-
const g = R(s, ...b);
|
48
|
-
return V(
|
49
|
-
E,
|
50
|
-
{
|
51
|
-
element: y ? S : void 0,
|
52
|
-
className: g,
|
53
|
-
ref: O,
|
54
|
-
...f
|
55
|
-
},
|
56
|
-
w
|
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
|
-
};
|