@primer/primitives 9.0.3 → 9.1.0-rc.c6c17c46
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/build/PrimerStyleDictionary.d.ts +9 -0
- package/dist/build/PrimerStyleDictionary.js +92 -0
- package/dist/build/filters/index.d.ts +13 -0
- package/dist/build/filters/index.js +29 -0
- package/{src/filters/isBorder.ts → dist/build/filters/isBorder.d.ts} +2 -5
- package/dist/build/filters/isBorder.js +12 -0
- package/{src/filters/isColor.ts → dist/build/filters/isColor.d.ts} +2 -5
- package/dist/build/filters/isColor.js +12 -0
- package/dist/build/filters/isColorWithAlpha.d.ts +7 -0
- package/dist/build/filters/isColorWithAlpha.js +13 -0
- package/dist/build/filters/isColorWithMix.d.ts +7 -0
- package/dist/build/filters/isColorWithMix.js +28 -0
- package/{src/filters/isDeprecated.ts → dist/build/filters/isDeprecated.d.ts} +2 -5
- package/dist/build/filters/isDeprecated.js +12 -0
- package/{src/filters/isDimension.ts → dist/build/filters/isDimension.d.ts} +2 -5
- package/dist/build/filters/isDimension.js +12 -0
- package/{src/filters/isDuration.ts → dist/build/filters/isDuration.d.ts} +2 -5
- package/dist/build/filters/isDuration.js +12 -0
- package/{src/filters/isFontFamily.ts → dist/build/filters/isFontFamily.d.ts} +2 -5
- package/dist/build/filters/isFontFamily.js +12 -0
- package/{src/filters/isFontWeight.ts → dist/build/filters/isFontWeight.d.ts} +2 -5
- package/dist/build/filters/isFontWeight.js +12 -0
- package/dist/build/filters/isFromFile.d.ts +8 -0
- package/dist/build/filters/isFromFile.js +14 -0
- package/{src/filters/isNumber.ts → dist/build/filters/isNumber.d.ts} +2 -3
- package/dist/build/filters/isNumber.js +10 -0
- package/{src/filters/isShadow.ts → dist/build/filters/isShadow.d.ts} +2 -5
- package/dist/build/filters/isShadow.js +12 -0
- package/{src/filters/isSource.ts → dist/build/filters/isSource.d.ts} +2 -5
- package/dist/build/filters/isSource.js +12 -0
- package/{src/filters/isTypography.ts → dist/build/filters/isTypography.d.ts} +2 -5
- package/dist/build/filters/isTypography.js +12 -0
- package/dist/build/formats/cssAdvanced.d.ts +2 -0
- package/dist/build/formats/cssAdvanced.js +85 -0
- package/dist/build/formats/cssCustomMedia.d.ts +7 -0
- package/dist/build/formats/cssCustomMedia.js +25 -0
- package/dist/build/formats/index.d.ts +9 -0
- package/dist/build/formats/index.js +21 -0
- package/dist/build/formats/javascriptCommonJs.d.ts +7 -0
- package/dist/build/formats/javascriptCommonJs.js +25 -0
- package/dist/build/formats/javascriptEsm.d.ts +7 -0
- package/dist/build/formats/javascriptEsm.js +25 -0
- package/dist/build/formats/jsonFigma.d.ts +7 -0
- package/dist/build/formats/jsonFigma.js +116 -0
- package/dist/build/formats/jsonNestedPrefixed.d.ts +8 -0
- package/dist/build/formats/jsonNestedPrefixed.js +28 -0
- package/dist/build/formats/jsonOneDimensional.d.ts +8 -0
- package/dist/build/formats/jsonOneDimensional.js +24 -0
- package/dist/build/formats/jsonPostCssFallback.d.ts +8 -0
- package/dist/build/formats/jsonPostCssFallback.js +21 -0
- package/dist/build/formats/typescriptExportDefinition.d.ts +7 -0
- package/dist/build/formats/typescriptExportDefinition.js +166 -0
- package/{src/formats/utilities/jsonToFlat.ts → dist/build/formats/utilities/jsonToFlat.d.ts} +4 -3
- package/dist/build/formats/utilities/jsonToFlat.js +12 -0
- package/dist/build/formats/utilities/jsonToNestedValue.d.ts +8 -0
- package/dist/build/formats/utilities/jsonToNestedValue.js +25 -0
- package/dist/build/formats/utilities/prefixTokens.d.ts +8 -0
- package/dist/build/formats/utilities/prefixTokens.js +17 -0
- package/dist/build/parsers/index.d.ts +1 -0
- package/dist/build/parsers/index.js +5 -0
- package/dist/build/parsers/w3cJsonParser.d.ts +6 -0
- package/dist/build/parsers/w3cJsonParser.js +27 -0
- package/dist/build/platforms/css.d.ts +2 -0
- package/dist/build/platforms/css.js +88 -0
- package/dist/build/platforms/deprecatedJson.d.ts +2 -0
- package/dist/build/platforms/deprecatedJson.js +17 -0
- package/dist/build/platforms/docJson.d.ts +2 -0
- package/dist/build/platforms/docJson.js +35 -0
- package/dist/build/platforms/fallbacks.d.ts +2 -0
- package/dist/build/platforms/fallbacks.js +35 -0
- package/dist/build/platforms/figma.d.ts +2 -0
- package/dist/build/platforms/figma.js +53 -0
- package/dist/build/platforms/index.d.ts +10 -0
- package/dist/build/platforms/index.js +23 -0
- package/dist/build/platforms/javascript.d.ts +2 -0
- package/dist/build/platforms/javascript.js +31 -0
- package/dist/build/platforms/json.d.ts +2 -0
- package/dist/build/platforms/json.js +33 -0
- package/dist/build/platforms/styleLint.d.ts +2 -0
- package/dist/build/platforms/styleLint.js +35 -0
- package/dist/build/platforms/typeDefinitions.d.ts +2 -0
- package/dist/build/platforms/typeDefinitions.js +31 -0
- package/dist/build/platforms/typescript.d.ts +2 -0
- package/dist/build/platforms/typescript.js +31 -0
- package/dist/build/schemas/alphaValue.d.ts +2 -0
- package/dist/build/schemas/alphaValue.js +8 -0
- package/dist/build/schemas/baseToken.d.ts +11 -0
- package/dist/build/schemas/baseToken.js +10 -0
- package/dist/build/schemas/borderToken.d.ts +51 -0
- package/dist/build/schemas/borderToken.js +20 -0
- package/dist/build/schemas/collections.d.ts +6 -0
- package/dist/build/schemas/collections.js +18 -0
- package/dist/build/schemas/colorHexValue.d.ts +2 -0
- package/dist/build/schemas/colorHexValue.js +12 -0
- package/dist/build/schemas/colorToken.d.ts +80 -0
- package/dist/build/schemas/colorToken.js +52 -0
- package/dist/build/schemas/designToken.d.ts +2 -0
- package/dist/build/schemas/designToken.js +37 -0
- package/dist/build/schemas/dimensionToken.d.ts +52 -0
- package/dist/build/schemas/dimensionToken.js +36 -0
- package/dist/build/schemas/dimensionValue.d.ts +2 -0
- package/dist/build/schemas/dimensionValue.js +12 -0
- package/dist/build/schemas/durationToken.d.ts +18 -0
- package/dist/build/schemas/durationToken.js +14 -0
- package/dist/build/schemas/durationValue.d.ts +2 -0
- package/dist/build/schemas/durationValue.js +8 -0
- package/dist/build/schemas/fontFamilyToken.d.ts +52 -0
- package/dist/build/schemas/fontFamilyToken.js +23 -0
- package/dist/build/schemas/fontWeightToken.d.ts +52 -0
- package/dist/build/schemas/fontWeightToken.js +24 -0
- package/dist/build/schemas/fontWeightValue.d.ts +2 -0
- package/dist/build/schemas/fontWeightValue.js +9 -0
- package/dist/build/schemas/numberToken.d.ts +71 -0
- package/dist/build/schemas/numberToken.js +30 -0
- package/dist/build/schemas/referenceValue.d.ts +2 -0
- package/dist/build/schemas/referenceValue.js +8 -0
- package/dist/build/schemas/scopes.d.ts +5 -0
- package/dist/build/schemas/scopes.js +34 -0
- package/dist/build/schemas/shadowToken.d.ts +157 -0
- package/dist/build/schemas/shadowToken.js +46 -0
- package/dist/build/schemas/stringToken.d.ts +18 -0
- package/dist/build/schemas/stringToken.js +13 -0
- package/dist/build/schemas/tokenName.d.ts +2 -0
- package/dist/build/schemas/tokenName.js +8 -0
- package/dist/build/schemas/tokenType.d.ts +3 -0
- package/dist/build/schemas/tokenType.js +6 -0
- package/dist/build/schemas/typographyToken.d.ts +59 -0
- package/dist/build/schemas/typographyToken.js +21 -0
- package/dist/build/schemas/validTokenType.d.ts +5 -0
- package/dist/build/schemas/validTokenType.js +34 -0
- package/dist/build/schemas/viewportRangeToken.d.ts +18 -0
- package/dist/build/schemas/viewportRangeToken.js +13 -0
- package/dist/build/transformers/borderToCss.d.ts +8 -0
- package/dist/build/transformers/borderToCss.js +38 -0
- package/dist/build/transformers/colorToHex.d.ts +8 -0
- package/dist/build/transformers/colorToHex.js +18 -0
- package/dist/build/transformers/colorToHexAlpha.d.ts +8 -0
- package/dist/build/transformers/colorToHexAlpha.js +25 -0
- package/dist/build/transformers/colorToHexMix.d.ts +8 -0
- package/dist/build/transformers/colorToHexMix.js +25 -0
- package/dist/build/transformers/colorToRgbAlpha.d.ts +8 -0
- package/dist/build/transformers/colorToRgbAlpha.js +22 -0
- package/dist/build/transformers/colorToRgbaFloat.d.ts +8 -0
- package/dist/build/transformers/colorToRgbaFloat.js +50 -0
- package/dist/build/transformers/dimensionToPixelUnitless.d.ts +8 -0
- package/dist/build/transformers/dimensionToPixelUnitless.js +50 -0
- package/dist/build/transformers/dimensionToRem.d.ts +8 -0
- package/dist/build/transformers/dimensionToRem.js +47 -0
- package/dist/build/transformers/dimensionToRemPxArray.d.ts +8 -0
- package/dist/build/transformers/dimensionToRemPxArray.js +47 -0
- package/dist/build/transformers/durationToCss.d.ts +8 -0
- package/dist/build/transformers/durationToCss.js +30 -0
- package/dist/build/transformers/figmaAttributes.d.ts +8 -0
- package/dist/build/transformers/figmaAttributes.js +57 -0
- package/dist/build/transformers/floatToPixel.d.ts +15 -0
- package/dist/build/transformers/floatToPixel.js +41 -0
- package/dist/build/transformers/fontFamilyToCss.d.ts +14 -0
- package/dist/build/transformers/fontFamilyToCss.js +40 -0
- package/dist/build/transformers/fontFamilyToFigma.d.ts +14 -0
- package/dist/build/transformers/fontFamilyToFigma.js +46 -0
- package/dist/build/transformers/fontWeightToNumber.d.ts +9 -0
- package/dist/build/transformers/fontWeightToNumber.js +53 -0
- package/dist/build/transformers/index.d.ts +24 -0
- package/dist/build/transformers/index.js +51 -0
- package/dist/build/transformers/jsonDeprecated.d.ts +8 -0
- package/dist/build/transformers/jsonDeprecated.js +16 -0
- package/{src/transformers/namePathToCamelCase.ts → dist/build/transformers/namePathToCamelCase.d.ts} +2 -8
- package/dist/build/transformers/namePathToCamelCase.js +14 -0
- package/dist/build/transformers/namePathToDotNotation.d.ts +8 -0
- package/dist/build/transformers/namePathToDotNotation.js +33 -0
- package/dist/build/transformers/namePathToFigma.d.ts +9 -0
- package/dist/build/transformers/namePathToFigma.js +24 -0
- package/dist/build/transformers/namePathToKebabCase.d.ts +8 -0
- package/dist/build/transformers/namePathToKebabCase.js +18 -0
- package/dist/build/transformers/namePathToPascalCase.d.ts +8 -0
- package/dist/build/transformers/namePathToPascalCase.js +14 -0
- package/dist/build/transformers/namePathToSlashNotation.d.ts +8 -0
- package/dist/build/transformers/namePathToSlashNotation.js +18 -0
- package/dist/build/transformers/shadowToCss.d.ts +8 -0
- package/dist/build/transformers/shadowToCss.js +35 -0
- package/dist/build/transformers/typographyToCss.d.ts +8 -0
- package/dist/build/transformers/typographyToCss.js +29 -0
- package/dist/build/transformers/utilities/alpha.d.ts +9 -0
- package/dist/build/transformers/utilities/alpha.js +20 -0
- package/dist/build/transformers/utilities/checkRequiredTokenProperties.d.ts +7 -0
- package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +17 -0
- package/dist/build/transformers/utilities/getTokenValue.d.ts +2 -0
- package/dist/build/transformers/utilities/getTokenValue.js +18 -0
- package/dist/build/transformers/utilities/hasSpaceInString.d.ts +1 -0
- package/dist/build/transformers/utilities/hasSpaceInString.js +10 -0
- package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +2 -0
- package/dist/build/transformers/utilities/hexToRgbaFloat.js +33 -0
- package/dist/build/transformers/utilities/invalidTokenError.d.ts +7 -0
- package/dist/build/transformers/utilities/invalidTokenError.js +26 -0
- package/dist/build/transformers/utilities/isRgbaFloat.d.ts +7 -0
- package/dist/build/transformers/utilities/isRgbaFloat.js +24 -0
- package/dist/build/transformers/utilities/mix.d.ts +5 -0
- package/dist/build/transformers/utilities/mix.js +40 -0
- package/dist/build/transformers/utilities/rgbaFloatToHex.d.ts +6 -0
- package/dist/build/transformers/utilities/rgbaFloatToHex.js +15 -0
- package/dist/build/utilities/copyFromDir.d.ts +8 -0
- package/dist/build/utilities/copyFromDir.js +34 -0
- package/dist/build/utilities/filterStringArray.d.ts +1 -0
- package/dist/build/utilities/filterStringArray.js +17 -0
- package/{src/utilities/getFlag.ts → dist/build/utilities/getFlag.d.ts} +1 -5
- package/dist/build/utilities/getFlag.js +16 -0
- package/dist/build/utilities/index.d.ts +3 -0
- package/dist/build/utilities/index.js +9 -0
- package/dist/build/utilities/joinFriendly.d.ts +1 -0
- package/dist/build/utilities/joinFriendly.js +5 -0
- package/dist/build/utilities/schemaErrorMessage.d.ts +1 -0
- package/dist/build/utilities/schemaErrorMessage.js +5 -0
- package/dist/build/utilities/toCamelCase.d.ts +1 -0
- package/dist/build/utilities/toCamelCase.js +20 -0
- package/dist/build/utilities/toPascalCase.d.ts +1 -0
- package/dist/build/utilities/toPascalCase.js +17 -0
- package/dist/build/utilities/treeWalker.d.ts +8 -0
- package/dist/build/utilities/treeWalker.js +27 -0
- package/{src/utilities/upperCaseFirstCharacter.ts → dist/build/utilities/upperCaseFirstCharacter.d.ts} +1 -3
- package/dist/build/utilities/upperCaseFirstCharacter.js +14 -0
- package/package.json +4 -5
- package/src/PrimerStyleDictionary.ts +0 -232
- package/src/filters/index.ts +0 -13
- package/src/filters/isColorWithAlpha.ts +0 -11
- package/src/filters/isColorWithMix.ts +0 -33
- package/src/filters/isFromFile.ts +0 -12
- package/src/formats/cssAdvanced.ts +0 -99
- package/src/formats/cssCustomMedia.ts +0 -24
- package/src/formats/index.ts +0 -9
- package/src/formats/javascriptCommonJs.ts +0 -21
- package/src/formats/javascriptEsm.ts +0 -21
- package/src/formats/jsonFigma.ts +0 -134
- package/src/formats/jsonNestedPrefixed.ts +0 -23
- package/src/formats/jsonOneDimensional.ts +0 -18
- package/src/formats/jsonPostCssFallback.ts +0 -16
- package/src/formats/typescriptExportDefinition.ts +0 -170
- package/src/formats/utilities/jsonToNestedValue.ts +0 -20
- package/src/formats/utilities/prefixTokens.ts +0 -17
- package/src/parsers/index.ts +0 -1
- package/src/parsers/w3cJsonParser.ts +0 -25
- package/src/platforms/css.ts +0 -101
- package/src/platforms/deprecatedJson.ts +0 -16
- package/src/platforms/docJson.ts +0 -34
- package/src/platforms/fallbacks.ts +0 -34
- package/src/platforms/figma.ts +0 -58
- package/src/platforms/index.ts +0 -10
- package/src/platforms/javascript.ts +0 -30
- package/src/platforms/json.ts +0 -32
- package/src/platforms/styleLint.ts +0 -34
- package/src/platforms/typeDefinitions.ts +0 -30
- package/src/platforms/typescript.ts +0 -30
- package/src/schemas/alphaValue.ts +0 -12
- package/src/schemas/baseToken.ts +0 -8
- package/src/schemas/borderToken.ts +0 -19
- package/src/schemas/collections.ts +0 -49
- package/src/schemas/colorHexValue.ts +0 -18
- package/src/schemas/colorToken.ts +0 -50
- package/src/schemas/designToken.ts +0 -38
- package/src/schemas/dimensionToken.ts +0 -34
- package/src/schemas/dimensionValue.ts +0 -16
- package/src/schemas/durationToken.ts +0 -12
- package/src/schemas/durationValue.ts +0 -9
- package/src/schemas/fontFamilyToken.ts +0 -21
- package/src/schemas/fontWeightToken.ts +0 -22
- package/src/schemas/fontWeightValue.ts +0 -14
- package/src/schemas/numberToken.ts +0 -28
- package/src/schemas/referenceValue.ts +0 -12
- package/src/schemas/scopes.ts +0 -40
- package/src/schemas/shadowToken.ts +0 -45
- package/src/schemas/stringToken.ts +0 -11
- package/src/schemas/tokenName.ts +0 -12
- package/src/schemas/tokenType.ts +0 -4
- package/src/schemas/typographyToken.ts +0 -20
- package/src/schemas/validTokenType.ts +0 -44
- package/src/schemas/viewportRangeToken.ts +0 -11
- package/src/test-utilities/getMockDictionary.ts +0 -22
- package/src/test-utilities/getMockFormatterArguments.ts +0 -21
- package/src/test-utilities/getMockParserInput.ts +0 -72
- package/src/test-utilities/getMockToken.ts +0 -25
- package/src/test-utilities/index.ts +0 -4
- package/src/tokens/base/color/dark/dark.dimmed.json5 +0 -1164
- package/src/tokens/base/color/dark/dark.high-contrast.json5 +0 -764
- package/src/tokens/base/color/dark/dark.json5 +0 -911
- package/src/tokens/base/color/dark/display-dark.json5 +0 -1774
- package/src/tokens/base/color/light/display-light.json5 +0 -1774
- package/src/tokens/base/color/light/light.high-contrast.json5 +0 -755
- package/src/tokens/base/color/light/light.json5 +0 -911
- package/src/tokens/base/size/size.json +0 -196
- package/src/tokens/base/typography/typography.json +0 -48
- package/src/tokens/fallback/color-fallbacks.json +0 -270
- package/src/tokens/functional/border/dark.json5 +0 -12
- package/src/tokens/functional/border/light.json5 +0 -12
- package/src/tokens/functional/color/dark/app-dark.json5 +0 -554
- package/src/tokens/functional/color/dark/data-vis-dark.json5 +0 -284
- package/src/tokens/functional/color/dark/display-dark.json5 +0 -1258
- package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +0 -194
- package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +0 -935
- package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +0 -310
- package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +0 -224
- package/src/tokens/functional/color/dark/patterns-dark.json5 +0 -3097
- package/src/tokens/functional/color/dark/primitives-dark.json5 +0 -1200
- package/src/tokens/functional/color/dark/syntax-dark.json5 +0 -559
- package/src/tokens/functional/color/light/app-light.json5 +0 -551
- package/src/tokens/functional/color/light/data-vis-light.json5 +0 -284
- package/src/tokens/functional/color/light/display-light.json5 +0 -1258
- package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +0 -819
- package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +0 -327
- package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +0 -237
- package/src/tokens/functional/color/light/patterns-light.json5 +0 -3091
- package/src/tokens/functional/color/light/primitives-light.json5 +0 -1193
- package/src/tokens/functional/color/light/syntax-light.json5 +0 -559
- package/src/tokens/functional/motion/loading.json5 +0 -17
- package/src/tokens/functional/motion/patterns.json5 +0 -28
- package/src/tokens/functional/shadow/dark.json5 +0 -383
- package/src/tokens/functional/shadow/light.json5 +0 -376
- package/src/tokens/functional/size/border.json +0 -111
- package/src/tokens/functional/size/breakpoints.json +0 -64
- package/src/tokens/functional/size/size-coarse.json +0 -28
- package/src/tokens/functional/size/size-fine.json +0 -28
- package/src/tokens/functional/size/size.json +0 -740
- package/src/tokens/functional/size/viewport.json +0 -28
- package/src/tokens/functional/typography/typography.json +0 -527
- package/src/tokens/removed/color.json +0 -421
- package/src/tokens/removed/testing.json5 +0 -4
- package/src/transformers/borderToCss.ts +0 -38
- package/src/transformers/colorToHex.ts +0 -16
- package/src/transformers/colorToHexAlpha.ts +0 -23
- package/src/transformers/colorToHexMix.ts +0 -19
- package/src/transformers/colorToRgbAlpha.ts +0 -19
- package/src/transformers/colorToRgbaFloat.ts +0 -45
- package/src/transformers/dimensionToPixelUnitless.ts +0 -60
- package/src/transformers/dimensionToRem.ts +0 -56
- package/src/transformers/dimensionToRemPxArray.ts +0 -60
- package/src/transformers/durationToCss.ts +0 -29
- package/src/transformers/figmaAttributes.ts +0 -79
- package/src/transformers/floatToPixel.ts +0 -40
- package/src/transformers/fontFamilyToCss.ts +0 -37
- package/src/transformers/fontFamilyToFigma.ts +0 -47
- package/src/transformers/fontWeightToNumber.ts +0 -53
- package/src/transformers/index.ts +0 -24
- package/src/transformers/jsonDeprecated.ts +0 -15
- package/src/transformers/namePathToDotNotation.ts +0 -34
- package/src/transformers/namePathToFigma.ts +0 -28
- package/src/transformers/namePathToKebabCase.ts +0 -19
- package/src/transformers/namePathToSlashNotation.ts +0 -19
- package/src/transformers/shadowToCss.ts +0 -37
- package/src/transformers/typographyToCss.ts +0 -31
- package/src/transformers/utilities/alpha.ts +0 -23
- package/src/transformers/utilities/checkRequiredTokenProperties.ts +0 -16
- package/src/transformers/utilities/getTokenValue.ts +0 -18
- package/src/transformers/utilities/hasSpaceInString.ts +0 -6
- package/src/transformers/utilities/hexToRgbaFloat.ts +0 -31
- package/src/transformers/utilities/invalidTokenError.ts +0 -34
- package/src/transformers/utilities/isRgbaFloat.ts +0 -29
- package/src/transformers/utilities/mix.ts +0 -46
- package/src/transformers/utilities/rgbaFloatToHex.ts +0 -15
- package/src/types/Border.d.ts +0 -5
- package/src/types/BorderTokenValue.d.ts +0 -10
- package/src/types/ColorHex.d.ts +0 -4
- package/src/types/PlatformInitializer.d.ts +0 -11
- package/src/types/Shadow.d.ts +0 -5
- package/src/types/ShadowTokenValue.d.ts +0 -14
- package/src/types/SizeEm.d.ts +0 -4
- package/src/types/SizePx.d.ts +0 -4
- package/src/types/SizeRem.d.ts +0 -4
- package/src/types/StyleDictionaryConfigGenerator.d.ts +0 -15
- package/src/types/TokenBuildInput.d.ts +0 -8
- package/src/types/TypographyTokenValue.d.ts +0 -12
- package/src/types/w3cTransformedToken.d.ts +0 -8
- package/src/utilities/copyFromDir.ts +0 -21
- package/src/utilities/index.ts +0 -3
- package/src/utilities/joinFriendly.ts +0 -2
- package/src/utilities/schemaErrorMessage.ts +0 -2
- package/src/utilities/toCamelCase.ts +0 -29
- package/src/utilities/treeWalker.ts +0 -27
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scopes = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const joinFriendly_1 = require("../utilities/joinFriendly");
|
|
6
|
+
const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
|
|
7
|
+
const validScopes = [
|
|
8
|
+
'all',
|
|
9
|
+
'bgColor',
|
|
10
|
+
'fgColor',
|
|
11
|
+
'borderColor',
|
|
12
|
+
'borderWidth',
|
|
13
|
+
'size',
|
|
14
|
+
'gap',
|
|
15
|
+
'radius',
|
|
16
|
+
'effectColor',
|
|
17
|
+
'effectFloat',
|
|
18
|
+
'opacity',
|
|
19
|
+
'fontFamily',
|
|
20
|
+
'fontStyle',
|
|
21
|
+
'fontWeight',
|
|
22
|
+
'fontSize',
|
|
23
|
+
'lineHeight',
|
|
24
|
+
'letterSpacing',
|
|
25
|
+
'paragraphSpacing',
|
|
26
|
+
'paragraphIndent',
|
|
27
|
+
];
|
|
28
|
+
const scopes = (scopeSubset) => {
|
|
29
|
+
const scopeArray = scopeSubset !== null && scopeSubset !== void 0 ? scopeSubset : validScopes;
|
|
30
|
+
return zod_1.z.array(zod_1.z.string()).refine(value => value.every(item => scopeArray.includes(item)), value => ({
|
|
31
|
+
message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid scope: "${value}"`, `Valid scopes are: ${(0, joinFriendly_1.joinFriendly)(scopeArray)}`),
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
exports.scopes = scopes;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const shadowValue: z.ZodObject<{
|
|
3
|
+
color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
|
+
alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
5
|
+
offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
6
|
+
offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
7
|
+
blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
8
|
+
spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
9
|
+
inset: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
color: string;
|
|
12
|
+
blur: string | 0;
|
|
13
|
+
offsetX: string | 0;
|
|
14
|
+
offsetY: string | 0;
|
|
15
|
+
spread: string | 0;
|
|
16
|
+
alpha?: any;
|
|
17
|
+
inset?: boolean | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
color: string;
|
|
20
|
+
blur: string | 0;
|
|
21
|
+
offsetX: string | 0;
|
|
22
|
+
offsetY: string | 0;
|
|
23
|
+
spread: string | 0;
|
|
24
|
+
alpha?: any;
|
|
25
|
+
inset?: boolean | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
28
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
30
|
+
}, {
|
|
31
|
+
$value: z.ZodUnion<[z.ZodObject<{
|
|
32
|
+
color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
33
|
+
alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
34
|
+
offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
35
|
+
offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
36
|
+
blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
37
|
+
spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
38
|
+
inset: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
}, "strict", z.ZodTypeAny, {
|
|
40
|
+
color: string;
|
|
41
|
+
blur: string | 0;
|
|
42
|
+
offsetX: string | 0;
|
|
43
|
+
offsetY: string | 0;
|
|
44
|
+
spread: string | 0;
|
|
45
|
+
alpha?: any;
|
|
46
|
+
inset?: boolean | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
color: string;
|
|
49
|
+
blur: string | 0;
|
|
50
|
+
offsetX: string | 0;
|
|
51
|
+
offsetY: string | 0;
|
|
52
|
+
spread: string | 0;
|
|
53
|
+
alpha?: any;
|
|
54
|
+
inset?: boolean | undefined;
|
|
55
|
+
}>, z.ZodArray<z.ZodObject<{
|
|
56
|
+
color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
57
|
+
alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
58
|
+
offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
59
|
+
offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
60
|
+
blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
61
|
+
spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
62
|
+
inset: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, "strict", z.ZodTypeAny, {
|
|
64
|
+
color: string;
|
|
65
|
+
blur: string | 0;
|
|
66
|
+
offsetX: string | 0;
|
|
67
|
+
offsetY: string | 0;
|
|
68
|
+
spread: string | 0;
|
|
69
|
+
alpha?: any;
|
|
70
|
+
inset?: boolean | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
color: string;
|
|
73
|
+
blur: string | 0;
|
|
74
|
+
offsetX: string | 0;
|
|
75
|
+
offsetY: string | 0;
|
|
76
|
+
spread: string | 0;
|
|
77
|
+
alpha?: any;
|
|
78
|
+
inset?: boolean | undefined;
|
|
79
|
+
}>, "many">, z.ZodEffects<z.ZodString, string, string>]>;
|
|
80
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
|
|
81
|
+
$extensions: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
'org.primer.figma': z.ZodObject<{
|
|
83
|
+
collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
84
|
+
mode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
mode?: string | undefined;
|
|
87
|
+
collection?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
mode?: string | undefined;
|
|
90
|
+
collection?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
'org.primer.figma': {
|
|
94
|
+
mode?: string | undefined;
|
|
95
|
+
collection?: string | undefined;
|
|
96
|
+
};
|
|
97
|
+
}, {
|
|
98
|
+
'org.primer.figma': {
|
|
99
|
+
mode?: string | undefined;
|
|
100
|
+
collection?: string | undefined;
|
|
101
|
+
};
|
|
102
|
+
}>>;
|
|
103
|
+
}>, "strict", z.ZodTypeAny, {
|
|
104
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
105
|
+
$value: string | {
|
|
106
|
+
color: string;
|
|
107
|
+
blur: string | 0;
|
|
108
|
+
offsetX: string | 0;
|
|
109
|
+
offsetY: string | 0;
|
|
110
|
+
spread: string | 0;
|
|
111
|
+
alpha?: any;
|
|
112
|
+
inset?: boolean | undefined;
|
|
113
|
+
} | {
|
|
114
|
+
color: string;
|
|
115
|
+
blur: string | 0;
|
|
116
|
+
offsetX: string | 0;
|
|
117
|
+
offsetY: string | 0;
|
|
118
|
+
spread: string | 0;
|
|
119
|
+
alpha?: any;
|
|
120
|
+
inset?: boolean | undefined;
|
|
121
|
+
}[];
|
|
122
|
+
deprecated?: string | boolean | undefined;
|
|
123
|
+
$extensions?: {
|
|
124
|
+
'org.primer.figma': {
|
|
125
|
+
mode?: string | undefined;
|
|
126
|
+
collection?: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
} | undefined;
|
|
129
|
+
$description?: string | undefined;
|
|
130
|
+
}, {
|
|
131
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
132
|
+
$value: string | {
|
|
133
|
+
color: string;
|
|
134
|
+
blur: string | 0;
|
|
135
|
+
offsetX: string | 0;
|
|
136
|
+
offsetY: string | 0;
|
|
137
|
+
spread: string | 0;
|
|
138
|
+
alpha?: any;
|
|
139
|
+
inset?: boolean | undefined;
|
|
140
|
+
} | {
|
|
141
|
+
color: string;
|
|
142
|
+
blur: string | 0;
|
|
143
|
+
offsetX: string | 0;
|
|
144
|
+
offsetY: string | 0;
|
|
145
|
+
spread: string | 0;
|
|
146
|
+
alpha?: any;
|
|
147
|
+
inset?: boolean | undefined;
|
|
148
|
+
}[];
|
|
149
|
+
deprecated?: string | boolean | undefined;
|
|
150
|
+
$extensions?: {
|
|
151
|
+
'org.primer.figma': {
|
|
152
|
+
mode?: string | undefined;
|
|
153
|
+
collection?: string | undefined;
|
|
154
|
+
};
|
|
155
|
+
} | undefined;
|
|
156
|
+
$description?: string | undefined;
|
|
157
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shadowToken = exports.shadowValue = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const baseToken_1 = require("./baseToken");
|
|
6
|
+
const referenceValue_1 = require("./referenceValue");
|
|
7
|
+
const colorHexValue_1 = require("./colorHexValue");
|
|
8
|
+
const alphaValue_1 = require("./alphaValue");
|
|
9
|
+
const dimensionValue_1 = require("./dimensionValue");
|
|
10
|
+
const tokenType_1 = require("./tokenType");
|
|
11
|
+
const collections_1 = require("./collections");
|
|
12
|
+
exports.shadowValue = zod_1.z
|
|
13
|
+
.object({
|
|
14
|
+
color: zod_1.z.union([colorHexValue_1.colorHexValue, referenceValue_1.referenceValue]),
|
|
15
|
+
alpha: zod_1.z.union([alphaValue_1.alphaValue, referenceValue_1.referenceValue]),
|
|
16
|
+
offsetX: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
|
|
17
|
+
offsetY: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
|
|
18
|
+
blur: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
|
|
19
|
+
spread: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
|
|
20
|
+
inset: zod_1.z.boolean().optional(),
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
exports.shadowToken = baseToken_1.baseToken
|
|
24
|
+
.extend({
|
|
25
|
+
$value: zod_1.z.union([exports.shadowValue, zod_1.z.array(exports.shadowValue), referenceValue_1.referenceValue]),
|
|
26
|
+
$type: (0, tokenType_1.tokenType)('shadow'),
|
|
27
|
+
$extensions: zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
'org.primer.figma': zod_1.z.object({
|
|
30
|
+
collection: (0, collections_1.collection)(['mode']).optional(),
|
|
31
|
+
mode: (0, collections_1.mode)([
|
|
32
|
+
'light',
|
|
33
|
+
'dark',
|
|
34
|
+
'dark dimmed',
|
|
35
|
+
'light high contrast',
|
|
36
|
+
'dark high contrast',
|
|
37
|
+
'light colorblind',
|
|
38
|
+
'dark colorblind',
|
|
39
|
+
'light tritanopia',
|
|
40
|
+
'dark tritanopia',
|
|
41
|
+
]).optional(),
|
|
42
|
+
}),
|
|
43
|
+
})
|
|
44
|
+
.optional(),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const stringToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
+
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
}, {
|
|
6
|
+
$value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
|
|
8
|
+
}>, "strict", z.ZodTypeAny, {
|
|
9
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
10
|
+
$value: string;
|
|
11
|
+
deprecated?: string | boolean | undefined;
|
|
12
|
+
$description?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
15
|
+
$value: string;
|
|
16
|
+
deprecated?: string | boolean | undefined;
|
|
17
|
+
$description?: string | undefined;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringToken = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const baseToken_1 = require("./baseToken");
|
|
6
|
+
const referenceValue_1 = require("./referenceValue");
|
|
7
|
+
const tokenType_1 = require("./tokenType");
|
|
8
|
+
exports.stringToken = baseToken_1.baseToken
|
|
9
|
+
.extend({
|
|
10
|
+
$value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
|
|
11
|
+
$type: (0, tokenType_1.tokenType)('string'),
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tokenName = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
|
|
6
|
+
exports.tokenName = zod_1.z.string().refine(name => /(^[a-z0-9][A-Za-z0-9-]*$|^@$)/.test(name), name => ({
|
|
7
|
+
message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid token name: "${name}"`, 'Token name must be kebab-case or camelCase, and start with a lowercase letter or number and consist only of letters, numbers, and hyphens.'),
|
|
8
|
+
}));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { TokenType } from './validTokenType';
|
|
3
|
+
export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const typographyValue: z.ZodObject<{
|
|
3
|
+
fontSize: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
|
+
lineHeight: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>>;
|
|
5
|
+
fontWeight: z.ZodUnion<[z.ZodEffects<z.ZodNumber, number, number>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
6
|
+
fontFamily: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
fontFamily: string;
|
|
9
|
+
fontSize: string | 0;
|
|
10
|
+
fontWeight: string | number;
|
|
11
|
+
lineHeight?: string | 0 | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
fontFamily: string;
|
|
14
|
+
fontSize: string | 0;
|
|
15
|
+
fontWeight: string | number;
|
|
16
|
+
lineHeight?: string | 0 | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
19
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
20
|
+
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
21
|
+
}, {
|
|
22
|
+
$value: z.ZodUnion<[z.ZodObject<{
|
|
23
|
+
fontSize: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
24
|
+
lineHeight: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>>;
|
|
25
|
+
fontWeight: z.ZodUnion<[z.ZodEffects<z.ZodNumber, number, number>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
26
|
+
fontFamily: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
fontFamily: string;
|
|
29
|
+
fontSize: string | 0;
|
|
30
|
+
fontWeight: string | number;
|
|
31
|
+
lineHeight?: string | 0 | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
fontFamily: string;
|
|
34
|
+
fontSize: string | 0;
|
|
35
|
+
fontWeight: string | number;
|
|
36
|
+
lineHeight?: string | 0 | undefined;
|
|
37
|
+
}>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
38
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
|
|
39
|
+
}>, "strict", z.ZodTypeAny, {
|
|
40
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
41
|
+
$value: string | {
|
|
42
|
+
fontFamily: string;
|
|
43
|
+
fontSize: string | 0;
|
|
44
|
+
fontWeight: string | number;
|
|
45
|
+
lineHeight?: string | 0 | undefined;
|
|
46
|
+
};
|
|
47
|
+
deprecated?: string | boolean | undefined;
|
|
48
|
+
$description?: string | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
51
|
+
$value: string | {
|
|
52
|
+
fontFamily: string;
|
|
53
|
+
fontSize: string | 0;
|
|
54
|
+
fontWeight: string | number;
|
|
55
|
+
lineHeight?: string | 0 | undefined;
|
|
56
|
+
};
|
|
57
|
+
deprecated?: string | boolean | undefined;
|
|
58
|
+
$description?: string | undefined;
|
|
59
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typographyToken = exports.typographyValue = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const referenceValue_1 = require("./referenceValue");
|
|
6
|
+
const dimensionValue_1 = require("./dimensionValue");
|
|
7
|
+
const baseToken_1 = require("./baseToken");
|
|
8
|
+
const fontWeightValue_1 = require("./fontWeightValue");
|
|
9
|
+
const tokenType_1 = require("./tokenType");
|
|
10
|
+
exports.typographyValue = zod_1.z.object({
|
|
11
|
+
fontSize: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
|
|
12
|
+
lineHeight: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]).optional(),
|
|
13
|
+
fontWeight: zod_1.z.union([fontWeightValue_1.fontWeightValue, referenceValue_1.referenceValue]),
|
|
14
|
+
fontFamily: zod_1.z.union([zod_1.z.string().min(1), referenceValue_1.referenceValue]),
|
|
15
|
+
});
|
|
16
|
+
exports.typographyToken = baseToken_1.baseToken
|
|
17
|
+
.extend({
|
|
18
|
+
$value: zod_1.z.union([exports.typographyValue, referenceValue_1.referenceValue]),
|
|
19
|
+
$type: (0, tokenType_1.tokenType)('typography'),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const validTypes: readonly ["color", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
|
|
3
|
+
export type TokenType = (typeof validTypes)[number];
|
|
4
|
+
export declare const validateType: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodTypeAny>>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const joinFriendly_1 = require("../utilities/joinFriendly");
|
|
6
|
+
const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
|
|
7
|
+
const validTypes = [
|
|
8
|
+
'color',
|
|
9
|
+
'typography',
|
|
10
|
+
'dimension',
|
|
11
|
+
'duration',
|
|
12
|
+
'border',
|
|
13
|
+
'shadow',
|
|
14
|
+
'fontFamily',
|
|
15
|
+
'fontWeight',
|
|
16
|
+
'number',
|
|
17
|
+
'string',
|
|
18
|
+
'custom-viewportRange',
|
|
19
|
+
];
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
21
|
+
// @ts-ignore: TODO: fix this
|
|
22
|
+
exports.validateType = zod_1.z.record(zod_1.z.string(), zod_1.z.lazy(() => {
|
|
23
|
+
return zod_1.z.union([
|
|
24
|
+
zod_1.z
|
|
25
|
+
.object({
|
|
26
|
+
$value: zod_1.z.any(),
|
|
27
|
+
$type: zod_1.z.string().refine(type => validTypes.includes(type), val => ({
|
|
28
|
+
message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid token $type: "${val}"`, `Must be one of the following: ${(0, joinFriendly_1.joinFriendly)([...validTypes], 'or')}`),
|
|
29
|
+
})),
|
|
30
|
+
})
|
|
31
|
+
.required(),
|
|
32
|
+
exports.validateType,
|
|
33
|
+
]);
|
|
34
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const viewportRangeToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
+
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
}, {
|
|
6
|
+
$value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
|
|
8
|
+
}>, "strict", z.ZodTypeAny, {
|
|
9
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
10
|
+
$value: string;
|
|
11
|
+
deprecated?: string | boolean | undefined;
|
|
12
|
+
$description?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
15
|
+
$value: string;
|
|
16
|
+
deprecated?: string | boolean | undefined;
|
|
17
|
+
$description?: string | undefined;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.viewportRangeToken = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const baseToken_1 = require("./baseToken");
|
|
6
|
+
const referenceValue_1 = require("./referenceValue");
|
|
7
|
+
const tokenType_1 = require("./tokenType");
|
|
8
|
+
exports.viewportRangeToken = baseToken_1.baseToken
|
|
9
|
+
.extend({
|
|
10
|
+
$value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
|
|
11
|
+
$type: (0, tokenType_1.tokenType)('custom-viewportRange'),
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type StyleDictionary from 'style-dictionary';
|
|
2
|
+
/**
|
|
3
|
+
* @description converts w3c border tokens in css border string
|
|
4
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
+
* @matcher matches all tokens of $type `border`
|
|
6
|
+
* @transformer returns css border `string`
|
|
7
|
+
*/
|
|
8
|
+
export declare const borderToCss: StyleDictionary.Transform;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderToCss = void 0;
|
|
4
|
+
const isBorder_1 = require("../filters/isBorder");
|
|
5
|
+
/**
|
|
6
|
+
* checks if all required properties exist on shadow token
|
|
7
|
+
* @param object - BorderTokenValue
|
|
8
|
+
* @returns void or throws error
|
|
9
|
+
*/
|
|
10
|
+
const checkForBorderTokenProperties = (border) => {
|
|
11
|
+
const requiredProperties = ['color', 'width', 'style'];
|
|
12
|
+
for (const prop of requiredProperties) {
|
|
13
|
+
if (prop in border === false) {
|
|
14
|
+
throw new Error(`Missing propery: ${prop} on border token ${JSON.stringify(border)}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @description converts w3c border tokens in css border string
|
|
20
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
21
|
+
* @matcher matches all tokens of $type `border`
|
|
22
|
+
* @transformer returns css border `string`
|
|
23
|
+
*/
|
|
24
|
+
exports.borderToCss = {
|
|
25
|
+
type: `value`,
|
|
26
|
+
transitive: true,
|
|
27
|
+
matcher: isBorder_1.isBorder,
|
|
28
|
+
transformer: ({ value }) => {
|
|
29
|
+
//
|
|
30
|
+
checkForBorderTokenProperties(value);
|
|
31
|
+
// if value === string it was probably already transformed
|
|
32
|
+
if (typeof value === 'string') {
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
/* color | style | width */
|
|
36
|
+
return `${value.color} ${value.style} ${value.width}`;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type StyleDictionary from 'style-dictionary';
|
|
2
|
+
/**
|
|
3
|
+
* @description converts color tokens value to `hex6` or `hex8`
|
|
4
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
+
* @matcher matches all tokens of $type `color`
|
|
6
|
+
* @transformer returns a `hex` string
|
|
7
|
+
*/
|
|
8
|
+
export declare const colorToHex: StyleDictionary.Transform;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colorToHex = void 0;
|
|
4
|
+
const color2k_1 = require("color2k");
|
|
5
|
+
const filters_1 = require("../filters");
|
|
6
|
+
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
7
|
+
/**
|
|
8
|
+
* @description converts color tokens value to `hex6` or `hex8`
|
|
9
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
10
|
+
* @matcher matches all tokens of $type `color`
|
|
11
|
+
* @transformer returns a `hex` string
|
|
12
|
+
*/
|
|
13
|
+
exports.colorToHex = {
|
|
14
|
+
type: `value`,
|
|
15
|
+
transitive: true,
|
|
16
|
+
matcher: filters_1.isColor,
|
|
17
|
+
transformer: (token) => (0, color2k_1.toHex)((0, getTokenValue_1.getTokenValue)(token)),
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type StyleDictionary from 'style-dictionary';
|
|
2
|
+
/**
|
|
3
|
+
* @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
|
|
4
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
+
* @matcher matches all tokens of $type `color` with an `alpha` property
|
|
6
|
+
* @transformer returns `hex8` string
|
|
7
|
+
*/
|
|
8
|
+
export declare const colorToHexAlpha: StyleDictionary.Transform;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colorToHexAlpha = void 0;
|
|
4
|
+
const color2k_1 = require("color2k");
|
|
5
|
+
const alpha_1 = require("./utilities/alpha");
|
|
6
|
+
const filters_1 = require("../filters");
|
|
7
|
+
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
8
|
+
/**
|
|
9
|
+
* @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
|
|
10
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
11
|
+
* @matcher matches all tokens of $type `color` with an `alpha` property
|
|
12
|
+
* @transformer returns `hex8` string
|
|
13
|
+
*/
|
|
14
|
+
exports.colorToHexAlpha = {
|
|
15
|
+
type: `value`,
|
|
16
|
+
transitive: true,
|
|
17
|
+
matcher: filters_1.isColorWithAlpha,
|
|
18
|
+
transformer: (token) => {
|
|
19
|
+
// don't change if alpha is null
|
|
20
|
+
if (token.alpha === null) {
|
|
21
|
+
return (0, color2k_1.toHex)((0, getTokenValue_1.getTokenValue)(token));
|
|
22
|
+
}
|
|
23
|
+
return (0, color2k_1.toHex)((0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(token), token.alpha, token));
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type StyleDictionary from 'style-dictionary';
|
|
2
|
+
/**
|
|
3
|
+
* @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
|
|
4
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
+
* @matcher matches all tokens of $type `color` with an `alpha` property
|
|
6
|
+
* @transformer returns `hex8` string
|
|
7
|
+
*/
|
|
8
|
+
export declare const colorToHexMix: StyleDictionary.Transform;
|
|
@@ -0,0 +1,25 @@
|
|
|
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.colorToHexMix = void 0;
|
|
7
|
+
const color2k_1 = require("color2k");
|
|
8
|
+
const filters_1 = require("../filters");
|
|
9
|
+
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
10
|
+
const mix_1 = __importDefault(require("./utilities/mix"));
|
|
11
|
+
/**
|
|
12
|
+
* @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
|
|
13
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
14
|
+
* @matcher matches all tokens of $type `color` with an `alpha` property
|
|
15
|
+
* @transformer returns `hex8` string
|
|
16
|
+
*/
|
|
17
|
+
exports.colorToHexMix = {
|
|
18
|
+
type: `value`,
|
|
19
|
+
transitive: true,
|
|
20
|
+
matcher: filters_1.isColorWithMix,
|
|
21
|
+
transformer: (token) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
return (0, color2k_1.toHex)((0, mix_1.default)((0, getTokenValue_1.getTokenValue)(token), ((_a = token.mix) === null || _a === void 0 ? void 0 : _a.color) || (0, getTokenValue_1.getTokenValue)(token), ((_b = token.mix) === null || _b === void 0 ? void 0 : _b.weight) || 0));
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type StyleDictionary from 'style-dictionary';
|
|
2
|
+
/**
|
|
3
|
+
* @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
|
|
4
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
|
+
* @matcher matches all tokens of $type `color` with an `alpha` property
|
|
6
|
+
* @transformer returns `rgba` string
|
|
7
|
+
*/
|
|
8
|
+
export declare const colorToRgbAlpha: StyleDictionary.Transform;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colorToRgbAlpha = void 0;
|
|
4
|
+
const filters_1 = require("../filters");
|
|
5
|
+
const alpha_1 = require("./utilities/alpha");
|
|
6
|
+
const getTokenValue_1 = require("./utilities/getTokenValue");
|
|
7
|
+
/**
|
|
8
|
+
* @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
|
|
9
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
10
|
+
* @matcher matches all tokens of $type `color` with an `alpha` property
|
|
11
|
+
* @transformer returns `rgba` string
|
|
12
|
+
*/
|
|
13
|
+
exports.colorToRgbAlpha = {
|
|
14
|
+
type: `value`,
|
|
15
|
+
transitive: true,
|
|
16
|
+
matcher: filters_1.isColorWithAlpha,
|
|
17
|
+
transformer: (token) => {
|
|
18
|
+
if (token.alpha === null)
|
|
19
|
+
return (0, getTokenValue_1.getTokenValue)(token);
|
|
20
|
+
return (0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(token), token.alpha, token);
|
|
21
|
+
},
|
|
22
|
+
};
|