@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,6 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description Parses a valid [json5](https://json5.org) file and replaces `$value` with `value` and `$description` with `comment` to make a w3c standard file compatible with style dictionary
4
- * @pattern supported file extensions `.json` or `.json5`
5
- */
6
- export declare const w3cJsonParser: StyleDictionary.Parser;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.w3cJsonParser = void 0;
4
- const json5_1 = require("json5");
5
- /**
6
- * @description Parses a valid [json5](https://json5.org) file and replaces `$value` with `value` and `$description` with `comment` to make a w3c standard file compatible with style dictionary
7
- * @pattern supported file extensions `.json` or `.json5`
8
- */
9
- exports.w3cJsonParser = {
10
- pattern: /\.json5?$/,
11
- parse: ({ filePath, contents }) => {
12
- // replace $value with value so that style dictionary recognizes it
13
- try {
14
- contents = contents
15
- .replace(/["|']?\$value["|']?:/g, '"value":')
16
- // convert $description to comment
17
- .replace(/["|']?\$?description["|']?:/g, '"comment":')
18
- .replace(/["|']?\$?type["|']?:/g, '"$type":')
19
- .replace(/["|']?\$?extensions["|']?:/g, '"$extensions":');
20
- //
21
- return (0, json5_1.parse)(contents);
22
- }
23
- catch (e) {
24
- throw new Error(`Invalid json5 file "${filePath}".`);
25
- }
26
- },
27
- };
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const css: PlatformInitializer;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.css = void 0;
4
- const filters_1 = require("../filters");
5
- const getCssSelectors = (outputFile) => {
6
- // check for dark in the beginning of the output filename
7
- const lastSlash = outputFile.lastIndexOf('/');
8
- const outputBasename = outputFile.substring(lastSlash + 1, outputFile.indexOf('.'));
9
- const themeName = outputBasename.replace(/-/g, '_');
10
- const mode = outputBasename.substring(0, 4) === 'dark' ? 'dark' : 'light';
11
- return [
12
- {
13
- selector: `[data-color-mode="${mode}"][data-${mode}-theme="${themeName}"], [data-color-mode="${mode}"][data-${mode}-theme="${themeName}"] ::backdrop, [data-color-mode="auto"][data-light-theme="${themeName}"], [data-color-mode="auto"][data-light-theme="${themeName}"] ::backdrop`,
14
- },
15
- {
16
- query: '@media (prefers-color-scheme: dark)',
17
- selector: `[data-color-mode="auto"][data-dark-theme="${themeName}"], [data-color-mode="auto"][data-dark-theme="${themeName}"] ::backdrop`,
18
- },
19
- ];
20
- };
21
- const css = (outputFile, prefix, buildPath, options) => {
22
- return {
23
- prefix,
24
- buildPath,
25
- transforms: [
26
- 'name/pathToKebabCase',
27
- 'color/hex',
28
- 'color/hexMix',
29
- 'dimension/rem',
30
- 'duration/css',
31
- 'shadow/css',
32
- 'border/css',
33
- 'typography/css',
34
- 'fontFamily/css',
35
- 'fontWeight/number',
36
- ],
37
- options: {
38
- basePxFontSize: 16,
39
- },
40
- files: [
41
- {
42
- destination: `${outputFile}`,
43
- format: `css/advanced`,
44
- filter: token => (0, filters_1.isSource)(token) && (options === null || options === void 0 ? void 0 : options.themed) === true,
45
- options: Object.assign({ showFileHeader: false, outputReferences: false, descriptions: false, queries: getCssSelectors(outputFile) }, options === null || options === void 0 ? void 0 : options.options),
46
- },
47
- {
48
- destination: `${outputFile}`,
49
- format: `css/advanced`,
50
- filter: token => (0, filters_1.isSource)(token) && (options === null || options === void 0 ? void 0 : options.themed) !== true,
51
- options: Object.assign({ showFileHeader: false, descriptions: false }, options === null || options === void 0 ? void 0 : options.options),
52
- },
53
- {
54
- destination: `${outputFile}`,
55
- format: `css/customMedia`,
56
- filter: token => (0, filters_1.isSource)(token) && (options === null || options === void 0 ? void 0 : options.themed) !== true && token.$type === 'custom-viewportRange',
57
- options: {
58
- showFileHeader: false,
59
- },
60
- },
61
- {
62
- destination: `${outputFile}`,
63
- format: `css/advanced`,
64
- filter: token => (0, filters_1.isSource)(token) &&
65
- (0, filters_1.isFromFile)(token, [
66
- 'src/tokens/functional/size/size-coarse.json',
67
- 'src/tokens/functional/size/size-fine.json',
68
- ]),
69
- options: {
70
- descriptions: false,
71
- showFileHeader: false,
72
- queries: [
73
- {
74
- query: '@media (pointer: fine)',
75
- matcher: (token) => token.filePath.includes('size-fine'),
76
- },
77
- {
78
- query: '@media (pointer: coarse)',
79
- matcher: (token) => token.filePath.includes('size-coarse'),
80
- },
81
- ],
82
- },
83
- },
84
- ],
85
- };
86
- };
87
- exports.css = css;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const deprecatedJson: PlatformInitializer;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deprecatedJson = void 0;
4
- const filters_1 = require("../filters");
5
- const deprecatedJson = (outputFile, prefix, buildPath) => ({
6
- prefix,
7
- buildPath,
8
- transforms: ['name/pathToDotNotation', 'json/deprecated'],
9
- files: [
10
- {
11
- destination: outputFile,
12
- format: `json/flat`,
13
- filter: filters_1.isDeprecated,
14
- },
15
- ],
16
- });
17
- exports.deprecatedJson = deprecatedJson;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const docJson: PlatformInitializer;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.docJson = void 0;
4
- const filters_1 = require("../filters");
5
- const docJson = (outputFile, prefix, buildPath) => ({
6
- prefix,
7
- buildPath,
8
- transforms: [
9
- 'name/pathToKebabCase',
10
- 'color/hex',
11
- 'color/hexMix',
12
- 'dimension/rem',
13
- 'shadow/css',
14
- 'border/css',
15
- 'typography/css',
16
- 'fontFamily/css',
17
- 'fontWeight/number',
18
- ],
19
- options: {
20
- basePxFontSize: 16,
21
- },
22
- files: [
23
- {
24
- destination: outputFile,
25
- format: `json/one-dimensional`,
26
- filter: filters_1.isSource,
27
- options: {
28
- outputReferences: false,
29
- outputVerbose: true,
30
- },
31
- },
32
- ],
33
- });
34
- exports.docJson = docJson;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const fallbacks: PlatformInitializer;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fallbacks = void 0;
4
- const filters_1 = require("../filters");
5
- const fallbacks = (outputFile, prefix, buildPath) => ({
6
- prefix,
7
- buildPath,
8
- transforms: [
9
- 'name/pathToKebabCase',
10
- 'color/hex',
11
- 'color/hexMix',
12
- 'dimension/rem',
13
- 'shadow/css',
14
- 'border/css',
15
- 'typography/css',
16
- 'fontFamily/css',
17
- 'fontWeight/number',
18
- ],
19
- options: {
20
- basePxFontSize: 16,
21
- },
22
- files: [
23
- {
24
- destination: outputFile,
25
- format: `json/postCss-fallback`,
26
- filter: filters_1.isSource,
27
- options: {
28
- outputReferences: false,
29
- outputVerbose: true,
30
- },
31
- },
32
- ],
33
- });
34
- exports.fallbacks = fallbacks;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const figma: PlatformInitializer;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.figma = void 0;
4
- const filters_1 = require("../filters");
5
- const validFigmaToken = (token) => {
6
- const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily', 'number'];
7
- // is a siource token, not an included one
8
- if (!(0, filters_1.isSource)(token))
9
- return false;
10
- if (`${token.value}`.substring(token.value.length - 2) === 'em')
11
- return false;
12
- // has a collection attribute
13
- if (!('$extensions' in token) ||
14
- !('org.primer.figma' in token.$extensions) ||
15
- !('collection' in token.$extensions['org.primer.figma']))
16
- return false;
17
- // is a color or dimension type
18
- return validTypes.includes(token.$type);
19
- };
20
- const figma = (outputFile, prefix, buildPath, options) => ({
21
- prefix,
22
- buildPath,
23
- transforms: [
24
- 'color/rgbaFloat',
25
- 'name/pathToFigma',
26
- // 'name/pathToSlashNotation',
27
- 'figma/attributes',
28
- 'fontFamily/figma',
29
- 'float/pixelUnitless',
30
- 'dimension/pixelUnitless',
31
- // 'border/figma',
32
- // 'typography/figma',
33
- 'fontWeight/number',
34
- ],
35
- options: Object.assign({ basePxFontSize: 16, fontFamilies: {
36
- 'fontStack/system': 'SF Pro Text',
37
- 'fontStack/sansSerif': 'SF Pro Text',
38
- 'fontStack/sansSerifDisplay': 'SF Pro Display',
39
- 'fontStack/monospace': 'SF Mono',
40
- } }, options),
41
- files: [
42
- {
43
- destination: outputFile,
44
- filter: validFigmaToken,
45
- format: `json/figma`,
46
- options: {
47
- outputReferences: true,
48
- mode: options === null || options === void 0 ? void 0 : options.mode,
49
- },
50
- },
51
- ],
52
- });
53
- exports.figma = figma;
@@ -1,10 +0,0 @@
1
- export { css } from './css';
2
- export { deprecatedJson } from './deprecatedJson';
3
- export { docJson } from './docJson';
4
- export { fallbacks } from './fallbacks';
5
- export { figma } from './figma';
6
- export { javascript } from './javascript';
7
- export { json } from './json';
8
- export { styleLint } from './styleLint';
9
- export { typeDefinitions } from './typeDefinitions';
10
- export { typescript } from './typescript';
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typescript = exports.typeDefinitions = exports.styleLint = exports.json = exports.javascript = exports.figma = exports.fallbacks = exports.docJson = exports.deprecatedJson = exports.css = void 0;
4
- var css_1 = require("./css");
5
- Object.defineProperty(exports, "css", { enumerable: true, get: function () { return css_1.css; } });
6
- var deprecatedJson_1 = require("./deprecatedJson");
7
- Object.defineProperty(exports, "deprecatedJson", { enumerable: true, get: function () { return deprecatedJson_1.deprecatedJson; } });
8
- var docJson_1 = require("./docJson");
9
- Object.defineProperty(exports, "docJson", { enumerable: true, get: function () { return docJson_1.docJson; } });
10
- var fallbacks_1 = require("./fallbacks");
11
- Object.defineProperty(exports, "fallbacks", { enumerable: true, get: function () { return fallbacks_1.fallbacks; } });
12
- var figma_1 = require("./figma");
13
- Object.defineProperty(exports, "figma", { enumerable: true, get: function () { return figma_1.figma; } });
14
- var javascript_1 = require("./javascript");
15
- Object.defineProperty(exports, "javascript", { enumerable: true, get: function () { return javascript_1.javascript; } });
16
- var json_1 = require("./json");
17
- Object.defineProperty(exports, "json", { enumerable: true, get: function () { return json_1.json; } });
18
- var styleLint_1 = require("./styleLint");
19
- Object.defineProperty(exports, "styleLint", { enumerable: true, get: function () { return styleLint_1.styleLint; } });
20
- var typeDefinitions_1 = require("./typeDefinitions");
21
- Object.defineProperty(exports, "typeDefinitions", { enumerable: true, get: function () { return typeDefinitions_1.typeDefinitions; } });
22
- var typescript_1 = require("./typescript");
23
- Object.defineProperty(exports, "typescript", { enumerable: true, get: function () { return typescript_1.typescript; } });
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const javascript: PlatformInitializer;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.javascript = void 0;
4
- const filters_1 = require("../filters");
5
- const javascript = (outputFile, prefix, buildPath) => ({
6
- prefix,
7
- buildPath,
8
- transforms: [
9
- 'color/hex',
10
- 'color/hexMix',
11
- 'dimension/rem',
12
- 'shadow/css',
13
- 'border/css',
14
- 'typography/css',
15
- 'fontFamily/css',
16
- 'fontWeight/number',
17
- ],
18
- options: {
19
- showFileHeader: false,
20
- basePxFontSize: 16,
21
- },
22
- files: [
23
- {
24
- format: 'javascript/commonJs',
25
- destination: outputFile,
26
- filter: filters_1.isSource,
27
- },
28
- ],
29
- });
30
- exports.javascript = javascript;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const json: PlatformInitializer;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.json = void 0;
4
- const filters_1 = require("../filters");
5
- const json = (outputFile, prefix, buildPath) => ({
6
- prefix,
7
- buildPath,
8
- transforms: [
9
- 'color/hex',
10
- 'color/hexMix',
11
- 'dimension/rem',
12
- 'shadow/css',
13
- 'border/css',
14
- 'typography/css',
15
- 'fontFamily/css',
16
- 'fontWeight/number',
17
- ],
18
- options: {
19
- basePxFontSize: 16,
20
- },
21
- files: [
22
- {
23
- destination: outputFile,
24
- filter: filters_1.isSource,
25
- format: `json/nested-prefixed`,
26
- options: {
27
- outputReferences: false,
28
- },
29
- },
30
- ],
31
- });
32
- exports.json = json;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const styleLint: PlatformInitializer;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.styleLint = void 0;
4
- const filters_1 = require("../filters");
5
- const styleLint = (outputFile, prefix, buildPath) => ({
6
- prefix,
7
- buildPath,
8
- transforms: [
9
- 'name/pathToKebabCase',
10
- 'color/hex',
11
- 'color/hexMix',
12
- 'dimension/remPxArray',
13
- 'shadow/css',
14
- 'border/css',
15
- 'typography/css',
16
- 'fontFamily/css',
17
- 'fontWeight/number',
18
- ],
19
- options: {
20
- basePxFontSize: 16,
21
- },
22
- files: [
23
- {
24
- destination: outputFile,
25
- format: `json/one-dimensional`,
26
- filter: filters_1.isSource,
27
- options: {
28
- outputReferences: false,
29
- outputVerbose: true,
30
- },
31
- },
32
- ],
33
- });
34
- exports.styleLint = styleLint;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const typeDefinitions: PlatformInitializer;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typeDefinitions = void 0;
4
- const filters_1 = require("../filters");
5
- const utilities_1 = require("../utilities");
6
- const typeDefinitions = (outputFile, prefix, buildPath) => ({
7
- prefix,
8
- buildPath,
9
- transforms: [
10
- 'color/hex',
11
- 'shadow/css',
12
- 'border/css',
13
- 'dimension/rem',
14
- 'typography/css',
15
- 'fontFamily/css',
16
- 'fontWeight/number',
17
- ],
18
- files: [
19
- {
20
- format: 'typescript/export-definition',
21
- destination: `${(0, utilities_1.upperCaseFirstCharacter)(outputFile)}DesignTokens.d.ts`,
22
- filter: filters_1.isSource,
23
- options: {
24
- tokenTypesPath: './src/types/',
25
- moduleName: `${(0, utilities_1.upperCaseFirstCharacter)(outputFile)}DesignTokens`,
26
- },
27
- },
28
- ],
29
- });
30
- exports.typeDefinitions = typeDefinitions;
@@ -1,2 +0,0 @@
1
- import type { PlatformInitializer } from '../types/PlatformInitializer';
2
- export declare const typescript: PlatformInitializer;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typescript = void 0;
4
- const filters_1 = require("../filters");
5
- const typescript = (outputFile, prefix, buildPath) => ({
6
- prefix,
7
- buildPath,
8
- transforms: [
9
- 'color/hex',
10
- 'color/hexMix',
11
- 'dimension/rem',
12
- 'shadow/css',
13
- 'border/css',
14
- 'typography/css',
15
- 'fontFamily/css',
16
- 'fontWeight/number',
17
- ],
18
- options: {
19
- showFileHeader: false,
20
- basePxFontSize: 16,
21
- },
22
- files: [
23
- {
24
- format: 'javascript/esm',
25
- destination: outputFile,
26
- filter: filters_1.isSource,
27
- },
28
- ],
29
- });
30
- exports.typescript = typescript;
@@ -1,2 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const alphaValue: z.ZodEffects<z.ZodAny, any, any>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.alphaValue = void 0;
4
- const zod_1 = require("zod");
5
- const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
6
- exports.alphaValue = zod_1.z.any().refine(value => typeof value === 'number' && value >= 0 && value <= 1, value => ({
7
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid alpha value: "${value}" (${typeof value})`, 'Alpha value must be a number between 0 and 1.'),
8
- }));
@@ -1,11 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const baseToken: z.ZodObject<{
3
- $description: z.ZodOptional<z.ZodString>;
4
- deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
- }, "strict", z.ZodTypeAny, {
6
- deprecated?: string | boolean | undefined;
7
- $description?: string | undefined;
8
- }, {
9
- deprecated?: string | boolean | undefined;
10
- $description?: string | undefined;
11
- }>;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseToken = void 0;
4
- const zod_1 = require("zod");
5
- exports.baseToken = zod_1.z
6
- .object({
7
- $description: zod_1.z.string().optional(),
8
- deprecated: zod_1.z.union([zod_1.z.string(), zod_1.z.boolean()]).optional(),
9
- })
10
- .strict();
@@ -1,51 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const borderValue: z.ZodObject<{
3
- color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
4
- style: z.ZodEnum<["solid", "dashed", "dotted", "double", "groove", "ridge", "outset", "inset"]>;
5
- width: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
6
- }, "strip", z.ZodTypeAny, {
7
- width: string | 0;
8
- color: string;
9
- style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
10
- }, {
11
- width: string | 0;
12
- color: string;
13
- style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
14
- }>;
15
- export declare const borderToken: z.ZodObject<z.objectUtil.extendShape<{
16
- $description: z.ZodOptional<z.ZodString>;
17
- deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
18
- }, {
19
- $value: z.ZodUnion<[z.ZodObject<{
20
- color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
21
- style: z.ZodEnum<["solid", "dashed", "dotted", "double", "groove", "ridge", "outset", "inset"]>;
22
- width: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
23
- }, "strip", z.ZodTypeAny, {
24
- width: string | 0;
25
- color: string;
26
- style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
27
- }, {
28
- width: string | 0;
29
- color: string;
30
- style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
31
- }>, z.ZodEffects<z.ZodString, string, string>]>;
32
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
33
- }>, "strict", z.ZodTypeAny, {
34
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
35
- $value: string | {
36
- width: string | 0;
37
- color: string;
38
- style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
39
- };
40
- deprecated?: string | boolean | undefined;
41
- $description?: string | undefined;
42
- }, {
43
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
44
- $value: string | {
45
- width: string | 0;
46
- color: string;
47
- style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
48
- };
49
- deprecated?: string | boolean | undefined;
50
- $description?: string | undefined;
51
- }>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.borderToken = exports.borderValue = void 0;
4
- const zod_1 = require("zod");
5
- const baseToken_1 = require("./baseToken");
6
- const referenceValue_1 = require("./referenceValue");
7
- const colorHexValue_1 = require("./colorHexValue");
8
- const dimensionValue_1 = require("./dimensionValue");
9
- const tokenType_1 = require("./tokenType");
10
- exports.borderValue = zod_1.z.object({
11
- color: zod_1.z.union([colorHexValue_1.colorHexValue, referenceValue_1.referenceValue]),
12
- style: zod_1.z.enum(['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'outset', 'inset']),
13
- width: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
14
- });
15
- exports.borderToken = baseToken_1.baseToken
16
- .extend({
17
- $value: zod_1.z.union([exports.borderValue, referenceValue_1.referenceValue]),
18
- $type: (0, tokenType_1.tokenType)('border'),
19
- })
20
- .strict();
@@ -1,6 +0,0 @@
1
- import { z } from 'zod';
2
- type Collections = 'base/color/light' | 'base/color/light-high-contrast' | 'base/color/dark' | 'base/color/dark-dimmed' | 'base/color/dark-high-contrast' | 'base/typography' | 'mode' | 'pattern/mode' | 'base/size' | 'functional/size' | 'pattern/size' | 'typography';
3
- export declare const collection: (collections: Collections[]) => z.ZodEffects<z.ZodString, string, string>;
4
- type Modes = 'light' | 'dark' | 'dark dimmed' | 'light high contrast' | 'dark high contrast' | 'light colorblind' | 'dark colorblind' | 'light tritanopia' | 'dark tritanopia';
5
- export declare const mode: (modes: Modes[]) => z.ZodEffects<z.ZodString, string, string>;
6
- export {};
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mode = exports.collection = void 0;
4
- const zod_1 = require("zod");
5
- const joinFriendly_1 = require("../utilities/joinFriendly");
6
- const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
7
- const collection = (collections) => {
8
- return zod_1.z.string().refine(value => collections.includes(value), value => ({
9
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid collection: "${value}"`, `Valid collections are ${(0, joinFriendly_1.joinFriendly)(collections)}`),
10
- }));
11
- };
12
- exports.collection = collection;
13
- const mode = (modes) => {
14
- return zod_1.z.string().refine(value => modes.includes(value), value => ({
15
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid mode: "${value}"`, `Valid modes are ${(0, joinFriendly_1.joinFriendly)(modes)}`),
16
- }));
17
- };
18
- exports.mode = mode;
@@ -1,2 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const colorHexValue: z.ZodEffects<z.ZodString, string, string>;