@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,7 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Checks if token is of $type `fontWeight`
|
|
4
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
-
* @returns boolean
|
|
6
|
-
*/
|
|
7
|
-
export declare const isFontWeight: (token: StyleDictionary.TransformedToken) => boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFontWeight = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description Checks if token is of $type `fontWeight`
|
|
6
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
7
|
-
* @returns boolean
|
|
8
|
-
*/
|
|
9
|
-
const isFontWeight = (token) => {
|
|
10
|
-
return token.$type === 'fontWeight';
|
|
11
|
-
};
|
|
12
|
-
exports.isFontWeight = isFontWeight;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Checks if token comes from a specific file
|
|
4
|
-
* @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
-
* @param files - array of file paths
|
|
6
|
-
* @returns boolean
|
|
7
|
-
*/
|
|
8
|
-
export declare const isFromFile: (token: StyleDictionary.TransformedToken, files: string[]) => boolean;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFromFile = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description Checks if token comes from a specific file
|
|
6
|
-
* @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
7
|
-
* @param files - array of file paths
|
|
8
|
-
* @returns boolean
|
|
9
|
-
*/
|
|
10
|
-
const isFromFile = (token, files) => {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
12
|
-
return (files === null || files === void 0 ? void 0 : files.includes(token.filePath)) === true;
|
|
13
|
-
};
|
|
14
|
-
exports.isFromFile = isFromFile;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Checks if token type is a number
|
|
4
|
-
* @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
-
* @returns boolean
|
|
6
|
-
*/
|
|
7
|
-
export declare const isNumber: (token: StyleDictionary.TransformedToken) => boolean;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNumber = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description Checks if token type is a number
|
|
6
|
-
* @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
7
|
-
* @returns boolean
|
|
8
|
-
*/
|
|
9
|
-
const isNumber = (token) => token.$type === 'number';
|
|
10
|
-
exports.isNumber = isNumber;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Checks if token is of $type `shadow`
|
|
4
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
-
* @returns boolean
|
|
6
|
-
*/
|
|
7
|
-
export declare const isShadow: (token: StyleDictionary.TransformedToken) => boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isShadow = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description Checks if token is of $type `shadow`
|
|
6
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
7
|
-
* @returns boolean
|
|
8
|
-
*/
|
|
9
|
-
const isShadow = (token) => {
|
|
10
|
-
return token.$type === 'shadow';
|
|
11
|
-
};
|
|
12
|
-
exports.isShadow = isShadow;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Checks if token is source token
|
|
4
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
-
* @returns boolean
|
|
6
|
-
*/
|
|
7
|
-
export declare const isSource: (token: StyleDictionary.TransformedToken) => boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSource = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description Checks if token is source token
|
|
6
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
7
|
-
* @returns boolean
|
|
8
|
-
*/
|
|
9
|
-
const isSource = (token) => {
|
|
10
|
-
return token.isSource === true;
|
|
11
|
-
};
|
|
12
|
-
exports.isSource = isSource;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Checks if token is of $type `typography`
|
|
4
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
-
* @returns boolean
|
|
6
|
-
*/
|
|
7
|
-
export declare const isTypography: (token: StyleDictionary.TransformedToken) => boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTypography = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description Checks if token is of $type `typography`
|
|
6
|
-
* @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
7
|
-
* @returns boolean
|
|
8
|
-
*/
|
|
9
|
-
const isTypography = (token) => {
|
|
10
|
-
return token.$type === 'typography';
|
|
11
|
-
};
|
|
12
|
-
exports.isTypography = isTypography;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.cssAdvanced = void 0;
|
|
7
|
-
const style_dictionary_1 = __importDefault(require("style-dictionary"));
|
|
8
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
9
|
-
const { fileHeader, formattedVariables } = style_dictionary_1.default.formatHelpers;
|
|
10
|
-
const wrapWithSelector = (css, selector) => {
|
|
11
|
-
// return without selector
|
|
12
|
-
if (selector === false || selector.trim().length === 0)
|
|
13
|
-
return css;
|
|
14
|
-
// return with selector
|
|
15
|
-
return `${selector} { ${css} }`;
|
|
16
|
-
};
|
|
17
|
-
const cssAdvanced = ({ dictionary: originalDictionary, options = {
|
|
18
|
-
queries: [],
|
|
19
|
-
}, file, }) => {
|
|
20
|
-
var _a, _b, _c, _d;
|
|
21
|
-
// get options
|
|
22
|
-
const { outputReferences, formatting } = options;
|
|
23
|
-
// selector
|
|
24
|
-
const selector = ((_a = file.options) === null || _a === void 0 ? void 0 : _a.selector) !== undefined ? file.options.selector : ':root';
|
|
25
|
-
// query extension property
|
|
26
|
-
const queryExtProp = ((_b = file.options) === null || _b === void 0 ? void 0 : _b.queryExtensionProperty) || 'mediaQuery';
|
|
27
|
-
// get queries from file options
|
|
28
|
-
const queries = ((_c = file.options) === null || _c === void 0 ? void 0 : _c.queries) || [
|
|
29
|
-
{
|
|
30
|
-
query: undefined,
|
|
31
|
-
matcher: () => true,
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
// set formatting
|
|
35
|
-
const mergedFormatting = Object.assign({ commentStyle: 'long' }, formatting);
|
|
36
|
-
// clone dictionary
|
|
37
|
-
const dictionary = Object.assign({}, originalDictionary);
|
|
38
|
-
// get queries from tokens
|
|
39
|
-
for (const designToken of dictionary.allTokens) {
|
|
40
|
-
const query = (_d = designToken.$extensions) === null || _d === void 0 ? void 0 : _d[queryExtProp];
|
|
41
|
-
// early abort if query does not exist on token
|
|
42
|
-
if (!query)
|
|
43
|
-
continue;
|
|
44
|
-
// if query exists already from other token
|
|
45
|
-
const currentQueryIndex = queries.findIndex((q) => q.query === query);
|
|
46
|
-
// if query exists
|
|
47
|
-
if (currentQueryIndex > -1) {
|
|
48
|
-
queries[currentQueryIndex] = Object.assign(Object.assign({}, queries[currentQueryIndex]), { matcher: (token) => queries[currentQueryIndex].matcher(token) ||
|
|
49
|
-
token.$extensions[queryExtProp] === queries[currentQueryIndex].query });
|
|
50
|
-
}
|
|
51
|
-
// if query does not exist
|
|
52
|
-
else {
|
|
53
|
-
queries.push({
|
|
54
|
-
query,
|
|
55
|
-
matcher: (token) => { var _a; return ((_a = token.$extensions) === null || _a === void 0 ? void 0 : _a[queryExtProp]) === query; },
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// add file header
|
|
60
|
-
const output = [fileHeader({ file })];
|
|
61
|
-
// add single theme css
|
|
62
|
-
for (const query of queries) {
|
|
63
|
-
const { query: queryString, matcher } = query;
|
|
64
|
-
// filter tokens to only include the ones that pass the matcher
|
|
65
|
-
const filteredDictionary = Object.assign(Object.assign({}, dictionary), { allTokens: dictionary.allTokens.filter(matcher || (() => true)) });
|
|
66
|
-
// early abort if no matches
|
|
67
|
-
if (!filteredDictionary.allTokens.length)
|
|
68
|
-
continue;
|
|
69
|
-
// add tokens into root
|
|
70
|
-
const css = formattedVariables({
|
|
71
|
-
format: 'css',
|
|
72
|
-
dictionary: filteredDictionary,
|
|
73
|
-
outputReferences,
|
|
74
|
-
formatting: mergedFormatting,
|
|
75
|
-
});
|
|
76
|
-
// wrap css
|
|
77
|
-
const cssWithSelector = wrapWithSelector(css, query.selector !== undefined ? query.selector : selector);
|
|
78
|
-
// add css with or without query
|
|
79
|
-
output.push(queryString ? `${queryString} { ${cssWithSelector} }` : cssWithSelector);
|
|
80
|
-
}
|
|
81
|
-
// return prettified
|
|
82
|
-
return sync_1.default.format(output.join('\n'), { parser: 'css', printWidth: 500 });
|
|
83
|
-
};
|
|
84
|
-
exports.cssAdvanced = cssAdvanced;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to css with @custom-media
|
|
4
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
5
|
-
* @returns formatted `string`
|
|
6
|
-
*/
|
|
7
|
-
export declare const cssCustomMedia: StyleDictionary.Formatter;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.cssCustomMedia = void 0;
|
|
7
|
-
const style_dictionary_1 = __importDefault(require("style-dictionary"));
|
|
8
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
9
|
-
const { fileHeader } = style_dictionary_1.default.formatHelpers;
|
|
10
|
-
/**
|
|
11
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to css with @custom-media
|
|
12
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
13
|
-
* @returns formatted `string`
|
|
14
|
-
*/
|
|
15
|
-
const cssCustomMedia = ({ dictionary, options: _options, file, }) => {
|
|
16
|
-
// add file header
|
|
17
|
-
const output = [fileHeader({ file })];
|
|
18
|
-
// add single theme css
|
|
19
|
-
dictionary.allTokens.map(({ name, value }) => {
|
|
20
|
-
output.push(`@custom-media --${name} ${value};`);
|
|
21
|
-
});
|
|
22
|
-
// return prettified
|
|
23
|
-
return sync_1.default.format(output.join('\n'), { parser: 'css', printWidth: 500 });
|
|
24
|
-
};
|
|
25
|
-
exports.cssCustomMedia = cssCustomMedia;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { cssCustomMedia } from './cssCustomMedia';
|
|
2
|
-
export { cssAdvanced } from './cssAdvanced';
|
|
3
|
-
export { jsonFigma } from './jsonFigma';
|
|
4
|
-
export { javascriptCommonJs } from './javascriptCommonJs';
|
|
5
|
-
export { javascriptEsm } from './javascriptEsm';
|
|
6
|
-
export { jsonNestedPrefixed } from './jsonNestedPrefixed';
|
|
7
|
-
export { jsonOneDimensional } from './jsonOneDimensional';
|
|
8
|
-
export { jsonPostCssFallback } from './jsonPostCssFallback';
|
|
9
|
-
export { typescriptExportDefinition } from './typescriptExportDefinition';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescriptExportDefinition = exports.jsonPostCssFallback = exports.jsonOneDimensional = exports.jsonNestedPrefixed = exports.javascriptEsm = exports.javascriptCommonJs = exports.jsonFigma = exports.cssAdvanced = exports.cssCustomMedia = void 0;
|
|
4
|
-
var cssCustomMedia_1 = require("./cssCustomMedia");
|
|
5
|
-
Object.defineProperty(exports, "cssCustomMedia", { enumerable: true, get: function () { return cssCustomMedia_1.cssCustomMedia; } });
|
|
6
|
-
var cssAdvanced_1 = require("./cssAdvanced");
|
|
7
|
-
Object.defineProperty(exports, "cssAdvanced", { enumerable: true, get: function () { return cssAdvanced_1.cssAdvanced; } });
|
|
8
|
-
var jsonFigma_1 = require("./jsonFigma");
|
|
9
|
-
Object.defineProperty(exports, "jsonFigma", { enumerable: true, get: function () { return jsonFigma_1.jsonFigma; } });
|
|
10
|
-
var javascriptCommonJs_1 = require("./javascriptCommonJs");
|
|
11
|
-
Object.defineProperty(exports, "javascriptCommonJs", { enumerable: true, get: function () { return javascriptCommonJs_1.javascriptCommonJs; } });
|
|
12
|
-
var javascriptEsm_1 = require("./javascriptEsm");
|
|
13
|
-
Object.defineProperty(exports, "javascriptEsm", { enumerable: true, get: function () { return javascriptEsm_1.javascriptEsm; } });
|
|
14
|
-
var jsonNestedPrefixed_1 = require("./jsonNestedPrefixed");
|
|
15
|
-
Object.defineProperty(exports, "jsonNestedPrefixed", { enumerable: true, get: function () { return jsonNestedPrefixed_1.jsonNestedPrefixed; } });
|
|
16
|
-
var jsonOneDimensional_1 = require("./jsonOneDimensional");
|
|
17
|
-
Object.defineProperty(exports, "jsonOneDimensional", { enumerable: true, get: function () { return jsonOneDimensional_1.jsonOneDimensional; } });
|
|
18
|
-
var jsonPostCssFallback_1 = require("./jsonPostCssFallback");
|
|
19
|
-
Object.defineProperty(exports, "jsonPostCssFallback", { enumerable: true, get: function () { return jsonPostCssFallback_1.jsonPostCssFallback; } });
|
|
20
|
-
var typescriptExportDefinition_1 = require("./typescriptExportDefinition");
|
|
21
|
-
Object.defineProperty(exports, "typescriptExportDefinition", { enumerable: true, get: function () { return typescriptExportDefinition_1.typescriptExportDefinition; } });
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to javascript commonJS module
|
|
4
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
5
|
-
* @returns formatted `string`
|
|
6
|
-
*/
|
|
7
|
-
export declare const javascriptCommonJs: StyleDictionary.Formatter;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.javascriptCommonJs = void 0;
|
|
7
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
8
|
-
const jsonToNestedValue_1 = require("./utilities/jsonToNestedValue");
|
|
9
|
-
const prefixTokens_1 = require("./utilities/prefixTokens");
|
|
10
|
-
const style_dictionary_1 = __importDefault(require("style-dictionary"));
|
|
11
|
-
const { fileHeader } = style_dictionary_1.default.formatHelpers;
|
|
12
|
-
/**
|
|
13
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to javascript commonJS module
|
|
14
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
15
|
-
* @returns formatted `string`
|
|
16
|
-
*/
|
|
17
|
-
const javascriptCommonJs = ({ dictionary, file, platform }) => {
|
|
18
|
-
// add prefix if defined
|
|
19
|
-
const tokens = (0, prefixTokens_1.prefixTokens)(dictionary.tokens, platform);
|
|
20
|
-
// add file header and convert output
|
|
21
|
-
const output = `${fileHeader({ file })}module.exports = ${JSON.stringify((0, jsonToNestedValue_1.jsonToNestedValue)(tokens), null, 2)}\n`;
|
|
22
|
-
// return prettified
|
|
23
|
-
return sync_1.default.format(output, { parser: 'typescript', printWidth: 500 });
|
|
24
|
-
};
|
|
25
|
-
exports.javascriptCommonJs = javascriptCommonJs;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to javascript esm (javascript export statement)
|
|
4
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
5
|
-
* @returns formatted `string`
|
|
6
|
-
*/
|
|
7
|
-
export declare const javascriptEsm: StyleDictionary.Formatter;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.javascriptEsm = void 0;
|
|
7
|
-
const style_dictionary_1 = __importDefault(require("style-dictionary"));
|
|
8
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
9
|
-
const jsonToNestedValue_1 = require("./utilities/jsonToNestedValue");
|
|
10
|
-
const prefixTokens_1 = require("./utilities/prefixTokens");
|
|
11
|
-
const { fileHeader } = style_dictionary_1.default.formatHelpers;
|
|
12
|
-
/**
|
|
13
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to javascript esm (javascript export statement)
|
|
14
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
15
|
-
* @returns formatted `string`
|
|
16
|
-
*/
|
|
17
|
-
const javascriptEsm = ({ dictionary, file, platform }) => {
|
|
18
|
-
// add prefix if defined
|
|
19
|
-
const tokens = (0, prefixTokens_1.prefixTokens)(dictionary.tokens, platform);
|
|
20
|
-
// add file header and convert output
|
|
21
|
-
const output = `${fileHeader({ file })}export default \n${JSON.stringify((0, jsonToNestedValue_1.jsonToNestedValue)(tokens), null, 2)}\n`;
|
|
22
|
-
// return prettified
|
|
23
|
-
return sync_1.default.format(output, { parser: 'typescript', printWidth: 500 });
|
|
24
|
-
};
|
|
25
|
-
exports.javascriptEsm = javascriptEsm;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to javascript esm (javascript export statement)
|
|
4
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
5
|
-
* @returns formatted `string`
|
|
6
|
-
*/
|
|
7
|
-
export declare const jsonFigma: StyleDictionary.Formatter;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.jsonFigma = void 0;
|
|
7
|
-
const style_dictionary_1 = __importDefault(require("style-dictionary"));
|
|
8
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
9
|
-
const namePathToFigma_1 = require("../transformers/namePathToFigma");
|
|
10
|
-
const hexToRgbaFloat_1 = require("../transformers/utilities/hexToRgbaFloat");
|
|
11
|
-
const isRgbaFloat_1 = require("../transformers/utilities/isRgbaFloat");
|
|
12
|
-
const { sortByReference } = style_dictionary_1.default.formatHelpers;
|
|
13
|
-
const isReference = (string) => /^\{([^\\]*)\}$/g.test(string);
|
|
14
|
-
const getReference = (dictionary, refString, platform) => {
|
|
15
|
-
var _a;
|
|
16
|
-
if (isReference(refString)) {
|
|
17
|
-
// retrieve reference token
|
|
18
|
-
const refToken = dictionary.getReferences(refString)[0];
|
|
19
|
-
// return full reference
|
|
20
|
-
return [(_a = refToken.attributes) === null || _a === void 0 ? void 0 : _a.collection, (0, namePathToFigma_1.transformNamePathToFigma)(refToken, platform)].filter(Boolean).join('/');
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const getFigmaType = (type) => {
|
|
24
|
-
const validTypes = {
|
|
25
|
-
color: 'COLOR',
|
|
26
|
-
dimension: 'FLOAT',
|
|
27
|
-
fontWeight: 'FLOAT',
|
|
28
|
-
number: 'FLOAT',
|
|
29
|
-
fontFamily: 'STRING',
|
|
30
|
-
};
|
|
31
|
-
if (type in validTypes)
|
|
32
|
-
return validTypes[type];
|
|
33
|
-
throw new Error(`Invalid type: ${type}`);
|
|
34
|
-
};
|
|
35
|
-
const shadowToVariables = (name, values, token) => {
|
|
36
|
-
// floatValue
|
|
37
|
-
const floatValue = (property) => ({
|
|
38
|
-
name: `${name}/${property}`,
|
|
39
|
-
value: parseInt(values[property].replace('px', '')),
|
|
40
|
-
type: 'FLOAT',
|
|
41
|
-
scopes: ['EFFECT_FLOAT'],
|
|
42
|
-
mode,
|
|
43
|
-
collection,
|
|
44
|
-
group,
|
|
45
|
-
});
|
|
46
|
-
const { attributes } = token;
|
|
47
|
-
const { mode, collection, group } = attributes || {};
|
|
48
|
-
return [
|
|
49
|
-
floatValue('offsetX'),
|
|
50
|
-
floatValue('offsetY'),
|
|
51
|
-
floatValue('blur'),
|
|
52
|
-
floatValue('spread'),
|
|
53
|
-
{
|
|
54
|
-
name: `${name}/color`,
|
|
55
|
-
value: (0, isRgbaFloat_1.isRgbaFloat)(values.color)
|
|
56
|
-
? Object.assign(Object.assign({}, values.color), (values.alpha ? { a: values.alpha } : {})) : (0, hexToRgbaFloat_1.hexToRgbaFloat)(values.color, values.alpha),
|
|
57
|
-
type: 'COLOR',
|
|
58
|
-
scopes: ['EFFECT_COLOR'],
|
|
59
|
-
mode,
|
|
60
|
-
collection,
|
|
61
|
-
group,
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to javascript esm (javascript export statement)
|
|
67
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
68
|
-
* @returns formatted `string`
|
|
69
|
-
*/
|
|
70
|
-
const jsonFigma = ({ dictionary, file: _file, platform }) => {
|
|
71
|
-
// array to store tokens in
|
|
72
|
-
const tokens = [];
|
|
73
|
-
// loop through tokens sorted by reference
|
|
74
|
-
for (const token of dictionary.allTokens.sort(sortByReference(dictionary))) {
|
|
75
|
-
// deconstruct token
|
|
76
|
-
const { attributes, value, $type, comment: description, original, alpha, mix } = token;
|
|
77
|
-
const { mode, collection, scopes, group, codeSyntax } = attributes || {};
|
|
78
|
-
// shadows need to be specifically dealt with
|
|
79
|
-
if ($type === 'shadow') {
|
|
80
|
-
const shadowValues = !Array.isArray(value) ? [value] : value;
|
|
81
|
-
// if only one set of shadow values is present
|
|
82
|
-
if (shadowValues.length === 1) {
|
|
83
|
-
tokens.push(...shadowToVariables(token.name, shadowValues[0], Object.assign(Object.assign({}, token), (platform.mode ? { mode: platform.mode } : {}))));
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
// if multiple shadow sets values are present we need loop through them and add the index to the name
|
|
87
|
-
for (const [index, stepValue] of shadowValues.entries()) {
|
|
88
|
-
tokens.push(...shadowToVariables(`${token.name}/${index + 1}`, stepValue, Object.assign(Object.assign({}, token), (platform.mode ? { mode: platform.mode } : {}))));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// other tokens just get added to tokens array
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
tokens.push({
|
|
95
|
-
name: token.name,
|
|
96
|
-
value,
|
|
97
|
-
type: getFigmaType($type),
|
|
98
|
-
alpha,
|
|
99
|
-
isMix: mix ? true : undefined,
|
|
100
|
-
description,
|
|
101
|
-
refId: [collection, token.name].filter(Boolean).join('/'),
|
|
102
|
-
reference: getReference(dictionary, original.value, platform),
|
|
103
|
-
collection,
|
|
104
|
-
mode,
|
|
105
|
-
group,
|
|
106
|
-
scopes,
|
|
107
|
-
codeSyntax,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// add file header and convert output
|
|
112
|
-
const output = JSON.stringify(tokens, null, 2);
|
|
113
|
-
// return prettified
|
|
114
|
-
return sync_1.default.format(output, { parser: 'json', printWidth: 500 });
|
|
115
|
-
};
|
|
116
|
-
exports.jsonFigma = jsonFigma;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Takes a style dictionary token dictionary and converts it to a nested json string.
|
|
4
|
-
* In contrast to the `json/nested` this formatter does add a prefix if provided
|
|
5
|
-
* @param StyleDictionary.FormatterArguments
|
|
6
|
-
* @returns formatted json `string`
|
|
7
|
-
*/
|
|
8
|
-
export declare const jsonNestedPrefixed: StyleDictionary.Formatter;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.jsonNestedPrefixed = void 0;
|
|
7
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
8
|
-
const prefixTokens_1 = require("./utilities/prefixTokens");
|
|
9
|
-
const jsonToNestedValue_1 = require("./utilities/jsonToNestedValue");
|
|
10
|
-
/**
|
|
11
|
-
* @description Takes a style dictionary token dictionary and converts it to a nested json string.
|
|
12
|
-
* In contrast to the `json/nested` this formatter does add a prefix if provided
|
|
13
|
-
* @param StyleDictionary.FormatterArguments
|
|
14
|
-
* @returns formatted json `string`
|
|
15
|
-
*/
|
|
16
|
-
const jsonNestedPrefixed = ({ dictionary, file: _file, options, platform }) => {
|
|
17
|
-
const { outputVerbose } = options;
|
|
18
|
-
// add prefix if defined
|
|
19
|
-
let tokens = (0, prefixTokens_1.prefixTokens)(dictionary.tokens, platform);
|
|
20
|
-
if (!outputVerbose) {
|
|
21
|
-
tokens = (0, jsonToNestedValue_1.jsonToNestedValue)(tokens);
|
|
22
|
-
}
|
|
23
|
-
// add file header and convert output
|
|
24
|
-
const output = JSON.stringify(tokens, null, 2);
|
|
25
|
-
// return prettified
|
|
26
|
-
return sync_1.default.format(output, { parser: 'json', printWidth: 500 });
|
|
27
|
-
};
|
|
28
|
-
exports.jsonNestedPrefixed = jsonNestedPrefixed;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
|
|
4
|
-
* @param StyleDictionary.FormatterArguments
|
|
5
|
-
* @param options.nameSeparator - separator to use for nested token name
|
|
6
|
-
* @returns formatted json `string`
|
|
7
|
-
*/
|
|
8
|
-
export declare const jsonOneDimensional: StyleDictionary.Formatter;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.jsonOneDimensional = void 0;
|
|
7
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
8
|
-
const jsonToFlat_1 = require("./utilities/jsonToFlat");
|
|
9
|
-
/**
|
|
10
|
-
* @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
|
|
11
|
-
* @param StyleDictionary.FormatterArguments
|
|
12
|
-
* @param options.nameSeparator - separator to use for nested token name
|
|
13
|
-
* @returns formatted json `string`
|
|
14
|
-
*/
|
|
15
|
-
const jsonOneDimensional = ({ dictionary, file: _file, options }) => {
|
|
16
|
-
// option to allow verbose output (object) or just the value
|
|
17
|
-
const { outputVerbose } = options;
|
|
18
|
-
const tokens = (0, jsonToFlat_1.jsonToFlat)(dictionary.allTokens, outputVerbose);
|
|
19
|
-
// add file header and convert output
|
|
20
|
-
const output = JSON.stringify(tokens, null, 2);
|
|
21
|
-
// return prettified
|
|
22
|
-
return sync_1.default.format(output, { parser: 'json', printWidth: 500 });
|
|
23
|
-
};
|
|
24
|
-
exports.jsonOneDimensional = jsonOneDimensional;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
|
|
4
|
-
* @param StyleDictionary.FormatterArguments
|
|
5
|
-
* @param options.nameSeparator - separator to use for nested token name
|
|
6
|
-
* @returns formatted json `string`
|
|
7
|
-
*/
|
|
8
|
-
export declare const jsonPostCssFallback: StyleDictionary.Formatter;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.jsonPostCssFallback = void 0;
|
|
7
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
8
|
-
/**
|
|
9
|
-
* @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
|
|
10
|
-
* @param StyleDictionary.FormatterArguments
|
|
11
|
-
* @param options.nameSeparator - separator to use for nested token name
|
|
12
|
-
* @returns formatted json `string`
|
|
13
|
-
*/
|
|
14
|
-
const jsonPostCssFallback = ({ dictionary, file: _file }) => {
|
|
15
|
-
const tokens = Object.fromEntries(dictionary.allTokens.map(token => [`--${token.name}`, token.value]));
|
|
16
|
-
// add file header and convert output
|
|
17
|
-
const output = JSON.stringify(tokens, null, 2);
|
|
18
|
-
// return prettified
|
|
19
|
-
return sync_1.default.format(output, { parser: 'json', printWidth: 500 });
|
|
20
|
-
};
|
|
21
|
-
exports.jsonPostCssFallback = jsonPostCssFallback;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to typescript definition
|
|
4
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
5
|
-
* @returns formatted `string`
|
|
6
|
-
*/
|
|
7
|
-
export declare const typescriptExportDefinition: StyleDictionary.Formatter;
|