@digdir/designsystemet 1.1.0 → 1.1.2
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.d.ts +3 -3
- package/dist/bin/config.d.ts.map +1 -1
- package/dist/bin/config.js +26 -27
- package/dist/bin/designsystemet.js +393 -376
- package/dist/config.schema.json +4 -4
- package/dist/src/config.d.ts +6 -21
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +24 -22
- package/dist/src/index.js +34 -46
- package/dist/src/scripts/createJsonSchema.js +5 -6
- package/dist/src/tokens/build.d.ts +1 -1
- package/dist/src/tokens/build.d.ts.map +1 -1
- package/dist/src/tokens/build.js +349 -331
- package/dist/src/tokens/create/generators/$designsystemet.js +9 -7
- package/dist/src/tokens/create/write.js +9 -7
- package/dist/src/tokens/format.d.ts.map +1 -1
- package/dist/src/tokens/format.js +34 -46
- package/dist/src/tokens/index.js +34 -46
- package/dist/src/tokens/process/output/declarations.d.ts +4 -0
- package/dist/src/tokens/process/output/declarations.d.ts.map +1 -0
- package/dist/src/tokens/process/output/declarations.js +860 -0
- package/dist/src/tokens/process/output/theme.js +10 -8
- package/dist/src/tokens/process/platform.d.ts +5 -3
- package/dist/src/tokens/process/platform.d.ts.map +1 -1
- package/dist/src/tokens/process/platform.js +22 -51
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts +1 -0
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts.map +1 -1
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +7 -0
- package/package.json +9 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@digdir/designsystemet",
|
|
4
|
-
version: "1.1.
|
|
4
|
+
version: "1.1.2",
|
|
5
5
|
description: "CLI for Designsystemet",
|
|
6
6
|
author: "Designsystemet team",
|
|
7
7
|
engines: {
|
|
@@ -36,6 +36,7 @@ var package_default = {
|
|
|
36
36
|
},
|
|
37
37
|
scripts: {
|
|
38
38
|
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
39
|
+
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
39
40
|
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
40
41
|
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
41
42
|
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
@@ -45,6 +46,7 @@ var package_default = {
|
|
|
45
46
|
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
46
47
|
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
47
48
|
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
49
|
+
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
48
50
|
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
49
51
|
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
50
52
|
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
@@ -63,15 +65,15 @@ var package_default = {
|
|
|
63
65
|
"change-case": "^5.4.4",
|
|
64
66
|
"chroma-js": "^3.1.2",
|
|
65
67
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
66
|
-
commander: "^
|
|
68
|
+
commander: "^14.0.0",
|
|
67
69
|
"fast-glob": "^3.3.3",
|
|
68
70
|
hsluv: "^1.0.1",
|
|
69
71
|
"object-hash": "^3.0.0",
|
|
70
|
-
postcss: "^8.5.
|
|
72
|
+
postcss: "^8.5.6",
|
|
71
73
|
ramda: "^0.30.1",
|
|
72
|
-
"style-dictionary": "^
|
|
73
|
-
zod: "^3.25.
|
|
74
|
-
"zod-validation-error": "^3.5.
|
|
74
|
+
"style-dictionary": "^5.0.0",
|
|
75
|
+
zod: "^3.25.67",
|
|
76
|
+
"zod-validation-error": "^3.5.2"
|
|
75
77
|
},
|
|
76
78
|
devDependencies: {
|
|
77
79
|
"@tokens-studio/types": "0.5.2",
|
|
@@ -79,7 +81,7 @@ var package_default = {
|
|
|
79
81
|
"@types/chroma-js": "^3.1.1",
|
|
80
82
|
"@types/fs-extra": "^11.0.4",
|
|
81
83
|
"@types/glob": "^8.1.0",
|
|
82
|
-
"@types/node": "^22.15.
|
|
84
|
+
"@types/node": "^22.15.32",
|
|
83
85
|
"@types/object-hash": "^3.0.6",
|
|
84
86
|
"@types/ramda": "^0.30.2",
|
|
85
87
|
"fs-extra": "^11.3.0",
|
|
@@ -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.1.
|
|
49
|
+
version: "1.1.2",
|
|
50
50
|
description: "CLI for Designsystemet",
|
|
51
51
|
author: "Designsystemet team",
|
|
52
52
|
engines: {
|
|
@@ -81,6 +81,7 @@ var package_default = {
|
|
|
81
81
|
},
|
|
82
82
|
scripts: {
|
|
83
83
|
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
84
|
+
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
84
85
|
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
85
86
|
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
86
87
|
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
@@ -90,6 +91,7 @@ var package_default = {
|
|
|
90
91
|
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
91
92
|
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
92
93
|
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
94
|
+
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
93
95
|
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
94
96
|
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
95
97
|
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
@@ -108,15 +110,15 @@ var package_default = {
|
|
|
108
110
|
"change-case": "^5.4.4",
|
|
109
111
|
"chroma-js": "^3.1.2",
|
|
110
112
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
111
|
-
commander: "^
|
|
113
|
+
commander: "^14.0.0",
|
|
112
114
|
"fast-glob": "^3.3.3",
|
|
113
115
|
hsluv: "^1.0.1",
|
|
114
116
|
"object-hash": "^3.0.0",
|
|
115
|
-
postcss: "^8.5.
|
|
117
|
+
postcss: "^8.5.6",
|
|
116
118
|
ramda: "^0.30.1",
|
|
117
|
-
"style-dictionary": "^
|
|
118
|
-
zod: "^3.25.
|
|
119
|
-
"zod-validation-error": "^3.5.
|
|
119
|
+
"style-dictionary": "^5.0.0",
|
|
120
|
+
zod: "^3.25.67",
|
|
121
|
+
"zod-validation-error": "^3.5.2"
|
|
120
122
|
},
|
|
121
123
|
devDependencies: {
|
|
122
124
|
"@tokens-studio/types": "0.5.2",
|
|
@@ -124,7 +126,7 @@ var package_default = {
|
|
|
124
126
|
"@types/chroma-js": "^3.1.1",
|
|
125
127
|
"@types/fs-extra": "^11.0.4",
|
|
126
128
|
"@types/glob": "^8.1.0",
|
|
127
|
-
"@types/node": "^22.15.
|
|
129
|
+
"@types/node": "^22.15.32",
|
|
128
130
|
"@types/object-hash": "^3.0.6",
|
|
129
131
|
"@types/ramda": "^0.30.2",
|
|
130
132
|
"fs-extra": "^11.3.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tokens/format.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,uBAAuB,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;AAE5E,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,2DAcnD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAU,aAAa,KAAK,oBAItD,CAAC"}
|
|
@@ -2413,7 +2413,7 @@ import * as R7 from "ramda";
|
|
|
2413
2413
|
// package.json
|
|
2414
2414
|
var package_default = {
|
|
2415
2415
|
name: "@digdir/designsystemet",
|
|
2416
|
-
version: "1.1.
|
|
2416
|
+
version: "1.1.2",
|
|
2417
2417
|
description: "CLI for Designsystemet",
|
|
2418
2418
|
author: "Designsystemet team",
|
|
2419
2419
|
engines: {
|
|
@@ -2448,6 +2448,7 @@ var package_default = {
|
|
|
2448
2448
|
},
|
|
2449
2449
|
scripts: {
|
|
2450
2450
|
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
2451
|
+
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
2451
2452
|
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
2452
2453
|
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
2453
2454
|
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
@@ -2457,6 +2458,7 @@ var package_default = {
|
|
|
2457
2458
|
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
2458
2459
|
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
2459
2460
|
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
2461
|
+
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
2460
2462
|
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
2461
2463
|
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
2462
2464
|
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
@@ -2475,15 +2477,15 @@ var package_default = {
|
|
|
2475
2477
|
"change-case": "^5.4.4",
|
|
2476
2478
|
"chroma-js": "^3.1.2",
|
|
2477
2479
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
2478
|
-
commander: "^
|
|
2480
|
+
commander: "^14.0.0",
|
|
2479
2481
|
"fast-glob": "^3.3.3",
|
|
2480
2482
|
hsluv: "^1.0.1",
|
|
2481
2483
|
"object-hash": "^3.0.0",
|
|
2482
|
-
postcss: "^8.5.
|
|
2484
|
+
postcss: "^8.5.6",
|
|
2483
2485
|
ramda: "^0.30.1",
|
|
2484
|
-
"style-dictionary": "^
|
|
2485
|
-
zod: "^3.25.
|
|
2486
|
-
"zod-validation-error": "^3.5.
|
|
2486
|
+
"style-dictionary": "^5.0.0",
|
|
2487
|
+
zod: "^3.25.67",
|
|
2488
|
+
"zod-validation-error": "^3.5.2"
|
|
2487
2489
|
},
|
|
2488
2490
|
devDependencies: {
|
|
2489
2491
|
"@tokens-studio/types": "0.5.2",
|
|
@@ -2491,7 +2493,7 @@ var package_default = {
|
|
|
2491
2493
|
"@types/chroma-js": "^3.1.1",
|
|
2492
2494
|
"@types/fs-extra": "^11.0.4",
|
|
2493
2495
|
"@types/glob": "^8.1.0",
|
|
2494
|
-
"@types/node": "^22.15.
|
|
2496
|
+
"@types/node": "^22.15.32",
|
|
2495
2497
|
"@types/object-hash": "^3.0.6",
|
|
2496
2498
|
"@types/ramda": "^0.30.2",
|
|
2497
2499
|
"fs-extra": "^11.3.0",
|
|
@@ -2509,7 +2511,7 @@ var createThemeCSSFiles = ({
|
|
|
2509
2511
|
fileHeader: fileHeader2 = defaultFileHeader
|
|
2510
2512
|
}) => {
|
|
2511
2513
|
const groupedByTheme = {};
|
|
2512
|
-
for (const [_, buildResults] of Object.entries(
|
|
2514
|
+
for (const [_, buildResults] of Object.entries(processedBuilds)) {
|
|
2513
2515
|
for (const buildResult of buildResults) {
|
|
2514
2516
|
const themeName = buildResult.permutation.theme;
|
|
2515
2517
|
const newOutputs = buildResult.formatted;
|
|
@@ -3276,6 +3278,12 @@ function filterTokenSets(tokensets) {
|
|
|
3276
3278
|
function cartesian(a) {
|
|
3277
3279
|
return a.reduce((a2, b) => a2.flatMap((d) => b.map((e) => [d, e].flat())));
|
|
3278
3280
|
}
|
|
3281
|
+
var getCustomColors = (processed$themes, colorGroups) => processed$themes.filter((x) => {
|
|
3282
|
+
if (!x.group) {
|
|
3283
|
+
return false;
|
|
3284
|
+
}
|
|
3285
|
+
return colorGroups.includes(x.group);
|
|
3286
|
+
}).map((x) => x.name);
|
|
3279
3287
|
|
|
3280
3288
|
// src/tokens/process/configs.ts
|
|
3281
3289
|
void register(StyleDictionary, { withSDBuiltins: false });
|
|
@@ -3358,12 +3366,6 @@ var initResult = {
|
|
|
3358
3366
|
};
|
|
3359
3367
|
var buildOptions;
|
|
3360
3368
|
var sd = new StyleDictionary2();
|
|
3361
|
-
var getCustomColors = (processed$themes, colorGroups) => processed$themes.filter((x) => {
|
|
3362
|
-
if (!x.group) {
|
|
3363
|
-
return false;
|
|
3364
|
-
}
|
|
3365
|
-
return colorGroups.includes(x.group);
|
|
3366
|
-
}).map((x) => x.name);
|
|
3367
3369
|
var buildConfigs = {
|
|
3368
3370
|
typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
|
|
3369
3371
|
"color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
|
|
@@ -3404,7 +3406,7 @@ var buildConfigs = {
|
|
|
3404
3406
|
// },
|
|
3405
3407
|
};
|
|
3406
3408
|
async function processPlatform(options) {
|
|
3407
|
-
const { type, $themes } = options;
|
|
3409
|
+
const { type, processed$themes } = options;
|
|
3408
3410
|
const platform = "css";
|
|
3409
3411
|
const tokenSets = type === "format" ? options.tokenSets : void 0;
|
|
3410
3412
|
const tokensDir = type === "build" ? options.tokensDir : void 0;
|
|
@@ -3429,8 +3431,11 @@ async function processPlatform(options) {
|
|
|
3429
3431
|
const colorGroups = UNSAFE_COLOR_GROUPS.length > 0 ? UNSAFE_COLOR_GROUPS : [colorCategories.main, colorCategories.support].map((c) => `${c}-color`);
|
|
3430
3432
|
buildOptions = options;
|
|
3431
3433
|
buildOptions.defaultColor = UNSAFE_DEFAULT_COLOR;
|
|
3432
|
-
|
|
3433
|
-
const
|
|
3434
|
+
buildOptions.colorGroups = colorGroups;
|
|
3435
|
+
const filteredProcessed$themes = processed$themes.filter(
|
|
3436
|
+
(theme) => R19.not(theme.group === "size" && theme.name !== "medium")
|
|
3437
|
+
);
|
|
3438
|
+
const customColors = getCustomColors(filteredProcessed$themes, colorGroups);
|
|
3434
3439
|
if (!buildOptions.defaultColor) {
|
|
3435
3440
|
const firstMainColor = R19.head(customColors);
|
|
3436
3441
|
buildOptions.defaultColor = firstMainColor;
|
|
@@ -3440,10 +3445,15 @@ async function processPlatform(options) {
|
|
|
3440
3445
|
\u{1F3A8} Using ${chalk3.blue(buildOptions.defaultColor)} as default color`);
|
|
3441
3446
|
}
|
|
3442
3447
|
const buildAndSdConfigs = R19.map((buildConfig) => {
|
|
3443
|
-
const sdConfigs = getConfigsForThemeDimensions(
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3448
|
+
const sdConfigs = getConfigsForThemeDimensions(
|
|
3449
|
+
buildConfig.getConfig,
|
|
3450
|
+
filteredProcessed$themes,
|
|
3451
|
+
buildConfig.dimensions,
|
|
3452
|
+
{
|
|
3453
|
+
tokensDir,
|
|
3454
|
+
tokenSets
|
|
3455
|
+
}
|
|
3456
|
+
);
|
|
3447
3457
|
const unknownConfigs = buildConfig.dimensions.map(
|
|
3448
3458
|
(dimension) => sdConfigs.filter((x) => x.permutation[dimension] === "unknown")
|
|
3449
3459
|
);
|
|
@@ -3467,8 +3477,7 @@ async function processPlatform(options) {
|
|
|
3467
3477
|
"warning-color": [initResult],
|
|
3468
3478
|
"info-color": [initResult],
|
|
3469
3479
|
semantic: [initResult],
|
|
3470
|
-
typography: [initResult]
|
|
3471
|
-
types: [initResult]
|
|
3480
|
+
typography: [initResult]
|
|
3472
3481
|
};
|
|
3473
3482
|
try {
|
|
3474
3483
|
for (const [buildName, { buildConfig, sdConfigs }] of R19.toPairs(buildAndSdConfigs)) {
|
|
@@ -3503,30 +3512,8 @@ async function processPlatform(options) {
|
|
|
3503
3512
|
}
|
|
3504
3513
|
throw err;
|
|
3505
3514
|
}
|
|
3506
|
-
const colorsFileName = "colors.d.ts";
|
|
3507
|
-
const reactColorTypes = await createColorTypeDeclaration(customColors);
|
|
3508
|
-
processedBuilds.types = [
|
|
3509
|
-
{
|
|
3510
|
-
...initResult,
|
|
3511
|
-
formatted: [{ output: reactColorTypes, destination: colorsFileName }]
|
|
3512
|
-
}
|
|
3513
|
-
];
|
|
3514
3515
|
return processedBuilds;
|
|
3515
3516
|
}
|
|
3516
|
-
async function createColorTypeDeclaration(colors) {
|
|
3517
|
-
console.log(`
|
|
3518
|
-
\u{1F371} Building ${chalk3.green("type declarations")}`);
|
|
3519
|
-
const typeDeclaration = `
|
|
3520
|
-
import type {} from '@digdir/designsystemet-react/colors';
|
|
3521
|
-
|
|
3522
|
-
declare module '@digdir/designsystemet-react/colors' {
|
|
3523
|
-
export interface MainAndSupportColors {
|
|
3524
|
-
${colors.map((color) => ` ${color}: never;`).join("\n")}
|
|
3525
|
-
}
|
|
3526
|
-
}
|
|
3527
|
-
`.trimStart();
|
|
3528
|
-
return typeDeclaration;
|
|
3529
|
-
}
|
|
3530
3517
|
|
|
3531
3518
|
// src/tokens/format.ts
|
|
3532
3519
|
var formatTokens = async (options) => {
|
|
@@ -3539,9 +3526,10 @@ var formatTokens = async (options) => {
|
|
|
3539
3526
|
var formatTheme = async (themeConfig) => {
|
|
3540
3527
|
const { tokenSets } = await createTokens(themeConfig);
|
|
3541
3528
|
const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors);
|
|
3529
|
+
const processed$themes = $themes.map(processThemeObject);
|
|
3542
3530
|
const processedBuilds = await formatTokens({
|
|
3543
3531
|
tokenSets,
|
|
3544
|
-
$themes,
|
|
3532
|
+
processed$themes,
|
|
3545
3533
|
verbose: false,
|
|
3546
3534
|
preview: false
|
|
3547
3535
|
});
|
package/dist/src/tokens/index.js
CHANGED
|
@@ -2429,7 +2429,7 @@ import * as R7 from "ramda";
|
|
|
2429
2429
|
// package.json
|
|
2430
2430
|
var package_default = {
|
|
2431
2431
|
name: "@digdir/designsystemet",
|
|
2432
|
-
version: "1.1.
|
|
2432
|
+
version: "1.1.2",
|
|
2433
2433
|
description: "CLI for Designsystemet",
|
|
2434
2434
|
author: "Designsystemet team",
|
|
2435
2435
|
engines: {
|
|
@@ -2464,6 +2464,7 @@ var package_default = {
|
|
|
2464
2464
|
},
|
|
2465
2465
|
scripts: {
|
|
2466
2466
|
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
2467
|
+
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
2467
2468
|
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
2468
2469
|
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
2469
2470
|
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
@@ -2473,6 +2474,7 @@ var package_default = {
|
|
|
2473
2474
|
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
2474
2475
|
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
2475
2476
|
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
2477
|
+
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
2476
2478
|
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
2477
2479
|
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
2478
2480
|
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
@@ -2491,15 +2493,15 @@ var package_default = {
|
|
|
2491
2493
|
"change-case": "^5.4.4",
|
|
2492
2494
|
"chroma-js": "^3.1.2",
|
|
2493
2495
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
2494
|
-
commander: "^
|
|
2496
|
+
commander: "^14.0.0",
|
|
2495
2497
|
"fast-glob": "^3.3.3",
|
|
2496
2498
|
hsluv: "^1.0.1",
|
|
2497
2499
|
"object-hash": "^3.0.0",
|
|
2498
|
-
postcss: "^8.5.
|
|
2500
|
+
postcss: "^8.5.6",
|
|
2499
2501
|
ramda: "^0.30.1",
|
|
2500
|
-
"style-dictionary": "^
|
|
2501
|
-
zod: "^3.25.
|
|
2502
|
-
"zod-validation-error": "^3.5.
|
|
2502
|
+
"style-dictionary": "^5.0.0",
|
|
2503
|
+
zod: "^3.25.67",
|
|
2504
|
+
"zod-validation-error": "^3.5.2"
|
|
2503
2505
|
},
|
|
2504
2506
|
devDependencies: {
|
|
2505
2507
|
"@tokens-studio/types": "0.5.2",
|
|
@@ -2507,7 +2509,7 @@ var package_default = {
|
|
|
2507
2509
|
"@types/chroma-js": "^3.1.1",
|
|
2508
2510
|
"@types/fs-extra": "^11.0.4",
|
|
2509
2511
|
"@types/glob": "^8.1.0",
|
|
2510
|
-
"@types/node": "^22.15.
|
|
2512
|
+
"@types/node": "^22.15.32",
|
|
2511
2513
|
"@types/object-hash": "^3.0.6",
|
|
2512
2514
|
"@types/ramda": "^0.30.2",
|
|
2513
2515
|
"fs-extra": "^11.3.0",
|
|
@@ -2525,7 +2527,7 @@ var createThemeCSSFiles = ({
|
|
|
2525
2527
|
fileHeader: fileHeader2 = defaultFileHeader
|
|
2526
2528
|
}) => {
|
|
2527
2529
|
const groupedByTheme = {};
|
|
2528
|
-
for (const [_, buildResults] of Object.entries(
|
|
2530
|
+
for (const [_, buildResults] of Object.entries(processedBuilds)) {
|
|
2529
2531
|
for (const buildResult of buildResults) {
|
|
2530
2532
|
const themeName = buildResult.permutation.theme;
|
|
2531
2533
|
const newOutputs = buildResult.formatted;
|
|
@@ -3292,6 +3294,12 @@ function filterTokenSets(tokensets) {
|
|
|
3292
3294
|
function cartesian(a) {
|
|
3293
3295
|
return a.reduce((a2, b) => a2.flatMap((d) => b.map((e) => [d, e].flat())));
|
|
3294
3296
|
}
|
|
3297
|
+
var getCustomColors = (processed$themes, colorGroups) => processed$themes.filter((x) => {
|
|
3298
|
+
if (!x.group) {
|
|
3299
|
+
return false;
|
|
3300
|
+
}
|
|
3301
|
+
return colorGroups.includes(x.group);
|
|
3302
|
+
}).map((x) => x.name);
|
|
3295
3303
|
|
|
3296
3304
|
// src/tokens/process/configs.ts
|
|
3297
3305
|
void register(StyleDictionary, { withSDBuiltins: false });
|
|
@@ -3374,12 +3382,6 @@ var initResult = {
|
|
|
3374
3382
|
};
|
|
3375
3383
|
var buildOptions;
|
|
3376
3384
|
var sd = new StyleDictionary2();
|
|
3377
|
-
var getCustomColors = (processed$themes, colorGroups) => processed$themes.filter((x) => {
|
|
3378
|
-
if (!x.group) {
|
|
3379
|
-
return false;
|
|
3380
|
-
}
|
|
3381
|
-
return colorGroups.includes(x.group);
|
|
3382
|
-
}).map((x) => x.name);
|
|
3383
3385
|
var buildConfigs = {
|
|
3384
3386
|
typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
|
|
3385
3387
|
"color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
|
|
@@ -3420,7 +3422,7 @@ var buildConfigs = {
|
|
|
3420
3422
|
// },
|
|
3421
3423
|
};
|
|
3422
3424
|
async function processPlatform(options) {
|
|
3423
|
-
const { type, $themes } = options;
|
|
3425
|
+
const { type, processed$themes } = options;
|
|
3424
3426
|
const platform = "css";
|
|
3425
3427
|
const tokenSets = type === "format" ? options.tokenSets : void 0;
|
|
3426
3428
|
const tokensDir = type === "build" ? options.tokensDir : void 0;
|
|
@@ -3445,8 +3447,11 @@ async function processPlatform(options) {
|
|
|
3445
3447
|
const colorGroups = UNSAFE_COLOR_GROUPS.length > 0 ? UNSAFE_COLOR_GROUPS : [colorCategories.main, colorCategories.support].map((c) => `${c}-color`);
|
|
3446
3448
|
buildOptions = options;
|
|
3447
3449
|
buildOptions.defaultColor = UNSAFE_DEFAULT_COLOR;
|
|
3448
|
-
|
|
3449
|
-
const
|
|
3450
|
+
buildOptions.colorGroups = colorGroups;
|
|
3451
|
+
const filteredProcessed$themes = processed$themes.filter(
|
|
3452
|
+
(theme) => R19.not(theme.group === "size" && theme.name !== "medium")
|
|
3453
|
+
);
|
|
3454
|
+
const customColors = getCustomColors(filteredProcessed$themes, colorGroups);
|
|
3450
3455
|
if (!buildOptions.defaultColor) {
|
|
3451
3456
|
const firstMainColor = R19.head(customColors);
|
|
3452
3457
|
buildOptions.defaultColor = firstMainColor;
|
|
@@ -3456,10 +3461,15 @@ async function processPlatform(options) {
|
|
|
3456
3461
|
\u{1F3A8} Using ${chalk3.blue(buildOptions.defaultColor)} as default color`);
|
|
3457
3462
|
}
|
|
3458
3463
|
const buildAndSdConfigs = R19.map((buildConfig) => {
|
|
3459
|
-
const sdConfigs = getConfigsForThemeDimensions(
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3464
|
+
const sdConfigs = getConfigsForThemeDimensions(
|
|
3465
|
+
buildConfig.getConfig,
|
|
3466
|
+
filteredProcessed$themes,
|
|
3467
|
+
buildConfig.dimensions,
|
|
3468
|
+
{
|
|
3469
|
+
tokensDir,
|
|
3470
|
+
tokenSets
|
|
3471
|
+
}
|
|
3472
|
+
);
|
|
3463
3473
|
const unknownConfigs = buildConfig.dimensions.map(
|
|
3464
3474
|
(dimension) => sdConfigs.filter((x) => x.permutation[dimension] === "unknown")
|
|
3465
3475
|
);
|
|
@@ -3483,8 +3493,7 @@ async function processPlatform(options) {
|
|
|
3483
3493
|
"warning-color": [initResult],
|
|
3484
3494
|
"info-color": [initResult],
|
|
3485
3495
|
semantic: [initResult],
|
|
3486
|
-
typography: [initResult]
|
|
3487
|
-
types: [initResult]
|
|
3496
|
+
typography: [initResult]
|
|
3488
3497
|
};
|
|
3489
3498
|
try {
|
|
3490
3499
|
for (const [buildName, { buildConfig, sdConfigs }] of R19.toPairs(buildAndSdConfigs)) {
|
|
@@ -3519,30 +3528,8 @@ async function processPlatform(options) {
|
|
|
3519
3528
|
}
|
|
3520
3529
|
throw err;
|
|
3521
3530
|
}
|
|
3522
|
-
const colorsFileName = "colors.d.ts";
|
|
3523
|
-
const reactColorTypes = await createColorTypeDeclaration(customColors);
|
|
3524
|
-
processedBuilds.types = [
|
|
3525
|
-
{
|
|
3526
|
-
...initResult,
|
|
3527
|
-
formatted: [{ output: reactColorTypes, destination: colorsFileName }]
|
|
3528
|
-
}
|
|
3529
|
-
];
|
|
3530
3531
|
return processedBuilds;
|
|
3531
3532
|
}
|
|
3532
|
-
async function createColorTypeDeclaration(colors) {
|
|
3533
|
-
console.log(`
|
|
3534
|
-
\u{1F371} Building ${chalk3.green("type declarations")}`);
|
|
3535
|
-
const typeDeclaration = `
|
|
3536
|
-
import type {} from '@digdir/designsystemet-react/colors';
|
|
3537
|
-
|
|
3538
|
-
declare module '@digdir/designsystemet-react/colors' {
|
|
3539
|
-
export interface MainAndSupportColors {
|
|
3540
|
-
${colors.map((color) => ` ${color}: never;`).join("\n")}
|
|
3541
|
-
}
|
|
3542
|
-
}
|
|
3543
|
-
`.trimStart();
|
|
3544
|
-
return typeDeclaration;
|
|
3545
|
-
}
|
|
3546
3533
|
|
|
3547
3534
|
// src/tokens/format.ts
|
|
3548
3535
|
var formatTokens = async (options) => {
|
|
@@ -3555,9 +3542,10 @@ var formatTokens = async (options) => {
|
|
|
3555
3542
|
var formatTheme = async (themeConfig) => {
|
|
3556
3543
|
const { tokenSets } = await createTokens(themeConfig);
|
|
3557
3544
|
const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors);
|
|
3545
|
+
const processed$themes = $themes.map(processThemeObject);
|
|
3558
3546
|
const processedBuilds = await formatTokens({
|
|
3559
3547
|
tokenSets,
|
|
3560
|
-
$themes,
|
|
3548
|
+
processed$themes,
|
|
3561
3549
|
verbose: false,
|
|
3562
3550
|
preview: false
|
|
3563
3551
|
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OutputFile } from '../../types.js';
|
|
2
|
+
import { type ProcessedThemeObject } from '../utils/getMultidimensionalThemes.js';
|
|
3
|
+
export declare const createTypeDeclarationFiles: (processed$themes: ProcessedThemeObject[]) => OutputFile[];
|
|
4
|
+
//# sourceMappingURL=declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/output/declarations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAEnG,eAAO,MAAM,0BAA0B,GAAI,kBAAkB,oBAAoB,EAAE,KAAG,UAAU,EAW/F,CAAC"}
|