@digdir/designsystemet 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/bin/config.js +20 -19
  2. package/dist/bin/designsystemet.js +421 -359
  3. package/dist/src/colors/index.d.ts +2 -2
  4. package/dist/src/colors/index.d.ts.map +1 -1
  5. package/dist/src/colors/index.js +143 -143
  6. package/dist/src/colors/theme.d.ts +1 -2
  7. package/dist/src/colors/theme.d.ts.map +1 -1
  8. package/dist/src/config.d.ts.map +1 -1
  9. package/dist/src/config.js +20 -19
  10. package/dist/src/index.js +394 -394
  11. package/dist/src/scripts/createJsonSchema.js +19 -19
  12. package/dist/src/scripts/update-template.d.ts.map +1 -1
  13. package/dist/src/tokens/build.d.ts.map +1 -1
  14. package/dist/src/tokens/build.js +89 -28
  15. package/dist/src/tokens/create/generators/$designsystemet.js +12 -13
  16. package/dist/src/tokens/create/generators/color.js +21 -21
  17. package/dist/src/tokens/create/write.js +13 -14
  18. package/dist/src/tokens/create.d.ts +1 -0
  19. package/dist/src/tokens/create.d.ts.map +1 -1
  20. package/dist/src/tokens/create.js +22 -21
  21. package/dist/src/tokens/format.d.ts.map +1 -1
  22. package/dist/src/tokens/format.js +883 -884
  23. package/dist/src/tokens/index.d.ts +2 -2
  24. package/dist/src/tokens/index.d.ts.map +1 -1
  25. package/dist/src/tokens/index.js +271 -271
  26. package/dist/src/tokens/process/configs/color.d.ts.map +1 -1
  27. package/dist/src/tokens/process/configs/color.js +5 -5
  28. package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -1
  29. package/dist/src/tokens/process/configs/semantic.js +5 -5
  30. package/dist/src/tokens/process/configs/storefront.d.ts.map +1 -1
  31. package/dist/src/tokens/process/configs/storefront.js +1 -1
  32. package/dist/src/tokens/process/configs/typography.d.ts.map +1 -1
  33. package/dist/src/tokens/process/configs/typography.js +5 -5
  34. package/dist/src/tokens/process/configs.d.ts.map +1 -1
  35. package/dist/src/tokens/process/configs.js +5 -5
  36. package/dist/src/tokens/process/formats/css/color.js +2 -2
  37. package/dist/src/tokens/process/formats/css/semantic.js +2 -2
  38. package/dist/src/tokens/process/formats/css/typography.js +1 -1
  39. package/dist/src/tokens/process/formats/css.js +5 -5
  40. package/dist/src/tokens/process/formats/js-tokens.js +1 -1
  41. package/dist/src/tokens/process/output/tailwind.d.ts +3 -0
  42. package/dist/src/tokens/process/output/tailwind.d.ts.map +1 -0
  43. package/dist/src/tokens/process/output/tailwind.js +59 -0
  44. package/dist/src/tokens/process/{theme.d.ts → output/theme.d.ts} +2 -2
  45. package/dist/src/tokens/process/output/theme.d.ts.map +1 -0
  46. package/dist/src/tokens/process/{theme.js → output/theme.js} +15 -16
  47. package/dist/src/tokens/process/platform.d.ts +3 -1
  48. package/dist/src/tokens/process/platform.d.ts.map +1 -1
  49. package/dist/src/tokens/process/platform.js +5 -5
  50. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +5 -5
  51. package/dist/src/tokens/types.d.ts +1 -1
  52. package/dist/src/tokens/types.d.ts.map +1 -1
  53. package/dist/src/tokens/utils.d.ts.map +1 -1
  54. package/package.json +12 -13
  55. package/dist/src/tokens/process/theme.d.ts.map +0 -1
@@ -6,26 +6,8 @@ import { z as z2 } from "zod/v4";
6
6
  // src/config.ts
7
7
  import chalk from "chalk";
8
8
  import * as R7 from "ramda";
9
- import { fromError } from "zod-validation-error";
10
9
  import { z } from "zod/v4";
11
-
12
- // src/colors/utils.ts
13
- import chroma from "chroma-js";
14
- import Colorjs from "colorjs.io";
15
- import { Hsluv } from "hsluv";
16
- var convertToHex = (color) => {
17
- if (!color) {
18
- return "#000000";
19
- }
20
- if (/^#[0-9A-Fa-f]{6}$/.test(color)) {
21
- return color;
22
- }
23
- return chroma(color).hex();
24
- };
25
-
26
- // src/colors/theme.ts
27
- import chroma2 from "chroma-js";
28
- import * as R2 from "ramda";
10
+ import { fromError } from "zod-validation-error";
29
11
 
30
12
  // src/colors/colorMetadata.ts
31
13
  import * as R from "ramda";
@@ -273,6 +255,24 @@ var colorMetadata = {
273
255
  };
274
256
  var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
275
257
 
258
+ // src/colors/theme.ts
259
+ import chroma2 from "chroma-js";
260
+ import * as R2 from "ramda";
261
+
262
+ // src/colors/utils.ts
263
+ import chroma from "chroma-js";
264
+ import Colorjs from "colorjs.io";
265
+ import { Hsluv } from "hsluv";
266
+ var convertToHex = (color) => {
267
+ if (!color) {
268
+ return "#000000";
269
+ }
270
+ if (/^#[0-9A-Fa-f]{6}$/.test(color)) {
271
+ return color;
272
+ }
273
+ return chroma(color).hex();
274
+ };
275
+
276
276
  // src/colors/theme.ts
277
277
  var RESERVED_COLORS = [
278
278
  "neutral",
@@ -1 +1 @@
1
- {"version":3,"file":"update-template.d.ts","sourceRoot":"","sources":["../../../src/scripts/update-template.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,eAAe,qBA+E3B,CAAC"}
1
+ {"version":3,"file":"update-template.d.ts","sourceRoot":"","sources":["../../../src/scripts/update-template.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,eAAe,qBA+E3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/tokens/build.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,uBAAuB,CAAC;AAiB3E,eAAO,MAAM,WAAW,GAAU,SAAS,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC,2DA6ChF,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/tokens/build.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,uBAAuB,CAAC;AAiB3E,eAAO,MAAM,WAAW,GAAU,SAAS,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC,2DAqDhF,CAAC"}
@@ -43,14 +43,71 @@ var readFile = async (path2, dry, allowFileNotFound) => {
43
43
  }
44
44
  };
45
45
 
46
- // src/tokens/process/theme.ts
47
- import * as R from "ramda";
46
+ // src/tokens/process/output/tailwind.ts
47
+ var createTailwindCSSFiles = (cssFiles) => {
48
+ console.log("\n\u{1F371} Creating Tailwind Config");
49
+ return cssFiles.map((file) => {
50
+ if (file.destination) {
51
+ const tailwindConfig = generateTailwind(file.output);
52
+ const tailwindFile = {
53
+ destination: file.destination.replace(".css", ".tailwind.css"),
54
+ output: tailwindConfig
55
+ };
56
+ return tailwindFile;
57
+ }
58
+ return void 0;
59
+ }).filter((item) => item !== void 0);
60
+ };
61
+ var generateTailwind = (css) => {
62
+ const tailwind = ["--font-sans: var(--ds-font-family)"];
63
+ const tokens = Array.from(new Set(css.match(/--ds-[^:)]+/g)), (m) => m).sort(
64
+ (a, b) => a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" })
65
+ );
66
+ for (const token of tokens) {
67
+ if (token.startsWith("--ds-color-") && !token.startsWith("--ds-color-focus")) {
68
+ tailwind.push(`--color-${token.replace("--ds-color-", "")}: var(${token})`);
69
+ } else if (token.startsWith("--ds-font-weight-")) {
70
+ tailwind.push(`--font-weight-${token.replace("--ds-font-weight-", "")}: var(${token})`);
71
+ } else if (token.match(/--ds-border-radius-(sm|md|lg|xl)/)) {
72
+ tailwind.push(`--radius-${token.replace("--ds-border-radius-", "")}: var(${token})`);
73
+ } else if (token.match(/--ds-body-(sm|mg|lg)-body-font-size/)) {
74
+ tailwind.push(`--text-${token.replace("--ds-body-", "").replace("-font-size", "")}: var(${token})`);
75
+ } else if (token.match(/^--ds-size-\d+$/)) {
76
+ tailwind.push(`--spacing-${token.replace("--ds-size-", "")}: var(${token})`);
77
+ }
78
+ }
79
+ const dynamicColors = `[data-color] {
80
+ --color-background-default: var(--ds-color-background-default);
81
+ --color-background-tinted: var(--ds-color-background-tinted);
82
+ --color-surface-default: var(--ds-color-surface-default);
83
+ --color-surface-tinted: var(--ds-color-surface-tinted);
84
+ --color-surface-hover: var(--ds-color-surface-hover);
85
+ --color-surface-active: var(--ds-color-surface-active);
86
+ --color-border-subtle: var(--ds-color-border-subtle);
87
+ --color-border-default: var(--ds-color-border-default);
88
+ --color-border-strong: var(--ds-color-border-strong);
89
+ --color-text-subtle: var(--ds-color-text-subtle);
90
+ --color-text-default: var(--ds-color-text-default);
91
+ --color-base-default: var(--ds-color-base-default);
92
+ --color-base-hover: var(--ds-color-base-hover);
93
+ --color-base-active: var(--ds-color-base-active);
94
+ --color-base-contrast-subtle: var(--ds-color-base-contrast-subtle);
95
+ --color-base-contrast-default: var(--ds-color-base-contrast-default);
96
+ }`;
97
+ return `@theme {${tailwind.map((str) => `
98
+ ${str};`).join("")}
99
+ }
100
+ ${dynamicColors}`;
101
+ };
102
+
103
+ // src/tokens/process/output/theme.ts
48
104
  import chalk2 from "chalk";
105
+ import * as R from "ramda";
49
106
 
50
107
  // package.json
51
108
  var package_default = {
52
109
  name: "@digdir/designsystemet",
53
- version: "1.0.8",
110
+ version: "1.1.0",
54
111
  description: "CLI for Designsystemet",
55
112
  author: "Designsystemet team",
56
113
  engines: {
@@ -60,7 +117,7 @@ var package_default = {
60
117
  type: "git",
61
118
  url: "git+https://github.com/digdir/designsystemet.git"
62
119
  },
63
- homepage: "https://github.com/digdir/designsystemet/tree/main/scripts/cli",
120
+ homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
64
121
  license: "MIT",
65
122
  type: "module",
66
123
  main: "./dist/src/index.js",
@@ -85,8 +142,6 @@ var package_default = {
85
142
  },
86
143
  scripts: {
87
144
  designsystemet: "tsx ./bin/designsystemet.ts",
88
- "build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
89
- "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
90
145
  build: "tsup && pnpm build:types && pnpm build:json-schema",
91
146
  "build:types": "tsc --emitDeclarationOnly --declaration",
92
147
  "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
@@ -94,17 +149,20 @@ var package_default = {
94
149
  "test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
95
150
  "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
96
151
  "test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
152
+ "test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
97
153
  "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
154
+ "test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
98
155
  "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
99
156
  "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
100
157
  test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
158
+ "digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
101
159
  "digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
102
160
  "update:template": "tsx ./src/scripts/update-template.ts",
103
- "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
161
+ "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
104
162
  verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
105
163
  },
106
164
  dependencies: {
107
- "@commander-js/extra-typings": "^13.1.0",
165
+ "@commander-js/extra-typings": "^14.0.0",
108
166
  "@tokens-studio/sd-transforms": "1.3.0",
109
167
  "apca-w3": "^0.1.9",
110
168
  chalk: "^5.4.1",
@@ -115,11 +173,11 @@ var package_default = {
115
173
  "fast-glob": "^3.3.3",
116
174
  hsluv: "^1.0.1",
117
175
  "object-hash": "^3.0.0",
118
- postcss: "^8.5.3",
176
+ postcss: "^8.5.5",
119
177
  ramda: "^0.30.1",
120
178
  "style-dictionary": "^4.4.0",
121
- zod: "^3.25.30",
122
- "zod-validation-error": "^3.4.1"
179
+ zod: "^3.25.64",
180
+ "zod-validation-error": "^3.5.0"
123
181
  },
124
182
  devDependencies: {
125
183
  "@tokens-studio/types": "0.5.2",
@@ -127,20 +185,18 @@ var package_default = {
127
185
  "@types/chroma-js": "^3.1.1",
128
186
  "@types/fs-extra": "^11.0.4",
129
187
  "@types/glob": "^8.1.0",
130
- "@types/jscodeshift": "^0.12.0",
131
- "@types/node": "^22.15.21",
188
+ "@types/node": "^22.15.31",
132
189
  "@types/object-hash": "^3.0.6",
133
190
  "@types/ramda": "^0.30.2",
134
191
  "fs-extra": "^11.3.0",
135
- "ts-toolbelt": "^9.6.0",
136
192
  tslib: "^2.8.1",
137
193
  tsup: "^8.5.0",
138
- tsx: "^4.19.4",
194
+ tsx: "^4.20.3",
139
195
  typescript: "^5.8.3"
140
196
  }
141
197
  };
142
198
 
143
- // src/tokens/process/theme.ts
199
+ // src/tokens/process/output/theme.ts
144
200
  var defaultFileHeader = `build: v${package_default.version}`;
145
201
  var createThemeCSSFiles = ({
146
202
  processedBuilds,
@@ -309,7 +365,7 @@ var prefersColorScheme = (colorScheme2, content) => `
309
365
  `;
310
366
  var colorScheme = {
311
367
  name: "ds/css-colorscheme",
312
- format: async ({ dictionary, file, options, platform }) => {
368
+ format: async ({ dictionary, options, platform }) => {
313
369
  const { allTokens } = dictionary;
314
370
  const { outputReferences, usesDtcg } = options;
315
371
  const { selector, colorScheme: colorScheme2, layer } = platform;
@@ -351,7 +407,7 @@ ${selector} ${content} ${autoSelectorContent}
351
407
  };
352
408
  var colorCategory = {
353
409
  name: "ds/css-colorcategory",
354
- format: async ({ dictionary, file, options, platform }) => {
410
+ format: async ({ dictionary, options, platform }) => {
355
411
  const { outputReferences, usesDtcg } = options;
356
412
  const { selector, layer } = platform;
357
413
  const format = R3.compose(
@@ -394,7 +450,7 @@ var isInlineTokens = R4.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
394
450
  var overrideSizingFormula = (format, token) => {
395
451
  const [name, value] = format(token).split(":");
396
452
  const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
397
- const round = `round(down, ${calc}, 0.0625rem)`;
453
+ const round = `round(down, ${calc}, 1px)`;
398
454
  return {
399
455
  name,
400
456
  round,
@@ -422,7 +478,7 @@ ${round.join("\n")}
422
478
  };
423
479
  var semantic = {
424
480
  name: "ds/css-semantic",
425
- format: async ({ dictionary, file, options, platform }) => {
481
+ format: async ({ dictionary, options, platform }) => {
426
482
  const { outputReferences, usesDtcg } = options;
427
483
  const { selector, layer } = platform;
428
484
  const format = createPropertyFormatter2({
@@ -460,7 +516,7 @@ var typographyFontFamilyPredicate = R5.allPass([
460
516
  ]);
461
517
  var typography = {
462
518
  name: "ds/css-typography",
463
- format: async ({ dictionary, file, options, platform }) => {
519
+ format: async ({ dictionary, options, platform }) => {
464
520
  const { outputReferences, usesDtcg } = options;
465
521
  const { selector, layer } = platform;
466
522
  const format = createPropertyFormatter3({
@@ -1349,7 +1405,7 @@ var buildTokens = async (options) => {
1349
1405
  try {
1350
1406
  const $designsystemetContent = await readFile(`${tokensDir}/$designsystemet.json`);
1351
1407
  $designsystemet = JSON.parse($designsystemetContent);
1352
- } catch (error) {
1408
+ } catch (_error) {
1353
1409
  }
1354
1410
  console.log(`
1355
1411
  \u{1F3D7}\uFE0F Start building tokens in ${chalk5.green(tokensDir)}`);
@@ -1360,17 +1416,22 @@ var buildTokens = async (options) => {
1360
1416
  type: "build",
1361
1417
  $themes
1362
1418
  });
1363
- console.log(`
1364
- \u{1F4BE} Writing build to ${chalk5.green(outDir)}`);
1365
- for (const { formatted } of processedBuilds.types) {
1366
- await write(formatted, outDir, options.dry);
1367
- }
1368
1419
  const fileHeader2 = R14.join("")([
1369
1420
  defaultFileHeader,
1370
1421
  $designsystemet ? `
1371
1422
  design-tokens: v${$designsystemet.version}` : ""
1372
1423
  ]);
1373
- await write(createThemeCSSFiles({ processedBuilds, fileHeader: fileHeader2 }), outDir, options.dry);
1424
+ let cssFiles = createThemeCSSFiles({ processedBuilds, fileHeader: fileHeader2 });
1425
+ if (options.tailwind) {
1426
+ const tailwindFiles = createTailwindCSSFiles(cssFiles);
1427
+ cssFiles = cssFiles.concat(tailwindFiles.filter(Boolean));
1428
+ }
1429
+ console.log(`
1430
+ \u{1F4BE} Writing build to ${chalk5.green(outDir)}`);
1431
+ for (const { formatted } of processedBuilds.types) {
1432
+ await write(formatted, outDir, options.dry);
1433
+ }
1434
+ await write(cssFiles, outDir, options.dry);
1374
1435
  console.log(`
1375
1436
  \u2705 Finished building tokens!`);
1376
1437
  return processedBuilds;
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@digdir/designsystemet",
4
- version: "1.0.8",
4
+ version: "1.1.0",
5
5
  description: "CLI for Designsystemet",
6
6
  author: "Designsystemet team",
7
7
  engines: {
@@ -11,7 +11,7 @@ var package_default = {
11
11
  type: "git",
12
12
  url: "git+https://github.com/digdir/designsystemet.git"
13
13
  },
14
- homepage: "https://github.com/digdir/designsystemet/tree/main/scripts/cli",
14
+ homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
15
15
  license: "MIT",
16
16
  type: "module",
17
17
  main: "./dist/src/index.js",
@@ -36,8 +36,6 @@ var package_default = {
36
36
  },
37
37
  scripts: {
38
38
  designsystemet: "tsx ./bin/designsystemet.ts",
39
- "build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
40
- "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
41
39
  build: "tsup && pnpm build:types && pnpm build:json-schema",
42
40
  "build:types": "tsc --emitDeclarationOnly --declaration",
43
41
  "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
@@ -45,17 +43,20 @@ var package_default = {
45
43
  "test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
46
44
  "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
47
45
  "test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
46
+ "test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
48
47
  "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
48
+ "test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
49
49
  "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
50
50
  "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
51
51
  test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
52
+ "digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
52
53
  "digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
53
54
  "update:template": "tsx ./src/scripts/update-template.ts",
54
- "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
55
+ "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
55
56
  verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
56
57
  },
57
58
  dependencies: {
58
- "@commander-js/extra-typings": "^13.1.0",
59
+ "@commander-js/extra-typings": "^14.0.0",
59
60
  "@tokens-studio/sd-transforms": "1.3.0",
60
61
  "apca-w3": "^0.1.9",
61
62
  chalk: "^5.4.1",
@@ -66,11 +67,11 @@ var package_default = {
66
67
  "fast-glob": "^3.3.3",
67
68
  hsluv: "^1.0.1",
68
69
  "object-hash": "^3.0.0",
69
- postcss: "^8.5.3",
70
+ postcss: "^8.5.5",
70
71
  ramda: "^0.30.1",
71
72
  "style-dictionary": "^4.4.0",
72
- zod: "^3.25.30",
73
- "zod-validation-error": "^3.4.1"
73
+ zod: "^3.25.64",
74
+ "zod-validation-error": "^3.5.0"
74
75
  },
75
76
  devDependencies: {
76
77
  "@tokens-studio/types": "0.5.2",
@@ -78,15 +79,13 @@ var package_default = {
78
79
  "@types/chroma-js": "^3.1.1",
79
80
  "@types/fs-extra": "^11.0.4",
80
81
  "@types/glob": "^8.1.0",
81
- "@types/jscodeshift": "^0.12.0",
82
- "@types/node": "^22.15.21",
82
+ "@types/node": "^22.15.31",
83
83
  "@types/object-hash": "^3.0.6",
84
84
  "@types/ramda": "^0.30.2",
85
85
  "fs-extra": "^11.3.0",
86
- "ts-toolbelt": "^9.6.0",
87
86
  tslib: "^2.8.1",
88
87
  tsup: "^8.5.0",
89
- tsx: "^4.19.4",
88
+ tsx: "^4.20.3",
90
89
  typescript: "^5.8.3"
91
90
  }
92
91
  };
@@ -1,27 +1,6 @@
1
1
  // src/tokens/create/generators/color.ts
2
2
  import * as R3 from "ramda";
3
3
 
4
- // src/colors/utils.ts
5
- import chroma from "chroma-js";
6
- import Colorjs from "colorjs.io";
7
- import { Hsluv } from "hsluv";
8
- var getLuminanceFromLightness = (lightness) => {
9
- const conv = new Hsluv();
10
- conv.hsluv_l = lightness;
11
- conv.hsluvToHex();
12
- return chroma(conv.hex).luminance();
13
- };
14
- var getLightnessFromHex = (hex) => {
15
- const conv = new Hsluv();
16
- conv.hex = hex;
17
- conv.hexToHsluv();
18
- return conv.hsluv_l;
19
- };
20
-
21
- // src/colors/theme.ts
22
- import chroma2 from "chroma-js";
23
- import * as R2 from "ramda";
24
-
25
4
  // src/colors/colorMetadata.ts
26
5
  import * as R from "ramda";
27
6
  var baseColors = {
@@ -275,6 +254,27 @@ var colorMetadata = {
275
254
  };
276
255
  var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
277
256
 
257
+ // src/colors/theme.ts
258
+ import chroma2 from "chroma-js";
259
+ import * as R2 from "ramda";
260
+
261
+ // src/colors/utils.ts
262
+ import chroma from "chroma-js";
263
+ import Colorjs from "colorjs.io";
264
+ import { Hsluv } from "hsluv";
265
+ var getLuminanceFromLightness = (lightness) => {
266
+ const conv = new Hsluv();
267
+ conv.hsluv_l = lightness;
268
+ conv.hsluvToHex();
269
+ return chroma(conv.hex).luminance();
270
+ };
271
+ var getLightnessFromHex = (hex) => {
272
+ const conv = new Hsluv();
273
+ conv.hex = hex;
274
+ conv.hexToHsluv();
275
+ return conv.hsluv_l;
276
+ };
277
+
278
278
  // src/colors/theme.ts
279
279
  var generateColorScale = (color, colorScheme) => {
280
280
  let interpolationColor = color;
@@ -46,7 +46,7 @@ var readFile = async (path2, dry, allowFileNotFound) => {
46
46
  // package.json
47
47
  var package_default = {
48
48
  name: "@digdir/designsystemet",
49
- version: "1.0.8",
49
+ version: "1.1.0",
50
50
  description: "CLI for Designsystemet",
51
51
  author: "Designsystemet team",
52
52
  engines: {
@@ -56,7 +56,7 @@ var package_default = {
56
56
  type: "git",
57
57
  url: "git+https://github.com/digdir/designsystemet.git"
58
58
  },
59
- homepage: "https://github.com/digdir/designsystemet/tree/main/scripts/cli",
59
+ homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
60
60
  license: "MIT",
61
61
  type: "module",
62
62
  main: "./dist/src/index.js",
@@ -81,8 +81,6 @@ var package_default = {
81
81
  },
82
82
  scripts: {
83
83
  designsystemet: "tsx ./bin/designsystemet.ts",
84
- "build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
85
- "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
86
84
  build: "tsup && pnpm build:types && pnpm build:json-schema",
87
85
  "build:types": "tsc --emitDeclarationOnly --declaration",
88
86
  "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
@@ -90,17 +88,20 @@ var package_default = {
90
88
  "test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
91
89
  "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
92
90
  "test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
91
+ "test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
93
92
  "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
93
+ "test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
94
94
  "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
95
95
  "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
96
96
  test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
97
+ "digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
97
98
  "digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
98
99
  "update:template": "tsx ./src/scripts/update-template.ts",
99
- "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
100
+ "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
100
101
  verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
101
102
  },
102
103
  dependencies: {
103
- "@commander-js/extra-typings": "^13.1.0",
104
+ "@commander-js/extra-typings": "^14.0.0",
104
105
  "@tokens-studio/sd-transforms": "1.3.0",
105
106
  "apca-w3": "^0.1.9",
106
107
  chalk: "^5.4.1",
@@ -111,11 +112,11 @@ var package_default = {
111
112
  "fast-glob": "^3.3.3",
112
113
  hsluv: "^1.0.1",
113
114
  "object-hash": "^3.0.0",
114
- postcss: "^8.5.3",
115
+ postcss: "^8.5.5",
115
116
  ramda: "^0.30.1",
116
117
  "style-dictionary": "^4.4.0",
117
- zod: "^3.25.30",
118
- "zod-validation-error": "^3.4.1"
118
+ zod: "^3.25.64",
119
+ "zod-validation-error": "^3.5.0"
119
120
  },
120
121
  devDependencies: {
121
122
  "@tokens-studio/types": "0.5.2",
@@ -123,15 +124,13 @@ var package_default = {
123
124
  "@types/chroma-js": "^3.1.1",
124
125
  "@types/fs-extra": "^11.0.4",
125
126
  "@types/glob": "^8.1.0",
126
- "@types/jscodeshift": "^0.12.0",
127
- "@types/node": "^22.15.21",
127
+ "@types/node": "^22.15.31",
128
128
  "@types/object-hash": "^3.0.6",
129
129
  "@types/ramda": "^0.30.2",
130
130
  "fs-extra": "^11.3.0",
131
- "ts-toolbelt": "^9.6.0",
132
131
  tslib: "^2.8.1",
133
132
  tsup: "^8.5.0",
134
- tsx: "^4.19.4",
133
+ tsx: "^4.20.3",
135
134
  typescript: "^5.8.3"
136
135
  }
137
136
  };
@@ -522,7 +521,7 @@ var writeTokens = async (options) => {
522
521
  if ($themes2) {
523
522
  themeObjects = JSON.parse($themes2);
524
523
  }
525
- } catch (error) {
524
+ } catch (_error) {
526
525
  }
527
526
  const concatThemeNames = R.pipe(
528
527
  R.filter((obj) => R.toLower(obj.group || "") === "theme"),
@@ -2,6 +2,7 @@ import type { Theme, TokenSets } from './types.js';
2
2
  export declare const cliOptions: {
3
3
  readonly outDir: "out-dir";
4
4
  readonly clean: "clean";
5
+ readonly tailwind: "tailwind";
5
6
  readonly theme: {
6
7
  readonly colors: {
7
8
  readonly main: "main-colors";
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tokens/create.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAY,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;CAcb,CAAC;AAEX,eAAO,MAAM,YAAY,GAAU,MAAM,KAAK;;EAiC7C,CAAC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tokens/create.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAY,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;CAeb,CAAC;AAEX,eAAO,MAAM,YAAY,GAAU,MAAM,KAAK;;EAiC7C,CAAC"}
@@ -992,27 +992,6 @@ var getDefaultToken = (tokenPath) => {
992
992
  // src/tokens/create/generators/color.ts
993
993
  import * as R4 from "ramda";
994
994
 
995
- // src/colors/utils.ts
996
- import chroma from "chroma-js";
997
- import Colorjs from "colorjs.io";
998
- import { Hsluv } from "hsluv";
999
- var getLuminanceFromLightness = (lightness) => {
1000
- const conv = new Hsluv();
1001
- conv.hsluv_l = lightness;
1002
- conv.hsluvToHex();
1003
- return chroma(conv.hex).luminance();
1004
- };
1005
- var getLightnessFromHex = (hex) => {
1006
- const conv = new Hsluv();
1007
- conv.hex = hex;
1008
- conv.hexToHsluv();
1009
- return conv.hsluv_l;
1010
- };
1011
-
1012
- // src/colors/theme.ts
1013
- import chroma2 from "chroma-js";
1014
- import * as R3 from "ramda";
1015
-
1016
995
  // src/colors/colorMetadata.ts
1017
996
  import * as R2 from "ramda";
1018
997
  var baseColors = {
@@ -1266,6 +1245,27 @@ var colorMetadata = {
1266
1245
  };
1267
1246
  var colorMetadataByNumber = R2.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
1268
1247
 
1248
+ // src/colors/theme.ts
1249
+ import chroma2 from "chroma-js";
1250
+ import * as R3 from "ramda";
1251
+
1252
+ // src/colors/utils.ts
1253
+ import chroma from "chroma-js";
1254
+ import Colorjs from "colorjs.io";
1255
+ import { Hsluv } from "hsluv";
1256
+ var getLuminanceFromLightness = (lightness) => {
1257
+ const conv = new Hsluv();
1258
+ conv.hsluv_l = lightness;
1259
+ conv.hsluvToHex();
1260
+ return chroma(conv.hex).luminance();
1261
+ };
1262
+ var getLightnessFromHex = (hex) => {
1263
+ const conv = new Hsluv();
1264
+ conv.hex = hex;
1265
+ conv.hexToHsluv();
1266
+ return conv.hsluv_l;
1267
+ };
1268
+
1269
1269
  // src/colors/theme.ts
1270
1270
  var generateColorScale = (color, colorScheme) => {
1271
1271
  let interpolationColor = color;
@@ -2043,6 +2043,7 @@ var generateTypography = (themeName, { fontFamily }) => {
2043
2043
  var cliOptions = {
2044
2044
  outDir: "out-dir",
2045
2045
  clean: "clean",
2046
+ tailwind: "tailwind",
2046
2047
  theme: {
2047
2048
  colors: {
2048
2049
  main: "main-colors",
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tokens/format.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,YAAY,GAAU,SAAS,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,2DAOtE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,aAAa,KAAK,2DAYnD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAU,aAAa,KAAK,oBAItD,CAAC"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tokens/format.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,eAAO,MAAM,YAAY,GAAU,SAAS,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,2DAOtE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,aAAa,KAAK,2DAYnD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAU,aAAa,KAAK,oBAItD,CAAC"}