@aziontech/theme 0.1.0 → 1.0.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/README.md +318 -329
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,466 +1,455 @@
|
|
|
1
|
-
|
|
1
|
+
# @aziontech/theme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A comprehensive design token system and theming solution for Azion's web applications. This package provides primitive colors, semantic tokens, brand colors, and seamless integration with Tailwind CSS.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<img
|
|
7
|
-
src="./doc/cover-image.png"
|
|
8
|
-
width="1200px"
|
|
9
|
-
/>
|
|
10
|
-
</p>
|
|
5
|
+
## Features
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
- **Design Tokens**: Primitive and semantic color tokens generated from Figma
|
|
8
|
+
- **Brand Colors**: Azion's official color palette with primary (orange), accent (violet), and surface colors
|
|
9
|
+
- **Theme Support**: Built-in light and dark mode theming
|
|
10
|
+
- **Tailwind Integration**: Plugin and preset for seamless Tailwind CSS integration
|
|
11
|
+
- **CSS Variables**: Automatic CSS variable generation for dynamic theming
|
|
12
|
+
- **Widget Support**: Separate theme variant for embedded widgets
|
|
13
13
|
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
- [Installation](#-installation)
|
|
17
|
-
- [Usage](#-usage)
|
|
18
|
-
- [Development](#-development)
|
|
19
|
-
- [Building](#-building)
|
|
20
|
-
- [Release Process](#-release-process)
|
|
21
|
-
- [Design Tokens](#-design-tokens)
|
|
22
|
-
- [Links](#-links)
|
|
23
|
-
|
|
24
|
-
## 🚀 Installation
|
|
25
|
-
|
|
26
|
-
To install the `azion-theme` project, you need to follow the command. Choose one of your preferences: npm or yarn:
|
|
14
|
+
## Installation
|
|
27
15
|
|
|
28
16
|
```bash
|
|
29
|
-
npm install
|
|
17
|
+
npm install @aziontech/theme
|
|
30
18
|
# or
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Alternatively, you can configure the `package.json` file by adding the dependency:
|
|
35
|
-
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"azion-theme": "^1.4.0"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
19
|
+
pnpm add @aziontech/theme
|
|
20
|
+
# or
|
|
21
|
+
yarn add @aziontech/theme
|
|
42
22
|
```
|
|
43
23
|
|
|
44
|
-
|
|
24
|
+
## Quick Start
|
|
45
25
|
|
|
46
|
-
###
|
|
26
|
+
### Option 1: CSS Import (Recommended for web applications)
|
|
47
27
|
|
|
48
|
-
|
|
28
|
+
Import the main theme stylesheet:
|
|
49
29
|
|
|
50
30
|
```javascript
|
|
51
|
-
|
|
52
|
-
import '
|
|
31
|
+
// Default theme (includes light/dark mode support)
|
|
32
|
+
import '@aziontech/theme';
|
|
53
33
|
```
|
|
54
34
|
|
|
55
|
-
|
|
35
|
+
Add the theme class to your root element:
|
|
56
36
|
|
|
57
|
-
|
|
37
|
+
```html
|
|
38
|
+
<div class="azion">
|
|
39
|
+
<!-- Your application content -->
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<!-- For dark mode -->
|
|
43
|
+
<div class="azion azion-dark">
|
|
44
|
+
<!-- Your application content -->
|
|
45
|
+
</div>
|
|
46
|
+
```
|
|
58
47
|
|
|
59
|
-
|
|
48
|
+
### Option 2: Tailwind CSS Integration
|
|
60
49
|
|
|
61
|
-
|
|
50
|
+
#### Using the Preset
|
|
62
51
|
|
|
63
|
-
|
|
52
|
+
Add the preset to your `tailwind.config.js`:
|
|
64
53
|
|
|
65
|
-
|
|
54
|
+
```javascript
|
|
55
|
+
import { preset } from '@aziontech/theme/tokens';
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
export default {
|
|
58
|
+
presets: [preset],
|
|
59
|
+
// your config
|
|
60
|
+
};
|
|
70
61
|
```
|
|
71
62
|
|
|
72
|
-
|
|
63
|
+
#### Using the Plugin
|
|
73
64
|
|
|
74
|
-
|
|
75
|
-
cd ./azion-theme && npm i && npm link
|
|
76
|
-
```
|
|
65
|
+
For static utility classes with light/dark mode support:
|
|
77
66
|
|
|
78
|
-
|
|
67
|
+
```javascript
|
|
68
|
+
import { tokenUtilities } from '@aziontech/theme/tokens';
|
|
79
69
|
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
export default {
|
|
71
|
+
plugins: [
|
|
72
|
+
tokenUtilities({
|
|
73
|
+
darkSelector: '.dark',
|
|
74
|
+
extraDarkSelectors: ['.azion.azion-dark']
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
};
|
|
82
78
|
```
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## 🏗️ Building
|
|
80
|
+
### Option 3: JavaScript Token Access
|
|
87
81
|
|
|
88
|
-
|
|
82
|
+
Access tokens programmatically:
|
|
89
83
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
7. **Generate Type Definitions** - Creates TypeScript declaration files
|
|
101
|
-
|
|
102
|
-
### Manual Build
|
|
84
|
+
```javascript
|
|
85
|
+
// Import all tokens
|
|
86
|
+
import {
|
|
87
|
+
primitives,
|
|
88
|
+
brandPrimitives,
|
|
89
|
+
surfacePrimitives,
|
|
90
|
+
textSemantic,
|
|
91
|
+
backgroundSemantic,
|
|
92
|
+
borderSemantic
|
|
93
|
+
} from '@aziontech/theme/tokens';
|
|
103
94
|
|
|
104
|
-
|
|
95
|
+
// Use primitive colors
|
|
96
|
+
const primaryColor = primitives.orange['500']; // '#fe601f'
|
|
97
|
+
const accentColor = primitives.violet['500']; // '#8a84ec'
|
|
105
98
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
npm run build
|
|
99
|
+
// Use semantic tokens (returns token references)
|
|
100
|
+
const textColor = textSemantic.light.textColorBase; // tokenRef('primitives.neutral.900')
|
|
109
101
|
```
|
|
110
102
|
|
|
111
|
-
|
|
103
|
+
### Option 4: CSS Variables Injection
|
|
112
104
|
|
|
113
|
-
|
|
105
|
+
Inject CSS variables dynamically at runtime:
|
|
114
106
|
|
|
115
|
-
|
|
107
|
+
```javascript
|
|
108
|
+
import { injectCssVars } from '@aziontech/theme/tokens';
|
|
116
109
|
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
// Injects <style data-azion-tokens> into document.head
|
|
111
|
+
const styleElement = injectCssVars();
|
|
119
112
|
```
|
|
120
113
|
|
|
121
|
-
|
|
114
|
+
## Token Structure
|
|
122
115
|
|
|
123
|
-
###
|
|
116
|
+
### Primitive Colors
|
|
124
117
|
|
|
125
|
-
|
|
118
|
+
Base color palettes with numeric scales (50-950):
|
|
126
119
|
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
This will remove the `dist/` directory.
|
|
132
|
-
|
|
133
|
-
## 📦 Release Process
|
|
120
|
+
```javascript
|
|
121
|
+
import { primitives } from '@aziontech/theme/tokens';
|
|
134
122
|
|
|
135
|
-
|
|
123
|
+
primitives.orange['500']; // Primary brand color
|
|
124
|
+
primitives.violet['500']; // Accent brand color
|
|
125
|
+
primitives.neutral['900']; // Dark surfaces
|
|
126
|
+
primitives.neutral['50']; // Light surfaces
|
|
127
|
+
```
|
|
136
128
|
|
|
137
|
-
|
|
129
|
+
Available primitives:
|
|
130
|
+
- `base`: White and black
|
|
131
|
+
- `orange`: Primary brand color (11 shades)
|
|
132
|
+
- `violet`: Accent brand color (11 shades)
|
|
133
|
+
- `neutral`: Gray scale for surfaces (11 shades)
|
|
134
|
+
- `gray`, `slate`: Additional gray variants
|
|
135
|
+
- `red`: Semantic danger color
|
|
136
|
+
- `green`: Semantic success color
|
|
137
|
+
- `yellow`: Semantic warning color
|
|
138
|
+
- `blue`: Link colors
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
2. Version numbers are automatically incremented based on commit type
|
|
141
|
-
3. Release notes are generated automatically
|
|
142
|
-
4. A changelog is updated
|
|
143
|
-
5. The package is built
|
|
144
|
-
6. The package is published to npm with provenance
|
|
145
|
-
7. GitHub release is created
|
|
140
|
+
### Brand Primitives
|
|
146
141
|
|
|
147
|
-
|
|
142
|
+
Azion-specific brand colors:
|
|
148
143
|
|
|
149
|
-
|
|
144
|
+
```javascript
|
|
145
|
+
import { brandPrimitives } from '@aziontech/theme/tokens';
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
[
|
|
147
|
+
brandPrimitives.primary['500']; // Orange brand color
|
|
148
|
+
brandPrimitives.accent['500']; // Violet accent color
|
|
149
|
+
brandPrimitives.absolute.white; // Pure white
|
|
150
|
+
brandPrimitives.absolute.black; // Pure black
|
|
153
151
|
```
|
|
154
152
|
|
|
155
|
-
|
|
153
|
+
### Surface Primitives
|
|
156
154
|
|
|
157
|
-
|
|
158
|
-
- `type` - One of: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`
|
|
159
|
-
- `subject` - Brief description of the change
|
|
155
|
+
Surface color scales for backgrounds:
|
|
160
156
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
- `feat(tokens): Add new primary color variants`
|
|
164
|
-
- `fix(theme): Update border radius values`
|
|
165
|
-
- `chore(build): Update semantic-release configuration`
|
|
157
|
+
```javascript
|
|
158
|
+
import { surfacePrimitives } from '@aziontech/theme/tokens';
|
|
166
159
|
|
|
167
|
-
|
|
160
|
+
surfacePrimitives.surface['0']; // White
|
|
161
|
+
surfacePrimitives.surface['50']; // Lightest gray
|
|
162
|
+
surfacePrimitives.surface['900']; // Very dark gray
|
|
163
|
+
surfacePrimitives.surface['950']; // Almost black
|
|
164
|
+
```
|
|
168
165
|
|
|
169
|
-
|
|
170
|
-
- **fix (bug fixes)**: **patch** version increment
|
|
171
|
-
- **hotfix (emergency fixes)**: **patch** version increment
|
|
172
|
-
- **chore, docs, style, refactor**: **patch** version increment
|
|
166
|
+
### Semantic Tokens
|
|
173
167
|
|
|
174
|
-
|
|
168
|
+
Context-aware tokens that automatically adapt to light/dark themes:
|
|
175
169
|
|
|
176
|
-
|
|
170
|
+
#### Background Tokens
|
|
177
171
|
|
|
178
|
-
|
|
172
|
+
```javascript
|
|
173
|
+
import { backgroundSemantic } from '@aziontech/theme/tokens';
|
|
179
174
|
|
|
180
|
-
|
|
175
|
+
// Light mode
|
|
176
|
+
backgroundSemantic.light.bgLayer1; // Surface 0 (white)
|
|
177
|
+
backgroundSemantic.light.bgLayer2; // Surface 50
|
|
178
|
+
backgroundSemantic.light.bgCanvas; // Surface 100
|
|
181
179
|
|
|
182
|
-
|
|
180
|
+
// Dark mode
|
|
181
|
+
backgroundSemantic.dark.bgLayer1; // Surface 800
|
|
182
|
+
backgroundSemantic.dark.bgCanvas; // Surface 950
|
|
183
|
+
```
|
|
183
184
|
|
|
184
|
-
|
|
185
|
+
#### Text Tokens
|
|
185
186
|
|
|
186
|
-
|
|
187
|
+
```javascript
|
|
188
|
+
import { textSemantic } from '@aziontech/theme/tokens';
|
|
187
189
|
|
|
188
|
-
|
|
190
|
+
// Light mode
|
|
191
|
+
textSemantic.light.textColorBase; // neutral.900
|
|
192
|
+
textSemantic.light.textColorMuted; // neutral.600
|
|
193
|
+
textSemantic.light.textColorLink; // blue.600
|
|
189
194
|
|
|
190
|
-
|
|
191
|
-
|
|
195
|
+
// Dark mode
|
|
196
|
+
textSemantic.dark.textColorBase; // neutral.50
|
|
197
|
+
textSemantic.dark.textColorMuted; // neutral.400
|
|
198
|
+
textSemantic.dark.textColorLink; // blue.300
|
|
192
199
|
```
|
|
193
200
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
## 🎨 Design Tokens
|
|
197
|
-
|
|
198
|
-
This project includes **primitive color tokens** extracted directly from Figma, ready to be consumed via Tailwind CSS.
|
|
199
|
-
|
|
200
|
-
### 🚀 How to Use the Tokens
|
|
201
|
+
#### Border Tokens
|
|
201
202
|
|
|
202
203
|
```javascript
|
|
203
|
-
|
|
204
|
-
import typography from '@tailwindcss/typography'
|
|
205
|
-
import { tokenUtilities } from 'azion-theme/tokens/build/tailwind-plugin'
|
|
206
|
-
import colors from 'azion-theme/tokens'
|
|
204
|
+
import { borderSemantic } from '@aziontech/theme/tokens';
|
|
207
205
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
...colors
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
plugins: [tokenUtilities(), typography]
|
|
219
|
-
}
|
|
206
|
+
borderSemantic.light.borderBase; // surface.200
|
|
207
|
+
borderSemantic.light.borderPrimary; // primary.500
|
|
208
|
+
borderSemantic.light.borderDanger; // red.600
|
|
209
|
+
|
|
210
|
+
borderSemantic.dark.borderBase; // surface.700
|
|
211
|
+
borderSemantic.dark.borderDanger; // red.400
|
|
220
212
|
```
|
|
221
213
|
|
|
222
|
-
|
|
214
|
+
## Theming
|
|
223
215
|
|
|
224
|
-
|
|
216
|
+
### Light Mode (Default)
|
|
225
217
|
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
colors.neutral[900] // #171717
|
|
231
|
-
|
|
232
|
-
// Brand colors
|
|
233
|
-
colors.brand.black // #0a0a0a
|
|
234
|
-
colors.brand.white // #fafafa
|
|
235
|
-
colors.brand.orange // #fe601f
|
|
236
|
-
|
|
237
|
-
// Brand primitives (aliases)
|
|
238
|
-
colors.primary[500] // orange palette
|
|
239
|
-
colors.accent[500] // violet palette
|
|
240
|
-
|
|
241
|
-
// Surface primitives (neutral-based)
|
|
242
|
-
colors.surface[950] // #0a0a0a
|
|
218
|
+
```html
|
|
219
|
+
<div class="azion azion-light">
|
|
220
|
+
<!-- Light theme content -->
|
|
221
|
+
</div>
|
|
243
222
|
```
|
|
244
223
|
|
|
245
|
-
|
|
224
|
+
### Dark Mode
|
|
246
225
|
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
colors.text.accent // accent-500 (both modes)
|
|
252
|
-
|
|
253
|
-
// Background colors - theme-aware layers
|
|
254
|
-
colors.background.layer1 // surface-0 (light) / surface-800 (dark)
|
|
255
|
-
colors.background.layer2 // surface-50 (light) / surface-700 (dark)
|
|
256
|
-
colors.background.canvas // surface-100 (light) / surface-950 (dark)
|
|
257
|
-
|
|
258
|
-
// Border colors - theme-aware borders
|
|
259
|
-
colors.border.base // surface-200 (light) / surface-700 (dark)
|
|
260
|
-
colors.border.primary // primary-500 (both modes)
|
|
261
|
-
colors.border.accent // accent-500 (both modes)
|
|
226
|
+
```html
|
|
227
|
+
<div class="azion azion-dark">
|
|
228
|
+
<!-- Dark theme content -->
|
|
229
|
+
</div>
|
|
262
230
|
```
|
|
263
231
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
**Using semantic tokens** (theme-aware, no `dark:` variant needed):
|
|
232
|
+
Or use the standard Tailwind dark mode class:
|
|
267
233
|
|
|
268
234
|
```html
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
<p class="text-base">Base text color (auto-adapts to theme)</p>
|
|
235
|
+
<div class="azion dark">
|
|
236
|
+
<!-- Dark theme content -->
|
|
237
|
+
</div>
|
|
238
|
+
```
|
|
274
239
|
|
|
275
|
-
|
|
276
|
-
<div class="border border-base">Border adapts to current theme</div>
|
|
240
|
+
### Dynamic Theme Switching
|
|
277
241
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
242
|
+
```javascript
|
|
243
|
+
// Toggle dark mode
|
|
244
|
+
const root = document.querySelector('.azion');
|
|
245
|
+
root.classList.toggle('azion-dark');
|
|
246
|
+
root.classList.toggle('azion-light');
|
|
282
247
|
```
|
|
283
248
|
|
|
284
|
-
|
|
249
|
+
## Tailwind CSS Usage
|
|
250
|
+
|
|
251
|
+
### With Preset (Dynamic CSS Variables)
|
|
285
252
|
|
|
286
253
|
```html
|
|
287
|
-
<!-- Background
|
|
288
|
-
<div class="bg-
|
|
254
|
+
<!-- Background colors -->
|
|
255
|
+
<div class="bg-layer1">Layer 1 background</div>
|
|
256
|
+
<div class="bg-canvas">Canvas background</div>
|
|
257
|
+
<div class="bg-base">Base background</div>
|
|
258
|
+
|
|
259
|
+
<!-- Text colors -->
|
|
260
|
+
<p class="text-base">Base text</p>
|
|
261
|
+
<p class="text-muted">Muted text</p>
|
|
262
|
+
<a class="text-link">Link text</a>
|
|
263
|
+
|
|
264
|
+
<!-- Border colors -->
|
|
265
|
+
<div class="border border-base">Default border</div>
|
|
266
|
+
<div class="border border-primary">Primary border</div>
|
|
267
|
+
```
|
|
289
268
|
|
|
290
|
-
|
|
291
|
-
<p class="text-neutral-900 dark:text-neutral-100">Primary text color</p>
|
|
269
|
+
### With Plugin (Static Utilities)
|
|
292
270
|
|
|
293
|
-
|
|
294
|
-
<div class="border border-neutral-200 dark:border-neutral-800">Card with adaptive border</div>
|
|
271
|
+
When using the `tokenUtilities` plugin:
|
|
295
272
|
|
|
296
|
-
|
|
297
|
-
|
|
273
|
+
```html
|
|
274
|
+
<!-- These generate static values for both light and dark -->
|
|
275
|
+
<div class="bg-layer1">Light: white / Dark: surface-800</div>
|
|
276
|
+
<div class="text-base">Light: neutral-900 / Dark: neutral-50</div>
|
|
298
277
|
```
|
|
299
278
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
_Global tokens_ (use with `dark:` variant):
|
|
279
|
+
### Complete Tailwind Config Example
|
|
303
280
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
- **Accent:** `violet-50` → `violet-950` (secondary highlights)
|
|
307
|
-
- **Status:** `red-*`, `green-*`, `yellow-*`, `blue-*` (semantic status colors)
|
|
308
|
-
|
|
309
|
-
_Semantic tokens_ (theme-aware, no `dark:` needed):
|
|
281
|
+
```javascript
|
|
282
|
+
import { preset, tokenUtilities } from '@aziontech/theme/tokens';
|
|
310
283
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
284
|
+
export default {
|
|
285
|
+
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
286
|
+
presets: [preset],
|
|
287
|
+
darkMode: 'class',
|
|
288
|
+
plugins: [
|
|
289
|
+
tokenUtilities({
|
|
290
|
+
darkSelector: '.dark',
|
|
291
|
+
extraDarkSelectors: ['.azion.azion-dark']
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
};
|
|
295
|
+
```
|
|
314
296
|
|
|
315
|
-
|
|
297
|
+
## CSS Variables
|
|
316
298
|
|
|
317
|
-
|
|
299
|
+
All semantic tokens are available as CSS variables:
|
|
318
300
|
|
|
319
301
|
```css
|
|
320
|
-
|
|
321
|
-
[data-theme=
|
|
322
|
-
|
|
323
|
-
|
|
302
|
+
/* Automatically generated */
|
|
303
|
+
:root, [data-theme=light], .azion.azion-light {
|
|
304
|
+
--text-textColorBase: #171717;
|
|
305
|
+
--background-bgLayer1: #ffffff;
|
|
306
|
+
--border-borderBase: #e5e5e5;
|
|
324
307
|
}
|
|
325
|
-
|
|
326
|
-
.dark,
|
|
327
|
-
|
|
328
|
-
|
|
308
|
+
|
|
309
|
+
[data-theme=dark], .dark, .azion.azion-dark {
|
|
310
|
+
--text-textColorBase: #fafafa;
|
|
311
|
+
--background-bgLayer1: #262626;
|
|
312
|
+
--border-borderBase: #404040;
|
|
329
313
|
}
|
|
330
314
|
```
|
|
331
315
|
|
|
332
|
-
|
|
316
|
+
Use in your CSS:
|
|
333
317
|
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
surfacePrimitives,
|
|
341
|
-
preset,
|
|
342
|
-
createTailwindConfig,
|
|
343
|
-
tokenUtilities
|
|
344
|
-
} from 'azion-theme/tokens'
|
|
318
|
+
```css
|
|
319
|
+
.custom-component {
|
|
320
|
+
color: var(--text-textColorBase);
|
|
321
|
+
background-color: var(--background-bgLayer1);
|
|
322
|
+
border-color: var(--border-borderBase);
|
|
323
|
+
}
|
|
345
324
|
```
|
|
346
325
|
|
|
347
|
-
|
|
326
|
+
## Widget Theme
|
|
348
327
|
|
|
349
|
-
|
|
328
|
+
For embedded widgets and iframes, use the widget theme variant:
|
|
350
329
|
|
|
351
|
-
|
|
352
|
-
|
|
330
|
+
```javascript
|
|
331
|
+
import '@aziontech/theme/widget';
|
|
332
|
+
```
|
|
353
333
|
|
|
354
|
-
|
|
334
|
+
The widget theme includes:
|
|
335
|
+
- Compact variable definitions
|
|
336
|
+
- Optimized for isolated contexts
|
|
337
|
+
- Same token structure as main theme
|
|
355
338
|
|
|
356
|
-
|
|
357
|
-
- Use Tokens Studio’s import-from-variables flow to bring the current Variables state into the token sets.
|
|
339
|
+
## API Reference
|
|
358
340
|
|
|
359
|
-
|
|
360
|
-
- Export using **Multiple files**.
|
|
341
|
+
### Exports
|
|
361
342
|
|
|
362
|
-
|
|
363
|
-
|
|
343
|
+
#### Default Export
|
|
344
|
+
- `@aziontech/theme` - Main CSS theme (default.js)
|
|
345
|
+
- `@aziontech/theme/widget` - Widget CSS theme (widget.js)
|
|
346
|
+
- `@aziontech/theme/tokens` - JavaScript token system (src/tokens/index.js)
|
|
364
347
|
|
|
365
|
-
|
|
366
|
-
- Run:
|
|
348
|
+
#### Token Exports
|
|
367
349
|
|
|
368
|
-
```
|
|
369
|
-
|
|
350
|
+
```javascript
|
|
351
|
+
// Primitive tokens
|
|
352
|
+
export { primitives } from './primitives/colors.js';
|
|
353
|
+
export { brandPrimitives, surfacePrimitives } from './primitives/brand.js';
|
|
354
|
+
|
|
355
|
+
// Semantic tokens
|
|
356
|
+
export { textSemantic } from './semantic/text.js';
|
|
357
|
+
export { backgroundSemantic } from './semantic/backgrounds.js';
|
|
358
|
+
export { borderSemantic } from './semantic/borders.js';
|
|
359
|
+
|
|
360
|
+
// Build utilities
|
|
361
|
+
export { tokenRef } from './build/refs.js';
|
|
362
|
+
export { resolveRefsToCssVars } from './build/resolve.js';
|
|
363
|
+
export { createCssVars, cssVarsString, injectCssVars } from './build/css-vars.js';
|
|
364
|
+
export { preset } from './build/preset.js';
|
|
365
|
+
export { tokenUtilities } from './build/tailwind-plugin.js';
|
|
370
366
|
```
|
|
371
367
|
|
|
372
|
-
|
|
373
|
-
- Inspect the diff in the generated files and validate light/dark semantics before committing.
|
|
374
|
-
|
|
375
|
-
Files affected by the script:
|
|
376
|
-
|
|
377
|
-
- [`src/tokens/primitives/colors.js`](src/tokens/primitives/colors.js)
|
|
378
|
-
- [`src/tokens/primitives/brand.js`](src/tokens/primitives/brand.js)
|
|
379
|
-
- [`src/tokens/semantic/text.js`](src/tokens/semantic/text.js)
|
|
380
|
-
- [`src/tokens/semantic/backgrounds.js`](src/tokens/semantic/backgrounds.js)
|
|
381
|
-
- [`src/tokens/semantic/borders.js`](src/tokens/semantic/borders.js)
|
|
382
|
-
|
|
383
|
-
### 🧰 Manual Maintenance (Without Script)
|
|
368
|
+
## Token Resolution
|
|
384
369
|
|
|
385
|
-
|
|
370
|
+
Tokens use a reference system for maintainability:
|
|
386
371
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
- **Semantic backgrounds (light/dark):** [`src/tokens/semantic/backgrounds.js`](src/tokens/semantic/backgrounds.js)
|
|
391
|
-
- **Semantic borders (light/dark):** [`src/tokens/semantic/borders.js`](src/tokens/semantic/borders.js)
|
|
392
|
-
- **Brand aliases:** [`src/tokens/colors-brand.js`](src/tokens/colors-brand.js)
|
|
393
|
-
- **Tailwind mappings (class names):** [`src/tokens/build/preset.js`](src/tokens/build/preset.js)
|
|
394
|
-
- **CSS vars output/selectors:** [`src/tokens/build/css-vars.js`](src/tokens/build/css-vars.js)
|
|
395
|
-
|
|
396
|
-
Checklist when adding a new token manually:
|
|
372
|
+
```javascript
|
|
373
|
+
// Define token reference
|
|
374
|
+
const textColor = tokenRef('primitives.neutral.900');
|
|
397
375
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
376
|
+
// Resolve to actual value
|
|
377
|
+
resolveRefsToCssVars({
|
|
378
|
+
primitives,
|
|
379
|
+
textSemantic
|
|
380
|
+
});
|
|
381
|
+
// Output: { '--text-textColorBase': '#171717' }
|
|
382
|
+
```
|
|
402
383
|
|
|
403
|
-
|
|
384
|
+
## Development
|
|
404
385
|
|
|
405
|
-
|
|
386
|
+
### Prerequisites
|
|
406
387
|
|
|
407
|
-
-
|
|
408
|
-
-
|
|
388
|
+
- Node.js (LTS version)
|
|
389
|
+
- pnpm (v9+)
|
|
409
390
|
|
|
410
|
-
|
|
391
|
+
### Scripts
|
|
411
392
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
- `brand-medium-gray` (#737373)
|
|
393
|
+
```bash
|
|
394
|
+
# Format code
|
|
395
|
+
pnpm format
|
|
416
396
|
|
|
417
|
-
|
|
397
|
+
# Dry-run package
|
|
398
|
+
pnpm pack:dry
|
|
418
399
|
|
|
419
|
-
|
|
420
|
-
|
|
400
|
+
# Publish (requires dist build)
|
|
401
|
+
pnpm publish
|
|
402
|
+
```
|
|
421
403
|
|
|
422
|
-
|
|
404
|
+
### Project Structure
|
|
423
405
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
406
|
+
```
|
|
407
|
+
packages/theme/
|
|
408
|
+
├── default.js # Main entry point
|
|
409
|
+
├── widget.js # Widget entry point
|
|
410
|
+
├── src/
|
|
411
|
+
│ ├── azion/ # CSS theme files
|
|
412
|
+
│ │ ├── theme.scss # Main theme
|
|
413
|
+
│ │ ├── theme-widget.scss
|
|
414
|
+
│ │ ├── _variables.scss
|
|
415
|
+
│ │ ├── _fonts.scss
|
|
416
|
+
│ │ ├── theme-base/ # Base components
|
|
417
|
+
│ │ ├── extended-components/
|
|
418
|
+
│ │ └── custom/
|
|
419
|
+
│ └── tokens/ # JavaScript tokens
|
|
420
|
+
│ ├── index.js # Public API
|
|
421
|
+
│ ├── primitives/ # Base colors
|
|
422
|
+
│ ├── semantic/ # Context-aware tokens
|
|
423
|
+
│ └── build/ # Build utilities
|
|
424
|
+
│ ├── preset.js
|
|
425
|
+
│ ├── css-vars.js
|
|
426
|
+
│ └── tailwind-plugin.js
|
|
427
|
+
└── package.json
|
|
428
|
+
```
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
## Browser Support
|
|
431
431
|
|
|
432
|
-
|
|
432
|
+
- Modern browsers with CSS Variables support
|
|
433
|
+
- Chrome, Firefox, Safari, Edge (latest versions)
|
|
433
434
|
|
|
434
|
-
|
|
435
|
+
## Versioning
|
|
435
436
|
|
|
436
|
-
|
|
437
|
-
import colors from 'azion-theme/tokens'
|
|
438
|
-
```
|
|
437
|
+
This package follows [Semantic Versioning](https://semver.org/). Version numbers are automatically managed via semantic-release.
|
|
439
438
|
|
|
440
|
-
|
|
439
|
+
## Contributing
|
|
441
440
|
|
|
442
|
-
|
|
443
|
-
import { primitives, brandColors, brandPrimitives, surfacePrimitives } from 'azion-theme/tokens'
|
|
444
|
-
```
|
|
441
|
+
This package is part of the Azion WebKit monorepo. Please see the main repository for contribution guidelines.
|
|
445
442
|
|
|
446
|
-
|
|
443
|
+
## License
|
|
447
444
|
|
|
448
|
-
|
|
449
|
-
import { primitives } from 'azion-theme/tokens/primitives/colors.js'
|
|
450
|
-
import { brandColors } from 'azion-theme/tokens/colors-brand.js'
|
|
451
|
-
```
|
|
445
|
+
MIT © Azion Technologies
|
|
452
446
|
|
|
453
|
-
|
|
454
|
-
Add to your `vite.config.js`:
|
|
447
|
+
## Links
|
|
455
448
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
conditions: ['import', 'module', 'browser', 'default']
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
```
|
|
449
|
+
- [GitHub Repository](https://github.com/aziontech/webkit)
|
|
450
|
+
- [NPM Package](https://www.npmjs.com/package/@aziontech/theme)
|
|
451
|
+
- [Issue Tracker](https://github.com/aziontech/webkit/issues)
|
|
463
452
|
|
|
464
|
-
##
|
|
453
|
+
## Changelog
|
|
465
454
|
|
|
466
|
-
|
|
455
|
+
See [CHANGELOG.md](./CHANGELOG.md) for release history.
|