@westayltd/design-tokens 0.3.6 → 0.3.8

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 +7 -191
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @westayltd/design-tokens
2
2
 
3
- A comprehensive design token system for Westay applications, providing consistent colors, spacing, typography, and radius values across the platform.
3
+ Design token system for Westay applications colors, spacing, typography, and radius.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,205 +8,21 @@ A comprehensive design token system for Westay applications, providing consisten
8
8
  npm install @westayltd/design-tokens
9
9
  ```
10
10
 
11
- ## Usage
11
+ ## Usage in Frontend (westay-b2c-fe-web)
12
12
 
13
- ### Import All Tokens
14
-
15
- ```typescript
16
- import { tokens } from '@westayltd/design-tokens';
17
-
18
- // Access all tokens
19
- const brandColor = tokens.colors.light.brand.crimson[500];
20
- const spacing = tokens.spacing[4]; // "16px"
21
- const fontSize = tokens.typography.fontSize.base; // "16px"
22
- const borderRadius = tokens.radius.md; // "10px"
23
- ```
24
-
25
- ### Import Individual Token Files
26
-
27
- You can also import individual JSON files directly:
28
-
29
- ```typescript
30
- import colors from '@westayltd/design-tokens/colors';
31
- import spacing from '@westayltd/design-tokens/spacing';
32
- import typography from '@westayltd/design-tokens/typography';
33
- import radius from '@westayltd/design-tokens/radius';
34
- ```
35
-
36
- ### TypeScript Support
37
-
38
- The package includes full TypeScript definitions:
39
-
40
- ```typescript
41
- import { tokens, ThemeMode, Tokens } from '@westayltd/design-tokens';
42
-
43
- // Type-safe access
44
- const mode: ThemeMode = 'light';
45
- const color: string = tokens.colors[mode].brand.crimson[500];
46
- ```
47
-
48
- ## Available Tokens
49
-
50
- ### Colors
51
-
52
- The color system supports both light and dark themes:
53
-
54
- ```typescript
55
- import { tokens } from '@westayltd/design-tokens';
56
-
57
- // Light theme colors
58
- tokens.colors.light.brand.crimson[500] // "#F17878"
59
- tokens.colors.light.brand.burgundy[500] // "#D8A6AE"
60
- tokens.colors.light.brand.royals[500] // "#004484"
61
- tokens.colors.light.brand.oldMoney[500] // "#448E80"
62
- tokens.colors.light.surface.bg // Background colors
63
- tokens.colors.light.text.primary // Text colors
64
- tokens.colors.light.feedback.success // Feedback colors
65
-
66
- // Dark theme colors
67
- tokens.colors.dark.brand.crimson[500]
68
- tokens.colors.dark.surface.bg
69
- tokens.colors.dark.text.primary
70
- ```
71
-
72
- **Color Categories:**
73
- - **Brand**: Crimson, Burgundy, Royals, OldMoney
74
- - **Surface**: Background, subtle, raised, border colors
75
- - **Text**: Primary, secondary, muted, inverse
76
- - **Feedback**: Success, error, warning, info
77
-
78
- ### Spacing
79
-
80
- Consistent spacing scale from 0 to 12:
81
-
82
- ```typescript
83
- tokens.spacing[0] // "0px"
84
- tokens.spacing[1] // "4px"
85
- tokens.spacing[2] // "8px"
86
- tokens.spacing[3] // "12px"
87
- tokens.spacing[4] // "16px"
88
- tokens.spacing[5] // "20px"
89
- tokens.spacing[6] // "24px"
90
- tokens.spacing[8] // "32px"
91
- tokens.spacing[10] // "40px"
92
- tokens.spacing[12] // "48px"
93
- ```
94
-
95
- ### Typography
96
-
97
- Font families, sizes, weights, and line heights:
98
-
99
- ```typescript
100
- // Font Family
101
- tokens.typography.fontFamily.sans // ["Helvetica", "Arial", "sans-serif"]
102
-
103
- // Font Sizes
104
- tokens.typography.fontSize.xs // "12px"
105
- tokens.typography.fontSize.sm // "14px"
106
- tokens.typography.fontSize.base // "16px"
107
- tokens.typography.fontSize.lg // "18px"
108
- tokens.typography.fontSize.xl // "20px"
109
- tokens.typography.fontSize['2xl'] // "24px"
110
- tokens.typography.fontSize['3xl'] // "30px"
111
-
112
- // Font Weights
113
- tokens.typography.fontWeight.regular // "400"
114
- tokens.typography.fontWeight.medium // "500"
115
- tokens.typography.fontWeight.semibold // "600"
116
- tokens.typography.fontWeight.bold // "700"
117
-
118
- // Line Heights
119
- tokens.typography.lineHeight.tight // "1.2"
120
- tokens.typography.lineHeight.normal // "1.5"
121
- tokens.typography.lineHeight.relaxed // "1.7"
122
- ```
123
-
124
- ### Radius
125
-
126
- Border radius values:
127
-
128
- ```typescript
129
- tokens.radius.none // "0px"
130
- tokens.radius.sm // "6px"
131
- tokens.radius.md // "10px"
132
- tokens.radius.lg // "14px"
133
- tokens.radius.xl // "20px"
134
- tokens.radius.full // "9999px"
135
- ```
136
-
137
- ## Building the Package
138
-
139
- To build the package from source:
140
-
141
- ```bash
142
- cd design-tokens
143
- npm install
144
- npm run build
145
- ```
146
-
147
- This will:
148
- - Compile TypeScript to both CommonJS and ES Module formats
149
- - Generate TypeScript declaration files (`.d.ts`)
150
- - Generate source maps for debugging
151
- - Output files to the `dist/` directory
152
-
153
- ### Development Mode
154
-
155
- For development with watch mode:
13
+ After installing a new version, regenerate the Tailwind CSS variables:
156
14
 
157
15
  ```bash
158
- npm run dev
16
+ npm run generate:tokens
159
17
  ```
160
18
 
161
- This will automatically rebuild when source files change.
162
-
163
- ## Package Structure
164
-
165
- ```
166
- design-tokens/
167
- ├── colors.json # Color tokens (light & dark themes)
168
- ├── spacing.json # Spacing scale
169
- ├── typography.json # Typography tokens
170
- ├── radius.json # Border radius tokens
171
- ├── index.ts # Main entry point
172
- ├── tsconfig.json # TypeScript configuration
173
- ├── tsup.config.ts # Build configuration
174
- ├── package.json # Package metadata
175
- └── dist/ # Built output
176
- ├── index.js # ES Module build
177
- ├── index.cjs # CommonJS build
178
- ├── index.d.ts # TypeScript declarations
179
- └── *.map # Source maps
180
- ```
19
+ This reads `design-tokens/colors.json` and outputs `src/app/design-tokens.css`.
181
20
 
182
- ## Exports
183
-
184
- The package exports:
185
-
186
- - **Main export**: `@westayltd/design-tokens` - Full tokens object with TypeScript types
187
- - **Colors**: `@westayltd/design-tokens/colors` - Colors JSON file
188
- - **Spacing**: `@westayltd/design-tokens/spacing` - Spacing JSON file
189
- - **Typography**: `@westayltd/design-tokens/typography` - Typography JSON file
190
- - **Radius**: `@westayltd/design-tokens/radius` - Radius JSON file
191
-
192
- ## TypeScript Types
193
-
194
- The package exports the following TypeScript types:
195
-
196
- ```typescript
197
- import type {
198
- ThemeMode, // "light" | "dark"
199
- Tokens, // Complete tokens object type
200
- Colors, // Colors type
201
- Spacing, // Spacing type
202
- Typography, // Typography type
203
- Radius // Radius type
204
- } from '@westayltd/design-tokens';
205
- ```
21
+ ---
206
22
 
207
23
  ## Version
208
24
 
209
- Current version: **0.2.1**
25
+ Current version: **0.3.7**
210
26
 
211
27
  ## License
212
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@westayltd/design-tokens",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",