@aziontech/theme 0.1.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/LICENSE +21 -0
- package/README.md +466 -0
- package/package.json +52 -0
- package/src/azion/_custom.scss +3 -0
- package/src/azion/_extensions.scss +37 -0
- package/src/azion/_fonts.scss +153 -0
- package/src/azion/_variables-widget.scss +400 -0
- package/src/azion/_variables.scss +407 -0
- package/src/azion/custom/_code.scss +11 -0
- package/src/azion/custom/_focus.scss +5 -0
- package/src/azion/custom/_scrollbehavior.scss +6 -0
- package/src/azion/custom/_selection.scss +4 -0
- package/src/azion/custom/_special-button.scss +57 -0
- package/src/azion/extended-components/_autocomplete.scss +13 -0
- package/src/azion/extended-components/_badge.scss +53 -0
- package/src/azion/extended-components/_breadcumb.scss +18 -0
- package/src/azion/extended-components/_button.scss +134 -0
- package/src/azion/extended-components/_calendar.scss +310 -0
- package/src/azion/extended-components/_carousel.scss +9 -0
- package/src/azion/extended-components/_checkbox.scss +33 -0
- package/src/azion/extended-components/_datatable.scss +130 -0
- package/src/azion/extended-components/_dialog.scss +45 -0
- package/src/azion/extended-components/_divider.scss +37 -0
- package/src/azion/extended-components/_dropdown.scss +10 -0
- package/src/azion/extended-components/_dropdownitem.scss +13 -0
- package/src/azion/extended-components/_inlinemessage.scss +10 -0
- package/src/azion/extended-components/_inputnumber.scss +40 -0
- package/src/azion/extended-components/_inputpassword.scss +4 -0
- package/src/azion/extended-components/_inputswitch.scss +53 -0
- package/src/azion/extended-components/_listbox.scss +35 -0
- package/src/azion/extended-components/_markdown.scss +135 -0
- package/src/azion/extended-components/_menuitem.scss +22 -0
- package/src/azion/extended-components/_multiselect.scss +167 -0
- package/src/azion/extended-components/_overlaypanel.scss +18 -0
- package/src/azion/extended-components/_picklist.scss +25 -0
- package/src/azion/extended-components/_progressbar.scss +6 -0
- package/src/azion/extended-components/_radiobutton.scss +63 -0
- package/src/azion/extended-components/_selectbutton.scss +36 -0
- package/src/azion/extended-components/_sidebar.scss +28 -0
- package/src/azion/extended-components/_splitbutton.scss +22 -0
- package/src/azion/extended-components/_tabmenu.scss +21 -0
- package/src/azion/extended-components/_tabview.scss +41 -0
- package/src/azion/extended-components/_tag.scss +47 -0
- package/src/azion/extended-components/_toast.scss +9 -0
- package/src/azion/extended-components/_tooltip.scss +7 -0
- package/src/azion/extended-components/_treeselect.scss +10 -0
- package/src/azion/extended-components/jsonform/_inputcheckbox.scss +41 -0
- package/src/azion/extended-components/jsonform/_inputtext.scss +26 -0
- package/src/azion/extended-components/jsonform/_label.scss +185 -0
- package/src/azion/extended-components/jsonform/_select.scss +34 -0
- package/src/azion/theme-base/_colors.scss +18 -0
- package/src/azion/theme-base/_common.scss +75 -0
- package/src/azion/theme-base/_components.scss +103 -0
- package/src/azion/theme-base/_mixins.scss +250 -0
- package/src/azion/theme-base/components/button/_button.scss +567 -0
- package/src/azion/theme-base/components/button/_speeddial.scss +97 -0
- package/src/azion/theme-base/components/button/_splitbutton.scss +390 -0
- package/src/azion/theme-base/components/data/_carousel.scss +37 -0
- package/src/azion/theme-base/components/data/_datatable.scss +347 -0
- package/src/azion/theme-base/components/data/_dataview.scss +47 -0
- package/src/azion/theme-base/components/data/_filter.scss +138 -0
- package/src/azion/theme-base/components/data/_orderlist.scss +70 -0
- package/src/azion/theme-base/components/data/_organizationchart.scss +50 -0
- package/src/azion/theme-base/components/data/_paginator.scss +92 -0
- package/src/azion/theme-base/components/data/_picklist.scss +70 -0
- package/src/azion/theme-base/components/data/_timeline.scss +38 -0
- package/src/azion/theme-base/components/data/_tree.scss +90 -0
- package/src/azion/theme-base/components/data/_treetable.scss +251 -0
- package/src/azion/theme-base/components/file/_fileupload.scss +82 -0
- package/src/azion/theme-base/components/input/_autocomplete.scss +114 -0
- package/src/azion/theme-base/components/input/_calendar.scss +251 -0
- package/src/azion/theme-base/components/input/_cascadeselect.scss +106 -0
- package/src/azion/theme-base/components/input/_checkbox.scss +86 -0
- package/src/azion/theme-base/components/input/_chips.scss +53 -0
- package/src/azion/theme-base/components/input/_colorpicker.scss +18 -0
- package/src/azion/theme-base/components/input/_dropdown.scss +147 -0
- package/src/azion/theme-base/components/input/_editor.scss +122 -0
- package/src/azion/theme-base/components/input/_inputgroup.scss +74 -0
- package/src/azion/theme-base/components/input/_inputnumber.scss +5 -0
- package/src/azion/theme-base/components/input/_inputswitch.scss +62 -0
- package/src/azion/theme-base/components/input/_inputtext.scss +100 -0
- package/src/azion/theme-base/components/input/_listbox.scss +89 -0
- package/src/azion/theme-base/components/input/_multiselect.scss +166 -0
- package/src/azion/theme-base/components/input/_password.scss +33 -0
- package/src/azion/theme-base/components/input/_radiobutton.scss +78 -0
- package/src/azion/theme-base/components/input/_rating.scss +60 -0
- package/src/azion/theme-base/components/input/_selectbutton.scss +50 -0
- package/src/azion/theme-base/components/input/_slider.scss +49 -0
- package/src/azion/theme-base/components/input/_togglebutton.scss +52 -0
- package/src/azion/theme-base/components/input/_treeselect.scss +91 -0
- package/src/azion/theme-base/components/menu/_breadcrumb.scss +42 -0
- package/src/azion/theme-base/components/menu/_contextmenu.scss +39 -0
- package/src/azion/theme-base/components/menu/_dock.scss +95 -0
- package/src/azion/theme-base/components/menu/_megamenu.scss +55 -0
- package/src/azion/theme-base/components/menu/_menu.scss +33 -0
- package/src/azion/theme-base/components/menu/_menubar.scss +141 -0
- package/src/azion/theme-base/components/menu/_panelmenu.scss +153 -0
- package/src/azion/theme-base/components/menu/_steps.scss +56 -0
- package/src/azion/theme-base/components/menu/_tabmenu.scss +49 -0
- package/src/azion/theme-base/components/menu/_tieredmenu.scss +43 -0
- package/src/azion/theme-base/components/messages/_inlinemessage.scss +64 -0
- package/src/azion/theme-base/components/messages/_message.scss +100 -0
- package/src/azion/theme-base/components/messages/_toast.scss +100 -0
- package/src/azion/theme-base/components/misc/_avatar.scss +30 -0
- package/src/azion/theme-base/components/misc/_badge.scss +48 -0
- package/src/azion/theme-base/components/misc/_blockui.scss +0 -0
- package/src/azion/theme-base/components/misc/_chip.scss +39 -0
- package/src/azion/theme-base/components/misc/_inplace.scss +17 -0
- package/src/azion/theme-base/components/misc/_progressbar.scss +17 -0
- package/src/azion/theme-base/components/misc/_progressspinner.scss +49 -0
- package/src/azion/theme-base/components/misc/_scrolltop.scss +25 -0
- package/src/azion/theme-base/components/misc/_skeleton.scss +8 -0
- package/src/azion/theme-base/components/misc/_tag.scss +40 -0
- package/src/azion/theme-base/components/misc/_terminal.scss +12 -0
- package/src/azion/theme-base/components/multimedia/_galleria.scss +151 -0
- package/src/azion/theme-base/components/multimedia/_image.scss +54 -0
- package/src/azion/theme-base/components/overlay/_confirmpopup.scss +72 -0
- package/src/azion/theme-base/components/overlay/_dialog.scss +64 -0
- package/src/azion/theme-base/components/overlay/_overlaypanel.scss +38 -0
- package/src/azion/theme-base/components/overlay/_sidebar.scss +23 -0
- package/src/azion/theme-base/components/overlay/_tooltip.scss +33 -0
- package/src/azion/theme-base/components/panel/_accordion.scss +118 -0
- package/src/azion/theme-base/components/panel/_card.scss +30 -0
- package/src/azion/theme-base/components/panel/_divider.scss +40 -0
- package/src/azion/theme-base/components/panel/_fieldset.scss +51 -0
- package/src/azion/theme-base/components/panel/_panel.scss +47 -0
- package/src/azion/theme-base/components/panel/_scrollpanel.scss +11 -0
- package/src/azion/theme-base/components/panel/_splitter.scss +24 -0
- package/src/azion/theme-base/components/panel/_tabview.scss +66 -0
- package/src/azion/theme-base/components/panel/_toolbar.scss +11 -0
- package/src/azion/theme-widget.scss +9 -0
- package/src/azion/theme.scss +9 -0
- package/src/azion/variables/_button.scss +438 -0
- package/src/azion/variables/_data.scss +346 -0
- package/src/azion/variables/_form.scss +570 -0
- package/src/azion/variables/_general.scss +149 -0
- package/src/azion/variables/_media.scss +231 -0
- package/src/azion/variables/_menu.scss +287 -0
- package/src/azion/variables/_message.scss +145 -0
- package/src/azion/variables/_misc.scss +143 -0
- package/src/azion/variables/_overlay.scss +67 -0
- package/src/azion/variables/_panel.scss +327 -0
- package/src/tokens/README.md +345 -0
- package/src/tokens/build/css-vars.js +41 -0
- package/src/tokens/build/preset.js +69 -0
- package/src/tokens/build/refs.js +7 -0
- package/src/tokens/build/resolve.js +102 -0
- package/src/tokens/build/tailwind-helper.js +12 -0
- package/src/tokens/build/tailwind-plugin.js +175 -0
- package/src/tokens/colors-brand.js +24 -0
- package/src/tokens/index.js +16 -0
- package/src/tokens/primitives/brand.js +69 -0
- package/src/tokens/primitives/colors.js +133 -0
- package/src/tokens/semantic/backgrounds.js +48 -0
- package/src/tokens/semantic/borders.js +46 -0
- package/src/tokens/semantic/text.js +78 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
|
|
2
|
+
<h1 align="center">azion-theme</h1>
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<img
|
|
8
|
+
src="./doc/cover-image.png"
|
|
9
|
+
width="1200px"
|
|
10
|
+
/>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
|
|
15
|
+
## 📋 Table of Contents
|
|
16
|
+
|
|
17
|
+
- [Installation](#-installation)
|
|
18
|
+
- [Usage](#-usage)
|
|
19
|
+
- [Development](#-development)
|
|
20
|
+
- [Design Tokens](#-design-tokens)
|
|
21
|
+
- [Links](#-links)
|
|
22
|
+
|
|
23
|
+
## 🚀 Installation
|
|
24
|
+
|
|
25
|
+
To install the `azion-theme` project, you need to follow the command. Choose one of your preferences: npm or yarn:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install azion-theme --save
|
|
29
|
+
# or
|
|
30
|
+
yarn add azion-theme
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Alternatively, you can configure the `package.json` file by adding the dependency:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"azion-theme": "^1.4.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
After updating the `package.json` file, run `npm install` in the root of your project to install the Azion Theme.
|
|
44
|
+
|
|
45
|
+
### 🔗 Integration with Front-End Project
|
|
46
|
+
|
|
47
|
+
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.):
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
import 'azion-theme/dark';
|
|
51
|
+
import 'azion-theme/light';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Make sure to include these imports at the top of your entry point file to ensure the styles are applied correctly throughout your application.
|
|
55
|
+
|
|
56
|
+
## 💻 Development
|
|
57
|
+
|
|
58
|
+
To work locally, you should clone both the `azion-theme` repository and the other repository where the theme will be used.
|
|
59
|
+
|
|
60
|
+
### Example:
|
|
61
|
+
|
|
62
|
+
In this example, we will use the [azion-webkit](https://github.com/aziontech/azion-webkit) repository:
|
|
63
|
+
|
|
64
|
+
1. Clone the `azion-webkit` and `azion-theme` repositories:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/aziontech/azion-webkit.git
|
|
68
|
+
git clone https://github.com/aziontech/azion-theme.git
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
2. Install dependencies and create the link point:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cd ./azion-theme && npm i && npm link
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
3. Link the `azion-theme` to the `azion-webkit` project:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd ../azion-webkit && npm i && npm link azion-theme
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Any modifications made to `azion-theme` will be reflected on this development server with hot reload.
|
|
84
|
+
|
|
85
|
+
## 🎨 Design Tokens
|
|
86
|
+
|
|
87
|
+
This project includes **primitive color tokens** extracted directly from Figma, ready to be consumed via Tailwind CSS.
|
|
88
|
+
|
|
89
|
+
### 🚀 How to Use the Tokens
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
// tailwind.config.js
|
|
93
|
+
import typography from '@tailwindcss/typography';
|
|
94
|
+
import { tokenUtilities } from 'azion-theme/tokens/build/tailwind-plugin';
|
|
95
|
+
import colors from 'azion-theme/tokens';
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
content: ['./src/**/*.{js,ts,jsx,tsx,html}'],
|
|
99
|
+
darkMode: ['class', '.dark', '.azion.azion-dark'],
|
|
100
|
+
theme: {
|
|
101
|
+
extend: {
|
|
102
|
+
colors: {
|
|
103
|
+
...colors,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
plugins: [tokenUtilities(), typography],
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Token structure overview
|
|
112
|
+
|
|
113
|
+
**Global/Primitive tokens** (direct values, use with `dark:` variant):
|
|
114
|
+
```javascript
|
|
115
|
+
// Primitive palettes (all with 50-950 shades)
|
|
116
|
+
colors.orange[500]; // #fe601f
|
|
117
|
+
colors.violet[500]; // #8a84ec
|
|
118
|
+
colors.neutral[900]; // #171717
|
|
119
|
+
|
|
120
|
+
// Brand colors
|
|
121
|
+
colors.brand.black; // #0a0a0a
|
|
122
|
+
colors.brand.white; // #fafafa
|
|
123
|
+
colors.brand.orange; // #fe601f
|
|
124
|
+
|
|
125
|
+
// Brand primitives (aliases)
|
|
126
|
+
colors.primary[500]; // orange palette
|
|
127
|
+
colors.accent[500]; // violet palette
|
|
128
|
+
|
|
129
|
+
// Surface primitives (neutral-based)
|
|
130
|
+
colors.surface[950]; // #0a0a0a
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Semantic tokens** (theme-aware, no `dark:` variant needed):
|
|
134
|
+
```javascript
|
|
135
|
+
// Text colors - automatically switches between light/dark
|
|
136
|
+
colors.text.base; // neutral-900 (light) / neutral-50 (dark)
|
|
137
|
+
colors.text.muted; // neutral-600 (light) / neutral-400 (dark)
|
|
138
|
+
colors.text.accent; // accent-500 (both modes)
|
|
139
|
+
|
|
140
|
+
// Background colors - theme-aware layers
|
|
141
|
+
colors.background.layer1; // surface-0 (light) / surface-800 (dark)
|
|
142
|
+
colors.background.layer2; // surface-50 (light) / surface-700 (dark)
|
|
143
|
+
colors.background.canvas; // surface-100 (light) / surface-950 (dark)
|
|
144
|
+
|
|
145
|
+
// Border colors - theme-aware borders
|
|
146
|
+
colors.border.base; // surface-200 (light) / surface-700 (dark)
|
|
147
|
+
colors.border.primary; // primary-500 (both modes)
|
|
148
|
+
colors.border.accent; // accent-500 (both modes)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Usage in HTML/Tailwind Classes
|
|
152
|
+
|
|
153
|
+
**Using semantic tokens** (theme-aware, no `dark:` variant needed):
|
|
154
|
+
```html
|
|
155
|
+
<!-- Semantic background - automatically switches theme -->
|
|
156
|
+
<div class="bg-layer1">
|
|
157
|
+
Layer 1 background (white in light, dark in dark mode)
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<!-- Semantic text colors -->
|
|
161
|
+
<p class="text-base">
|
|
162
|
+
Base text color (auto-adapts to theme)
|
|
163
|
+
</p>
|
|
164
|
+
|
|
165
|
+
<!-- Semantic borders -->
|
|
166
|
+
<div class="border border-base">
|
|
167
|
+
Border adapts to current theme
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<!-- Semantic interactive states -->
|
|
171
|
+
<button class="bg-layer1 hover:bg-layer1-hover border border-primary text-primary">
|
|
172
|
+
Themed button
|
|
173
|
+
</button>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Using global tokens** (can use `dark:` in this cases):
|
|
177
|
+
```html
|
|
178
|
+
<!-- Background with dark variant -->
|
|
179
|
+
<div class="bg-neutral-50 dark:bg-neutral-950">
|
|
180
|
+
Adaptive background
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<!-- Text colors with dark variant -->
|
|
184
|
+
<p class="text-neutral-900 dark:text-neutral-100">
|
|
185
|
+
Primary text color
|
|
186
|
+
</p>
|
|
187
|
+
|
|
188
|
+
<!-- Border colors with dark variant -->
|
|
189
|
+
<div class="border border-neutral-200 dark:border-neutral-800">
|
|
190
|
+
Card with adaptive border
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<!-- Using brand colors (no dark variant needed) -->
|
|
194
|
+
<button class="bg-orange-500 text-white hover:bg-orange-600">
|
|
195
|
+
Action Button
|
|
196
|
+
</button>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Available token classes:**
|
|
200
|
+
|
|
201
|
+
*Global tokens* (use with `dark:` variant):
|
|
202
|
+
- **Neutrals:** `neutral-50` → `neutral-950` (surface backgrounds, text, borders)
|
|
203
|
+
- **Brand:** `orange-50` → `orange-950` (primary actions)
|
|
204
|
+
- **Accent:** `violet-50` → `violet-950` (secondary highlights)
|
|
205
|
+
- **Status:** `red-*`, `green-*`, `yellow-*`, `blue-*` (semantic status colors)
|
|
206
|
+
|
|
207
|
+
*Semantic tokens* (theme-aware, no `dark:` needed):
|
|
208
|
+
- **Text:** `text-base`, `text-muted`, `text-accent`, `text-primary`, `text-link`
|
|
209
|
+
- **Background:** `bg-layer1`, `bg-layer2`, `bg-canvas`, `bg-base`
|
|
210
|
+
- **Border:** `border-base`, `border-primary`, `border-accent`, `border-warning`, `border-success`, `border-danger`
|
|
211
|
+
|
|
212
|
+
### Theme Switch Compatibility
|
|
213
|
+
|
|
214
|
+
The CSS variable initializer targets both the Tailwind `.dark` class and the existing theme classes used by the SCSS theme:
|
|
215
|
+
|
|
216
|
+
```css
|
|
217
|
+
:root, [data-theme=light], .azion.azion-light { /* light vars */ }
|
|
218
|
+
[data-theme=dark], .dark, .azion.azion-dark { /* dark vars */ }
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Granular Imports (Advanced)
|
|
222
|
+
|
|
223
|
+
```javascript
|
|
224
|
+
// Named exports for specific token types
|
|
225
|
+
import {
|
|
226
|
+
primitives,
|
|
227
|
+
brandColors,
|
|
228
|
+
brandPrimitives,
|
|
229
|
+
surfacePrimitives,
|
|
230
|
+
preset,
|
|
231
|
+
createTailwindConfig,
|
|
232
|
+
tokenUtilities
|
|
233
|
+
} from 'azion-theme/tokens';
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 🛠️ Sync & Maintenance (With Script)
|
|
237
|
+
|
|
238
|
+
#### How to feed new and changed tokens from Figma
|
|
239
|
+
|
|
240
|
+
1) **Update Figma Variables**
|
|
241
|
+
- Ensure **Global** and **Semantic** variables are updated and organized correctly (naming, groups, modes, and values).
|
|
242
|
+
|
|
243
|
+
2) **Open the Tokens Studio for Figma plugin**
|
|
244
|
+
|
|
245
|
+
3) **Import Figma Variables into Tokens Studio**
|
|
246
|
+
- Use Tokens Studio’s import-from-variables flow to bring the current Variables state into the token sets.
|
|
247
|
+
|
|
248
|
+
4) **Export to file/folder**
|
|
249
|
+
- Export using **Multiple files**.
|
|
250
|
+
|
|
251
|
+
5) **Copy the exported files into this repo**
|
|
252
|
+
- Place them under [`src/tokens/figma-reference-tokens-studio/`](src/tokens/figma-reference-tokens-studio:1) (replace existing contents).
|
|
253
|
+
|
|
254
|
+
6) **Regenerate the code tokens**
|
|
255
|
+
- Run:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
node ./scripts/figma-sync.js
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
7) **Review and commit**
|
|
262
|
+
- Inspect the diff in the generated files and validate light/dark semantics before committing.
|
|
263
|
+
|
|
264
|
+
Files affected by the script:
|
|
265
|
+
- [`src/tokens/primitives/colors.js`](src/tokens/primitives/colors.js)
|
|
266
|
+
- [`src/tokens/primitives/brand.js`](src/tokens/primitives/brand.js)
|
|
267
|
+
- [`src/tokens/semantic/text.js`](src/tokens/semantic/text.js)
|
|
268
|
+
- [`src/tokens/semantic/backgrounds.js`](src/tokens/semantic/backgrounds.js)
|
|
269
|
+
- [`src/tokens/semantic/borders.js`](src/tokens/semantic/borders.js)
|
|
270
|
+
|
|
271
|
+
### 🧰 Manual Maintenance (Without Script)
|
|
272
|
+
|
|
273
|
+
When updating or adding tokens manually, edit the files below depending on the token type:
|
|
274
|
+
|
|
275
|
+
- **Primitive palettes:** [`src/tokens/primitives/colors.js`](src/tokens/primitives/colors.js)
|
|
276
|
+
- **Brand + surface primitives:** [`src/tokens/primitives/brand.js`](src/tokens/primitives/brand.js)
|
|
277
|
+
- **Semantic text (light/dark):** [`src/tokens/semantic/text.js`](src/tokens/semantic/text.js)
|
|
278
|
+
- **Semantic backgrounds (light/dark):** [`src/tokens/semantic/backgrounds.js`](src/tokens/semantic/backgrounds.js)
|
|
279
|
+
- **Semantic borders (light/dark):** [`src/tokens/semantic/borders.js`](src/tokens/semantic/borders.js)
|
|
280
|
+
- **Brand aliases:** [`src/tokens/colors-brand.js`](src/tokens/colors-brand.js)
|
|
281
|
+
- **Tailwind mappings (class names):** [`src/tokens/build/preset.js`](src/tokens/build/preset.js)
|
|
282
|
+
- **CSS vars output/selectors:** [`src/tokens/build/css-vars.js`](src/tokens/build/css-vars.js)
|
|
283
|
+
|
|
284
|
+
Checklist when adding a new token manually:
|
|
285
|
+
1) Add/update the primitive or surface scale value (if needed).
|
|
286
|
+
2) Add matching semantic entries for both `light` and `dark`.
|
|
287
|
+
3) Update Tailwind mappings if you want a class for the token.
|
|
288
|
+
4) Regenerate or verify CSS vars output for both themes.
|
|
289
|
+
|
|
290
|
+
### 🎨 Available Colors
|
|
291
|
+
|
|
292
|
+
#### Main Palette (Orange)
|
|
293
|
+
- `orange-50` → `orange-950`
|
|
294
|
+
- **Primary**: `orange-500` (#fe601f)
|
|
295
|
+
|
|
296
|
+
#### Brand Palette
|
|
297
|
+
- `brand-black` (#0a0a0a)
|
|
298
|
+
- `brand-white` (#fafafa)
|
|
299
|
+
- `brand-dark-gray` (#171717)
|
|
300
|
+
- `brand-medium-gray` (#737373)
|
|
301
|
+
|
|
302
|
+
#### Other Complete Palettes
|
|
303
|
+
- **Violet, Slate, Gray, Neutral, Blue, Red, Yellow, Green**
|
|
304
|
+
- All with 11 shades (50 → 950)
|
|
305
|
+
|
|
306
|
+
#### Semantic Colors
|
|
307
|
+
- `primary` (orange-500)
|
|
308
|
+
- `success` (green-500)
|
|
309
|
+
- `warning` (yellow-500)
|
|
310
|
+
- `error` (red-500)
|
|
311
|
+
- `info` (blue-500)
|
|
312
|
+
|
|
313
|
+
### ⚠️ Troubleshooting
|
|
314
|
+
|
|
315
|
+
#### If you get import errors:
|
|
316
|
+
|
|
317
|
+
**ES Modules (recommended)**
|
|
318
|
+
```javascript
|
|
319
|
+
import colors from 'azion-theme/tokens';
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Named exports**
|
|
323
|
+
```javascript
|
|
324
|
+
import { primitives, brandColors, brandPrimitives, surfacePrimitives } from 'azion-theme/tokens';
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Direct file imports**
|
|
328
|
+
```javascript
|
|
329
|
+
import { primitives } from 'azion-theme/tokens/primitives/colors.js';
|
|
330
|
+
import { brandColors } from 'azion-theme/tokens/colors-brand.js';
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Configure Vite (if using Vite)**
|
|
334
|
+
Add to your `vite.config.js`:
|
|
335
|
+
```javascript
|
|
336
|
+
export default {
|
|
337
|
+
resolve: {
|
|
338
|
+
conditions: ['import', 'module', 'browser', 'default']
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## 🔗 Links
|
|
344
|
+
|
|
345
|
+
- [Figma Global Tokens](https://www.figma.com/design/t97pXRs7xME3SJDs5iZ5RF/Global-Tokens?node-id=0-1)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS variables initializer for tokens.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { primitives } from '../primitives/colors.js';
|
|
6
|
+
import { surfacePrimitives, brandPrimitives } from '../primitives/brand.js';
|
|
7
|
+
import { textSemantic } from '../semantic/text.js';
|
|
8
|
+
import { backgroundSemantic } from '../semantic/backgrounds.js';
|
|
9
|
+
import { borderSemantic } from '../semantic/borders.js';
|
|
10
|
+
import { resolveRefsToCssVars } from './resolve.js';
|
|
11
|
+
|
|
12
|
+
export const createCssVars = () =>
|
|
13
|
+
resolveRefsToCssVars({
|
|
14
|
+
primitives,
|
|
15
|
+
surfacePrimitives,
|
|
16
|
+
brandPrimitives,
|
|
17
|
+
textSemantic,
|
|
18
|
+
backgroundSemantic,
|
|
19
|
+
borderSemantic,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const cssVarsString = () => {
|
|
23
|
+
const { light, dark } = createCssVars();
|
|
24
|
+
const format = (vars) =>
|
|
25
|
+
Object.entries(vars)
|
|
26
|
+
.map(([key, value]) => ` ${key}: ${value};`)
|
|
27
|
+
.join('\n');
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
`:root, [data-theme=light], .azion.azion-light {\n${format(light)}\n}`,
|
|
31
|
+
`[data-theme=dark], .dark, .azion.azion-dark {\n${format(dark)}\n}`,
|
|
32
|
+
].join('\n\n');
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const injectCssVars = () => {
|
|
36
|
+
const style = document.createElement('style');
|
|
37
|
+
style.setAttribute('data-azion-tokens', 'true');
|
|
38
|
+
style.textContent = cssVarsString();
|
|
39
|
+
document.head.appendChild(style);
|
|
40
|
+
return style;
|
|
41
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind preset for Azion tokens.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const preset = {
|
|
6
|
+
theme: {
|
|
7
|
+
extend: {
|
|
8
|
+
colors: {
|
|
9
|
+
text: {
|
|
10
|
+
base: 'var(--text-textColorBase)',
|
|
11
|
+
muted: 'var(--text-textColorMuted)',
|
|
12
|
+
link: 'var(--text-textColorLink)',
|
|
13
|
+
code: 'var(--text-textColorCode)',
|
|
14
|
+
mutedHover: 'var(--text-textColorMutedHover)',
|
|
15
|
+
linkHover: 'var(--text-textColorLinkHover)',
|
|
16
|
+
baseHover: 'var(--text-textColorBaseHover)',
|
|
17
|
+
primary: 'var(--text-textColorPrimary)',
|
|
18
|
+
primaryHover: 'var(--text-textColorPrimaryHover)',
|
|
19
|
+
accent: 'var(--text-textColorAccent)',
|
|
20
|
+
accentHover: 'var(--text-textColorAccentHover)',
|
|
21
|
+
secondary: 'var(--text-textColorSecondary)',
|
|
22
|
+
secondaryHover: 'var(--text-textColorSecondaryHover)',
|
|
23
|
+
danger: 'var(--text-textDanger)',
|
|
24
|
+
dangerHover: 'var(--text-textDangerHover)',
|
|
25
|
+
warning: 'var(--text-textWarning)',
|
|
26
|
+
warningHover: 'var(--text-textWarningHover)',
|
|
27
|
+
success: 'var(--text-textSuccess)',
|
|
28
|
+
successHover: 'var(--text-textSuccessHover)',
|
|
29
|
+
},
|
|
30
|
+
background: {
|
|
31
|
+
layer1: 'var(--background-bgLayer1)',
|
|
32
|
+
layer2: 'var(--background-bgLayer2)',
|
|
33
|
+
base: 'var(--background-bgBase)',
|
|
34
|
+
canvas: 'var(--background-bgCanvas)',
|
|
35
|
+
layer1Hover: 'var(--background-bgLayer1Hover)',
|
|
36
|
+
layer2Hover: 'var(--background-bgLayer2Hover)',
|
|
37
|
+
danger: 'var(--background-bgDanger)',
|
|
38
|
+
dangerHover: 'var(--background-bgDangerHover)',
|
|
39
|
+
warning: 'var(--background-bgWarning)',
|
|
40
|
+
warningHover: 'var(--background-bgWarningHover)',
|
|
41
|
+
success: 'var(--background-bgSuccess)',
|
|
42
|
+
successHover: 'var(--background-bgSuccessHover)',
|
|
43
|
+
backdrop: 'var(--background-bgBackdrop)',
|
|
44
|
+
primary: 'var(--background-bgPrimary)',
|
|
45
|
+
primaryHover: 'var(--background-bgPrimaryHover)',
|
|
46
|
+
},
|
|
47
|
+
border: {
|
|
48
|
+
base: 'var(--border-borderBase)',
|
|
49
|
+
baseHover: 'var(--border-borderBaseHover)',
|
|
50
|
+
warning: 'var(--border-borderWarning)',
|
|
51
|
+
success: 'var(--border-borderSuccess)',
|
|
52
|
+
danger: 'var(--border-borderDanger)',
|
|
53
|
+
primary: 'var(--border-borderPrimary)',
|
|
54
|
+
secondary: 'var(--border-borderSecondary)',
|
|
55
|
+
accent: 'var(--border-borderAccent)',
|
|
56
|
+
warningHover: 'var(--border-borderWarningHover)',
|
|
57
|
+
successHover: 'var(--border-borderSuccessHover)',
|
|
58
|
+
dangerHover: 'var(--border-borderDangerHover)',
|
|
59
|
+
primaryHover: 'var(--border-borderPrimaryHover)',
|
|
60
|
+
secondaryHover: 'var(--border-borderSecondaryHover)',
|
|
61
|
+
accentHover: 'var(--border-borderAccentHover)',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
darkMode: ['class', '.dark', '.azion.azion-dark'],
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default preset;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve token refs to CSS variable map.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { isTokenRef } from './refs.js';
|
|
6
|
+
|
|
7
|
+
const getValueByPath = (obj, path) =>
|
|
8
|
+
path.split('.').reduce((acc, key) => {
|
|
9
|
+
if (acc && typeof acc === 'object' && key in acc) {
|
|
10
|
+
return acc[key];
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}, obj);
|
|
14
|
+
|
|
15
|
+
const flattenToCssVars = (obj, prefix = []) => {
|
|
16
|
+
const result = {};
|
|
17
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
18
|
+
const nextPath = [...prefix, key];
|
|
19
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && !isTokenRef(value)) {
|
|
20
|
+
Object.assign(result, flattenToCssVars(value, nextPath));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (isTokenRef(value)) {
|
|
24
|
+
result[`--${nextPath.join('-')}`] = value.__ref;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
28
|
+
result[`--${nextPath.join('-')}`] = String(value);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const resolveRefsToCssVars = (tokens) => {
|
|
35
|
+
const baseForResolve = {
|
|
36
|
+
primitives: tokens.primitives,
|
|
37
|
+
surfacePrimitives: tokens.surfacePrimitives,
|
|
38
|
+
brandPrimitives: tokens.brandPrimitives,
|
|
39
|
+
};
|
|
40
|
+
const baseForVars = { primitives: tokens.primitives, surfacePrimitives: tokens.surfacePrimitives };
|
|
41
|
+
const lightSemantic = {
|
|
42
|
+
text: tokens.textSemantic.light,
|
|
43
|
+
background: tokens.backgroundSemantic.light,
|
|
44
|
+
border: tokens.borderSemantic.light,
|
|
45
|
+
};
|
|
46
|
+
const darkSemantic = {
|
|
47
|
+
text: tokens.textSemantic.dark,
|
|
48
|
+
background: tokens.backgroundSemantic.dark,
|
|
49
|
+
border: tokens.borderSemantic.dark,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const resolveBrandRef = (ref) => {
|
|
53
|
+
if (ref.startsWith('brand.surfaces.surface-')) {
|
|
54
|
+
const shade = ref.replace('brand.surfaces.surface-', '');
|
|
55
|
+
const resolved = getValueByPath(baseForResolve, `surfacePrimitives.surface.${shade}`);
|
|
56
|
+
return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null;
|
|
57
|
+
}
|
|
58
|
+
if (ref.startsWith('brand.primary.primary-')) {
|
|
59
|
+
const shade = ref.replace('brand.primary.primary-', '');
|
|
60
|
+
const resolved = getValueByPath(baseForResolve, `brandPrimitives.primary.${shade}`);
|
|
61
|
+
return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null;
|
|
62
|
+
}
|
|
63
|
+
if (ref.startsWith('brand.accent.accent-')) {
|
|
64
|
+
const shade = ref.replace('brand.accent.accent-', '');
|
|
65
|
+
const resolved = getValueByPath(baseForResolve, `brandPrimitives.accent.${shade}`);
|
|
66
|
+
return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null;
|
|
67
|
+
}
|
|
68
|
+
if (ref.startsWith('brand.absolute.')) {
|
|
69
|
+
const name = ref.replace('brand.absolute.', '');
|
|
70
|
+
const resolved = getValueByPath(baseForResolve, `brandPrimitives.absolute.${name}`);
|
|
71
|
+
return typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : null;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const resolveSemantic = (semantic) => {
|
|
77
|
+
const flattened = flattenToCssVars(semantic);
|
|
78
|
+
return Object.fromEntries(
|
|
79
|
+
Object.entries(flattened).map(([key, value]) => {
|
|
80
|
+
if (value.startsWith('brand.')) {
|
|
81
|
+
return [key, resolveBrandRef(value) ?? value];
|
|
82
|
+
}
|
|
83
|
+
if (value.startsWith('primitives.') || value.startsWith('surfacePrimitives.')) {
|
|
84
|
+
const resolved = getValueByPath(baseForResolve, value);
|
|
85
|
+
return [key, typeof resolved === 'string' || typeof resolved === 'number' ? String(resolved) : value];
|
|
86
|
+
}
|
|
87
|
+
return [key, value];
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
light: {
|
|
94
|
+
...flattenToCssVars(baseForVars),
|
|
95
|
+
...resolveSemantic(lightSemantic),
|
|
96
|
+
},
|
|
97
|
+
dark: {
|
|
98
|
+
...flattenToCssVars(baseForVars),
|
|
99
|
+
...resolveSemantic(darkSemantic),
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
};
|