@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.
- package/CHANGELOG.md +3 -1
- package/README.md +3 -4
- package/build.js +33 -33
- package/dist/color-contrast-check.json +1 -0
- package/dist/js/colors/dark.d.ts +3 -0
- package/dist/js/colors/dark.js +3 -0
- package/dist/js/colors/dark_colorblind.d.ts +3 -0
- package/dist/js/colors/dark_colorblind.js +3 -0
- package/dist/js/colors/dark_dimmed.d.ts +3 -0
- package/dist/js/colors/dark_dimmed.js +3 -0
- package/dist/js/colors/dark_high_contrast.d.ts +3 -0
- package/dist/js/colors/dark_high_contrast.js +3 -0
- package/dist/js/colors/dark_tritanopia.d.ts +3 -0
- package/dist/js/colors/dark_tritanopia.js +3 -0
- package/dist/js/colors/index.d.ts +27 -0
- package/dist/js/colors/light.d.ts +3 -0
- package/dist/js/colors/light.js +3 -0
- package/dist/js/colors/light_colorblind.d.ts +3 -0
- package/dist/js/colors/light_colorblind.js +3 -0
- package/dist/js/colors/light_high_contrast.d.ts +3 -0
- package/dist/js/colors/light_high_contrast.js +3 -0
- package/dist/js/colors/light_tritanopia.d.ts +3 -0
- package/dist/js/colors/light_tritanopia.js +3 -0
- package/dist/js/index.d.ts +27 -0
- package/dist/json/colors/dark.json +3 -0
- package/dist/json/colors/dark_colorblind.json +3 -0
- package/dist/json/colors/dark_dimmed.json +3 -0
- package/dist/json/colors/dark_high_contrast.json +3 -0
- package/dist/json/colors/dark_tritanopia.json +3 -0
- package/dist/json/colors/light.json +3 -0
- package/dist/json/colors/light_colorblind.json +3 -0
- package/dist/json/colors/light_high_contrast.json +3 -0
- package/dist/json/colors/light_tritanopia.json +3 -0
- package/dist/scss/colors/_dark.scss +1 -0
- package/dist/scss/colors/_dark_colorblind.scss +1 -0
- package/dist/scss/colors/_dark_dimmed.scss +1 -0
- package/dist/scss/colors/_dark_high_contrast.scss +1 -0
- package/dist/scss/colors/_dark_tritanopia.scss +1 -0
- package/dist/scss/colors/_light.scss +1 -0
- package/dist/scss/colors/_light_colorblind.scss +1 -0
- package/dist/scss/colors/_light_high_contrast.scss +1 -0
- package/dist/scss/colors/_light_tritanopia.scss +1 -0
- package/dist/ts/colors/dark.ts +3 -0
- package/dist/ts/colors/dark_colorblind.ts +3 -0
- package/dist/ts/colors/dark_dimmed.ts +3 -0
- package/dist/ts/colors/dark_high_contrast.ts +3 -0
- package/dist/ts/colors/dark_tritanopia.ts +3 -0
- package/dist/ts/colors/light.ts +3 -0
- package/dist/ts/colors/light_colorblind.ts +3 -0
- package/dist/ts/colors/light_high_contrast.ts +3 -0
- package/dist/ts/colors/light_tritanopia.ts +3 -0
- package/package.json +27 -4
- package/tokens/base/color/dark-colorblind.json +44 -0
- package/tokens/base/color/dark-dimmed.json +124 -0
- package/tokens/base/color/dark-high-contrast.json +124 -0
- package/tokens/base/color/dark-tritanopia.json +92 -0
- package/tokens/base/color/dark.json +129 -0
- package/tokens/base/color/light-colorblind.json +134 -0
- package/tokens/base/color/light-high-contrast.json +390 -0
- package/tokens/base/color/light-tritanopia.json +92 -0
- package/tokens/base/color/light.json +399 -0
- package/tokens/functional/color/ansi-dark.json +74 -0
- package/tokens/functional/color/ansi-light.json +74 -0
- package/tokens/functional/color/checks-dark.json +289 -0
- package/tokens/functional/color/checks-light.json +296 -0
- package/tokens/functional/color/components-dark.json +556 -0
- package/tokens/functional/color/components-light.json +469 -0
- package/tokens/functional/color/diff-dark.json +78 -0
- package/tokens/functional/color/diff-light.json +76 -0
- package/tokens/functional/color/exceptions-dark-colorblind.json +45 -0
- package/tokens/functional/color/exceptions-dark-dimmed.json +12 -0
- package/tokens/functional/color/exceptions-dark-high-contrast.json +271 -0
- package/tokens/functional/color/exceptions-dark-tritanopia.json +44 -0
- package/tokens/functional/color/exceptions-light-colorblind.json +87 -0
- package/tokens/functional/color/exceptions-light-high-contrast.json +327 -0
- package/tokens/functional/color/exceptions-light-tritanopia.json +87 -0
- package/tokens/functional/color/marketing-dark.json +24 -0
- package/tokens/functional/color/marketing-light.json +24 -0
- package/tokens/functional/color/misc-dark.json +38 -0
- package/tokens/functional/color/misc-light.json +37 -0
- package/tokens/functional/color/primitives-dark.json +322 -0
- package/tokens/functional/color/primitives-light.json +313 -0
- package/tokens/functional/color/scales.json +582 -0
- package/tokens/functional/color/syntax-dark.json +208 -0
- package/tokens/functional/color/syntax-light.json +208 -0
- package/tokens/removed/color.json +421 -0
- package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +3 -2
- package/tokens-v2-private/css/tokens/functional/size/size-fine.css +3 -2
- package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
- package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/base/size/size.js +3 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/base/typography/typography.js +3 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/functional/size/border.js +3 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +3 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +3 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +3 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/functional/size/size.js +3 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +4 -2
- package/tokens-v2-private/ts/tokens/functional/size/viewport.js +3 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +4 -2
- 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
|
-
- [#
|
|
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
|

|
|
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
|
-
```
|
|
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
|
|
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:
|
|
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
|
|
161
|
+
formatter({dictionary, file, options}) {
|
|
162
162
|
const {outputReferences} = options
|
|
163
|
-
return (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
|
175
|
+
formatter({dictionary, file, options}) {
|
|
176
176
|
const {outputReferences} = options
|
|
177
|
-
return (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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,
|
|
192
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
236
|
-
|
|
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
|
|
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
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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: {
|