@primer/primitives 9.1.2 → 10.0.0-rc.6651a0c1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/functional/themes/dark-colorblind.css +4 -4
- package/dist/css/functional/themes/dark-high-contrast.css +20 -20
- package/dist/css/functional/themes/light-high-contrast.css +14 -14
- package/dist/css/functional/typography/typography.css +20 -20
- package/dist/css/primitives.css +20 -20
- package/dist/docs/base/size/size.json +76 -76
- package/dist/docs/base/typography/typography.json +16 -16
- package/dist/docs/functional/motion/motion.json +18 -18
- package/dist/docs/functional/size/border.json +56 -56
- package/dist/docs/functional/size/breakpoints.json +24 -24
- package/dist/docs/functional/size/size-coarse.json +12 -12
- package/dist/docs/functional/size/size-fine.json +12 -12
- package/dist/docs/functional/size/size.json +264 -264
- package/dist/docs/functional/size/viewport.json +24 -24
- package/dist/docs/functional/themes/dark-colorblind.json +2310 -3186
- package/dist/docs/functional/themes/dark-dimmed.json +2300 -2794
- package/dist/docs/functional/themes/dark-high-contrast.json +2520 -5038
- package/dist/docs/functional/themes/dark-tritanopia.json +2351 -3003
- package/dist/docs/functional/themes/dark.json +2270 -2270
- package/dist/docs/functional/themes/light-colorblind.json +2298 -3124
- package/dist/docs/functional/themes/light-high-contrast.json +2419 -4645
- package/dist/docs/functional/themes/light-tritanopia.json +2330 -2990
- package/dist/docs/functional/themes/light.json +2260 -2260
- package/dist/docs/functional/typography/typography.json +206 -206
- package/dist/figma/dimension/dimension.json +489 -489
- package/dist/figma/figma.json +11 -3
- package/dist/figma/scales/dark-dimmed.json +38 -38
- package/dist/figma/scales/dark-high-constrast.json +38 -38
- package/dist/figma/scales/dark.json +35 -35
- package/dist/figma/scales/light-high-constrast.json +40 -40
- package/dist/figma/scales/light.json +40 -40
- package/dist/figma/shadows/dark-colorblind.json +280 -280
- package/dist/figma/shadows/dark-dimmed.json +280 -280
- package/dist/figma/shadows/dark-high-contrast.json +280 -280
- package/dist/figma/shadows/dark-tritanopia.json +280 -280
- package/dist/figma/shadows/dark.json +280 -280
- package/dist/figma/shadows/light-colorblind.json +281 -281
- package/dist/figma/shadows/light-high-contrast.json +281 -281
- package/dist/figma/shadows/light-tritanopia.json +281 -281
- package/dist/figma/shadows/light.json +281 -281
- package/dist/figma/themes/dark-colorblind.json +4991 -5854
- package/dist/figma/themes/dark-dimmed.json +5314 -5799
- package/dist/figma/themes/dark-high-contrast.json +4210 -6679
- package/dist/figma/themes/dark-tritanopia.json +5165 -5817
- package/dist/figma/themes/dark.json +5534 -5537
- package/dist/figma/themes/light-colorblind.json +4857 -5669
- package/dist/figma/themes/light-high-contrast.json +4198 -6372
- package/dist/figma/themes/light-tritanopia.json +4901 -5529
- package/dist/figma/themes/light.json +5349 -5349
- package/dist/figma/typography/typography.json +112 -156
- package/dist/internalCss/dark-colorblind.css +4 -4
- package/dist/internalCss/dark-high-contrast.css +20 -20
- package/dist/internalCss/light-high-contrast.css +14 -14
- package/dist/styleLint/base/size/size.json +38 -38
- package/dist/styleLint/base/typography/typography.json +8 -8
- package/dist/styleLint/functional/motion/motion.json +12 -12
- package/dist/styleLint/functional/size/border.json +30 -30
- package/dist/styleLint/functional/size/breakpoints.json +12 -12
- package/dist/styleLint/functional/size/size-coarse.json +6 -6
- package/dist/styleLint/functional/size/size-fine.json +6 -6
- package/dist/styleLint/functional/size/size.json +132 -132
- package/dist/styleLint/functional/size/viewport.json +12 -12
- package/dist/styleLint/functional/themes/dark-colorblind.json +1171 -2047
- package/dist/styleLint/functional/themes/dark-dimmed.json +1160 -1654
- package/dist/styleLint/functional/themes/dark-high-contrast.json +1307 -3825
- package/dist/styleLint/functional/themes/dark-tritanopia.json +1232 -1884
- package/dist/styleLint/functional/themes/dark.json +1140 -1140
- package/dist/styleLint/functional/themes/light-colorblind.json +1198 -2024
- package/dist/styleLint/functional/themes/light-high-contrast.json +1270 -3496
- package/dist/styleLint/functional/themes/light-tritanopia.json +1205 -1865
- package/dist/styleLint/functional/themes/light.json +1130 -1130
- package/dist/styleLint/functional/typography/typography.json +114 -114
- package/package.json +18 -10
- package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +4 -4
- package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +6 -0
- package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +21 -3
- package/src/tokens/functional/color/dark/primitives-dark.json5 +3 -3
- package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +4 -1
- package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +4 -1
- package/src/tokens/functional/color/light/primitives-light.json5 +2 -2
- package/dist/build/PrimerStyleDictionary.d.ts +0 -9
- package/dist/build/PrimerStyleDictionary.js +0 -92
- package/dist/build/filters/index.d.ts +0 -13
- package/dist/build/filters/index.js +0 -29
- package/dist/build/filters/isBorder.d.ts +0 -7
- package/dist/build/filters/isBorder.js +0 -12
- package/dist/build/filters/isColor.d.ts +0 -7
- package/dist/build/filters/isColor.js +0 -12
- package/dist/build/filters/isColorWithAlpha.d.ts +0 -7
- package/dist/build/filters/isColorWithAlpha.js +0 -13
- package/dist/build/filters/isColorWithMix.d.ts +0 -7
- package/dist/build/filters/isColorWithMix.js +0 -28
- package/dist/build/filters/isDeprecated.d.ts +0 -7
- package/dist/build/filters/isDeprecated.js +0 -12
- package/dist/build/filters/isDimension.d.ts +0 -7
- package/dist/build/filters/isDimension.js +0 -12
- package/dist/build/filters/isDuration.d.ts +0 -7
- package/dist/build/filters/isDuration.js +0 -12
- package/dist/build/filters/isFontFamily.d.ts +0 -7
- package/dist/build/filters/isFontFamily.js +0 -12
- package/dist/build/filters/isFontWeight.d.ts +0 -7
- package/dist/build/filters/isFontWeight.js +0 -12
- package/dist/build/filters/isFromFile.d.ts +0 -8
- package/dist/build/filters/isFromFile.js +0 -14
- package/dist/build/filters/isNumber.d.ts +0 -7
- package/dist/build/filters/isNumber.js +0 -10
- package/dist/build/filters/isShadow.d.ts +0 -7
- package/dist/build/filters/isShadow.js +0 -12
- package/dist/build/filters/isSource.d.ts +0 -7
- package/dist/build/filters/isSource.js +0 -12
- package/dist/build/filters/isTypography.d.ts +0 -7
- package/dist/build/filters/isTypography.js +0 -12
- package/dist/build/formats/cssAdvanced.d.ts +0 -2
- package/dist/build/formats/cssAdvanced.js +0 -84
- package/dist/build/formats/cssCustomMedia.d.ts +0 -7
- package/dist/build/formats/cssCustomMedia.js +0 -25
- package/dist/build/formats/index.d.ts +0 -9
- package/dist/build/formats/index.js +0 -21
- package/dist/build/formats/javascriptCommonJs.d.ts +0 -7
- package/dist/build/formats/javascriptCommonJs.js +0 -25
- package/dist/build/formats/javascriptEsm.d.ts +0 -7
- package/dist/build/formats/javascriptEsm.js +0 -25
- package/dist/build/formats/jsonFigma.d.ts +0 -7
- package/dist/build/formats/jsonFigma.js +0 -116
- package/dist/build/formats/jsonNestedPrefixed.d.ts +0 -8
- package/dist/build/formats/jsonNestedPrefixed.js +0 -28
- package/dist/build/formats/jsonOneDimensional.d.ts +0 -8
- package/dist/build/formats/jsonOneDimensional.js +0 -24
- package/dist/build/formats/jsonPostCssFallback.d.ts +0 -8
- package/dist/build/formats/jsonPostCssFallback.js +0 -21
- package/dist/build/formats/typescriptExportDefinition.d.ts +0 -7
- package/dist/build/formats/typescriptExportDefinition.js +0 -166
- package/dist/build/formats/utilities/jsonToFlat.d.ts +0 -11
- package/dist/build/formats/utilities/jsonToFlat.js +0 -12
- package/dist/build/formats/utilities/jsonToNestedValue.d.ts +0 -8
- package/dist/build/formats/utilities/jsonToNestedValue.js +0 -25
- package/dist/build/formats/utilities/prefixTokens.d.ts +0 -8
- package/dist/build/formats/utilities/prefixTokens.js +0 -17
- package/dist/build/parsers/index.d.ts +0 -1
- package/dist/build/parsers/index.js +0 -5
- package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
- package/dist/build/parsers/w3cJsonParser.js +0 -27
- package/dist/build/platforms/css.d.ts +0 -2
- package/dist/build/platforms/css.js +0 -87
- package/dist/build/platforms/deprecatedJson.d.ts +0 -2
- package/dist/build/platforms/deprecatedJson.js +0 -17
- package/dist/build/platforms/docJson.d.ts +0 -2
- package/dist/build/platforms/docJson.js +0 -34
- package/dist/build/platforms/fallbacks.d.ts +0 -2
- package/dist/build/platforms/fallbacks.js +0 -34
- package/dist/build/platforms/figma.d.ts +0 -2
- package/dist/build/platforms/figma.js +0 -53
- package/dist/build/platforms/index.d.ts +0 -10
- package/dist/build/platforms/index.js +0 -23
- package/dist/build/platforms/javascript.d.ts +0 -2
- package/dist/build/platforms/javascript.js +0 -30
- package/dist/build/platforms/json.d.ts +0 -2
- package/dist/build/platforms/json.js +0 -32
- package/dist/build/platforms/styleLint.d.ts +0 -2
- package/dist/build/platforms/styleLint.js +0 -34
- package/dist/build/platforms/typeDefinitions.d.ts +0 -2
- package/dist/build/platforms/typeDefinitions.js +0 -30
- package/dist/build/platforms/typescript.d.ts +0 -2
- package/dist/build/platforms/typescript.js +0 -30
- package/dist/build/schemas/alphaValue.d.ts +0 -2
- package/dist/build/schemas/alphaValue.js +0 -8
- package/dist/build/schemas/baseToken.d.ts +0 -11
- package/dist/build/schemas/baseToken.js +0 -10
- package/dist/build/schemas/borderToken.d.ts +0 -51
- package/dist/build/schemas/borderToken.js +0 -20
- package/dist/build/schemas/collections.d.ts +0 -6
- package/dist/build/schemas/collections.js +0 -18
- package/dist/build/schemas/colorHexValue.d.ts +0 -2
- package/dist/build/schemas/colorHexValue.js +0 -12
- package/dist/build/schemas/colorToken.d.ts +0 -80
- package/dist/build/schemas/colorToken.js +0 -52
- package/dist/build/schemas/designToken.d.ts +0 -2
- package/dist/build/schemas/designToken.js +0 -37
- package/dist/build/schemas/dimensionToken.d.ts +0 -52
- package/dist/build/schemas/dimensionToken.js +0 -36
- package/dist/build/schemas/dimensionValue.d.ts +0 -2
- package/dist/build/schemas/dimensionValue.js +0 -12
- package/dist/build/schemas/durationToken.d.ts +0 -18
- package/dist/build/schemas/durationToken.js +0 -14
- package/dist/build/schemas/durationValue.d.ts +0 -2
- package/dist/build/schemas/durationValue.js +0 -8
- package/dist/build/schemas/fontFamilyToken.d.ts +0 -52
- package/dist/build/schemas/fontFamilyToken.js +0 -23
- package/dist/build/schemas/fontWeightToken.d.ts +0 -52
- package/dist/build/schemas/fontWeightToken.js +0 -24
- package/dist/build/schemas/fontWeightValue.d.ts +0 -2
- package/dist/build/schemas/fontWeightValue.js +0 -9
- package/dist/build/schemas/numberToken.d.ts +0 -71
- package/dist/build/schemas/numberToken.js +0 -30
- package/dist/build/schemas/referenceValue.d.ts +0 -2
- package/dist/build/schemas/referenceValue.js +0 -8
- package/dist/build/schemas/scopes.d.ts +0 -5
- package/dist/build/schemas/scopes.js +0 -34
- package/dist/build/schemas/shadowToken.d.ts +0 -157
- package/dist/build/schemas/shadowToken.js +0 -46
- package/dist/build/schemas/stringToken.d.ts +0 -18
- package/dist/build/schemas/stringToken.js +0 -13
- package/dist/build/schemas/tokenName.d.ts +0 -2
- package/dist/build/schemas/tokenName.js +0 -8
- package/dist/build/schemas/tokenType.d.ts +0 -3
- package/dist/build/schemas/tokenType.js +0 -6
- package/dist/build/schemas/typographyToken.d.ts +0 -59
- package/dist/build/schemas/typographyToken.js +0 -21
- package/dist/build/schemas/validTokenType.d.ts +0 -5
- package/dist/build/schemas/validTokenType.js +0 -34
- package/dist/build/schemas/viewportRangeToken.d.ts +0 -18
- package/dist/build/schemas/viewportRangeToken.js +0 -13
- package/dist/build/transformers/borderToCss.d.ts +0 -8
- package/dist/build/transformers/borderToCss.js +0 -38
- package/dist/build/transformers/colorToHex.d.ts +0 -8
- package/dist/build/transformers/colorToHex.js +0 -26
- package/dist/build/transformers/colorToHexMix.d.ts +0 -8
- package/dist/build/transformers/colorToHexMix.js +0 -25
- package/dist/build/transformers/colorToRgbAlpha.d.ts +0 -8
- package/dist/build/transformers/colorToRgbAlpha.js +0 -22
- package/dist/build/transformers/colorToRgbaFloat.d.ts +0 -8
- package/dist/build/transformers/colorToRgbaFloat.js +0 -50
- package/dist/build/transformers/dimensionToPixelUnitless.d.ts +0 -8
- package/dist/build/transformers/dimensionToPixelUnitless.js +0 -50
- package/dist/build/transformers/dimensionToRem.d.ts +0 -8
- package/dist/build/transformers/dimensionToRem.js +0 -47
- package/dist/build/transformers/dimensionToRemPxArray.d.ts +0 -8
- package/dist/build/transformers/dimensionToRemPxArray.js +0 -47
- package/dist/build/transformers/durationToCss.d.ts +0 -8
- package/dist/build/transformers/durationToCss.js +0 -30
- package/dist/build/transformers/figmaAttributes.d.ts +0 -8
- package/dist/build/transformers/figmaAttributes.js +0 -57
- package/dist/build/transformers/floatToPixel.d.ts +0 -15
- package/dist/build/transformers/floatToPixel.js +0 -41
- package/dist/build/transformers/fontFamilyToCss.d.ts +0 -14
- package/dist/build/transformers/fontFamilyToCss.js +0 -40
- package/dist/build/transformers/fontFamilyToFigma.d.ts +0 -14
- package/dist/build/transformers/fontFamilyToFigma.js +0 -46
- package/dist/build/transformers/fontWeightToNumber.d.ts +0 -9
- package/dist/build/transformers/fontWeightToNumber.js +0 -53
- package/dist/build/transformers/index.d.ts +0 -24
- package/dist/build/transformers/index.js +0 -51
- package/dist/build/transformers/jsonDeprecated.d.ts +0 -8
- package/dist/build/transformers/jsonDeprecated.js +0 -16
- package/dist/build/transformers/namePathToCamelCase.d.ts +0 -8
- package/dist/build/transformers/namePathToCamelCase.js +0 -14
- package/dist/build/transformers/namePathToDotNotation.d.ts +0 -8
- package/dist/build/transformers/namePathToDotNotation.js +0 -33
- package/dist/build/transformers/namePathToFigma.d.ts +0 -9
- package/dist/build/transformers/namePathToFigma.js +0 -24
- package/dist/build/transformers/namePathToKebabCase.d.ts +0 -8
- package/dist/build/transformers/namePathToKebabCase.js +0 -18
- package/dist/build/transformers/namePathToPascalCase.d.ts +0 -8
- package/dist/build/transformers/namePathToPascalCase.js +0 -14
- package/dist/build/transformers/namePathToSlashNotation.d.ts +0 -8
- package/dist/build/transformers/namePathToSlashNotation.js +0 -18
- package/dist/build/transformers/shadowToCss.d.ts +0 -8
- package/dist/build/transformers/shadowToCss.js +0 -35
- package/dist/build/transformers/typographyToCss.d.ts +0 -8
- package/dist/build/transformers/typographyToCss.js +0 -29
- package/dist/build/transformers/utilities/alpha.d.ts +0 -9
- package/dist/build/transformers/utilities/alpha.js +0 -20
- package/dist/build/transformers/utilities/checkRequiredTokenProperties.d.ts +0 -7
- package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +0 -17
- package/dist/build/transformers/utilities/getTokenValue.d.ts +0 -2
- package/dist/build/transformers/utilities/getTokenValue.js +0 -18
- package/dist/build/transformers/utilities/hasSpaceInString.d.ts +0 -1
- package/dist/build/transformers/utilities/hasSpaceInString.js +0 -10
- package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +0 -2
- package/dist/build/transformers/utilities/hexToRgbaFloat.js +0 -33
- package/dist/build/transformers/utilities/invalidTokenError.d.ts +0 -7
- package/dist/build/transformers/utilities/invalidTokenError.js +0 -26
- package/dist/build/transformers/utilities/isRgbaFloat.d.ts +0 -7
- package/dist/build/transformers/utilities/isRgbaFloat.js +0 -24
- package/dist/build/transformers/utilities/mix.d.ts +0 -5
- package/dist/build/transformers/utilities/mix.js +0 -40
- package/dist/build/transformers/utilities/rgbaFloatToHex.d.ts +0 -6
- package/dist/build/transformers/utilities/rgbaFloatToHex.js +0 -15
- package/dist/build/utilities/copyFromDir.d.ts +0 -8
- package/dist/build/utilities/copyFromDir.js +0 -34
- package/dist/build/utilities/filterStringArray.d.ts +0 -1
- package/dist/build/utilities/filterStringArray.js +0 -17
- package/dist/build/utilities/getFlag.d.ts +0 -8
- package/dist/build/utilities/getFlag.js +0 -16
- package/dist/build/utilities/index.d.ts +0 -3
- package/dist/build/utilities/index.js +0 -9
- package/dist/build/utilities/joinFriendly.d.ts +0 -1
- package/dist/build/utilities/joinFriendly.js +0 -5
- package/dist/build/utilities/schemaErrorMessage.d.ts +0 -1
- package/dist/build/utilities/schemaErrorMessage.js +0 -5
- package/dist/build/utilities/toCamelCase.d.ts +0 -1
- package/dist/build/utilities/toCamelCase.js +0 -20
- package/dist/build/utilities/toPascalCase.d.ts +0 -1
- package/dist/build/utilities/toPascalCase.js +0 -17
- package/dist/build/utilities/treeWalker.d.ts +0 -8
- package/dist/build/utilities/treeWalker.js +0 -27
- package/dist/build/utilities/upperCaseFirstCharacter.d.ts +0 -8
- package/dist/build/utilities/upperCaseFirstCharacter.js +0 -14
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.typescriptExportDefinition = void 0;
|
|
7
|
-
const style_dictionary_1 = __importDefault(require("style-dictionary"));
|
|
8
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
9
|
-
const fs = require("fs");
|
|
10
|
-
const path = require("path");
|
|
11
|
-
const treeWalker_1 = require("../utilities/treeWalker");
|
|
12
|
-
const prefixTokens_1 = require("./utilities/prefixTokens");
|
|
13
|
-
const { fileHeader } = style_dictionary_1.default.formatHelpers;
|
|
14
|
-
/**
|
|
15
|
-
* unquoteTypes
|
|
16
|
-
* @description extract types from designTokenTypes (string with type definitions from file) and replace quoted types "Color" with unquoted Color
|
|
17
|
-
* @param output
|
|
18
|
-
* @param designTokenTypes
|
|
19
|
-
* @returns string with unquoted types
|
|
20
|
-
*/
|
|
21
|
-
const unquoteTypes = (output, designTokenTypes) => {
|
|
22
|
-
// join types for replacement
|
|
23
|
-
const regex = `"(${['number', 'string', 'any', ...designTokenTypes].join('|')})"`;
|
|
24
|
-
// remove strings
|
|
25
|
-
return output.replace(new RegExp(regex, 'g'), '$1');
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* getTokenType
|
|
29
|
-
* @description extract content from token files
|
|
30
|
-
* @param path string
|
|
31
|
-
*/
|
|
32
|
-
const getTokenType = (tokenTypesPath) => {
|
|
33
|
-
try {
|
|
34
|
-
const designTokenType = fs.readFileSync(path.resolve(tokenTypesPath), { encoding: 'utf-8' });
|
|
35
|
-
return designTokenType;
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
// eslint-disable-next-line no-console
|
|
39
|
-
throw new Error(`Error trying to load design token type from file "${tokenTypesPath}".`);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* @description throws an error stating the token name, type and invalid value
|
|
44
|
-
* @param token w3cTransformedToken
|
|
45
|
-
*/
|
|
46
|
-
const invalidTokenValueError = (token) => {
|
|
47
|
-
throw new Error(`Invalid token: "${token.name}" with type "${token.$type}" can not have a value of "${token.value}"`);
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* convertPropToType
|
|
51
|
-
* @description return take type attribute and return correct typescript type as string
|
|
52
|
-
* @param type
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
const convertPropToType = (tree) => {
|
|
56
|
-
if (!Object.prototype.hasOwnProperty.call(tree, 'value')) {
|
|
57
|
-
throw new Error(`Invalid token: ${tree}`);
|
|
58
|
-
}
|
|
59
|
-
switch (tree.$type) {
|
|
60
|
-
case 'color':
|
|
61
|
-
if (typeof tree.value === 'string' && tree.value[0] === '#') {
|
|
62
|
-
return 'ColorHex';
|
|
63
|
-
}
|
|
64
|
-
return invalidTokenValueError(tree);
|
|
65
|
-
case 'dimension':
|
|
66
|
-
if (typeof tree.value === 'string' && tree.value.substring(tree.value.length - 3) === 'rem')
|
|
67
|
-
return 'SizeRem';
|
|
68
|
-
if (typeof tree.value === 'string' && tree.value.substring(tree.value.length - 2) === 'em')
|
|
69
|
-
return 'SizeEm';
|
|
70
|
-
if (typeof tree.value === 'string' && tree.value.substring(tree.value.length - 2) === 'px')
|
|
71
|
-
return 'SizePx';
|
|
72
|
-
return invalidTokenValueError(tree);
|
|
73
|
-
case 'shadow':
|
|
74
|
-
return 'Shadow';
|
|
75
|
-
case 'border':
|
|
76
|
-
return 'Border';
|
|
77
|
-
default:
|
|
78
|
-
if (typeof tree.value === 'number')
|
|
79
|
-
return 'number';
|
|
80
|
-
if (typeof tree.value === 'string')
|
|
81
|
-
return 'string';
|
|
82
|
-
if (typeof tree.value === 'boolean')
|
|
83
|
-
return 'boolean';
|
|
84
|
-
return 'any';
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* a valid token node has a `value` property
|
|
89
|
-
* @param item object
|
|
90
|
-
* @returns boolean
|
|
91
|
-
*/
|
|
92
|
-
const validTokenNode = (item) => {
|
|
93
|
-
return typeof item === 'object' && item !== null && 'value' in item;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* returns a set with every used token type
|
|
97
|
-
* @param item object
|
|
98
|
-
* @param validTypes array, all other types will be removed
|
|
99
|
-
* @returns set of all used token types
|
|
100
|
-
*/
|
|
101
|
-
const getUsedTokenTypes = (tokens, validTypes) => {
|
|
102
|
-
// using a set to assure every value only exists once
|
|
103
|
-
const usedTypes = new Set();
|
|
104
|
-
// adds type to set
|
|
105
|
-
const callback = (tree) => usedTypes.add(convertPropToType(tree));
|
|
106
|
-
// tree walker adds to usedTypes
|
|
107
|
-
(0, treeWalker_1.treeWalker)(tokens, callback, validTokenNode);
|
|
108
|
-
// clean up types
|
|
109
|
-
for (const type of usedTypes) {
|
|
110
|
-
if (!validTypes.includes(type)) {
|
|
111
|
-
usedTypes.delete(type);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return usedTypes;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* returns the entire token object structure but instead of token values each token just has a typescript type
|
|
118
|
-
* @param item object
|
|
119
|
-
* @returns object
|
|
120
|
-
*/
|
|
121
|
-
const getTokenObjectWithTypes = (tokens) => {
|
|
122
|
-
// TODO: FIX typescript issues
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
return (0, treeWalker_1.treeWalker)(tokens, convertPropToType, validTokenNode);
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* getTypeDefinition
|
|
129
|
-
* @description returns type definitions as string
|
|
130
|
-
* @param tokens
|
|
131
|
-
* @param moduleName
|
|
132
|
-
* @param tokenTypesPath
|
|
133
|
-
* @returns string
|
|
134
|
-
*/
|
|
135
|
-
const getTypeDefinition = (tokens, moduleName, tokenTypesPath) => {
|
|
136
|
-
const usedTypes = getUsedTokenTypes(tokens, ['ColorHex', 'Shadow', 'Border', 'SizeEm', 'SizeRem', 'SizePx']);
|
|
137
|
-
const tokenObjectWithTypes = getTokenObjectWithTypes(tokens);
|
|
138
|
-
// get token type declaration from file
|
|
139
|
-
const designTokenTypes = [];
|
|
140
|
-
for (const type of usedTypes) {
|
|
141
|
-
// path to type files without trailing slash
|
|
142
|
-
const typePath = tokenTypesPath.replace(new RegExp(/\/$/, 'g'), '');
|
|
143
|
-
designTokenTypes.push(getTokenType(`${typePath}/${type}.d.ts`));
|
|
144
|
-
}
|
|
145
|
-
// build output
|
|
146
|
-
const output = `${designTokenTypes.join('\n')}
|
|
147
|
-
export type ${moduleName} = ${JSON.stringify(tokenObjectWithTypes, null, 2)}`;
|
|
148
|
-
// JSON stringify will quote strings, because this is a type we need it unquoted.
|
|
149
|
-
return unquoteTypes(output, [...usedTypes]);
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* @description Converts `StyleDictionary.dictionary.tokens` to typescript definition
|
|
153
|
-
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
154
|
-
* @returns formatted `string`
|
|
155
|
-
*/
|
|
156
|
-
const typescriptExportDefinition = ({ dictionary, file, options = {}, platform, }) => {
|
|
157
|
-
// extract options
|
|
158
|
-
const { moduleName = `tokens`, tokenTypesPath = `./src/types/` } = options;
|
|
159
|
-
// add prefix if defined
|
|
160
|
-
const tokens = (0, prefixTokens_1.prefixTokens)(dictionary.tokens, platform);
|
|
161
|
-
// add file header and convert output
|
|
162
|
-
const output = `${fileHeader({ file })}\n${getTypeDefinition(tokens, moduleName, tokenTypesPath)}\n`;
|
|
163
|
-
// return prettified
|
|
164
|
-
return sync_1.default.format(output, { parser: 'typescript', printWidth: 500 });
|
|
165
|
-
};
|
|
166
|
-
exports.typescriptExportDefinition = typescriptExportDefinition;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* jsonToFlat
|
|
4
|
-
* @description creates a one dimensional json structure with either a single value or an token object as the value
|
|
5
|
-
* @param token StyleDictionary.DesignToken
|
|
6
|
-
* @param returnObject - boolean
|
|
7
|
-
* @returns flat json three
|
|
8
|
-
*/
|
|
9
|
-
export declare const jsonToFlat: (tokens: StyleDictionary.TransformedToken[], returnObject?: boolean) => {
|
|
10
|
-
[k: string]: any;
|
|
11
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonToFlat = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* jsonToFlat
|
|
6
|
-
* @description creates a one dimensional json structure with either a single value or an token object as the value
|
|
7
|
-
* @param token StyleDictionary.DesignToken
|
|
8
|
-
* @param returnObject - boolean
|
|
9
|
-
* @returns flat json three
|
|
10
|
-
*/
|
|
11
|
-
const jsonToFlat = (tokens, returnObject = false) => Object.fromEntries(tokens.map(token => [token.name, returnObject ? token : token.value]));
|
|
12
|
-
exports.jsonToFlat = jsonToFlat;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* jsonToNestedValue
|
|
4
|
-
* @description creates a nested json tree where every final value is the `.value` prop
|
|
5
|
-
* @param token StyleDictionary.DesignToken
|
|
6
|
-
* @returns nested json three
|
|
7
|
-
*/
|
|
8
|
-
export declare const jsonToNestedValue: (token: StyleDictionary.DesignToken | Record<string, unknown>) => any;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonToNestedValue = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* jsonToNestedValue
|
|
6
|
-
* @description creates a nested json tree where every final value is the `.value` prop
|
|
7
|
-
* @param token StyleDictionary.DesignToken
|
|
8
|
-
* @returns nested json three
|
|
9
|
-
*/
|
|
10
|
-
const jsonToNestedValue = (token) => {
|
|
11
|
-
// is non-object value
|
|
12
|
-
if (typeof token !== 'object')
|
|
13
|
-
return token;
|
|
14
|
-
// is design token
|
|
15
|
-
if ('value' in token)
|
|
16
|
-
return token.value;
|
|
17
|
-
// is obj
|
|
18
|
-
const nextObj = {};
|
|
19
|
-
for (const [prop, value] of Object.entries(token)) {
|
|
20
|
-
// @ts-expect-error: can't predict type
|
|
21
|
-
nextObj[prop] = (0, exports.jsonToNestedValue)(value);
|
|
22
|
-
}
|
|
23
|
-
return nextObj;
|
|
24
|
-
};
|
|
25
|
-
exports.jsonToNestedValue = jsonToNestedValue;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description extract prefix from platform and add to tokens array if defined
|
|
4
|
-
* @param tokens StyleDictionary.TransformedTokens
|
|
5
|
-
* @param platform StyleDictionary.Platform
|
|
6
|
-
* @return StyleDictionary.TransformedTokens
|
|
7
|
-
*/
|
|
8
|
-
export declare const prefixTokens: (tokens: StyleDictionary.TransformedTokens, platform?: StyleDictionary.Platform) => StyleDictionary.TransformedTokens;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prefixTokens = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description extract prefix from platform and add to tokens array if defined
|
|
6
|
-
* @param tokens StyleDictionary.TransformedTokens
|
|
7
|
-
* @param platform StyleDictionary.Platform
|
|
8
|
-
* @return StyleDictionary.TransformedTokens
|
|
9
|
-
*/
|
|
10
|
-
const prefixTokens = (tokens, platform = {}) => {
|
|
11
|
-
const { prefix } = platform;
|
|
12
|
-
if (typeof prefix === 'string') {
|
|
13
|
-
tokens = { [prefix]: tokens };
|
|
14
|
-
}
|
|
15
|
-
return tokens;
|
|
16
|
-
};
|
|
17
|
-
exports.prefixTokens = prefixTokens;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { w3cJsonParser } from './w3cJsonParser';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.w3cJsonParser = void 0;
|
|
4
|
-
var w3cJsonParser_1 = require("./w3cJsonParser");
|
|
5
|
-
Object.defineProperty(exports, "w3cJsonParser", { enumerable: true, get: function () { return w3cJsonParser_1.w3cJsonParser; } });
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary';
|
|
2
|
-
/**
|
|
3
|
-
* @description Parses a valid [json5](https://json5.org) file and replaces `$value` with `value` and `$description` with `comment` to make a w3c standard file compatible with style dictionary
|
|
4
|
-
* @pattern supported file extensions `.json` or `.json5`
|
|
5
|
-
*/
|
|
6
|
-
export declare const w3cJsonParser: StyleDictionary.Parser;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.w3cJsonParser = void 0;
|
|
4
|
-
const json5_1 = require("json5");
|
|
5
|
-
/**
|
|
6
|
-
* @description Parses a valid [json5](https://json5.org) file and replaces `$value` with `value` and `$description` with `comment` to make a w3c standard file compatible with style dictionary
|
|
7
|
-
* @pattern supported file extensions `.json` or `.json5`
|
|
8
|
-
*/
|
|
9
|
-
exports.w3cJsonParser = {
|
|
10
|
-
pattern: /\.json5?$/,
|
|
11
|
-
parse: ({ filePath, contents }) => {
|
|
12
|
-
// replace $value with value so that style dictionary recognizes it
|
|
13
|
-
try {
|
|
14
|
-
contents = contents
|
|
15
|
-
.replace(/["|']?\$value["|']?:/g, '"value":')
|
|
16
|
-
// convert $description to comment
|
|
17
|
-
.replace(/["|']?\$?description["|']?:/g, '"comment":')
|
|
18
|
-
.replace(/["|']?\$?type["|']?:/g, '"$type":')
|
|
19
|
-
.replace(/["|']?\$?extensions["|']?:/g, '"$extensions":');
|
|
20
|
-
//
|
|
21
|
-
return (0, json5_1.parse)(contents);
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
throw new Error(`Invalid json5 file "${filePath}".`);
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.css = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const getCssSelectors = (outputFile) => {
|
|
6
|
-
// check for dark in the beginning of the output filename
|
|
7
|
-
const lastSlash = outputFile.lastIndexOf('/');
|
|
8
|
-
const outputBasename = outputFile.substring(lastSlash + 1, outputFile.indexOf('.'));
|
|
9
|
-
const themeName = outputBasename.replace(/-/g, '_');
|
|
10
|
-
const mode = outputBasename.substring(0, 4) === 'dark' ? 'dark' : 'light';
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
selector: `[data-color-mode="${mode}"][data-${mode}-theme="${themeName}"], [data-color-mode="${mode}"][data-${mode}-theme="${themeName}"] ::backdrop, [data-color-mode="auto"][data-light-theme="${themeName}"], [data-color-mode="auto"][data-light-theme="${themeName}"] ::backdrop`,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
query: '@media (prefers-color-scheme: dark)',
|
|
17
|
-
selector: `[data-color-mode="auto"][data-dark-theme="${themeName}"], [data-color-mode="auto"][data-dark-theme="${themeName}"] ::backdrop`,
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
};
|
|
21
|
-
const css = (outputFile, prefix, buildPath, options) => {
|
|
22
|
-
return {
|
|
23
|
-
prefix,
|
|
24
|
-
buildPath,
|
|
25
|
-
transforms: [
|
|
26
|
-
'name/pathToKebabCase',
|
|
27
|
-
'color/hex',
|
|
28
|
-
'color/hexMix',
|
|
29
|
-
'dimension/rem',
|
|
30
|
-
'duration/css',
|
|
31
|
-
'shadow/css',
|
|
32
|
-
'border/css',
|
|
33
|
-
'typography/css',
|
|
34
|
-
'fontFamily/css',
|
|
35
|
-
'fontWeight/number',
|
|
36
|
-
],
|
|
37
|
-
options: {
|
|
38
|
-
basePxFontSize: 16,
|
|
39
|
-
},
|
|
40
|
-
files: [
|
|
41
|
-
{
|
|
42
|
-
destination: `${outputFile}`,
|
|
43
|
-
format: `css/advanced`,
|
|
44
|
-
filter: token => (0, filters_1.isSource)(token) && (options === null || options === void 0 ? void 0 : options.themed) === true,
|
|
45
|
-
options: Object.assign({ showFileHeader: false, outputReferences: false, descriptions: false, queries: getCssSelectors(outputFile) }, options === null || options === void 0 ? void 0 : options.options),
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
destination: `${outputFile}`,
|
|
49
|
-
format: `css/advanced`,
|
|
50
|
-
filter: token => (0, filters_1.isSource)(token) && (options === null || options === void 0 ? void 0 : options.themed) !== true,
|
|
51
|
-
options: Object.assign({ showFileHeader: false, descriptions: false }, options === null || options === void 0 ? void 0 : options.options),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
destination: `${outputFile}`,
|
|
55
|
-
format: `css/customMedia`,
|
|
56
|
-
filter: token => (0, filters_1.isSource)(token) && (options === null || options === void 0 ? void 0 : options.themed) !== true && token.$type === 'custom-viewportRange',
|
|
57
|
-
options: {
|
|
58
|
-
showFileHeader: false,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
destination: `${outputFile}`,
|
|
63
|
-
format: `css/advanced`,
|
|
64
|
-
filter: token => (0, filters_1.isSource)(token) &&
|
|
65
|
-
(0, filters_1.isFromFile)(token, [
|
|
66
|
-
'src/tokens/functional/size/size-coarse.json',
|
|
67
|
-
'src/tokens/functional/size/size-fine.json',
|
|
68
|
-
]),
|
|
69
|
-
options: {
|
|
70
|
-
descriptions: false,
|
|
71
|
-
showFileHeader: false,
|
|
72
|
-
queries: [
|
|
73
|
-
{
|
|
74
|
-
query: '@media (pointer: fine)',
|
|
75
|
-
matcher: (token) => token.filePath.includes('size-fine'),
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
query: '@media (pointer: coarse)',
|
|
79
|
-
matcher: (token) => token.filePath.includes('size-coarse'),
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
exports.css = css;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deprecatedJson = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const deprecatedJson = (outputFile, prefix, buildPath) => ({
|
|
6
|
-
prefix,
|
|
7
|
-
buildPath,
|
|
8
|
-
transforms: ['name/pathToDotNotation', 'json/deprecated'],
|
|
9
|
-
files: [
|
|
10
|
-
{
|
|
11
|
-
destination: outputFile,
|
|
12
|
-
format: `json/flat`,
|
|
13
|
-
filter: filters_1.isDeprecated,
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
});
|
|
17
|
-
exports.deprecatedJson = deprecatedJson;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.docJson = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const docJson = (outputFile, prefix, buildPath) => ({
|
|
6
|
-
prefix,
|
|
7
|
-
buildPath,
|
|
8
|
-
transforms: [
|
|
9
|
-
'name/pathToKebabCase',
|
|
10
|
-
'color/hex',
|
|
11
|
-
'color/hexMix',
|
|
12
|
-
'dimension/rem',
|
|
13
|
-
'shadow/css',
|
|
14
|
-
'border/css',
|
|
15
|
-
'typography/css',
|
|
16
|
-
'fontFamily/css',
|
|
17
|
-
'fontWeight/number',
|
|
18
|
-
],
|
|
19
|
-
options: {
|
|
20
|
-
basePxFontSize: 16,
|
|
21
|
-
},
|
|
22
|
-
files: [
|
|
23
|
-
{
|
|
24
|
-
destination: outputFile,
|
|
25
|
-
format: `json/one-dimensional`,
|
|
26
|
-
filter: filters_1.isSource,
|
|
27
|
-
options: {
|
|
28
|
-
outputReferences: false,
|
|
29
|
-
outputVerbose: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
});
|
|
34
|
-
exports.docJson = docJson;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fallbacks = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const fallbacks = (outputFile, prefix, buildPath) => ({
|
|
6
|
-
prefix,
|
|
7
|
-
buildPath,
|
|
8
|
-
transforms: [
|
|
9
|
-
'name/pathToKebabCase',
|
|
10
|
-
'color/hex',
|
|
11
|
-
'color/hexMix',
|
|
12
|
-
'dimension/rem',
|
|
13
|
-
'shadow/css',
|
|
14
|
-
'border/css',
|
|
15
|
-
'typography/css',
|
|
16
|
-
'fontFamily/css',
|
|
17
|
-
'fontWeight/number',
|
|
18
|
-
],
|
|
19
|
-
options: {
|
|
20
|
-
basePxFontSize: 16,
|
|
21
|
-
},
|
|
22
|
-
files: [
|
|
23
|
-
{
|
|
24
|
-
destination: outputFile,
|
|
25
|
-
format: `json/postCss-fallback`,
|
|
26
|
-
filter: filters_1.isSource,
|
|
27
|
-
options: {
|
|
28
|
-
outputReferences: false,
|
|
29
|
-
outputVerbose: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
});
|
|
34
|
-
exports.fallbacks = fallbacks;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.figma = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const validFigmaToken = (token) => {
|
|
6
|
-
const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily', 'number'];
|
|
7
|
-
// is a siource token, not an included one
|
|
8
|
-
if (!(0, filters_1.isSource)(token))
|
|
9
|
-
return false;
|
|
10
|
-
if (`${token.value}`.substring(token.value.length - 2) === 'em')
|
|
11
|
-
return false;
|
|
12
|
-
// has a collection attribute
|
|
13
|
-
if (!('$extensions' in token) ||
|
|
14
|
-
!('org.primer.figma' in token.$extensions) ||
|
|
15
|
-
!('collection' in token.$extensions['org.primer.figma']))
|
|
16
|
-
return false;
|
|
17
|
-
// is a color or dimension type
|
|
18
|
-
return validTypes.includes(token.$type);
|
|
19
|
-
};
|
|
20
|
-
const figma = (outputFile, prefix, buildPath, options) => ({
|
|
21
|
-
prefix,
|
|
22
|
-
buildPath,
|
|
23
|
-
transforms: [
|
|
24
|
-
'color/rgbaFloat',
|
|
25
|
-
'name/pathToFigma',
|
|
26
|
-
// 'name/pathToSlashNotation',
|
|
27
|
-
'figma/attributes',
|
|
28
|
-
'fontFamily/figma',
|
|
29
|
-
'float/pixelUnitless',
|
|
30
|
-
'dimension/pixelUnitless',
|
|
31
|
-
// 'border/figma',
|
|
32
|
-
// 'typography/figma',
|
|
33
|
-
'fontWeight/number',
|
|
34
|
-
],
|
|
35
|
-
options: Object.assign({ basePxFontSize: 16, fontFamilies: {
|
|
36
|
-
'fontStack/system': 'SF Pro Text',
|
|
37
|
-
'fontStack/sansSerif': 'SF Pro Text',
|
|
38
|
-
'fontStack/sansSerifDisplay': 'SF Pro Display',
|
|
39
|
-
'fontStack/monospace': 'SF Mono',
|
|
40
|
-
} }, options),
|
|
41
|
-
files: [
|
|
42
|
-
{
|
|
43
|
-
destination: outputFile,
|
|
44
|
-
filter: validFigmaToken,
|
|
45
|
-
format: `json/figma`,
|
|
46
|
-
options: {
|
|
47
|
-
outputReferences: true,
|
|
48
|
-
mode: options === null || options === void 0 ? void 0 : options.mode,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
});
|
|
53
|
-
exports.figma = figma;
|
|
@@ -1,10 +0,0 @@
|
|
|
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,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescript = exports.typeDefinitions = exports.styleLint = exports.json = exports.javascript = exports.figma = exports.fallbacks = exports.docJson = exports.deprecatedJson = exports.css = void 0;
|
|
4
|
-
var css_1 = require("./css");
|
|
5
|
-
Object.defineProperty(exports, "css", { enumerable: true, get: function () { return css_1.css; } });
|
|
6
|
-
var deprecatedJson_1 = require("./deprecatedJson");
|
|
7
|
-
Object.defineProperty(exports, "deprecatedJson", { enumerable: true, get: function () { return deprecatedJson_1.deprecatedJson; } });
|
|
8
|
-
var docJson_1 = require("./docJson");
|
|
9
|
-
Object.defineProperty(exports, "docJson", { enumerable: true, get: function () { return docJson_1.docJson; } });
|
|
10
|
-
var fallbacks_1 = require("./fallbacks");
|
|
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,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.javascript = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const javascript = (outputFile, prefix, buildPath) => ({
|
|
6
|
-
prefix,
|
|
7
|
-
buildPath,
|
|
8
|
-
transforms: [
|
|
9
|
-
'color/hex',
|
|
10
|
-
'color/hexMix',
|
|
11
|
-
'dimension/rem',
|
|
12
|
-
'shadow/css',
|
|
13
|
-
'border/css',
|
|
14
|
-
'typography/css',
|
|
15
|
-
'fontFamily/css',
|
|
16
|
-
'fontWeight/number',
|
|
17
|
-
],
|
|
18
|
-
options: {
|
|
19
|
-
showFileHeader: false,
|
|
20
|
-
basePxFontSize: 16,
|
|
21
|
-
},
|
|
22
|
-
files: [
|
|
23
|
-
{
|
|
24
|
-
format: 'javascript/commonJs',
|
|
25
|
-
destination: outputFile,
|
|
26
|
-
filter: filters_1.isSource,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
exports.javascript = javascript;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.json = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const json = (outputFile, prefix, buildPath) => ({
|
|
6
|
-
prefix,
|
|
7
|
-
buildPath,
|
|
8
|
-
transforms: [
|
|
9
|
-
'color/hex',
|
|
10
|
-
'color/hexMix',
|
|
11
|
-
'dimension/rem',
|
|
12
|
-
'shadow/css',
|
|
13
|
-
'border/css',
|
|
14
|
-
'typography/css',
|
|
15
|
-
'fontFamily/css',
|
|
16
|
-
'fontWeight/number',
|
|
17
|
-
],
|
|
18
|
-
options: {
|
|
19
|
-
basePxFontSize: 16,
|
|
20
|
-
},
|
|
21
|
-
files: [
|
|
22
|
-
{
|
|
23
|
-
destination: outputFile,
|
|
24
|
-
filter: filters_1.isSource,
|
|
25
|
-
format: `json/nested-prefixed`,
|
|
26
|
-
options: {
|
|
27
|
-
outputReferences: false,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
exports.json = json;
|