@primer/primitives 9.1.2 → 10.0.0-rc.367a0502

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.
Files changed (219) hide show
  1. package/package.json +9 -8
  2. package/dist/build/PrimerStyleDictionary.d.ts +0 -9
  3. package/dist/build/PrimerStyleDictionary.js +0 -92
  4. package/dist/build/filters/index.d.ts +0 -13
  5. package/dist/build/filters/index.js +0 -29
  6. package/dist/build/filters/isBorder.d.ts +0 -7
  7. package/dist/build/filters/isBorder.js +0 -12
  8. package/dist/build/filters/isColor.d.ts +0 -7
  9. package/dist/build/filters/isColor.js +0 -12
  10. package/dist/build/filters/isColorWithAlpha.d.ts +0 -7
  11. package/dist/build/filters/isColorWithAlpha.js +0 -13
  12. package/dist/build/filters/isColorWithMix.d.ts +0 -7
  13. package/dist/build/filters/isColorWithMix.js +0 -28
  14. package/dist/build/filters/isDeprecated.d.ts +0 -7
  15. package/dist/build/filters/isDeprecated.js +0 -12
  16. package/dist/build/filters/isDimension.d.ts +0 -7
  17. package/dist/build/filters/isDimension.js +0 -12
  18. package/dist/build/filters/isDuration.d.ts +0 -7
  19. package/dist/build/filters/isDuration.js +0 -12
  20. package/dist/build/filters/isFontFamily.d.ts +0 -7
  21. package/dist/build/filters/isFontFamily.js +0 -12
  22. package/dist/build/filters/isFontWeight.d.ts +0 -7
  23. package/dist/build/filters/isFontWeight.js +0 -12
  24. package/dist/build/filters/isFromFile.d.ts +0 -8
  25. package/dist/build/filters/isFromFile.js +0 -14
  26. package/dist/build/filters/isNumber.d.ts +0 -7
  27. package/dist/build/filters/isNumber.js +0 -10
  28. package/dist/build/filters/isShadow.d.ts +0 -7
  29. package/dist/build/filters/isShadow.js +0 -12
  30. package/dist/build/filters/isSource.d.ts +0 -7
  31. package/dist/build/filters/isSource.js +0 -12
  32. package/dist/build/filters/isTypography.d.ts +0 -7
  33. package/dist/build/filters/isTypography.js +0 -12
  34. package/dist/build/formats/cssAdvanced.d.ts +0 -2
  35. package/dist/build/formats/cssAdvanced.js +0 -84
  36. package/dist/build/formats/cssCustomMedia.d.ts +0 -7
  37. package/dist/build/formats/cssCustomMedia.js +0 -25
  38. package/dist/build/formats/index.d.ts +0 -9
  39. package/dist/build/formats/index.js +0 -21
  40. package/dist/build/formats/javascriptCommonJs.d.ts +0 -7
  41. package/dist/build/formats/javascriptCommonJs.js +0 -25
  42. package/dist/build/formats/javascriptEsm.d.ts +0 -7
  43. package/dist/build/formats/javascriptEsm.js +0 -25
  44. package/dist/build/formats/jsonFigma.d.ts +0 -7
  45. package/dist/build/formats/jsonFigma.js +0 -116
  46. package/dist/build/formats/jsonNestedPrefixed.d.ts +0 -8
  47. package/dist/build/formats/jsonNestedPrefixed.js +0 -28
  48. package/dist/build/formats/jsonOneDimensional.d.ts +0 -8
  49. package/dist/build/formats/jsonOneDimensional.js +0 -24
  50. package/dist/build/formats/jsonPostCssFallback.d.ts +0 -8
  51. package/dist/build/formats/jsonPostCssFallback.js +0 -21
  52. package/dist/build/formats/typescriptExportDefinition.d.ts +0 -7
  53. package/dist/build/formats/typescriptExportDefinition.js +0 -166
  54. package/dist/build/formats/utilities/jsonToFlat.d.ts +0 -11
  55. package/dist/build/formats/utilities/jsonToFlat.js +0 -12
  56. package/dist/build/formats/utilities/jsonToNestedValue.d.ts +0 -8
  57. package/dist/build/formats/utilities/jsonToNestedValue.js +0 -25
  58. package/dist/build/formats/utilities/prefixTokens.d.ts +0 -8
  59. package/dist/build/formats/utilities/prefixTokens.js +0 -17
  60. package/dist/build/parsers/index.d.ts +0 -1
  61. package/dist/build/parsers/index.js +0 -5
  62. package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
  63. package/dist/build/parsers/w3cJsonParser.js +0 -27
  64. package/dist/build/platforms/css.d.ts +0 -2
  65. package/dist/build/platforms/css.js +0 -87
  66. package/dist/build/platforms/deprecatedJson.d.ts +0 -2
  67. package/dist/build/platforms/deprecatedJson.js +0 -17
  68. package/dist/build/platforms/docJson.d.ts +0 -2
  69. package/dist/build/platforms/docJson.js +0 -34
  70. package/dist/build/platforms/fallbacks.d.ts +0 -2
  71. package/dist/build/platforms/fallbacks.js +0 -34
  72. package/dist/build/platforms/figma.d.ts +0 -2
  73. package/dist/build/platforms/figma.js +0 -53
  74. package/dist/build/platforms/index.d.ts +0 -10
  75. package/dist/build/platforms/index.js +0 -23
  76. package/dist/build/platforms/javascript.d.ts +0 -2
  77. package/dist/build/platforms/javascript.js +0 -30
  78. package/dist/build/platforms/json.d.ts +0 -2
  79. package/dist/build/platforms/json.js +0 -32
  80. package/dist/build/platforms/styleLint.d.ts +0 -2
  81. package/dist/build/platforms/styleLint.js +0 -34
  82. package/dist/build/platforms/typeDefinitions.d.ts +0 -2
  83. package/dist/build/platforms/typeDefinitions.js +0 -30
  84. package/dist/build/platforms/typescript.d.ts +0 -2
  85. package/dist/build/platforms/typescript.js +0 -30
  86. package/dist/build/schemas/alphaValue.d.ts +0 -2
  87. package/dist/build/schemas/alphaValue.js +0 -8
  88. package/dist/build/schemas/baseToken.d.ts +0 -11
  89. package/dist/build/schemas/baseToken.js +0 -10
  90. package/dist/build/schemas/borderToken.d.ts +0 -51
  91. package/dist/build/schemas/borderToken.js +0 -20
  92. package/dist/build/schemas/collections.d.ts +0 -6
  93. package/dist/build/schemas/collections.js +0 -18
  94. package/dist/build/schemas/colorHexValue.d.ts +0 -2
  95. package/dist/build/schemas/colorHexValue.js +0 -12
  96. package/dist/build/schemas/colorToken.d.ts +0 -80
  97. package/dist/build/schemas/colorToken.js +0 -52
  98. package/dist/build/schemas/designToken.d.ts +0 -2
  99. package/dist/build/schemas/designToken.js +0 -37
  100. package/dist/build/schemas/dimensionToken.d.ts +0 -52
  101. package/dist/build/schemas/dimensionToken.js +0 -36
  102. package/dist/build/schemas/dimensionValue.d.ts +0 -2
  103. package/dist/build/schemas/dimensionValue.js +0 -12
  104. package/dist/build/schemas/durationToken.d.ts +0 -18
  105. package/dist/build/schemas/durationToken.js +0 -14
  106. package/dist/build/schemas/durationValue.d.ts +0 -2
  107. package/dist/build/schemas/durationValue.js +0 -8
  108. package/dist/build/schemas/fontFamilyToken.d.ts +0 -52
  109. package/dist/build/schemas/fontFamilyToken.js +0 -23
  110. package/dist/build/schemas/fontWeightToken.d.ts +0 -52
  111. package/dist/build/schemas/fontWeightToken.js +0 -24
  112. package/dist/build/schemas/fontWeightValue.d.ts +0 -2
  113. package/dist/build/schemas/fontWeightValue.js +0 -9
  114. package/dist/build/schemas/numberToken.d.ts +0 -71
  115. package/dist/build/schemas/numberToken.js +0 -30
  116. package/dist/build/schemas/referenceValue.d.ts +0 -2
  117. package/dist/build/schemas/referenceValue.js +0 -8
  118. package/dist/build/schemas/scopes.d.ts +0 -5
  119. package/dist/build/schemas/scopes.js +0 -34
  120. package/dist/build/schemas/shadowToken.d.ts +0 -157
  121. package/dist/build/schemas/shadowToken.js +0 -46
  122. package/dist/build/schemas/stringToken.d.ts +0 -18
  123. package/dist/build/schemas/stringToken.js +0 -13
  124. package/dist/build/schemas/tokenName.d.ts +0 -2
  125. package/dist/build/schemas/tokenName.js +0 -8
  126. package/dist/build/schemas/tokenType.d.ts +0 -3
  127. package/dist/build/schemas/tokenType.js +0 -6
  128. package/dist/build/schemas/typographyToken.d.ts +0 -59
  129. package/dist/build/schemas/typographyToken.js +0 -21
  130. package/dist/build/schemas/validTokenType.d.ts +0 -5
  131. package/dist/build/schemas/validTokenType.js +0 -34
  132. package/dist/build/schemas/viewportRangeToken.d.ts +0 -18
  133. package/dist/build/schemas/viewportRangeToken.js +0 -13
  134. package/dist/build/transformers/borderToCss.d.ts +0 -8
  135. package/dist/build/transformers/borderToCss.js +0 -38
  136. package/dist/build/transformers/colorToHex.d.ts +0 -8
  137. package/dist/build/transformers/colorToHex.js +0 -26
  138. package/dist/build/transformers/colorToHexMix.d.ts +0 -8
  139. package/dist/build/transformers/colorToHexMix.js +0 -25
  140. package/dist/build/transformers/colorToRgbAlpha.d.ts +0 -8
  141. package/dist/build/transformers/colorToRgbAlpha.js +0 -22
  142. package/dist/build/transformers/colorToRgbaFloat.d.ts +0 -8
  143. package/dist/build/transformers/colorToRgbaFloat.js +0 -50
  144. package/dist/build/transformers/dimensionToPixelUnitless.d.ts +0 -8
  145. package/dist/build/transformers/dimensionToPixelUnitless.js +0 -50
  146. package/dist/build/transformers/dimensionToRem.d.ts +0 -8
  147. package/dist/build/transformers/dimensionToRem.js +0 -47
  148. package/dist/build/transformers/dimensionToRemPxArray.d.ts +0 -8
  149. package/dist/build/transformers/dimensionToRemPxArray.js +0 -47
  150. package/dist/build/transformers/durationToCss.d.ts +0 -8
  151. package/dist/build/transformers/durationToCss.js +0 -30
  152. package/dist/build/transformers/figmaAttributes.d.ts +0 -8
  153. package/dist/build/transformers/figmaAttributes.js +0 -57
  154. package/dist/build/transformers/floatToPixel.d.ts +0 -15
  155. package/dist/build/transformers/floatToPixel.js +0 -41
  156. package/dist/build/transformers/fontFamilyToCss.d.ts +0 -14
  157. package/dist/build/transformers/fontFamilyToCss.js +0 -40
  158. package/dist/build/transformers/fontFamilyToFigma.d.ts +0 -14
  159. package/dist/build/transformers/fontFamilyToFigma.js +0 -46
  160. package/dist/build/transformers/fontWeightToNumber.d.ts +0 -9
  161. package/dist/build/transformers/fontWeightToNumber.js +0 -53
  162. package/dist/build/transformers/index.d.ts +0 -24
  163. package/dist/build/transformers/index.js +0 -51
  164. package/dist/build/transformers/jsonDeprecated.d.ts +0 -8
  165. package/dist/build/transformers/jsonDeprecated.js +0 -16
  166. package/dist/build/transformers/namePathToCamelCase.d.ts +0 -8
  167. package/dist/build/transformers/namePathToCamelCase.js +0 -14
  168. package/dist/build/transformers/namePathToDotNotation.d.ts +0 -8
  169. package/dist/build/transformers/namePathToDotNotation.js +0 -33
  170. package/dist/build/transformers/namePathToFigma.d.ts +0 -9
  171. package/dist/build/transformers/namePathToFigma.js +0 -24
  172. package/dist/build/transformers/namePathToKebabCase.d.ts +0 -8
  173. package/dist/build/transformers/namePathToKebabCase.js +0 -18
  174. package/dist/build/transformers/namePathToPascalCase.d.ts +0 -8
  175. package/dist/build/transformers/namePathToPascalCase.js +0 -14
  176. package/dist/build/transformers/namePathToSlashNotation.d.ts +0 -8
  177. package/dist/build/transformers/namePathToSlashNotation.js +0 -18
  178. package/dist/build/transformers/shadowToCss.d.ts +0 -8
  179. package/dist/build/transformers/shadowToCss.js +0 -35
  180. package/dist/build/transformers/typographyToCss.d.ts +0 -8
  181. package/dist/build/transformers/typographyToCss.js +0 -29
  182. package/dist/build/transformers/utilities/alpha.d.ts +0 -9
  183. package/dist/build/transformers/utilities/alpha.js +0 -20
  184. package/dist/build/transformers/utilities/checkRequiredTokenProperties.d.ts +0 -7
  185. package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +0 -17
  186. package/dist/build/transformers/utilities/getTokenValue.d.ts +0 -2
  187. package/dist/build/transformers/utilities/getTokenValue.js +0 -18
  188. package/dist/build/transformers/utilities/hasSpaceInString.d.ts +0 -1
  189. package/dist/build/transformers/utilities/hasSpaceInString.js +0 -10
  190. package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +0 -2
  191. package/dist/build/transformers/utilities/hexToRgbaFloat.js +0 -33
  192. package/dist/build/transformers/utilities/invalidTokenError.d.ts +0 -7
  193. package/dist/build/transformers/utilities/invalidTokenError.js +0 -26
  194. package/dist/build/transformers/utilities/isRgbaFloat.d.ts +0 -7
  195. package/dist/build/transformers/utilities/isRgbaFloat.js +0 -24
  196. package/dist/build/transformers/utilities/mix.d.ts +0 -5
  197. package/dist/build/transformers/utilities/mix.js +0 -40
  198. package/dist/build/transformers/utilities/rgbaFloatToHex.d.ts +0 -6
  199. package/dist/build/transformers/utilities/rgbaFloatToHex.js +0 -15
  200. package/dist/build/utilities/copyFromDir.d.ts +0 -8
  201. package/dist/build/utilities/copyFromDir.js +0 -34
  202. package/dist/build/utilities/filterStringArray.d.ts +0 -1
  203. package/dist/build/utilities/filterStringArray.js +0 -17
  204. package/dist/build/utilities/getFlag.d.ts +0 -8
  205. package/dist/build/utilities/getFlag.js +0 -16
  206. package/dist/build/utilities/index.d.ts +0 -3
  207. package/dist/build/utilities/index.js +0 -9
  208. package/dist/build/utilities/joinFriendly.d.ts +0 -1
  209. package/dist/build/utilities/joinFriendly.js +0 -5
  210. package/dist/build/utilities/schemaErrorMessage.d.ts +0 -1
  211. package/dist/build/utilities/schemaErrorMessage.js +0 -5
  212. package/dist/build/utilities/toCamelCase.d.ts +0 -1
  213. package/dist/build/utilities/toCamelCase.js +0 -20
  214. package/dist/build/utilities/toPascalCase.d.ts +0 -1
  215. package/dist/build/utilities/toPascalCase.js +0 -17
  216. package/dist/build/utilities/treeWalker.d.ts +0 -8
  217. package/dist/build/utilities/treeWalker.js +0 -27
  218. package/dist/build/utilities/upperCaseFirstCharacter.d.ts +0 -8
  219. package/dist/build/utilities/upperCaseFirstCharacter.js +0 -14
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typographyToCss = exports.shadowToCss = exports.namePathToSlashNotation = exports.namePathToKebabCase = exports.namePathToFigma = exports.namePathToDotNotation = exports.namePathToPascalCase = exports.namePathToCamelCase = exports.jsonDeprecated = exports.fontWeightToNumber = exports.fontFamilyToFigma = exports.fontFamilyToCss = exports.figmaAttributes = exports.durationToCss = exports.dimensionToPixelUnitless = exports.dimensionToRemPxArray = exports.dimensionToRem = exports.floatToPixelUnitless = exports.floatToPixel = exports.colorToRgbaFloat = exports.colorToRgbAlpha = exports.colorToHexMix = exports.colorToHex = exports.borderToCss = void 0;
4
- var borderToCss_1 = require("./borderToCss");
5
- Object.defineProperty(exports, "borderToCss", { enumerable: true, get: function () { return borderToCss_1.borderToCss; } });
6
- var colorToHex_1 = require("./colorToHex");
7
- Object.defineProperty(exports, "colorToHex", { enumerable: true, get: function () { return colorToHex_1.colorToHex; } });
8
- var colorToHexMix_1 = require("./colorToHexMix");
9
- Object.defineProperty(exports, "colorToHexMix", { enumerable: true, get: function () { return colorToHexMix_1.colorToHexMix; } });
10
- var colorToRgbAlpha_1 = require("./colorToRgbAlpha");
11
- Object.defineProperty(exports, "colorToRgbAlpha", { enumerable: true, get: function () { return colorToRgbAlpha_1.colorToRgbAlpha; } });
12
- var colorToRgbaFloat_1 = require("./colorToRgbaFloat");
13
- Object.defineProperty(exports, "colorToRgbaFloat", { enumerable: true, get: function () { return colorToRgbaFloat_1.colorToRgbaFloat; } });
14
- var floatToPixel_1 = require("./floatToPixel");
15
- Object.defineProperty(exports, "floatToPixel", { enumerable: true, get: function () { return floatToPixel_1.floatToPixel; } });
16
- var floatToPixel_2 = require("./floatToPixel");
17
- Object.defineProperty(exports, "floatToPixelUnitless", { enumerable: true, get: function () { return floatToPixel_2.floatToPixelUnitless; } });
18
- var dimensionToRem_1 = require("./dimensionToRem");
19
- Object.defineProperty(exports, "dimensionToRem", { enumerable: true, get: function () { return dimensionToRem_1.dimensionToRem; } });
20
- var dimensionToRemPxArray_1 = require("./dimensionToRemPxArray");
21
- Object.defineProperty(exports, "dimensionToRemPxArray", { enumerable: true, get: function () { return dimensionToRemPxArray_1.dimensionToRemPxArray; } });
22
- var dimensionToPixelUnitless_1 = require("./dimensionToPixelUnitless");
23
- Object.defineProperty(exports, "dimensionToPixelUnitless", { enumerable: true, get: function () { return dimensionToPixelUnitless_1.dimensionToPixelUnitless; } });
24
- var durationToCss_1 = require("./durationToCss");
25
- Object.defineProperty(exports, "durationToCss", { enumerable: true, get: function () { return durationToCss_1.durationToCss; } });
26
- var figmaAttributes_1 = require("./figmaAttributes");
27
- Object.defineProperty(exports, "figmaAttributes", { enumerable: true, get: function () { return figmaAttributes_1.figmaAttributes; } });
28
- var fontFamilyToCss_1 = require("./fontFamilyToCss");
29
- Object.defineProperty(exports, "fontFamilyToCss", { enumerable: true, get: function () { return fontFamilyToCss_1.fontFamilyToCss; } });
30
- var fontFamilyToFigma_1 = require("./fontFamilyToFigma");
31
- Object.defineProperty(exports, "fontFamilyToFigma", { enumerable: true, get: function () { return fontFamilyToFigma_1.fontFamilyToFigma; } });
32
- var fontWeightToNumber_1 = require("./fontWeightToNumber");
33
- Object.defineProperty(exports, "fontWeightToNumber", { enumerable: true, get: function () { return fontWeightToNumber_1.fontWeightToNumber; } });
34
- var jsonDeprecated_1 = require("./jsonDeprecated");
35
- Object.defineProperty(exports, "jsonDeprecated", { enumerable: true, get: function () { return jsonDeprecated_1.jsonDeprecated; } });
36
- var namePathToCamelCase_1 = require("./namePathToCamelCase");
37
- Object.defineProperty(exports, "namePathToCamelCase", { enumerable: true, get: function () { return namePathToCamelCase_1.namePathToCamelCase; } });
38
- var namePathToPascalCase_1 = require("./namePathToPascalCase");
39
- Object.defineProperty(exports, "namePathToPascalCase", { enumerable: true, get: function () { return namePathToPascalCase_1.namePathToPascalCase; } });
40
- var namePathToDotNotation_1 = require("./namePathToDotNotation");
41
- Object.defineProperty(exports, "namePathToDotNotation", { enumerable: true, get: function () { return namePathToDotNotation_1.namePathToDotNotation; } });
42
- var namePathToFigma_1 = require("./namePathToFigma");
43
- Object.defineProperty(exports, "namePathToFigma", { enumerable: true, get: function () { return namePathToFigma_1.namePathToFigma; } });
44
- var namePathToKebabCase_1 = require("./namePathToKebabCase");
45
- Object.defineProperty(exports, "namePathToKebabCase", { enumerable: true, get: function () { return namePathToKebabCase_1.namePathToKebabCase; } });
46
- var namePathToSlashNotation_1 = require("./namePathToSlashNotation");
47
- Object.defineProperty(exports, "namePathToSlashNotation", { enumerable: true, get: function () { return namePathToSlashNotation_1.namePathToSlashNotation; } });
48
- var shadowToCss_1 = require("./shadowToCss");
49
- Object.defineProperty(exports, "shadowToCss", { enumerable: true, get: function () { return shadowToCss_1.shadowToCss; } });
50
- var typographyToCss_1 = require("./typographyToCss");
51
- Object.defineProperty(exports, "typographyToCss", { enumerable: true, get: function () { return typographyToCss_1.typographyToCss; } });
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description replaces tokens value with content of tokens `deprecated` property
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens with a `deprecated` property
6
- * @transformer returns `string` specified in `token.deprecated` or `null`
7
- */
8
- export declare const jsonDeprecated: StyleDictionary.Transform;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsonDeprecated = void 0;
4
- const filters_1 = require("../filters");
5
- /**
6
- * @description replaces tokens value with content of tokens `deprecated` property
7
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
8
- * @matcher matches all tokens with a `deprecated` property
9
- * @transformer returns `string` specified in `token.deprecated` or `null`
10
- */
11
- exports.jsonDeprecated = {
12
- type: `value`,
13
- transitive: true,
14
- matcher: filters_1.isDeprecated,
15
- transformer: (token) => typeof token.deprecated === 'string' ? token.deprecated.replace(/[{}]/g, '') : null,
16
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a camelCase string, preserves casing of parts
4
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher omitted to match all tokens
6
- * @transformer returns `string` camelCase
7
- */
8
- export declare const namePathToCamelCase: StyleDictionary.Transform;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.namePathToCamelCase = void 0;
4
- const utilities_1 = require("../utilities");
5
- /**
6
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a camelCase string, preserves casing of parts
7
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
8
- * @matcher omitted to match all tokens
9
- * @transformer returns `string` camelCase
10
- */
11
- exports.namePathToCamelCase = {
12
- type: `name`,
13
- transformer: (token, options) => (0, utilities_1.toCamelCase)([(options === null || options === void 0 ? void 0 : options.prefix) || '', ...token.path]),
14
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a dot.notation string
4
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher omitted to match all tokens
6
- * @transformer returns `string` in dot.notation
7
- */
8
- export declare const namePathToDotNotation: StyleDictionary.Transform;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.namePathToDotNotation = void 0;
4
- const utilities_1 = require("../utilities");
5
- /**
6
- * camelCase
7
- * @scope custom camelCase implementation should only be used within `name path to dot notation` transformer
8
- * @description replaces space ` `, dash `-`, underscore `_` and plus `+` by camelCasing e.g. `camel-case` -> `camelCase`
9
- * @param string
10
- * @returns string
11
- */
12
- const camelCase = (string) => {
13
- return string
14
- .split(/[\s-_+]+/g)
15
- .map((stringPart, index) => (index === 0 ? stringPart : (0, utilities_1.upperCaseFirstCharacter)(stringPart)))
16
- .join('');
17
- };
18
- /**
19
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a dot.notation string
20
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
21
- * @matcher omitted to match all tokens
22
- * @transformer returns `string` in dot.notation
23
- */
24
- exports.namePathToDotNotation = {
25
- type: `name`,
26
- transformer: (token, options) => {
27
- return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
28
- // remove undefined if exists
29
- .filter((part) => typeof part === 'string' && part !== '@')
30
- .map((part) => camelCase(part))
31
- .join('.'));
32
- },
33
- };
@@ -1,9 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- export declare const transformNamePathToFigma: (token: StyleDictionary.TransformedToken, options?: StyleDictionary.Platform) => string;
3
- /**
4
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a specific figma name
5
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
6
- * @matcher omitted to match all tokens
7
- * @transformer returns `string`
8
- */
9
- export declare const namePathToFigma: StyleDictionary.Transform;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.namePathToFigma = exports.transformNamePathToFigma = void 0;
4
- const transformNamePathToFigma = (token, options) => {
5
- let pathArray = token.path.filter((part) => part !== '@');
6
- if (['fgColor', 'borderColor', 'bgColor'].includes(pathArray[0]) && pathArray.length === 3) {
7
- pathArray = [pathArray[0], `${pathArray[1]}-${pathArray[2]}`];
8
- }
9
- return ([options === null || options === void 0 ? void 0 : options.prefix, ...pathArray]
10
- // remove undefined if exists
11
- .filter((part) => typeof part === 'string' && part !== '@')
12
- .join('/'));
13
- };
14
- exports.transformNamePathToFigma = transformNamePathToFigma;
15
- /**
16
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a specific figma name
17
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
18
- * @matcher omitted to match all tokens
19
- * @transformer returns `string`
20
- */
21
- exports.namePathToFigma = {
22
- type: `name`,
23
- transformer: exports.transformNamePathToFigma,
24
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a kebab-case string, preserves casing of parts
4
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher omitted to match all tokens
6
- * @transformer returns `string` kebab-case
7
- */
8
- export declare const namePathToKebabCase: StyleDictionary.Transform;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.namePathToKebabCase = void 0;
4
- /**
5
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a kebab-case string, preserves casing of parts
6
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
7
- * @matcher omitted to match all tokens
8
- * @transformer returns `string` kebab-case
9
- */
10
- exports.namePathToKebabCase = {
11
- type: `name`,
12
- transformer: (token, options) => {
13
- return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
14
- // remove undefined if exists
15
- .filter((part) => typeof part === 'string' && part !== '@')
16
- .join('-'));
17
- },
18
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a PascalCase string, preserves casing of parts
4
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher omitted to match all tokens
6
- * @transformer returns `string` PascalCase
7
- */
8
- export declare const namePathToPascalCase: StyleDictionary.Transform;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.namePathToPascalCase = void 0;
4
- const toPascalCase_1 = require("../utilities/toPascalCase");
5
- /**
6
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a PascalCase string, preserves casing of parts
7
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
8
- * @matcher omitted to match all tokens
9
- * @transformer returns `string` PascalCase
10
- */
11
- exports.namePathToPascalCase = {
12
- type: `name`,
13
- transformer: (token, options) => (0, toPascalCase_1.toPascalCase)([(options === null || options === void 0 ? void 0 : options.prefix) || '', ...token.path]),
14
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a slash/notation string
4
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher omitted to match all tokens
6
- * @transformer returns `string` on slash/notation
7
- */
8
- export declare const namePathToSlashNotation: StyleDictionary.Transform;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.namePathToSlashNotation = void 0;
4
- /**
5
- * @description converts the [TransformedToken's](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts) `.path` array to a slash/notation string
6
- * @type name transformer — [StyleDictionary.NameTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
7
- * @matcher omitted to match all tokens
8
- * @transformer returns `string` on slash/notation
9
- */
10
- exports.namePathToSlashNotation = {
11
- type: `name`,
12
- transformer: (token, options) => {
13
- return ([options === null || options === void 0 ? void 0 : options.prefix, ...token.path]
14
- // remove undefined if exists
15
- .filter((part) => typeof part === 'string' && part !== '@')
16
- .join('/'));
17
- },
18
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts w3c shadow tokens in css shadow string
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens of $type `shadow`
6
- * @transformer returns css shadow `string`
7
- */
8
- export declare const shadowToCss: StyleDictionary.Transform;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shadowToCss = void 0;
4
- const color2k_1 = require("color2k");
5
- const filters_1 = require("../filters");
6
- const alpha_1 = require("./utilities/alpha");
7
- const checkRequiredTokenProperties_1 = require("./utilities/checkRequiredTokenProperties");
8
- const getTokenValue_1 = require("./utilities/getTokenValue");
9
- /**
10
- * @description converts w3c shadow tokens in css shadow string
11
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
12
- * @matcher matches all tokens of $type `shadow`
13
- * @transformer returns css shadow `string`
14
- */
15
- exports.shadowToCss = {
16
- type: `value`,
17
- transitive: true,
18
- matcher: filters_1.isShadow,
19
- transformer: (token) => {
20
- // extract value
21
- const { value } = token;
22
- // turn value into array
23
- const shadowValues = !Array.isArray(value) ? [value] : value;
24
- return shadowValues
25
- .map((shadow) => {
26
- // if value === string it was probably already transformed
27
- if (typeof shadow === 'string')
28
- return shadow;
29
- (0, checkRequiredTokenProperties_1.checkRequiredTokenProperties)(shadow, ['color', 'offsetX', 'offsetY', 'blur', 'spread']);
30
- /*css box shadow: inset? | offset-x | offset-y | blur-radius | spread-radius | color */
31
- return `${shadow.inset === true ? 'inset ' : ''}${shadow.offsetX} ${shadow.offsetY} ${shadow.blur} ${shadow.spread} ${(0, color2k_1.toHex)((0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(Object.assign(Object.assign({}, token), { value: shadow }), 'color'), shadow.alpha || 1, token))}`;
32
- })
33
- .join(', ');
34
- },
35
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts typograhy token value to css font shorthand
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens of $type `typography`
6
- * @transformer returns a css font string
7
- */
8
- export declare const typographyToCss: StyleDictionary.Transform;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typographyToCss = void 0;
4
- const filters_1 = require("../filters");
5
- const checkRequiredTokenProperties_1 = require("./utilities/checkRequiredTokenProperties");
6
- const fontFamilyToCss_1 = require("./fontFamilyToCss");
7
- const fontWeightToNumber_1 = require("./fontWeightToNumber");
8
- const getTokenValue_1 = require("./utilities/getTokenValue");
9
- /**
10
- * @description converts typograhy token value to css font shorthand
11
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
12
- * @matcher matches all tokens of $type `typography`
13
- * @transformer returns a css font string
14
- */
15
- exports.typographyToCss = {
16
- type: `value`,
17
- transitive: true,
18
- matcher: filters_1.isTypography,
19
- transformer: (token) => {
20
- // extract value
21
- const value = (0, getTokenValue_1.getTokenValue)(token);
22
- // validate token properties
23
- (0, checkRequiredTokenProperties_1.checkRequiredTokenProperties)(value, ['fontWeight', 'fontSize', 'fontFamily']);
24
- // format output
25
- return `${value.fontStyle || ''} ${(0, fontWeightToNumber_1.parseFontWeight)((0, getTokenValue_1.getTokenValue)(token, 'fontWeight'))} ${value.fontSize}${value.lineHeight ? `/${value.lineHeight}` : ''} ${(0, fontFamilyToCss_1.parseFontFamily)((0, getTokenValue_1.getTokenValue)(token, 'fontFamily'))}`
26
- .trim()
27
- .replace(/\s\s+/g, ' ');
28
- },
29
- };
@@ -1,9 +0,0 @@
1
- import type { TransformedToken } from 'style-dictionary';
2
- /**
3
- * alpha
4
- * @description takes a colors string like hex or rgba and returns an rgba color with the specified alpha value
5
- * @param color color string like a `#334455` or `rgb(255,200,100)`
6
- * @param desiredAlpha number
7
- * @returns rgba value
8
- */
9
- export declare const alpha: (color: string, desiredAlpha: number, token?: TransformedToken) => string;
@@ -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,2 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- export declare const getTokenValue: (token: StyleDictionary.TransformedToken, property?: string) => any;
@@ -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,2 +0,0 @@
1
- import type { RgbaFloat } from './isRgbaFloat';
2
- export declare const hexToRgbaFloat: (hex: string, alpha?: number) => RgbaFloat;
@@ -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,7 +0,0 @@
1
- export type RgbaFloat = {
2
- r: number;
3
- g: number;
4
- b: number;
5
- a?: number;
6
- };
7
- export declare const isRgbaFloat: (value: unknown) => value is RgbaFloat;
@@ -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,5 +0,0 @@
1
- /**
2
- * Mixes two colors together. Taken from sass's implementation.
3
- */
4
- declare function mix(color1: string, color2: string, weight: number): string;
5
- export default mix;
@@ -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,6 +0,0 @@
1
- export declare const rgbaFloatToHex: ({ r, g, b, a }: {
2
- r: number;
3
- g: number;
4
- b: number;
5
- a?: number;
6
- }, alpha?: boolean) => string;