@primer/primitives 7.10.0-rc.a4b55e0 → 7.10.0-rc.e05ea69

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 (139) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +3 -4
  3. package/build.js +33 -33
  4. package/dist/color-contrast-check.json +1 -0
  5. package/dist/js/colors/dark.d.ts +3 -0
  6. package/dist/js/colors/dark.js +3 -0
  7. package/dist/js/colors/dark_colorblind.d.ts +3 -0
  8. package/dist/js/colors/dark_colorblind.js +3 -0
  9. package/dist/js/colors/dark_dimmed.d.ts +3 -0
  10. package/dist/js/colors/dark_dimmed.js +3 -0
  11. package/dist/js/colors/dark_high_contrast.d.ts +3 -0
  12. package/dist/js/colors/dark_high_contrast.js +3 -0
  13. package/dist/js/colors/dark_tritanopia.d.ts +3 -0
  14. package/dist/js/colors/dark_tritanopia.js +3 -0
  15. package/dist/js/colors/index.d.ts +27 -0
  16. package/dist/js/colors/light.d.ts +3 -0
  17. package/dist/js/colors/light.js +3 -0
  18. package/dist/js/colors/light_colorblind.d.ts +3 -0
  19. package/dist/js/colors/light_colorblind.js +3 -0
  20. package/dist/js/colors/light_high_contrast.d.ts +3 -0
  21. package/dist/js/colors/light_high_contrast.js +3 -0
  22. package/dist/js/colors/light_tritanopia.d.ts +3 -0
  23. package/dist/js/colors/light_tritanopia.js +3 -0
  24. package/dist/js/index.d.ts +27 -0
  25. package/dist/json/colors/dark.json +3 -0
  26. package/dist/json/colors/dark_colorblind.json +3 -0
  27. package/dist/json/colors/dark_dimmed.json +3 -0
  28. package/dist/json/colors/dark_high_contrast.json +3 -0
  29. package/dist/json/colors/dark_tritanopia.json +3 -0
  30. package/dist/json/colors/light.json +3 -0
  31. package/dist/json/colors/light_colorblind.json +3 -0
  32. package/dist/json/colors/light_high_contrast.json +3 -0
  33. package/dist/json/colors/light_tritanopia.json +3 -0
  34. package/dist/scss/colors/_dark.scss +1 -0
  35. package/dist/scss/colors/_dark_colorblind.scss +1 -0
  36. package/dist/scss/colors/_dark_dimmed.scss +1 -0
  37. package/dist/scss/colors/_dark_high_contrast.scss +1 -0
  38. package/dist/scss/colors/_dark_tritanopia.scss +1 -0
  39. package/dist/scss/colors/_light.scss +1 -0
  40. package/dist/scss/colors/_light_colorblind.scss +1 -0
  41. package/dist/scss/colors/_light_high_contrast.scss +1 -0
  42. package/dist/scss/colors/_light_tritanopia.scss +1 -0
  43. package/dist/ts/colors/dark.ts +3 -0
  44. package/dist/ts/colors/dark_colorblind.ts +3 -0
  45. package/dist/ts/colors/dark_dimmed.ts +3 -0
  46. package/dist/ts/colors/dark_high_contrast.ts +3 -0
  47. package/dist/ts/colors/dark_tritanopia.ts +3 -0
  48. package/dist/ts/colors/light.ts +3 -0
  49. package/dist/ts/colors/light_colorblind.ts +3 -0
  50. package/dist/ts/colors/light_high_contrast.ts +3 -0
  51. package/dist/ts/colors/light_tritanopia.ts +3 -0
  52. package/package.json +27 -4
  53. package/tokens/base/color/dark-colorblind.json +44 -0
  54. package/tokens/base/color/dark-dimmed.json +124 -0
  55. package/tokens/base/color/dark-high-contrast.json +124 -0
  56. package/tokens/base/color/dark-tritanopia.json +92 -0
  57. package/tokens/base/color/dark.json +129 -0
  58. package/tokens/base/color/light-colorblind.json +134 -0
  59. package/tokens/base/color/light-high-contrast.json +390 -0
  60. package/tokens/base/color/light-tritanopia.json +92 -0
  61. package/tokens/base/color/light.json +399 -0
  62. package/tokens/functional/color/ansi-dark.json +74 -0
  63. package/tokens/functional/color/ansi-light.json +74 -0
  64. package/tokens/functional/color/checks-dark.json +289 -0
  65. package/tokens/functional/color/checks-light.json +296 -0
  66. package/tokens/functional/color/components-dark.json +556 -0
  67. package/tokens/functional/color/components-light.json +469 -0
  68. package/tokens/functional/color/diff-dark.json +78 -0
  69. package/tokens/functional/color/diff-light.json +76 -0
  70. package/tokens/functional/color/exceptions-dark-colorblind.json +45 -0
  71. package/tokens/functional/color/exceptions-dark-dimmed.json +12 -0
  72. package/tokens/functional/color/exceptions-dark-high-contrast.json +271 -0
  73. package/tokens/functional/color/exceptions-dark-tritanopia.json +44 -0
  74. package/tokens/functional/color/exceptions-light-colorblind.json +87 -0
  75. package/tokens/functional/color/exceptions-light-high-contrast.json +327 -0
  76. package/tokens/functional/color/exceptions-light-tritanopia.json +87 -0
  77. package/tokens/functional/color/marketing-dark.json +24 -0
  78. package/tokens/functional/color/marketing-light.json +24 -0
  79. package/tokens/functional/color/misc-dark.json +38 -0
  80. package/tokens/functional/color/misc-light.json +37 -0
  81. package/tokens/functional/color/primitives-dark.json +322 -0
  82. package/tokens/functional/color/primitives-light.json +313 -0
  83. package/tokens/functional/color/scales.json +582 -0
  84. package/tokens/functional/color/syntax-dark.json +208 -0
  85. package/tokens/functional/color/syntax-light.json +208 -0
  86. package/tokens/removed/color.json +421 -0
  87. package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
  88. package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
  89. package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
  90. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
  91. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +3 -2
  92. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +3 -2
  93. package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
  94. package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
  95. package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
  96. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
  97. package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
  98. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
  99. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
  100. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
  101. package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
  102. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
  103. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
  104. package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
  105. package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
  106. package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
  107. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
  108. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
  109. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
  110. package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
  111. package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
  112. package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
  113. package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
  114. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
  115. package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
  116. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
  117. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
  118. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
  119. package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
  120. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
  121. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
  122. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +4 -2
  123. package/tokens-v2-private/ts/tokens/base/size/size.js +3 -1
  124. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +4 -2
  125. package/tokens-v2-private/ts/tokens/base/typography/typography.js +3 -1
  126. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +4 -2
  127. package/tokens-v2-private/ts/tokens/functional/size/border.js +3 -1
  128. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +4 -2
  129. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +3 -1
  130. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +4 -2
  131. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +3 -1
  132. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +4 -2
  133. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +3 -1
  134. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +4 -2
  135. package/tokens-v2-private/ts/tokens/functional/size/size.js +3 -1
  136. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +4 -2
  137. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +3 -1
  138. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +4 -2
  139. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +3 -1
package/CHANGELOG.md CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - [#354](https://github.com/primer/primitives/pull/354) [`3b28659`](https://github.com/primer/primitives/commit/3b286594aed3d4de97866d354f050f7e59945e95) Thanks [@mperrotti](https://github.com/mperrotti)! - Introduces TreeView.Item component color primitives
7
+ - [#358](https://github.com/primer/primitives/pull/358) [`a188c78`](https://github.com/primer/primitives/commit/a188c788c88dbf8f79bb3252d24416bd195fbc14) Thanks [@mperrotti](https://github.com/mperrotti)! - Adds a color token for the treeview icon fill.
8
+
9
+ * [#354](https://github.com/primer/primitives/pull/354) [`3b28659`](https://github.com/primer/primitives/commit/3b286594aed3d4de97866d354f050f7e59945e95) Thanks [@mperrotti](https://github.com/mperrotti)! - Introduces TreeView.Item component color primitives
8
10
 
9
11
  ### Patch Changes
10
12
 
package/README.md CHANGED
@@ -6,7 +6,6 @@ This repo contains values for color, spacing, and typography primitives for use
6
6
 
7
7
  ![primer primitives diagram](https://user-images.githubusercontent.com/4608155/135384588-192c279f-020f-4544-a61f-559be6629f18.png)
8
8
 
9
-
10
9
  ## Install
11
10
 
12
11
  This repository is distributed on [npm][npm]. After [installing npm][install-npm], you can install `@primer/primitives` with this command.
@@ -35,15 +34,15 @@ To deprecate a variable, define a mapping from the deprecated variable to its re
35
34
  ...
36
35
  ```
37
36
 
38
- ```js
37
+ ```
39
38
  // data/colors/deprecated.json
40
- {
39
+
41
40
  {
42
41
  "text.primary": "fg.default", // this means: `text.primary` is deprecated. Use `fg.default` instead
43
42
  "auto.blue.4": ["accent.fg, accent.emphasis"], // this means: `auto.blue.4` is deprecated. Use `accent.fg` or `accent.emphasis` instead
44
43
  "text.white": null // this means: `text.white` is deprecated. We don't have a replacement for it
45
44
  }
46
- }
45
+
47
46
  ```
48
47
 
49
48
  During the build process, the `deprecated.json` files will be added to a `dist/deprecated` directory organized by variable category:
package/build.js CHANGED
@@ -59,14 +59,14 @@ StyleDictionary.registerTransform({
59
59
 
60
60
  // find values with px unit
61
61
  function isPx(value) {
62
- return /[\d\.]+px$/.test(value)
62
+ return /[\d.]+px$/.test(value)
63
63
  }
64
64
 
65
65
  // transform: px to rem
66
66
  StyleDictionary.registerTransform({
67
67
  name: 'pxToRem',
68
68
  type: 'value',
69
- transformer: (token, options) => {
69
+ transformer: token => {
70
70
  if (isPx(token.value)) {
71
71
  const baseFontSize = 16
72
72
  const floatValue = parseFloat(token.value.replace('px', ''))
@@ -158,28 +158,28 @@ StyleDictionary.registerTransformGroup({
158
158
  // wrap mobile tokens in media query
159
159
  StyleDictionary.registerFormat({
160
160
  name: 'css/touch-target-mobile',
161
- formatter: function({dictionary, file, options}) {
161
+ formatter({dictionary, file, options}) {
162
162
  const {outputReferences} = options
163
- return (
164
- fileHeader({file}) +
165
- `@media (pointer: coarse) { :root {\n` +
166
- formattedVariables({format: 'css', dictionary, outputReferences}) +
167
- '\n}}\n'
168
- )
163
+ return `${fileHeader({file})}
164
+ @media (pointer: coarse) { :root {\n${formattedVariables({
165
+ format: 'css',
166
+ dictionary,
167
+ outputReferences
168
+ })}\n}}\n`
169
169
  }
170
170
  })
171
171
 
172
172
  // wrap desktop tokens in media query
173
173
  StyleDictionary.registerFormat({
174
174
  name: 'css/touch-target-desktop',
175
- formatter: function({dictionary, file, options}) {
175
+ formatter({dictionary, file, options}) {
176
176
  const {outputReferences} = options
177
- return (
178
- fileHeader({file}) +
179
- `@media (pointer: fine) { :root {\n` +
180
- formattedVariables({format: 'css', dictionary, outputReferences}) +
181
- '\n}}\n'
182
- )
177
+ return `${fileHeader({file})}
178
+ @media (pointer: fine) { :root {\n${formattedVariables({
179
+ format: 'css',
180
+ dictionary,
181
+ outputReferences
182
+ })}\n}}\n`
183
183
  }
184
184
  })
185
185
 
@@ -188,9 +188,8 @@ StyleDictionary.registerFormat({
188
188
  formatter({dictionary}) {
189
189
  return dictionary.allProperties
190
190
  .map(prop => {
191
- const {value, path, name} = prop
192
- // const tokenPath = path
193
- // const tokenProperty = path[path.length - 1]
191
+ const {value, name} = prop
192
+
194
193
  return `@custom-media --${name}-viewport ${value};`
195
194
  })
196
195
  .join('\n')
@@ -200,7 +199,7 @@ StyleDictionary.registerFormat({
200
199
  // format docs
201
200
  StyleDictionary.registerFormat({
202
201
  name: 'json/docs',
203
- formatter: function({dictionary}) {
202
+ formatter({dictionary}) {
204
203
  const groupedTokens = groupBy(dictionary.allProperties, 'filePath')
205
204
 
206
205
  return JSON.stringify(groupedTokens, null, 2)
@@ -212,7 +211,7 @@ StyleDictionary.registerFormat({
212
211
  */
213
212
  StyleDictionary.registerFormat({
214
213
  name: 'javascript/module-v2',
215
- formatter: function({dictionary, file}) {
214
+ formatter({dictionary, file}) {
216
215
  const recursiveleyFlattenDictionary = obj => {
217
216
  const tree = {}
218
217
  if (typeof obj !== 'object' || Array.isArray(obj)) {
@@ -231,11 +230,9 @@ StyleDictionary.registerFormat({
231
230
  return tree
232
231
  }
233
232
 
234
- return (
235
- fileHeader({file}) +
236
- 'module.exports = ' +
237
- JSON.stringify(recursiveleyFlattenDictionary(dictionary.tokens), null, 2)
238
- )
233
+ return `${fileHeader({file})}
234
+
235
+ module.exports = ${JSON.stringify(recursiveleyFlattenDictionary(dictionary.tokens), null, 2)}`
239
236
  }
240
237
  })
241
238
 
@@ -245,7 +242,7 @@ StyleDictionary.registerFormat({
245
242
  */
246
243
  StyleDictionary.registerFormat({
247
244
  name: 'typescript/module-declarations-v2',
248
- formatter: function({dictionary, options, file}) {
245
+ formatter({dictionary, options, file}) {
249
246
  const {moduleName = `tokens`} = options
250
247
 
251
248
  const getType = value => {
@@ -283,10 +280,10 @@ StyleDictionary.registerFormat({
283
280
  return tree
284
281
  }
285
282
 
286
- const output =
287
- fileHeader({file}) +
288
- `declare const ${moduleName}: ${JSON.stringify(recursiveTypeGeneration(dictionary.tokens), null, 2)}
289
- export default ${moduleName};`
283
+ const output = `${fileHeader({file})}
284
+
285
+ declare const ${moduleName}: ${JSON.stringify(recursiveTypeGeneration(dictionary.tokens), null, 2)}
286
+ export default ${moduleName};`
290
287
 
291
288
  return output
292
289
  .replace(/"any"/g, 'any')
@@ -341,7 +338,9 @@ function buildPrimitives(
341
338
  {source, outputPath = 'tokens-v2-private', include, platforms, namespace = 'primer'},
342
339
  _StyleDictionary = StyleDictionary
343
340
  ) {
341
+ // eslint-disable-next-line no-console
344
342
  console.log('Build started...')
343
+ // eslint-disable-next-line no-console
345
344
  console.log('\n==============================================')
346
345
 
347
346
  const customParseConfig = {
@@ -360,6 +359,7 @@ function buildPrimitives(
360
359
 
361
360
  return JSON.parse(parsed)
362
361
  } catch (error) {
362
+ // eslint-disable-next-line no-console
363
363
  console.log(error)
364
364
  }
365
365
  }
@@ -488,7 +488,7 @@ function _init() {
488
488
  const outputPath = 'tokens-v2-private'
489
489
  //build all tokens
490
490
  buildPrimitives({
491
- source: [`tokens/**/*.json`, `!tokens/**/size-*.json`],
491
+ source: [`tokens/**/*.json`, `!tokens/**/size-*.json`, `!tokens/**/color/*.json`],
492
492
  outputPath
493
493
  })
494
494
 
@@ -547,7 +547,7 @@ function _init() {
547
547
 
548
548
  //build docs data
549
549
  buildPrimitives({
550
- source: [`tokens/**/*.json`],
550
+ source: [`tokens/**/*.json`, `!tokens/**/color/*.json`],
551
551
  outputPath,
552
552
  platforms: {
553
553
  docs: {