style-dictionary 4.2.0 → 4.3.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/README.md +8 -5
- package/bin/style-dictionary.d.ts +8 -0
- package/bin/style-dictionary.js +38 -10
- package/examples/advanced/assets-base64-embed/package.json +1 -1
- package/examples/advanced/create-react-app/package.json +1 -1
- package/examples/advanced/create-react-native-app/package.json +1 -1
- package/examples/advanced/create-react-native-app/src/App.js +0 -1
- package/examples/advanced/custom-parser/package.json +1 -1
- package/examples/advanced/custom-parser/sd.config.js +3 -2
- package/examples/advanced/custom-transforms/README.md +1 -1
- package/examples/advanced/custom-transforms/build.js +11 -8
- package/examples/advanced/custom-transforms/package.json +1 -1
- package/examples/advanced/font-face-rules/package.json +1 -1
- package/examples/advanced/font-face-rules/sd.config.js +2 -1
- package/examples/advanced/format-helpers/package.json +1 -1
- package/examples/advanced/format-helpers/sd.config.js +3 -2
- package/examples/advanced/matching-build-files/config.js +15 -10
- package/examples/advanced/matching-build-files/package.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/build.js +10 -7
- package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
- package/examples/advanced/node-modules-as-config-and-properties/config.js +17 -12
- package/examples/advanced/node-modules-as-config-and-properties/package.json +1 -1
- package/examples/advanced/npm-module/package.json +1 -1
- package/examples/advanced/referencing_aliasing/package.json +1 -1
- package/examples/advanced/s3/package.json +1 -1
- package/examples/advanced/tailwind-preset/README.md +94 -0
- package/examples/advanced/tailwind-preset/config/filter.js +3 -0
- package/examples/advanced/tailwind-preset/config/filter.test.js +12 -0
- package/examples/advanced/tailwind-preset/config/format.js +60 -0
- package/examples/advanced/tailwind-preset/config/transform.js +21 -0
- package/examples/advanced/tailwind-preset/config/transform.test.js +37 -0
- package/examples/advanced/tailwind-preset/config.js +55 -0
- package/examples/advanced/tailwind-preset/demo/index.html +27 -0
- package/examples/advanced/tailwind-preset/demo/input.css +3 -0
- package/examples/advanced/tailwind-preset/package.json +18 -0
- package/examples/advanced/tailwind-preset/tailwind.config.js +11 -0
- package/examples/advanced/tailwind-preset/tokens/tokens.json +49 -0
- package/examples/advanced/tokens-deprecation/build.js +2 -1
- package/examples/advanced/tokens-deprecation/package.json +1 -1
- package/examples/advanced/transitive-transforms/package.json +1 -1
- package/examples/advanced/transitive-transforms/sd.config.js +12 -9
- package/examples/advanced/variables-in-outputs/package.json +1 -1
- package/examples/advanced/variables-in-outputs/sd.config.js +10 -5
- package/examples/advanced/yaml-tokens/package.json +1 -1
- package/examples/advanced/yaml-tokens/sd.config.js +3 -2
- package/lib/Register.d.ts +2 -2
- package/lib/Register.js +6 -3
- package/lib/StyleDictionary.d.ts +20 -18
- package/lib/StyleDictionary.js +89 -71
- package/lib/cleanActions.d.ts +1 -1
- package/lib/cleanDir.d.ts +1 -1
- package/lib/cleanDir.js +2 -1
- package/lib/cleanDirs.d.ts +1 -1
- package/lib/cleanFile.d.ts +1 -6
- package/lib/cleanFile.js +5 -2
- package/lib/cleanFiles.d.ts +1 -1
- package/lib/common/actions.d.ts +20 -1
- package/lib/common/actions.js +8 -4
- package/lib/common/filters.d.ts +7 -1
- package/lib/common/formatHelpers/createPropertyFormatter.d.ts +3 -1
- package/lib/common/formatHelpers/createPropertyFormatter.js +26 -19
- package/lib/common/formatHelpers/fileHeader.d.ts +1 -1
- package/lib/common/formatHelpers/fileHeader.js +4 -2
- package/lib/common/formatHelpers/formattedVariables.d.ts +3 -1
- package/lib/common/formatHelpers/formattedVariables.js +3 -1
- package/lib/common/formatHelpers/getTypeScriptType.d.ts +2 -2
- package/lib/common/formatHelpers/minifyDictionary.d.ts +1 -1
- package/lib/common/formatHelpers/setComposeObjectProperties.d.ts +1 -1
- package/lib/common/formatHelpers/setSwiftFileProperties.d.ts +1 -1
- package/lib/common/formatHelpers/sortByReference.d.ts +1 -1
- package/lib/common/formats.js +235 -162
- package/lib/common/templates/compose/object.kt.template.js +8 -4
- package/lib/common/templates/css/fonts.css.template.js +2 -2
- package/lib/common/templates/scss/map-flat.template.js +4 -3
- package/lib/common/transformGroups.d.ts +209 -1
- package/lib/common/transformGroups.js +139 -93
- package/lib/common/transforms.d.ts +961 -1
- package/lib/common/transforms.js +113 -111
- package/lib/enums/actions.d.ts +4 -0
- package/lib/enums/actions.js +4 -0
- package/lib/enums/commentPositions.d.ts +4 -0
- package/lib/enums/commentPositions.js +4 -0
- package/lib/enums/commentStyles.d.ts +5 -0
- package/lib/enums/commentStyles.js +5 -0
- package/lib/enums/fileHeaderCommentStyles.d.ts +5 -0
- package/lib/enums/fileHeaderCommentStyles.js +5 -0
- package/lib/enums/formats.d.ts +46 -0
- package/lib/enums/formats.js +50 -0
- package/lib/enums/index.d.ts +12 -0
- package/lib/enums/index.js +12 -0
- package/lib/enums/logBrokenReferenceLevels.d.ts +5 -0
- package/lib/enums/logBrokenReferenceLevels.js +4 -0
- package/lib/enums/logVerbosityLevels.d.ts +6 -0
- package/lib/enums/logVerbosityLevels.js +5 -0
- package/lib/enums/logWarningLevels.d.ts +5 -0
- package/lib/enums/logWarningLevels.js +5 -0
- package/lib/enums/propertyFormatNames.d.ts +6 -0
- package/lib/enums/propertyFormatNames.js +6 -0
- package/lib/enums/transformGroups.d.ts +17 -0
- package/lib/enums/transformGroups.js +17 -0
- package/lib/enums/transformTypes.d.ts +5 -0
- package/lib/enums/transformTypes.js +5 -0
- package/lib/enums/transforms.d.ts +57 -0
- package/lib/enums/transforms.js +57 -0
- package/lib/filterTokens.d.ts +1 -1
- package/lib/filterTokens.js +5 -0
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +1 -1
- package/lib/performActions.d.ts +1 -1
- package/lib/resolve.d.ts +1 -1
- package/lib/resolve.js +4 -3
- package/lib/transform/config.js +3 -2
- package/lib/transform/object.d.ts +1 -1
- package/lib/transform/token.d.ts +1 -9
- package/lib/transform/token.js +10 -3
- package/lib/utils/cleanActions.d.ts +1 -1
- package/lib/utils/combineJSON.d.ts +1 -1
- package/lib/utils/combineJSON.js +12 -32
- package/lib/utils/convertToBase64.d.ts +1 -1
- package/lib/utils/convertToDTCG.d.ts +3 -3
- package/lib/utils/convertTokenData.d.ts +30 -0
- package/lib/utils/convertTokenData.js +123 -0
- package/lib/utils/deepExtend.d.ts +1 -1
- package/lib/utils/deepmerge.d.ts +1 -1
- package/lib/utils/expandObjectTokens.d.ts +2 -2
- package/lib/utils/expandObjectTokens.js +1 -1
- package/lib/utils/flattenTokens.d.ts +9 -5
- package/lib/utils/flattenTokens.js +28 -16
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +3 -0
- package/lib/utils/loadFile.d.ts +13 -0
- package/lib/utils/loadFile.js +89 -0
- package/lib/utils/preprocess.d.ts +1 -1
- package/lib/utils/references/defaults.d.ts +5 -1
- package/lib/utils/references/getName.d.ts +1 -1
- package/lib/utils/references/getReferences.d.ts +1 -1
- package/lib/utils/references/outputReferencesTransformed.js +1 -1
- package/lib/utils/references/resolveReferences.d.ts +2 -2
- package/lib/utils/references/usesReferences.d.ts +1 -1
- package/package.json +27 -16
- package/types/Config.d.ts +9 -3
- package/types/DesignToken.d.ts +6 -0
- package/types/File.d.ts +6 -2
- package/types/Format.d.ts +4 -1
- package/types/Transform.d.ts +4 -3
|
@@ -4,9 +4,969 @@
|
|
|
4
4
|
* @returns {boolean}
|
|
5
5
|
*/
|
|
6
6
|
export function isColor(token: Token, options: Config): boolean;
|
|
7
|
-
declare const _default:
|
|
7
|
+
declare const _default: {
|
|
8
|
+
/**
|
|
9
|
+
* Adds: category, type, item, subitem, and state on the attributes object based on the location in the style dictionary.
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* // Matches: all
|
|
13
|
+
* // Returns:
|
|
14
|
+
* {
|
|
15
|
+
* "category": "color",
|
|
16
|
+
* "type": "background",
|
|
17
|
+
* "item": "button",
|
|
18
|
+
* "subitem": "primary",
|
|
19
|
+
* "state": "active"
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @memberof Transforms
|
|
24
|
+
*/
|
|
25
|
+
"attribute/cti": {
|
|
26
|
+
type: "attribute";
|
|
27
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken) => Record<string, string> & Record<string, unknown>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Adds: hex, hsl, hsv, rgb, red, blue, green.
|
|
31
|
+
*
|
|
32
|
+
* ```js
|
|
33
|
+
* // Matches: token.type === 'color'
|
|
34
|
+
* // Returns
|
|
35
|
+
* {
|
|
36
|
+
* "hex": "009688",
|
|
37
|
+
* "rgb": {"r": 0, "g": 150, "b": 136, "a": 1},
|
|
38
|
+
* "hsl": {"h": 174.4, "s": 1, "l": 0.294, "a": 1},
|
|
39
|
+
* "hsv": {"h": 174.4, "s": 1, "l": 0.588, "a": 1},
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @memberof Transforms
|
|
44
|
+
*/
|
|
45
|
+
"attribute/color": {
|
|
46
|
+
type: "attribute";
|
|
47
|
+
filter: typeof isColor;
|
|
48
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => {
|
|
49
|
+
hex: string;
|
|
50
|
+
rgb: Color.ColorFormats.RGBA;
|
|
51
|
+
hsl: Color.ColorFormats.HSLA;
|
|
52
|
+
hsv: Color.ColorFormats.HSVA;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates a human-friendly name
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* // Matches: All
|
|
60
|
+
* // Returns:
|
|
61
|
+
* "button primary"
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @memberof Transforms
|
|
65
|
+
*/
|
|
66
|
+
"name/human": {
|
|
67
|
+
type: "name";
|
|
68
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken) => string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Creates a camel case name. If you define a prefix on the platform in your config, it will prepend with your prefix
|
|
72
|
+
*
|
|
73
|
+
* ```js
|
|
74
|
+
* // Matches: all
|
|
75
|
+
* // Returns:
|
|
76
|
+
* "colorBackgroundButtonPrimaryActive"
|
|
77
|
+
* "prefixColorBackgroundButtonPrimaryActive"
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @memberof Transforms
|
|
81
|
+
*/
|
|
82
|
+
"name/camel": {
|
|
83
|
+
type: "name";
|
|
84
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig) => string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Creates a kebab case name. If you define a prefix on the platform in your config, it will prepend with your prefix
|
|
88
|
+
*
|
|
89
|
+
* ```js
|
|
90
|
+
* // Matches: all
|
|
91
|
+
* // Returns:
|
|
92
|
+
* "color-background-button-primary-active"
|
|
93
|
+
* "prefix-color-background-button-primary-active"
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @memberof Transforms
|
|
97
|
+
*/
|
|
98
|
+
"name/kebab": {
|
|
99
|
+
type: "name";
|
|
100
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig) => string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Creates a snake case name. If you define a prefix on the platform in your config, it will prepend with your prefix
|
|
104
|
+
*
|
|
105
|
+
* ```js
|
|
106
|
+
* // Matches: all
|
|
107
|
+
* // Returns:
|
|
108
|
+
* "color_background_button_primary_active"
|
|
109
|
+
* "prefix_color_background_button_primary_active"
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @memberof Transforms
|
|
113
|
+
*/
|
|
114
|
+
"name/snake": {
|
|
115
|
+
type: "name";
|
|
116
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig) => string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Creates a constant-style name based on the full CTI of the token. If you define a prefix on the platform in your config, it will prepend with your prefix
|
|
120
|
+
*
|
|
121
|
+
* ```js
|
|
122
|
+
* // Matches: all
|
|
123
|
+
* // Returns:
|
|
124
|
+
* "COLOR_BACKGROUND_BUTTON_PRIMARY_ACTIVE"
|
|
125
|
+
* "PREFIX_COLOR_BACKGROUND_BUTTON_PRIMARY_ACTIVE"
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @memberof Transforms
|
|
129
|
+
*/
|
|
130
|
+
"name/constant": {
|
|
131
|
+
type: "name";
|
|
132
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig) => string;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Creates a Pascal case name. If you define a prefix on the platform in your config, it will prepend with your prefix
|
|
136
|
+
*
|
|
137
|
+
* ```js
|
|
138
|
+
* // Matches: all
|
|
139
|
+
* // Returns:
|
|
140
|
+
* "ColorBackgroundButtonPrimaryActive"
|
|
141
|
+
* "PrefixColorBackgroundButtonPrimaryActive"
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @memberof Transforms
|
|
145
|
+
*/
|
|
146
|
+
"name/pascal": {
|
|
147
|
+
type: "name";
|
|
148
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig) => string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Transforms the value into an RGB string
|
|
152
|
+
*
|
|
153
|
+
* ```js
|
|
154
|
+
* // Matches: token.type === 'color'
|
|
155
|
+
* // Returns:
|
|
156
|
+
* "rgb(0, 150, 136)"
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @memberof Transforms
|
|
160
|
+
*/
|
|
161
|
+
"color/rgb": {
|
|
162
|
+
type: "value";
|
|
163
|
+
filter: typeof isColor;
|
|
164
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Transforms the value into an HSL string or HSLA if alpha is present. Better browser support than color/hsl-4
|
|
168
|
+
*
|
|
169
|
+
* ```js
|
|
170
|
+
* // Matches: token.type === 'color'
|
|
171
|
+
* // Returns:
|
|
172
|
+
* "hsl(174, 100%, 29%)"
|
|
173
|
+
* "hsl(174, 100%, 29%, .5)"
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @memberof Transforms
|
|
177
|
+
*/
|
|
178
|
+
"color/hsl": {
|
|
179
|
+
type: "value";
|
|
180
|
+
filter: typeof isColor;
|
|
181
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Transforms the value into an HSL string, using fourth argument if alpha is present.
|
|
185
|
+
*
|
|
186
|
+
* ```js
|
|
187
|
+
* // Matches: token.type === 'color'
|
|
188
|
+
* // Returns:
|
|
189
|
+
* "hsl(174 100% 29%)"
|
|
190
|
+
* "hsl(174 100% 29% / .5)"
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @memberof Transforms
|
|
194
|
+
*/
|
|
195
|
+
"color/hsl-4": {
|
|
196
|
+
type: "value";
|
|
197
|
+
filter: typeof isColor;
|
|
198
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Transforms the value into an 6-digit hex string
|
|
202
|
+
*
|
|
203
|
+
* ```js
|
|
204
|
+
* // Matches: token.type === 'color'
|
|
205
|
+
* // Returns:
|
|
206
|
+
* "#009688"
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @memberof Transforms
|
|
210
|
+
*/
|
|
211
|
+
"color/hex": {
|
|
212
|
+
type: "value";
|
|
213
|
+
filter: typeof isColor;
|
|
214
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Transforms the value into an 8-digit hex string
|
|
218
|
+
*
|
|
219
|
+
* ```js
|
|
220
|
+
* // Matches: token.type === 'color'
|
|
221
|
+
* // Returns:
|
|
222
|
+
* "#009688ff"
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @memberof Transforms
|
|
226
|
+
*/
|
|
227
|
+
"color/hex8": {
|
|
228
|
+
type: "value";
|
|
229
|
+
filter: typeof isColor;
|
|
230
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Transforms the value into an 8-digit hex string for Android because they put the alpha channel first
|
|
234
|
+
*
|
|
235
|
+
* ```js
|
|
236
|
+
* // Matches: token.type === 'color'
|
|
237
|
+
* // Returns:
|
|
238
|
+
* "#ff009688"
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
* @memberof Transforms
|
|
242
|
+
*/
|
|
243
|
+
"color/hex8android": {
|
|
244
|
+
type: "value";
|
|
245
|
+
filter: typeof isColor;
|
|
246
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Transforms the value into a Color class for Compose
|
|
250
|
+
*
|
|
251
|
+
* ```kotlin
|
|
252
|
+
* // Matches: token.type === 'color'
|
|
253
|
+
* // Returns:
|
|
254
|
+
* Color(0xFF009688)
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* @memberof Transforms
|
|
258
|
+
*/
|
|
259
|
+
"color/composeColor": {
|
|
260
|
+
type: "value";
|
|
261
|
+
filter: typeof isColor;
|
|
262
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Transforms the value into an UIColor class for iOS
|
|
266
|
+
*
|
|
267
|
+
* ```objective-c
|
|
268
|
+
* // Matches: token.type === 'color'
|
|
269
|
+
* // Returns:
|
|
270
|
+
* [UIColor colorWithRed:0.114f green:0.114f blue:0.114f alpha:1.000f]
|
|
271
|
+
* ```
|
|
272
|
+
*
|
|
273
|
+
* @memberof Transforms
|
|
274
|
+
*/
|
|
275
|
+
"color/UIColor": {
|
|
276
|
+
type: "value";
|
|
277
|
+
filter: typeof isColor;
|
|
278
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Transforms the value into an UIColor swift class for iOS
|
|
282
|
+
*
|
|
283
|
+
* ```swift
|
|
284
|
+
* // Matches: token.type === 'color'
|
|
285
|
+
* // Returns:
|
|
286
|
+
* UIColor(red: 0.667, green: 0.667, blue: 0.667, alpha: 0.6)
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* @memberof Transforms
|
|
290
|
+
*/
|
|
291
|
+
"color/UIColorSwift": {
|
|
292
|
+
type: "value";
|
|
293
|
+
filter: typeof isColor;
|
|
294
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Transforms the value into an UIColor swift class for iOS
|
|
298
|
+
*
|
|
299
|
+
* ```swift
|
|
300
|
+
* // Matches: token.type === 'color'
|
|
301
|
+
* // Returns:
|
|
302
|
+
* Color(red: 0.667, green: 0.667, blue: 0.667, opacity: 0.6)
|
|
303
|
+
* ```
|
|
304
|
+
*
|
|
305
|
+
* @memberof Transforms
|
|
306
|
+
*/
|
|
307
|
+
"color/ColorSwiftUI": {
|
|
308
|
+
type: "value";
|
|
309
|
+
filter: typeof isColor;
|
|
310
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Transforms the value into a hex or rgb string depending on if it has transparency
|
|
314
|
+
*
|
|
315
|
+
* ```css
|
|
316
|
+
* // Matches: token.type === 'color'
|
|
317
|
+
* // Returns:
|
|
318
|
+
* #000000
|
|
319
|
+
* rgba(0,0,0,0.5)
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @memberof Transforms
|
|
323
|
+
*/
|
|
324
|
+
"color/css": {
|
|
325
|
+
type: "value";
|
|
326
|
+
filter: typeof isColor;
|
|
327
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
*
|
|
331
|
+
* Transforms a color into an object with red, green, blue, and alpha
|
|
332
|
+
* attributes that are floats from 0 - 1. This object is how Sketch stores
|
|
333
|
+
* colors.
|
|
334
|
+
*
|
|
335
|
+
* ```js
|
|
336
|
+
* // Matches: token.type === 'color'
|
|
337
|
+
* // Returns:
|
|
338
|
+
* {
|
|
339
|
+
* red: 0.5,
|
|
340
|
+
* green: 0.5,
|
|
341
|
+
* blue: 0.5,
|
|
342
|
+
* alpha: 1
|
|
343
|
+
* }
|
|
344
|
+
* ```
|
|
345
|
+
* @memberof Transforms
|
|
346
|
+
*/
|
|
347
|
+
"color/sketch": {
|
|
348
|
+
type: "value";
|
|
349
|
+
filter: typeof isColor;
|
|
350
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => {
|
|
351
|
+
red: string;
|
|
352
|
+
green: string;
|
|
353
|
+
blue: string;
|
|
354
|
+
alpha: number;
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* Transforms the value into a scale-independent pixel (sp) value for font sizes on Android. It will not scale the number.
|
|
359
|
+
*
|
|
360
|
+
* ```js
|
|
361
|
+
* // Matches: token.type === 'fontSize'
|
|
362
|
+
* // Returns:
|
|
363
|
+
* "10.0sp"
|
|
364
|
+
* ```
|
|
365
|
+
*
|
|
366
|
+
* @memberof Transforms
|
|
367
|
+
*/
|
|
368
|
+
"size/sp": {
|
|
369
|
+
type: "value";
|
|
370
|
+
filter: typeof isFontSize;
|
|
371
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Transforms the value into a density-independent pixel (dp) value for non-font sizes on Android. It will not scale the number.
|
|
375
|
+
*
|
|
376
|
+
* ```js
|
|
377
|
+
* // Matches: token.type === 'dimension'
|
|
378
|
+
* // Returns:
|
|
379
|
+
* "10.0dp"
|
|
380
|
+
* ```
|
|
381
|
+
*
|
|
382
|
+
* @memberof Transforms
|
|
383
|
+
*/
|
|
384
|
+
"size/dp": {
|
|
385
|
+
type: "value";
|
|
386
|
+
filter: typeof isDimension;
|
|
387
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Transforms the value into a useful object ( for React Native support )
|
|
391
|
+
*
|
|
392
|
+
* ```js
|
|
393
|
+
* // Matches: token.type === 'dimension'
|
|
394
|
+
* // Returns:
|
|
395
|
+
* {
|
|
396
|
+
* original: "10px",
|
|
397
|
+
* number: 10,
|
|
398
|
+
* decimal: 0.1, // 10 divided by 100
|
|
399
|
+
* scale: 160, // 10 times 16
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* @memberof Transforms
|
|
404
|
+
*/
|
|
405
|
+
"size/object": {
|
|
406
|
+
type: "value";
|
|
407
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
408
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => {
|
|
409
|
+
original: any;
|
|
410
|
+
number: number;
|
|
411
|
+
decimal: number;
|
|
412
|
+
scale: number;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* Transforms the value from a REM size on web into a scale-independent pixel (sp) value for font sizes on Android. It WILL scale the number by a factor of 16 (or the value of 'basePxFontSize' on the platform in your config).
|
|
417
|
+
*
|
|
418
|
+
* ```js
|
|
419
|
+
* // Matches: token.type === 'fontSize'
|
|
420
|
+
* // Returns:
|
|
421
|
+
* "16.0sp"
|
|
422
|
+
* ```
|
|
423
|
+
*
|
|
424
|
+
* @memberof Transforms
|
|
425
|
+
*/
|
|
426
|
+
"size/remToSp": {
|
|
427
|
+
type: "value";
|
|
428
|
+
filter: typeof isFontSize;
|
|
429
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* Transforms the value from a REM size on web into a density-independent pixel (dp) value for non font-sizes on Android. It WILL scale the number by a factor of 16 (or the value of 'basePxFontSize' on the platform in your config).
|
|
433
|
+
*
|
|
434
|
+
* ```js
|
|
435
|
+
* // Matches: token.type === 'dimension'
|
|
436
|
+
* // Returns:
|
|
437
|
+
* "16.0dp"
|
|
438
|
+
* ```
|
|
439
|
+
*
|
|
440
|
+
* @memberof Transforms
|
|
441
|
+
*/
|
|
442
|
+
"size/remToDp": {
|
|
443
|
+
type: "value";
|
|
444
|
+
filter: typeof isDimension;
|
|
445
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* Adds 'px' to the end of the number. Does not scale the number
|
|
449
|
+
*
|
|
450
|
+
* ```js
|
|
451
|
+
* // Matches: token.type === 'dimension'
|
|
452
|
+
* // Returns:
|
|
453
|
+
* "10px"
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* @memberof Transforms
|
|
457
|
+
*/
|
|
458
|
+
"size/px": {
|
|
459
|
+
type: "value";
|
|
460
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
461
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Adds 'rem' to the end of the number. Does not scale the number
|
|
465
|
+
*
|
|
466
|
+
* ```js
|
|
467
|
+
* // Matches: token.type === 'dimension'
|
|
468
|
+
* // Returns:
|
|
469
|
+
* "10rem"
|
|
470
|
+
* ```
|
|
471
|
+
*
|
|
472
|
+
* @memberof Transforms
|
|
473
|
+
*/
|
|
474
|
+
"size/rem": {
|
|
475
|
+
type: "value";
|
|
476
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
477
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
478
|
+
};
|
|
479
|
+
/**
|
|
480
|
+
* Scales the number by 16 (or the value of 'basePxFontSize' on the platform in your config) and adds 'pt' to the end.
|
|
481
|
+
*
|
|
482
|
+
* ```js
|
|
483
|
+
* // Matches: token.type === 'dimension'
|
|
484
|
+
* // Returns:
|
|
485
|
+
* "16pt"
|
|
486
|
+
* ```
|
|
487
|
+
*
|
|
488
|
+
* @memberof Transforms
|
|
489
|
+
*/
|
|
490
|
+
"size/remToPt": {
|
|
491
|
+
type: "value";
|
|
492
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
493
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Transforms the value from a REM size on web into a scale-independent pixel (sp) value for font sizes in Compose. It WILL scale the number by a factor of 16 (or the value of 'basePxFontSize' on the platform in your config).
|
|
497
|
+
*
|
|
498
|
+
* ```kotlin
|
|
499
|
+
* // Matches: token.type === 'fontSize'
|
|
500
|
+
* // Returns:
|
|
501
|
+
* "16.0.sp"
|
|
502
|
+
* ```
|
|
503
|
+
*
|
|
504
|
+
* @memberof Transforms
|
|
505
|
+
*/
|
|
506
|
+
"size/compose/remToSp": {
|
|
507
|
+
type: "value";
|
|
508
|
+
filter: typeof isFontSize;
|
|
509
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
510
|
+
};
|
|
511
|
+
/**
|
|
512
|
+
* Transforms the value from a REM size on web into a density-independent pixel (dp) value for font sizes in Compose. It WILL scale the number by a factor of 16 (or the value of 'basePxFontSize' on the platform in your config).
|
|
513
|
+
*
|
|
514
|
+
* ```kotlin
|
|
515
|
+
* // Matches: token.type === 'dimension'
|
|
516
|
+
* // Returns:
|
|
517
|
+
* "16.0.dp"
|
|
518
|
+
* ```
|
|
519
|
+
*
|
|
520
|
+
* @memberof Transforms
|
|
521
|
+
*/
|
|
522
|
+
"size/compose/remToDp": {
|
|
523
|
+
type: "value";
|
|
524
|
+
filter: typeof isDimension;
|
|
525
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Adds the .em Compose extension to the end of a number. Does not scale the value
|
|
529
|
+
*
|
|
530
|
+
* ```kotlin
|
|
531
|
+
* // Matches: token.type === 'fontSize'
|
|
532
|
+
* // Returns:
|
|
533
|
+
* "16.0em"
|
|
534
|
+
* ```
|
|
535
|
+
*
|
|
536
|
+
* @memberof Transforms
|
|
537
|
+
*/
|
|
538
|
+
"size/compose/em": {
|
|
539
|
+
type: "value";
|
|
540
|
+
filter: typeof isFontSize;
|
|
541
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
542
|
+
};
|
|
543
|
+
/**
|
|
544
|
+
* Scales the number by 16 (or the value of 'basePxFontSize' on the platform in your config) to get to points for Swift and initializes a CGFloat
|
|
545
|
+
*
|
|
546
|
+
* ```js
|
|
547
|
+
* // Matches: token.type === 'dimension'
|
|
548
|
+
* // Returns: "CGFloat(16.00)""
|
|
549
|
+
* ```
|
|
550
|
+
*
|
|
551
|
+
* @memberof Transforms
|
|
552
|
+
*/
|
|
553
|
+
"size/swift/remToCGFloat": {
|
|
554
|
+
type: "value";
|
|
555
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
556
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* Scales the number by 16 (or the value of 'basePxFontSize' on the platform in your config) and adds 'px' to the end.
|
|
560
|
+
*
|
|
561
|
+
* ```js
|
|
562
|
+
* // Matches: token.type === 'dimension'
|
|
563
|
+
* // Returns:
|
|
564
|
+
* "16px"
|
|
565
|
+
* ```
|
|
566
|
+
*
|
|
567
|
+
* @memberof Transforms
|
|
568
|
+
*/
|
|
569
|
+
"size/remToPx": {
|
|
570
|
+
type: "value";
|
|
571
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
572
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
573
|
+
};
|
|
574
|
+
/**
|
|
575
|
+
* Scales non-zero numbers to rem, and adds 'rem' to the end. If you define a "basePxFontSize" on the platform in your config, it will be used to scale the value, otherwise 16 (default web font size) will be used.
|
|
576
|
+
*
|
|
577
|
+
* ```js
|
|
578
|
+
* // Matches: token.type === 'dimension'
|
|
579
|
+
* // Returns:
|
|
580
|
+
* "0"
|
|
581
|
+
* "1rem"
|
|
582
|
+
* ```
|
|
583
|
+
*
|
|
584
|
+
* @memberof Transforms
|
|
585
|
+
*/
|
|
586
|
+
"size/pxToRem": {
|
|
587
|
+
type: "value";
|
|
588
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
589
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
590
|
+
};
|
|
591
|
+
/**
|
|
592
|
+
* Takes a unicode point and transforms it into a form CSS can use.
|
|
593
|
+
*
|
|
594
|
+
* ```js
|
|
595
|
+
* // Matches: token.type === 'html'
|
|
596
|
+
* // Returns:
|
|
597
|
+
* "'\\E001'"
|
|
598
|
+
* ```
|
|
599
|
+
*
|
|
600
|
+
* @memberof Transforms
|
|
601
|
+
*/
|
|
602
|
+
"html/icon": {
|
|
603
|
+
type: "value";
|
|
604
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
605
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
606
|
+
};
|
|
607
|
+
/**
|
|
608
|
+
* Wraps the value in a single quoted string
|
|
609
|
+
*
|
|
610
|
+
* ```js
|
|
611
|
+
* // Matches: token.type === 'content'
|
|
612
|
+
* // Returns:
|
|
613
|
+
* "'string'"
|
|
614
|
+
* ```
|
|
615
|
+
*
|
|
616
|
+
* @memberof Transforms
|
|
617
|
+
*/
|
|
618
|
+
"content/quote": {
|
|
619
|
+
type: "value";
|
|
620
|
+
filter: typeof isContent;
|
|
621
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* Wraps the value in a double-quoted string and prepends an '@' to make a string literal.
|
|
625
|
+
*
|
|
626
|
+
* ```objective-c
|
|
627
|
+
* // Matches: token.type === 'content'
|
|
628
|
+
* // Returns:
|
|
629
|
+
* \@"string"
|
|
630
|
+
* ```
|
|
631
|
+
*
|
|
632
|
+
* @memberof Transforms
|
|
633
|
+
*/
|
|
634
|
+
"content/objC/literal": {
|
|
635
|
+
type: "value";
|
|
636
|
+
filter: typeof isContent;
|
|
637
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
638
|
+
};
|
|
639
|
+
/**
|
|
640
|
+
* Wraps the value in a double-quoted string to make a string literal.
|
|
641
|
+
*
|
|
642
|
+
* ```swift
|
|
643
|
+
* // Matches: token.type === 'content'
|
|
644
|
+
* // Returns:
|
|
645
|
+
* "string"
|
|
646
|
+
* ```
|
|
647
|
+
*
|
|
648
|
+
* @memberof Transforms
|
|
649
|
+
*/
|
|
650
|
+
"content/swift/literal": {
|
|
651
|
+
type: "value";
|
|
652
|
+
filter: typeof isContent;
|
|
653
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
654
|
+
};
|
|
655
|
+
/**
|
|
656
|
+
* Assumes a time in miliseconds and transforms it into a decimal
|
|
657
|
+
*
|
|
658
|
+
* ```js
|
|
659
|
+
* // Matches: token.type === 'time'
|
|
660
|
+
* // Returns:
|
|
661
|
+
* "0.5s"
|
|
662
|
+
* ```
|
|
663
|
+
*
|
|
664
|
+
* @memberof Transforms
|
|
665
|
+
*/
|
|
666
|
+
"time/seconds": {
|
|
667
|
+
type: "value";
|
|
668
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
669
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Turns fontFamily tokens into valid CSS string values
|
|
673
|
+
* https://design-tokens.github.io/community-group/format/#font-family
|
|
674
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
|
|
675
|
+
*
|
|
676
|
+
* ```js
|
|
677
|
+
* // Matches: token.type === 'fontFamily'
|
|
678
|
+
* // Returns:
|
|
679
|
+
* "'Arial Narrow', Arial, sans-serif"
|
|
680
|
+
* ```.
|
|
681
|
+
*
|
|
682
|
+
* @memberof Transforms
|
|
683
|
+
*/
|
|
684
|
+
"fontFamily/css": {
|
|
685
|
+
type: "value";
|
|
686
|
+
transitive: true;
|
|
687
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
688
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Turns fontFamily tokens into valid CSS string values
|
|
692
|
+
* https://design-tokens.github.io/community-group/format/#font-family
|
|
693
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
|
|
694
|
+
*
|
|
695
|
+
* ```js
|
|
696
|
+
* // Matches: token.type === 'fontFamily'
|
|
697
|
+
* // Returns:
|
|
698
|
+
* "'Arial Narrow', Arial, sans-serif"
|
|
699
|
+
* ```.
|
|
700
|
+
*
|
|
701
|
+
* @memberof Transforms
|
|
702
|
+
*/
|
|
703
|
+
"cubicBezier/css": {
|
|
704
|
+
type: "value";
|
|
705
|
+
transitive: true;
|
|
706
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
707
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* Turns strokeStyle object-value tokens into stringified CSS fallback
|
|
711
|
+
* https://design-tokens.github.io/community-group/format/#stroke-style
|
|
712
|
+
* https://design-tokens.github.io/community-group/format/#example-fallback-for-object-stroke-style
|
|
713
|
+
* CSS does not allow detailed control of the dash pattern or line caps on dashed borders, so we use dashed fallback
|
|
714
|
+
* ```js
|
|
715
|
+
* // Matches: token.type === 'border'
|
|
716
|
+
* // Returns:
|
|
717
|
+
* "dashed"
|
|
718
|
+
* ```.
|
|
719
|
+
*
|
|
720
|
+
* @memberof Transforms
|
|
721
|
+
*/
|
|
722
|
+
"strokeStyle/css/shorthand": {
|
|
723
|
+
type: "value";
|
|
724
|
+
transitive: true;
|
|
725
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
726
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
727
|
+
};
|
|
728
|
+
/**
|
|
729
|
+
* Turns border tokens object-value into stringified CSS shorthand
|
|
730
|
+
* https://design-tokens.github.io/community-group/format/#border
|
|
731
|
+
*
|
|
732
|
+
* ```js
|
|
733
|
+
* // Matches: token.type === 'border'
|
|
734
|
+
* // Returns:
|
|
735
|
+
* "2px solid #000000"
|
|
736
|
+
* ```.
|
|
737
|
+
*
|
|
738
|
+
* @memberof Transforms
|
|
739
|
+
*/
|
|
740
|
+
"border/css/shorthand": {
|
|
741
|
+
type: "value";
|
|
742
|
+
transitive: true;
|
|
743
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
744
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* Turns typography tokens object-value into stringified CSS shorthand
|
|
748
|
+
* https://design-tokens.github.io/community-group/format/#typography
|
|
749
|
+
*
|
|
750
|
+
* Available props within typography has been extended here
|
|
751
|
+
* to include those available in CSS font shorthand:
|
|
752
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/font
|
|
753
|
+
*
|
|
754
|
+
* ```js
|
|
755
|
+
* // Matches: token.type === 'typography'
|
|
756
|
+
* // Returns:
|
|
757
|
+
* "500 20px/1.5 Arial"
|
|
758
|
+
* ```.
|
|
759
|
+
*
|
|
760
|
+
* @memberof Transforms
|
|
761
|
+
*/
|
|
762
|
+
"typography/css/shorthand": {
|
|
763
|
+
type: "value";
|
|
764
|
+
transitive: true;
|
|
765
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
766
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, platform: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* Turns transition tokens object-value into stringified CSS shorthand
|
|
770
|
+
* https://design-tokens.github.io/community-group/format/#border
|
|
771
|
+
*
|
|
772
|
+
* ```js
|
|
773
|
+
* // Matches: token.type === 'transition'
|
|
774
|
+
* // Returns:
|
|
775
|
+
* "200ms linear 50ms"
|
|
776
|
+
* ```.
|
|
777
|
+
*
|
|
778
|
+
* @memberof Transforms
|
|
779
|
+
*/
|
|
780
|
+
"transition/css/shorthand": {
|
|
781
|
+
type: "value";
|
|
782
|
+
transitive: true;
|
|
783
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
784
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
785
|
+
};
|
|
786
|
+
/**
|
|
787
|
+
* Turns shadow tokens object-value into stringified CSS shorthand
|
|
788
|
+
* https://design-tokens.github.io/community-group/format/#shadow
|
|
789
|
+
*
|
|
790
|
+
* ```js
|
|
791
|
+
* // Matches: token.type === 'shadow'
|
|
792
|
+
* // Returns:
|
|
793
|
+
* "inset 2px 4px 10px 5px #000000"
|
|
794
|
+
* ```.
|
|
795
|
+
*
|
|
796
|
+
* @memberof Transforms
|
|
797
|
+
*/
|
|
798
|
+
"shadow/css/shorthand": {
|
|
799
|
+
type: "value";
|
|
800
|
+
transitive: true;
|
|
801
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
802
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => any;
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* Wraps the value in a CSS url() function https://developer.mozilla.org/en-US/docs/Web/CSS/url
|
|
806
|
+
*
|
|
807
|
+
* ```js
|
|
808
|
+
* // Matches: token.type === 'asset'
|
|
809
|
+
* // Returns:
|
|
810
|
+
* url("https://www.example.com/style.css")
|
|
811
|
+
* ```
|
|
812
|
+
*
|
|
813
|
+
* @memberof Transforms
|
|
814
|
+
*/
|
|
815
|
+
"asset/url": {
|
|
816
|
+
type: "value";
|
|
817
|
+
filter: typeof isAsset;
|
|
818
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
819
|
+
};
|
|
820
|
+
/**
|
|
821
|
+
* Wraps the value in a double-quoted string and prepends an '@' to make a string literal.
|
|
822
|
+
*
|
|
823
|
+
* ```js
|
|
824
|
+
* // Matches: token.type === 'asset'
|
|
825
|
+
* // Returns:
|
|
826
|
+
* 'IyBlZGl0b3Jjb25maWcub3JnCnJvb3QgPSB0cnVlCgpbKl0KaW5kZW50X3N0eWxlID0gc3BhY2UKaW5kZW50X3NpemUgPSAyCmVuZF9vZl9saW5lID0gbGYKY2hhcnNldCA9IHV0Zi04CnRyaW1fdHJhaWxpbmdfd2hpdGVzcGFjZSA9IHRydWUKaW5zZXJ0X2ZpbmFsX25ld2xpbmUgPSB0cnVlCgpbKi5tZF0KdHJpbV90cmFpbGluZ193aGl0ZXNwYWNlID0gZmFsc2U='
|
|
827
|
+
* ```
|
|
828
|
+
*
|
|
829
|
+
* @memberof Transforms
|
|
830
|
+
*/
|
|
831
|
+
"asset/base64": {
|
|
832
|
+
type: "value";
|
|
833
|
+
filter: typeof isAsset;
|
|
834
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config, vol: import("../../types/Volume.js").Volume | undefined) => Promise<string>;
|
|
835
|
+
};
|
|
836
|
+
/**
|
|
837
|
+
* Prepends the local file path
|
|
838
|
+
*
|
|
839
|
+
* ```js
|
|
840
|
+
* // Matches: token.type === 'asset'
|
|
841
|
+
* // Returns:
|
|
842
|
+
* "path/to/file/asset.png"
|
|
843
|
+
* ```
|
|
844
|
+
*
|
|
845
|
+
* @memberof Transforms
|
|
846
|
+
*/
|
|
847
|
+
"asset/path": {
|
|
848
|
+
type: "value";
|
|
849
|
+
filter: typeof isAsset;
|
|
850
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
851
|
+
};
|
|
852
|
+
/**
|
|
853
|
+
* Wraps the value in a double-quoted string and prepends an '@' to make a string literal.
|
|
854
|
+
*
|
|
855
|
+
* ```objective-c
|
|
856
|
+
* // Matches: token.type === 'asset'
|
|
857
|
+
* // Returns: \@"string"
|
|
858
|
+
* ```
|
|
859
|
+
*
|
|
860
|
+
* @memberof Transforms
|
|
861
|
+
*/
|
|
862
|
+
"asset/objC/literal": {
|
|
863
|
+
type: "value";
|
|
864
|
+
filter: typeof isAsset;
|
|
865
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
866
|
+
};
|
|
867
|
+
/**
|
|
868
|
+
* Wraps the value in a double-quoted string to make a string literal.
|
|
869
|
+
*
|
|
870
|
+
* ```swift
|
|
871
|
+
* // Matches: token.type === 'asset'
|
|
872
|
+
* // Returns: "string"
|
|
873
|
+
* ```
|
|
874
|
+
*
|
|
875
|
+
* @memberof Transforms
|
|
876
|
+
*/
|
|
877
|
+
"asset/swift/literal": {
|
|
878
|
+
type: "value";
|
|
879
|
+
filter: typeof isAsset;
|
|
880
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
881
|
+
};
|
|
882
|
+
/**
|
|
883
|
+
* Transforms the value into a Flutter Color object using 8-digit hex with the alpha chanel on start
|
|
884
|
+
* ```js
|
|
885
|
+
* // Matches: token.type === 'color'
|
|
886
|
+
* // Returns:
|
|
887
|
+
* Color(0xFF00FF5F)
|
|
888
|
+
* ```
|
|
889
|
+
* @memberof Transforms
|
|
890
|
+
*
|
|
891
|
+
*/
|
|
892
|
+
"color/hex8flutter": {
|
|
893
|
+
type: "value";
|
|
894
|
+
filter: typeof isColor;
|
|
895
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
896
|
+
};
|
|
897
|
+
/**
|
|
898
|
+
* Wraps the value in a double-quoted string to make a string literal.
|
|
899
|
+
*
|
|
900
|
+
* ```dart
|
|
901
|
+
* // Matches: token.type === 'content'
|
|
902
|
+
* // Returns: "string"
|
|
903
|
+
* ```
|
|
904
|
+
*
|
|
905
|
+
* @memberof Transforms
|
|
906
|
+
*/
|
|
907
|
+
"content/flutter/literal": {
|
|
908
|
+
type: "value";
|
|
909
|
+
filter: typeof isContent;
|
|
910
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* Wraps the value in a double-quoted string to make a string literal.
|
|
914
|
+
*
|
|
915
|
+
* ```dart
|
|
916
|
+
* // Matches: token.type === 'asset'
|
|
917
|
+
* // Returns: "string"
|
|
918
|
+
* ```
|
|
919
|
+
*
|
|
920
|
+
* @memberof Transforms
|
|
921
|
+
*/
|
|
922
|
+
"asset/flutter/literal": {
|
|
923
|
+
type: "value";
|
|
924
|
+
filter: typeof isAsset;
|
|
925
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* Scales the number by 16 (or the value of 'basePxFontSize' on the platform in your config) to get to points for Flutter
|
|
929
|
+
*
|
|
930
|
+
* ```dart
|
|
931
|
+
* // Matches: token.type === 'dimension'
|
|
932
|
+
* // Returns: 16.00
|
|
933
|
+
* ```
|
|
934
|
+
*
|
|
935
|
+
* @memberof Transforms
|
|
936
|
+
*/
|
|
937
|
+
"size/flutter/remToDouble": {
|
|
938
|
+
type: "value";
|
|
939
|
+
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
940
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string;
|
|
941
|
+
};
|
|
942
|
+
};
|
|
8
943
|
export default _default;
|
|
9
944
|
export type Transform = import("../../types/Transform.d.ts").Transform;
|
|
10
945
|
export type Token = import("../../types/DesignToken.d.ts").TransformedToken;
|
|
11
946
|
export type PlatformConfig = import("../../types/Config.d.ts").PlatformConfig;
|
|
12
947
|
export type Config = import("../../types/Config.d.ts").Config;
|
|
948
|
+
import Color from 'tinycolor2';
|
|
949
|
+
/**
|
|
950
|
+
* @param {Token} token
|
|
951
|
+
* @param {Config} options
|
|
952
|
+
* @returns {boolean}
|
|
953
|
+
*/
|
|
954
|
+
declare function isFontSize(token: Token, options: Config): boolean;
|
|
955
|
+
/**
|
|
956
|
+
* @param {Token} token
|
|
957
|
+
* @param {Config} options
|
|
958
|
+
* @returns {boolean}
|
|
959
|
+
*/
|
|
960
|
+
declare function isDimension(token: Token, options: Config): boolean;
|
|
961
|
+
/**
|
|
962
|
+
* @param {Token} token
|
|
963
|
+
* @param {Config} options
|
|
964
|
+
* @returns {boolean}
|
|
965
|
+
*/
|
|
966
|
+
declare function isContent(token: Token, options: Config): boolean;
|
|
967
|
+
/**
|
|
968
|
+
* @param {Token} token
|
|
969
|
+
* @param {Config} options
|
|
970
|
+
* @returns {boolean}
|
|
971
|
+
*/
|
|
972
|
+
declare function isAsset(token: Token, options: Config): boolean;
|