@salty-css/react 0.0.1-alpha.12 → 0.0.1-alpha.14
Sign up to get free protection for your applications and to get access to all the features.
- package/element-factory-B9SpSdkZ.cjs +1 -0
- package/element-factory-BQovXL0W.js +59 -0
- package/element-factory.d.ts +2 -1
- package/package.json +1 -1
- package/styled-client.cjs +1 -1
- package/styled-client.d.ts +2 -1
- package/styled-client.js +3 -3
- package/styled.cjs +1 -1
- package/styled.d.ts +2 -2
- package/styled.js +22 -18
- package/element-factory-BCMNslLa.cjs +0 -1
- package/element-factory-CwnAXm6m.js +0 -49
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const K=require("react"),C=require("./dash-case-BSxADP5V.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;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { forwardRef as E, createElement as V } from "react";
|
2
|
+
import { d as C } from "./dash-case-BLMDQfZk.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
|
+
};
|
package/element-factory.d.ts
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
+
import { GeneratorProps } from '../../core/src/generator';
|
1
2
|
import { StyledComponentProps, Tag } from '../../core/src/types';
|
2
|
-
export declare const elementFactory: (tagName: Tag<any>, _className: string,
|
3
|
+
export declare const elementFactory: (tagName: Tag<any>, _className: string, _generatorProps: GeneratorProps, _additionalProps?: Record<PropertyKey, any>) => import('react').ForwardRefExoticComponent<Omit<StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
|
package/package.json
CHANGED
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 r=require("./element-factory-B9SpSdkZ.cjs"),l=(e,t,n="",o)=>r.elementFactory(e,t,o,{"data-component-name":n});exports.styledClient=l;
|
package/styled-client.d.ts
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
+
import { GeneratorProps } from '../../core/src/generator';
|
1
2
|
import { Tag } from '../../core/src/types';
|
2
|
-
export declare const styledClient: (tagName: Tag<any>, className: string, callerName
|
3
|
+
export declare const styledClient: (tagName: Tag<any>, className: string, callerName: string | undefined, generatorProps: GeneratorProps) => import('react').ForwardRefExoticComponent<Omit<import('../../core/src/types').StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
|
package/styled-client.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { e as
|
2
|
-
const
|
1
|
+
import { e as r } from "./element-factory-BQovXL0W.js";
|
2
|
+
const m = (e, t, n = "", o) => r(e, t, o, {
|
3
3
|
"data-component-name": n
|
4
4
|
});
|
5
5
|
export {
|
6
|
-
|
6
|
+
m as styledClient
|
7
7
|
};
|
package/styled.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 p=require("./parse-styles-CsUEXYf5.cjs"),h=require("./element-factory-B9SpSdkZ.cjs"),m=r=>Object.keys(r);class l{constructor(t,s){this.tagName=t,this.params=s}get hash(){return p.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?m(this._context.config.templates):[]}get css(){var a;const{base:t={},variants:s={},compoundVariants:e=[]}=this.params,n={...t,variants:s,compoundVariants:e};return p.parseStyles(n,`.${this.cssClassName}`,this.priority,(a=this._context)==null?void 0:a.config)}get props(){const{element:t}=this.params,s=this.params.variants?Object.keys(this.params.variants).map(a=>{var i;const o=(i=this.params.defaultVariants)==null?void 0:i[a];return o!==void 0?`${a}=${String(o)}`:a}):void 0,e=new Set([]),n=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return n&&n.forEach((a,o,i)=>{const c=i.at(1);c&&e.add(c)}),{element:t,variantKeys:s,propValueKeys:[...e]}}_withBuildContext(t){this._context=t;const{name:s,config:e}=t;return this._callerName=s,this}}const u=(r,t)=>{const s=new l(r,t),e=h.elementFactory(r,s.cssClassName,s.props,{"data-unoptimized-client-component":!0});return Object.assign(e,{generator:s}),e};exports.styled=u;
|
package/styled.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AllHTMLAttributes, ReactDOM, ReactNode } from 'react';
|
2
|
-
import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams,
|
2
|
+
import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams, ValueProps } from '../../core/src/types';
|
3
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 & ParentComponentProps<TAG>) | (TAG extends string ? {
|
4
4
|
ref: any;
|
5
|
-
} : never) |
|
5
|
+
} : never) | VariantProps<STYLE_PARAMS> | ValueProps | (TAG extends keyof ReactDOM ? ReactDOM[TAG] extends (...props: infer R) => any ? R[0] : TAG extends string ? AllHTMLAttributes<HTMLElement> : never : TAG extends string ? AllHTMLAttributes<HTMLElement> : never)) => ReactNode) & string;
|
package/styled.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import { t as
|
2
|
-
import { e as
|
3
|
-
const
|
4
|
-
class
|
1
|
+
import { t as p, p as h } from "./parse-styles-jRJiQaik.js";
|
2
|
+
import { e as m } from "./element-factory-BQovXL0W.js";
|
3
|
+
const l = (r) => Object.keys(r);
|
4
|
+
class u {
|
5
5
|
constructor(t, s) {
|
6
6
|
this.tagName = t, this.params = s;
|
7
7
|
}
|
8
8
|
get hash() {
|
9
|
-
return
|
9
|
+
return p(this.params.base || this.params);
|
10
10
|
}
|
11
11
|
get priority() {
|
12
12
|
var t;
|
@@ -24,22 +24,26 @@ class m {
|
|
24
24
|
}
|
25
25
|
get templateKeys() {
|
26
26
|
var t;
|
27
|
-
return (t = this._context) != null && t.config.templates ?
|
27
|
+
return (t = this._context) != null && t.config.templates ? l(this._context.config.templates) : [];
|
28
28
|
}
|
29
29
|
get css() {
|
30
|
-
var
|
30
|
+
var a;
|
31
31
|
const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, n = { ...t, variants: s, compoundVariants: e };
|
32
|
-
return
|
32
|
+
return h(n, `.${this.cssClassName}`, this.priority, (a = this._context) == null ? void 0 : a.config);
|
33
33
|
}
|
34
34
|
get props() {
|
35
|
-
const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((
|
36
|
-
var
|
37
|
-
const
|
38
|
-
return
|
39
|
-
}) : void 0;
|
40
|
-
return {
|
35
|
+
const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((a) => {
|
36
|
+
var i;
|
37
|
+
const o = (i = this.params.defaultVariants) == null ? void 0 : i[a];
|
38
|
+
return o !== void 0 ? `${a}=${String(o)}` : a;
|
39
|
+
}) : void 0, e = /* @__PURE__ */ new Set([]), n = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
|
40
|
+
return n && n.forEach((a, o, i) => {
|
41
|
+
const c = i.at(1);
|
42
|
+
c && e.add(c);
|
43
|
+
}), {
|
41
44
|
element: t,
|
42
|
-
variantKeys: s
|
45
|
+
variantKeys: s,
|
46
|
+
propValueKeys: [...e]
|
43
47
|
};
|
44
48
|
}
|
45
49
|
_withBuildContext(t) {
|
@@ -48,8 +52,8 @@ class m {
|
|
48
52
|
return this._callerName = s, this;
|
49
53
|
}
|
50
54
|
}
|
51
|
-
const
|
52
|
-
const s = new
|
55
|
+
const f = (r, t) => {
|
56
|
+
const s = new u(r, t), e = m(r, s.cssClassName, s.props, {
|
53
57
|
"data-unoptimized-client-component": !0
|
54
58
|
});
|
55
59
|
return Object.assign(e, {
|
@@ -57,5 +61,5 @@ const u = (a, t) => {
|
|
57
61
|
}), e;
|
58
62
|
};
|
59
63
|
export {
|
60
|
-
|
64
|
+
f as styled
|
61
65
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const w=require("react"),N=require("./dash-case-BSxADP5V.cjs");function E(t){var n,o,e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){var f=t.length;for(n=0;n<f;n++)t[n]&&(o=E(t[n]))&&(e&&(e+=" "),e+=o)}else for(o in t)t[o]&&(e&&(e+=" "),e+=o);return e}function q(){for(var t,n,o=0,e="",f=arguments.length;o<f;o++)(t=arguments[o])&&(n=E(t))&&(e&&(e+=" "),e+=n);return e}const A=["passVariantProps"],F=(t,n,o,e,f)=>{const $=({extend:c=t,element:b=o,className:p="",children:C,passVariantProps:j,cssValues:u,_vks:a=new Set,...d},O)=>{const s={passVariantProps:j};f&&Object.assign(s,f),d&&Object.assign(s,d);const g=new Set(p.split(" ")),l=typeof c=="function"||typeof c=="object",m=l&&"isStyled"in c,S=l?c:b||c;if(!S)throw new Error("No element provided");u&&(console.log(u),s.style||(s.style={}),Object.entries(u).forEach(([i,r])=>{const y=`--${N.dashCase(i)}`;s.style[y]=r})),e&&e.forEach(i=>{const[r,y]=i.split("=");d[r]!==void 0?(g.add(`${r}-${d[r]}`),l?a&&a.add(r):delete s[r]):y!==void 0&&g.add(`${r}-${y}`)}),a&&(!l||!m&&!j)?a.forEach(i=>delete s[i]):m&&Object.assign(s,{_vks:a}),m||A.forEach(i=>delete s[i]);const v=q(n,...g);return w.createElement(S,{element:l?b:void 0,className:v,ref:O,...s},C)},h=w.forwardRef($);return Object.assign(h,{isStyled:!0,className:n,toString:()=>`.${n}`}),h};exports.elementFactory=F;
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { forwardRef as C, createElement as v } from "react";
|
2
|
-
import { d as N } from "./dash-case-BLMDQfZk.js";
|
3
|
-
function S(t) {
|
4
|
-
var o, n, e = "";
|
5
|
-
if (typeof t == "string" || typeof t == "number") e += t;
|
6
|
-
else if (typeof t == "object") if (Array.isArray(t)) {
|
7
|
-
var f = t.length;
|
8
|
-
for (o = 0; o < f; o++) t[o] && (n = S(t[o])) && (e && (e += " "), e += n);
|
9
|
-
} else for (n in t) t[n] && (e && (e += " "), e += n);
|
10
|
-
return e;
|
11
|
-
}
|
12
|
-
function A() {
|
13
|
-
for (var t, o, n = 0, e = "", f = arguments.length; n < f; n++) (t = arguments[n]) && (o = S(t)) && (e && (e += " "), e += o);
|
14
|
-
return e;
|
15
|
-
}
|
16
|
-
const K = ["passVariantProps"], x = (t, o, n, e, f) => {
|
17
|
-
const b = C(({ extend: a = t, element: h = n, className: w = "", children: E, passVariantProps: j, cssValues: m, _vks: l = /* @__PURE__ */ new Set(), ...d }, $) => {
|
18
|
-
const r = { passVariantProps: j };
|
19
|
-
f && Object.assign(r, f), d && Object.assign(r, d);
|
20
|
-
const g = new Set(w.split(" ")), c = typeof a == "function" || typeof a == "object", u = c && "isStyled" in a, p = c ? a : h || a;
|
21
|
-
if (!p) throw new Error("No element provided");
|
22
|
-
m && (console.log(m), r.style || (r.style = {}), Object.entries(m).forEach(([i, s]) => {
|
23
|
-
const y = `--${N(i)}`;
|
24
|
-
r.style[y] = s;
|
25
|
-
})), e && e.forEach((i) => {
|
26
|
-
const [s, y] = i.split("=");
|
27
|
-
d[s] !== void 0 ? (g.add(`${s}-${d[s]}`), c ? l && l.add(s) : delete r[s]) : y !== void 0 && g.add(`${s}-${y}`);
|
28
|
-
}), l && (!c || !u && !j) ? l.forEach((i) => delete r[i]) : u && Object.assign(r, { _vks: l }), u || K.forEach((i) => delete r[i]);
|
29
|
-
const O = A(o, ...g);
|
30
|
-
return v(
|
31
|
-
p,
|
32
|
-
{
|
33
|
-
element: c ? h : void 0,
|
34
|
-
className: O,
|
35
|
-
ref: $,
|
36
|
-
...r
|
37
|
-
},
|
38
|
-
E
|
39
|
-
);
|
40
|
-
});
|
41
|
-
return Object.assign(b, {
|
42
|
-
isStyled: !0,
|
43
|
-
className: o,
|
44
|
-
toString: () => `.${o}`
|
45
|
-
}), b;
|
46
|
-
};
|
47
|
-
export {
|
48
|
-
x as e
|
49
|
-
};
|