@wordpress/theme 0.4.0 → 0.4.1-next.76cff8c98.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 (184) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +97 -33
  4. package/build/color-ramps/{index.js → index.cjs} +9 -9
  5. package/build/color-ramps/index.cjs.map +7 -0
  6. package/build/color-ramps/lib/{color-utils.js → color-utils.cjs} +3 -3
  7. package/build/color-ramps/lib/color-utils.cjs.map +7 -0
  8. package/build/color-ramps/lib/{constants.js → constants.cjs} +2 -2
  9. package/build/color-ramps/lib/{default-ramps.js → default-ramps.cjs} +1 -1
  10. package/build/color-ramps/lib/{find-color-with-constraints.js → find-color-with-constraints.cjs} +6 -6
  11. package/build/color-ramps/lib/{index.js → index.cjs} +7 -7
  12. package/build/color-ramps/lib/index.cjs.map +7 -0
  13. package/build/color-ramps/lib/{ramp-configs.js → ramp-configs.cjs} +1 -1
  14. package/build/color-ramps/lib/{register-color-spaces.js → register-color-spaces.cjs} +1 -1
  15. package/build/color-ramps/lib/{taper-chroma.js → taper-chroma.cjs} +4 -4
  16. package/build/color-ramps/lib/{taper-chroma.js.map → taper-chroma.cjs.map} +2 -2
  17. package/build/color-ramps/lib/{types.js → types.cjs} +1 -1
  18. package/build/color-ramps/lib/{utils.js → utils.cjs} +4 -4
  19. package/build/{context.js → context.cjs} +1 -1
  20. package/build/{index.js → index.cjs} +2 -2
  21. package/build/index.cjs.map +7 -0
  22. package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
  23. package/build/prebuilt/js/{design-tokens.js → design-tokens.cjs} +16 -14
  24. package/build/prebuilt/js/design-tokens.cjs.map +7 -0
  25. package/build/prebuilt/ts/{color-tokens.js → color-tokens.cjs} +1 -1
  26. package/build/prebuilt/ts/color-tokens.cjs.map +7 -0
  27. package/build/prebuilt/ts/token-types.cjs +18 -0
  28. package/build/prebuilt/ts/token-types.cjs.map +7 -0
  29. package/build/{private-apis.js → private-apis.cjs} +4 -4
  30. package/build/stylelint-plugins/no-setting-wpds-custom-properties.cjs +69 -0
  31. package/build/stylelint-plugins/no-setting-wpds-custom-properties.cjs.map +7 -0
  32. package/build/stylelint-plugins/no-unknown-ds-tokens.cjs +98 -0
  33. package/build/stylelint-plugins/no-unknown-ds-tokens.cjs.map +7 -0
  34. package/build/{theme-provider.js → theme-provider.cjs} +3 -3
  35. package/build/{types.js → types.cjs} +1 -1
  36. package/build/{use-theme-provider-styles.js → use-theme-provider-styles.cjs} +19 -35
  37. package/build/use-theme-provider-styles.cjs.map +7 -0
  38. package/build-module/color-ramps/{index.js → index.mjs} +10 -10
  39. package/build-module/color-ramps/index.mjs.map +7 -0
  40. package/build-module/color-ramps/lib/{color-utils.js → color-utils.mjs} +3 -3
  41. package/build-module/color-ramps/lib/color-utils.mjs.map +7 -0
  42. package/build-module/color-ramps/lib/{constants.js → constants.mjs} +2 -2
  43. package/build-module/color-ramps/lib/{default-ramps.js → default-ramps.mjs} +1 -1
  44. package/build-module/color-ramps/lib/{find-color-with-constraints.js → find-color-with-constraints.mjs} +6 -6
  45. package/build-module/color-ramps/lib/{index.js → index.mjs} +7 -8
  46. package/build-module/color-ramps/lib/index.mjs.map +7 -0
  47. package/build-module/color-ramps/lib/{ramp-configs.js → ramp-configs.mjs} +1 -1
  48. package/build-module/color-ramps/lib/{register-color-spaces.js → register-color-spaces.mjs} +1 -1
  49. package/build-module/color-ramps/lib/{taper-chroma.js → taper-chroma.mjs} +4 -4
  50. package/build-module/color-ramps/lib/{taper-chroma.js.map → taper-chroma.mjs.map} +2 -2
  51. package/build-module/color-ramps/lib/types.mjs +1 -0
  52. package/build-module/color-ramps/lib/{utils.js → utils.mjs} +4 -4
  53. package/build-module/{context.js → context.mjs} +1 -1
  54. package/build-module/index.mjs +6 -0
  55. package/build-module/index.mjs.map +7 -0
  56. package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
  57. package/build-module/prebuilt/js/{design-tokens.js → design-tokens.mjs} +16 -14
  58. package/build-module/prebuilt/js/design-tokens.mjs.map +7 -0
  59. package/build-module/prebuilt/ts/{color-tokens.js → color-tokens.mjs} +1 -1
  60. package/build-module/prebuilt/ts/color-tokens.mjs.map +7 -0
  61. package/build-module/prebuilt/ts/token-types.mjs +1 -0
  62. package/build-module/{private-apis.js → private-apis.mjs} +4 -4
  63. package/build-module/stylelint-plugins/no-setting-wpds-custom-properties.mjs +39 -0
  64. package/build-module/stylelint-plugins/no-setting-wpds-custom-properties.mjs.map +7 -0
  65. package/build-module/stylelint-plugins/no-unknown-ds-tokens.mjs +68 -0
  66. package/build-module/stylelint-plugins/no-unknown-ds-tokens.mjs.map +7 -0
  67. package/build-module/{theme-provider.js → theme-provider.mjs} +3 -3
  68. package/build-module/types.mjs +1 -0
  69. package/build-module/types.mjs.map +7 -0
  70. package/build-module/{use-theme-provider-styles.js → use-theme-provider-styles.mjs} +21 -37
  71. package/build-module/use-theme-provider-styles.mjs.map +7 -0
  72. package/build-types/color-ramps/lib/color-utils.d.ts +1 -1
  73. package/build-types/color-ramps/lib/color-utils.d.ts.map +1 -1
  74. package/build-types/color-ramps/lib/constants.d.ts +2 -2
  75. package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
  76. package/build-types/color-ramps/lib/index.d.ts.map +1 -1
  77. package/build-types/color-ramps/stories/index.story.d.ts +1 -1
  78. package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
  79. package/build-types/index.d.ts +2 -0
  80. package/build-types/index.d.ts.map +1 -1
  81. package/build-types/prebuilt/js/{design-tokens.d.ts → design-tokens.d.mts} +1 -1
  82. package/build-types/prebuilt/js/design-tokens.d.mts.map +1 -0
  83. package/build-types/prebuilt/ts/color-tokens.d.ts +0 -4
  84. package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -1
  85. package/build-types/prebuilt/ts/token-types.d.ts +65 -0
  86. package/build-types/prebuilt/ts/token-types.d.ts.map +1 -0
  87. package/build-types/stories/index.story.d.ts +1 -1
  88. package/build-types/stories/index.story.d.ts.map +1 -1
  89. package/build-types/stylelint-plugins/no-setting-wpds-custom-properties.d.mts +4 -0
  90. package/build-types/stylelint-plugins/no-setting-wpds-custom-properties.d.mts.map +1 -0
  91. package/build-types/stylelint-plugins/no-unknown-ds-tokens.d.mts +4 -0
  92. package/build-types/stylelint-plugins/no-unknown-ds-tokens.d.mts.map +1 -0
  93. package/build-types/use-theme-provider-styles.d.ts.map +1 -1
  94. package/package.json +42 -12
  95. package/src/color-ramps/index.ts +2 -2
  96. package/src/color-ramps/lib/color-utils.ts +1 -1
  97. package/src/color-ramps/lib/index.ts +1 -2
  98. package/src/color-ramps/lib/taper-chroma.ts +2 -2
  99. package/src/color-ramps/stories/index.story.tsx +1 -1
  100. package/src/color-ramps/test/__snapshots__/index.test.ts.snap +7060 -7041
  101. package/src/color-ramps/test/index.test.ts +14 -23
  102. package/src/index.ts +2 -1
  103. package/src/prebuilt/css/design-tokens.css +14 -12
  104. package/src/prebuilt/js/{design-tokens.js → design-tokens.mjs} +16 -14
  105. package/src/prebuilt/ts/color-tokens.ts +1 -1
  106. package/src/prebuilt/ts/token-types.ts +179 -0
  107. package/src/stories/index.story.tsx +1 -1
  108. package/src/stylelint-plugins/no-setting-wpds-custom-properties.mjs +45 -0
  109. package/src/stylelint-plugins/no-unknown-ds-tokens.mjs +101 -0
  110. package/src/stylelint-plugins/test/.stylelintignore +1 -0
  111. package/src/stylelint-plugins/test/.stylelintrc.json +10 -0
  112. package/src/stylelint-plugins/test/__snapshots__/no-setting-wpds-custom-properties.test.ts.snap +24 -0
  113. package/src/stylelint-plugins/test/__snapshots__/no-unknown-ds-tokens.test.ts.snap +24 -0
  114. package/src/stylelint-plugins/test/fixtures/no-setting-wpds-custom-properties-invalid.css +9 -0
  115. package/src/stylelint-plugins/test/fixtures/no-setting-wpds-custom-properties-valid.css +12 -0
  116. package/src/stylelint-plugins/test/fixtures/no-unknown-ds-tokens-invalid.css +9 -0
  117. package/src/stylelint-plugins/test/fixtures/no-unknown-ds-tokens-valid.css +19 -0
  118. package/src/stylelint-plugins/test/no-setting-wpds-custom-properties.test.ts +47 -0
  119. package/src/stylelint-plugins/test/no-unknown-ds-tokens.test.ts +47 -0
  120. package/src/stylelint-plugins/test/utils/index.ts +29 -0
  121. package/src/use-theme-provider-styles.ts +19 -30
  122. package/bin/generate-default-ramps/index.ts +0 -49
  123. package/bin/generate-primitive-tokens/index.ts +0 -113
  124. package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +0 -84
  125. package/bin/terrazzo-plugin-inline-alias-values/index.ts +0 -113
  126. package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +0 -52
  127. package/bin/terrazzo-plugin-mode-overrides/index.ts +0 -208
  128. package/build/color-ramps/index.js.map +0 -7
  129. package/build/color-ramps/lib/color-utils.js.map +0 -7
  130. package/build/color-ramps/lib/index.js.map +0 -7
  131. package/build/index.js.map +0 -7
  132. package/build/prebuilt/js/design-tokens.js.map +0 -7
  133. package/build/prebuilt/ts/color-tokens.js.map +0 -7
  134. package/build/use-theme-provider-styles.js.map +0 -7
  135. package/build-module/color-ramps/index.js.map +0 -7
  136. package/build-module/color-ramps/lib/color-utils.js.map +0 -7
  137. package/build-module/color-ramps/lib/index.js.map +0 -7
  138. package/build-module/color-ramps/lib/types.js +0 -1
  139. package/build-module/index.js +0 -6
  140. package/build-module/index.js.map +0 -7
  141. package/build-module/prebuilt/js/design-tokens.js.map +0 -7
  142. package/build-module/prebuilt/ts/color-tokens.js.map +0 -7
  143. package/build-module/types.js +0 -1
  144. package/build-module/use-theme-provider-styles.js.map +0 -7
  145. package/build-types/prebuilt/js/design-tokens.d.ts.map +0 -1
  146. package/docs/ds-tokens.md +0 -176
  147. package/terrazzo.config.ts +0 -123
  148. package/tokens/border.json +0 -56
  149. package/tokens/color.json +0 -1559
  150. package/tokens/dimension.json +0 -169
  151. package/tokens/elevation.json +0 -201
  152. package/tokens/modes/border.high-dpi.json +0 -15
  153. package/tokens/modes/dimension.comfortable.json +0 -54
  154. package/tokens/modes/dimension.compact.json +0 -54
  155. package/tokens/typography.json +0 -93
  156. package/tsconfig.bin.json +0 -13
  157. package/tsconfig.bin.tsbuildinfo +0 -1
  158. package/tsconfig.json +0 -11
  159. package/tsconfig.src.json +0 -9
  160. package/tsconfig.src.tsbuildinfo +0 -1
  161. /package/build/color-ramps/lib/{constants.js.map → constants.cjs.map} +0 -0
  162. /package/build/color-ramps/lib/{default-ramps.js.map → default-ramps.cjs.map} +0 -0
  163. /package/build/color-ramps/lib/{find-color-with-constraints.js.map → find-color-with-constraints.cjs.map} +0 -0
  164. /package/build/color-ramps/lib/{ramp-configs.js.map → ramp-configs.cjs.map} +0 -0
  165. /package/build/color-ramps/lib/{register-color-spaces.js.map → register-color-spaces.cjs.map} +0 -0
  166. /package/build/color-ramps/lib/{types.js.map → types.cjs.map} +0 -0
  167. /package/build/color-ramps/lib/{utils.js.map → utils.cjs.map} +0 -0
  168. /package/build/{context.js.map → context.cjs.map} +0 -0
  169. /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
  170. /package/build/{private-apis.js.map → private-apis.cjs.map} +0 -0
  171. /package/build/{theme-provider.js.map → theme-provider.cjs.map} +0 -0
  172. /package/build/{types.js.map → types.cjs.map} +0 -0
  173. /package/build-module/color-ramps/lib/{constants.js.map → constants.mjs.map} +0 -0
  174. /package/build-module/color-ramps/lib/{default-ramps.js.map → default-ramps.mjs.map} +0 -0
  175. /package/build-module/color-ramps/lib/{find-color-with-constraints.js.map → find-color-with-constraints.mjs.map} +0 -0
  176. /package/build-module/color-ramps/lib/{ramp-configs.js.map → ramp-configs.mjs.map} +0 -0
  177. /package/build-module/color-ramps/lib/{register-color-spaces.js.map → register-color-spaces.mjs.map} +0 -0
  178. /package/build-module/color-ramps/lib/{types.js.map → types.mjs.map} +0 -0
  179. /package/build-module/color-ramps/lib/{utils.js.map → utils.mjs.map} +0 -0
  180. /package/build-module/{context.js.map → context.mjs.map} +0 -0
  181. /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
  182. /package/build-module/{types.js.map → prebuilt/ts/token-types.mjs.map} +0 -0
  183. /package/build-module/{private-apis.js.map → private-apis.mjs.map} +0 -0
  184. /package/build-module/{theme-provider.js.map → theme-provider.mjs.map} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.4.0-next.0 (2026-01-07)
6
+
7
+ ### New Features
8
+
9
+ - Added stylelint plugins for design token linting: `no-unknown-ds-tokens` to catch references to non-existent design tokens, and `no-setting-wpds-custom-properties` to prevent reassignments of design token variables ([#74226](https://github.com/WordPress/gutenberg/pull/74226)).
10
+ - Expose `ThemeProvider` TypeScript type from package. While the component is still experimental, this makes it easier to use TypeScript typings in your code, which would otherwise be inaccessible. ([#74011](https://github.com/WordPress/gutenberg/pull/74011))
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2025 by the contributors
3
+ Copyright 2016-2026 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
package/README.md CHANGED
@@ -6,8 +6,8 @@ This package is still experimental. “Experimental” means this is an early im
6
6
 
7
7
  A theming package that's part of the WordPress Design System. It has two parts:
8
8
 
9
- - **Design Tokens**: A comprehensive system of design tokens for colors, spacing, typography, and more
10
- - **Theme System**: A flexible theming provider for consistent theming across applications
9
+ - **Design Tokens**: A comprehensive system of design tokens for colors, spacing, typography, and more.
10
+ - **Theme System**: A flexible theming provider for consistent theming across applications.
11
11
 
12
12
  ## Design Tokens
13
13
 
@@ -76,14 +76,14 @@ Semantic tokens follow a consistent naming pattern:
76
76
 
77
77
  **Target** is the component or element type the token applies to.
78
78
 
79
- | Value | Description |
80
- | ------------- | ------------------------------------------------------------ |
81
- | `surface` | Container or layout backgrounds and borders |
82
- | `interactive` | Interactive elements like buttons, inputs, and controls |
83
- | `content` | Static content like text and icons |
84
- | `track` | Track components like scrollbars and slider tracks |
85
- | `thumb` | Thumb components like scrollbar thumbs and slider handles |
86
- | `focus` | Focus indicators and rings |
79
+ | Value | Description |
80
+ | ------------- | --------------------------------------------------------- |
81
+ | `surface` | Container or layout backgrounds and borders |
82
+ | `interactive` | Interactive elements like buttons, inputs, and controls |
83
+ | `content` | Static content like text and icons |
84
+ | `track` | Track components like scrollbars and slider tracks |
85
+ | `thumb` | Thumb components like scrollbar thumbs and slider handles |
86
+ | `focus` | Focus indicators and rings |
87
87
 
88
88
  **Modifier** is an optional size or intensity modifier.
89
89
 
@@ -101,15 +101,15 @@ Color tokens extend the base pattern with additional modifiers for tone, emphasi
101
101
 
102
102
  **Tone** defines the semantic intent of the color.
103
103
 
104
- | Value | Description |
105
- | --------- | ---------------------------------------------------------------------------------------- |
106
- | `neutral` | Neutrally toned UI elements. |
107
- | `brand` | Brand-accented or primary action colors. |
108
- | `success` | Positive or completed states. |
109
- | `info` | Informational or system-generated context. |
110
- | `caution` | Heads-up or low-severity issues; “proceed carefully.” |
111
- | `warning` | Higher-severity or time-sensitive issues that require user attention but are not errors. |
112
- | `error` | Blocking issues, validation failures, or destructive actions. |
104
+ | Value | Description |
105
+ | --------- | --------------------------------------------------------------------------------------- |
106
+ | `neutral` | Neutrally toned UI elements |
107
+ | `brand` | Brand-accented or primary action colors |
108
+ | `success` | Positive or completed states |
109
+ | `info` | Informational or system-generated context |
110
+ | `caution` | Heads-up or low-severity issues; “proceed carefully |
111
+ | `warning` | Higher-severity or time-sensitive issues that require user attention but are not errors |
112
+ | `error` | Blocking issues, validation failures, or destructive actions |
113
113
 
114
114
  > [!NOTE]
115
115
  > `caution` and `warning` represent two escalation levels of non-error severity.
@@ -117,17 +117,17 @@ Color tokens extend the base pattern with additional modifiers for tone, emphasi
117
117
 
118
118
  **Emphasis** adjusts color strength relative to the base tone, if specified. The default is a normal emphasis.
119
119
 
120
- | Value | Description |
121
- | -------------------- | ----------------------------------------------- |
122
- | `strong` | Higher contrast and/or elevated emphasis. |
123
- | `weak` | Subtle variant for secondary or muted elements. |
120
+ | Value | Description |
121
+ | -------------------- | ---------------------------------------------- |
122
+ | `strong` | Higher contrast and/or elevated emphasis |
123
+ | `weak` | Subtle variant for secondary or muted elements |
124
124
 
125
125
  **State** represents the interactive state of the element, if specified. The default is an idle state.
126
126
 
127
- | Value | Description |
128
- | ---------- | ---------------------------------------- |
129
- | `active` | Hovered, pressed, or selected state. |
130
- | `disabled` | Unavailable or inoperable state. |
127
+ | Value | Description |
128
+ | ---------- | ----------------------------------- |
129
+ | `active` | Hovered, pressed, or selected state |
130
+ | `disabled` | Unavailable or inoperable state |
131
131
 
132
132
  ## Theme Provider
133
133
 
@@ -138,7 +138,7 @@ import { ThemeProvider } from '@wordpress/theme';
138
138
 
139
139
  function App() {
140
140
  return (
141
- <ThemeProvider color={ { primary: 'blue' } }>
141
+ <ThemeProvider color={ { primary: 'blue' } } density="compact">
142
142
  { /* Your app content */ }
143
143
  </ThemeProvider>
144
144
  );
@@ -147,11 +147,21 @@ function App() {
147
147
 
148
148
  The `color` prop accepts an object with the following optional properties:
149
149
 
150
- - `primary`: The primary/accent seed color (default: `'#3858e9'`)
151
- - `bg`: The background seed color (default: `'#f8f8f8'`)
150
+ - `primary`: The primary/accent seed color (default: `'#3858e9'`).
151
+ - `bg`: The background seed color (default: `'#f8f8f8'`).
152
152
 
153
153
  Both properties accept any valid CSS color value. The theme system automatically generates appropriate color ramps and determines light/dark mode based on these seed colors.
154
154
 
155
+ The `density` prop controls the spacing scale throughout the UI:
156
+
157
+ - `'default'`: Standard spacing for general use.
158
+ - `'compact'`: Reduced spacing for information-dense interfaces like data tables or dashboards.
159
+ - `'comfortable'`: Increased spacing for focused experiences like modals, dialogs, or full-screen settings panels.
160
+
161
+ The density setting adjusts dimension tokens like gaps and paddings to maintain consistent spacing throughout the UI. Changing the density automatically updates spacing of all components that use these tokens.
162
+
163
+ When the `color` or `density` prop is omitted, the theme inherits the value from the closest parent `ThemeProvider`, or uses the default value if none is inherited.
164
+
155
165
  ### Nesting Providers
156
166
 
157
167
  The provider can be used recursively to override or modify the theme for a specific subtree.
@@ -159,10 +169,10 @@ The provider can be used recursively to override or modify the theme for a speci
159
169
  ```tsx
160
170
  <ThemeProvider color={ { bg: 'white' } }>
161
171
  { /* light-themed UI components */ }
162
- <ThemeProvider color={ { bg: '#1e1e1e' } }>
163
- { /* dark-themed UI components */ }
172
+ <ThemeProvider color={ { bg: '#1e1e1e' } } density="compact">
173
+ { /* dark-themed UI components with compact spacing */ }
164
174
  <ThemeProvider color={ { primary: 'red' } }>
165
- { /* dark-themed with red accent */ }
175
+ { /* dark-themed with red accent, inheriting compact density */ }
166
176
  </ThemeProvider>
167
177
  </ThemeProvider>
168
178
  { /* light-themed UI components */ }
@@ -186,6 +196,60 @@ The files generated in this step will all be committed to the repo.
186
196
 
187
197
  After the prebuild step, the package will be built into its final form via the repo's standard package build script.
188
198
 
199
+ ## Stylelint Plugins
200
+
201
+ This package provides Stylelint plugins to help enforce consistent usage of design tokens. To use them, add the plugins to your Stylelint configuration:
202
+
203
+ ```json
204
+ {
205
+ "plugins": [
206
+ "@wordpress/theme/stylelint-plugins/no-unknown-ds-tokens",
207
+ "@wordpress/theme/stylelint-plugins/no-setting-wpds-custom-properties"
208
+ ],
209
+ "rules": {
210
+ "plugin-wpds/no-unknown-ds-tokens": true,
211
+ "plugin-wpds/no-setting-wpds-custom-properties": true
212
+ }
213
+ }
214
+ ```
215
+
216
+ ### `plugin-wpds/no-unknown-ds-tokens`
217
+
218
+ This rule reports an error when a CSS value references a `--wpds-*` custom property that is not a valid design token. This helps catch typos and ensures that only valid design tokens are used.
219
+
220
+ ```css
221
+ /* ✗ Error: '--wpds-unknown-token' is not a valid Design System token */
222
+ .example {
223
+ color: var(--wpds-unknown-token);
224
+ }
225
+
226
+ /* ✓ OK */
227
+ .example {
228
+ color: var(--wpds-color-fg-content-neutral);
229
+ }
230
+ ```
231
+
232
+ ### `plugin-wpds/no-setting-wpds-custom-properties`
233
+
234
+ This rule reports an error when a CSS declaration sets (defines) a custom property in the `--wpds-*` namespace. The design system tokens should only be consumed, not defined or overridden in consuming code.
235
+
236
+ ```css
237
+ /* ✗ Error: Do not set CSS custom properties using the Design System tokens namespace */
238
+ .example {
239
+ --wpds-my-token: red;
240
+ }
241
+
242
+ /* ✗ Error: Overriding existing tokens is also not allowed */
243
+ .example {
244
+ --wpds-color-fg-content-neutral: red;
245
+ }
246
+
247
+ /* ✓ OK */
248
+ .example {
249
+ --my-custom-token: red;
250
+ }
251
+ ```
252
+
189
253
  ## Contributing to this package
190
254
 
191
255
  This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
@@ -26,13 +26,13 @@ __export(color_ramps_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(color_ramps_exports);
28
28
  var import_fn = require("colorjs.io/fn");
29
- var import_register_color_spaces = require("./lib/register-color-spaces");
30
- var import_lib = require("./lib/index");
31
- var import_utils = require("./lib/utils");
32
- var import_ramp_configs = require("./lib/ramp-configs");
33
- var import_color_utils = require("./lib/color-utils");
34
- var import_constants = require("./lib/constants");
35
- var import_constants2 = require("./lib/constants");
29
+ var import_register_color_spaces = require("./lib/register-color-spaces.cjs");
30
+ var import_lib = require("./lib/index.cjs");
31
+ var import_utils = require("./lib/utils.cjs");
32
+ var import_ramp_configs = require("./lib/ramp-configs.cjs");
33
+ var import_color_utils = require("./lib/color-utils.cjs");
34
+ var import_constants = require("./lib/constants.cjs");
35
+ var import_constants2 = require("./lib/constants.cjs");
36
36
  function buildBgRamp(seed) {
37
37
  if (typeof seed !== "string" || seed.trim() === "") {
38
38
  throw new Error("Seed color must be a non-empty string");
@@ -46,7 +46,7 @@ function getBgRampInfo(ramp) {
46
46
  pinLightness: {
47
47
  stepName: STEP_TO_PIN,
48
48
  value: (0, import_utils.clampAccentScaleReferenceLightness)(
49
- (0, import_fn.get)((0, import_fn.parse)(ramp.ramp[STEP_TO_PIN]), [import_fn.OKLCH, "l"]),
49
+ (0, import_fn.get)(ramp.ramp[STEP_TO_PIN], [import_fn.OKLCH, "l"]),
50
50
  ramp.direction
51
51
  )
52
52
  }
@@ -115,4 +115,4 @@ function checkAccessibleCombinations({
115
115
  buildBgRamp,
116
116
  checkAccessibleCombinations
117
117
  });
118
- //# sourceMappingURL=index.js.map
118
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/color-ramps/index.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { get, OKLCH } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './lib/register-color-spaces';\nimport { buildRamp } from './lib/index';\nimport { clampAccentScaleReferenceLightness } from './lib/utils';\nimport { BG_RAMP_CONFIG, ACCENT_RAMP_CONFIG } from './lib/ramp-configs';\nimport type {\n\tRampResult as InternalRampResult,\n\tRampDirection,\n\tRamp,\n} from './lib/types';\nimport { getContrast } from './lib/color-utils';\nimport { CONTRAST_COMBINATIONS } from './lib/constants';\nexport { DEFAULT_SEED_COLORS } from './lib/constants';\n\n/**\n * Creates a background ramp.\n * @param seed The seed color for the background ramp.\n */\nexport function buildBgRamp( seed: string ) {\n\tif ( typeof seed !== 'string' || seed.trim() === '' ) {\n\t\tthrow new Error( 'Seed color must be a non-empty string' );\n\t}\n\n\treturn buildRamp( seed, BG_RAMP_CONFIG );\n}\n\nconst STEP_TO_PIN = 'surface2';\nfunction getBgRampInfo( ramp: InternalRampResult ): {\n\tmainDirection: RampDirection;\n\tpinLightness: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} {\n\treturn {\n\t\tmainDirection: ramp.direction,\n\t\tpinLightness: {\n\t\t\tstepName: STEP_TO_PIN,\n\t\t\tvalue: clampAccentScaleReferenceLightness(\n\t\t\t\tget( ramp.ramp[ STEP_TO_PIN ], [ OKLCH, 'l' ] ),\n\t\t\t\tramp.direction\n\t\t\t),\n\t\t},\n\t};\n}\n\n/**\n * Creates an accent ramp (ie used by primary, success, info, warning and error\n * ramps).\n * @param seed The seed color for the accent ramp.\n * @param bgRamp The ramp of the background on which the accent is shown.\n */\nexport function buildAccentRamp(\n\tseed: string,\n\tbgRamp?: InternalRampResult\n): InternalRampResult {\n\tif ( typeof seed !== 'string' || seed.trim() === '' ) {\n\t\tthrow new Error( 'Seed color must be a non-empty string' );\n\t}\n\n\tconst bgRampInfo = bgRamp ? getBgRampInfo( bgRamp ) : undefined;\n\treturn buildRamp( seed, ACCENT_RAMP_CONFIG, bgRampInfo );\n}\n\n/**\n * Checks that all bg/fg combinations generated by the ramps meet contrast\n * targets.\n * @param params\n * @param params.bgRamp\n * @param params.accentRamps\n */\nexport function checkAccessibleCombinations( {\n\tbgRamp,\n\taccentRamps = [],\n}: {\n\tbgRamp: InternalRampResult;\n\taccentRamps?: InternalRampResult[];\n} ) {\n\tconst unmetTargets: {\n\t\tbgName: keyof Ramp;\n\t\tbgColor: string;\n\t\tfgName: keyof Ramp;\n\t\tfgColor: string;\n\t\tunmetContrast: number;\n\t\tachievedContrast: number;\n\t}[] = [];\n\n\t// Assess combinations within each ramp\n\t[ bgRamp, ...accentRamps ].forEach( ( ramp ) => {\n\t\tCONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {\n\t\t\tfor ( const bg of bgs ) {\n\t\t\t\tfor ( const fg of fgs ) {\n\t\t\t\t\tconst bgColor = ramp.ramp[ bg ];\n\t\t\t\t\tconst fgColor = ramp.ramp[ fg ];\n\t\t\t\t\tconst achievedContrast = getContrast( bgColor, fgColor );\n\t\t\t\t\tif ( achievedContrast < target ) {\n\t\t\t\t\t\tunmetTargets.push( {\n\t\t\t\t\t\t\tbgName: bg,\n\t\t\t\t\t\t\tbgColor,\n\t\t\t\t\t\t\tfgName: fg,\n\t\t\t\t\t\t\tfgColor,\n\t\t\t\t\t\t\tunmetContrast: target,\n\t\t\t\t\t\t\tachievedContrast,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} );\n\t// Assess each accent ramp's fg color against bg ramp\n\taccentRamps.forEach( ( ramp ) => {\n\t\tCONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {\n\t\t\tfor ( const bg of bgs ) {\n\t\t\t\tfor ( const fg of fgs ) {\n\t\t\t\t\tconst bgColor = bgRamp.ramp[ bg ];\n\t\t\t\t\tconst fgColor = ramp.ramp[ fg ];\n\t\t\t\t\tconst achievedContrast = getContrast( bgColor, fgColor );\n\t\t\t\t\tif ( achievedContrast < target ) {\n\t\t\t\t\t\tunmetTargets.push( {\n\t\t\t\t\t\t\tbgName: bg,\n\t\t\t\t\t\t\tbgColor,\n\t\t\t\t\t\t\tfgName: fg,\n\t\t\t\t\t\t\tfgColor,\n\t\t\t\t\t\t\tunmetContrast: target,\n\t\t\t\t\t\t\tachievedContrast,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn unmetTargets;\n}\n\nexport type RampResult = InternalRampResult;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAA2B;AAK3B,mCAAO;AACP,iBAA0B;AAC1B,mBAAmD;AACnD,0BAAmD;AAMnD,yBAA4B;AAC5B,uBAAsC;AACtC,IAAAA,oBAAoC;AAM7B,SAAS,YAAa,MAAe;AAC3C,MAAK,OAAO,SAAS,YAAY,KAAK,KAAK,MAAM,IAAK;AACrD,UAAM,IAAI,MAAO,uCAAwC;AAAA,EAC1D;AAEA,aAAO,sBAAW,MAAM,kCAAe;AACxC;AAEA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C,gBAAM,UAAU,KAAK,KAAM,EAAG;AAC9B,gBAAM,uBAAmB,gCAAa,SAAS,OAAQ;AACvD,cAAK,mBAAmB,QAAS;AAChC,yBAAa,KAAM;AAAA,cAClB,QAAQ;AAAA,cACR;AAAA,cACA,QAAQ;AAAA,cACR;AAAA,cACA,eAAe;AAAA,cACf;AAAA,YACD,CAAE;AAAA,UACH;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,SAAO;AACR;",
6
+ "names": ["import_constants"]
7
+ }
@@ -25,9 +25,9 @@ __export(color_utils_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(color_utils_exports);
27
27
  var import_fn = require("colorjs.io/fn");
28
- var import_register_color_spaces = require("./register-color-spaces");
28
+ var import_register_color_spaces = require("./register-color-spaces.cjs");
29
29
  function getColorString(color) {
30
- return (0, import_fn.serialize)((0, import_fn.to)(color, import_fn.sRGB), { format: "hex", inGamut: true });
30
+ return (0, import_fn.serialize)(color, { format: "hex", inGamut: true });
31
31
  }
32
32
  function getContrast(colorA, colorB) {
33
33
  return (0, import_fn.contrastWCAG21)(colorA, colorB);
@@ -41,4 +41,4 @@ function clampToGamut(c) {
41
41
  getColorString,
42
42
  getContrast
43
43
  });
44
- //# sourceMappingURL=color-utils.js.map
44
+ //# sourceMappingURL=color-utils.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/color-ramps/lib/color-utils.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tto,\n\ttoGamut,\n\tserialize,\n\tcontrastWCAG21,\n\tsRGB,\n\tOKLCH,\n\ttype ColorTypes,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\n\n/**\n * Get string representation of a color\n * @param color Color object to stringify\n * @return String representation\n */\nexport function getColorString( color: ColorTypes ): string {\n\treturn serialize( color, { format: 'hex', inGamut: true } );\n}\n\n/**\n * Get contrast value between two colors\n * @param colorA First color\n * @param colorB Second color\n * @return WCAG 2.1 contrast ratio\n */\nexport function getContrast( colorA: ColorTypes, colorB: ColorTypes ): number {\n\treturn contrastWCAG21( colorA, colorB );\n}\n\n/**\n * Make sure that a color is valid in the sRGB gamut and convert it to OKLCH.\n * @param c\n */\nexport function clampToGamut( c: ColorTypes ) {\n\t// map into sRGB using CSS OKLCH method\n\treturn to( toGamut( c, { space: sRGB, method: 'css' } ), OKLCH );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAQO;AAKP,mCAAO;AAOA,SAAS,eAAgB,OAA4B;AAC3D,aAAO,qBAAW,OAAO,EAAE,QAAQ,OAAO,SAAS,KAAK,CAAE;AAC3D;AAQO,SAAS,YAAa,QAAoB,QAA6B;AAC7E,aAAO,0BAAgB,QAAQ,MAAO;AACvC;AAMO,SAAS,aAAc,GAAgB;AAE7C,aAAO,kBAAI,mBAAS,GAAG,EAAE,OAAO,gBAAM,QAAQ,MAAM,CAAE,GAAG,eAAM;AAChE;",
6
+ "names": []
7
+ }
@@ -31,7 +31,7 @@ __export(constants_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(constants_exports);
33
33
  var import_fn = require("colorjs.io/fn");
34
- var import_register_color_spaces = require("./register-color-spaces");
34
+ var import_register_color_spaces = require("./register-color-spaces.cjs");
35
35
  var WHITE = (0, import_fn.to)("white", import_fn.OKLCH);
36
36
  var BLACK = (0, import_fn.to)("black", import_fn.OKLCH);
37
37
  var UNIVERSAL_CONTRAST_TOPUP = 0.02;
@@ -95,4 +95,4 @@ var DEFAULT_SEED_COLORS = {
95
95
  WHITE,
96
96
  WHITE_TEXT_CONTRAST_MARGIN
97
97
  });
98
- //# sourceMappingURL=constants.js.map
98
+ //# sourceMappingURL=constants.cjs.map
@@ -217,4 +217,4 @@ var DEFAULT_RAMPS = {
217
217
  0 && (module.exports = {
218
218
  DEFAULT_RAMPS
219
219
  });
220
- //# sourceMappingURL=default-ramps.js.map
220
+ //# sourceMappingURL=default-ramps.cjs.map
@@ -23,11 +23,11 @@ __export(find_color_with_constraints_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(find_color_with_constraints_exports);
25
25
  var import_fn = require("colorjs.io/fn");
26
- var import_register_color_spaces = require("./register-color-spaces");
27
- var import_utils = require("./utils");
28
- var import_constants = require("./constants");
29
- var import_color_utils = require("./color-utils");
30
- var import_taper_chroma = require("./taper-chroma");
26
+ var import_register_color_spaces = require("./register-color-spaces.cjs");
27
+ var import_utils = require("./utils.cjs");
28
+ var import_constants = require("./constants.cjs");
29
+ var import_color_utils = require("./color-utils.cjs");
30
+ var import_taper_chroma = require("./taper-chroma.cjs");
31
31
  function cdiff(c1, c2) {
32
32
  return Math.log(c1 / c2);
33
33
  }
@@ -107,4 +107,4 @@ function findColorMeetingRequirements(reference, seed, target, direction, {
107
107
  0 && (module.exports = {
108
108
  findColorMeetingRequirements
109
109
  });
110
- //# sourceMappingURL=find-color-with-constraints.js.map
110
+ //# sourceMappingURL=find-color-with-constraints.cjs.map
@@ -23,11 +23,11 @@ __export(lib_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(lib_exports);
25
25
  var import_fn = require("colorjs.io/fn");
26
- var import_register_color_spaces = require("./register-color-spaces");
27
- var import_color_utils = require("./color-utils");
28
- var import_find_color_with_constraints = require("./find-color-with-constraints");
29
- var import_utils = require("./utils");
30
- var import_constants = require("./constants");
26
+ var import_register_color_spaces = require("./register-color-spaces.cjs");
27
+ var import_color_utils = require("./color-utils.cjs");
28
+ var import_find_color_with_constraints = require("./find-color-with-constraints.cjs");
29
+ var import_utils = require("./utils.cjs");
30
+ var import_constants = require("./constants.cjs");
31
31
  function calculateRamp({
32
32
  seed,
33
33
  sortedSteps,
@@ -143,7 +143,7 @@ function buildRamp(seedArg, config, {
143
143
  } = {}) {
144
144
  let seed;
145
145
  try {
146
- seed = (0, import_color_utils.clampToGamut)((0, import_fn.parse)(seedArg));
146
+ seed = (0, import_color_utils.clampToGamut)(seedArg);
147
147
  } catch (error) {
148
148
  throw new Error(
149
149
  `Invalid seed color "${seedArg}": ${error instanceof Error ? error.message : "Unknown error"}`
@@ -226,4 +226,4 @@ function buildRamp(seedArg, config, {
226
226
  0 && (module.exports = {
227
227
  buildRamp
228
228
  });
229
- //# sourceMappingURL=index.js.map
229
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/color-ramps/lib/index.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tclone,\n\tget,\n\tOKLCH,\n\tset,\n\ttype ColorTypes,\n\ttype PlainColorObject,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { clampToGamut, getContrast, getColorString } from './color-utils';\nimport { findColorMeetingRequirements } from './find-color-with-constraints';\nimport {\n\tsortByDependency,\n\tcomputeBetterFgColorDirection,\n\tadjustContrastTarget,\n\tstepsForStep,\n\tsolveWithBisect,\n} from './utils';\n\nimport type {\n\tFollowDirection,\n\tRamp,\n\tRampDirection,\n\tRampConfig,\n\tRampResult,\n} from './types';\nimport { CONTRAST_EPSILON } from './constants';\n\n/**\n * Calculate a complete color ramp based on the provided configuration.\n *\n * @param params - The calculation parameters\n * @param params.seed - The base color to build the ramp from\n * @param params.sortedSteps - Steps sorted in dependency order\n * @param params.config - Ramp configuration defining contrast requirements\n * @param params.mainDir - Primary direction for the ramp (lighter/darker)\n * @param params.oppDir - Opposite direction from mainDir\n * @param params.pinLightness - Optional lightness override for a given step\n * @param params.pinLightness.stepName\n * @param params.pinLightness.value\n * @return Object containing ramp results and satisfaction status\n */\nfunction calculateRamp( {\n\tseed,\n\tsortedSteps,\n\tconfig,\n\tmainDir,\n\toppDir,\n\tpinLightness,\n}: {\n\tseed: PlainColorObject;\n\tsortedSteps: ( keyof Ramp )[];\n\tconfig: RampConfig;\n\tmainDir: RampDirection;\n\toppDir: RampDirection;\n\tpinLightness?: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} ) {\n\tconst rampResults = {} as Record< keyof Ramp, string >;\n\tlet warnings: string[] | undefined;\n\tlet maxDeficit = -Infinity;\n\tlet maxDeficitDirection: RampDirection = 'lighter';\n\tlet maxDeficitStep;\n\n\t// Keep track of the calculated colors, as they are going to be useful\n\t// when other colors reference them.\n\tconst calculatedColors = new Map< keyof Ramp | 'seed', PlainColorObject >();\n\tcalculatedColors.set( 'seed', seed );\n\n\tfor ( const stepName of sortedSteps ) {\n\t\tconst {\n\t\t\tcontrast,\n\t\t\tlightness: stepLightnessConstraint,\n\t\t\ttaperChromaOptions,\n\t\t\tsameAsIfPossible,\n\t\t} = config[ stepName ];\n\n\t\tconst referenceColor = calculatedColors.get( contrast.reference );\n\t\tif ( ! referenceColor ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Reference color for step ${ stepName } not found: ${ contrast.reference }`\n\t\t\t);\n\t\t}\n\n\t\t// Check if we can reuse color from the `sameAsIfPossible` config option\n\t\tif ( sameAsIfPossible ) {\n\t\t\tconst candidateColor = calculatedColors.get( sameAsIfPossible );\n\t\t\tif ( ! candidateColor ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Same-as color for step ${ stepName } not found: ${ sameAsIfPossible }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst candidateContrast = getContrast(\n\t\t\t\treferenceColor,\n\t\t\t\tcandidateColor\n\t\t\t);\n\t\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\t\t\t// If the candidate meets the contrast requirement, use it\n\t\t\tif ( candidateContrast >= adjustedTarget ) {\n\t\t\t\t// Store the reused color\n\t\t\t\tcalculatedColors.set( stepName, candidateColor );\n\t\t\t\trampResults[ stepName ] = getColorString( candidateColor );\n\n\t\t\t\tcontinue; // Skip to next step\n\t\t\t}\n\t\t}\n\n\t\tfunction computeDirection(\n\t\t\tcolor: ColorTypes,\n\t\t\tfollowDirection: FollowDirection\n\t\t): RampDirection {\n\t\t\tif ( followDirection === 'main' ) {\n\t\t\t\treturn mainDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'opposite' ) {\n\t\t\t\treturn oppDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'best' ) {\n\t\t\t\treturn computeBetterFgColorDirection(\n\t\t\t\t\tcolor,\n\t\t\t\t\tcontrast.preferLighter\n\t\t\t\t).better;\n\t\t\t}\n\n\t\t\treturn followDirection;\n\t\t}\n\n\t\tconst computedDir = computeDirection(\n\t\t\treferenceColor,\n\t\t\tcontrast.followDirection\n\t\t);\n\n\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\n\t\t// Define the lightness constraint, if needed.\n\t\tlet lightnessConstraint;\n\t\tif ( pinLightness?.stepName === stepName ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: pinLightness.value,\n\t\t\t\ttype: 'force',\n\t\t\t} as const;\n\t\t} else if ( stepLightnessConstraint ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: stepLightnessConstraint( computedDir ),\n\t\t\t\ttype: 'onlyIfSucceeds',\n\t\t\t} as const;\n\t\t}\n\n\t\t// Calculate the color meeting the requirements\n\t\tconst searchResults = findColorMeetingRequirements(\n\t\t\treferenceColor,\n\t\t\tseed,\n\t\t\tadjustedTarget,\n\t\t\tcomputedDir,\n\t\t\t{\n\t\t\t\tlightnessConstraint,\n\t\t\t\ttaperChromaOptions,\n\t\t\t}\n\t\t);\n\n\t\t// When the target contrast is not met, take note of it and use\n\t\t// that information to guide the ramp calculation bisection.\n\t\tif (\n\t\t\t! contrast.ignoreWhenAdjustingSeed &&\n\t\t\tsearchResults.deficit &&\n\t\t\tsearchResults.deficit > maxDeficit\n\t\t) {\n\t\t\tmaxDeficit = searchResults.deficit;\n\t\t\tmaxDeficitDirection = computedDir;\n\t\t\tmaxDeficitStep = stepName;\n\t\t}\n\n\t\t// Store calculated color for future dependencies\n\t\tcalculatedColors.set( stepName, searchResults.color );\n\n\t\t// Add to results\n\t\trampResults[ stepName ] = getColorString( searchResults.color );\n\n\t\tif ( ! searchResults.reached && ! contrast.ignoreWhenAdjustingSeed ) {\n\t\t\twarnings ??= [];\n\t\t\twarnings.push( stepName );\n\t\t}\n\t}\n\n\treturn {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t};\n}\n\nexport function buildRamp(\n\tseedArg: string,\n\tconfig: RampConfig,\n\t{\n\t\tmainDirection,\n\t\tpinLightness,\n\t\trescaleToFitContrastTargets = true,\n\t}: {\n\t\tmainDirection?: RampDirection;\n\t\tpinLightness?: {\n\t\t\tstepName: keyof Ramp;\n\t\t\tvalue: number;\n\t\t};\n\t\trescaleToFitContrastTargets?: boolean;\n\t} = {}\n): RampResult {\n\tlet seed: PlainColorObject;\n\ttry {\n\t\tseed = clampToGamut( seedArg );\n\t} catch ( error ) {\n\t\tthrow new Error(\n\t\t\t`Invalid seed color \"${ seedArg }\": ${\n\t\t\t\terror instanceof Error ? error.message : 'Unknown error'\n\t\t\t}`\n\t\t);\n\t}\n\n\tlet mainDir: RampDirection = 'lighter';\n\tlet oppDir: RampDirection = 'darker';\n\n\tif ( mainDirection ) {\n\t\tmainDir = mainDirection;\n\t\toppDir = mainDirection === 'darker' ? 'lighter' : 'darker';\n\t} else {\n\t\tconst { better, worse } = computeBetterFgColorDirection( seed );\n\t\tmainDir = better;\n\t\toppDir = worse;\n\t}\n\n\t// Get the correct calculation order based on dependencies\n\tconst sortedSteps = sortByDependency( config );\n\n\t// Calculate the ramp with the initial seed.\n\tconst {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t} = calculateRamp( {\n\t\tseed,\n\t\tsortedSteps,\n\t\tconfig,\n\t\tmainDir,\n\t\toppDir,\n\t\tpinLightness,\n\t} );\n\n\tlet bestRamp = rampResults;\n\n\tif ( maxDeficit > CONTRAST_EPSILON && rescaleToFitContrastTargets ) {\n\t\tconst iterSteps = stepsForStep( maxDeficitStep!, config );\n\n\t\tfunction getSeedForL( l: number ): PlainColorObject {\n\t\t\treturn clampToGamut( set( clone( seed ), [ OKLCH, 'l' ], l ) );\n\t\t}\n\n\t\tfunction getDeficitForSeed( s: PlainColorObject ): number {\n\t\t\tconst iterationResults = calculateRamp( {\n\t\t\t\tseed: s,\n\t\t\t\tsortedSteps: iterSteps,\n\t\t\t\tconfig,\n\t\t\t\tmainDir,\n\t\t\t\toppDir,\n\t\t\t\tpinLightness,\n\t\t\t} );\n\n\t\t\t// If the constraints start failing in the opposite direction to the original\n\t\t\t// iteration's direction, that means we've moved too far away from the target.\n\t\t\t// Don't use the `maxDeficit` value because it's not related to our search,\n\t\t\t// and might even be positive, which would confuse the bisection algorithm.\n\t\t\treturn iterationResults.maxDeficitDirection === maxDeficitDirection\n\t\t\t\t? iterationResults.maxDeficit\n\t\t\t\t: -maxDeficit;\n\t\t}\n\n\t\t// For a scale with the \"lighter\" direction, the contrast can be improved\n\t\t// by darkening the seed. For \"darker\" direction, by lightening the seed.\n\t\tconst lowerSeedL = maxDeficitDirection === 'lighter' ? 0 : 1;\n\t\tconst lowerDeficit = -maxDeficit;\n\t\tconst upperSeedL = get( seed, [ OKLCH, 'l' ] );\n\t\tconst upperDeficit = maxDeficit;\n\n\t\tconst bestSeed = solveWithBisect(\n\t\t\tgetSeedForL,\n\t\t\tgetDeficitForSeed,\n\t\t\tlowerSeedL,\n\t\t\tlowerDeficit,\n\t\t\tupperSeedL,\n\t\t\tupperDeficit\n\t\t);\n\n\t\t// Calculate the final ramp with adjusted seed.\n\t\tbestRamp = calculateRamp( {\n\t\t\tseed: bestSeed,\n\t\t\tsortedSteps,\n\t\t\tconfig,\n\t\t\tmainDir,\n\t\t\toppDir,\n\t\t\tpinLightness,\n\t\t} ).rampResults;\n\t}\n\n\t// Swap surface1 and surface3 for darker ramps to maintain visual elevation hierarchy.\n\t// This ensures surface1 appears \"behind\" surface2, and surface3 appears \"in front\",\n\t// regardless of the ramp's main direction.\n\tif ( mainDir === 'darker' ) {\n\t\tconst tmpSurface1 = bestRamp.surface1;\n\t\tbestRamp.surface1 = bestRamp.surface3;\n\t\tbestRamp.surface3 = tmpSurface1;\n\t}\n\n\treturn {\n\t\tramp: bestRamp,\n\t\twarnings,\n\t\tdirection: mainDir,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAOO;AAKP,mCAAO;AACP,yBAA0D;AAC1D,yCAA6C;AAC7C,mBAMO;AASP,uBAAiC;AAgBjC,SAAS,cAAe;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAUI;AACH,QAAM,cAAc,CAAC;AACrB,MAAI;AACJ,MAAI,aAAa;AACjB,MAAI,sBAAqC;AACzC,MAAI;AAIJ,QAAM,mBAAmB,oBAAI,IAA6C;AAC1E,mBAAiB,IAAK,QAAQ,IAAK;AAEnC,aAAY,YAAY,aAAc;AAuCrC,QAAS,mBAAT,SACC,OACA,iBACgB;AAChB,UAAK,oBAAoB,QAAS;AACjC,eAAO;AAAA,MACR;AAEA,UAAK,oBAAoB,YAAa;AACrC,eAAO;AAAA,MACR;AAEA,UAAK,oBAAoB,QAAS;AACjC,mBAAO;AAAA,UACN;AAAA,UACA,SAAS;AAAA,QACV,EAAE;AAAA,MACH;AAEA,aAAO;AAAA,IACR;AA1DA,UAAM;AAAA,MACL;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,QAAS;AAErB,UAAM,iBAAiB,iBAAiB,IAAK,SAAS,SAAU;AAChE,QAAK,CAAE,gBAAiB;AACvB,YAAM,IAAI;AAAA,QACT,4BAA6B,QAAS,eAAgB,SAAS,SAAU;AAAA,MAC1E;AAAA,IACD;AAGA,QAAK,kBAAm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E,iBAAO,GAAI,CAAE;AAC7C,UAAM,eAAe;AAErB,UAAM,eAAW;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAGA,eAAW,cAAe;AAAA,MACzB,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAE,EAAE;AAAA,EACL;AAKA,MAAK,YAAY,UAAW;AAC3B,UAAM,cAAc,SAAS;AAC7B,aAAS,WAAW,SAAS;AAC7B,aAAS,WAAW;AAAA,EACrB;AAEA,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA,WAAW;AAAA,EACZ;AACD;",
6
+ "names": ["adjustedTarget"]
7
+ }
@@ -313,4 +313,4 @@ var ACCENT_RAMP_CONFIG = {
313
313
  ACCENT_RAMP_CONFIG,
314
314
  BG_RAMP_CONFIG
315
315
  });
316
- //# sourceMappingURL=ramp-configs.js.map
316
+ //# sourceMappingURL=ramp-configs.cjs.map
@@ -4,4 +4,4 @@ import_fn.ColorSpace.register(import_fn.sRGB);
4
4
  import_fn.ColorSpace.register(import_fn.OKLCH);
5
5
  import_fn.ColorSpace.register(import_fn.P3);
6
6
  import_fn.ColorSpace.register(import_fn.HSL);
7
- //# sourceMappingURL=register-color-spaces.js.map
7
+ //# sourceMappingURL=register-color-spaces.cjs.map
@@ -23,7 +23,7 @@ __export(taper_chroma_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(taper_chroma_exports);
25
25
  var import_fn = require("colorjs.io/fn");
26
- var import_register_color_spaces = require("./register-color-spaces");
26
+ var import_register_color_spaces = require("./register-color-spaces.cjs");
27
27
  function taperChroma(seed, lTarget, options = {}) {
28
28
  const gamut = options.gamut ?? import_fn.sRGB;
29
29
  const alpha = options.alpha ?? 0.65;
@@ -35,9 +35,9 @@ function taperChroma(seed, lTarget, options = {}) {
35
35
  const kDark = options.kDark ?? 0.85;
36
36
  const achromaEpsilon = options.achromaEpsilon ?? 5e-3;
37
37
  const cSeed = Math.max(0, (0, import_fn.get)(seed, [import_fn.OKLCH, "c"]));
38
- let hSeed = Number((0, import_fn.get)(seed, [import_fn.OKLCH, "h"]));
38
+ let hSeed = (0, import_fn.get)(seed, [import_fn.OKLCH, "h"]);
39
39
  const chromaIsTiny = cSeed < achromaEpsilon;
40
- const hueIsInvalid = !Number.isFinite(hSeed);
40
+ const hueIsInvalid = hSeed === null || !Number.isFinite(hSeed);
41
41
  if (chromaIsTiny || hueIsInvalid) {
42
42
  if (typeof options.hueFallback === "number") {
43
43
  hSeed = normalizeHue(options.hueFallback);
@@ -138,4 +138,4 @@ function maxInGamutChromaAtLH(l, h, gamutSpace, cap) {
138
138
  0 && (module.exports = {
139
139
  taperChroma
140
140
  });
141
- //# sourceMappingURL=taper-chroma.js.map
141
+ //# sourceMappingURL=taper-chroma.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/color-ramps/lib/taper-chroma.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tget,\n\ttoGamut,\n\tOKLCH,\n\tsRGB,\n\ttype PlainColorObject,\n\ttype ColorSpace,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\n\nexport interface TaperChromaOptions {\n\tgamut?: ColorSpace; // target gamut (default `sRGB`)\n\talpha?: number; // base fraction of Cmax at target (default 0.62)\n\tcarry?: number; // seed vividness carry exponent \u03B2 in [0..1] (default 0.5)\n\tcUpperBound?: number; // hard search cap for C (default 0.45)\n\t// Continuous taper around the seed (desaturate both sides slightly)\n\tradiusLight?: number; // distance in L where kLight is reached (default 0.20)\n\tradiusDark?: number; // distance in L where kDark is reached (default 0.20)\n\tkLight?: number; // floor multiplier near lighter side (default 0.85)\n\tkDark?: number; // floor multiplier near darker side (default 0.85)\n\t// Achromatic handling\n\thueFallback?: number; // degrees: if seed is achromatic and you still want color\n\tachromaEpsilon?: number; // \u2264 this chroma \u2192 treat as achromatic (default 0.005)\n}\n\n/**\n * Given the seed and the target lightness, tapers the chroma smoothly.\n * - C_intended = Cmax(Lt,H0) * alpha * (seedRelative^carry)\n * - Continuous taper vs |Lt - Ls| to softly reduce chroma for neighbors\n * - Downward-only clamp on C (preserve L & H)\n * @param seed\n * @param lTarget\n * @param options\n */\nexport function taperChroma(\n\tseed: PlainColorObject, // already OKLCH\n\tlTarget: number, // [0..1]\n\toptions: TaperChromaOptions = {}\n): { l: number; c: number } | PlainColorObject {\n\tconst gamut = options.gamut ?? sRGB;\n\tconst alpha = options.alpha ?? 0.65; // 0.7-0.8 works well for accent surface\n\tconst carry = options.carry ?? 0.5;\n\tconst cUpperBound = options.cUpperBound ?? 0.45;\n\tconst radiusLight = options.radiusLight ?? 0.2;\n\tconst radiusDark = options.radiusDark ?? 0.2;\n\tconst kLight = options.kLight ?? 0.85;\n\tconst kDark = options.kDark ?? 0.85;\n\tconst achromaEpsilon = options.achromaEpsilon ?? 0.005;\n\n\tconst cSeed = Math.max( 0, get( seed, [ OKLCH, 'c' ] ) );\n\tlet hSeed = Number( get( seed, [ OKLCH, 'h' ] ) );\n\n\tconst chromaIsTiny = cSeed < achromaEpsilon;\n\tconst hueIsInvalid = ! Number.isFinite( hSeed );\n\n\tif ( chromaIsTiny || hueIsInvalid ) {\n\t\tif ( typeof options.hueFallback === 'number' ) {\n\t\t\thSeed = normalizeHue( options.hueFallback );\n\t\t} else {\n\t\t\t// Respect achromatic intent: grayscale at target L\n\t\t\treturn {\n\t\t\t\tspace: OKLCH,\n\t\t\t\tcoords: [ clamp01( lTarget ), 0, 0 ],\n\t\t\t\talpha: 1,\n\t\t\t};\n\t\t}\n\t}\n\n\t// Capacity at seed and target\n\tconst lSeed = clamp01( get( seed, [ OKLCH, 'l' ] ) );\n\tconst cmaxSeed = getCachedMaxChromaAtLH( lSeed, hSeed, gamut, cUpperBound );\n\tconst cmaxTarget = getCachedMaxChromaAtLH(\n\t\tclamp01( lTarget ),\n\t\thSeed,\n\t\tgamut,\n\t\tcUpperBound\n\t);\n\n\t// Seed vividness ratio (hue-fair normalization)\n\tlet seedRelative = 0;\n\tconst denom = cmaxSeed > 0 ? cmaxSeed : 1e-6;\n\tseedRelative = clamp01( cSeed / denom );\n\n\t// Intended chroma from local capacity, tempered by seed vividness\n\tconst cIntendedBase = alpha * cmaxTarget;\n\tconst cWithCarry =\n\t\tcIntendedBase * Math.pow( seedRelative, clamp01( carry ) );\n\n\t// Gentle, symmetric desaturation vs distance in L\n\tconst t = continuousTaper( lSeed, lTarget, {\n\t\tradiusLight,\n\t\tradiusDark,\n\t\tkLight,\n\t\tkDark,\n\t} );\n\tconst cPlanned = cWithCarry * t;\n\n\t// Downward-only clamp (preserve L & H)\n\tconst lOut = clamp01( lTarget );\n\n\treturn { l: lOut, c: cPlanned };\n}\n\n/* ---------------- helpers & caches ---------------- */\n\nfunction clamp01( x: number ): number {\n\tif ( x < 0 ) {\n\t\treturn 0;\n\t}\n\tif ( x > 1 ) {\n\t\treturn 1;\n\t}\n\treturn x;\n}\nfunction normalizeHue( h: number ): number {\n\tlet hue = h % 360;\n\tif ( hue < 0 ) {\n\t\thue += 360;\n\t}\n\treturn hue;\n}\nfunction raisedCosine( u: number ): number {\n\tconst x = clamp01( u );\n\treturn 0.5 - 0.5 * Math.cos( Math.PI * x );\n}\n\n/**\n * smooth, distance-from-seed chroma taper (raised-cosine per side)\n * @param seedL\n * @param targetL\n * @param opts\n * @param opts.radiusLight\n * @param opts.radiusDark\n * @param opts.kLight\n * @param opts.kDark\n */\nfunction continuousTaper(\n\tseedL: number,\n\ttargetL: number,\n\topts: {\n\t\tradiusLight: number;\n\t\tradiusDark: number;\n\t\tkLight: number;\n\t\tkDark: number;\n\t}\n): number {\n\tconst d = targetL - seedL;\n\tif ( d >= 0 ) {\n\t\tconst u = opts.radiusLight > 0 ? Math.abs( d ) / opts.radiusLight : 1;\n\t\tconst w = raisedCosine( u > 1 ? 1 : u );\n\t\treturn 1 - ( 1 - opts.kLight ) * w;\n\t}\n\tconst u = opts.radiusDark > 0 ? Math.abs( d ) / opts.radiusDark : 1;\n\tconst w = raisedCosine( u > 1 ? 1 : u );\n\treturn 1 - ( 1 - opts.kDark ) * w;\n}\n\n/* ---- chroma-capacity queries with small caches ---- */\n\nconst maxChromaCache = new Map< string, number >();\nfunction keyMax( l: number, h: number, gamut: string, cap: number ): string {\n\t// Quantize to keep cache compact\n\tconst lq = quantize( l, 0.05 );\n\tconst hq = quantize( normalizeHue( h ), 10 );\n\tconst cq = quantize( cap, 0.05 );\n\treturn `${ gamut }|L:${ lq }|H:${ hq }|cap:${ cq }`;\n}\n\nfunction quantize( x: number, step: number ): number {\n\tconst k = Math.round( x / step );\n\treturn k * step;\n}\n\nfunction getCachedMaxChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: ColorSpace,\n\tcap: number\n): number {\n\tconst gamut = gamutSpace.id;\n\tconst key = keyMax( l, h, gamut, cap );\n\tconst hit = maxChromaCache.get( key );\n\tif ( typeof hit === 'number' ) {\n\t\treturn hit;\n\t}\n\n\tconst computed = maxInGamutChromaAtLH( l, h, gamutSpace, cap );\n\tmaxChromaCache.set( key, computed );\n\treturn computed;\n}\n\n/**\n * Find the max in-gamut chroma at fixed (L,H) in the target gamut\n * @param l\n * @param h\n * @param gamutSpace\n * @param cap\n */\nfunction maxInGamutChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: ColorSpace,\n\tcap: number\n): number {\n\t// Construct a color with maximum chroma.\n\tconst probe: PlainColorObject = {\n\t\tspace: OKLCH,\n\t\tcoords: [ l, cap, h ],\n\t\talpha: 1,\n\t};\n\n\t// Let `toGamut` reduce the chroma to the gamut maximum.\n\tconst clamped = toGamut( probe, { space: gamutSpace, method: 'css' } );\n\n\treturn get( clamped, [ OKLCH, 'c' ] );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAOO;AAKP,m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AClD;AAEA,SAAS,SAAU,GAAW,MAAuB;AACpD,QAAM,IAAI,KAAK,MAAO,IAAI,IAAK;AAC/B,SAAO,IAAI;AACZ;AAEA,SAAS,uBACR,GACA,GACA,YACA,KACS;AACT,QAAM,QAAQ,WAAW;AACzB,QAAM,MAAM,OAAQ,GAAG,GAAG,OAAO,GAAI;AACrC,QAAM,MAAM,eAAe,IAAK,GAAI;AACpC,MAAK,OAAO,QAAQ,UAAW;AAC9B,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,qBAAsB,GAAG,GAAG,YAAY,GAAI;AAC7D,iBAAe,IAAK,KAAK,QAAS;AAClC,SAAO;AACR;AASA,SAAS,qBACR,GACA,GACA,YACA,KACS;AAET,QAAM,QAA0B;AAAA,IAC/B,OAAO;AAAA,IACP,QAAQ,CAAE,GAAG,KAAK,CAAE;AAAA,IACpB,OAAO;AAAA,EACR;AAGA,QAAM,cAAU,mBAAS,OAAO,EAAE,OAAO,YAAY,QAAQ,MAAM,CAAE;AAErE,aAAO,eAAK,SAAS,CAAE,iBAAO,GAAI,CAAE;AACrC;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tget,\n\ttoGamut,\n\tOKLCH,\n\tsRGB,\n\ttype PlainColorObject,\n\ttype ColorSpace,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\n\nexport interface TaperChromaOptions {\n\tgamut?: ColorSpace; // target gamut (default `sRGB`)\n\talpha?: number; // base fraction of Cmax at target (default 0.62)\n\tcarry?: number; // seed vividness carry exponent \u03B2 in [0..1] (default 0.5)\n\tcUpperBound?: number; // hard search cap for C (default 0.45)\n\t// Continuous taper around the seed (desaturate both sides slightly)\n\tradiusLight?: number; // distance in L where kLight is reached (default 0.20)\n\tradiusDark?: number; // distance in L where kDark is reached (default 0.20)\n\tkLight?: number; // floor multiplier near lighter side (default 0.85)\n\tkDark?: number; // floor multiplier near darker side (default 0.85)\n\t// Achromatic handling\n\thueFallback?: number; // degrees: if seed is achromatic and you still want color\n\tachromaEpsilon?: number; // \u2264 this chroma \u2192 treat as achromatic (default 0.005)\n}\n\n/**\n * Given the seed and the target lightness, tapers the chroma smoothly.\n * - C_intended = Cmax(Lt,H0) * alpha * (seedRelative^carry)\n * - Continuous taper vs |Lt - Ls| to softly reduce chroma for neighbors\n * - Downward-only clamp on C (preserve L & H)\n * @param seed\n * @param lTarget\n * @param options\n */\nexport function taperChroma(\n\tseed: PlainColorObject, // already OKLCH\n\tlTarget: number, // [0..1]\n\toptions: TaperChromaOptions = {}\n): { l: number; c: number } | PlainColorObject {\n\tconst gamut = options.gamut ?? sRGB;\n\tconst alpha = options.alpha ?? 0.65; // 0.7-0.8 works well for accent surface\n\tconst carry = options.carry ?? 0.5;\n\tconst cUpperBound = options.cUpperBound ?? 0.45;\n\tconst radiusLight = options.radiusLight ?? 0.2;\n\tconst radiusDark = options.radiusDark ?? 0.2;\n\tconst kLight = options.kLight ?? 0.85;\n\tconst kDark = options.kDark ?? 0.85;\n\tconst achromaEpsilon = options.achromaEpsilon ?? 0.005;\n\n\tconst cSeed = Math.max( 0, get( seed, [ OKLCH, 'c' ] ) );\n\tlet hSeed = get( seed, [ OKLCH, 'h' ] );\n\n\tconst chromaIsTiny = cSeed < achromaEpsilon;\n\tconst hueIsInvalid = hSeed === null || ! Number.isFinite( hSeed );\n\n\tif ( chromaIsTiny || hueIsInvalid ) {\n\t\tif ( typeof options.hueFallback === 'number' ) {\n\t\t\thSeed = normalizeHue( options.hueFallback );\n\t\t} else {\n\t\t\t// Respect achromatic intent: grayscale at target L\n\t\t\treturn {\n\t\t\t\tspace: OKLCH,\n\t\t\t\tcoords: [ clamp01( lTarget ), 0, 0 ],\n\t\t\t\talpha: 1,\n\t\t\t};\n\t\t}\n\t}\n\n\t// Capacity at seed and target\n\tconst lSeed = clamp01( get( seed, [ OKLCH, 'l' ] ) );\n\tconst cmaxSeed = getCachedMaxChromaAtLH( lSeed, hSeed, gamut, cUpperBound );\n\tconst cmaxTarget = getCachedMaxChromaAtLH(\n\t\tclamp01( lTarget ),\n\t\thSeed,\n\t\tgamut,\n\t\tcUpperBound\n\t);\n\n\t// Seed vividness ratio (hue-fair normalization)\n\tlet seedRelative = 0;\n\tconst denom = cmaxSeed > 0 ? cmaxSeed : 1e-6;\n\tseedRelative = clamp01( cSeed / denom );\n\n\t// Intended chroma from local capacity, tempered by seed vividness\n\tconst cIntendedBase = alpha * cmaxTarget;\n\tconst cWithCarry =\n\t\tcIntendedBase * Math.pow( seedRelative, clamp01( carry ) );\n\n\t// Gentle, symmetric desaturation vs distance in L\n\tconst t = continuousTaper( lSeed, lTarget, {\n\t\tradiusLight,\n\t\tradiusDark,\n\t\tkLight,\n\t\tkDark,\n\t} );\n\tconst cPlanned = cWithCarry * t;\n\n\t// Downward-only clamp (preserve L & H)\n\tconst lOut = clamp01( lTarget );\n\n\treturn { l: lOut, c: cPlanned };\n}\n\n/* ---------------- helpers & caches ---------------- */\n\nfunction clamp01( x: number ): number {\n\tif ( x < 0 ) {\n\t\treturn 0;\n\t}\n\tif ( x > 1 ) {\n\t\treturn 1;\n\t}\n\treturn x;\n}\nfunction normalizeHue( h: number ): number {\n\tlet hue = h % 360;\n\tif ( hue < 0 ) {\n\t\thue += 360;\n\t}\n\treturn hue;\n}\nfunction raisedCosine( u: number ): number {\n\tconst x = clamp01( u );\n\treturn 0.5 - 0.5 * Math.cos( Math.PI * x );\n}\n\n/**\n * smooth, distance-from-seed chroma taper (raised-cosine per side)\n * @param seedL\n * @param targetL\n * @param opts\n * @param opts.radiusLight\n * @param opts.radiusDark\n * @param opts.kLight\n * @param opts.kDark\n */\nfunction continuousTaper(\n\tseedL: number,\n\ttargetL: number,\n\topts: {\n\t\tradiusLight: number;\n\t\tradiusDark: number;\n\t\tkLight: number;\n\t\tkDark: number;\n\t}\n): number {\n\tconst d = targetL - seedL;\n\tif ( d >= 0 ) {\n\t\tconst u = opts.radiusLight > 0 ? Math.abs( d ) / opts.radiusLight : 1;\n\t\tconst w = raisedCosine( u > 1 ? 1 : u );\n\t\treturn 1 - ( 1 - opts.kLight ) * w;\n\t}\n\tconst u = opts.radiusDark > 0 ? Math.abs( d ) / opts.radiusDark : 1;\n\tconst w = raisedCosine( u > 1 ? 1 : u );\n\treturn 1 - ( 1 - opts.kDark ) * w;\n}\n\n/* ---- chroma-capacity queries with small caches ---- */\n\nconst maxChromaCache = new Map< string, number >();\nfunction keyMax( l: number, h: number, gamut: string, cap: number ): string {\n\t// Quantize to keep cache compact\n\tconst lq = quantize( l, 0.05 );\n\tconst hq = quantize( normalizeHue( h ), 10 );\n\tconst cq = quantize( cap, 0.05 );\n\treturn `${ gamut }|L:${ lq }|H:${ hq }|cap:${ cq }`;\n}\n\nfunction quantize( x: number, step: number ): number {\n\tconst k = Math.round( x / step );\n\treturn k * step;\n}\n\nfunction getCachedMaxChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: ColorSpace,\n\tcap: number\n): number {\n\tconst gamut = gamutSpace.id;\n\tconst key = keyMax( l, h, gamut, cap );\n\tconst hit = maxChromaCache.get( key );\n\tif ( typeof hit === 'number' ) {\n\t\treturn hit;\n\t}\n\n\tconst computed = maxInGamutChromaAtLH( l, h, gamutSpace, cap );\n\tmaxChromaCache.set( key, computed );\n\treturn computed;\n}\n\n/**\n * Find the max in-gamut chroma at fixed (L,H) in the target gamut\n * @param l\n * @param h\n * @param gamutSpace\n * @param cap\n */\nfunction maxInGamutChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: ColorSpace,\n\tcap: number\n): number {\n\t// Construct a color with maximum chroma.\n\tconst probe: PlainColorObject = {\n\t\tspace: OKLCH,\n\t\tcoords: [ l, cap, h ],\n\t\talpha: 1,\n\t};\n\n\t// Let `toGamut` reduce the chroma to the gamut maximum.\n\tconst clamped = toGamut( probe, { space: gamutSpace, method: 'css' } );\n\n\treturn get( clamped, [ OKLCH, 'c' ] );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AA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AAI,KAAM,MAAO,EAAG,MAAO,EAAG,QAAS,EAAG;AAClD;AAEA,SAAS,SAAU,GAAW,MAAuB;AACpD,QAAM,IAAI,KAAK,MAAO,IAAI,IAAK;AAC/B,SAAO,IAAI;AACZ;AAEA,SAAS,uBACR,GACA,GACA,YACA,KACS;AACT,QAAM,QAAQ,WAAW;AACzB,QAAM,MAAM,OAAQ,GAAG,GAAG,OAAO,GAAI;AACrC,QAAM,MAAM,eAAe,IAAK,GAAI;AACpC,MAAK,OAAO,QAAQ,UAAW;AAC9B,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,qBAAsB,GAAG,GAAG,YAAY,GAAI;AAC7D,iBAAe,IAAK,KAAK,QAAS;AAClC,SAAO;AACR;AASA,SAAS,qBACR,GACA,GACA,YACA,KACS;AAET,QAAM,QAA0B;AAAA,IAC/B,OAAO;AAAA,IACP,QAAQ,CAAE,GAAG,KAAK,CAAE;AAAA,IACpB,OAAO;AAAA,EACR;AAGA,QAAM,cAAU,mBAAS,OAAO,EAAE,OAAO,YAAY,QAAQ,MAAM,CAAE;AAErE,aAAO,eAAK,SAAS,CAAE,iBAAO,GAAI,CAAE;AACrC;",
6
6
  "names": ["u", "w"]
7
7
  }
@@ -15,4 +15,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
15
15
  // packages/theme/src/color-ramps/lib/types.ts
16
16
  var types_exports = {};
17
17
  module.exports = __toCommonJS(types_exports);
18
- //# sourceMappingURL=types.js.map
18
+ //# sourceMappingURL=types.cjs.map
@@ -27,9 +27,9 @@ __export(utils_exports, {
27
27
  stepsForStep: () => stepsForStep
28
28
  });
29
29
  module.exports = __toCommonJS(utils_exports);
30
- var import_register_color_spaces = require("./register-color-spaces");
31
- var import_constants = require("./constants");
32
- var import_color_utils = require("./color-utils");
30
+ var import_register_color_spaces = require("./register-color-spaces.cjs");
31
+ var import_constants = require("./constants.cjs");
32
+ var import_color_utils = require("./color-utils.cjs");
33
33
  function buildDependencyGraph(config) {
34
34
  const dependencies = /* @__PURE__ */ new Map();
35
35
  const dependents = /* @__PURE__ */ new Map();
@@ -163,4 +163,4 @@ function solveWithBisect(calculateC, calculateValue, initLowerL, initLowerValue,
163
163
  sortByDependency,
164
164
  stepsForStep
165
165
  });
166
- //# sourceMappingURL=utils.js.map
166
+ //# sourceMappingURL=utils.cjs.map
@@ -32,4 +32,4 @@ var ThemeContext = (0, import_element.createContext)({
32
32
  0 && (module.exports = {
33
33
  ThemeContext
34
34
  });
35
- //# sourceMappingURL=context.js.map
35
+ //# sourceMappingURL=context.cjs.map
@@ -22,9 +22,9 @@ __export(index_exports, {
22
22
  privateApis: () => import_private_apis.privateApis
23
23
  });
24
24
  module.exports = __toCommonJS(index_exports);
25
- var import_private_apis = require("./private-apis");
25
+ var import_private_apis = require("./private-apis.cjs");
26
26
  // Annotate the CommonJS export names for ESM import in node:
27
27
  0 && (module.exports = {
28
28
  privateApis
29
29
  });
30
- //# sourceMappingURL=index.js.map
30
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export { privateApis } from './private-apis';\nexport type * from './prebuilt/ts/token-types';\nexport { type ThemeProvider } from './theme-provider';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B;",
6
+ "names": []
7
+ }
@@ -33,4 +33,4 @@ var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnl
33
33
  lock,
34
34
  unlock
35
35
  });
36
- //# sourceMappingURL=lock-unlock.js.map
36
+ //# sourceMappingURL=lock-unlock.cjs.map
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
- // packages/theme/src/prebuilt/js/design-tokens.js
19
+ // packages/theme/src/prebuilt/js/design-tokens.mjs
20
20
  var design_tokens_exports = {};
21
21
  __export(design_tokens_exports, {
22
22
  default: () => design_tokens_default
@@ -154,17 +154,19 @@ var design_tokens_default = [
154
154
  "--wpds-font-family-heading",
155
155
  "--wpds-font-family-body",
156
156
  "--wpds-font-family-mono",
157
- "--wpds-font-size-x-small",
158
- "--wpds-font-size-small",
159
- "--wpds-font-size-medium",
160
- "--wpds-font-size-large",
161
- "--wpds-font-size-x-large",
162
- "--wpds-font-size-2x-large",
163
- "--wpds-font-line-height-x-small",
164
- "--wpds-font-line-height-small",
165
- "--wpds-font-line-height-medium",
166
- "--wpds-font-line-height-large",
167
- "--wpds-font-line-height-x-large",
168
- "--wpds-font-line-height-2x-large"
157
+ "--wpds-font-size-xs",
158
+ "--wpds-font-size-sm",
159
+ "--wpds-font-size-md",
160
+ "--wpds-font-size-lg",
161
+ "--wpds-font-size-xl",
162
+ "--wpds-font-size-2xl",
163
+ "--wpds-font-line-height-xs",
164
+ "--wpds-font-line-height-sm",
165
+ "--wpds-font-line-height-md",
166
+ "--wpds-font-line-height-lg",
167
+ "--wpds-font-line-height-xl",
168
+ "--wpds-font-line-height-2xl",
169
+ "--wpds-font-weight-regular",
170
+ "--wpds-font-weight-medium"
169
171
  ];
170
- //# sourceMappingURL=design-tokens.js.map
172
+ //# sourceMappingURL=design-tokens.cjs.map