@aleph-alpha/config-css 0.14.23 → 0.15.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/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 0.15.1 (2025-07-06)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **deps:** update unocss monorepo to v66.3.3
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Renovatebot
10
+
11
+ ## 0.15.0 (2025-07-03)
12
+
13
+ ### 🚀 Features
14
+
15
+ - **AST-1989:** Customization doc
16
+
17
+ ### ❤️ Thank You
18
+
19
+ - Suraj Jadhav
20
+
1
21
  ## 0.14.23 (2025-07-03)
2
22
 
3
23
  ### 🧱 Updated Dependencies
package/README.md CHANGED
@@ -103,6 +103,10 @@ graph TD
103
103
 
104
104
  ```
105
105
 
106
+ ## Config CSS Preset helps in UI Customization
107
+
108
+ [Read more here](./customization.md)
109
+
106
110
  ## References
107
111
 
108
112
  The following packages are used to generate the presets:
@@ -0,0 +1,217 @@
1
+ # Config CSS Preset Customization Guide
2
+
3
+ ## Overview
4
+
5
+ The Config CSS Preset package (`@aleph-alpha/config-css`) provides a centralized theming system that enables consistent customization across all Aleph Alpha Design System components and Pharia applications. This package allows developers to customize fonts and colors throughout the entire ecosystem by modifying CSS custom properties.
6
+
7
+ ## What Does Config CSS Preset Customize?
8
+
9
+ The Config CSS Preset enables customization of two main visual aspects:
10
+
11
+ - **Typography**: Font families that apply to all design system components
12
+ - **Color Themes**: Brand and core UI colors used throughout applications
13
+
14
+ These customizations are automatically applied to:
15
+ - All components from `@aleph-alpha/ds-components-vue`
16
+ - Any Pharia applications that consume the `@aleph-alpha/config-css` package
17
+
18
+ ## Font Customization
19
+
20
+ ### How Font Customization Works
21
+
22
+ Config CSS Preset uses a sophisticated transformation process to make fonts customizable across the entire design system:
23
+
24
+ #### 1. Token Processing
25
+ The system processes font tokens defined in [`tokens.json`](https://gitlab.aleph-alpha.de/engineering/frontend-hub/-/blob/main/packages/config-css-preset/tokens.json) using Style Dictionary, a build system for design tokens.
26
+
27
+ #### 2. Custom Transform Application
28
+ A custom Style Dictionary transform called `custom/typography/font-family` (defined in the [config file](https://gitlab.aleph-alpha.de/engineering/frontend-hub/-/blob/main/packages/config-css-preset/sd.config.js)) processes these tokens.
29
+
30
+ #### 3. Variable Substitution
31
+ The transform replaces hardcoded font family references with CSS custom properties:
32
+
33
+ **Before transformation:**
34
+ ```css
35
+ font-family: 'Raleway';
36
+ ```
37
+
38
+ **After transformation:**
39
+ ```css
40
+ font-family: var(--custom-font-family, Raleway);
41
+ ```
42
+
43
+ This approach ensures that:
44
+ - All typography classes automatically expose the customizable font family variable
45
+ - Applications can override fonts by simply updating the `--custom-font-family` CSS variable
46
+ - A fallback font (Raleway) is always available if no custom font is specified
47
+
48
+ ### Available Font Options
49
+
50
+ Currently, Config CSS Preset provides built-in support for two font families through the [font preset file](https://gitlab.aleph-alpha.de/engineering/frontend-hub/-/blob/main/packages/config-css-preset/src/presetWebFontsAlephAlpha.ts):
51
+
52
+ - **Raleway** (default)
53
+ - **Roboto**
54
+
55
+ ### Adding Custom Font Families
56
+
57
+ You have two options for extending font family support:
58
+
59
+ #### Option 1: Extend the Preset (Recommended for System-Wide Fonts)
60
+ Add new font definitions to the existing preset file by following the established code patterns. This approach makes fonts available across all applications using the preset.
61
+
62
+ #### Option 2: Application-Level Implementation (Recommended for App-Specific Fonts)
63
+ 1. Define your custom `@font-face` declarations in your Pharia application
64
+ 2. Update the `--custom-font-family` CSS variable to reference your custom font
65
+
66
+ **Example:**
67
+ ```css
68
+ @font-face {
69
+ font-family: 'MyCustomFont';
70
+ src: url('./assets/fonts/MyCustomFont.woff2') format('woff2');
71
+ font-weight: normal;
72
+ font-style: normal;
73
+ }
74
+
75
+ :root {
76
+ --custom-font-family: 'MyCustomFont';
77
+ }
78
+ ```
79
+
80
+ ### Updating Font Variables
81
+
82
+ #### JavaScript Method
83
+ ```javascript
84
+ // Update font family dynamically
85
+ document.documentElement.style.setProperty(
86
+ '--custom-font-family',
87
+ 'Your-Custom-Font-Family'
88
+ );
89
+ ```
90
+
91
+ #### CSS Method
92
+ ```css
93
+ :root {
94
+ --custom-font-family: 'Your-Custom-Font-Family';
95
+ }
96
+ ```
97
+
98
+ ## Color Customization
99
+
100
+ ### Understanding the Color Token System
101
+
102
+ Config CSS Preset transforms design system color tokens into customizable CSS variables using a combination of Style Dictionary and UnoCSS preset functionality.
103
+
104
+ ### Exploring Available Color Tokens
105
+
106
+ To discover all available color tokens in your system:
107
+
108
+ #### 1. Build the Token Files
109
+ Run the following command from your project root:
110
+ ```bash
111
+ nx run config-css-preset:build
112
+ ```
113
+
114
+ #### 2. Examine Generated Files
115
+ This command generates a structured output directory:
116
+ ```
117
+ config-css-preset/
118
+ sd-output/
119
+ box-shadows.json # Shadow token definitions
120
+ dark-mode.json # Dark theme color tokens
121
+ global.json # Global design tokens
122
+ light-mode.json # Light theme color tokens
123
+ spacings.json # Spacing and layout tokens
124
+ typography.json # Typography-related tokens
125
+ ```
126
+
127
+ #### 3. Review Color Tokens
128
+ Open `config-css-preset/sd-output/light-mode.json` to see all available color tokens, including:
129
+ - `brand-*` tokens: Brand-specific colors
130
+ - `core-*` tokens: Core UI and system colors
131
+
132
+ ### Color Token Transformation
133
+
134
+ The Config CSS Preset automatically transforms design tokens into CSS custom properties using a consistent naming convention:
135
+
136
+ #### Transformation Examples
137
+
138
+ **Brand Background Token:**
139
+ ```
140
+ Design Token: brand-bg-brand
141
+ CSS Variable: --un-preset-theme-colors-brand-bg-brand
142
+ ```
143
+
144
+ **Core Content Token:**
145
+ ```
146
+ Design Token: core-content-secondary
147
+ CSS Variable: --un-preset-theme-colors-core-content-secondary
148
+ ```
149
+
150
+ #### Naming Convention Breakdown
151
+ - **Prefix**: `--un-preset-theme-colors-`
152
+ - **Token Name**: The original design token name (e.g., `brand-bg-brand`)
153
+ - **Result**: A globally accessible CSS custom property
154
+
155
+ ### Color Value Format
156
+
157
+ Color values in Config CSS Preset use a specific RGB format optimized for flexibility:
158
+
159
+ **Format**: Space-separated RGB values without `rgb()` wrapper
160
+ **Example**: `"205 231 4"`
161
+
162
+ ### Updating Color Variables
163
+
164
+ #### JavaScript Method
165
+ ```javascript
166
+ // Update a specific color token
167
+ document.documentElement.style.setProperty(
168
+ '--un-preset-theme-colors-brand-bg-brand',
169
+ '255 128 0' // RGB values for orange
170
+ );
171
+
172
+ // Update multiple colors programmatically
173
+ const customColors = {
174
+ 'brand-bg-brand': '255 128 0',
175
+ 'core-content-secondary': '64 64 64',
176
+ 'core-bg-primary': '248 250 252'
177
+ };
178
+
179
+ Object.entries(customColors).forEach(([token, value]) => {
180
+ document.documentElement.style.setProperty(
181
+ `--un-preset-theme-colors-${token}`,
182
+ value
183
+ );
184
+ });
185
+ ```
186
+
187
+ #### CSS Method
188
+ ```css
189
+ :root {
190
+ /* Brand colors */
191
+ --un-preset-theme-colors-brand-bg-brand: 255 128 0;
192
+
193
+ /* Core UI colors */
194
+ --un-preset-theme-colors-core-content-secondary: 64 64 64;
195
+ --un-preset-theme-colors-core-bg-primary: 248 250 252;
196
+ }
197
+ ```
198
+
199
+ ## Technical Architecture
200
+
201
+ ### Style Dictionary Integration
202
+ Config CSS Preset leverages Style Dictionary's token transformation capabilities to:
203
+ - Process design tokens from JSON files
204
+ - Apply custom transforms for font and color handling
205
+ - Generate CSS custom properties with consistent naming
206
+
207
+ ### UnoCSS Preset Integration
208
+ The UnoCSS preset automatically:
209
+ - Generates utility classes based on design tokens
210
+ - Creates CSS custom properties for runtime customization
211
+ - Ensures consistent theming across atomic CSS classes
212
+
213
+ ## Additional Resources
214
+
215
+ - [Style Dictionary Documentation](https://amzn.github.io/style-dictionary/) - Complete guide to design token transformations
216
+ - [UnoCSS Documentation](https://unocss.dev/) - Atomic CSS framework reference
217
+ - [Aleph Alpha Design System](https://gitlab.aleph-alpha.de/engineering/frontend-hub) - Design system repository and guidelines
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aleph-alpha/config-css",
3
3
  "license": "Apache-2.0",
4
- "version": "0.14.23",
4
+ "version": "0.15.1",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "prettier": "@aleph-alpha/prettier-config-frontend",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@tokens-studio/sd-transforms": "2.0.1",
18
- "@unocss/preset-legacy-compat": "66.3.1",
18
+ "@unocss/preset-legacy-compat": "66.3.3",
19
19
  "token-transformer": "0.0.33",
20
20
  "unocss": "^66.0.0",
21
21
  "unocss-preset-animations": "1.2.1",