@salty-css/react 0.0.1-alpha.123 → 0.0.1-alpha.125

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.
Files changed (2) hide show
  1. package/README.md +61 -30
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- ![Bannter](https://raw.githubusercontent.com/gist/tremppu/ef2b867907cbf262ab7373f41558a403/raw/7cc7dc697eb34342dc685d814eff6bc4d62796d2/salty-logo-svg-dvd.svg)
1
+ ![Bannter](https://raw.githubusercontent.com/gist/tremppu/ef2b867907cbf262ab7373f41558a403/raw/a2137de136ee2296e386682beb4487bba0f58a2f/salty-logo-svg-dvd.svg)
2
2
 
3
- # Salty CSS - Kinda sweet but yet spicy CSS-in-JS library
3
+ # Salty CSS - CSS-in-JS library that is kinda sweet
4
4
 
5
- In the world of frontend dev is there anything saltier than CSS? Salty CSS is built to provide better developer experience for developers looking for performant and feature rich CSS-in-JS solutions.
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
7
  ## Features
8
8
 
@@ -14,21 +14,46 @@ In the world of frontend dev is there anything saltier than CSS? Salty CSS is bu
14
14
 
15
15
  ## Get started
16
16
 
17
- - Initialize: `npx salty-css init [directory]`
17
+ Fastest way to get started with any framework is `npx salty-css init [directory]` command
18
+
19
+ - Next.js → [Next.js guide](#nextjs) + [Next.js example app](https://github.com/margarita-form/salty-css-website)
20
+ - React + Vite → [React + Vite guide](#react--vite) + [React example code](#code-examples)
21
+ - React + Webpack → Guide coming soon
22
+ ## Useful commands
18
23
  - Create component: `npx salty-css generate [filePath]`
19
24
  - Build: `npx salty-css build [directory]`
25
+ - Update Salty CSS packages: `npx salty-css up`
20
26
 
21
- ### Initialize
27
+ ## Salty CSS styled function
22
28
 
23
- Fastest way to get started with any framework is [npx salty-css init [directory]](#initialize-salty-css-for-a-project) command
29
+ ```ts
30
+ // components/wrapper.css.ts
31
+ import { styled } from '@salty-css/react/styled';
24
32
 
25
- - Next.js [Next.js guide](#nextjs) + [Next.js example app](https://github.com/margarita-form/salty-css-website)
26
- - React [React guide](#react) + [React example code](#code-examples)
27
- - Vite [Vite guide](#vite)
28
- - Webpack Guide coming soon
29
- - ESLint → Guide coming soon
33
+ // Define a component with styled function. First argument is the component name or existing component to extend and second argument is the object containing the styles and other options
34
+ export const Component = styled('div', {
35
+ className: 'wrapper', // Define custom class name that will be included for this component
36
+ element: 'section', // Define the html element that will be rendered for this component, overrides the first 'div' argument
37
+ base: {
38
+ // 👉 Add your CSS-in-JS base styles here! 👈
39
+ },
40
+ variants: {
41
+ // Define conditional styles that will be applied to the component based on the variant prop values
42
+ },
43
+ compoundVariants: [
44
+ // Define conditional styles that will be applied to the component based on the combination of variant prop values
45
+ ],
46
+ defaultVariants: {
47
+ // Set default variant prop values
48
+ },
49
+ defaultProps: {
50
+ // Add additional default props for the component (eg, id and other html element attributes)
51
+ },
52
+ passProps: true, // Pass variant props to the rendered element / parent component (default: false)
53
+ });
54
+ ```
30
55
 
31
- ### Salty CSS CLI
56
+ ## Salty CSS CLI
32
57
 
33
58
  In your existing repository you can use `npx salty-css [command]` to initialize a project, generate components, update related packages and build required files.
34
59
 
@@ -36,21 +61,25 @@ In your existing repository you can use `npx salty-css [command]` to initialize
36
61
  - Generate component → `npx salty-css update [version]` - Update @salty-css packages in your repository. Default version is "latest". Additional options like `--dir`, `--tag`, `--name` and `--className` are also supported.
37
62
  - Build files → `npx salty-css build [directory]` - Compile Salty CSS related files in your project. This should not be needed if you are using tools like Next.js or Vite
38
63
 
39
- ### Guides
40
64
 
41
- #### Next.js
65
+
66
+ ## Usage
67
+
68
+ ### Next.js
69
+
70
+ ![salty-next](https://github.com/user-attachments/assets/2cf6a93f-cdd5-4f5f-ab2e-3bc8bcfb83e8)
42
71
 
43
72
  Salty CSS provides Next.js App & Pages router support with full React Server Components support.
44
73
 
45
- ##### Add Salty CSS to Next.js
74
+ ### Add Salty CSS to Next.js
46
75
 
47
76
  1. In your existing Next.js repository you can run `npx salty-css init` to automatically configure Salty CSS.
48
77
  2. Create your first Salty CSS component with `npx salty-css generate [filePath]` (e.g. src/custom-wrapper)
49
78
  3. Import your component for example to `page.tsx` and see it working!
50
79
 
51
- And note: steps 2 & 3 are just to show how get things up and running, step 1 does all of the important stuff 🤯
80
+ And note: steps 2 & 3 are just to show how get new components up and running, step 1 does all of the important stuff 🤯
52
81
 
53
- ##### Manual configuration
82
+ #### Manual configuration
54
83
 
55
84
  1. For Next.js support install `npm i @salty-css/next @salty-css/core @salty-css/react`
56
85
  2. Create `salty.config.ts` to your app directory
@@ -65,11 +94,21 @@ And note: steps 2 & 3 are just to show how get things up and running, step 1 doe
65
94
 
66
95
  [Check out Next.js demo project](https://github.com/margarita-form/salty-css-website) or [react example code](#code-examples)
67
96
 
68
- #### Vite
97
+ ---
98
+
99
+ ### React + Vite
100
+
101
+ ![salty-vite-react](https://github.com/user-attachments/assets/12ec5b6a-0dcc-48fa-afc1-d337fc8f800c)
102
+
103
+ ### Add Salty CSS to your React + Vite app
104
+
105
+ 1. In your existing Vite repository you can run `npx salty-css init` to automatically configure Salty CSS.
106
+ 2. Create your first Salty CSS component with `npx salty-css generate [filePath]` (e.g. src/custom-wrapper)
107
+ 3. Import your component for example to `main.tsx` and see it working!
69
108
 
70
- In your existing Vite repository you can run `npx salty-css init` to automatically configure Salty CSS.
109
+ And note: steps 2 & 3 are just to show how get new components up and running, step 1 does all of the important stuff 🤯
71
110
 
72
- ##### Manual configuration
111
+ #### Manual configuration
73
112
 
74
113
  1. For Vite support install `npm i @salty-css/vite @salty-css/core`
75
114
  2. In `vite.config` add import for salty plugin `import { saltyPlugin } from '@salty-css/vite';` and then add `saltyPlugin(__dirname)` to your vite configuration plugins
@@ -77,18 +116,10 @@ In your existing Vite repository you can run `npx salty-css init` to automatical
77
116
  4. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
78
117
  5. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
79
118
 
80
- #### React
81
-
82
- In your existing React repository you can run `npx salty-css init` to automatically configure Salty CSS.
83
-
84
- ##### Manual configuration
85
-
86
- 1. Install related dependencies: `npm i @salty-css/core @salty-css/react`
87
- 2. Create `salty.config.ts` to your app directory
88
- 3. Configure your build tool to support Salty CSS ([Vite](#vite) or Webpack) or after changes run `npx salty-css build`
89
-
90
119
  [Check out react example code](#code-examples)
91
120
 
121
+ ----
122
+
92
123
  ### Create components
93
124
 
94
125
  1. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.123",
3
+ "version": "0.0.1-alpha.125",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@salty-css/core": "^0.0.1-alpha.123",
49
+ "@salty-css/core": "^0.0.1-alpha.125",
50
50
  "clsx": ">=2.x",
51
51
  "react": ">=19.x || >=18.3.x"
52
52
  }