@primer/primitives 9.1.2 → 10.0.0-rc.1bc5b670
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 +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 +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,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { FormatFn } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
|
|
4
|
-
* @param
|
|
4
|
+
* @param FormatFnArguments
|
|
5
5
|
* @param options.nameSeparator - separator to use for nested token name
|
|
6
6
|
* @returns formatted json `string`
|
|
7
7
|
*/
|
|
8
|
-
export declare const jsonPostCssFallback:
|
|
8
|
+
export declare const jsonPostCssFallback: FormatFn;
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
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.jsonPostCssFallback = void 0;
|
|
7
|
-
const sync_1 = __importDefault(require("@prettier/sync"));
|
|
1
|
+
import { format } from 'prettier';
|
|
8
2
|
/**
|
|
9
3
|
* @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
|
|
10
|
-
* @param
|
|
4
|
+
* @param FormatFnArguments
|
|
11
5
|
* @param options.nameSeparator - separator to use for nested token name
|
|
12
6
|
* @returns formatted json `string`
|
|
13
7
|
*/
|
|
14
|
-
const jsonPostCssFallback = ({ dictionary, file: _file }) => {
|
|
15
|
-
const tokens = Object.fromEntries(dictionary.allTokens.map(token => [`--${token.name}`, token
|
|
8
|
+
export const jsonPostCssFallback = ({ dictionary, file: _file }) => {
|
|
9
|
+
const tokens = Object.fromEntries(dictionary.allTokens.map(token => [`--${token.name}`, token.$value]));
|
|
16
10
|
// add file header and convert output
|
|
17
11
|
const output = JSON.stringify(tokens, null, 2);
|
|
18
12
|
// return prettified
|
|
19
|
-
return
|
|
13
|
+
return format(output, { parser: 'json', printWidth: 500 });
|
|
20
14
|
};
|
|
21
|
-
exports.jsonPostCssFallback = jsonPostCssFallback;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FormatFn } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description Converts `StyleDictionary.dictionary.tokens` to typescript definition
|
|
4
4
|
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
5
5
|
* @returns formatted `string`
|
|
6
6
|
*/
|
|
7
|
-
export declare const typescriptExportDefinition:
|
|
7
|
+
export declare const typescriptExportDefinition: FormatFn;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (
|
|
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
|
+
});
|
|
4
9
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const prefixTokens_1 = require("./utilities/prefixTokens");
|
|
13
|
-
const { fileHeader } = style_dictionary_1.default.formatHelpers;
|
|
10
|
+
import { format } from 'prettier';
|
|
11
|
+
import { readFileSync } from 'fs';
|
|
12
|
+
import { resolve as resolvePath } from 'path';
|
|
13
|
+
import { treeWalker } from '../utilities/treeWalker.js';
|
|
14
|
+
import { prefixTokens } from './utilities/prefixTokens.js';
|
|
15
|
+
import { fileHeader } from 'style-dictionary/utils';
|
|
16
|
+
import { getPropName } from './utilities/getPropName.js';
|
|
14
17
|
/**
|
|
15
18
|
* unquoteTypes
|
|
16
19
|
* @description extract types from designTokenTypes (string with type definitions from file) and replace quoted types "Color" with unquoted Color
|
|
@@ -31,20 +34,20 @@ const unquoteTypes = (output, designTokenTypes) => {
|
|
|
31
34
|
*/
|
|
32
35
|
const getTokenType = (tokenTypesPath) => {
|
|
33
36
|
try {
|
|
34
|
-
const designTokenType =
|
|
37
|
+
const designTokenType = readFileSync(resolvePath(tokenTypesPath), { encoding: 'utf-8' });
|
|
35
38
|
return designTokenType;
|
|
36
39
|
}
|
|
37
|
-
catch (
|
|
40
|
+
catch (error) {
|
|
38
41
|
// eslint-disable-next-line no-console
|
|
39
|
-
throw new Error(`Error trying to load design token type from file "${tokenTypesPath}"
|
|
42
|
+
throw new Error(`Error trying to load design token type from file "${tokenTypesPath}". Error: ${error}`);
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
45
|
/**
|
|
43
46
|
* @description throws an error stating the token name, type and invalid value
|
|
44
47
|
* @param token w3cTransformedToken
|
|
45
48
|
*/
|
|
46
|
-
const invalidTokenValueError = (token) => {
|
|
47
|
-
throw new Error(`Invalid token: "${token.name}" with type "${token
|
|
49
|
+
const invalidTokenValueError = (token, options) => {
|
|
50
|
+
throw new Error(`Invalid token: "${token.name}" with type "${token[getPropName('type', options.usesDtcg)]}" can not have a value of "${token[getPropName('value', options.usesDtcg)]}"`);
|
|
48
51
|
};
|
|
49
52
|
/**
|
|
50
53
|
* convertPropToType
|
|
@@ -52,34 +55,35 @@ const invalidTokenValueError = (token) => {
|
|
|
52
55
|
* @param type
|
|
53
56
|
* @returns
|
|
54
57
|
*/
|
|
55
|
-
const convertPropToType = (tree) => {
|
|
56
|
-
|
|
58
|
+
const convertPropToType = (tree, options) => {
|
|
59
|
+
const valueProp = getPropName('value', options.usesDtcg);
|
|
60
|
+
if (!Object.prototype.hasOwnProperty.call(tree, valueProp)) {
|
|
57
61
|
throw new Error(`Invalid token: ${tree}`);
|
|
58
62
|
}
|
|
59
63
|
switch (tree.$type) {
|
|
60
64
|
case 'color':
|
|
61
|
-
if (typeof tree
|
|
65
|
+
if (typeof tree[valueProp] === 'string' && tree[valueProp][0] === '#') {
|
|
62
66
|
return 'ColorHex';
|
|
63
67
|
}
|
|
64
|
-
return invalidTokenValueError(tree);
|
|
68
|
+
return invalidTokenValueError(tree, options);
|
|
65
69
|
case 'dimension':
|
|
66
|
-
if (typeof tree
|
|
70
|
+
if (typeof tree[valueProp] === 'string' && tree[valueProp].substring(tree[valueProp].length - 3) === 'rem')
|
|
67
71
|
return 'SizeRem';
|
|
68
|
-
if (typeof tree
|
|
72
|
+
if (typeof tree[valueProp] === 'string' && tree[valueProp].substring(tree[valueProp].length - 2) === 'em')
|
|
69
73
|
return 'SizeEm';
|
|
70
|
-
if (typeof tree
|
|
74
|
+
if (typeof tree[valueProp] === 'string' && tree[valueProp].substring(tree[valueProp].length - 2) === 'px')
|
|
71
75
|
return 'SizePx';
|
|
72
|
-
return invalidTokenValueError(tree);
|
|
76
|
+
return invalidTokenValueError(tree, options);
|
|
73
77
|
case 'shadow':
|
|
74
78
|
return 'Shadow';
|
|
75
79
|
case 'border':
|
|
76
80
|
return 'Border';
|
|
77
81
|
default:
|
|
78
|
-
if (typeof tree
|
|
82
|
+
if (typeof tree[valueProp] === 'number')
|
|
79
83
|
return 'number';
|
|
80
|
-
if (typeof tree
|
|
84
|
+
if (typeof tree[valueProp] === 'string')
|
|
81
85
|
return 'string';
|
|
82
|
-
if (typeof tree
|
|
86
|
+
if (typeof tree[valueProp] === 'boolean')
|
|
83
87
|
return 'boolean';
|
|
84
88
|
return 'any';
|
|
85
89
|
}
|
|
@@ -89,8 +93,8 @@ const convertPropToType = (tree) => {
|
|
|
89
93
|
* @param item object
|
|
90
94
|
* @returns boolean
|
|
91
95
|
*/
|
|
92
|
-
const validTokenNode = (item) => {
|
|
93
|
-
return typeof item === 'object' && item !== null && 'value' in item;
|
|
96
|
+
const validTokenNode = (usesDtcg) => (item) => {
|
|
97
|
+
return typeof item === 'object' && item !== null && getPropName('value', usesDtcg) in item;
|
|
94
98
|
};
|
|
95
99
|
/**
|
|
96
100
|
* returns a set with every used token type
|
|
@@ -98,13 +102,13 @@ const validTokenNode = (item) => {
|
|
|
98
102
|
* @param validTypes array, all other types will be removed
|
|
99
103
|
* @returns set of all used token types
|
|
100
104
|
*/
|
|
101
|
-
const getUsedTokenTypes = (tokens, validTypes) => {
|
|
105
|
+
const getUsedTokenTypes = (tokens, validTypes, options) => {
|
|
102
106
|
// using a set to assure every value only exists once
|
|
103
107
|
const usedTypes = new Set();
|
|
104
108
|
// adds type to set
|
|
105
|
-
const callback = (tree) => usedTypes.add(convertPropToType(tree));
|
|
109
|
+
const callback = (tree) => usedTypes.add(convertPropToType(tree, options));
|
|
106
110
|
// tree walker adds to usedTypes
|
|
107
|
-
|
|
111
|
+
treeWalker(tokens, callback, validTokenNode(options.usesDtcg));
|
|
108
112
|
// clean up types
|
|
109
113
|
for (const type of usedTypes) {
|
|
110
114
|
if (!validTypes.includes(type)) {
|
|
@@ -118,11 +122,12 @@ const getUsedTokenTypes = (tokens, validTypes) => {
|
|
|
118
122
|
* @param item object
|
|
119
123
|
* @returns object
|
|
120
124
|
*/
|
|
121
|
-
const getTokenObjectWithTypes = (tokens) => {
|
|
125
|
+
const getTokenObjectWithTypes = (tokens, options) => {
|
|
126
|
+
const callback = (tree) => convertPropToType(tree, options);
|
|
122
127
|
// TODO: FIX typescript issues
|
|
123
128
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
124
129
|
// @ts-ignore
|
|
125
|
-
return
|
|
130
|
+
return treeWalker(tokens, callback, validTokenNode(options.usesDtcg));
|
|
126
131
|
};
|
|
127
132
|
/**
|
|
128
133
|
* getTypeDefinition
|
|
@@ -132,9 +137,11 @@ const getTokenObjectWithTypes = (tokens) => {
|
|
|
132
137
|
* @param tokenTypesPath
|
|
133
138
|
* @returns string
|
|
134
139
|
*/
|
|
135
|
-
const getTypeDefinition = (tokens,
|
|
136
|
-
|
|
137
|
-
const
|
|
140
|
+
const getTypeDefinition = (tokens, options) => {
|
|
141
|
+
// extract options
|
|
142
|
+
const { moduleName = `tokens`, tokenTypesPath = `./src/types/` } = options;
|
|
143
|
+
const usedTypes = getUsedTokenTypes(tokens, ['Shadow', 'ColorHex', 'Border', 'SizeEm', 'SizeRem', 'SizePx'], options);
|
|
144
|
+
const tokenObjectWithTypes = getTokenObjectWithTypes(tokens, options);
|
|
138
145
|
// get token type declaration from file
|
|
139
146
|
const designTokenTypes = [];
|
|
140
147
|
for (const type of usedTypes) {
|
|
@@ -153,14 +160,11 @@ const getTypeDefinition = (tokens, moduleName, tokenTypesPath) => {
|
|
|
153
160
|
* @param arguments [FormatterArguments](https://github.com/amzn/style-dictionary/blob/main/types/Format.d.ts)
|
|
154
161
|
* @returns formatted `string`
|
|
155
162
|
*/
|
|
156
|
-
const typescriptExportDefinition = ({ dictionary, file, options = {}, platform, })
|
|
157
|
-
// extract options
|
|
158
|
-
const { moduleName = `tokens`, tokenTypesPath = `./src/types/` } = options;
|
|
163
|
+
export const typescriptExportDefinition = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dictionary, file, options = {}, platform, }) {
|
|
159
164
|
// add prefix if defined
|
|
160
|
-
const tokens =
|
|
165
|
+
const tokens = prefixTokens(dictionary.tokens, platform);
|
|
161
166
|
// add file header and convert output
|
|
162
|
-
const output = `${fileHeader({ file })}\n${getTypeDefinition(tokens,
|
|
167
|
+
const output = `${yield fileHeader({ file })}\n${getTypeDefinition(tokens, options)}\n`;
|
|
163
168
|
// return prettified
|
|
164
|
-
return
|
|
165
|
-
};
|
|
166
|
-
exports.typescriptExportDefinition = typescriptExportDefinition;
|
|
169
|
+
return format(output, { parser: 'typescript', printWidth: 500 });
|
|
170
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getPropName: (prop: "value" | "type" | "description", usesDtcg?: boolean) => "type" | "value" | "$value" | "$type" | "$description" | "comment";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const props = {
|
|
2
|
+
dtcg: {
|
|
3
|
+
value: '$value',
|
|
4
|
+
type: '$type',
|
|
5
|
+
description: '$description',
|
|
6
|
+
},
|
|
7
|
+
legacy: {
|
|
8
|
+
value: 'value',
|
|
9
|
+
type: 'type',
|
|
10
|
+
description: 'comment',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export const getPropName = (prop, usesDtcg) => {
|
|
14
|
+
const type = usesDtcg ? 'dtcg' : 'legacy';
|
|
15
|
+
return props[type][prop];
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* jsonToFlat
|
|
4
4
|
* @description creates a one dimensional json structure with either a single value or an token object as the value
|
|
@@ -6,6 +6,6 @@ import type StyleDictionary from 'style-dictionary';
|
|
|
6
6
|
* @param returnObject - boolean
|
|
7
7
|
* @returns flat json three
|
|
8
8
|
*/
|
|
9
|
-
export declare const jsonToFlat: (tokens:
|
|
9
|
+
export declare const jsonToFlat: (tokens: TransformedToken[], returnObject?: boolean) => {
|
|
10
10
|
[k: string]: any;
|
|
11
11
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonToFlat = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* jsonToFlat
|
|
6
3
|
* @description creates a one dimensional json structure with either a single value or an token object as the value
|
|
@@ -8,5 +5,4 @@ exports.jsonToFlat = void 0;
|
|
|
8
5
|
* @param returnObject - boolean
|
|
9
6
|
* @returns flat json three
|
|
10
7
|
*/
|
|
11
|
-
const jsonToFlat = (tokens, returnObject = false) => Object.fromEntries(tokens.map(token => [token.name, returnObject ? token : token
|
|
12
|
-
exports.jsonToFlat = jsonToFlat;
|
|
8
|
+
export const jsonToFlat = (tokens, returnObject = false) => Object.fromEntries(tokens.map(token => [token.name, returnObject ? token : token.$value]));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { DesignToken } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* jsonToNestedValue
|
|
4
4
|
* @description creates a nested json tree where every final value is the `.value` prop
|
|
5
5
|
* @param token StyleDictionary.DesignToken
|
|
6
6
|
* @returns nested json three
|
|
7
7
|
*/
|
|
8
|
-
export declare const jsonToNestedValue: (token:
|
|
8
|
+
export declare const jsonToNestedValue: (token: DesignToken | Record<string, unknown>) => any;
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonToNestedValue = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* jsonToNestedValue
|
|
6
3
|
* @description creates a nested json tree where every final value is the `.value` prop
|
|
7
4
|
* @param token StyleDictionary.DesignToken
|
|
8
5
|
* @returns nested json three
|
|
9
6
|
*/
|
|
10
|
-
const jsonToNestedValue = (token) => {
|
|
7
|
+
export const jsonToNestedValue = (token) => {
|
|
11
8
|
// is non-object value
|
|
12
9
|
if (typeof token !== 'object')
|
|
13
10
|
return token;
|
|
14
11
|
// is design token
|
|
12
|
+
if ('$value' in token)
|
|
13
|
+
return token.$value;
|
|
15
14
|
if ('value' in token)
|
|
16
15
|
return token.value;
|
|
17
16
|
// is obj
|
|
18
17
|
const nextObj = {};
|
|
19
18
|
for (const [prop, value] of Object.entries(token)) {
|
|
20
19
|
// @ts-expect-error: can't predict type
|
|
21
|
-
nextObj[prop] =
|
|
20
|
+
nextObj[prop] = jsonToNestedValue(value);
|
|
22
21
|
}
|
|
23
22
|
return nextObj;
|
|
24
23
|
};
|
|
25
|
-
exports.jsonToNestedValue = jsonToNestedValue;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { PlatformConfig, TransformedTokens } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description extract prefix from platform and add to tokens array if defined
|
|
4
4
|
* @param tokens StyleDictionary.TransformedTokens
|
|
5
5
|
* @param platform StyleDictionary.Platform
|
|
6
6
|
* @return StyleDictionary.TransformedTokens
|
|
7
7
|
*/
|
|
8
|
-
export declare const prefixTokens: (tokens:
|
|
8
|
+
export declare const prefixTokens: (tokens: TransformedTokens, platform?: PlatformConfig) => TransformedTokens;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prefixTokens = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @description extract prefix from platform and add to tokens array if defined
|
|
6
3
|
* @param tokens StyleDictionary.TransformedTokens
|
|
7
4
|
* @param platform StyleDictionary.Platform
|
|
8
5
|
* @return StyleDictionary.TransformedTokens
|
|
9
6
|
*/
|
|
10
|
-
const prefixTokens = (tokens, platform = {}) => {
|
|
7
|
+
export const prefixTokens = (tokens, platform = {}) => {
|
|
11
8
|
const { prefix } = platform;
|
|
12
9
|
if (typeof prefix === 'string') {
|
|
13
10
|
tokens = { [prefix]: tokens };
|
|
14
11
|
}
|
|
15
12
|
return tokens;
|
|
16
13
|
};
|
|
17
|
-
exports.prefixTokens = prefixTokens;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { w3cJsonParser } from './w3cJsonParser';
|
|
1
|
+
export { w3cJsonParser } from './w3cJsonParser.js';
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
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
|
+
export { w3cJsonParser } from './w3cJsonParser.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Parser } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
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
4
|
* @pattern supported file extensions `.json` or `.json5`
|
|
5
5
|
*/
|
|
6
|
-
export declare const w3cJsonParser:
|
|
6
|
+
export declare const w3cJsonParser: Parser;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.w3cJsonParser = void 0;
|
|
4
|
-
const json5_1 = require("json5");
|
|
1
|
+
import JSON5 from 'json5';
|
|
5
2
|
/**
|
|
6
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
|
|
7
4
|
* @pattern supported file extensions `.json` or `.json5`
|
|
8
5
|
*/
|
|
9
|
-
|
|
6
|
+
export const w3cJsonParser = {
|
|
7
|
+
name: 'w3cJsonParser',
|
|
10
8
|
pattern: /\.json5?$/,
|
|
11
|
-
|
|
9
|
+
parser: ({ filePath, contents }) => {
|
|
12
10
|
// replace $value with value so that style dictionary recognizes it
|
|
13
11
|
try {
|
|
14
12
|
contents = contents
|
|
@@ -18,10 +16,10 @@ exports.w3cJsonParser = {
|
|
|
18
16
|
.replace(/["|']?\$?type["|']?:/g, '"$type":')
|
|
19
17
|
.replace(/["|']?\$?extensions["|']?:/g, '"$extensions":');
|
|
20
18
|
//
|
|
21
|
-
return
|
|
19
|
+
return JSON5.parse(contents);
|
|
22
20
|
}
|
|
23
|
-
catch (
|
|
24
|
-
throw new Error(`Invalid json5 file "${filePath}"
|
|
21
|
+
catch (error) {
|
|
22
|
+
throw new Error(`Invalid json5 file "${filePath}". Error: ${error}`);
|
|
25
23
|
}
|
|
26
24
|
},
|
|
27
25
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.ts';
|
|
2
2
|
export declare const css: PlatformInitializer;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.css = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
1
|
+
import { isFromFile, isSource } from '../filters/index.js';
|
|
5
2
|
const getCssSelectors = (outputFile) => {
|
|
6
3
|
// check for dark in the beginning of the output filename
|
|
7
4
|
const lastSlash = outputFile.lastIndexOf('/');
|
|
@@ -18,7 +15,7 @@ const getCssSelectors = (outputFile) => {
|
|
|
18
15
|
},
|
|
19
16
|
];
|
|
20
17
|
};
|
|
21
|
-
const css = (outputFile, prefix, buildPath, options) => {
|
|
18
|
+
export const css = (outputFile, prefix, buildPath, options) => {
|
|
22
19
|
return {
|
|
23
20
|
prefix,
|
|
24
21
|
buildPath,
|
|
@@ -26,6 +23,7 @@ const css = (outputFile, prefix, buildPath, options) => {
|
|
|
26
23
|
'name/pathToKebabCase',
|
|
27
24
|
'color/hex',
|
|
28
25
|
'color/hexMix',
|
|
26
|
+
'cubicBezier/css',
|
|
29
27
|
'dimension/rem',
|
|
30
28
|
'duration/css',
|
|
31
29
|
'shadow/css',
|
|
@@ -41,19 +39,31 @@ const css = (outputFile, prefix, buildPath, options) => {
|
|
|
41
39
|
{
|
|
42
40
|
destination: `${outputFile}`,
|
|
43
41
|
format: `css/advanced`,
|
|
44
|
-
filter: token =>
|
|
42
|
+
filter: token => isSource(token) &&
|
|
43
|
+
(options === null || options === void 0 ? void 0 : options.themed) === true &&
|
|
44
|
+
token.$type !== 'custom-viewportRange' &&
|
|
45
|
+
!isFromFile(token, [
|
|
46
|
+
'src/tokens/functional/size/size-coarse.json',
|
|
47
|
+
'src/tokens/functional/size/size-fine.json',
|
|
48
|
+
]),
|
|
45
49
|
options: Object.assign({ showFileHeader: false, outputReferences: false, descriptions: false, queries: getCssSelectors(outputFile) }, options === null || options === void 0 ? void 0 : options.options),
|
|
46
50
|
},
|
|
47
51
|
{
|
|
48
52
|
destination: `${outputFile}`,
|
|
49
53
|
format: `css/advanced`,
|
|
50
|
-
filter: token =>
|
|
54
|
+
filter: token => isSource(token) &&
|
|
55
|
+
(options === null || options === void 0 ? void 0 : options.themed) !== true &&
|
|
56
|
+
token.$type !== 'custom-viewportRange' &&
|
|
57
|
+
!isFromFile(token, [
|
|
58
|
+
'src/tokens/functional/size/size-coarse.json',
|
|
59
|
+
'src/tokens/functional/size/size-fine.json',
|
|
60
|
+
]),
|
|
51
61
|
options: Object.assign({ showFileHeader: false, descriptions: false }, options === null || options === void 0 ? void 0 : options.options),
|
|
52
62
|
},
|
|
53
63
|
{
|
|
54
64
|
destination: `${outputFile}`,
|
|
55
65
|
format: `css/customMedia`,
|
|
56
|
-
filter: token =>
|
|
66
|
+
filter: token => isSource(token) && (options === null || options === void 0 ? void 0 : options.themed) !== true && token.$type === 'custom-viewportRange',
|
|
57
67
|
options: {
|
|
58
68
|
showFileHeader: false,
|
|
59
69
|
},
|
|
@@ -61,8 +71,8 @@ const css = (outputFile, prefix, buildPath, options) => {
|
|
|
61
71
|
{
|
|
62
72
|
destination: `${outputFile}`,
|
|
63
73
|
format: `css/advanced`,
|
|
64
|
-
filter: token =>
|
|
65
|
-
|
|
74
|
+
filter: token => isSource(token) &&
|
|
75
|
+
isFromFile(token, [
|
|
66
76
|
'src/tokens/functional/size/size-coarse.json',
|
|
67
77
|
'src/tokens/functional/size/size-fine.json',
|
|
68
78
|
]),
|
|
@@ -84,4 +94,3 @@ const css = (outputFile, prefix, buildPath, options) => {
|
|
|
84
94
|
],
|
|
85
95
|
};
|
|
86
96
|
};
|
|
87
|
-
exports.css = css;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const deprecatedJson: PlatformInitializer;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.deprecatedJson = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const deprecatedJson = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isDeprecated } from '../filters/index.js';
|
|
2
|
+
export const deprecatedJson = (outputFile, prefix, buildPath) => ({
|
|
6
3
|
prefix,
|
|
7
4
|
buildPath,
|
|
8
5
|
transforms: ['name/pathToDotNotation', 'json/deprecated'],
|
|
@@ -10,8 +7,7 @@ const deprecatedJson = (outputFile, prefix, buildPath) => ({
|
|
|
10
7
|
{
|
|
11
8
|
destination: outputFile,
|
|
12
9
|
format: `json/flat`,
|
|
13
|
-
filter:
|
|
10
|
+
filter: isDeprecated,
|
|
14
11
|
},
|
|
15
12
|
],
|
|
16
13
|
});
|
|
17
|
-
exports.deprecatedJson = deprecatedJson;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const docJson: PlatformInitializer;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.docJson = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const docJson = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isSource } from '../filters/index.js';
|
|
2
|
+
export const docJson = (outputFile, prefix, buildPath) => ({
|
|
6
3
|
prefix,
|
|
7
4
|
buildPath,
|
|
8
5
|
transforms: [
|
|
@@ -18,12 +15,17 @@ const docJson = (outputFile, prefix, buildPath) => ({
|
|
|
18
15
|
],
|
|
19
16
|
options: {
|
|
20
17
|
basePxFontSize: 16,
|
|
18
|
+
propertyConversion: {
|
|
19
|
+
$value: 'value',
|
|
20
|
+
$type: 'type',
|
|
21
|
+
$description: 'description',
|
|
22
|
+
},
|
|
21
23
|
},
|
|
22
24
|
files: [
|
|
23
25
|
{
|
|
24
26
|
destination: outputFile,
|
|
25
27
|
format: `json/one-dimensional`,
|
|
26
|
-
filter:
|
|
28
|
+
filter: isSource,
|
|
27
29
|
options: {
|
|
28
30
|
outputReferences: false,
|
|
29
31
|
outputVerbose: true,
|
|
@@ -31,4 +33,3 @@ const docJson = (outputFile, prefix, buildPath) => ({
|
|
|
31
33
|
},
|
|
32
34
|
],
|
|
33
35
|
});
|
|
34
|
-
exports.docJson = docJson;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const fallbacks: PlatformInitializer;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.fallbacks = void 0;
|
|
4
|
-
const filters_1 = require("../filters");
|
|
5
|
-
const fallbacks = (outputFile, prefix, buildPath) => ({
|
|
1
|
+
import { isSource } from '../filters/index.js';
|
|
2
|
+
export const fallbacks = (outputFile, prefix, buildPath) => ({
|
|
6
3
|
prefix,
|
|
7
4
|
buildPath,
|
|
8
5
|
transforms: [
|
|
@@ -23,7 +20,7 @@ const fallbacks = (outputFile, prefix, buildPath) => ({
|
|
|
23
20
|
{
|
|
24
21
|
destination: outputFile,
|
|
25
22
|
format: `json/postCss-fallback`,
|
|
26
|
-
filter:
|
|
23
|
+
filter: isSource,
|
|
27
24
|
options: {
|
|
28
25
|
outputReferences: false,
|
|
29
26
|
outputVerbose: true,
|
|
@@ -31,4 +28,3 @@ const fallbacks = (outputFile, prefix, buildPath) => ({
|
|
|
31
28
|
},
|
|
32
29
|
],
|
|
33
30
|
});
|
|
34
|
-
exports.fallbacks = fallbacks;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlatformInitializer } from '../types/PlatformInitializer';
|
|
1
|
+
import type { PlatformInitializer } from '../types/PlatformInitializer.js';
|
|
2
2
|
export declare const figma: PlatformInitializer;
|