@primer/primitives 9.1.2 → 10.0.0-rc.6651a0c1
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/css/functional/themes/dark-colorblind.css +4 -4
- package/dist/css/functional/themes/dark-high-contrast.css +20 -20
- package/dist/css/functional/themes/light-high-contrast.css +14 -14
- package/dist/css/functional/typography/typography.css +20 -20
- package/dist/css/primitives.css +20 -20
- package/dist/docs/base/size/size.json +76 -76
- package/dist/docs/base/typography/typography.json +16 -16
- package/dist/docs/functional/motion/motion.json +18 -18
- package/dist/docs/functional/size/border.json +56 -56
- package/dist/docs/functional/size/breakpoints.json +24 -24
- package/dist/docs/functional/size/size-coarse.json +12 -12
- package/dist/docs/functional/size/size-fine.json +12 -12
- package/dist/docs/functional/size/size.json +264 -264
- package/dist/docs/functional/size/viewport.json +24 -24
- package/dist/docs/functional/themes/dark-colorblind.json +2310 -3186
- package/dist/docs/functional/themes/dark-dimmed.json +2300 -2794
- package/dist/docs/functional/themes/dark-high-contrast.json +2520 -5038
- package/dist/docs/functional/themes/dark-tritanopia.json +2351 -3003
- package/dist/docs/functional/themes/dark.json +2270 -2270
- package/dist/docs/functional/themes/light-colorblind.json +2298 -3124
- package/dist/docs/functional/themes/light-high-contrast.json +2419 -4645
- package/dist/docs/functional/themes/light-tritanopia.json +2330 -2990
- package/dist/docs/functional/themes/light.json +2260 -2260
- package/dist/docs/functional/typography/typography.json +206 -206
- package/dist/figma/dimension/dimension.json +489 -489
- package/dist/figma/figma.json +11 -3
- package/dist/figma/scales/dark-dimmed.json +38 -38
- package/dist/figma/scales/dark-high-constrast.json +38 -38
- package/dist/figma/scales/dark.json +35 -35
- package/dist/figma/scales/light-high-constrast.json +40 -40
- package/dist/figma/scales/light.json +40 -40
- package/dist/figma/shadows/dark-colorblind.json +280 -280
- package/dist/figma/shadows/dark-dimmed.json +280 -280
- package/dist/figma/shadows/dark-high-contrast.json +280 -280
- package/dist/figma/shadows/dark-tritanopia.json +280 -280
- package/dist/figma/shadows/dark.json +280 -280
- package/dist/figma/shadows/light-colorblind.json +281 -281
- package/dist/figma/shadows/light-high-contrast.json +281 -281
- package/dist/figma/shadows/light-tritanopia.json +281 -281
- package/dist/figma/shadows/light.json +281 -281
- package/dist/figma/themes/dark-colorblind.json +4991 -5854
- package/dist/figma/themes/dark-dimmed.json +5314 -5799
- package/dist/figma/themes/dark-high-contrast.json +4210 -6679
- package/dist/figma/themes/dark-tritanopia.json +5165 -5817
- package/dist/figma/themes/dark.json +5534 -5537
- package/dist/figma/themes/light-colorblind.json +4857 -5669
- package/dist/figma/themes/light-high-contrast.json +4198 -6372
- package/dist/figma/themes/light-tritanopia.json +4901 -5529
- package/dist/figma/themes/light.json +5349 -5349
- package/dist/figma/typography/typography.json +112 -156
- package/dist/internalCss/dark-colorblind.css +4 -4
- package/dist/internalCss/dark-high-contrast.css +20 -20
- package/dist/internalCss/light-high-contrast.css +14 -14
- package/dist/styleLint/base/size/size.json +38 -38
- package/dist/styleLint/base/typography/typography.json +8 -8
- package/dist/styleLint/functional/motion/motion.json +12 -12
- package/dist/styleLint/functional/size/border.json +30 -30
- package/dist/styleLint/functional/size/breakpoints.json +12 -12
- package/dist/styleLint/functional/size/size-coarse.json +6 -6
- package/dist/styleLint/functional/size/size-fine.json +6 -6
- package/dist/styleLint/functional/size/size.json +132 -132
- package/dist/styleLint/functional/size/viewport.json +12 -12
- package/dist/styleLint/functional/themes/dark-colorblind.json +1171 -2047
- package/dist/styleLint/functional/themes/dark-dimmed.json +1160 -1654
- package/dist/styleLint/functional/themes/dark-high-contrast.json +1307 -3825
- package/dist/styleLint/functional/themes/dark-tritanopia.json +1232 -1884
- package/dist/styleLint/functional/themes/dark.json +1140 -1140
- package/dist/styleLint/functional/themes/light-colorblind.json +1198 -2024
- package/dist/styleLint/functional/themes/light-high-contrast.json +1270 -3496
- package/dist/styleLint/functional/themes/light-tritanopia.json +1205 -1865
- package/dist/styleLint/functional/themes/light.json +1130 -1130
- package/dist/styleLint/functional/typography/typography.json +114 -114
- package/package.json +18 -10
- package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +4 -4
- package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +6 -0
- package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +21 -3
- package/src/tokens/functional/color/dark/primitives-dark.json5 +3 -3
- package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +4 -1
- package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +4 -1
- package/src/tokens/functional/color/light/primitives-light.json5 +2 -2
- package/dist/build/PrimerStyleDictionary.d.ts +0 -9
- package/dist/build/PrimerStyleDictionary.js +0 -92
- package/dist/build/filters/index.d.ts +0 -13
- package/dist/build/filters/index.js +0 -29
- package/dist/build/filters/isBorder.d.ts +0 -7
- package/dist/build/filters/isBorder.js +0 -12
- package/dist/build/filters/isColor.d.ts +0 -7
- package/dist/build/filters/isColor.js +0 -12
- package/dist/build/filters/isColorWithAlpha.d.ts +0 -7
- package/dist/build/filters/isColorWithAlpha.js +0 -13
- package/dist/build/filters/isColorWithMix.d.ts +0 -7
- package/dist/build/filters/isColorWithMix.js +0 -28
- package/dist/build/filters/isDeprecated.d.ts +0 -7
- package/dist/build/filters/isDeprecated.js +0 -12
- package/dist/build/filters/isDimension.d.ts +0 -7
- package/dist/build/filters/isDimension.js +0 -12
- package/dist/build/filters/isDuration.d.ts +0 -7
- package/dist/build/filters/isDuration.js +0 -12
- package/dist/build/filters/isFontFamily.d.ts +0 -7
- package/dist/build/filters/isFontFamily.js +0 -12
- package/dist/build/filters/isFontWeight.d.ts +0 -7
- package/dist/build/filters/isFontWeight.js +0 -12
- package/dist/build/filters/isFromFile.d.ts +0 -8
- package/dist/build/filters/isFromFile.js +0 -14
- package/dist/build/filters/isNumber.d.ts +0 -7
- package/dist/build/filters/isNumber.js +0 -10
- package/dist/build/filters/isShadow.d.ts +0 -7
- package/dist/build/filters/isShadow.js +0 -12
- package/dist/build/filters/isSource.d.ts +0 -7
- package/dist/build/filters/isSource.js +0 -12
- package/dist/build/filters/isTypography.d.ts +0 -7
- package/dist/build/filters/isTypography.js +0 -12
- package/dist/build/formats/cssAdvanced.d.ts +0 -2
- package/dist/build/formats/cssAdvanced.js +0 -84
- package/dist/build/formats/cssCustomMedia.d.ts +0 -7
- package/dist/build/formats/cssCustomMedia.js +0 -25
- package/dist/build/formats/index.d.ts +0 -9
- package/dist/build/formats/index.js +0 -21
- package/dist/build/formats/javascriptCommonJs.d.ts +0 -7
- package/dist/build/formats/javascriptCommonJs.js +0 -25
- package/dist/build/formats/javascriptEsm.d.ts +0 -7
- package/dist/build/formats/javascriptEsm.js +0 -25
- package/dist/build/formats/jsonFigma.d.ts +0 -7
- package/dist/build/formats/jsonFigma.js +0 -116
- package/dist/build/formats/jsonNestedPrefixed.d.ts +0 -8
- package/dist/build/formats/jsonNestedPrefixed.js +0 -28
- package/dist/build/formats/jsonOneDimensional.d.ts +0 -8
- package/dist/build/formats/jsonOneDimensional.js +0 -24
- package/dist/build/formats/jsonPostCssFallback.d.ts +0 -8
- package/dist/build/formats/jsonPostCssFallback.js +0 -21
- package/dist/build/formats/typescriptExportDefinition.d.ts +0 -7
- package/dist/build/formats/typescriptExportDefinition.js +0 -166
- package/dist/build/formats/utilities/jsonToFlat.d.ts +0 -11
- package/dist/build/formats/utilities/jsonToFlat.js +0 -12
- package/dist/build/formats/utilities/jsonToNestedValue.d.ts +0 -8
- package/dist/build/formats/utilities/jsonToNestedValue.js +0 -25
- package/dist/build/formats/utilities/prefixTokens.d.ts +0 -8
- package/dist/build/formats/utilities/prefixTokens.js +0 -17
- package/dist/build/parsers/index.d.ts +0 -1
- package/dist/build/parsers/index.js +0 -5
- package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
- package/dist/build/parsers/w3cJsonParser.js +0 -27
- package/dist/build/platforms/css.d.ts +0 -2
- package/dist/build/platforms/css.js +0 -87
- package/dist/build/platforms/deprecatedJson.d.ts +0 -2
- package/dist/build/platforms/deprecatedJson.js +0 -17
- package/dist/build/platforms/docJson.d.ts +0 -2
- package/dist/build/platforms/docJson.js +0 -34
- package/dist/build/platforms/fallbacks.d.ts +0 -2
- package/dist/build/platforms/fallbacks.js +0 -34
- package/dist/build/platforms/figma.d.ts +0 -2
- package/dist/build/platforms/figma.js +0 -53
- package/dist/build/platforms/index.d.ts +0 -10
- package/dist/build/platforms/index.js +0 -23
- package/dist/build/platforms/javascript.d.ts +0 -2
- package/dist/build/platforms/javascript.js +0 -30
- package/dist/build/platforms/json.d.ts +0 -2
- package/dist/build/platforms/json.js +0 -32
- package/dist/build/platforms/styleLint.d.ts +0 -2
- package/dist/build/platforms/styleLint.js +0 -34
- package/dist/build/platforms/typeDefinitions.d.ts +0 -2
- package/dist/build/platforms/typeDefinitions.js +0 -30
- package/dist/build/platforms/typescript.d.ts +0 -2
- package/dist/build/platforms/typescript.js +0 -30
- package/dist/build/schemas/alphaValue.d.ts +0 -2
- package/dist/build/schemas/alphaValue.js +0 -8
- package/dist/build/schemas/baseToken.d.ts +0 -11
- package/dist/build/schemas/baseToken.js +0 -10
- package/dist/build/schemas/borderToken.d.ts +0 -51
- package/dist/build/schemas/borderToken.js +0 -20
- package/dist/build/schemas/collections.d.ts +0 -6
- package/dist/build/schemas/collections.js +0 -18
- package/dist/build/schemas/colorHexValue.d.ts +0 -2
- package/dist/build/schemas/colorHexValue.js +0 -12
- package/dist/build/schemas/colorToken.d.ts +0 -80
- package/dist/build/schemas/colorToken.js +0 -52
- package/dist/build/schemas/designToken.d.ts +0 -2
- package/dist/build/schemas/designToken.js +0 -37
- package/dist/build/schemas/dimensionToken.d.ts +0 -52
- package/dist/build/schemas/dimensionToken.js +0 -36
- package/dist/build/schemas/dimensionValue.d.ts +0 -2
- package/dist/build/schemas/dimensionValue.js +0 -12
- package/dist/build/schemas/durationToken.d.ts +0 -18
- package/dist/build/schemas/durationToken.js +0 -14
- package/dist/build/schemas/durationValue.d.ts +0 -2
- package/dist/build/schemas/durationValue.js +0 -8
- package/dist/build/schemas/fontFamilyToken.d.ts +0 -52
- package/dist/build/schemas/fontFamilyToken.js +0 -23
- package/dist/build/schemas/fontWeightToken.d.ts +0 -52
- package/dist/build/schemas/fontWeightToken.js +0 -24
- package/dist/build/schemas/fontWeightValue.d.ts +0 -2
- package/dist/build/schemas/fontWeightValue.js +0 -9
- package/dist/build/schemas/numberToken.d.ts +0 -71
- package/dist/build/schemas/numberToken.js +0 -30
- package/dist/build/schemas/referenceValue.d.ts +0 -2
- package/dist/build/schemas/referenceValue.js +0 -8
- package/dist/build/schemas/scopes.d.ts +0 -5
- package/dist/build/schemas/scopes.js +0 -34
- package/dist/build/schemas/shadowToken.d.ts +0 -157
- package/dist/build/schemas/shadowToken.js +0 -46
- package/dist/build/schemas/stringToken.d.ts +0 -18
- package/dist/build/schemas/stringToken.js +0 -13
- package/dist/build/schemas/tokenName.d.ts +0 -2
- package/dist/build/schemas/tokenName.js +0 -8
- package/dist/build/schemas/tokenType.d.ts +0 -3
- package/dist/build/schemas/tokenType.js +0 -6
- package/dist/build/schemas/typographyToken.d.ts +0 -59
- package/dist/build/schemas/typographyToken.js +0 -21
- package/dist/build/schemas/validTokenType.d.ts +0 -5
- package/dist/build/schemas/validTokenType.js +0 -34
- package/dist/build/schemas/viewportRangeToken.d.ts +0 -18
- package/dist/build/schemas/viewportRangeToken.js +0 -13
- package/dist/build/transformers/borderToCss.d.ts +0 -8
- package/dist/build/transformers/borderToCss.js +0 -38
- package/dist/build/transformers/colorToHex.d.ts +0 -8
- package/dist/build/transformers/colorToHex.js +0 -26
- package/dist/build/transformers/colorToHexMix.d.ts +0 -8
- package/dist/build/transformers/colorToHexMix.js +0 -25
- package/dist/build/transformers/colorToRgbAlpha.d.ts +0 -8
- package/dist/build/transformers/colorToRgbAlpha.js +0 -22
- package/dist/build/transformers/colorToRgbaFloat.d.ts +0 -8
- package/dist/build/transformers/colorToRgbaFloat.js +0 -50
- package/dist/build/transformers/dimensionToPixelUnitless.d.ts +0 -8
- package/dist/build/transformers/dimensionToPixelUnitless.js +0 -50
- package/dist/build/transformers/dimensionToRem.d.ts +0 -8
- package/dist/build/transformers/dimensionToRem.js +0 -47
- package/dist/build/transformers/dimensionToRemPxArray.d.ts +0 -8
- package/dist/build/transformers/dimensionToRemPxArray.js +0 -47
- package/dist/build/transformers/durationToCss.d.ts +0 -8
- package/dist/build/transformers/durationToCss.js +0 -30
- package/dist/build/transformers/figmaAttributes.d.ts +0 -8
- package/dist/build/transformers/figmaAttributes.js +0 -57
- package/dist/build/transformers/floatToPixel.d.ts +0 -15
- package/dist/build/transformers/floatToPixel.js +0 -41
- package/dist/build/transformers/fontFamilyToCss.d.ts +0 -14
- package/dist/build/transformers/fontFamilyToCss.js +0 -40
- package/dist/build/transformers/fontFamilyToFigma.d.ts +0 -14
- package/dist/build/transformers/fontFamilyToFigma.js +0 -46
- package/dist/build/transformers/fontWeightToNumber.d.ts +0 -9
- package/dist/build/transformers/fontWeightToNumber.js +0 -53
- package/dist/build/transformers/index.d.ts +0 -24
- package/dist/build/transformers/index.js +0 -51
- package/dist/build/transformers/jsonDeprecated.d.ts +0 -8
- package/dist/build/transformers/jsonDeprecated.js +0 -16
- package/dist/build/transformers/namePathToCamelCase.d.ts +0 -8
- package/dist/build/transformers/namePathToCamelCase.js +0 -14
- package/dist/build/transformers/namePathToDotNotation.d.ts +0 -8
- package/dist/build/transformers/namePathToDotNotation.js +0 -33
- package/dist/build/transformers/namePathToFigma.d.ts +0 -9
- package/dist/build/transformers/namePathToFigma.js +0 -24
- package/dist/build/transformers/namePathToKebabCase.d.ts +0 -8
- package/dist/build/transformers/namePathToKebabCase.js +0 -18
- package/dist/build/transformers/namePathToPascalCase.d.ts +0 -8
- package/dist/build/transformers/namePathToPascalCase.js +0 -14
- package/dist/build/transformers/namePathToSlashNotation.d.ts +0 -8
- package/dist/build/transformers/namePathToSlashNotation.js +0 -18
- package/dist/build/transformers/shadowToCss.d.ts +0 -8
- package/dist/build/transformers/shadowToCss.js +0 -35
- package/dist/build/transformers/typographyToCss.d.ts +0 -8
- package/dist/build/transformers/typographyToCss.js +0 -29
- package/dist/build/transformers/utilities/alpha.d.ts +0 -9
- package/dist/build/transformers/utilities/alpha.js +0 -20
- package/dist/build/transformers/utilities/checkRequiredTokenProperties.d.ts +0 -7
- package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +0 -17
- package/dist/build/transformers/utilities/getTokenValue.d.ts +0 -2
- package/dist/build/transformers/utilities/getTokenValue.js +0 -18
- package/dist/build/transformers/utilities/hasSpaceInString.d.ts +0 -1
- package/dist/build/transformers/utilities/hasSpaceInString.js +0 -10
- package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +0 -2
- package/dist/build/transformers/utilities/hexToRgbaFloat.js +0 -33
- package/dist/build/transformers/utilities/invalidTokenError.d.ts +0 -7
- package/dist/build/transformers/utilities/invalidTokenError.js +0 -26
- package/dist/build/transformers/utilities/isRgbaFloat.d.ts +0 -7
- package/dist/build/transformers/utilities/isRgbaFloat.js +0 -24
- package/dist/build/transformers/utilities/mix.d.ts +0 -5
- package/dist/build/transformers/utilities/mix.js +0 -40
- package/dist/build/transformers/utilities/rgbaFloatToHex.d.ts +0 -6
- package/dist/build/transformers/utilities/rgbaFloatToHex.js +0 -15
- package/dist/build/utilities/copyFromDir.d.ts +0 -8
- package/dist/build/utilities/copyFromDir.js +0 -34
- package/dist/build/utilities/filterStringArray.d.ts +0 -1
- package/dist/build/utilities/filterStringArray.js +0 -17
- package/dist/build/utilities/getFlag.d.ts +0 -8
- package/dist/build/utilities/getFlag.js +0 -16
- package/dist/build/utilities/index.d.ts +0 -3
- package/dist/build/utilities/index.js +0 -9
- package/dist/build/utilities/joinFriendly.d.ts +0 -1
- package/dist/build/utilities/joinFriendly.js +0 -5
- package/dist/build/utilities/schemaErrorMessage.d.ts +0 -1
- package/dist/build/utilities/schemaErrorMessage.js +0 -5
- package/dist/build/utilities/toCamelCase.d.ts +0 -1
- package/dist/build/utilities/toCamelCase.js +0 -20
- package/dist/build/utilities/toPascalCase.d.ts +0 -1
- package/dist/build/utilities/toPascalCase.js +0 -17
- package/dist/build/utilities/treeWalker.d.ts +0 -8
- package/dist/build/utilities/treeWalker.js +0 -27
- package/dist/build/utilities/upperCaseFirstCharacter.d.ts +0 -8
- package/dist/build/utilities/upperCaseFirstCharacter.js +0 -14
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.floatToPixelUnitless = exports.floatToPixel = exports.convertFloatToPixel = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
/**
|
|
6
|
-
* takes a value and returns it if its a px string if it is a float and the token has a fontSize value in extensions['org.primer.data']
|
|
7
|
-
* @param value
|
|
8
|
-
* @returns string
|
|
9
|
-
*/
|
|
10
|
-
const convertFloatToPixel = (token, unitless = false) => {
|
|
11
|
-
var _a, _b, _c, _d, _e, _f;
|
|
12
|
-
// short circut if value is not a number
|
|
13
|
-
if (typeof token.value !== 'number' ||
|
|
14
|
-
!((_b = (_a = token.$extensions) === null || _a === void 0 ? void 0 : _a['org.primer.data']) === null || _b === void 0 ? void 0 : _b.fontSize) ||
|
|
15
|
-
typeof ((_d = (_c = token.$extensions) === null || _c === void 0 ? void 0 : _c['org.primer.data']) === null || _d === void 0 ? void 0 : _d.fontSize) !== 'number') {
|
|
16
|
-
return token.value;
|
|
17
|
-
}
|
|
18
|
-
// convert value
|
|
19
|
-
const convertedValue = ((_f = (_e = token.$extensions) === null || _e === void 0 ? void 0 : _e['org.primer.data']) === null || _f === void 0 ? void 0 : _f.fontSize) * token.value;
|
|
20
|
-
// return converted value
|
|
21
|
-
return convertedValue === 0 ? 0 : unitless ? Math.round(convertedValue) : `${Math.round(convertedValue)}px`;
|
|
22
|
-
};
|
|
23
|
-
exports.convertFloatToPixel = convertFloatToPixel;
|
|
24
|
-
/**
|
|
25
|
-
* @description converts a float value to a pixel value based on the provided fontSize on the tokersn extension
|
|
26
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
27
|
-
* @matcher matches all tokens of $type `isNumber`
|
|
28
|
-
* @transformer returns a pixel string
|
|
29
|
-
*/
|
|
30
|
-
exports.floatToPixel = {
|
|
31
|
-
type: `value`,
|
|
32
|
-
transitive: true,
|
|
33
|
-
matcher: filters_1.isNumber,
|
|
34
|
-
transformer: (token) => (0, exports.convertFloatToPixel)(token),
|
|
35
|
-
};
|
|
36
|
-
exports.floatToPixelUnitless = {
|
|
37
|
-
type: `value`,
|
|
38
|
-
transitive: true,
|
|
39
|
-
matcher: filters_1.isNumber,
|
|
40
|
-
transformer: (token) => (0, exports.convertFloatToPixel)(token, true),
|
|
41
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
4
|
-
* @param value
|
|
5
|
-
* @returns string
|
|
6
|
-
*/
|
|
7
|
-
export declare const parseFontFamily: (value: unknown) => string;
|
|
8
|
-
/**
|
|
9
|
-
* @description converts fontFamily tokens value to string
|
|
10
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
11
|
-
* @matcher matches all tokens of $type `fontFamily`
|
|
12
|
-
* @transformer returns a string
|
|
13
|
-
*/
|
|
14
|
-
export declare const fontFamilyToCss: StyleDictionary.Transform;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fontFamilyToCss = exports.parseFontFamily = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
6
|
-
const hasSpaceInString_1 = require("./utilities/hasSpaceInString");
|
|
7
|
-
/**
|
|
8
|
-
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
9
|
-
* @param value
|
|
10
|
-
* @returns string
|
|
11
|
-
*/
|
|
12
|
-
const parseFontFamily = (value) => {
|
|
13
|
-
if (typeof value === 'string') {
|
|
14
|
-
return value;
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(value)) {
|
|
17
|
-
return value
|
|
18
|
-
.map((string) => {
|
|
19
|
-
if (typeof string !== 'string') {
|
|
20
|
-
throw new Error(`Invalid value in array ${string}, must be a string`);
|
|
21
|
-
}
|
|
22
|
-
return (0, hasSpaceInString_1.hasSpaceInString)(string) ? `'${string}'` : string;
|
|
23
|
-
})
|
|
24
|
-
.join(', ');
|
|
25
|
-
}
|
|
26
|
-
throw new Error(`Invalid value ${value}, should be a string or array of strings`);
|
|
27
|
-
};
|
|
28
|
-
exports.parseFontFamily = parseFontFamily;
|
|
29
|
-
/**
|
|
30
|
-
* @description converts fontFamily tokens value to string
|
|
31
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
32
|
-
* @matcher matches all tokens of $type `fontFamily`
|
|
33
|
-
* @transformer returns a string
|
|
34
|
-
*/
|
|
35
|
-
exports.fontFamilyToCss = {
|
|
36
|
-
type: `value`,
|
|
37
|
-
transitive: true,
|
|
38
|
-
matcher: filters_1.isFontFamily,
|
|
39
|
-
transformer: (token) => (0, exports.parseFontFamily)((0, getTokenValue_1.getTokenValue)(token)),
|
|
40
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
4
|
-
* @param value
|
|
5
|
-
* @returns string
|
|
6
|
-
*/
|
|
7
|
-
export declare const parseFontFamily: (token: StyleDictionary.TransformedToken, fontFamilies?: Record<string, string>) => string;
|
|
8
|
-
/**
|
|
9
|
-
* @description converts fontFamily tokens value to string
|
|
10
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
11
|
-
* @matcher matches all tokens of $type `fontFamily`
|
|
12
|
-
* @transformer returns a string
|
|
13
|
-
*/
|
|
14
|
-
export declare const fontFamilyToFigma: StyleDictionary.Transform;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fontFamilyToFigma = exports.parseFontFamily = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const hasSpaceInString_1 = require("./utilities/hasSpaceInString");
|
|
6
|
-
/**
|
|
7
|
-
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
8
|
-
* @param value
|
|
9
|
-
* @returns string
|
|
10
|
-
*/
|
|
11
|
-
const parseFontFamily = (token, fontFamilies = {}) => {
|
|
12
|
-
// return value from fontFamilies
|
|
13
|
-
if (token.name in fontFamilies) {
|
|
14
|
-
return fontFamilies[token.name];
|
|
15
|
-
}
|
|
16
|
-
// return string
|
|
17
|
-
if (typeof token.value === 'string') {
|
|
18
|
-
return token.value;
|
|
19
|
-
}
|
|
20
|
-
// return stringified array
|
|
21
|
-
if (Array.isArray(token.value)) {
|
|
22
|
-
return token.value
|
|
23
|
-
.map((string) => {
|
|
24
|
-
if (typeof string !== 'string') {
|
|
25
|
-
throw new Error(`Invalid value in array ${string}, must be a string`);
|
|
26
|
-
}
|
|
27
|
-
return (0, hasSpaceInString_1.hasSpaceInString)(string) ? `'${string}'` : string;
|
|
28
|
-
})
|
|
29
|
-
.join(', ');
|
|
30
|
-
}
|
|
31
|
-
// invalid value
|
|
32
|
-
throw new Error(`Invalid value ${token.value}, should be a string or array of strings`);
|
|
33
|
-
};
|
|
34
|
-
exports.parseFontFamily = parseFontFamily;
|
|
35
|
-
/**
|
|
36
|
-
* @description converts fontFamily tokens value to string
|
|
37
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
38
|
-
* @matcher matches all tokens of $type `fontFamily`
|
|
39
|
-
* @transformer returns a string
|
|
40
|
-
*/
|
|
41
|
-
exports.fontFamilyToFigma = {
|
|
42
|
-
type: `value`,
|
|
43
|
-
transitive: true,
|
|
44
|
-
matcher: filters_1.isFontFamily,
|
|
45
|
-
transformer: (token, platform) => { var _a; return (0, exports.parseFontFamily)(token, (_a = platform.options) === null || _a === void 0 ? void 0 : _a.fontFamilies); },
|
|
46
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
export declare const parseFontWeight: (value: unknown) => number;
|
|
3
|
-
/**
|
|
4
|
-
* @description converts fontWeight tokens value to numeric value
|
|
5
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
6
|
-
* @matcher matches all tokens of $type `fontWeight`
|
|
7
|
-
* @transformer returns a number
|
|
8
|
-
*/
|
|
9
|
-
export declare const fontWeightToNumber: StyleDictionary.Transform;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fontWeightToNumber = exports.parseFontWeight = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
6
|
-
const fontWeightMatrix = {
|
|
7
|
-
'100': ['thin', 'hairline'],
|
|
8
|
-
'200': ['extra-light', 'ultra-light'],
|
|
9
|
-
'300': ['light'],
|
|
10
|
-
'400': ['normal', 'regular', 'book'],
|
|
11
|
-
'500': ['medium'],
|
|
12
|
-
'600': ['semi-bold', 'demi-bold'],
|
|
13
|
-
'700': ['bold'],
|
|
14
|
-
'800': ['extra-bold', 'ultra-bold'],
|
|
15
|
-
'900': ['black', 'heavy'],
|
|
16
|
-
'950': ['extra-black', 'ultra-black'],
|
|
17
|
-
};
|
|
18
|
-
const parseFontWeight = (value) => {
|
|
19
|
-
// throw on anything but string and number
|
|
20
|
-
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
21
|
-
throw new Error(`Invalid value ${value}, should be a number or fontWeight string`);
|
|
22
|
-
}
|
|
23
|
-
// valid string
|
|
24
|
-
if (typeof value === 'string') {
|
|
25
|
-
const key = Object.keys(fontWeightMatrix).find((k) => fontWeightMatrix[k].includes(value));
|
|
26
|
-
if (key !== undefined) {
|
|
27
|
-
return parseInt(key);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// if number as string
|
|
31
|
-
if (typeof value === 'string' && typeof parseInt(value) === 'number' && !isNaN(parseInt(value))) {
|
|
32
|
-
value = parseInt(value);
|
|
33
|
-
}
|
|
34
|
-
// return if valid numver
|
|
35
|
-
if (typeof value === 'number' && value > 0 && value <= 1000) {
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
// invalid value
|
|
39
|
-
throw new Error(`Invalid value ${value}, should be a number or fontWeight string`);
|
|
40
|
-
};
|
|
41
|
-
exports.parseFontWeight = parseFontWeight;
|
|
42
|
-
/**
|
|
43
|
-
* @description converts fontWeight tokens value to numeric value
|
|
44
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
45
|
-
* @matcher matches all tokens of $type `fontWeight`
|
|
46
|
-
* @transformer returns a number
|
|
47
|
-
*/
|
|
48
|
-
exports.fontWeightToNumber = {
|
|
49
|
-
type: `value`,
|
|
50
|
-
transitive: true,
|
|
51
|
-
matcher: filters_1.isFontWeight,
|
|
52
|
-
transformer: (token) => (0, exports.parseFontWeight)((0, getTokenValue_1.getTokenValue)(token)),
|
|
53
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { borderToCss } from './borderToCss';
|
|
2
|
-
export { colorToHex } from './colorToHex';
|
|
3
|
-
export { colorToHexMix } from './colorToHexMix';
|
|
4
|
-
export { colorToRgbAlpha } from './colorToRgbAlpha';
|
|
5
|
-
export { colorToRgbaFloat } from './colorToRgbaFloat';
|
|
6
|
-
export { floatToPixel } from './floatToPixel';
|
|
7
|
-
export { floatToPixelUnitless } from './floatToPixel';
|
|
8
|
-
export { dimensionToRem } from './dimensionToRem';
|
|
9
|
-
export { dimensionToRemPxArray } from './dimensionToRemPxArray';
|
|
10
|
-
export { dimensionToPixelUnitless } from './dimensionToPixelUnitless';
|
|
11
|
-
export { durationToCss } from './durationToCss';
|
|
12
|
-
export { figmaAttributes } from './figmaAttributes';
|
|
13
|
-
export { fontFamilyToCss } from './fontFamilyToCss';
|
|
14
|
-
export { fontFamilyToFigma } from './fontFamilyToFigma';
|
|
15
|
-
export { fontWeightToNumber } from './fontWeightToNumber';
|
|
16
|
-
export { jsonDeprecated } from './jsonDeprecated';
|
|
17
|
-
export { namePathToCamelCase } from './namePathToCamelCase';
|
|
18
|
-
export { namePathToPascalCase } from './namePathToPascalCase';
|
|
19
|
-
export { namePathToDotNotation } from './namePathToDotNotation';
|
|
20
|
-
export { namePathToFigma } from './namePathToFigma';
|
|
21
|
-
export { namePathToKebabCase } from './namePathToKebabCase';
|
|
22
|
-
export { namePathToSlashNotation } from './namePathToSlashNotation';
|
|
23
|
-
export { shadowToCss } from './shadowToCss';
|
|
24
|
-
export { typographyToCss } from './typographyToCss';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typographyToCss = exports.shadowToCss = exports.namePathToSlashNotation = exports.namePathToKebabCase = exports.namePathToFigma = exports.namePathToDotNotation = exports.namePathToPascalCase = exports.namePathToCamelCase = exports.jsonDeprecated = exports.fontWeightToNumber = exports.fontFamilyToFigma = exports.fontFamilyToCss = exports.figmaAttributes = exports.durationToCss = exports.dimensionToPixelUnitless = exports.dimensionToRemPxArray = exports.dimensionToRem = exports.floatToPixelUnitless = exports.floatToPixel = exports.colorToRgbaFloat = exports.colorToRgbAlpha = exports.colorToHexMix = exports.colorToHex = exports.borderToCss = void 0;
|
|
4
|
-
var borderToCss_1 = require("./borderToCss");
|
|
5
|
-
Object.defineProperty(exports, "borderToCss", { enumerable: true, get: function () { return borderToCss_1.borderToCss; } });
|
|
6
|
-
var colorToHex_1 = require("./colorToHex");
|
|
7
|
-
Object.defineProperty(exports, "colorToHex", { enumerable: true, get: function () { return colorToHex_1.colorToHex; } });
|
|
8
|
-
var colorToHexMix_1 = require("./colorToHexMix");
|
|
9
|
-
Object.defineProperty(exports, "colorToHexMix", { enumerable: true, get: function () { return colorToHexMix_1.colorToHexMix; } });
|
|
10
|
-
var colorToRgbAlpha_1 = require("./colorToRgbAlpha");
|
|
11
|
-
Object.defineProperty(exports, "colorToRgbAlpha", { enumerable: true, get: function () { return colorToRgbAlpha_1.colorToRgbAlpha; } });
|
|
12
|
-
var colorToRgbaFloat_1 = require("./colorToRgbaFloat");
|
|
13
|
-
Object.defineProperty(exports, "colorToRgbaFloat", { enumerable: true, get: function () { return colorToRgbaFloat_1.colorToRgbaFloat; } });
|
|
14
|
-
var floatToPixel_1 = require("./floatToPixel");
|
|
15
|
-
Object.defineProperty(exports, "floatToPixel", { enumerable: true, get: function () { return floatToPixel_1.floatToPixel; } });
|
|
16
|
-
var floatToPixel_2 = require("./floatToPixel");
|
|
17
|
-
Object.defineProperty(exports, "floatToPixelUnitless", { enumerable: true, get: function () { return floatToPixel_2.floatToPixelUnitless; } });
|
|
18
|
-
var dimensionToRem_1 = require("./dimensionToRem");
|
|
19
|
-
Object.defineProperty(exports, "dimensionToRem", { enumerable: true, get: function () { return dimensionToRem_1.dimensionToRem; } });
|
|
20
|
-
var dimensionToRemPxArray_1 = require("./dimensionToRemPxArray");
|
|
21
|
-
Object.defineProperty(exports, "dimensionToRemPxArray", { enumerable: true, get: function () { return dimensionToRemPxArray_1.dimensionToRemPxArray; } });
|
|
22
|
-
var dimensionToPixelUnitless_1 = require("./dimensionToPixelUnitless");
|
|
23
|
-
Object.defineProperty(exports, "dimensionToPixelUnitless", { enumerable: true, get: function () { return dimensionToPixelUnitless_1.dimensionToPixelUnitless; } });
|
|
24
|
-
var durationToCss_1 = require("./durationToCss");
|
|
25
|
-
Object.defineProperty(exports, "durationToCss", { enumerable: true, get: function () { return durationToCss_1.durationToCss; } });
|
|
26
|
-
var figmaAttributes_1 = require("./figmaAttributes");
|
|
27
|
-
Object.defineProperty(exports, "figmaAttributes", { enumerable: true, get: function () { return figmaAttributes_1.figmaAttributes; } });
|
|
28
|
-
var fontFamilyToCss_1 = require("./fontFamilyToCss");
|
|
29
|
-
Object.defineProperty(exports, "fontFamilyToCss", { enumerable: true, get: function () { return fontFamilyToCss_1.fontFamilyToCss; } });
|
|
30
|
-
var fontFamilyToFigma_1 = require("./fontFamilyToFigma");
|
|
31
|
-
Object.defineProperty(exports, "fontFamilyToFigma", { enumerable: true, get: function () { return fontFamilyToFigma_1.fontFamilyToFigma; } });
|
|
32
|
-
var fontWeightToNumber_1 = require("./fontWeightToNumber");
|
|
33
|
-
Object.defineProperty(exports, "fontWeightToNumber", { enumerable: true, get: function () { return fontWeightToNumber_1.fontWeightToNumber; } });
|
|
34
|
-
var jsonDeprecated_1 = require("./jsonDeprecated");
|
|
35
|
-
Object.defineProperty(exports, "jsonDeprecated", { enumerable: true, get: function () { return jsonDeprecated_1.jsonDeprecated; } });
|
|
36
|
-
var namePathToCamelCase_1 = require("./namePathToCamelCase");
|
|
37
|
-
Object.defineProperty(exports, "namePathToCamelCase", { enumerable: true, get: function () { return namePathToCamelCase_1.namePathToCamelCase; } });
|
|
38
|
-
var namePathToPascalCase_1 = require("./namePathToPascalCase");
|
|
39
|
-
Object.defineProperty(exports, "namePathToPascalCase", { enumerable: true, get: function () { return namePathToPascalCase_1.namePathToPascalCase; } });
|
|
40
|
-
var namePathToDotNotation_1 = require("./namePathToDotNotation");
|
|
41
|
-
Object.defineProperty(exports, "namePathToDotNotation", { enumerable: true, get: function () { return namePathToDotNotation_1.namePathToDotNotation; } });
|
|
42
|
-
var namePathToFigma_1 = require("./namePathToFigma");
|
|
43
|
-
Object.defineProperty(exports, "namePathToFigma", { enumerable: true, get: function () { return namePathToFigma_1.namePathToFigma; } });
|
|
44
|
-
var namePathToKebabCase_1 = require("./namePathToKebabCase");
|
|
45
|
-
Object.defineProperty(exports, "namePathToKebabCase", { enumerable: true, get: function () { return namePathToKebabCase_1.namePathToKebabCase; } });
|
|
46
|
-
var namePathToSlashNotation_1 = require("./namePathToSlashNotation");
|
|
47
|
-
Object.defineProperty(exports, "namePathToSlashNotation", { enumerable: true, get: function () { return namePathToSlashNotation_1.namePathToSlashNotation; } });
|
|
48
|
-
var shadowToCss_1 = require("./shadowToCss");
|
|
49
|
-
Object.defineProperty(exports, "shadowToCss", { enumerable: true, get: function () { return shadowToCss_1.shadowToCss; } });
|
|
50
|
-
var typographyToCss_1 = require("./typographyToCss");
|
|
51
|
-
Object.defineProperty(exports, "typographyToCss", { enumerable: true, get: function () { return typographyToCss_1.typographyToCss; } });
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description replaces tokens value with content of tokens `deprecated` property
|
|
4
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher matches all tokens with a `deprecated` property
|
|
6
|
-
* @transformer returns `string` specified in `token.deprecated` or `null`
|
|
7
|
-
*/
|
|
8
|
-
export declare const jsonDeprecated: StyleDictionary.Transform;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonDeprecated = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
/**
|
|
6
|
-
* @description replaces tokens value with content of tokens `deprecated` property
|
|
7
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
8
|
-
* @matcher matches all tokens with a `deprecated` property
|
|
9
|
-
* @transformer returns `string` specified in `token.deprecated` or `null`
|
|
10
|
-
*/
|
|
11
|
-
exports.jsonDeprecated = {
|
|
12
|
-
type: `value`,
|
|
13
|
-
transitive: true,
|
|
14
|
-
matcher: filters_1.isDeprecated,
|
|
15
|
-
transformer: (token) => typeof token.deprecated === 'string' ? token.deprecated.replace(/[{}]/g, '') : null,
|
|
16
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a camelCase string, preserves casing of parts
|
|
4
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher omitted to match all tokens
|
|
6
|
-
* @transformer returns `string` camelCase
|
|
7
|
-
*/
|
|
8
|
-
export declare const namePathToCamelCase: StyleDictionary.Transform;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToCamelCase = void 0;
|
|
4
|
-
const utilities_1 = require("../utilities");
|
|
5
|
-
/**
|
|
6
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a camelCase string, preserves casing of parts
|
|
7
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
8
|
-
* @matcher omitted to match all tokens
|
|
9
|
-
* @transformer returns `string` camelCase
|
|
10
|
-
*/
|
|
11
|
-
exports.namePathToCamelCase = {
|
|
12
|
-
type: `name`,
|
|
13
|
-
transformer: (token, options) => (0, utilities_1.toCamelCase)([(options === null || options === void 0 ? void 0 : options.prefix) || '', ...token.path]),
|
|
14
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a dot.notation string
|
|
4
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher omitted to match all tokens
|
|
6
|
-
* @transformer returns `string` in dot.notation
|
|
7
|
-
*/
|
|
8
|
-
export declare const namePathToDotNotation: StyleDictionary.Transform;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToDotNotation = void 0;
|
|
4
|
-
const utilities_1 = require("../utilities");
|
|
5
|
-
/**
|
|
6
|
-
* camelCase
|
|
7
|
-
* @scope custom camelCase implementation should only be used within `name path to dot notation` transformer
|
|
8
|
-
* @description replaces space ` `, dash `-`, underscore `_` and plus `+` by camelCasing e.g. `camel-case` -> `camelCase`
|
|
9
|
-
* @param string
|
|
10
|
-
* @returns string
|
|
11
|
-
*/
|
|
12
|
-
const camelCase = (string) => {
|
|
13
|
-
return string
|
|
14
|
-
.split(/[\s-_+]+/g)
|
|
15
|
-
.map((stringPart, index) => (index === 0 ? stringPart : (0, utilities_1.upperCaseFirstCharacter)(stringPart)))
|
|
16
|
-
.join('');
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a dot.notation string
|
|
20
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
21
|
-
* @matcher omitted to match all tokens
|
|
22
|
-
* @transformer returns `string` in dot.notation
|
|
23
|
-
*/
|
|
24
|
-
exports.namePathToDotNotation = {
|
|
25
|
-
type: `name`,
|
|
26
|
-
transformer: (token, options) => {
|
|
27
|
-
return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
|
|
28
|
-
// remove undefined if exists
|
|
29
|
-
.filter((part) => typeof part === 'string' && part !== '@')
|
|
30
|
-
.map((part) => camelCase(part))
|
|
31
|
-
.join('.'));
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
export declare const transformNamePathToFigma: (token: StyleDictionary.TransformedToken, options?: StyleDictionary.Platform) => string;
|
|
3
|
-
/**
|
|
4
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a specific figma name
|
|
5
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
6
|
-
* @matcher omitted to match all tokens
|
|
7
|
-
* @transformer returns `string`
|
|
8
|
-
*/
|
|
9
|
-
export declare const namePathToFigma: StyleDictionary.Transform;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToFigma = exports.transformNamePathToFigma = void 0;
|
|
4
|
-
const transformNamePathToFigma = (token, options) => {
|
|
5
|
-
let pathArray = token.path.filter((part) => part !== '@');
|
|
6
|
-
if (['fgColor', 'borderColor', 'bgColor'].includes(pathArray[0]) && pathArray.length === 3) {
|
|
7
|
-
pathArray = [pathArray[0], `${pathArray[1]}-${pathArray[2]}`];
|
|
8
|
-
}
|
|
9
|
-
return ([options === null || options === void 0 ? void 0 : options.prefix, ...pathArray]
|
|
10
|
-
// remove undefined if exists
|
|
11
|
-
.filter((part) => typeof part === 'string' && part !== '@')
|
|
12
|
-
.join('/'));
|
|
13
|
-
};
|
|
14
|
-
exports.transformNamePathToFigma = transformNamePathToFigma;
|
|
15
|
-
/**
|
|
16
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a specific figma name
|
|
17
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
18
|
-
* @matcher omitted to match all tokens
|
|
19
|
-
* @transformer returns `string`
|
|
20
|
-
*/
|
|
21
|
-
exports.namePathToFigma = {
|
|
22
|
-
type: `name`,
|
|
23
|
-
transformer: exports.transformNamePathToFigma,
|
|
24
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a kebab-case string, preserves casing of parts
|
|
4
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher omitted to match all tokens
|
|
6
|
-
* @transformer returns `string` kebab-case
|
|
7
|
-
*/
|
|
8
|
-
export declare const namePathToKebabCase: StyleDictionary.Transform;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToKebabCase = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a kebab-case string, preserves casing of parts
|
|
6
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
7
|
-
* @matcher omitted to match all tokens
|
|
8
|
-
* @transformer returns `string` kebab-case
|
|
9
|
-
*/
|
|
10
|
-
exports.namePathToKebabCase = {
|
|
11
|
-
type: `name`,
|
|
12
|
-
transformer: (token, options) => {
|
|
13
|
-
return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
|
|
14
|
-
// remove undefined if exists
|
|
15
|
-
.filter((part) => typeof part === 'string' && part !== '@')
|
|
16
|
-
.join('-'));
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a PascalCase string, preserves casing of parts
|
|
4
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher omitted to match all tokens
|
|
6
|
-
* @transformer returns `string` PascalCase
|
|
7
|
-
*/
|
|
8
|
-
export declare const namePathToPascalCase: StyleDictionary.Transform;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToPascalCase = void 0;
|
|
4
|
-
const toPascalCase_1 = require("../utilities/toPascalCase");
|
|
5
|
-
/**
|
|
6
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a PascalCase string, preserves casing of parts
|
|
7
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
8
|
-
* @matcher omitted to match all tokens
|
|
9
|
-
* @transformer returns `string` PascalCase
|
|
10
|
-
*/
|
|
11
|
-
exports.namePathToPascalCase = {
|
|
12
|
-
type: `name`,
|
|
13
|
-
transformer: (token, options) => (0, toPascalCase_1.toPascalCase)([(options === null || options === void 0 ? void 0 : options.prefix) || '', ...token.path]),
|
|
14
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a slash/notation string
|
|
4
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher omitted to match all tokens
|
|
6
|
-
* @transformer returns `string` on slash/notation
|
|
7
|
-
*/
|
|
8
|
-
export declare const namePathToSlashNotation: StyleDictionary.Transform;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToSlashNotation = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a slash/notation string
|
|
6
|
-
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
7
|
-
* @matcher omitted to match all tokens
|
|
8
|
-
* @transformer returns `string` on slash/notation
|
|
9
|
-
*/
|
|
10
|
-
exports.namePathToSlashNotation = {
|
|
11
|
-
type: `name`,
|
|
12
|
-
transformer: (token, options) => {
|
|
13
|
-
return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
|
|
14
|
-
// remove undefined if exists
|
|
15
|
-
.filter((part) => typeof part === 'string' && part !== '@')
|
|
16
|
-
.join('/'));
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description converts w3c shadow tokens in css shadow string
|
|
4
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher matches all tokens of $type `shadow`
|
|
6
|
-
* @transformer returns css shadow `string`
|
|
7
|
-
*/
|
|
8
|
-
export declare const shadowToCss: StyleDictionary.Transform;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shadowToCss = void 0;
|
|
4
|
-
const color2k_1 = require("color2k");
|
|
5
|
-
const filters_1 = require("../filters");
|
|
6
|
-
const alpha_1 = require("./utilities/alpha");
|
|
7
|
-
const checkRequiredTokenProperties_1 = require("./utilities/checkRequiredTokenProperties");
|
|
8
|
-
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
9
|
-
/**
|
|
10
|
-
* @description converts w3c shadow tokens in css shadow string
|
|
11
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
12
|
-
* @matcher matches all tokens of $type `shadow`
|
|
13
|
-
* @transformer returns css shadow `string`
|
|
14
|
-
*/
|
|
15
|
-
exports.shadowToCss = {
|
|
16
|
-
type: `value`,
|
|
17
|
-
transitive: true,
|
|
18
|
-
matcher: filters_1.isShadow,
|
|
19
|
-
transformer: (token) => {
|
|
20
|
-
// extract value
|
|
21
|
-
const { value } = token;
|
|
22
|
-
// turn value into array
|
|
23
|
-
const shadowValues = !Array.isArray(value) ? [value] : value;
|
|
24
|
-
return shadowValues
|
|
25
|
-
.map((shadow) => {
|
|
26
|
-
// if value === string it was probably already transformed
|
|
27
|
-
if (typeof shadow === 'string')
|
|
28
|
-
return shadow;
|
|
29
|
-
(0, checkRequiredTokenProperties_1.checkRequiredTokenProperties)(shadow, ['color', 'offsetX', 'offsetY', 'blur', 'spread']);
|
|
30
|
-
/*css box shadow: inset? | offset-x | offset-y | blur-radius | spread-radius | color */
|
|
31
|
-
return `${shadow.inset === true ? 'inset ' : ''}${shadow.offsetX} ${shadow.offsetY} ${shadow.blur} ${shadow.spread} ${(0, color2k_1.toHex)((0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(Object.assign(Object.assign({}, token), { value: shadow }), 'color'), shadow.alpha || 1, token))}`;
|
|
32
|
-
})
|
|
33
|
-
.join(', ');
|
|
34
|
-
},
|
|
35
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description converts typograhy token value to css font shorthand
|
|
4
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
-
* @matcher matches all tokens of $type `typography`
|
|
6
|
-
* @transformer returns a css font string
|
|
7
|
-
*/
|
|
8
|
-
export declare const typographyToCss: StyleDictionary.Transform;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typographyToCss = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const checkRequiredTokenProperties_1 = require("./utilities/checkRequiredTokenProperties");
|
|
6
|
-
const fontFamilyToCss_1 = require("./fontFamilyToCss");
|
|
7
|
-
const fontWeightToNumber_1 = require("./fontWeightToNumber");
|
|
8
|
-
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
9
|
-
/**
|
|
10
|
-
* @description converts typograhy token value to css font shorthand
|
|
11
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
12
|
-
* @matcher matches all tokens of $type `typography`
|
|
13
|
-
* @transformer returns a css font string
|
|
14
|
-
*/
|
|
15
|
-
exports.typographyToCss = {
|
|
16
|
-
type: `value`,
|
|
17
|
-
transitive: true,
|
|
18
|
-
matcher: filters_1.isTypography,
|
|
19
|
-
transformer: (token) => {
|
|
20
|
-
// extract value
|
|
21
|
-
const value = (0, getTokenValue_1.getTokenValue)(token);
|
|
22
|
-
// validate token properties
|
|
23
|
-
(0, checkRequiredTokenProperties_1.checkRequiredTokenProperties)(value, ['fontWeight', 'fontSize', 'fontFamily']);
|
|
24
|
-
// format output
|
|
25
|
-
return `${value.fontStyle || ''} ${(0, fontWeightToNumber_1.parseFontWeight)((0, getTokenValue_1.getTokenValue)(token, 'fontWeight'))} ${value.fontSize}${value.lineHeight ? `/${value.lineHeight}` : ''} ${(0, fontFamilyToCss_1.parseFontFamily)((0, getTokenValue_1.getTokenValue)(token, 'fontFamily'))}`
|
|
26
|
-
.trim()
|
|
27
|
-
.replace(/\s\s+/g, ' ');
|
|
28
|
-
},
|
|
29
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TransformedToken } from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* alpha
|
|
4
|
-
* @description takes a colors string like hex or rgba and returns an rgba color with the specified alpha value
|
|
5
|
-
* @param color color string like a `#334455` or `rgb(255,200,100)`
|
|
6
|
-
* @param desiredAlpha number
|
|
7
|
-
* @returns rgba value
|
|
8
|
-
*/
|
|
9
|
-
export declare const alpha: (color: string, desiredAlpha: number, token?: TransformedToken) => string;
|