@madgex/design-system 9.3.0 → 10.0.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.
@@ -1,181 +0,0 @@
1
- const path = require('path');
2
-
3
- const config = {
4
- // This source path needs to be in posix because combineJSON util inside style dictionary only accepts that
5
- source: [path.resolve(__dirname, '../tokens/*.json').split(path.sep).join(path.posix.sep)],
6
- platforms: {
7
- 'css-variables': {
8
- // transformGroup: 'css',
9
- transforms: ['attribute/cti', 'name/cti/kebab', 'time/seconds', 'content/icon', 'color/css', 'css/rawData'],
10
- buildPath: `${path.resolve(__dirname, '../../dist/_tokens/css/')}/`,
11
- prefix: 'mds',
12
- files: [
13
- {
14
- destination: '_tokens.css',
15
- format: 'css/variables',
16
- filter: 'removePrivate',
17
- },
18
- ],
19
- },
20
- 'scss-variables': {
21
- transforms: ['attribute/cti', 'name/cti/kebab'],
22
- buildPath: `${path.resolve(__dirname, '../scss/constants/')}/`,
23
- prefix: 'constant',
24
- files: [
25
- {
26
- destination: '_sd-tokens.scss',
27
- format: 'scss/map-deep',
28
- options: {
29
- themeable: false,
30
- },
31
- filter(token) {
32
- // only keep "private" tokens aka constants
33
- return !!(token && token.private);
34
- },
35
- },
36
- ],
37
- },
38
- // sketch: {
39
- // transformGroup: 'web',
40
- // buildPath: `${path.resolve(__dirname, '../../dist/_tokens/sketch/')}/`,
41
- // prefix: 'mds',
42
- // files: [
43
- // {
44
- // destination: '_tokens.sketchpalette',
45
- // format: 'sketch/palette',
46
- // },
47
- // ],
48
- // },
49
- 'json-flat': {
50
- transformGroup: 'js',
51
- transforms: ['attribute/cti', 'name/cti/kebab', 'color/css'],
52
- buildPath: 'dist/_tokens/json/',
53
- files: [
54
- {
55
- destination: '_tokens-flat.json',
56
- format: 'json/flat',
57
- },
58
- ],
59
- },
60
- 'json-nested': {
61
- transformGroup: 'js',
62
- transforms: ['attribute/cti', 'name/cti/kebab', 'color/css'],
63
- buildPath: 'dist/_tokens/json/',
64
- files: [
65
- {
66
- destination: '_tokens-nested.json',
67
- format: 'json',
68
- },
69
- ],
70
- },
71
- // 'js-es6': {
72
- // transformGroup: 'js',
73
- // buildPath: 'dist/js/',
74
- // prefix: 'mds',
75
- // files: [
76
- // {
77
- // format: 'javascript/es6',
78
- // destination: '_variables-es6.js',
79
- // filter: {
80
- // attributes: {
81
- // category: 'color',
82
- // },
83
- // },
84
- // },
85
- // ],
86
- // },
87
- 'js-module': {
88
- transforms: ['attribute/cti', 'name/cti/pascal'],
89
- buildPath: `${path.resolve(__dirname, '../../dist/_tokens/js/')}/`,
90
- prefix: 'mds',
91
- files: [
92
- {
93
- destination: '_tokens-module.js',
94
- format: 'javascript/module',
95
- },
96
- ],
97
- },
98
- // 'js-object': {
99
- // transformGroup: 'js',
100
- // buildPath: 'build/js/',
101
- // files: [
102
- // {
103
- // destination: '_variables-object.js',
104
- // format: 'javascript/object',
105
- // },
106
- // ],
107
- // },
108
-
109
- // android: {
110
- // transformGroup: 'android',
111
- // buildPath: 'build/android/',
112
- // files: [
113
- // {
114
- // destination: 'font_dimens.xml',
115
- // format: 'android/fontDimens',
116
- // },
117
- // {
118
- // destination: 'colors.xml',
119
- // format: 'android/colors',
120
- // filter: {
121
- // attributes: {
122
- // category: 'color',
123
- // },
124
- // },
125
- // },
126
- // ],
127
- // },
128
- // ios: {
129
- // transformGroup: 'ios',
130
- // buildPath: 'build/ios/',
131
- // files: [
132
- // {
133
- // destination: 'StyleDictionaryColor.h',
134
- // format: 'ios/colors.h',
135
- // className: 'StyleDictionaryColor',
136
- // type: 'StyleDictionaryColorName',
137
- // filter: {
138
- // attributes: {
139
- // category: 'color',
140
- // },
141
- // },
142
- // },
143
- // {
144
- // destination: 'StyleDictionaryColor.m',
145
- // format: 'ios/colors.m',
146
- // className: 'StyleDictionaryColor',
147
- // type: 'StyleDictionaryColorName',
148
- // filter: {
149
- // attributes: {
150
- // category: 'color',
151
- // },
152
- // },
153
- // },
154
- // {
155
- // destination: 'StyleDictionarySize.h',
156
- // format: 'ios/static.h',
157
- // className: 'StyleDictionarySize',
158
- // type: 'float',
159
- // filter: {
160
- // attributes: {
161
- // category: 'size',
162
- // },
163
- // },
164
- // },
165
- // {
166
- // destination: 'StyleDictionarySize.m',
167
- // format: 'ios/static.m',
168
- // className: 'StyleDictionarySize',
169
- // type: 'float',
170
- // filter: {
171
- // attributes: {
172
- // category: 'size',
173
- // },
174
- // },
175
- // },
176
- // ],
177
- // },
178
- },
179
- };
180
-
181
- module.exports = config;
@@ -1,65 +0,0 @@
1
- const { TinyColor } = require('@ctrl/tinycolor');
2
-
3
- const TRANSFORM_AMOUNTS = {
4
- LIGHT: 10,
5
- LIGHTEST: 95,
6
- DARK: 10,
7
- DARKEST: 12,
8
- };
9
-
10
- // Replicates Sass lightness($color) function
11
- function lightness(color) {
12
- const { l } = color.toHsl();
13
-
14
- return l * 100;
15
- }
16
-
17
- function createColorsFromBase({ value: baseColor }) {
18
- const asTinyColor = new TinyColor(baseColor);
19
-
20
- return {
21
- light: {
22
- value: asTinyColor.lighten(TRANSFORM_AMOUNTS.LIGHT).toHexString(),
23
- },
24
- lightest: {
25
- value: asTinyColor.lighten(TRANSFORM_AMOUNTS.LIGHTEST - lightness(asTinyColor)).toHexString(),
26
- },
27
- dark: {
28
- value: asTinyColor.darken(TRANSFORM_AMOUNTS.DARK).toHexString(),
29
- },
30
- darkest: {
31
- value: asTinyColor.darken(lightness(asTinyColor) - TRANSFORM_AMOUNTS.DARKEST).toHexString(),
32
- },
33
- };
34
- }
35
-
36
- function transformAllColors(colors) {
37
- return colors.reduce((builtBrand, [name, color]) => {
38
- if (!builtBrand[name]) {
39
- // eslint-disable-next-line no-param-reassign
40
- builtBrand[name] = { ...createColorsFromBase(color.base), ...color };
41
- }
42
-
43
- return builtBrand;
44
- }, {});
45
- }
46
-
47
- function generateBrandAndStatus({ brand, status }) {
48
- if (status) {
49
- return { brand: transformAllColors(Object.entries(brand)), status: transformAllColors(Object.entries(status)) };
50
- }
51
-
52
- return { brand: transformAllColors(Object.entries(brand)) };
53
- }
54
-
55
- function transformTokens(tokensObject) {
56
- return {
57
- ...tokensObject,
58
- color: {
59
- ...tokensObject.color,
60
- ...generateBrandAndStatus(tokensObject.color),
61
- },
62
- };
63
- }
64
-
65
- module.exports = transformTokens;
@@ -1,17 +0,0 @@
1
- function registerTransforms(StyleDictionary) {
2
- return new Promise((resolve) => {
3
- StyleDictionary.registerTransform({
4
- name: 'css/rawData',
5
- type: 'value',
6
- matcher(prop) {
7
- return prop.rawData;
8
- },
9
- transformer(prop) {
10
- return prop.rawData;
11
- },
12
- });
13
- resolve('Transform registered');
14
- });
15
- }
16
-
17
- exports.registerTransforms = registerTransforms;