@primer/primitives 7.17.0-rc.d7413369 → 8.0.0-rc.2e61fcd8

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 (80) hide show
  1. package/README.md +29 -95
  2. package/dist/css/functional/typography/typography.css +1 -1
  3. package/dist/docs/base/typography/typography.json +52 -4
  4. package/dist/docs/functional/themes/dark-colorblind.json +78 -78
  5. package/dist/docs/functional/themes/dark-dimmed.json +73 -73
  6. package/dist/docs/functional/themes/dark-high-contrast.json +75 -75
  7. package/dist/docs/functional/themes/dark-tritanopia.json +78 -78
  8. package/dist/docs/functional/themes/dark.json +73 -73
  9. package/dist/docs/functional/themes/light-colorblind.json +76 -76
  10. package/dist/docs/functional/themes/light-high-contrast.json +70 -70
  11. package/dist/docs/functional/themes/light-tritanopia.json +76 -76
  12. package/dist/docs/functional/themes/light.json +71 -71
  13. package/dist/docs/functional/typography/typography.json +455 -33
  14. package/dist/fallbacks/functional/typography/typography.json +1 -1
  15. package/dist/figma/figma.json +8 -0
  16. package/dist/figma/scales/dark-dimmed.json +20 -20
  17. package/dist/figma/scales/dark-high-constrast.json +20 -20
  18. package/dist/figma/scales/dark.json +20 -20
  19. package/dist/figma/scales/light-high-constrast.json +20 -20
  20. package/dist/figma/scales/light.json +20 -20
  21. package/dist/figma/themes/dark-colorblind.json +70 -70
  22. package/dist/figma/themes/dark-dimmed.json +65 -65
  23. package/dist/figma/themes/dark-high-contrast.json +69 -69
  24. package/dist/figma/themes/dark-tritanopia.json +70 -70
  25. package/dist/figma/themes/dark.json +65 -65
  26. package/dist/figma/themes/light-colorblind.json +59 -59
  27. package/dist/figma/themes/light-high-contrast.json +55 -55
  28. package/dist/figma/themes/light-tritanopia.json +59 -59
  29. package/dist/figma/themes/light.json +54 -54
  30. package/dist/figma/typography/typography.json +338 -0
  31. package/dist/internalCss/dark-colorblind.css +20 -20
  32. package/dist/internalCss/dark-dimmed.css +20 -20
  33. package/dist/internalCss/dark-high-contrast.css +20 -20
  34. package/dist/internalCss/dark-tritanopia.css +20 -20
  35. package/dist/internalCss/dark.css +20 -20
  36. package/dist/internalCss/light-colorblind.css +20 -20
  37. package/dist/internalCss/light-high-contrast.css +20 -20
  38. package/dist/internalCss/light-tritanopia.css +20 -20
  39. package/dist/internalCss/light.css +20 -20
  40. package/dist/styleLint/base/typography/typography.json +52 -4
  41. package/dist/styleLint/functional/themes/dark-colorblind.json +78 -78
  42. package/dist/styleLint/functional/themes/dark-dimmed.json +73 -73
  43. package/dist/styleLint/functional/themes/dark-high-contrast.json +75 -75
  44. package/dist/styleLint/functional/themes/dark-tritanopia.json +78 -78
  45. package/dist/styleLint/functional/themes/dark.json +73 -73
  46. package/dist/styleLint/functional/themes/light-colorblind.json +76 -76
  47. package/dist/styleLint/functional/themes/light-high-contrast.json +70 -70
  48. package/dist/styleLint/functional/themes/light-tritanopia.json +76 -76
  49. package/dist/styleLint/functional/themes/light.json +71 -71
  50. package/dist/styleLint/functional/typography/typography.json +455 -33
  51. package/package.json +3 -11
  52. package/src/PrimerStyleDictionary.ts +6 -0
  53. package/src/platforms/figma.ts +1 -0
  54. package/src/schemas/numberToken.ts +17 -0
  55. package/src/tokens/base/color/dark/dark.dimmed.json5 +1 -1
  56. package/src/tokens/base/color/dark/dark.high-contrast.json5 +1 -1
  57. package/src/tokens/base/color/dark/dark.json5 +1 -1
  58. package/src/tokens/base/color/light/light.high-contrast.json5 +1 -1
  59. package/src/tokens/base/color/light/light.json5 +1 -1
  60. package/src/tokens/base/typography/typography.json +28 -4
  61. package/src/tokens/functional/color/dark/app-dark.json5 +5 -5
  62. package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +17 -17
  63. package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +5 -5
  64. package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +5 -5
  65. package/src/tokens/functional/color/dark/patterns-dark.json5 +42 -42
  66. package/src/tokens/functional/color/dark/primitives-dark.json5 +16 -16
  67. package/src/tokens/functional/color/dark/syntax-dark.json5 +13 -13
  68. package/src/tokens/functional/color/light/app-light.json5 +5 -5
  69. package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +25 -25
  70. package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +5 -5
  71. package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +5 -5
  72. package/src/tokens/functional/color/light/patterns-light.json5 +30 -30
  73. package/src/tokens/functional/color/light/primitives-light.json5 +15 -15
  74. package/src/tokens/functional/color/light/syntax-light.json5 +14 -14
  75. package/src/tokens/functional/shadow/dark.json5 +1 -1
  76. package/src/tokens/functional/shadow/light.json5 +11 -11
  77. package/src/tokens/functional/typography/typography.json +242 -31
  78. package/src/transformers/floatToPixel.ts +33 -0
  79. package/src/transformers/index.ts +1 -0
  80. package/src/utils-v1.ts +0 -36
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Primer Primitives
2
2
 
3
- [![npm package](https://img.shields.io/npm/v/@primer/primitives.svg?style=flat)](https://www.npmjs.com/package/@primer/primitives)
3
+ [![npm package](https://img.shields.io/npm/v/@primer/primitives.svg?style=flat)](https://www.npmjs.com/package/@primer/primitives) [![Storybook](https://github.com/primer/primitives/actions/workflows/deploy.yml/badge.svg)](https://primer.style/primitives/storybook/) [![A11y contrast check](https://github.com/primer/primitives/actions/workflows/a11y-contrast.yml/badge.svg)](https://github.com/primer/primitives/actions/workflows/a11y-contrast.yml)
4
4
 
5
5
  This repo contains values for color, spacing, and typography primitives for use with [Primer][primer], GitHub's design system.
6
6
 
@@ -16,109 +16,43 @@ npm install --save @primer/primitives
16
16
 
17
17
  ## Usage
18
18
 
19
- [Storybook](https://primer.style/primitives/storybook) | [Docs](https://primer.style/primitives/)
19
+ [Storybook](https://primer.style/primitives/storybook) | [Docs](https://primer.style/foundations/primitives/getting-started)
20
20
 
21
- Primitive data is served in several formats from the `dist/` folder:
21
+ See [Primitives documentation](https://primer.style/foundations/primitives/getting-started) for more information on theming and using CSS variables.
22
22
 
23
- - `dist/scss` contains [SCSS][scss] files that define CSS variables to be imported into other SCSS files
24
- - `dist/json` contains JSON files for each set of primitives
25
- - `dist/js` contains CommonJS-style JavaScript modules for each set of primitives, as well as an index file that loads all of the primitives for all primitive types; you can access this via `require('@primer/primitives')`. The JavaScript modules also include TypeScript typings files for use in TypeScript projects.
23
+ Data is served from the `dist/` folder:
26
24
 
27
- ## Deprecating variables
25
+ - `dist/css` contains CSS files with values available as CSS variables
28
26
 
29
- To deprecate a variable, define a mapping from the deprecated variable to its replacement(s) in a file called `deprecated.json` in the appropriate subdirectory of `data`:
27
+ All available imports:
30
28
 
31
- ```diff
32
- data/
33
- colors/
34
- + deprecated.json
35
- spacing/
36
- ...
37
29
  ```
38
-
39
- ```
40
- // data/colors/deprecated.json
41
-
42
- {
43
- "text.primary": "fg.default", // this means: `text.primary` is deprecated. Use `fg.default` instead
44
- "auto.blue.4": ["accent.fg, accent.emphasis"], // this means: `auto.blue.4` is deprecated. Use `accent.fg` or `accent.emphasis` instead
45
- "text.white": null // this means: `text.white` is deprecated. We don't have a replacement for it
46
- }
47
-
48
- ```
49
-
50
- During the build process, the `deprecated.json` files will be added to a `dist/deprecated` directory organized by variable category:
51
-
52
- ```diff
53
- dist/
54
- js/
55
- ts/
56
- json/
57
- scss/
58
- + deprecated/
59
- + colors.json
60
- ```
61
-
62
- ## Removing variables
63
-
64
- When you're ready to remove a variable, first remove it's definitions:
65
-
66
- ```diff
67
- // data/colors/vars/global_light.ts
68
- import {get} from '../../../src/utils-v1'
69
-
70
- export default {
71
- text: {
72
- - primary: get('scale.gray.9'),
73
- secondary: get('scale.gray.6')
74
- }
75
- }
76
- ```
77
-
78
- ```diff
79
- // data/colors/vars/global_dark.ts
80
- import {get} from '../../../src/utils-v1'
81
-
82
- export default {
83
- text: {
84
- - primary: get('scale.gray.1'),
85
- secondary: get('scale.gray.3')
86
- }
87
- }
88
- ```
89
-
90
- Then remove it from `deprecated.json` and add it to `removed.json`:
91
-
92
- ```diff
93
- // data/colors/deprecated.json
94
- {
95
- - "text.primary": "fg.default"
96
- }
97
- ```
98
-
99
- ```diff
100
- // data/colors/removed.json
101
- {
102
- + "text.primary": "fg.default"
103
- }
104
- ```
105
-
106
- During the build process, the `removed.json` files will be added to a `dist/removed` directory organized by variable category:
107
-
108
- ```diff
109
- dist/
110
- js/
111
- ts/
112
- json/
113
- scss/
114
- deprecated/
115
- + removed/
116
- + colors.json
30
+ /* size/typography */
31
+ @import '@primer/primitives/dist/css/base/size/size.css';
32
+ @import '@primer/primitives/dist/css/base/typography/typography.css';
33
+ @import '@primer/primitives/dist/css/functional/size/border.css';
34
+ @import '@primer/primitives/dist/css/functional/size/breakpoints.css';
35
+ @import '@primer/primitives/dist/css/functional/size/size-coarse.css';
36
+ @import '@primer/primitives/dist/css/functional/size/size-fine.css';
37
+ @import '@primer/primitives/dist/css/functional/size/size.css';
38
+ @import '@primer/primitives/dist/css/functional/size/viewport.css';
39
+ @import '@primer/primitives/dist/css/functional/typography/typography.css';
40
+
41
+ /* color */
42
+ @import '@primer/primitives/dist/css/functional/themes/light.css';
43
+ @import '@primer/primitives/dist/css/functional/themes/light-tritanopia.css';
44
+ @import '@primer/primitives/dist/css/functional/themes/light-high-contrast.css';
45
+ @import '@primer/primitives/dist/css/functional/themes/light-colorblind.css';
46
+ @import '@primer/primitives/dist/css/functional/themes/dark.css';
47
+ @import '@primer/primitives/dist/css/functional/themes/dark-colorblind.css';
48
+ @import '@primer/primitives/dist/css/functional/themes/dark-dimmed.css';
49
+ @import '@primer/primitives/dist/css/functional/themes/dark-high-contrast.css';
50
+ @import '@primer/primitives/dist/css/functional/themes/dark-tritanopia.css';
117
51
  ```
118
52
 
119
- ## V8 Tokens
53
+ ## Design token data
120
54
 
121
- With `/primitives` version 8, design tokens have been moved to json files in the [src/tokens](./src/tokens/) directory. Those tokens are compiled with [style dictionary](https://amzn.github.io/style-dictionary/#/) in [scripts/buildTokens.ts](./scripts/buildTokens.ts).
55
+ Design token data is stored in the [src/tokens](./src/tokens/) directory. These tokens are compiled with [style dictionary](https://amzn.github.io/style-dictionary/#/) in [scripts/buildTokens.ts](./scripts/buildTokens.ts).
122
56
 
123
57
  To make working with tokens easier, we added some additional functionality on top of what style dictionary comes with:
124
58
 
@@ -20,7 +20,7 @@
20
20
  --text-title-size-large: 2rem;
21
21
  --text-display-lineHeight: 1.4;
22
22
  --text-display-size: 2.5rem;
23
- --text-display-lineBoxHeight: 3.5rem;
23
+ --text-display-lineBoxHeight: 1.4;
24
24
  --fontStack-monospace: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
25
25
  --fontStack-sansSerif: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
26
26
  --fontStack-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
@@ -2,11 +2,23 @@
2
2
  "base-text-weight-light": {
3
3
  "$type": "fontWeight",
4
4
  "value": 300,
5
+ "$extensions": {
6
+ "org.primer.figma": {
7
+ "collection": "base/typography",
8
+ "scopes": ["all"]
9
+ }
10
+ },
5
11
  "filePath": "src/tokens/base/typography/typography.json",
6
12
  "isSource": true,
7
13
  "original": {
8
14
  "$type": "fontWeight",
9
- "value": 300
15
+ "value": 300,
16
+ "$extensions": {
17
+ "org.primer.figma": {
18
+ "collection": "base/typography",
19
+ "scopes": ["all"]
20
+ }
21
+ }
10
22
  },
11
23
  "name": "base-text-weight-light",
12
24
  "attributes": {},
@@ -15,11 +27,23 @@
15
27
  "base-text-weight-normal": {
16
28
  "value": 400,
17
29
  "$type": "fontWeight",
30
+ "$extensions": {
31
+ "org.primer.figma": {
32
+ "collection": "base/typography",
33
+ "scopes": ["all"]
34
+ }
35
+ },
18
36
  "filePath": "src/tokens/base/typography/typography.json",
19
37
  "isSource": true,
20
38
  "original": {
21
39
  "value": 400,
22
- "$type": "fontWeight"
40
+ "$type": "fontWeight",
41
+ "$extensions": {
42
+ "org.primer.figma": {
43
+ "collection": "base/typography",
44
+ "scopes": ["all"]
45
+ }
46
+ }
23
47
  },
24
48
  "name": "base-text-weight-normal",
25
49
  "attributes": {},
@@ -28,11 +52,23 @@
28
52
  "base-text-weight-medium": {
29
53
  "value": 500,
30
54
  "$type": "fontWeight",
55
+ "$extensions": {
56
+ "org.primer.figma": {
57
+ "collection": "base/typography",
58
+ "scopes": ["all"]
59
+ }
60
+ },
31
61
  "filePath": "src/tokens/base/typography/typography.json",
32
62
  "isSource": true,
33
63
  "original": {
34
64
  "value": 500,
35
- "$type": "fontWeight"
65
+ "$type": "fontWeight",
66
+ "$extensions": {
67
+ "org.primer.figma": {
68
+ "collection": "base/typography",
69
+ "scopes": ["all"]
70
+ }
71
+ }
36
72
  },
37
73
  "name": "base-text-weight-medium",
38
74
  "attributes": {},
@@ -41,11 +77,23 @@
41
77
  "base-text-weight-semibold": {
42
78
  "value": 600,
43
79
  "$type": "fontWeight",
80
+ "$extensions": {
81
+ "org.primer.figma": {
82
+ "collection": "base/typography",
83
+ "scopes": ["all"]
84
+ }
85
+ },
44
86
  "filePath": "src/tokens/base/typography/typography.json",
45
87
  "isSource": true,
46
88
  "original": {
47
89
  "value": 600,
48
- "$type": "fontWeight"
90
+ "$type": "fontWeight",
91
+ "$extensions": {
92
+ "org.primer.figma": {
93
+ "collection": "base/typography",
94
+ "scopes": ["all"]
95
+ }
96
+ }
49
97
  },
50
98
  "name": "base-text-weight-semibold",
51
99
  "attributes": {},