@primer/primitives 4.8.1 → 5.0.0
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.
- package/CHANGELOG.md +53 -0
- package/README.md +98 -3
- package/dist/deprecated/colors.json +1 -0
- package/dist/js/colors/dark.d.ts +47 -493
- package/dist/js/colors/dark.js +50 -584
- package/dist/js/colors/dark_dimmed.d.ts +47 -493
- package/dist/js/colors/dark_dimmed.js +51 -585
- package/dist/js/colors/dark_high_contrast.d.ts +47 -493
- package/dist/js/colors/dark_high_contrast.js +50 -584
- package/dist/js/colors/dark_protanopia.d.ts +47 -493
- package/dist/js/colors/dark_protanopia.js +50 -584
- package/dist/js/colors/index.d.ts +1419 -4095
- package/dist/js/colors/light.d.ts +47 -493
- package/dist/js/colors/light.js +50 -584
- package/dist/js/colors/light_protanopia.d.ts +47 -493
- package/dist/js/colors/light_protanopia.js +50 -584
- package/dist/js/index.d.ts +1419 -4095
- package/dist/json/colors/dark.json +50 -584
- package/dist/json/colors/dark_dimmed.json +51 -585
- package/dist/json/colors/dark_high_contrast.json +50 -584
- package/dist/json/colors/dark_protanopia.json +50 -584
- package/dist/json/colors/light.json +50 -584
- package/dist/json/colors/light_protanopia.json +50 -584
- package/dist/{deprecations → removed}/colors.json +0 -5
- package/dist/scss/colors/_dark.scss +27 -415
- package/dist/scss/colors/_dark_dimmed.scss +28 -416
- package/dist/scss/colors/_dark_high_contrast.scss +27 -415
- package/dist/scss/colors/_dark_protanopia.scss +27 -415
- package/dist/scss/colors/_light.scss +27 -415
- package/dist/scss/colors/_light_protanopia.scss +27 -415
- package/dist/ts/colors/dark.ts +50 -584
- package/dist/ts/colors/dark_dimmed.ts +51 -585
- package/dist/ts/colors/dark_high_contrast.ts +50 -584
- package/dist/ts/colors/dark_protanopia.ts +50 -584
- package/dist/ts/colors/light.ts +50 -584
- package/dist/ts/colors/light_protanopia.ts +50 -584
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @primer/primitives
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#245](https://github.com/primer/primitives/pull/245) [`65ad2df`](https://github.com/primer/primitives/commit/65ad2df4d19f1eac86778879266bab6648ebe0e4) Thanks [@colebemis](https://github.com/colebemis)! - All deprecated color variables have been removed. See [removed variables](https://primer.style/primitives/colors#removed-variables) for the complete list of removed variables.
|
|
8
|
+
|
|
9
|
+
* [#245](https://github.com/primer/primitives/pull/245) [`65ad2df`](https://github.com/primer/primitives/commit/65ad2df4d19f1eac86778879266bab6648ebe0e4) Thanks [@colebemis](https://github.com/colebemis)! - The `deprecations` directory in the `dist` directory has been renamed to `deprecated`:
|
|
10
|
+
|
|
11
|
+
```diff
|
|
12
|
+
dist/
|
|
13
|
+
- deprecations/
|
|
14
|
+
+ deprecated/
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
You'll need to update your imports accordingly:
|
|
18
|
+
|
|
19
|
+
```diff
|
|
20
|
+
- import deprecatedColors from '@primer/primitives/dist/deprecations/colors.json'
|
|
21
|
+
+ import deprecatedColors from '@primer/primitives/dist/deprecated/colors.json'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- [#245](https://github.com/primer/primitives/pull/245) [`65ad2df`](https://github.com/primer/primitives/commit/65ad2df4d19f1eac86778879266bab6648ebe0e4) Thanks [@colebemis](https://github.com/colebemis)! - The [`dist`](https://unpkg.com/browse/@primer/primitives/dist/) directory now contains a `removed` directory with data about removed variables organized by category:
|
|
27
|
+
|
|
28
|
+
```diff
|
|
29
|
+
dist/
|
|
30
|
+
js/
|
|
31
|
+
ts/
|
|
32
|
+
json/
|
|
33
|
+
scss/
|
|
34
|
+
deprecated/
|
|
35
|
+
+ removed/
|
|
36
|
+
+ colors.json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Each JSON file in the `removed` directory contains a mapping of removed variables to replacement variables. Example:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
// dist/removed/colors.json
|
|
43
|
+
{
|
|
44
|
+
"text.primary": "fg.default", // this means: `text.primary` is deprecated. Use `fg.default` instead
|
|
45
|
+
"auto.blue.4": ["accent.fg, accent.emphasis"], // this means: `auto.blue.4` is deprecated. Use `accent.fg` or `accent.emphasis` instead
|
|
46
|
+
"text.white": null // this means: `text.white` is deprecated. We don't have a replacement for it
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This data will allow you to write linters to prevent usage of removed variables.
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- [#250](https://github.com/primer/primitives/pull/250) [`9948e13`](https://github.com/primer/primitives/commit/9948e139bcdd360bccb939aab27992ac06b3a3bf) Thanks [@Juliusschaeper](https://github.com/Juliusschaeper)! - Fix duplicate hex value (red 9)
|
|
55
|
+
|
|
3
56
|
## 4.8.1
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
This repo contains values for color, spacing, and typography primitives for use with [Primer][primer], GitHub's design system.
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
5
8
|
## Install
|
|
6
9
|
|
|
7
10
|
This repository is distributed on [npm][npm]. After [installing npm][install-npm], you can install `@primer/primitives` with this command.
|
|
@@ -14,9 +17,101 @@ $ npm install --save @primer/primitives
|
|
|
14
17
|
|
|
15
18
|
Primitive data is served in several formats from the `dist/` folder:
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
- `dist/scss` contains [SCSS][scss] files that define CSS variables to be imported into other SCSS files
|
|
21
|
+
- `dist/json` contains JSON files for each set of primitives
|
|
22
|
+
- `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
|
+
|
|
24
|
+
## Deprecating variables
|
|
25
|
+
|
|
26
|
+
To deprecate a variable, define a mapping from the deprecated variable to its replacement(s) in a file called `deprecated.json` in the approriate subdirectory of `data`:
|
|
27
|
+
|
|
28
|
+
```diff
|
|
29
|
+
data/
|
|
30
|
+
colors/
|
|
31
|
+
+ deprecated.json
|
|
32
|
+
spacing/
|
|
33
|
+
...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// data/colors/deprecated.json
|
|
38
|
+
{
|
|
39
|
+
{
|
|
40
|
+
"text.primary": "fg.default", // this means: `text.primary` is deprecated. Use `fg.default` instead
|
|
41
|
+
"auto.blue.4": ["accent.fg, accent.emphasis"], // this means: `auto.blue.4` is deprecated. Use `accent.fg` or `accent.emphasis` instead
|
|
42
|
+
"text.white": null // this means: `text.white` is deprecated. We don't have a replacement for it
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
During the build process, the `deprecated.json` files will be added to a `dist/deprected` directory organized by variable category:
|
|
48
|
+
|
|
49
|
+
```diff
|
|
50
|
+
dist/
|
|
51
|
+
js/
|
|
52
|
+
ts/
|
|
53
|
+
json/
|
|
54
|
+
scss/
|
|
55
|
+
+ deprecated/
|
|
56
|
+
+ colors.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Removing variables
|
|
60
|
+
|
|
61
|
+
When you're ready to remove a variable, first remove it's definitions:
|
|
62
|
+
|
|
63
|
+
```diff
|
|
64
|
+
// data/colors/vars/global_light.ts
|
|
65
|
+
import {get} from '../../../src/utils'
|
|
66
|
+
|
|
67
|
+
export default {
|
|
68
|
+
text: {
|
|
69
|
+
- primary: get('scale.gray.9'),
|
|
70
|
+
secondary: get('scale.gray.6')
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```diff
|
|
76
|
+
// data/colors/vars/global_dark.ts
|
|
77
|
+
import {get} from '../../../src/utils'
|
|
78
|
+
|
|
79
|
+
export default {
|
|
80
|
+
text: {
|
|
81
|
+
- primary: get('scale.gray.1'),
|
|
82
|
+
secondary: get('scale.gray.3')
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then remove it from `deprecated.json` and add it to `removed.json`:
|
|
88
|
+
|
|
89
|
+
```diff
|
|
90
|
+
// data/colors/deprecated.json
|
|
91
|
+
{
|
|
92
|
+
- "text.primary": "fg.default"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```diff
|
|
97
|
+
// data/colors/removed.json
|
|
98
|
+
{
|
|
99
|
+
+ "text.primary": "fg.default"
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
During the build process, the `removed.json` files will be added to a `dist/removed` directory organized by variable category:
|
|
104
|
+
|
|
105
|
+
```diff
|
|
106
|
+
dist/
|
|
107
|
+
js/
|
|
108
|
+
ts/
|
|
109
|
+
json/
|
|
110
|
+
scss/
|
|
111
|
+
deprecated/
|
|
112
|
+
+ removed/
|
|
113
|
+
+ colors.json
|
|
114
|
+
```
|
|
20
115
|
|
|
21
116
|
## License
|
|
22
117
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|