@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,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.alpha = void 0;
|
|
4
|
-
const color2k_1 = require("color2k");
|
|
5
|
-
/**
|
|
6
|
-
* alpha
|
|
7
|
-
* @description takes a colors string like hex or rgba and returns an rgba color with the specified alpha value
|
|
8
|
-
* @param color color string like a `#334455` or `rgb(255,200,100)`
|
|
9
|
-
* @param desiredAlpha number
|
|
10
|
-
* @returns rgba value
|
|
11
|
-
*/
|
|
12
|
-
const alpha = (color, desiredAlpha, token) => {
|
|
13
|
-
const [r, g, b, a] = (0, color2k_1.parseToRgba)(color);
|
|
14
|
-
if (a < 1 && desiredAlpha < 1) {
|
|
15
|
-
// eslint-disable-next-line no-console
|
|
16
|
-
console.warn(`🚨 You are setting an alpha value of "${desiredAlpha}" for a color with an alpha value (${color}). The previous alpha value will be disregarded as if the color would have been 100% opaque.${token !== undefined ? `\n ↳ Token: "${token.name}" in file: "${token.filePath}"` : ''}`);
|
|
17
|
-
}
|
|
18
|
-
return (0, color2k_1.rgba)(r, g, b, desiredAlpha);
|
|
19
|
-
};
|
|
20
|
-
exports.alpha = alpha;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* checks if all required properties exist on token
|
|
3
|
-
* @param object - tokenValue
|
|
4
|
-
* @param array - property names
|
|
5
|
-
* @returns void or throws error
|
|
6
|
-
*/
|
|
7
|
-
export declare const checkRequiredTokenProperties: (tokenValue: Record<string, unknown>, requiredProperties: readonly string[]) => void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkRequiredTokenProperties = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* checks if all required properties exist on token
|
|
6
|
-
* @param object - tokenValue
|
|
7
|
-
* @param array - property names
|
|
8
|
-
* @returns void or throws error
|
|
9
|
-
*/
|
|
10
|
-
const checkRequiredTokenProperties = (tokenValue, requiredProperties) => {
|
|
11
|
-
for (const prop of requiredProperties) {
|
|
12
|
-
if (prop in tokenValue === false) {
|
|
13
|
-
throw new Error(`Missing property: ${prop} on token with value ${JSON.stringify(tokenValue)}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
exports.checkRequiredTokenProperties = checkRequiredTokenProperties;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokenValue = void 0;
|
|
4
|
-
const invalidTokenError_1 = require("./invalidTokenError");
|
|
5
|
-
const getTokenValue = (token, property) => {
|
|
6
|
-
if (token.value === undefined) {
|
|
7
|
-
throw new invalidTokenError_1.invalidTokenValueError(token);
|
|
8
|
-
}
|
|
9
|
-
// for composite token if subproperty is needed
|
|
10
|
-
if (typeof property === 'string' && token.value[property] === undefined) {
|
|
11
|
-
throw new invalidTokenError_1.invalidTokenValuePropertyError(token, property);
|
|
12
|
-
}
|
|
13
|
-
if (typeof property === 'string') {
|
|
14
|
-
return token.value[property];
|
|
15
|
-
}
|
|
16
|
-
return token.value;
|
|
17
|
-
};
|
|
18
|
-
exports.getTokenValue = getTokenValue;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const hasSpaceInString: (string: string) => boolean;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasSpaceInString = void 0;
|
|
4
|
-
const hasSpaceInString = (string) => {
|
|
5
|
-
if (typeof string !== 'string') {
|
|
6
|
-
throw new TypeError(`Invalid input. Input must be a string, ${typeof string} provided`);
|
|
7
|
-
}
|
|
8
|
-
return /\s/g.test(string);
|
|
9
|
-
};
|
|
10
|
-
exports.hasSpaceInString = hasSpaceInString;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hexToRgbaFloat = void 0;
|
|
4
|
-
const hexToRgbaFloat = (hex, alpha) => {
|
|
5
|
-
// retrieve spots from hex value (hex 3, hex 4, hex 6 or hex 8)
|
|
6
|
-
let result;
|
|
7
|
-
if (hex.length > 5) {
|
|
8
|
-
result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(hex);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
result = /^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})?$/i.exec(hex);
|
|
12
|
-
}
|
|
13
|
-
if (result === null) {
|
|
14
|
-
throw new Error('Invalid hex value in "hexToRgbaFloat". Please provide a valid hex3, hex4, hex6 or hex8 value.');
|
|
15
|
-
}
|
|
16
|
-
// doule characters if hex 3 or hex 4
|
|
17
|
-
if (hex.length < 6) {
|
|
18
|
-
result[1] = `${result[1]}${result[1]}`; // double the character
|
|
19
|
-
result[2] = `${result[2]}${result[2]}`; // double the character
|
|
20
|
-
result[3] = `${result[3]}${result[3]}`; // double the character
|
|
21
|
-
if (result[4]) {
|
|
22
|
-
result[4] = `${result[4]}${result[4]}`; // double the character
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
// return parsed rgba float object using alpha value from token, from hex code or defaults to 1
|
|
26
|
-
return {
|
|
27
|
-
r: parseInt(result[1], 16) / 255,
|
|
28
|
-
g: parseInt(result[2], 16) / 255,
|
|
29
|
-
b: parseInt(result[3], 16) / 255,
|
|
30
|
-
a: alpha !== undefined ? alpha : result[4] ? parseInt(result[4], 16) / 255 : 1,
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
exports.hexToRgbaFloat = hexToRgbaFloat;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TransformedToken } from 'style-dictionary';
|
|
2
|
-
export declare class invalidTokenValueError extends Error {
|
|
3
|
-
constructor(token: TransformedToken);
|
|
4
|
-
}
|
|
5
|
-
export declare class invalidTokenValuePropertyError extends Error {
|
|
6
|
-
constructor(token: TransformedToken, property: string);
|
|
7
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invalidTokenValuePropertyError = exports.invalidTokenValueError = void 0;
|
|
4
|
-
const namePathToDotNotation_1 = require("../namePathToDotNotation");
|
|
5
|
-
const composeValueErrorMessage = (token) => {
|
|
6
|
-
// eslint-disable-next-line i18n-text/no-en
|
|
7
|
-
return `Invalid token "${namePathToDotNotation_1.namePathToDotNotation.transformer(token, {})}" in file "${token.filePath}". Transformed value: "${JSON.stringify(token.value)}". ${token.original.value ? `Original value: "${JSON.stringify(token.original.value)}" ` : ''}This may be due to referencing a token that does not exists.`;
|
|
8
|
-
};
|
|
9
|
-
const composeValuePropertyErrorMessage = (token, property) => {
|
|
10
|
-
// eslint-disable-next-line i18n-text/no-en
|
|
11
|
-
return `Invalid property "${property}" of token "${namePathToDotNotation_1.namePathToDotNotation.transformer(token, {})}" in file "${token.filePath}". Transformed property value: "${token.value[property]}". ${token.original.value ? `Original value: "${token.original.value[property]}" ` : ''}This may be due to referencing a token that does not exists.`;
|
|
12
|
-
};
|
|
13
|
-
class invalidTokenValueError extends Error {
|
|
14
|
-
constructor(token) {
|
|
15
|
-
super(composeValueErrorMessage(token));
|
|
16
|
-
Error.captureStackTrace(this, invalidTokenValueError);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.invalidTokenValueError = invalidTokenValueError;
|
|
20
|
-
class invalidTokenValuePropertyError extends Error {
|
|
21
|
-
constructor(token, property) {
|
|
22
|
-
super(composeValuePropertyErrorMessage(token, property));
|
|
23
|
-
Error.captureStackTrace(this, invalidTokenValuePropertyError);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.invalidTokenValuePropertyError = invalidTokenValuePropertyError;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRgbaFloat = void 0;
|
|
4
|
-
// check if a value is an rgba float object
|
|
5
|
-
const isRgbaFloat = (value) => {
|
|
6
|
-
if (value &&
|
|
7
|
-
typeof value === `object` &&
|
|
8
|
-
'r' in value &&
|
|
9
|
-
typeof value.r === `number` &&
|
|
10
|
-
'g' in value &&
|
|
11
|
-
typeof value.g === `number` &&
|
|
12
|
-
'b' in value &&
|
|
13
|
-
typeof value.b === `number` &&
|
|
14
|
-
value.r >= 0 &&
|
|
15
|
-
value.r <= 1 &&
|
|
16
|
-
value.g >= 0 &&
|
|
17
|
-
value.g <= 1 &&
|
|
18
|
-
value.b >= 0 &&
|
|
19
|
-
value.b <= 1) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
};
|
|
24
|
-
exports.isRgbaFloat = isRgbaFloat;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color2k_1 = require("color2k");
|
|
4
|
-
/**
|
|
5
|
-
* Mixes two colors together. Taken from sass's implementation.
|
|
6
|
-
*/
|
|
7
|
-
function mix(color1, color2, weight) {
|
|
8
|
-
const normalize = (n, index) =>
|
|
9
|
-
// 3rd index is alpha channel which is already normalized
|
|
10
|
-
index === 3 ? n : n / 255;
|
|
11
|
-
const [r1, g1, b1, a1] = (0, color2k_1.parseToRgba)(color1).map(normalize);
|
|
12
|
-
const [r2, g2, b2, a2] = (0, color2k_1.parseToRgba)(color2).map(normalize);
|
|
13
|
-
// The formula is copied from the original Sass implementation:
|
|
14
|
-
// http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
|
|
15
|
-
const normalizedWeight = 2 * weight - 1;
|
|
16
|
-
const alphaDelta = a1 - a2;
|
|
17
|
-
const combinedWeight = normalizedWeight * alphaDelta === -1
|
|
18
|
-
? normalizedWeight
|
|
19
|
-
: (normalizedWeight + alphaDelta) / (1 + normalizedWeight * alphaDelta);
|
|
20
|
-
const weight2 = (combinedWeight + 1) / 2;
|
|
21
|
-
const weight1 = 1 - weight2;
|
|
22
|
-
const r = Math.round((r1 * weight1 + r2 * weight2) * 255);
|
|
23
|
-
const g = Math.round((g1 * weight1 + g2 * weight2) * 255);
|
|
24
|
-
const b = Math.round((b1 * weight1 + b2 * weight2) * 255);
|
|
25
|
-
const a = a2 * weight + a1 * (1 - weight);
|
|
26
|
-
return (0, color2k_1.rgba)(r, g, b, a);
|
|
27
|
-
}
|
|
28
|
-
exports.default = mix;
|
|
29
|
-
// Number* weight = ARGR("$weight", Number, 0, 100);
|
|
30
|
-
// double p = weight->value()/100;
|
|
31
|
-
// double w = 2*p - 1;
|
|
32
|
-
// double a = color1->a() - color2->a();
|
|
33
|
-
// double nW = ((w * a == -1) ? w : (w + a)/(1 + w*a))
|
|
34
|
-
// double w1 = (nW + 1)/2.0;
|
|
35
|
-
// double w2 = 1 - w1;
|
|
36
|
-
// return new (ctx.mem) Color(pstate,
|
|
37
|
-
// std::round(w1*color1->r() + w2*color2->r()),
|
|
38
|
-
// std::round(w1*color1->g() + w2*color2->g()),
|
|
39
|
-
// std::round(w1*color1->b() + w2*color2->b()),
|
|
40
|
-
// color1->a()*p + color2->a()*(1-p));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rgbaFloatToHex = void 0;
|
|
4
|
-
const rgbaFloatToHex = ({ r, g, b, a }, alpha = true) => {
|
|
5
|
-
const values = [r, g, b, alpha === true && a && a < 1 ? a : undefined].filter(item => item !== undefined);
|
|
6
|
-
if (r > 1 || r < 0 || g > 1 || g < 0 || b > 1 || b < 0) {
|
|
7
|
-
throw new Error('Invalid RgbaFloat value. R, G and B values must be between 0 and 1.');
|
|
8
|
-
}
|
|
9
|
-
return `#${values
|
|
10
|
-
.map(v => Number(parseInt(`${v * 255}`, 10))
|
|
11
|
-
.toString(16)
|
|
12
|
-
.padStart(2, '0'))
|
|
13
|
-
.join('')}`;
|
|
14
|
-
};
|
|
15
|
-
exports.rgbaFloatToHex = rgbaFloatToHex;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.copyFromDir = void 0;
|
|
13
|
-
/* istanbul ignore file */
|
|
14
|
-
const promises_1 = require("fs/promises");
|
|
15
|
-
/**
|
|
16
|
-
* copyFromDir
|
|
17
|
-
* @description Copies all files from source folder to destination
|
|
18
|
-
* @param source path
|
|
19
|
-
* @param destination path
|
|
20
|
-
* @returns promise
|
|
21
|
-
*/
|
|
22
|
-
const copyFromDir = (source, destination) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
// adjust trailing slash
|
|
24
|
-
const src = `${source.replace(/\/$/, '')}`;
|
|
25
|
-
const dest = `${destination.replace(/\/$/, '')}`;
|
|
26
|
-
// create dest if it does not exists
|
|
27
|
-
yield (0, promises_1.mkdir)(dest, { recursive: true });
|
|
28
|
-
// read files from source
|
|
29
|
-
const files = yield (0, promises_1.readdir)(src);
|
|
30
|
-
for (const file of files) {
|
|
31
|
-
(0, promises_1.copyFile)(`${src}/${file}`, `${dest}/${file}`);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
exports.copyFromDir = copyFromDir;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const filterStringArray: (string: string[]) => string[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterStringArray = void 0;
|
|
4
|
-
const filterStringArray = (string) => {
|
|
5
|
-
// match unsupported characters
|
|
6
|
-
const regex = /[^a-zA-Z0-9]+/g;
|
|
7
|
-
// replace any non-letter and non-number character and split into word array
|
|
8
|
-
const stringArray = string
|
|
9
|
-
.filter(Boolean)
|
|
10
|
-
.join(' ')
|
|
11
|
-
.replace(regex, ' ')
|
|
12
|
-
.split(' ')
|
|
13
|
-
// remove undefined if exists
|
|
14
|
-
.filter((part) => Boolean(part) && typeof part === 'string');
|
|
15
|
-
return stringArray;
|
|
16
|
-
};
|
|
17
|
-
exports.filterStringArray = filterStringArray;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the value of a flag from the command line
|
|
3
|
-
* @param flag name of the flag to get
|
|
4
|
-
* @param prefix default `--` but can be changed to `-` the part to the left of the flag name
|
|
5
|
-
* @returns null if flag is not found, otherwise the value of the flag or the flag name if the flag has no value
|
|
6
|
-
* @example `getFlag('--silent')` returns `null` if `--silent` is not found, `--silent` if `--silent` is found with no value, and `true` if `--silent=true` is found
|
|
7
|
-
*/
|
|
8
|
-
export declare const getFlag: (flag: string, prefix?: string) => string | null;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFlag = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Get the value of a flag from the command line
|
|
6
|
-
* @param flag name of the flag to get
|
|
7
|
-
* @param prefix default `--` but can be changed to `-` the part to the left of the flag name
|
|
8
|
-
* @returns null if flag is not found, otherwise the value of the flag or the flag name if the flag has no value
|
|
9
|
-
* @example `getFlag('--silent')` returns `null` if `--silent` is not found, `--silent` if `--silent` is found with no value, and `true` if `--silent=true` is found
|
|
10
|
-
*/
|
|
11
|
-
const getFlag = (flag, prefix = '--') => {
|
|
12
|
-
flag = `${prefix}${flag.replace(prefix, '')}`;
|
|
13
|
-
const index = process.argv.findIndex(arg => arg === flag || arg.startsWith(`${flag}=`));
|
|
14
|
-
return index === -1 ? null : process.argv[index].replace(`${flag}=`, '');
|
|
15
|
-
};
|
|
16
|
-
exports.getFlag = getFlag;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCamelCase = exports.upperCaseFirstCharacter = exports.copyFromDir = void 0;
|
|
4
|
-
var copyFromDir_1 = require("./copyFromDir");
|
|
5
|
-
Object.defineProperty(exports, "copyFromDir", { enumerable: true, get: function () { return copyFromDir_1.copyFromDir; } });
|
|
6
|
-
var upperCaseFirstCharacter_1 = require("./upperCaseFirstCharacter");
|
|
7
|
-
Object.defineProperty(exports, "upperCaseFirstCharacter", { enumerable: true, get: function () { return upperCaseFirstCharacter_1.upperCaseFirstCharacter; } });
|
|
8
|
-
var toCamelCase_1 = require("./toCamelCase");
|
|
9
|
-
Object.defineProperty(exports, "toCamelCase", { enumerable: true, get: function () { return toCamelCase_1.toCamelCase; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const joinFriendly: (array: string[], lastJoin?: string) => string;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.joinFriendly = void 0;
|
|
4
|
-
const joinFriendly = (array, lastJoin = 'and') => array.length > 1 ? `${array.slice(0, -1).join(', ')} ${lastJoin} ${array.slice(-1)}` : `${array[0]}`;
|
|
5
|
-
exports.joinFriendly = joinFriendly;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const schemaErrorMessage: (title: string, description?: string) => string;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schemaErrorMessage = void 0;
|
|
4
|
-
const schemaErrorMessage = (title, description) => `**${title}**${description ? `\n${description}` : ``}`;
|
|
5
|
-
exports.schemaErrorMessage = schemaErrorMessage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toCamelCase: (string: string | string[]) => string;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCamelCase = void 0;
|
|
4
|
-
const filterStringArray_1 = require("./filterStringArray");
|
|
5
|
-
const upperCaseFirstCharacter_1 = require("./upperCaseFirstCharacter");
|
|
6
|
-
const toCamelCase = (string) => {
|
|
7
|
-
if (!Array.isArray(string)) {
|
|
8
|
-
string = [string];
|
|
9
|
-
}
|
|
10
|
-
return ((0, filterStringArray_1.filterStringArray)(string)
|
|
11
|
-
// ucFirst all but first part
|
|
12
|
-
.map((part, index) => {
|
|
13
|
-
if (index > 0) {
|
|
14
|
-
return (0, upperCaseFirstCharacter_1.upperCaseFirstCharacter)(part);
|
|
15
|
-
}
|
|
16
|
-
return part;
|
|
17
|
-
})
|
|
18
|
-
.join(''));
|
|
19
|
-
};
|
|
20
|
-
exports.toCamelCase = toCamelCase;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toPascalCase: (string: string | string[]) => string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toPascalCase = void 0;
|
|
4
|
-
const filterStringArray_1 = require("./filterStringArray");
|
|
5
|
-
const upperCaseFirstCharacter_1 = require("./upperCaseFirstCharacter");
|
|
6
|
-
const toPascalCase = (string) => {
|
|
7
|
-
if (!Array.isArray(string)) {
|
|
8
|
-
string = [string];
|
|
9
|
-
}
|
|
10
|
-
return ((0, filterStringArray_1.filterStringArray)(string)
|
|
11
|
-
// ucFirst all but first part
|
|
12
|
-
.map((part) => {
|
|
13
|
-
return (0, upperCaseFirstCharacter_1.upperCaseFirstCharacter)(part);
|
|
14
|
-
})
|
|
15
|
-
.join(''));
|
|
16
|
-
};
|
|
17
|
-
exports.toPascalCase = toPascalCase;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description converts tokens to type and returns array with used type
|
|
3
|
-
* @param tree object
|
|
4
|
-
* @param callback function to be run on valid items
|
|
5
|
-
* @param validItem function to test if a node is a validItem to be transformed
|
|
6
|
-
* @returns object
|
|
7
|
-
*/
|
|
8
|
-
export declare const treeWalker: (tree: unknown, callback: <T>(argument: T) => unknown, isValidItem: (argument: unknown) => boolean) => unknown;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.treeWalker = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @description converts tokens to type and returns array with used type
|
|
6
|
-
* @param tree object
|
|
7
|
-
* @param callback function to be run on valid items
|
|
8
|
-
* @param validItem function to test if a node is a validItem to be transformed
|
|
9
|
-
* @returns object
|
|
10
|
-
*/
|
|
11
|
-
const treeWalker = (tree, callback, isValidItem) => {
|
|
12
|
-
// is a valid item -> pass through callback
|
|
13
|
-
if (isValidItem(tree)) {
|
|
14
|
-
return callback(tree);
|
|
15
|
-
}
|
|
16
|
-
// is non-object value -> ignore
|
|
17
|
-
if (typeof tree !== 'object' || tree === null) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
// is obj -> continue
|
|
21
|
-
const nextObj = {};
|
|
22
|
-
for (const [prop, value] of Object.entries(tree)) {
|
|
23
|
-
nextObj[prop] = (0, exports.treeWalker)(value, callback, isValidItem);
|
|
24
|
-
}
|
|
25
|
-
return nextObj;
|
|
26
|
-
};
|
|
27
|
-
exports.treeWalker = treeWalker;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* upperCaseFirstCharacter
|
|
3
|
-
* @scope custom implementation should only be used within `name path to ...` transformer
|
|
4
|
-
* @description changes first letter to uppercase but keeps the rest of the word as is
|
|
5
|
-
* @param string
|
|
6
|
-
* @returns string
|
|
7
|
-
*/
|
|
8
|
-
export declare const upperCaseFirstCharacter: ([firstLetter, ...restOfWord]: string) => string;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.upperCaseFirstCharacter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* upperCaseFirstCharacter
|
|
6
|
-
* @scope custom implementation should only be used within `name path to ...` transformer
|
|
7
|
-
* @description changes first letter to uppercase but keeps the rest of the word as is
|
|
8
|
-
* @param string
|
|
9
|
-
* @returns string
|
|
10
|
-
*/
|
|
11
|
-
const upperCaseFirstCharacter = ([firstLetter, ...restOfWord]) => {
|
|
12
|
-
return firstLetter.toUpperCase() + restOfWord.join('');
|
|
13
|
-
};
|
|
14
|
-
exports.upperCaseFirstCharacter = upperCaseFirstCharacter;
|