@digdir/designsystemet 1.0.5 → 1.0.7

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 (49) hide show
  1. package/LICENSE +7 -0
  2. package/configs/digdir.config.json +59 -0
  3. package/configs/test-tokens.config.json +45 -0
  4. package/dist/bin/designsystemet.js +82 -88
  5. package/dist/config.schema.json +38 -27
  6. package/dist/src/colors/index.js +32 -0
  7. package/dist/src/colors/theme.js +1 -0
  8. package/dist/src/colors/utils.d.ts +13 -0
  9. package/dist/src/colors/utils.d.ts.map +1 -1
  10. package/dist/src/colors/utils.js +32 -0
  11. package/dist/src/config.d.ts +24 -176
  12. package/dist/src/config.d.ts.map +1 -1
  13. package/dist/src/config.js +23 -32
  14. package/dist/src/index.js +85 -50
  15. package/dist/src/migrations/beta-to-v1.js +2 -2
  16. package/dist/src/migrations/codemods/css/run.js +2 -2
  17. package/dist/src/migrations/color-rename-next49.js +2 -2
  18. package/dist/src/migrations/index.js +2 -2
  19. package/dist/src/scripts/createJsonSchema.js +33 -1292
  20. package/dist/src/scripts/update-design-tokens.js +4 -4
  21. package/dist/src/scripts/update-template.js +7 -7
  22. package/dist/src/tokens/build.js +56 -53
  23. package/dist/src/tokens/create/generators/$designsystemet.js +27 -25
  24. package/dist/src/tokens/create/generators/$themes.js +10 -10
  25. package/dist/src/tokens/create/generators/color.js +1 -0
  26. package/dist/src/tokens/create/write.js +39 -37
  27. package/dist/src/tokens/create.js +1 -0
  28. package/dist/src/tokens/format.js +54 -50
  29. package/dist/src/tokens/index.js +54 -50
  30. package/dist/src/tokens/process/configs/color.js +26 -22
  31. package/dist/src/tokens/process/configs/semantic.js +16 -12
  32. package/dist/src/tokens/process/configs/shared.js +16 -12
  33. package/dist/src/tokens/process/configs/storefront.js +16 -12
  34. package/dist/src/tokens/process/configs/typography.js +16 -12
  35. package/dist/src/tokens/process/configs.js +26 -22
  36. package/dist/src/tokens/process/formats/css/color.js +16 -12
  37. package/dist/src/tokens/process/formats/css/semantic.js +16 -12
  38. package/dist/src/tokens/process/formats/css.js +16 -12
  39. package/dist/src/tokens/process/formats/js-tokens.js +16 -12
  40. package/dist/src/tokens/process/platform.js +26 -22
  41. package/dist/src/tokens/process/theme.d.ts.map +1 -1
  42. package/dist/src/tokens/process/theme.js +27 -28
  43. package/dist/src/tokens/process/transformers.js +16 -12
  44. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +26 -22
  45. package/dist/src/tokens/utils.d.ts +2 -2
  46. package/dist/src/tokens/utils.d.ts.map +1 -1
  47. package/dist/src/tokens/utils.js +16 -12
  48. package/dist/src/utils.js +1 -1
  49. package/package.json +35 -33
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2024 Digitaliseringsdirektoratet (Digdir)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,59 @@
1
+ {
2
+ "$schema": "../dist/config.schema.json",
3
+ "outDir": "./temp/digdir/design-tokens",
4
+ "clean": true,
5
+ "themes": {
6
+ "digdir": {
7
+ "colors": {
8
+ "main": {
9
+ "accent": "#0062BA"
10
+ },
11
+ "support": {
12
+ "brand1": "#F45F63",
13
+ "brand2": "#E5AA20",
14
+ "brand3": "#1E98F5"
15
+ },
16
+ "neutral": "#1E2B3C"
17
+ }
18
+ },
19
+ "altinn": {
20
+ "colors": {
21
+ "main": {
22
+ "accent": "#0062BA"
23
+ },
24
+ "support": {
25
+ "brand1": "#0162BA",
26
+ "brand2": "#3F3161",
27
+ "brand3": "#E02F4A"
28
+ },
29
+ "neutral": "#1E2B3C"
30
+ }
31
+ },
32
+ "uutilsynet": {
33
+ "colors": {
34
+ "main": {
35
+ "accent": "#0062BA"
36
+ },
37
+ "support": {
38
+ "brand1": "#5B60D1",
39
+ "brand2": "#FEA769",
40
+ "brand3": "#5DA290"
41
+ },
42
+ "neutral": "#1E2B3C"
43
+ }
44
+ },
45
+ "portal": {
46
+ "colors": {
47
+ "main": {
48
+ "accent": "#38628C"
49
+ },
50
+ "support": {
51
+ "brand1": "#D9ECFF",
52
+ "brand2": "#FFCA99",
53
+ "brand3": "#D96C79"
54
+ },
55
+ "neutral": "#203040"
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "../dist/config.schema.json",
3
+ "outDir": "./temp/config/design-tokens",
4
+ "clean": true,
5
+ "themes": {
6
+ "some-org": {
7
+ "colors": {
8
+ "main": {
9
+ "dominant": "#0062BA",
10
+ "complimentary": "#94237C"
11
+ },
12
+ "support": {
13
+ "first": "#F45F63",
14
+ "second": "#E5AA20",
15
+ "third": "#1E98F5",
16
+ "fourth": "#F167EC"
17
+ },
18
+ "neutral": "#303030"
19
+ },
20
+ "typography": {
21
+ "fontFamily": "Inter"
22
+ },
23
+ "borderRadius": 8
24
+ },
25
+ "other-org": {
26
+ "colors": {
27
+ "main": {
28
+ "dominant": "#ffaaaa",
29
+ "complimentary": "#00ff00"
30
+ },
31
+ "support": {
32
+ "first": "#abcdef",
33
+ "second": "#123456",
34
+ "third": "#994a22",
35
+ "fourth": "#3d5f30"
36
+ },
37
+ "neutral": "#c05030"
38
+ },
39
+ "typography": {
40
+ "fontFamily": "Roboto"
41
+ },
42
+ "borderRadius": 99
43
+ }
44
+ }
45
+ }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // bin/designsystemet.ts
4
- import path4 from "node:path";
4
+ import path4 from "path";
5
5
  import { Argument, createCommand, program } from "@commander-js/extra-typings";
6
6
  import chalk8 from "chalk";
7
7
  import * as R25 from "ramda";
@@ -9,6 +9,7 @@ import { fromError } from "zod-validation-error";
9
9
 
10
10
  // src/colors/utils.ts
11
11
  import chroma from "chroma-js";
12
+ import Colorjs from "colorjs.io";
12
13
  import { Hsluv } from "hsluv";
13
14
  var getLuminanceFromLightness = (lightness) => {
14
15
  const conv = new Hsluv();
@@ -360,7 +361,7 @@ var generateColorContrast = (color, type) => {
360
361
 
361
362
  // src/config.ts
362
363
  import * as R7 from "ramda";
363
- import { z } from "zod";
364
+ import { z } from "zod/v4";
364
365
 
365
366
  // src/tokens/create/defaults.ts
366
367
  import * as R3 from "ramda";
@@ -2136,45 +2137,35 @@ var hexPatterns = [
2136
2137
  ];
2137
2138
  var reservedColorsPattern = `^(?!(?:${RESERVED_COLORS.join("|")})$)`;
2138
2139
  var colorRegex = new RegExp(`^${hexPatterns.join("|")}$`);
2139
- var colorSchema = z.string({
2140
- description: `A hex color, which is used for creating a color scale. Invalid color names: ${RESERVED_COLORS.join(", ")}`
2141
- }).regex(colorRegex).transform(convertToHex);
2140
+ var colorSchema = z.string().regex(colorRegex).transform(convertToHex).describe(
2141
+ `A hex color, which is used for creating a color scale. Invalid color names: ${RESERVED_COLORS.join(", ")}`
2142
+ );
2142
2143
  var colorCategorySchema = z.record(
2143
2144
  z.string().regex(new RegExp(reservedColorsPattern, "i"), {
2144
- message: `Color names cannot include reserved names: ${RESERVED_COLORS.join(", ")}`
2145
+ error: `Color names cannot include reserved names: ${RESERVED_COLORS.join(", ")}`
2145
2146
  }),
2146
2147
  colorSchema,
2147
2148
  {
2148
- description: "One or more color definitions",
2149
- invalid_type_error: "Color definitions must be hex color values"
2149
+ error: "Color definitions must be hex color values"
2150
2150
  }
2151
2151
  ).refine((colors2) => !Object.keys(colors2).some((key) => RESERVED_COLORS.includes(key.toLowerCase())), {
2152
- message: `Color names cannot include reserved names: ${RESERVED_COLORS.join(", ")}`
2153
- });
2154
- var themeSchema = z.object(
2155
- {
2156
- colors: z.object(
2157
- {
2158
- main: colorCategorySchema,
2159
- support: colorCategorySchema.optional().default({}),
2160
- neutral: colorSchema
2161
- },
2162
- { description: "Defines the colors for this theme" }
2163
- ),
2164
- typography: z.object(
2165
- {
2166
- fontFamily: z.string({ description: "Sets the font-family for this theme" })
2167
- },
2168
- { description: "Defines the typography for a given theme" }
2169
- ).optional(),
2170
- borderRadius: z.number({ description: "Defines the border-radius for this theme" }).optional()
2171
- },
2172
- { description: "An object defining a theme. The property name holding the object becomes the theme name." }
2173
- );
2152
+ error: `Color names cannot include reserved names: ${RESERVED_COLORS.join(", ")}`
2153
+ }).describe("An object with one or more color definitions. The property name is used as the color name.");
2154
+ var themeSchema = z.object({
2155
+ colors: z.object({
2156
+ main: colorCategorySchema,
2157
+ support: colorCategorySchema.optional().default({}),
2158
+ neutral: colorSchema
2159
+ }).meta({ description: "Defines the colors for this theme" }),
2160
+ typography: z.object({
2161
+ fontFamily: z.string().meta({ description: "Sets the font-family for this theme" })
2162
+ }).describe("Defines the typography for a given theme").optional(),
2163
+ borderRadius: z.number().meta({ description: "Defines the border-radius for this theme" }).optional()
2164
+ }).meta({ description: "An object defining a theme. The property name holding the object becomes the theme name." });
2174
2165
  var configFileSchema = z.object({
2175
- outDir: z.string({ description: "Path to the output directory for the created design tokens" }).optional(),
2176
- clean: z.boolean({ description: "Delete the output directory before building or creating tokens" }).optional(),
2177
- themes: z.record(themeSchema, {
2166
+ outDir: z.string().meta({ description: "Path to the output directory for the created design tokens" }).optional(),
2167
+ clean: z.boolean().meta({ description: "Delete the output directory before building or creating tokens" }).optional(),
2168
+ themes: z.record(z.string(), themeSchema).meta({
2178
2169
  description: "An object with one or more themes. Each property defines a theme, and the property name is used as the theme name."
2179
2170
  })
2180
2171
  });
@@ -2224,12 +2215,12 @@ var cssVarRename = (dictionary) => ({
2224
2215
  });
2225
2216
 
2226
2217
  // src/migrations/codemods/css/run.ts
2227
- import fs2 from "node:fs";
2218
+ import fs2 from "fs";
2228
2219
  import glob from "fast-glob";
2229
2220
  import postcss from "postcss";
2230
2221
 
2231
2222
  // src/utils.ts
2232
- import fs from "node:fs/promises";
2223
+ import fs from "fs/promises";
2233
2224
  import chalk2 from "chalk";
2234
2225
  var mkdir = async (dir, dry) => {
2235
2226
  if (dry) {
@@ -2676,7 +2667,7 @@ var migrations_default = {
2676
2667
  };
2677
2668
 
2678
2669
  // src/tokens/build.ts
2679
- import path2 from "node:path";
2670
+ import path2 from "path";
2680
2671
  import chalk6 from "chalk";
2681
2672
  import * as R23 from "ramda";
2682
2673
 
@@ -2687,11 +2678,11 @@ import chalk3 from "chalk";
2687
2678
  // package.json
2688
2679
  var package_default = {
2689
2680
  name: "@digdir/designsystemet",
2690
- version: "1.0.5",
2681
+ version: "1.0.7",
2691
2682
  description: "CLI for Designsystemet",
2692
2683
  author: "Designsystemet team",
2693
2684
  engines: {
2694
- node: ">=22.14.0"
2685
+ node: ">=22.16.0"
2695
2686
  },
2696
2687
  repository: {
2697
2688
  type: "git",
@@ -2702,7 +2693,8 @@ var package_default = {
2702
2693
  type: "module",
2703
2694
  main: "./dist/src/index.js",
2704
2695
  files: [
2705
- "./dist/**"
2696
+ "./dist/**",
2697
+ "./configs/**"
2706
2698
  ],
2707
2699
  bin: "dist/bin/designsystemet.js",
2708
2700
  exports: {
@@ -2721,57 +2713,58 @@ var package_default = {
2721
2713
  },
2722
2714
  scripts: {
2723
2715
  designsystemet: "tsx ./bin/designsystemet.ts",
2724
- "build:tokens": "yarn designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
2725
- "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
2726
- build: "tsup && yarn build:types && yarn build:json-schema",
2716
+ "build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
2717
+ "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
2718
+ build: "tsup && pnpm build:types && pnpm build:json-schema",
2727
2719
  "build:types": "tsc --emitDeclarationOnly --declaration",
2728
2720
  "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
2729
2721
  types: "tsc --noEmit",
2730
- "test:tokens-create-options": "yarn designsystemet tokens create -m dominant:#007682 -n #003333 -b 99 -o ./test-tokens/options --theme options --clean",
2731
- "test:tokens-create-config": "yarn designsystemet tokens create --config ./test/test-tokens.config.json",
2732
- "test:tokens-build": "yarn designsystemet tokens build -t ./test-tokens/options -o ./test-tokens/options-build --clean",
2733
- "test:tokens-build-config": "yarn designsystemet tokens build -t ./test-tokens/config -o ./test-tokens/config-build --clean",
2734
- "test:tokens-create-and-build-options": "yarn test:tokens-create-options && yarn test:tokens-build",
2735
- "test:tokens-create-and-build-config": "yarn test:tokens-create-config && yarn test:tokens-build-config",
2736
- test: "yarn test:tokens-create-and-build-options && yarn test:tokens-create-and-build-config",
2737
- "internal:tokens-create": "yarn designsystemet tokens create --config ./internal.config.json",
2722
+ "test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
2723
+ "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
2724
+ "test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
2725
+ "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
2726
+ "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
2727
+ "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
2728
+ test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
2729
+ "digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
2738
2730
  "update:template": "tsx ./src/scripts/update-template.ts",
2739
- "update:design-tokens": "yarn internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
2740
- verify: "yarn test && yarn update:template && yarn update:design-tokens"
2731
+ "update:design-tokens": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
2732
+ verify: "pnpm test && pnpm update:template && pnpm update:design-tokens"
2741
2733
  },
2742
2734
  dependencies: {
2743
2735
  "@commander-js/extra-typings": "^13.1.0",
2744
- "@tokens-studio/sd-transforms": "1.2.12",
2736
+ "@tokens-studio/sd-transforms": "1.3.0",
2745
2737
  "apca-w3": "^0.1.9",
2746
2738
  chalk: "^5.4.1",
2747
2739
  "change-case": "^5.4.4",
2748
2740
  "chroma-js": "^3.1.2",
2741
+ "colorjs.io": "^0.6.0-alpha.1",
2749
2742
  commander: "^13.1.0",
2750
2743
  "fast-glob": "^3.3.3",
2751
2744
  hsluv: "^1.0.1",
2752
2745
  "object-hash": "^3.0.0",
2753
2746
  postcss: "^8.5.3",
2754
2747
  ramda: "^0.30.1",
2755
- "style-dictionary": "^4.3.3",
2756
- zod: "^3.24.2",
2757
- "zod-validation-error": "^3.4.0"
2748
+ "style-dictionary": "^4.4.0",
2749
+ zod: "^3.25.30",
2750
+ "zod-validation-error": "^3.4.1"
2758
2751
  },
2759
2752
  devDependencies: {
2753
+ "@tokens-studio/types": "0.5.2",
2760
2754
  "@types/apca-w3": "^0.1.3",
2761
2755
  "@types/chroma-js": "^3.1.1",
2762
2756
  "@types/fs-extra": "^11.0.4",
2763
2757
  "@types/glob": "^8.1.0",
2764
2758
  "@types/jscodeshift": "^0.12.0",
2765
- "@types/node": "^22.14.0",
2759
+ "@types/node": "^22.15.21",
2766
2760
  "@types/object-hash": "^3.0.6",
2767
2761
  "@types/ramda": "^0.30.2",
2768
2762
  "fs-extra": "^11.3.0",
2769
2763
  "ts-toolbelt": "^9.6.0",
2770
2764
  tslib: "^2.8.1",
2771
- tsup: "^8.4.0",
2772
- tsx: "^4.19.3",
2773
- typescript: "^5.8.2",
2774
- "zod-to-json-schema": "^3.24.5"
2765
+ tsup: "^8.5.0",
2766
+ tsx: "^4.19.4",
2767
+ typescript: "^5.8.3"
2775
2768
  }
2776
2769
  };
2777
2770
 
@@ -2825,9 +2818,6 @@ order may change due to nondeterminism.`.trim()
2825
2818
  return sortIndex;
2826
2819
  });
2827
2820
  const header = `@charset "UTF-8";
2828
-
2829
- @layer ds.theme, ds.base, ds.utilities, ds.components;
2830
-
2831
2821
  /*
2832
2822
  ${fileHeader2}
2833
2823
  */
@@ -2871,20 +2861,24 @@ var mapToLowerCase = R11.map(R11.toLower);
2871
2861
  var hasAnyTruth = R11.any(R11.equals(true));
2872
2862
  var getType = (token) => (token.$type ?? token.type) || "";
2873
2863
  var getValue = (token) => token.$value ?? token.value;
2874
- var typeEquals = R11.curry((types, token) => {
2875
- if (R11.isNil(token)) {
2876
- return false;
2864
+ var typeEquals = R11.curry(
2865
+ (types, token) => {
2866
+ if (R11.isNil(token)) {
2867
+ return false;
2868
+ }
2869
+ return R11.includes(R11.toLower(getType(token)), R11.map(R11.toLower, Array.isArray(types) ? types : [types]));
2877
2870
  }
2878
- return R11.includes(R11.toLower(getType(token)), R11.map(R11.toLower, Array.isArray(types) ? types : [types]));
2879
- });
2880
- var pathStartsWithOneOf = R11.curry((paths, token) => {
2881
- if (R11.isNil(token)) {
2882
- return false;
2871
+ );
2872
+ var pathStartsWithOneOf = R11.curry(
2873
+ (paths, token) => {
2874
+ if (R11.isNil(token)) {
2875
+ return false;
2876
+ }
2877
+ const tokenPath = mapToLowerCase(token.path);
2878
+ const matchPathsStartingWith = R11.map((path5) => R11.startsWith([path5], tokenPath), mapToLowerCase(paths));
2879
+ return hasAnyTruth(matchPathsStartingWith);
2883
2880
  }
2884
- const tokenPath = mapToLowerCase(token.path);
2885
- const matchPathsStartingWith = R11.map((path5) => R11.startsWith([path5], tokenPath), mapToLowerCase(paths));
2886
- return hasAnyTruth(matchPathsStartingWith);
2887
- });
2881
+ );
2888
2882
  function isSemanticToken(token) {
2889
2883
  return token.filePath.includes("semantic/");
2890
2884
  }
@@ -3440,14 +3434,14 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
3440
3434
  };
3441
3435
  };
3442
3436
 
3443
- // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
3437
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
3444
3438
  var BoxShadowTypes;
3445
3439
  (function(BoxShadowTypes2) {
3446
3440
  BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
3447
3441
  BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
3448
3442
  })(BoxShadowTypes || (BoxShadowTypes = {}));
3449
3443
 
3450
- // ../../node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
3444
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
3451
3445
  var ColorModifierTypes;
3452
3446
  (function(ColorModifierTypes2) {
3453
3447
  ColorModifierTypes2["LIGHTEN"] = "lighten";
@@ -3456,7 +3450,7 @@ var ColorModifierTypes;
3456
3450
  ColorModifierTypes2["ALPHA"] = "alpha";
3457
3451
  })(ColorModifierTypes || (ColorModifierTypes = {}));
3458
3452
 
3459
- // ../../node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
3453
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
3460
3454
  var ColorSpaceTypes;
3461
3455
  (function(ColorSpaceTypes2) {
3462
3456
  ColorSpaceTypes2["LCH"] = "lch";
@@ -3465,7 +3459,7 @@ var ColorSpaceTypes;
3465
3459
  ColorSpaceTypes2["HSL"] = "hsl";
3466
3460
  })(ColorSpaceTypes || (ColorSpaceTypes = {}));
3467
3461
 
3468
- // ../../node_modules/@tokens-studio/types/dist/constants/Properties.js
3462
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
3469
3463
  var Properties;
3470
3464
  (function(Properties2) {
3471
3465
  Properties2["sizing"] = "sizing";
@@ -3517,7 +3511,7 @@ var Properties;
3517
3511
  Properties2["description"] = "description";
3518
3512
  })(Properties || (Properties = {}));
3519
3513
 
3520
- // ../../node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
3514
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
3521
3515
  var TokenSetStatus;
3522
3516
  (function(TokenSetStatus2) {
3523
3517
  TokenSetStatus2["DISABLED"] = "disabled";
@@ -3525,7 +3519,7 @@ var TokenSetStatus;
3525
3519
  TokenSetStatus2["ENABLED"] = "enabled";
3526
3520
  })(TokenSetStatus || (TokenSetStatus = {}));
3527
3521
 
3528
- // ../../node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
3522
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
3529
3523
  var TokenTypes;
3530
3524
  (function(TokenTypes2) {
3531
3525
  TokenTypes2["OTHER"] = "other";
@@ -3556,7 +3550,7 @@ var TokenTypes;
3556
3550
  TokenTypes2["NUMBER"] = "number";
3557
3551
  })(TokenTypes || (TokenTypes = {}));
3558
3552
 
3559
- // ../../node_modules/@tokens-studio/types/dist/constants/BorderValues.js
3553
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
3560
3554
  var BorderValues;
3561
3555
  (function(BorderValues2) {
3562
3556
  BorderValues2["BORDER_COLOR"] = "color";
@@ -3564,7 +3558,7 @@ var BorderValues;
3564
3558
  BorderValues2["BORDER_STYLE"] = "style";
3565
3559
  })(BorderValues || (BorderValues = {}));
3566
3560
 
3567
- // ../../node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
3561
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
3568
3562
  var StrokeStyleValues;
3569
3563
  (function(StrokeStyleValues2) {
3570
3564
  StrokeStyleValues2["SOLID"] = "solid";
@@ -3577,7 +3571,7 @@ var StrokeStyleValues;
3577
3571
  StrokeStyleValues2["INSET"] = "inset";
3578
3572
  })(StrokeStyleValues || (StrokeStyleValues = {}));
3579
3573
 
3580
- // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
3574
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
3581
3575
  var BoxShadowValues;
3582
3576
  (function(BoxShadowValues2) {
3583
3577
  BoxShadowValues2["TYPE"] = "type";
@@ -3589,7 +3583,7 @@ var BoxShadowValues;
3589
3583
  BoxShadowValues2["BLEND_MODE"] = "blendMode";
3590
3584
  })(BoxShadowValues || (BoxShadowValues = {}));
3591
3585
 
3592
- // ../../node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
3586
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
3593
3587
  var TypographyValues;
3594
3588
  (function(TypographyValues2) {
3595
3589
  TypographyValues2["FONT_FAMILY"] = "fontFamily";
@@ -3978,7 +3972,7 @@ var buildTokens = async (options) => {
3978
3972
  const fileHeader2 = R23.join("")([
3979
3973
  defaultFileHeader,
3980
3974
  $designsystemet ? `
3981
- design-tokens: v${$designsystemet.version} ` : ""
3975
+ design-tokens: v${$designsystemet.version}` : ""
3982
3976
  ]);
3983
3977
  await write(createThemeCSSFiles({ processedBuilds, fileHeader: fileHeader2 }), outDir, options.dry);
3984
3978
  console.log(`
@@ -3987,7 +3981,7 @@ design-tokens: v${$designsystemet.version} ` : ""
3987
3981
  };
3988
3982
 
3989
3983
  // src/tokens/create/write.ts
3990
- import path3 from "node:path";
3984
+ import path3 from "path";
3991
3985
  import chalk7 from "chalk";
3992
3986
  import * as R24 from "ramda";
3993
3987
 
@@ -1,83 +1,94 @@
1
1
  {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2
3
  "type": "object",
3
4
  "properties": {
4
5
  "$schema": {
5
6
  "type": "string"
6
7
  },
7
8
  "outDir": {
8
- "type": "string",
9
- "description": "Path to the output directory for the created design tokens"
9
+ "description": "Path to the output directory for the created design tokens",
10
+ "type": "string"
10
11
  },
11
12
  "clean": {
12
- "type": "boolean",
13
- "description": "Delete the output directory before building or creating tokens"
13
+ "description": "Delete the output directory before building or creating tokens",
14
+ "type": "boolean"
14
15
  },
15
16
  "themes": {
17
+ "description": "An object with one or more themes. Each property defines a theme, and the property name is used as the theme name.",
16
18
  "type": "object",
19
+ "propertyNames": {
20
+ "type": "string"
21
+ },
17
22
  "additionalProperties": {
23
+ "description": "An object defining a theme. The property name holding the object becomes the theme name.",
18
24
  "type": "object",
19
25
  "properties": {
20
26
  "colors": {
27
+ "description": "Defines the colors for this theme",
21
28
  "type": "object",
22
29
  "properties": {
23
30
  "main": {
31
+ "description": "An object with one or more color definitions. The property name is used as the color name.",
24
32
  "type": "object",
25
- "additionalProperties": {
26
- "type": "string",
27
- "pattern": "^#[0-9a-fA-F]{3}|#[0-9a-fA-F]{4}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{8}$",
28
- "description": "A hex color, which is used for creating a color scale. Invalid color names: neutral, success, warning, danger, info, blue, green, orange, purple, red"
29
- },
30
33
  "propertyNames": {
34
+ "type": "string",
31
35
  "pattern": "^(?!(?:neutral|success|warning|danger|info|blue|green|orange|purple|red)$)"
32
36
  },
33
- "description": "One or more color definitions"
37
+ "additionalProperties": {
38
+ "description": "A hex color, which is used for creating a color scale. Invalid color names: neutral, success, warning, danger, info, blue, green, orange, purple, red"
39
+ }
34
40
  },
35
41
  "support": {
36
- "$ref": "#/properties/themes/additionalProperties/properties/colors/properties/main",
37
- "default": {}
42
+ "default": {},
43
+ "description": "An object with one or more color definitions. The property name is used as the color name.",
44
+ "type": "object",
45
+ "propertyNames": {
46
+ "type": "string",
47
+ "pattern": "^(?!(?:neutral|success|warning|danger|info|blue|green|orange|purple|red)$)"
48
+ },
49
+ "additionalProperties": {
50
+ "description": "A hex color, which is used for creating a color scale. Invalid color names: neutral, success, warning, danger, info, blue, green, orange, purple, red"
51
+ }
38
52
  },
39
53
  "neutral": {
40
- "$ref": "#/properties/themes/additionalProperties/properties/colors/properties/main/additionalProperties"
54
+ "description": "A hex color, which is used for creating a color scale. Invalid color names: neutral, success, warning, danger, info, blue, green, orange, purple, red"
41
55
  }
42
56
  },
43
57
  "required": [
44
58
  "main",
59
+ "support",
45
60
  "neutral"
46
61
  ],
47
- "additionalProperties": false,
48
- "description": "Defines the colors for this theme"
62
+ "additionalProperties": false
49
63
  },
50
64
  "typography": {
65
+ "description": "Defines the typography for a given theme",
51
66
  "type": "object",
52
67
  "properties": {
53
68
  "fontFamily": {
54
- "type": "string",
55
- "description": "Sets the font-family for this theme"
69
+ "description": "Sets the font-family for this theme",
70
+ "type": "string"
56
71
  }
57
72
  },
58
73
  "required": [
59
74
  "fontFamily"
60
75
  ],
61
- "additionalProperties": false,
62
- "description": "Defines the typography for a given theme"
76
+ "additionalProperties": false
63
77
  },
64
78
  "borderRadius": {
65
- "type": "number",
66
- "description": "Defines the border-radius for this theme"
79
+ "description": "Defines the border-radius for this theme",
80
+ "type": "number"
67
81
  }
68
82
  },
69
83
  "required": [
70
84
  "colors"
71
85
  ],
72
- "additionalProperties": false,
73
- "description": "An object defining a theme. The property name holding the object becomes the theme name."
74
- },
75
- "description": "An object with one or more themes. Each property defines a theme, and the property name is used as the theme name."
86
+ "additionalProperties": false
87
+ }
76
88
  }
77
89
  },
78
90
  "required": [
79
91
  "themes"
80
92
  ],
81
- "additionalProperties": false,
82
- "$schema": "http://json-schema.org/draft-07/schema#"
93
+ "additionalProperties": false
83
94
  }