@digdir/designsystemet 0.1.0-next.30 → 1.0.0-next.32

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.
@@ -3,8 +3,8 @@ import { Hsluv } from "hsluv";
3
3
  import { getContrastFromHex, getContrastFromLightness, getLightnessFromHex } from "./utils.js";
4
4
  const baseColors = {
5
5
  blue: "#0A71C0",
6
- green: "#078D19",
7
- orange: "#CA5C21",
6
+ green: "#068718",
7
+ orange: "#B8581D",
8
8
  purple: "#663299",
9
9
  red: "#C01B1B",
10
10
  yellow: "#EABF28"
@@ -2,7 +2,7 @@ import { normalizeTokenSetName } from "./utils.js";
2
2
  function generateMetadataJson(modes, themes) {
3
3
  return {
4
4
  tokenSetOrder: [
5
- "primitives/modes/globals",
5
+ "primitives/globals",
6
6
  "primitives/size/default",
7
7
  "primitives/modes/typography/primary/theme",
8
8
  "primitives/modes/typography/secondary/theme",
@@ -551,11 +551,11 @@
551
551
  },
552
552
  "contrast-default": {
553
553
  "$type": "color",
554
- "$value": "{global.yellow.contrast-1}"
554
+ "$value": "{global.orange.contrast-1}"
555
555
  },
556
556
  "contrast-subtle": {
557
557
  "$type": "color",
558
- "$value": "{global.yellow.contrast-2}"
558
+ "$value": "{global.orange.contrast-2}"
559
559
  }
560
560
  },
561
561
  "focus": {
@@ -67,8 +67,7 @@ const generateThemeTokens = (theme, colors) => {
67
67
  const generateColorModeFile = (folder, name, tokens, outPath) => {
68
68
  const path2 = `${outPath}/primitives/modes/colors/${folder}`;
69
69
  return {
70
- data: `${JSON.stringify(tokens, null, 2)}
71
- `,
70
+ data: JSON.stringify(tokens, null, 2),
72
71
  path: path2,
73
72
  filePath: `${path2}/${name}.json`
74
73
  };
@@ -76,8 +75,7 @@ const generateColorModeFile = (folder, name, tokens, outPath) => {
76
75
  const generateTypographyFile = (folder, name, tokens, outPath) => {
77
76
  const path2 = `${outPath}/primitives/modes/typography/${folder}`;
78
77
  return {
79
- data: `${JSON.stringify(tokens, null, 2)}
80
- `,
78
+ data: JSON.stringify(tokens, null, 2),
81
79
  path: path2,
82
80
  filePath: `${path2}/${name}.json`
83
81
  };
@@ -123,7 +121,7 @@ const createTokens = async (opts) => {
123
121
  const $metadata = generateMetadataJson(["Light", "Dark", "Contrast"], ["theme"]);
124
122
  await fs.writeFile(path.join(targetDir, "$themes.json"), JSON.stringify($theme, null, 2));
125
123
  await fs.writeFile(path.join(targetDir, "$metadata.json"), JSON.stringify($metadata, null, 2));
126
- console.log(`Copy files to ${targetDir}`);
124
+ console.log(`Copying default files to ${targetDir}`);
127
125
  await fs.cp(DEFAULT_FILES_PATH, targetDir, {
128
126
  recursive: true
129
127
  });
@@ -138,10 +136,10 @@ const createTokens = async (opts) => {
138
136
  generateTypographyFile("secondary", "theme", tokens.typography.primary, targetDir)
139
137
  ];
140
138
  for (const file of files) {
141
- const path_ = path.resolve(file.path);
139
+ const dirPath = path.resolve(file.path);
142
140
  const filePath = path.resolve(file.filePath);
143
141
  console.log(`Writing file ${filePath}`);
144
- await fs.mkdir(path_, { recursive: true });
142
+ await fs.mkdir(dirPath, { recursive: true });
145
143
  await fs.writeFile(filePath, file.data, { encoding: "utf-8" });
146
144
  }
147
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet",
3
- "version": "0.1.0-next.30",
3
+ "version": "1.0.0-next.32",
4
4
  "description": "CLI for Designsystemet",
5
5
  "author": "Designsystemet team",
6
6
  "repository": {