@salty-css/react 0.0.1-alpha.225 → 0.0.1-alpha.227
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 +6 -1
- package/class-name-client.cjs +1 -0
- package/class-name-client.d.ts +3 -0
- package/class-name-client.js +11 -0
- package/package.json +6 -2
- package/styled.cjs +1 -1
- package/styled.js +12 -12
package/README.md
CHANGED
@@ -19,7 +19,7 @@ Is there anything saltier than CSS in frontend web development? Salty CSS is bui
|
|
19
19
|
Fastest way to get started with any framework is
|
20
20
|
|
21
21
|
```bash
|
22
|
-
npx salty-css init
|
22
|
+
npx salty-css init
|
23
23
|
```
|
24
24
|
|
25
25
|
Other guides:
|
@@ -40,6 +40,10 @@ Other guides:
|
|
40
40
|
2. Salty CSS components created with styled function can extend non Salty CSS components (`export const CustomLink = styled(NextJSLink, { ... });`) but those components must take in `className` prop for styles to apply.
|
41
41
|
3. Among common types like `string` and `number`, CSS-in-JS properties in Salty CSS do support `functions` and `promises` as values (`styled('span', { base: { color: async () => 'red' } });`) but running asynchronous tasks or importing heavy 3rd party libraries into `*.css.ts` or `*.css.tsx` files can cause longer build times.
|
42
42
|
|
43
|
+
## Get support
|
44
|
+
|
45
|
+
To get help with problems, [Join Salty CSS Discord server](https://discord.gg/R6kr4KxMhP).
|
46
|
+
|
43
47
|
## API
|
44
48
|
|
45
49
|
### Component styling
|
@@ -88,6 +92,7 @@ export const Component = styled('div', {
|
|
88
92
|
// Add additional default props for the component (eg, id and other html element attributes)
|
89
93
|
},
|
90
94
|
passProps: true, // Pass variant props to the rendered element / parent component (default: false)
|
95
|
+
priority: 1, // Override automatic priotity layer with a custom value (0-8), higher is considered more important
|
91
96
|
});
|
92
97
|
```
|
93
98
|
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=t=>{const e=new String(t);return Object.assign(e,{get isClassName(){return!0}}),e};exports.className=s;
|
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.227",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -44,6 +44,10 @@
|
|
44
44
|
"import": "./class-name.js",
|
45
45
|
"require": "./class-name.cjs"
|
46
46
|
},
|
47
|
+
"./class-name-client": {
|
48
|
+
"import": "./class-name-client.js",
|
49
|
+
"require": "./class-name-client.cjs"
|
50
|
+
},
|
47
51
|
"./keyframes": {
|
48
52
|
"import": "./keyframes.js",
|
49
53
|
"require": "./keyframes.cjs"
|
@@ -62,7 +66,7 @@
|
|
62
66
|
}
|
63
67
|
},
|
64
68
|
"dependencies": {
|
65
|
-
"@salty-css/core": "^0.0.1-alpha.
|
69
|
+
"@salty-css/core": "^0.0.1-alpha.227",
|
66
70
|
"clsx": ">=2.x",
|
67
71
|
"react": ">=19.x || >=18.3.x"
|
68
72
|
}
|
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
|