@digdir/designsystemet 1.1.10 → 1.2.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.
- package/dist/bin/config.js +12 -12
- package/dist/bin/designsystemet.js +55 -57
- package/dist/src/config.js +6 -6
- package/dist/src/index.js +18 -18
- package/dist/src/migrations/beta-to-v1.js +5 -5
- package/dist/src/migrations/codemods/css/plugins.js +3 -3
- package/dist/src/migrations/codemods/css/run.js +2 -2
- package/dist/src/migrations/color-rename-next49.js +5 -5
- package/dist/src/migrations/index.js +5 -5
- package/dist/src/scripts/createJsonSchema.js +1 -1
- package/dist/src/scripts/update-design-tokens.js +2 -2
- package/dist/src/scripts/update-preview-tokens.js +22 -22
- package/dist/src/scripts/update-template.js +11 -11
- package/dist/src/tokens/build.js +29 -29
- package/dist/src/tokens/create/generators/$designsystemet.js +5 -5
- package/dist/src/tokens/create/write.d.ts.map +1 -1
- package/dist/src/tokens/create/write.js +14 -16
- package/dist/src/tokens/format.js +18 -18
- package/dist/src/tokens/index.js +18 -18
- package/dist/src/tokens/process/configs/color.js +2 -2
- package/dist/src/tokens/process/configs/semantic.js +2 -2
- package/dist/src/tokens/process/configs/typography.js +2 -2
- package/dist/src/tokens/process/configs.js +4 -4
- package/dist/src/tokens/process/formats/css/color.js +2 -2
- package/dist/src/tokens/process/formats/css/semantic.js +2 -2
- package/dist/src/tokens/process/formats/css/typography.js +2 -2
- package/dist/src/tokens/process/formats/css.js +2 -2
- package/dist/src/tokens/process/output/declarations.js +9 -9
- package/dist/src/tokens/process/output/theme.js +8 -8
- package/dist/src/tokens/process/platform.js +10 -10
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +4 -4
- package/dist/src/utils.js +10 -10
- package/package.json +5 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/migrations/codemods/css/plugins.ts
|
|
2
|
-
import chalk from "chalk";
|
|
3
2
|
import hash from "object-hash";
|
|
3
|
+
import pc from "picocolors";
|
|
4
4
|
import * as R from "ramda";
|
|
5
|
-
var printDelete = (text) => console.log(`${
|
|
6
|
-
var deleteMsg = (decl, from) => `${
|
|
5
|
+
var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
|
|
6
|
+
var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
7
7
|
var cssClassRename = (dictionary) => ({
|
|
8
8
|
postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
|
|
9
9
|
Rule(rule) {
|
|
@@ -5,10 +5,10 @@ import postcss from "postcss";
|
|
|
5
5
|
|
|
6
6
|
// src/utils.ts
|
|
7
7
|
import fs from "fs/promises";
|
|
8
|
-
import
|
|
8
|
+
import pc from "picocolors";
|
|
9
9
|
var readFile = async (path, dry, allowFileNotFound) => {
|
|
10
10
|
if (dry) {
|
|
11
|
-
console.log(`${
|
|
11
|
+
console.log(`${pc.blue("readFile")} ${path}`);
|
|
12
12
|
return Promise.resolve("");
|
|
13
13
|
}
|
|
14
14
|
try {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import * as R2 from "ramda";
|
|
3
3
|
|
|
4
4
|
// src/migrations/codemods/css/plugins.ts
|
|
5
|
-
import chalk from "chalk";
|
|
6
5
|
import hash from "object-hash";
|
|
6
|
+
import pc from "picocolors";
|
|
7
7
|
import * as R from "ramda";
|
|
8
|
-
var printDelete = (text) => console.log(`${
|
|
9
|
-
var deleteMsg = (decl, from) => `${
|
|
8
|
+
var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
|
|
9
|
+
var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
10
10
|
var cssVarRename = (dictionary) => ({
|
|
11
11
|
postcssPlugin: `Replaces CSS variables ${hash(dictionary)}`,
|
|
12
12
|
Declaration(decl) {
|
|
@@ -39,10 +39,10 @@ import postcss from "postcss";
|
|
|
39
39
|
|
|
40
40
|
// src/utils.ts
|
|
41
41
|
import fs from "fs/promises";
|
|
42
|
-
import
|
|
42
|
+
import pc2 from "picocolors";
|
|
43
43
|
var readFile = async (path, dry, allowFileNotFound) => {
|
|
44
44
|
if (dry) {
|
|
45
|
-
console.log(`${
|
|
45
|
+
console.log(`${pc2.blue("readFile")} ${path}`);
|
|
46
46
|
return Promise.resolve("");
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/migrations/codemods/css/plugins.ts
|
|
2
|
-
import chalk from "chalk";
|
|
3
2
|
import hash from "object-hash";
|
|
3
|
+
import pc from "picocolors";
|
|
4
4
|
import * as R from "ramda";
|
|
5
|
-
var printDelete = (text) => console.log(`${
|
|
6
|
-
var deleteMsg = (decl, from) => `${
|
|
5
|
+
var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
|
|
6
|
+
var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
7
7
|
var cssClassRename = (dictionary) => ({
|
|
8
8
|
postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
|
|
9
9
|
Rule(rule) {
|
|
@@ -48,10 +48,10 @@ import postcss from "postcss";
|
|
|
48
48
|
|
|
49
49
|
// src/utils.ts
|
|
50
50
|
import fs from "fs/promises";
|
|
51
|
-
import
|
|
51
|
+
import pc2 from "picocolors";
|
|
52
52
|
var readFile = async (path, dry, allowFileNotFound) => {
|
|
53
53
|
if (dry) {
|
|
54
|
-
console.log(`${
|
|
54
|
+
console.log(`${pc2.blue("readFile")} ${path}`);
|
|
55
55
|
return Promise.resolve("");
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
@@ -3,10 +3,10 @@ import path from "path";
|
|
|
3
3
|
|
|
4
4
|
// src/utils.ts
|
|
5
5
|
import fs from "fs/promises";
|
|
6
|
-
import
|
|
6
|
+
import pc from "picocolors";
|
|
7
7
|
var cp = async (src, dest, dry, filter) => {
|
|
8
8
|
if (dry) {
|
|
9
|
-
console.log(`${
|
|
9
|
+
console.log(`${pc.blue("cp")} ${src} ${dest}`);
|
|
10
10
|
return Promise.resolve();
|
|
11
11
|
}
|
|
12
12
|
return fs.cp(src, dest, { recursive: true, filter });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/scripts/update-preview-tokens.ts
|
|
2
2
|
import path from "path";
|
|
3
|
-
import
|
|
3
|
+
import pc4 from "picocolors";
|
|
4
4
|
|
|
5
5
|
// ../theme/configs/designsystemet.config.json
|
|
6
6
|
var designsystemet_config_default = {
|
|
@@ -2434,7 +2434,7 @@ var createTokens = async (opts) => {
|
|
|
2434
2434
|
};
|
|
2435
2435
|
|
|
2436
2436
|
// src/tokens/process/platform.ts
|
|
2437
|
-
import
|
|
2437
|
+
import pc2 from "picocolors";
|
|
2438
2438
|
import * as R16 from "ramda";
|
|
2439
2439
|
import StyleDictionary2 from "style-dictionary";
|
|
2440
2440
|
|
|
@@ -2975,8 +2975,8 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
|
|
|
2975
2975
|
};
|
|
2976
2976
|
|
|
2977
2977
|
// src/tokens/process/utils/getMultidimensionalThemes.ts
|
|
2978
|
-
import chalk from "chalk";
|
|
2979
2978
|
import { kebabCase } from "change-case";
|
|
2979
|
+
import pc from "picocolors";
|
|
2980
2980
|
import * as R14 from "ramda";
|
|
2981
2981
|
var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
2982
2982
|
const verboseLogging = buildOptions?.verbose;
|
|
@@ -2986,8 +2986,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
|
2986
2986
|
const keys2 = R14.keys(grouped$themes);
|
|
2987
2987
|
const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
|
|
2988
2988
|
if (verboseLogging) {
|
|
2989
|
-
console.log(
|
|
2990
|
-
console.log(
|
|
2989
|
+
console.log(pc.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
|
|
2990
|
+
console.log(pc.cyan(` (ignoring permutations for ${nonDependentKeys})`));
|
|
2991
2991
|
}
|
|
2992
2992
|
return permutations.filter((val) => {
|
|
2993
2993
|
const filters = nonDependentKeys.map((x) => val.permutation[x] === grouped$themes[x][0].name);
|
|
@@ -3214,18 +3214,18 @@ async function processPlatform(options) {
|
|
|
3214
3214
|
const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
|
|
3215
3215
|
if (UNSAFE_DEFAULT_COLOR) {
|
|
3216
3216
|
console.warn(
|
|
3217
|
-
|
|
3217
|
+
pc2.yellow(
|
|
3218
3218
|
`
|
|
3219
|
-
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${
|
|
3219
|
+
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${pc2.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
|
|
3220
3220
|
)
|
|
3221
3221
|
);
|
|
3222
3222
|
}
|
|
3223
3223
|
const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
|
|
3224
3224
|
if (UNSAFE_COLOR_GROUPS.length > 0) {
|
|
3225
3225
|
console.warn(
|
|
3226
|
-
|
|
3226
|
+
pc2.yellow(
|
|
3227
3227
|
`
|
|
3228
|
-
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${
|
|
3228
|
+
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${pc2.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
|
|
3229
3229
|
)
|
|
3230
3230
|
);
|
|
3231
3231
|
}
|
|
@@ -3240,7 +3240,7 @@ async function processPlatform(options) {
|
|
|
3240
3240
|
}
|
|
3241
3241
|
if (buildOptions.defaultColor) {
|
|
3242
3242
|
console.log(`
|
|
3243
|
-
\u{1F3A8} Using ${
|
|
3243
|
+
\u{1F3A8} Using ${pc2.blue(buildOptions.defaultColor)} as default color`);
|
|
3244
3244
|
}
|
|
3245
3245
|
const buildAndSdConfigs = R16.map((buildConfig) => {
|
|
3246
3246
|
const sdConfigs = getConfigsForThemeDimensions(
|
|
@@ -3284,7 +3284,7 @@ async function processPlatform(options) {
|
|
|
3284
3284
|
}
|
|
3285
3285
|
if (sdConfigs.length > 0) {
|
|
3286
3286
|
console.log(`
|
|
3287
|
-
\u{1F371} Building ${
|
|
3287
|
+
\u{1F371} Building ${pc2.green(buildConfig.name ?? buildName)}`);
|
|
3288
3288
|
const results = await Promise.all(
|
|
3289
3289
|
sdConfigs.map(async (sdConfig) => {
|
|
3290
3290
|
const { config, permutation } = sdConfig;
|
|
@@ -3318,10 +3318,10 @@ async function processPlatform(options) {
|
|
|
3318
3318
|
|
|
3319
3319
|
// src/utils.ts
|
|
3320
3320
|
import fs from "fs/promises";
|
|
3321
|
-
import
|
|
3321
|
+
import pc3 from "picocolors";
|
|
3322
3322
|
var mkdir = async (dir, dry) => {
|
|
3323
3323
|
if (dry) {
|
|
3324
|
-
console.log(`${
|
|
3324
|
+
console.log(`${pc3.blue("mkdir")} ${dir}`);
|
|
3325
3325
|
return Promise.resolve();
|
|
3326
3326
|
}
|
|
3327
3327
|
const exists = await fs.access(dir, fs.constants.F_OK).then(() => true).catch(() => false);
|
|
@@ -3332,22 +3332,22 @@ var mkdir = async (dir, dry) => {
|
|
|
3332
3332
|
};
|
|
3333
3333
|
var writeFile = async (path2, data, dry) => {
|
|
3334
3334
|
if (dry) {
|
|
3335
|
-
console.log(`${
|
|
3335
|
+
console.log(`${pc3.blue("writeFile")} ${path2}`);
|
|
3336
3336
|
return Promise.resolve();
|
|
3337
3337
|
}
|
|
3338
3338
|
return fs.writeFile(path2, data, { encoding: "utf-8" }).catch((error) => {
|
|
3339
|
-
console.error(
|
|
3340
|
-
console.error(
|
|
3339
|
+
console.error(pc3.red(`Error writing file: ${path2}`));
|
|
3340
|
+
console.error(pc3.red(error));
|
|
3341
3341
|
throw error;
|
|
3342
3342
|
});
|
|
3343
3343
|
};
|
|
3344
3344
|
var cleanDir = async (dir, dry) => {
|
|
3345
3345
|
if (dry) {
|
|
3346
|
-
console.log(`${
|
|
3346
|
+
console.log(`${pc3.blue("cleanDir")} ${dir}`);
|
|
3347
3347
|
return Promise.resolve();
|
|
3348
3348
|
}
|
|
3349
3349
|
console.log(`
|
|
3350
|
-
\u{1F525} Cleaning dir ${
|
|
3350
|
+
\u{1F525} Cleaning dir ${pc3.red(`${dir.trim()}`)} `);
|
|
3351
3351
|
return fs.rm(dir, { recursive: true, force: true });
|
|
3352
3352
|
};
|
|
3353
3353
|
|
|
@@ -3357,7 +3357,7 @@ async function write(files, outDir, dry) {
|
|
|
3357
3357
|
if (destination) {
|
|
3358
3358
|
const filePath = path.join(outDir, destination);
|
|
3359
3359
|
const fileDir = path.dirname(filePath);
|
|
3360
|
-
console.log(`Writing file: ${
|
|
3360
|
+
console.log(`Writing file: ${pc4.green(filePath)}`);
|
|
3361
3361
|
await mkdir(fileDir, dry);
|
|
3362
3362
|
await writeFile(filePath, output, dry);
|
|
3363
3363
|
}
|
|
@@ -3388,14 +3388,14 @@ var formatTheme = async (themeConfig) => {
|
|
|
3388
3388
|
await cleanDir(outDir, false);
|
|
3389
3389
|
console.log(
|
|
3390
3390
|
buildOptions?.buildTokenFormats ? `
|
|
3391
|
-
\u{1F3D7}\uFE0F Start building preview tokens for ${
|
|
3391
|
+
\u{1F3D7}\uFE0F Start building preview tokens for ${pc4.blue("Designsystemet")}
|
|
3392
3392
|
` : "\n\u{1F6AB} No token formats to build."
|
|
3393
3393
|
);
|
|
3394
3394
|
const tokensGroupedByType = {};
|
|
3395
3395
|
if (buildOptions?.buildTokenFormats) {
|
|
3396
3396
|
for (const [destination, tokenFormats] of Object.entries(buildOptions.buildTokenFormats)) {
|
|
3397
3397
|
if (destination === "typography/secondary.css") continue;
|
|
3398
|
-
console.log(`Processing preview tokens for ${
|
|
3398
|
+
console.log(`Processing preview tokens for ${pc4.green(destination)}`);
|
|
3399
3399
|
const splits = destination.replace(".css", "").split("/");
|
|
3400
3400
|
const [type, name] = splits;
|
|
3401
3401
|
tokensGroupedByType[type] = tokensGroupedByType[type] === void 0 ? {} : tokensGroupedByType[type];
|
|
@@ -3428,7 +3428,7 @@ var formatTheme = async (themeConfig) => {
|
|
|
3428
3428
|
);
|
|
3429
3429
|
}
|
|
3430
3430
|
console.log(`
|
|
3431
|
-
\u2705 Finished building preview tokens for ${
|
|
3431
|
+
\u2705 Finished building preview tokens for ${pc4.blue("Designsystemet")}`);
|
|
3432
3432
|
}
|
|
3433
3433
|
};
|
|
3434
3434
|
formatTheme({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/scripts/update-template.ts
|
|
2
2
|
import path from "path";
|
|
3
|
-
import
|
|
3
|
+
import pc2 from "picocolors";
|
|
4
4
|
import * as R from "ramda";
|
|
5
5
|
|
|
6
6
|
// ../../internal/design-tokens/semantic/color.json
|
|
@@ -1083,10 +1083,10 @@ var digdir_default = {
|
|
|
1083
1083
|
|
|
1084
1084
|
// src/utils.ts
|
|
1085
1085
|
import fs from "fs/promises";
|
|
1086
|
-
import
|
|
1086
|
+
import pc from "picocolors";
|
|
1087
1087
|
var mkdir = async (dir, dry) => {
|
|
1088
1088
|
if (dry) {
|
|
1089
|
-
console.log(`${
|
|
1089
|
+
console.log(`${pc.blue("mkdir")} ${dir}`);
|
|
1090
1090
|
return Promise.resolve();
|
|
1091
1091
|
}
|
|
1092
1092
|
const exists = await fs.access(dir, fs.constants.F_OK).then(() => true).catch(() => false);
|
|
@@ -1097,34 +1097,34 @@ var mkdir = async (dir, dry) => {
|
|
|
1097
1097
|
};
|
|
1098
1098
|
var writeFile = async (path2, data, dry) => {
|
|
1099
1099
|
if (dry) {
|
|
1100
|
-
console.log(`${
|
|
1100
|
+
console.log(`${pc.blue("writeFile")} ${path2}`);
|
|
1101
1101
|
return Promise.resolve();
|
|
1102
1102
|
}
|
|
1103
1103
|
return fs.writeFile(path2, data, { encoding: "utf-8" }).catch((error) => {
|
|
1104
|
-
console.error(
|
|
1105
|
-
console.error(
|
|
1104
|
+
console.error(pc.red(`Error writing file: ${path2}`));
|
|
1105
|
+
console.error(pc.red(error));
|
|
1106
1106
|
throw error;
|
|
1107
1107
|
});
|
|
1108
1108
|
};
|
|
1109
1109
|
var cp = async (src, dest, dry, filter) => {
|
|
1110
1110
|
if (dry) {
|
|
1111
|
-
console.log(`${
|
|
1111
|
+
console.log(`${pc.blue("cp")} ${src} ${dest}`);
|
|
1112
1112
|
return Promise.resolve();
|
|
1113
1113
|
}
|
|
1114
1114
|
return fs.cp(src, dest, { recursive: true, filter });
|
|
1115
1115
|
};
|
|
1116
1116
|
var cleanDir = async (dir, dry) => {
|
|
1117
1117
|
if (dry) {
|
|
1118
|
-
console.log(`${
|
|
1118
|
+
console.log(`${pc.blue("cleanDir")} ${dir}`);
|
|
1119
1119
|
return Promise.resolve();
|
|
1120
1120
|
}
|
|
1121
1121
|
console.log(`
|
|
1122
|
-
\u{1F525} Cleaning dir ${
|
|
1122
|
+
\u{1F525} Cleaning dir ${pc.red(`${dir.trim()}`)} `);
|
|
1123
1123
|
return fs.rm(dir, { recursive: true, force: true });
|
|
1124
1124
|
};
|
|
1125
1125
|
var readFile = async (path2, dry, allowFileNotFound) => {
|
|
1126
1126
|
if (dry) {
|
|
1127
|
-
console.log(`${
|
|
1127
|
+
console.log(`${pc.blue("readFile")} ${path2}`);
|
|
1128
1128
|
return Promise.resolve("");
|
|
1129
1129
|
}
|
|
1130
1130
|
try {
|
|
@@ -1199,7 +1199,7 @@ var updateTemplates = async () => {
|
|
|
1199
1199
|
path.join(TEMPLATE_FILES_PATH, `themes/theme.template.json`),
|
|
1200
1200
|
JSON.stringify(themeColorTemplate, null, 2).replaceAll("digdir.accent", "<theme>.<color>")
|
|
1201
1201
|
);
|
|
1202
|
-
console.log(
|
|
1202
|
+
console.log(pc2.green("Templates updated"));
|
|
1203
1203
|
};
|
|
1204
1204
|
await updateTemplates();
|
|
1205
1205
|
export {
|
package/dist/src/tokens/build.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// src/tokens/build.ts
|
|
2
2
|
import path from "path";
|
|
3
|
-
import
|
|
3
|
+
import pc6 from "picocolors";
|
|
4
4
|
import * as R12 from "ramda";
|
|
5
5
|
|
|
6
6
|
// src/utils.ts
|
|
7
7
|
import fs from "fs/promises";
|
|
8
|
-
import
|
|
8
|
+
import pc from "picocolors";
|
|
9
9
|
var mkdir = async (dir, dry) => {
|
|
10
10
|
if (dry) {
|
|
11
|
-
console.log(`${
|
|
11
|
+
console.log(`${pc.blue("mkdir")} ${dir}`);
|
|
12
12
|
return Promise.resolve();
|
|
13
13
|
}
|
|
14
14
|
const exists = await fs.access(dir, fs.constants.F_OK).then(() => true).catch(() => false);
|
|
@@ -19,18 +19,18 @@ var mkdir = async (dir, dry) => {
|
|
|
19
19
|
};
|
|
20
20
|
var writeFile = async (path2, data, dry) => {
|
|
21
21
|
if (dry) {
|
|
22
|
-
console.log(`${
|
|
22
|
+
console.log(`${pc.blue("writeFile")} ${path2}`);
|
|
23
23
|
return Promise.resolve();
|
|
24
24
|
}
|
|
25
25
|
return fs.writeFile(path2, data, { encoding: "utf-8" }).catch((error) => {
|
|
26
|
-
console.error(
|
|
27
|
-
console.error(
|
|
26
|
+
console.error(pc.red(`Error writing file: ${path2}`));
|
|
27
|
+
console.error(pc.red(error));
|
|
28
28
|
throw error;
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
var readFile = async (path2, dry, allowFileNotFound) => {
|
|
32
32
|
if (dry) {
|
|
33
|
-
console.log(`${
|
|
33
|
+
console.log(`${pc.blue("readFile")} ${path2}`);
|
|
34
34
|
return Promise.resolve("");
|
|
35
35
|
}
|
|
36
36
|
try {
|
|
@@ -44,12 +44,12 @@ var readFile = async (path2, dry, allowFileNotFound) => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
// src/tokens/process/output/declarations.ts
|
|
47
|
-
import
|
|
47
|
+
import pc4 from "picocolors";
|
|
48
48
|
|
|
49
49
|
// package.json
|
|
50
50
|
var package_default = {
|
|
51
51
|
name: "@digdir/designsystemet",
|
|
52
|
-
version: "1.
|
|
52
|
+
version: "1.2.0",
|
|
53
53
|
description: "CLI for Designsystemet",
|
|
54
54
|
author: "Designsystemet team",
|
|
55
55
|
engines: {
|
|
@@ -113,7 +113,6 @@ var package_default = {
|
|
|
113
113
|
"@commander-js/extra-typings": "^14.0.0",
|
|
114
114
|
"@tokens-studio/sd-transforms": "1.3.0",
|
|
115
115
|
"apca-w3": "^0.1.9",
|
|
116
|
-
chalk: "^5.4.1",
|
|
117
116
|
"change-case": "^5.4.4",
|
|
118
117
|
"chroma-js": "^3.1.2",
|
|
119
118
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
@@ -121,10 +120,11 @@ var package_default = {
|
|
|
121
120
|
"fast-glob": "^3.3.3",
|
|
122
121
|
hsluv: "^1.0.1",
|
|
123
122
|
"object-hash": "^3.0.0",
|
|
123
|
+
picocolors: "^1.1.1",
|
|
124
124
|
postcss: "^8.5.6",
|
|
125
125
|
ramda: "^0.31.3",
|
|
126
126
|
"style-dictionary": "^5.0.1",
|
|
127
|
-
zod: "^4.0.
|
|
127
|
+
zod: "^4.0.17",
|
|
128
128
|
"zod-validation-error": "^4.0.1"
|
|
129
129
|
},
|
|
130
130
|
devDependencies: {
|
|
@@ -132,10 +132,10 @@ var package_default = {
|
|
|
132
132
|
"@types/apca-w3": "^0.1.3",
|
|
133
133
|
"@types/chroma-js": "^3.1.1",
|
|
134
134
|
"@types/fs-extra": "^11.0.4",
|
|
135
|
-
"@types/node": "^22.17.
|
|
135
|
+
"@types/node": "^22.17.1",
|
|
136
136
|
"@types/object-hash": "^3.0.6",
|
|
137
137
|
"@types/ramda": "^0.31.0",
|
|
138
|
-
"fs-extra": "^11.3.
|
|
138
|
+
"fs-extra": "^11.3.1",
|
|
139
139
|
tslib: "^2.8.1",
|
|
140
140
|
tsup: "^8.5.0",
|
|
141
141
|
tsx: "^4.20.3",
|
|
@@ -144,7 +144,7 @@ var package_default = {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
// src/tokens/process/platform.ts
|
|
147
|
-
import
|
|
147
|
+
import pc3 from "picocolors";
|
|
148
148
|
import * as R10 from "ramda";
|
|
149
149
|
import StyleDictionary2 from "style-dictionary";
|
|
150
150
|
|
|
@@ -848,8 +848,8 @@ var TypographyValues;
|
|
|
848
848
|
})(TypographyValues || (TypographyValues = {}));
|
|
849
849
|
|
|
850
850
|
// src/tokens/process/utils/getMultidimensionalThemes.ts
|
|
851
|
-
import chalk2 from "chalk";
|
|
852
851
|
import { kebabCase } from "change-case";
|
|
852
|
+
import pc2 from "picocolors";
|
|
853
853
|
import * as R8 from "ramda";
|
|
854
854
|
var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
855
855
|
const verboseLogging = buildOptions?.verbose;
|
|
@@ -859,8 +859,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
|
859
859
|
const keys2 = R8.keys(grouped$themes);
|
|
860
860
|
const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
|
|
861
861
|
if (verboseLogging) {
|
|
862
|
-
console.log(
|
|
863
|
-
console.log(
|
|
862
|
+
console.log(pc2.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
|
|
863
|
+
console.log(pc2.cyan(` (ignoring permutations for ${nonDependentKeys})`));
|
|
864
864
|
}
|
|
865
865
|
return permutations.filter((val) => {
|
|
866
866
|
const filters = nonDependentKeys.map((x) => val.permutation[x] === grouped$themes[x][0].name);
|
|
@@ -1087,18 +1087,18 @@ async function processPlatform(options) {
|
|
|
1087
1087
|
const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
|
|
1088
1088
|
if (UNSAFE_DEFAULT_COLOR) {
|
|
1089
1089
|
console.warn(
|
|
1090
|
-
|
|
1090
|
+
pc3.yellow(
|
|
1091
1091
|
`
|
|
1092
|
-
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${
|
|
1092
|
+
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${pc3.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
|
|
1093
1093
|
)
|
|
1094
1094
|
);
|
|
1095
1095
|
}
|
|
1096
1096
|
const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
|
|
1097
1097
|
if (UNSAFE_COLOR_GROUPS.length > 0) {
|
|
1098
1098
|
console.warn(
|
|
1099
|
-
|
|
1099
|
+
pc3.yellow(
|
|
1100
1100
|
`
|
|
1101
|
-
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${
|
|
1101
|
+
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${pc3.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
|
|
1102
1102
|
)
|
|
1103
1103
|
);
|
|
1104
1104
|
}
|
|
@@ -1113,7 +1113,7 @@ async function processPlatform(options) {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
if (buildOptions.defaultColor) {
|
|
1115
1115
|
console.log(`
|
|
1116
|
-
\u{1F3A8} Using ${
|
|
1116
|
+
\u{1F3A8} Using ${pc3.blue(buildOptions.defaultColor)} as default color`);
|
|
1117
1117
|
}
|
|
1118
1118
|
const buildAndSdConfigs = R10.map((buildConfig) => {
|
|
1119
1119
|
const sdConfigs = getConfigsForThemeDimensions(
|
|
@@ -1157,7 +1157,7 @@ async function processPlatform(options) {
|
|
|
1157
1157
|
}
|
|
1158
1158
|
if (sdConfigs.length > 0) {
|
|
1159
1159
|
console.log(`
|
|
1160
|
-
\u{1F371} Building ${
|
|
1160
|
+
\u{1F371} Building ${pc3.green(buildConfig.name ?? buildName)}`);
|
|
1161
1161
|
const results = await Promise.all(
|
|
1162
1162
|
sdConfigs.map(async (sdConfig) => {
|
|
1163
1163
|
const { config, permutation } = sdConfig;
|
|
@@ -1209,7 +1209,7 @@ ${typeDeclaration}`,
|
|
|
1209
1209
|
};
|
|
1210
1210
|
function createColorTypeDeclaration(colors) {
|
|
1211
1211
|
console.log(`
|
|
1212
|
-
\u{1F371} Building ${
|
|
1212
|
+
\u{1F371} Building ${pc4.green("type declarations")}`);
|
|
1213
1213
|
const typeDeclaration = `
|
|
1214
1214
|
/* ${defaultFileHeader} */
|
|
1215
1215
|
import type {} from '@digdir/designsystemet/types';
|
|
@@ -1288,7 +1288,7 @@ ${dynamicColors}`;
|
|
|
1288
1288
|
};
|
|
1289
1289
|
|
|
1290
1290
|
// src/tokens/process/output/theme.ts
|
|
1291
|
-
import
|
|
1291
|
+
import pc5 from "picocolors";
|
|
1292
1292
|
import * as R11 from "ramda";
|
|
1293
1293
|
var defaultFileHeader2 = `build: v${package_default.version}`;
|
|
1294
1294
|
var createThemeCSSFiles = ({
|
|
@@ -1325,10 +1325,10 @@ var createThemeCSSFiles = ({
|
|
|
1325
1325
|
});
|
|
1326
1326
|
if (sortIndex === -1) {
|
|
1327
1327
|
console.error(
|
|
1328
|
-
|
|
1328
|
+
pc5.yellow(`WARNING: CSS section does not have a defined sort order: ${filePath.replace(".css", "")}`)
|
|
1329
1329
|
);
|
|
1330
1330
|
console.log(
|
|
1331
|
-
|
|
1331
|
+
pc5.dim(
|
|
1332
1332
|
`
|
|
1333
1333
|
The section will currently be added to the end of the entry file, but the exact
|
|
1334
1334
|
order may change due to nondeterminism.`.trim()
|
|
@@ -1384,7 +1384,7 @@ var buildTokens = async (options) => {
|
|
|
1384
1384
|
} catch (_error) {
|
|
1385
1385
|
}
|
|
1386
1386
|
console.log(`
|
|
1387
|
-
\u{1F3D7}\uFE0F Start building tokens in ${
|
|
1387
|
+
\u{1F3D7}\uFE0F Start building tokens in ${pc6.green(tokensDir)}`);
|
|
1388
1388
|
const processedBuilds = await processPlatform({
|
|
1389
1389
|
...options,
|
|
1390
1390
|
outDir,
|
|
@@ -1407,7 +1407,7 @@ design-tokens: v${$designsystemet.version}` : ""
|
|
|
1407
1407
|
files = files.concat(tailwindFiles.filter(Boolean));
|
|
1408
1408
|
}
|
|
1409
1409
|
console.log(`
|
|
1410
|
-
\u{1F4BE} Writing build to ${
|
|
1410
|
+
\u{1F4BE} Writing build to ${pc6.green(outDir)}`);
|
|
1411
1411
|
await write(files, outDir, options.dry);
|
|
1412
1412
|
console.log(`
|
|
1413
1413
|
\u2705 Finished building tokens!`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@digdir/designsystemet",
|
|
4
|
-
version: "1.
|
|
4
|
+
version: "1.2.0",
|
|
5
5
|
description: "CLI for Designsystemet",
|
|
6
6
|
author: "Designsystemet team",
|
|
7
7
|
engines: {
|
|
@@ -65,7 +65,6 @@ var package_default = {
|
|
|
65
65
|
"@commander-js/extra-typings": "^14.0.0",
|
|
66
66
|
"@tokens-studio/sd-transforms": "1.3.0",
|
|
67
67
|
"apca-w3": "^0.1.9",
|
|
68
|
-
chalk: "^5.4.1",
|
|
69
68
|
"change-case": "^5.4.4",
|
|
70
69
|
"chroma-js": "^3.1.2",
|
|
71
70
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
@@ -73,10 +72,11 @@ var package_default = {
|
|
|
73
72
|
"fast-glob": "^3.3.3",
|
|
74
73
|
hsluv: "^1.0.1",
|
|
75
74
|
"object-hash": "^3.0.0",
|
|
75
|
+
picocolors: "^1.1.1",
|
|
76
76
|
postcss: "^8.5.6",
|
|
77
77
|
ramda: "^0.31.3",
|
|
78
78
|
"style-dictionary": "^5.0.1",
|
|
79
|
-
zod: "^4.0.
|
|
79
|
+
zod: "^4.0.17",
|
|
80
80
|
"zod-validation-error": "^4.0.1"
|
|
81
81
|
},
|
|
82
82
|
devDependencies: {
|
|
@@ -84,10 +84,10 @@ var package_default = {
|
|
|
84
84
|
"@types/apca-w3": "^0.1.3",
|
|
85
85
|
"@types/chroma-js": "^3.1.1",
|
|
86
86
|
"@types/fs-extra": "^11.0.4",
|
|
87
|
-
"@types/node": "^22.17.
|
|
87
|
+
"@types/node": "^22.17.1",
|
|
88
88
|
"@types/object-hash": "^3.0.6",
|
|
89
89
|
"@types/ramda": "^0.31.0",
|
|
90
|
-
"fs-extra": "^11.3.
|
|
90
|
+
"fs-extra": "^11.3.1",
|
|
91
91
|
tslib: "^2.8.1",
|
|
92
92
|
tsup: "^8.5.0",
|
|
93
93
|
tsx: "^4.20.3",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../src/tokens/create/write.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKpD,eAAO,MAAM,SAAS,GAAI,MAAM,OAAO,WAAkC,CAAC;AAE1E,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,SAAS,kBAAkB,
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../src/tokens/create/write.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKpD,eAAO,MAAM,SAAS,GAAI,MAAM,OAAO,WAAkC,CAAC;AAE1E,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,SAAS,kBAAkB,kBAsD5D,CAAC"}
|