@digdir/designsystemet 1.7.3 → 1.9.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/configs/test-tokens.config.json +10 -0
- package/dist/bin/config.js +12 -1
- package/dist/bin/designsystemet.js +52 -14
- package/dist/{color.base.template-QGZJKXMN.json → color.base.template-5XWYH2F5.json} +3 -3
- package/dist/config.schema.json +33 -0
- package/dist/src/config.d.ts +30 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +12 -1
- package/dist/src/index.js +50 -12
- package/dist/src/scripts/createJsonSchema.js +12 -1
- package/dist/src/scripts/update-preview-tokens.js +30 -4
- package/dist/src/scripts/update-template.js +12 -2
- package/dist/src/tokens/build.js +10 -9
- package/dist/src/tokens/create/generators/$designsystemet.js +8 -7
- package/dist/src/tokens/create/generators/color.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/color.js +18 -2
- package/dist/src/tokens/create/generators/semantic.js +2 -2
- package/dist/src/tokens/create/generators/theme.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/theme.js +10 -0
- package/dist/src/tokens/create/write.js +8 -7
- package/dist/src/tokens/create.js +30 -4
- package/dist/src/tokens/format.js +38 -11
- package/dist/src/tokens/index.js +38 -11
- package/dist/src/tokens/process/output/declarations.js +10 -9
- package/dist/src/tokens/process/output/theme.js +8 -7
- package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +1 -1
- package/dist/src/types.d.ts +4 -50
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +6 -0
- package/package.json +9 -8
package/dist/bin/config.js
CHANGED
|
@@ -397,10 +397,21 @@ var linkVisitedOverrideSchema = z.object({
|
|
|
397
397
|
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
398
398
|
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
399
399
|
}).describe('Overrides for the "link-visited" color');
|
|
400
|
+
var focusOverrideSchema = z.object({
|
|
401
|
+
inner: z.object({
|
|
402
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
403
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
404
|
+
}).optional().describe('Overrides for the "focus-inner" color'),
|
|
405
|
+
outer: z.object({
|
|
406
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
407
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
408
|
+
}).optional().describe('Overrides for the "focus-outer" color')
|
|
409
|
+
}).describe("Overrides for the focus colors");
|
|
400
410
|
var overridesSchema = z.object({
|
|
401
411
|
colors: semanticColorOverrideSchema.optional(),
|
|
402
412
|
severity: severityColorOverrideSchema.optional(),
|
|
403
|
-
linkVisited: linkVisitedOverrideSchema.optional()
|
|
413
|
+
linkVisited: linkVisitedOverrideSchema.optional(),
|
|
414
|
+
focus: focusOverrideSchema.optional()
|
|
404
415
|
}).describe("Overrides for generated design tokens. Currently only supports colors defined in your theme").optional();
|
|
405
416
|
var themeSchema = z.object({
|
|
406
417
|
colors: z.object({
|
|
@@ -861,7 +861,7 @@ import pc5 from "picocolors";
|
|
|
861
861
|
// package.json
|
|
862
862
|
var package_default = {
|
|
863
863
|
name: "@digdir/designsystemet",
|
|
864
|
-
version: "1.
|
|
864
|
+
version: "1.9.0",
|
|
865
865
|
description: "CLI for Designsystemet",
|
|
866
866
|
author: "Designsystemet team",
|
|
867
867
|
engines: {
|
|
@@ -924,10 +924,11 @@ var package_default = {
|
|
|
924
924
|
},
|
|
925
925
|
dependencies: {
|
|
926
926
|
"@commander-js/extra-typings": "^14.0.0",
|
|
927
|
-
"@
|
|
927
|
+
"@digdir/designsystemet-types": "workspace:^",
|
|
928
|
+
"@tokens-studio/sd-transforms": "2.0.3",
|
|
928
929
|
"apca-w3": "^0.1.9",
|
|
929
930
|
"change-case": "^5.4.4",
|
|
930
|
-
"chroma-js": "^3.
|
|
931
|
+
"chroma-js": "^3.2.0",
|
|
931
932
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
932
933
|
commander: "^14.0.2",
|
|
933
934
|
"fast-glob": "^3.3.3",
|
|
@@ -937,7 +938,7 @@ var package_default = {
|
|
|
937
938
|
postcss: "^8.5.6",
|
|
938
939
|
ramda: "^0.32.0",
|
|
939
940
|
"style-dictionary": "^5.1.1",
|
|
940
|
-
zod: "^4.1.
|
|
941
|
+
zod: "^4.1.13",
|
|
941
942
|
"zod-validation-error": "^4.0.2"
|
|
942
943
|
},
|
|
943
944
|
devDependencies: {
|
|
@@ -945,13 +946,13 @@ var package_default = {
|
|
|
945
946
|
"@types/apca-w3": "^0.1.3",
|
|
946
947
|
"@types/chroma-js": "^3.1.2",
|
|
947
948
|
"@types/fs-extra": "^11.0.4",
|
|
948
|
-
"@types/node": "^22.19.
|
|
949
|
+
"@types/node": "^22.19.1",
|
|
949
950
|
"@types/object-hash": "^3.0.6",
|
|
950
951
|
"@types/ramda": "^0.31.1",
|
|
951
952
|
"fs-extra": "^11.3.2",
|
|
952
953
|
tslib: "^2.8.1",
|
|
953
|
-
tsup: "^8.5.
|
|
954
|
-
tsx: "^4.
|
|
954
|
+
tsup: "^8.5.1",
|
|
955
|
+
tsx: "^4.21.0",
|
|
955
956
|
typescript: "^5.9.3"
|
|
956
957
|
}
|
|
957
958
|
};
|
|
@@ -2350,10 +2351,10 @@ function createColorTypeDeclaration(colors2) {
|
|
|
2350
2351
|
\u{1F371} Building ${pc5.green("type declarations")}`);
|
|
2351
2352
|
const typeDeclaration = `
|
|
2352
2353
|
/* ${defaultFileHeader} */
|
|
2353
|
-
import type {} from '@digdir/designsystemet
|
|
2354
|
+
import type {} from '@digdir/designsystemet-types';
|
|
2354
2355
|
|
|
2355
2356
|
// Augment types based on theme
|
|
2356
|
-
declare module '@digdir/designsystemet
|
|
2357
|
+
declare module '@digdir/designsystemet-types' {
|
|
2357
2358
|
export interface ColorDefinitions {
|
|
2358
2359
|
${colors2.map((color) => ` ${color.includes("-") ? `'${color}'` : color}: never;`).join("\n")}
|
|
2359
2360
|
}
|
|
@@ -3855,7 +3856,8 @@ var generateColorScheme = (themeName, colorScheme2, colors2, overrides) => {
|
|
|
3855
3856
|
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
3856
3857
|
colors2.support
|
|
3857
3858
|
);
|
|
3858
|
-
const
|
|
3859
|
+
const neutralColorScale = generateColorScale(colors2.neutral, colorScheme2);
|
|
3860
|
+
const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
|
|
3859
3861
|
const baseColorsWithOverrides = {
|
|
3860
3862
|
...baseColors,
|
|
3861
3863
|
...overrides?.severity
|
|
@@ -3865,7 +3867,12 @@ var generateColorScheme = (themeName, colorScheme2, colors2, overrides) => {
|
|
|
3865
3867
|
baseColorsWithOverrides
|
|
3866
3868
|
);
|
|
3867
3869
|
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
|
|
3870
|
+
const defaultLinkVisited = linkColor[12];
|
|
3868
3871
|
const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
|
|
3872
|
+
const defaultFocusInner = neutralColorScale[0].hex;
|
|
3873
|
+
const defaultFocusOuter = neutralColorScale[10].hex;
|
|
3874
|
+
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
|
|
3875
|
+
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
|
|
3869
3876
|
return {
|
|
3870
3877
|
[themeName]: {
|
|
3871
3878
|
...main,
|
|
@@ -3873,7 +3880,17 @@ var generateColorScheme = (themeName, colorScheme2, colors2, overrides) => {
|
|
|
3873
3880
|
neutral,
|
|
3874
3881
|
...globalColors,
|
|
3875
3882
|
link: {
|
|
3876
|
-
visited: linkOverride ||
|
|
3883
|
+
visited: linkOverride || defaultLinkVisited
|
|
3884
|
+
},
|
|
3885
|
+
focus: {
|
|
3886
|
+
inner: {
|
|
3887
|
+
$type: "color",
|
|
3888
|
+
$value: focusInnerOverride || defaultFocusInner
|
|
3889
|
+
},
|
|
3890
|
+
outer: {
|
|
3891
|
+
$type: "color",
|
|
3892
|
+
$value: focusOuterOverride || defaultFocusOuter
|
|
3893
|
+
}
|
|
3877
3894
|
}
|
|
3878
3895
|
}
|
|
3879
3896
|
};
|
|
@@ -3888,11 +3905,11 @@ var color_base_template_default = {
|
|
|
3888
3905
|
focus: {
|
|
3889
3906
|
inner: {
|
|
3890
3907
|
$type: "color",
|
|
3891
|
-
$value: "{color.
|
|
3908
|
+
$value: "{color.focus.inner-color}"
|
|
3892
3909
|
},
|
|
3893
3910
|
outer: {
|
|
3894
3911
|
$type: "color",
|
|
3895
|
-
$value: "{color.
|
|
3912
|
+
$value: "{color.focus.outer-color}"
|
|
3896
3913
|
}
|
|
3897
3914
|
}
|
|
3898
3915
|
},
|
|
@@ -4248,6 +4265,16 @@ var generateTheme = (colors2, themeName, borderRadius) => {
|
|
|
4248
4265
|
$type: "color",
|
|
4249
4266
|
$value: `{${themeName}.link.visited}`
|
|
4250
4267
|
}
|
|
4268
|
+
},
|
|
4269
|
+
focus: {
|
|
4270
|
+
"inner-color": {
|
|
4271
|
+
$type: "color",
|
|
4272
|
+
$value: `{${themeName}.focus.inner}`
|
|
4273
|
+
},
|
|
4274
|
+
"outer-color": {
|
|
4275
|
+
$type: "color",
|
|
4276
|
+
$value: `{${themeName}.focus.outer}`
|
|
4277
|
+
}
|
|
4251
4278
|
}
|
|
4252
4279
|
},
|
|
4253
4280
|
...remainingThemeFile
|
|
@@ -4640,10 +4667,21 @@ var linkVisitedOverrideSchema = z.object({
|
|
|
4640
4667
|
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
4641
4668
|
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
4642
4669
|
}).describe('Overrides for the "link-visited" color');
|
|
4670
|
+
var focusOverrideSchema = z.object({
|
|
4671
|
+
inner: z.object({
|
|
4672
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
4673
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
4674
|
+
}).optional().describe('Overrides for the "focus-inner" color'),
|
|
4675
|
+
outer: z.object({
|
|
4676
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
4677
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
4678
|
+
}).optional().describe('Overrides for the "focus-outer" color')
|
|
4679
|
+
}).describe("Overrides for the focus colors");
|
|
4643
4680
|
var overridesSchema = z.object({
|
|
4644
4681
|
colors: semanticColorOverrideSchema.optional(),
|
|
4645
4682
|
severity: severityColorOverrideSchema.optional(),
|
|
4646
|
-
linkVisited: linkVisitedOverrideSchema.optional()
|
|
4683
|
+
linkVisited: linkVisitedOverrideSchema.optional(),
|
|
4684
|
+
focus: focusOverrideSchema.optional()
|
|
4647
4685
|
}).describe("Overrides for generated design tokens. Currently only supports colors defined in your theme").optional();
|
|
4648
4686
|
var themeSchema = z.object({
|
|
4649
4687
|
colors: z.object({
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
"focus": {
|
|
4
4
|
"inner": {
|
|
5
5
|
"$type": "color",
|
|
6
|
-
"$value": "{color.
|
|
6
|
+
"$value": "{color.focus.inner-color}"
|
|
7
7
|
},
|
|
8
8
|
"outer": {
|
|
9
9
|
"$type": "color",
|
|
10
|
-
"$value": "{color.
|
|
10
|
+
"$value": "{color.focus.outer-color}"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
},
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
}
|
package/dist/config.schema.json
CHANGED
|
@@ -152,6 +152,39 @@
|
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
"additionalProperties": false
|
|
155
|
+
},
|
|
156
|
+
"focus": {
|
|
157
|
+
"description": "Overrides for the focus colors",
|
|
158
|
+
"type": "object",
|
|
159
|
+
"properties": {
|
|
160
|
+
"inner": {
|
|
161
|
+
"description": "Overrides for the \"focus-inner\" color",
|
|
162
|
+
"type": "object",
|
|
163
|
+
"properties": {
|
|
164
|
+
"light": {
|
|
165
|
+
"description": "A hex color that overrides light mode"
|
|
166
|
+
},
|
|
167
|
+
"dark": {
|
|
168
|
+
"description": "A hex color that overrides dark mode"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"additionalProperties": false
|
|
172
|
+
},
|
|
173
|
+
"outer": {
|
|
174
|
+
"description": "Overrides for the \"focus-outer\" color",
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"light": {
|
|
178
|
+
"description": "A hex color that overrides light mode"
|
|
179
|
+
},
|
|
180
|
+
"dark": {
|
|
181
|
+
"description": "A hex color that overrides dark mode"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"additionalProperties": false
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"additionalProperties": false
|
|
155
188
|
}
|
|
156
189
|
},
|
|
157
190
|
"additionalProperties": false
|
package/dist/src/config.d.ts
CHANGED
|
@@ -43,6 +43,16 @@ declare const overridesSchema: z.ZodOptional<z.ZodObject<{
|
|
|
43
43
|
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
44
44
|
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
45
45
|
}, z.core.$strip>>;
|
|
46
|
+
focus: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
inner: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
49
|
+
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
outer: z.ZodOptional<z.ZodObject<{
|
|
52
|
+
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
53
|
+
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
46
56
|
}, z.core.$strip>>;
|
|
47
57
|
declare const themeSchema: z.ZodObject<{
|
|
48
58
|
colors: z.ZodObject<{
|
|
@@ -86,6 +96,16 @@ declare const themeSchema: z.ZodObject<{
|
|
|
86
96
|
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
87
97
|
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
88
98
|
}, z.core.$strip>>;
|
|
99
|
+
focus: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
inner: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
102
|
+
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
outer: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
106
|
+
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
89
109
|
}, z.core.$strip>>;
|
|
90
110
|
}, z.core.$strip>;
|
|
91
111
|
export declare const commonConfig: z.ZodObject<{
|
|
@@ -138,6 +158,16 @@ export declare const configFileCreateSchema: z.ZodObject<{
|
|
|
138
158
|
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
139
159
|
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
140
160
|
}, z.core.$strip>>;
|
|
161
|
+
focus: z.ZodOptional<z.ZodObject<{
|
|
162
|
+
inner: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
164
|
+
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
outer: z.ZodOptional<z.ZodObject<{
|
|
167
|
+
light: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
168
|
+
dark: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`#${string}`, string>>>;
|
|
169
|
+
}, z.core.$strip>>;
|
|
170
|
+
}, z.core.$strip>>;
|
|
141
171
|
}, z.core.$strip>>;
|
|
142
172
|
}, z.core.$strip>>>;
|
|
143
173
|
clean: z.ZodOptional<z.ZodBoolean>;
|
package/dist/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuCxB;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,UAAU,EAAE,MAAM,GACjB,CAAC,CAUH;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAexE;AAWD,eAAO,MAAM,UAAU,QAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuCxB;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,UAAU,EAAE,MAAM,GACjB,CAAC,CAUH;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAexE;AAWD,eAAO,MAAM,UAAU,QAA2C,CAAC;AAuEnE,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQR,CAAC;AAEd,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBmG,CAAC;AAErH,eAAO,MAAM,YAAY;;iBAEvB,CAAC;AAYH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAqD,CAAC;AACzF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC7D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/src/config.js
CHANGED
|
@@ -392,10 +392,21 @@ var linkVisitedOverrideSchema = z.object({
|
|
|
392
392
|
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
393
393
|
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
394
394
|
}).describe('Overrides for the "link-visited" color');
|
|
395
|
+
var focusOverrideSchema = z.object({
|
|
396
|
+
inner: z.object({
|
|
397
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
398
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
399
|
+
}).optional().describe('Overrides for the "focus-inner" color'),
|
|
400
|
+
outer: z.object({
|
|
401
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
402
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
403
|
+
}).optional().describe('Overrides for the "focus-outer" color')
|
|
404
|
+
}).describe("Overrides for the focus colors");
|
|
395
405
|
var overridesSchema = z.object({
|
|
396
406
|
colors: semanticColorOverrideSchema.optional(),
|
|
397
407
|
severity: severityColorOverrideSchema.optional(),
|
|
398
|
-
linkVisited: linkVisitedOverrideSchema.optional()
|
|
408
|
+
linkVisited: linkVisitedOverrideSchema.optional(),
|
|
409
|
+
focus: focusOverrideSchema.optional()
|
|
399
410
|
}).describe("Overrides for generated design tokens. Currently only supports colors defined in your theme").optional();
|
|
400
411
|
var themeSchema = z.object({
|
|
401
412
|
colors: z.object({
|
package/dist/src/index.js
CHANGED
|
@@ -1512,7 +1512,8 @@ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
|
1512
1512
|
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
1513
1513
|
colors.support
|
|
1514
1514
|
);
|
|
1515
|
-
const
|
|
1515
|
+
const neutralColorScale = generateColorScale(colors.neutral, colorScheme2);
|
|
1516
|
+
const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
|
|
1516
1517
|
const baseColorsWithOverrides = {
|
|
1517
1518
|
...baseColors,
|
|
1518
1519
|
...overrides?.severity
|
|
@@ -1522,7 +1523,12 @@ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
|
1522
1523
|
baseColorsWithOverrides
|
|
1523
1524
|
);
|
|
1524
1525
|
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
|
|
1526
|
+
const defaultLinkVisited = linkColor[12];
|
|
1525
1527
|
const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
|
|
1528
|
+
const defaultFocusInner = neutralColorScale[0].hex;
|
|
1529
|
+
const defaultFocusOuter = neutralColorScale[10].hex;
|
|
1530
|
+
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
|
|
1531
|
+
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
|
|
1526
1532
|
return {
|
|
1527
1533
|
[themeName]: {
|
|
1528
1534
|
...main,
|
|
@@ -1530,7 +1536,17 @@ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
|
1530
1536
|
neutral,
|
|
1531
1537
|
...globalColors,
|
|
1532
1538
|
link: {
|
|
1533
|
-
visited: linkOverride ||
|
|
1539
|
+
visited: linkOverride || defaultLinkVisited
|
|
1540
|
+
},
|
|
1541
|
+
focus: {
|
|
1542
|
+
inner: {
|
|
1543
|
+
$type: "color",
|
|
1544
|
+
$value: focusInnerOverride || defaultFocusInner
|
|
1545
|
+
},
|
|
1546
|
+
outer: {
|
|
1547
|
+
$type: "color",
|
|
1548
|
+
$value: focusOuterOverride || defaultFocusOuter
|
|
1549
|
+
}
|
|
1534
1550
|
}
|
|
1535
1551
|
}
|
|
1536
1552
|
};
|
|
@@ -1545,11 +1561,11 @@ var color_base_template_default = {
|
|
|
1545
1561
|
focus: {
|
|
1546
1562
|
inner: {
|
|
1547
1563
|
$type: "color",
|
|
1548
|
-
$value: "{color.
|
|
1564
|
+
$value: "{color.focus.inner-color}"
|
|
1549
1565
|
},
|
|
1550
1566
|
outer: {
|
|
1551
1567
|
$type: "color",
|
|
1552
|
-
$value: "{color.
|
|
1568
|
+
$value: "{color.focus.outer-color}"
|
|
1553
1569
|
}
|
|
1554
1570
|
}
|
|
1555
1571
|
},
|
|
@@ -1905,6 +1921,16 @@ var generateTheme = (colors, themeName, borderRadius) => {
|
|
|
1905
1921
|
$type: "color",
|
|
1906
1922
|
$value: `{${themeName}.link.visited}`
|
|
1907
1923
|
}
|
|
1924
|
+
},
|
|
1925
|
+
focus: {
|
|
1926
|
+
"inner-color": {
|
|
1927
|
+
$type: "color",
|
|
1928
|
+
$value: `{${themeName}.focus.inner}`
|
|
1929
|
+
},
|
|
1930
|
+
"outer-color": {
|
|
1931
|
+
$type: "color",
|
|
1932
|
+
$value: `{${themeName}.focus.outer}`
|
|
1933
|
+
}
|
|
1908
1934
|
}
|
|
1909
1935
|
},
|
|
1910
1936
|
...remainingThemeFile
|
|
@@ -2040,10 +2066,21 @@ var linkVisitedOverrideSchema = z.object({
|
|
|
2040
2066
|
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
2041
2067
|
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
2042
2068
|
}).describe('Overrides for the "link-visited" color');
|
|
2069
|
+
var focusOverrideSchema = z.object({
|
|
2070
|
+
inner: z.object({
|
|
2071
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
2072
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
2073
|
+
}).optional().describe('Overrides for the "focus-inner" color'),
|
|
2074
|
+
outer: z.object({
|
|
2075
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
2076
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
2077
|
+
}).optional().describe('Overrides for the "focus-outer" color')
|
|
2078
|
+
}).describe("Overrides for the focus colors");
|
|
2043
2079
|
var overridesSchema = z.object({
|
|
2044
2080
|
colors: semanticColorOverrideSchema.optional(),
|
|
2045
2081
|
severity: severityColorOverrideSchema.optional(),
|
|
2046
|
-
linkVisited: linkVisitedOverrideSchema.optional()
|
|
2082
|
+
linkVisited: linkVisitedOverrideSchema.optional(),
|
|
2083
|
+
focus: focusOverrideSchema.optional()
|
|
2047
2084
|
}).describe("Overrides for generated design tokens. Currently only supports colors defined in your theme").optional();
|
|
2048
2085
|
var themeSchema = z.object({
|
|
2049
2086
|
colors: z.object({
|
|
@@ -2408,7 +2445,7 @@ import * as R9 from "ramda";
|
|
|
2408
2445
|
// package.json
|
|
2409
2446
|
var package_default = {
|
|
2410
2447
|
name: "@digdir/designsystemet",
|
|
2411
|
-
version: "1.
|
|
2448
|
+
version: "1.9.0",
|
|
2412
2449
|
description: "CLI for Designsystemet",
|
|
2413
2450
|
author: "Designsystemet team",
|
|
2414
2451
|
engines: {
|
|
@@ -2471,10 +2508,11 @@ var package_default = {
|
|
|
2471
2508
|
},
|
|
2472
2509
|
dependencies: {
|
|
2473
2510
|
"@commander-js/extra-typings": "^14.0.0",
|
|
2474
|
-
"@
|
|
2511
|
+
"@digdir/designsystemet-types": "workspace:^",
|
|
2512
|
+
"@tokens-studio/sd-transforms": "2.0.3",
|
|
2475
2513
|
"apca-w3": "^0.1.9",
|
|
2476
2514
|
"change-case": "^5.4.4",
|
|
2477
|
-
"chroma-js": "^3.
|
|
2515
|
+
"chroma-js": "^3.2.0",
|
|
2478
2516
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
2479
2517
|
commander: "^14.0.2",
|
|
2480
2518
|
"fast-glob": "^3.3.3",
|
|
@@ -2484,7 +2522,7 @@ var package_default = {
|
|
|
2484
2522
|
postcss: "^8.5.6",
|
|
2485
2523
|
ramda: "^0.32.0",
|
|
2486
2524
|
"style-dictionary": "^5.1.1",
|
|
2487
|
-
zod: "^4.1.
|
|
2525
|
+
zod: "^4.1.13",
|
|
2488
2526
|
"zod-validation-error": "^4.0.2"
|
|
2489
2527
|
},
|
|
2490
2528
|
devDependencies: {
|
|
@@ -2492,13 +2530,13 @@ var package_default = {
|
|
|
2492
2530
|
"@types/apca-w3": "^0.1.3",
|
|
2493
2531
|
"@types/chroma-js": "^3.1.2",
|
|
2494
2532
|
"@types/fs-extra": "^11.0.4",
|
|
2495
|
-
"@types/node": "^22.19.
|
|
2533
|
+
"@types/node": "^22.19.1",
|
|
2496
2534
|
"@types/object-hash": "^3.0.6",
|
|
2497
2535
|
"@types/ramda": "^0.31.1",
|
|
2498
2536
|
"fs-extra": "^11.3.2",
|
|
2499
2537
|
tslib: "^2.8.1",
|
|
2500
|
-
tsup: "^8.5.
|
|
2501
|
-
tsx: "^4.
|
|
2538
|
+
tsup: "^8.5.1",
|
|
2539
|
+
tsx: "^4.21.0",
|
|
2502
2540
|
typescript: "^5.9.3"
|
|
2503
2541
|
}
|
|
2504
2542
|
};
|
|
@@ -331,10 +331,21 @@ var linkVisitedOverrideSchema = z.object({
|
|
|
331
331
|
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
332
332
|
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
333
333
|
}).describe('Overrides for the "link-visited" color');
|
|
334
|
+
var focusOverrideSchema = z.object({
|
|
335
|
+
inner: z.object({
|
|
336
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
337
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
338
|
+
}).optional().describe('Overrides for the "focus-inner" color'),
|
|
339
|
+
outer: z.object({
|
|
340
|
+
light: colorSchema.optional().describe("A hex color that overrides light mode"),
|
|
341
|
+
dark: colorSchema.optional().describe("A hex color that overrides dark mode")
|
|
342
|
+
}).optional().describe('Overrides for the "focus-outer" color')
|
|
343
|
+
}).describe("Overrides for the focus colors");
|
|
334
344
|
var overridesSchema = z.object({
|
|
335
345
|
colors: semanticColorOverrideSchema.optional(),
|
|
336
346
|
severity: severityColorOverrideSchema.optional(),
|
|
337
|
-
linkVisited: linkVisitedOverrideSchema.optional()
|
|
347
|
+
linkVisited: linkVisitedOverrideSchema.optional(),
|
|
348
|
+
focus: focusOverrideSchema.optional()
|
|
338
349
|
}).describe("Overrides for generated design tokens. Currently only supports colors defined in your theme").optional();
|
|
339
350
|
var themeSchema = z.object({
|
|
340
351
|
colors: z.object({
|
|
@@ -1773,7 +1773,8 @@ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
|
1773
1773
|
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
1774
1774
|
colors.support
|
|
1775
1775
|
);
|
|
1776
|
-
const
|
|
1776
|
+
const neutralColorScale = generateColorScale(colors.neutral, colorScheme2);
|
|
1777
|
+
const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
|
|
1777
1778
|
const baseColorsWithOverrides = {
|
|
1778
1779
|
...baseColors,
|
|
1779
1780
|
...overrides?.severity
|
|
@@ -1783,7 +1784,12 @@ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
|
1783
1784
|
baseColorsWithOverrides
|
|
1784
1785
|
);
|
|
1785
1786
|
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
|
|
1787
|
+
const defaultLinkVisited = linkColor[12];
|
|
1786
1788
|
const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
|
|
1789
|
+
const defaultFocusInner = neutralColorScale[0].hex;
|
|
1790
|
+
const defaultFocusOuter = neutralColorScale[10].hex;
|
|
1791
|
+
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
|
|
1792
|
+
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
|
|
1787
1793
|
return {
|
|
1788
1794
|
[themeName]: {
|
|
1789
1795
|
...main,
|
|
@@ -1791,7 +1797,17 @@ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
|
1791
1797
|
neutral,
|
|
1792
1798
|
...globalColors,
|
|
1793
1799
|
link: {
|
|
1794
|
-
visited: linkOverride ||
|
|
1800
|
+
visited: linkOverride || defaultLinkVisited
|
|
1801
|
+
},
|
|
1802
|
+
focus: {
|
|
1803
|
+
inner: {
|
|
1804
|
+
$type: "color",
|
|
1805
|
+
$value: focusInnerOverride || defaultFocusInner
|
|
1806
|
+
},
|
|
1807
|
+
outer: {
|
|
1808
|
+
$type: "color",
|
|
1809
|
+
$value: focusOuterOverride || defaultFocusOuter
|
|
1810
|
+
}
|
|
1795
1811
|
}
|
|
1796
1812
|
}
|
|
1797
1813
|
};
|
|
@@ -1806,11 +1822,11 @@ var color_base_template_default = {
|
|
|
1806
1822
|
focus: {
|
|
1807
1823
|
inner: {
|
|
1808
1824
|
$type: "color",
|
|
1809
|
-
$value: "{color.
|
|
1825
|
+
$value: "{color.focus.inner-color}"
|
|
1810
1826
|
},
|
|
1811
1827
|
outer: {
|
|
1812
1828
|
$type: "color",
|
|
1813
|
-
$value: "{color.
|
|
1829
|
+
$value: "{color.focus.outer-color}"
|
|
1814
1830
|
}
|
|
1815
1831
|
}
|
|
1816
1832
|
},
|
|
@@ -2166,6 +2182,16 @@ var generateTheme = (colors, themeName, borderRadius) => {
|
|
|
2166
2182
|
$type: "color",
|
|
2167
2183
|
$value: `{${themeName}.link.visited}`
|
|
2168
2184
|
}
|
|
2185
|
+
},
|
|
2186
|
+
focus: {
|
|
2187
|
+
"inner-color": {
|
|
2188
|
+
$type: "color",
|
|
2189
|
+
$value: `{${themeName}.focus.inner}`
|
|
2190
|
+
},
|
|
2191
|
+
"outer-color": {
|
|
2192
|
+
$type: "color",
|
|
2193
|
+
$value: `{${themeName}.focus.outer}`
|
|
2194
|
+
}
|
|
2169
2195
|
}
|
|
2170
2196
|
},
|
|
2171
2197
|
...remainingThemeFile
|
|
@@ -603,11 +603,11 @@ var color_default = {
|
|
|
603
603
|
focus: {
|
|
604
604
|
inner: {
|
|
605
605
|
$type: "color",
|
|
606
|
-
$value: "{color.
|
|
606
|
+
$value: "{color.focus.inner-color}"
|
|
607
607
|
},
|
|
608
608
|
outer: {
|
|
609
609
|
$type: "color",
|
|
610
|
-
$value: "{color.
|
|
610
|
+
$value: "{color.focus.outer-color}"
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
},
|
|
@@ -1295,6 +1295,16 @@ var digdir_default = {
|
|
|
1295
1295
|
$type: "color",
|
|
1296
1296
|
$value: "{digdir.link.visited}"
|
|
1297
1297
|
}
|
|
1298
|
+
},
|
|
1299
|
+
focus: {
|
|
1300
|
+
"inner-color": {
|
|
1301
|
+
$type: "color",
|
|
1302
|
+
$value: "{digdir.focus.inner}"
|
|
1303
|
+
},
|
|
1304
|
+
"outer-color": {
|
|
1305
|
+
$type: "color",
|
|
1306
|
+
$value: "{digdir.focus.outer}"
|
|
1307
|
+
}
|
|
1298
1308
|
}
|
|
1299
1309
|
},
|
|
1300
1310
|
"font-family": {
|