@primer/primitives 8.2.4-rc.d955f312 → 8.2.4-rc.ea4beb50

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 (74) hide show
  1. package/README.md +17 -18
  2. package/dist/css/functional/size/border.css +1 -0
  3. package/dist/css/functional/themes/dark-colorblind.css +18 -12
  4. package/dist/css/functional/themes/dark-dimmed.css +20 -14
  5. package/dist/css/functional/themes/dark-high-contrast.css +258 -252
  6. package/dist/css/functional/themes/dark-tritanopia.css +20 -14
  7. package/dist/css/functional/themes/dark.css +20 -14
  8. package/dist/css/functional/themes/light-colorblind.css +30 -24
  9. package/dist/css/functional/themes/light-high-contrast.css +154 -148
  10. package/dist/css/functional/themes/light-tritanopia.css +30 -24
  11. package/dist/css/functional/themes/light.css +18 -12
  12. package/dist/css/primitives.css +1 -0
  13. package/dist/docs/functional/size/border.json +31 -0
  14. package/dist/docs/functional/themes/dark-colorblind.json +236 -149
  15. package/dist/docs/functional/themes/dark-dimmed.json +247 -158
  16. package/dist/docs/functional/themes/dark-high-contrast.json +555 -458
  17. package/dist/docs/functional/themes/dark-tritanopia.json +240 -153
  18. package/dist/docs/functional/themes/dark.json +247 -158
  19. package/dist/docs/functional/themes/light-colorblind.json +254 -173
  20. package/dist/docs/functional/themes/light-high-contrast.json +452 -361
  21. package/dist/docs/functional/themes/light-tritanopia.json +252 -171
  22. package/dist/docs/functional/themes/light.json +246 -157
  23. package/dist/fallbacks/functional/size/border.json +1 -0
  24. package/dist/figma/dimension/dimension.json +14 -0
  25. package/dist/figma/themes/dark-colorblind.json +246 -198
  26. package/dist/figma/themes/dark-dimmed.json +249 -200
  27. package/dist/figma/themes/dark-high-contrast.json +675 -625
  28. package/dist/figma/themes/dark-tritanopia.json +248 -200
  29. package/dist/figma/themes/dark.json +249 -200
  30. package/dist/figma/themes/light-colorblind.json +265 -218
  31. package/dist/figma/themes/light-high-contrast.json +457 -407
  32. package/dist/figma/themes/light-tritanopia.json +264 -217
  33. package/dist/figma/themes/light.json +187 -138
  34. package/dist/internalCss/dark-colorblind.css +18 -12
  35. package/dist/internalCss/dark-dimmed.css +20 -14
  36. package/dist/internalCss/dark-high-contrast.css +258 -252
  37. package/dist/internalCss/dark-tritanopia.css +20 -14
  38. package/dist/internalCss/dark.css +20 -14
  39. package/dist/internalCss/light-colorblind.css +30 -24
  40. package/dist/internalCss/light-high-contrast.css +154 -148
  41. package/dist/internalCss/light-tritanopia.css +30 -24
  42. package/dist/internalCss/light.css +18 -12
  43. package/dist/styleLint/functional/size/border.json +31 -0
  44. package/dist/styleLint/functional/themes/dark-colorblind.json +236 -149
  45. package/dist/styleLint/functional/themes/dark-dimmed.json +247 -158
  46. package/dist/styleLint/functional/themes/dark-high-contrast.json +555 -458
  47. package/dist/styleLint/functional/themes/dark-tritanopia.json +240 -153
  48. package/dist/styleLint/functional/themes/dark.json +247 -158
  49. package/dist/styleLint/functional/themes/light-colorblind.json +254 -173
  50. package/dist/styleLint/functional/themes/light-high-contrast.json +452 -361
  51. package/dist/styleLint/functional/themes/light-tritanopia.json +252 -171
  52. package/dist/styleLint/functional/themes/light.json +246 -157
  53. package/package.json +38 -35
  54. package/src/formats/cssAdvanced.ts +3 -3
  55. package/src/formats/cssCustomMedia.ts +2 -2
  56. package/src/formats/javascriptCommonJs.ts +2 -2
  57. package/src/formats/javascriptEsm.ts +2 -2
  58. package/src/formats/jsonFigma.ts +2 -2
  59. package/src/formats/jsonNestedPrefixed.ts +2 -2
  60. package/src/formats/jsonOneDimensional.ts +2 -2
  61. package/src/formats/jsonPostCssFallback.ts +2 -2
  62. package/src/formats/typescriptExportDefinition.ts +2 -2
  63. package/src/schemas/designToken.ts +1 -1
  64. package/src/schemas/validTokenType.ts +1 -1
  65. package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +528 -2
  66. package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +4 -0
  67. package/src/tokens/functional/color/dark/patterns-dark.json5 +26 -0
  68. package/src/tokens/functional/color/dark/primitives-dark.json5 +78 -65
  69. package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +400 -0
  70. package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +3 -6
  71. package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +3 -6
  72. package/src/tokens/functional/color/light/patterns-light.json5 +26 -0
  73. package/src/tokens/functional/color/light/primitives-light.json5 +77 -64
  74. package/src/tokens/functional/size/border.json +13 -0
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@primer/primitives",
3
- "version": "8.2.4-rc.d955f312",
3
+ "version": "8.2.4-rc.ea4beb50",
4
4
  "description": "Typography, spacing, and color primitives for Primer design system",
5
+ "engines": {
6
+ "node": ">=18.18.0 <18.19.0"
7
+ },
5
8
  "files": [
6
9
  "dist",
7
10
  "src/**/*",
@@ -25,56 +28,56 @@
25
28
  "scripts": {
26
29
  "build": "npm run build:v8 && npm run build:fallbacks && npm run build:figma",
27
30
  "build:next": "echo '\\033[31m 🛑 Use npm run build instead of npm run build:next\\033[0m'",
28
- "build:v8": "ts-node ./scripts/buildTokens.ts",
29
- "build:fallbacks": "ts-node ./scripts/buildFallbacks.ts",
30
- "build:figma": "ts-node scripts/buildFigma.ts",
31
- "tokenJson:check": "ts-node scripts/diffThemes.ts && ts-node scripts/diffTokenProps.ts",
32
- "contrast:check": "ts-node scripts/color-contrast.ts",
31
+ "build:v8": "tsx ./scripts/buildTokens.ts",
32
+ "build:fallbacks": "tsx ./scripts/buildFallbacks.ts",
33
+ "build:figma": "tsx scripts/buildFigma.ts",
34
+ "tokenJson:check": "tsx scripts/diffThemes.ts && tsx scripts/diffTokenProps.ts",
35
+ "contrast:check": "tsx scripts/color-contrast.ts",
33
36
  "format": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,css}'",
34
37
  "format:check": "prettier --check '**/*.{js,jsx,ts,tsx,md,mdx,css}'",
35
38
  "install:storybook": "cd docs/storybook && npm ci --legacy-peer-deps --no-audit --no-fund",
36
- "lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0 --config .eslintrc.js && npm run lint:tokens",
37
- "lint:fix": "eslint '**/*.{js,ts,tsx,md,mdx}' --fix --max-warnings=0 --config .eslintrc.js",
38
- "lint:tokens": "ts-node ./scripts/validateTokenJson.ts",
39
+ "lint": "ESLINT_USE_FLAT_CONFIG=false eslint '**/*.{js,ts,tsx,md,mdx}' --config .eslintrc.cjs && npm run lint:tokens",
40
+ "lint:fix": "eslint '**/*.{js,ts,tsx,md,mdx}' --fix --max-warnings=0 --config .eslintrc.cjs",
41
+ "lint:tokens": "tsx ./scripts/validateTokenJson.ts",
39
42
  "prebuild": "rm -rf dist",
40
43
  "prepack": "npm run build",
41
44
  "release": "changeset publish",
42
45
  "start:storybook": "npm run build && cd docs/storybook && npm run storybook",
43
- "test": "jest --verbose --coverage"
46
+ "test": "vitest run --coverage"
44
47
  },
45
48
  "prettier": "@github/prettier-config",
46
49
  "devDependencies": {
47
50
  "@actions/github": "^6.0.0",
48
51
  "@changesets/changelog-github": "^0.5.0",
49
- "@changesets/cli": "^2.27.1",
52
+ "@changesets/cli": "^2.27.7",
50
53
  "@github/prettier-config": "^0.0.6",
51
- "@playwright/test": "^1.43.0",
52
- "@types/jest": "^29.5.2",
53
- "@types/node": "^20.4.0",
54
- "@typescript-eslint/eslint-plugin": "^5.61.0",
55
- "@typescript-eslint/parser": "^5.61.0",
54
+ "@playwright/test": "^1.45.1",
55
+ "@prettier/sync": "^0.5.2",
56
+ "@types/node": "^20.14.9",
57
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
58
+ "@typescript-eslint/parser": "^7.15.0",
59
+ "@vitest/coverage-v8": "^2.0.1",
56
60
  "color-blend": "^4.0.0",
57
- "color2k": "^2.0.0",
58
- "console-table-printer": "^2.11.1",
59
- "eslint": "^8.12.0",
60
- "eslint-config-prettier": "^8.6.0",
61
- "eslint-import-resolver-typescript": "^3.5.3",
62
- "eslint-plugin-github": "^4.3.6",
63
- "eslint-plugin-jsx-a11y": "^6.5.1",
64
- "eslint-plugin-mdx": "^2.0.5",
65
- "eslint-plugin-primer-react": "^1.0.1",
66
- "eslint-plugin-react": "^7.29.4",
67
- "eslint-plugin-react-hooks": "^4.4.0",
68
- "eslint-plugin-storybook": "^0.6.15",
69
- "jest": "^29.6.1",
61
+ "color2k": "^2.0.3",
62
+ "console-table-printer": "^2.12.1",
63
+ "eslint": "^8.57.0",
64
+ "eslint-config-prettier": "^9.1.0",
65
+ "eslint-import-resolver-typescript": "3.6",
66
+ "eslint-plugin-github": "^5.0.1",
67
+ "eslint-plugin-jsx-a11y": "6.9",
68
+ "eslint-plugin-mdx": "^3.1.5",
69
+ "eslint-plugin-primer-react": "^5.3.0",
70
+ "eslint-plugin-react": "7.34",
71
+ "eslint-plugin-react-hooks": "^4.6.2",
72
+ "eslint-plugin-storybook": "^0.8.0",
70
73
  "json5": "^2.2.1",
71
74
  "markdown-table-ts": "^1.0.3",
72
- "prettier": "^2.7.1",
75
+ "prettier": "3.3",
73
76
  "style-dictionary": "^3.9.2",
74
- "ts-jest": "^29.1.2",
75
- "ts-node": "^10.9.2",
76
- "typescript": "^5.4.5",
77
- "zod": "^3.22.4",
78
- "zod-validation-error": "^3.1.0"
77
+ "tsx": "^4.16.2",
78
+ "typescript": "5.5",
79
+ "vitest": "^2.0.1",
80
+ "zod": "3.23",
81
+ "zod-validation-error": "3.3"
79
82
  }
80
83
  }
@@ -1,7 +1,7 @@
1
1
  import type {TransformedToken} from 'style-dictionary'
2
2
  import StyleDictionary from 'style-dictionary'
3
3
  import type {FormatterArguments} from 'style-dictionary/types/Format'
4
- import {format} from 'prettier'
4
+ import syncPrettier from '@prettier/sync'
5
5
  import type {LineFormatting} from 'style-dictionary/types/FormatHelpers'
6
6
  const {fileHeader, formattedVariables} = StyleDictionary.formatHelpers
7
7
 
@@ -47,7 +47,7 @@ export const cssAdvanced: StyleDictionary.Formatter = ({
47
47
  ...token,
48
48
  name: `${platform.prefix}-${token.name}`,
49
49
  path: [platform.prefix, ...token.path],
50
- } as TransformedToken),
50
+ }) as TransformedToken,
51
51
  )
52
52
  }
53
53
  // get queries from tokens
@@ -95,5 +95,5 @@ export const cssAdvanced: StyleDictionary.Formatter = ({
95
95
  output.push(queryString ? `${queryString} { ${cssWithSelector} }` : cssWithSelector)
96
96
  }
97
97
  // return prettified
98
- return format(output.join('\n'), {parser: 'css', printWidth: 500})
98
+ return syncPrettier.format(output.join('\n'), {parser: 'css', printWidth: 500})
99
99
  }
@@ -1,6 +1,6 @@
1
1
  import StyleDictionary from 'style-dictionary'
2
2
  import type {FormatterArguments} from 'style-dictionary/types/Format'
3
- import {format} from 'prettier'
3
+ import syncPrettier from '@prettier/sync'
4
4
  const {fileHeader} = StyleDictionary.formatHelpers
5
5
 
6
6
  /**
@@ -20,5 +20,5 @@ export const cssCustomMedia: StyleDictionary.Formatter = ({
20
20
  output.push(`@custom-media --${name} ${value};`)
21
21
  })
22
22
  // return prettified
23
- return format(output.join('\n'), {parser: 'css', printWidth: 500})
23
+ return syncPrettier.format(output.join('\n'), {parser: 'css', printWidth: 500})
24
24
  }
@@ -1,4 +1,4 @@
1
- import {format} from 'prettier'
1
+ import syncPrettier from '@prettier/sync'
2
2
  import {jsonToNestedValue} from './utilities/jsonToNestedValue'
3
3
  import {prefixTokens} from './utilities/prefixTokens'
4
4
  import StyleDictionary from 'style-dictionary'
@@ -17,5 +17,5 @@ export const javascriptCommonJs: StyleDictionary.Formatter = ({dictionary, file,
17
17
  // add file header and convert output
18
18
  const output = `${fileHeader({file})}exports.default = ${JSON.stringify(jsonToNestedValue(tokens), null, 2)}\n`
19
19
  // return prettified
20
- return format(output, {parser: 'typescript', printWidth: 500})
20
+ return syncPrettier.format(output, {parser: 'typescript', printWidth: 500})
21
21
  }
@@ -1,5 +1,5 @@
1
1
  import StyleDictionary from 'style-dictionary'
2
- import {format} from 'prettier'
2
+ import syncPrettier from '@prettier/sync'
3
3
  import {jsonToNestedValue} from './utilities/jsonToNestedValue'
4
4
  import {prefixTokens} from './utilities/prefixTokens'
5
5
  import type {FormatterArguments} from 'style-dictionary/types/Format'
@@ -17,5 +17,5 @@ export const javascriptEsm: StyleDictionary.Formatter = ({dictionary, file, plat
17
17
  // add file header and convert output
18
18
  const output = `${fileHeader({file})}export default \n${JSON.stringify(jsonToNestedValue(tokens), null, 2)}\n`
19
19
  // return prettified
20
- return format(output, {parser: 'typescript', printWidth: 500})
20
+ return syncPrettier.format(output, {parser: 'typescript', printWidth: 500})
21
21
  }
@@ -1,5 +1,5 @@
1
1
  import StyleDictionary from 'style-dictionary'
2
- import {format} from 'prettier'
2
+ import syncPrettier from '@prettier/sync'
3
3
  import type {FormatterArguments} from 'style-dictionary/types/Format'
4
4
  import {transformNamePathToFigma} from '../transformers/namePathToFigma'
5
5
  import type {ShadowTokenValue} from '../types/ShadowTokenValue'
@@ -130,5 +130,5 @@ export const jsonFigma: StyleDictionary.Formatter = ({dictionary, file: _file, p
130
130
  // add file header and convert output
131
131
  const output = JSON.stringify(tokens, null, 2)
132
132
  // return prettified
133
- return format(output, {parser: 'json', printWidth: 500})
133
+ return syncPrettier.format(output, {parser: 'json', printWidth: 500})
134
134
  }
@@ -1,5 +1,5 @@
1
1
  import type StyleDictionary from 'style-dictionary'
2
- import {format} from 'prettier'
2
+ import syncPrettier from '@prettier/sync'
3
3
  import {prefixTokens} from './utilities/prefixTokens'
4
4
  import {jsonToNestedValue} from './utilities/jsonToNestedValue'
5
5
 
@@ -19,5 +19,5 @@ export const jsonNestedPrefixed: StyleDictionary.Formatter = ({dictionary, file:
19
19
  // add file header and convert output
20
20
  const output = JSON.stringify(tokens, null, 2)
21
21
  // return prettified
22
- return format(output, {parser: 'json', printWidth: 500})
22
+ return syncPrettier.format(output, {parser: 'json', printWidth: 500})
23
23
  }
@@ -1,5 +1,5 @@
1
1
  import type StyleDictionary from 'style-dictionary'
2
- import {format} from 'prettier'
2
+ import syncPrettier from '@prettier/sync'
3
3
  import {jsonToFlat} from './utilities/jsonToFlat'
4
4
  /**
5
5
  * @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
@@ -14,5 +14,5 @@ export const jsonOneDimensional: StyleDictionary.Formatter = ({dictionary, file:
14
14
  // add file header and convert output
15
15
  const output = JSON.stringify(tokens, null, 2)
16
16
  // return prettified
17
- return format(output, {parser: 'json', printWidth: 500})
17
+ return syncPrettier.format(output, {parser: 'json', printWidth: 500})
18
18
  }
@@ -1,5 +1,5 @@
1
1
  import type StyleDictionary from 'style-dictionary'
2
- import {format} from 'prettier'
2
+ import syncPrettier from '@prettier/sync'
3
3
 
4
4
  /**
5
5
  * @description Takes a style dictionary token dictionary and converts it to a one dimensional json object.
@@ -12,5 +12,5 @@ export const jsonPostCssFallback: StyleDictionary.Formatter = ({dictionary, file
12
12
  // add file header and convert output
13
13
  const output = JSON.stringify(tokens, null, 2)
14
14
  // return prettified
15
- return format(output, {parser: 'json', printWidth: 500})
15
+ return syncPrettier.format(output, {parser: 'json', printWidth: 500})
16
16
  }
@@ -1,5 +1,5 @@
1
1
  import StyleDictionary from 'style-dictionary'
2
- import {format} from 'prettier'
2
+ import syncPrettier from '@prettier/sync'
3
3
  import fs = require('fs')
4
4
  import path = require('path')
5
5
  import {treeWalker} from '../utilities/treeWalker'
@@ -166,5 +166,5 @@ export const typescriptExportDefinition: StyleDictionary.Formatter = ({
166
166
  // add file header and convert output
167
167
  const output = `${fileHeader({file})}\n${getTypeDefinition(tokens, moduleName, tokenTypesPath)}\n`
168
168
  // return prettified
169
- return format(output, {parser: 'typescript', printWidth: 500})
169
+ return syncPrettier.format(output, {parser: 'typescript', printWidth: 500})
170
170
  }
@@ -16,7 +16,7 @@ import {durationToken} from './durationToken'
16
16
  // @ts-ignore: TODO: fix this
17
17
  export const designToken = z.record(
18
18
  tokenName,
19
- z.lazy(() => {
19
+ z.lazy((): z.ZodTypeAny => {
20
20
  return z.union([
21
21
  z.discriminatedUnion('$type', [
22
22
  colorToken,
@@ -22,7 +22,7 @@ export type TokenType = (typeof validTypes)[number]
22
22
  // @ts-ignore: TODO: fix this
23
23
  export const validateType = z.record(
24
24
  z.string(),
25
- z.lazy(() => {
25
+ z.lazy((): z.ZodTypeAny => {
26
26
  return z.union([
27
27
  z
28
28
  .object({