@marioschmidt/design-system-tokens 1.0.9

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 (181) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +767 -0
  3. package/dist/css/base/index.css +8 -0
  4. package/dist/css/base/primitive-color-value-global.css +100 -0
  5. package/dist/css/base/primitive-color-value.css +100 -0
  6. package/dist/css/base/primitive-font-value-global.css +49 -0
  7. package/dist/css/base/primitive-font-value.css +49 -0
  8. package/dist/css/base/primitive-size-value-global.css +55 -0
  9. package/dist/css/base/primitive-size-value.css +55 -0
  10. package/dist/css/base/primitive-space-value-global.css +31 -0
  11. package/dist/css/base/primitive-space-value.css +31 -0
  12. package/dist/css/density/density-compact-global.css +14 -0
  13. package/dist/css/density/density-compact.css +14 -0
  14. package/dist/css/density/density-default-global.css +14 -0
  15. package/dist/css/density/density-default.css +14 -0
  16. package/dist/css/density/density-spacious-global.css +14 -0
  17. package/dist/css/density/density-spacious.css +14 -0
  18. package/dist/css/density/index.css +7 -0
  19. package/dist/css/mapping/brand-advertorial-global.css +277 -0
  20. package/dist/css/mapping/brand-advertorial.css +277 -0
  21. package/dist/css/mapping/brand-bild-global.css +277 -0
  22. package/dist/css/mapping/brand-bild.css +277 -0
  23. package/dist/css/mapping/brand-color-bild-global.css +74 -0
  24. package/dist/css/mapping/brand-color-bild.css +74 -0
  25. package/dist/css/mapping/brand-color-sportbild-global.css +74 -0
  26. package/dist/css/mapping/brand-color-sportbild.css +74 -0
  27. package/dist/css/mapping/brand-sportbild-global.css +277 -0
  28. package/dist/css/mapping/brand-sportbild.css +277 -0
  29. package/dist/css/mapping/index.css +9 -0
  30. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-lg-global.css +490 -0
  31. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-lg.css +490 -0
  32. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-md-global.css +490 -0
  33. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-md.css +490 -0
  34. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-sm-global.css +490 -0
  35. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-sm.css +490 -0
  36. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-xs-global.css +490 -0
  37. package/dist/css/semantic/advertorial/breakpoints/breakpoint-advertorial-xs.css +490 -0
  38. package/dist/css/semantic/advertorial/breakpoints/index.css +8 -0
  39. package/dist/css/semantic/advertorial/color/color-advertorial-dark-global.css +425 -0
  40. package/dist/css/semantic/advertorial/color/color-advertorial-dark.css +425 -0
  41. package/dist/css/semantic/advertorial/color/color-advertorial-light-global.css +425 -0
  42. package/dist/css/semantic/advertorial/color/color-advertorial-light.css +425 -0
  43. package/dist/css/semantic/advertorial/color/index.css +6 -0
  44. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-lg-global.css +490 -0
  45. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-lg.css +490 -0
  46. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-md-global.css +490 -0
  47. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-md.css +490 -0
  48. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-sm-global.css +490 -0
  49. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-sm.css +490 -0
  50. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-xs-global.css +490 -0
  51. package/dist/css/semantic/bild/breakpoints/breakpoint-bild-xs.css +490 -0
  52. package/dist/css/semantic/bild/breakpoints/index.css +8 -0
  53. package/dist/css/semantic/bild/color/color-bild-dark-global.css +425 -0
  54. package/dist/css/semantic/bild/color/color-bild-dark.css +425 -0
  55. package/dist/css/semantic/bild/color/color-bild-light-global.css +425 -0
  56. package/dist/css/semantic/bild/color/color-bild-light.css +425 -0
  57. package/dist/css/semantic/bild/color/index.css +6 -0
  58. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-lg-global.css +490 -0
  59. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-lg.css +490 -0
  60. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-md-global.css +490 -0
  61. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-md.css +490 -0
  62. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-sm-global.css +490 -0
  63. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-sm.css +490 -0
  64. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-xs-global.css +490 -0
  65. package/dist/css/semantic/sportbild/breakpoints/breakpoint-sportbild-xs.css +490 -0
  66. package/dist/css/semantic/sportbild/breakpoints/index.css +8 -0
  67. package/dist/css/semantic/sportbild/color/color-sportbild-dark-global.css +425 -0
  68. package/dist/css/semantic/sportbild/color/color-sportbild-dark.css +425 -0
  69. package/dist/css/semantic/sportbild/color/color-sportbild-light-global.css +425 -0
  70. package/dist/css/semantic/sportbild/color/color-sportbild-light.css +425 -0
  71. package/dist/css/semantic/sportbild/color/index.css +6 -0
  72. package/dist/js/base/index.js +15 -0
  73. package/dist/js/base/primitive-color-value.js +98 -0
  74. package/dist/js/base/primitive-font-value.js +47 -0
  75. package/dist/js/base/primitive-size-value.js +53 -0
  76. package/dist/js/base/primitive-space-value.js +29 -0
  77. package/dist/js/density/density-compact.js +12 -0
  78. package/dist/js/density/density-default.js +12 -0
  79. package/dist/js/density/density-spacious.js +12 -0
  80. package/dist/js/density/index.js +13 -0
  81. package/dist/js/mapping/brand-advertorial.js +276 -0
  82. package/dist/js/mapping/brand-bild.js +277 -0
  83. package/dist/js/mapping/brand-color-bild.js +78 -0
  84. package/dist/js/mapping/brand-color-sportbild.js +78 -0
  85. package/dist/js/mapping/brand-sportbild.js +280 -0
  86. package/dist/js/mapping/index.js +17 -0
  87. package/dist/js/semantic/advertorial/breakpoints/breakpoint-advertorial-lg.js +477 -0
  88. package/dist/js/semantic/advertorial/breakpoints/breakpoint-advertorial-md.js +477 -0
  89. package/dist/js/semantic/advertorial/breakpoints/breakpoint-advertorial-sm.js +477 -0
  90. package/dist/js/semantic/advertorial/breakpoints/breakpoint-advertorial-xs.js +477 -0
  91. package/dist/js/semantic/advertorial/breakpoints/index.js +15 -0
  92. package/dist/js/semantic/advertorial/color/color-advertorial-dark.js +347 -0
  93. package/dist/js/semantic/advertorial/color/color-advertorial-light.js +343 -0
  94. package/dist/js/semantic/advertorial/color/index.js +11 -0
  95. package/dist/js/semantic/bild/breakpoints/breakpoint-bild-lg.js +478 -0
  96. package/dist/js/semantic/bild/breakpoints/breakpoint-bild-md.js +478 -0
  97. package/dist/js/semantic/bild/breakpoints/breakpoint-bild-sm.js +478 -0
  98. package/dist/js/semantic/bild/breakpoints/breakpoint-bild-xs.js +478 -0
  99. package/dist/js/semantic/bild/breakpoints/index.js +15 -0
  100. package/dist/js/semantic/bild/color/color-bild-dark.js +347 -0
  101. package/dist/js/semantic/bild/color/color-bild-light.js +343 -0
  102. package/dist/js/semantic/bild/color/index.js +11 -0
  103. package/dist/js/semantic/sportbild/breakpoints/breakpoint-sportbild-lg.js +479 -0
  104. package/dist/js/semantic/sportbild/breakpoints/breakpoint-sportbild-md.js +479 -0
  105. package/dist/js/semantic/sportbild/breakpoints/breakpoint-sportbild-sm.js +479 -0
  106. package/dist/js/semantic/sportbild/breakpoints/breakpoint-sportbild-xs.js +479 -0
  107. package/dist/js/semantic/sportbild/breakpoints/index.js +15 -0
  108. package/dist/js/semantic/sportbild/color/color-sportbild-dark.js +347 -0
  109. package/dist/js/semantic/sportbild/color/color-sportbild-light.js +343 -0
  110. package/dist/js/semantic/sportbild/color/index.js +11 -0
  111. package/dist/json/base/primitive-color-value.json +148 -0
  112. package/dist/json/base/primitive-font-value.json +59 -0
  113. package/dist/json/base/primitive-size-value.json +51 -0
  114. package/dist/json/base/primitive-space-value.json +27 -0
  115. package/dist/json/density/density-compact.json +16 -0
  116. package/dist/json/density/density-default.json +16 -0
  117. package/dist/json/density/density-spacious.json +16 -0
  118. package/dist/json/mapping/brand-advertorial.json +393 -0
  119. package/dist/json/mapping/brand-bild.json +393 -0
  120. package/dist/json/mapping/brand-color-bild.json +98 -0
  121. package/dist/json/mapping/brand-color-sportbild.json +98 -0
  122. package/dist/json/mapping/brand-sportbild.json +393 -0
  123. package/dist/json/semantic/advertorial/breakpoints/breakpoint-advertorial-lg.json +686 -0
  124. package/dist/json/semantic/advertorial/breakpoints/breakpoint-advertorial-md.json +686 -0
  125. package/dist/json/semantic/advertorial/breakpoints/breakpoint-advertorial-sm.json +686 -0
  126. package/dist/json/semantic/advertorial/breakpoints/breakpoint-advertorial-xs.json +686 -0
  127. package/dist/json/semantic/advertorial/color/color-advertorial-dark.json +307 -0
  128. package/dist/json/semantic/advertorial/color/color-advertorial-light.json +307 -0
  129. package/dist/json/semantic/bild/breakpoints/breakpoint-bild-lg.json +686 -0
  130. package/dist/json/semantic/bild/breakpoints/breakpoint-bild-md.json +686 -0
  131. package/dist/json/semantic/bild/breakpoints/breakpoint-bild-sm.json +686 -0
  132. package/dist/json/semantic/bild/breakpoints/breakpoint-bild-xs.json +686 -0
  133. package/dist/json/semantic/bild/color/color-bild-dark.json +307 -0
  134. package/dist/json/semantic/bild/color/color-bild-light.json +307 -0
  135. package/dist/json/semantic/sportbild/breakpoints/breakpoint-sportbild-lg.json +686 -0
  136. package/dist/json/semantic/sportbild/breakpoints/breakpoint-sportbild-md.json +686 -0
  137. package/dist/json/semantic/sportbild/breakpoints/breakpoint-sportbild-sm.json +686 -0
  138. package/dist/json/semantic/sportbild/breakpoints/breakpoint-sportbild-xs.json +686 -0
  139. package/dist/json/semantic/sportbild/color/color-sportbild-dark.json +307 -0
  140. package/dist/json/semantic/sportbild/color/color-sportbild-light.json +307 -0
  141. package/dist/manifest.json +183 -0
  142. package/dist/scss/base/index.scss +8 -0
  143. package/dist/scss/base/primitive-color-value.scss +97 -0
  144. package/dist/scss/base/primitive-font-value.scss +46 -0
  145. package/dist/scss/base/primitive-size-value.scss +52 -0
  146. package/dist/scss/base/primitive-space-value.scss +28 -0
  147. package/dist/scss/density/density-compact.scss +11 -0
  148. package/dist/scss/density/density-default.scss +11 -0
  149. package/dist/scss/density/density-spacious.scss +11 -0
  150. package/dist/scss/density/index.scss +7 -0
  151. package/dist/scss/mapping/brand-advertorial.scss +274 -0
  152. package/dist/scss/mapping/brand-bild.scss +274 -0
  153. package/dist/scss/mapping/brand-color-bild.scss +71 -0
  154. package/dist/scss/mapping/brand-color-sportbild.scss +71 -0
  155. package/dist/scss/mapping/brand-sportbild.scss +274 -0
  156. package/dist/scss/mapping/index.scss +9 -0
  157. package/dist/scss/semantic/advertorial/breakpoints/breakpoint-advertorial-lg.scss +475 -0
  158. package/dist/scss/semantic/advertorial/breakpoints/breakpoint-advertorial-md.scss +475 -0
  159. package/dist/scss/semantic/advertorial/breakpoints/breakpoint-advertorial-sm.scss +475 -0
  160. package/dist/scss/semantic/advertorial/breakpoints/breakpoint-advertorial-xs.scss +475 -0
  161. package/dist/scss/semantic/advertorial/breakpoints/index.scss +8 -0
  162. package/dist/scss/semantic/advertorial/color/color-advertorial-dark.scss +318 -0
  163. package/dist/scss/semantic/advertorial/color/color-advertorial-light.scss +318 -0
  164. package/dist/scss/semantic/advertorial/color/index.scss +6 -0
  165. package/dist/scss/semantic/bild/breakpoints/breakpoint-bild-lg.scss +475 -0
  166. package/dist/scss/semantic/bild/breakpoints/breakpoint-bild-md.scss +475 -0
  167. package/dist/scss/semantic/bild/breakpoints/breakpoint-bild-sm.scss +475 -0
  168. package/dist/scss/semantic/bild/breakpoints/breakpoint-bild-xs.scss +475 -0
  169. package/dist/scss/semantic/bild/breakpoints/index.scss +8 -0
  170. package/dist/scss/semantic/bild/color/color-bild-dark.scss +318 -0
  171. package/dist/scss/semantic/bild/color/color-bild-light.scss +318 -0
  172. package/dist/scss/semantic/bild/color/index.scss +6 -0
  173. package/dist/scss/semantic/sportbild/breakpoints/breakpoint-sportbild-lg.scss +475 -0
  174. package/dist/scss/semantic/sportbild/breakpoints/breakpoint-sportbild-md.scss +475 -0
  175. package/dist/scss/semantic/sportbild/breakpoints/breakpoint-sportbild-sm.scss +475 -0
  176. package/dist/scss/semantic/sportbild/breakpoints/breakpoint-sportbild-xs.scss +475 -0
  177. package/dist/scss/semantic/sportbild/breakpoints/index.scss +8 -0
  178. package/dist/scss/semantic/sportbild/color/color-sportbild-dark.scss +318 -0
  179. package/dist/scss/semantic/sportbild/color/color-sportbild-light.scss +318 -0
  180. package/dist/scss/semantic/sportbild/color/index.scss +6 -0
  181. package/package.json +62 -0
package/README.md ADDED
@@ -0,0 +1,767 @@
1
+ # ๐ŸŽจ BILD Design System - Token Pipeline
2
+
3
+ A comprehensive token transformation pipeline based on **Style Dictionary v4** for the BILD Design System. This pipeline transforms Figma design tokens (exported via VariableVisualizer Plugin) into consumable formats across multiple platforms, brands, and modes.
4
+
5
+ ## ๐Ÿ“‹ Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Features](#features)
9
+ - [Token Architecture](#token-architecture)
10
+ - [Installation](#installation)
11
+ - [Usage](#usage)
12
+ - [Output Structure](#output-structure)
13
+ - [Configuration](#configuration)
14
+ - [CI/CD Integration](#cicd-integration)
15
+ - [Troubleshooting](#troubleshooting)
16
+
17
+ ---
18
+
19
+ ## ๐ŸŽฏ Overview
20
+
21
+ This token pipeline processes the multi-layer, multi-brand architecture of the BILD Design System with full support for design token aliases, modes, and brand-specific variations.
22
+
23
+ ```
24
+ Figma Tokens (JSON)
25
+ โ†“
26
+ Preprocessing (scripts/preprocess-figma-tokens.js)
27
+ โ€ข Alias resolution with brand awareness
28
+ โ€ข Mode ID mapping
29
+ โ€ข Collection ID-based filtering
30
+ โ†“
31
+ Style Dictionary v4 (scripts/build-tokens.js)
32
+ โ€ข Custom transforms
33
+ โ€ข Multi-platform output
34
+ โ€ข Brand-specific builds
35
+ โ†“
36
+ Output Files (CSS, SCSS, JS, JSON)
37
+ โ€ข Platform-first organization
38
+ โ€ข Brand-specific semantic tokens
39
+ โ€ข Zero warnings, fully resolved
40
+ ```
41
+
42
+ ---
43
+
44
+ ## โœจ Features
45
+
46
+ ### Pipeline Features
47
+
48
+ โœ… **Stable Collection IDs**: Uses Figma Collection IDs instead of names for robustness against renaming
49
+ โœ… **Zero Warnings**: All false positives eliminated - handles `0`, `false`, `""` values correctly
50
+ โœ… **Brand-Aware Alias Resolution**: Cross-collection references resolve correctly per brand
51
+ โœ… **Multi-Layer Support**: Base โ†’ Mapping โ†’ Density โ†’ Semantic
52
+ โœ… **Multi-Brand**: BILD, SportBILD, Advertorial
53
+ โœ… **Multi-Mode**: Light/Dark, Responsive Breakpoints, Density variations
54
+ โœ… **Multiple Output Formats**: CSS, SCSS, JavaScript, JSON
55
+ โœ… **Hot Reload**: Watch mode for development
56
+
57
+ ### Architecture Features
58
+
59
+ โœ… **Platform-First Organization**: `dist/css/`, `dist/scss/`, `dist/js/`, `dist/json/`
60
+ โœ… **Brand-Specific Semantic Layer**: Tokens organized by brand, then category
61
+ โœ… **Recursive Index Files**: Automatic index generation at each level
62
+ โœ… **Gitignored Dist**: Build artifacts excluded from version control
63
+
64
+ ---
65
+
66
+ ## ๐Ÿ“ฆ Installation
67
+
68
+ ### As NPM Package (Recommended)
69
+
70
+ This package is published to **GitHub Packages** as `@uxwizard25/design-system-tokens`.
71
+
72
+ #### 1. Configure NPM Registry
73
+
74
+ Create or edit `.npmrc` in your project root:
75
+
76
+ ```bash
77
+ @uxwizard25:registry=https://npm.pkg.github.com
78
+ //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
79
+ ```
80
+
81
+ #### 2. Authenticate with GitHub
82
+
83
+ Create a Personal Access Token (PAT):
84
+
85
+ 1. Go to: https://github.com/settings/tokens
86
+ 2. Click **"Generate new token (classic)"**
87
+ 3. Name: `npm-packages-read`
88
+ 4. Scopes: Select `read:packages`
89
+ 5. Click **"Generate token"**
90
+ 6. Copy the token
91
+
92
+ Add the token to your `.npmrc`:
93
+
94
+ ```bash
95
+ //npm.pkg.github.com/:_authToken=ghp_YOUR_TOKEN_HERE
96
+ ```
97
+
98
+ Or use an environment variable:
99
+
100
+ ```bash
101
+ export GITHUB_TOKEN="ghp_YOUR_TOKEN_HERE"
102
+ ```
103
+
104
+ #### 3. Install Package
105
+
106
+ ```bash
107
+ # Latest version
108
+ npm install @uxwizard25/design-system-tokens
109
+
110
+ # Specific version
111
+ npm install @uxwizard25/design-system-tokens@1.2.3
112
+
113
+ # As dev dependency
114
+ npm install --save-dev @uxwizard25/design-system-tokens
115
+ ```
116
+
117
+ #### 4. Use in Your Project
118
+
119
+ **CSS:**
120
+ ```css
121
+ /* Import in your main CSS file */
122
+ @import '@uxwizard25/design-system-tokens/css/semantic/bild/color/color-bild-light.css';
123
+ ```
124
+
125
+ **SCSS:**
126
+ ```scss
127
+ // Import in your SCSS file
128
+ @import '@uxwizard25/design-system-tokens/scss/semantic/bild/color/color-bild-light';
129
+
130
+ .my-button {
131
+ background-color: var(--color-brand-primary);
132
+ }
133
+ ```
134
+
135
+ **JavaScript/TypeScript:**
136
+ ```javascript
137
+ // Import tokens as JS module
138
+ import tokens from '@uxwizard25/design-system-tokens/json/semantic/bild/color/color-bild-light.json';
139
+
140
+ console.log(tokens.color.brand.primary); // "#de0000"
141
+ ```
142
+
143
+ **Webpack/Vite:**
144
+ ```javascript
145
+ // In your main.js or main.ts
146
+ import '@uxwizard25/design-system-tokens/css/semantic/bild/color/color-bild-light.css';
147
+ ```
148
+
149
+ ### Local Development
150
+
151
+ If you want to develop the token pipeline itself:
152
+
153
+ ```bash
154
+ # Clone repository
155
+ git clone https://github.com/UXWizard25/vv-token-test-v3.git
156
+ cd vv-token-test-v3
157
+
158
+ # Install dependencies
159
+ npm install
160
+
161
+ # Build tokens
162
+ npm run build
163
+
164
+ # Watch mode (auto-rebuild on changes)
165
+ npm run watch
166
+ ```
167
+
168
+ ---
169
+
170
+ ## ๐Ÿ—๏ธ Token Architecture
171
+
172
+ ### Layer Structure
173
+
174
+ The Design System is organized in four layers:
175
+
176
+ #### 1๏ธโƒฃ **Base Layer** - Primitive Tokens
177
+
178
+ Foundation tokens without modes (only "Value" mode).
179
+
180
+ - **`_ColorPrimitive`**: Base color palette (includes opacity values)
181
+ - **`_SpacePrimitive`**: Base spacing scale
182
+ - **`_SizePrimitive`**: Base size scale
183
+ - **`_FontPrimitive`**: Base typography
184
+
185
+ **Collections:**
186
+ - `VariableCollectionId:539:2238` โ†’ `_ColorPrimitive`
187
+ - `VariableCollectionId:2726:12077` โ†’ `_SpacePrimitive`
188
+ - `VariableCollectionId:4072:1817` โ†’ `_SizePrimitive`
189
+ - `VariableCollectionId:470:1450` โ†’ `_FontPrimitive`
190
+
191
+ **Output:**
192
+ ```
193
+ dist/css/base/
194
+ โ”œโ”€โ”€ primitive-color-value.css
195
+ โ”œโ”€โ”€ primitive-space-value.css
196
+ โ”œโ”€โ”€ primitive-size-value.css
197
+ โ””โ”€โ”€ primitive-font-value.css
198
+ ```
199
+
200
+ #### 2๏ธโƒฃ **Mapping Layer** - Brand-Specific Tokens
201
+
202
+ Maps primitives to brand identities.
203
+
204
+ - **`BrandTokenMapping`**: Modes: BILD, SportBILD, Advertorial
205
+ - **`BrandColorMapping`**: Modes: BILD, SportBILD
206
+
207
+ **Collections:**
208
+ - `VariableCollectionId:18038:10593` โ†’ `BrandTokenMapping`
209
+ - `VariableCollectionId:18212:14495` โ†’ `BrandColorMapping`
210
+
211
+ **Output:**
212
+ ```
213
+ dist/css/mapping/
214
+ โ”œโ”€โ”€ brand-bild.css
215
+ โ”œโ”€โ”€ brand-sportbild.css
216
+ โ”œโ”€โ”€ brand-advertorial.css
217
+ โ”œโ”€โ”€ brand-color-bild.css
218
+ โ””โ”€โ”€ brand-color-sportbild.css
219
+ ```
220
+
221
+ #### 3๏ธโƒฃ **Density Layer** - Density Variations
222
+
223
+ Intermediate layer for UI density levels.
224
+
225
+ - **`Density`**: Modes: compact, default, spacious
226
+
227
+ **Collections:**
228
+ - `VariableCollectionId:5695:5841` โ†’ `Density`
229
+
230
+ **Output:**
231
+ ```
232
+ dist/css/density/
233
+ โ”œโ”€โ”€ density-compact.css
234
+ โ”œโ”€โ”€ density-default.css
235
+ โ””โ”€โ”€ density-spacious.css
236
+ ```
237
+
238
+ #### 4๏ธโƒฃ **Semantic Layer** - Context-Specific Tokens โญ
239
+
240
+ **Brand-specific consumable layer** for applications. Each brand gets its own directory with resolved values.
241
+
242
+ - **`ColorMode`**: Modes: Light, Dark (brand-specific)
243
+ - **`BreakpointMode`**: Modes: XS, SM, MD, LG (brand-specific)
244
+
245
+ **Collections:**
246
+ - `VariableCollectionId:588:1979` โ†’ `ColorMode`
247
+ - `VariableCollectionId:7017:25696` โ†’ `BreakpointMode`
248
+
249
+ **Output:**
250
+ ```
251
+ dist/css/semantic/
252
+ โ”œโ”€โ”€ bild/
253
+ โ”‚ โ”œโ”€โ”€ color/
254
+ โ”‚ โ”‚ โ”œโ”€โ”€ color-bild-light.css # BILD brand with #de0000
255
+ โ”‚ โ”‚ โ””โ”€โ”€ color-bild-dark.css
256
+ โ”‚ โ””โ”€โ”€ breakpoints/
257
+ โ”‚ โ”œโ”€โ”€ breakpoint-bild-xs.css
258
+ โ”‚ โ”œโ”€โ”€ breakpoint-bild-sm.css
259
+ โ”‚ โ”œโ”€โ”€ breakpoint-bild-md.css
260
+ โ”‚ โ””โ”€โ”€ breakpoint-bild-lg.css
261
+ โ”œโ”€โ”€ sportbild/
262
+ โ”‚ โ”œโ”€โ”€ color/
263
+ โ”‚ โ”‚ โ”œโ”€โ”€ color-sportbild-light.css # SportBILD brand with #0a264f
264
+ โ”‚ โ”‚ โ””โ”€โ”€ color-sportbild-dark.css
265
+ โ”‚ โ””โ”€โ”€ breakpoints/
266
+ โ”‚ โ””โ”€โ”€ ...
267
+ โ””โ”€โ”€ advertorial/
268
+ โ”œโ”€โ”€ color/
269
+ โ”‚ โ”œโ”€โ”€ color-advertorial-light.css
270
+ โ”‚ โ””โ”€โ”€ color-advertorial-dark.css
271
+ โ””โ”€โ”€ breakpoints/
272
+ โ””โ”€โ”€ ...
273
+ ```
274
+
275
+ **Key Feature:** Each brand directory contains fully resolved token values specific to that brand. Cross-collection aliases (e.g., from `ColorMode` โ†’ `BrandColorMapping`) are resolved correctly per brand during preprocessing.
276
+
277
+ ---
278
+
279
+ ## ๐Ÿ“ฆ Installation
280
+
281
+ ### Prerequisites
282
+
283
+ - Node.js >= 16.x
284
+ - npm >= 8.x
285
+
286
+ ### Setup
287
+
288
+ ```bash
289
+ # Install dependencies
290
+ npm install
291
+
292
+ # Or with pnpm/yarn
293
+ pnpm install
294
+ yarn install
295
+ ```
296
+
297
+ ---
298
+
299
+ ## ๐Ÿš€ Usage
300
+
301
+ ### Full Build
302
+
303
+ ```bash
304
+ # 1. Preprocessing: Figma JSON โ†’ Intermediate tokens
305
+ npm run preprocess
306
+
307
+ # 2. Build: Tokens โ†’ Output files
308
+ npm run build:tokens
309
+
310
+ # Or both in one step:
311
+ npm run build
312
+ ```
313
+
314
+ **Build Results:**
315
+ - โœ… 30/30 builds successful
316
+ - โœ… 0 warnings
317
+ - โœ… All aliases resolved correctly
318
+ - โœ… Brand-specific values verified
319
+
320
+ ### Watch Mode (Development)
321
+
322
+ ```bash
323
+ # Auto-rebuild on changes
324
+ npm run watch
325
+ ```
326
+
327
+ ### Clean Build
328
+
329
+ ```bash
330
+ # Remove all generated files
331
+ npm run clean
332
+ ```
333
+
334
+ ---
335
+
336
+ ## ๐Ÿ“ Output Structure
337
+
338
+ ### Platform-First Organization
339
+
340
+ ```
341
+ dist/
342
+ โ”œโ”€โ”€ manifest.json # Manifest of all generated files
343
+ โ”‚
344
+ โ”œโ”€โ”€ css/ # CSS Custom Properties
345
+ โ”‚ โ”œโ”€โ”€ base/
346
+ โ”‚ โ”‚ โ”œโ”€โ”€ index.css # Aggregates all base tokens
347
+ โ”‚ โ”‚ โ”œโ”€โ”€ primitive-color-value.css
348
+ โ”‚ โ”‚ โ”œโ”€โ”€ primitive-color-value-global.css
349
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
350
+ โ”‚ โ”œโ”€โ”€ mapping/
351
+ โ”‚ โ”‚ โ”œโ”€โ”€ index.css
352
+ โ”‚ โ”‚ โ”œโ”€โ”€ brand-bild.css
353
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
354
+ โ”‚ โ”œโ”€โ”€ density/
355
+ โ”‚ โ”‚ โ”œโ”€โ”€ index.css
356
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
357
+ โ”‚ โ””โ”€โ”€ semantic/
358
+ โ”‚ โ”œโ”€โ”€ bild/
359
+ โ”‚ โ”‚ โ”œโ”€โ”€ color/
360
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ index.css
361
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ color-bild-light.css
362
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ color-bild-light-global.css
363
+ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ color-bild-dark.css
364
+ โ”‚ โ”‚ โ””โ”€โ”€ breakpoints/
365
+ โ”‚ โ”‚ โ”œโ”€โ”€ index.css
366
+ โ”‚ โ”‚ โ”œโ”€โ”€ breakpoint-bild-xs.css
367
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
368
+ โ”‚ โ”œโ”€โ”€ sportbild/
369
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
370
+ โ”‚ โ””โ”€โ”€ advertorial/
371
+ โ”‚ โ””โ”€โ”€ ...
372
+ โ”‚
373
+ โ”œโ”€โ”€ scss/ # SCSS Variables (same structure)
374
+ โ”œโ”€โ”€ js/ # JavaScript ES6 Modules (same structure)
375
+ โ””โ”€โ”€ json/ # Structured JSON (same structure)
376
+ ```
377
+
378
+ ### File Format Variants
379
+
380
+ Each token set generates multiple variants:
381
+
382
+ | Format | Usage | Selector | Example |
383
+ |--------|-------|----------|---------|
384
+ | `.css` | Data attribute scoped | `[data-color="light"]` | Scoped contexts |
385
+ | `-global.css` | Root scoped | `:root` | Global application |
386
+ | `.scss` | SCSS variables | `$token-name` | Sass preprocessing |
387
+ | `.js` | ES6 module | `import tokens` | JavaScript apps |
388
+ | `.json` | Structured data | JSON | API/tooling |
389
+
390
+ ---
391
+
392
+ ## ๐ŸŽจ Usage in Projects
393
+
394
+ ### CSS
395
+
396
+ ```css
397
+ /* Import brand-specific tokens */
398
+ @import '@bild-ds/tokens/dist/css/semantic/bild/color/color-bild-light.css';
399
+ @import '@bild-ds/tokens/dist/css/semantic/bild/breakpoints/breakpoint-bild-md.css';
400
+
401
+ /* Or use index files */
402
+ @import '@bild-ds/tokens/dist/css/semantic/bild/color/index.css';
403
+
404
+ /* Usage with data attributes */
405
+ [data-color="light"] {
406
+ background: var(--semantic-core-core-color-primary); /* #de0000 for BILD */
407
+ }
408
+
409
+ /* Or with global variant */
410
+ @import '@bild-ds/tokens/dist/css/semantic/bild/color/color-bild-light-global.css';
411
+
412
+ .button {
413
+ background: var(--semantic-core-core-color-primary);
414
+ }
415
+ ```
416
+
417
+ ### SCSS
418
+
419
+ ```scss
420
+ // Import brand-specific tokens
421
+ @import '@bild-ds/tokens/dist/scss/semantic/bild/color/color-bild-light.scss';
422
+
423
+ // Usage
424
+ .button {
425
+ background-color: $semantic-core-core-color-primary; // #de0000 for BILD
426
+ padding: $semantic-spacing-spacing-md;
427
+ }
428
+ ```
429
+
430
+ ### JavaScript/TypeScript
431
+
432
+ ```javascript
433
+ // Import brand-specific tokens
434
+ import bildColorLight from '@bild-ds/tokens/dist/js/semantic/bild/color/color-bild-light.js';
435
+ import sportbildColorLight from '@bild-ds/tokens/dist/js/semantic/sportbild/color/color-sportbild-light.js';
436
+
437
+ // BILD brand
438
+ console.log(bildColorLight['semantic-core-core-color-primary']); // "#de0000"
439
+
440
+ // SportBILD brand
441
+ console.log(sportbildColorLight['semantic-core-core-color-primary']); // "#0a264f"
442
+ ```
443
+
444
+ ### React/Styled Components
445
+
446
+ ```jsx
447
+ import bildTokens from '@bild-ds/tokens/dist/js/semantic/bild/color/color-bild-light.js';
448
+
449
+ const Button = styled.button`
450
+ background-color: ${bildTokens['semantic-core-core-color-primary']};
451
+ color: ${bildTokens['semantic-core-core-fg-on-primary']};
452
+ `;
453
+ ```
454
+
455
+ ---
456
+
457
+ ## โš™๏ธ Configuration
458
+
459
+ ### Collection Configuration
460
+
461
+ Located in `scripts/build-tokens.js`:
462
+
463
+ ```javascript
464
+ const COLLECTION_CONFIG = {
465
+ 'colormode': {
466
+ layer: 'semantic',
467
+ category: 'color',
468
+ modes: ['light', 'dark'],
469
+ outputPrefix: 'color',
470
+ figmaCollectionId: 'VariableCollectionId:588:1979', // Stable ID
471
+ figmaCollectionName: 'ColorMode', // For logging only
472
+ brandSpecific: true,
473
+ brands: ['bild', 'sportbild', 'advertorial']
474
+ },
475
+ // ... more collections
476
+ };
477
+ ```
478
+
479
+ **Key Points:**
480
+ - Uses **stable Collection IDs** from Figma (robust against renaming)
481
+ - `brandSpecific: true` generates separate files per brand
482
+ - `modeMapping` can transform mode names (e.g., `xs-320px` โ†’ `xs`)
483
+
484
+ ### Brand-Specific Collections
485
+
486
+ Located in `scripts/preprocess-figma-tokens.js`:
487
+
488
+ ```javascript
489
+ const BRAND_SPECIFIC_COLLECTIONS = {
490
+ 'VariableCollectionId:588:1979': { // ColorMode
491
+ collectionName: 'ColorMode',
492
+ brandSpecific: true,
493
+ brands: ['bild', 'sportbild', 'advertorial'],
494
+ brandCollectionIds: [
495
+ 'VariableCollectionId:18038:10593', // BrandTokenMapping
496
+ 'VariableCollectionId:18212:14495' // BrandColorMapping
497
+ ]
498
+ }
499
+ };
500
+ ```
501
+
502
+ **How It Works:**
503
+ 1. During preprocessing, ColorMode tokens that reference BrandColorMapping
504
+ 2. Are resolved **per brand** using the correct mode ID
505
+ 3. Generate separate output files: `light-bild.json`, `light-sportbild.json`, etc.
506
+
507
+ ### Style Dictionary Transforms
508
+
509
+ Custom transforms in `build-config/style-dictionary.config.js`:
510
+
511
+ ```javascript
512
+ StyleDictionary.registerTransform({
513
+ name: 'attribute/cti',
514
+ type: 'attribute',
515
+ transformer: (token) => {
516
+ // Custom transformation logic
517
+ }
518
+ });
519
+ ```
520
+
521
+ ---
522
+
523
+ ## ๐Ÿ”„ CI/CD Integration
524
+
525
+ ### GitHub Actions Workflow
526
+
527
+ Located in `.github/workflows/build-tokens.yml`
528
+
529
+ **Triggers:**
530
+ - Push to `main`, `develop`, or `claude/**` branches
531
+ - Changes in `src/design-tokens/`
532
+ - Changes in `scripts/` or `build-config/`
533
+ - Manual workflow dispatch
534
+
535
+ **Build Steps:**
536
+ 1. Checkout repository
537
+ 2. Setup Node.js
538
+ 3. Install dependencies
539
+ 4. Run preprocessing
540
+ 5. Run build
541
+ 6. Upload artifacts
542
+
543
+ **Artifacts:**
544
+ - Name: `design-tokens-{commit-sha}`
545
+ - Retention: 30 days
546
+ - Contains: All generated files
547
+
548
+ ### Manual Workflow Dispatch
549
+
550
+ **Via GitHub UI:**
551
+ 1. Go to **Actions** tab
552
+ 2. Select **"Build Design Tokens"**
553
+ 3. Click **"Run workflow"**
554
+
555
+ **Via GitHub CLI:**
556
+ ```bash
557
+ gh workflow run build-tokens.yml
558
+ ```
559
+
560
+ ---
561
+
562
+ ## ๐Ÿ”ง Development
563
+
564
+ ### Project Structure
565
+
566
+ ```
567
+ .
568
+ โ”œโ”€โ”€ src/
569
+ โ”‚ โ””โ”€โ”€ design-tokens/
570
+ โ”‚ โ””โ”€โ”€ BILD Design System-variables-full.json # Figma export
571
+ โ”‚
572
+ โ”œโ”€โ”€ scripts/
573
+ โ”‚ โ”œโ”€โ”€ preprocess-figma-tokens.js # Preprocessing
574
+ โ”‚ โ”‚ โ€ข Alias resolution with brand awareness
575
+ โ”‚ โ”‚ โ€ข Collection ID mapping
576
+ โ”‚ โ”‚ โ€ข Mode ID mapping
577
+ โ”‚ โ”‚ โ€ข Zero false positives (handles 0, false, "")
578
+ โ”‚ โ””โ”€โ”€ build-tokens.js # Build orchestration
579
+ โ”‚ โ€ข Collection configuration
580
+ โ”‚ โ€ข Brand-specific builds
581
+ โ”‚ โ€ข Index file generation
582
+ โ”‚
583
+ โ”œโ”€โ”€ build-config/
584
+ โ”‚ โ””โ”€โ”€ style-dictionary.config.js # Custom transforms & formats
585
+ โ”‚
586
+ โ”œโ”€โ”€ tokens/ # Generated (gitignored)
587
+ โ”‚ โ”œโ”€โ”€ colormode/
588
+ โ”‚ โ”‚ โ”œโ”€โ”€ light-bild.json # Brand-specific
589
+ โ”‚ โ”‚ โ”œโ”€โ”€ light-sportbild.json
590
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
591
+ โ”‚ โ””โ”€โ”€ ...
592
+ โ”‚
593
+ โ”œโ”€โ”€ dist/ # Generated (gitignored)
594
+ โ”‚ โ”œโ”€โ”€ css/
595
+ โ”‚ โ”œโ”€โ”€ scss/
596
+ โ”‚ โ”œโ”€โ”€ js/
597
+ โ”‚ โ””โ”€โ”€ json/
598
+ โ”‚
599
+ โ””โ”€โ”€ README.md
600
+ ```
601
+
602
+ ### Development Workflow
603
+
604
+ 1. **Export from Figma**
605
+ - Use VariableVisualizer Plugin
606
+ - Export as `BILD Design System-variables-full.json`
607
+
608
+ 2. **Place JSON**
609
+ - Save to `src/design-tokens/`
610
+
611
+ 3. **Preprocess**
612
+ ```bash
613
+ npm run preprocess
614
+ ```
615
+ - Resolves aliases per brand
616
+ - Creates intermediate token files
617
+ - **0 warnings expected**
618
+
619
+ 4. **Build**
620
+ ```bash
621
+ npm run build:tokens
622
+ ```
623
+ - Transforms to all formats
624
+ - **30/30 builds expected**
625
+
626
+ 5. **Verify**
627
+ ```bash
628
+ # Check brand-specific values
629
+ grep "core-color-primary" dist/css/semantic/*/color/*-light.css
630
+
631
+ # Expected:
632
+ # bild: #de0000 (BILD red)
633
+ # sportbild: #0a264f (SportBILD dark blue)
634
+ ```
635
+
636
+ ---
637
+
638
+ ## ๐Ÿงช Testing
639
+
640
+ ### Build Verification
641
+
642
+ ```bash
643
+ # Run full build
644
+ npm run build
645
+
646
+ # Check build statistics
647
+ # Expected: 30/30 builds successful, 0 warnings
648
+
649
+ # Verify output structure
650
+ ls -R dist/css/semantic/
651
+
652
+ # Check brand-specific values
653
+ cat dist/css/semantic/bild/color/color-bild-light.css | grep "core-color-primary"
654
+ cat dist/css/semantic/sportbild/color/color-sportbild-light.css | grep "core-color-primary"
655
+ ```
656
+
657
+ ### Alias Resolution Check
658
+
659
+ ```bash
660
+ # Check for unresolved aliases
661
+ grep -r "UNRESOLVED" tokens/
662
+
663
+ # Expected: No results (all aliases should be resolved)
664
+ ```
665
+
666
+ ---
667
+
668
+ ## ๐Ÿ†˜ Troubleshooting
669
+
670
+ ### Build Warnings
671
+
672
+ **Problem:** Warnings about missing values or circular references
673
+
674
+ **Solution:** This has been fixed! The pipeline now:
675
+ - Uses `value === undefined || value === null` checks (handles `0`, `false`, `""` correctly)
676
+ - Uses Variable IDs for circular reference detection (not names)
677
+ - Resolves cross-collection aliases correctly per brand
678
+
679
+ **Expected:** 0 warnings in both preprocessing and build
680
+
681
+ ### Brand Values Incorrect
682
+
683
+ **Problem:** All brands have the same color values
684
+
685
+ **Solution:** This has been fixed! The pipeline now:
686
+ - Maps brand names to Mode IDs in brand collections
687
+ - Resolves aliases using the correct brand-specific mode
688
+ - Generates separate token files per brand
689
+
690
+ **Verify:**
691
+ ```bash
692
+ # BILD should have #de0000
693
+ grep "core-color-primary" dist/css/semantic/bild/color/color-bild-light.css
694
+
695
+ # SportBILD should have #0a264f
696
+ grep "core-color-primary" dist/css/semantic/sportbild/color/color-sportbild-light.css
697
+ ```
698
+
699
+ ### Merge Conflicts with dist/
700
+
701
+ **Problem:** Git conflicts in `dist/` folder
702
+
703
+ **Solution:** This has been fixed! `dist/` is now:
704
+ - Fully gitignored
705
+ - Generated locally or in CI/CD
706
+ - Never committed to the repository
707
+
708
+ ### Collection Renamed in Figma
709
+
710
+ **Problem:** Pipeline breaks after renaming collections in Figma
711
+
712
+ **Solution:** This has been fixed! The pipeline now uses:
713
+ - **Stable Collection IDs** instead of names
714
+ - IDs never change even if you rename collections
715
+ - Names are kept only for logging purposes
716
+
717
+ ---
718
+
719
+ ## ๐Ÿ“Š Build Statistics
720
+
721
+ **Current Performance:**
722
+ - โœ… 30/30 builds successful
723
+ - โœ… 0 warnings
724
+ - โœ… 0 errors
725
+ - โœ… ~3s preprocessing
726
+ - โœ… ~5s build
727
+ - โœ… 178 token files generated
728
+ - โœ… All cross-collection aliases resolved
729
+ - โœ… Brand-specific values verified
730
+
731
+ ---
732
+
733
+ ## ๐Ÿ”— Resources
734
+
735
+ - [Style Dictionary v4 Documentation](https://styledictionary.com/)
736
+ - [Figma Variables API](https://www.figma.com/plugin-docs/api/properties/figma-variables/)
737
+ - [Design Tokens Community Group](https://design-tokens.github.io/community-group/)
738
+ - [VariableVisualizer Plugin](https://www.figma.com/community/plugin/1245712093276493432)
739
+
740
+ ---
741
+
742
+ ## ๐Ÿ“ Changelog
743
+
744
+ ### Latest (Current)
745
+
746
+ **โœจ Features:**
747
+ - Brand-specific semantic layer structure (`dist/css/semantic/{brand}/{category}/`)
748
+ - Stable Collection ID usage (robust against Figma renaming)
749
+ - Zero false positive warnings (correct handling of falsy values)
750
+ - Cross-collection brand-aware alias resolution
751
+ - Recursive index file generation
752
+
753
+ **๐Ÿ› Bug Fixes:**
754
+ - Fixed falsy value detection (`0`, `false`, `""` now handled correctly)
755
+ - Fixed false positive circular reference warnings
756
+ - Fixed cross-collection alias resolution for brand-specific tokens
757
+ - Removed `dist/` from git tracking (now fully gitignored)
758
+
759
+ **โšก Performance:**
760
+ - 30/30 builds successful
761
+ - 0 warnings in preprocessing
762
+ - 0 warnings in build
763
+ - All aliases fully resolved
764
+
765
+ ---
766
+
767
+ **Built with โค๏ธ for the BILD Design System**