style-dictionary 5.4.1 → 5.4.2
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/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/custom-parser/package.json +1 -1
- package/examples/advanced/custom-transforms/package.json +1 -1
- package/examples/advanced/font-face-rules/package.json +1 -1
- package/examples/advanced/format-helpers/package.json +1 -1
- package/examples/advanced/matching-build-files/package.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
- package/examples/advanced/node-modules-as-config-and-properties/package-lock.json +3 -3
- 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/package.json +1 -1
- package/examples/advanced/tokens-deprecation/package.json +1 -1
- package/examples/advanced/transitive-transforms/package.json +1 -1
- package/examples/advanced/variables-in-outputs/package.json +1 -1
- package/examples/advanced/yaml-tokens/package.json +1 -1
- package/lib/StyleDictionary.js +1 -1
- package/lib/common/transforms.d.ts +4 -4
- package/lib/common/transforms.js +4 -5
- package/package.json +1 -1
|
@@ -1125,9 +1125,9 @@
|
|
|
1125
1125
|
"license": "MIT"
|
|
1126
1126
|
},
|
|
1127
1127
|
"node_modules/qs": {
|
|
1128
|
-
"version": "6.
|
|
1129
|
-
"resolved": "https://registry.npmjs.org/qs/-/qs-6.
|
|
1130
|
-
"integrity": "sha512-
|
|
1128
|
+
"version": "6.15.2",
|
|
1129
|
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz",
|
|
1130
|
+
"integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==",
|
|
1131
1131
|
"dev": true,
|
|
1132
1132
|
"license": "BSD-3-Clause",
|
|
1133
1133
|
"dependencies": {
|
package/lib/StyleDictionary.js
CHANGED
|
@@ -67,7 +67,7 @@ export default class StyleDictionary extends Register {
|
|
|
67
67
|
// Placeholder is transformed on prepublish -> see scripts/inject-version.js
|
|
68
68
|
// Another option might be import pkg from './package.json' with { "type": "json" } which would work in both browser and node, but support is not there yet.
|
|
69
69
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility
|
|
70
|
-
static VERSION = '5.4.
|
|
70
|
+
static VERSION = '5.4.2';
|
|
71
71
|
|
|
72
72
|
/** @returns {Config} */
|
|
73
73
|
get options() {
|
|
@@ -42,10 +42,10 @@ export function isColor(token: Token, options: Config): boolean;
|
|
|
42
42
|
*
|
|
43
43
|
* unit can be undefined for this utility method as well to support old dimension token values
|
|
44
44
|
* which can be defined as unitless dimension tokens or numbers
|
|
45
|
-
* @returns {{ value: number; unit: TokenTypeDimensionUnit | undefined }}
|
|
45
|
+
* @returns {{ value: string | number; unit: TokenTypeDimensionUnit | undefined }}
|
|
46
46
|
*/
|
|
47
47
|
export function getTokenDimensionValue(val: Token["value"]): {
|
|
48
|
-
value: number;
|
|
48
|
+
value: string | number;
|
|
49
49
|
unit: TokenTypeDimensionUnit | undefined;
|
|
50
50
|
};
|
|
51
51
|
declare const _default: {
|
|
@@ -591,7 +591,7 @@ declare const _default: {
|
|
|
591
591
|
"size/rem": {
|
|
592
592
|
type: "value";
|
|
593
593
|
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
594
|
-
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string |
|
|
594
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, _: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string | number;
|
|
595
595
|
};
|
|
596
596
|
/**
|
|
597
597
|
* Scales the number by 16 (or the value of 'basePxFontSize' on the platform in your config) and adds 'f' to the end.
|
|
@@ -754,7 +754,7 @@ declare const _default: {
|
|
|
754
754
|
"size/pxToRem": {
|
|
755
755
|
type: "value";
|
|
756
756
|
filter: (token: import("../../types/DesignToken.d.ts").TransformedToken, options: import("../../types/Config.d.ts").Config) => boolean;
|
|
757
|
-
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string |
|
|
757
|
+
transform: (token: import("../../types/DesignToken.d.ts").TransformedToken, config: import("../../types/Config.d.ts").PlatformConfig, options: import("../../types/Config.d.ts").Config) => string | number;
|
|
758
758
|
};
|
|
759
759
|
/**
|
|
760
760
|
* Scales the number by 16 (or the value of 'basePxFontSize' on the platform in your config) to get to points for Flutter
|
package/lib/common/transforms.js
CHANGED
|
@@ -385,7 +385,7 @@ function transformCubicBezierCSS(token, options) {
|
|
|
385
385
|
*
|
|
386
386
|
* unit can be undefined for this utility method as well to support old dimension token values
|
|
387
387
|
* which can be defined as unitless dimension tokens or numbers
|
|
388
|
-
* @returns {{ value: number; unit: TokenTypeDimensionUnit | undefined }}
|
|
388
|
+
* @returns {{ value: string | number; unit: TokenTypeDimensionUnit | undefined }}
|
|
389
389
|
*/
|
|
390
390
|
export function getTokenDimensionValue(val) {
|
|
391
391
|
/** @type {TokenTypeDimensionUnit | undefined} */
|
|
@@ -398,9 +398,8 @@ export function getTokenDimensionValue(val) {
|
|
|
398
398
|
const unitMatch = `${val}`.match(/[^0-9.-]+$/);
|
|
399
399
|
if (unitMatch) {
|
|
400
400
|
unit = /** @type {TokenTypeDimensionUnit} */ (unitMatch[0]);
|
|
401
|
-
val =
|
|
401
|
+
val = val.replace(unit, '');
|
|
402
402
|
}
|
|
403
|
-
val = parseFloat(val);
|
|
404
403
|
}
|
|
405
404
|
|
|
406
405
|
return valueObj
|
|
@@ -1207,7 +1206,7 @@ export default {
|
|
|
1207
1206
|
if (nonParsed.unit !== undefined) {
|
|
1208
1207
|
return `${nonParsed.value}${nonParsed.unit}`;
|
|
1209
1208
|
}
|
|
1210
|
-
if (parsedVal === 0) return
|
|
1209
|
+
if (parsedVal === 0) return nonParsed.value;
|
|
1211
1210
|
|
|
1212
1211
|
return `${parsedVal}rem`;
|
|
1213
1212
|
},
|
|
@@ -1468,7 +1467,7 @@ export default {
|
|
|
1468
1467
|
const baseFont = getBasePxFontSize(config);
|
|
1469
1468
|
if (isNaN(parsedVal))
|
|
1470
1469
|
throwSizeError(token.name, options.usesDtcg ? token.$value : token.value, 'rem');
|
|
1471
|
-
if (parsedVal === 0) return
|
|
1470
|
+
if (parsedVal === 0) return nonParsed.value;
|
|
1472
1471
|
|
|
1473
1472
|
return `${parsedVal / baseFont}rem`;
|
|
1474
1473
|
},
|