@digdir/designsystemet 1.13.2 → 1.13.3
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.js +50 -658
- package/dist/bin/designsystemet.js +131 -4623
- package/dist/bin/options.js +22 -14
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js +9 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js +8 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js +13 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js +10 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js +10 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js +53 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js +14 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js +9 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js +32 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js +15 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/types/index.js +11 -0
- package/dist/package.js +5 -0
- package/dist/src/colors/colorMetadata.js +255 -261
- package/dist/src/colors/index.js +5 -522
- package/dist/src/colors/theme.js +104 -343
- package/dist/src/colors/types.js +22 -25
- package/dist/src/colors/utils.js +241 -154
- package/dist/src/config.js +103 -444
- package/dist/src/index.js +10 -3588
- package/dist/src/migrations/beta-to-v1.js +339 -537
- package/dist/src/migrations/codemods/css/plugins.js +31 -42
- package/dist/src/migrations/codemods/css/run.js +20 -151
- package/dist/src/migrations/color-rename-next49.js +44 -220
- package/dist/src/migrations/index.js +7 -577
- package/dist/src/tokens/build.js +39 -1816
- package/dist/src/tokens/create/files.js +43 -602
- package/dist/src/tokens/create/generators/$designsystemet.js +8 -97
- package/dist/src/tokens/create/generators/$metadata.js +17 -20
- package/dist/src/tokens/create/generators/$themes.js +137 -311
- package/dist/src/tokens/create/generators/primitives/color-scheme.js +68 -443
- package/dist/src/tokens/create/generators/primitives/globals.js +141 -147
- package/dist/src/tokens/create/generators/primitives/size.js +146 -156
- package/dist/src/tokens/create/generators/primitives/typography.js +213 -217
- package/dist/src/tokens/create/generators/semantic/color-modes.js +24 -59
- package/dist/src/tokens/create/generators/semantic/color.js +42 -326
- package/dist/src/tokens/create/generators/semantic/style.js +379 -382
- package/dist/src/tokens/create/generators/themes/theme.js +108 -392
- package/dist/src/tokens/create.js +47 -1591
- package/dist/src/tokens/format.js +38 -3324
- package/dist/src/tokens/generate-config.js +155 -298
- package/dist/src/tokens/index.js +3 -3344
- package/dist/src/tokens/process/configs/color.js +50 -1085
- package/dist/src/tokens/process/configs/semantic.js +45 -1083
- package/dist/src/tokens/process/configs/shared.js +18 -109
- package/dist/src/tokens/process/configs/size-mode.js +27 -1082
- package/dist/src/tokens/process/configs/size.js +32 -1083
- package/dist/src/tokens/process/configs/type-scale.js +49 -1083
- package/dist/src/tokens/process/configs/typography.js +63 -1084
- package/dist/src/tokens/process/configs.js +88 -1224
- package/dist/src/tokens/process/formats/css/color.js +58 -1079
- package/dist/src/tokens/process/formats/css/semantic.js +27 -1081
- package/dist/src/tokens/process/formats/css/size-mode.js +43 -1077
- package/dist/src/tokens/process/formats/css/size.js +86 -1079
- package/dist/src/tokens/process/formats/css/type-scale.js +53 -1083
- package/dist/src/tokens/process/formats/css/typography.js +27 -1081
- package/dist/src/tokens/process/formats/css.js +18 -1081
- package/dist/src/tokens/process/output/declarations.js +18 -1201
- package/dist/src/tokens/process/output/tailwind.js +26 -40
- package/dist/src/tokens/process/output/theme.js +73 -206
- package/dist/src/tokens/process/platform.js +165 -1355
- package/dist/src/tokens/process/transformers.js +49 -89
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +100 -1183
- package/dist/src/tokens/process/utils/kebab-case.js +7 -5
- package/dist/src/tokens/types.js +6 -7
- package/dist/src/tokens/utils.js +102 -93
- package/dist/src/types.js +1 -5
- package/dist/src/utils/filesystem.js +112 -124
- package/package.json +10 -13
- package/configs/test-tokens.config.json +0 -82
- package/dist/src/scripts/createJsonSchema.js +0 -409
- package/dist/src/scripts/update-preview-tokens.js +0 -3353
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return void 0;
|
|
14
|
-
}).filter((item) => item !== void 0);
|
|
1
|
+
//#region src/tokens/process/output/tailwind.ts
|
|
2
|
+
const createTailwindCSSFiles = (cssFiles) => {
|
|
3
|
+
console.log("\n🍱 Creating Tailwind Config");
|
|
4
|
+
return cssFiles.map((file) => {
|
|
5
|
+
if (file.destination) {
|
|
6
|
+
const tailwindConfig = generateTailwind(file.output);
|
|
7
|
+
return {
|
|
8
|
+
destination: file.destination.replace(".css", ".tailwind.css"),
|
|
9
|
+
output: tailwindConfig
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}).filter((item) => item !== void 0);
|
|
15
13
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} else if (token.match(/--ds-body-(sm|mg|lg)-body-font-size/)) {
|
|
29
|
-
tailwind.push(`--text-${token.replace("--ds-body-", "").replace("-font-size", "")}: var(${token})`);
|
|
30
|
-
} else if (token.match(/^--ds-size-\d+$/)) {
|
|
31
|
-
tailwind.push(`--spacing-${token.replace("--ds-size-", "")}: var(${token})`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const dynamicColors = `[data-color] {
|
|
14
|
+
const generateTailwind = (css) => {
|
|
15
|
+
const tailwind = ["--font-sans: var(--ds-font-family)"];
|
|
16
|
+
const tokens = Array.from(new Set(css.match(/--ds-[^:)]+/g)), (m) => m).sort((a, b) => a.localeCompare(b, void 0, {
|
|
17
|
+
numeric: true,
|
|
18
|
+
sensitivity: "base"
|
|
19
|
+
}));
|
|
20
|
+
for (const token of tokens) if (token.startsWith("--ds-color-") && !token.startsWith("--ds-color-focus")) tailwind.push(`--color-${token.replace("--ds-color-", "")}: var(${token})`);
|
|
21
|
+
else if (token.startsWith("--ds-font-weight-")) tailwind.push(`--font-weight-${token.replace("--ds-font-weight-", "")}: var(${token})`);
|
|
22
|
+
else if (token.match(/--ds-border-radius-(sm|md|lg|xl)/)) tailwind.push(`--radius-${token.replace("--ds-border-radius-", "")}: var(${token})`);
|
|
23
|
+
else if (token.match(/--ds-body-(sm|mg|lg)-body-font-size/)) tailwind.push(`--text-${token.replace("--ds-body-", "").replace("-font-size", "")}: var(${token})`);
|
|
24
|
+
else if (token.match(/^--ds-size-\d+$/)) tailwind.push(`--spacing-${token.replace("--ds-size-", "")}: var(${token})`);
|
|
25
|
+
return `@theme {${tailwind.map((str) => `\n ${str};`).join("")}\n}\n[data-color] {
|
|
35
26
|
--color-background-default: var(--ds-color-background-default);
|
|
36
27
|
--color-background-tinted: var(--ds-color-background-tinted);
|
|
37
28
|
--color-surface-default: var(--ds-color-surface-default);
|
|
@@ -49,11 +40,6 @@ var generateTailwind = (css) => {
|
|
|
49
40
|
--color-base-contrast-subtle: var(--ds-color-base-contrast-subtle);
|
|
50
41
|
--color-base-contrast-default: var(--ds-color-base-contrast-default);
|
|
51
42
|
}`;
|
|
52
|
-
return `@theme {${tailwind.map((str) => `
|
|
53
|
-
${str};`).join("")}
|
|
54
|
-
}
|
|
55
|
-
${dynamicColors}`;
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
createTailwindCSSFiles
|
|
59
43
|
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { createTailwindCSSFiles };
|
|
@@ -1,216 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
import { version } from "../../../../package.js";
|
|
2
|
+
import { sizeComparator } from "../../utils.js";
|
|
2
3
|
import pc from "picocolors";
|
|
3
|
-
import * as R2 from "ramda";
|
|
4
|
-
|
|
5
|
-
// package.json
|
|
6
|
-
var package_default = {
|
|
7
|
-
name: "@digdir/designsystemet",
|
|
8
|
-
version: "1.13.2",
|
|
9
|
-
description: "CLI for Designsystemet",
|
|
10
|
-
author: "Designsystemet team",
|
|
11
|
-
engines: {
|
|
12
|
-
node: ">=20.20.2"
|
|
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/packages/cli",
|
|
19
|
-
license: "MIT",
|
|
20
|
-
type: "module",
|
|
21
|
-
main: "./dist/src/index.js",
|
|
22
|
-
files: [
|
|
23
|
-
"./dist/**",
|
|
24
|
-
"./configs/**"
|
|
25
|
-
],
|
|
26
|
-
bin: "dist/bin/designsystemet.js",
|
|
27
|
-
exports: {
|
|
28
|
-
".": {
|
|
29
|
-
import: "./dist/src/index.js"
|
|
30
|
-
},
|
|
31
|
-
"./color": {
|
|
32
|
-
import: "./dist/src/colors/index.js"
|
|
33
|
-
},
|
|
34
|
-
"./tokens": {
|
|
35
|
-
import: "./dist/src/tokens/index.js"
|
|
36
|
-
},
|
|
37
|
-
"./types": {
|
|
38
|
-
import: "./dist/src/types.js"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
publishConfig: {
|
|
42
|
-
access: "public"
|
|
43
|
-
},
|
|
44
|
-
scripts: {
|
|
45
|
-
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
46
|
-
"designsystemet:inspect": "tsx --inspect-brk ./bin/designsystemet.ts",
|
|
47
|
-
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
48
|
-
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
49
|
-
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
50
|
-
types: "tsc --noEmit",
|
|
51
|
-
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
|
|
52
|
-
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
|
|
53
|
-
"test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
|
|
54
|
-
"test:tokens-build-tailwind": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean --experimental-tailwind",
|
|
55
|
-
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
56
|
-
"test:tokens-build-config:inspect": "pnpm run designsystemet:inspect tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
|
|
57
|
-
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
58
|
-
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
59
|
-
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
60
|
-
"test:generate-config-from-tokens": "pnpm run designsystemet generate-config-from-tokens -d ../../design-tokens --dry",
|
|
61
|
-
test: "node -v && pnpm test:tokens-create-and-build-options && pnpm test:generate-config-from-tokens && pnpm test:tokens-create-and-build-config",
|
|
62
|
-
"update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
|
|
63
|
-
verify: "pnpm test && pnpm update:template && pnpm --filter @internal/digdir update:theme-digdir"
|
|
64
|
-
},
|
|
65
|
-
dependencies: {
|
|
66
|
-
"@commander-js/extra-typings": "^14.0.0",
|
|
67
|
-
"@digdir/designsystemet-types": "workspace:",
|
|
68
|
-
"@tokens-studio/sd-transforms": "2.0.3",
|
|
69
|
-
"chroma-js": "^3.2.0",
|
|
70
|
-
"colorjs.io": "^0.6.1",
|
|
71
|
-
commander: "^14.0.3",
|
|
72
|
-
"fast-glob": "^3.3.3",
|
|
73
|
-
hsluv: "^1.0.1",
|
|
74
|
-
"object-hash": "^3.0.0",
|
|
75
|
-
picocolors: "^1.1.1",
|
|
76
|
-
postcss: "^8.5.8",
|
|
77
|
-
ramda: "^0.32.0",
|
|
78
|
-
"style-dictionary": "^5.4.0",
|
|
79
|
-
zod: "^4.3.6",
|
|
80
|
-
"zod-validation-error": "^5.0.0"
|
|
81
|
-
},
|
|
82
|
-
devDependencies: {
|
|
83
|
-
"@tokens-studio/types": "0.5.2",
|
|
84
|
-
"@types/chroma-js": "3.1.2",
|
|
85
|
-
"@types/node": "24.12.2",
|
|
86
|
-
"@types/object-hash": "3.0.6",
|
|
87
|
-
"@types/ramda": "0.31.1",
|
|
88
|
-
tsup: "8.5.1",
|
|
89
|
-
tsx: "4.21.0",
|
|
90
|
-
typescript: "5.9.3"
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// src/tokens/utils.ts
|
|
95
4
|
import * as R from "ramda";
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (R.isNil(token)) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
var pathStartsWithOneOf = R.curry(
|
|
108
|
-
(paths, token) => {
|
|
109
|
-
if (R.isNil(token)) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
const tokenPath = mapToLowerCase(token.path);
|
|
113
|
-
const matchPathsStartingWith = R.map((pathOrString) => {
|
|
114
|
-
const path = typeof pathOrString === "string" ? [pathOrString] : pathOrString;
|
|
115
|
-
return R.startsWith(mapToLowerCase(path), tokenPath);
|
|
116
|
-
}, paths);
|
|
117
|
-
return hasAnyTruth(matchPathsStartingWith);
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
var sizeMap = {
|
|
121
|
-
xsmall: "xs",
|
|
122
|
-
small: "sm",
|
|
123
|
-
medium: "md",
|
|
124
|
-
large: "lg",
|
|
125
|
-
xlarge: "xl"
|
|
126
|
-
};
|
|
127
|
-
var sizeComparator = (size) => {
|
|
128
|
-
const sortIndex = Object.entries(sizeMap).findIndex(([key, val]) => key === size || val === size);
|
|
129
|
-
return sortIndex ?? 0;
|
|
5
|
+
//#region src/tokens/process/output/theme.ts
|
|
6
|
+
const defaultFileHeader = `build: v${version}`;
|
|
7
|
+
const getFileNameWithoutExtension = (path) => {
|
|
8
|
+
const pathSegments = path.split("/");
|
|
9
|
+
return pathSegments[pathSegments.length - 1].split(".").slice(0, -1).join(".");
|
|
130
10
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Generates theme-specific CSS files from Style Dictionary build results.
|
|
13
|
+
*
|
|
14
|
+
* @param processedBuilds - The processed build results containing formatted CSS outputs
|
|
15
|
+
* grouped by themes and other permutations.
|
|
16
|
+
* @param fileHeader - Optional header to be included in the generated CSS files.
|
|
17
|
+
* @returns An array of `OutputFile` objects, each representing a theme-specific CSS file
|
|
18
|
+
* with its destination and content.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* - The function groups the build results by theme and ensures a deterministic order
|
|
22
|
+
* for the sections of the entry CSS file using a predefined sort order.
|
|
23
|
+
* - If a CSS section does not have a defined sort order the section is added to the end of the entry file.
|
|
24
|
+
* - The generated CSS files include a header with metadata and layer definitions.
|
|
25
|
+
*/
|
|
26
|
+
const createThemeCSSFiles = ({ processedBuilds, fileHeader = defaultFileHeader }) => {
|
|
27
|
+
const groupedByTheme = {};
|
|
28
|
+
for (const [_, buildResults] of Object.entries(processedBuilds)) for (const buildResult of buildResults) {
|
|
29
|
+
const themeName = buildResult.permutation.theme;
|
|
30
|
+
const newOutputs = buildResult.formatted;
|
|
31
|
+
if (R.isNotEmpty(newOutputs)) {
|
|
32
|
+
const currentOutputs = groupedByTheme[themeName] ?? [];
|
|
33
|
+
groupedByTheme[themeName] = R.concat(currentOutputs, newOutputs);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Defines a sort order for the sections of the entry CSS file.
|
|
38
|
+
* This ensures a deterministic order, whereas earlier this was nondeterministic
|
|
39
|
+
*/
|
|
40
|
+
const sortOrder = [
|
|
41
|
+
"size-mode/",
|
|
42
|
+
"type-scale",
|
|
43
|
+
"color-scheme/light",
|
|
44
|
+
"typography/secondary",
|
|
45
|
+
"size",
|
|
46
|
+
"semantic",
|
|
47
|
+
"color-scheme/dark",
|
|
48
|
+
"color-scheme/contrast",
|
|
49
|
+
"typography/primary",
|
|
50
|
+
"color/"
|
|
51
|
+
];
|
|
52
|
+
const sortByDefinedOrder = R.sortBy((file) => {
|
|
53
|
+
const filePath = file.destination || "";
|
|
54
|
+
const sortIndex = sortOrder.findIndex((sortElement) => {
|
|
55
|
+
if (sortElement.endsWith("/")) return filePath.includes(sortElement);
|
|
56
|
+
return filePath.includes(`${sortElement}.css`);
|
|
57
|
+
});
|
|
58
|
+
if (sortIndex === -1) {
|
|
59
|
+
console.error(pc.yellow(`WARNING: CSS section does not have a defined sort order: ${filePath.replace(".css", "")}`));
|
|
60
|
+
console.log(pc.dim(`
|
|
180
61
|
The section will currently be added to the end of the entry file, but the exact
|
|
181
|
-
order may change due to nondeterminism.`.trim()
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
});
|
|
188
|
-
const header = `@charset "UTF-8";
|
|
62
|
+
order may change due to nondeterminism.`.trim()));
|
|
63
|
+
return Infinity;
|
|
64
|
+
}
|
|
65
|
+
return sortIndex;
|
|
66
|
+
});
|
|
67
|
+
const header = `@charset "UTF-8";
|
|
189
68
|
/*
|
|
190
69
|
${fileHeader}
|
|
191
70
|
*/
|
|
192
71
|
|
|
193
72
|
`;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
sortByDefinedOrder,
|
|
203
|
-
pickOutputs,
|
|
204
|
-
R2.join("\n"),
|
|
205
|
-
(content) => header + content
|
|
206
|
-
);
|
|
207
|
-
const themeCSSFiles = Object.entries(groupedByTheme).map(([theme, files]) => ({
|
|
208
|
-
destination: `${theme}.css`,
|
|
209
|
-
output: themeCSSFile(files)
|
|
210
|
-
}));
|
|
211
|
-
return themeCSSFiles;
|
|
212
|
-
};
|
|
213
|
-
export {
|
|
214
|
-
createThemeCSSFiles,
|
|
215
|
-
defaultFileHeader
|
|
73
|
+
const sortAlphabetically = R.sort(R.ascend((x) => x.destination || ""));
|
|
74
|
+
const sortBySize = R.sortBy(R.pipe((s) => getFileNameWithoutExtension(s.destination ?? ""), sizeComparator));
|
|
75
|
+
const pickOutputs = R.map(R.view(R.lensProp("output")));
|
|
76
|
+
const themeCSSFile = R.pipe(sortAlphabetically, sortBySize, sortByDefinedOrder, pickOutputs, R.join("\n"), (content) => header + content);
|
|
77
|
+
return Object.entries(groupedByTheme).map(([theme, files]) => ({
|
|
78
|
+
destination: `${theme}.css`,
|
|
79
|
+
output: themeCSSFile(files)
|
|
80
|
+
}));
|
|
216
81
|
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { createThemeCSSFiles, defaultFileHeader };
|