@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.
Files changed (131) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +48 -3
  3. package/build.mjs +86 -20
  4. package/cssFixers.mjs +89 -0
  5. package/cssFixers.spec.mjs +98 -0
  6. package/dist/_variables.scss +1359 -1381
  7. package/dist/index.css +1359 -1381
  8. package/dist/index.d.ts +1437 -1396
  9. package/dist/index.js +1292 -1275
  10. package/dist/index.json +1208 -1230
  11. package/dist/index.tokens.json +1703 -1746
  12. package/dist/kern-lintblauw/_variables.scss +1376 -0
  13. package/dist/kern-lintblauw/index.css +1379 -0
  14. package/dist/kern-lintblauw/index.d.ts +1440 -0
  15. package/dist/{wetgevend → kern-lintblauw}/index.js +1334 -1238
  16. package/dist/{wetgevend → kern-lintblauw}/index.json +1294 -1237
  17. package/dist/{wetgevend → kern-lintblauw}/index.tokens.json +1894 -1779
  18. package/dist/kern-lintblauw/root.css +1379 -0
  19. package/dist/kern-lintblauw/tokens.d.ts +2245 -0
  20. package/dist/kern-lintblauw/tokens.js +31032 -0
  21. package/dist/root.css +1359 -1381
  22. package/dist/tokens.d.ts +2205 -2247
  23. package/dist/tokens.js +29984 -32173
  24. package/dist/uitvoerend-groen/_variables.scss +1355 -1298
  25. package/dist/uitvoerend-groen/index.css +1355 -1298
  26. package/dist/uitvoerend-groen/index.d.ts +1437 -1317
  27. package/dist/uitvoerend-groen/index.js +1307 -1220
  28. package/dist/uitvoerend-groen/index.json +1280 -1223
  29. package/dist/uitvoerend-groen/index.tokens.json +1918 -1803
  30. package/dist/uitvoerend-groen/root.css +1355 -1298
  31. package/dist/uitvoerend-groen/tokens.d.ts +2209 -2100
  32. package/dist/uitvoerend-groen/tokens.js +30314 -30632
  33. package/dist/uitvoerend-hemelblauw/_variables.scss +1355 -1298
  34. package/dist/uitvoerend-hemelblauw/index.css +1355 -1298
  35. package/dist/uitvoerend-hemelblauw/index.d.ts +1437 -1317
  36. package/dist/uitvoerend-hemelblauw/index.js +1307 -1220
  37. package/dist/uitvoerend-hemelblauw/index.json +1280 -1223
  38. package/dist/uitvoerend-hemelblauw/index.tokens.json +1921 -1806
  39. package/dist/uitvoerend-hemelblauw/root.css +1355 -1298
  40. package/dist/uitvoerend-hemelblauw/tokens.d.ts +2209 -2100
  41. package/dist/uitvoerend-hemelblauw/tokens.js +30314 -30632
  42. package/dist/uitvoerend-lintblauw/_variables.scss +1376 -0
  43. package/dist/uitvoerend-lintblauw/index.css +1379 -0
  44. package/dist/uitvoerend-lintblauw/index.d.ts +1440 -0
  45. package/dist/{koop → uitvoerend-lintblauw}/index.js +1325 -1238
  46. package/dist/{koop → uitvoerend-lintblauw}/index.json +1295 -1238
  47. package/dist/{koop → uitvoerend-lintblauw}/index.tokens.json +1894 -1779
  48. package/dist/uitvoerend-lintblauw/root.css +1379 -0
  49. package/dist/uitvoerend-lintblauw/tokens.d.ts +2245 -0
  50. package/dist/uitvoerend-lintblauw/tokens.js +31032 -0
  51. package/dist/uitvoerend-oranje/_variables.scss +1355 -1298
  52. package/dist/uitvoerend-oranje/index.css +1355 -1298
  53. package/dist/uitvoerend-oranje/index.d.ts +1437 -1317
  54. package/dist/uitvoerend-oranje/index.js +1336 -1249
  55. package/dist/uitvoerend-oranje/index.json +1290 -1233
  56. package/dist/uitvoerend-oranje/index.tokens.json +1922 -1807
  57. package/dist/uitvoerend-oranje/root.css +1355 -1298
  58. package/dist/uitvoerend-oranje/tokens.d.ts +2209 -2100
  59. package/dist/uitvoerend-oranje/tokens.js +30314 -30632
  60. package/dist/uitvoerend-paars/_variables.scss +1355 -1298
  61. package/dist/uitvoerend-paars/index.css +1355 -1298
  62. package/dist/uitvoerend-paars/index.d.ts +1437 -1317
  63. package/dist/uitvoerend-paars/index.js +1307 -1220
  64. package/dist/uitvoerend-paars/index.json +1280 -1223
  65. package/dist/uitvoerend-paars/index.tokens.json +1931 -1816
  66. package/dist/uitvoerend-paars/root.css +1355 -1298
  67. package/dist/uitvoerend-paars/tokens.d.ts +2209 -2100
  68. package/dist/uitvoerend-paars/tokens.js +30314 -30632
  69. package/dist/uitvoerend-robijnrood/_variables.scss +1376 -0
  70. package/dist/uitvoerend-robijnrood/index.css +1379 -0
  71. package/dist/uitvoerend-robijnrood/index.d.ts +1440 -0
  72. package/dist/uitvoerend-robijnrood/index.js +1407 -0
  73. package/dist/{uitvoerend-mintgroen → uitvoerend-robijnrood}/index.json +1278 -1221
  74. package/dist/{uitvoerend-mintgroen → uitvoerend-robijnrood}/index.tokens.json +1955 -1840
  75. package/dist/uitvoerend-robijnrood/root.css +1379 -0
  76. package/dist/uitvoerend-robijnrood/tokens.d.ts +2245 -0
  77. package/dist/uitvoerend-robijnrood/tokens.js +31032 -0
  78. package/figma/figma.tokens.json +4613 -6238
  79. package/package.json +6 -4
  80. package/src/generated/base.tokens.json +5872 -5852
  81. package/src/generated/kern-lintblauw/tokens.json +6760 -0
  82. package/src/generated/themes.json +41479 -50820
  83. package/src/generated/uitvoerend-groen/tokens.json +5920 -5453
  84. package/src/generated/uitvoerend-hemelblauw/tokens.json +5920 -5453
  85. package/src/generated/uitvoerend-lintblauw/tokens.json +6772 -0
  86. package/src/generated/uitvoerend-oranje/tokens.json +6136 -5485
  87. package/src/generated/uitvoerend-paars/tokens.json +5920 -5453
  88. package/src/generated/uitvoerend-robijnrood/tokens.json +6812 -0
  89. package/token-transformer.mjs +5 -43
  90. package/dist/koop/_variables.scss +0 -1319
  91. package/dist/koop/index.css +0 -1322
  92. package/dist/koop/index.d.ts +0 -1320
  93. package/dist/koop/root.css +0 -1322
  94. package/dist/koop/tokens.d.ts +0 -2136
  95. package/dist/koop/tokens.js +0 -31350
  96. package/dist/uitvoerend-mintgroen/_variables.scss +0 -1319
  97. package/dist/uitvoerend-mintgroen/index.css +0 -1322
  98. package/dist/uitvoerend-mintgroen/index.d.ts +0 -1320
  99. package/dist/uitvoerend-mintgroen/index.js +0 -1320
  100. package/dist/uitvoerend-mintgroen/root.css +0 -1322
  101. package/dist/uitvoerend-mintgroen/tokens.d.ts +0 -2136
  102. package/dist/uitvoerend-mintgroen/tokens.js +0 -31350
  103. package/dist/uitvoerend-violet/_variables.scss +0 -1319
  104. package/dist/uitvoerend-violet/index.css +0 -1322
  105. package/dist/uitvoerend-violet/index.d.ts +0 -1320
  106. package/dist/uitvoerend-violet/index.js +0 -1320
  107. package/dist/uitvoerend-violet/index.json +0 -1317
  108. package/dist/uitvoerend-violet/index.tokens.json +0 -2113
  109. package/dist/uitvoerend-violet/root.css +0 -1322
  110. package/dist/uitvoerend-violet/tokens.d.ts +0 -2136
  111. package/dist/uitvoerend-violet/tokens.js +0 -31350
  112. package/dist/uitvoerend-violet-oud/_variables.scss +0 -1320
  113. package/dist/uitvoerend-violet-oud/index.css +0 -1323
  114. package/dist/uitvoerend-violet-oud/index.d.ts +0 -1321
  115. package/dist/uitvoerend-violet-oud/index.js +0 -1321
  116. package/dist/uitvoerend-violet-oud/index.json +0 -1318
  117. package/dist/uitvoerend-violet-oud/index.tokens.json +0 -2114
  118. package/dist/uitvoerend-violet-oud/root.css +0 -1323
  119. package/dist/uitvoerend-violet-oud/tokens.d.ts +0 -2137
  120. package/dist/uitvoerend-violet-oud/tokens.js +0 -31371
  121. package/dist/wetgevend/_variables.scss +0 -1319
  122. package/dist/wetgevend/index.css +0 -1322
  123. package/dist/wetgevend/index.d.ts +0 -1320
  124. package/dist/wetgevend/root.css +0 -1322
  125. package/dist/wetgevend/tokens.d.ts +0 -2136
  126. package/dist/wetgevend/tokens.js +0 -31350
  127. package/src/generated/koop/tokens.json +0 -6345
  128. package/src/generated/uitvoerend-mintgroen/tokens.json +0 -6345
  129. package/src/generated/uitvoerend-violet/tokens.json +0 -6345
  130. package/src/generated/uitvoerend-violet-oud/tokens.json +0 -6349
  131. package/src/generated/wetgevend/tokens.json +0 -6345
@@ -1,50 +1,12 @@
1
1
  import { existsSync, mkdirSync } from 'fs';
2
2
  import { readFile, writeFile } from 'node:fs/promises';
3
3
 
4
- import { transformTokens } from 'token-transformer';
5
-
6
- // the commented options and their values are default values from the token-transformer package
7
- const transformerOptions = {
8
- // expandTypography: true,
9
- // expandShadow: true,
10
- // expandComposition: true,
11
- // expandBorder: true,
12
- // preserveRawValue: false,
13
- // throwErrorWhenNotResolved: true,
14
- // Tried to set this to false, it worked in principle but there were breaking in the styles especially with spacing. I think it's better to keep it true
15
- // resolveReferences: true,
16
- };
17
-
18
- const excludes = [
19
- 'components/avatar',
20
- 'components/form-field-option-label',
21
- 'components/modal-dialog',
22
- 'components/pagination/todo',
23
- 'components/status-badge',
24
- 'components/summary-list',
25
- 'components/task-list',
26
- 'components/toolbar-button',
27
- ];
28
-
29
4
  // Split tokens into separate files
30
5
  async function transformAndSplitTokens() {
31
6
  // Read the raw JSON file directly
32
7
  const json = await readFile('./figma/figma.tokens.json', 'utf-8');
33
8
  const tokens = JSON.parse(json);
34
9
 
35
- // Extract base tokens (excluding $themes and overwrites/)
36
- // Not sure if other designers might not be able to modify the themes created by paid plugin so getting the base tokens is a good fallback
37
- const baseTokens = {};
38
- Object.entries(tokens).forEach(([key, value]) => {
39
- if (!key.startsWith('$') && !key.startsWith('overwrites/')) {
40
- baseTokens[key] = value;
41
- }
42
- });
43
-
44
- // Transform base tokens
45
- let resolved = transformTokens(baseTokens, [], excludes, transformerOptions);
46
- delete resolved['tokenSetOrder'];
47
-
48
10
  // Process themes to add the enabled components
49
11
  const themes = tokens.$themes || [];
50
12
  const processedThemes = {};
@@ -60,12 +22,9 @@ async function transformAndSplitTokens() {
60
22
  }
61
23
  });
62
24
 
63
- // Transform the theme tokens
64
- const transformedThemeTokens = transformTokens(themeTokens, [], excludes, transformerOptions);
65
-
66
25
  processedThemes[theme.name] = {
67
26
  id: theme.id,
68
- tokens: transformedThemeTokens,
27
+ tokens: themeTokens,
69
28
  group: theme.group,
70
29
  };
71
30
  });
@@ -76,7 +35,10 @@ async function transformAndSplitTokens() {
76
35
  }
77
36
 
78
37
  // Write files
79
- await writeFile('./src/generated/base.tokens.json', JSON.stringify(resolved, null, 2));
38
+ await writeFile(
39
+ './src/generated/base.tokens.json',
40
+ JSON.stringify(processedThemes['Kern - Lintblauw'].tokens, null, 2),
41
+ );
80
42
  await writeFile('./src/generated/themes.json', JSON.stringify(processedThemes, null, 2));
81
43
  }
82
44