@salty-css/react 0.0.1-alpha.85 → 0.0.1-alpha.86
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-JxDKzaxU.cjs +1 -0
- package/element-factory-U2CFtpB_.js +59 -0
- package/package.json +2 -2
- package/styled-client.cjs +1 -1
- package/styled-client.d.ts +1 -1
- package/styled-client.js +3 -5
- package/styled.cjs +1 -1
- package/styled.js +23 -19
- package/element-factory-WgNOpLmJ.cjs +0 -1
- package/element-factory-uEk4VrqP.js +0 -59
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const K=require("react"),O=require("./dash-case-B_odFlTl.cjs");function $(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=$(s[i]))&&(t&&(t+=" "),t+=e)}else for(e in s)s[e]&&(t&&(t+=" "),t+=e);return t}function V(){for(var s,i,e=0,t="",o=arguments.length;e<o;e++)(s=arguments[e])&&(i=$(s))&&(t&&(t+=" "),t+=i);return t}const p=["passVariantProps"],N=(s,i,e,t)=>{const o=({extend:r=s,element:b=e.element,className:v="",children:w,passVariantProps:j,_vks:f=new Set,...l},E)=>{const n={passVariantProps:j};e.attr&&Object.assign(n,e.attr),t&&Object.assign(n,t),l&&Object.assign(n,l);const u=new Set(v.split(" ")),y=typeof r=="function"||typeof r=="object",m=y&&"isStyled"in r,S=y?r:b||r;if(!S)throw new Error("No element provided");e.propValueKeys&&(n.style||(n.style={}),e.propValueKeys.forEach(a=>{const c=`css-${a}`,d=l[c];if(d===void 0)return;const C=`--props-${O.dashCase(a)}`;n.style[C]=d,f&&f.add(c)})),e.variantKeys&&e.variantKeys.forEach(a=>{const[c,d]=a.split("=");l[c]!==void 0?(u.add(`${c}-${l[c]}`),f&&f.add(c)):d!==void 0&&u.add(`${c}-${d}`)}),f&&(!y||!m&&!j)?f.forEach(a=>delete n[a]):m&&Object.assign(n,{_vks:f}),m||p.forEach(a=>delete n[a]);const g=V(i,...u);return K.createElement(S,{element:y?b:void 0,className:g,ref:E,...n},w)},h=K.forwardRef(o);return Object.assign(h,{isStyled:!0,className:i,toString:()=>`.${i}`}),h};exports.elementFactory=N;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { forwardRef as g, createElement as O } from "react";
|
2
|
+
import { d as V } from "./dash-case-CGJ_UIZz.js";
|
3
|
+
function K(s) {
|
4
|
+
var i, t, e = "";
|
5
|
+
if (typeof s == "string" || typeof s == "number") e += 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] && (t = K(s[i])) && (e && (e += " "), e += t);
|
9
|
+
} else for (t in s) s[t] && (e && (e += " "), e += t);
|
10
|
+
return e;
|
11
|
+
}
|
12
|
+
function C() {
|
13
|
+
for (var s, i, t = 0, e = "", d = arguments.length; t < d; t++) (s = arguments[t]) && (i = K(s)) && (e && (e += " "), e += i);
|
14
|
+
return e;
|
15
|
+
}
|
16
|
+
const N = ["passVariantProps"], q = (s, i, t, e) => {
|
17
|
+
const b = g(({
|
18
|
+
extend: c = s,
|
19
|
+
element: h = t.element,
|
20
|
+
className: $ = "",
|
21
|
+
children: p,
|
22
|
+
passVariantProps: j,
|
23
|
+
_vks: o = /* @__PURE__ */ new Set(),
|
24
|
+
...l
|
25
|
+
}, v) => {
|
26
|
+
const n = { passVariantProps: j };
|
27
|
+
t.attr && Object.assign(n, t.attr), e && Object.assign(n, e), l && Object.assign(n, l);
|
28
|
+
const u = new Set($.split(" ")), y = typeof c == "function" || typeof c == "object", m = y && "isStyled" in c, S = y ? c : h || c;
|
29
|
+
if (!S) throw new Error("No element provided");
|
30
|
+
t.propValueKeys && (n.style || (n.style = {}), t.propValueKeys.forEach((a) => {
|
31
|
+
const f = `css-${a}`, r = l[f];
|
32
|
+
if (r === void 0) return;
|
33
|
+
const E = `--props-${V(a)}`;
|
34
|
+
n.style[E] = r, o && o.add(f);
|
35
|
+
})), t.variantKeys && t.variantKeys.forEach((a) => {
|
36
|
+
const [f, r] = a.split("=");
|
37
|
+
l[f] !== void 0 ? (u.add(`${f}-${l[f]}`), o && o.add(f)) : r !== void 0 && u.add(`${f}-${r}`);
|
38
|
+
}), o && (!y || !m && !j) ? o.forEach((a) => delete n[a]) : m && Object.assign(n, { _vks: o }), m || N.forEach((a) => delete n[a]);
|
39
|
+
const w = C(i, ...u);
|
40
|
+
return O(
|
41
|
+
S,
|
42
|
+
{
|
43
|
+
element: y ? h : void 0,
|
44
|
+
className: w,
|
45
|
+
ref: v,
|
46
|
+
...n
|
47
|
+
},
|
48
|
+
p
|
49
|
+
);
|
50
|
+
});
|
51
|
+
return Object.assign(b, {
|
52
|
+
isStyled: !0,
|
53
|
+
className: i,
|
54
|
+
toString: () => `.${i}`
|
55
|
+
}), b;
|
56
|
+
};
|
57
|
+
export {
|
58
|
+
q as e
|
59
|
+
};
|
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.86",
|
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.86",
|
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
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-JxDKzaxU.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
|
package/styled-client.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
import { GeneratorProps } from '@salty-css/core/generator';
|
2
2
|
import { Tag } from '@salty-css/core/types';
|
3
|
-
export declare const styledClient: (tagName: Tag<any>, className: string,
|
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
|
2
|
-
const
|
3
|
-
"data-component-name": n
|
4
|
-
});
|
1
|
+
import { e as o } from "./element-factory-U2CFtpB_.js";
|
2
|
+
const l = (e, t, r) => o(e, t, r);
|
5
3
|
export {
|
6
|
-
|
4
|
+
l as styledClient
|
7
5
|
};
|
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var m=Object.defineProperty;var l=(e,t,s)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var o=(e,t,s)=>l(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./parse-styles-DbNZJMT5.cjs"),u=require("./element-factory-JxDKzaxU.cjs"),y=e=>Object.keys(e);class g{constructor(t,s){o(this,"_isProd");o(this,"_callerName");o(this,"_context");this.tagName=t,this.params=s}get hash(){return h.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?y(this._context.config.templates):[]}get css(){var r;const{base:t={},variants:s={},compoundVariants:a=[]}=this.params,i={...t,variants:s,compoundVariants:a};return h.parseStyles(i,`.${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(r=>{var n;const c=(n=this.params.defaultVariants)==null?void 0:n[r];return c!==void 0?`${r}=${String(c)}`:r}):void 0,a=new Set([]),i=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return i&&i.forEach((r,c,n)=>{const p=n.at(1);p&&a.add(p)}),{element:t,variantKeys:s,propValueKeys:[...a],attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:s,config:a,prod:i}=t;return this._isProd=i,this._callerName=s,this}}const d=(e,t)=>{const s=new g(e,t),a=u.elementFactory(e,s.cssClassName,s.props,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:s}),a};exports.styled=d;
|
package/styled.js
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
var m = Object.defineProperty;
|
2
2
|
var h = (e, t, s) => t in e ? m(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
3
|
-
var
|
3
|
+
var o = (e, t, s) => h(e, typeof t != "symbol" ? t + "" : t, s);
|
4
4
|
import { t as l, p as u } from "./parse-styles-DLe1Dr-N.js";
|
5
|
-
import { e as g } from "./element-factory-
|
5
|
+
import { e as g } from "./element-factory-U2CFtpB_.js";
|
6
6
|
const y = (e) => Object.keys(e);
|
7
|
-
class
|
7
|
+
class d {
|
8
8
|
constructor(t, s) {
|
9
|
-
|
10
|
-
|
9
|
+
o(this, "_isProd");
|
10
|
+
o(this, "_callerName");
|
11
|
+
o(this, "_context");
|
11
12
|
this.tagName = t, this.params = s;
|
12
13
|
}
|
13
14
|
get hash() {
|
@@ -33,32 +34,35 @@ class f {
|
|
33
34
|
}
|
34
35
|
get css() {
|
35
36
|
var r;
|
36
|
-
const { base: t = {}, variants: s = {}, compoundVariants: a = [] } = this.params,
|
37
|
-
return u(
|
37
|
+
const { base: t = {}, variants: s = {}, compoundVariants: a = [] } = this.params, i = { ...t, variants: s, compoundVariants: a };
|
38
|
+
return u(i, `.${this.cssClassName}`, this.priority, (r = this._context) == null ? void 0 : r.config);
|
38
39
|
}
|
39
40
|
get props() {
|
40
41
|
const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((r) => {
|
41
|
-
var
|
42
|
-
const
|
43
|
-
return
|
44
|
-
}) : void 0, a = /* @__PURE__ */ new Set([]),
|
45
|
-
return
|
46
|
-
const p =
|
42
|
+
var n;
|
43
|
+
const c = (n = this.params.defaultVariants) == null ? void 0 : n[r];
|
44
|
+
return c !== void 0 ? `${r}=${String(c)}` : r;
|
45
|
+
}) : void 0, a = /* @__PURE__ */ new Set([]), i = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
|
46
|
+
return i && i.forEach((r, c, n) => {
|
47
|
+
const p = n.at(1);
|
47
48
|
p && a.add(p);
|
48
49
|
}), {
|
49
50
|
element: t,
|
50
51
|
variantKeys: s,
|
51
|
-
propValueKeys: [...a]
|
52
|
+
propValueKeys: [...a],
|
53
|
+
attr: {
|
54
|
+
"data-component-name": this._isProd ? void 0 : this._callerName
|
55
|
+
}
|
52
56
|
};
|
53
57
|
}
|
54
58
|
_withBuildContext(t) {
|
55
59
|
this._context = t;
|
56
|
-
const { name: s, config: a } = t;
|
57
|
-
return this._callerName = s, this;
|
60
|
+
const { name: s, config: a, prod: i } = t;
|
61
|
+
return this._isProd = i, this._callerName = s, this;
|
58
62
|
}
|
59
63
|
}
|
60
|
-
const
|
61
|
-
const s = new
|
64
|
+
const v = (e, t) => {
|
65
|
+
const s = new d(e, t), a = g(e, s.cssClassName, s.props, {
|
62
66
|
"data-unoptimized-client-component": !0
|
63
67
|
});
|
64
68
|
return Object.assign(a, {
|
@@ -66,5 +70,5 @@ const _ = (e, t) => {
|
|
66
70
|
}), a;
|
67
71
|
};
|
68
72
|
export {
|
69
|
-
|
73
|
+
v as styled
|
70
74
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const K=require("react"),C=require("./dash-case-B_odFlTl.cjs");function $(t){var n,s,e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){var c=t.length;for(n=0;n<c;n++)t[n]&&(s=$(t[n]))&&(e&&(e+=" "),e+=s)}else for(s in t)t[s]&&(e&&(e+=" "),e+=s);return e}function V(){for(var t,n,s=0,e="",c=arguments.length;s<c;s++)(t=arguments[s])&&(n=$(t))&&(e&&(e+=" "),e+=n);return e}const O=["passVariantProps"],N=(t,n,s,e)=>{const c=({extend:f=t,element:b=s.element,className:g="",children:v,passVariantProps:S,_vks:r=new Set,...l},w)=>{const i={passVariantProps:S};e&&Object.assign(i,e),l&&Object.assign(i,l);const u=new Set(g.split(" ")),y=typeof f=="function"||typeof f=="object",m=y&&"isStyled"in f,j=y?f:b||f;if(!j)throw new Error("No element provided");s.propValueKeys&&(i.style||(i.style={}),s.propValueKeys.forEach(a=>{const o=`css-${a}`,d=l[o];if(d===void 0)return;const p=`--props-${C.dashCase(a)}`;i.style[p]=d,r&&r.add(o)})),s.variantKeys&&s.variantKeys.forEach(a=>{const[o,d]=a.split("=");l[o]!==void 0?(u.add(`${o}-${l[o]}`),r&&r.add(o)):d!==void 0&&u.add(`${o}-${d}`)}),r&&(!y||!m&&!S)?r.forEach(a=>delete i[a]):m&&Object.assign(i,{_vks:r}),m||O.forEach(a=>delete i[a]);const E=V(n,...u);return K.createElement(j,{element:y?b:void 0,className:E,ref:w,...i},v)},h=K.forwardRef(c);return Object.assign(h,{isStyled:!0,className:n,toString:()=>`.${n}`}),h};exports.elementFactory=N;
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { forwardRef as E, createElement as V } from "react";
|
2
|
-
import { d as C } from "./dash-case-CGJ_UIZz.js";
|
3
|
-
function j(t) {
|
4
|
-
var n, s, e = "";
|
5
|
-
if (typeof t == "string" || typeof t == "number") e += t;
|
6
|
-
else if (typeof t == "object") if (Array.isArray(t)) {
|
7
|
-
var d = t.length;
|
8
|
-
for (n = 0; n < d; n++) t[n] && (s = j(t[n])) && (e && (e += " "), e += s);
|
9
|
-
} else for (s in t) t[s] && (e && (e += " "), e += s);
|
10
|
-
return e;
|
11
|
-
}
|
12
|
-
function O() {
|
13
|
-
for (var t, n, s = 0, e = "", d = arguments.length; s < d; s++) (t = arguments[s]) && (n = j(t)) && (e && (e += " "), e += n);
|
14
|
-
return e;
|
15
|
-
}
|
16
|
-
const N = ["passVariantProps"], q = (t, n, s, e) => {
|
17
|
-
const h = E(({
|
18
|
-
extend: r = t,
|
19
|
-
element: b = s.element,
|
20
|
-
className: K = "",
|
21
|
-
children: $,
|
22
|
-
passVariantProps: p,
|
23
|
-
_vks: f = /* @__PURE__ */ new Set(),
|
24
|
-
...c
|
25
|
-
}, g) => {
|
26
|
-
const i = { passVariantProps: p };
|
27
|
-
e && Object.assign(i, e), c && Object.assign(i, c);
|
28
|
-
const u = new Set(K.split(" ")), y = typeof r == "function" || typeof r == "object", m = y && "isStyled" in r, S = y ? r : b || r;
|
29
|
-
if (!S) throw new Error("No element provided");
|
30
|
-
s.propValueKeys && (i.style || (i.style = {}), s.propValueKeys.forEach((o) => {
|
31
|
-
const a = `css-${o}`, l = c[a];
|
32
|
-
if (l === void 0) return;
|
33
|
-
const w = `--props-${C(o)}`;
|
34
|
-
i.style[w] = l, f && f.add(a);
|
35
|
-
})), s.variantKeys && s.variantKeys.forEach((o) => {
|
36
|
-
const [a, l] = o.split("=");
|
37
|
-
c[a] !== void 0 ? (u.add(`${a}-${c[a]}`), f && f.add(a)) : l !== void 0 && u.add(`${a}-${l}`);
|
38
|
-
}), f && (!y || !m && !p) ? f.forEach((o) => delete i[o]) : m && Object.assign(i, { _vks: f }), m || N.forEach((o) => delete i[o]);
|
39
|
-
const v = O(n, ...u);
|
40
|
-
return V(
|
41
|
-
S,
|
42
|
-
{
|
43
|
-
element: y ? b : void 0,
|
44
|
-
className: v,
|
45
|
-
ref: g,
|
46
|
-
...i
|
47
|
-
},
|
48
|
-
$
|
49
|
-
);
|
50
|
-
});
|
51
|
-
return Object.assign(h, {
|
52
|
-
isStyled: !0,
|
53
|
-
className: n,
|
54
|
-
toString: () => `.${n}`
|
55
|
-
}), h;
|
56
|
-
};
|
57
|
-
export {
|
58
|
-
q as e
|
59
|
-
};
|