@primer/primitives 9.1.2 → 10.0.0-rc.2963a70e
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 +2 -6
- 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 +2 -2
- package/dist/build/schemas/baseToken.js +4 -7
- package/dist/build/schemas/borderToken.d.ts +5 -5
- 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 +20 -15
- package/dist/build/schemas/colorToken.js +24 -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 +5 -5
- package/dist/build/schemas/dimensionToken.js +14 -17
- package/dist/build/schemas/dimensionValue.js +7 -10
- package/dist/build/schemas/durationToken.d.ts +5 -5
- package/dist/build/schemas/durationToken.js +8 -11
- package/dist/build/schemas/durationValue.js +4 -7
- package/dist/build/schemas/fontFamilyToken.d.ts +5 -5
- package/dist/build/schemas/fontFamilyToken.js +13 -16
- package/dist/build/schemas/fontWeightToken.d.ts +5 -5
- package/dist/build/schemas/fontWeightToken.js +14 -17
- package/dist/build/schemas/fontWeightValue.js +4 -7
- package/dist/build/schemas/numberToken.d.ts +5 -5
- 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 +5 -5
- package/dist/build/schemas/shadowToken.js +23 -26
- package/dist/build/schemas/stringToken.d.ts +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +3 -5
- 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 +2868 -3462
- package/dist/docs/functional/themes/dark-dimmed.json +2826 -3016
- package/dist/docs/functional/themes/dark-high-contrast.json +2822 -5100
- package/dist/docs/functional/themes/dark-tritanopia.json +2829 -3203
- package/dist/docs/functional/themes/dark.json +2808 -2520
- package/dist/docs/functional/themes/light-colorblind.json +2604 -3150
- package/dist/docs/functional/themes/light-high-contrast.json +2653 -4609
- package/dist/docs/functional/themes/light-tritanopia.json +2546 -2960
- package/dist/docs/functional/themes/light.json +2590 -2312
- 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 +1644 -2238
- package/dist/styleLint/functional/themes/dark-dimmed.json +1699 -1889
- package/dist/styleLint/functional/themes/dark-high-contrast.json +1627 -3905
- package/dist/styleLint/functional/themes/dark-tritanopia.json +1704 -2078
- package/dist/styleLint/functional/themes/dark.json +1692 -1404
- package/dist/styleLint/functional/themes/light-colorblind.json +1506 -2052
- package/dist/styleLint/functional/themes/light-high-contrast.json +1515 -3471
- package/dist/styleLint/functional/themes/light-tritanopia.json +1434 -1848
- package/dist/styleLint/functional/themes/light.json +1474 -1196
- package/dist/styleLint/functional/typography/typography.json +114 -114
- package/package.json +22 -22
- 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 +203 -88
- package/src/tokens/functional/color/dark/data-vis-dark.json5 +20 -20
- package/src/tokens/functional/color/dark/display-dark.json5 +95 -95
- package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +0 -8
- package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +43 -30
- 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.json5 +16 -4
- package/src/tokens/functional/color/dark/primitives-dark.json5 +4 -4
- package/src/tokens/functional/color/light/app-light.json5 +195 -85
- package/src/tokens/functional/color/light/data-vis-light.json5 +20 -20
- package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +25 -25
- package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +65 -34
- package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +66 -11
- package/src/tokens/functional/color/light/patterns-light.json5 +13 -1
- package/src/tokens/functional/color/light/primitives-light.json5 +2 -2
- package/src/tokens/functional/motion/loading.json5 +1 -1
- package/src/tokens/functional/motion/patterns.json5 +9 -2
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { isSource } from '../filters/index.js';
|
|
11
|
+
const validFigmaToken = (token, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
const valueProp = options.usesDtcg ? '$value' : 'value';
|
|
6
13
|
const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily', 'number'];
|
|
7
14
|
// is a siource token, not an included one
|
|
8
|
-
if (!
|
|
15
|
+
if (!isSource(token) || !token.$type)
|
|
9
16
|
return false;
|
|
10
|
-
if (`${token
|
|
17
|
+
if (`${token[valueProp]}`.substring(token[valueProp].length - 2) === 'em')
|
|
11
18
|
return false;
|
|
12
19
|
// has a collection attribute
|
|
13
20
|
if (!('$extensions' in token) ||
|
|
@@ -16,21 +23,20 @@ const validFigmaToken = (token) => {
|
|
|
16
23
|
return false;
|
|
17
24
|
// is a color or dimension type
|
|
18
25
|
return validTypes.includes(token.$type);
|
|
19
|
-
};
|
|
20
|
-
const figma = (outputFile, prefix, buildPath, options) => ({
|
|
26
|
+
});
|
|
27
|
+
export const figma = (outputFile, prefix, buildPath, options) => ({
|
|
21
28
|
prefix,
|
|
22
29
|
buildPath,
|
|
23
30
|
transforms: [
|
|
24
31
|
'color/rgbaFloat',
|
|
25
|
-
'name/pathToFigma',
|
|
26
|
-
// 'name/pathToSlashNotation',
|
|
27
|
-
'figma/attributes',
|
|
28
32
|
'fontFamily/figma',
|
|
29
33
|
'float/pixelUnitless',
|
|
30
34
|
'dimension/pixelUnitless',
|
|
31
35
|
// 'border/figma',
|
|
32
36
|
// 'typography/figma',
|
|
33
37
|
'fontWeight/number',
|
|
38
|
+
'figma/attributes',
|
|
39
|
+
'name/pathToFigma',
|
|
34
40
|
],
|
|
35
41
|
options: Object.assign({ basePxFontSize: 16, fontFamilies: {
|
|
36
42
|
'fontStack/system': 'SF Pro Text',
|
|
@@ -41,7 +47,9 @@ const figma = (outputFile, prefix, buildPath, options) => ({
|
|
|
41
47
|
files: [
|
|
42
48
|
{
|
|
43
49
|
destination: outputFile,
|
|
44
|
-
filter:
|
|
50
|
+
filter: (token, config) => {
|
|
51
|
+
return validFigmaToken(token, config);
|
|
52
|
+
},
|
|
45
53
|
format: `json/figma`,
|
|
46
54
|
options: {
|
|
47
55
|
outputReferences: true,
|
|
@@ -50,4 +58,3 @@ const figma = (outputFile, prefix, buildPath, options) => ({
|
|
|
50
58
|
},
|
|
51
59
|
],
|
|
52
60
|
});
|
|
53
|
-
exports.figma = figma;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { css } from './css';
|
|
2
|
-
export { deprecatedJson } from './deprecatedJson';
|
|
3
|
-
export { docJson } from './docJson';
|
|
4
|
-
export { fallbacks } from './fallbacks';
|
|
5
|
-
export { figma } from './figma';
|
|
6
|
-
export { javascript } from './javascript';
|
|
7
|
-
export { json } from './json';
|
|
8
|
-
export { styleLint } from './styleLint';
|
|
9
|
-
export { typeDefinitions } from './typeDefinitions';
|
|
10
|
-
export { typescript } from './typescript';
|
|
1
|
+
export { css } from './css.js';
|
|
2
|
+
export { deprecatedJson } from './deprecatedJson.js';
|
|
3
|
+
export { docJson } from './docJson.js';
|
|
4
|
+
export { fallbacks } from './fallbacks.js';
|
|
5
|
+
export { figma } from './figma.js';
|
|
6
|
+
export { javascript } from './javascript.js';
|
|
7
|
+
export { json } from './json.js';
|
|
8
|
+
export { styleLint } from './styleLint.js';
|
|
9
|
+
export { typeDefinitions } from './typeDefinitions.js';
|
|
10
|
+
export { typescript } from './typescript.js';
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "fallbacks", { enumerable: true, get: function () { return fallbacks_1.fallbacks; } });
|
|
12
|
-
var figma_1 = require("./figma");
|
|
13
|
-
Object.defineProperty(exports, "figma", { enumerable: true, get: function () { return figma_1.figma; } });
|
|
14
|
-
var javascript_1 = require("./javascript");
|
|
15
|
-
Object.defineProperty(exports, "javascript", { enumerable: true, get: function () { return javascript_1.javascript; } });
|
|
16
|
-
var json_1 = require("./json");
|
|
17
|
-
Object.defineProperty(exports, "json", { enumerable: true, get: function () { return json_1.json; } });
|
|
18
|
-
var styleLint_1 = require("./styleLint");
|
|
19
|
-
Object.defineProperty(exports, "styleLint", { enumerable: true, get: function () { return styleLint_1.styleLint; } });
|
|
20
|
-
var typeDefinitions_1 = require("./typeDefinitions");
|
|
21
|
-
Object.defineProperty(exports, "typeDefinitions", { enumerable: true, get: function () { return typeDefinitions_1.typeDefinitions; } });
|
|
22
|
-
var typescript_1 = require("./typescript");
|
|
23
|
-
Object.defineProperty(exports, "typescript", { enumerable: true, get: function () { return typescript_1.typescript; } });
|
|
1
|
+
export { css } from './css.js';
|
|
2
|
+
export { deprecatedJson } from './deprecatedJson.js';
|
|
3
|
+
export { docJson } from './docJson.js';
|
|
4
|
+
export { fallbacks } from './fallbacks.js';
|
|
5
|
+
export { figma } from './figma.js';
|
|
6
|
+
export { javascript } from './javascript.js';
|
|
7
|
+
export { json } from './json.js';
|
|
8
|
+
export { styleLint } from './styleLint.js';
|
|
9
|
+
export { typeDefinitions } from './typeDefinitions.js';
|
|
10
|
+
export { typescript } from './typescript.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const javascript: PlatformInitializer;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.javascript = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const javascript = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isSource } from '../filters/index.js';
|
|
2
|
+
export const javascript = (outputFile, prefix, buildPath) => ({
|
|
6
3
|
prefix,
|
|
7
4
|
buildPath,
|
|
8
5
|
transforms: [
|
|
@@ -23,8 +20,7 @@ const javascript = (outputFile, prefix, buildPath) => ({
|
|
|
23
20
|
{
|
|
24
21
|
format: 'javascript/commonJs',
|
|
25
22
|
destination: outputFile,
|
|
26
|
-
filter:
|
|
23
|
+
filter: isSource,
|
|
27
24
|
},
|
|
28
25
|
],
|
|
29
26
|
});
|
|
30
|
-
exports.javascript = javascript;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const json: PlatformInitializer;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.json = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const json = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isSource } from '../filters/index.js';
|
|
2
|
+
export const json = (outputFile, prefix, buildPath) => ({
|
|
6
3
|
prefix,
|
|
7
4
|
buildPath,
|
|
8
5
|
transforms: [
|
|
@@ -21,7 +18,7 @@ const json = (outputFile, prefix, buildPath) => ({
|
|
|
21
18
|
files: [
|
|
22
19
|
{
|
|
23
20
|
destination: outputFile,
|
|
24
|
-
filter:
|
|
21
|
+
filter: isSource,
|
|
25
22
|
format: `json/nested-prefixed`,
|
|
26
23
|
options: {
|
|
27
24
|
outputReferences: false,
|
|
@@ -29,4 +26,3 @@ const json = (outputFile, prefix, buildPath) => ({
|
|
|
29
26
|
},
|
|
30
27
|
],
|
|
31
28
|
});
|
|
32
|
-
exports.json = json;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const styleLint: PlatformInitializer;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.styleLint = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const styleLint = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isSource } from '../filters/index.js';
|
|
2
|
+
export const styleLint = (outputFile, prefix, buildPath) => ({
|
|
6
3
|
prefix,
|
|
7
4
|
buildPath,
|
|
8
5
|
transforms: [
|
|
@@ -23,7 +20,7 @@ const styleLint = (outputFile, prefix, buildPath) => ({
|
|
|
23
20
|
{
|
|
24
21
|
destination: outputFile,
|
|
25
22
|
format: `json/one-dimensional`,
|
|
26
|
-
filter:
|
|
23
|
+
filter: isSource,
|
|
27
24
|
options: {
|
|
28
25
|
outputReferences: false,
|
|
29
26
|
outputVerbose: true,
|
|
@@ -31,4 +28,3 @@ const styleLint = (outputFile, prefix, buildPath) => ({
|
|
|
31
28
|
},
|
|
32
29
|
],
|
|
33
30
|
});
|
|
34
|
-
exports.styleLint = styleLint;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const typeDefinitions: PlatformInitializer;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const utilities_1 = require("../utilities");
|
|
6
|
-
const typeDefinitions = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isSource } from '../filters/index.js';
|
|
2
|
+
import { upperCaseFirstCharacter } from '../utilities/index.js';
|
|
3
|
+
export const typeDefinitions = (outputFile, prefix, buildPath) => ({
|
|
7
4
|
prefix,
|
|
8
5
|
buildPath,
|
|
9
6
|
transforms: [
|
|
@@ -18,13 +15,12 @@ const typeDefinitions = (outputFile, prefix, buildPath) => ({
|
|
|
18
15
|
files: [
|
|
19
16
|
{
|
|
20
17
|
format: 'typescript/export-definition',
|
|
21
|
-
destination: `${
|
|
22
|
-
filter:
|
|
18
|
+
destination: `${upperCaseFirstCharacter(outputFile)}DesignTokens.d.ts`,
|
|
19
|
+
filter: isSource,
|
|
23
20
|
options: {
|
|
24
21
|
tokenTypesPath: './src/types/',
|
|
25
|
-
moduleName: `${
|
|
22
|
+
moduleName: `${upperCaseFirstCharacter(outputFile)}DesignTokens`,
|
|
26
23
|
},
|
|
27
24
|
},
|
|
28
25
|
],
|
|
29
26
|
});
|
|
30
|
-
exports.typeDefinitions = typeDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const typescript: PlatformInitializer;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.typescript = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const typescript = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isSource } from '../filters/index.js';
|
|
2
|
+
export const typescript = (outputFile, prefix, buildPath) => ({
|
|
6
3
|
prefix,
|
|
7
4
|
buildPath,
|
|
8
5
|
transforms: [
|
|
@@ -23,8 +20,7 @@ const typescript = (outputFile, prefix, buildPath) => ({
|
|
|
23
20
|
{
|
|
24
21
|
format: 'javascript/esm',
|
|
25
22
|
destination: outputFile,
|
|
26
|
-
filter:
|
|
23
|
+
filter: isSource,
|
|
27
24
|
},
|
|
28
25
|
],
|
|
29
26
|
});
|
|
30
|
-
exports.typescript = typescript;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
|
|
6
|
-
exports.alphaValue = zod_1.z.any().refine(value => typeof value === 'number' && value >= 0 && value <= 1, value => ({
|
|
7
|
-
message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid alpha value: "${value}" (${typeof value})`, 'Alpha value must be a number between 0 and 1.'),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { schemaErrorMessage } from '../utilities/index.js';
|
|
3
|
+
export const alphaValue = z.any().refine(value => typeof value === 'number' && value >= 0 && value <= 1, value => ({
|
|
4
|
+
message: schemaErrorMessage(`Invalid alpha value: "${value}" (${typeof value})`, 'Alpha value must be a number between 0 and 1.'),
|
|
8
5
|
}));
|
|
@@ -3,9 +3,9 @@ export declare const baseToken: z.ZodObject<{
|
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
4
|
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
}, "strict", z.ZodTypeAny, {
|
|
6
|
-
deprecated?: string | boolean | undefined;
|
|
7
6
|
$description?: string | undefined;
|
|
8
|
-
}, {
|
|
9
7
|
deprecated?: string | boolean | undefined;
|
|
8
|
+
}, {
|
|
10
9
|
$description?: string | undefined;
|
|
10
|
+
deprecated?: string | boolean | undefined;
|
|
11
11
|
}>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.baseToken = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.baseToken = zod_1.z
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const baseToken = z
|
|
6
3
|
.object({
|
|
7
|
-
$description:
|
|
8
|
-
deprecated:
|
|
4
|
+
$description: z.string().optional(),
|
|
5
|
+
deprecated: z.union([z.string(), z.boolean()]).optional(),
|
|
9
6
|
})
|
|
10
7
|
.strict();
|
|
@@ -29,23 +29,23 @@ export declare const borderToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
29
29
|
color: string;
|
|
30
30
|
style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
|
|
31
31
|
}>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
32
|
-
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "
|
|
32
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
33
33
|
}>, "strict", z.ZodTypeAny, {
|
|
34
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
35
34
|
$value: string | {
|
|
36
35
|
width: string | 0;
|
|
37
36
|
color: string;
|
|
38
37
|
style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
|
|
39
38
|
};
|
|
40
|
-
|
|
39
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
41
40
|
$description?: string | undefined;
|
|
41
|
+
deprecated?: string | boolean | undefined;
|
|
42
42
|
}, {
|
|
43
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
44
43
|
$value: string | {
|
|
45
44
|
width: string | 0;
|
|
46
45
|
color: string;
|
|
47
46
|
style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
|
|
48
47
|
};
|
|
49
|
-
|
|
48
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
50
49
|
$description?: string | undefined;
|
|
50
|
+
deprecated?: string | boolean | undefined;
|
|
51
51
|
}>;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
color: zod_1.z.union([colorHexValue_1.colorHexValue, referenceValue_1.referenceValue]),
|
|
12
|
-
style: zod_1.z.enum(['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'outset', 'inset']),
|
|
13
|
-
width: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
|
|
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 { dimensionValue } from './dimensionValue.js';
|
|
6
|
+
import { tokenType } from './tokenType.js';
|
|
7
|
+
export const borderValue = z.object({
|
|
8
|
+
color: z.union([colorHexValue, referenceValue]),
|
|
9
|
+
style: z.enum(['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'outset', 'inset']),
|
|
10
|
+
width: z.union([dimensionValue, referenceValue]),
|
|
14
11
|
});
|
|
15
|
-
|
|
12
|
+
export const borderToken = baseToken
|
|
16
13
|
.extend({
|
|
17
|
-
$value:
|
|
18
|
-
$type:
|
|
14
|
+
$value: z.union([borderValue, referenceValue]),
|
|
15
|
+
$type: tokenType('border'),
|
|
19
16
|
})
|
|
20
17
|
.strict();
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
|
|
7
|
-
const collection = (collections) => {
|
|
8
|
-
return zod_1.z.string().refine(value => collections.includes(value), value => ({
|
|
9
|
-
message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid collection: "${value}"`, `Valid collections are ${(0, joinFriendly_1.joinFriendly)(collections)}`),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { joinFriendly, schemaErrorMessage } from '../utilities/index.js';
|
|
3
|
+
export const collection = (collections) => {
|
|
4
|
+
return z.string().refine(value => collections.includes(value), value => ({
|
|
5
|
+
message: schemaErrorMessage(`Invalid collection: "${value}"`, `Valid collections are ${joinFriendly(collections)}`),
|
|
10
6
|
}));
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid mode: "${value}"`, `Valid modes are ${(0, joinFriendly_1.joinFriendly)(modes)}`),
|
|
8
|
+
export const mode = (modes) => {
|
|
9
|
+
return z.string().refine(value => modes.includes(value), value => ({
|
|
10
|
+
message: schemaErrorMessage(`Invalid mode: "${value}"`, `Valid modes are ${joinFriendly(modes)}`),
|
|
16
11
|
}));
|
|
17
12
|
};
|
|
18
|
-
exports.mode = mode;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.colorHexValue = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { schemaErrorMessage } from '../utilities/index.js';
|
|
6
3
|
const colorHex3RegEx = '^#[0-9a-f]{3}$';
|
|
7
4
|
const colorHex6RegEx = '^#[0-9a-f]{6}$';
|
|
8
5
|
const colorHex8RegEx = '^#[0-9a-f]{8}$';
|
|
9
6
|
const colorHexRegex = new RegExp(`(${colorHex3RegEx})|(${colorHex6RegEx})|(${colorHex8RegEx})`, 'i');
|
|
10
|
-
|
|
11
|
-
message:
|
|
7
|
+
export const colorHexValue = z.string().refine(color => colorHexRegex.test(color), color => ({
|
|
8
|
+
message: schemaErrorMessage(`Invalid color: "${color}"`, 'Color must be a hex string or a reference to a color token.'),
|
|
12
9
|
}));
|
|
@@ -4,7 +4,7 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
4
4
|
deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
}, {
|
|
6
6
|
$value: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, 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
|
alpha: z.ZodNullable<z.ZodOptional<z.ZodEffects<z.ZodAny, any, any>>>;
|
|
9
9
|
mix: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
10
10
|
color: z.ZodString;
|
|
@@ -17,7 +17,8 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
17
17
|
weight: number;
|
|
18
18
|
}>>>;
|
|
19
19
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
20
|
-
|
|
20
|
+
alpha: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
21
|
+
'org.primer.figma': z.ZodOptional<z.ZodObject<{
|
|
21
22
|
collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
22
23
|
mode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
23
24
|
scopes: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
|
|
@@ -29,52 +30,56 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
29
30
|
mode?: string | undefined;
|
|
30
31
|
collection?: string | undefined;
|
|
31
32
|
scopes?: string[] | undefined;
|
|
32
|
-
}
|
|
33
|
+
}>>;
|
|
33
34
|
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
|
|
35
|
+
alpha?: number | null | undefined;
|
|
36
|
+
'org.primer.figma'?: {
|
|
35
37
|
mode?: string | undefined;
|
|
36
38
|
collection?: string | undefined;
|
|
37
39
|
scopes?: string[] | undefined;
|
|
38
|
-
};
|
|
40
|
+
} | undefined;
|
|
39
41
|
}, {
|
|
40
|
-
|
|
42
|
+
alpha?: number | null | undefined;
|
|
43
|
+
'org.primer.figma'?: {
|
|
41
44
|
mode?: string | undefined;
|
|
42
45
|
collection?: string | undefined;
|
|
43
46
|
scopes?: string[] | undefined;
|
|
44
|
-
};
|
|
47
|
+
} | undefined;
|
|
45
48
|
}>>;
|
|
46
49
|
}>, "strict", z.ZodTypeAny, {
|
|
47
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
48
50
|
$value: string;
|
|
51
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
49
52
|
alpha?: any;
|
|
53
|
+
$description?: string | undefined;
|
|
50
54
|
mix?: {
|
|
51
55
|
color: string;
|
|
52
56
|
weight: number;
|
|
53
57
|
} | null | undefined;
|
|
54
58
|
deprecated?: string | boolean | undefined;
|
|
55
59
|
$extensions?: {
|
|
56
|
-
|
|
60
|
+
alpha?: number | null | undefined;
|
|
61
|
+
'org.primer.figma'?: {
|
|
57
62
|
mode?: string | undefined;
|
|
58
63
|
collection?: string | undefined;
|
|
59
64
|
scopes?: string[] | undefined;
|
|
60
|
-
};
|
|
65
|
+
} | undefined;
|
|
61
66
|
} | undefined;
|
|
62
|
-
$description?: string | undefined;
|
|
63
67
|
}, {
|
|
64
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
|
|
65
68
|
$value: string;
|
|
69
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
66
70
|
alpha?: any;
|
|
71
|
+
$description?: string | undefined;
|
|
67
72
|
mix?: {
|
|
68
73
|
color: string;
|
|
69
74
|
weight: number;
|
|
70
75
|
} | null | undefined;
|
|
71
76
|
deprecated?: string | boolean | undefined;
|
|
72
77
|
$extensions?: {
|
|
73
|
-
|
|
78
|
+
alpha?: number | null | undefined;
|
|
79
|
+
'org.primer.figma'?: {
|
|
74
80
|
mode?: string | undefined;
|
|
75
81
|
collection?: string | undefined;
|
|
76
82
|
scopes?: string[] | undefined;
|
|
77
|
-
};
|
|
83
|
+
} | undefined;
|
|
78
84
|
} | undefined;
|
|
79
|
-
$description?: string | undefined;
|
|
80
85
|
}>;
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const scopes_1 = require("./scopes");
|
|
11
|
-
const tokenType_1 = require("./tokenType");
|
|
12
|
-
exports.colorToken = baseToken_1.baseToken
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { colorHexValue } from './colorHexValue.js';
|
|
3
|
+
import { referenceValue } from './referenceValue.js';
|
|
4
|
+
import { alphaValue } from './alphaValue.js';
|
|
5
|
+
import { baseToken } from './baseToken.js';
|
|
6
|
+
import { collection, mode } from './collections.js';
|
|
7
|
+
import { scopes } from './scopes.js';
|
|
8
|
+
import { tokenType } from './tokenType.js';
|
|
9
|
+
export const colorToken = baseToken
|
|
13
10
|
.extend({
|
|
14
|
-
$value:
|
|
15
|
-
$type:
|
|
16
|
-
alpha:
|
|
17
|
-
mix:
|
|
11
|
+
$value: z.union([colorHexValue, referenceValue]),
|
|
12
|
+
$type: tokenType('color'),
|
|
13
|
+
alpha: alphaValue.optional().nullable(),
|
|
14
|
+
mix: z
|
|
18
15
|
.object({
|
|
19
|
-
color:
|
|
20
|
-
weight:
|
|
16
|
+
color: z.string(),
|
|
17
|
+
weight: z.number().min(0).max(1),
|
|
21
18
|
})
|
|
22
19
|
.nullable()
|
|
23
20
|
.optional(),
|
|
24
|
-
$extensions:
|
|
21
|
+
$extensions: z
|
|
25
22
|
.object({
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
alpha: z.number().min(0).max(1).optional().nullable(),
|
|
24
|
+
'org.primer.figma': z
|
|
25
|
+
.object({
|
|
26
|
+
collection: collection([
|
|
28
27
|
'base/color/light',
|
|
29
28
|
'base/color/light-high-contrast',
|
|
30
29
|
'base/color/dark',
|
|
@@ -33,7 +32,7 @@ exports.colorToken = baseToken_1.baseToken
|
|
|
33
32
|
'mode',
|
|
34
33
|
'pattern/mode',
|
|
35
34
|
]).optional(),
|
|
36
|
-
mode:
|
|
35
|
+
mode: mode([
|
|
37
36
|
'light',
|
|
38
37
|
'dark',
|
|
39
38
|
'dark dimmed',
|
|
@@ -44,8 +43,9 @@ exports.colorToken = baseToken_1.baseToken
|
|
|
44
43
|
'light tritanopia',
|
|
45
44
|
'dark tritanopia',
|
|
46
45
|
]).optional(),
|
|
47
|
-
scopes:
|
|
48
|
-
})
|
|
46
|
+
scopes: scopes(['all', 'bgColor', 'fgColor', 'borderColor', 'effectColor']).optional(),
|
|
47
|
+
})
|
|
48
|
+
.optional(),
|
|
49
49
|
})
|
|
50
50
|
.optional(),
|
|
51
51
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const cubicBezierToken: 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.ZodArray<z.ZodNumber, "many">, z.ZodEffects<z.ZodString, string, string>]>;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
|
+
}>, "strict", z.ZodTypeAny, {
|
|
9
|
+
$value: string | number[];
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
11
|
+
$description?: string | undefined;
|
|
12
|
+
deprecated?: string | boolean | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
$value: string | number[];
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
16
|
+
$description?: string | undefined;
|
|
17
|
+
deprecated?: string | boolean | undefined;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 cubicBezierToken = baseToken.extend({
|
|
6
|
+
$value: z.union([z.array(z.number()).length(4), referenceValue]),
|
|
7
|
+
$type: tokenType('cubicBezier'),
|
|
8
|
+
});
|