salty-css 0.0.1-alpha.30 → 0.0.1-alpha.32

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 +152 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # Salty CSS - Kinda sweet but yet spicy CSS-in-JS library 🧂
2
+
3
+ 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.
4
+
5
+ ## Features
6
+
7
+ - Build time compilation to achieve awesome runtime performance and minimal size
8
+ - Next.js, React Server Components, Vite and Webpack support
9
+ - Type safety with out of the box TypeScript and ESLint plugin
10
+ - Advanced CSS variables configuration to allow smooth token usage
11
+ - Style templates to create reusable styles easily
12
+
13
+ ## Get started
14
+
15
+ ### Quick way of using `salty-css` CLI
16
+
17
+ #### Initialize Salty CSS for a project
18
+
19
+ In your repository run `npx salty-css init [directory]` which installs required salty-css packages to the current directory and creates project files to the provided directory. Directory can be left blank if you want files to be created to the current directory.
20
+
21
+ #### Create components
22
+
23
+ Components can be created with `npx salty-css generate [filePath]` which then creates a new Salty CSS component file to the specified path. Additional options like `--dir, --tag, --name and --className` are also supported. Read more about them with `npx salty-css generate --help`
24
+
25
+ #### Build / Compile Salty CSS
26
+
27
+ If you want to manually build your project that can be done by running `npx salty-css build [directory]`
28
+
29
+ #### Update Salty CSS packages
30
+
31
+ To ease the pain of package updates all Salty CSS packages can be updated with `npx salty-css update`
32
+
33
+ ### Manual work
34
+
35
+ #### React
36
+
37
+ 1. Install related dependencies: `npm i @salty-css/core @salty-css/react`
38
+ 2. Create `salty.config.ts` to your app directory
39
+
40
+ #### Vite
41
+
42
+ 1. First check the instructions for React
43
+ 2. For Vite support install `npm i -D @salty-css/vite`
44
+ 3. In `vite.config.ts` add import for salty plugin `import { saltyPlugin } from '@salty-css/vite';` and then add `saltyPlugin(__dirname)` to your vite configuration plugins
45
+ 4. Make sure that `salty.config.ts` and `vite.config.ts` are in the same folder!
46
+
47
+ ### Create components
48
+
49
+ 1. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
50
+
51
+ ## Code examples
52
+
53
+ ### Basic usage example with Button
54
+
55
+ **Salty config**
56
+
57
+ ```tsx
58
+ import { defineConfig } from '@salty-css/core/config';
59
+
60
+ export const config = defineConfig({
61
+ variables: {
62
+ colors: {
63
+ brand: '#111',
64
+ highlight: 'yellow',
65
+ },
66
+ },
67
+ global: {
68
+ html: {
69
+ backgroundColor: '#f8f8f8',
70
+ },
71
+ },
72
+ });
73
+ ```
74
+
75
+ **Your React component file**
76
+
77
+ ```tsx
78
+ import { Wrapper } from '../components/wrapper/wrapper.css';
79
+ import { Button } from '../components/button/button.css';
80
+
81
+ export const IndexPage = () => {
82
+ return (
83
+ <Wrapper>
84
+ <Button variant="solid" onClick={() => alert('It is a button.')}>
85
+ Outlined
86
+ </Button>
87
+ </Wrapper>
88
+ );
89
+ };
90
+ ```
91
+
92
+ **Wrapper** (`components/wrapper/wrapper.css.ts`)
93
+
94
+ ```tsx
95
+ import { styled } from '@salty-css/react/styled';
96
+
97
+ export const Wrapper = styled('div', {
98
+ base: {
99
+ display: 'block',
100
+ padding: '2vw',
101
+ },
102
+ });
103
+ ```
104
+
105
+ **Button** (`components/button/button.css.ts`)
106
+
107
+ ```tsx
108
+ import { styled } from '@salty-css/react/styled';
109
+
110
+ export const Button = styled('button', {
111
+ base: {
112
+ display: 'block',
113
+ padding: `0.6em 1.2em`,
114
+ border: '1px solid currentColor',
115
+ background: 'transparent',
116
+ color: 'currentColor/40',
117
+ cursor: 'pointer',
118
+ transition: '200ms',
119
+ textDecoration: 'none',
120
+ '&:hover': {
121
+ background: 'black',
122
+ borderColor: 'black',
123
+ color: 'white',
124
+ },
125
+ '&:disabled': {
126
+ opacity: 0.25,
127
+ pointerEvents: 'none',
128
+ },
129
+ },
130
+ variants: {
131
+ variant: {
132
+ outlined: {
133
+ // same as default styles
134
+ },
135
+ solid: {
136
+ '&:not(:hover)': {
137
+ background: 'black',
138
+ borderColor: 'black',
139
+ color: 'white',
140
+ },
141
+ '&:hover': {
142
+ background: 'transparent',
143
+ borderColor: 'currentColor',
144
+ color: 'currentColor',
145
+ },
146
+ },
147
+ },
148
+ },
149
+ });
150
+ ```
151
+
152
+ More examples coming soon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "salty-css",
3
- "version": "0.0.1-alpha.30",
3
+ "version": "0.0.1-alpha.32",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -20,7 +20,7 @@
20
20
  "name": "cli"
21
21
  },
22
22
  "dependencies": {
23
- "@salty-css/core": "^0.0.1-alpha.30"
23
+ "@salty-css/core": "^0.0.1-alpha.32"
24
24
  },
25
25
  "bin": {
26
26
  "salty-css": "./index.js"