@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,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const scopes_1 = require("./scopes");
|
|
9
|
-
const collections_1 = require("./collections");
|
|
10
|
-
exports.numberToken = baseToken_1.baseToken
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseToken } from './baseToken.js';
|
|
3
|
+
import { referenceValue } from './referenceValue.js';
|
|
4
|
+
import { tokenType } from './tokenType.js';
|
|
5
|
+
import { scopes } from './scopes.js';
|
|
6
|
+
import { collection } from './collections.js';
|
|
7
|
+
export const numberToken = baseToken
|
|
11
8
|
.extend({
|
|
12
|
-
$value:
|
|
13
|
-
$type:
|
|
14
|
-
$extensions:
|
|
9
|
+
$value: z.union([z.number(), referenceValue]),
|
|
10
|
+
$type: tokenType('number'),
|
|
11
|
+
$extensions: z
|
|
15
12
|
.object({
|
|
16
|
-
'org.primer.data':
|
|
13
|
+
'org.primer.data': z
|
|
17
14
|
.object({
|
|
18
|
-
fontSize:
|
|
15
|
+
fontSize: z.number().optional(),
|
|
19
16
|
})
|
|
20
17
|
.optional(),
|
|
21
|
-
'org.primer.figma':
|
|
18
|
+
'org.primer.figma': z
|
|
22
19
|
.object({
|
|
23
|
-
collection:
|
|
24
|
-
scopes:
|
|
20
|
+
collection: collection(['typography']).optional(),
|
|
21
|
+
scopes: scopes(['fontWeight', 'lineHeight']).optional(),
|
|
25
22
|
})
|
|
26
23
|
.optional(),
|
|
27
24
|
})
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
|
|
6
|
-
exports.referenceValue = zod_1.z.string().refine(ref => /^{\w+(\.\w+)*(\.\w+|\.@)}$/.test(ref), ref => ({
|
|
7
|
-
message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid reference: "${ref}"`, 'Reference must be a string in the format "{path.to.token}".'),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { schemaErrorMessage } from '../utilities/index.js';
|
|
3
|
+
export const referenceValue = z.string().refine(ref => /^{\w+(\.\w+)*(\.\w+|\.@)}$/.test(ref), ref => ({
|
|
4
|
+
message: schemaErrorMessage(`Invalid reference: "${ref}"`, 'Reference must be a string in the format "{path.to.token}".'),
|
|
8
5
|
}));
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { joinFriendly, schemaErrorMessage } from '../utilities/index.js';
|
|
7
3
|
const validScopes = [
|
|
8
4
|
'all',
|
|
9
5
|
'bgColor',
|
|
@@ -25,10 +21,9 @@ const validScopes = [
|
|
|
25
21
|
'paragraphSpacing',
|
|
26
22
|
'paragraphIndent',
|
|
27
23
|
];
|
|
28
|
-
const scopes = (scopeSubset) => {
|
|
24
|
+
export const scopes = (scopeSubset) => {
|
|
29
25
|
const scopeArray = scopeSubset !== null && scopeSubset !== void 0 ? scopeSubset : validScopes;
|
|
30
|
-
return
|
|
31
|
-
message:
|
|
26
|
+
return z.array(z.string()).refine(value => value.every(item => scopeArray.includes(item)), value => ({
|
|
27
|
+
message: schemaErrorMessage(`Invalid scope: "${value}"`, `Valid scopes are: ${joinFriendly(scopeArray)}`),
|
|
32
28
|
}));
|
|
33
29
|
};
|
|
34
|
-
exports.scopes = scopes;
|
|
@@ -26,7 +26,7 @@ export declare const shadowValue: z.ZodObject<{
|
|
|
26
26
|
}>;
|
|
27
27
|
export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
28
28
|
$description: z.ZodOptional<z.ZodString>;
|
|
29
|
-
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
29
|
+
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
30
30
|
}, {
|
|
31
31
|
$value: z.ZodUnion<[z.ZodObject<{
|
|
32
32
|
color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
@@ -77,31 +77,35 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
77
77
|
alpha?: any;
|
|
78
78
|
inset?: boolean | undefined;
|
|
79
79
|
}>, "many">, z.ZodEffects<z.ZodString, string, string>]>;
|
|
80
|
-
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "
|
|
80
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
81
81
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
82
82
|
'org.primer.figma': z.ZodObject<{
|
|
83
83
|
collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
modeOverride: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
85
|
+
group: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, "strict", z.ZodTypeAny, {
|
|
87
|
+
group?: string | undefined;
|
|
87
88
|
collection?: string | undefined;
|
|
89
|
+
modeOverride?: string | undefined;
|
|
88
90
|
}, {
|
|
89
|
-
|
|
91
|
+
group?: string | undefined;
|
|
90
92
|
collection?: string | undefined;
|
|
93
|
+
modeOverride?: string | undefined;
|
|
91
94
|
}>;
|
|
92
95
|
}, "strip", z.ZodTypeAny, {
|
|
93
96
|
'org.primer.figma': {
|
|
94
|
-
|
|
97
|
+
group?: string | undefined;
|
|
95
98
|
collection?: string | undefined;
|
|
99
|
+
modeOverride?: string | undefined;
|
|
96
100
|
};
|
|
97
101
|
}, {
|
|
98
102
|
'org.primer.figma': {
|
|
99
|
-
|
|
103
|
+
group?: string | undefined;
|
|
100
104
|
collection?: string | undefined;
|
|
105
|
+
modeOverride?: string | undefined;
|
|
101
106
|
};
|
|
102
107
|
}>>;
|
|
103
108
|
}>, "strict", z.ZodTypeAny, {
|
|
104
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
105
109
|
$value: string | {
|
|
106
110
|
color: string;
|
|
107
111
|
blur: string | 0;
|
|
@@ -119,16 +123,17 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
119
123
|
alpha?: any;
|
|
120
124
|
inset?: boolean | undefined;
|
|
121
125
|
}[];
|
|
122
|
-
|
|
126
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
127
|
+
$description?: string | undefined;
|
|
128
|
+
$deprecated?: string | boolean | undefined;
|
|
123
129
|
$extensions?: {
|
|
124
130
|
'org.primer.figma': {
|
|
125
|
-
|
|
131
|
+
group?: string | undefined;
|
|
126
132
|
collection?: string | undefined;
|
|
133
|
+
modeOverride?: string | undefined;
|
|
127
134
|
};
|
|
128
135
|
} | undefined;
|
|
129
|
-
$description?: string | undefined;
|
|
130
136
|
}, {
|
|
131
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
132
137
|
$value: string | {
|
|
133
138
|
color: string;
|
|
134
139
|
blur: string | 0;
|
|
@@ -146,12 +151,14 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
146
151
|
alpha?: any;
|
|
147
152
|
inset?: boolean | undefined;
|
|
148
153
|
}[];
|
|
149
|
-
|
|
154
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
155
|
+
$description?: string | undefined;
|
|
156
|
+
$deprecated?: string | boolean | undefined;
|
|
150
157
|
$extensions?: {
|
|
151
158
|
'org.primer.figma': {
|
|
152
|
-
|
|
159
|
+
group?: string | undefined;
|
|
153
160
|
collection?: string | undefined;
|
|
161
|
+
modeOverride?: string | undefined;
|
|
154
162
|
};
|
|
155
163
|
} | undefined;
|
|
156
|
-
$description?: string | undefined;
|
|
157
164
|
}>;
|
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const tokenType_1 = require("./tokenType");
|
|
11
|
-
const collections_1 = require("./collections");
|
|
12
|
-
exports.shadowValue = zod_1.z
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseToken } from './baseToken.js';
|
|
3
|
+
import { referenceValue } from './referenceValue.js';
|
|
4
|
+
import { colorHexValue } from './colorHexValue.js';
|
|
5
|
+
import { alphaValue } from './alphaValue.js';
|
|
6
|
+
import { dimensionValue } from './dimensionValue.js';
|
|
7
|
+
import { tokenType } from './tokenType.js';
|
|
8
|
+
import { collection, mode } from './collections.js';
|
|
9
|
+
export const shadowValue = z
|
|
13
10
|
.object({
|
|
14
|
-
color:
|
|
15
|
-
alpha:
|
|
16
|
-
offsetX:
|
|
17
|
-
offsetY:
|
|
18
|
-
blur:
|
|
19
|
-
spread:
|
|
20
|
-
inset:
|
|
11
|
+
color: z.union([colorHexValue, referenceValue]),
|
|
12
|
+
alpha: z.union([alphaValue, referenceValue]),
|
|
13
|
+
offsetX: z.union([dimensionValue, referenceValue]),
|
|
14
|
+
offsetY: z.union([dimensionValue, referenceValue]),
|
|
15
|
+
blur: z.union([dimensionValue, referenceValue]),
|
|
16
|
+
spread: z.union([dimensionValue, referenceValue]),
|
|
17
|
+
inset: z.boolean().optional(),
|
|
21
18
|
})
|
|
22
19
|
.strict();
|
|
23
|
-
|
|
20
|
+
export const shadowToken = baseToken
|
|
24
21
|
.extend({
|
|
25
|
-
$value:
|
|
26
|
-
$type:
|
|
27
|
-
$extensions:
|
|
22
|
+
$value: z.union([shadowValue, z.array(shadowValue), referenceValue]),
|
|
23
|
+
$type: tokenType('shadow'),
|
|
24
|
+
$extensions: z
|
|
28
25
|
.object({
|
|
29
|
-
'org.primer.figma':
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
'org.primer.figma': z
|
|
27
|
+
.object({
|
|
28
|
+
collection: collection(['mode']).optional(),
|
|
29
|
+
modeOverride: mode([
|
|
32
30
|
'light',
|
|
33
31
|
'dark',
|
|
34
32
|
'dark dimmed',
|
|
@@ -39,7 +37,9 @@ exports.shadowToken = baseToken_1.baseToken
|
|
|
39
37
|
'light tritanopia',
|
|
40
38
|
'dark tritanopia',
|
|
41
39
|
]).optional(),
|
|
42
|
-
|
|
40
|
+
group: z.string().optional(),
|
|
41
|
+
})
|
|
42
|
+
.strict(),
|
|
43
43
|
})
|
|
44
44
|
.optional(),
|
|
45
45
|
})
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const stringToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
}, {
|
|
6
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" | "
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
8
|
}>, "strict", z.ZodTypeAny, {
|
|
9
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
10
9
|
$value: string;
|
|
11
|
-
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
12
11
|
$description?: string | undefined;
|
|
12
|
+
$deprecated?: string | boolean | undefined;
|
|
13
13
|
}, {
|
|
14
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
15
14
|
$value: string;
|
|
16
|
-
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
17
16
|
$description?: string | undefined;
|
|
17
|
+
$deprecated?: string | boolean | undefined;
|
|
18
18
|
}>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const referenceValue_1 = require("./referenceValue");
|
|
7
|
-
const tokenType_1 = require("./tokenType");
|
|
8
|
-
exports.stringToken = baseToken_1.baseToken
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseToken } from './baseToken.js';
|
|
3
|
+
import { referenceValue } from './referenceValue.js';
|
|
4
|
+
import { tokenType } from './tokenType.js';
|
|
5
|
+
export const stringToken = baseToken
|
|
9
6
|
.extend({
|
|
10
|
-
$value:
|
|
11
|
-
$type:
|
|
7
|
+
$value: z.union([z.string(), referenceValue]),
|
|
8
|
+
$type: tokenType('string'),
|
|
12
9
|
})
|
|
13
10
|
.strict();
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.'),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { schemaErrorMessage } from '../utilities/index.js';
|
|
3
|
+
export const tokenName = z.string().refine(name => /(^[a-z0-9][A-Za-z0-9-]*$|^@$)/.test(name), name => ({
|
|
4
|
+
message: 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
5
|
}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
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" | "
|
|
2
|
+
import type { TokenType } from './validTokenType.js';
|
|
3
|
+
export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.tokenType = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const tokenType = ($type) => zod_1.z.literal($type);
|
|
6
|
-
exports.tokenType = tokenType;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const tokenType = ($type) => z.literal($type);
|
|
@@ -17,7 +17,7 @@ export declare const typographyValue: z.ZodObject<{
|
|
|
17
17
|
}>;
|
|
18
18
|
export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
19
19
|
$description: z.ZodOptional<z.ZodString>;
|
|
20
|
-
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
20
|
+
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
21
21
|
}, {
|
|
22
22
|
$value: z.ZodUnion<[z.ZodObject<{
|
|
23
23
|
fontSize: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
@@ -35,25 +35,25 @@ export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
35
35
|
fontWeight: string | number;
|
|
36
36
|
lineHeight?: string | 0 | undefined;
|
|
37
37
|
}>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
38
|
-
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "
|
|
38
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
39
39
|
}>, "strict", z.ZodTypeAny, {
|
|
40
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
41
40
|
$value: string | {
|
|
42
41
|
fontFamily: string;
|
|
43
42
|
fontSize: string | 0;
|
|
44
43
|
fontWeight: string | number;
|
|
45
44
|
lineHeight?: string | 0 | undefined;
|
|
46
45
|
};
|
|
47
|
-
|
|
46
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
48
47
|
$description?: string | undefined;
|
|
48
|
+
$deprecated?: string | boolean | undefined;
|
|
49
49
|
}, {
|
|
50
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
51
50
|
$value: string | {
|
|
52
51
|
fontFamily: string;
|
|
53
52
|
fontSize: string | 0;
|
|
54
53
|
fontWeight: string | number;
|
|
55
54
|
lineHeight?: string | 0 | undefined;
|
|
56
55
|
};
|
|
57
|
-
|
|
56
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
58
57
|
$description?: string | undefined;
|
|
58
|
+
$deprecated?: string | boolean | undefined;
|
|
59
59
|
}>;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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]),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { referenceValue } from './referenceValue.js';
|
|
3
|
+
import { dimensionValue } from './dimensionValue.js';
|
|
4
|
+
import { baseToken } from './baseToken.js';
|
|
5
|
+
import { fontWeightValue } from './fontWeightValue.js';
|
|
6
|
+
import { tokenType } from './tokenType.js';
|
|
7
|
+
export const typographyValue = z.object({
|
|
8
|
+
fontSize: z.union([dimensionValue, referenceValue]),
|
|
9
|
+
lineHeight: z.union([dimensionValue, referenceValue]).optional(),
|
|
10
|
+
fontWeight: z.union([fontWeightValue, referenceValue]),
|
|
11
|
+
fontFamily: z.union([z.string().min(1), referenceValue]),
|
|
15
12
|
});
|
|
16
|
-
|
|
13
|
+
export const typographyToken = baseToken
|
|
17
14
|
.extend({
|
|
18
|
-
$value:
|
|
19
|
-
$type:
|
|
15
|
+
$value: z.union([typographyValue, referenceValue]),
|
|
16
|
+
$type: tokenType('typography'),
|
|
20
17
|
})
|
|
21
18
|
.strict();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
declare const validTypes: readonly ["color", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
|
|
2
|
+
declare const validTypes: readonly ["color", "cubicBezier", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
|
|
3
3
|
export type TokenType = (typeof validTypes)[number];
|
|
4
4
|
export declare const validateType: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodTypeAny>>;
|
|
5
5
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { joinFriendly, schemaErrorMessage } from '../utilities/index.js';
|
|
7
3
|
const validTypes = [
|
|
8
4
|
'color',
|
|
5
|
+
'cubicBezier',
|
|
9
6
|
'typography',
|
|
10
7
|
'dimension',
|
|
11
8
|
'duration',
|
|
@@ -19,16 +16,16 @@ const validTypes = [
|
|
|
19
16
|
];
|
|
20
17
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
21
18
|
// @ts-ignore: TODO: fix this
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
|
|
19
|
+
export const validateType = z.record(z.string(), z.lazy(() => {
|
|
20
|
+
return z.union([
|
|
21
|
+
z
|
|
25
22
|
.object({
|
|
26
|
-
$value:
|
|
27
|
-
$type:
|
|
28
|
-
message:
|
|
23
|
+
$value: z.any(),
|
|
24
|
+
$type: z.string().refine(type => validTypes.includes(type), val => ({
|
|
25
|
+
message: schemaErrorMessage(`Invalid token $type: "${val}"`, `Must be one of the following: ${joinFriendly([...validTypes], 'or')}`),
|
|
29
26
|
})),
|
|
30
27
|
})
|
|
31
28
|
.required(),
|
|
32
|
-
|
|
29
|
+
validateType,
|
|
33
30
|
]);
|
|
34
31
|
}));
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const viewportRangeToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
}, {
|
|
6
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" | "
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
8
|
}>, "strict", z.ZodTypeAny, {
|
|
9
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
10
9
|
$value: string;
|
|
11
|
-
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
12
11
|
$description?: string | undefined;
|
|
12
|
+
$deprecated?: string | boolean | undefined;
|
|
13
13
|
}, {
|
|
14
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
15
14
|
$value: string;
|
|
16
|
-
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
17
16
|
$description?: string | undefined;
|
|
17
|
+
$deprecated?: string | boolean | undefined;
|
|
18
18
|
}>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const referenceValue_1 = require("./referenceValue");
|
|
7
|
-
const tokenType_1 = require("./tokenType");
|
|
8
|
-
exports.viewportRangeToken = baseToken_1.baseToken
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseToken } from './baseToken.js';
|
|
3
|
+
import { referenceValue } from './referenceValue.js';
|
|
4
|
+
import { tokenType } from './tokenType.js';
|
|
5
|
+
export const viewportRangeToken = baseToken
|
|
9
6
|
.extend({
|
|
10
|
-
$value:
|
|
11
|
-
$type:
|
|
7
|
+
$value: z.union([z.string(), referenceValue]),
|
|
8
|
+
$type: tokenType('custom-viewportRange'),
|
|
12
9
|
})
|
|
13
10
|
.strict();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description converts w3c border tokens in css border string
|
|
4
|
-
* @type
|
|
4
|
+
* @type valueTransformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
5
5
|
* @matcher matches all tokens of $type `border`
|
|
6
6
|
* @transformer returns css border `string`
|
|
7
7
|
*/
|
|
8
|
-
export declare const borderToCss:
|
|
8
|
+
export declare const borderToCss: Transform;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderToCss = void 0;
|
|
4
|
-
const isBorder_1 = require("../filters/isBorder");
|
|
1
|
+
import { isBorder } from '../filters/isBorder.js';
|
|
5
2
|
/**
|
|
6
3
|
* checks if all required properties exist on shadow token
|
|
7
4
|
* @param object - BorderTokenValue
|
|
8
5
|
* @returns void or throws error
|
|
9
6
|
*/
|
|
10
7
|
const checkForBorderTokenProperties = (border) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (prop in border === false) {
|
|
14
|
-
throw new Error(`Missing propery: ${prop} on border token ${JSON.stringify(border)}`);
|
|
15
|
-
}
|
|
8
|
+
if ('color' in border && 'width' in border && 'style' in border) {
|
|
9
|
+
return true;
|
|
16
10
|
}
|
|
11
|
+
return false;
|
|
17
12
|
};
|
|
18
13
|
/**
|
|
19
14
|
* @description converts w3c border tokens in css border string
|
|
20
|
-
* @type
|
|
15
|
+
* @type valueTransformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
21
16
|
* @matcher matches all tokens of $type `border`
|
|
22
17
|
* @transformer returns css border `string`
|
|
23
18
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
export const borderToCss = {
|
|
20
|
+
name: 'border/css',
|
|
21
|
+
type: 'value',
|
|
26
22
|
transitive: true,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
filter: isBorder,
|
|
24
|
+
transform: (token) => {
|
|
25
|
+
var _a;
|
|
26
|
+
const value = (_a = token.$value) !== null && _a !== void 0 ? _a : token.value;
|
|
31
27
|
// if value === string it was probably already transformed
|
|
32
28
|
if (typeof value === 'string') {
|
|
33
29
|
return value;
|
|
34
30
|
}
|
|
31
|
+
//
|
|
32
|
+
if (!checkForBorderTokenProperties(value)) {
|
|
33
|
+
throw new Error(`Invalid border token property ${JSON.stringify(value)}. Must be an object with color, width and style properties.`);
|
|
34
|
+
}
|
|
35
35
|
/* color | style | width */
|
|
36
36
|
return `${value.color} ${value.style} ${value.width}`;
|
|
37
37
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description converts color tokens value to `hex6` or `hex8`
|
|
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 `color`
|
|
6
6
|
* @transformer returns a `hex` string
|
|
7
7
|
*/
|
|
8
|
-
export declare const colorToHex:
|
|
8
|
+
export declare const colorToHex: Transform;
|