@yuva-devlab/tokens 0.1.0 → 0.1.1
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +183 -32
- package/package.json +5 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @yuva-devlab/tokens@0.1.
|
|
2
|
+
> @yuva-devlab/tokens@0.1.1 build /home/runner/work/yuva-devlab-workspace/yuva-devlab-workspace/packages/tokens
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v7.2.4 [32mbuilding client environment for production...[36m[39m
|
|
@@ -11,8 +11,8 @@ rendering chunks...
|
|
|
11
11
|
computing gzip size...
|
|
12
12
|
[2mdist/[22m[35mtokens.css [39m[1m[2m9.42 kB[22m[1m[22m[2m │ gzip: 2.19 kB[22m
|
|
13
13
|
[2mdist/[22m[36mindex.js [39m[1m[2m7.43 kB[22m[1m[22m[2m │ gzip: 1.55 kB[22m
|
|
14
|
-
[vite:dts] Declaration files built in
|
|
14
|
+
[vite:dts] Declaration files built in 1028ms.
|
|
15
15
|
|
|
16
16
|
[2mdist/[22m[35mtokens.css [39m[1m[2m9.42 kB[22m[1m[22m[2m │ gzip: 2.19 kB[22m
|
|
17
17
|
[2mdist/[22m[36mindex.cjs [39m[1m[2m6.95 kB[22m[1m[22m[2m │ gzip: 1.59 kB[22m
|
|
18
|
-
[32m✓ built in 1.
|
|
18
|
+
[32m✓ built in 1.38s[39m
|
package/CHANGELOG.md
CHANGED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Yuva Devlab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,56 +1,207 @@
|
|
|
1
1
|
# 🎨 @yuva-devlab/tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@yuva-devlab/tokens)
|
|
4
|
+
[](LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
> Design system tokens built with Vanilla Extract, providing a comprehensive
|
|
7
|
+
> foundation for consistent UI development.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
- Semantic Colors (Natural / Organic theme)
|
|
9
|
-
- Spacing (Systemic 2xs-5xl scales)
|
|
10
|
-
- Typography (Scale-based)
|
|
11
|
-
- Radii & Shadows
|
|
12
|
-
- Breakpoints & Z-indices
|
|
9
|
+
## Features
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
- 🎨 **Automated Tonal Palettes** - Material Design 3 inspired color generation
|
|
12
|
+
- 🌓 **Light/Dark Themes** - Semantic color tokens that adapt to theme
|
|
13
|
+
- 📏 **Systematic Spacing** - Consistent scale from 2xs to 5xl
|
|
14
|
+
- 📝 **Typography Scale** - Harmonious type system
|
|
15
|
+
- 🎯 **Zero Runtime** - All tokens compiled to CSS variables at build time
|
|
16
|
+
- 🔒 **Type-Safe** - Full TypeScript autocomplete for all tokens
|
|
15
17
|
|
|
16
|
-
##
|
|
18
|
+
## Installation
|
|
17
19
|
|
|
18
20
|
```bash
|
|
19
|
-
|
|
20
|
-
├── src/
|
|
21
|
-
│ ├── utils/ # Token generation logic
|
|
22
|
-
│ ├── palettes.css.ts # Global tonal palettes
|
|
23
|
-
│ ├── themes.css.ts # Semantic light/dark mappings
|
|
24
|
-
│ ├── spacing.css.ts # Spacing scales
|
|
25
|
-
│ ├── typography.css.ts # Type scales
|
|
26
|
-
│ └── index.ts # Entry point
|
|
27
|
-
└── README.md
|
|
21
|
+
npm install @yuva-devlab/tokens
|
|
28
22
|
```
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
**Zero runtime dependencies** - All tokens are compiled to static CSS at build
|
|
25
|
+
time.
|
|
31
26
|
|
|
32
|
-
##
|
|
27
|
+
## Token Categories
|
|
33
28
|
|
|
34
|
-
###
|
|
29
|
+
### Colors
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
- **Tonal Palettes** - 13-shade palettes for primary, secondary, tertiary,
|
|
32
|
+
neutral, and error
|
|
33
|
+
- **Semantic Colors** - Theme-aware tokens (background, surface, primary, etc.)
|
|
34
|
+
- **State Colors** - Hover, active, and disabled states
|
|
38
35
|
|
|
39
|
-
###
|
|
36
|
+
### Spacing
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
- **Scale**: `2xs`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`
|
|
39
|
+
- **Values**: 4px to 96px in systematic increments
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
### Typography
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
- **Sizes**: `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`
|
|
44
|
+
- **Weights**: `light`, `regular`, `medium`, `semibold`, `bold`
|
|
45
|
+
- **Line Heights**: Optimized for readability
|
|
46
|
+
|
|
47
|
+
### Other Tokens
|
|
48
|
+
|
|
49
|
+
- **Border Radius**: `sm`, `md`, `lg`, `xl`, `full`
|
|
50
|
+
- **Shadows**: `sm`, `md`, `lg`, `xl`
|
|
51
|
+
- **Z-Index**: Layered system for overlays, modals, tooltips
|
|
52
|
+
- **Breakpoints**: Responsive design breakpoints
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
### In Vanilla Extract
|
|
47
57
|
|
|
48
58
|
```ts
|
|
49
59
|
import { vars } from "@yuva-devlab/tokens";
|
|
50
60
|
import { style } from "@vanilla-extract/css";
|
|
51
61
|
|
|
52
|
-
export const
|
|
53
|
-
backgroundColor: vars.colors.
|
|
54
|
-
padding: vars.spacing.
|
|
62
|
+
export const card = style({
|
|
63
|
+
backgroundColor: vars.colors.surface,
|
|
64
|
+
padding: vars.spacing.lg,
|
|
65
|
+
borderRadius: vars.radii.md,
|
|
66
|
+
boxShadow: vars.shadows.sm,
|
|
67
|
+
|
|
68
|
+
// Typography
|
|
69
|
+
fontSize: vars.typography.size.md,
|
|
70
|
+
lineHeight: vars.typography.lineHeight.md,
|
|
71
|
+
|
|
72
|
+
// Responsive
|
|
73
|
+
"@media": {
|
|
74
|
+
[vars.breakpoints.md]: {
|
|
75
|
+
padding: vars.spacing.xl,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
55
78
|
});
|
|
56
79
|
```
|
|
80
|
+
|
|
81
|
+
### Importing CSS
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
// Import compiled CSS in your app entry point
|
|
85
|
+
import "@yuva-devlab/tokens/tokens.css";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Using CSS Variables Directly
|
|
89
|
+
|
|
90
|
+
```css
|
|
91
|
+
.my-component {
|
|
92
|
+
background-color: var(--colors-surface);
|
|
93
|
+
padding: var(--spacing-md);
|
|
94
|
+
border-radius: var(--radii-md);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Color System
|
|
99
|
+
|
|
100
|
+
### Tonal Palettes
|
|
101
|
+
|
|
102
|
+
Each color has 13 shades (0-100 in increments of 10):
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { vars } from "@yuva-devlab/tokens";
|
|
106
|
+
|
|
107
|
+
// Primary palette
|
|
108
|
+
vars.palettes.primary[0]; // Lightest
|
|
109
|
+
vars.palettes.primary[50]; // Mid-tone
|
|
110
|
+
vars.palettes.primary[100]; // Darkest
|
|
111
|
+
|
|
112
|
+
// Available palettes:
|
|
113
|
+
// - primary (Natural green)
|
|
114
|
+
// - secondary
|
|
115
|
+
// - tertiary
|
|
116
|
+
// - neutral
|
|
117
|
+
// - neutralVariant
|
|
118
|
+
// - error
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Semantic Colors
|
|
122
|
+
|
|
123
|
+
Theme-aware tokens that automatically adapt:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
vars.colors.background; // Page background
|
|
127
|
+
vars.colors.surface; // Card/panel background
|
|
128
|
+
vars.colors.primary; // Primary brand color
|
|
129
|
+
vars.colors.onPrimary; // Text on primary
|
|
130
|
+
vars.colors.secondary; // Secondary color
|
|
131
|
+
vars.colors.error; // Error state
|
|
132
|
+
vars.colors.outline; // Borders
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Spacing System
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { vars } from "@yuva-devlab/tokens";
|
|
139
|
+
|
|
140
|
+
vars.spacing["2xs"]; // 4px
|
|
141
|
+
vars.spacing.xs; // 8px
|
|
142
|
+
vars.spacing.sm; // 12px
|
|
143
|
+
vars.spacing.md; // 16px
|
|
144
|
+
vars.spacing.lg; // 24px
|
|
145
|
+
vars.spacing.xl; // 32px
|
|
146
|
+
vars.spacing["2xl"]; // 48px
|
|
147
|
+
vars.spacing["3xl"]; // 64px
|
|
148
|
+
vars.spacing["4xl"]; // 80px
|
|
149
|
+
vars.spacing["5xl"]; // 96px
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Typography
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import { vars } from "@yuva-devlab/tokens";
|
|
156
|
+
|
|
157
|
+
// Sizes
|
|
158
|
+
vars.typography.size.xs; // 12px
|
|
159
|
+
vars.typography.size.sm; // 14px
|
|
160
|
+
vars.typography.size.md; // 16px
|
|
161
|
+
vars.typography.size.lg; // 18px
|
|
162
|
+
vars.typography.size.xl; // 20px
|
|
163
|
+
vars.typography.size["2xl"]; // 24px
|
|
164
|
+
vars.typography.size["3xl"]; // 30px
|
|
165
|
+
vars.typography.size["4xl"]; // 36px
|
|
166
|
+
vars.typography.size["5xl"]; // 48px
|
|
167
|
+
|
|
168
|
+
// Weights
|
|
169
|
+
vars.typography.weight.light; // 300
|
|
170
|
+
vars.typography.weight.regular; // 400
|
|
171
|
+
vars.typography.weight.medium; // 500
|
|
172
|
+
vars.typography.weight.semibold; // 600
|
|
173
|
+
vars.typography.weight.bold; // 700
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Development
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Build tokens
|
|
180
|
+
pnpm --filter @yuva-devlab/tokens build
|
|
181
|
+
|
|
182
|
+
# Watch mode
|
|
183
|
+
pnpm --filter @yuva-devlab/tokens dev
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Architecture
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
Color Seeds (HSL)
|
|
190
|
+
↓
|
|
191
|
+
Tonal Palette Generation (MD3 algorithm)
|
|
192
|
+
↓
|
|
193
|
+
Semantic Token Mapping (Light/Dark)
|
|
194
|
+
↓
|
|
195
|
+
CSS Variables (Compiled by Vanilla Extract)
|
|
196
|
+
↓
|
|
197
|
+
Your Components
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Related Packages
|
|
201
|
+
|
|
202
|
+
- [@yuva-devlab/colors](../colors) - Palette generation utility
|
|
203
|
+
- [@yuva-devlab/ui](../ui) - Components using these tokens
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT © Yuva Devlab
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuva-devlab/tokens",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"@vanilla-extract/vite-plugin": "^5.1.1",
|
|
24
24
|
"vite": "^7.2.4",
|
|
25
25
|
"vite-plugin-dts": "^4.5.4",
|
|
26
|
-
"@yuva-devlab/
|
|
27
|
-
"@yuva-devlab/
|
|
28
|
-
"@yuva-devlab/prettier-config": "0.1.
|
|
29
|
-
"@yuva-devlab/typescript-config": "0.1.
|
|
26
|
+
"@yuva-devlab/colors": "0.1.1",
|
|
27
|
+
"@yuva-devlab/eslint-config": "0.1.1",
|
|
28
|
+
"@yuva-devlab/prettier-config": "0.1.1",
|
|
29
|
+
"@yuva-devlab/typescript-config": "0.1.1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@vanilla-extract/css": "^1.17.4"
|