@digdir/designsystemet 0.1.0-alpha.9 ā 0.1.0-next.21
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/designsystemet.js +34 -0
- package/dist/src/colors/colorUtils.js +242 -0
- package/dist/src/colors/index.js +3 -0
- package/dist/src/colors/themeUtils.js +245 -0
- package/dist/src/colors/types.js +0 -0
- package/dist/src/init/createTokensPackage.js +250 -0
- package/dist/src/init/generateMetadataJson.js +19 -0
- package/dist/src/init/generateThemesJson.js +52 -0
- package/dist/src/init/index.js +10 -0
- package/dist/src/init/nextStepsMarkdown.js +92 -0
- package/dist/src/init/template/default-files/README.md +10 -0
- package/dist/src/init/template/default-files/design-tokens/README.md +3 -0
- package/dist/src/init/template/default-files/design-tokens/primitives/globals.json +197 -0
- package/dist/src/init/template/default-files/design-tokens/primitives/typography/default.json +86 -0
- package/dist/src/init/template/default-files/design-tokens/semantic/color.json +562 -0
- package/dist/src/init/template/default-files/design-tokens/semantic/style.json +543 -0
- package/dist/src/init/template/prettier.config.js +5 -0
- package/dist/src/init/template/template-files/design-tokens/primitives/colors/contrast/global.json +376 -0
- package/dist/src/init/template/template-files/design-tokens/primitives/colors/contrast/theme-template.json +314 -0
- package/dist/src/init/template/template-files/design-tokens/primitives/colors/dark/global.json +376 -0
- package/dist/src/init/template/template-files/design-tokens/primitives/colors/dark/theme-template.json +314 -0
- package/dist/src/init/template/template-files/design-tokens/primitives/colors/light/global.json +376 -0
- package/dist/src/init/template/template-files/design-tokens/primitives/colors/light/theme-template.json +314 -0
- package/dist/src/init/template/template-files/design-tokens/themes/theme-template.json +314 -0
- package/dist/src/init/template/template-files/package.json +24 -0
- package/dist/src/init/utils.js +15 -0
- package/dist/src/migrations/beta-to-v1.js +344 -0
- package/dist/src/migrations/codemods/css/plugins.js +47 -0
- package/dist/src/migrations/codemods/css/run.js +19 -0
- package/dist/src/migrations/codemods/jsx/classname-prefix.js +63 -0
- package/dist/src/migrations/codemods/jsx/run.js +22 -0
- package/dist/src/migrations/index.js +9 -0
- package/dist/src/migrations/react-beta-to-v1.js +5 -0
- package/dist/src/tokens/actions.js +33 -0
- package/dist/src/tokens/build.js +74 -0
- package/dist/src/tokens/configs.js +223 -0
- package/dist/src/tokens/formats/css.js +170 -0
- package/dist/src/tokens/formats/js-tokens.js +31 -0
- package/dist/src/tokens/transformers.js +47 -0
- package/dist/src/tokens/utils/noCase.js +24 -0
- package/dist/src/tokens/utils/permutateThemes.js +64 -0
- package/dist/src/tokens/utils/utils.js +14 -0
- package/package.json +21 -13
- package/LICENSE +0 -7
- package/dist/build/bin/designsystemet.js +0 -50
- package/dist/build/src/colors/colorUtils.js +0 -314
- package/dist/build/src/colors/index.js +0 -3
- package/dist/build/src/colors/themeUtils.js +0 -290
- package/dist/build/src/colors/types.js +0 -1
- package/dist/build/src/migrations/beta-to-v1.js +0 -341
- package/dist/build/src/migrations/codemods/css/plugins.js +0 -45
- package/dist/build/src/migrations/codemods/css/run.js +0 -17
- package/dist/build/src/migrations/codemods/jsx/classname-prefix.js +0 -80
- package/dist/build/src/migrations/codemods/jsx/run.js +0 -19
- package/dist/build/src/migrations/index.js +0 -6
- package/dist/build/src/migrations/react-beta-to-v1.js +0 -2
- package/dist/build/src/test/jsx-test.js +0 -10
- package/dist/build/src/tokens/actions.js +0 -20
- package/dist/build/src/tokens/build.js +0 -63
- package/dist/build/src/tokens/configs.js +0 -229
- package/dist/build/src/tokens/formats/css-classes.js +0 -50
- package/dist/build/src/tokens/formats/css-variables.js +0 -39
- package/dist/build/src/tokens/formats/js-tokens.js +0 -29
- package/dist/build/src/tokens/transformers.js +0 -42
- package/dist/build/src/tokens/utils/noCase.js +0 -30
- package/dist/build/src/tokens/utils/permutateThemes.js +0 -56
- package/dist/build/src/tokens/utils/utils.js +0 -21
- package/dist/build/tsconfig.tsbuildinfo +0 -1
- package/dist/types/bin/designsystemet.d.ts +0 -3
- package/dist/types/bin/designsystemet.d.ts.map +0 -1
- package/dist/types/src/colors/colorUtils.d.ts +0 -118
- package/dist/types/src/colors/colorUtils.d.ts.map +0 -1
- package/dist/types/src/colors/index.d.ts +0 -4
- package/dist/types/src/colors/index.d.ts.map +0 -1
- package/dist/types/src/colors/themeUtils.d.ts +0 -101
- package/dist/types/src/colors/themeUtils.d.ts.map +0 -1
- package/dist/types/src/colors/types.d.ts +0 -16
- package/dist/types/src/colors/types.d.ts.map +0 -1
- package/dist/types/src/migrations/beta-to-v1.d.ts +0 -3
- package/dist/types/src/migrations/beta-to-v1.d.ts.map +0 -1
- package/dist/types/src/migrations/codemods/css/plugins.d.ts +0 -6
- package/dist/types/src/migrations/codemods/css/plugins.d.ts.map +0 -1
- package/dist/types/src/migrations/codemods/css/run.d.ts +0 -8
- package/dist/types/src/migrations/codemods/css/run.d.ts.map +0 -1
- package/dist/types/src/migrations/codemods/jsx/classname-prefix.d.ts +0 -10
- package/dist/types/src/migrations/codemods/jsx/classname-prefix.d.ts.map +0 -1
- package/dist/types/src/migrations/codemods/jsx/run.d.ts +0 -7
- package/dist/types/src/migrations/codemods/jsx/run.d.ts.map +0 -1
- package/dist/types/src/migrations/index.d.ts +0 -6
- package/dist/types/src/migrations/index.d.ts.map +0 -1
- package/dist/types/src/migrations/react-beta-to-v1.d.ts +0 -3
- package/dist/types/src/migrations/react-beta-to-v1.d.ts.map +0 -1
- package/dist/types/src/test/jsx-test.d.ts +0 -4
- package/dist/types/src/test/jsx-test.d.ts.map +0 -1
- package/dist/types/src/tokens/actions.d.ts +0 -3
- package/dist/types/src/tokens/actions.d.ts.map +0 -1
- package/dist/types/src/tokens/build.d.ts +0 -11
- package/dist/types/src/tokens/build.d.ts.map +0 -1
- package/dist/types/src/tokens/configs.d.ts +0 -23
- package/dist/types/src/tokens/configs.d.ts.map +0 -1
- package/dist/types/src/tokens/formats/css-classes.d.ts +0 -6
- package/dist/types/src/tokens/formats/css-classes.d.ts.map +0 -1
- package/dist/types/src/tokens/formats/css-variables.d.ts +0 -3
- package/dist/types/src/tokens/formats/css-variables.d.ts.map +0 -1
- package/dist/types/src/tokens/formats/js-tokens.d.ts +0 -6
- package/dist/types/src/tokens/formats/js-tokens.d.ts.map +0 -1
- package/dist/types/src/tokens/transformers.d.ts +0 -5
- package/dist/types/src/tokens/transformers.d.ts.map +0 -1
- package/dist/types/src/tokens/utils/noCase.d.ts +0 -11
- package/dist/types/src/tokens/utils/noCase.d.ts.map +0 -1
- package/dist/types/src/tokens/utils/permutateThemes.d.ts +0 -7
- package/dist/types/src/tokens/utils/permutateThemes.d.ts.map +0 -1
- package/dist/types/src/tokens/utils/utils.d.ts +0 -17
- package/dist/types/src/tokens/utils/utils.d.ts.map +0 -1
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { cssClassRename, cssVarRename } from './codemods/css/plugins.js';
|
|
2
|
-
import { runCssCodemod } from './codemods/css/run.js';
|
|
3
|
-
export default (glob) => runCssCodemod({
|
|
4
|
-
globPattern: glob,
|
|
5
|
-
plugins: [
|
|
6
|
-
cssClassRename({
|
|
7
|
-
'.fds-': '.ds-',
|
|
8
|
-
}),
|
|
9
|
-
// New component token prefixes
|
|
10
|
-
cssVarRename({
|
|
11
|
-
'--fds-accordion': '--dsc-accordion',
|
|
12
|
-
'--fds-alert': '--dsc-alert',
|
|
13
|
-
'--fds-btn': '--dsc-btn',
|
|
14
|
-
'--fds-checkbox': '--dsc-checkbox',
|
|
15
|
-
'--fdsc-chip': '--dsc-chip',
|
|
16
|
-
'--fdsc-gap': '--dsc-chip-group-gap',
|
|
17
|
-
'--fdsc-removable': '--dsc-removable',
|
|
18
|
-
'--fdsc-bottom': '--dsc-bottom',
|
|
19
|
-
'--fds-pagination': '--dsc-pagination',
|
|
20
|
-
'--fds-popover': '--dsc-popover',
|
|
21
|
-
'--fds-radio': '--dsc-radio',
|
|
22
|
-
'--f-search': '--dsc-search',
|
|
23
|
-
'--fds-skeleton': '--dsc-skeleton',
|
|
24
|
-
'--fds-switch--transition': '--dsc-switch-transition',
|
|
25
|
-
'--fds-switch': '--dsc-switch',
|
|
26
|
-
'--table-padding': '--dsc-table-padding',
|
|
27
|
-
'--border-radius': '--dsc-table-border-radius',
|
|
28
|
-
'--fds-tabs': '--dsc-tabs',
|
|
29
|
-
'--fds-tag': '--dsc-tag',
|
|
30
|
-
'--fds-focus-border-width': '--dsc-focus-border-width',
|
|
31
|
-
}),
|
|
32
|
-
// New tokens
|
|
33
|
-
cssVarRename({
|
|
34
|
-
'--fds-semantic-surface-first-light': '--ds-color-brand1-surface-default',
|
|
35
|
-
'--fds-semantic-surface-first-light-hover': '--ds-color-brand1-surface-hover',
|
|
36
|
-
'--fds-semantic-surface-first-light-active': '--ds-color-brand1-surface-active',
|
|
37
|
-
'--fds-semantic-surface-first-dark': '[delete]',
|
|
38
|
-
'--fds-semantic-surface-second-light': '--ds-color-brand2-surface-default',
|
|
39
|
-
'--fds-semantic-surface-second-light-hover': '--ds-color-brand2-surface-hover',
|
|
40
|
-
'--fds-semantic-surface-second-light-active': '--ds-color-brand2-surface-active',
|
|
41
|
-
'--fds-semantic-surface-second-dark': '[delete]',
|
|
42
|
-
'--fds-semantic-surface-third-light': '--ds-color-brand3-surface-default',
|
|
43
|
-
'--fds-semantic-surface-third-light-hover': '--ds-color-brand3-surface-hover',
|
|
44
|
-
'--fds-semantic-surface-third-light-active': '--ds-color-brand3-surface-active',
|
|
45
|
-
'--fds-semantic-surface-third-dark': '[delete]',
|
|
46
|
-
'--fds-semantic-surface-action-first-subtle': '--ds-color-accent-surface-default',
|
|
47
|
-
'--fds-semantic-surface-action-first-subtle-hover': '--ds-color-accent-surface-hover',
|
|
48
|
-
'--fds-semantic-surface-action-first-default': '--ds-color-accent-base-default',
|
|
49
|
-
'--fds-semantic-surface-action-first-hover': '--ds-color-accent-base-hover',
|
|
50
|
-
'--fds-semantic-surface-action-first-active': '--ds-color-accent-base-active',
|
|
51
|
-
'--fds-semantic-surface-action-first-no_fill': '--ds-color-accent-background-default',
|
|
52
|
-
'--fds-semantic-surface-action-first-no_fill-hover': '--ds-color-accent-surface-default',
|
|
53
|
-
'--fds-semantic-surface-action-first-no_fill-active': '--ds-color-accent-surface-hover',
|
|
54
|
-
'--fds-semantic-surface-action-second-subtle': '--ds-color-neutral-surface-default',
|
|
55
|
-
'--fds-semantic-surface-action-second-subtle-hover': '--ds-color-neutral-surface-hover',
|
|
56
|
-
'--fds-semantic-surface-action-second-default': '--ds-color-neutral-base-default',
|
|
57
|
-
'--fds-semantic-surface-action-second-hover': '--ds-color-neutral-base-hover',
|
|
58
|
-
'--fds-semantic-surface-action-second-active': '--ds-color-neutral-base-active',
|
|
59
|
-
'--fds-semantic-surface-action-second-no_fill': '--ds-color-neutral-background-default',
|
|
60
|
-
'--fds-semantic-surface-action-second-no_fill-hover': '--ds-color-neutral-surface-default',
|
|
61
|
-
'--fds-semantic-surface-action-second-no_fill-active': '--ds-color-neutral-surface-hover',
|
|
62
|
-
'--fds-semantic-surface-action-subtle': '--ds-color-accent-surface-default',
|
|
63
|
-
'--fds-semantic-surface-action-subtle-hover': '--ds-color-accent-surface-hover',
|
|
64
|
-
'--fds-semantic-surface-action-default': '--ds-color-accent-base-default',
|
|
65
|
-
'--fds-semantic-surface-action-hover': '--ds-color-accent-base-hover',
|
|
66
|
-
'--fds-semantic-surface-action-active': '--ds-color-accent-base-active',
|
|
67
|
-
'--fds-semantic-surface-action-no_fill': '--ds-color-accent-background-default',
|
|
68
|
-
'--fds-semantic-surface-action-no_fill-hover': '--ds-color-accent-surface-default',
|
|
69
|
-
'--fds-semantic-surface-action-no_fill-active': '--ds-color-accent-surface-hover',
|
|
70
|
-
'--fds-semantic-surface-action-checked': '--ds-color-accent-base-default',
|
|
71
|
-
'--fds-semantic-surface-neutral-default': '--ds-color-neutral-background-default',
|
|
72
|
-
'--fds-semantic-surface-neutral-selected': '[delete]',
|
|
73
|
-
'--fds-semantic-surface-neutral-subtle': '--ds-color-neutral-background-subtle',
|
|
74
|
-
'--fds-semantic-surface-neutral-subtle-hover': '--ds-color-neutral-surface-default',
|
|
75
|
-
'--fds-semantic-surface-neutral-dark': '[delete]',
|
|
76
|
-
'--fds-semantic-surface-neutral-dark-hover': '[delete]',
|
|
77
|
-
'--fds-semantic-surface-neutral-inverted': '[delete]',
|
|
78
|
-
'--fds-semantic-surface-success-subtle': '--ds-color-success-surface-default',
|
|
79
|
-
'--fds-semantic-surface-success-subtle-hover': '--ds-color-success-surface-hover',
|
|
80
|
-
'--fds-semantic-surface-success-default': '--ds-color-success-base-default',
|
|
81
|
-
'--fds-semantic-surface-success-hover': '--ds-color-success-base-hover',
|
|
82
|
-
'--fds-semantic-surface-success-active': '--ds-color-success-base-active',
|
|
83
|
-
'--fds-semantic-surface-success-no_fill': '--ds-color-success-background-default',
|
|
84
|
-
'--fds-semantic-surface-success-no_fill-hover': '--ds-color-success-surface-default',
|
|
85
|
-
'--fds-semantic-surface-success-no_fill-active': '--ds-color-success-surface-hover',
|
|
86
|
-
'--fds-semantic-surface-warning-subtle': '--ds-color-warning-surface-default',
|
|
87
|
-
'--fds-semantic-surface-warning-subtle-hover': '--ds-color-warning-surface-default',
|
|
88
|
-
'--fds-semantic-surface-warning-default': '--ds-color-warning-surface-default',
|
|
89
|
-
'--fds-semantic-surface-warning-default-hover': '--ds-color-warning-surface-hover',
|
|
90
|
-
'--fds-semantic-surface-danger-subtle': '--ds-color-danger-surface-default',
|
|
91
|
-
'--fds-semantic-surface-danger-subtle-hover': '--ds-color-danger-surface-hover',
|
|
92
|
-
'--fds-semantic-surface-danger-default': '--ds-color-danger-base-default',
|
|
93
|
-
'--fds-semantic-surface-danger-hover': '--ds-color-danger-base-hover',
|
|
94
|
-
'--fds-semantic-surface-danger-active': '--ds-color-danger-base-active',
|
|
95
|
-
'--fds-semantic-surface-danger-no_fill': '--ds-color-danger-background-default',
|
|
96
|
-
'--fds-semantic-surface-danger-no_fill-hover': '--ds-color-danger-surface-default',
|
|
97
|
-
'--fds-semantic-surface-danger-no_fill-active': '--ds-color-danger-surface-hover',
|
|
98
|
-
'--fds-semantic-surface-info-subtle': '--ds-color-info-surface-default',
|
|
99
|
-
'--fds-semantic-surface-info-subtle-hover': '[delete]',
|
|
100
|
-
'--fds-semantic-surface-on_inverted-default': '[delete]',
|
|
101
|
-
'--fds-semantic-surface-on_inverted-hover': '[delete]',
|
|
102
|
-
'--fds-semantic-surface-on_inverted-active': '[delete]',
|
|
103
|
-
'--fds-semantic-surface-on_inverted-no_fill': '[delete]',
|
|
104
|
-
'--fds-semantic-surface-on_inverted-no_fill-hover': '[delete]',
|
|
105
|
-
'--fds-semantic-surface-on_inverted-no_fill-active': '[delete]',
|
|
106
|
-
'--fds-semantic-surface-focus-default': '[delete]',
|
|
107
|
-
'--fds-semantic-border-first-default': '--ds-color-brand1-base-default',
|
|
108
|
-
'--fds-semantic-border-first-hover': '--ds-color-brand1-base-hover',
|
|
109
|
-
'--fds-semantic-border-first-active': '--ds-color-brand1-base-active',
|
|
110
|
-
'--fds-semantic-border-second-default': '--ds-color-brand2-base-default',
|
|
111
|
-
'--fds-semantic-border-second-hover': '--ds-color-brand2-base-hover',
|
|
112
|
-
'--fds-semantic-border-second-active': '--ds-color-brand2-base-active',
|
|
113
|
-
'--fds-semantic-border-third-default': '--ds-color-brand3-base-default',
|
|
114
|
-
'--fds-semantic-border-third-hover': '--ds-color-brand3-base-hover',
|
|
115
|
-
'--fds-semantic-border-third-active': '--ds-color-brand3-base-active',
|
|
116
|
-
'--fds-semantic-border-action-first-subtle': '--ds-color-accent-border-subtle',
|
|
117
|
-
'--fds-semantic-border-action-first-subtle-hover': '--ds-color-accent-border-default',
|
|
118
|
-
'--fds-semantic-border-action-first-default': '--ds-color-accent-base-default',
|
|
119
|
-
'--fds-semantic-border-action-first-hover': '--ds-color-accent-base-hover',
|
|
120
|
-
'--fds-semantic-border-action-first-active': '--ds-color-accent-base-active',
|
|
121
|
-
'--fds-semantic-border-action-second-subtle': '--ds-color-neutral-border-subtle',
|
|
122
|
-
'--fds-semantic-border-action-second-subtle-hover': '--ds-color-neutral-border-default',
|
|
123
|
-
'--fds-semantic-border-action-second-default': '--ds-color-neutral-base-default',
|
|
124
|
-
'--fds-semantic-border-action-second-hover': '--ds-color-neutral-base-hover',
|
|
125
|
-
'--fds-semantic-border-action-second-active': '--ds-color-neutral-base-active',
|
|
126
|
-
'--fds-semantic-border-action-subtle': '--ds-color-accent-border-subtle',
|
|
127
|
-
'--fds-semantic-border-action-subtle-hover': '--ds-color-accent-border-default',
|
|
128
|
-
'--fds-semantic-border-action-default': '--ds-color-accent-base-default',
|
|
129
|
-
'--fds-semantic-border-action-hover': '--ds-color-accent-base-hover',
|
|
130
|
-
'--fds-semantic-border-action-active': '--ds-color-accent-base-active',
|
|
131
|
-
'--fds-semantic-border-action-dark': '[delete]',
|
|
132
|
-
'--fds-semantic-border-action-dark-hover': '[delete]',
|
|
133
|
-
'--fds-semantic-border-info-default': '--ds-color-info-border-strong',
|
|
134
|
-
'--fds-semantic-border-neutral-default': '--ds-color-neutral-border-strong',
|
|
135
|
-
'--fds-semantic-border-neutral-subtle': '--ds-color-neutral-border-subtle',
|
|
136
|
-
'--fds-semantic-border-neutral-strong': '--ds-color-neutral-base-default',
|
|
137
|
-
'--fds-semantic-border-success-default': '--ds-color-success-border-default',
|
|
138
|
-
'--fds-semantic-border-success-hover': '[delete]',
|
|
139
|
-
'--fds-semantic-border-success-active': '[delete]',
|
|
140
|
-
'--fds-semantic-border-warning-default': '--ds-color-warning-border-default',
|
|
141
|
-
'--fds-semantic-border-warning-hover': '[delete]',
|
|
142
|
-
'--fds-semantic-border-warning-active': '[delete]',
|
|
143
|
-
'--fds-semantic-border-danger-default': '--ds-color-danger-border-default',
|
|
144
|
-
'--fds-semantic-border-danger-hover': '--ds-color-danger-border-strong',
|
|
145
|
-
'--fds-semantic-border-danger-active': '--ds-color-danger-border-strong',
|
|
146
|
-
'--fds-semantic-border-focus-outline': '--ds-color-neutral-text-default',
|
|
147
|
-
'--fds-semantic-border-focus-boxshadow': '--ds-color-neutral-background-default',
|
|
148
|
-
'--fds-semantic-border-on_inverted-default': '[delete]',
|
|
149
|
-
'--fds-semantic-border-input-default': '--ds-color-neutral-border-default',
|
|
150
|
-
'--fds-semantic-border-input-hover': '--ds-color-accent-border-strong',
|
|
151
|
-
'--fds-semantic-border-divider-default': '--ds-color-neutral-border-subtle',
|
|
152
|
-
'--fds-semantic-border-divider-subtle': '--ds-color-neutral-border-subtle',
|
|
153
|
-
'--fds-semantic-border-divider-strong': '--ds-color-neutral-border-default',
|
|
154
|
-
'--fds-semantic-text-action-first-default': '--ds-color-accent-base-default',
|
|
155
|
-
'--fds-semantic-text-action-first-hover': '--ds-color-accent-base-hover',
|
|
156
|
-
'--fds-semantic-text-action-first-active': '--ds-color-accent-base-active',
|
|
157
|
-
'--fds-semantic-text-action-first-on_action': '--ds-color-accent-contrast-default',
|
|
158
|
-
'--fds-semantic-text-action-second-default': '--ds-color-neutral-base-default',
|
|
159
|
-
'--fds-semantic-text-action-second-hover': '--ds-color-neutral-base-hover',
|
|
160
|
-
'--fds-semantic-text-action-second-active': '--ds-color-neutral-base-active',
|
|
161
|
-
'--fds-semantic-text-action-second-on_action': '--ds-color-neutral-contrast-default',
|
|
162
|
-
'--fds-semantic-text-action-default': '--ds-color-accent-base-default',
|
|
163
|
-
'--fds-semantic-text-action-hover': '--ds-color-accent-base-hover',
|
|
164
|
-
'--fds-semantic-text-action-active': '--ds-color-accent-base-active',
|
|
165
|
-
'--fds-semantic-text-action-on_action': '--ds-color-accent-contrast-default',
|
|
166
|
-
'--fds-semantic-text-success-default': '--ds-color-success-base-default',
|
|
167
|
-
'--fds-semantic-text-success-hover': '--ds-color-success-base-default',
|
|
168
|
-
'--fds-semantic-text-success-active': '--ds-color-success-base-default',
|
|
169
|
-
'--fds-semantic-text-success-on_success': '--ds-color-success-contrast-default',
|
|
170
|
-
'--fds-semantic-text-success-on_success_subtle': '--ds-color-success-text-default',
|
|
171
|
-
'--fds-semantic-text-neutral-default': '--ds-color-neutral-text-default',
|
|
172
|
-
'--fds-semantic-text-neutral-subtle': '--ds-color-neutral-text-subtle',
|
|
173
|
-
'--fds-semantic-text-neutral-on_inverted': '--ds-color-neutral-contrast-default',
|
|
174
|
-
'--fds-semantic-text-warning-default': '[delete]',
|
|
175
|
-
'--fds-semantic-text-warning-icon_warning': '--ds-color-warning-base-default',
|
|
176
|
-
'--fds-semantic-text-warning-on_warning': '--ds-color-neutral-text-default',
|
|
177
|
-
'--fds-semantic-text-danger-default': '--ds-color-danger-text-default',
|
|
178
|
-
'--fds-semantic-text-danger-hover': '--ds-color-danger-text-default',
|
|
179
|
-
'--fds-semantic-text-danger-active': '--ds-color-danger-text-default',
|
|
180
|
-
'--fds-semantic-text-danger-on_danger': '--ds-color-danger-contrast-default',
|
|
181
|
-
'--fds-semantic-text-danger-on_danger_subtle': '--ds-color-danger-text-default',
|
|
182
|
-
'--fds-semantic-text-visited-default': '--ds-global-purple-13',
|
|
183
|
-
'--fds-semantic-background-default': '--ds-color-neutral-background-default',
|
|
184
|
-
'--fds-semantic-background-subtle': '--ds-color-neutral-background-subtle',
|
|
185
|
-
'--fds-typography-heading-3xlarge': '[delete]',
|
|
186
|
-
'--fds-typography-heading-2xlarge': '--ds-typography-heading-2xl',
|
|
187
|
-
'--fds-typography-heading-xlarge': '--ds-typography-heading-xl',
|
|
188
|
-
'--fds-typography-heading-large': '--ds-typography-heading-lg',
|
|
189
|
-
'--fds-typography-heading-medium': '--ds-typography-heading-md',
|
|
190
|
-
'--fds-typography-heading-small': '--ds-typography-heading-sm',
|
|
191
|
-
'--fds-typography-heading-xsmall': '--ds-typography-heading-xs',
|
|
192
|
-
'--fds-typography-heading-xxsmall': '--ds-typography-heading-2xs',
|
|
193
|
-
'--fds-typography-ingress-large': '--ds-typography-ingress-lg',
|
|
194
|
-
'--fds-typography-ingress-medium': '--ds-typography-ingress-md',
|
|
195
|
-
'--fds-typography-ingress-small': '--ds-typography-ingress-sm',
|
|
196
|
-
'--fds-typography-ingress-xsmall': '--ds-typography-ingress-xs',
|
|
197
|
-
'--fds-typography-paragraph-large': '--ds-typography-paragraph-lg',
|
|
198
|
-
'--fds-typography-paragraph-medium': '--ds-typography-paragraph-md',
|
|
199
|
-
'--fds-typography-paragraph-small': '--ds-typography-paragraph-sm',
|
|
200
|
-
'--fds-typography-paragraph-xsmall': '--ds-typography-paragraph-xs',
|
|
201
|
-
'--fds-typography-paragraph-short-large': '--ds-typography-paragraph-short-lg',
|
|
202
|
-
'--fds-typography-paragraph-short-medium': '--ds-typography-paragraph-short-md',
|
|
203
|
-
'--fds-typography-paragraph-short-small': '--ds-typography-paragraph-short-sm',
|
|
204
|
-
'--fds-typography-paragraph-short-xsmall': '--ds-typography-paragraph-short-xs',
|
|
205
|
-
'--fds-typography-paragraph-long-large': '--ds-typography-paragraph-long-lg',
|
|
206
|
-
'--fds-typography-paragraph-long-medium': '--ds-typography-paragraph-long-md',
|
|
207
|
-
'--fds-typography-paragraph-long-small': '--ds-typography-paragraph-long-sm',
|
|
208
|
-
'--fds-typography-paragraph-long-xsmall': '--ds-typography-paragraph-long-xs',
|
|
209
|
-
'--fds-typography-label-large': '--ds-typography-label-lg',
|
|
210
|
-
'--fds-typography-label-medium': '--ds-typography-label-md',
|
|
211
|
-
'--fds-typography-label-small': '--ds-typography-label-sm',
|
|
212
|
-
'--fds-typography-label-xsmall': '--ds-typography-label-xs',
|
|
213
|
-
'--fds-typography-error_message-large': '--ds-typography-error_message-lg',
|
|
214
|
-
'--fds-typography-error_message-medium': '--ds-typography-error_message-md',
|
|
215
|
-
'--fds-typography-error_message-small': '--ds-typography-error_message-sm',
|
|
216
|
-
'--fds-typography-error_message-xsmall': '--ds-typography-error_message-xs',
|
|
217
|
-
'--fds-typography-interactive-large': '--ds-typography-paragraph-short-lg',
|
|
218
|
-
'--fds-typography-interactive-medium': '--ds-typography-paragraph-short-md',
|
|
219
|
-
'--fds-typography-interactive-small': '--ds-typography-paragraph-short-sm',
|
|
220
|
-
'--fds-border_radius-interactive': '--ds-border-radius-md',
|
|
221
|
-
'--fds-border_radius-small': '--ds-border-radius-sm',
|
|
222
|
-
'--fds-border_radius-medium': '--ds-border-radius-md',
|
|
223
|
-
'--fds-border_radius-large': '--ds-border-radius-lg',
|
|
224
|
-
'--fds-border_radius-xlarge': '--ds-border-radius-xl',
|
|
225
|
-
'--fds-border_radius-xxlarge': '--ds-border-radius-2xl',
|
|
226
|
-
'--fds-border_radius-xxxlarge': '--ds-border-radius-3xl',
|
|
227
|
-
'--fds-border_radius-xxxxlarge': '--ds-border-radius-4xl',
|
|
228
|
-
'--fds-border_radius-full': '--ds-border-radius-full',
|
|
229
|
-
'--fds-base_spacing': '[delete]',
|
|
230
|
-
'--fds-base_sizing': '[delete]',
|
|
231
|
-
'--fds-border_width-default': '--ds-border-width-default',
|
|
232
|
-
'--fds-border_width-active': '--ds-border-width-highlight',
|
|
233
|
-
'--fds-border_width-tab_focus': '--ds-border-width-highlight',
|
|
234
|
-
'--fds-shadow-xsmall': '--ds-shadow-xs',
|
|
235
|
-
'--fds-shadow-small': '--ds-shadow-sm',
|
|
236
|
-
'--fds-shadow-medium': '--ds-shadow-md',
|
|
237
|
-
'--fds-shadow-large': '--ds-shadow-lg',
|
|
238
|
-
'--fds-shadow-xlarge': '--ds-shadow-xl',
|
|
239
|
-
'--fds-spacing-0': '--ds-spacing-0',
|
|
240
|
-
'--fds-spacing-1': '--ds-spacing-1',
|
|
241
|
-
'--fds-spacing-2': '--ds-spacing-2',
|
|
242
|
-
'--fds-spacing-3': '--ds-spacing-3',
|
|
243
|
-
'--fds-spacing-4': '--ds-spacing-4',
|
|
244
|
-
'--fds-spacing-5': '--ds-spacing-5',
|
|
245
|
-
'--fds-spacing-6': '--ds-spacing-6',
|
|
246
|
-
'--fds-spacing-7': '--ds-spacing-7',
|
|
247
|
-
'--fds-spacing-8': '--ds-spacing-8',
|
|
248
|
-
'--fds-spacing-9': '--ds-spacing-9',
|
|
249
|
-
'--fds-spacing-10': '--ds-spacing-10',
|
|
250
|
-
'--fds-spacing-11': '--ds-spacing-11',
|
|
251
|
-
'--fds-spacing-12': '--ds-spacing-12',
|
|
252
|
-
'--fds-spacing-13': '--ds-spacing-13',
|
|
253
|
-
'--fds-spacing-14': '--ds-spacing-14',
|
|
254
|
-
'--fds-spacing-15': '--ds-spacing-15',
|
|
255
|
-
'--fds-spacing-18': '--ds-spacing-18',
|
|
256
|
-
'--fds-spacing-22': '--ds-spacing-22',
|
|
257
|
-
'--fds-spacing-26': '--ds-spacing-26',
|
|
258
|
-
'--fds-spacing-30': '--ds-spacing-30',
|
|
259
|
-
'--fds-sizing-0': '--ds-sizing-0',
|
|
260
|
-
'--fds-sizing-1': '--ds-sizing-1',
|
|
261
|
-
'--fds-sizing-2': '--ds-sizing-2',
|
|
262
|
-
'--fds-sizing-3': '--ds-sizing-3',
|
|
263
|
-
'--fds-sizing-4': '--ds-sizing-4',
|
|
264
|
-
'--fds-sizing-5': '--ds-sizing-5',
|
|
265
|
-
'--fds-sizing-6': '--ds-sizing-6',
|
|
266
|
-
'--fds-sizing-7': '--ds-sizing-7',
|
|
267
|
-
'--fds-sizing-8': '--ds-sizing-8',
|
|
268
|
-
'--fds-sizing-9': '--ds-sizing-9',
|
|
269
|
-
'--fds-sizing-10': '--ds-sizing-10',
|
|
270
|
-
'--fds-sizing-11': '--ds-sizing-11',
|
|
271
|
-
'--fds-sizing-12': '--ds-sizing-12',
|
|
272
|
-
'--fds-sizing-13': '--ds-sizing-13',
|
|
273
|
-
'--fds-sizing-14': '--ds-sizing-14',
|
|
274
|
-
'--fds-sizing-15': '--ds-sizing-15',
|
|
275
|
-
'--fds-sizing-18': '--ds-sizing-18',
|
|
276
|
-
'--fds-sizing-22': '--ds-sizing-22',
|
|
277
|
-
'--fds-sizing-26': '--ds-sizing-26',
|
|
278
|
-
'--fds-sizing-30': '--ds-sizing-30',
|
|
279
|
-
'--fds-opacity-disabled': '--ds-disabled-opacity',
|
|
280
|
-
'--fds-colors-blue-100': '--ds-global-blue-1',
|
|
281
|
-
'--fds-colors-blue-200': '--ds-global-blue-2',
|
|
282
|
-
'--fds-colors-blue-700': '--ds-global-blue-7',
|
|
283
|
-
'--fds-colors-blue-800': '--ds-global-blue-8',
|
|
284
|
-
'--fds-colors-blue-900': '--ds-global-blue-9',
|
|
285
|
-
'--fds-colors-grey-100': '--ds-color-neutral-1',
|
|
286
|
-
'--fds-colors-grey-200': '--ds-color-neutral-2',
|
|
287
|
-
'--fds-colors-grey-400': '--ds-color-neutral-4',
|
|
288
|
-
'--fds-colors-grey-600': '--ds-color-neutral-6',
|
|
289
|
-
'--fds-colors-grey-700': '--ds-color-neutral-7',
|
|
290
|
-
'--fds-colors-grey-800': '--ds-color-neutral-8',
|
|
291
|
-
'--fds-colors-green-200': '--ds-global-green-2',
|
|
292
|
-
'--fds-colors-green-300': '--ds-global-green-3',
|
|
293
|
-
'--fds-colors-green-700': '--ds-global-green-7',
|
|
294
|
-
'--fds-colors-green-800': '--ds-global-green-8',
|
|
295
|
-
'--fds-colors-green-900': '--ds-global-green-9',
|
|
296
|
-
'--fds-colors-yellow-100': '--ds-global-yellow-1',
|
|
297
|
-
'--fds-colors-yellow-200': '--ds-global-yellow-2',
|
|
298
|
-
'--fds-colors-yellow-300': '--ds-global-yellow-3',
|
|
299
|
-
'--fds-colors-yellow-500': '--ds-global-yellow-5',
|
|
300
|
-
'--fds-colors-blue-400': '--ds-global-blue-4',
|
|
301
|
-
'--fds-colors-grey-300': '--ds-global-grey-3',
|
|
302
|
-
'--fds-colors-orange-600': '--ds-global-orange-6',
|
|
303
|
-
'--fds-colors-orange-700': '--ds-global-orange-7',
|
|
304
|
-
'--fds-colors-orange-800': '--ds-global-orange-8',
|
|
305
|
-
'--fds-colors-red-800': '--ds-global-red-8',
|
|
306
|
-
'--fds-colors-purple-700': '--ds-global-purple-7',
|
|
307
|
-
'--fds-colors-red-100': '--ds-global-red-1',
|
|
308
|
-
'--fds-colors-red-200': '--ds-global-red-2',
|
|
309
|
-
'--fds-colors-red-500': '--ds-global-red-5',
|
|
310
|
-
'--fds-colors-red-600': '--ds-global-red-6',
|
|
311
|
-
'--fds-colors-red-700': '--ds-global-red-7',
|
|
312
|
-
'--fds-brand-alt1-100': '--ds-color-brand1-1',
|
|
313
|
-
'--fds-brand-alt1-200': '--ds-color-brand1-2',
|
|
314
|
-
'--fds-brand-alt1-300': '--ds-color-brand1-3',
|
|
315
|
-
'--fds-brand-alt1-400': '--ds-color-brand1-4',
|
|
316
|
-
'--fds-brand-alt1-500': '--ds-color-brand1-5',
|
|
317
|
-
'--fds-brand-alt1-600': '--ds-color-brand1-6',
|
|
318
|
-
'--fds-brand-alt1-700': '--ds-color-brand1-7',
|
|
319
|
-
'--fds-brand-alt1-800': '--ds-color-brand1-8',
|
|
320
|
-
'--fds-brand-alt1-900': '--ds-color-brand1-9',
|
|
321
|
-
'--fds-brand-alt2-100': '--ds-color-brand2-1',
|
|
322
|
-
'--fds-brand-alt2-200': '--ds-color-brand2-2',
|
|
323
|
-
'--fds-brand-alt2-300': '--ds-color-brand2-3',
|
|
324
|
-
'--fds-brand-alt2-400': '--ds-color-brand2-4',
|
|
325
|
-
'--fds-brand-alt2-500': '--ds-color-brand2-5',
|
|
326
|
-
'--fds-brand-alt2-600': '--ds-color-brand2-6',
|
|
327
|
-
'--fds-brand-alt2-700': '--ds-color-brand2-7',
|
|
328
|
-
'--fds-brand-alt2-800': '--ds-color-brand2-8',
|
|
329
|
-
'--fds-brand-alt2-900': '--ds-color-brand2-9',
|
|
330
|
-
'--fds-brand-alt3-100': '--ds-color-brand3-1',
|
|
331
|
-
'--fds-brand-alt3-200': '--ds-color-brand3-2',
|
|
332
|
-
'--fds-brand-alt3-300': '--ds-color-brand3-3',
|
|
333
|
-
'--fds-brand-alt3-400': '--ds-color-brand3-4',
|
|
334
|
-
'--fds-brand-alt3-500': '--ds-color-brand3-5',
|
|
335
|
-
'--fds-brand-alt3-600': '--ds-color-brand3-6',
|
|
336
|
-
'--fds-brand-alt3-700': '--ds-color-brand3-7',
|
|
337
|
-
'--fds-brand-alt3-800': '--ds-color-brand3-8',
|
|
338
|
-
'--fds-brand-alt3-900': '--ds-color-brand3-9',
|
|
339
|
-
}),
|
|
340
|
-
],
|
|
341
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import hash from 'object-hash';
|
|
4
|
-
const printDelete = (text) => console.log(`${chalk.red('Deleted:')} ${text}`.replace(/"|'/g, ''));
|
|
5
|
-
const deleteMsg = (decl, from) => `${chalk.yellow(from)} @ ${chalk.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
6
|
-
export const cssClassRename = (dictionary) => ({
|
|
7
|
-
postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
|
|
8
|
-
Rule(rule) {
|
|
9
|
-
const selector = rule.selector;
|
|
10
|
-
if (!selector)
|
|
11
|
-
return;
|
|
12
|
-
Object.entries(dictionary).forEach(([from, to]) => {
|
|
13
|
-
if (!selector.includes(from))
|
|
14
|
-
return;
|
|
15
|
-
const newSelector = selector.replace(new RegExp(from, 'g'), to);
|
|
16
|
-
rule.selector = newSelector;
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
export const cssVarRename = (dictionary) => ({
|
|
21
|
-
postcssPlugin: `Replaces CSS variables ${hash(dictionary)}`,
|
|
22
|
-
Declaration(decl) {
|
|
23
|
-
const { value, prop } = decl;
|
|
24
|
-
const deleted = new Set();
|
|
25
|
-
Object.entries(dictionary).forEach(([from, to]) => {
|
|
26
|
-
if (!R.isEmpty(to)) {
|
|
27
|
-
switch (true) {
|
|
28
|
-
case R.includes(from, value):
|
|
29
|
-
to === '[delete]' && deleted.add(deleteMsg(decl, from));
|
|
30
|
-
decl.value = value.replace(from, to);
|
|
31
|
-
break;
|
|
32
|
-
case R.includes(from, prop):
|
|
33
|
-
if (decl.variable) {
|
|
34
|
-
to === '[delete]' && deleted.add(deleteMsg(decl, from));
|
|
35
|
-
decl.prop = prop.replace(from, to);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
if (deleted.size > 0) {
|
|
42
|
-
Array.from(deleted).forEach(printDelete);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import postcss from 'postcss';
|
|
3
|
-
import glob from 'fast-glob';
|
|
4
|
-
export const runCssCodemod = async ({ plugins = [], globPattern = './**/*.css' }) => {
|
|
5
|
-
const processor = postcss(plugins);
|
|
6
|
-
const transform = async () => {
|
|
7
|
-
const files = await glob(globPattern, { ignore: ['node_modules/**', 'dist/**'] });
|
|
8
|
-
const filePromises = files.map(async (file) => {
|
|
9
|
-
const contents = fs.readFileSync(file).toString();
|
|
10
|
-
const result = await processor.process(contents, { from: file });
|
|
11
|
-
fs.writeFileSync(file, result.css);
|
|
12
|
-
});
|
|
13
|
-
await Promise.all(filePromises);
|
|
14
|
-
};
|
|
15
|
-
// Run the transform.
|
|
16
|
-
return transform();
|
|
17
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const replaceInLiteral = (node) => {
|
|
2
|
-
if (node.startsWith('fds-')) {
|
|
3
|
-
return node.replace('fds-', 'ds-');
|
|
4
|
-
}
|
|
5
|
-
return node;
|
|
6
|
-
};
|
|
7
|
-
const replaceInTemplateLiteral = (node) => {
|
|
8
|
-
node.forEach((element) => {
|
|
9
|
-
const value = element.value.raw;
|
|
10
|
-
if (typeof value !== 'string')
|
|
11
|
-
return;
|
|
12
|
-
element.value.raw = replaceInLiteral(value);
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
const processNode = (node) => {
|
|
16
|
-
if (!node)
|
|
17
|
-
return;
|
|
18
|
-
if (node.type === 'Literal') {
|
|
19
|
-
const value = node.value;
|
|
20
|
-
if (typeof value !== 'string')
|
|
21
|
-
return;
|
|
22
|
-
node.value = replaceInLiteral(value);
|
|
23
|
-
}
|
|
24
|
-
else if (node.type === 'StringLiteral') {
|
|
25
|
-
const value = node.value;
|
|
26
|
-
if (typeof value !== 'string')
|
|
27
|
-
return;
|
|
28
|
-
node.value = replaceInLiteral(value);
|
|
29
|
-
}
|
|
30
|
-
else if (node.type === 'TemplateLiteral') {
|
|
31
|
-
node.quasis && replaceInTemplateLiteral(node.quasis);
|
|
32
|
-
}
|
|
33
|
-
else if (node.type === 'JSXExpressionContainer') {
|
|
34
|
-
const expression = node.expression;
|
|
35
|
-
if (!expression)
|
|
36
|
-
return;
|
|
37
|
-
if (expression.type === 'CallExpression') {
|
|
38
|
-
expression.arguments?.forEach(processNode);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
processNode(expression);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else if (node.type === 'ConditionalExpression') {
|
|
45
|
-
node.test && processNode(node.test);
|
|
46
|
-
node.consequent && processNode(node.consequent);
|
|
47
|
-
node.alternate && processNode(node.alternate);
|
|
48
|
-
}
|
|
49
|
-
else if (node.type === 'BinaryExpression') {
|
|
50
|
-
node.right && processNode(node.right);
|
|
51
|
-
node.left && processNode(node.left);
|
|
52
|
-
}
|
|
53
|
-
else if (node.type === 'LogicalExpression') {
|
|
54
|
-
node.right && processNode(node.right);
|
|
55
|
-
node.left && processNode(node.left);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Replace all class prefixes from 'fds-' to 'ds-'
|
|
60
|
-
* @param file
|
|
61
|
-
* @param api
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
function replaceClassNamePrefix(file, api) {
|
|
65
|
-
const j = api.jscodeshift;
|
|
66
|
-
const root = j(file.source);
|
|
67
|
-
root.find(j.JSXElement).forEach((path) => {
|
|
68
|
-
j(path)
|
|
69
|
-
.find(j.JSXAttribute, { name: { name: 'className' } })
|
|
70
|
-
.forEach((nodePath) => {
|
|
71
|
-
processNode(nodePath.value.value);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
return root.toSource({
|
|
75
|
-
quote: 'single',
|
|
76
|
-
reuseWhitespace: true,
|
|
77
|
-
wrapColumn: 100,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
export default replaceClassNamePrefix;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import glob from 'fast-glob';
|
|
2
|
-
import { run as jscodeshift } from 'jscodeshift/src/Runner.js';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
const transformer = `${import.meta.dirname}/classname-prefix.ts`;
|
|
5
|
-
export const runJSXCodemod = async ({ globPattern = './**/*.tsx', dry }) => {
|
|
6
|
-
const options = {
|
|
7
|
-
dry,
|
|
8
|
-
extensions: 'tsx',
|
|
9
|
-
parser: 'tsx',
|
|
10
|
-
};
|
|
11
|
-
const transform = async () => {
|
|
12
|
-
const files = await glob(globPattern, { ignore: ['node_modules/**', 'dist/**'] });
|
|
13
|
-
const result = await jscodeshift(transformer, files, options);
|
|
14
|
-
if (result.ok) {
|
|
15
|
-
console.log(chalk.green('Finished parsing'));
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
return transform();
|
|
19
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import cl from 'classnames';
|
|
3
|
-
const DEFAULT = 'fds-default';
|
|
4
|
-
export default function JsxTest({ className }) {
|
|
5
|
-
return (_jsxs("div", { children: [_jsx("div", { className: 'fds-hey', onMouseEnter: () => 'fds-func', children: _jsx("button", { className: cl('fds-skrr', 'another', `fds-${DEFAULT}`, true && 'fds-hey', true && `fds-${DEFAULT}`, DEFAULT.includes('fds-') ? 'fds-yes' : 'fds-no', typeof DEFAULT === 'string'
|
|
6
|
-
? 'fds-yes'
|
|
7
|
-
: typeof DEFAULT === 'function'
|
|
8
|
-
? 'fds-no'
|
|
9
|
-
: 'fds-yes', className), children: "button" }) }), _jsx("div", { className: `fds-${DEFAULT}` })] }));
|
|
10
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import glob from 'fast-glob';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import * as R from 'ramda';
|
|
5
|
-
export const makeEntryFile = {
|
|
6
|
-
name: 'make_entryfile',
|
|
7
|
-
do: async function (dictionary, platform) {
|
|
8
|
-
const { outPath, theme, log } = platform;
|
|
9
|
-
const writePath = `${outPath}/${theme}.css`;
|
|
10
|
-
if (log?.verbosity !== 'silent') {
|
|
11
|
-
console.log(chalk.green(`Creating entry file: ${writePath}`));
|
|
12
|
-
}
|
|
13
|
-
const files = await glob(`**/*`, { cwd: platform.buildPath });
|
|
14
|
-
const content = R.reverse(R.sortBy(R.includes('light'), files))
|
|
15
|
-
.map((file) => `@import url('./${theme}/${file}');`)
|
|
16
|
-
.join('\n');
|
|
17
|
-
await fs.writeFile(writePath, content);
|
|
18
|
-
},
|
|
19
|
-
undo: async function noOp() { },
|
|
20
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import StyleDictionary from 'style-dictionary';
|
|
4
|
-
import * as R from 'ramda';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import * as configs from './configs.js';
|
|
7
|
-
const { permutateThemes, getConfigs } = configs;
|
|
8
|
-
// type FormattedCSSPlatform = { css: { output: string; destination: string }[] };
|
|
9
|
-
const sd = new StyleDictionary();
|
|
10
|
-
export async function run(options) {
|
|
11
|
-
const tokensDir = options.tokens;
|
|
12
|
-
const storefrontOutDir = path.resolve('../../apps/storefront/tokens');
|
|
13
|
-
const tokensOutDir = path.resolve(options.out);
|
|
14
|
-
const $themes = JSON.parse(fs.readFileSync(path.resolve(`${tokensDir}/$themes.json`), 'utf-8'));
|
|
15
|
-
const relevant$themes = $themes.filter((theme) => {
|
|
16
|
-
const group = R.toLower(R.defaultTo('')(theme.group));
|
|
17
|
-
if (group === 'typography' && theme.name !== 'default')
|
|
18
|
-
return false;
|
|
19
|
-
if (group === 'size' && theme.name !== 'default')
|
|
20
|
-
return false;
|
|
21
|
-
return true;
|
|
22
|
-
});
|
|
23
|
-
const themes = permutateThemes(relevant$themes);
|
|
24
|
-
const semanticThemes = R.pickBy((_, key) => R.startsWith('light', R.toLower(key)), themes);
|
|
25
|
-
const colorModeConfigs = getConfigs(configs.colorModeVariables, tokensOutDir, tokensDir, themes);
|
|
26
|
-
const semanticConfigs = getConfigs(configs.semanticVariables, tokensOutDir, tokensDir, semanticThemes);
|
|
27
|
-
const storefrontConfigs = getConfigs(configs.typescriptTokens, storefrontOutDir, tokensDir, themes);
|
|
28
|
-
const typographyConfigs = getConfigs(configs.typographyCSS, tokensOutDir, tokensDir, semanticThemes);
|
|
29
|
-
if (typographyConfigs.length > 0) {
|
|
30
|
-
console.log(`\nš± Building ${chalk.green('typography')}`);
|
|
31
|
-
await Promise.all(typographyConfigs.map(async ({ name, config }) => {
|
|
32
|
-
const typographyTheme = name.split('-')[0];
|
|
33
|
-
console.log(`š· Processing: ${typographyTheme}`);
|
|
34
|
-
const typographyClasses = await sd.extend(config);
|
|
35
|
-
return typographyClasses.buildAllPlatforms();
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
if (semanticConfigs.length > 0) {
|
|
39
|
-
console.log(`\nš± Building ${chalk.green('semantic')}`);
|
|
40
|
-
await Promise.all(semanticConfigs.map(async ({ name, config }) => {
|
|
41
|
-
const typographyTheme = name.split('-')[0];
|
|
42
|
-
console.log(`š· Processing: ${typographyTheme}`);
|
|
43
|
-
const typographyClasses = await sd.extend(config);
|
|
44
|
-
return typographyClasses.buildAllPlatforms();
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
if (colorModeConfigs.length > 0) {
|
|
48
|
-
console.log(`\nš± Building ${chalk.green('color-mode')}`);
|
|
49
|
-
await Promise.all(colorModeConfigs.map(async ({ name, config }) => {
|
|
50
|
-
console.log(`š· Processing: ${name}`);
|
|
51
|
-
const themeVariablesSD = await sd.extend(config);
|
|
52
|
-
return themeVariablesSD.buildAllPlatforms();
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
if (storefrontConfigs.length > 0 && options.preview) {
|
|
56
|
-
console.log(`\nš± Building ${chalk.bgGreen('Storefront')}`);
|
|
57
|
-
await Promise.all(storefrontConfigs.map(async ({ name, config }) => {
|
|
58
|
-
console.log(`š· Processing: ${name}`);
|
|
59
|
-
const storefrontSD = await sd.extend(config);
|
|
60
|
-
return storefrontSD.buildAllPlatforms();
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
}
|