@salty-css/react 0.1.0-alpha.33 → 0.1.0-alpha.35
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/README.md +2 -0
- package/element-factory-Ccd9WJOa.js +68 -0
- package/element-factory-CgP5yEab.cjs +1 -0
- package/package.json +3 -6
- package/styled-client.cjs +1 -1
- package/styled-client.js +1 -1
- package/styled.cjs +1 -1
- package/styled.js +1 -1
- package/clsx-C11secjj.cjs +0 -1
- package/clsx-OuTLNxxd.js +0 -16
- package/dynamic-styles.cjs +0 -1
- package/dynamic-styles.d.ts +0 -15
- package/dynamic-styles.js +0 -24
- package/element-factory-BPI0pGIH.cjs +0 -1
- package/element-factory-D5vMsSwp.js +0 -56
package/README.md
CHANGED
|
@@ -617,6 +617,8 @@ And note: steps 2 & 3 are just to show how get new components up and running, st
|
|
|
617
617
|
- **Next.js 15:** In `next.config.ts` add import for salty plugin `import { withSaltyCss } from '@salty-css/next';` and then add `withSaltyCss` to wrap your nextConfig export like so `export default withSaltyCss(nextConfig);`
|
|
618
618
|
- **Next.js 14 and older:** In `next.config.js` add import for salty plugin `const { withSaltyCss } = require('@salty-css/next');` and then add `withSaltyCss` to wrap your nextConfig export like so `module.exports = withSaltyCss(nextConfig);`
|
|
619
619
|
|
|
620
|
+
Both Webpack and Turbopack are supported. `withSaltyCss` auto-detects which bundler Next.js is using (`next dev --turbopack` sets `process.env.TURBOPACK=1`), so no extra config is required. To force a specific bundler, pass `{ bundler: 'webpack' | 'turbopack' }` as the second argument.
|
|
621
|
+
|
|
620
622
|
4. Make sure that `salty.config.ts` and `next.config.ts` are in the same folder!
|
|
621
623
|
5. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
|
|
622
624
|
6. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { forwardRef as C, createElement as N } from "react";
|
|
2
|
+
import { dashCase as p } from "@salty-css/core/util";
|
|
3
|
+
import { parseVariableTokens as g } from "@salty-css/core/parsers";
|
|
4
|
+
function K(i) {
|
|
5
|
+
var n, e, t = "";
|
|
6
|
+
if (typeof i == "string" || typeof i == "number") t += i;
|
|
7
|
+
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
8
|
+
var d = i.length;
|
|
9
|
+
for (n = 0; n < d; n++) i[n] && (e = K(i[n])) && (t && (t += " "), t += e);
|
|
10
|
+
} else for (e in i) i[e] && (t && (t += " "), t += e);
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
function A() {
|
|
14
|
+
for (var i, n, e = 0, t = "", d = arguments.length; e < d; e++) (i = arguments[e]) && (n = K(i)) && (t && (t += " "), t += n);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
const R = ["passProps"], z = (i, n = "", e = {}, t) => {
|
|
18
|
+
const j = C(({
|
|
19
|
+
extend: o = i,
|
|
20
|
+
element: S = e.element,
|
|
21
|
+
className: O = "",
|
|
22
|
+
children: $,
|
|
23
|
+
passProps: u = e.passProps,
|
|
24
|
+
_vks: l = /* @__PURE__ */ new Set(),
|
|
25
|
+
...r
|
|
26
|
+
}, w) => {
|
|
27
|
+
const f = { passProps: u };
|
|
28
|
+
e.attr && Object.assign(f, e.attr), t && Object.assign(f, t), e.defaultProps && Object.assign(r, e.defaultProps), r && Object.assign(f, r);
|
|
29
|
+
const b = /* @__PURE__ */ new Set([...n.split(" "), ...O.split(" ")]), y = typeof o == "function" || typeof o == "object", h = y && "isStyled" in o, E = y ? o : S || o;
|
|
30
|
+
if (!E) throw new Error("No element provided");
|
|
31
|
+
const m = f.style || {};
|
|
32
|
+
f.style || (f.style = m), Object.entries(m).forEach(([s, a]) => {
|
|
33
|
+
const c = g(a);
|
|
34
|
+
c && (m[s] = c.transformed);
|
|
35
|
+
}), e.propValueKeys && e.propValueKeys.forEach((s) => {
|
|
36
|
+
const a = `css-${s}`, c = r[a];
|
|
37
|
+
if (c === void 0) return;
|
|
38
|
+
const v = `--props-${p(s)}`;
|
|
39
|
+
m[v] = c, l && l.add(a);
|
|
40
|
+
}), e.variantKeys && e.variantKeys.forEach((s) => {
|
|
41
|
+
const [a, c] = s.split("=");
|
|
42
|
+
r[a] !== void 0 ? (b.add(`${a}-${r[a]}`), l && l.add(a)) : c !== void 0 && b.add(`${a}-${c}`);
|
|
43
|
+
}), l && (!y || !h) ? l.forEach((s) => {
|
|
44
|
+
if (!u) return delete f[s];
|
|
45
|
+
if (u !== !0 && !u.includes(s))
|
|
46
|
+
return delete f[s];
|
|
47
|
+
}) : h && Object.assign(f, { _vks: l }), h || R.forEach((s) => delete f[s]);
|
|
48
|
+
const V = A(...b);
|
|
49
|
+
return N(
|
|
50
|
+
E,
|
|
51
|
+
{
|
|
52
|
+
element: y ? S : void 0,
|
|
53
|
+
className: V,
|
|
54
|
+
ref: w,
|
|
55
|
+
...f
|
|
56
|
+
},
|
|
57
|
+
$
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
return Object.assign(j, {
|
|
61
|
+
isStyled: !0,
|
|
62
|
+
className: n,
|
|
63
|
+
toString: () => `.${e.hash}`
|
|
64
|
+
}), j;
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
z as e
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const K=require("react"),C=require("@salty-css/core/util"),N=require("@salty-css/core/parsers");function O(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=O(s[n]))&&(t&&(t+=" "),t+=e)}else for(e in s)s[e]&&(t&&(t+=" "),t+=e);return t}function g(){for(var s,n,e=0,t="",o=arguments.length;e<o;e++)(s=arguments[e])&&(n=O(s))&&(t&&(t+=" "),t+=n);return t}const A=["passProps"],F=(s,n="",e={},t)=>{const o=({extend:u=s,element:S=e.element,className:$="",children:w,passProps:d=e.passProps,_vks:l=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([...n.split(" "),...$.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 c=N.parseVariableTokens(a);c&&(m[i]=c.transformed)}),e.propValueKeys&&e.propValueKeys.forEach(i=>{const a=`css-${i}`,c=r[a];if(c===void 0)return;const v=`--props-${C.dashCase(i)}`;m[v]=c,l&&l.add(a)}),e.variantKeys&&e.variantKeys.forEach(i=>{const[a,c]=i.split("=");r[a]!==void 0?(b.add(`${a}-${r[a]}`),l&&l.add(a)):c!==void 0&&b.add(`${a}-${c}`)}),l&&(!y||!h)?l.forEach(i=>{if(!d)return delete f[i];if(d!==!0&&!d.includes(i))return delete f[i]}):h&&Object.assign(f,{_vks:l}),h||A.forEach(i=>delete f[i]);const q=g(...b);return K.createElement(E,{element:y?S:void 0,className:q,ref:V,...f},w)},j=K.forwardRef(o);return Object.assign(j,{isStyled:!0,className:n,toString:()=>`.${e.hash}`}),j};exports.elementFactory=F;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salty-css/react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.35",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -64,10 +64,6 @@
|
|
|
64
64
|
"import": "./helpers.js",
|
|
65
65
|
"require": "./helpers.cjs"
|
|
66
66
|
},
|
|
67
|
-
"./dynamic-styles": {
|
|
68
|
-
"import": "./dynamic-styles.js",
|
|
69
|
-
"require": "./dynamic-styles.cjs"
|
|
70
|
-
},
|
|
71
67
|
"./runtime": {
|
|
72
68
|
"import": "./runtime.js",
|
|
73
69
|
"require": "./runtime.cjs"
|
|
@@ -78,7 +74,8 @@
|
|
|
78
74
|
}
|
|
79
75
|
},
|
|
80
76
|
"dependencies": {
|
|
81
|
-
"@salty-css/core": "0.1.0-alpha.
|
|
77
|
+
"@salty-css/core": "0.1.0-alpha.35",
|
|
78
|
+
"@testing-library/react": "^16.3.2",
|
|
82
79
|
"clsx": ">=2.x",
|
|
83
80
|
"react": ">=19.x || >=18.3.x"
|
|
84
81
|
},
|
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-CgP5yEab.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-CgP5yEab.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-Ccd9WJOa.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
|
package/clsx-C11secjj.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function i(r){var f,n,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var s=r.length;for(f=0;f<s;f++)r[f]&&(n=i(r[f]))&&(t&&(t+=" "),t+=n)}else for(n in r)r[n]&&(t&&(t+=" "),t+=n);return t}function o(){for(var r,f,n=0,t="",s=arguments.length;n<s;n++)(r=arguments[n])&&(f=i(r))&&(t&&(t+=" "),t+=f);return t}exports.clsx=o;
|
package/clsx-OuTLNxxd.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
function a(r) {
|
|
2
|
-
var f, n, t = "";
|
|
3
|
-
if (typeof r == "string" || typeof r == "number") t += r;
|
|
4
|
-
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
5
|
-
var o = r.length;
|
|
6
|
-
for (f = 0; f < o; f++) r[f] && (n = a(r[f])) && (t && (t += " "), t += n);
|
|
7
|
-
} else for (n in r) r[n] && (t && (t += " "), t += n);
|
|
8
|
-
return t;
|
|
9
|
-
}
|
|
10
|
-
function i() {
|
|
11
|
-
for (var r, f, n = 0, t = "", o = arguments.length; n < o; n++) (r = arguments[n]) && (f = a(r)) && (t && (t += " "), t += f);
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
i as c
|
|
16
|
-
};
|
package/dynamic-styles.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@salty-css/core/css/dynamic-styles"),u=require("./clsx-C11secjj.cjs"),g=require("react"),S=async({as:n,scope:r,styles:t,...c})=>{if(n){const a=l=>typeof n=="string"?g.createElement(n,l):n(l);if(!t)return e.jsx(a,{...c});const i=s.getDynamicStylesClassName(t),m=await s.getDynamicStylesCss(t,r||`.${i}`),o={...c,className:u.clsx(i,c.className)};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:m}),e.jsx(a,{...o})]})}if(!t)return null;const y=await s.getDynamicStylesCss(t,r);return e.jsx("style",{children:y})};Object.defineProperty(exports,"getDynamicStylesClassName",{enumerable:!0,get:()=>s.getDynamicStylesClassName});Object.defineProperty(exports,"getDynamicStylesCss",{enumerable:!0,get:()=>s.getDynamicStylesCss});exports.DynamicStyles=S;
|
package/dynamic-styles.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseStyles } from '@salty-css/core/types';
|
|
2
|
-
import { getDynamicStylesClassName, getDynamicStylesCss } from '@salty-css/core/css/dynamic-styles';
|
|
3
|
-
import { HTMLAttributes } from 'react';
|
|
4
|
-
export { getDynamicStylesClassName, getDynamicStylesCss };
|
|
5
|
-
type AnyComponent = (...args: any[]) => React.ReactNode;
|
|
6
|
-
interface DynamicStylesProps extends HTMLAttributes<HTMLElement> {
|
|
7
|
-
styles?: BaseStyles;
|
|
8
|
-
scope?: string;
|
|
9
|
-
as?: string | AnyComponent;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Add any dynamic styles to your app with a custom scope.
|
|
13
|
-
* Note: this works only with server components.
|
|
14
|
-
*/
|
|
15
|
-
export declare const DynamicStyles: ({ as, scope, styles, ...rest }: DynamicStylesProps) => Promise<import("react/jsx-runtime").JSX.Element | null>;
|
package/dynamic-styles.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as n, jsxs as f, Fragment as p } from "react/jsx-runtime";
|
|
2
|
-
import { getDynamicStylesClassName as g, getDynamicStylesCss as o } from "@salty-css/core/css/dynamic-styles";
|
|
3
|
-
import { getDynamicStylesClassName as w, getDynamicStylesCss as E } from "@salty-css/core/css/dynamic-styles";
|
|
4
|
-
import { c as u } from "./clsx-OuTLNxxd.js";
|
|
5
|
-
import { createElement as x } from "react";
|
|
6
|
-
const d = async ({ as: e, scope: r, styles: t, ...s }) => {
|
|
7
|
-
if (e) {
|
|
8
|
-
const c = (a) => typeof e == "string" ? x(e, a) : e(a);
|
|
9
|
-
if (!t) return /* @__PURE__ */ n(c, { ...s });
|
|
10
|
-
const m = g(t), l = await o(t, r || `.${m}`), y = { ...s, className: u(m, s.className) };
|
|
11
|
-
return /* @__PURE__ */ f(p, { children: [
|
|
12
|
-
/* @__PURE__ */ n("style", { children: l }),
|
|
13
|
-
/* @__PURE__ */ n(c, { ...y })
|
|
14
|
-
] });
|
|
15
|
-
}
|
|
16
|
-
if (!t) return null;
|
|
17
|
-
const i = await o(t, r);
|
|
18
|
-
return /* @__PURE__ */ n("style", { children: i });
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
d as DynamicStyles,
|
|
22
|
-
w as getDynamicStylesClassName,
|
|
23
|
-
E as getDynamicStylesCss
|
|
24
|
-
};
|
|
@@ -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;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { forwardRef as V, createElement as C } from "react";
|
|
2
|
-
import { c as N } from "./clsx-OuTLNxxd.js";
|
|
3
|
-
import { dashCase as R } from "@salty-css/core/util";
|
|
4
|
-
import { parseVariableTokens as p } from "@salty-css/core/parsers";
|
|
5
|
-
const q = ["passProps"], B = (S, m = "", t = {}, y) => {
|
|
6
|
-
const b = V(({
|
|
7
|
-
extend: c = S,
|
|
8
|
-
element: h = t.element,
|
|
9
|
-
className: E = "",
|
|
10
|
-
children: K,
|
|
11
|
-
passProps: l = t.passProps,
|
|
12
|
-
_vks: n = /* @__PURE__ */ new Set(),
|
|
13
|
-
...a
|
|
14
|
-
}, O) => {
|
|
15
|
-
const s = { passProps: l };
|
|
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 r = /* @__PURE__ */ new Set([...m.split(" "), ...E.split(" ")]), o = typeof c == "function" || typeof c == "object", u = o && "isStyled" in c, j = o ? c : h || c;
|
|
18
|
-
if (!j) throw new Error("No element provided");
|
|
19
|
-
const d = s.style || {};
|
|
20
|
-
s.style || (s.style = d), Object.entries(d).forEach(([e, i]) => {
|
|
21
|
-
const f = p(i);
|
|
22
|
-
f && (d[e] = f.transformed);
|
|
23
|
-
}), t.propValueKeys && t.propValueKeys.forEach((e) => {
|
|
24
|
-
const i = `css-${e}`, f = a[i];
|
|
25
|
-
if (f === void 0) return;
|
|
26
|
-
const w = `--props-${R(e)}`;
|
|
27
|
-
d[w] = f, n && n.add(i);
|
|
28
|
-
}), t.variantKeys && t.variantKeys.forEach((e) => {
|
|
29
|
-
const [i, f] = e.split("=");
|
|
30
|
-
a[i] !== void 0 ? (r.add(`${i}-${a[i]}`), n && n.add(i)) : f !== void 0 && r.add(`${i}-${f}`);
|
|
31
|
-
}), n && (!o || !u) ? n.forEach((e) => {
|
|
32
|
-
if (!l) return delete s[e];
|
|
33
|
-
if (l !== !0 && !l.includes(e))
|
|
34
|
-
return delete s[e];
|
|
35
|
-
}) : u && Object.assign(s, { _vks: n }), u || q.forEach((e) => delete s[e]);
|
|
36
|
-
const $ = N(...r);
|
|
37
|
-
return C(
|
|
38
|
-
j,
|
|
39
|
-
{
|
|
40
|
-
element: o ? h : void 0,
|
|
41
|
-
className: $,
|
|
42
|
-
ref: O,
|
|
43
|
-
...s
|
|
44
|
-
},
|
|
45
|
-
K
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
return Object.assign(b, {
|
|
49
|
-
isStyled: !0,
|
|
50
|
-
className: m,
|
|
51
|
-
toString: () => `.${t.hash}`
|
|
52
|
-
}), b;
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
B as e
|
|
56
|
-
};
|