Skip to content

Commit 34e73ce

Browse files
committed
Initial commit
0 parents  commit 34e73ce

10 files changed

+6733
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.swc
3+
coverage
4+
dist
5+
*.log
6+
*.tsbuildinfo
7+
.DS_Store

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm-lock.yaml

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ISC License
2+
3+
Copyright 2025 Javier Diaz Chamorro
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## SVA
2+
3+
SVA (Style Variant API) provides a way to define styles in React Native with better experience and composability. The key featuare is the ability to create multi-variants styles with a type-safe definition inspired by [Stitches](https://stitches.dev/docs/variants) and [CVA](https://cva.style/docs/getting-started/variants) (for React apps)
4+
5+
#### Currently properties:
6+
7+
- `base`: The base styles for the element.
8+
- `variants`: The different visual styles for the element.
9+
- `compoundVariants`: Styles that apply when multiple other variant conditions are met.
10+
- `default`: Set a variant by default.
11+
12+
#### Roadmap
13+
14+
- [x] Variants definition.
15+
- [x] Default variants.
16+
- [ ] Styles based on conditions.
17+
- [ ] Support to define theme tokens.
18+
19+
### Example of usage
20+
21+
```tsx
22+
import { styles } from 'sva';
23+
24+
// With React Native screens
25+
export const Button = () => {
26+
return (
27+
<TouchableOpacity style={buttonStyles()}>
28+
<Text>Click me</Text>
29+
</TouchableOpacity>
30+
);
31+
};
32+
33+
const buttonStyles = styles({
34+
base: {
35+
borderRadius: 8,
36+
},
37+
variants: {
38+
intent: {
39+
primary: {
40+
backgroundColor: '#32275F',
41+
},
42+
secondary: {
43+
backgroundColor: '#D9D9D9',
44+
},
45+
},
46+
size: {
47+
sm: { paddingHorizontal: 8, paddingVertical: 6 },
48+
md: { paddingHorizontal: 12, paddingVertical: 8 },
49+
lg: { paddingHorizontal: 16, paddingVertical: 10 },
50+
},
51+
},
52+
default: {
53+
intent: 'primary',
54+
size: 'md',
55+
},
56+
});
57+
```

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"build": "pnpm run --filter './packages/**' build",
5+
"check": "pnpm run --filter './packages/**' --parallel check",
6+
"test": "vitest run --coverage"
7+
},
8+
"devDependencies": {
9+
"@vitest/coverage-v8": "3.0.7",
10+
"prettier": "3.5.2",
11+
"typescript": "^5.7.3",
12+
"vitest": "^3.0.7"
13+
},
14+
"engines": {
15+
"node": ">=18.x.x"
16+
},
17+
"pnpm": {
18+
"overrides": {
19+
"sva": "workspace:*"
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)