@rijkshuisstijl-community/design-tokens 9.0.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +160 -0
- package/README.md +48 -3
- package/build.mjs +86 -20
- package/cssFixers.mjs +89 -0
- package/cssFixers.spec.mjs +98 -0
- package/dist/_variables.scss +1359 -1381
- package/dist/index.css +1359 -1381
- package/dist/index.d.ts +1437 -1396
- package/dist/index.js +1292 -1275
- package/dist/index.json +1208 -1230
- package/dist/index.tokens.json +1703 -1746
- package/dist/kern-lintblauw/_variables.scss +1376 -0
- package/dist/kern-lintblauw/index.css +1379 -0
- package/dist/kern-lintblauw/index.d.ts +1440 -0
- package/dist/{wetgevend → kern-lintblauw}/index.js +1334 -1238
- package/dist/{wetgevend → kern-lintblauw}/index.json +1294 -1237
- package/dist/{wetgevend → kern-lintblauw}/index.tokens.json +1894 -1779
- package/dist/kern-lintblauw/root.css +1379 -0
- package/dist/kern-lintblauw/tokens.d.ts +2245 -0
- package/dist/kern-lintblauw/tokens.js +31032 -0
- package/dist/root.css +1359 -1381
- package/dist/tokens.d.ts +2205 -2247
- package/dist/tokens.js +29984 -32173
- package/dist/uitvoerend-groen/_variables.scss +1355 -1298
- package/dist/uitvoerend-groen/index.css +1355 -1298
- package/dist/uitvoerend-groen/index.d.ts +1437 -1317
- package/dist/uitvoerend-groen/index.js +1307 -1220
- package/dist/uitvoerend-groen/index.json +1280 -1223
- package/dist/uitvoerend-groen/index.tokens.json +1918 -1803
- package/dist/uitvoerend-groen/root.css +1355 -1298
- package/dist/uitvoerend-groen/tokens.d.ts +2209 -2100
- package/dist/uitvoerend-groen/tokens.js +30314 -30632
- package/dist/uitvoerend-hemelblauw/_variables.scss +1355 -1298
- package/dist/uitvoerend-hemelblauw/index.css +1355 -1298
- package/dist/uitvoerend-hemelblauw/index.d.ts +1437 -1317
- package/dist/uitvoerend-hemelblauw/index.js +1307 -1220
- package/dist/uitvoerend-hemelblauw/index.json +1280 -1223
- package/dist/uitvoerend-hemelblauw/index.tokens.json +1921 -1806
- package/dist/uitvoerend-hemelblauw/root.css +1355 -1298
- package/dist/uitvoerend-hemelblauw/tokens.d.ts +2209 -2100
- package/dist/uitvoerend-hemelblauw/tokens.js +30314 -30632
- package/dist/uitvoerend-lintblauw/_variables.scss +1376 -0
- package/dist/uitvoerend-lintblauw/index.css +1379 -0
- package/dist/uitvoerend-lintblauw/index.d.ts +1440 -0
- package/dist/{koop → uitvoerend-lintblauw}/index.js +1325 -1238
- package/dist/{koop → uitvoerend-lintblauw}/index.json +1295 -1238
- package/dist/{koop → uitvoerend-lintblauw}/index.tokens.json +1894 -1779
- package/dist/uitvoerend-lintblauw/root.css +1379 -0
- package/dist/uitvoerend-lintblauw/tokens.d.ts +2245 -0
- package/dist/uitvoerend-lintblauw/tokens.js +31032 -0
- package/dist/uitvoerend-oranje/_variables.scss +1355 -1298
- package/dist/uitvoerend-oranje/index.css +1355 -1298
- package/dist/uitvoerend-oranje/index.d.ts +1437 -1317
- package/dist/uitvoerend-oranje/index.js +1336 -1249
- package/dist/uitvoerend-oranje/index.json +1290 -1233
- package/dist/uitvoerend-oranje/index.tokens.json +1922 -1807
- package/dist/uitvoerend-oranje/root.css +1355 -1298
- package/dist/uitvoerend-oranje/tokens.d.ts +2209 -2100
- package/dist/uitvoerend-oranje/tokens.js +30314 -30632
- package/dist/uitvoerend-paars/_variables.scss +1355 -1298
- package/dist/uitvoerend-paars/index.css +1355 -1298
- package/dist/uitvoerend-paars/index.d.ts +1437 -1317
- package/dist/uitvoerend-paars/index.js +1307 -1220
- package/dist/uitvoerend-paars/index.json +1280 -1223
- package/dist/uitvoerend-paars/index.tokens.json +1931 -1816
- package/dist/uitvoerend-paars/root.css +1355 -1298
- package/dist/uitvoerend-paars/tokens.d.ts +2209 -2100
- package/dist/uitvoerend-paars/tokens.js +30314 -30632
- package/dist/uitvoerend-robijnrood/_variables.scss +1376 -0
- package/dist/uitvoerend-robijnrood/index.css +1379 -0
- package/dist/uitvoerend-robijnrood/index.d.ts +1440 -0
- package/dist/uitvoerend-robijnrood/index.js +1407 -0
- package/dist/{uitvoerend-mintgroen → uitvoerend-robijnrood}/index.json +1278 -1221
- package/dist/{uitvoerend-mintgroen → uitvoerend-robijnrood}/index.tokens.json +1955 -1840
- package/dist/uitvoerend-robijnrood/root.css +1379 -0
- package/dist/uitvoerend-robijnrood/tokens.d.ts +2245 -0
- package/dist/uitvoerend-robijnrood/tokens.js +31032 -0
- package/figma/figma.tokens.json +4613 -6238
- package/package.json +6 -4
- package/src/generated/base.tokens.json +5872 -5852
- package/src/generated/kern-lintblauw/tokens.json +6760 -0
- package/src/generated/themes.json +41479 -50820
- package/src/generated/uitvoerend-groen/tokens.json +5920 -5453
- package/src/generated/uitvoerend-hemelblauw/tokens.json +5920 -5453
- package/src/generated/uitvoerend-lintblauw/tokens.json +6772 -0
- package/src/generated/uitvoerend-oranje/tokens.json +6136 -5485
- package/src/generated/uitvoerend-paars/tokens.json +5920 -5453
- package/src/generated/uitvoerend-robijnrood/tokens.json +6812 -0
- package/token-transformer.mjs +5 -43
- package/dist/koop/_variables.scss +0 -1319
- package/dist/koop/index.css +0 -1322
- package/dist/koop/index.d.ts +0 -1320
- package/dist/koop/root.css +0 -1322
- package/dist/koop/tokens.d.ts +0 -2136
- package/dist/koop/tokens.js +0 -31350
- package/dist/uitvoerend-mintgroen/_variables.scss +0 -1319
- package/dist/uitvoerend-mintgroen/index.css +0 -1322
- package/dist/uitvoerend-mintgroen/index.d.ts +0 -1320
- package/dist/uitvoerend-mintgroen/index.js +0 -1320
- package/dist/uitvoerend-mintgroen/root.css +0 -1322
- package/dist/uitvoerend-mintgroen/tokens.d.ts +0 -2136
- package/dist/uitvoerend-mintgroen/tokens.js +0 -31350
- package/dist/uitvoerend-violet/_variables.scss +0 -1319
- package/dist/uitvoerend-violet/index.css +0 -1322
- package/dist/uitvoerend-violet/index.d.ts +0 -1320
- package/dist/uitvoerend-violet/index.js +0 -1320
- package/dist/uitvoerend-violet/index.json +0 -1317
- package/dist/uitvoerend-violet/index.tokens.json +0 -2113
- package/dist/uitvoerend-violet/root.css +0 -1322
- package/dist/uitvoerend-violet/tokens.d.ts +0 -2136
- package/dist/uitvoerend-violet/tokens.js +0 -31350
- package/dist/uitvoerend-violet-oud/_variables.scss +0 -1320
- package/dist/uitvoerend-violet-oud/index.css +0 -1323
- package/dist/uitvoerend-violet-oud/index.d.ts +0 -1321
- package/dist/uitvoerend-violet-oud/index.js +0 -1321
- package/dist/uitvoerend-violet-oud/index.json +0 -1318
- package/dist/uitvoerend-violet-oud/index.tokens.json +0 -2114
- package/dist/uitvoerend-violet-oud/root.css +0 -1323
- package/dist/uitvoerend-violet-oud/tokens.d.ts +0 -2137
- package/dist/uitvoerend-violet-oud/tokens.js +0 -31371
- package/dist/wetgevend/_variables.scss +0 -1319
- package/dist/wetgevend/index.css +0 -1322
- package/dist/wetgevend/index.d.ts +0 -1320
- package/dist/wetgevend/root.css +0 -1322
- package/dist/wetgevend/tokens.d.ts +0 -2136
- package/dist/wetgevend/tokens.js +0 -31350
- package/src/generated/koop/tokens.json +0 -6345
- package/src/generated/uitvoerend-mintgroen/tokens.json +0 -6345
- package/src/generated/uitvoerend-violet/tokens.json +0 -6345
- package/src/generated/uitvoerend-violet-oud/tokens.json +0 -6349
- package/src/generated/wetgevend/tokens.json +0 -6345
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,165 @@
|
|
|
1
1
|
# @rijkshuisstijl-community/design-tokens
|
|
2
2
|
|
|
3
|
+
## 10.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f5942a6: Parent key is verwijderd uit figma.tokens.json. Deze key is nooit in gebruik geweest, dit heeft geen impact.
|
|
8
|
+
- e7b3d60: Add section about adding new token sets in documentation
|
|
9
|
+
- 5f77bfa: Added transformations on CSS-tokens to allow for calculations with references, power (^) and sanitize any `roundTo` in tokens
|
|
10
|
+
|
|
11
|
+
## 10.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- 093f3af: Update token format version to W3C DCTG, read more at https://docs.tokens.studio/convert-to-dtcg-format.
|
|
16
|
+
- 462686a: De brand en common tokens van RHC zijn naast de basis tokens gelegd. Hieruit zijn aantal naamwijzigen gekomen om de tokens beter aan te laten sluiten. Maak je direct gebruik van common tokens? Dan is dit een breaking change.
|
|
17
|
+
|
|
18
|
+
Subdued is gewijzigd in subtle:
|
|
19
|
+
- naam `rhc.color.foreground.subdued` gewijzigd naar `rhc.color.foreground.subtle`
|
|
20
|
+
- naam `rhc.color.border.subdued` gewijzigd naar `rhc.color.border.subtle`
|
|
21
|
+
|
|
22
|
+
Naamgeving feedback kleuren zijn aangepast:
|
|
23
|
+
- naam `rhc.color.feedback.success.default` gewijzigd naar `rhc.color.positive.default`
|
|
24
|
+
- naam `rhc.color.feedback.success.subdued` gewijzigd naar `rhc.color.positive.subtle`
|
|
25
|
+
- naam `rhc.color.feedback.info.default` gewijzigd naar `rhc.color.info.default`
|
|
26
|
+
- naam `rhc.color.feedback.info.subdued` gewijzigd naar `rhc.color.info.subtle`
|
|
27
|
+
- naam `rhc.color.feedback.error.default` gewijzigd naar `rhc.color.negative.default`
|
|
28
|
+
- naam `rhc.color.feedback.error.subdued` gewijzigd naar `rhc.color.negative.subtle`
|
|
29
|
+
- naam `rhc.color.feedback.warning.default` gewijzigd naar `rhc.color.warning.default`
|
|
30
|
+
- naam `rhc.color.feedback.warning.subdued` gewijzigd naar `rhc.color.warning.subtle`
|
|
31
|
+
|
|
32
|
+
Groepering 'text' is toegevoegd aan de font tokens:
|
|
33
|
+
- naam `rhc.font-weight.extra-bold` gewijzigd naar `rhc.text.font-weight.extra-bold`
|
|
34
|
+
- naam `rhc.font-weight.bold` gewijzigd naar `rhc.text.font-weight.bold`
|
|
35
|
+
- naam `rhc.font-weight.semi-bold` gewijzigd naar `rhc.text.font-weight.semi-bold`
|
|
36
|
+
- naam `rhc.font-weight.regular` gewijzigd naar `rhc.text.font-weight.regular`
|
|
37
|
+
- naam `rhc.font-weight.light` gewijzigd naar `rhc.text.font-weight.light`
|
|
38
|
+
- naam `rhc.font-weight.default` gewijzigd naar `rhc.text.font-weight.default`
|
|
39
|
+
- naam `rhc.font-weight.strong` gewijzigd naar `rhc.text.font-weight.strong`
|
|
40
|
+
- naam `rhc.font-weight.thin` gewijzigd naar `rhc.text.font-weight.thin`
|
|
41
|
+
- naam `rhc.line-height.sm` gewijzigd naar `rhc.text.line-height.sm`
|
|
42
|
+
- naam `rhc.line-height.md` & `rhc.line-height.body` gewijzigd naar `rhc.text.line-height.md`
|
|
43
|
+
- naam `rhc.font-family.primary` gewijzigd naar `rhc.text.font-family.default`
|
|
44
|
+
- naam `rhc.font-family.secondary` gewijzigd naar `rhc.text.font-family.serif`
|
|
45
|
+
|
|
46
|
+
Font-size schaal is gewijzigd:
|
|
47
|
+
- naam `rhc.font-size.heading.level-5` & `rhc.font-size.body.default` gewijzigd naar `rhc.text.font-size.md`
|
|
48
|
+
- naam `rhc.font-size.heading.level-4` & `rhc.font-size.body.intro` gewijzigd naar `rhc.text.font-size.lg`
|
|
49
|
+
- naam `rhc.font-size.heading.level-3` gewijzigd naar `rhc.text.font-size.xl`
|
|
50
|
+
- naam `rhc.font-size.heading.level-2` gewijzigd naar `rhc.text.font-size.2xl`
|
|
51
|
+
- naam `rhc.font-size.heading.level-1` gewijzigd naar `rhc.text.font-size.3xl`
|
|
52
|
+
|
|
53
|
+
responsive schaal is gewijzigd:
|
|
54
|
+
- naam `rhc.font-size.xs.desktop` gewijzigd naar `rhc.text.font-size.max.md`
|
|
55
|
+
- naam `rhc.font-size.xs.mobile` gewijzigd naar `rhc.text.font-size.min.md`
|
|
56
|
+
- naam `rhc.font-size.sm.desktop` gewijzigd naar `rhc.text.font-size.max.lg`
|
|
57
|
+
- naam `rhc.font-size.sm.mobile` gewijzigd naar `rhc.text.font-size.min.lg`
|
|
58
|
+
- naam `rhc.font-size.md.desktop` gewijzigd naar `rhc.text.font-size.max.xl`
|
|
59
|
+
- naam `rhc.font-size.md.mobile` gewijzigd naar `rhc.text.font-size.min.xl`
|
|
60
|
+
- naam `rhc.font-size.lg.desktop` gewijzigd naar `rhc.text.font-size.max.2xl`
|
|
61
|
+
- naam `rhc.font-size.lg.mobile` gewijzigd naar `rhc.text.font-size.min.2xl`
|
|
62
|
+
- naam `rhc.font-size.xl.desktop` gewijzigd naar `rhc.text.font-size.max.3xl`
|
|
63
|
+
- naam `rhc.font-size.xl.mobile` gewijzigd naar `rhc.text.font-size.min.3xl`
|
|
64
|
+
|
|
65
|
+
Andere naam-wijzigingen:
|
|
66
|
+
- naam `rhc.color.canvas` gewijzigd naar `rhc.color.bg-document`
|
|
67
|
+
- naam `rhc.size.target` gewijzigd naar `rhc.size.pointer-target`
|
|
68
|
+
|
|
69
|
+
Toegevoegde tokens:
|
|
70
|
+
- `rhc.text.font-family.sans`
|
|
71
|
+
|
|
72
|
+
Verwijderde tokens:
|
|
73
|
+
- `rhc.font-size.xs.tablet`
|
|
74
|
+
- `rhc.font-size.sm.tablet`
|
|
75
|
+
- `rhc.font-size.md.tablet`
|
|
76
|
+
- `rhc.font-size.lg.tablet`
|
|
77
|
+
- `rhc.font-size.xl.tablet`
|
|
78
|
+
|
|
79
|
+
- b04f679: Thema's bijgewerkt
|
|
80
|
+
- `body` en `root` zijn enabled.
|
|
81
|
+
- Hover & active kleuren van buttons aangepast van lint-blauw naar de thema kleuren
|
|
82
|
+
- Alle uitvoerende thema's hebben nu RijksSans als default font.
|
|
83
|
+
- Thema's hernoemd volgens de naming convention `{type organisatie} - {naam primaire kleur}` bijvoorbeeld:
|
|
84
|
+
- Kern - Lintblauw
|
|
85
|
+
- Uitvoerend - Groen
|
|
86
|
+
- Uitvoerend - Oranje
|
|
87
|
+
- Verwijderd, deze thema’s waren voorbeelden en worden naar verwachting niet gebruikt:
|
|
88
|
+
- Uitvoerend - violet
|
|
89
|
+
- Uitvoerend - violet - oud
|
|
90
|
+
- Uitvoerend - mintgroen
|
|
91
|
+
- Nieuwe toevoeging:
|
|
92
|
+
- Uitvoerend - Robijn Rood
|
|
93
|
+
|
|
94
|
+
Overwrites tokensets bijgewerkt en opgeschoond
|
|
95
|
+
- `type-scale` toegevoegd.
|
|
96
|
+
- Accent kleuren verwijderd.
|
|
97
|
+
- Oude rijkshuisstijl verwijderd.
|
|
98
|
+
- Afwijkende button verwijderd.
|
|
99
|
+
- Volgorde van de tokensets aangepast.
|
|
100
|
+
|
|
101
|
+
Nieuwe token toegevoegd
|
|
102
|
+
- Token `rhc.color.primary.active` is toegevoegd aan de common tokens.
|
|
103
|
+
|
|
104
|
+
- cd14679: De brand en common tokens van RHC zijn naast de basis tokens gelegd. Hieruit zijn aantal naamwijzigen gekomen om de tokens beter aan te laten sluiten. Maak je direct gebruik van common tokens? Dan is dit een breaking change.
|
|
105
|
+
- `rhc.color.none` gewijzigd naar `rhc.color.transparant`
|
|
106
|
+
- `rhc.color.focus.outline` gewijzigd naar `rhc.focus.outline-color`
|
|
107
|
+
- `rhc.focus.inverse.outline-color` is toegevoegd
|
|
108
|
+
- `rhc.size.icon.functional` gewijzigd naar `rhc.size.icon.md`
|
|
109
|
+
- `rhc.border-radius.circle` gewijzigd naar `rhc.border-radius.round`
|
|
110
|
+
- `rhc.border-width.default` gewijzigd naar `rhc.border-width.sm`
|
|
111
|
+
- `rhc.border-width.m` gewijzigd naar `rhc.border-width.md`
|
|
112
|
+
|
|
113
|
+
- afe2d9c: **Token-structuur opgeschoond en hernoemd**
|
|
114
|
+
- `utrecht/*` tokens hernoemd naar `component/*` of verplaatst naar `common/vendor`.
|
|
115
|
+
- `component/rhc-icon-only` tokens verplaatst naar `components/button`.
|
|
116
|
+
- Alle `*/font` mappen hernoemd naar `*/text`.
|
|
117
|
+
- `overwrites/*` hernoemd naar `overrides/*`.
|
|
118
|
+
- Verwijderd:
|
|
119
|
+
- `utrecht/root`,
|
|
120
|
+
- `utrecht/body`,
|
|
121
|
+
- `components/form-field-label/todo`,
|
|
122
|
+
- `overwrites/footer/*`,
|
|
123
|
+
- `overwrites/nav-bar/*`.
|
|
124
|
+
- Hernoemd:
|
|
125
|
+
- `components/pagination/ams` → `components/page-number-navigation`,
|
|
126
|
+
- `components/footer` → `components/page-footer`.
|
|
127
|
+
|
|
128
|
+
**Accent-tokens verwijderd**
|
|
129
|
+
Accent-tokens verwijderd omdat ze niet in gebruik zijn en de waardes organisatie specifiek:
|
|
130
|
+
- `rhc.color.accent-1`,
|
|
131
|
+
- `rhc.color.accent-2`.
|
|
132
|
+
|
|
133
|
+
**Thema's aangepast**
|
|
134
|
+
- Thema `KOOP` hernoemd naar `Uitvoerend – Lintblauw` voor meer generieke naamgeving.
|
|
135
|
+
- Thema `Uitvoerend - Oranje` non-primary button uitvoering aangepast voor toegankelijkheid.
|
|
136
|
+
|
|
137
|
+
- 5b7a72c: Updated rounded corner common tokens to the following values:
|
|
138
|
+
--rhc-rounded-corner-overflow
|
|
139
|
+
--rhc-rounded-corner-sm-border-radius
|
|
140
|
+
--rhc-rounded-corner-md-border-radius
|
|
141
|
+
--rhc-rounded-corner-lg-border-radius
|
|
142
|
+
- afe2d9c: Koop thema hernoemd naar Uitvoerend lintblauw. Let op dat je de volgende import wijzeging moet doorvoeren als je de koop thema gebruikte:
|
|
143
|
+
van: `@import "@rijkshuisstijl-community/design-tokens/dist/koop/index.css";`
|
|
144
|
+
naar: `@import "@rijkshuisstijl-community/design-tokens/dist/uitvoerend-lintblauw/index.css";`
|
|
145
|
+
|
|
146
|
+
### Minor Changes
|
|
147
|
+
|
|
148
|
+
- 80fea49: - De volgende token is toegevoegd: `utrecht.icon.baseline.inset-block-start`
|
|
149
|
+
- Design token utrecht.link-list.font-weight hernoemd naar utrecht.link-list.link.font-weight
|
|
150
|
+
- 3d1fbeb: standaard theme is nu hetzelfde als kern - lintblauw
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- cd80794: Updated readme's to install dependencies for build instead of dev.
|
|
155
|
+
- 9a27826: radio button removed deprecated tokens
|
|
156
|
+
- 2062466: textarea tokens; deprecated verwijderd
|
|
157
|
+
- e536c65: A token classified as deprecated was not deprecated (field field) - still in use by form-field-radio-option
|
|
158
|
+
- 2f3f91c: figure; token en css cleanup
|
|
159
|
+
- 5961ac6: checkbox; check on deprecated tokens
|
|
160
|
+
- 17fe29e: select; removed deprecated tokens
|
|
161
|
+
- bbba719: added tokens for utrecht/root&body to support root font
|
|
162
|
+
|
|
3
163
|
## 9.0.0
|
|
4
164
|
|
|
5
165
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -18,10 +18,10 @@ Hieronder vind je instructies hoe je de standaard Rijkshuisstijl-community token
|
|
|
18
18
|
1. Installeer je het [design-tokens npm package](https://www.npmjs.com/package/@rijkshuisstijl-community/design-tokens).
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npm install
|
|
21
|
+
npm install @rijkshuisstijl-community/design-tokens
|
|
22
22
|
|
|
23
23
|
# En als je CSS classes wilt importeren
|
|
24
|
-
npm install
|
|
24
|
+
npm install @rijkshuisstijl-community/components-css
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Dit pakket bevat de CSS-variabelen van het design systeem. Importeer het `index.css`-bestand uit de `dist` map van het pakket, en omring het deel van je applicatie waar je het thema wilt toepassen. Het Rijkshuisstijl-thema is bijvoorbeeld: `rhc-theme`.
|
|
@@ -44,7 +44,7 @@ Hieronder vind je instructies hoe je de standaard Rijkshuisstijl-community token
|
|
|
44
44
|
|
|
45
45
|
## Nieuw thema toevoegen
|
|
46
46
|
|
|
47
|
-
Er zijn al verschillende bedrijfsthema's in de @rijkshuisstijl-community/design-tokens package waarvoor (gedeeltelijke) support is vanuit de Rijkshuisstijl-community. Hieronder volgt een uitleg hoe nog meer thema's kunnen worden toegevoegd
|
|
47
|
+
Er zijn al verschillende bedrijfsthema's in de @rijkshuisstijl-community/design-tokens package waarvoor (gedeeltelijke) support is vanuit de Rijkshuisstijl-community. Hieronder volgt een uitleg hoe nog meer thema's kunnen worden toegevoegd.
|
|
48
48
|
|
|
49
49
|
## Nieuwe thema tokens
|
|
50
50
|
|
|
@@ -166,3 +166,48 @@ Er zijn al verschillende bedrijfsthema's in de @rijkshuisstijl-community/design-
|
|
|
166
166
|
};
|
|
167
167
|
export default preview;
|
|
168
168
|
```
|
|
169
|
+
|
|
170
|
+
## Nieuwe token set toevoegen
|
|
171
|
+
|
|
172
|
+
Als je tokensets toevoegt vanuit de code in `figma.tokens.json`, zitten daar regels aan vast.
|
|
173
|
+
Voor elke nieuwe tokenset, zoals bijvoorbeeld `components/pagination/ams`:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
"components/pagination/ams": {
|
|
177
|
+
"ams": {
|
|
178
|
+
"pagination": {
|
|
179
|
+
"font-family": {
|
|
180
|
+
"keys...": "values..."
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
is ook een entry nodig in `.$metadata.tokenSetOrder`: (op alfabetische volgorde aub)
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
"$metadata": {
|
|
191
|
+
"tokenSetOrder": [
|
|
192
|
+
"brand/color",
|
|
193
|
+
"components/pagination/ams",
|
|
194
|
+
"etc..."
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
én in _elk_ thema `.$themes[x].selectedTokenSets`: (op alfabetische volgorde aub)
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
"$themes": [
|
|
203
|
+
{
|
|
204
|
+
"id": "05865788a086eeac7ffc4514736ccd777f1ff95c",
|
|
205
|
+
"name": "wetgevend",
|
|
206
|
+
"$figmaStyleReferences": {},
|
|
207
|
+
"selectedTokenSets": {
|
|
208
|
+
"components/pagination/ams": "enabled",
|
|
209
|
+
"other/groups...": "enabled"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
```
|
package/build.mjs
CHANGED
|
@@ -1,20 +1,76 @@
|
|
|
1
1
|
import { existsSync, mkdirSync } from 'fs';
|
|
2
2
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
3
|
-
import
|
|
3
|
+
import { posix } from 'path';
|
|
4
4
|
import StyleDictionary from 'style-dictionary';
|
|
5
|
+
import { register } from '@tokens-studio/sd-transforms';
|
|
6
|
+
|
|
7
|
+
import { fixCSSFile } from './cssFixers.mjs';
|
|
5
8
|
|
|
6
9
|
// Will take the theme name and remove all spaces and make it lowercase
|
|
7
10
|
const normalizeThemeName = (name) => {
|
|
8
11
|
return name.toLowerCase().replace(/\s+/g, '');
|
|
9
12
|
};
|
|
10
13
|
|
|
14
|
+
const removeUnitlessLineHeightTransform = () => {
|
|
15
|
+
// During update to W3C DTCG format, we found that the tokens-studio transformGroup
|
|
16
|
+
// includes the transform "ts/size/lineheight" which transforms line-height token values declared with % into a unitless value.
|
|
17
|
+
// This caused minor UI changes in many of our components. We decided that this is not something we want to have happen automatically.
|
|
18
|
+
// Therefore we remove this specific transform from the transformGroup before building.
|
|
19
|
+
const indexOfLineHeightTransform =
|
|
20
|
+
StyleDictionary.hooks.transformGroups['tokens-studio'].indexOf('ts/size/lineheight');
|
|
21
|
+
if (indexOfLineHeightTransform !== -1) {
|
|
22
|
+
StyleDictionary.hooks.transformGroups['tokens-studio'].splice(indexOfLineHeightTransform, 1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
StyleDictionary.registerAction({
|
|
27
|
+
name: 'fixCSSTokens',
|
|
28
|
+
do: async function (_dictionary, config) {
|
|
29
|
+
const buildPath = config.buildPath || 'dist/';
|
|
30
|
+
const files = config.files || [];
|
|
31
|
+
// TS allows roundTo(), exponentiation (^) and basic calculations (without `calc()`) in their values, but these are not valid CSS.
|
|
32
|
+
for (const file of files) {
|
|
33
|
+
const filePath = posix.join(buildPath, file.destination);
|
|
34
|
+
console.log('🔧 fixing css:', filePath);
|
|
35
|
+
await fixCSSFile(filePath);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
// No undo action available - files are deleted during cleanup.
|
|
39
|
+
undo: function () {},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Custom header to add generation date
|
|
43
|
+
StyleDictionary.registerFileHeader({
|
|
44
|
+
name: 'nlds-rhc-header',
|
|
45
|
+
fileHeader: function (defaultMessage) {
|
|
46
|
+
return [...defaultMessage, `Generated on ${new Date().toUTCString()}`];
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const excludes = [
|
|
51
|
+
'components/avatar',
|
|
52
|
+
'components/form-field-option-label',
|
|
53
|
+
'components/modal-dialog',
|
|
54
|
+
'components/pagination/todo',
|
|
55
|
+
'components/status-badge',
|
|
56
|
+
'components/summary-list',
|
|
57
|
+
'components/task-list',
|
|
58
|
+
'components/toolbar-button',
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
register(StyleDictionary, { excludeParentKeys: true });
|
|
62
|
+
|
|
11
63
|
// Get the platforms config
|
|
12
64
|
const getPlatformsConfig = (buildPath, themeName) => {
|
|
13
65
|
return {
|
|
14
66
|
javascript: {
|
|
15
|
-
|
|
16
|
-
|
|
67
|
+
transformGroup: 'tokens-studio',
|
|
68
|
+
transforms: ['name/camel'],
|
|
17
69
|
buildPath,
|
|
70
|
+
excludes,
|
|
71
|
+
options: {
|
|
72
|
+
fileHeader: 'nlds-rhc-header',
|
|
73
|
+
},
|
|
18
74
|
files: [
|
|
19
75
|
{
|
|
20
76
|
format: 'typescript/es6-declarations',
|
|
@@ -42,31 +98,31 @@ const getPlatformsConfig = (buildPath, themeName) => {
|
|
|
42
98
|
},
|
|
43
99
|
],
|
|
44
100
|
},
|
|
45
|
-
|
|
46
|
-
|
|
101
|
+
web: {
|
|
102
|
+
transformGroup: 'tokens-studio',
|
|
103
|
+
transforms: ['name/kebab'],
|
|
47
104
|
buildPath,
|
|
105
|
+
excludes,
|
|
106
|
+
actions: ['fixCSSTokens'],
|
|
107
|
+
options: {
|
|
108
|
+
fileHeader: 'nlds-rhc-header',
|
|
109
|
+
outputReferences: true,
|
|
110
|
+
},
|
|
48
111
|
files: [
|
|
49
112
|
{
|
|
50
113
|
destination: 'root.css',
|
|
51
114
|
format: 'css/variables',
|
|
52
|
-
options: {
|
|
53
|
-
outputReferences: true,
|
|
54
|
-
},
|
|
55
115
|
},
|
|
56
116
|
{
|
|
57
117
|
destination: 'index.css',
|
|
58
118
|
format: 'css/variables',
|
|
59
119
|
options: {
|
|
60
120
|
selector: `.${themeName}`,
|
|
61
|
-
outputReferences: true,
|
|
62
121
|
},
|
|
63
122
|
},
|
|
64
123
|
{
|
|
65
124
|
destination: '_variables.scss',
|
|
66
125
|
format: 'scss/variables',
|
|
67
|
-
options: {
|
|
68
|
-
outputReferences: true,
|
|
69
|
-
},
|
|
70
126
|
},
|
|
71
127
|
],
|
|
72
128
|
},
|
|
@@ -76,14 +132,18 @@ const getPlatformsConfig = (buildPath, themeName) => {
|
|
|
76
132
|
// This will build the base tokens without the themes and without the overwrites
|
|
77
133
|
async function buildBaseTokens() {
|
|
78
134
|
const config = getPlatformsConfig('dist/', 'rhc-theme');
|
|
79
|
-
const StyleDictionaryBase = StyleDictionary
|
|
135
|
+
const StyleDictionaryBase = new StyleDictionary({
|
|
136
|
+
log: { verbosity: 'verbose' },
|
|
80
137
|
source: ['./src/**/base.tokens.json'],
|
|
138
|
+
preprocessors: ['tokens-studio'],
|
|
81
139
|
platforms: {
|
|
82
140
|
...config,
|
|
83
141
|
},
|
|
84
142
|
});
|
|
143
|
+
await StyleDictionaryBase.hasInitialized;
|
|
85
144
|
|
|
86
|
-
StyleDictionaryBase.
|
|
145
|
+
await StyleDictionaryBase.cleanAllPlatforms();
|
|
146
|
+
await StyleDictionaryBase.buildAllPlatforms();
|
|
87
147
|
}
|
|
88
148
|
|
|
89
149
|
// This will build the themes
|
|
@@ -93,7 +153,8 @@ async function buildThemes() {
|
|
|
93
153
|
|
|
94
154
|
// Process each theme separately
|
|
95
155
|
for (const [theme, themeData] of Object.entries(themes)) {
|
|
96
|
-
const
|
|
156
|
+
const themeName = normalizeThemeName(theme);
|
|
157
|
+
const themesDir = `./src/generated/${themeName}`;
|
|
97
158
|
|
|
98
159
|
// Create the theme directory if it doesn't exist
|
|
99
160
|
if (!existsSync(themesDir)) {
|
|
@@ -101,24 +162,29 @@ async function buildThemes() {
|
|
|
101
162
|
}
|
|
102
163
|
|
|
103
164
|
// Write individual theme tokens
|
|
104
|
-
await writeFile(
|
|
165
|
+
await writeFile(posix.join(themesDir, `tokens.json`), JSON.stringify(themeData.tokens, null, 2));
|
|
105
166
|
|
|
106
|
-
const config = getPlatformsConfig(`dist/${
|
|
167
|
+
const config = getPlatformsConfig(`dist/${themeName}/`, themeName);
|
|
107
168
|
// Create a separate Style Dictionary instance for each theme
|
|
108
|
-
const StyleDictionaryTheme = StyleDictionary
|
|
109
|
-
|
|
169
|
+
const StyleDictionaryTheme = new StyleDictionary({
|
|
170
|
+
log: { verbosity: 'verbose' },
|
|
171
|
+
source: [`./src/generated/${themeName}/tokens.json`],
|
|
172
|
+
preprocessors: ['tokens-studio'],
|
|
110
173
|
platforms: {
|
|
111
174
|
...config,
|
|
112
175
|
},
|
|
113
176
|
});
|
|
177
|
+
await StyleDictionaryTheme.hasInitialized;
|
|
114
178
|
|
|
115
179
|
// Build this specific theme
|
|
116
|
-
StyleDictionaryTheme.
|
|
180
|
+
await StyleDictionaryTheme.cleanAllPlatforms();
|
|
181
|
+
await StyleDictionaryTheme.buildAllPlatforms();
|
|
117
182
|
}
|
|
118
183
|
}
|
|
119
184
|
|
|
120
185
|
async function build() {
|
|
121
186
|
try {
|
|
187
|
+
removeUnitlessLineHeightTransform(); // This needs to happen before building anything
|
|
122
188
|
await buildBaseTokens();
|
|
123
189
|
await buildThemes();
|
|
124
190
|
} catch (error) {
|
package/cssFixers.mjs
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
2
|
+
|
|
3
|
+
// When using `outputReferences: true` in Style Dictionary (see `build.mjs`), any calculations/transforms are overwritten by the css-var-names.
|
|
4
|
+
// So you'll end up with invalid CSS like:
|
|
5
|
+
// `--my-var: var(--my-length) + 20px;` - see: https://github.com/style-dictionary/style-dictionary/issues/1055
|
|
6
|
+
// We will need to fix any invalid stuff from Tokens Studio (TS) here as a post-build step.
|
|
7
|
+
// This applies to both .css and .scss files.
|
|
8
|
+
|
|
9
|
+
const varRegex = /(?<prefix>^\s*--[^:]+:\s*)(?<value>[^;]+?)(?<suffix>\s*;)/gm;
|
|
10
|
+
|
|
11
|
+
export async function fixCSSFile(filePath) {
|
|
12
|
+
let content = await readFile(filePath, 'utf-8');
|
|
13
|
+
|
|
14
|
+
content = await fixRoundTo(content);
|
|
15
|
+
content = await fixExponentiation(content);
|
|
16
|
+
content = await fixCalc(content);
|
|
17
|
+
|
|
18
|
+
await writeFile(filePath, content);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// This will wrap any calculations in `calc()`.
|
|
22
|
+
export function fixCalc(content) {
|
|
23
|
+
const operatorRegex = /(?:\s\+\s|\s-\s|\/|\*)/;
|
|
24
|
+
|
|
25
|
+
return content.replace(varRegex, (match, prefix, value, suffix) => {
|
|
26
|
+
if (!value.match(operatorRegex)) {
|
|
27
|
+
return match;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return `${prefix}calc(${value})${suffix}`;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Exponentiation (^) is not supported in CSS, so we need to convert it to pow(base, exponent)
|
|
35
|
+
export function fixExponentiation(content) {
|
|
36
|
+
const exponentiationRegex =
|
|
37
|
+
/([0-9]*\.?[0-9]+(?:[a-z%]+)?|var\([^)]+\))\s*\^\s*([0-9]*\.?[0-9]+(?:[a-z%]+)?|var\([^)]+\))/g;
|
|
38
|
+
|
|
39
|
+
return content.replace(varRegex, (match, prefix, value, suffix) => {
|
|
40
|
+
if (!value.includes('^')) {
|
|
41
|
+
return match;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const fixedValue = value.replace(exponentiationRegex, (_match, base, exponent) => {
|
|
45
|
+
return `pow(${base}, ${exponent})`;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return `${prefix}${fixedValue}${suffix}`;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// This will strip out any roundTo() calls, as CSS doesn't support it.
|
|
53
|
+
// It does allow round(), but that needs a rounding interval, which is unknown at this point.
|
|
54
|
+
// See https://developer.mozilla.org/en-US/docs/Web/CSS/round
|
|
55
|
+
export function fixRoundTo(content) {
|
|
56
|
+
return content.replace(varRegex, (match, prefix, value, suffix) => {
|
|
57
|
+
if (!value.includes('roundTo(')) {
|
|
58
|
+
return match;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Handle nested parentheses by processing the string character by character
|
|
62
|
+
let fixedValue = value;
|
|
63
|
+
let result = '';
|
|
64
|
+
let i = 0;
|
|
65
|
+
|
|
66
|
+
while (i < fixedValue.length) {
|
|
67
|
+
if (fixedValue.slice(i, i + 8) === 'roundTo(') {
|
|
68
|
+
// Found roundTo(, now find the matching closing parenthesis
|
|
69
|
+
i += 8; // Skip "roundTo("
|
|
70
|
+
let parenCount = 1;
|
|
71
|
+
let start = i;
|
|
72
|
+
|
|
73
|
+
while (i < fixedValue.length && parenCount > 0) {
|
|
74
|
+
if (fixedValue[i] === '(') parenCount++;
|
|
75
|
+
if (fixedValue[i] === ')') parenCount--;
|
|
76
|
+
i++;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Extract the content between parentheses and add to result
|
|
80
|
+
result += fixedValue.slice(start, i - 1);
|
|
81
|
+
} else {
|
|
82
|
+
result += fixedValue[i];
|
|
83
|
+
i++;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return `${prefix}${result}${suffix}`;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { fixCalc, fixExponentiation, fixRoundTo } from './cssFixers.mjs';
|
|
3
|
+
|
|
4
|
+
describe('css fixers', () => {
|
|
5
|
+
describe('fixCalc', () => {
|
|
6
|
+
test('should wrap adding calculations in calc()', async () => {
|
|
7
|
+
const input = '--some-var: 100px + 50%;';
|
|
8
|
+
const output = '--some-var: calc(100px + 50%);';
|
|
9
|
+
expect(fixCalc(input)).toBe(output);
|
|
10
|
+
});
|
|
11
|
+
test('should wrap calculations with variables in calc()', async () => {
|
|
12
|
+
const input = '--some-var: 100px + var(--some-other-var);';
|
|
13
|
+
const output = '--some-var: calc(100px + var(--some-other-var));';
|
|
14
|
+
expect(fixCalc(input)).toBe(output);
|
|
15
|
+
});
|
|
16
|
+
test('should wrap calculations with variables in calc()', async () => {
|
|
17
|
+
const input = '--some-var: var(--some-other-var) + 100px;';
|
|
18
|
+
const output = '--some-var: calc(var(--some-other-var) + 100px);';
|
|
19
|
+
expect(fixCalc(input)).toBe(output);
|
|
20
|
+
});
|
|
21
|
+
test('should wrap subtraction calculations in calc()', async () => {
|
|
22
|
+
const input = '--some-var: 100px - 50px;';
|
|
23
|
+
const output = '--some-var: calc(100px - 50px);';
|
|
24
|
+
expect(fixCalc(input)).toBe(output);
|
|
25
|
+
});
|
|
26
|
+
test('should wrap multiplication calculations in calc()', async () => {
|
|
27
|
+
const input = '--some-var: 10px * 2;';
|
|
28
|
+
const output = '--some-var: calc(10px * 2);';
|
|
29
|
+
expect(fixCalc(input)).toBe(output);
|
|
30
|
+
});
|
|
31
|
+
test('should wrap division calculations in calc()', async () => {
|
|
32
|
+
const input = '--some-var: 100px / 2;';
|
|
33
|
+
const output = '--some-var: calc(100px / 2);';
|
|
34
|
+
expect(fixCalc(input)).toBe(output);
|
|
35
|
+
});
|
|
36
|
+
test('should wrap mixed calculations in calc()', async () => {
|
|
37
|
+
const input = '--some-var: var(--base) * 2 - 10px;';
|
|
38
|
+
const output = '--some-var: calc(var(--base) * 2 - 10px);';
|
|
39
|
+
expect(fixCalc(input)).toBe(output);
|
|
40
|
+
});
|
|
41
|
+
test('should not wrap single variables in calc()', async () => {
|
|
42
|
+
const input = '--some-var: var(--other-var);';
|
|
43
|
+
const output = '--some-var: var(--other-var);';
|
|
44
|
+
expect(fixCalc(input)).toBe(output);
|
|
45
|
+
});
|
|
46
|
+
test('should not wrap simple values in calc()', async () => {
|
|
47
|
+
const input = '--some-var: 10px;';
|
|
48
|
+
const output = '--some-var: 10px;';
|
|
49
|
+
expect(fixCalc(input)).toBe(output);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('fixExponentiation', () => {
|
|
54
|
+
test('should convert ^ to pow()', async () => {
|
|
55
|
+
const input = '--some-var: 2^3;';
|
|
56
|
+
const output = '--some-var: pow(2, 3);';
|
|
57
|
+
expect(fixExponentiation(input)).toBe(output);
|
|
58
|
+
});
|
|
59
|
+
test('should convert ^ to pow() with variable as base', async () => {
|
|
60
|
+
const input = '--some-var: var(--base)^3;';
|
|
61
|
+
const output = '--some-var: pow(var(--base), 3);';
|
|
62
|
+
expect(fixExponentiation(input)).toBe(output);
|
|
63
|
+
});
|
|
64
|
+
test('should convert ^ to pow() with variable as exponent', async () => {
|
|
65
|
+
const input = '--some-var: 2^var(--exponent);';
|
|
66
|
+
const output = '--some-var: pow(2, var(--exponent));';
|
|
67
|
+
expect(fixExponentiation(input)).toBe(output);
|
|
68
|
+
});
|
|
69
|
+
test('should convert ^ to pow() with variables as both base and exponent', async () => {
|
|
70
|
+
const input = '--some-var: var(--base)^var(--exponent);';
|
|
71
|
+
const output = '--some-var: pow(var(--base), var(--exponent));';
|
|
72
|
+
expect(fixExponentiation(input)).toBe(output);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('fixRoundTo', () => {
|
|
77
|
+
test('should remove roundTo()', async () => {
|
|
78
|
+
const input = '--some-var: roundTo(10px);';
|
|
79
|
+
const output = '--some-var: 10px;';
|
|
80
|
+
expect(fixRoundTo(input)).toBe(output);
|
|
81
|
+
});
|
|
82
|
+
test('should remove roundTo() with variable', async () => {
|
|
83
|
+
const input = '--some-var: roundTo(var(--base-size));';
|
|
84
|
+
const output = '--some-var: var(--base-size);';
|
|
85
|
+
expect(fixRoundTo(input)).toBe(output);
|
|
86
|
+
});
|
|
87
|
+
test('should remove roundTo() with calc function', async () => {
|
|
88
|
+
const input = '--some-var: roundTo(calc(10px + 5px));';
|
|
89
|
+
const output = '--some-var: calc(10px + 5px);';
|
|
90
|
+
expect(fixRoundTo(input)).toBe(output);
|
|
91
|
+
});
|
|
92
|
+
test('should remove roundTo() with calc function containing variables', async () => {
|
|
93
|
+
const input = '--some-var: roundTo(calc(var(--base) * 2));';
|
|
94
|
+
const output = '--some-var: calc(var(--base) * 2);';
|
|
95
|
+
expect(fixRoundTo(input)).toBe(output);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|