@digdir/designsystemet 1.0.4 → 1.0.6
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/LICENSE +7 -0
- package/dist/bin/designsystemet.js +623 -593
- package/dist/src/colors/index.js +32 -0
- package/dist/src/colors/theme.js +1 -0
- package/dist/src/colors/utils.d.ts +13 -0
- package/dist/src/colors/utils.d.ts.map +1 -1
- package/dist/src/colors/utils.js +32 -0
- package/dist/src/config.js +1 -0
- package/dist/src/index.js +196 -142
- package/dist/src/scripts/createJsonSchema.js +39 -38
- package/dist/src/scripts/update-design-tokens.js +1 -0
- package/dist/src/tokens/build.d.ts.map +1 -1
- package/dist/src/tokens/build.js +353 -590
- package/dist/src/tokens/create/generators/$designsystemet.js +22 -19
- package/dist/src/tokens/create/generators/$themes.js +10 -10
- package/dist/src/tokens/create/generators/color.js +1 -0
- package/dist/src/tokens/create/write.js +32 -29
- package/dist/src/tokens/create.js +1 -0
- package/dist/src/tokens/format.d.ts +4 -5
- package/dist/src/tokens/format.d.ts.map +1 -1
- package/dist/src/tokens/format.js +165 -143
- package/dist/src/tokens/index.js +165 -142
- package/dist/src/tokens/process/configs/color.js +26 -22
- package/dist/src/tokens/process/configs/semantic.js +16 -12
- package/dist/src/tokens/process/configs/shared.js +16 -12
- package/dist/src/tokens/process/configs/storefront.js +16 -12
- package/dist/src/tokens/process/configs/typography.js +16 -12
- package/dist/src/tokens/process/configs.js +26 -22
- package/dist/src/tokens/process/formats/css/color.js +16 -12
- package/dist/src/tokens/process/formats/css/semantic.js +16 -12
- package/dist/src/tokens/process/formats/css.js +16 -12
- package/dist/src/tokens/process/formats/js-tokens.js +16 -12
- package/dist/src/tokens/process/platform.js +27 -23
- package/dist/src/tokens/process/theme.d.ts +27 -0
- package/dist/src/tokens/process/theme.d.ts.map +1 -0
- package/dist/src/tokens/process/theme.js +174 -0
- package/dist/src/tokens/process/transformers.js +16 -12
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +26 -22
- package/dist/src/tokens/types.d.ts +4 -0
- 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 +16 -12
- package/package.json +31 -28
|
@@ -1,96 +1,5 @@
|
|
|
1
1
|
// src/tokens/format.ts
|
|
2
|
-
import * as
|
|
3
|
-
import chalk3 from "chalk";
|
|
4
|
-
|
|
5
|
-
// package.json
|
|
6
|
-
var package_default = {
|
|
7
|
-
name: "@digdir/designsystemet",
|
|
8
|
-
version: "1.0.4",
|
|
9
|
-
description: "CLI for Designsystemet",
|
|
10
|
-
author: "Designsystemet team",
|
|
11
|
-
engines: {
|
|
12
|
-
node: ">=22.14.0"
|
|
13
|
-
},
|
|
14
|
-
repository: {
|
|
15
|
-
type: "git",
|
|
16
|
-
url: "git+https://github.com/digdir/designsystemet.git"
|
|
17
|
-
},
|
|
18
|
-
homepage: "https://github.com/digdir/designsystemet/tree/main/scripts/cli",
|
|
19
|
-
license: "MIT",
|
|
20
|
-
type: "module",
|
|
21
|
-
main: "./dist/src/index.js",
|
|
22
|
-
files: [
|
|
23
|
-
"./dist/**"
|
|
24
|
-
],
|
|
25
|
-
bin: "dist/bin/designsystemet.js",
|
|
26
|
-
exports: {
|
|
27
|
-
".": {
|
|
28
|
-
import: "./dist/src/index.js"
|
|
29
|
-
},
|
|
30
|
-
"./color": {
|
|
31
|
-
import: "./dist/src/colors/index.js"
|
|
32
|
-
},
|
|
33
|
-
"./tokens": {
|
|
34
|
-
import: "./dist/src/tokens/index.js"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
publishConfig: {
|
|
38
|
-
access: "public"
|
|
39
|
-
},
|
|
40
|
-
scripts: {
|
|
41
|
-
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
42
|
-
"build:tokens": "yarn designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
|
|
43
|
-
"build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
|
|
44
|
-
build: "tsup && yarn build:types && yarn build:json-schema",
|
|
45
|
-
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
46
|
-
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
47
|
-
types: "tsc --noEmit",
|
|
48
|
-
"test:tokens-create-options": "yarn designsystemet tokens create -m dominant:#007682 -n #003333 -b 99 -o ./test-tokens-create --theme options-test --clean",
|
|
49
|
-
"test:tokens-create-config": "yarn designsystemet tokens create --config ./test-tokens-create-complex.config.json",
|
|
50
|
-
"test:tokens-build": "yarn designsystemet tokens build -t ./test-tokens-create -o ./test-tokens-build --clean",
|
|
51
|
-
"test:tokens-create-and-build-options": "yarn test:tokens-create-options && yarn test:tokens-build",
|
|
52
|
-
"test:tokens-create-and-build-config": "yarn test:tokens-create-config && yarn test:tokens-build",
|
|
53
|
-
test: "yarn test:tokens-create-and-build-options && yarn test:tokens-create-and-build-config",
|
|
54
|
-
"internal:tokens-create": "yarn designsystemet tokens create --config ./internal.config.json",
|
|
55
|
-
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
56
|
-
"update:design-tokens": "yarn internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
|
|
57
|
-
verify: "yarn test && yarn update:template && yarn update:design-tokens"
|
|
58
|
-
},
|
|
59
|
-
dependencies: {
|
|
60
|
-
"@commander-js/extra-typings": "^13.1.0",
|
|
61
|
-
"@tokens-studio/sd-transforms": "1.2.12",
|
|
62
|
-
"apca-w3": "^0.1.9",
|
|
63
|
-
chalk: "^5.4.1",
|
|
64
|
-
"change-case": "^5.4.4",
|
|
65
|
-
"chroma-js": "^3.1.2",
|
|
66
|
-
commander: "^13.1.0",
|
|
67
|
-
"fast-glob": "^3.3.3",
|
|
68
|
-
hsluv: "^1.0.1",
|
|
69
|
-
"object-hash": "^3.0.0",
|
|
70
|
-
postcss: "^8.5.3",
|
|
71
|
-
ramda: "^0.30.1",
|
|
72
|
-
"style-dictionary": "^4.3.3",
|
|
73
|
-
zod: "^3.24.2",
|
|
74
|
-
"zod-validation-error": "^3.4.0"
|
|
75
|
-
},
|
|
76
|
-
devDependencies: {
|
|
77
|
-
"@types/apca-w3": "^0.1.3",
|
|
78
|
-
"@types/chroma-js": "^3.1.1",
|
|
79
|
-
"@types/fs-extra": "^11.0.4",
|
|
80
|
-
"@types/glob": "^8.1.0",
|
|
81
|
-
"@types/jscodeshift": "^0.12.0",
|
|
82
|
-
"@types/node": "^22.14.0",
|
|
83
|
-
"@types/object-hash": "^3.0.6",
|
|
84
|
-
"@types/ramda": "^0.30.2",
|
|
85
|
-
"fs-extra": "^11.3.0",
|
|
86
|
-
"ts-toolbelt": "^9.6.0",
|
|
87
|
-
tslib: "^2.8.1",
|
|
88
|
-
tsup: "^8.4.0",
|
|
89
|
-
tsx: "^4.19.3",
|
|
90
|
-
typescript: "^5.8.2",
|
|
91
|
-
"zod-to-json-schema": "^3.24.5"
|
|
92
|
-
}
|
|
93
|
-
};
|
|
2
|
+
import * as R20 from "ramda";
|
|
94
3
|
|
|
95
4
|
// src/tokens/create/defaults.ts
|
|
96
5
|
import * as R from "ramda";
|
|
@@ -1088,6 +997,7 @@ import * as R4 from "ramda";
|
|
|
1088
997
|
|
|
1089
998
|
// src/colors/utils.ts
|
|
1090
999
|
import chroma from "chroma-js";
|
|
1000
|
+
import Colorjs from "colorjs.io";
|
|
1091
1001
|
import { Hsluv } from "hsluv";
|
|
1092
1002
|
var getLuminanceFromLightness = (lightness) => {
|
|
1093
1003
|
const conv = new Hsluv();
|
|
@@ -2165,14 +2075,14 @@ var createTokens = async (opts) => {
|
|
|
2165
2075
|
return { tokenSets };
|
|
2166
2076
|
};
|
|
2167
2077
|
|
|
2168
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
|
|
2078
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
|
|
2169
2079
|
var BoxShadowTypes;
|
|
2170
2080
|
(function(BoxShadowTypes2) {
|
|
2171
2081
|
BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
|
|
2172
2082
|
BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
|
|
2173
2083
|
})(BoxShadowTypes || (BoxShadowTypes = {}));
|
|
2174
2084
|
|
|
2175
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
|
|
2085
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
|
|
2176
2086
|
var ColorModifierTypes;
|
|
2177
2087
|
(function(ColorModifierTypes2) {
|
|
2178
2088
|
ColorModifierTypes2["LIGHTEN"] = "lighten";
|
|
@@ -2181,7 +2091,7 @@ var ColorModifierTypes;
|
|
|
2181
2091
|
ColorModifierTypes2["ALPHA"] = "alpha";
|
|
2182
2092
|
})(ColorModifierTypes || (ColorModifierTypes = {}));
|
|
2183
2093
|
|
|
2184
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
|
|
2094
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
|
|
2185
2095
|
var ColorSpaceTypes;
|
|
2186
2096
|
(function(ColorSpaceTypes2) {
|
|
2187
2097
|
ColorSpaceTypes2["LCH"] = "lch";
|
|
@@ -2190,7 +2100,7 @@ var ColorSpaceTypes;
|
|
|
2190
2100
|
ColorSpaceTypes2["HSL"] = "hsl";
|
|
2191
2101
|
})(ColorSpaceTypes || (ColorSpaceTypes = {}));
|
|
2192
2102
|
|
|
2193
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/Properties.js
|
|
2103
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
|
|
2194
2104
|
var Properties;
|
|
2195
2105
|
(function(Properties2) {
|
|
2196
2106
|
Properties2["sizing"] = "sizing";
|
|
@@ -2242,7 +2152,7 @@ var Properties;
|
|
|
2242
2152
|
Properties2["description"] = "description";
|
|
2243
2153
|
})(Properties || (Properties = {}));
|
|
2244
2154
|
|
|
2245
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
|
|
2155
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
|
|
2246
2156
|
var TokenSetStatus;
|
|
2247
2157
|
(function(TokenSetStatus2) {
|
|
2248
2158
|
TokenSetStatus2["DISABLED"] = "disabled";
|
|
@@ -2250,7 +2160,7 @@ var TokenSetStatus;
|
|
|
2250
2160
|
TokenSetStatus2["ENABLED"] = "enabled";
|
|
2251
2161
|
})(TokenSetStatus || (TokenSetStatus = {}));
|
|
2252
2162
|
|
|
2253
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
|
|
2163
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
|
|
2254
2164
|
var TokenTypes;
|
|
2255
2165
|
(function(TokenTypes2) {
|
|
2256
2166
|
TokenTypes2["OTHER"] = "other";
|
|
@@ -2281,7 +2191,7 @@ var TokenTypes;
|
|
|
2281
2191
|
TokenTypes2["NUMBER"] = "number";
|
|
2282
2192
|
})(TokenTypes || (TokenTypes = {}));
|
|
2283
2193
|
|
|
2284
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/BorderValues.js
|
|
2194
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
|
|
2285
2195
|
var BorderValues;
|
|
2286
2196
|
(function(BorderValues2) {
|
|
2287
2197
|
BorderValues2["BORDER_COLOR"] = "color";
|
|
@@ -2289,7 +2199,7 @@ var BorderValues;
|
|
|
2289
2199
|
BorderValues2["BORDER_STYLE"] = "style";
|
|
2290
2200
|
})(BorderValues || (BorderValues = {}));
|
|
2291
2201
|
|
|
2292
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
|
|
2202
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
|
|
2293
2203
|
var StrokeStyleValues;
|
|
2294
2204
|
(function(StrokeStyleValues2) {
|
|
2295
2205
|
StrokeStyleValues2["SOLID"] = "solid";
|
|
@@ -2302,7 +2212,7 @@ var StrokeStyleValues;
|
|
|
2302
2212
|
StrokeStyleValues2["INSET"] = "inset";
|
|
2303
2213
|
})(StrokeStyleValues || (StrokeStyleValues = {}));
|
|
2304
2214
|
|
|
2305
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
|
|
2215
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
|
|
2306
2216
|
var BoxShadowValues;
|
|
2307
2217
|
(function(BoxShadowValues2) {
|
|
2308
2218
|
BoxShadowValues2["TYPE"] = "type";
|
|
@@ -2314,7 +2224,7 @@ var BoxShadowValues;
|
|
|
2314
2224
|
BoxShadowValues2["BLEND_MODE"] = "blendMode";
|
|
2315
2225
|
})(BoxShadowValues || (BoxShadowValues = {}));
|
|
2316
2226
|
|
|
2317
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
|
|
2227
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
|
|
2318
2228
|
var TypographyValues;
|
|
2319
2229
|
(function(TypographyValues2) {
|
|
2320
2230
|
TypographyValues2["FONT_FAMILY"] = "fontFamily";
|
|
@@ -2518,20 +2428,24 @@ var mapToLowerCase = R7.map(R7.toLower);
|
|
|
2518
2428
|
var hasAnyTruth = R7.any(R7.equals(true));
|
|
2519
2429
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
2520
2430
|
var getValue = (token) => token.$value ?? token.value;
|
|
2521
|
-
var typeEquals = R7.curry(
|
|
2522
|
-
|
|
2523
|
-
|
|
2431
|
+
var typeEquals = R7.curry(
|
|
2432
|
+
(types, token) => {
|
|
2433
|
+
if (R7.isNil(token)) {
|
|
2434
|
+
return false;
|
|
2435
|
+
}
|
|
2436
|
+
return R7.includes(R7.toLower(getType(token)), R7.map(R7.toLower, Array.isArray(types) ? types : [types]));
|
|
2524
2437
|
}
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2438
|
+
);
|
|
2439
|
+
var pathStartsWithOneOf = R7.curry(
|
|
2440
|
+
(paths, token) => {
|
|
2441
|
+
if (R7.isNil(token)) {
|
|
2442
|
+
return false;
|
|
2443
|
+
}
|
|
2444
|
+
const tokenPath = mapToLowerCase(token.path);
|
|
2445
|
+
const matchPathsStartingWith = R7.map((path) => R7.startsWith([path], tokenPath), mapToLowerCase(paths));
|
|
2446
|
+
return hasAnyTruth(matchPathsStartingWith);
|
|
2530
2447
|
}
|
|
2531
|
-
|
|
2532
|
-
const matchPathsStartingWith = R7.map((path) => R7.startsWith([path], tokenPath), mapToLowerCase(paths));
|
|
2533
|
-
return hasAnyTruth(matchPathsStartingWith);
|
|
2534
|
-
});
|
|
2448
|
+
);
|
|
2535
2449
|
function isSemanticToken(token) {
|
|
2536
2450
|
return token.filePath.includes("semantic/");
|
|
2537
2451
|
}
|
|
@@ -3319,7 +3233,7 @@ var buildConfigs = {
|
|
|
3319
3233
|
// },
|
|
3320
3234
|
};
|
|
3321
3235
|
async function processPlatform(options) {
|
|
3322
|
-
const {
|
|
3236
|
+
const { process, $themes } = options;
|
|
3323
3237
|
const platform = "css";
|
|
3324
3238
|
const tokenSets = process === "format" ? options.tokenSets : void 0;
|
|
3325
3239
|
const tokensDir = process === "build" ? options.tokensDir : void 0;
|
|
@@ -3420,36 +3334,118 @@ ${colors.map((color) => ` ${color}: never;`).join("\n")}
|
|
|
3420
3334
|
return typeDeclaration;
|
|
3421
3335
|
}
|
|
3422
3336
|
|
|
3423
|
-
// src/tokens/
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
}
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3337
|
+
// src/tokens/process/theme.ts
|
|
3338
|
+
import * as R19 from "ramda";
|
|
3339
|
+
import chalk3 from "chalk";
|
|
3340
|
+
|
|
3341
|
+
// package.json
|
|
3342
|
+
var package_default = {
|
|
3343
|
+
name: "@digdir/designsystemet",
|
|
3344
|
+
version: "1.0.6",
|
|
3345
|
+
description: "CLI for Designsystemet",
|
|
3346
|
+
author: "Designsystemet team",
|
|
3347
|
+
engines: {
|
|
3348
|
+
node: ">=22.15.0"
|
|
3349
|
+
},
|
|
3350
|
+
repository: {
|
|
3351
|
+
type: "git",
|
|
3352
|
+
url: "git+https://github.com/digdir/designsystemet.git"
|
|
3353
|
+
},
|
|
3354
|
+
homepage: "https://github.com/digdir/designsystemet/tree/main/scripts/cli",
|
|
3355
|
+
license: "MIT",
|
|
3356
|
+
type: "module",
|
|
3357
|
+
main: "./dist/src/index.js",
|
|
3358
|
+
files: [
|
|
3359
|
+
"./dist/**"
|
|
3360
|
+
],
|
|
3361
|
+
bin: "dist/bin/designsystemet.js",
|
|
3362
|
+
exports: {
|
|
3363
|
+
".": {
|
|
3364
|
+
import: "./dist/src/index.js"
|
|
3365
|
+
},
|
|
3366
|
+
"./color": {
|
|
3367
|
+
import: "./dist/src/colors/index.js"
|
|
3368
|
+
},
|
|
3369
|
+
"./tokens": {
|
|
3370
|
+
import: "./dist/src/tokens/index.js"
|
|
3371
|
+
}
|
|
3372
|
+
},
|
|
3373
|
+
publishConfig: {
|
|
3374
|
+
access: "public"
|
|
3375
|
+
},
|
|
3376
|
+
scripts: {
|
|
3377
|
+
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
3378
|
+
"build:tokens": "pnpm run designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
|
|
3379
|
+
"build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
|
|
3380
|
+
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
3381
|
+
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
3382
|
+
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
3383
|
+
types: "tsc --noEmit",
|
|
3384
|
+
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./test-tokens/options --theme options --clean',
|
|
3385
|
+
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./test/test-tokens.config.json",
|
|
3386
|
+
"test:tokens-build": "pnpm run designsystemet tokens build -t ./test-tokens/options -o ./test-tokens/options-build --clean",
|
|
3387
|
+
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./test-tokens/config -o ./test-tokens/config-build --clean",
|
|
3388
|
+
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
3389
|
+
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
3390
|
+
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
3391
|
+
"internal:tokens-create": "pnpm run designsystemet tokens create --config ./internal.config.json",
|
|
3392
|
+
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
3393
|
+
"update:design-tokens": "pnpm internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
|
|
3394
|
+
verify: "pnpm test && pnpm update:template && pnpm update:design-tokens"
|
|
3395
|
+
},
|
|
3396
|
+
dependencies: {
|
|
3397
|
+
"@commander-js/extra-typings": "^13.1.0",
|
|
3398
|
+
"@tokens-studio/sd-transforms": "1.3.0",
|
|
3399
|
+
"apca-w3": "^0.1.9",
|
|
3400
|
+
chalk: "^5.4.1",
|
|
3401
|
+
"change-case": "^5.4.4",
|
|
3402
|
+
"chroma-js": "^3.1.2",
|
|
3403
|
+
"colorjs.io": "^0.6.0-alpha.1",
|
|
3404
|
+
commander: "^13.1.0",
|
|
3405
|
+
"fast-glob": "^3.3.3",
|
|
3406
|
+
hsluv: "^1.0.1",
|
|
3407
|
+
"object-hash": "^3.0.0",
|
|
3408
|
+
postcss: "^8.5.3",
|
|
3409
|
+
ramda: "^0.30.1",
|
|
3410
|
+
"style-dictionary": "^4.4.0",
|
|
3411
|
+
zod: "^3.24.4",
|
|
3412
|
+
"zod-validation-error": "^3.4.0"
|
|
3413
|
+
},
|
|
3414
|
+
devDependencies: {
|
|
3415
|
+
"@tokens-studio/types": "0.5.2",
|
|
3416
|
+
"@types/apca-w3": "^0.1.3",
|
|
3417
|
+
"@types/chroma-js": "^3.1.1",
|
|
3418
|
+
"@types/fs-extra": "^11.0.4",
|
|
3419
|
+
"@types/glob": "^8.1.0",
|
|
3420
|
+
"@types/jscodeshift": "^0.12.0",
|
|
3421
|
+
"@types/node": "^22.15.3",
|
|
3422
|
+
"@types/object-hash": "^3.0.6",
|
|
3423
|
+
"@types/ramda": "^0.30.2",
|
|
3424
|
+
"fs-extra": "^11.3.0",
|
|
3425
|
+
"ts-toolbelt": "^9.6.0",
|
|
3426
|
+
tslib: "^2.8.1",
|
|
3427
|
+
tsup: "^8.4.0",
|
|
3428
|
+
tsx: "^4.19.4",
|
|
3429
|
+
typescript: "^5.8.3",
|
|
3430
|
+
"zod-to-json-schema": "^3.24.5"
|
|
3431
|
+
}
|
|
3446
3432
|
};
|
|
3447
|
-
|
|
3433
|
+
|
|
3434
|
+
// src/tokens/process/theme.ts
|
|
3435
|
+
var defaultFileHeader = `build: v${package_default.version}`;
|
|
3436
|
+
var createThemeCSSFiles = ({
|
|
3437
|
+
processedBuilds,
|
|
3438
|
+
fileHeader: fileHeader2 = defaultFileHeader
|
|
3439
|
+
}) => {
|
|
3448
3440
|
const groupedByTheme = {};
|
|
3449
3441
|
for (const [_, buildResults] of Object.entries(R19.dissoc("types", processedBuilds))) {
|
|
3450
3442
|
for (const buildResult of buildResults) {
|
|
3451
|
-
const
|
|
3452
|
-
|
|
3443
|
+
const themeName = buildResult.permutation.theme;
|
|
3444
|
+
const newOutputs = buildResult.formatted;
|
|
3445
|
+
if (R19.isNotEmpty(newOutputs)) {
|
|
3446
|
+
const currentOutputs = groupedByTheme[themeName] ?? [];
|
|
3447
|
+
groupedByTheme[themeName] = R19.concat(currentOutputs, newOutputs);
|
|
3448
|
+
}
|
|
3453
3449
|
}
|
|
3454
3450
|
}
|
|
3455
3451
|
const sortOrder = [
|
|
@@ -3488,7 +3484,9 @@ order may change due to nondeterminism.`.trim()
|
|
|
3488
3484
|
|
|
3489
3485
|
@layer ds.theme, ds.base, ds.utilities, ds.components;
|
|
3490
3486
|
|
|
3491
|
-
/*
|
|
3487
|
+
/*
|
|
3488
|
+
${fileHeader2}
|
|
3489
|
+
*/
|
|
3492
3490
|
|
|
3493
3491
|
`;
|
|
3494
3492
|
const sortAlphabetically = R19.sort(R19.ascend((x) => x.destination || ""));
|
|
@@ -3506,8 +3504,32 @@ order may change due to nondeterminism.`.trim()
|
|
|
3506
3504
|
}));
|
|
3507
3505
|
return themeCSSFiles;
|
|
3508
3506
|
};
|
|
3507
|
+
|
|
3508
|
+
// src/tokens/format.ts
|
|
3509
|
+
var formatTokens = async (options) => {
|
|
3510
|
+
const processedBuilds = await processPlatform({
|
|
3511
|
+
process: "format",
|
|
3512
|
+
...options
|
|
3513
|
+
});
|
|
3514
|
+
return processedBuilds;
|
|
3515
|
+
};
|
|
3516
|
+
var formatTheme = async (themeConfig) => {
|
|
3517
|
+
const { tokenSets } = await createTokens(themeConfig);
|
|
3518
|
+
const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors);
|
|
3519
|
+
const processedBuilds = await formatTokens({
|
|
3520
|
+
tokenSets,
|
|
3521
|
+
$themes,
|
|
3522
|
+
verbose: false,
|
|
3523
|
+
preview: false
|
|
3524
|
+
});
|
|
3525
|
+
return processedBuilds;
|
|
3526
|
+
};
|
|
3527
|
+
var formatThemeCSS = async (themeConfig) => {
|
|
3528
|
+
const processedBuilds = await formatTheme(themeConfig);
|
|
3529
|
+
const themeCSSFiles = createThemeCSSFiles({ processedBuilds });
|
|
3530
|
+
return R20.head(themeCSSFiles)?.output ?? "";
|
|
3531
|
+
};
|
|
3509
3532
|
export {
|
|
3510
|
-
createThemeCSSFiles,
|
|
3511
3533
|
formatTheme,
|
|
3512
3534
|
formatThemeCSS,
|
|
3513
3535
|
formatTokens
|