@itamarshdev/reactwind 1.1.0 → 1.2.0
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 +21 -21
- package/dist/{chunk-KAWYX6WW.js → chunk-6MX4RX23.js} +4 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/jsx-dev-runtime.cjs +4 -0
- package/dist/jsx-dev-runtime.d.cts +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.cjs +4 -0
- package/dist/jsx-runtime.d.cts +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/{types-CBbQP9uE.d.ts → types-DuRT-DEW.d.ts} +3 -0
- package/dist/{types-Bb5v_nmy.d.cts → types-I6XgQvJp.d.cts} +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ReactWind
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/reactwind)
|
|
4
|
-
[](https://github.com/
|
|
5
|
-
[](https://
|
|
6
|
-
[](https://www.npmjs.com/package/@itamarshdev/reactwind)
|
|
4
|
+
[](https://github.com/ItamarShDev/reactwind/blob/main/LICENSE)
|
|
5
|
+
[](https://ItamarShDev.github.io/reactwind/storybook/)
|
|
6
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
7
7
|
|
|
8
8
|
**ReactWind** is a JSX runtime wrapper that brings the power of Tailwind CSS shorthands and array-based classNames directly to your React components. No more template literal spaghetti or complex utility merges.
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
npm install @itamarshdev/reactwind
|
|
@@ -20,20 +20,20 @@ yarn add @itamarshdev/reactwind
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Features
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
25
|
+
- **Prop-based Styling**: Use Tailwind utilities as props: `<div flex bg="blue-500" p={4} />`.
|
|
26
|
+
- **Array ClassNames**: Pass classes as clean arrays: `classNames={['text-center', isActive && 'font-bold']}`.
|
|
27
|
+
- **Zero Runtime (Concept)**: Designed for minimal overhead. Most transformations happen at the JSX level.
|
|
28
|
+
- **TypeScript First**: Automatic types for nearly all Tailwind utilities.
|
|
29
|
+
- **Framework Agnostic**: Works with Vite, Next.js, and any stack supporting custom JSX runtimes.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## Setup
|
|
35
35
|
|
|
36
|
-
Configure your build tool to use
|
|
36
|
+
Configure your build tool to use `@itamarshdev/reactwind` as your JSX import source.
|
|
37
37
|
|
|
38
38
|
### Vite
|
|
39
39
|
|
|
@@ -41,7 +41,7 @@ Configure your build tool to use `reactwind` as your JSX import source.
|
|
|
41
41
|
// vite.config.ts
|
|
42
42
|
export default defineConfig({
|
|
43
43
|
esbuild: {
|
|
44
|
-
jsxImportSource: 'reactwind',
|
|
44
|
+
jsxImportSource: '@itamarshdev/reactwind',
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
47
|
```
|
|
@@ -53,14 +53,14 @@ export default defineConfig({
|
|
|
53
53
|
{
|
|
54
54
|
"compilerOptions": {
|
|
55
55
|
"jsx": "react-jsx",
|
|
56
|
-
"jsxImportSource": "reactwind"
|
|
56
|
+
"jsxImportSource": "@itamarshdev/reactwind"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## Usage Examples
|
|
64
64
|
|
|
65
65
|
### 1. Shorthand Props & Booleans
|
|
66
66
|
|
|
@@ -132,7 +132,7 @@ export default defineConfig({
|
|
|
132
132
|
|
|
133
133
|
---
|
|
134
134
|
|
|
135
|
-
##
|
|
135
|
+
## Goals
|
|
136
136
|
|
|
137
137
|
ReactWind aims to improve the developer experience of styling with Tailwind CSS by:
|
|
138
138
|
1. **Removing syntactic noise**: Replacing long `className` strings with structured props.
|
|
@@ -141,10 +141,10 @@ ReactWind aims to improve the developer experience of styling with Tailwind CSS
|
|
|
141
141
|
|
|
142
142
|
---
|
|
143
143
|
|
|
144
|
-
##
|
|
144
|
+
## Contributing
|
|
145
145
|
|
|
146
146
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
147
147
|
|
|
148
|
-
##
|
|
148
|
+
## License
|
|
149
149
|
|
|
150
|
-
MIT © [
|
|
150
|
+
MIT © [ItamarShDev](https://github.com/ItamarShDev/reactwind)
|
|
@@ -260,6 +260,10 @@ var withClassNames = (props) => {
|
|
|
260
260
|
if (!props) {
|
|
261
261
|
return props;
|
|
262
262
|
}
|
|
263
|
+
if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
|
|
264
|
+
const { sx, ...restProps } = props;
|
|
265
|
+
return withClassNames({ ...restProps, ...sx });
|
|
266
|
+
}
|
|
263
267
|
const hasClassNames = "classNames" in props;
|
|
264
268
|
const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
|
|
265
269
|
const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
|
package/dist/index.cjs
CHANGED
|
@@ -286,6 +286,10 @@ var withClassNames = (props) => {
|
|
|
286
286
|
if (!props) {
|
|
287
287
|
return props;
|
|
288
288
|
}
|
|
289
|
+
if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
|
|
290
|
+
const { sx, ...restProps } = props;
|
|
291
|
+
return withClassNames({ ...restProps, ...sx });
|
|
292
|
+
}
|
|
289
293
|
const hasClassNames = "classNames" in props;
|
|
290
294
|
const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
|
|
291
295
|
const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
|
package/dist/index.d.cts
CHANGED
|
@@ -49,13 +49,17 @@ interface LayoutProps {
|
|
|
49
49
|
shrink?: boolean;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
type SxProp = Partial<ValueProps & LayoutProps>;
|
|
53
|
+
|
|
52
54
|
declare module "react" {
|
|
53
55
|
interface HTMLAttributes<T> extends LayoutProps, ValueProps {
|
|
54
56
|
classNames?: (TailwindClass | string)[];
|
|
57
|
+
sx?: SxProp;
|
|
55
58
|
}
|
|
56
59
|
interface SVGAttributes<T> extends LayoutProps, ValueProps {
|
|
57
60
|
classNames?: (TailwindClass | string)[];
|
|
61
|
+
sx?: SxProp;
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
export type { LayoutProps, ValueProps };
|
|
65
|
+
export type { LayoutProps, SxProp, ValueProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -49,13 +49,17 @@ interface LayoutProps {
|
|
|
49
49
|
shrink?: boolean;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
type SxProp = Partial<ValueProps & LayoutProps>;
|
|
53
|
+
|
|
52
54
|
declare module "react" {
|
|
53
55
|
interface HTMLAttributes<T> extends LayoutProps, ValueProps {
|
|
54
56
|
classNames?: (TailwindClass | string)[];
|
|
57
|
+
sx?: SxProp;
|
|
55
58
|
}
|
|
56
59
|
interface SVGAttributes<T> extends LayoutProps, ValueProps {
|
|
57
60
|
classNames?: (TailwindClass | string)[];
|
|
61
|
+
sx?: SxProp;
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
export type { LayoutProps, ValueProps };
|
|
65
|
+
export type { LayoutProps, SxProp, ValueProps };
|
package/dist/index.js
CHANGED
package/dist/jsx-dev-runtime.cjs
CHANGED
|
@@ -288,6 +288,10 @@ var withClassNames = (props) => {
|
|
|
288
288
|
if (!props) {
|
|
289
289
|
return props;
|
|
290
290
|
}
|
|
291
|
+
if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
|
|
292
|
+
const { sx, ...restProps } = props;
|
|
293
|
+
return withClassNames({ ...restProps, ...sx });
|
|
294
|
+
}
|
|
291
295
|
const hasClassNames = "classNames" in props;
|
|
292
296
|
const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
|
|
293
297
|
const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
|
package/dist/jsx-dev-runtime.js
CHANGED
package/dist/jsx-runtime.cjs
CHANGED
|
@@ -289,6 +289,10 @@ var withClassNames = (props) => {
|
|
|
289
289
|
if (!props) {
|
|
290
290
|
return props;
|
|
291
291
|
}
|
|
292
|
+
if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
|
|
293
|
+
const { sx, ...restProps } = props;
|
|
294
|
+
return withClassNames({ ...restProps, ...sx });
|
|
295
|
+
}
|
|
292
296
|
const hasClassNames = "classNames" in props;
|
|
293
297
|
const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
|
|
294
298
|
const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
|
package/dist/jsx-runtime.d.cts
CHANGED
package/dist/jsx-runtime.d.ts
CHANGED
package/dist/jsx-runtime.js
CHANGED
|
@@ -233,13 +233,16 @@ interface ModifierProps {
|
|
|
233
233
|
dark?: ModifierValue;
|
|
234
234
|
print?: ModifierValue;
|
|
235
235
|
}
|
|
236
|
+
type SxProp = Partial<ValueProps & LayoutProps & ModifierProps>;
|
|
236
237
|
declare module "react" {
|
|
237
238
|
interface HTMLAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
|
|
238
239
|
classNames?: (TailwindClass | string)[];
|
|
240
|
+
sx?: SxProp;
|
|
239
241
|
[key: string]: any;
|
|
240
242
|
}
|
|
241
243
|
interface SVGAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
|
|
242
244
|
classNames?: (TailwindClass | string)[];
|
|
245
|
+
sx?: SxProp;
|
|
243
246
|
[key: string]: any;
|
|
244
247
|
}
|
|
245
248
|
}
|
|
@@ -233,13 +233,16 @@ interface ModifierProps {
|
|
|
233
233
|
dark?: ModifierValue;
|
|
234
234
|
print?: ModifierValue;
|
|
235
235
|
}
|
|
236
|
+
type SxProp = Partial<ValueProps & LayoutProps & ModifierProps>;
|
|
236
237
|
declare module "react" {
|
|
237
238
|
interface HTMLAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
|
|
238
239
|
classNames?: (TailwindClass | string)[];
|
|
240
|
+
sx?: SxProp;
|
|
239
241
|
[key: string]: any;
|
|
240
242
|
}
|
|
241
243
|
interface SVGAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
|
|
242
244
|
classNames?: (TailwindClass | string)[];
|
|
245
|
+
sx?: SxProp;
|
|
243
246
|
[key: string]: any;
|
|
244
247
|
}
|
|
245
248
|
}
|