@salty-css/react 0.0.1-alpha.276 → 0.0.1-alpha.278
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/dynamic-styles.cjs +2 -2
- package/dynamic-styles.d.ts +3 -2
- package/dynamic-styles.js +20 -18
- package/{element-factory-D5vMsSwp.js → element-factory-Bs1HmAhv.js} +17 -17
- package/element-factory-CvLrXNeg.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 +1 -1
- package/element-factory-BPI0pGIH.cjs +0 -1
package/dynamic-styles.cjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
2
|
-
`),
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),S=require("@salty-css/core/parsers"),g=require("@salty-css/core/util"),j=require("./clsx-C11secjj.cjs"),x=require("react"),o=e=>g.toHash(e),c=async(e,n)=>(await S.parseStyles(e,n)).join(`
|
2
|
+
`),d=async({as:e,scope:n,styles:s,...r})=>{if(e){const a=l=>typeof e=="string"?x.createElement(e,l):e(l);if(!s)return t.jsx(a,{...r});const i=o(s),m=await c(s,n||`.${i}`),y={...r,className:j.clsx(i,r.className)};return t.jsxs(t.Fragment,{children:[t.jsx("style",{children:m}),t.jsx(a,{...y})]})}if(!s)return null;const u=await c(s,n);return t.jsx("style",{children:u})};exports.DynamicStyles=d;exports.getDynamicStylesClassName=o;exports.getDynamicStylesCss=c;
|
package/dynamic-styles.d.ts
CHANGED
@@ -9,14 +9,15 @@ export declare const getDynamicStylesClassName: (styles: BaseStyles) => string;
|
|
9
9
|
* Note: this works only with server components.
|
10
10
|
*/
|
11
11
|
export declare const getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
|
12
|
+
type AnyComponent = (...args: any[]) => React.ReactNode;
|
12
13
|
interface DynamicStylesProps extends HTMLAttributes<HTMLElement> {
|
13
14
|
styles?: BaseStyles;
|
14
15
|
scope?: string;
|
15
|
-
as?:
|
16
|
+
as?: string | AnyComponent;
|
16
17
|
}
|
17
18
|
/**
|
18
19
|
* Add any dynamic styles to your app with a custom scope.
|
19
20
|
* Note: this works only with server components.
|
20
21
|
*/
|
21
|
-
export declare const DynamicStyles: ({ as
|
22
|
+
export declare const DynamicStyles: ({ as, scope, styles, ...rest }: DynamicStylesProps) => Promise<import("react/jsx-runtime").JSX.Element | null>;
|
22
23
|
export {};
|
package/dynamic-styles.js
CHANGED
@@ -1,23 +1,25 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { parseStyles as
|
3
|
-
import { toHash as
|
4
|
-
import { c as
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const
|
10
|
-
return /* @__PURE__ */
|
11
|
-
|
12
|
-
|
1
|
+
import { jsx as s, jsxs as f, Fragment as y } from "react/jsx-runtime";
|
2
|
+
import { parseStyles as u } from "@salty-css/core/parsers";
|
3
|
+
import { toHash as d } from "@salty-css/core/util";
|
4
|
+
import { c as g } from "./clsx-OuTLNxxd.js";
|
5
|
+
import { createElement as h } from "react";
|
6
|
+
const x = (t) => d(t), m = async (t, r) => (await u(t, r)).join(`
|
7
|
+
`), D = async ({ as: t, scope: r, styles: n, ...e }) => {
|
8
|
+
if (t) {
|
9
|
+
const c = (a) => typeof t == "string" ? h(t, a) : t(a);
|
10
|
+
if (!n) return /* @__PURE__ */ s(c, { ...e });
|
11
|
+
const o = x(n), l = await m(n, r || `.${o}`), p = { ...e, className: g(o, e.className) };
|
12
|
+
return /* @__PURE__ */ f(y, { children: [
|
13
|
+
/* @__PURE__ */ s("style", { children: l }),
|
14
|
+
/* @__PURE__ */ s(c, { ...p })
|
13
15
|
] });
|
14
16
|
}
|
15
|
-
if (!
|
16
|
-
const i = await
|
17
|
-
return /* @__PURE__ */
|
17
|
+
if (!n) return null;
|
18
|
+
const i = await m(n, r);
|
19
|
+
return /* @__PURE__ */ s("style", { children: i });
|
18
20
|
};
|
19
21
|
export {
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
D as DynamicStyles,
|
23
|
+
x as getDynamicStylesClassName,
|
24
|
+
m as getDynamicStylesCss
|
23
25
|
};
|
@@ -2,42 +2,42 @@ import { forwardRef as V, createElement as C } from "react";
|
|
2
2
|
import { c as N } from "./clsx-OuTLNxxd.js";
|
3
3
|
import { dashCase as R } from "@salty-css/core/util";
|
4
4
|
import { parseVariableTokens as p } from "@salty-css/core/parsers";
|
5
|
-
const q = ["passProps"],
|
5
|
+
const q = ["passProps"], D = (S, m = "", t = {}, y) => {
|
6
6
|
const b = V(({
|
7
7
|
extend: c = S,
|
8
8
|
element: h = t.element,
|
9
9
|
className: E = "",
|
10
10
|
children: K,
|
11
11
|
passProps: l = t.passProps,
|
12
|
-
_vks:
|
12
|
+
_vks: f = /* @__PURE__ */ new Set(),
|
13
13
|
...a
|
14
14
|
}, O) => {
|
15
15
|
const s = { passProps: l };
|
16
16
|
t.attr && Object.assign(s, t.attr), y && Object.assign(s, y), t.defaultProps && Object.assign(a, t.defaultProps), a && Object.assign(s, a);
|
17
|
-
const
|
17
|
+
const u = /* @__PURE__ */ new Set([...m.split(" "), ...E.split(" ")]), d = typeof c == "function" || typeof c == "object", r = d && "isStyled" in c, j = d ? c : h || c;
|
18
18
|
if (!j) throw new Error("No element provided");
|
19
|
-
const
|
20
|
-
s.style || (s.style =
|
21
|
-
const
|
22
|
-
|
19
|
+
const o = s.style || {};
|
20
|
+
s.style || (s.style = o), Object.entries(o).forEach(([e, i]) => {
|
21
|
+
const n = p(i);
|
22
|
+
n && (o[e] = n.transformed);
|
23
23
|
}), t.propValueKeys && t.propValueKeys.forEach((e) => {
|
24
|
-
const i = `css-${e}`,
|
25
|
-
if (
|
24
|
+
const i = `css-${e}`, n = a[i];
|
25
|
+
if (n === void 0) return;
|
26
26
|
const w = `--props-${R(e)}`;
|
27
|
-
|
27
|
+
o[w] = n, f && f.add(i);
|
28
28
|
}), t.variantKeys && t.variantKeys.forEach((e) => {
|
29
|
-
const [i,
|
30
|
-
a[i] !== void 0 ? (
|
31
|
-
}),
|
29
|
+
const [i, n] = e.split("=");
|
30
|
+
a[i] !== void 0 ? (u.add(`${i}-${a[i]}`), f && f.add(i)) : n !== void 0 && u.add(`${i}-${n}`);
|
31
|
+
}), f && (!d || !r) ? f.forEach((e) => {
|
32
32
|
if (!l) return delete s[e];
|
33
33
|
if (l !== !0 && !l.includes(e))
|
34
34
|
return delete s[e];
|
35
|
-
}) :
|
36
|
-
const $ = N(...
|
35
|
+
}) : r && Object.assign(s, { _vks: f }), r || q.forEach((e) => delete s[e]);
|
36
|
+
const $ = N(...u);
|
37
37
|
return C(
|
38
38
|
j,
|
39
39
|
{
|
40
|
-
element:
|
40
|
+
element: d ? h : void 0,
|
41
41
|
className: $,
|
42
42
|
ref: O,
|
43
43
|
...s
|
@@ -52,5 +52,5 @@ const q = ["passProps"], B = (S, m = "", t = {}, y) => {
|
|
52
52
|
}), b;
|
53
53
|
};
|
54
54
|
export {
|
55
|
-
|
55
|
+
D as e
|
56
56
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const S=require("react"),C=require("./clsx-C11secjj.cjs"),N=require("@salty-css/core/util"),F=require("@salty-css/core/parsers"),R=["passProps"],T=(E,y="",t={},m)=>{const K=({extend:a=E,element:h=t.element,className:O="",children:$,passProps:l=t.passProps,_vks:c=new Set,...f},w)=>{const s={passProps:l};t.attr&&Object.assign(s,t.attr),m&&Object.assign(s,m),t.defaultProps&&Object.assign(f,t.defaultProps),f&&Object.assign(s,f);const r=new Set([...y.split(" "),...O.split(" ")]),d=typeof a=="function"||typeof a=="object",o=d&&"isStyled"in a,j=d?a:h||a;if(!j)throw new Error("No element provided");const u=s.style||{};s.style||(s.style=u),Object.entries(u).forEach(([e,n])=>{const i=F.parseVariableTokens(n);i&&(u[e]=i.transformed)}),t.propValueKeys&&t.propValueKeys.forEach(e=>{const n=`css-${e}`,i=f[n];if(i===void 0)return;const q=`--props-${N.dashCase(e)}`;u[q]=i,c&&c.add(n)}),t.variantKeys&&t.variantKeys.forEach(e=>{const[n,i]=e.split("=");f[n]!==void 0?(r.add(`${n}-${f[n]}`),c&&c.add(n)):i!==void 0&&r.add(`${n}-${i}`)}),c&&(!d||!o)?c.forEach(e=>{if(!l)return delete s[e];if(l!==!0&&!l.includes(e))return delete s[e]}):o&&Object.assign(s,{_vks:c}),o||R.forEach(e=>delete s[e]);const V=C.clsx(...r);return S.createElement(j,{element:d?h:void 0,className:V,ref:w,...s},$)},b=S.forwardRef(K);return Object.assign(b,{isStyled:!0,className:y,toString:()=>`.${t.hash}`}),b};exports.elementFactory=T;
|
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.278",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -70,7 +70,7 @@
|
|
70
70
|
}
|
71
71
|
},
|
72
72
|
"dependencies": {
|
73
|
-
"@salty-css/core": "^0.0.1-alpha.
|
73
|
+
"@salty-css/core": "^0.0.1-alpha.278",
|
74
74
|
"clsx": ">=2.x",
|
75
75
|
"react": ">=19.x || >=18.3.x"
|
76
76
|
}
|
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-CvLrXNeg.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-CvLrXNeg.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-Bs1HmAhv.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 +0,0 @@
|
|
1
|
-
"use strict";const S=require("react"),C=require("./clsx-C11secjj.cjs"),N=require("@salty-css/core/util"),F=require("@salty-css/core/parsers"),R=["passProps"],v=(E,y="",t={},m)=>{const K=({extend:l=E,element:h=t.element,className:O="",children:$,passProps:f=t.passProps,_vks:c=new Set,...a},w)=>{const s={passProps:f};t.attr&&Object.assign(s,t.attr),m&&Object.assign(s,m),t.defaultProps&&Object.assign(a,t.defaultProps),a&&Object.assign(s,a);const o=new Set([...y.split(" "),...O.split(" ")]),d=typeof l=="function"||typeof l=="object",r=d&&"isStyled"in l,j=d?l:h||l;if(!j)throw new Error("No element provided");const u=s.style||{};s.style||(s.style=u),Object.entries(u).forEach(([e,i])=>{const n=F.parseVariableTokens(i);n&&(u[e]=n.transformed)}),t.propValueKeys&&t.propValueKeys.forEach(e=>{const i=`css-${e}`,n=a[i];if(n===void 0)return;const q=`--props-${N.dashCase(e)}`;u[q]=n,c&&c.add(i)}),t.variantKeys&&t.variantKeys.forEach(e=>{const[i,n]=e.split("=");a[i]!==void 0?(o.add(`${i}-${a[i]}`),c&&c.add(i)):n!==void 0&&o.add(`${i}-${n}`)}),c&&(!d||!r)?c.forEach(e=>{if(!f)return delete s[e];if(f!==!0&&!f.includes(e))return delete s[e]}):r&&Object.assign(s,{_vks:c}),r||R.forEach(e=>delete s[e]);const V=C.clsx(...o);return S.createElement(j,{element:d?h:void 0,className:V,ref:w,...s},$)},b=S.forwardRef(K);return Object.assign(b,{isStyled:!0,className:y,toString:()=>`.${t.hash}`}),b};exports.elementFactory=v;
|