@aziontech/theme 0.1.0 β 1.0.0
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 +1 -466
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,466 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
<p align="center">
|
|
6
|
-
<img
|
|
7
|
-
src="./doc/cover-image.png"
|
|
8
|
-
width="1200px"
|
|
9
|
-
/>
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
The Azion Theme repository is focused on sharing our style kit across interfaces and should be used in all company projects, including Azion Console Kit, Azion Site, Landing Pages, and all user interactions with Azion.
|
|
13
|
-
|
|
14
|
-
## π Table of Contents
|
|
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:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install azion-theme --save
|
|
30
|
-
# or
|
|
31
|
-
yarn add azion-theme
|
|
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
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
After updating the `package.json` file, run `npm install` in the root of your project to install the Azion Theme.
|
|
45
|
-
|
|
46
|
-
### π Integration with Front-End Project
|
|
47
|
-
|
|
48
|
-
To integrate the Azion Theme into your front-end project, you need to import the theme files in your project's entry point file (App.vue, main.js, index.js, etc.):
|
|
49
|
-
|
|
50
|
-
```javascript
|
|
51
|
-
import 'azion-theme/dark'
|
|
52
|
-
import 'azion-theme/light'
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Make sure to include these imports at the top of your entry point file to ensure the styles are applied correctly throughout your application.
|
|
56
|
-
|
|
57
|
-
## π» Development
|
|
58
|
-
|
|
59
|
-
To work locally, you should clone both the `azion-theme` repository and the other repository where the theme will be used.
|
|
60
|
-
|
|
61
|
-
### Example:
|
|
62
|
-
|
|
63
|
-
In this example, we will use the [azion-webkit](https://github.com/aziontech/azion-webkit) repository:
|
|
64
|
-
|
|
65
|
-
1. Clone the `azion-webkit` and `azion-theme` repositories:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
git clone https://github.com/aziontech/azion-webkit.git
|
|
69
|
-
git clone https://github.com/aziontech/azion-theme.git
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
2. Install dependencies and create the link point:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
cd ./azion-theme && npm i && npm link
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
3. Link the `azion-theme` to the `azion-webkit` project:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
cd ../azion-webkit && npm i && npm link azion-theme
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Any modifications made to `azion-theme` will be reflected on this development server with hot reload.
|
|
85
|
-
|
|
86
|
-
## ποΈ Building
|
|
87
|
-
|
|
88
|
-
This package is built automatically using Semantic Release during the release process. However, you can also build it manually for development purposes.
|
|
89
|
-
|
|
90
|
-
### Build Process
|
|
91
|
-
|
|
92
|
-
The build process includes the following steps:
|
|
93
|
-
|
|
94
|
-
1. **Validate Theme Tokens** - Ensures all token files are valid and properly formatted
|
|
95
|
-
2. **Clean dist/ Directory** - Removes any previously generated files
|
|
96
|
-
3. **Compile Tokens** - Merges all token definitions into a distributable format
|
|
97
|
-
4. **Generate CSS Files** - Creates CSS files with CSS variables for light/dark themes
|
|
98
|
-
5. **Generate package.json** - Creates a distributable package manifest
|
|
99
|
-
6. **Copy Documentation** - Copies LICENSE and README.md into the dist folder
|
|
100
|
-
7. **Generate Type Definitions** - Creates TypeScript declaration files
|
|
101
|
-
|
|
102
|
-
### Manual Build
|
|
103
|
-
|
|
104
|
-
To build the package manually:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
cd packages/theme
|
|
108
|
-
npm run build
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
This will generate the `dist/` directory with all necessary files.
|
|
112
|
-
|
|
113
|
-
### Preview Build
|
|
114
|
-
|
|
115
|
-
To preview what the build will look like without publishing:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
npm run pack:dry
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
This will generate a tarball preview using npm pack --dry-run.
|
|
122
|
-
|
|
123
|
-
### Clean Build Artifacts
|
|
124
|
-
|
|
125
|
-
To remove all generated files:
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
npm run clean
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
This will remove the `dist/` directory.
|
|
132
|
-
|
|
133
|
-
## π¦ Release Process
|
|
134
|
-
|
|
135
|
-
This package uses Semantic Release for automated versioning and publishing.
|
|
136
|
-
|
|
137
|
-
### Automatic Release Workflow
|
|
138
|
-
|
|
139
|
-
1. Commits following the conventional commit format are analyzed
|
|
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
|
|
146
|
-
|
|
147
|
-
### Commit Convention
|
|
148
|
-
|
|
149
|
-
Use this format for conventional commits:
|
|
150
|
-
|
|
151
|
-
```
|
|
152
|
-
[#ticket] type: subject
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Where:
|
|
156
|
-
|
|
157
|
-
- `[#ticket]` - Optional Jira ticket reference (e.g., `[#AZ-1234]`)
|
|
158
|
-
- `type` - One of: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`
|
|
159
|
-
- `subject` - Brief description of the change
|
|
160
|
-
|
|
161
|
-
Examples:
|
|
162
|
-
|
|
163
|
-
- `feat(tokens): Add new primary color variants`
|
|
164
|
-
- `fix(theme): Update border radius values`
|
|
165
|
-
- `chore(build): Update semantic-release configuration`
|
|
166
|
-
|
|
167
|
-
### Release Types
|
|
168
|
-
|
|
169
|
-
- **feat (new features)**: **minor** version increment
|
|
170
|
-
- **fix (bug fixes)**: **patch** version increment
|
|
171
|
-
- **hotfix (emergency fixes)**: **patch** version increment
|
|
172
|
-
- **chore, docs, style, refactor**: **patch** version increment
|
|
173
|
-
|
|
174
|
-
### CI/CD Workflow
|
|
175
|
-
|
|
176
|
-
The workflow is defined in `.github/workflows/package-theme.yml` and runs on pushes to the `main` branch when `packages/theme/**` files change.
|
|
177
|
-
|
|
178
|
-
### Required Secrets
|
|
179
|
-
|
|
180
|
-
To enable automated npm publishing, configure the following GitHub secrets:
|
|
181
|
-
|
|
182
|
-
- `NPM_TOKEN` - Your npm authentication token with publish permissions
|
|
183
|
-
|
|
184
|
-
Without this token, the build will still complete and generate release notes, but npm publishing will be skipped.
|
|
185
|
-
|
|
186
|
-
### Manual Release
|
|
187
|
-
|
|
188
|
-
You can also trigger a manual release:
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
npx semantic-release
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
This will require the `NPM_TOKEN` to be available in your environment.
|
|
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
|
-
|
|
202
|
-
```javascript
|
|
203
|
-
// tailwind.config.js
|
|
204
|
-
import typography from '@tailwindcss/typography'
|
|
205
|
-
import { tokenUtilities } from 'azion-theme/tokens/build/tailwind-plugin'
|
|
206
|
-
import colors from 'azion-theme/tokens'
|
|
207
|
-
|
|
208
|
-
export default {
|
|
209
|
-
content: ['./src/**/*.{js,ts,jsx,tsx,html}'],
|
|
210
|
-
darkMode: ['class', '.dark', '.azion.azion-dark'],
|
|
211
|
-
theme: {
|
|
212
|
-
extend: {
|
|
213
|
-
colors: {
|
|
214
|
-
...colors
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
plugins: [tokenUtilities(), typography]
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
#### Token structure overview
|
|
223
|
-
|
|
224
|
-
**Global/Primitive tokens** (direct values, use with `dark:` variant):
|
|
225
|
-
|
|
226
|
-
```javascript
|
|
227
|
-
// Primitive palettes (all with 50-950 shades)
|
|
228
|
-
colors.orange[500] // #fe601f
|
|
229
|
-
colors.violet[500] // #8a84ec
|
|
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
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
**Semantic tokens** (theme-aware, no `dark:` variant needed):
|
|
246
|
-
|
|
247
|
-
```javascript
|
|
248
|
-
// Text colors - automatically switches between light/dark
|
|
249
|
-
colors.text.base // neutral-900 (light) / neutral-50 (dark)
|
|
250
|
-
colors.text.muted // neutral-600 (light) / neutral-400 (dark)
|
|
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)
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
#### Usage in HTML/Tailwind Classes
|
|
265
|
-
|
|
266
|
-
**Using semantic tokens** (theme-aware, no `dark:` variant needed):
|
|
267
|
-
|
|
268
|
-
```html
|
|
269
|
-
<!-- Semantic background - automatically switches theme -->
|
|
270
|
-
<div class="bg-layer1">Layer 1 background (white in light, dark in dark mode)</div>
|
|
271
|
-
|
|
272
|
-
<!-- Semantic text colors -->
|
|
273
|
-
<p class="text-base">Base text color (auto-adapts to theme)</p>
|
|
274
|
-
|
|
275
|
-
<!-- Semantic borders -->
|
|
276
|
-
<div class="border border-base">Border adapts to current theme</div>
|
|
277
|
-
|
|
278
|
-
<!-- Semantic interactive states -->
|
|
279
|
-
<button class="bg-layer1 hover:bg-layer1-hover border border-primary text-primary">
|
|
280
|
-
Themed button
|
|
281
|
-
</button>
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
**Using global tokens** (can use `dark:` in this cases):
|
|
285
|
-
|
|
286
|
-
```html
|
|
287
|
-
<!-- Background with dark variant -->
|
|
288
|
-
<div class="bg-neutral-50 dark:bg-neutral-950">Adaptive background</div>
|
|
289
|
-
|
|
290
|
-
<!-- Text colors with dark variant -->
|
|
291
|
-
<p class="text-neutral-900 dark:text-neutral-100">Primary text color</p>
|
|
292
|
-
|
|
293
|
-
<!-- Border colors with dark variant -->
|
|
294
|
-
<div class="border border-neutral-200 dark:border-neutral-800">Card with adaptive border</div>
|
|
295
|
-
|
|
296
|
-
<!-- Using brand colors (no dark variant needed) -->
|
|
297
|
-
<button class="bg-orange-500 text-white hover:bg-orange-600">Action Button</button>
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
**Available token classes:**
|
|
301
|
-
|
|
302
|
-
_Global tokens_ (use with `dark:` variant):
|
|
303
|
-
|
|
304
|
-
- **Neutrals:** `neutral-50` β `neutral-950` (surface backgrounds, text, borders)
|
|
305
|
-
- **Brand:** `orange-50` β `orange-950` (primary actions)
|
|
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):
|
|
310
|
-
|
|
311
|
-
- **Text:** `text-base`, `text-muted`, `text-accent`, `text-primary`, `text-link`
|
|
312
|
-
- **Background:** `bg-layer1`, `bg-layer2`, `bg-canvas`, `bg-base`
|
|
313
|
-
- **Border:** `border-base`, `border-primary`, `border-accent`, `border-warning`, `border-success`, `border-danger`
|
|
314
|
-
|
|
315
|
-
### Theme Switch Compatibility
|
|
316
|
-
|
|
317
|
-
The CSS variable initializer targets both the Tailwind `.dark` class and the existing theme classes used by the SCSS theme:
|
|
318
|
-
|
|
319
|
-
```css
|
|
320
|
-
:root,
|
|
321
|
-
[data-theme='light'],
|
|
322
|
-
.azion.azion-light {
|
|
323
|
-
/* light vars */
|
|
324
|
-
}
|
|
325
|
-
[data-theme='dark'],
|
|
326
|
-
.dark,
|
|
327
|
-
.azion.azion-dark {
|
|
328
|
-
/* dark vars */
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Granular Imports (Advanced)
|
|
333
|
-
|
|
334
|
-
```javascript
|
|
335
|
-
// Named exports for specific token types
|
|
336
|
-
import {
|
|
337
|
-
primitives,
|
|
338
|
-
brandColors,
|
|
339
|
-
brandPrimitives,
|
|
340
|
-
surfacePrimitives,
|
|
341
|
-
preset,
|
|
342
|
-
createTailwindConfig,
|
|
343
|
-
tokenUtilities
|
|
344
|
-
} from 'azion-theme/tokens'
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### π οΈ Sync & Maintenance (With Script)
|
|
348
|
-
|
|
349
|
-
#### How to feed new and changed tokens from Figma
|
|
350
|
-
|
|
351
|
-
1. **Update Figma Variables**
|
|
352
|
-
- Ensure **Global** and **Semantic** variables are updated and organized correctly (naming, groups, modes, and values).
|
|
353
|
-
|
|
354
|
-
2. **Open the Tokens Studio for Figma plugin**
|
|
355
|
-
|
|
356
|
-
3. **Import Figma Variables into Tokens Studio**
|
|
357
|
-
- Use Tokens Studioβs import-from-variables flow to bring the current Variables state into the token sets.
|
|
358
|
-
|
|
359
|
-
4. **Export to file/folder**
|
|
360
|
-
- Export using **Multiple files**.
|
|
361
|
-
|
|
362
|
-
5. **Copy the exported files into this repo**
|
|
363
|
-
- Place them under [`src/tokens/figma-reference-tokens-studio/`](src/tokens/figma-reference-tokens-studio:1) (replace existing contents).
|
|
364
|
-
|
|
365
|
-
6. **Regenerate the code tokens**
|
|
366
|
-
- Run:
|
|
367
|
-
|
|
368
|
-
```bash
|
|
369
|
-
node ./scripts/figma-sync.js
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
7. **Review and commit**
|
|
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)
|
|
384
|
-
|
|
385
|
-
When updating or adding tokens manually, edit the files below depending on the token type:
|
|
386
|
-
|
|
387
|
-
- **Primitive palettes:** [`src/tokens/primitives/colors.js`](src/tokens/primitives/colors.js)
|
|
388
|
-
- **Brand + surface primitives:** [`src/tokens/primitives/brand.js`](src/tokens/primitives/brand.js)
|
|
389
|
-
- **Semantic text (light/dark):** [`src/tokens/semantic/text.js`](src/tokens/semantic/text.js)
|
|
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:
|
|
397
|
-
|
|
398
|
-
1. Add/update the primitive or surface scale value (if needed).
|
|
399
|
-
2. Add matching semantic entries for both `light` and `dark`.
|
|
400
|
-
3. Update Tailwind mappings if you want a class for the token.
|
|
401
|
-
4. Regenerate or verify CSS vars output for both themes.
|
|
402
|
-
|
|
403
|
-
### π¨ Available Colors
|
|
404
|
-
|
|
405
|
-
#### Main Palette (Orange)
|
|
406
|
-
|
|
407
|
-
- `orange-50` β `orange-950`
|
|
408
|
-
- **Primary**: `orange-500` (#fe601f)
|
|
409
|
-
|
|
410
|
-
#### Brand Palette
|
|
411
|
-
|
|
412
|
-
- `brand-black` (#0a0a0a)
|
|
413
|
-
- `brand-white` (#fafafa)
|
|
414
|
-
- `brand-dark-gray` (#171717)
|
|
415
|
-
- `brand-medium-gray` (#737373)
|
|
416
|
-
|
|
417
|
-
#### Other Complete Palettes
|
|
418
|
-
|
|
419
|
-
- **Violet, Slate, Gray, Neutral, Blue, Red, Yellow, Green**
|
|
420
|
-
- All with 11 shades (50 β 950)
|
|
421
|
-
|
|
422
|
-
#### Semantic Colors
|
|
423
|
-
|
|
424
|
-
- `primary` (orange-500)
|
|
425
|
-
- `success` (green-500)
|
|
426
|
-
- `warning` (yellow-500)
|
|
427
|
-
- `error` (red-500)
|
|
428
|
-
- `info` (blue-500)
|
|
429
|
-
|
|
430
|
-
### β οΈ Troubleshooting
|
|
431
|
-
|
|
432
|
-
#### If you get import errors:
|
|
433
|
-
|
|
434
|
-
**ES Modules (recommended)**
|
|
435
|
-
|
|
436
|
-
```javascript
|
|
437
|
-
import colors from 'azion-theme/tokens'
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
**Named exports**
|
|
441
|
-
|
|
442
|
-
```javascript
|
|
443
|
-
import { primitives, brandColors, brandPrimitives, surfacePrimitives } from 'azion-theme/tokens'
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
**Direct file imports**
|
|
447
|
-
|
|
448
|
-
```javascript
|
|
449
|
-
import { primitives } from 'azion-theme/tokens/primitives/colors.js'
|
|
450
|
-
import { brandColors } from 'azion-theme/tokens/colors-brand.js'
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
**Configure Vite (if using Vite)**
|
|
454
|
-
Add to your `vite.config.js`:
|
|
455
|
-
|
|
456
|
-
```javascript
|
|
457
|
-
export default {
|
|
458
|
-
resolve: {
|
|
459
|
-
conditions: ['import', 'module', 'browser', 'default']
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
## π Links
|
|
465
|
-
|
|
466
|
-
- [Figma Global Tokens](https://www.figma.com/design/t97pXRs7xME3SJDs5iZ5RF/Global-Tokens?node-id=0-1)
|
|
1
|
+
# @aziontech/theme
|