@utrecht/design-tokens 2.0.0 → 2.1.1
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/.stylelintrc.json +5 -1
- package/CHANGELOG.md +14 -0
- package/config.json +8 -0
- package/dist/_mixin-theme.scss +64 -55
- package/dist/_mixin.scss +1011 -0
- package/dist/_variables.scss +64 -55
- package/dist/background-image-icon.css +0 -1
- package/dist/dark/_mixin-theme.scss +64 -55
- package/dist/dark/_mixin.scss +1022 -0
- package/dist/dark/_variables.scss +1019 -0
- package/dist/dark/index.cjs +1022 -0
- package/dist/dark/index.css +64 -55
- package/dist/dark/index.d.ts +1143 -0
- package/dist/dark/index.flat.json +1018 -0
- package/dist/dark/index.json +30708 -0
- package/dist/dark/index.mjs +1020 -0
- package/dist/dark/index.tokens.json +7790 -0
- package/dist/dark/list.json +30708 -0
- package/dist/dark/property.css +703 -0
- package/dist/dark/root.css +546 -537
- package/dist/dark/theme-prince-xml.css +1022 -0
- package/dist/dark/theme.css +1022 -0
- package/dist/dark/tokens.cjs +37484 -0
- package/dist/dark/tokens.d.ts +4792 -0
- package/dist/dark/tokens.json +37480 -0
- package/dist/dark/variables.cjs +1022 -0
- package/dist/dark/variables.css +1022 -0
- package/dist/dark/variables.d.ts +1143 -0
- package/dist/dark/variables.json +1018 -0
- package/dist/dark/variables.less +1019 -0
- package/dist/dark/variables.mjs +1020 -0
- package/dist/index.cjs +67 -58
- package/dist/index.css +131 -118
- package/dist/index.d.ts +59 -47
- package/dist/index.flat.json +607 -597
- package/dist/index.json +7028 -7230
- package/dist/index.mjs +67 -58
- package/dist/index.tokens.json +2170 -911
- package/dist/list.json +31825 -0
- package/dist/property.css +768 -0
- package/dist/root.css +541 -532
- package/dist/theme-prince-xml.css +64 -55
- package/dist/theme.css +541 -532
- package/dist/tokens.cjs +10583 -9537
- package/dist/tokens.d.ts +609 -249
- package/dist/tokens.json +38622 -0
- package/dist/variables.cjs +1011 -0
- package/dist/variables.css +1011 -0
- package/dist/variables.d.ts +1132 -0
- package/dist/variables.json +1007 -0
- package/dist/variables.less +64 -55
- package/dist/variables.mjs +1009 -0
- package/package.json +6 -5
- package/src/background-image-icon.scss +0 -1
- package/src/brand/utrecht/typography.tokens.json +9 -9
- package/src/component/of/progress-indicator.tokens.json +1 -1
- package/src/component/utrecht/accordion.tokens.json +1 -0
- package/src/component/utrecht/backdrop.tokens.json +1 -1
- package/src/component/utrecht/blockquote.tokens.json +3 -3
- package/src/component/utrecht/button.tokens.json +1 -3
- package/src/component/utrecht/code-block.tokens.json +2 -2
- package/src/component/utrecht/figure.tokens.json +2 -2
- package/src/component/utrecht/form-fieldset.tokens.json +2 -2
- package/src/component/utrecht/form-toggle.tokens.json +1 -1
- package/src/component/utrecht/link.tokens.json +3 -1
- package/src/component/utrecht/number-badge.tokens.json +23 -0
- package/src/component/utrecht/pagination.tokens.json +1 -1
- package/src/component/utrecht/skip-link.tokens.json +4 -2
- package/src/component/utrecht/spotlight-section.tokens.json +8 -0
- package/src/component/utrecht/table.tokens.json +1 -1
- package/src/component/utrecht/textarea.tokens.json +1 -0
- package/src/component/utrecht/toptask-link.tokens.json +1 -1
- package/src/css-property-formatter.mjs +46 -0
- package/src/dark/component/tokens.json +1 -1
- package/src/index.scss +2 -5
- package/style-dictionary-build-dark.mjs +64 -0
- package/style-dictionary-build.mjs +41 -0
- package/style-dictionary-config.mjs +261 -0
- package/dist/figma-tokens.json +0 -36582
- package/src/css-property-formatter.js +0 -35
- package/src/style-dictionary-config-dark.js +0 -56
- package/src/style-dictionary-config.js +0 -63
- package/style-dictionary.config.json +0 -143
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.1.1",
|
|
3
3
|
"author": "Community for NL Design System",
|
|
4
4
|
"description": "Design Tokens for the Municipality of Utrecht based on the NL Design System architecture",
|
|
5
5
|
"license": "SEE LICENSE IN ./LICENSE.md",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"directory": "proprietary/design-tokens"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@
|
|
20
|
+
"@tokens-studio/sd-transforms": "1.2.3",
|
|
21
21
|
"chokidar-cli": "3.0.0",
|
|
22
22
|
"glob": "10.4.2",
|
|
23
23
|
"lodash.isplainobject": "4.0.6",
|
|
@@ -26,15 +26,16 @@
|
|
|
26
26
|
"regex-trie": "1.0.4",
|
|
27
27
|
"rimraf": "5.0.7",
|
|
28
28
|
"sass": "1.69.5",
|
|
29
|
-
"style-dictionary": "4.0.
|
|
29
|
+
"style-dictionary": "4.0.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "pnpm run build:style-dictionary && pnpm run build:scss",
|
|
33
33
|
"build:scss": "sass --no-source-map src/:dist/",
|
|
34
34
|
"build:style-dictionary": "pnpm run '/^build:style-dictionary:.*/'",
|
|
35
|
-
"build:style-dictionary:default": "
|
|
36
|
-
"build:style-dictionary:dark": "
|
|
35
|
+
"build:style-dictionary:default": "node ./style-dictionary-build.mjs",
|
|
36
|
+
"build:style-dictionary:dark": "node ./style-dictionary-build-dark.mjs",
|
|
37
37
|
"build:stylelint": "node ./build-stylelint.mjs",
|
|
38
|
+
"lint-build": "stylelint dist/*.css",
|
|
38
39
|
"clean": "rimraf dist/",
|
|
39
40
|
"watch": "pnpm run --parallel '/^watch:.*/'",
|
|
40
41
|
"watch:style-dictionary": "chokidar --follow-symlinks --initial --command 'pnpm run build' 'src/**/*.tokens.json'"
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
.utrecht-theme,
|
|
8
8
|
.utrecht-theme ::backdrop {
|
|
9
9
|
--utrecht-menulijst-item-background-image: url("./pijltje.svg");
|
|
10
|
-
--utrecht-link-icon-left-background-image: url("./pijltje.svg");
|
|
11
10
|
--utrecht-search-bar-input-background-image: url("./icoon-zoek-rood.svg");
|
|
12
11
|
--utrecht-select-background-image: url("./arrow-dropdown.svg");
|
|
13
12
|
--utrecht-link-list-marker-background-image: url("./pijltje-zwart.svg");
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"font-family": { "value": "\"Lucida Grande\", \"Lucida Sans Unicode\", \"Lucida Sans\", \"Arial\", sans-serif" }
|
|
6
6
|
},
|
|
7
7
|
"scale": {
|
|
8
|
-
"2xs": { "font-size": { "value": "
|
|
9
|
-
"xs": { "font-size": { "value": "
|
|
10
|
-
"sm": { "font-size": { "value": "
|
|
11
|
-
"md": { "font-size": { "value": "
|
|
12
|
-
"lg": { "font-size": { "value": "
|
|
13
|
-
"xl": { "font-size": { "value": "
|
|
14
|
-
"2xl": { "font-size": { "value": "
|
|
15
|
-
"3xl": { "font-size": { "value": "
|
|
16
|
-
"4xl": { "font-size": { "value": "
|
|
8
|
+
"2xs": { "font-size": { "value": "8px", "comment": "8px" } },
|
|
9
|
+
"xs": { "font-size": { "value": "12px", "comment": "12px" } },
|
|
10
|
+
"sm": { "font-size": { "value": "14px", "comment": "14px" } },
|
|
11
|
+
"md": { "font-size": { "value": "16px", "comment": "16px" } },
|
|
12
|
+
"lg": { "font-size": { "value": "18px", "comment": "18px" } },
|
|
13
|
+
"xl": { "font-size": { "value": "20px", "comment": "20px" } },
|
|
14
|
+
"2xl": { "font-size": { "value": "22px", "comment": "22px" } },
|
|
15
|
+
"3xl": { "font-size": { "value": "24px", "comment": "24px" } },
|
|
16
|
+
"4xl": { "font-size": { "value": "32px", "comment": "32px" } }
|
|
17
17
|
},
|
|
18
18
|
"weight-scale": {
|
|
19
19
|
"bold": { "font-weight": { "value": "700" } },
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"margin-block-start": { "value": "1.6em" },
|
|
13
13
|
"margin-block-end": { "value": "1.6em" },
|
|
14
14
|
"font-size": {},
|
|
15
|
-
"
|
|
15
|
+
"caption": {
|
|
16
16
|
"color": {},
|
|
17
|
-
"font-size": { "value": "
|
|
17
|
+
"font-size": { "value": "{utrecht.typography.scale.xs.font-size}" }
|
|
18
18
|
},
|
|
19
19
|
"content": {
|
|
20
20
|
"color": { "value": "{utrecht.color.red.40}" },
|
|
21
|
-
"font-size": { "value": "
|
|
21
|
+
"font-size": { "value": "{utrecht.typography.scale.lg.font-size}" }
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"border-radius": { "value": "0" },
|
|
7
7
|
"border-width": { "value": "1px" },
|
|
8
8
|
"color": { "value": "{utrecht.color.grey.40}" },
|
|
9
|
+
"column-gap": { "value": "{utrecht.space.text.xs}" },
|
|
9
10
|
"font-family": { "value": "{utrecht.typography.sans-serif.font-family}" },
|
|
10
11
|
"font-size": { "value": "{utrecht.typography.scale.md.font-size}" },
|
|
11
12
|
"padding-inline-start": { "value": "{utrecht.space.inline.md}" },
|
|
@@ -16,9 +17,6 @@
|
|
|
16
17
|
"margin-inline-end": { "value": "0" },
|
|
17
18
|
"margin-block-start": { "value": "{utrecht.space.row.xs}" },
|
|
18
19
|
"margin-block-end": { "value": "{utrecht.space.row.xs}" },
|
|
19
|
-
"icon": {
|
|
20
|
-
"gap": { "value": "{utrecht.space.text.xs}" }
|
|
21
|
-
},
|
|
22
20
|
"active": {
|
|
23
21
|
"background-color": { "value": "{utrecht.color.grey.40}" },
|
|
24
22
|
"color": { "value": "{utrecht.color.white}" }
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"background-color": { "value": "{utrecht.color.grey.95}" },
|
|
5
5
|
"color": { "value": "{utrecht.color.black}" },
|
|
6
6
|
"font-family": {},
|
|
7
|
-
"font-size": { "value": "
|
|
8
|
-
"line-height": { "value": "
|
|
7
|
+
"font-size": { "value": "{utrecht.typography.scale.md.font-size}" },
|
|
8
|
+
"line-height": { "value": "{utrecht.typography.line-height.md}" },
|
|
9
9
|
"margin-block-end": { "value": "{utrecht.space.block.lg}" },
|
|
10
10
|
"margin-block-start": { "value": "{utrecht.space.block.lg}" },
|
|
11
11
|
"margin-inline-end": {},
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"margin-block-start": {},
|
|
6
6
|
"caption": {
|
|
7
7
|
"color": { "value": "#727272" },
|
|
8
|
-
"font-size": { "value": "
|
|
9
|
-
"line-height": { "value": "
|
|
8
|
+
"font-size": { "value": "{utrecht.typography.scale.sm.font-size}" },
|
|
9
|
+
"line-height": { "value": "{utrecht.typography.line-height.md}" }
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"legend": {
|
|
11
11
|
"color": {},
|
|
12
12
|
"font-family": {},
|
|
13
|
-
"font-size": { "value": "
|
|
13
|
+
"font-size": { "value": "{utrecht.typography.scale.md.font-size}" },
|
|
14
14
|
"font-weight": { "value": "{utrecht.typography.weight-scale.bold.font-weight}" },
|
|
15
|
-
"line-height": { "value": "
|
|
15
|
+
"line-height": { "value": "{utrecht.typography.line-height.md}" },
|
|
16
16
|
"margin-block-end": { "value": "{utrecht.space.block.sm}" },
|
|
17
17
|
"margin-block-start": { "value": "{utrecht.space.block.xl}" },
|
|
18
18
|
"disabled": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"utrecht": {
|
|
3
3
|
"form-toggle": {
|
|
4
|
-
"accent-color": { "value": "hsla(0
|
|
4
|
+
"accent-color": { "value": "hsla(0 0% 48% / 100%)" },
|
|
5
5
|
"background-color": { "value": "{utrecht.color.white}" },
|
|
6
6
|
"border-color": { "value": "transparent" },
|
|
7
7
|
"border-radius": { "value": "10em" },
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"color": { "value": "{utrecht.link.color}" }
|
|
13
13
|
},
|
|
14
14
|
"focus": {
|
|
15
|
-
"color": { "value": "{utrecht.color.blue.40}" }
|
|
15
|
+
"color": { "value": "{utrecht.color.blue.40}" }
|
|
16
|
+
},
|
|
17
|
+
"focus-visible": {
|
|
16
18
|
"text-decoration": { "value": "none" }
|
|
17
19
|
},
|
|
18
20
|
"hover": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"utrecht": {
|
|
3
|
+
"number-badge": {
|
|
4
|
+
"background-color": {
|
|
5
|
+
"value": "{utrecht.color.red.40}"
|
|
6
|
+
},
|
|
7
|
+
"border-radius": {
|
|
8
|
+
"value": "{utrecht.number-badge.font-size}"
|
|
9
|
+
},
|
|
10
|
+
"color": {
|
|
11
|
+
"value": "{utrecht.color.white}"
|
|
12
|
+
},
|
|
13
|
+
"font-size": { "value": "{utrecht.typography.scale.md.font-size}" },
|
|
14
|
+
"font-weight": {},
|
|
15
|
+
"padding-block": {
|
|
16
|
+
"value": "1ex"
|
|
17
|
+
},
|
|
18
|
+
"padding-inline": {
|
|
19
|
+
"value": "1ex"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
"text-decoration": { "value": "{utrecht.link.text-decoration}" },
|
|
11
11
|
"focus": {
|
|
12
12
|
"color": { "value": "{utrecht.topnav.link.focus.color}" },
|
|
13
|
-
"background-color": { "value": "{utrecht.topnav.link.focus.background-color}" }
|
|
14
|
-
|
|
13
|
+
"background-color": { "value": "{utrecht.topnav.link.focus.background-color}" }
|
|
14
|
+
},
|
|
15
|
+
"focus-visible": {
|
|
16
|
+
"text-decoration": { "value": "{utrecht.link.focus-visible.text-decoration}" }
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -18,6 +18,14 @@
|
|
|
18
18
|
"warning": {
|
|
19
19
|
"background-color": { "value": "{utrecht.color.yellow.80}" },
|
|
20
20
|
"color": {}
|
|
21
|
+
},
|
|
22
|
+
"error": {
|
|
23
|
+
"background-color": { "value": "{utrecht.color.red.95}" },
|
|
24
|
+
"color": {}
|
|
25
|
+
},
|
|
26
|
+
"ok": {
|
|
27
|
+
"background-color": { "value": "{utrecht.color.green.90}" },
|
|
28
|
+
"color": {}
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"margin-block-start": { "value": "{utrecht.space.block.md}" },
|
|
5
5
|
"margin-block-end": { "value": "0" },
|
|
6
6
|
"caption": {
|
|
7
|
-
"font-size": { "value": "
|
|
7
|
+
"font-size": { "value": "{utrecht.typography.scale.lg.font-size}" },
|
|
8
8
|
"font-weight": { "value": "{utrecht.typography.weight-scale.bold.font-weight}" },
|
|
9
9
|
"font-family": {},
|
|
10
10
|
"color": {},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"toptask-link": {
|
|
4
4
|
"background-color": { "value": "{utrecht.button.primary-action.background-color}" },
|
|
5
5
|
"color": { "value": "{utrecht.button.primary-action.color}" },
|
|
6
|
-
"font-size": { "value": "
|
|
6
|
+
"font-size": { "value": "{utrecht.typography.scale.md.font-size}" },
|
|
7
7
|
"line-height": { "value": "1.2" },
|
|
8
8
|
"min-block-size": { "value": "8.25rem" },
|
|
9
9
|
"min-inline-size": { "value": "15rem" },
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const stringSort = (a, b) => (a === b ? 0 : a > b ? 1 : -1);
|
|
7
|
+
|
|
8
|
+
export const propertyFormatter = function ({ dictionary }) {
|
|
9
|
+
let { allTokens } = dictionary;
|
|
10
|
+
|
|
11
|
+
// https://drafts.css-houdini.org/css-properties-values-api/#the-css-property-rule-interface
|
|
12
|
+
const css = allTokens
|
|
13
|
+
.sort((tokenA, tokenB) => stringSort(tokenA.name, tokenB.name))
|
|
14
|
+
.filter(
|
|
15
|
+
(token) =>
|
|
16
|
+
token['$extensions'] &&
|
|
17
|
+
token['$extensions']['nl.nldesignsystem.css.property'] &&
|
|
18
|
+
token['$extensions']['nl.nldesignsystem.css.property'].syntax !== '*' &&
|
|
19
|
+
typeof token['$extensions']['nl.nldesignsystem.css.property'].inherits === 'boolean',
|
|
20
|
+
)
|
|
21
|
+
.map((token) => {
|
|
22
|
+
let str = `@property --${token.name} { `;
|
|
23
|
+
const cssProperty = token['$extensions']['nl.nldesignsystem.css.property'];
|
|
24
|
+
|
|
25
|
+
const syntax = Array.isArray(cssProperty.syntax) ? cssProperty.syntax.join(' | ') : cssProperty.syntax;
|
|
26
|
+
|
|
27
|
+
str += `syntax: '${syntax}'; `;
|
|
28
|
+
|
|
29
|
+
str += `inherits: ${cssProperty.inherits}; `;
|
|
30
|
+
|
|
31
|
+
if (cssProperty.initialValue) {
|
|
32
|
+
str += `initial-value: ${cssProperty.initialValue}; `;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
str += `}`;
|
|
36
|
+
|
|
37
|
+
return str;
|
|
38
|
+
})
|
|
39
|
+
.join('\n');
|
|
40
|
+
|
|
41
|
+
return css;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const propertyFormatterHooksConfig = {
|
|
45
|
+
'css/property': propertyFormatter,
|
|
46
|
+
};
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
"form-toggle": {
|
|
218
|
-
"accent-color": { "value": "hsla(0
|
|
218
|
+
"accent-color": { "value": "hsla(0 0% 48% / 100%)" },
|
|
219
219
|
"background-color": { "value": "{utrecht.color.white}" },
|
|
220
220
|
"border-color": { "value": "transparent" },
|
|
221
221
|
"color": { "value": "{utrecht.color.black}" },
|
package/src/index.scss
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
@import "./responsive";
|
|
13
13
|
|
|
14
|
-
.utrecht-theme
|
|
15
|
-
.utrecht-theme ::backdrop {
|
|
14
|
+
.utrecht-theme {
|
|
16
15
|
@include utrecht-theme;
|
|
17
16
|
|
|
18
17
|
utrecht-page-footer,
|
|
@@ -27,9 +26,7 @@
|
|
|
27
26
|
|
|
28
27
|
@media (prefers-color-scheme: dark) {
|
|
29
28
|
.utrecht-theme--media-query,
|
|
30
|
-
.utrecht-theme--media-query
|
|
31
|
-
.utrecht-theme--media-query-color-scheme,
|
|
32
|
-
.utrecht-theme--media-query-color-scheme ::backdrop {
|
|
29
|
+
.utrecht-theme--media-query-color-scheme {
|
|
33
30
|
@include utrecht-theme--dark;
|
|
34
31
|
}
|
|
35
32
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { register } from '@tokens-studio/sd-transforms';
|
|
2
|
+
import StyleDictionary from 'style-dictionary';
|
|
3
|
+
import { typeDtcgDelegate } from 'style-dictionary/utils';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import { createStyleDictionaryConfig } from './style-dictionary-config.mjs';
|
|
6
|
+
|
|
7
|
+
const build = async () => {
|
|
8
|
+
const themeConfig = JSON.parse(await readFile('./config.json', 'utf-8'));
|
|
9
|
+
StyleDictionary.registerPreprocessor({
|
|
10
|
+
name: 'dtcg-delegate',
|
|
11
|
+
preprocessor: typeDtcgDelegate,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
register(StyleDictionary, {
|
|
15
|
+
// TODO: Enable `excludeParentKeys` when Figma is the source of design tokens
|
|
16
|
+
// excludeParentKeys: true,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const config = {
|
|
20
|
+
...createStyleDictionaryConfig({
|
|
21
|
+
themeName: `${themeConfig.prefix}-theme--dark`,
|
|
22
|
+
}),
|
|
23
|
+
log: 'warn',
|
|
24
|
+
preprocessors: ['tokens-studio', 'dtcg-delegate'],
|
|
25
|
+
source: [
|
|
26
|
+
'../../components/**/tokens.json',
|
|
27
|
+
'../../components/**/*.tokens.json',
|
|
28
|
+
'./src/brand/tokens.json',
|
|
29
|
+
'./src/brand/**/*.tokens.json',
|
|
30
|
+
'./src/common/tokens.json',
|
|
31
|
+
'./src/common/**/*.tokens.json',
|
|
32
|
+
'./src/component/tokens.json',
|
|
33
|
+
'./src/component/**/*.tokens.json',
|
|
34
|
+
|
|
35
|
+
// Additional dark theme tokens
|
|
36
|
+
'./src/dark/tokens.json',
|
|
37
|
+
'./src/dark/*.tokens.json',
|
|
38
|
+
'./src/dark/**/tokens.json',
|
|
39
|
+
'./src/dark/**.tokens.json',
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
Object.values(config.platforms).forEach((platform) => {
|
|
44
|
+
platform.buildPath = 'dist/dark/';
|
|
45
|
+
|
|
46
|
+
if (Array.isArray(platform.files)) {
|
|
47
|
+
platform.files.forEach((file) => {
|
|
48
|
+
if (file.destination === 'variables.css') {
|
|
49
|
+
file.options.selector = '.utrecht-theme--dark, .utrecht-theme--dark ::backdrop';
|
|
50
|
+
}
|
|
51
|
+
if (file.destination === '_mixin.scss') {
|
|
52
|
+
file.options.selector = '@mixin utrecht-theme--dark';
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const sd = new StyleDictionary(config);
|
|
59
|
+
|
|
60
|
+
await sd.cleanAllPlatforms();
|
|
61
|
+
await sd.buildAllPlatforms();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
build();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { register } from '@tokens-studio/sd-transforms';
|
|
2
|
+
import StyleDictionary from 'style-dictionary';
|
|
3
|
+
import { typeDtcgDelegate } from 'style-dictionary/utils';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import { createStyleDictionaryConfig } from './style-dictionary-config.mjs';
|
|
6
|
+
|
|
7
|
+
const build = async () => {
|
|
8
|
+
const themeConfig = JSON.parse(await readFile('./config.json', 'utf-8'));
|
|
9
|
+
StyleDictionary.registerPreprocessor({
|
|
10
|
+
name: 'dtcg-delegate',
|
|
11
|
+
preprocessor: typeDtcgDelegate,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
register(StyleDictionary, {
|
|
15
|
+
// TODO: Enable `excludeParentKeys` when Figma is the source of design tokens
|
|
16
|
+
// excludeParentKeys: true,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const sd = new StyleDictionary({
|
|
20
|
+
...createStyleDictionaryConfig({
|
|
21
|
+
themeName: `${themeConfig.prefix}-theme`,
|
|
22
|
+
}),
|
|
23
|
+
log: 'warn',
|
|
24
|
+
preprocessors: ['tokens-studio', 'dtcg-delegate'],
|
|
25
|
+
source: [
|
|
26
|
+
'../../components/**/tokens.json',
|
|
27
|
+
'../../components/**/*.tokens.json',
|
|
28
|
+
'./src/brand/tokens.json',
|
|
29
|
+
'./src/brand/**/*.tokens.json',
|
|
30
|
+
'./src/common/tokens.json',
|
|
31
|
+
'./src/common/**/*.tokens.json',
|
|
32
|
+
'./src/component/tokens.json',
|
|
33
|
+
'./src/component/**/*.tokens.json',
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
await sd.cleanAllPlatforms();
|
|
38
|
+
await sd.buildAllPlatforms();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
build();
|