@digdir/designsystemet 1.1.5 → 1.1.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.
- package/dist/bin/designsystemet.js +119 -104
- package/dist/src/index.js +7 -4
- package/dist/src/scripts/update-preview-tokens.js +4 -4
- package/dist/src/tokens/build.js +119 -104
- package/dist/src/tokens/create/generators/$designsystemet.js +7 -4
- package/dist/src/tokens/create/write.js +7 -4
- package/dist/src/tokens/format.js +7 -4
- package/dist/src/tokens/index.js +7 -4
- package/dist/src/tokens/process/output/declarations.d.ts +1 -0
- package/dist/src/tokens/process/output/declarations.d.ts.map +1 -1
- package/dist/src/tokens/process/output/declarations.js +118 -6
- package/dist/src/tokens/process/output/theme.js +7 -4
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +0 -0
- package/package.json +7 -4
|
@@ -867,6 +867,103 @@ import * as R16 from "ramda";
|
|
|
867
867
|
// src/tokens/process/output/declarations.ts
|
|
868
868
|
import chalk5 from "chalk";
|
|
869
869
|
|
|
870
|
+
// package.json
|
|
871
|
+
var package_default = {
|
|
872
|
+
name: "@digdir/designsystemet",
|
|
873
|
+
version: "1.1.7",
|
|
874
|
+
description: "CLI for Designsystemet",
|
|
875
|
+
author: "Designsystemet team",
|
|
876
|
+
engines: {
|
|
877
|
+
node: ">=22.17.0"
|
|
878
|
+
},
|
|
879
|
+
repository: {
|
|
880
|
+
type: "git",
|
|
881
|
+
url: "git+https://github.com/digdir/designsystemet.git"
|
|
882
|
+
},
|
|
883
|
+
homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
|
|
884
|
+
license: "MIT",
|
|
885
|
+
type: "module",
|
|
886
|
+
main: "./dist/src/index.js",
|
|
887
|
+
files: [
|
|
888
|
+
"./dist/**",
|
|
889
|
+
"./configs/**"
|
|
890
|
+
],
|
|
891
|
+
bin: "dist/bin/designsystemet.js",
|
|
892
|
+
exports: {
|
|
893
|
+
".": {
|
|
894
|
+
import: "./dist/src/index.js"
|
|
895
|
+
},
|
|
896
|
+
"./color": {
|
|
897
|
+
import: "./dist/src/colors/index.js"
|
|
898
|
+
},
|
|
899
|
+
"./tokens": {
|
|
900
|
+
import: "./dist/src/tokens/index.js"
|
|
901
|
+
},
|
|
902
|
+
"./types": {
|
|
903
|
+
import: "./dist/src/types.js"
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
publishConfig: {
|
|
907
|
+
access: "public"
|
|
908
|
+
},
|
|
909
|
+
scripts: {
|
|
910
|
+
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
911
|
+
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
912
|
+
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
913
|
+
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
914
|
+
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
915
|
+
types: "tsc --noEmit",
|
|
916
|
+
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
|
|
917
|
+
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
918
|
+
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
919
|
+
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
920
|
+
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
921
|
+
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
922
|
+
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
923
|
+
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
924
|
+
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
925
|
+
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
926
|
+
"digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
|
|
927
|
+
"digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
|
|
928
|
+
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
929
|
+
"update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
|
|
930
|
+
"update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
|
|
931
|
+
verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
|
|
932
|
+
},
|
|
933
|
+
dependencies: {
|
|
934
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
935
|
+
"@tokens-studio/sd-transforms": "1.3.0",
|
|
936
|
+
"apca-w3": "^0.1.9",
|
|
937
|
+
chalk: "^5.4.1",
|
|
938
|
+
"change-case": "^5.4.4",
|
|
939
|
+
"chroma-js": "^3.1.2",
|
|
940
|
+
"colorjs.io": "^0.6.0-alpha.1",
|
|
941
|
+
commander: "^14.0.0",
|
|
942
|
+
"fast-glob": "^3.3.3",
|
|
943
|
+
hsluv: "^1.0.1",
|
|
944
|
+
"object-hash": "^3.0.0",
|
|
945
|
+
postcss: "^8.5.6",
|
|
946
|
+
ramda: "^0.31.3",
|
|
947
|
+
"style-dictionary": "^5.0.1",
|
|
948
|
+
zod: "^3.25.76",
|
|
949
|
+
"zod-validation-error": "^3.5.3"
|
|
950
|
+
},
|
|
951
|
+
devDependencies: {
|
|
952
|
+
"@tokens-studio/types": "0.5.2",
|
|
953
|
+
"@types/apca-w3": "^0.1.3",
|
|
954
|
+
"@types/chroma-js": "^3.1.1",
|
|
955
|
+
"@types/fs-extra": "^11.0.4",
|
|
956
|
+
"@types/node": "^22.16.3",
|
|
957
|
+
"@types/object-hash": "^3.0.6",
|
|
958
|
+
"@types/ramda": "^0.30.2",
|
|
959
|
+
"fs-extra": "^11.3.0",
|
|
960
|
+
tslib: "^2.8.1",
|
|
961
|
+
tsup: "^8.5.0",
|
|
962
|
+
tsx: "^4.20.3",
|
|
963
|
+
typescript: "^5.8.3"
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
|
|
870
967
|
// src/tokens/process/platform.ts
|
|
871
968
|
import chalk4 from "chalk";
|
|
872
969
|
import * as R14 from "ramda";
|
|
@@ -1914,14 +2011,20 @@ async function processPlatform(options) {
|
|
|
1914
2011
|
}
|
|
1915
2012
|
|
|
1916
2013
|
// src/tokens/process/output/declarations.ts
|
|
2014
|
+
var defaultFileHeader = `build: v${package_default.version}`;
|
|
1917
2015
|
var createTypeDeclarationFiles = (processed$themes) => {
|
|
1918
2016
|
const colorGroups = buildOptions?.colorGroups || [];
|
|
1919
2017
|
const customColors = getCustomColors(processed$themes, colorGroups);
|
|
1920
|
-
const typeDeclaration = createColorTypeDeclaration(customColors);
|
|
2018
|
+
const typeDeclaration = createColorTypeDeclaration([...customColors, "neutral"]);
|
|
1921
2019
|
return [
|
|
1922
2020
|
{
|
|
1923
|
-
output:
|
|
2021
|
+
output: `/* This file is deprecated and will be removed in a future release. Use types.d.ts instead */
|
|
2022
|
+
${typeDeclaration}`,
|
|
1924
2023
|
destination: "colors.d.ts"
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
output: typeDeclaration,
|
|
2027
|
+
destination: "types.d.ts"
|
|
1925
2028
|
}
|
|
1926
2029
|
];
|
|
1927
2030
|
};
|
|
@@ -1929,12 +2032,20 @@ function createColorTypeDeclaration(colors2) {
|
|
|
1929
2032
|
console.log(`
|
|
1930
2033
|
\u{1F371} Building ${chalk5.green("type declarations")}`);
|
|
1931
2034
|
const typeDeclaration = `
|
|
1932
|
-
|
|
2035
|
+
/* ${defaultFileHeader} */
|
|
2036
|
+
import type {} from '@digdir/designsystemet/types';
|
|
1933
2037
|
|
|
1934
|
-
|
|
1935
|
-
|
|
2038
|
+
// Augment types based on theme
|
|
2039
|
+
declare module '@digdir/designsystemet/types' {
|
|
2040
|
+
export interface ColorDefinitions {
|
|
1936
2041
|
${colors2.map((color) => ` ${color.includes("-") ? `'${color}'` : color}: never;`).join("\n")}
|
|
1937
2042
|
}
|
|
2043
|
+
export interface SeverityColorDefinitions {
|
|
2044
|
+
info: never;
|
|
2045
|
+
success: never;
|
|
2046
|
+
warning: never;
|
|
2047
|
+
danger: never;
|
|
2048
|
+
}
|
|
1938
2049
|
}
|
|
1939
2050
|
`.trimStart();
|
|
1940
2051
|
return typeDeclaration;
|
|
@@ -2000,106 +2111,10 @@ ${dynamicColors}`;
|
|
|
2000
2111
|
// src/tokens/process/output/theme.ts
|
|
2001
2112
|
import chalk6 from "chalk";
|
|
2002
2113
|
import * as R15 from "ramda";
|
|
2003
|
-
|
|
2004
|
-
// package.json
|
|
2005
|
-
var package_default = {
|
|
2006
|
-
name: "@digdir/designsystemet",
|
|
2007
|
-
version: "1.1.5",
|
|
2008
|
-
description: "CLI for Designsystemet",
|
|
2009
|
-
author: "Designsystemet team",
|
|
2010
|
-
engines: {
|
|
2011
|
-
node: ">=22.17.0"
|
|
2012
|
-
},
|
|
2013
|
-
repository: {
|
|
2014
|
-
type: "git",
|
|
2015
|
-
url: "git+https://github.com/digdir/designsystemet.git"
|
|
2016
|
-
},
|
|
2017
|
-
homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
|
|
2018
|
-
license: "MIT",
|
|
2019
|
-
type: "module",
|
|
2020
|
-
main: "./dist/src/index.js",
|
|
2021
|
-
files: [
|
|
2022
|
-
"./dist/**",
|
|
2023
|
-
"./configs/**"
|
|
2024
|
-
],
|
|
2025
|
-
bin: "dist/bin/designsystemet.js",
|
|
2026
|
-
exports: {
|
|
2027
|
-
".": {
|
|
2028
|
-
import: "./dist/src/index.js"
|
|
2029
|
-
},
|
|
2030
|
-
"./color": {
|
|
2031
|
-
import: "./dist/src/colors/index.js"
|
|
2032
|
-
},
|
|
2033
|
-
"./tokens": {
|
|
2034
|
-
import: "./dist/src/tokens/index.js"
|
|
2035
|
-
}
|
|
2036
|
-
},
|
|
2037
|
-
publishConfig: {
|
|
2038
|
-
access: "public"
|
|
2039
|
-
},
|
|
2040
|
-
scripts: {
|
|
2041
|
-
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
2042
|
-
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
2043
|
-
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
2044
|
-
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
2045
|
-
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
2046
|
-
types: "tsc --noEmit",
|
|
2047
|
-
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
|
|
2048
|
-
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
2049
|
-
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
2050
|
-
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
2051
|
-
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
2052
|
-
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
2053
|
-
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
2054
|
-
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
2055
|
-
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
2056
|
-
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
2057
|
-
"digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
|
|
2058
|
-
"digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
|
|
2059
|
-
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
2060
|
-
"update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
|
|
2061
|
-
"update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
|
|
2062
|
-
verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
|
|
2063
|
-
},
|
|
2064
|
-
dependencies: {
|
|
2065
|
-
"@commander-js/extra-typings": "^14.0.0",
|
|
2066
|
-
"@tokens-studio/sd-transforms": "1.3.0",
|
|
2067
|
-
"apca-w3": "^0.1.9",
|
|
2068
|
-
chalk: "^5.4.1",
|
|
2069
|
-
"change-case": "^5.4.4",
|
|
2070
|
-
"chroma-js": "^3.1.2",
|
|
2071
|
-
"colorjs.io": "^0.6.0-alpha.1",
|
|
2072
|
-
commander: "^14.0.0",
|
|
2073
|
-
"fast-glob": "^3.3.3",
|
|
2074
|
-
hsluv: "^1.0.1",
|
|
2075
|
-
"object-hash": "^3.0.0",
|
|
2076
|
-
postcss: "^8.5.6",
|
|
2077
|
-
ramda: "^0.31.3",
|
|
2078
|
-
"style-dictionary": "^5.0.1",
|
|
2079
|
-
zod: "^3.25.74",
|
|
2080
|
-
"zod-validation-error": "^3.5.2"
|
|
2081
|
-
},
|
|
2082
|
-
devDependencies: {
|
|
2083
|
-
"@tokens-studio/types": "0.5.2",
|
|
2084
|
-
"@types/apca-w3": "^0.1.3",
|
|
2085
|
-
"@types/chroma-js": "^3.1.1",
|
|
2086
|
-
"@types/fs-extra": "^11.0.4",
|
|
2087
|
-
"@types/node": "^22.16.0",
|
|
2088
|
-
"@types/object-hash": "^3.0.6",
|
|
2089
|
-
"@types/ramda": "^0.30.2",
|
|
2090
|
-
"fs-extra": "^11.3.0",
|
|
2091
|
-
tslib: "^2.8.1",
|
|
2092
|
-
tsup: "^8.5.0",
|
|
2093
|
-
tsx: "^4.20.3",
|
|
2094
|
-
typescript: "^5.8.3"
|
|
2095
|
-
}
|
|
2096
|
-
};
|
|
2097
|
-
|
|
2098
|
-
// src/tokens/process/output/theme.ts
|
|
2099
|
-
var defaultFileHeader = `build: v${package_default.version}`;
|
|
2114
|
+
var defaultFileHeader2 = `build: v${package_default.version}`;
|
|
2100
2115
|
var createThemeCSSFiles = ({
|
|
2101
2116
|
processedBuilds,
|
|
2102
|
-
fileHeader =
|
|
2117
|
+
fileHeader = defaultFileHeader2
|
|
2103
2118
|
}) => {
|
|
2104
2119
|
const groupedByTheme = {};
|
|
2105
2120
|
for (const [_, buildResults] of Object.entries(processedBuilds)) {
|
|
@@ -2200,7 +2215,7 @@ var buildTokens = async (options) => {
|
|
|
2200
2215
|
buildTokenFormats: {}
|
|
2201
2216
|
});
|
|
2202
2217
|
const fileHeader = R16.join("")([
|
|
2203
|
-
|
|
2218
|
+
defaultFileHeader2,
|
|
2204
2219
|
$designsystemet ? `
|
|
2205
2220
|
design-tokens: v${$designsystemet.version}` : ""
|
|
2206
2221
|
]);
|
package/dist/src/index.js
CHANGED
|
@@ -2572,7 +2572,7 @@ import * as R7 from "ramda";
|
|
|
2572
2572
|
// package.json
|
|
2573
2573
|
var package_default = {
|
|
2574
2574
|
name: "@digdir/designsystemet",
|
|
2575
|
-
version: "1.1.
|
|
2575
|
+
version: "1.1.7",
|
|
2576
2576
|
description: "CLI for Designsystemet",
|
|
2577
2577
|
author: "Designsystemet team",
|
|
2578
2578
|
engines: {
|
|
@@ -2600,6 +2600,9 @@ var package_default = {
|
|
|
2600
2600
|
},
|
|
2601
2601
|
"./tokens": {
|
|
2602
2602
|
import: "./dist/src/tokens/index.js"
|
|
2603
|
+
},
|
|
2604
|
+
"./types": {
|
|
2605
|
+
import: "./dist/src/types.js"
|
|
2603
2606
|
}
|
|
2604
2607
|
},
|
|
2605
2608
|
publishConfig: {
|
|
@@ -2644,15 +2647,15 @@ var package_default = {
|
|
|
2644
2647
|
postcss: "^8.5.6",
|
|
2645
2648
|
ramda: "^0.31.3",
|
|
2646
2649
|
"style-dictionary": "^5.0.1",
|
|
2647
|
-
zod: "^3.25.
|
|
2648
|
-
"zod-validation-error": "^3.5.
|
|
2650
|
+
zod: "^3.25.76",
|
|
2651
|
+
"zod-validation-error": "^3.5.3"
|
|
2649
2652
|
},
|
|
2650
2653
|
devDependencies: {
|
|
2651
2654
|
"@tokens-studio/types": "0.5.2",
|
|
2652
2655
|
"@types/apca-w3": "^0.1.3",
|
|
2653
2656
|
"@types/chroma-js": "^3.1.1",
|
|
2654
2657
|
"@types/fs-extra": "^11.0.4",
|
|
2655
|
-
"@types/node": "^22.16.
|
|
2658
|
+
"@types/node": "^22.16.3",
|
|
2656
2659
|
"@types/object-hash": "^3.0.6",
|
|
2657
2660
|
"@types/ramda": "^0.30.2",
|
|
2658
2661
|
"fs-extra": "^11.3.0",
|
|
@@ -3375,7 +3375,7 @@ var toPreviewToken = (tokens) => tokens.map(({ token, formatted }) => {
|
|
|
3375
3375
|
});
|
|
3376
3376
|
var formatTheme = async (themeConfig) => {
|
|
3377
3377
|
const { tokenSets } = await createTokens(themeConfig);
|
|
3378
|
-
const outDir = "
|
|
3378
|
+
const outDir = "../../apps/www/app/_components/tokens/design-tokens";
|
|
3379
3379
|
const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors);
|
|
3380
3380
|
const processed$themes = $themes.map(processThemeObject);
|
|
3381
3381
|
await processPlatform({
|
|
@@ -3385,7 +3385,7 @@ var formatTheme = async (themeConfig) => {
|
|
|
3385
3385
|
verbose: false,
|
|
3386
3386
|
buildTokenFormats: {}
|
|
3387
3387
|
});
|
|
3388
|
-
await cleanDir(
|
|
3388
|
+
await cleanDir(outDir, false);
|
|
3389
3389
|
console.log(
|
|
3390
3390
|
buildOptions?.buildTokenFormats ? `
|
|
3391
3391
|
\u{1F3D7}\uFE0F Start building preview tokens for ${chalk4.blue("Designsystemet")}
|
|
@@ -3419,11 +3419,11 @@ var formatTheme = async (themeConfig) => {
|
|
|
3419
3419
|
write(
|
|
3420
3420
|
[
|
|
3421
3421
|
{
|
|
3422
|
-
destination: `${
|
|
3422
|
+
destination: `${type}.json`,
|
|
3423
3423
|
output: JSON.stringify(tokens, null, 2)
|
|
3424
3424
|
}
|
|
3425
3425
|
],
|
|
3426
|
-
|
|
3426
|
+
outDir,
|
|
3427
3427
|
false
|
|
3428
3428
|
);
|
|
3429
3429
|
}
|
package/dist/src/tokens/build.js
CHANGED
|
@@ -46,6 +46,103 @@ var readFile = async (path2, dry, allowFileNotFound) => {
|
|
|
46
46
|
// src/tokens/process/output/declarations.ts
|
|
47
47
|
import chalk4 from "chalk";
|
|
48
48
|
|
|
49
|
+
// package.json
|
|
50
|
+
var package_default = {
|
|
51
|
+
name: "@digdir/designsystemet",
|
|
52
|
+
version: "1.1.7",
|
|
53
|
+
description: "CLI for Designsystemet",
|
|
54
|
+
author: "Designsystemet team",
|
|
55
|
+
engines: {
|
|
56
|
+
node: ">=22.17.0"
|
|
57
|
+
},
|
|
58
|
+
repository: {
|
|
59
|
+
type: "git",
|
|
60
|
+
url: "git+https://github.com/digdir/designsystemet.git"
|
|
61
|
+
},
|
|
62
|
+
homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
|
|
63
|
+
license: "MIT",
|
|
64
|
+
type: "module",
|
|
65
|
+
main: "./dist/src/index.js",
|
|
66
|
+
files: [
|
|
67
|
+
"./dist/**",
|
|
68
|
+
"./configs/**"
|
|
69
|
+
],
|
|
70
|
+
bin: "dist/bin/designsystemet.js",
|
|
71
|
+
exports: {
|
|
72
|
+
".": {
|
|
73
|
+
import: "./dist/src/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./color": {
|
|
76
|
+
import: "./dist/src/colors/index.js"
|
|
77
|
+
},
|
|
78
|
+
"./tokens": {
|
|
79
|
+
import: "./dist/src/tokens/index.js"
|
|
80
|
+
},
|
|
81
|
+
"./types": {
|
|
82
|
+
import: "./dist/src/types.js"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
publishConfig: {
|
|
86
|
+
access: "public"
|
|
87
|
+
},
|
|
88
|
+
scripts: {
|
|
89
|
+
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
90
|
+
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
91
|
+
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
92
|
+
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
93
|
+
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
94
|
+
types: "tsc --noEmit",
|
|
95
|
+
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
|
|
96
|
+
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
97
|
+
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
98
|
+
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
99
|
+
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
100
|
+
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
101
|
+
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
102
|
+
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
103
|
+
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
104
|
+
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
105
|
+
"digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
|
|
106
|
+
"digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
|
|
107
|
+
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
108
|
+
"update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
|
|
109
|
+
"update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
|
|
110
|
+
verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
|
|
111
|
+
},
|
|
112
|
+
dependencies: {
|
|
113
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
114
|
+
"@tokens-studio/sd-transforms": "1.3.0",
|
|
115
|
+
"apca-w3": "^0.1.9",
|
|
116
|
+
chalk: "^5.4.1",
|
|
117
|
+
"change-case": "^5.4.4",
|
|
118
|
+
"chroma-js": "^3.1.2",
|
|
119
|
+
"colorjs.io": "^0.6.0-alpha.1",
|
|
120
|
+
commander: "^14.0.0",
|
|
121
|
+
"fast-glob": "^3.3.3",
|
|
122
|
+
hsluv: "^1.0.1",
|
|
123
|
+
"object-hash": "^3.0.0",
|
|
124
|
+
postcss: "^8.5.6",
|
|
125
|
+
ramda: "^0.31.3",
|
|
126
|
+
"style-dictionary": "^5.0.1",
|
|
127
|
+
zod: "^3.25.76",
|
|
128
|
+
"zod-validation-error": "^3.5.3"
|
|
129
|
+
},
|
|
130
|
+
devDependencies: {
|
|
131
|
+
"@tokens-studio/types": "0.5.2",
|
|
132
|
+
"@types/apca-w3": "^0.1.3",
|
|
133
|
+
"@types/chroma-js": "^3.1.1",
|
|
134
|
+
"@types/fs-extra": "^11.0.4",
|
|
135
|
+
"@types/node": "^22.16.3",
|
|
136
|
+
"@types/object-hash": "^3.0.6",
|
|
137
|
+
"@types/ramda": "^0.30.2",
|
|
138
|
+
"fs-extra": "^11.3.0",
|
|
139
|
+
tslib: "^2.8.1",
|
|
140
|
+
tsup: "^8.5.0",
|
|
141
|
+
tsx: "^4.20.3",
|
|
142
|
+
typescript: "^5.8.3"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
49
146
|
// src/tokens/process/platform.ts
|
|
50
147
|
import chalk3 from "chalk";
|
|
51
148
|
import * as R10 from "ramda";
|
|
@@ -1093,14 +1190,20 @@ async function processPlatform(options) {
|
|
|
1093
1190
|
}
|
|
1094
1191
|
|
|
1095
1192
|
// src/tokens/process/output/declarations.ts
|
|
1193
|
+
var defaultFileHeader = `build: v${package_default.version}`;
|
|
1096
1194
|
var createTypeDeclarationFiles = (processed$themes) => {
|
|
1097
1195
|
const colorGroups = buildOptions?.colorGroups || [];
|
|
1098
1196
|
const customColors = getCustomColors(processed$themes, colorGroups);
|
|
1099
|
-
const typeDeclaration = createColorTypeDeclaration(customColors);
|
|
1197
|
+
const typeDeclaration = createColorTypeDeclaration([...customColors, "neutral"]);
|
|
1100
1198
|
return [
|
|
1101
1199
|
{
|
|
1102
|
-
output:
|
|
1200
|
+
output: `/* This file is deprecated and will be removed in a future release. Use types.d.ts instead */
|
|
1201
|
+
${typeDeclaration}`,
|
|
1103
1202
|
destination: "colors.d.ts"
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
output: typeDeclaration,
|
|
1206
|
+
destination: "types.d.ts"
|
|
1104
1207
|
}
|
|
1105
1208
|
];
|
|
1106
1209
|
};
|
|
@@ -1108,12 +1211,20 @@ function createColorTypeDeclaration(colors) {
|
|
|
1108
1211
|
console.log(`
|
|
1109
1212
|
\u{1F371} Building ${chalk4.green("type declarations")}`);
|
|
1110
1213
|
const typeDeclaration = `
|
|
1111
|
-
|
|
1214
|
+
/* ${defaultFileHeader} */
|
|
1215
|
+
import type {} from '@digdir/designsystemet/types';
|
|
1112
1216
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1217
|
+
// Augment types based on theme
|
|
1218
|
+
declare module '@digdir/designsystemet/types' {
|
|
1219
|
+
export interface ColorDefinitions {
|
|
1115
1220
|
${colors.map((color) => ` ${color.includes("-") ? `'${color}'` : color}: never;`).join("\n")}
|
|
1116
1221
|
}
|
|
1222
|
+
export interface SeverityColorDefinitions {
|
|
1223
|
+
info: never;
|
|
1224
|
+
success: never;
|
|
1225
|
+
warning: never;
|
|
1226
|
+
danger: never;
|
|
1227
|
+
}
|
|
1117
1228
|
}
|
|
1118
1229
|
`.trimStart();
|
|
1119
1230
|
return typeDeclaration;
|
|
@@ -1179,106 +1290,10 @@ ${dynamicColors}`;
|
|
|
1179
1290
|
// src/tokens/process/output/theme.ts
|
|
1180
1291
|
import chalk5 from "chalk";
|
|
1181
1292
|
import * as R11 from "ramda";
|
|
1182
|
-
|
|
1183
|
-
// package.json
|
|
1184
|
-
var package_default = {
|
|
1185
|
-
name: "@digdir/designsystemet",
|
|
1186
|
-
version: "1.1.5",
|
|
1187
|
-
description: "CLI for Designsystemet",
|
|
1188
|
-
author: "Designsystemet team",
|
|
1189
|
-
engines: {
|
|
1190
|
-
node: ">=22.17.0"
|
|
1191
|
-
},
|
|
1192
|
-
repository: {
|
|
1193
|
-
type: "git",
|
|
1194
|
-
url: "git+https://github.com/digdir/designsystemet.git"
|
|
1195
|
-
},
|
|
1196
|
-
homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
|
|
1197
|
-
license: "MIT",
|
|
1198
|
-
type: "module",
|
|
1199
|
-
main: "./dist/src/index.js",
|
|
1200
|
-
files: [
|
|
1201
|
-
"./dist/**",
|
|
1202
|
-
"./configs/**"
|
|
1203
|
-
],
|
|
1204
|
-
bin: "dist/bin/designsystemet.js",
|
|
1205
|
-
exports: {
|
|
1206
|
-
".": {
|
|
1207
|
-
import: "./dist/src/index.js"
|
|
1208
|
-
},
|
|
1209
|
-
"./color": {
|
|
1210
|
-
import: "./dist/src/colors/index.js"
|
|
1211
|
-
},
|
|
1212
|
-
"./tokens": {
|
|
1213
|
-
import: "./dist/src/tokens/index.js"
|
|
1214
|
-
}
|
|
1215
|
-
},
|
|
1216
|
-
publishConfig: {
|
|
1217
|
-
access: "public"
|
|
1218
|
-
},
|
|
1219
|
-
scripts: {
|
|
1220
|
-
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
1221
|
-
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
1222
|
-
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
1223
|
-
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
1224
|
-
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
1225
|
-
types: "tsc --noEmit",
|
|
1226
|
-
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
|
|
1227
|
-
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
1228
|
-
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
1229
|
-
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
1230
|
-
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
1231
|
-
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
1232
|
-
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
1233
|
-
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
1234
|
-
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
1235
|
-
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
1236
|
-
"digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
|
|
1237
|
-
"digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
|
|
1238
|
-
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
1239
|
-
"update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
|
|
1240
|
-
"update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
|
|
1241
|
-
verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
|
|
1242
|
-
},
|
|
1243
|
-
dependencies: {
|
|
1244
|
-
"@commander-js/extra-typings": "^14.0.0",
|
|
1245
|
-
"@tokens-studio/sd-transforms": "1.3.0",
|
|
1246
|
-
"apca-w3": "^0.1.9",
|
|
1247
|
-
chalk: "^5.4.1",
|
|
1248
|
-
"change-case": "^5.4.4",
|
|
1249
|
-
"chroma-js": "^3.1.2",
|
|
1250
|
-
"colorjs.io": "^0.6.0-alpha.1",
|
|
1251
|
-
commander: "^14.0.0",
|
|
1252
|
-
"fast-glob": "^3.3.3",
|
|
1253
|
-
hsluv: "^1.0.1",
|
|
1254
|
-
"object-hash": "^3.0.0",
|
|
1255
|
-
postcss: "^8.5.6",
|
|
1256
|
-
ramda: "^0.31.3",
|
|
1257
|
-
"style-dictionary": "^5.0.1",
|
|
1258
|
-
zod: "^3.25.74",
|
|
1259
|
-
"zod-validation-error": "^3.5.2"
|
|
1260
|
-
},
|
|
1261
|
-
devDependencies: {
|
|
1262
|
-
"@tokens-studio/types": "0.5.2",
|
|
1263
|
-
"@types/apca-w3": "^0.1.3",
|
|
1264
|
-
"@types/chroma-js": "^3.1.1",
|
|
1265
|
-
"@types/fs-extra": "^11.0.4",
|
|
1266
|
-
"@types/node": "^22.16.0",
|
|
1267
|
-
"@types/object-hash": "^3.0.6",
|
|
1268
|
-
"@types/ramda": "^0.30.2",
|
|
1269
|
-
"fs-extra": "^11.3.0",
|
|
1270
|
-
tslib: "^2.8.1",
|
|
1271
|
-
tsup: "^8.5.0",
|
|
1272
|
-
tsx: "^4.20.3",
|
|
1273
|
-
typescript: "^5.8.3"
|
|
1274
|
-
}
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
// src/tokens/process/output/theme.ts
|
|
1278
|
-
var defaultFileHeader = `build: v${package_default.version}`;
|
|
1293
|
+
var defaultFileHeader2 = `build: v${package_default.version}`;
|
|
1279
1294
|
var createThemeCSSFiles = ({
|
|
1280
1295
|
processedBuilds,
|
|
1281
|
-
fileHeader =
|
|
1296
|
+
fileHeader = defaultFileHeader2
|
|
1282
1297
|
}) => {
|
|
1283
1298
|
const groupedByTheme = {};
|
|
1284
1299
|
for (const [_, buildResults] of Object.entries(processedBuilds)) {
|
|
@@ -1379,7 +1394,7 @@ var buildTokens = async (options) => {
|
|
|
1379
1394
|
buildTokenFormats: {}
|
|
1380
1395
|
});
|
|
1381
1396
|
const fileHeader = R12.join("")([
|
|
1382
|
-
|
|
1397
|
+
defaultFileHeader2,
|
|
1383
1398
|
$designsystemet ? `
|
|
1384
1399
|
design-tokens: v${$designsystemet.version}` : ""
|
|
1385
1400
|
]);
|
|
@@ -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.7",
|
|
5
5
|
description: "CLI for Designsystemet",
|
|
6
6
|
author: "Designsystemet team",
|
|
7
7
|
engines: {
|
|
@@ -29,6 +29,9 @@ var package_default = {
|
|
|
29
29
|
},
|
|
30
30
|
"./tokens": {
|
|
31
31
|
import: "./dist/src/tokens/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./types": {
|
|
34
|
+
import: "./dist/src/types.js"
|
|
32
35
|
}
|
|
33
36
|
},
|
|
34
37
|
publishConfig: {
|
|
@@ -73,15 +76,15 @@ var package_default = {
|
|
|
73
76
|
postcss: "^8.5.6",
|
|
74
77
|
ramda: "^0.31.3",
|
|
75
78
|
"style-dictionary": "^5.0.1",
|
|
76
|
-
zod: "^3.25.
|
|
77
|
-
"zod-validation-error": "^3.5.
|
|
79
|
+
zod: "^3.25.76",
|
|
80
|
+
"zod-validation-error": "^3.5.3"
|
|
78
81
|
},
|
|
79
82
|
devDependencies: {
|
|
80
83
|
"@tokens-studio/types": "0.5.2",
|
|
81
84
|
"@types/apca-w3": "^0.1.3",
|
|
82
85
|
"@types/chroma-js": "^3.1.1",
|
|
83
86
|
"@types/fs-extra": "^11.0.4",
|
|
84
|
-
"@types/node": "^22.16.
|
|
87
|
+
"@types/node": "^22.16.3",
|
|
85
88
|
"@types/object-hash": "^3.0.6",
|
|
86
89
|
"@types/ramda": "^0.30.2",
|
|
87
90
|
"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.7",
|
|
50
50
|
description: "CLI for Designsystemet",
|
|
51
51
|
author: "Designsystemet team",
|
|
52
52
|
engines: {
|
|
@@ -74,6 +74,9 @@ var package_default = {
|
|
|
74
74
|
},
|
|
75
75
|
"./tokens": {
|
|
76
76
|
import: "./dist/src/tokens/index.js"
|
|
77
|
+
},
|
|
78
|
+
"./types": {
|
|
79
|
+
import: "./dist/src/types.js"
|
|
77
80
|
}
|
|
78
81
|
},
|
|
79
82
|
publishConfig: {
|
|
@@ -118,15 +121,15 @@ var package_default = {
|
|
|
118
121
|
postcss: "^8.5.6",
|
|
119
122
|
ramda: "^0.31.3",
|
|
120
123
|
"style-dictionary": "^5.0.1",
|
|
121
|
-
zod: "^3.25.
|
|
122
|
-
"zod-validation-error": "^3.5.
|
|
124
|
+
zod: "^3.25.76",
|
|
125
|
+
"zod-validation-error": "^3.5.3"
|
|
123
126
|
},
|
|
124
127
|
devDependencies: {
|
|
125
128
|
"@tokens-studio/types": "0.5.2",
|
|
126
129
|
"@types/apca-w3": "^0.1.3",
|
|
127
130
|
"@types/chroma-js": "^3.1.1",
|
|
128
131
|
"@types/fs-extra": "^11.0.4",
|
|
129
|
-
"@types/node": "^22.16.
|
|
132
|
+
"@types/node": "^22.16.3",
|
|
130
133
|
"@types/object-hash": "^3.0.6",
|
|
131
134
|
"@types/ramda": "^0.30.2",
|
|
132
135
|
"fs-extra": "^11.3.0",
|
|
@@ -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.7",
|
|
2417
2417
|
description: "CLI for Designsystemet",
|
|
2418
2418
|
author: "Designsystemet team",
|
|
2419
2419
|
engines: {
|
|
@@ -2441,6 +2441,9 @@ var package_default = {
|
|
|
2441
2441
|
},
|
|
2442
2442
|
"./tokens": {
|
|
2443
2443
|
import: "./dist/src/tokens/index.js"
|
|
2444
|
+
},
|
|
2445
|
+
"./types": {
|
|
2446
|
+
import: "./dist/src/types.js"
|
|
2444
2447
|
}
|
|
2445
2448
|
},
|
|
2446
2449
|
publishConfig: {
|
|
@@ -2485,15 +2488,15 @@ var package_default = {
|
|
|
2485
2488
|
postcss: "^8.5.6",
|
|
2486
2489
|
ramda: "^0.31.3",
|
|
2487
2490
|
"style-dictionary": "^5.0.1",
|
|
2488
|
-
zod: "^3.25.
|
|
2489
|
-
"zod-validation-error": "^3.5.
|
|
2491
|
+
zod: "^3.25.76",
|
|
2492
|
+
"zod-validation-error": "^3.5.3"
|
|
2490
2493
|
},
|
|
2491
2494
|
devDependencies: {
|
|
2492
2495
|
"@tokens-studio/types": "0.5.2",
|
|
2493
2496
|
"@types/apca-w3": "^0.1.3",
|
|
2494
2497
|
"@types/chroma-js": "^3.1.1",
|
|
2495
2498
|
"@types/fs-extra": "^11.0.4",
|
|
2496
|
-
"@types/node": "^22.16.
|
|
2499
|
+
"@types/node": "^22.16.3",
|
|
2497
2500
|
"@types/object-hash": "^3.0.6",
|
|
2498
2501
|
"@types/ramda": "^0.30.2",
|
|
2499
2502
|
"fs-extra": "^11.3.0",
|
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.7",
|
|
2433
2433
|
description: "CLI for Designsystemet",
|
|
2434
2434
|
author: "Designsystemet team",
|
|
2435
2435
|
engines: {
|
|
@@ -2457,6 +2457,9 @@ var package_default = {
|
|
|
2457
2457
|
},
|
|
2458
2458
|
"./tokens": {
|
|
2459
2459
|
import: "./dist/src/tokens/index.js"
|
|
2460
|
+
},
|
|
2461
|
+
"./types": {
|
|
2462
|
+
import: "./dist/src/types.js"
|
|
2460
2463
|
}
|
|
2461
2464
|
},
|
|
2462
2465
|
publishConfig: {
|
|
@@ -2501,15 +2504,15 @@ var package_default = {
|
|
|
2501
2504
|
postcss: "^8.5.6",
|
|
2502
2505
|
ramda: "^0.31.3",
|
|
2503
2506
|
"style-dictionary": "^5.0.1",
|
|
2504
|
-
zod: "^3.25.
|
|
2505
|
-
"zod-validation-error": "^3.5.
|
|
2507
|
+
zod: "^3.25.76",
|
|
2508
|
+
"zod-validation-error": "^3.5.3"
|
|
2506
2509
|
},
|
|
2507
2510
|
devDependencies: {
|
|
2508
2511
|
"@tokens-studio/types": "0.5.2",
|
|
2509
2512
|
"@types/apca-w3": "^0.1.3",
|
|
2510
2513
|
"@types/chroma-js": "^3.1.1",
|
|
2511
2514
|
"@types/fs-extra": "^11.0.4",
|
|
2512
|
-
"@types/node": "^22.16.
|
|
2515
|
+
"@types/node": "^22.16.3",
|
|
2513
2516
|
"@types/object-hash": "^3.0.6",
|
|
2514
2517
|
"@types/ramda": "^0.30.2",
|
|
2515
2518
|
"fs-extra": "^11.3.0",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OutputFile } from '../../types.js';
|
|
2
2
|
import { type ProcessedThemeObject } from '../utils/getMultidimensionalThemes.js';
|
|
3
|
+
export declare const defaultFileHeader: string;
|
|
3
4
|
export declare const createTypeDeclarationFiles: (processed$themes: ProcessedThemeObject[]) => OutputFile[];
|
|
4
5
|
//# sourceMappingURL=declarations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/output/declarations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/output/declarations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAEnG,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,eAAO,MAAM,0BAA0B,GAAI,kBAAkB,oBAAoB,EAAE,KAAG,UAAU,EAe/F,CAAC"}
|
|
@@ -1,6 +1,103 @@
|
|
|
1
1
|
// src/tokens/process/output/declarations.ts
|
|
2
2
|
import chalk3 from "chalk";
|
|
3
3
|
|
|
4
|
+
// package.json
|
|
5
|
+
var package_default = {
|
|
6
|
+
name: "@digdir/designsystemet",
|
|
7
|
+
version: "1.1.7",
|
|
8
|
+
description: "CLI for Designsystemet",
|
|
9
|
+
author: "Designsystemet team",
|
|
10
|
+
engines: {
|
|
11
|
+
node: ">=22.17.0"
|
|
12
|
+
},
|
|
13
|
+
repository: {
|
|
14
|
+
type: "git",
|
|
15
|
+
url: "git+https://github.com/digdir/designsystemet.git"
|
|
16
|
+
},
|
|
17
|
+
homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
|
|
18
|
+
license: "MIT",
|
|
19
|
+
type: "module",
|
|
20
|
+
main: "./dist/src/index.js",
|
|
21
|
+
files: [
|
|
22
|
+
"./dist/**",
|
|
23
|
+
"./configs/**"
|
|
24
|
+
],
|
|
25
|
+
bin: "dist/bin/designsystemet.js",
|
|
26
|
+
exports: {
|
|
27
|
+
".": {
|
|
28
|
+
import: "./dist/src/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./color": {
|
|
31
|
+
import: "./dist/src/colors/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./tokens": {
|
|
34
|
+
import: "./dist/src/tokens/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./types": {
|
|
37
|
+
import: "./dist/src/types.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
publishConfig: {
|
|
41
|
+
access: "public"
|
|
42
|
+
},
|
|
43
|
+
scripts: {
|
|
44
|
+
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
45
|
+
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
46
|
+
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
47
|
+
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
48
|
+
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
49
|
+
types: "tsc --noEmit",
|
|
50
|
+
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
|
|
51
|
+
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
52
|
+
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
53
|
+
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
54
|
+
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
55
|
+
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
56
|
+
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
57
|
+
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
58
|
+
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
59
|
+
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
60
|
+
"digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
|
|
61
|
+
"digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
|
|
62
|
+
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
63
|
+
"update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
|
|
64
|
+
"update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
|
|
65
|
+
verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
|
|
66
|
+
},
|
|
67
|
+
dependencies: {
|
|
68
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
69
|
+
"@tokens-studio/sd-transforms": "1.3.0",
|
|
70
|
+
"apca-w3": "^0.1.9",
|
|
71
|
+
chalk: "^5.4.1",
|
|
72
|
+
"change-case": "^5.4.4",
|
|
73
|
+
"chroma-js": "^3.1.2",
|
|
74
|
+
"colorjs.io": "^0.6.0-alpha.1",
|
|
75
|
+
commander: "^14.0.0",
|
|
76
|
+
"fast-glob": "^3.3.3",
|
|
77
|
+
hsluv: "^1.0.1",
|
|
78
|
+
"object-hash": "^3.0.0",
|
|
79
|
+
postcss: "^8.5.6",
|
|
80
|
+
ramda: "^0.31.3",
|
|
81
|
+
"style-dictionary": "^5.0.1",
|
|
82
|
+
zod: "^3.25.76",
|
|
83
|
+
"zod-validation-error": "^3.5.3"
|
|
84
|
+
},
|
|
85
|
+
devDependencies: {
|
|
86
|
+
"@tokens-studio/types": "0.5.2",
|
|
87
|
+
"@types/apca-w3": "^0.1.3",
|
|
88
|
+
"@types/chroma-js": "^3.1.1",
|
|
89
|
+
"@types/fs-extra": "^11.0.4",
|
|
90
|
+
"@types/node": "^22.16.3",
|
|
91
|
+
"@types/object-hash": "^3.0.6",
|
|
92
|
+
"@types/ramda": "^0.30.2",
|
|
93
|
+
"fs-extra": "^11.3.0",
|
|
94
|
+
tslib: "^2.8.1",
|
|
95
|
+
tsup: "^8.5.0",
|
|
96
|
+
tsx: "^4.20.3",
|
|
97
|
+
typescript: "^5.8.3"
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
4
101
|
// src/tokens/process/platform.ts
|
|
5
102
|
import chalk2 from "chalk";
|
|
6
103
|
import * as R10 from "ramda";
|
|
@@ -769,14 +866,20 @@ var buildConfigs = {
|
|
|
769
866
|
};
|
|
770
867
|
|
|
771
868
|
// src/tokens/process/output/declarations.ts
|
|
869
|
+
var defaultFileHeader = `build: v${package_default.version}`;
|
|
772
870
|
var createTypeDeclarationFiles = (processed$themes) => {
|
|
773
871
|
const colorGroups = buildOptions?.colorGroups || [];
|
|
774
872
|
const customColors = getCustomColors(processed$themes, colorGroups);
|
|
775
|
-
const typeDeclaration = createColorTypeDeclaration(customColors);
|
|
873
|
+
const typeDeclaration = createColorTypeDeclaration([...customColors, "neutral"]);
|
|
776
874
|
return [
|
|
777
875
|
{
|
|
778
|
-
output:
|
|
876
|
+
output: `/* This file is deprecated and will be removed in a future release. Use types.d.ts instead */
|
|
877
|
+
${typeDeclaration}`,
|
|
779
878
|
destination: "colors.d.ts"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
output: typeDeclaration,
|
|
882
|
+
destination: "types.d.ts"
|
|
780
883
|
}
|
|
781
884
|
];
|
|
782
885
|
};
|
|
@@ -784,16 +887,25 @@ function createColorTypeDeclaration(colors) {
|
|
|
784
887
|
console.log(`
|
|
785
888
|
\u{1F371} Building ${chalk3.green("type declarations")}`);
|
|
786
889
|
const typeDeclaration = `
|
|
787
|
-
|
|
890
|
+
/* ${defaultFileHeader} */
|
|
891
|
+
import type {} from '@digdir/designsystemet/types';
|
|
788
892
|
|
|
789
|
-
|
|
790
|
-
|
|
893
|
+
// Augment types based on theme
|
|
894
|
+
declare module '@digdir/designsystemet/types' {
|
|
895
|
+
export interface ColorDefinitions {
|
|
791
896
|
${colors.map((color) => ` ${color.includes("-") ? `'${color}'` : color}: never;`).join("\n")}
|
|
792
897
|
}
|
|
898
|
+
export interface SeverityColorDefinitions {
|
|
899
|
+
info: never;
|
|
900
|
+
success: never;
|
|
901
|
+
warning: never;
|
|
902
|
+
danger: never;
|
|
903
|
+
}
|
|
793
904
|
}
|
|
794
905
|
`.trimStart();
|
|
795
906
|
return typeDeclaration;
|
|
796
907
|
}
|
|
797
908
|
export {
|
|
798
|
-
createTypeDeclarationFiles
|
|
909
|
+
createTypeDeclarationFiles,
|
|
910
|
+
defaultFileHeader
|
|
799
911
|
};
|
|
@@ -5,7 +5,7 @@ import * as R from "ramda";
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@digdir/designsystemet",
|
|
8
|
-
version: "1.1.
|
|
8
|
+
version: "1.1.7",
|
|
9
9
|
description: "CLI for Designsystemet",
|
|
10
10
|
author: "Designsystemet team",
|
|
11
11
|
engines: {
|
|
@@ -33,6 +33,9 @@ var package_default = {
|
|
|
33
33
|
},
|
|
34
34
|
"./tokens": {
|
|
35
35
|
import: "./dist/src/tokens/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./types": {
|
|
38
|
+
import: "./dist/src/types.js"
|
|
36
39
|
}
|
|
37
40
|
},
|
|
38
41
|
publishConfig: {
|
|
@@ -77,15 +80,15 @@ var package_default = {
|
|
|
77
80
|
postcss: "^8.5.6",
|
|
78
81
|
ramda: "^0.31.3",
|
|
79
82
|
"style-dictionary": "^5.0.1",
|
|
80
|
-
zod: "^3.25.
|
|
81
|
-
"zod-validation-error": "^3.5.
|
|
83
|
+
zod: "^3.25.76",
|
|
84
|
+
"zod-validation-error": "^3.5.3"
|
|
82
85
|
},
|
|
83
86
|
devDependencies: {
|
|
84
87
|
"@tokens-studio/types": "0.5.2",
|
|
85
88
|
"@types/apca-w3": "^0.1.3",
|
|
86
89
|
"@types/chroma-js": "^3.1.1",
|
|
87
90
|
"@types/fs-extra": "^11.0.4",
|
|
88
|
-
"@types/node": "^22.16.
|
|
91
|
+
"@types/node": "^22.16.3",
|
|
89
92
|
"@types/object-hash": "^3.0.6",
|
|
90
93
|
"@types/ramda": "^0.30.2",
|
|
91
94
|
"fs-extra": "^11.3.0",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
2
|
+
type EmptyObject = {
|
|
3
|
+
[emptyObjectSymbol]?: never;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Base interface for available colors in Designsystemet.
|
|
7
|
+
* The CLI will generate augmentations of this interface to allow
|
|
8
|
+
* type safety of custom color names.
|
|
9
|
+
*/
|
|
10
|
+
export interface ColorDefinitions {
|
|
11
|
+
}
|
|
12
|
+
export interface SeverityColorDefinitions {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* If {@link ColorDefinitions} or {@link SeverityColorDefinitions} has been extended to include color names, return T,
|
|
16
|
+
* otherwise return the arbitrary string type.
|
|
17
|
+
*/
|
|
18
|
+
type ColorWithFallback<T> = ColorDefinitions extends EmptyObject ? string : T;
|
|
19
|
+
export type SeverityColors = ColorWithFallback<keyof SeverityColorDefinitions>;
|
|
20
|
+
export type Color = ColorWithFallback<keyof ColorDefinitions>;
|
|
21
|
+
export type Size = 'sm' | 'md' | 'lg';
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAC;AAC/C,KAAK,WAAW,GAAG;IAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEnD;;;;GAIG;AAGH,MAAM,WAAW,gBAAgB;CAAG;AAEpC,MAAM,WAAW,wBAAwB;CAAG;AAE5C;;;GAGG;AACH,KAAK,iBAAiB,CAAC,CAAC,IAAI,gBAAgB,SAAS,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC;AAE9E,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,MAAM,wBAAwB,CAAC,CAAC;AAC/E,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,gBAAgB,CAAC,CAAC;AAC9D,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digdir/designsystemet",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "CLI for Designsystemet",
|
|
5
5
|
"author": "Designsystemet team",
|
|
6
6
|
"engines": {
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"./tokens": {
|
|
30
30
|
"import": "./dist/src/tokens/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./types": {
|
|
33
|
+
"import": "./dist/src/types.js"
|
|
31
34
|
}
|
|
32
35
|
},
|
|
33
36
|
"publishConfig": {
|
|
@@ -48,15 +51,15 @@
|
|
|
48
51
|
"postcss": "^8.5.6",
|
|
49
52
|
"ramda": "^0.31.3",
|
|
50
53
|
"style-dictionary": "^5.0.1",
|
|
51
|
-
"zod": "^3.25.
|
|
52
|
-
"zod-validation-error": "^3.5.
|
|
54
|
+
"zod": "^3.25.76",
|
|
55
|
+
"zod-validation-error": "^3.5.3"
|
|
53
56
|
},
|
|
54
57
|
"devDependencies": {
|
|
55
58
|
"@tokens-studio/types": "0.5.2",
|
|
56
59
|
"@types/apca-w3": "^0.1.3",
|
|
57
60
|
"@types/chroma-js": "^3.1.1",
|
|
58
61
|
"@types/fs-extra": "^11.0.4",
|
|
59
|
-
"@types/node": "^22.16.
|
|
62
|
+
"@types/node": "^22.16.3",
|
|
60
63
|
"@types/object-hash": "^3.0.6",
|
|
61
64
|
"@types/ramda": "^0.30.2",
|
|
62
65
|
"fs-extra": "^11.3.0",
|