@wordpress/theme 0.3.1-next.6deb34194.0 → 0.4.1-next.738bb1424.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +114 -40
  3. package/build/color-ramps/{index.js → index.cjs} +8 -8
  4. package/build/color-ramps/lib/{color-utils.js → color-utils.cjs} +2 -2
  5. package/build/color-ramps/lib/{constants.js → constants.cjs} +2 -2
  6. package/build/color-ramps/lib/{default-ramps.js → default-ramps.cjs} +1 -1
  7. package/build/color-ramps/lib/{find-color-with-constraints.js → find-color-with-constraints.cjs} +6 -6
  8. package/build/color-ramps/lib/{index.js → index.cjs} +6 -6
  9. package/build/color-ramps/lib/{ramp-configs.js → ramp-configs.cjs} +1 -1
  10. package/build/color-ramps/lib/{register-color-spaces.js → register-color-spaces.cjs} +1 -1
  11. package/build/color-ramps/lib/{taper-chroma.js → taper-chroma.cjs} +2 -2
  12. package/build/color-ramps/lib/{types.js → types.cjs} +1 -1
  13. package/build/color-ramps/lib/{utils.js → utils.cjs} +4 -4
  14. package/build/{context.js → context.cjs} +1 -1
  15. package/build/{index.js → index.cjs} +2 -2
  16. package/build/index.cjs.map +7 -0
  17. package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
  18. package/build/prebuilt/js/{design-tokens.js → design-tokens.cjs} +18 -2
  19. package/build/prebuilt/js/design-tokens.cjs.map +7 -0
  20. package/build/prebuilt/ts/{color-tokens.js → color-tokens.cjs} +36 -14
  21. package/build/prebuilt/ts/color-tokens.cjs.map +7 -0
  22. package/build/{token-id.js → prebuilt/ts/token-types.cjs} +4 -16
  23. package/build/prebuilt/ts/token-types.cjs.map +7 -0
  24. package/build/{private-apis.js → private-apis.cjs} +4 -4
  25. package/build/{theme-provider.js → theme-provider.cjs} +3 -3
  26. package/build/{types.js → types.cjs} +1 -1
  27. package/build/{use-theme-provider-styles.js → use-theme-provider-styles.cjs} +6 -6
  28. package/build-module/color-ramps/index.js +7 -7
  29. package/build-module/color-ramps/lib/color-utils.js +1 -1
  30. package/build-module/color-ramps/lib/constants.js +1 -1
  31. package/build-module/color-ramps/lib/find-color-with-constraints.js +5 -5
  32. package/build-module/color-ramps/lib/index.js +5 -5
  33. package/build-module/color-ramps/lib/taper-chroma.js +1 -1
  34. package/build-module/color-ramps/lib/utils.js +3 -3
  35. package/build-module/index.js +1 -1
  36. package/build-module/index.js.map +2 -2
  37. package/build-module/prebuilt/js/design-tokens.js +17 -1
  38. package/build-module/prebuilt/js/design-tokens.js.map +2 -2
  39. package/build-module/prebuilt/ts/color-tokens.js +35 -13
  40. package/build-module/prebuilt/ts/color-tokens.js.map +2 -2
  41. package/build-module/prebuilt/ts/token-types.js +1 -0
  42. package/build-module/prebuilt/ts/token-types.js.map +7 -0
  43. package/build-module/private-apis.js +3 -3
  44. package/build-module/theme-provider.js +2 -2
  45. package/build-module/use-theme-provider-styles.js +4 -4
  46. package/build-types/index.d.ts +2 -0
  47. package/build-types/index.d.ts.map +1 -1
  48. package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -1
  49. package/build-types/prebuilt/ts/token-types.d.ts +49 -0
  50. package/build-types/prebuilt/ts/token-types.d.ts.map +1 -0
  51. package/package.json +15 -7
  52. package/src/index.ts +2 -1
  53. package/src/prebuilt/css/design-tokens.css +18 -2
  54. package/src/prebuilt/js/design-tokens.js +17 -1
  55. package/src/prebuilt/ts/color-tokens.ts +31 -9
  56. package/src/prebuilt/ts/token-types.ts +125 -0
  57. package/bin/generate-default-ramps/index.ts +0 -49
  58. package/bin/generate-primitive-tokens/index.ts +0 -120
  59. package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +0 -84
  60. package/bin/terrazzo-plugin-figma-ds-token-manager/index.ts +0 -217
  61. package/bin/terrazzo-plugin-figma-ds-token-manager/lib.ts +0 -1
  62. package/bin/terrazzo-plugin-inline-alias-values/index.ts +0 -113
  63. package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +0 -52
  64. package/build/index.js.map +0 -7
  65. package/build/prebuilt/js/design-tokens.js.map +0 -7
  66. package/build/prebuilt/json/figma.json +0 -787
  67. package/build/prebuilt/ts/color-tokens.js.map +0 -7
  68. package/build/token-id.js.map +0 -7
  69. package/build-module/prebuilt/json/figma.json +0 -787
  70. package/build-module/token-id.js +0 -6
  71. package/build-module/token-id.js.map +0 -7
  72. package/build-types/token-id.d.ts +0 -9
  73. package/build-types/token-id.d.ts.map +0 -1
  74. package/docs/ds-tokens.md +0 -160
  75. package/src/prebuilt/json/figma.json +0 -787
  76. package/src/test/token-id.test.ts +0 -12
  77. package/src/token-id.ts +0 -9
  78. package/terrazzo.config.ts +0 -126
  79. package/tokens/border.json +0 -56
  80. package/tokens/color.json +0 -1029
  81. package/tokens/dimension.json +0 -171
  82. package/tokens/elevation.json +0 -201
  83. package/tokens/typography.json +0 -93
  84. package/tsconfig.bin.json +0 -13
  85. package/tsconfig.bin.tsbuildinfo +0 -1
  86. package/tsconfig.json +0 -11
  87. package/tsconfig.src.json +0 -9
  88. package/tsconfig.src.tsbuildinfo +0 -1
  89. /package/build/color-ramps/{index.js.map → index.cjs.map} +0 -0
  90. /package/build/color-ramps/lib/{color-utils.js.map → color-utils.cjs.map} +0 -0
  91. /package/build/color-ramps/lib/{constants.js.map → constants.cjs.map} +0 -0
  92. /package/build/color-ramps/lib/{default-ramps.js.map → default-ramps.cjs.map} +0 -0
  93. /package/build/color-ramps/lib/{find-color-with-constraints.js.map → find-color-with-constraints.cjs.map} +0 -0
  94. /package/build/color-ramps/lib/{index.js.map → index.cjs.map} +0 -0
  95. /package/build/color-ramps/lib/{ramp-configs.js.map → ramp-configs.cjs.map} +0 -0
  96. /package/build/color-ramps/lib/{register-color-spaces.js.map → register-color-spaces.cjs.map} +0 -0
  97. /package/build/color-ramps/lib/{taper-chroma.js.map → taper-chroma.cjs.map} +0 -0
  98. /package/build/color-ramps/lib/{types.js.map → types.cjs.map} +0 -0
  99. /package/build/color-ramps/lib/{utils.js.map → utils.cjs.map} +0 -0
  100. /package/build/{context.js.map → context.cjs.map} +0 -0
  101. /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
  102. /package/build/{private-apis.js.map → private-apis.cjs.map} +0 -0
  103. /package/build/{theme-provider.js.map → theme-provider.cjs.map} +0 -0
  104. /package/build/{types.js.map → types.cjs.map} +0 -0
  105. /package/build/{use-theme-provider-styles.js.map → use-theme-provider-styles.cjs.map} +0 -0
@@ -0,0 +1,49 @@
1
+ /**
2
+ * This file is generated by the @wordpress/terrazzo-plugin-typescript-types plugin.
3
+ * Do not edit this file directly.
4
+ */
5
+ /**
6
+ * Size scale for padding tokens.
7
+ */
8
+ export type PaddingSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg';
9
+ /**
10
+ * Size scale for gap tokens.
11
+ */
12
+ export type GapSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
13
+ /**
14
+ * Size scale for border radius tokens.
15
+ */
16
+ export type BorderRadiusSize = 'xs' | 'sm' | 'md' | 'lg';
17
+ /**
18
+ * Size scale for border width tokens.
19
+ */
20
+ export type BorderWidthSize = 'xs' | 'sm' | 'md' | 'lg';
21
+ /**
22
+ * Target elements that tokens can be applied to.
23
+ */
24
+ export type Target = 'surface' | 'interactive' | 'track' | 'thumb' | 'content' | 'focus';
25
+ /**
26
+ * Background color variants for surface elements.
27
+ */
28
+ export type SurfaceBackgroundColor = 'neutral' | 'neutral-strong' | 'neutral-weak' | 'brand' | 'success' | 'success-weak' | 'info' | 'info-weak' | 'warning' | 'warning-weak' | 'caution' | 'caution-weak' | 'error' | 'error-weak';
29
+ /**
30
+ * Background color variants for interactive elements.
31
+ */
32
+ export type InteractiveBackgroundColor = 'neutral' | 'neutral-strong' | 'neutral-weak' | 'brand' | 'brand-strong' | 'brand-weak' | 'error' | 'error-strong' | 'error-weak';
33
+ /**
34
+ * Foreground color variants for content text and icons.
35
+ */
36
+ export type ContentForegroundColor = 'neutral' | 'neutral-weak' | 'success' | 'success-weak' | 'info' | 'info-weak' | 'warning' | 'warning-weak' | 'caution' | 'caution-weak' | 'error' | 'error-weak';
37
+ /**
38
+ * Foreground color variants for interactive element text and icons.
39
+ */
40
+ export type InteractiveForegroundColor = 'neutral' | 'neutral-strong' | 'neutral-weak' | 'brand' | 'brand-strong' | 'error' | 'error-strong';
41
+ /**
42
+ * Stroke color variants for surface borders.
43
+ */
44
+ export type SurfaceStrokeColor = 'neutral' | 'neutral-weak' | 'neutral-strong' | 'brand' | 'brand-strong' | 'success' | 'success-strong' | 'info' | 'info-strong' | 'warning' | 'warning-strong' | 'error' | 'error-strong';
45
+ /**
46
+ * Stroke color variants for interactive element borders.
47
+ */
48
+ export type InteractiveStrokeColor = 'neutral' | 'neutral-strong' | 'brand' | 'error' | 'error-strong';
49
+ //# sourceMappingURL=token-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-types.d.ts","sourceRoot":"","sources":["../../../src/prebuilt/ts/token-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,MAAM,GACf,SAAS,GACT,aAAa,GACb,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAC/B,SAAS,GACT,gBAAgB,GAChB,cAAc,GACd,OAAO,GACP,SAAS,GACT,cAAc,GACd,MAAM,GACN,WAAW,GACX,SAAS,GACT,cAAc,GACd,SAAS,GACT,cAAc,GACd,OAAO,GACP,YAAY,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,0BAA0B,GACnC,SAAS,GACT,gBAAgB,GAChB,cAAc,GACd,OAAO,GACP,cAAc,GACd,YAAY,GACZ,OAAO,GACP,cAAc,GACd,YAAY,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAC/B,SAAS,GACT,cAAc,GACd,SAAS,GACT,cAAc,GACd,MAAM,GACN,WAAW,GACX,SAAS,GACT,cAAc,GACd,SAAS,GACT,cAAc,GACd,OAAO,GACP,YAAY,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,0BAA0B,GACnC,SAAS,GACT,gBAAgB,GAChB,cAAc,GACd,OAAO,GACP,cAAc,GACd,OAAO,GACP,cAAc,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC3B,SAAS,GACT,cAAc,GACd,gBAAgB,GAChB,OAAO,GACP,cAAc,GACd,SAAS,GACT,gBAAgB,GAChB,MAAM,GACN,aAAa,GACb,SAAS,GACT,gBAAgB,GAChB,OAAO,GACP,cAAc,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAC/B,SAAS,GACT,gBAAgB,GAChB,OAAO,GACP,OAAO,GACP,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/theme",
3
- "version": "0.3.1-next.6deb34194.0",
3
+ "version": "0.4.1-next.738bb1424.0",
4
4
  "description": "Theme and context provider for the WordPress Design System.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -22,13 +22,21 @@
22
22
  "node": ">=18.12.0",
23
23
  "npm": ">=8.19.2"
24
24
  },
25
- "main": "build/index.js",
25
+ "files": [
26
+ "src",
27
+ "build",
28
+ "build-module",
29
+ "build-types",
30
+ "*.md"
31
+ ],
32
+ "type": "module",
33
+ "main": "build/index.cjs",
26
34
  "module": "build-module/index.js",
27
35
  "exports": {
28
36
  ".": {
29
37
  "types": "./build-types/index.d.ts",
30
38
  "import": "./build-module/index.js",
31
- "default": "./build/index.js"
39
+ "default": "./build/index.cjs"
32
40
  },
33
41
  "./design-tokens.css": "./src/prebuilt/css/design-tokens.css",
34
42
  "./design-tokens.js": "./src/prebuilt/js/design-tokens.js",
@@ -43,8 +51,8 @@
43
51
  "build-module/color-ramps/lib/register-color-spaces.js"
44
52
  ],
45
53
  "dependencies": {
46
- "@wordpress/element": "^6.36.1-next.6deb34194.0",
47
- "@wordpress/private-apis": "^1.36.1-next.6deb34194.0",
54
+ "@wordpress/element": "^6.36.1-next.738bb1424.0",
55
+ "@wordpress/private-apis": "^1.36.1-next.738bb1424.0",
48
56
  "colorjs.io": "^0.5.2",
49
57
  "memize": "^2.1.0"
50
58
  },
@@ -62,7 +70,7 @@
62
70
  "build:default-ramps": "node --import=esbuild-esm-loader/register bin/generate-default-ramps/index.ts",
63
71
  "build:tokens": "node --import=esbuild-esm-loader/register bin/generate-primitive-tokens/index.ts && cross-env NODE_OPTIONS=--import=esbuild-esm-loader/register tz build --config terrazzo.config.ts",
64
72
  "build": "npm run build:tokens && npm run build:default-ramps",
65
- "postbuild": "prettier --write tokens/color.json src/prebuilt src/color-ramps/lib/default-ramps.ts docs"
73
+ "postbuild": "prettier --write tokens/color.json tokens/modes src/prebuilt src/color-ramps/lib/default-ramps.ts docs"
66
74
  },
67
- "gitHead": "457096e9e9b3896d2d4fe54fc19d7fb571ee9a44"
75
+ "gitHead": "ab1b004c0d61c295aa34bc86ea07f979343983ce"
68
76
  }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
- // Private APIs.
2
1
  export { privateApis } from './private-apis';
2
+ export type * from './prebuilt/ts/token-types';
3
+ export { type ThemeProvider } from './theme-provider';
@@ -21,6 +21,15 @@
21
21
  --wpds-color-bg-interactive-brand-weak: #00000000; /* Background color for interactive elements with brand tone and weak emphasis. */
22
22
  --wpds-color-bg-interactive-brand-weak-active: #e6eaf4; /* Background color for interactive elements with brand tone and weak emphasis that are hovered, focused, or active. */
23
23
  --wpds-color-bg-interactive-brand-weak-disabled: #e2e2e2; /* Background color for interactive elements with brand tone and weak emphasis, in their disabled state. */
24
+ --wpds-color-bg-interactive-error: #00000000; /* Background color for interactive elements with error tone and normal emphasis. */
25
+ --wpds-color-bg-interactive-error-active: #fff6f4; /* Background color for interactive elements with error tone and normal emphasis that are hovered, focused, or active. */
26
+ --wpds-color-bg-interactive-error-disabled: #e2e2e2; /* Background color for interactive elements with error tone and normal emphasis, in their disabled state. */
27
+ --wpds-color-bg-interactive-error-strong: #cc1818; /* Background color for interactive elements with error tone and strong emphasis. */
28
+ --wpds-color-bg-interactive-error-strong-active: #b90000; /* Background color for interactive elements with error tone and strong emphasis that are hovered, focused, or active. */
29
+ --wpds-color-bg-interactive-error-strong-disabled: #d2d2d2; /* Background color for interactive elements with error tone and strong emphasis, in their disabled state. */
30
+ --wpds-color-bg-interactive-error-weak: #00000000; /* Background color for interactive elements with error tone and weak emphasis. */
31
+ --wpds-color-bg-interactive-error-weak-active: #f6e6e3; /* Background color for interactive elements with error tone and weak emphasis that are hovered, focused, or active. */
32
+ --wpds-color-bg-interactive-error-weak-disabled: #e2e2e2; /* Background color for interactive elements with error tone and weak emphasis, in their disabled state. */
24
33
  --wpds-color-bg-interactive-neutral: #00000000; /* Background color for interactive elements with neutral tone and normal emphasis. */
25
34
  --wpds-color-bg-interactive-neutral-active: #eaeaea; /* Background color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. */
26
35
  --wpds-color-bg-interactive-neutral-disabled: #e2e2e2; /* Background color for interactive elements with neutral tone and normal emphasis, in their disabled state. */
@@ -69,6 +78,12 @@
69
78
  --wpds-color-fg-interactive-brand-strong: #eff0f2; /* Foreground color for interactive elements with brand tone and strong emphasis. */
70
79
  --wpds-color-fg-interactive-brand-strong-active: #eff0f2; /* Foreground color for interactive elements with brand tone and strong emphasis that are hovered, focused, or active. */
71
80
  --wpds-color-fg-interactive-brand-strong-disabled: #6d6d6d; /* Foreground color for interactive elements with brand tone and strong emphasis, in their disabled state. */
81
+ --wpds-color-fg-interactive-error: #cc1818; /* Foreground color for interactive elements with error tone and normal emphasis. */
82
+ --wpds-color-fg-interactive-error-active: #cc1818; /* Foreground color for interactive elements with error tone and normal emphasis that are hovered, focused, or active. */
83
+ --wpds-color-fg-interactive-error-disabled: #8a8a8a; /* Foreground color for interactive elements with error tone and normal emphasis, in their disabled state. */
84
+ --wpds-color-fg-interactive-error-strong: #f2efef; /* Foreground color for interactive elements with error tone and strong emphasis. */
85
+ --wpds-color-fg-interactive-error-strong-active: #f2efef; /* Foreground color for interactive elements with error tone and strong emphasis that are hovered, focused, or active. */
86
+ --wpds-color-fg-interactive-error-strong-disabled: #6d6d6d; /* Foreground color for interactive elements with error tone and strong emphasis, in their disabled state. */
72
87
  --wpds-color-fg-interactive-neutral: #1e1e1e; /* Foreground color for interactive elements with neutral tone and normal emphasis. */
73
88
  --wpds-color-fg-interactive-neutral-active: #1e1e1e; /* Foreground color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. */
74
89
  --wpds-color-fg-interactive-neutral-disabled: #8a8a8a; /* Foreground color for interactive elements with neutral tone and normal emphasis, in their disabled state. */
@@ -80,14 +95,15 @@
80
95
  --wpds-color-stroke-focus-brand: #3858e9; /* Accessible stroke color applied to focus rings. */
81
96
  --wpds-color-stroke-interactive-brand: #3858e9; /* Accessible stroke color used for interactive brand-toned elements with normal emphasis. */
82
97
  --wpds-color-stroke-interactive-brand-active: #2337c8; /* Accessible stroke color used for interactive brand-toned elements with normal emphasis that are hovered, focused, or active. */
83
- --wpds-color-stroke-interactive-brand-disabled: #d8d8d8; /* Accessible stroke color used for interactive brand-toned elements with normal emphasis, in their disabled state. */
98
+ --wpds-color-stroke-interactive-error: #cc1818; /* Accessible stroke color used for interactive error-toned elements with normal emphasis. */
99
+ --wpds-color-stroke-interactive-error-active: #9d0000; /* Accessible stroke color used for interactive error-toned elements with normal emphasis that are hovered, focused, or active. */
84
100
  --wpds-color-stroke-interactive-error-strong: #cc1818; /* Accessible stroke color used for interactive error-toned elements with strong emphasis. */
85
101
  --wpds-color-stroke-interactive-neutral: #8a8a8a; /* Accessible stroke color used for interactive neutrally-toned elements with normal emphasis. */
86
102
  --wpds-color-stroke-interactive-neutral-active: #6c6c6c; /* Accessible stroke color used for interactive neutrally-toned elements with normal emphasis that are hovered, focused, or active. */
87
103
  --wpds-color-stroke-interactive-neutral-disabled: #d8d8d8; /* Accessible stroke color used for interactive neutrally-toned elements with normal emphasis, in their disabled state. */
88
104
  --wpds-color-stroke-interactive-neutral-strong: #6c6c6c; /* Accessible stroke color used for interactive neutrally-toned elements with strong emphasis. */
89
105
  --wpds-color-stroke-surface-brand: #a3b1d4; /* Decorative stroke color used to define brand-toned surface boundaries with normal emphasis. */
90
- --wpds-color-stroke-surface-brand-strong: #3858e9; /* Decorative stroke color used to define neutrally-toned surface boundaries with strong emphasis. */
106
+ --wpds-color-stroke-surface-brand-strong: #3858e9; /* Decorative stroke color used to define brand-toned surface boundaries with strong emphasis. */
91
107
  --wpds-color-stroke-surface-error: #daa39b; /* Decorative stroke color used to define error-toned surface boundaries with normal emphasis. */
92
108
  --wpds-color-stroke-surface-error-strong: #cc1818; /* Decorative stroke color used to define error-toned surface boundaries with strong emphasis. */
93
109
  --wpds-color-stroke-surface-info: #9fbcdc; /* Decorative stroke color used to define info-toned surface boundaries with normal emphasis. */
@@ -45,6 +45,15 @@ export default [
45
45
  '--wpds-color-bg-interactive-brand-weak',
46
46
  '--wpds-color-bg-interactive-brand-weak-active',
47
47
  '--wpds-color-bg-interactive-brand-weak-disabled',
48
+ '--wpds-color-bg-interactive-error',
49
+ '--wpds-color-bg-interactive-error-active',
50
+ '--wpds-color-bg-interactive-error-disabled',
51
+ '--wpds-color-bg-interactive-error-strong',
52
+ '--wpds-color-bg-interactive-error-strong-active',
53
+ '--wpds-color-bg-interactive-error-strong-disabled',
54
+ '--wpds-color-bg-interactive-error-weak',
55
+ '--wpds-color-bg-interactive-error-weak-active',
56
+ '--wpds-color-bg-interactive-error-weak-disabled',
48
57
  '--wpds-color-bg-track-neutral-weak',
49
58
  '--wpds-color-bg-track-neutral',
50
59
  '--wpds-color-bg-thumb-neutral-weak',
@@ -78,6 +87,12 @@ export default [
78
87
  '--wpds-color-fg-interactive-brand-strong',
79
88
  '--wpds-color-fg-interactive-brand-strong-active',
80
89
  '--wpds-color-fg-interactive-brand-strong-disabled',
90
+ '--wpds-color-fg-interactive-error',
91
+ '--wpds-color-fg-interactive-error-active',
92
+ '--wpds-color-fg-interactive-error-disabled',
93
+ '--wpds-color-fg-interactive-error-strong',
94
+ '--wpds-color-fg-interactive-error-strong-active',
95
+ '--wpds-color-fg-interactive-error-strong-disabled',
81
96
  '--wpds-color-stroke-surface-neutral',
82
97
  '--wpds-color-stroke-surface-neutral-weak',
83
98
  '--wpds-color-stroke-surface-neutral-strong',
@@ -97,7 +112,8 @@ export default [
97
112
  '--wpds-color-stroke-interactive-neutral-strong',
98
113
  '--wpds-color-stroke-interactive-brand',
99
114
  '--wpds-color-stroke-interactive-brand-active',
100
- '--wpds-color-stroke-interactive-brand-disabled',
115
+ '--wpds-color-stroke-interactive-error',
116
+ '--wpds-color-stroke-interactive-error-active',
101
117
  '--wpds-color-stroke-interactive-error-strong',
102
118
  '--wpds-color-stroke-focus-brand',
103
119
  '--wpds-dimension-base',
@@ -6,19 +6,19 @@
6
6
  export default {
7
7
  'primary-bgFill1': [ 'bg-interactive-brand-strong' ],
8
8
  'primary-fgFill': [
9
- 'fg-interactive-brand-strong-active',
10
9
  'fg-interactive-brand-strong',
10
+ 'fg-interactive-brand-strong-active',
11
11
  ],
12
12
  'primary-bgFill2': [ 'bg-interactive-brand-strong-active' ],
13
13
  'primary-surface2': [ 'bg-interactive-brand-active' ],
14
14
  'primary-surface4': [ 'bg-interactive-brand-weak-active' ],
15
15
  'primary-fgSurface3': [
16
- 'fg-interactive-brand-active',
17
16
  'fg-interactive-brand',
17
+ 'fg-interactive-brand-active',
18
18
  ],
19
19
  'primary-stroke3': [
20
- 'bg-thumb-brand-active',
21
20
  'bg-thumb-brand',
21
+ 'bg-thumb-brand-active',
22
22
  'stroke-focus-brand',
23
23
  'stroke-interactive-brand',
24
24
  'stroke-surface-brand-strong',
@@ -44,23 +44,44 @@ export default {
44
44
  'warning-fgSurface3': [ 'fg-content-warning-weak' ],
45
45
  'warning-stroke3': [ 'stroke-surface-warning-strong' ],
46
46
  'warning-stroke1': [ 'stroke-surface-warning' ],
47
- 'error-surface2': [ 'bg-surface-error-weak' ],
48
- 'error-surface4': [ 'bg-surface-error' ],
47
+ 'error-bgFill1': [ 'bg-interactive-error-strong' ],
48
+ 'error-fgFill': [
49
+ 'fg-interactive-error-strong',
50
+ 'fg-interactive-error-strong-active',
51
+ ],
52
+ 'error-bgFill2': [ 'bg-interactive-error-strong-active' ],
53
+ 'error-surface2': [
54
+ 'bg-interactive-error-active',
55
+ 'bg-surface-error-weak',
56
+ ],
57
+ 'error-surface4': [
58
+ 'bg-interactive-error-weak-active',
59
+ 'bg-surface-error',
60
+ ],
49
61
  'error-fgSurface4': [ 'fg-content-error' ],
50
- 'error-fgSurface3': [ 'fg-content-error-weak' ],
62
+ 'error-fgSurface3': [
63
+ 'fg-content-error-weak',
64
+ 'fg-interactive-error',
65
+ 'fg-interactive-error-active',
66
+ ],
51
67
  'error-stroke3': [
68
+ 'stroke-interactive-error',
52
69
  'stroke-interactive-error-strong',
53
70
  'stroke-surface-error-strong',
54
71
  ],
72
+ 'error-stroke4': [ 'stroke-interactive-error-active' ],
55
73
  'error-stroke1': [ 'stroke-surface-error' ],
56
74
  'bg-surface2': [ 'bg-surface-neutral' ],
57
75
  'bg-surface6': [
58
76
  'bg-interactive-brand-strong-disabled',
77
+ 'bg-interactive-error-strong-disabled',
59
78
  'bg-interactive-neutral-strong-disabled',
60
79
  ],
61
80
  'bg-surface5': [
62
81
  'bg-interactive-brand-disabled',
63
82
  'bg-interactive-brand-weak-disabled',
83
+ 'bg-interactive-error-disabled',
84
+ 'bg-interactive-error-weak-disabled',
64
85
  'bg-interactive-neutral-disabled',
65
86
  'bg-interactive-neutral-weak-disabled',
66
87
  ],
@@ -71,17 +92,19 @@ export default {
71
92
  'bg-surface3': [ 'bg-surface-neutral-strong' ],
72
93
  'bg-fgSurface4': [
73
94
  'fg-content-neutral',
74
- 'fg-interactive-neutral-active',
75
95
  'fg-interactive-neutral',
96
+ 'fg-interactive-neutral-active',
76
97
  ],
77
98
  'bg-fgSurface3': [
78
99
  'fg-content-neutral-weak',
79
100
  'fg-interactive-brand-strong-disabled',
101
+ 'fg-interactive-error-strong-disabled',
80
102
  'fg-interactive-neutral-strong-disabled',
81
103
  'fg-interactive-neutral-weak',
82
104
  ],
83
105
  'bg-fgSurface2': [
84
106
  'fg-interactive-brand-disabled',
107
+ 'fg-interactive-error-disabled',
85
108
  'fg-interactive-neutral-disabled',
86
109
  'fg-interactive-neutral-weak-disabled',
87
110
  ],
@@ -98,7 +121,6 @@ export default {
98
121
  'bg-stroke2': [
99
122
  'bg-thumb-brand-disabled',
100
123
  'bg-track-neutral',
101
- 'stroke-interactive-brand-disabled',
102
124
  'stroke-interactive-neutral-disabled',
103
125
  'stroke-surface-neutral',
104
126
  ],
@@ -106,8 +128,8 @@ export default {
106
128
  'bg-bgFillInverted2': [ 'bg-interactive-neutral-strong-active' ],
107
129
  'bg-bgFillInverted1': [ 'bg-interactive-neutral-strong' ],
108
130
  'bg-fgFillInverted': [
109
- 'fg-interactive-neutral-strong-active',
110
131
  'fg-interactive-neutral-strong',
132
+ 'fg-interactive-neutral-strong-active',
111
133
  ],
112
134
  'bg-surface1': [ 'bg-surface-neutral-weak' ],
113
135
  'caution-surface2': [ 'bg-surface-caution-weak' ],
@@ -0,0 +1,125 @@
1
+ /**
2
+ * This file is generated by the @wordpress/terrazzo-plugin-typescript-types plugin.
3
+ * Do not edit this file directly.
4
+ */
5
+
6
+ /**
7
+ * Size scale for padding tokens.
8
+ */
9
+ export type PaddingSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg';
10
+
11
+ /**
12
+ * Size scale for gap tokens.
13
+ */
14
+ export type GapSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
15
+
16
+ /**
17
+ * Size scale for border radius tokens.
18
+ */
19
+ export type BorderRadiusSize = 'xs' | 'sm' | 'md' | 'lg';
20
+
21
+ /**
22
+ * Size scale for border width tokens.
23
+ */
24
+ export type BorderWidthSize = 'xs' | 'sm' | 'md' | 'lg';
25
+
26
+ /**
27
+ * Target elements that tokens can be applied to.
28
+ */
29
+ export type Target =
30
+ | 'surface'
31
+ | 'interactive'
32
+ | 'track'
33
+ | 'thumb'
34
+ | 'content'
35
+ | 'focus';
36
+
37
+ /**
38
+ * Background color variants for surface elements.
39
+ */
40
+ export type SurfaceBackgroundColor =
41
+ | 'neutral'
42
+ | 'neutral-strong'
43
+ | 'neutral-weak'
44
+ | 'brand'
45
+ | 'success'
46
+ | 'success-weak'
47
+ | 'info'
48
+ | 'info-weak'
49
+ | 'warning'
50
+ | 'warning-weak'
51
+ | 'caution'
52
+ | 'caution-weak'
53
+ | 'error'
54
+ | 'error-weak';
55
+
56
+ /**
57
+ * Background color variants for interactive elements.
58
+ */
59
+ export type InteractiveBackgroundColor =
60
+ | 'neutral'
61
+ | 'neutral-strong'
62
+ | 'neutral-weak'
63
+ | 'brand'
64
+ | 'brand-strong'
65
+ | 'brand-weak'
66
+ | 'error'
67
+ | 'error-strong'
68
+ | 'error-weak';
69
+
70
+ /**
71
+ * Foreground color variants for content text and icons.
72
+ */
73
+ export type ContentForegroundColor =
74
+ | 'neutral'
75
+ | 'neutral-weak'
76
+ | 'success'
77
+ | 'success-weak'
78
+ | 'info'
79
+ | 'info-weak'
80
+ | 'warning'
81
+ | 'warning-weak'
82
+ | 'caution'
83
+ | 'caution-weak'
84
+ | 'error'
85
+ | 'error-weak';
86
+
87
+ /**
88
+ * Foreground color variants for interactive element text and icons.
89
+ */
90
+ export type InteractiveForegroundColor =
91
+ | 'neutral'
92
+ | 'neutral-strong'
93
+ | 'neutral-weak'
94
+ | 'brand'
95
+ | 'brand-strong'
96
+ | 'error'
97
+ | 'error-strong';
98
+
99
+ /**
100
+ * Stroke color variants for surface borders.
101
+ */
102
+ export type SurfaceStrokeColor =
103
+ | 'neutral'
104
+ | 'neutral-weak'
105
+ | 'neutral-strong'
106
+ | 'brand'
107
+ | 'brand-strong'
108
+ | 'success'
109
+ | 'success-strong'
110
+ | 'info'
111
+ | 'info-strong'
112
+ | 'warning'
113
+ | 'warning-strong'
114
+ | 'error'
115
+ | 'error-strong';
116
+
117
+ /**
118
+ * Stroke color variants for interactive element borders.
119
+ */
120
+ export type InteractiveStrokeColor =
121
+ | 'neutral'
122
+ | 'neutral-strong'
123
+ | 'brand'
124
+ | 'error'
125
+ | 'error-strong';
@@ -1,49 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { writeFile } from 'node:fs/promises';
5
- import { dirname, join } from 'node:path';
6
- import { fileURLToPath } from 'node:url';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import {
12
- DEFAULT_SEED_COLORS,
13
- buildBgRamp,
14
- buildAccentRamp,
15
- } from '../../src/color-ramps/index.ts';
16
-
17
- const __dirname = dirname( fileURLToPath( import.meta.url ) );
18
-
19
- const bgRamp = buildBgRamp( DEFAULT_SEED_COLORS.bg );
20
- const accentRamps = Object.fromEntries(
21
- [ ...Object.entries( DEFAULT_SEED_COLORS ) ]
22
- .filter( ( [ scaleName ] ) => scaleName !== 'bg' )
23
- .map( ( [ scaleName, seed ] ) => [
24
- scaleName,
25
- buildAccentRamp( seed, bgRamp ),
26
- ] )
27
- );
28
-
29
- const ramps = { bg: bgRamp, ...accentRamps };
30
-
31
- const outputPath = join(
32
- __dirname,
33
- '../../src/color-ramps/lib/default-ramps.ts'
34
- );
35
-
36
- const content = `
37
- /**
38
- * Internal dependencies
39
- */
40
- import type { RampResult } from './types';
41
- import type { DEFAULT_SEED_COLORS } from './constants';
42
-
43
- export const DEFAULT_RAMPS: Record<
44
- keyof typeof DEFAULT_SEED_COLORS,
45
- RampResult
46
- > = ${ JSON.stringify( ramps ) };
47
- `;
48
-
49
- await writeFile( outputPath, content );
@@ -1,120 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import fs from 'fs';
5
- import path from 'path';
6
- import { fileURLToPath } from 'url';
7
- import {
8
- parse,
9
- to,
10
- serialize,
11
- OKLCH,
12
- sRGB,
13
- type PlainColorObject,
14
- } from 'colorjs.io/fn';
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
- import '../../src/color-ramps/lib/register-color-spaces';
20
- import {
21
- DEFAULT_SEED_COLORS,
22
- buildBgRamp,
23
- buildAccentRamp,
24
- } from '../../src/color-ramps/index';
25
-
26
- const __filename = fileURLToPath( import.meta.url );
27
- const __dirname = path.dirname( __filename );
28
-
29
- // Path to the color.json file
30
- const colorJsonPath = path.join( __dirname, '../../tokens/color.json' );
31
-
32
- const transformColorStringToDTCGValue = ( color: string ) => {
33
- if ( /oklch|p3/.test( color ) ) {
34
- let parsed: PlainColorObject;
35
- try {
36
- parsed = to( parse( color ), OKLCH );
37
- } catch {
38
- return color;
39
- }
40
-
41
- const coords = parsed.coords;
42
- return {
43
- colorSpace: 'oklch',
44
- components: [
45
- Math.floor( 10000 * coords[ 0 ] ) / 10000, // l
46
- coords[ 1 ], // c
47
- isNaN( coords[ 2 ] ) ? 0 : coords[ 2 ], // h
48
- ],
49
- ...( parsed.alpha < 1 ? { alpha: parsed.alpha } : undefined ),
50
- hex: serialize( to( parsed, sRGB ), { format: 'hex' } ),
51
- };
52
- }
53
-
54
- return color;
55
- };
56
-
57
- // Main function
58
- function generatePrimitiveColorTokens() {
59
- const startTime = performance.now();
60
- console.log( '🎨 Starting primitive color tokens generation...' );
61
-
62
- try {
63
- // Read the color.json file
64
- const colorJson = JSON.parse(
65
- fs.readFileSync( colorJsonPath, 'utf8' )
66
- );
67
-
68
- // Build the ramps
69
- const bgRamp = buildBgRamp( DEFAULT_SEED_COLORS.bg );
70
- const accentRamps = [ ...Object.entries( DEFAULT_SEED_COLORS ) ]
71
- .filter( ( [ scaleName ] ) => scaleName !== 'bg' )
72
- .map( ( [ scaleName, seed ] ) => ( {
73
- scaleName,
74
- ramp: buildAccentRamp( seed, bgRamp ),
75
- } ) );
76
-
77
- // Convert the ramp values in a DTCG compatible format
78
- [
79
- {
80
- scaleName: 'bg',
81
- ramp: bgRamp,
82
- },
83
- ...accentRamps,
84
- ].forEach( ( { scaleName, ramp } ) => {
85
- colorJson.color.primitive[ scaleName ] = {};
86
- for ( const [ tokenName, tokenValue ] of Object.entries(
87
- ramp.ramp
88
- ) ) {
89
- colorJson.color.primitive[ scaleName ][ tokenName ] = {
90
- $value: transformColorStringToDTCGValue( tokenValue ),
91
- };
92
- }
93
- } );
94
-
95
- // Write the updated JSON back to the file with proper formatting
96
- fs.writeFileSync(
97
- colorJsonPath,
98
- JSON.stringify( colorJson, null, '\t' )
99
- );
100
-
101
- const endTime = performance.now();
102
- const duration = endTime - startTime;
103
- console.log(
104
- `✅ Successfully updated color.json (${ duration.toFixed( 2 ) }ms)`
105
- );
106
- } catch ( error ) {
107
- const endTime = performance.now();
108
- const duration = endTime - startTime;
109
- console.error(
110
- `❌ Error updating color tokens after ${ duration.toFixed(
111
- 2
112
- ) }ms:`,
113
- error
114
- );
115
- process.exit( 1 );
116
- }
117
- }
118
-
119
- // Run the script
120
- generatePrimitiveColorTokens();