@primer/primitives 7.10.0 → 7.11.0-rc.00655fc

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 (143) hide show
  1. package/README.md +2 -2
  2. package/build.js +70 -70
  3. package/dist/color-contrast-check.json +1 -1
  4. package/dist/deprecated/colors.json +7 -1
  5. package/dist/js/colors/dark.d.ts +0 -13
  6. package/dist/js/colors/dark.js +1 -14
  7. package/dist/js/colors/dark_colorblind.d.ts +0 -13
  8. package/dist/js/colors/dark_colorblind.js +1 -14
  9. package/dist/js/colors/dark_dimmed.d.ts +0 -13
  10. package/dist/js/colors/dark_dimmed.js +1 -14
  11. package/dist/js/colors/dark_high_contrast.d.ts +0 -13
  12. package/dist/js/colors/dark_high_contrast.js +1 -14
  13. package/dist/js/colors/dark_tritanopia.d.ts +0 -13
  14. package/dist/js/colors/dark_tritanopia.js +1 -14
  15. package/dist/js/colors/index.d.ts +0 -117
  16. package/dist/js/colors/light.d.ts +0 -13
  17. package/dist/js/colors/light.js +1 -14
  18. package/dist/js/colors/light_colorblind.d.ts +0 -13
  19. package/dist/js/colors/light_colorblind.js +1 -14
  20. package/dist/js/colors/light_high_contrast.d.ts +0 -13
  21. package/dist/js/colors/light_high_contrast.js +1 -14
  22. package/dist/js/colors/light_tritanopia.d.ts +0 -13
  23. package/dist/js/colors/light_tritanopia.js +1 -14
  24. package/dist/js/index.d.ts +0 -117
  25. package/dist/json/colors/dark.json +1 -14
  26. package/dist/json/colors/dark_colorblind.json +1 -14
  27. package/dist/json/colors/dark_dimmed.json +1 -14
  28. package/dist/json/colors/dark_high_contrast.json +1 -14
  29. package/dist/json/colors/dark_tritanopia.json +1 -14
  30. package/dist/json/colors/light.json +1 -14
  31. package/dist/json/colors/light_colorblind.json +1 -14
  32. package/dist/json/colors/light_high_contrast.json +1 -14
  33. package/dist/json/colors/light_tritanopia.json +1 -14
  34. package/dist/removed/colors.json +13 -2
  35. package/dist/scss/colors/_dark.scss +0 -13
  36. package/dist/scss/colors/_dark_colorblind.scss +0 -13
  37. package/dist/scss/colors/_dark_dimmed.scss +0 -13
  38. package/dist/scss/colors/_dark_high_contrast.scss +0 -13
  39. package/dist/scss/colors/_dark_tritanopia.scss +0 -13
  40. package/dist/scss/colors/_light.scss +0 -13
  41. package/dist/scss/colors/_light_colorblind.scss +0 -13
  42. package/dist/scss/colors/_light_high_contrast.scss +0 -13
  43. package/dist/scss/colors/_light_tritanopia.scss +0 -13
  44. package/dist/ts/colors/dark.ts +1 -14
  45. package/dist/ts/colors/dark_colorblind.ts +1 -14
  46. package/dist/ts/colors/dark_dimmed.ts +1 -14
  47. package/dist/ts/colors/dark_high_contrast.ts +1 -14
  48. package/dist/ts/colors/dark_tritanopia.ts +1 -14
  49. package/dist/ts/colors/light.ts +1 -14
  50. package/dist/ts/colors/light_colorblind.ts +1 -14
  51. package/dist/ts/colors/light_high_contrast.ts +1 -14
  52. package/dist/ts/colors/light_tritanopia.ts +1 -14
  53. package/package.json +31 -32
  54. package/tokens/functional/size/border.json +8 -0
  55. package/tokens/functional/typography/typography.json +2 -2
  56. package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
  57. package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
  58. package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
  59. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
  60. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
  61. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
  62. package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
  63. package/tokens-v2-private/css/tokens/functional/typography/typography.css +3 -3
  64. package/tokens-v2-private/docs/docValues.json +12 -12
  65. package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
  66. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
  67. package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
  68. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
  69. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
  70. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
  71. package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
  72. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
  73. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +13 -13
  74. package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
  75. package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
  76. package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
  77. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
  78. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
  79. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
  80. package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
  81. package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
  82. package/tokens-v2-private/js/tokens/functional/typography/typography.js +11 -11
  83. package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
  84. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
  85. package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
  86. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
  87. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
  88. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
  89. package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
  90. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
  91. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +3 -3
  92. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
  93. package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
  94. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
  95. package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
  96. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
  97. package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
  98. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  99. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
  100. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  101. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
  102. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
  103. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
  104. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
  105. package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
  106. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
  107. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
  108. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
  109. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +11 -11
  110. package/CHANGELOG.md +0 -677
  111. package/tokens/base/color/dark-colorblind.json +0 -44
  112. package/tokens/base/color/dark-dimmed.json +0 -124
  113. package/tokens/base/color/dark-high-contrast.json +0 -124
  114. package/tokens/base/color/dark-tritanopia.json +0 -92
  115. package/tokens/base/color/dark.json +0 -129
  116. package/tokens/base/color/light-colorblind.json +0 -134
  117. package/tokens/base/color/light-high-contrast.json +0 -390
  118. package/tokens/base/color/light-tritanopia.json +0 -92
  119. package/tokens/base/color/light.json +0 -399
  120. package/tokens/functional/color/ansi-dark.json +0 -74
  121. package/tokens/functional/color/ansi-light.json +0 -74
  122. package/tokens/functional/color/checks-dark.json +0 -289
  123. package/tokens/functional/color/checks-light.json +0 -296
  124. package/tokens/functional/color/components-dark.json +0 -556
  125. package/tokens/functional/color/components-light.json +0 -469
  126. package/tokens/functional/color/diff-dark.json +0 -78
  127. package/tokens/functional/color/diff-light.json +0 -76
  128. package/tokens/functional/color/exceptions-dark-colorblind.json +0 -45
  129. package/tokens/functional/color/exceptions-dark-dimmed.json +0 -12
  130. package/tokens/functional/color/exceptions-dark-high-contrast.json +0 -271
  131. package/tokens/functional/color/exceptions-dark-tritanopia.json +0 -44
  132. package/tokens/functional/color/exceptions-light-colorblind.json +0 -87
  133. package/tokens/functional/color/exceptions-light-high-contrast.json +0 -327
  134. package/tokens/functional/color/exceptions-light-tritanopia.json +0 -87
  135. package/tokens/functional/color/marketing-dark.json +0 -24
  136. package/tokens/functional/color/marketing-light.json +0 -24
  137. package/tokens/functional/color/misc-dark.json +0 -38
  138. package/tokens/functional/color/misc-light.json +0 -37
  139. package/tokens/functional/color/primitives-dark.json +0 -322
  140. package/tokens/functional/color/primitives-light.json +0 -313
  141. package/tokens/functional/color/scales.json +0 -582
  142. package/tokens/functional/color/syntax-dark.json +0 -208
  143. package/tokens/functional/color/syntax-light.json +0 -208
package/README.md CHANGED
@@ -63,7 +63,7 @@ When you're ready to remove a variable, first remove it's definitions:
63
63
 
64
64
  ```diff
65
65
  // data/colors/vars/global_light.ts
66
- import {get} from '../../../src/utils'
66
+ import {get} from '../../../src/utils-v1'
67
67
 
68
68
  export default {
69
69
  text: {
@@ -75,7 +75,7 @@ export default {
75
75
 
76
76
  ```diff
77
77
  // data/colors/vars/global_dark.ts
78
- import {get} from '../../../src/utils'
78
+ import {get} from '../../../src/utils-v1'
79
79
 
80
80
  export default {
81
81
  text: {
package/build.js CHANGED
@@ -24,7 +24,7 @@ const pathToPascalCase = token => token.path.map(tokenPathItems => capitalize(to
24
24
  StyleDictionary.registerTransform({
25
25
  name: 'name/scss',
26
26
  type: 'name',
27
- transformer: pathToKebabCase
27
+ transformer: pathToKebabCase,
28
28
  })
29
29
 
30
30
  /**
@@ -34,7 +34,7 @@ StyleDictionary.registerTransform({
34
34
  StyleDictionary.registerTransform({
35
35
  name: 'name/css',
36
36
  type: 'name',
37
- transformer: pathToKebabCase
37
+ transformer: pathToKebabCase,
38
38
  })
39
39
 
40
40
  /**
@@ -44,7 +44,7 @@ StyleDictionary.registerTransform({
44
44
  StyleDictionary.registerTransform({
45
45
  name: 'name/js',
46
46
  type: 'name',
47
- transformer: pathToDotNotation
47
+ transformer: pathToDotNotation,
48
48
  })
49
49
 
50
50
  /**
@@ -54,7 +54,7 @@ StyleDictionary.registerTransform({
54
54
  StyleDictionary.registerTransform({
55
55
  name: 'name/js/es6',
56
56
  type: 'name',
57
- transformer: pathToPascalCase
57
+ transformer: pathToPascalCase,
58
58
  })
59
59
 
60
60
  // find values with px unit
@@ -86,7 +86,7 @@ StyleDictionary.registerTransform({
86
86
  return `${floatValue / baseFontSize}rem`
87
87
  }
88
88
  return token.value
89
- }
89
+ },
90
90
  })
91
91
 
92
92
  //-----
@@ -102,10 +102,10 @@ StyleDictionary.registerTransform({
102
102
  // or you can "chain" the transforms and use token.name and token.value
103
103
  // like scss and less transforms do.
104
104
  name: token.path.slice(1).join('.'),
105
- value: token.value
106
- }
105
+ value: token.value,
106
+ },
107
107
  }
108
- }
108
+ },
109
109
  })
110
110
 
111
111
  // css output
@@ -117,10 +117,10 @@ StyleDictionary.registerTransform({
117
117
  return {
118
118
  css: {
119
119
  name: `--${tokenName}`,
120
- value: token.value
121
- }
120
+ value: token.value,
121
+ },
122
122
  }
123
- }
123
+ },
124
124
  })
125
125
 
126
126
  // transform: composite typography to shorthands
@@ -138,19 +138,19 @@ StyleDictionary.registerTransform({
138
138
  }
139
139
 
140
140
  return `${value.fontWeight} ${value.fontSize} ${value.fontFamily}`
141
- }
141
+ },
142
142
  })
143
143
 
144
144
  // REGISTER THE CUSTOM TRANFORM GROUPS
145
145
 
146
146
  StyleDictionary.registerTransformGroup({
147
147
  name: 'css',
148
- transforms: ['name/css', 'pxToRem', 'typography/shorthand']
148
+ transforms: ['name/css', 'pxToRem', 'typography/shorthand'],
149
149
  })
150
150
 
151
151
  StyleDictionary.registerTransformGroup({
152
152
  name: 'scss',
153
- transforms: ['name/scss', 'pxToRem', 'typography/shorthand']
153
+ transforms: ['name/scss', 'pxToRem', 'typography/shorthand'],
154
154
  })
155
155
 
156
156
  // REGISTER A CUSTOM FORMAT
@@ -164,9 +164,9 @@ StyleDictionary.registerFormat({
164
164
  @media (pointer: coarse) { :root {\n${formattedVariables({
165
165
  format: 'css',
166
166
  dictionary,
167
- outputReferences
167
+ outputReferences,
168
168
  })}\n}}\n`
169
- }
169
+ },
170
170
  })
171
171
 
172
172
  // wrap desktop tokens in media query
@@ -178,9 +178,9 @@ StyleDictionary.registerFormat({
178
178
  @media (pointer: fine) { :root {\n${formattedVariables({
179
179
  format: 'css',
180
180
  dictionary,
181
- outputReferences
181
+ outputReferences,
182
182
  })}\n}}\n`
183
- }
183
+ },
184
184
  })
185
185
 
186
186
  StyleDictionary.registerFormat({
@@ -193,7 +193,7 @@ StyleDictionary.registerFormat({
193
193
  return `@custom-media --${name}-viewport ${value};`
194
194
  })
195
195
  .join('\n')
196
- }
196
+ },
197
197
  })
198
198
 
199
199
  // format docs
@@ -203,7 +203,7 @@ StyleDictionary.registerFormat({
203
203
  const groupedTokens = groupBy(dictionary.allProperties, 'filePath')
204
204
 
205
205
  return JSON.stringify(groupedTokens, null, 2)
206
- }
206
+ },
207
207
  })
208
208
 
209
209
  /**
@@ -233,7 +233,7 @@ StyleDictionary.registerFormat({
233
233
  return `${fileHeader({file})}
234
234
 
235
235
  module.exports = ${JSON.stringify(recursiveleyFlattenDictionary(dictionary.tokens), null, 2)}`
236
- }
236
+ },
237
237
  })
238
238
 
239
239
  /**
@@ -289,7 +289,7 @@ export default ${moduleName};`
289
289
  .replace(/"any"/g, 'any')
290
290
  .replace(/"string"/g, 'string')
291
291
  .replace(/"number"/g, 'number')
292
- }
292
+ },
293
293
  })
294
294
 
295
295
  /**
@@ -336,7 +336,7 @@ function groupBy(collection, iteratee = x => x) {
336
336
  */
337
337
  function buildPrimitives(
338
338
  {source, outputPath = 'tokens-v2-private', include, platforms, namespace = 'primer'},
339
- _StyleDictionary = StyleDictionary
339
+ _StyleDictionary = StyleDictionary,
340
340
  ) {
341
341
  // eslint-disable-next-line no-console
342
342
  console.log('Build started...')
@@ -362,9 +362,9 @@ function buildPrimitives(
362
362
  // eslint-disable-next-line no-console
363
363
  console.log(error)
364
364
  }
365
- }
366
- }
367
- ]
365
+ },
366
+ },
367
+ ],
368
368
  }
369
369
 
370
370
  const getConfig = files => {
@@ -379,10 +379,10 @@ function buildPrimitives(
379
379
  destination: filePath.replace(`.json`, `.css`),
380
380
  filter: token => token.filePath === filePath,
381
381
  options: {
382
- outputReferences: true
383
- }
382
+ outputReferences: true,
383
+ },
384
384
  }
385
- })
385
+ }),
386
386
  },
387
387
  cssViewport: {
388
388
  buildPath: `${outputPath}/css/tokens/functional/size/`,
@@ -391,9 +391,9 @@ function buildPrimitives(
391
391
  {
392
392
  filter: token => token.filePath.includes('viewport'),
393
393
  format: 'custom/format/custom-media',
394
- destination: 'viewport.css'
395
- }
396
- ]
394
+ destination: 'viewport.css',
395
+ },
396
+ ],
397
397
  },
398
398
  scss: {
399
399
  buildPath: `${outputPath}/scss/`,
@@ -405,10 +405,10 @@ function buildPrimitives(
405
405
  destination: filePath.replace(`.json`, `.scss`),
406
406
  filter: token => token.filePath === filePath,
407
407
  options: {
408
- outputReferences: true
409
- }
408
+ outputReferences: true,
409
+ },
410
410
  }
411
- })
411
+ }),
412
412
  },
413
413
  js: {
414
414
  buildPath: `${outputPath}/js/`,
@@ -418,9 +418,9 @@ function buildPrimitives(
418
418
  return {
419
419
  format: `javascript/es6`,
420
420
  destination: filePath.replace(`.json`, `.js`),
421
- filter: token => token.filePath === filePath
421
+ filter: token => token.filePath === filePath,
422
422
  }
423
- })
423
+ }),
424
424
  },
425
425
  jsModule: {
426
426
  buildPath: `${outputPath}/js/module/`,
@@ -430,9 +430,9 @@ function buildPrimitives(
430
430
  return {
431
431
  format: `javascript/module`,
432
432
  destination: filePath.replace(`.json`, `.js`),
433
- filter: token => token.filePath === filePath
433
+ filter: token => token.filePath === filePath,
434
434
  }
435
- })
435
+ }),
436
436
  },
437
437
  tsTypes: {
438
438
  buildPath: `${outputPath}/ts/`,
@@ -442,9 +442,9 @@ function buildPrimitives(
442
442
  return {
443
443
  format: `typescript/module-declarations-v2`,
444
444
  destination: filePath.replace(`.json`, `.d.ts`),
445
- filter: token => token.filePath === filePath
445
+ filter: token => token.filePath === filePath,
446
446
  }
447
- })
447
+ }),
448
448
  },
449
449
  ts: {
450
450
  buildPath: `${outputPath}/ts/`,
@@ -454,17 +454,17 @@ function buildPrimitives(
454
454
  return {
455
455
  format: `javascript/module-v2`,
456
456
  destination: filePath.replace(`.json`, `.js`),
457
- filter: token => token.filePath === filePath
457
+ filter: token => token.filePath === filePath,
458
458
  }
459
- })
460
- }
459
+ }),
460
+ },
461
461
  }
462
462
 
463
463
  const config = {
464
464
  ...{include: include ? [include] : undefined},
465
465
  source: files,
466
466
  ...customParseConfig,
467
- platforms: platforms ? platforms : defaultPlatformConfig
467
+ platforms: platforms ? platforms : defaultPlatformConfig,
468
468
  }
469
469
  return config
470
470
  }
@@ -472,7 +472,7 @@ function buildPrimitives(
472
472
  //build all tokens
473
473
  _StyleDictionary
474
474
  .extend({
475
- ...getConfig(glob.sync([...source]))
475
+ ...getConfig(glob.sync([...source])),
476
476
  })
477
477
  .buildAllPlatforms()
478
478
  }
@@ -488,20 +488,20 @@ function _init() {
488
488
  const outputPath = 'tokens-v2-private'
489
489
  //build all tokens
490
490
  buildPrimitives({
491
- source: [`tokens/**/*.json`, `!tokens/**/size-*.json`, `!tokens/**/color/*.json`],
492
- outputPath
491
+ source: [`tokens/**/*.json`, `!tokens/**/size-*.json`, `!tokens/**/color/*.json`, `!tokens/**/shadow/*.json`],
492
+ outputPath,
493
493
  })
494
494
 
495
495
  //build size fine
496
496
  buildPrimitives({
497
497
  source: [`tokens/functional/size/size-fine.json`, `tokens/base/size/size.json`],
498
- outputPath
498
+ outputPath,
499
499
  })
500
500
 
501
501
  //build size coarse
502
502
  buildPrimitives({
503
503
  source: [`tokens/functional/size/size-coarse.json`, `tokens/base/size/size.json`],
504
- outputPath
504
+ outputPath,
505
505
  })
506
506
 
507
507
  buildPrimitives({
@@ -517,12 +517,12 @@ function _init() {
517
517
  format: `css/touch-target-desktop`,
518
518
  filter: token => token.filePath.includes('fine'),
519
519
  options: {
520
- outputReferences: true
521
- }
522
- }
523
- ]
524
- }
525
- }
520
+ outputReferences: true,
521
+ },
522
+ },
523
+ ],
524
+ },
525
+ },
526
526
  })
527
527
 
528
528
  buildPrimitives({
@@ -537,17 +537,17 @@ function _init() {
537
537
  format: `css/touch-target-mobile`,
538
538
  filter: token => token.filePath.includes('coarse'),
539
539
  options: {
540
- outputReferences: true
541
- }
542
- }
543
- ]
544
- }
545
- }
540
+ outputReferences: true,
541
+ },
542
+ },
543
+ ],
544
+ },
545
+ },
546
546
  })
547
547
 
548
548
  //build docs data
549
549
  buildPrimitives({
550
- source: [`tokens/**/*.json`, `!tokens/**/color/*.json`],
550
+ source: [`tokens/**/*.json`, `!tokens/**/color/*.json`, `!tokens/**/shadow/*.json`],
551
551
  outputPath,
552
552
  platforms: {
553
553
  docs: {
@@ -558,12 +558,12 @@ function _init() {
558
558
  format: 'json/docs',
559
559
  destination: 'docValues.json',
560
560
  options: {
561
- outputReferences: false
562
- }
563
- }
564
- ]
565
- }
566
- }
561
+ outputReferences: false,
562
+ },
563
+ },
564
+ ],
565
+ },
566
+ },
567
567
  })
568
568
  }
569
569
 
@@ -574,5 +574,5 @@ module.exports = {
574
574
  pathToKebabCase,
575
575
  pathToDotNotation,
576
576
  capitalize,
577
- pathToPascalCase
577
+ pathToPascalCase,
578
578
  }