@digdir/designsystemet 1.16.1 → 1.17.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/README.md +2 -15
- package/dist/bin/config.d.ts +2 -4
- package/dist/bin/config.d.ts.map +1 -1
- package/dist/bin/config.js +6 -8
- package/dist/bin/designsystemet.d.ts +1 -1
- package/dist/bin/designsystemet.d.ts.map +1 -1
- package/dist/bin/designsystemet.js +12 -13
- package/dist/config.schema.json +5 -33
- package/dist/package.js +1 -1
- package/dist/src/automigrate.d.ts +2 -0
- package/dist/src/automigrate.d.ts.map +1 -0
- package/dist/src/automigrate.js +33 -0
- package/dist/src/colors/types.d.ts +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -3
- package/dist/src/migrations/flatten-color-categories.d.ts +10 -0
- package/dist/src/migrations/flatten-color-categories.d.ts.map +1 -0
- package/dist/src/migrations/flatten-color-categories.js +51 -0
- package/dist/src/migrations/index.d.ts +9 -0
- package/dist/src/migrations/index.d.ts.map +1 -1
- package/dist/src/migrations/index.js +3 -1
- package/dist/src/schemas/helpers.d.ts +29 -0
- package/dist/src/schemas/helpers.d.ts.map +1 -0
- package/dist/src/schemas/helpers.js +71 -0
- package/dist/src/{config.d.ts → schemas/v1/schema.d.ts} +1 -12
- package/dist/src/schemas/v1/schema.d.ts.map +1 -0
- package/dist/src/{config.js → schemas/v1/schema.js} +6 -61
- package/dist/src/schemas/v1.1/schema.d.ts +162 -0
- package/dist/src/schemas/v1.1/schema.d.ts.map +1 -0
- package/dist/src/schemas/v1.1/schema.js +54 -0
- package/dist/src/tokens/build.js +1 -1
- package/dist/src/tokens/create/files.d.ts +2 -2
- package/dist/src/tokens/create/files.d.ts.map +1 -1
- package/dist/src/tokens/create/files.js +3 -3
- package/dist/src/tokens/create/generators/$metadata.d.ts +2 -2
- package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$metadata.js +2 -4
- package/dist/src/tokens/create/generators/$themes.d.ts +2 -2
- package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$themes.js +7 -10
- package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts +4 -4
- package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/primitives/color-scheme.js +9 -11
- package/dist/src/tokens/create/generators/semantic/color.d.ts +2 -4
- package/dist/src/tokens/create/generators/semantic/color.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/semantic/color.js +9 -38
- package/dist/src/tokens/create/generators/semantic/style.d.ts +1 -1
- package/dist/src/tokens/create/generators/semantic/style.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/semantic/style.js +78 -41
- package/dist/src/tokens/create/generators/themes/theme.d.ts +2 -2
- package/dist/src/tokens/create/generators/themes/theme.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/themes/theme.js +2 -11
- package/dist/src/tokens/create.d.ts +0 -16
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +10 -22
- package/dist/src/tokens/format.js +6 -4
- package/dist/src/tokens/generate-config.d.ts +3 -2
- package/dist/src/tokens/generate-config.d.ts.map +1 -1
- package/dist/src/tokens/generate-config.js +10 -36
- package/dist/src/tokens/index.d.ts +2 -1
- package/dist/src/tokens/index.d.ts.map +1 -1
- package/dist/src/tokens/index.js +3 -2
- package/dist/src/tokens/process/configs/color.d.ts +1 -9
- package/dist/src/tokens/process/configs/color.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/color.js +6 -9
- package/dist/src/tokens/process/configs.d.ts +1 -7
- package/dist/src/tokens/process/configs.d.ts.map +1 -1
- package/dist/src/tokens/process/configs.js +3 -24
- package/dist/src/tokens/process/formats/css/color.d.ts.map +1 -1
- package/dist/src/tokens/process/formats/css/color.js +3 -4
- package/dist/src/tokens/process/formats/css/size-mode.d.ts +0 -1
- package/dist/src/tokens/process/formats/css/size-mode.d.ts.map +1 -1
- package/dist/src/tokens/process/formats/css/size-mode.js +1 -1
- package/dist/src/tokens/process/formats/css/size.d.ts +0 -12
- package/dist/src/tokens/process/formats/css/size.d.ts.map +1 -1
- package/dist/src/tokens/process/formats/css/size.js +1 -1
- package/dist/src/tokens/process/output/declarations.d.ts.map +1 -1
- package/dist/src/tokens/process/output/declarations.js +6 -8
- package/dist/src/tokens/process/platform.d.ts +4 -36
- package/dist/src/tokens/process/platform.d.ts.map +1 -1
- package/dist/src/tokens/process/platform.js +8 -50
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts +2 -3
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts.map +1 -1
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +4 -8
- package/dist/src/tokens/types.d.ts +3 -11
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/dist/src/tokens/types.js +1 -7
- package/dist/src/tokens/utils.d.ts +5 -11
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/dist/src/tokens/utils.js +8 -13
- package/package.json +7 -3
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/semantic/color-modes.d.ts +0 -8
- package/dist/src/tokens/create/generators/semantic/color-modes.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/semantic/color-modes.js +0 -26
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { baseColors } from "../../../colors/colorMetadata.js";
|
|
1
2
|
import { version } from "../../../../package.js";
|
|
2
|
-
import {
|
|
3
|
-
import { buildOptions } from "../platform.js";
|
|
3
|
+
import { getThemeColors } from "../utils/getMultidimensionalThemes.js";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
//#region src/tokens/process/output/declarations.ts
|
|
6
6
|
const defaultFileHeader = `build: v${version}`;
|
|
7
7
|
const createTypeDeclarationFiles = (processed$themes) => {
|
|
8
|
-
const typeDeclaration = createColorTypeDeclaration(
|
|
8
|
+
const typeDeclaration = createColorTypeDeclaration(getThemeColors(processed$themes));
|
|
9
9
|
return [{
|
|
10
10
|
output: `/* This file is deprecated and will be removed in a future release. Use types.d.ts instead */\n${typeDeclaration}`,
|
|
11
11
|
destination: "colors.d.ts"
|
|
@@ -16,6 +16,7 @@ const createTypeDeclarationFiles = (processed$themes) => {
|
|
|
16
16
|
};
|
|
17
17
|
function createColorTypeDeclaration(colors) {
|
|
18
18
|
console.log(`\n🍱 Building ${pc.green("type declarations")}`);
|
|
19
|
+
const severityColors = Object.keys(baseColors);
|
|
19
20
|
return `
|
|
20
21
|
/* ${defaultFileHeader} */
|
|
21
22
|
import type {} from '@digdir/designsystemet-types';
|
|
@@ -23,13 +24,10 @@ import type {} from '@digdir/designsystemet-types';
|
|
|
23
24
|
// Augment types based on theme
|
|
24
25
|
declare module '@digdir/designsystemet-types' {
|
|
25
26
|
export interface ColorDefinitions {
|
|
26
|
-
${colors.map((color) => ` ${color.includes("-") ? `'${color}'` : color}: never;`).join("\n")}
|
|
27
|
+
${colors.filter((color) => !severityColors.includes(color)).map((color) => ` ${color.includes("-") ? `'${color}'` : color}: never;`).join("\n")}
|
|
27
28
|
}
|
|
28
29
|
export interface SeverityColorDefinitions {
|
|
29
|
-
|
|
30
|
-
success: never;
|
|
31
|
-
warning: never;
|
|
32
|
-
danger: never;
|
|
30
|
+
${severityColors.map((color) => ` ${color}: never;`).join("\n")}
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
33
|
`.trimStart();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
|
-
import type { OutputFile, TokenSet } from '../types.js';
|
|
3
|
-
import { type ThemePermutation } from '../types.js';
|
|
2
|
+
import type { OutputFile, ThemePermutation, TokenSet } from '../types.js';
|
|
4
3
|
import { type ProcessedThemeObject } from './utils/getMultidimensionalThemes.js';
|
|
5
4
|
type SharedOptions = {
|
|
6
5
|
/** Enable verbose output */
|
|
@@ -13,8 +12,6 @@ type SharedOptions = {
|
|
|
13
12
|
sizeModes?: string[];
|
|
14
13
|
/** Token Studio `$themes.json` content */
|
|
15
14
|
processed$themes: ProcessedThemeObject[];
|
|
16
|
-
/** Color groups */
|
|
17
|
-
colorGroups?: string[];
|
|
18
15
|
/** Build token format map */
|
|
19
16
|
buildTokenFormats: Record<string, {
|
|
20
17
|
token: TransformedToken;
|
|
@@ -33,7 +30,7 @@ export type FormatOptions = {
|
|
|
33
30
|
/** Tokensets */
|
|
34
31
|
tokenSets: Map<string, TokenSet>;
|
|
35
32
|
} & SharedOptions;
|
|
36
|
-
|
|
33
|
+
type ProcessOptions = BuildOptions | FormatOptions;
|
|
37
34
|
type ProcessedBuildConfigs<T> = Record<keyof typeof buildConfigs, T>;
|
|
38
35
|
export type ProcessReturn = ProcessedBuildConfigs<BuildResult[]>;
|
|
39
36
|
type BuildResult = {
|
|
@@ -63,38 +60,9 @@ declare const buildConfigs: {
|
|
|
63
60
|
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
64
61
|
dimensions: "color-scheme"[];
|
|
65
62
|
};
|
|
66
|
-
|
|
63
|
+
color: {
|
|
67
64
|
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
68
|
-
dimensions: "
|
|
69
|
-
};
|
|
70
|
-
'support-color': {
|
|
71
|
-
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
72
|
-
dimensions: "support-color"[];
|
|
73
|
-
};
|
|
74
|
-
'neutral-color': {
|
|
75
|
-
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
76
|
-
dimensions: "semantic"[];
|
|
77
|
-
log: ({ permutation: { theme } }: import("../types.js").SDConfigForThemePermutation) => string;
|
|
78
|
-
};
|
|
79
|
-
'success-color': {
|
|
80
|
-
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
81
|
-
dimensions: "semantic"[];
|
|
82
|
-
log: ({ permutation: { theme } }: import("../types.js").SDConfigForThemePermutation) => string;
|
|
83
|
-
};
|
|
84
|
-
'danger-color': {
|
|
85
|
-
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
86
|
-
dimensions: "semantic"[];
|
|
87
|
-
log: ({ permutation: { theme } }: import("../types.js").SDConfigForThemePermutation) => string;
|
|
88
|
-
};
|
|
89
|
-
'warning-color': {
|
|
90
|
-
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
91
|
-
dimensions: "semantic"[];
|
|
92
|
-
log: ({ permutation: { theme } }: import("../types.js").SDConfigForThemePermutation) => string;
|
|
93
|
-
};
|
|
94
|
-
'info-color': {
|
|
95
|
-
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
96
|
-
dimensions: "semantic"[];
|
|
97
|
-
log: ({ permutation: { theme } }: import("../types.js").SDConfigForThemePermutation) => string;
|
|
65
|
+
dimensions: "color"[];
|
|
98
66
|
};
|
|
99
67
|
semantic: {
|
|
100
68
|
getConfig: import("./configs/shared.js").GetStyleDictionaryConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/platform.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/platform.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAe,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjG,KAAK,aAAa,GAAG;IACnB,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,WA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
-
import { colorCategories } from "../types.js";
|
|
2
|
-
import { getCustomColors } from "./utils/getMultidimensionalThemes.js";
|
|
3
1
|
import { configs, getConfigsForThemeDimensions } from "./configs.js";
|
|
2
|
+
import { getThemeColors } from "./utils/getMultidimensionalThemes.js";
|
|
4
3
|
import pc from "picocolors";
|
|
5
4
|
import * as R from "ramda";
|
|
6
5
|
import StyleDictionary from "style-dictionary";
|
|
@@ -10,8 +9,7 @@ const initResult = {
|
|
|
10
9
|
tokens: [],
|
|
11
10
|
permutation: {
|
|
12
11
|
"color-scheme": "",
|
|
13
|
-
|
|
14
|
-
"support-color": "",
|
|
12
|
+
color: "",
|
|
15
13
|
semantic: "",
|
|
16
14
|
size: "",
|
|
17
15
|
theme: "",
|
|
@@ -45,38 +43,9 @@ const buildConfigs = {
|
|
|
45
43
|
getConfig: configs.colorSchemeVariables,
|
|
46
44
|
dimensions: ["color-scheme"]
|
|
47
45
|
},
|
|
48
|
-
|
|
49
|
-
getConfig: configs.
|
|
50
|
-
dimensions: ["
|
|
51
|
-
},
|
|
52
|
-
"support-color": {
|
|
53
|
-
getConfig: configs.supportColorVariables,
|
|
54
|
-
dimensions: ["support-color"]
|
|
55
|
-
},
|
|
56
|
-
"neutral-color": {
|
|
57
|
-
getConfig: configs.neutralColorVariables,
|
|
58
|
-
dimensions: ["semantic"],
|
|
59
|
-
log: ({ permutation: { theme } }) => `${theme} - neutral`
|
|
60
|
-
},
|
|
61
|
-
"success-color": {
|
|
62
|
-
getConfig: configs.successColorVariables,
|
|
63
|
-
dimensions: ["semantic"],
|
|
64
|
-
log: ({ permutation: { theme } }) => `${theme} - success`
|
|
65
|
-
},
|
|
66
|
-
"danger-color": {
|
|
67
|
-
getConfig: configs.dangerColorVariables,
|
|
68
|
-
dimensions: ["semantic"],
|
|
69
|
-
log: ({ permutation: { theme } }) => `${theme} - danger`
|
|
70
|
-
},
|
|
71
|
-
"warning-color": {
|
|
72
|
-
getConfig: configs.warningColorVariables,
|
|
73
|
-
dimensions: ["semantic"],
|
|
74
|
-
log: ({ permutation: { theme } }) => `${theme} - warning`
|
|
75
|
-
},
|
|
76
|
-
"info-color": {
|
|
77
|
-
getConfig: configs.infoColorVariables,
|
|
78
|
-
dimensions: ["semantic"],
|
|
79
|
-
log: ({ permutation: { theme } }) => `${theme} - info`
|
|
46
|
+
color: {
|
|
47
|
+
getConfig: configs.colorVariables,
|
|
48
|
+
dimensions: ["color"]
|
|
80
49
|
},
|
|
81
50
|
semantic: {
|
|
82
51
|
getConfig: configs.semanticVariables,
|
|
@@ -90,17 +59,12 @@ async function processPlatform(options) {
|
|
|
90
59
|
const tokensDir = type === "build" ? options.tokensDir : void 0;
|
|
91
60
|
const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
|
|
92
61
|
if (UNSAFE_DEFAULT_COLOR) console.warn(pc.yellow(`\n⚠️ UNSAFE_DEFAULT_COLOR is set to ${pc.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`));
|
|
93
|
-
const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
|
|
94
|
-
if (UNSAFE_COLOR_GROUPS.length > 0) console.warn(pc.yellow(`\n⚠️ UNSAFE_COLOR_GROUPS is set to ${pc.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`));
|
|
95
|
-
const colorGroups = UNSAFE_COLOR_GROUPS.length > 0 ? UNSAFE_COLOR_GROUPS : [colorCategories.main, colorCategories.support].map((c) => `${c}-color`);
|
|
96
62
|
/** For sharing build options in other files */
|
|
97
63
|
buildOptions = options;
|
|
98
64
|
buildOptions.defaultColor = UNSAFE_DEFAULT_COLOR;
|
|
99
|
-
buildOptions.colorGroups = colorGroups;
|
|
100
65
|
if (!buildOptions.defaultColor) {
|
|
101
|
-
const customColors =
|
|
102
|
-
|
|
103
|
-
buildOptions.defaultColor = firstMainColor;
|
|
66
|
+
const customColors = getThemeColors(processed$themes);
|
|
67
|
+
buildOptions.defaultColor = R.head(customColors);
|
|
104
68
|
}
|
|
105
69
|
if (buildOptions.defaultColor) console.log(`\n🎨 Using ${pc.blue(buildOptions.defaultColor)} as default color`);
|
|
106
70
|
const sizeModes = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
|
|
@@ -124,13 +88,7 @@ async function processPlatform(options) {
|
|
|
124
88
|
}, buildConfigs);
|
|
125
89
|
const processedBuilds = {
|
|
126
90
|
"color-scheme": [initResult],
|
|
127
|
-
|
|
128
|
-
"support-color": [initResult],
|
|
129
|
-
"neutral-color": [initResult],
|
|
130
|
-
"success-color": [initResult],
|
|
131
|
-
"danger-color": [initResult],
|
|
132
|
-
"warning-color": [initResult],
|
|
133
|
-
"info-color": [initResult],
|
|
91
|
+
color: [initResult],
|
|
134
92
|
semantic: [initResult],
|
|
135
93
|
typography: [initResult],
|
|
136
94
|
sizeMode: [initResult],
|
|
@@ -12,7 +12,7 @@ import type { ThemeDimension, ThemePermutation } from '../../types.js';
|
|
|
12
12
|
* @returns the relevant theme permutations
|
|
13
13
|
*/
|
|
14
14
|
export declare const getMultidimensionalThemes: (processed$themes: ProcessedThemeObject[], dimensions: ThemeDimension[]) => PermutatedTheme[];
|
|
15
|
-
|
|
15
|
+
type PermutatedTheme = {
|
|
16
16
|
name: string;
|
|
17
17
|
selectedTokenSets: string[];
|
|
18
18
|
permutation: ThemePermutation;
|
|
@@ -30,7 +30,6 @@ export type ProcessedThemeObject = ThemeObject & {
|
|
|
30
30
|
* @returns Processed theme object
|
|
31
31
|
*/
|
|
32
32
|
export declare function processThemeObject(theme: ThemeObject | ProcessedThemeObject): ProcessedThemeObject;
|
|
33
|
-
export
|
|
34
|
-
export declare const getCustomColors: (processed$themes: ProcessedThemeObject[], colorGroups: (string | RegExp)[]) => string[];
|
|
33
|
+
export declare const getThemeColors: (processed$themes: ProcessedThemeObject[]) => string[];
|
|
35
34
|
export {};
|
|
36
35
|
//# sourceMappingURL=getMultidimensionalThemes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMultidimensionalThemes.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/utils/getMultidimensionalThemes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,kBAAkB,oBAAoB,EAAE,EAAE,YAAY,cAAc,EAAE,sBAe/G,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"getMultidimensionalThemes.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/utils/getMultidimensionalThemes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,kBAAkB,oBAAoB,EAAE,EAAE,YAAY,cAAc,EAAE,sBAe/G,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,OAAO,MAAsD,CAAC;AAC/E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAMvE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,GAAG,oBAAoB,CAUlG;AA+FD,eAAO,MAAM,cAAc,GAAI,kBAAkB,oBAAoB,EAAE,aAC8B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TokenSetStatus } from "../../../../node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js";
|
|
2
2
|
import "../../../../node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/types/index.js";
|
|
3
|
-
import { kebabCase } from "./kebab-case.js";
|
|
4
3
|
import { buildOptions } from "../platform.js";
|
|
4
|
+
import { kebabCase } from "./kebab-case.js";
|
|
5
5
|
import pc from "picocolors";
|
|
6
6
|
import * as R from "ramda";
|
|
7
7
|
//#region src/tokens/process/utils/getMultidimensionalThemes.ts
|
|
@@ -80,8 +80,7 @@ function permutateThemes(groups) {
|
|
|
80
80
|
selectedTokenSets: [],
|
|
81
81
|
permutation: {
|
|
82
82
|
"color-scheme": "unknown",
|
|
83
|
-
|
|
84
|
-
"support-color": "unknown",
|
|
83
|
+
color: "unknown",
|
|
85
84
|
theme: "unknown",
|
|
86
85
|
semantic: "unknown",
|
|
87
86
|
size: "unknown",
|
|
@@ -106,9 +105,6 @@ function filterTokenSets(tokensets) {
|
|
|
106
105
|
function cartesian(a) {
|
|
107
106
|
return a.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat())));
|
|
108
107
|
}
|
|
109
|
-
const
|
|
110
|
-
if (!x.group) return false;
|
|
111
|
-
return colorGroups.includes(x.group);
|
|
112
|
-
}).map((x) => x.name);
|
|
108
|
+
const getThemeColors = (processed$themes) => Array.from(new Set(processed$themes.filter((x) => x.group === "color").map((x) => x.name)));
|
|
113
109
|
//#endregion
|
|
114
|
-
export {
|
|
110
|
+
export { getMultidimensionalThemes, getThemeColors, processThemeObject };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config as SDConfig } from 'style-dictionary/types';
|
|
2
|
-
import type { ConfigSchemaTheme } from '../config.js';
|
|
3
2
|
import type { ColorScheme } from '../index.js';
|
|
3
|
+
import type { ConfigSchemaTheme } from '../schemas/v1.1/schema.js';
|
|
4
4
|
import type { GetStyleDictionaryConfig } from './process/configs/shared.js';
|
|
5
5
|
export type Token = {
|
|
6
6
|
$value: string | Record<string, string>[];
|
|
@@ -21,21 +21,13 @@ export type Typography = Theme['typography'];
|
|
|
21
21
|
export type Theme = {
|
|
22
22
|
name: string;
|
|
23
23
|
} & Required<Omit<ConfigSchemaTheme, 'overrides'>> & Pick<ConfigSchemaTheme, 'overrides'>;
|
|
24
|
-
export declare const colorCategories: {
|
|
25
|
-
readonly main: "main";
|
|
26
|
-
readonly support: "support";
|
|
27
|
-
};
|
|
28
|
-
export type ColorCategories = keyof typeof colorCategories;
|
|
29
|
-
export type ColorNamesByCategory = Record<ColorCategories, string[]>;
|
|
30
|
-
export type BuiltInColors = 'neutral' | 'success' | 'warning' | 'danger' | 'info';
|
|
31
24
|
export type SizeModes = 'small' | 'medium' | 'large';
|
|
32
25
|
/**
|
|
33
26
|
* A multi-dimensional theme is a concrete permutation of the possible theme dimensions
|
|
34
27
|
*/
|
|
35
28
|
export type ThemePermutation = {
|
|
36
29
|
'color-scheme': string;
|
|
37
|
-
|
|
38
|
-
'support-color'?: string;
|
|
30
|
+
color: string;
|
|
39
31
|
semantic: string;
|
|
40
32
|
size: string;
|
|
41
33
|
theme: string;
|
|
@@ -56,7 +48,7 @@ export type BuildConfig = {
|
|
|
56
48
|
name?: string;
|
|
57
49
|
/** Style Dictionary configuration creator */
|
|
58
50
|
getConfig: GetStyleDictionaryConfig;
|
|
59
|
-
/** Which theme dimensions to include. `theme`
|
|
51
|
+
/** Which theme dimensions to include. `theme` is always included. */
|
|
60
52
|
dimensions: ThemeDimension[];
|
|
61
53
|
/** Whether the build config is enabled. @default () => true */
|
|
62
54
|
enabled?: () => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tokens/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,wBAAwB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AC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/dist/src/tokens/types.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { Tokens } from 'style-dictionary';
|
|
2
2
|
import type { DesignToken, TransformedToken } from 'style-dictionary/types';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
* Returns type based on design token format used. Read more:https://v4.styledictionary.com/info/dtcg/
|
|
6
|
-
* @param token Transformed token
|
|
7
|
-
* @returns type
|
|
8
|
-
*/
|
|
9
|
-
export declare const getType: (token: TransformedToken) => string;
|
|
3
|
+
import type { CssColor } from '../index.js';
|
|
4
|
+
import type { Theme, TokenSet } from './types.js';
|
|
10
5
|
/**
|
|
11
6
|
* Returns value based on design token format used. Read more:https://v4.styledictionary.com/info/dtcg/
|
|
12
7
|
*
|
|
@@ -26,12 +21,10 @@ export declare const typeEquals: (types: string[] | string, token: TransformedTo
|
|
|
26
21
|
export declare const pathStartsWithOneOf: ((paths: (string | string[])[], token: TransformedToken) => boolean) & ((paths: (string | string[])[]) => (token: TransformedToken) => boolean);
|
|
27
22
|
export declare function isSemanticToken(token: TransformedToken): boolean;
|
|
28
23
|
export declare function isSemanticColorToken(token: TransformedToken, color: string): boolean;
|
|
29
|
-
export declare function isGlobalColorToken(token: TransformedToken): boolean;
|
|
30
|
-
export declare function isColorCategoryToken(token: TransformedToken, category?: ColorCategories): boolean;
|
|
31
24
|
export declare const isDigit: (s: string) => boolean;
|
|
32
25
|
/** Copied from Style Dictionary and added types
|
|
33
26
|
@see https://github.com/amzn/style-dictionary/blob/31c29df0382a61b085f6392dc3225c5009fbffc5/lib/utils/combineJSON.js#L33 */
|
|
34
|
-
export declare function traverseObj(obj: Tokens | TokenSet, fn: (obj: TokenSet | Tokens | DesignToken, key: keyof Tokens | string, slice: Tokens | DesignToken | string) => void): import("style-dictionary/types").DesignTokens
|
|
27
|
+
export declare function traverseObj(obj: Tokens | TokenSet, fn: (obj: TokenSet | Tokens | DesignToken, key: keyof Tokens | string, slice: Tokens | DesignToken | string) => void): TokenSet | import("style-dictionary/types").DesignTokens;
|
|
35
28
|
/**
|
|
36
29
|
* In the given tokens array, inline and remove tokens that match the predicate
|
|
37
30
|
*
|
|
@@ -60,5 +53,6 @@ export declare function inlineTokens(shouldInline: (t: TransformedToken) => bool
|
|
|
60
53
|
export declare function shortSizeName(size: string): string;
|
|
61
54
|
export declare const sizeComparator: (size: string) => number;
|
|
62
55
|
export declare function orderBySize(sizes: string[]): string[];
|
|
63
|
-
export declare function
|
|
56
|
+
export declare function addSeverityColors(colors: Theme['colors']): Record<string, CssColor>;
|
|
57
|
+
export declare function toColorNames(themeColors: Theme['colors']): string[];
|
|
64
58
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokens/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokens/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAalD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,OAAO,gBAAgB,GAAG,WAAW,KAAG,CAAuC,CAAC;AAE5G;;;;;;GAMG;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C,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAGnF;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,EAAE,CAInE"}
|
package/dist/src/tokens/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { baseColors } from "../colors/colorMetadata.js";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
//#region src/tokens/utils.ts
|
|
4
4
|
const mapToLowerCase = R.map(R.toLower);
|
|
@@ -42,13 +42,6 @@ function isSemanticToken(token) {
|
|
|
42
42
|
function isSemanticColorToken(token, color) {
|
|
43
43
|
return token.filePath.includes("semantic/") && R.startsWith(["color", color], token.path);
|
|
44
44
|
}
|
|
45
|
-
function isGlobalColorToken(token) {
|
|
46
|
-
return typeEquals("color", token) && pathStartsWithOneOf(["global"], token);
|
|
47
|
-
}
|
|
48
|
-
function isColorCategoryToken(token, category) {
|
|
49
|
-
if (!category) return Object.keys(colorCategories).some((colorCategory) => isColorCategoryToken(token, colorCategory));
|
|
50
|
-
return R.startsWith(["color", category], token.path);
|
|
51
|
-
}
|
|
52
45
|
const isDigit = (s) => /^\d+$/.test(s);
|
|
53
46
|
/** Copied from Style Dictionary and added types
|
|
54
47
|
@see https://github.com/amzn/style-dictionary/blob/31c29df0382a61b085f6392dc3225c5009fbffc5/lib/utils/combineJSON.js#L33 */
|
|
@@ -117,10 +110,12 @@ const sizeComparator = (size) => {
|
|
|
117
110
|
function orderBySize(sizes) {
|
|
118
111
|
return R.sortBy(sizeComparator, sizes);
|
|
119
112
|
}
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
function addSeverityColors(colors) {
|
|
114
|
+
return R.mergeDeepLeft(colors, baseColors);
|
|
115
|
+
}
|
|
116
|
+
function toColorNames(themeColors) {
|
|
117
|
+
const colors = addSeverityColors(themeColors);
|
|
118
|
+
return Object.keys(colors);
|
|
124
119
|
}
|
|
125
120
|
//#endregion
|
|
126
|
-
export {
|
|
121
|
+
export { addSeverityColors, getValue, inlineTokens, isDigit, isSemanticColorToken, isSemanticToken, orderBySize, pathStartsWithOneOf, shortSizeName, sizeComparator, toColorNames, traverseObj, typeEquals };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digdir/designsystemet",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "CLI for Designsystemet",
|
|
5
5
|
"author": "Designsystemet team",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=24.16.0"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"./types": {
|
|
32
32
|
"import": "./dist/src/types.js"
|
|
33
|
+
},
|
|
34
|
+
"./schemas/*": {
|
|
35
|
+
"import": "./dist/src/schemas/*"
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
"publishConfig": {
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
42
|
"@commander-js/extra-typings": "^14.0.0",
|
|
43
|
+
"@inquirer/confirm": "^6.1.0",
|
|
40
44
|
"@tokens-studio/sd-transforms": "2.0.3",
|
|
41
45
|
"chroma-js": "^3.2.0",
|
|
42
46
|
"colorjs.io": "^0.6.1",
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
"style-dictionary": "^5.4.4",
|
|
51
55
|
"zod": "^4.4.3",
|
|
52
56
|
"zod-validation-error": "^5.0.0",
|
|
53
|
-
"@digdir/designsystemet-types": "1.
|
|
57
|
+
"@digdir/designsystemet-types": "1.17.0"
|
|
54
58
|
},
|
|
55
59
|
"devDependencies": {
|
|
56
60
|
"@tokens-studio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mB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Colors, TokenSet } from '../../../types.js';
|
|
2
|
-
type SemanticModes = {
|
|
3
|
-
'main-color': Record<string, TokenSet>;
|
|
4
|
-
'support-color': Record<string, TokenSet>;
|
|
5
|
-
};
|
|
6
|
-
export declare const generateColorModes: (colors: Colors, _themeName: string) => SemanticModes;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=color-modes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-modes.d.ts","sourceRoot":"","sources":["../../../../../../src/tokens/create/generators/semantic/color-modes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAS,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,YAAY,MAAM,kBA4BpE,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { semanticColorNames } from "../../../../colors/types.js";
|
|
2
|
-
//#region src/tokens/create/generators/semantic/color-modes.ts
|
|
3
|
-
const generateColorModes = (colors, _themeName) => {
|
|
4
|
-
const mainColorNames = Object.keys(colors.main);
|
|
5
|
-
const supportColorNames = Object.keys(colors.support);
|
|
6
|
-
const modes = {
|
|
7
|
-
"main-color": {},
|
|
8
|
-
"support-color": {}
|
|
9
|
-
};
|
|
10
|
-
const categories = [["main-color", mainColorNames], ["support-color", supportColorNames]];
|
|
11
|
-
for (const [colorCategory, colorNames] of categories) for (const colorName of colorNames) {
|
|
12
|
-
const customColorTokens = { color: { [colorCategory.replace("-color", "")]: generateColorScaleTokens(colorName) } };
|
|
13
|
-
modes[colorCategory][colorName] = customColorTokens;
|
|
14
|
-
}
|
|
15
|
-
return modes;
|
|
16
|
-
};
|
|
17
|
-
const generateColorScaleTokens = (colorName) => {
|
|
18
|
-
const colorScale = {};
|
|
19
|
-
for (const colorSemantic of semanticColorNames) colorScale[colorSemantic] = {
|
|
20
|
-
$type: "color",
|
|
21
|
-
$value: `{color.${colorName}.${colorSemantic}}`
|
|
22
|
-
};
|
|
23
|
-
return colorScale;
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
|
-
export { generateColorModes };
|