@salty-css/react 0.0.1-alpha.224 → 0.0.1-alpha.226
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 +9 -2
- package/package.json +2 -2
- package/styled.cjs +1 -1
- package/styled.js +12 -12
package/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Is there anything saltier than CSS in frontend web development? Salty CSS is built to provide better developer experience for developers looking for performant and feature rich CSS-in-JS solutions.
|
6
6
|
|
7
|
-
[Get started](#get-started) | [API](#api) | [Website](https://salty-css.dev/) | [GitHub](https://github.com/margarita-form/salty-css) | [NPM](https://www.npmjs.com/package/@salty-css/core)
|
7
|
+
[Get started](#get-started) | [API](#api) | [Discord](https://discord.gg/R6kr4KxMhP) | [Website](https://salty-css.dev/) | [GitHub](https://github.com/margarita-form/salty-css) | [NPM](https://www.npmjs.com/package/@salty-css/core)
|
8
8
|
|
9
9
|
## Features
|
10
10
|
|
@@ -16,7 +16,13 @@ Is there anything saltier than CSS in frontend web development? Salty CSS is bui
|
|
16
16
|
|
17
17
|
## Get started
|
18
18
|
|
19
|
-
Fastest way to get started with any framework is
|
19
|
+
Fastest way to get started with any framework is
|
20
|
+
|
21
|
+
```bash
|
22
|
+
npx salty-css init [directory]
|
23
|
+
```
|
24
|
+
|
25
|
+
Other guides:
|
20
26
|
|
21
27
|
- Next.js → [Next.js guide](#nextjs) + [Next.js example app](https://github.com/margarita-form/salty-css-website)
|
22
28
|
- React + Vite → [React + Vite guide](#react--vite) + [React example code](#code-examples)
|
@@ -82,6 +88,7 @@ export const Component = styled('div', {
|
|
82
88
|
// Add additional default props for the component (eg, id and other html element attributes)
|
83
89
|
},
|
84
90
|
passProps: true, // Pass variant props to the rendered element / parent component (default: false)
|
91
|
+
priority: 1, // Override automatic priotity layer with a custom value (0-8), higher is considered more important
|
85
92
|
});
|
86
93
|
```
|
87
94
|
|
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.226",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
}
|
63
63
|
},
|
64
64
|
"dependencies": {
|
65
|
-
"@salty-css/core": "^0.0.1-alpha.
|
65
|
+
"@salty-css/core": "^0.0.1-alpha.226",
|
66
66
|
"clsx": ">=2.x",
|
67
67
|
"react": ">=19.x || >=18.3.x"
|
68
68
|
}
|
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-CD8r4Qz6.cjs"),
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-CD8r4Qz6.cjs"),h=require("./element-factory-DjYdX8Jd.cjs");class g extends m.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return this.params.priority?this.params.priority:typeof this.tagName=="function"||typeof this.tagName=="object"?(((e=this.tagName.generator)==null?void 0:e.priority)||0)+1:0}get clientProps(){const{element:e,variants:t={},compoundVariants:s=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:f}=this.buildContext,o=new Set([]),i=r=>{const a=d[r];a!==void 0?o.add(`${r}=${String(a)}`):o.add(r)};Object.keys(t).forEach(i),s.map(r=>Object.keys(r).forEach(i));const c=new Set([]);if(this.params.base){const r=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);r&&r.forEach(a=>{const p=a.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&c.add(p)})}return{element:e,variantKeys:[...o],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":f?void 0:y}}}}const b=(n,e)=>{const t=new g(n,e),s=h.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(s,{generator:t}),s};exports.styled=b;
|
package/styled.js
CHANGED
@@ -6,19 +6,19 @@ class g extends y {
|
|
6
6
|
}
|
7
7
|
get priority() {
|
8
8
|
var e;
|
9
|
-
return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((e = this.tagName.generator) == null ? void 0 : e.priority) || 0) + 1 : 0;
|
9
|
+
return this.params.priority ? this.params.priority : typeof this.tagName == "function" || typeof this.tagName == "object" ? (((e = this.tagName.generator) == null ? void 0 : e.priority) || 0) + 1 : 0;
|
10
10
|
}
|
11
11
|
get clientProps() {
|
12
|
-
const { element: e, variants: t = {}, compoundVariants:
|
13
|
-
const
|
14
|
-
|
12
|
+
const { element: e, variants: t = {}, compoundVariants: r = [], defaultVariants: d = {}, defaultProps: m = {}, passProps: f } = this.params, { callerName: l, isProduction: u } = this.buildContext, o = /* @__PURE__ */ new Set([]), i = (a) => {
|
13
|
+
const s = d[a];
|
14
|
+
s !== void 0 ? o.add(`${a}=${String(s)}`) : o.add(a);
|
15
15
|
};
|
16
|
-
Object.keys(t).forEach(i),
|
16
|
+
Object.keys(t).forEach(i), r.map((a) => Object.keys(a).forEach(i));
|
17
17
|
const c = /* @__PURE__ */ new Set([]);
|
18
18
|
if (this.params.base) {
|
19
19
|
const a = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
|
20
|
-
a && a.forEach((
|
21
|
-
const p =
|
20
|
+
a && a.forEach((s) => {
|
21
|
+
const p = s.replace(/\{props\.([\w\d]+)\}/gi, "$1");
|
22
22
|
p && c.add(p);
|
23
23
|
});
|
24
24
|
}
|
@@ -27,20 +27,20 @@ class g extends y {
|
|
27
27
|
variantKeys: [...o],
|
28
28
|
propValueKeys: [...c],
|
29
29
|
passProps: f,
|
30
|
-
defaultProps:
|
30
|
+
defaultProps: m,
|
31
31
|
attr: {
|
32
|
-
"data-component-name": u ? void 0 :
|
32
|
+
"data-component-name": u ? void 0 : l
|
33
33
|
}
|
34
34
|
};
|
35
35
|
}
|
36
36
|
}
|
37
37
|
const v = (n, e) => {
|
38
|
-
const t = new g(n, e),
|
38
|
+
const t = new g(n, e), r = h(n, t.cssClassName, t.clientProps, {
|
39
39
|
"data-unoptimized-client-component": !0
|
40
40
|
});
|
41
|
-
return Object.assign(
|
41
|
+
return Object.assign(r, {
|
42
42
|
generator: t
|
43
|
-
}),
|
43
|
+
}), r;
|
44
44
|
};
|
45
45
|
export {
|
46
46
|
v as styled
|