@digdir/designsystemet 1.0.7 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/config.d.ts +12 -0
- package/dist/bin/config.d.ts.map +1 -0
- package/dist/bin/config.js +517 -0
- package/dist/bin/designsystemet.js +3699 -3572
- package/dist/config.schema.json +1 -0
- package/dist/src/colors/index.d.ts +2 -2
- package/dist/src/colors/index.d.ts.map +1 -1
- package/dist/src/colors/index.js +143 -143
- package/dist/src/colors/theme.d.ts +1 -2
- package/dist/src/colors/theme.d.ts.map +1 -1
- package/dist/src/config.d.ts +25 -14
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +68 -24
- package/dist/src/index.js +431 -404
- package/dist/src/migrations/beta-to-v1.js +9 -2
- package/dist/src/migrations/codemods/css/run.js +9 -2
- package/dist/src/migrations/color-rename-next49.js +9 -2
- package/dist/src/migrations/index.js +9 -2
- package/dist/src/scripts/createJsonSchema.js +28 -23
- package/dist/src/scripts/update-template.d.ts.map +1 -1
- package/dist/src/scripts/update-template.js +9 -2
- package/dist/src/tokens/build.d.ts +1 -1
- package/dist/src/tokens/build.d.ts.map +1 -1
- package/dist/src/tokens/build.js +140 -57
- package/dist/src/tokens/create/generators/$designsystemet.js +13 -14
- package/dist/src/tokens/create/generators/color.js +21 -21
- package/dist/src/tokens/create/write.js +23 -17
- package/dist/src/tokens/create.d.ts +1 -0
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +22 -21
- package/dist/src/tokens/format.d.ts +1 -1
- package/dist/src/tokens/format.d.ts.map +1 -1
- package/dist/src/tokens/format.js +916 -890
- package/dist/src/tokens/index.d.ts +2 -2
- package/dist/src/tokens/index.d.ts.map +1 -1
- package/dist/src/tokens/index.js +308 -281
- package/dist/src/tokens/process/configs/color.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/color.js +17 -15
- package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/semantic.js +16 -14
- package/dist/src/tokens/process/configs/storefront.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/storefront.js +12 -2
- package/dist/src/tokens/process/configs/typography.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/typography.js +16 -14
- package/dist/src/tokens/process/configs.d.ts.map +1 -1
- package/dist/src/tokens/process/configs.js +18 -31
- package/dist/src/tokens/process/formats/css/color.js +5 -3
- package/dist/src/tokens/process/formats/css/semantic.js +2 -2
- package/dist/src/tokens/process/formats/css/typography.js +1 -1
- package/dist/src/tokens/process/formats/css.js +8 -6
- package/dist/src/tokens/process/formats/js-tokens.js +12 -2
- package/dist/src/tokens/process/output/tailwind.d.ts +3 -0
- package/dist/src/tokens/process/output/tailwind.d.ts.map +1 -0
- package/dist/src/tokens/process/output/tailwind.js +59 -0
- package/dist/src/tokens/process/{theme.d.ts → output/theme.d.ts} +2 -2
- package/dist/src/tokens/process/output/theme.d.ts.map +1 -0
- package/dist/src/tokens/process/{theme.js → output/theme.js} +16 -17
- package/dist/src/tokens/process/platform.d.ts +6 -6
- package/dist/src/tokens/process/platform.d.ts.map +1 -1
- package/dist/src/tokens/process/platform.js +46 -19
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +10 -9
- package/dist/src/tokens/types.d.ts +3 -3
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/dist/src/tokens/utils.d.ts +2 -2
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/dist/src/tokens/utils.js +11 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +9 -2
- package/package.json +13 -14
- package/dist/src/tokens/process/theme.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OutputFile } from '
|
|
2
|
-
import type { ProcessReturn } from '
|
|
1
|
+
import type { OutputFile } from '../../types.js';
|
|
2
|
+
import type { ProcessReturn } from '../platform.js';
|
|
3
3
|
export declare const defaultFileHeader: string;
|
|
4
4
|
type CreateThemeCSSFiles = {
|
|
5
5
|
/** The processed build results containing formatted CSS outputs grouped by themes and other permutations. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/output/theme.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,6GAA6G;IAC7G,eAAe,EAAE,aAAa,CAAC;IAC/B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,kCAGjC,mBAAmB,KAAG,UAAU,EA8ElC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// src/tokens/process/theme.ts
|
|
2
|
-
import * as R from "ramda";
|
|
1
|
+
// src/tokens/process/output/theme.ts
|
|
3
2
|
import chalk from "chalk";
|
|
3
|
+
import * as R from "ramda";
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@digdir/designsystemet",
|
|
8
|
-
version: "1.0
|
|
8
|
+
version: "1.1.0",
|
|
9
9
|
description: "CLI for Designsystemet",
|
|
10
10
|
author: "Designsystemet team",
|
|
11
11
|
engines: {
|
|
@@ -15,7 +15,7 @@ var package_default = {
|
|
|
15
15
|
type: "git",
|
|
16
16
|
url: "git+https://github.com/digdir/designsystemet.git"
|
|
17
17
|
},
|
|
18
|
-
homepage: "https://github.com/digdir/designsystemet/tree/main/
|
|
18
|
+
homepage: "https://github.com/digdir/designsystemet/tree/main/packages/cli",
|
|
19
19
|
license: "MIT",
|
|
20
20
|
type: "module",
|
|
21
21
|
main: "./dist/src/index.js",
|
|
@@ -40,8 +40,6 @@ var package_default = {
|
|
|
40
40
|
},
|
|
41
41
|
scripts: {
|
|
42
42
|
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
43
|
-
"build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
|
|
44
|
-
"build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
|
|
45
43
|
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
46
44
|
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
47
45
|
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
@@ -49,17 +47,20 @@ var package_default = {
|
|
|
49
47
|
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
|
|
50
48
|
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
51
49
|
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
50
|
+
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
52
51
|
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
52
|
+
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
53
53
|
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
54
54
|
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
55
55
|
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
56
|
+
"digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
|
|
56
57
|
"digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
|
|
57
58
|
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
58
|
-
"update:
|
|
59
|
-
verify: "pnpm test && pnpm update:template && pnpm update:
|
|
59
|
+
"update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
|
|
60
|
+
verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
|
|
60
61
|
},
|
|
61
62
|
dependencies: {
|
|
62
|
-
"@commander-js/extra-typings": "^
|
|
63
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
63
64
|
"@tokens-studio/sd-transforms": "1.3.0",
|
|
64
65
|
"apca-w3": "^0.1.9",
|
|
65
66
|
chalk: "^5.4.1",
|
|
@@ -70,11 +71,11 @@ var package_default = {
|
|
|
70
71
|
"fast-glob": "^3.3.3",
|
|
71
72
|
hsluv: "^1.0.1",
|
|
72
73
|
"object-hash": "^3.0.0",
|
|
73
|
-
postcss: "^8.5.
|
|
74
|
+
postcss: "^8.5.5",
|
|
74
75
|
ramda: "^0.30.1",
|
|
75
76
|
"style-dictionary": "^4.4.0",
|
|
76
|
-
zod: "^3.25.
|
|
77
|
-
"zod-validation-error": "^3.
|
|
77
|
+
zod: "^3.25.64",
|
|
78
|
+
"zod-validation-error": "^3.5.0"
|
|
78
79
|
},
|
|
79
80
|
devDependencies: {
|
|
80
81
|
"@tokens-studio/types": "0.5.2",
|
|
@@ -82,20 +83,18 @@ var package_default = {
|
|
|
82
83
|
"@types/chroma-js": "^3.1.1",
|
|
83
84
|
"@types/fs-extra": "^11.0.4",
|
|
84
85
|
"@types/glob": "^8.1.0",
|
|
85
|
-
"@types/
|
|
86
|
-
"@types/node": "^22.15.21",
|
|
86
|
+
"@types/node": "^22.15.31",
|
|
87
87
|
"@types/object-hash": "^3.0.6",
|
|
88
88
|
"@types/ramda": "^0.30.2",
|
|
89
89
|
"fs-extra": "^11.3.0",
|
|
90
|
-
"ts-toolbelt": "^9.6.0",
|
|
91
90
|
tslib: "^2.8.1",
|
|
92
91
|
tsup: "^8.5.0",
|
|
93
|
-
tsx: "^4.
|
|
92
|
+
tsx: "^4.20.3",
|
|
94
93
|
typescript: "^5.8.3"
|
|
95
94
|
}
|
|
96
95
|
};
|
|
97
96
|
|
|
98
|
-
// src/tokens/process/theme.ts
|
|
97
|
+
// src/tokens/process/output/theme.ts
|
|
99
98
|
var defaultFileHeader = `build: v${package_default.version}`;
|
|
100
99
|
var createThemeCSSFiles = ({
|
|
101
100
|
processedBuilds,
|
|
@@ -5,25 +5,25 @@ type SharedOptions = {
|
|
|
5
5
|
/** Enable verbose output */
|
|
6
6
|
verbose: boolean;
|
|
7
7
|
/** Set the default color for ":root" */
|
|
8
|
-
|
|
8
|
+
defaultColor?: string;
|
|
9
9
|
/** Dry run, no files will be written */
|
|
10
10
|
dry?: boolean;
|
|
11
|
-
/** Clean the output path before building tokens */
|
|
12
|
-
clean?: boolean;
|
|
13
11
|
/** Generate preview tokens */
|
|
14
12
|
preview: boolean;
|
|
15
13
|
/** Token Studio `$themes.json` content */
|
|
16
14
|
$themes: ThemeObject[];
|
|
17
15
|
};
|
|
18
16
|
export type BuildOptions = {
|
|
19
|
-
|
|
17
|
+
type: 'build';
|
|
20
18
|
/** Design tokens path */
|
|
21
19
|
tokensDir: string;
|
|
22
20
|
/** Output directory for built tokens */
|
|
23
21
|
outDir: string;
|
|
22
|
+
/** Tailwind CSS configuration */
|
|
23
|
+
tailwind?: boolean;
|
|
24
24
|
} & SharedOptions;
|
|
25
25
|
export type FormatOptions = {
|
|
26
|
-
|
|
26
|
+
type: 'format';
|
|
27
27
|
/** Tokensets */
|
|
28
28
|
tokenSets: Map<string, TokenSet>;
|
|
29
29
|
} & SharedOptions;
|
|
@@ -82,6 +82,6 @@ declare const buildConfigs: {
|
|
|
82
82
|
dimensions: "semantic"[];
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
export declare function processPlatform
|
|
85
|
+
export declare function processPlatform(options: ProcessOptions): Promise<ProcessReturn>;
|
|
86
86
|
export {};
|
|
87
87
|
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAqC,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIvF,KAAK,aAAa,GAAG;IACnB,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,8BAA8B;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,0CAA0C;IAC1C,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,aAAa,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,gBAAgB;IAChB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAClC,GAAG,aAAa,CAAC;AAElB,KAAK,cAAc,GAAG,YAAY,GAAG,aAAa,CAAC;AAEnD,KAAK,qBAAqB,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC,WAAW,EAAE,CAAC,CAAC;AAEjE,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,SAAS,EAAE,UAAU,EAAE,CAAC;CACzB,CAAC;AAeF,eAAO,IAAI,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC;AAkBpD,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCqB,CAAC;AAExC,wBAAsB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA0IrF"}
|
|
@@ -49,7 +49,9 @@ function isGlobalColorToken(token) {
|
|
|
49
49
|
}
|
|
50
50
|
function isColorCategoryToken(token, category) {
|
|
51
51
|
if (!category) {
|
|
52
|
-
return
|
|
52
|
+
return Object.keys(colorCategories).some(
|
|
53
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
54
|
+
);
|
|
53
55
|
}
|
|
54
56
|
return R.startsWith(["color", category], token.path);
|
|
55
57
|
}
|
|
@@ -94,7 +96,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
94
96
|
`;
|
|
95
97
|
var colorScheme = {
|
|
96
98
|
name: "ds/css-colorscheme",
|
|
97
|
-
format: async ({ dictionary,
|
|
99
|
+
format: async ({ dictionary, options, platform }) => {
|
|
98
100
|
const { allTokens } = dictionary;
|
|
99
101
|
const { outputReferences, usesDtcg } = options;
|
|
100
102
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -136,7 +138,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
136
138
|
};
|
|
137
139
|
var colorCategory = {
|
|
138
140
|
name: "ds/css-colorcategory",
|
|
139
|
-
format: async ({ dictionary,
|
|
141
|
+
format: async ({ dictionary, options, platform }) => {
|
|
140
142
|
const { outputReferences, usesDtcg } = options;
|
|
141
143
|
const { selector, layer } = platform;
|
|
142
144
|
const format = R2.compose(
|
|
@@ -179,7 +181,7 @@ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
179
181
|
var overrideSizingFormula = (format, token) => {
|
|
180
182
|
const [name, value] = format(token).split(":");
|
|
181
183
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
182
|
-
const round = `round(down, ${calc},
|
|
184
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
183
185
|
return {
|
|
184
186
|
name,
|
|
185
187
|
round,
|
|
@@ -207,7 +209,7 @@ ${round.join("\n")}
|
|
|
207
209
|
};
|
|
208
210
|
var semantic = {
|
|
209
211
|
name: "ds/css-semantic",
|
|
210
|
-
format: async ({ dictionary,
|
|
212
|
+
format: async ({ dictionary, options, platform }) => {
|
|
211
213
|
const { outputReferences, usesDtcg } = options;
|
|
212
214
|
const { selector, layer } = platform;
|
|
213
215
|
const format = createPropertyFormatter2({
|
|
@@ -245,7 +247,7 @@ var typographyFontFamilyPredicate = R4.allPass([
|
|
|
245
247
|
]);
|
|
246
248
|
var typography = {
|
|
247
249
|
name: "ds/css-typography",
|
|
248
|
-
format: async ({ dictionary,
|
|
250
|
+
format: async ({ dictionary, options, platform }) => {
|
|
249
251
|
const { outputReferences, usesDtcg } = options;
|
|
250
252
|
const { selector, layer } = platform;
|
|
251
253
|
const format = createPropertyFormatter3({
|
|
@@ -386,7 +388,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
|
|
|
386
388
|
);
|
|
387
389
|
}
|
|
388
390
|
const layer = `ds.theme.color`;
|
|
389
|
-
const isRootColor = color === buildOptions?.
|
|
391
|
+
const isRootColor = color === buildOptions?.defaultColor;
|
|
390
392
|
const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
|
|
391
393
|
const config = {
|
|
392
394
|
preprocessors: ["tokens-studio"],
|
|
@@ -793,8 +795,7 @@ function processThemeObject(theme) {
|
|
|
793
795
|
}
|
|
794
796
|
function groupThemes(themes) {
|
|
795
797
|
const groups = {};
|
|
796
|
-
for (const
|
|
797
|
-
const theme = processThemeObject(rawTheme);
|
|
798
|
+
for (const theme of themes) {
|
|
798
799
|
if (theme.group) {
|
|
799
800
|
const groupKey = theme.group;
|
|
800
801
|
groups[groupKey] = [...groups[groupKey] ?? [], theme];
|
|
@@ -945,9 +946,12 @@ var initResult = {
|
|
|
945
946
|
};
|
|
946
947
|
var buildOptions;
|
|
947
948
|
var sd = new StyleDictionary2();
|
|
948
|
-
var getCustomColors = (processed$themes) => processed$themes.filter(
|
|
949
|
-
(x
|
|
950
|
-
|
|
949
|
+
var getCustomColors = (processed$themes, colorGroups) => processed$themes.filter((x) => {
|
|
950
|
+
if (!x.group) {
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
return colorGroups.includes(x.group);
|
|
954
|
+
}).map((x) => x.name);
|
|
951
955
|
var buildConfigs = {
|
|
952
956
|
typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
|
|
953
957
|
"color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
|
|
@@ -988,17 +992,40 @@ var buildConfigs = {
|
|
|
988
992
|
// },
|
|
989
993
|
};
|
|
990
994
|
async function processPlatform(options) {
|
|
991
|
-
const {
|
|
995
|
+
const { type, $themes } = options;
|
|
992
996
|
const platform = "css";
|
|
993
|
-
const tokenSets =
|
|
994
|
-
const tokensDir =
|
|
997
|
+
const tokenSets = type === "format" ? options.tokenSets : void 0;
|
|
998
|
+
const tokensDir = type === "build" ? options.tokensDir : void 0;
|
|
999
|
+
const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
|
|
1000
|
+
if (UNSAFE_DEFAULT_COLOR) {
|
|
1001
|
+
console.warn(
|
|
1002
|
+
chalk2.yellow(
|
|
1003
|
+
`
|
|
1004
|
+
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${chalk2.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
|
|
1005
|
+
)
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
|
|
1009
|
+
if (UNSAFE_COLOR_GROUPS.length > 0) {
|
|
1010
|
+
console.warn(
|
|
1011
|
+
chalk2.yellow(
|
|
1012
|
+
`
|
|
1013
|
+
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${chalk2.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
|
|
1014
|
+
)
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
const colorGroups = UNSAFE_COLOR_GROUPS.length > 0 ? UNSAFE_COLOR_GROUPS : [colorCategories.main, colorCategories.support].map((c) => `${c}-color`);
|
|
995
1018
|
buildOptions = options;
|
|
1019
|
+
buildOptions.defaultColor = UNSAFE_DEFAULT_COLOR;
|
|
996
1020
|
const processed$themes = $themes.map(processThemeObject).filter((theme) => R12.not(theme.group === "size" && theme.name !== "medium"));
|
|
997
|
-
const customColors = getCustomColors(processed$themes);
|
|
998
|
-
if (!buildOptions.
|
|
1021
|
+
const customColors = getCustomColors(processed$themes, colorGroups);
|
|
1022
|
+
if (!buildOptions.defaultColor) {
|
|
999
1023
|
const firstMainColor = R12.head(customColors);
|
|
1000
|
-
buildOptions.
|
|
1001
|
-
|
|
1024
|
+
buildOptions.defaultColor = firstMainColor;
|
|
1025
|
+
}
|
|
1026
|
+
if (buildOptions.defaultColor) {
|
|
1027
|
+
console.log(`
|
|
1028
|
+
\u{1F3A8} Using ${chalk2.blue(buildOptions.defaultColor)} as default color`);
|
|
1002
1029
|
}
|
|
1003
1030
|
const buildAndSdConfigs = R12.map((buildConfig) => {
|
|
1004
1031
|
const sdConfigs = getConfigsForThemeDimensions(buildConfig.getConfig, processed$themes, buildConfig.dimensions, {
|
|
@@ -217,7 +217,9 @@ function isGlobalColorToken(token) {
|
|
|
217
217
|
}
|
|
218
218
|
function isColorCategoryToken(token, category) {
|
|
219
219
|
if (!category) {
|
|
220
|
-
return
|
|
220
|
+
return Object.keys(colorCategories).some(
|
|
221
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
222
|
+
);
|
|
221
223
|
}
|
|
222
224
|
return R.startsWith(["color", category], token.path);
|
|
223
225
|
}
|
|
@@ -250,7 +252,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
250
252
|
`;
|
|
251
253
|
var colorScheme = {
|
|
252
254
|
name: "ds/css-colorscheme",
|
|
253
|
-
format: async ({ dictionary,
|
|
255
|
+
format: async ({ dictionary, options, platform }) => {
|
|
254
256
|
const { allTokens } = dictionary;
|
|
255
257
|
const { outputReferences, usesDtcg } = options;
|
|
256
258
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -292,7 +294,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
292
294
|
};
|
|
293
295
|
var colorCategory = {
|
|
294
296
|
name: "ds/css-colorcategory",
|
|
295
|
-
format: async ({ dictionary,
|
|
297
|
+
format: async ({ dictionary, options, platform }) => {
|
|
296
298
|
const { outputReferences, usesDtcg } = options;
|
|
297
299
|
const { selector, layer } = platform;
|
|
298
300
|
const format = R2.compose(
|
|
@@ -335,7 +337,7 @@ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
335
337
|
var overrideSizingFormula = (format, token) => {
|
|
336
338
|
const [name, value] = format(token).split(":");
|
|
337
339
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
338
|
-
const round = `round(down, ${calc},
|
|
340
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
339
341
|
return {
|
|
340
342
|
name,
|
|
341
343
|
round,
|
|
@@ -363,7 +365,7 @@ ${round.join("\n")}
|
|
|
363
365
|
};
|
|
364
366
|
var semantic = {
|
|
365
367
|
name: "ds/css-semantic",
|
|
366
|
-
format: async ({ dictionary,
|
|
368
|
+
format: async ({ dictionary, options, platform }) => {
|
|
367
369
|
const { outputReferences, usesDtcg } = options;
|
|
368
370
|
const { selector, layer } = platform;
|
|
369
371
|
const format = createPropertyFormatter2({
|
|
@@ -401,7 +403,7 @@ var typographyFontFamilyPredicate = R4.allPass([
|
|
|
401
403
|
]);
|
|
402
404
|
var typography = {
|
|
403
405
|
name: "ds/css-typography",
|
|
404
|
-
format: async ({ dictionary,
|
|
406
|
+
format: async ({ dictionary, options, platform }) => {
|
|
405
407
|
const { outputReferences, usesDtcg } = options;
|
|
406
408
|
const { selector, layer } = platform;
|
|
407
409
|
const format = createPropertyFormatter3({
|
|
@@ -542,7 +544,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
|
|
|
542
544
|
);
|
|
543
545
|
}
|
|
544
546
|
const layer = `ds.theme.color`;
|
|
545
|
-
const isRootColor = color === buildOptions?.
|
|
547
|
+
const isRootColor = color === buildOptions?.defaultColor;
|
|
546
548
|
const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
|
|
547
549
|
const config = {
|
|
548
550
|
preprocessors: ["tokens-studio"],
|
|
@@ -850,8 +852,7 @@ function processThemeObject(theme) {
|
|
|
850
852
|
}
|
|
851
853
|
function groupThemes(themes) {
|
|
852
854
|
const groups = {};
|
|
853
|
-
for (const
|
|
854
|
-
const theme = processThemeObject(rawTheme);
|
|
855
|
+
for (const theme of themes) {
|
|
855
856
|
if (theme.group) {
|
|
856
857
|
const groupKey = theme.group;
|
|
857
858
|
groups[groupKey] = [...groups[groupKey] ?? [], theme];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config as SDConfig } from 'style-dictionary/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ConfigSchemaTheme } from '../config.js';
|
|
3
3
|
import type { GetStyleDictionaryConfig } from './process/configs/shared.js';
|
|
4
4
|
export type Token = {
|
|
5
5
|
$value: string | Record<string, string>[];
|
|
@@ -13,7 +13,7 @@ export type Colors = Theme['colors'];
|
|
|
13
13
|
export type Typography = Theme['typography'];
|
|
14
14
|
export type Theme = {
|
|
15
15
|
name: string;
|
|
16
|
-
} & Required<
|
|
16
|
+
} & Required<ConfigSchemaTheme>;
|
|
17
17
|
export declare const colorCategories: {
|
|
18
18
|
readonly main: "main";
|
|
19
19
|
readonly support: "support";
|
|
@@ -56,7 +56,7 @@ export type SDConfigForThemePermutation = {
|
|
|
56
56
|
};
|
|
57
57
|
export type OutputFile = {
|
|
58
58
|
output: string;
|
|
59
|
-
destination: string
|
|
59
|
+
destination: string;
|
|
60
60
|
};
|
|
61
61
|
export type DesignsystemetObject = {
|
|
62
62
|
name: string;
|
|
@@ -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,CAAC;AACjE,OAAO,KAAK,EAAE,
|
|
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,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE5E,MAAM,MAAM,KAAK,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AACjF,MAAM,MAAM,QAAQ,GAAG;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;CACjC,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE9C,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;AACrC,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAE7C,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAEhC,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,eAAe,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,SAAS,EAAE,wBAAwB,CAAC;IACpC,0FAA0F;IAC1F,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;IACxB,0BAA0B;IAC1B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,2BAA2B,KAAK,MAAM,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IAAE,WAAW,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE9F,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Tokens } from 'style-dictionary';
|
|
2
2
|
import type { DesignToken, TransformedToken } from 'style-dictionary/types';
|
|
3
|
-
import type
|
|
3
|
+
import { type ColorCategories, type TokenSet } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns type based on design token format used. Read more:https://v4.styledictionary.com/info/dtcg/
|
|
6
6
|
* @param token Transformed token
|
|
@@ -27,7 +27,7 @@ export declare const pathStartsWithOneOf: (paths: string[], token: TransformedTo
|
|
|
27
27
|
export declare function isSemanticToken(token: TransformedToken): boolean;
|
|
28
28
|
export declare function isSemanticColorToken(token: TransformedToken, color: string): boolean;
|
|
29
29
|
export declare function isGlobalColorToken(token: TransformedToken): boolean;
|
|
30
|
-
export declare function isColorCategoryToken(token: TransformedToken, category?:
|
|
30
|
+
export declare function isColorCategoryToken(token: TransformedToken, category?: ColorCategories): boolean;
|
|
31
31
|
export declare const isDigit: (s: string) => boolean;
|
|
32
32
|
/** Copied from Style Dictionary and added types
|
|
33
33
|
@see https://github.com/amzn/style-dictionary/blob/31c29df0382a61b085f6392dc3225c5009fbffc5/lib/utils/combineJSON.js#L33 */
|
|
@@ -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;AAC5E,OAAO,KAAK,
|
|
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;AAC5E,OAAO,EAAE,KAAK,eAAe,EAAmB,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMlF;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,gBAAgB,WAAkD,CAAC;AAElG;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,OAAO,gBAAgB,GAAG,WAAW,KAAG,CAAuC,CAAC;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,gBAAgB,KAAK,OAQ/E,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,gBAAgB,KAAK,OAW/E,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAEhE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAOjG;AAED,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,YAAoB,CAAC;AAEtD;2HAC2H;AAC3H,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,GAAG,QAAQ,EACtB,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,KAAK,IAAI,4DAYrH;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,sBAetG"}
|
package/dist/src/tokens/utils.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
// src/tokens/utils.ts
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
+
|
|
4
|
+
// src/tokens/types.ts
|
|
5
|
+
var colorCategories = {
|
|
6
|
+
main: "main",
|
|
7
|
+
support: "support"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// src/tokens/utils.ts
|
|
3
11
|
var mapToLowerCase = R.map(R.toLower);
|
|
4
12
|
var hasAnyTruth = R.any(R.equals(true));
|
|
5
13
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
@@ -33,7 +41,9 @@ function isGlobalColorToken(token) {
|
|
|
33
41
|
}
|
|
34
42
|
function isColorCategoryToken(token, category) {
|
|
35
43
|
if (!category) {
|
|
36
|
-
return
|
|
44
|
+
return Object.keys(colorCategories).some(
|
|
45
|
+
(colorCategory) => isColorCategoryToken(token, colorCategory)
|
|
46
|
+
);
|
|
37
47
|
}
|
|
38
48
|
return R.startsWith(["color", category], token.path);
|
|
39
49
|
}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export declare const writeFile: (path: string, data: string, dry?: boolean) => P
|
|
|
14
14
|
export declare const cp: (src: string, dest: string, dry?: boolean, filter?: CopyOptions["filter"]) => Promise<void>;
|
|
15
15
|
export declare const copyFile: (src: string, dest: string, dry?: boolean) => Promise<void>;
|
|
16
16
|
export declare const cleanDir: (dir: string, dry?: boolean) => Promise<void>;
|
|
17
|
-
export declare const readFile: (path: string, dry?: boolean) => Promise<string>;
|
|
17
|
+
export declare const readFile: (path: string, dry?: boolean, allowFileNotFound?: boolean) => Promise<string>;
|
|
18
18
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,2BAgBrD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAWxE,CAAC;AAEF,eAAO,MAAM,EAAE,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,EAAE,SAAS,WAAW,CAAC,QAAQ,CAAC,kBAOhG,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAOtE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,kBASxD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,EAAE,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,2BAgBrD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAWxE,CAAC;AAEF,eAAO,MAAM,EAAE,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,EAAE,SAAS,WAAW,CAAC,QAAQ,CAAC,kBAOhG,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAOtE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,kBASxD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,EAAE,MAAM,OAAO,EAAE,oBAAoB,OAAO,oBActF,CAAC"}
|
package/dist/src/utils.js
CHANGED
|
@@ -46,12 +46,19 @@ var cleanDir = async (dir, dry) => {
|
|
|
46
46
|
\u{1F525} Cleaning dir ${chalk.red(`${dir.trim()}`)} `);
|
|
47
47
|
return fs.rm(dir, { recursive: true, force: true });
|
|
48
48
|
};
|
|
49
|
-
var readFile = async (path, dry) => {
|
|
49
|
+
var readFile = async (path, dry, allowFileNotFound) => {
|
|
50
50
|
if (dry) {
|
|
51
51
|
console.log(`${chalk.blue("readFile")} ${path}`);
|
|
52
52
|
return Promise.resolve("");
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
try {
|
|
55
|
+
return await fs.readFile(path, "utf-8");
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (allowFileNotFound && error.code === "ENOENT") {
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
55
62
|
};
|
|
56
63
|
export {
|
|
57
64
|
cleanDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digdir/designsystemet",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI for Designsystemet",
|
|
5
5
|
"author": "Designsystemet team",
|
|
6
6
|
"engines": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/digdir/designsystemet.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/digdir/designsystemet/tree/main/
|
|
13
|
+
"homepage": "https://github.com/digdir/designsystemet/tree/main/packages/cli",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "./dist/src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@commander-js/extra-typings": "^
|
|
37
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
38
38
|
"@tokens-studio/sd-transforms": "1.3.0",
|
|
39
39
|
"apca-w3": "^0.1.9",
|
|
40
40
|
"chalk": "^5.4.1",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"fast-glob": "^3.3.3",
|
|
46
46
|
"hsluv": "^1.0.1",
|
|
47
47
|
"object-hash": "^3.0.0",
|
|
48
|
-
"postcss": "^8.5.
|
|
48
|
+
"postcss": "^8.5.5",
|
|
49
49
|
"ramda": "^0.30.1",
|
|
50
50
|
"style-dictionary": "^4.4.0",
|
|
51
|
-
"zod": "^3.25.
|
|
52
|
-
"zod-validation-error": "^3.
|
|
51
|
+
"zod": "^3.25.64",
|
|
52
|
+
"zod-validation-error": "^3.5.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@tokens-studio/types": "0.5.2",
|
|
@@ -57,21 +57,17 @@
|
|
|
57
57
|
"@types/chroma-js": "^3.1.1",
|
|
58
58
|
"@types/fs-extra": "^11.0.4",
|
|
59
59
|
"@types/glob": "^8.1.0",
|
|
60
|
-
"@types/
|
|
61
|
-
"@types/node": "^22.15.21",
|
|
60
|
+
"@types/node": "^22.15.31",
|
|
62
61
|
"@types/object-hash": "^3.0.6",
|
|
63
62
|
"@types/ramda": "^0.30.2",
|
|
64
63
|
"fs-extra": "^11.3.0",
|
|
65
|
-
"ts-toolbelt": "^9.6.0",
|
|
66
64
|
"tslib": "^2.8.1",
|
|
67
65
|
"tsup": "^8.5.0",
|
|
68
|
-
"tsx": "^4.
|
|
66
|
+
"tsx": "^4.20.3",
|
|
69
67
|
"typescript": "^5.8.3"
|
|
70
68
|
},
|
|
71
69
|
"scripts": {
|
|
72
70
|
"designsystemet": "tsx ./bin/designsystemet.ts",
|
|
73
|
-
"build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
|
|
74
|
-
"build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
|
|
75
71
|
"build": "tsup && pnpm build:types && pnpm build:json-schema",
|
|
76
72
|
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
77
73
|
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
@@ -79,13 +75,16 @@
|
|
|
79
75
|
"test:tokens-create-options": "pnpm run designsystemet tokens create -m dominant:\"#007682\" -n \"#003333\" -b 99 -o ./temp/options/design-tokens --theme options --clean",
|
|
80
76
|
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
81
77
|
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
78
|
+
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
82
79
|
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
80
|
+
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
83
81
|
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
84
82
|
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
85
83
|
"test": "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
84
|
+
"digdir:tokens-build": "pnpm run designsystemet tokens build -t ../../internal/design-tokens -o ../../packages/theme/brand --clean --experimental-tailwind",
|
|
86
85
|
"digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
|
|
87
86
|
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
88
|
-
"update:
|
|
89
|
-
"verify": "pnpm test && pnpm update:template && pnpm update:
|
|
87
|
+
"update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts && pnpm digdir:tokens-build",
|
|
88
|
+
"verify": "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/theme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,6GAA6G;IAC7G,eAAe,EAAE,aAAa,CAAC;IAC/B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,kCAGjC,mBAAmB,KAAG,UAAU,EA8ElC,CAAC"}
|