@primer/primitives 9.1.2 → 10.0.0-rc.0c3e84bf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/build/PrimerStyleDictionary.d.ts +1 -2
- package/dist/build/PrimerStyleDictionary.js +52 -64
- package/dist/build/filters/index.d.ts +14 -13
- package/dist/build/filters/index.js +14 -29
- package/dist/build/filters/isBorder.d.ts +3 -3
- package/dist/build/filters/isBorder.js +2 -6
- package/dist/build/filters/isColor.d.ts +3 -3
- package/dist/build/filters/isColor.js +8 -7
- package/dist/build/filters/isColorWithAlpha.d.ts +3 -3
- package/dist/build/filters/isColorWithAlpha.js +4 -8
- package/dist/build/filters/isColorWithMix.d.ts +3 -3
- package/dist/build/filters/isColorWithMix.js +4 -8
- package/dist/build/filters/isCubicBezier.d.ts +7 -0
- package/dist/build/filters/isCubicBezier.js +10 -0
- package/dist/build/filters/isDeprecated.d.ts +3 -3
- package/dist/build/filters/isDeprecated.js +3 -7
- package/dist/build/filters/isDimension.d.ts +3 -3
- package/dist/build/filters/isDimension.js +2 -6
- package/dist/build/filters/isDuration.d.ts +3 -3
- package/dist/build/filters/isDuration.js +2 -6
- package/dist/build/filters/isFontFamily.d.ts +3 -3
- package/dist/build/filters/isFontFamily.js +2 -6
- package/dist/build/filters/isFontWeight.d.ts +3 -3
- package/dist/build/filters/isFontWeight.js +2 -6
- package/dist/build/filters/isFromFile.d.ts +3 -3
- package/dist/build/filters/isFromFile.js +2 -6
- package/dist/build/filters/isNumber.d.ts +3 -3
- package/dist/build/filters/isNumber.js +4 -6
- package/dist/build/filters/isShadow.d.ts +3 -3
- package/dist/build/filters/isShadow.js +2 -6
- package/dist/build/filters/isSource.d.ts +3 -3
- package/dist/build/filters/isSource.js +2 -6
- package/dist/build/filters/isTypography.d.ts +3 -3
- package/dist/build/filters/isTypography.js +2 -6
- package/dist/build/formats/cssAdvanced.d.ts +2 -2
- package/dist/build/formats/cssAdvanced.js +22 -20
- package/dist/build/formats/cssCustomMedia.d.ts +2 -2
- package/dist/build/formats/cssCustomMedia.js +16 -15
- package/dist/build/formats/index.d.ts +9 -9
- package/dist/build/formats/index.js +9 -21
- package/dist/build/formats/javascriptCommonJs.d.ts +2 -2
- package/dist/build/formats/javascriptCommonJs.js +17 -16
- package/dist/build/formats/javascriptEsm.d.ts +2 -2
- package/dist/build/formats/javascriptEsm.js +17 -16
- package/dist/build/formats/jsonFigma.d.ts +2 -2
- package/dist/build/formats/jsonFigma.js +27 -22
- package/dist/build/formats/jsonNestedPrefixed.d.ts +3 -3
- package/dist/build/formats/jsonNestedPrefixed.js +17 -15
- package/dist/build/formats/jsonOneDimensional.d.ts +3 -3
- package/dist/build/formats/jsonOneDimensional.js +24 -16
- package/dist/build/formats/jsonPostCssFallback.d.ts +3 -3
- package/dist/build/formats/jsonPostCssFallback.js +5 -12
- package/dist/build/formats/typescriptExportDefinition.d.ts +2 -2
- package/dist/build/formats/typescriptExportDefinition.js +50 -46
- package/dist/build/formats/utilities/getPropName.d.ts +1 -0
- package/dist/build/formats/utilities/getPropName.js +16 -0
- package/dist/build/formats/utilities/jsonToFlat.d.ts +2 -2
- package/dist/build/formats/utilities/jsonToFlat.js +1 -5
- package/dist/build/formats/utilities/jsonToNestedValue.d.ts +2 -2
- package/dist/build/formats/utilities/jsonToNestedValue.js +4 -6
- package/dist/build/formats/utilities/prefixTokens.d.ts +2 -2
- package/dist/build/formats/utilities/prefixTokens.js +1 -5
- package/dist/build/parsers/index.d.ts +1 -1
- package/dist/build/parsers/index.js +1 -5
- package/dist/build/parsers/w3cJsonParser.d.ts +2 -2
- package/dist/build/parsers/w3cJsonParser.js +7 -9
- package/dist/build/platforms/css.d.ts +1 -1
- package/dist/build/platforms/css.js +20 -11
- package/dist/build/platforms/deprecatedJson.d.ts +1 -1
- package/dist/build/platforms/deprecatedJson.js +3 -7
- package/dist/build/platforms/docJson.d.ts +1 -1
- package/dist/build/platforms/docJson.js +8 -7
- package/dist/build/platforms/fallbacks.d.ts +1 -1
- package/dist/build/platforms/fallbacks.js +3 -7
- package/dist/build/platforms/figma.d.ts +1 -1
- package/dist/build/platforms/figma.js +21 -14
- package/dist/build/platforms/index.d.ts +10 -10
- package/dist/build/platforms/index.js +10 -23
- package/dist/build/platforms/javascript.d.ts +1 -1
- package/dist/build/platforms/javascript.js +3 -7
- package/dist/build/platforms/json.d.ts +1 -1
- package/dist/build/platforms/json.js +3 -7
- package/dist/build/platforms/styleLint.d.ts +1 -1
- package/dist/build/platforms/styleLint.js +3 -7
- package/dist/build/platforms/typeDefinitions.d.ts +1 -1
- package/dist/build/platforms/typeDefinitions.js +6 -10
- package/dist/build/platforms/typescript.d.ts +1 -1
- package/dist/build/platforms/typescript.js +3 -7
- package/dist/build/schemas/alphaValue.js +4 -7
- package/dist/build/schemas/baseToken.d.ts +3 -3
- package/dist/build/schemas/baseToken.js +4 -7
- package/dist/build/schemas/borderToken.d.ts +6 -6
- package/dist/build/schemas/borderToken.js +13 -16
- package/dist/build/schemas/collections.js +8 -14
- package/dist/build/schemas/colorHexValue.js +4 -7
- package/dist/build/schemas/colorToken.d.ts +37 -25
- package/dist/build/schemas/colorToken.js +25 -24
- package/dist/build/schemas/cubicBezierToken.d.ts +18 -0
- package/dist/build/schemas/cubicBezierToken.js +8 -0
- package/dist/build/schemas/designToken.js +30 -32
- package/dist/build/schemas/dimensionToken.d.ts +15 -8
- package/dist/build/schemas/dimensionToken.js +15 -17
- package/dist/build/schemas/dimensionValue.js +7 -10
- package/dist/build/schemas/durationToken.d.ts +6 -6
- package/dist/build/schemas/durationToken.js +8 -11
- package/dist/build/schemas/durationValue.js +4 -7
- package/dist/build/schemas/fontFamilyToken.d.ts +8 -8
- package/dist/build/schemas/fontFamilyToken.js +13 -16
- package/dist/build/schemas/fontWeightToken.d.ts +8 -8
- package/dist/build/schemas/fontWeightToken.js +14 -17
- package/dist/build/schemas/fontWeightValue.js +4 -7
- package/dist/build/schemas/numberToken.d.ts +8 -8
- package/dist/build/schemas/numberToken.js +15 -18
- package/dist/build/schemas/referenceValue.js +4 -7
- package/dist/build/schemas/scopes.js +5 -10
- package/dist/build/schemas/shadowToken.d.ts +23 -16
- package/dist/build/schemas/shadowToken.js +27 -27
- package/dist/build/schemas/stringToken.d.ts +6 -6
- package/dist/build/schemas/stringToken.js +7 -10
- package/dist/build/schemas/tokenName.js +4 -7
- package/dist/build/schemas/tokenType.d.ts +2 -2
- package/dist/build/schemas/tokenType.js +2 -6
- package/dist/build/schemas/typographyToken.d.ts +6 -6
- package/dist/build/schemas/typographyToken.js +14 -17
- package/dist/build/schemas/validTokenType.d.ts +1 -1
- package/dist/build/schemas/validTokenType.js +10 -13
- package/dist/build/schemas/viewportRangeToken.d.ts +6 -6
- package/dist/build/schemas/viewportRangeToken.js +7 -10
- package/dist/build/transformers/borderToCss.d.ts +3 -3
- package/dist/build/transformers/borderToCss.js +16 -16
- package/dist/build/transformers/colorToHex.d.ts +2 -2
- package/dist/build/transformers/colorToHex.js +11 -13
- package/dist/build/transformers/colorToHexMix.d.ts +2 -2
- package/dist/build/transformers/colorToHexMix.js +10 -15
- package/dist/build/transformers/colorToRgbAlpha.d.ts +2 -2
- package/dist/build/transformers/colorToRgbAlpha.js +10 -12
- package/dist/build/transformers/colorToRgbaFloat.d.ts +2 -2
- package/dist/build/transformers/colorToRgbaFloat.js +24 -28
- package/dist/build/transformers/cubicBezierToCss.d.ts +8 -0
- package/dist/build/transformers/cubicBezierToCss.js +23 -0
- package/dist/build/transformers/dimensionToPixelUnitless.d.ts +2 -2
- package/dist/build/transformers/dimensionToPixelUnitless.js +13 -14
- package/dist/build/transformers/dimensionToRem.d.ts +2 -2
- package/dist/build/transformers/dimensionToRem.js +12 -13
- package/dist/build/transformers/dimensionToRemPxArray.d.ts +2 -2
- package/dist/build/transformers/dimensionToRemPxArray.js +11 -12
- package/dist/build/transformers/durationToCss.d.ts +2 -2
- package/dist/build/transformers/durationToCss.js +10 -11
- package/dist/build/transformers/figmaAttributes.d.ts +2 -2
- package/dist/build/transformers/figmaAttributes.js +5 -7
- package/dist/build/transformers/floatToPixel.d.ts +4 -4
- package/dist/build/transformers/floatToPixel.js +12 -14
- package/dist/build/transformers/fontFamilyToCss.d.ts +2 -2
- package/dist/build/transformers/fontFamilyToCss.js +10 -13
- package/dist/build/transformers/fontFamilyToFigma.d.ts +3 -3
- package/dist/build/transformers/fontFamilyToFigma.js +15 -17
- package/dist/build/transformers/fontWeightToNumber.d.ts +2 -2
- package/dist/build/transformers/fontWeightToNumber.js +8 -11
- package/dist/build/transformers/index.d.ts +25 -24
- package/dist/build/transformers/index.js +25 -51
- package/dist/build/transformers/jsonDeprecated.d.ts +2 -2
- package/dist/build/transformers/jsonDeprecated.js +6 -8
- package/dist/build/transformers/namePathToCamelCase.d.ts +2 -2
- package/dist/build/transformers/namePathToCamelCase.js +5 -7
- package/dist/build/transformers/namePathToDotNotation.d.ts +2 -2
- package/dist/build/transformers/namePathToDotNotation.js +6 -8
- package/dist/build/transformers/namePathToFigma.d.ts +3 -3
- package/dist/build/transformers/namePathToFigma.js +5 -8
- package/dist/build/transformers/namePathToKebabCase.d.ts +2 -2
- package/dist/build/transformers/namePathToKebabCase.js +4 -6
- package/dist/build/transformers/namePathToPascalCase.d.ts +2 -2
- package/dist/build/transformers/namePathToPascalCase.js +5 -7
- package/dist/build/transformers/namePathToSlashNotation.d.ts +2 -2
- package/dist/build/transformers/namePathToSlashNotation.js +4 -6
- package/dist/build/transformers/shadowToCss.d.ts +2 -2
- package/dist/build/transformers/shadowToCss.js +14 -15
- package/dist/build/transformers/typographyToCss.d.ts +2 -2
- package/dist/build/transformers/typographyToCss.js +13 -15
- package/dist/build/transformers/utilities/alpha.d.ts +1 -1
- package/dist/build/transformers/utilities/alpha.js +4 -8
- package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +1 -5
- package/dist/build/transformers/utilities/getTokenValue.d.ts +2 -2
- package/dist/build/transformers/utilities/getTokenValue.js +10 -12
- package/dist/build/transformers/utilities/hasSpaceInString.js +1 -5
- package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +1 -1
- package/dist/build/transformers/utilities/hexToRgbaFloat.js +1 -5
- package/dist/build/transformers/utilities/invalidTokenError.d.ts +1 -1
- package/dist/build/transformers/utilities/invalidTokenError.js +11 -10
- package/dist/build/transformers/utilities/isRgbaFloat.js +1 -5
- package/dist/build/transformers/utilities/mix.js +5 -7
- package/dist/build/transformers/utilities/rgbaFloatToHex.js +1 -5
- package/dist/build/types/Border.d.ts +5 -0
- package/dist/build/types/BorderTokenValue.d.ts +10 -0
- package/dist/build/types/ColorHex.d.ts +4 -0
- package/dist/build/types/PlatformInitializer.d.ts +11 -0
- package/dist/build/types/Shadow.d.ts +5 -0
- package/dist/build/types/ShadowTokenValue.d.ts +14 -0
- package/dist/build/types/SizeEm.d.ts +4 -0
- package/dist/build/types/SizePx.d.ts +4 -0
- package/dist/build/types/SizeRem.d.ts +4 -0
- package/dist/build/types/StyleDictionaryConfigGenerator.d.ts +15 -0
- package/dist/build/types/TokenBuildInput.d.ts +8 -0
- package/dist/build/types/TypographyTokenValue.d.ts +12 -0
- package/dist/build/types/w3cTransformedToken.d.ts +8 -0
- package/dist/build/utilities/copyFromDir.d.ts +2 -2
- package/dist/build/utilities/copyFromDir.js +7 -10
- package/dist/build/utilities/filterStringArray.js +1 -5
- package/dist/build/utilities/getFlag.js +1 -5
- package/dist/build/utilities/index.d.ts +9 -3
- package/dist/build/utilities/index.js +9 -9
- package/dist/build/utilities/joinFriendly.js +1 -5
- package/dist/build/utilities/schemaErrorMessage.js +1 -5
- package/dist/build/utilities/toCamelCase.js +5 -9
- package/dist/build/utilities/toPascalCase.js +5 -9
- package/dist/build/utilities/treeWalker.js +2 -6
- package/dist/build/utilities/upperCaseFirstCharacter.js +1 -5
- package/dist/css/base/motion/motion.css +17 -0
- package/dist/css/functional/motion/motion.css +4 -3
- package/dist/css/functional/themes/dark-colorblind.css +58 -38
- package/dist/css/functional/themes/dark-dimmed.css +44 -24
- package/dist/css/functional/themes/dark-high-contrast.css +62 -42
- package/dist/css/functional/themes/dark-tritanopia.css +44 -24
- package/dist/css/functional/themes/dark.css +42 -22
- package/dist/css/functional/themes/light-colorblind.css +60 -40
- package/dist/css/functional/themes/light-high-contrast.css +58 -38
- package/dist/css/functional/themes/light-tritanopia.css +42 -22
- package/dist/css/functional/themes/light.css +42 -22
- package/dist/css/functional/typography/typography.css +43 -43
- package/dist/css/primitives.css +64 -46
- package/dist/docs/base/motion/motion.json +205 -0
- 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 +33 -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 +2561 -4201
- package/dist/docs/functional/themes/dark-dimmed.json +2610 -3892
- package/dist/docs/functional/themes/dark-high-contrast.json +2687 -5815
- package/dist/docs/functional/themes/dark-tritanopia.json +2613 -4059
- package/dist/docs/functional/themes/dark.json +2590 -3450
- package/dist/docs/functional/themes/light-colorblind.json +2568 -4168
- package/dist/docs/functional/themes/light-high-contrast.json +2686 -5526
- package/dist/docs/functional/themes/light-tritanopia.json +2542 -4026
- package/dist/docs/functional/themes/light.json +2570 -3436
- package/dist/docs/functional/typography/typography.json +206 -206
- package/dist/fallbacks/base/motion/motion.json +17 -0
- package/dist/fallbacks/functional/motion/motion.json +1 -0
- package/dist/figma/dimension/dimension.json +492 -492
- package/dist/figma/figma.json +21 -13
- package/dist/figma/scales/dark-dimmed.json +3536 -656
- package/dist/figma/scales/dark-high-constrast.json +3535 -655
- package/dist/figma/scales/dark.json +3371 -491
- package/dist/figma/scales/light-high-constrast.json +3532 -652
- package/dist/figma/scales/light.json +3367 -487
- package/dist/figma/shadows/dark-colorblind.json +199 -199
- package/dist/figma/shadows/dark-dimmed.json +199 -199
- package/dist/figma/shadows/dark-high-contrast.json +199 -199
- package/dist/figma/shadows/dark-tritanopia.json +199 -199
- package/dist/figma/shadows/dark.json +199 -199
- package/dist/figma/shadows/light-colorblind.json +189 -189
- package/dist/figma/shadows/light-high-contrast.json +191 -191
- package/dist/figma/shadows/light-tritanopia.json +189 -189
- package/dist/figma/shadows/light.json +189 -189
- package/dist/figma/themes/dark-colorblind.json +4470 -5204
- package/dist/figma/themes/dark-dimmed.json +4771 -5081
- package/dist/figma/themes/dark-high-contrast.json +4189 -6548
- package/dist/figma/themes/dark-tritanopia.json +4629 -5153
- package/dist/figma/themes/dark.json +5072 -4916
- package/dist/figma/themes/light-colorblind.json +4490 -5127
- package/dist/figma/themes/light-high-contrast.json +4170 -6201
- package/dist/figma/themes/light-tritanopia.json +4525 -5027
- package/dist/figma/themes/light.json +4982 -4825
- package/dist/figma/typography/typography.json +159 -203
- package/dist/internalCss/dark-colorblind.css +58 -38
- package/dist/internalCss/dark-dimmed.css +44 -24
- package/dist/internalCss/dark-high-contrast.css +62 -42
- package/dist/internalCss/dark-tritanopia.css +44 -24
- package/dist/internalCss/dark.css +42 -22
- package/dist/internalCss/light-colorblind.css +60 -40
- package/dist/internalCss/light-high-contrast.css +58 -38
- package/dist/internalCss/light-tritanopia.css +42 -22
- package/dist/internalCss/light.css +42 -22
- package/dist/styleLint/base/motion/motion.json +205 -0
- 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 +27 -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 +1442 -3082
- package/dist/styleLint/functional/themes/dark-dimmed.json +1486 -2768
- package/dist/styleLint/functional/themes/dark-high-contrast.json +1517 -4645
- package/dist/styleLint/functional/themes/dark-tritanopia.json +1480 -2926
- package/dist/styleLint/functional/themes/dark.json +1474 -2334
- package/dist/styleLint/functional/themes/light-colorblind.json +1428 -3028
- package/dist/styleLint/functional/themes/light-high-contrast.json +1524 -4364
- package/dist/styleLint/functional/themes/light-tritanopia.json +1416 -2900
- package/dist/styleLint/functional/themes/light.json +1454 -2320
- package/dist/styleLint/functional/typography/typography.json +114 -114
- package/package.json +33 -32
- package/src/tokens/base/motion/easing.json5 +26 -0
- package/src/tokens/base/motion/timing.json5 +50 -0
- package/src/tokens/functional/color/dark/app-dark.json5 +236 -121
- package/src/tokens/functional/color/dark/data-vis-dark.json5 +40 -40
- package/src/tokens/functional/color/dark/display-dark.json5 +95 -95
- package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +1 -9
- package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +44 -31
- package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +62 -30
- package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +53 -12
- package/src/tokens/functional/color/dark/patterns-dark.json +3963 -0
- package/src/tokens/functional/color/dark/patterns-dark.json5 +126 -277
- package/src/tokens/functional/color/dark/primitives-dark.json5 +81 -81
- package/src/tokens/functional/color/dark/syntax-dark.json5 +47 -47
- package/src/tokens/functional/color/light/app-light.json5 +179 -118
- package/src/tokens/functional/color/light/data-vis-light.json5 +40 -40
- package/src/tokens/functional/color/light/display-light.json5 +0 -95
- package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +25 -27
- package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +62 -34
- package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +63 -11
- package/src/tokens/functional/color/light/patterns-light.json5 +126 -276
- package/src/tokens/functional/color/light/primitives-light.json5 +2 -80
- package/src/tokens/functional/color/light/syntax-light.json5 +0 -47
- package/src/tokens/functional/motion/loading.json5 +1 -1
- package/src/tokens/functional/motion/patterns.json5 +9 -2
- package/src/tokens/functional/shadow/dark.json5 +0 -14
- package/src/tokens/functional/shadow/light.json5 +0 -13
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
6
|
-
const hasSpaceInString_1 = require("./utilities/hasSpaceInString");
|
|
1
|
+
import { isFontFamily } from '../filters/index.js';
|
|
2
|
+
import { getTokenValue } from './utilities/getTokenValue.js';
|
|
3
|
+
import { hasSpaceInString } from './utilities/hasSpaceInString.js';
|
|
7
4
|
/**
|
|
8
5
|
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
9
6
|
* @param value
|
|
10
7
|
* @returns string
|
|
11
8
|
*/
|
|
12
|
-
const parseFontFamily = (value) => {
|
|
9
|
+
export const parseFontFamily = (value) => {
|
|
13
10
|
if (typeof value === 'string') {
|
|
14
11
|
return value;
|
|
15
12
|
}
|
|
@@ -19,22 +16,22 @@ const parseFontFamily = (value) => {
|
|
|
19
16
|
if (typeof string !== 'string') {
|
|
20
17
|
throw new Error(`Invalid value in array ${string}, must be a string`);
|
|
21
18
|
}
|
|
22
|
-
return
|
|
19
|
+
return hasSpaceInString(string) ? `'${string}'` : string;
|
|
23
20
|
})
|
|
24
21
|
.join(', ');
|
|
25
22
|
}
|
|
26
23
|
throw new Error(`Invalid value ${value}, should be a string or array of strings`);
|
|
27
24
|
};
|
|
28
|
-
exports.parseFontFamily = parseFontFamily;
|
|
29
25
|
/**
|
|
30
26
|
* @description converts fontFamily tokens value to string
|
|
31
27
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
32
28
|
* @matcher matches all tokens of $type `fontFamily`
|
|
33
29
|
* @transformer returns a string
|
|
34
30
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
export const fontFamilyToCss = {
|
|
32
|
+
name: 'fontFamily/css',
|
|
33
|
+
type: 'value',
|
|
37
34
|
transitive: true,
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
filter: isFontFamily,
|
|
36
|
+
transform: (token) => parseFontFamily(getTokenValue(token)),
|
|
40
37
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Config, Transform, TransformedToken } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
4
4
|
* @param value
|
|
5
5
|
* @returns string
|
|
6
6
|
*/
|
|
7
|
-
export declare const parseFontFamily: (token:
|
|
7
|
+
export declare const parseFontFamily: (token: TransformedToken, fontFamilies: Record<string, string> | undefined, options: Config) => string;
|
|
8
8
|
/**
|
|
9
9
|
* @description converts fontFamily tokens value to string
|
|
10
10
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
11
11
|
* @matcher matches all tokens of $type `fontFamily`
|
|
12
12
|
* @transformer returns a string
|
|
13
13
|
*/
|
|
14
|
-
export declare const fontFamilyToFigma:
|
|
14
|
+
export declare const fontFamilyToFigma: Transform;
|
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.fontFamilyToFigma = exports.parseFontFamily = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const hasSpaceInString_1 = require("./utilities/hasSpaceInString");
|
|
1
|
+
import { isFontFamily } from '../filters/index.js';
|
|
2
|
+
import { hasSpaceInString } from './utilities/hasSpaceInString.js';
|
|
6
3
|
/**
|
|
7
4
|
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
8
5
|
* @param value
|
|
9
6
|
* @returns string
|
|
10
7
|
*/
|
|
11
|
-
const parseFontFamily = (token, fontFamilies = {}) => {
|
|
8
|
+
export const parseFontFamily = (token, fontFamilies = {}, options) => {
|
|
9
|
+
const valueProp = options.usesDtcg ? '$value' : 'value';
|
|
12
10
|
// return value from fontFamilies
|
|
13
11
|
if (token.name in fontFamilies) {
|
|
14
12
|
return fontFamilies[token.name];
|
|
15
13
|
}
|
|
16
14
|
// return string
|
|
17
|
-
if (typeof token
|
|
18
|
-
return token
|
|
15
|
+
if (typeof token[valueProp] === 'string') {
|
|
16
|
+
return token[valueProp];
|
|
19
17
|
}
|
|
20
18
|
// return stringified array
|
|
21
|
-
if (Array.isArray(token
|
|
22
|
-
return token
|
|
19
|
+
if (Array.isArray(token[valueProp])) {
|
|
20
|
+
return token[valueProp]
|
|
23
21
|
.map((string) => {
|
|
24
22
|
if (typeof string !== 'string') {
|
|
25
23
|
throw new Error(`Invalid value in array ${string}, must be a string`);
|
|
26
24
|
}
|
|
27
|
-
return
|
|
25
|
+
return hasSpaceInString(string) ? `'${string}'` : string;
|
|
28
26
|
})
|
|
29
27
|
.join(', ');
|
|
30
28
|
}
|
|
31
29
|
// invalid value
|
|
32
|
-
throw new Error(`Invalid value ${token
|
|
30
|
+
throw new Error(`Invalid value ${token[valueProp]}, should be a string or array of strings`);
|
|
33
31
|
};
|
|
34
|
-
exports.parseFontFamily = parseFontFamily;
|
|
35
32
|
/**
|
|
36
33
|
* @description converts fontFamily tokens value to string
|
|
37
34
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
38
35
|
* @matcher matches all tokens of $type `fontFamily`
|
|
39
36
|
* @transformer returns a string
|
|
40
37
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
export const fontFamilyToFigma = {
|
|
39
|
+
name: 'fontFamily/figma',
|
|
40
|
+
type: 'value',
|
|
43
41
|
transitive: true,
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
filter: isFontFamily,
|
|
43
|
+
transform: (token, platform, options) => { var _a; return parseFontFamily(token, (_a = platform.options) === null || _a === void 0 ? void 0 : _a.fontFamilies, options); },
|
|
46
44
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
export declare const parseFontWeight: (value: unknown) => number;
|
|
3
3
|
/**
|
|
4
4
|
* @description converts fontWeight tokens value to numeric value
|
|
@@ -6,4 +6,4 @@ export declare const parseFontWeight: (value: unknown) => number;
|
|
|
6
6
|
* @matcher matches all tokens of $type `fontWeight`
|
|
7
7
|
* @transformer returns a number
|
|
8
8
|
*/
|
|
9
|
-
export declare const fontWeightToNumber:
|
|
9
|
+
export declare const fontWeightToNumber: Transform;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.fontWeightToNumber = exports.parseFontWeight = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
1
|
+
import { isFontWeight } from '../filters/index.js';
|
|
2
|
+
import { getTokenValue } from './utilities/getTokenValue.js';
|
|
6
3
|
const fontWeightMatrix = {
|
|
7
4
|
'100': ['thin', 'hairline'],
|
|
8
5
|
'200': ['extra-light', 'ultra-light'],
|
|
@@ -15,7 +12,7 @@ const fontWeightMatrix = {
|
|
|
15
12
|
'900': ['black', 'heavy'],
|
|
16
13
|
'950': ['extra-black', 'ultra-black'],
|
|
17
14
|
};
|
|
18
|
-
const parseFontWeight = (value) => {
|
|
15
|
+
export const parseFontWeight = (value) => {
|
|
19
16
|
// throw on anything but string and number
|
|
20
17
|
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
21
18
|
throw new Error(`Invalid value ${value}, should be a number or fontWeight string`);
|
|
@@ -38,16 +35,16 @@ const parseFontWeight = (value) => {
|
|
|
38
35
|
// invalid value
|
|
39
36
|
throw new Error(`Invalid value ${value}, should be a number or fontWeight string`);
|
|
40
37
|
};
|
|
41
|
-
exports.parseFontWeight = parseFontWeight;
|
|
42
38
|
/**
|
|
43
39
|
* @description converts fontWeight tokens value to numeric value
|
|
44
40
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
45
41
|
* @matcher matches all tokens of $type `fontWeight`
|
|
46
42
|
* @transformer returns a number
|
|
47
43
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
export const fontWeightToNumber = {
|
|
45
|
+
name: 'fontWeight/number',
|
|
46
|
+
type: 'value',
|
|
50
47
|
transitive: true,
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
filter: isFontWeight,
|
|
49
|
+
transform: (token) => parseFontWeight(getTokenValue(token)),
|
|
53
50
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
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 {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
1
|
+
export { borderToCss } from './borderToCss.js';
|
|
2
|
+
export { colorToHex } from './colorToHex.js';
|
|
3
|
+
export { colorToHexMix } from './colorToHexMix.js';
|
|
4
|
+
export { colorToRgbAlpha } from './colorToRgbAlpha.js';
|
|
5
|
+
export { colorToRgbaFloat } from './colorToRgbaFloat.js';
|
|
6
|
+
export { cubicBezierToCss } from './cubicBezierToCss.js';
|
|
7
|
+
export { floatToPixel } from './floatToPixel.js';
|
|
8
|
+
export { floatToPixelUnitless } from './floatToPixel.js';
|
|
9
|
+
export { dimensionToRem } from './dimensionToRem.js';
|
|
10
|
+
export { dimensionToRemPxArray } from './dimensionToRemPxArray.js';
|
|
11
|
+
export { dimensionToPixelUnitless } from './dimensionToPixelUnitless.js';
|
|
12
|
+
export { durationToCss } from './durationToCss.js';
|
|
13
|
+
export { figmaAttributes } from './figmaAttributes.js';
|
|
14
|
+
export { fontFamilyToCss } from './fontFamilyToCss.js';
|
|
15
|
+
export { fontFamilyToFigma } from './fontFamilyToFigma.js';
|
|
16
|
+
export { fontWeightToNumber } from './fontWeightToNumber.js';
|
|
17
|
+
export { jsonDeprecated } from './jsonDeprecated.js';
|
|
18
|
+
export { namePathToCamelCase } from './namePathToCamelCase.js';
|
|
19
|
+
export { namePathToPascalCase } from './namePathToPascalCase.js';
|
|
20
|
+
export { namePathToDotNotation } from './namePathToDotNotation.js';
|
|
21
|
+
export { namePathToFigma } from './namePathToFigma.js';
|
|
22
|
+
export { namePathToKebabCase } from './namePathToKebabCase.js';
|
|
23
|
+
export { namePathToSlashNotation } from './namePathToSlashNotation.js';
|
|
24
|
+
export { shadowToCss } from './shadowToCss.js';
|
|
25
|
+
export { typographyToCss } from './typographyToCss.js';
|
|
@@ -1,51 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
+
export { borderToCss } from './borderToCss.js';
|
|
2
|
+
export { colorToHex } from './colorToHex.js';
|
|
3
|
+
export { colorToHexMix } from './colorToHexMix.js';
|
|
4
|
+
export { colorToRgbAlpha } from './colorToRgbAlpha.js';
|
|
5
|
+
export { colorToRgbaFloat } from './colorToRgbaFloat.js';
|
|
6
|
+
export { cubicBezierToCss } from './cubicBezierToCss.js';
|
|
7
|
+
export { floatToPixel } from './floatToPixel.js';
|
|
8
|
+
export { floatToPixelUnitless } from './floatToPixel.js';
|
|
9
|
+
export { dimensionToRem } from './dimensionToRem.js';
|
|
10
|
+
export { dimensionToRemPxArray } from './dimensionToRemPxArray.js';
|
|
11
|
+
export { dimensionToPixelUnitless } from './dimensionToPixelUnitless.js';
|
|
12
|
+
export { durationToCss } from './durationToCss.js';
|
|
13
|
+
export { figmaAttributes } from './figmaAttributes.js';
|
|
14
|
+
export { fontFamilyToCss } from './fontFamilyToCss.js';
|
|
15
|
+
export { fontFamilyToFigma } from './fontFamilyToFigma.js';
|
|
16
|
+
export { fontWeightToNumber } from './fontWeightToNumber.js';
|
|
17
|
+
export { jsonDeprecated } from './jsonDeprecated.js';
|
|
18
|
+
export { namePathToCamelCase } from './namePathToCamelCase.js';
|
|
19
|
+
export { namePathToPascalCase } from './namePathToPascalCase.js';
|
|
20
|
+
export { namePathToDotNotation } from './namePathToDotNotation.js';
|
|
21
|
+
export { namePathToFigma } from './namePathToFigma.js';
|
|
22
|
+
export { namePathToKebabCase } from './namePathToKebabCase.js';
|
|
23
|
+
export { namePathToSlashNotation } from './namePathToSlashNotation.js';
|
|
24
|
+
export { shadowToCss } from './shadowToCss.js';
|
|
25
|
+
export { typographyToCss } from './typographyToCss.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description replaces tokens value with content of tokens `deprecated` property
|
|
4
4
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher matches all tokens with a `deprecated` property
|
|
6
6
|
* @transformer returns `string` specified in `token.deprecated` or `null`
|
|
7
7
|
*/
|
|
8
|
-
export declare const jsonDeprecated:
|
|
8
|
+
export declare const jsonDeprecated: Transform;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonDeprecated = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
1
|
+
import { isDeprecated } from '../filters/index.js';
|
|
5
2
|
/**
|
|
6
3
|
* @description replaces tokens value with content of tokens `deprecated` property
|
|
7
4
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
8
5
|
* @matcher matches all tokens with a `deprecated` property
|
|
9
6
|
* @transformer returns `string` specified in `token.deprecated` or `null`
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export const jsonDeprecated = {
|
|
9
|
+
name: 'json/deprecated',
|
|
10
|
+
type: 'value',
|
|
13
11
|
transitive: true,
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
filter: isDeprecated,
|
|
13
|
+
transform: (token) => typeof token.$deprecated === 'string' ? token.$deprecated.replace(/[{}]/g, '') : null,
|
|
16
14
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
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
4
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher omitted to match all tokens
|
|
6
6
|
* @transformer returns `string` camelCase
|
|
7
7
|
*/
|
|
8
|
-
export declare const namePathToCamelCase:
|
|
8
|
+
export declare const namePathToCamelCase: Transform;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToCamelCase = void 0;
|
|
4
|
-
const utilities_1 = require("../utilities");
|
|
1
|
+
import { toCamelCase } from '../utilities/index.js';
|
|
5
2
|
/**
|
|
6
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
|
|
7
4
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
8
5
|
* @matcher omitted to match all tokens
|
|
9
6
|
* @transformer returns `string` camelCase
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const namePathToCamelCase = {
|
|
9
|
+
name: 'name/pathToCamelCase',
|
|
10
|
+
type: 'name',
|
|
11
|
+
transform: (token, options) => toCamelCase([(options === null || options === void 0 ? void 0 : options.prefix) || '', ...token.path]),
|
|
14
12
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
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
4
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher omitted to match all tokens
|
|
6
6
|
* @transformer returns `string` in dot.notation
|
|
7
7
|
*/
|
|
8
|
-
export declare const namePathToDotNotation:
|
|
8
|
+
export declare const namePathToDotNotation: Transform;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToDotNotation = void 0;
|
|
4
|
-
const utilities_1 = require("../utilities");
|
|
1
|
+
import { upperCaseFirstCharacter } from '../utilities/index.js';
|
|
5
2
|
/**
|
|
6
3
|
* camelCase
|
|
7
4
|
* @scope custom camelCase implementation should only be used within `name path to dot notation` transformer
|
|
@@ -12,7 +9,7 @@ const utilities_1 = require("../utilities");
|
|
|
12
9
|
const camelCase = (string) => {
|
|
13
10
|
return string
|
|
14
11
|
.split(/[\s-_+]+/g)
|
|
15
|
-
.map((stringPart, index) => (index === 0 ? stringPart :
|
|
12
|
+
.map((stringPart, index) => (index === 0 ? stringPart : upperCaseFirstCharacter(stringPart)))
|
|
16
13
|
.join('');
|
|
17
14
|
};
|
|
18
15
|
/**
|
|
@@ -21,9 +18,10 @@ const camelCase = (string) => {
|
|
|
21
18
|
* @matcher omitted to match all tokens
|
|
22
19
|
* @transformer returns `string` in dot.notation
|
|
23
20
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
export const namePathToDotNotation = {
|
|
22
|
+
name: 'name/pathToDotNotation',
|
|
23
|
+
type: 'name',
|
|
24
|
+
transform: (token, options) => {
|
|
27
25
|
return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
|
|
28
26
|
// remove undefined if exists
|
|
29
27
|
.filter((part) => typeof part === 'string' && part !== '@')
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare const transformNamePathToFigma: (token:
|
|
1
|
+
import type { PlatformConfig, Transform, TransformedToken } from 'style-dictionary/types';
|
|
2
|
+
export declare const transformNamePathToFigma: (token: TransformedToken, options?: PlatformConfig) => string;
|
|
3
3
|
/**
|
|
4
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
5
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
6
6
|
* @matcher omitted to match all tokens
|
|
7
7
|
* @transformer returns `string`
|
|
8
8
|
*/
|
|
9
|
-
export declare const namePathToFigma:
|
|
9
|
+
export declare const namePathToFigma: Transform;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToFigma = exports.transformNamePathToFigma = void 0;
|
|
4
|
-
const transformNamePathToFigma = (token, options) => {
|
|
1
|
+
export const transformNamePathToFigma = (token, options) => {
|
|
5
2
|
let pathArray = token.path.filter((part) => part !== '@');
|
|
6
3
|
if (['fgColor', 'borderColor', 'bgColor'].includes(pathArray[0]) && pathArray.length === 3) {
|
|
7
4
|
pathArray = [pathArray[0], `${pathArray[1]}-${pathArray[2]}`];
|
|
@@ -11,14 +8,14 @@ const transformNamePathToFigma = (token, options) => {
|
|
|
11
8
|
.filter((part) => typeof part === 'string' && part !== '@')
|
|
12
9
|
.join('/'));
|
|
13
10
|
};
|
|
14
|
-
exports.transformNamePathToFigma = transformNamePathToFigma;
|
|
15
11
|
/**
|
|
16
12
|
* @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
13
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
18
14
|
* @matcher omitted to match all tokens
|
|
19
15
|
* @transformer returns `string`
|
|
20
16
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
export const namePathToFigma = {
|
|
18
|
+
name: 'name/pathToFigma',
|
|
19
|
+
type: 'name',
|
|
20
|
+
transform: transformNamePathToFigma,
|
|
24
21
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
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
4
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher omitted to match all tokens
|
|
6
6
|
* @transformer returns `string` kebab-case
|
|
7
7
|
*/
|
|
8
|
-
export declare const namePathToKebabCase:
|
|
8
|
+
export declare const namePathToKebabCase: Transform;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToKebabCase = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @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
3
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
7
4
|
* @matcher omitted to match all tokens
|
|
8
5
|
* @transformer returns `string` kebab-case
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const namePathToKebabCase = {
|
|
8
|
+
name: 'name/pathToKebabCase',
|
|
9
|
+
type: 'name',
|
|
10
|
+
transform: (token, options) => {
|
|
13
11
|
return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
|
|
14
12
|
// remove undefined if exists
|
|
15
13
|
.filter((part) => typeof part === 'string' && part !== '@')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
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
4
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher omitted to match all tokens
|
|
6
6
|
* @transformer returns `string` PascalCase
|
|
7
7
|
*/
|
|
8
|
-
export declare const namePathToPascalCase:
|
|
8
|
+
export declare const namePathToPascalCase: Transform;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToPascalCase = void 0;
|
|
4
|
-
const toPascalCase_1 = require("../utilities/toPascalCase");
|
|
1
|
+
import { toPascalCase } from '../utilities/index.js';
|
|
5
2
|
/**
|
|
6
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
|
|
7
4
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
8
5
|
* @matcher omitted to match all tokens
|
|
9
6
|
* @transformer returns `string` PascalCase
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const namePathToPascalCase = {
|
|
9
|
+
name: 'name/pathToPascalCase',
|
|
10
|
+
type: 'name',
|
|
11
|
+
transform: (token, options) => toPascalCase([(options === null || options === void 0 ? void 0 : options.prefix) || '', ...token.path]),
|
|
14
12
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
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
4
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher omitted to match all tokens
|
|
6
6
|
* @transformer returns `string` on slash/notation
|
|
7
7
|
*/
|
|
8
|
-
export declare const namePathToSlashNotation:
|
|
8
|
+
export declare const namePathToSlashNotation: Transform;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.namePathToSlashNotation = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @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
3
|
* @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
7
4
|
* @matcher omitted to match all tokens
|
|
8
5
|
* @transformer returns `string` on slash/notation
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const namePathToSlashNotation = {
|
|
8
|
+
name: 'name/pathToSlashNotation',
|
|
9
|
+
type: 'name',
|
|
10
|
+
transform: (token, options) => {
|
|
13
11
|
return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
|
|
14
12
|
// remove undefined if exists
|
|
15
13
|
.filter((part) => typeof part === 'string' && part !== '@')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description converts w3c shadow tokens in css shadow string
|
|
4
4
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher matches all tokens of $type `shadow`
|
|
6
6
|
* @transformer returns css shadow `string`
|
|
7
7
|
*/
|
|
8
|
-
export declare const shadowToCss:
|
|
8
|
+
export declare const shadowToCss: Transform;
|