@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/color.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKrE,OAAO,
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/color.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKrE,OAAO,EAAkB,KAAK,wBAAwB,EAAU,MAAM,aAAa,CAAC;AAEpF,eAAO,MAAM,oBAAoB,EAAE,wBA8BlC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CAAC;AAEvG,eAAO,MAAM,sBAAsB,GAChC,MAAM,iBAAiB,KAAG,wBAgD1B,CAAC"}
|
|
@@ -3,6 +3,14 @@ import * as R12 from "ramda";
|
|
|
3
3
|
|
|
4
4
|
// src/tokens/utils.ts
|
|
5
5
|
import * as R from "ramda";
|
|
6
|
+
|
|
7
|
+
// src/tokens/types.ts
|
|
8
|
+
var colorCategories = {
|
|
9
|
+
main: "main",
|
|
10
|
+
support: "support"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/tokens/utils.ts
|
|
6
14
|
var mapToLowerCase = R.map(R.toLower);
|
|
7
15
|
var hasAnyTruth = R.any(R.equals(true));
|
|
8
16
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
@@ -36,7 +44,9 @@ function isGlobalColorToken(token) {
|
|
|
36
44
|
}
|
|
37
45
|
function isColorCategoryToken(token, category) {
|
|
38
46
|
if (!category) {
|
|
39
|
-
return
|
|
47
|
+
return Object.keys(colorCategories).some(
|
|
48
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
49
|
+
);
|
|
40
50
|
}
|
|
41
51
|
return R.startsWith(["color", category], token.path);
|
|
42
52
|
}
|
|
@@ -59,14 +69,6 @@ function inlineTokens(shouldInline, tokens) {
|
|
|
59
69
|
// src/tokens/process/formats/css/color.ts
|
|
60
70
|
import * as R2 from "ramda";
|
|
61
71
|
import { createPropertyFormatter } from "style-dictionary/utils";
|
|
62
|
-
|
|
63
|
-
// src/tokens/types.ts
|
|
64
|
-
var colorCategories = {
|
|
65
|
-
main: "main",
|
|
66
|
-
support: "support"
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// src/tokens/process/formats/css/color.ts
|
|
70
72
|
var prefersColorScheme = (colorScheme2, content) => `
|
|
71
73
|
@media (prefers-color-scheme: ${colorScheme2}) {
|
|
72
74
|
[data-color-scheme="auto"] ${content}
|
|
@@ -74,7 +76,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
74
76
|
`;
|
|
75
77
|
var colorScheme = {
|
|
76
78
|
name: "ds/css-colorscheme",
|
|
77
|
-
format: async ({ dictionary,
|
|
79
|
+
format: async ({ dictionary, options, platform }) => {
|
|
78
80
|
const { allTokens } = dictionary;
|
|
79
81
|
const { outputReferences, usesDtcg } = options;
|
|
80
82
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -116,7 +118,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
116
118
|
};
|
|
117
119
|
var colorCategory = {
|
|
118
120
|
name: "ds/css-colorcategory",
|
|
119
|
-
format: async ({ dictionary,
|
|
121
|
+
format: async ({ dictionary, options, platform }) => {
|
|
120
122
|
const { outputReferences, usesDtcg } = options;
|
|
121
123
|
const { selector, layer } = platform;
|
|
122
124
|
const format = R2.compose(
|
|
@@ -159,7 +161,7 @@ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
159
161
|
var overrideSizingFormula = (format, token) => {
|
|
160
162
|
const [name, value] = format(token).split(":");
|
|
161
163
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
162
|
-
const round = `round(down, ${calc},
|
|
164
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
163
165
|
return {
|
|
164
166
|
name,
|
|
165
167
|
round,
|
|
@@ -187,7 +189,7 @@ ${round.join("\n")}
|
|
|
187
189
|
};
|
|
188
190
|
var semantic = {
|
|
189
191
|
name: "ds/css-semantic",
|
|
190
|
-
format: async ({ dictionary,
|
|
192
|
+
format: async ({ dictionary, options, platform }) => {
|
|
191
193
|
const { outputReferences, usesDtcg } = options;
|
|
192
194
|
const { selector, layer } = platform;
|
|
193
195
|
const format = createPropertyFormatter2({
|
|
@@ -225,7 +227,7 @@ var typographyFontFamilyPredicate = R4.allPass([
|
|
|
225
227
|
]);
|
|
226
228
|
var typography = {
|
|
227
229
|
name: "ds/css-typography",
|
|
228
|
-
format: async ({ dictionary,
|
|
230
|
+
format: async ({ dictionary, options, platform }) => {
|
|
229
231
|
const { outputReferences, usesDtcg } = options;
|
|
230
232
|
const { selector, layer } = platform;
|
|
231
233
|
const format = createPropertyFormatter3({
|
|
@@ -791,7 +793,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
|
|
|
791
793
|
);
|
|
792
794
|
}
|
|
793
795
|
const layer = `ds.theme.color`;
|
|
794
|
-
const isRootColor = color === buildOptions?.
|
|
796
|
+
const isRootColor = color === buildOptions?.defaultColor;
|
|
795
797
|
const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
|
|
796
798
|
const config = {
|
|
797
799
|
preprocessors: ["tokens-studio"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/semantic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/semantic.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkC,KAAK,wBAAwB,EAAU,MAAM,aAAa,CAAC;AAEpG,eAAO,MAAM,iBAAiB,EAAE,wBA0C/B,CAAC"}
|
|
@@ -4,6 +4,14 @@ import { outputReferencesFilter } from "style-dictionary/utils";
|
|
|
4
4
|
|
|
5
5
|
// src/tokens/utils.ts
|
|
6
6
|
import * as R from "ramda";
|
|
7
|
+
|
|
8
|
+
// src/tokens/types.ts
|
|
9
|
+
var colorCategories = {
|
|
10
|
+
main: "main",
|
|
11
|
+
support: "support"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/tokens/utils.ts
|
|
7
15
|
var mapToLowerCase = R.map(R.toLower);
|
|
8
16
|
var hasAnyTruth = R.any(R.equals(true));
|
|
9
17
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
@@ -34,7 +42,9 @@ function isGlobalColorToken(token) {
|
|
|
34
42
|
}
|
|
35
43
|
function isColorCategoryToken(token, category) {
|
|
36
44
|
if (!category) {
|
|
37
|
-
return
|
|
45
|
+
return Object.keys(colorCategories).some(
|
|
46
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
47
|
+
);
|
|
38
48
|
}
|
|
39
49
|
return R.startsWith(["color", category], token.path);
|
|
40
50
|
}
|
|
@@ -57,14 +67,6 @@ function inlineTokens(shouldInline, tokens) {
|
|
|
57
67
|
// src/tokens/process/formats/css/color.ts
|
|
58
68
|
import * as R2 from "ramda";
|
|
59
69
|
import { createPropertyFormatter } from "style-dictionary/utils";
|
|
60
|
-
|
|
61
|
-
// src/tokens/types.ts
|
|
62
|
-
var colorCategories = {
|
|
63
|
-
main: "main",
|
|
64
|
-
support: "support"
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// src/tokens/process/formats/css/color.ts
|
|
68
70
|
var prefersColorScheme = (colorScheme2, content) => `
|
|
69
71
|
@media (prefers-color-scheme: ${colorScheme2}) {
|
|
70
72
|
[data-color-scheme="auto"] ${content}
|
|
@@ -72,7 +74,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
72
74
|
`;
|
|
73
75
|
var colorScheme = {
|
|
74
76
|
name: "ds/css-colorscheme",
|
|
75
|
-
format: async ({ dictionary,
|
|
77
|
+
format: async ({ dictionary, options, platform }) => {
|
|
76
78
|
const { allTokens } = dictionary;
|
|
77
79
|
const { outputReferences, usesDtcg } = options;
|
|
78
80
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -114,7 +116,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
114
116
|
};
|
|
115
117
|
var colorCategory = {
|
|
116
118
|
name: "ds/css-colorcategory",
|
|
117
|
-
format: async ({ dictionary,
|
|
119
|
+
format: async ({ dictionary, options, platform }) => {
|
|
118
120
|
const { outputReferences, usesDtcg } = options;
|
|
119
121
|
const { selector, layer } = platform;
|
|
120
122
|
const format = R2.compose(
|
|
@@ -157,7 +159,7 @@ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
157
159
|
var overrideSizingFormula = (format, token) => {
|
|
158
160
|
const [name, value] = format(token).split(":");
|
|
159
161
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
160
|
-
const round = `round(down, ${calc},
|
|
162
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
161
163
|
return {
|
|
162
164
|
name,
|
|
163
165
|
round,
|
|
@@ -185,7 +187,7 @@ ${round.join("\n")}
|
|
|
185
187
|
};
|
|
186
188
|
var semantic = {
|
|
187
189
|
name: "ds/css-semantic",
|
|
188
|
-
format: async ({ dictionary,
|
|
190
|
+
format: async ({ dictionary, options, platform }) => {
|
|
189
191
|
const { outputReferences, usesDtcg } = options;
|
|
190
192
|
const { selector, layer } = platform;
|
|
191
193
|
const format = createPropertyFormatter2({
|
|
@@ -223,7 +225,7 @@ var typographyFontFamilyPredicate = R4.allPass([
|
|
|
223
225
|
]);
|
|
224
226
|
var typography = {
|
|
225
227
|
name: "ds/css-typography",
|
|
226
|
-
format: async ({ dictionary,
|
|
228
|
+
format: async ({ dictionary, options, platform }) => {
|
|
227
229
|
const { outputReferences, usesDtcg } = options;
|
|
228
230
|
const { selector, layer } = platform;
|
|
229
231
|
const format = createPropertyFormatter3({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storefront.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/storefront.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"storefront.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/storefront.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkC,KAAK,wBAAwB,EAAU,MAAM,aAAa,CAAC;AAEpG,eAAO,MAAM,gBAAgB,EAAE,wBAqC9B,CAAC"}
|
|
@@ -4,6 +4,14 @@ import { outputReferencesFilter } from "style-dictionary/utils";
|
|
|
4
4
|
|
|
5
5
|
// src/tokens/utils.ts
|
|
6
6
|
import * as R from "ramda";
|
|
7
|
+
|
|
8
|
+
// src/tokens/types.ts
|
|
9
|
+
var colorCategories = {
|
|
10
|
+
main: "main",
|
|
11
|
+
support: "support"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/tokens/utils.ts
|
|
7
15
|
var mapToLowerCase = R.map(R.toLower);
|
|
8
16
|
var hasAnyTruth = R.any(R.equals(true));
|
|
9
17
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
@@ -28,7 +36,9 @@ var pathStartsWithOneOf = R.curry(
|
|
|
28
36
|
);
|
|
29
37
|
function isColorCategoryToken(token, category) {
|
|
30
38
|
if (!category) {
|
|
31
|
-
return
|
|
39
|
+
return Object.keys(colorCategories).some(
|
|
40
|
+
(colorCategory) => isColorCategoryToken(token, colorCategory)
|
|
41
|
+
);
|
|
32
42
|
}
|
|
33
43
|
return R.startsWith(["color", category], token.path);
|
|
34
44
|
}
|
|
@@ -62,7 +72,7 @@ var isInlineTokens = R2.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
62
72
|
var overrideSizingFormula = (format, token) => {
|
|
63
73
|
const [name, value] = format(token).split(":");
|
|
64
74
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
65
|
-
const round = `round(down, ${calc},
|
|
75
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
66
76
|
return {
|
|
67
77
|
name,
|
|
68
78
|
round,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/typography.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/configs/typography.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,KAAK,wBAAwB,EAAU,MAAM,aAAa,CAAC;AAEpF,eAAO,MAAM,mBAAmB,EAAE,wBAkDjC,CAAC"}
|
|
@@ -3,6 +3,14 @@ import { expandTypesMap } from "@tokens-studio/sd-transforms";
|
|
|
3
3
|
|
|
4
4
|
// src/tokens/utils.ts
|
|
5
5
|
import * as R from "ramda";
|
|
6
|
+
|
|
7
|
+
// src/tokens/types.ts
|
|
8
|
+
var colorCategories = {
|
|
9
|
+
main: "main",
|
|
10
|
+
support: "support"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/tokens/utils.ts
|
|
6
14
|
var mapToLowerCase = R.map(R.toLower);
|
|
7
15
|
var hasAnyTruth = R.any(R.equals(true));
|
|
8
16
|
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
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
46
|
+
);
|
|
37
47
|
}
|
|
38
48
|
return R.startsWith(["color", category], token.path);
|
|
39
49
|
}
|
|
@@ -56,14 +66,6 @@ function inlineTokens(shouldInline, tokens) {
|
|
|
56
66
|
// src/tokens/process/formats/css/color.ts
|
|
57
67
|
import * as R2 from "ramda";
|
|
58
68
|
import { createPropertyFormatter } from "style-dictionary/utils";
|
|
59
|
-
|
|
60
|
-
// src/tokens/types.ts
|
|
61
|
-
var colorCategories = {
|
|
62
|
-
main: "main",
|
|
63
|
-
support: "support"
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// src/tokens/process/formats/css/color.ts
|
|
67
69
|
var prefersColorScheme = (colorScheme2, content) => `
|
|
68
70
|
@media (prefers-color-scheme: ${colorScheme2}) {
|
|
69
71
|
[data-color-scheme="auto"] ${content}
|
|
@@ -71,7 +73,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
71
73
|
`;
|
|
72
74
|
var colorScheme = {
|
|
73
75
|
name: "ds/css-colorscheme",
|
|
74
|
-
format: async ({ dictionary,
|
|
76
|
+
format: async ({ dictionary, options, platform }) => {
|
|
75
77
|
const { allTokens } = dictionary;
|
|
76
78
|
const { outputReferences, usesDtcg } = options;
|
|
77
79
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -113,7 +115,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
113
115
|
};
|
|
114
116
|
var colorCategory = {
|
|
115
117
|
name: "ds/css-colorcategory",
|
|
116
|
-
format: async ({ dictionary,
|
|
118
|
+
format: async ({ dictionary, options, platform }) => {
|
|
117
119
|
const { outputReferences, usesDtcg } = options;
|
|
118
120
|
const { selector, layer } = platform;
|
|
119
121
|
const format = R2.compose(
|
|
@@ -156,7 +158,7 @@ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
156
158
|
var overrideSizingFormula = (format, token) => {
|
|
157
159
|
const [name, value] = format(token).split(":");
|
|
158
160
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
159
|
-
const round = `round(down, ${calc},
|
|
161
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
160
162
|
return {
|
|
161
163
|
name,
|
|
162
164
|
round,
|
|
@@ -184,7 +186,7 @@ ${round.join("\n")}
|
|
|
184
186
|
};
|
|
185
187
|
var semantic = {
|
|
186
188
|
name: "ds/css-semantic",
|
|
187
|
-
format: async ({ dictionary,
|
|
189
|
+
format: async ({ dictionary, options, platform }) => {
|
|
188
190
|
const { outputReferences, usesDtcg } = options;
|
|
189
191
|
const { selector, layer } = platform;
|
|
190
192
|
const format = createPropertyFormatter2({
|
|
@@ -222,7 +224,7 @@ var typographyFontFamilyPredicate = R4.allPass([
|
|
|
222
224
|
]);
|
|
223
225
|
var typography = {
|
|
224
226
|
name: "ds/css-typography",
|
|
225
|
-
format: async ({ dictionary,
|
|
227
|
+
format: async ({ dictionary, options, platform }) => {
|
|
226
228
|
const { outputReferences, usesDtcg } = options;
|
|
227
229
|
const { selector, layer } = platform;
|
|
228
230
|
const format = createPropertyFormatter3({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/configs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAInG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAOpE,OAAO,
|
|
1
|
+
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/configs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAInG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAOpE,OAAO,EAA6B,KAAK,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAc5G,eAAO,MAAM,OAAO;;;;;;;;;;;;CAYnB,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,WAAW,wBAAwB,EACnC,kBAAkB,oBAAoB,EAAE,EACxC,YAAY,cAAc,EAAE,EAC5B,SAAS,kBAAkB,KAC1B,2BAA2B,EAoD7B,CAAC"}
|
|
@@ -5,6 +5,14 @@ import StyleDictionary2 from "style-dictionary";
|
|
|
5
5
|
|
|
6
6
|
// src/tokens/utils.ts
|
|
7
7
|
import * as R from "ramda";
|
|
8
|
+
|
|
9
|
+
// src/tokens/types.ts
|
|
10
|
+
var colorCategories = {
|
|
11
|
+
main: "main",
|
|
12
|
+
support: "support"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/tokens/utils.ts
|
|
8
16
|
var mapToLowerCase = R.map(R.toLower);
|
|
9
17
|
var hasAnyTruth = R.any(R.equals(true));
|
|
10
18
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
@@ -38,7 +46,9 @@ function isGlobalColorToken(token) {
|
|
|
38
46
|
}
|
|
39
47
|
function isColorCategoryToken(token, category) {
|
|
40
48
|
if (!category) {
|
|
41
|
-
return
|
|
49
|
+
return Object.keys(colorCategories).some(
|
|
50
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
51
|
+
);
|
|
42
52
|
}
|
|
43
53
|
return R.startsWith(["color", category], token.path);
|
|
44
54
|
}
|
|
@@ -76,14 +86,6 @@ import * as R8 from "ramda";
|
|
|
76
86
|
// src/tokens/process/formats/css/color.ts
|
|
77
87
|
import * as R2 from "ramda";
|
|
78
88
|
import { createPropertyFormatter } from "style-dictionary/utils";
|
|
79
|
-
|
|
80
|
-
// src/tokens/types.ts
|
|
81
|
-
var colorCategories = {
|
|
82
|
-
main: "main",
|
|
83
|
-
support: "support"
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// src/tokens/process/formats/css/color.ts
|
|
87
89
|
var prefersColorScheme = (colorScheme2, content) => `
|
|
88
90
|
@media (prefers-color-scheme: ${colorScheme2}) {
|
|
89
91
|
[data-color-scheme="auto"] ${content}
|
|
@@ -91,7 +93,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
91
93
|
`;
|
|
92
94
|
var colorScheme = {
|
|
93
95
|
name: "ds/css-colorscheme",
|
|
94
|
-
format: async ({ dictionary,
|
|
96
|
+
format: async ({ dictionary, options, platform }) => {
|
|
95
97
|
const { allTokens } = dictionary;
|
|
96
98
|
const { outputReferences, usesDtcg } = options;
|
|
97
99
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -133,7 +135,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
133
135
|
};
|
|
134
136
|
var colorCategory = {
|
|
135
137
|
name: "ds/css-colorcategory",
|
|
136
|
-
format: async ({ dictionary,
|
|
138
|
+
format: async ({ dictionary, options, platform }) => {
|
|
137
139
|
const { outputReferences, usesDtcg } = options;
|
|
138
140
|
const { selector, layer } = platform;
|
|
139
141
|
const format = R2.compose(
|
|
@@ -176,7 +178,7 @@ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
176
178
|
var overrideSizingFormula = (format, token) => {
|
|
177
179
|
const [name, value] = format(token).split(":");
|
|
178
180
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
179
|
-
const round = `round(down, ${calc},
|
|
181
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
180
182
|
return {
|
|
181
183
|
name,
|
|
182
184
|
round,
|
|
@@ -204,7 +206,7 @@ ${round.join("\n")}
|
|
|
204
206
|
};
|
|
205
207
|
var semantic = {
|
|
206
208
|
name: "ds/css-semantic",
|
|
207
|
-
format: async ({ dictionary,
|
|
209
|
+
format: async ({ dictionary, options, platform }) => {
|
|
208
210
|
const { outputReferences, usesDtcg } = options;
|
|
209
211
|
const { selector, layer } = platform;
|
|
210
212
|
const format = createPropertyFormatter2({
|
|
@@ -242,7 +244,7 @@ var typographyFontFamilyPredicate = R4.allPass([
|
|
|
242
244
|
]);
|
|
243
245
|
var typography = {
|
|
244
246
|
name: "ds/css-typography",
|
|
245
|
-
format: async ({ dictionary,
|
|
247
|
+
format: async ({ dictionary, options, platform }) => {
|
|
246
248
|
const { outputReferences, usesDtcg } = options;
|
|
247
249
|
const { selector, layer } = platform;
|
|
248
250
|
const format = createPropertyFormatter3({
|
|
@@ -460,24 +462,9 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
|
460
462
|
});
|
|
461
463
|
};
|
|
462
464
|
var processed = Symbol("Type brand for ProcessedThemeObject");
|
|
463
|
-
function isProcessed(theme) {
|
|
464
|
-
return Boolean(theme[processed]);
|
|
465
|
-
}
|
|
466
|
-
function processThemeObject(theme) {
|
|
467
|
-
if (isProcessed(theme)) {
|
|
468
|
-
return theme;
|
|
469
|
-
}
|
|
470
|
-
const result = { ...theme, [processed]: true };
|
|
471
|
-
if (result.group) {
|
|
472
|
-
result.group = kebabCase(result.group);
|
|
473
|
-
}
|
|
474
|
-
result.name = kebabCase(result.name);
|
|
475
|
-
return result;
|
|
476
|
-
}
|
|
477
465
|
function groupThemes(themes) {
|
|
478
466
|
const groups = {};
|
|
479
|
-
for (const
|
|
480
|
-
const theme = processThemeObject(rawTheme);
|
|
467
|
+
for (const theme of themes) {
|
|
481
468
|
if (theme.group) {
|
|
482
469
|
const groupKey = theme.group;
|
|
483
470
|
groups[groupKey] = [...groups[groupKey] ?? [], theme];
|
|
@@ -702,7 +689,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
|
|
|
702
689
|
);
|
|
703
690
|
}
|
|
704
691
|
const layer = `ds.theme.color`;
|
|
705
|
-
const isRootColor = color === buildOptions?.
|
|
692
|
+
const isRootColor = color === buildOptions?.defaultColor;
|
|
706
693
|
const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
|
|
707
694
|
const config = {
|
|
708
695
|
preprocessors: ["tokens-studio"],
|
|
@@ -39,7 +39,9 @@ function isGlobalColorToken(token) {
|
|
|
39
39
|
}
|
|
40
40
|
function isColorCategoryToken(token, category) {
|
|
41
41
|
if (!category) {
|
|
42
|
-
return
|
|
42
|
+
return Object.keys(colorCategories).some(
|
|
43
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
44
|
+
);
|
|
43
45
|
}
|
|
44
46
|
return R.startsWith(["color", category], token.path);
|
|
45
47
|
}
|
|
@@ -52,7 +54,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
52
54
|
`;
|
|
53
55
|
var colorScheme = {
|
|
54
56
|
name: "ds/css-colorscheme",
|
|
55
|
-
format: async ({ dictionary,
|
|
57
|
+
format: async ({ dictionary, options, platform }) => {
|
|
56
58
|
const { allTokens } = dictionary;
|
|
57
59
|
const { outputReferences, usesDtcg } = options;
|
|
58
60
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -94,7 +96,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
94
96
|
};
|
|
95
97
|
var colorCategory = {
|
|
96
98
|
name: "ds/css-colorcategory",
|
|
97
|
-
format: async ({ dictionary,
|
|
99
|
+
format: async ({ dictionary, options, platform }) => {
|
|
98
100
|
const { outputReferences, usesDtcg } = options;
|
|
99
101
|
const { selector, layer } = platform;
|
|
100
102
|
const format = R2.compose(
|
|
@@ -50,7 +50,7 @@ var isInlineTokens = R2.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
50
50
|
var overrideSizingFormula = (format, token) => {
|
|
51
51
|
const [name, value] = format(token).split(":");
|
|
52
52
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
53
|
-
const round = `round(down, ${calc},
|
|
53
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
54
54
|
return {
|
|
55
55
|
name,
|
|
56
56
|
round,
|
|
@@ -78,7 +78,7 @@ ${round.join("\n")}
|
|
|
78
78
|
};
|
|
79
79
|
var semantic = {
|
|
80
80
|
name: "ds/css-semantic",
|
|
81
|
-
format: async ({ dictionary,
|
|
81
|
+
format: async ({ dictionary, options, platform }) => {
|
|
82
82
|
const { outputReferences, usesDtcg } = options;
|
|
83
83
|
const { selector, layer } = platform;
|
|
84
84
|
const format = createPropertyFormatter({
|
|
@@ -7,7 +7,7 @@ var typographyFontFamilyPredicate = R.allPass([
|
|
|
7
7
|
]);
|
|
8
8
|
var typography = {
|
|
9
9
|
name: "ds/css-typography",
|
|
10
|
-
format: async ({ dictionary,
|
|
10
|
+
format: async ({ dictionary, options, platform }) => {
|
|
11
11
|
const { outputReferences, usesDtcg } = options;
|
|
12
12
|
const { selector, layer } = platform;
|
|
13
13
|
const format = createPropertyFormatter({
|
|
@@ -40,7 +40,9 @@ function isGlobalColorToken(token) {
|
|
|
40
40
|
}
|
|
41
41
|
function isColorCategoryToken(token, category) {
|
|
42
42
|
if (!category) {
|
|
43
|
-
return
|
|
43
|
+
return Object.keys(colorCategories).some(
|
|
44
|
+
(colorCategory2) => isColorCategoryToken(token, colorCategory2)
|
|
45
|
+
);
|
|
44
46
|
}
|
|
45
47
|
return R.startsWith(["color", category], token.path);
|
|
46
48
|
}
|
|
@@ -68,7 +70,7 @@ var prefersColorScheme = (colorScheme2, content) => `
|
|
|
68
70
|
`;
|
|
69
71
|
var colorScheme = {
|
|
70
72
|
name: "ds/css-colorscheme",
|
|
71
|
-
format: async ({ dictionary,
|
|
73
|
+
format: async ({ dictionary, options, platform }) => {
|
|
72
74
|
const { allTokens } = dictionary;
|
|
73
75
|
const { outputReferences, usesDtcg } = options;
|
|
74
76
|
const { selector, colorScheme: colorScheme2, layer } = platform;
|
|
@@ -110,7 +112,7 @@ ${selector} ${content} ${autoSelectorContent}
|
|
|
110
112
|
};
|
|
111
113
|
var colorCategory = {
|
|
112
114
|
name: "ds/css-colorcategory",
|
|
113
|
-
format: async ({ dictionary,
|
|
115
|
+
format: async ({ dictionary, options, platform }) => {
|
|
114
116
|
const { outputReferences, usesDtcg } = options;
|
|
115
117
|
const { selector, layer } = platform;
|
|
116
118
|
const format = R2.compose(
|
|
@@ -153,7 +155,7 @@ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
153
155
|
var overrideSizingFormula = (format, token) => {
|
|
154
156
|
const [name, value] = format(token).split(":");
|
|
155
157
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
156
|
-
const round = `round(down, ${calc},
|
|
158
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
157
159
|
return {
|
|
158
160
|
name,
|
|
159
161
|
round,
|
|
@@ -181,7 +183,7 @@ ${round.join("\n")}
|
|
|
181
183
|
};
|
|
182
184
|
var semantic = {
|
|
183
185
|
name: "ds/css-semantic",
|
|
184
|
-
format: async ({ dictionary,
|
|
186
|
+
format: async ({ dictionary, options, platform }) => {
|
|
185
187
|
const { outputReferences, usesDtcg } = options;
|
|
186
188
|
const { selector, layer } = platform;
|
|
187
189
|
const format = createPropertyFormatter2({
|
|
@@ -219,7 +221,7 @@ var typographyFontFamilyPredicate = R4.allPass([
|
|
|
219
221
|
]);
|
|
220
222
|
var typography = {
|
|
221
223
|
name: "ds/css-typography",
|
|
222
|
-
format: async ({ dictionary,
|
|
224
|
+
format: async ({ dictionary, options, platform }) => {
|
|
223
225
|
const { outputReferences, usesDtcg } = options;
|
|
224
226
|
const { selector, layer } = platform;
|
|
225
227
|
const format = createPropertyFormatter3({
|
|
@@ -4,6 +4,14 @@ import { createPropertyFormatter as createPropertyFormatter2, fileHeader } from
|
|
|
4
4
|
|
|
5
5
|
// src/tokens/utils.ts
|
|
6
6
|
import * as R from "ramda";
|
|
7
|
+
|
|
8
|
+
// src/tokens/types.ts
|
|
9
|
+
var colorCategories = {
|
|
10
|
+
main: "main",
|
|
11
|
+
support: "support"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/tokens/utils.ts
|
|
7
15
|
var mapToLowerCase = R.map(R.toLower);
|
|
8
16
|
var hasAnyTruth = R.any(R.equals(true));
|
|
9
17
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
@@ -28,7 +36,9 @@ var pathStartsWithOneOf = R.curry(
|
|
|
28
36
|
);
|
|
29
37
|
function isColorCategoryToken(token, category) {
|
|
30
38
|
if (!category) {
|
|
31
|
-
return
|
|
39
|
+
return Object.keys(colorCategories).some(
|
|
40
|
+
(colorCategory) => isColorCategoryToken(token, colorCategory)
|
|
41
|
+
);
|
|
32
42
|
}
|
|
33
43
|
return R.startsWith(["color", category], token.path);
|
|
34
44
|
}
|
|
@@ -58,7 +68,7 @@ var isInlineTokens = R2.anyPass([isNumericBorderRadiusToken, isNumericSizeToken,
|
|
|
58
68
|
var overrideSizingFormula = (format, token) => {
|
|
59
69
|
const [name, value] = format(token).split(":");
|
|
60
70
|
const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
|
|
61
|
-
const round = `round(down, ${calc},
|
|
71
|
+
const round = `round(down, ${calc}, 1px)`;
|
|
62
72
|
return {
|
|
63
73
|
name,
|
|
64
74
|
round,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/process/output/tailwind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,sBAAsB,GAAI,UAAU,UAAU,EAAE,KAAG,UAAU,EAezE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/tokens/process/output/tailwind.ts
|
|
2
|
+
var createTailwindCSSFiles = (cssFiles) => {
|
|
3
|
+
console.log("\n\u{1F371} Creating Tailwind Config");
|
|
4
|
+
return cssFiles.map((file) => {
|
|
5
|
+
if (file.destination) {
|
|
6
|
+
const tailwindConfig = generateTailwind(file.output);
|
|
7
|
+
const tailwindFile = {
|
|
8
|
+
destination: file.destination.replace(".css", ".tailwind.css"),
|
|
9
|
+
output: tailwindConfig
|
|
10
|
+
};
|
|
11
|
+
return tailwindFile;
|
|
12
|
+
}
|
|
13
|
+
return void 0;
|
|
14
|
+
}).filter((item) => item !== void 0);
|
|
15
|
+
};
|
|
16
|
+
var generateTailwind = (css) => {
|
|
17
|
+
const tailwind = ["--font-sans: var(--ds-font-family)"];
|
|
18
|
+
const tokens = Array.from(new Set(css.match(/--ds-[^:)]+/g)), (m) => m).sort(
|
|
19
|
+
(a, b) => a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" })
|
|
20
|
+
);
|
|
21
|
+
for (const token of tokens) {
|
|
22
|
+
if (token.startsWith("--ds-color-") && !token.startsWith("--ds-color-focus")) {
|
|
23
|
+
tailwind.push(`--color-${token.replace("--ds-color-", "")}: var(${token})`);
|
|
24
|
+
} else if (token.startsWith("--ds-font-weight-")) {
|
|
25
|
+
tailwind.push(`--font-weight-${token.replace("--ds-font-weight-", "")}: var(${token})`);
|
|
26
|
+
} else if (token.match(/--ds-border-radius-(sm|md|lg|xl)/)) {
|
|
27
|
+
tailwind.push(`--radius-${token.replace("--ds-border-radius-", "")}: var(${token})`);
|
|
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] {
|
|
35
|
+
--color-background-default: var(--ds-color-background-default);
|
|
36
|
+
--color-background-tinted: var(--ds-color-background-tinted);
|
|
37
|
+
--color-surface-default: var(--ds-color-surface-default);
|
|
38
|
+
--color-surface-tinted: var(--ds-color-surface-tinted);
|
|
39
|
+
--color-surface-hover: var(--ds-color-surface-hover);
|
|
40
|
+
--color-surface-active: var(--ds-color-surface-active);
|
|
41
|
+
--color-border-subtle: var(--ds-color-border-subtle);
|
|
42
|
+
--color-border-default: var(--ds-color-border-default);
|
|
43
|
+
--color-border-strong: var(--ds-color-border-strong);
|
|
44
|
+
--color-text-subtle: var(--ds-color-text-subtle);
|
|
45
|
+
--color-text-default: var(--ds-color-text-default);
|
|
46
|
+
--color-base-default: var(--ds-color-base-default);
|
|
47
|
+
--color-base-hover: var(--ds-color-base-hover);
|
|
48
|
+
--color-base-active: var(--ds-color-base-active);
|
|
49
|
+
--color-base-contrast-subtle: var(--ds-color-base-contrast-subtle);
|
|
50
|
+
--color-base-contrast-default: var(--ds-color-base-contrast-default);
|
|
51
|
+
}`;
|
|
52
|
+
return `@theme {${tailwind.map((str) => `
|
|
53
|
+
${str};`).join("")}
|
|
54
|
+
}
|
|
55
|
+
${dynamicColors}`;
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
createTailwindCSSFiles
|
|
59
|
+
};
|