@wordpress/theme 0.3.1-next.8b30e05b0.0 → 0.4.1-next.8fd3f8831.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 (125) 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} +66 -66
  7. package/build/color-ramps/lib/{default-ramps.js.map → default-ramps.cjs.map} +1 -1
  8. package/build/color-ramps/lib/{find-color-with-constraints.js → find-color-with-constraints.cjs} +6 -6
  9. package/build/color-ramps/lib/find-color-with-constraints.cjs.map +7 -0
  10. package/build/color-ramps/lib/{index.js → index.cjs} +6 -6
  11. package/build/color-ramps/lib/index.cjs.map +7 -0
  12. package/build/color-ramps/lib/{ramp-configs.js → ramp-configs.cjs} +1 -1
  13. package/build/color-ramps/lib/{register-color-spaces.js → register-color-spaces.cjs} +1 -1
  14. package/build/color-ramps/lib/{taper-chroma.js → taper-chroma.cjs} +20 -46
  15. package/build/color-ramps/lib/taper-chroma.cjs.map +7 -0
  16. package/build/color-ramps/lib/{types.js → types.cjs} +1 -1
  17. package/build/color-ramps/lib/{utils.js → utils.cjs} +4 -4
  18. package/build/{context.js → context.cjs} +1 -1
  19. package/build/{index.js → index.cjs} +2 -2
  20. package/build/index.cjs.map +7 -0
  21. package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
  22. package/build/prebuilt/js/{design-tokens.js → design-tokens.cjs} +33 -7
  23. package/build/prebuilt/js/design-tokens.cjs.map +7 -0
  24. package/build/prebuilt/ts/{color-tokens.js → color-tokens.cjs} +36 -14
  25. package/build/prebuilt/ts/color-tokens.cjs.map +7 -0
  26. package/build/{token-id.js → prebuilt/ts/token-types.cjs} +4 -16
  27. package/build/prebuilt/ts/token-types.cjs.map +7 -0
  28. package/build/{private-apis.js → private-apis.cjs} +4 -4
  29. package/build/{theme-provider.js → theme-provider.cjs} +3 -3
  30. package/build/{types.js → types.cjs} +1 -1
  31. package/build/{use-theme-provider-styles.js → use-theme-provider-styles.cjs} +6 -6
  32. package/build-module/color-ramps/index.js +7 -7
  33. package/build-module/color-ramps/lib/color-utils.js +1 -1
  34. package/build-module/color-ramps/lib/constants.js +1 -1
  35. package/build-module/color-ramps/lib/default-ramps.js +65 -65
  36. package/build-module/color-ramps/lib/default-ramps.js.map +1 -1
  37. package/build-module/color-ramps/lib/find-color-with-constraints.js +5 -5
  38. package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  39. package/build-module/color-ramps/lib/index.js +5 -5
  40. package/build-module/color-ramps/lib/index.js.map +2 -2
  41. package/build-module/color-ramps/lib/taper-chroma.js +20 -47
  42. package/build-module/color-ramps/lib/taper-chroma.js.map +2 -2
  43. package/build-module/color-ramps/lib/utils.js +3 -3
  44. package/build-module/index.js +1 -1
  45. package/build-module/index.js.map +2 -2
  46. package/build-module/prebuilt/js/design-tokens.js +32 -6
  47. package/build-module/prebuilt/js/design-tokens.js.map +2 -2
  48. package/build-module/prebuilt/ts/color-tokens.js +35 -13
  49. package/build-module/prebuilt/ts/color-tokens.js.map +2 -2
  50. package/build-module/prebuilt/ts/token-types.js +1 -0
  51. package/build-module/private-apis.js +3 -3
  52. package/build-module/theme-provider.js +2 -2
  53. package/build-module/use-theme-provider-styles.js +4 -4
  54. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +3 -4
  55. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
  56. package/build-types/color-ramps/lib/taper-chroma.d.ts +4 -4
  57. package/build-types/color-ramps/lib/taper-chroma.d.ts.map +1 -1
  58. package/build-types/index.d.ts +2 -0
  59. package/build-types/index.d.ts.map +1 -1
  60. package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -1
  61. package/build-types/prebuilt/ts/token-types.d.ts +49 -0
  62. package/build-types/prebuilt/ts/token-types.d.ts.map +1 -0
  63. package/package.json +15 -7
  64. package/src/color-ramps/lib/default-ramps.ts +65 -65
  65. package/src/color-ramps/lib/find-color-with-constraints.ts +11 -7
  66. package/src/color-ramps/lib/index.ts +4 -4
  67. package/src/color-ramps/lib/taper-chroma.ts +32 -63
  68. package/src/index.ts +2 -1
  69. package/src/prebuilt/css/design-tokens.css +72 -28
  70. package/src/prebuilt/js/design-tokens.js +32 -6
  71. package/src/prebuilt/ts/color-tokens.ts +31 -9
  72. package/src/prebuilt/ts/token-types.ts +125 -0
  73. package/bin/generate-default-ramps/index.ts +0 -49
  74. package/bin/generate-primitive-tokens/index.ts +0 -120
  75. package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +0 -84
  76. package/bin/terrazzo-plugin-figma-ds-token-manager/index.ts +0 -217
  77. package/bin/terrazzo-plugin-figma-ds-token-manager/lib.ts +0 -1
  78. package/bin/terrazzo-plugin-inline-alias-values/index.ts +0 -113
  79. package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +0 -52
  80. package/build/color-ramps/lib/find-color-with-constraints.js.map +0 -7
  81. package/build/color-ramps/lib/index.js.map +0 -7
  82. package/build/color-ramps/lib/taper-chroma.js.map +0 -7
  83. package/build/index.js.map +0 -7
  84. package/build/prebuilt/js/design-tokens.js.map +0 -7
  85. package/build/prebuilt/json/figma.json +0 -715
  86. package/build/prebuilt/ts/color-tokens.js.map +0 -7
  87. package/build/token-id.js.map +0 -7
  88. package/build/types/css-modules.d.js +0 -1
  89. package/build/types/css-modules.d.js.map +0 -7
  90. package/build-module/prebuilt/json/figma.json +0 -715
  91. package/build-module/token-id.js +0 -6
  92. package/build-module/token-id.js.map +0 -7
  93. package/build-module/types/css-modules.d.js +0 -1
  94. package/build-types/token-id.d.ts +0 -9
  95. package/build-types/token-id.d.ts.map +0 -1
  96. package/docs/ds-tokens.md +0 -150
  97. package/src/prebuilt/json/figma.json +0 -715
  98. package/src/test/token-id.test.ts +0 -12
  99. package/src/token-id.ts +0 -9
  100. package/src/types/css-modules.d.ts +0 -4
  101. package/terrazzo.config.ts +0 -126
  102. package/tokens/border.json +0 -34
  103. package/tokens/color.json +0 -1029
  104. package/tokens/dimension.json +0 -109
  105. package/tokens/elevation.json +0 -201
  106. package/tokens/typography.json +0 -93
  107. package/tsconfig.bin.json +0 -13
  108. package/tsconfig.bin.tsbuildinfo +0 -1
  109. package/tsconfig.json +0 -11
  110. package/tsconfig.src.json +0 -9
  111. package/tsconfig.src.tsbuildinfo +0 -1
  112. /package/build/color-ramps/{index.js.map → index.cjs.map} +0 -0
  113. /package/build/color-ramps/lib/{color-utils.js.map → color-utils.cjs.map} +0 -0
  114. /package/build/color-ramps/lib/{constants.js.map → constants.cjs.map} +0 -0
  115. /package/build/color-ramps/lib/{ramp-configs.js.map → ramp-configs.cjs.map} +0 -0
  116. /package/build/color-ramps/lib/{register-color-spaces.js.map → register-color-spaces.cjs.map} +0 -0
  117. /package/build/color-ramps/lib/{types.js.map → types.cjs.map} +0 -0
  118. /package/build/color-ramps/lib/{utils.js.map → utils.cjs.map} +0 -0
  119. /package/build/{context.js.map → context.cjs.map} +0 -0
  120. /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
  121. /package/build/{private-apis.js.map → private-apis.cjs.map} +0 -0
  122. /package/build/{theme-provider.js.map → theme-provider.cjs.map} +0 -0
  123. /package/build/{types.js.map → types.cjs.map} +0 -0
  124. /package/build/{use-theme-provider-styles.js.map → use-theme-provider-styles.cjs.map} +0 -0
  125. /package/build-module/{types/css-modules.d.js.map → prebuilt/ts/token-types.js.map} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
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 (2025-12-24)
6
+
7
+ ### New Features
8
+
9
+ - 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/README.md CHANGED
@@ -6,46 +6,110 @@ 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
 
14
14
  In the **[Design Tokens Reference](docs/ds-tokens.md)** document there is a complete reference of all available design tokens including colors, spacing, typography, and more.
15
15
 
16
- ### Color Tokens
16
+ ### Architecture
17
17
 
18
- The design system defines color tokens using the following naming scheme:
18
+ Internally, the design system uses a tiered token architecture:
19
+
20
+ - **Primitive tokens**: Raw values like hex colors or pixel dimensions which are what the browsers eventually interpret. These live in the `/tokens` directory as JSON source files and are an internal implementation detail.
21
+ - **Semantic tokens**: Purpose-driven tokens with meaningful names that reference primitives and describe their intended use. These are what get exported as CSS custom properties.
22
+
23
+ This separation allows the design system to maintain consistency while providing flexibility, since primitive values can be updated without changing the semantic token names that developers use in their code.
24
+
25
+ ### Design Tokens
26
+
27
+ Design tokens are the visual design atoms of a design system. They are named entities that store visual design attributes like colors, spacing, typography, and shadows. They serve as a single source of truth that bridges design and development, ensuring consistency across platforms and making it easy to maintain and evolve the visual language of an application.
28
+
29
+ Rather than hardcoding values like `#3858e9` or `16px` throughout your code, tokens provide semantic names like `--wpds-color-bg-interactive-brand-strong` or `--wpds-dimension-padding-surface-md` that describe the purpose and context of the value. This makes code more maintainable and allows the design system to evolve. When a token's value changes, all components using that token automatically reflect the update.
30
+
31
+ #### Structure
32
+
33
+ The design system follows the [Design Tokens Community Group (DTCG)](https://design-tokens.github.io/community-group/format/) specification and organizes tokens into distinct types based on what kind of visual property they represent. Token definitions are stored as JSON files in the `/tokens` directory:
34
+
35
+ | File | Description |
36
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------- |
37
+ | `color.json` | Color palettes including primitive color ramps and semantic color tokens for backgrounds, foregrounds, strokes, and focus states |
38
+ | `dimension.json` | Spacing scale and semantic spacing tokens for padding, margins, and sizing |
39
+ | `typography.json` | Font family stacks, font sizes, and line heights |
40
+ | `border.json` | Border radius and width values |
41
+ | `elevation.json` | Shadow definitions for creating depth and layering |
42
+
43
+ Each JSON file contains both primitive and semantic token definitions in a hierarchical structure. These files are the source of truth for the design system and are processed during the build step to generate CSS custom properties and other output formats in `/src/prebuilt`.
44
+
45
+ #### Token Naming
46
+
47
+ Semantic tokens follow a consistent naming pattern:
19
48
 
20
49
  ```
21
- --wpds-<element>-<tone>[-<emphasis>][-<state>]
50
+ --wpds-<type>-<property>-<target>[-<modifier>]
22
51
  ```
23
52
 
24
- **Element** specifies what the color is applied to.
53
+ **Type** indicates what kind of value it represents, usually mapping to a DTCG token type.
54
+
55
+ | Value | Description |
56
+ | ----------- | ------------------------------------------------------------------------------ |
57
+ | `color` | Color values for backgrounds, foregrounds, and strokes |
58
+ | `dimension` | Spacing, sizing, and other measurable lengths (e.g., padding, margins, widths) |
59
+ | `border` | Border properties like radius and width |
60
+ | `elevation` | Shadow definitions for layering and depth |
61
+ | `font` | Typography properties like family, size, and line-height |
62
+
63
+ **Property** is the specific design property being defined.
25
64
 
26
- | Value | Description |
27
- | -------------------- | ------------------------------------------------------------------------------------------- |
28
- | `bg-surface` | Backgrounds of layout or container surfaces. |
29
- | `bg-interactive` | Backgrounds of interactive elements such as buttons, inputs, and toggles. |
30
- | `bg-track` | Backgrounds of track components like scrollbars and slider tracks. |
31
- | `bg-thumb` | Backgrounds of thumb components like scrollbar thumbs and slider thumbs. |
32
- | `fg-content` | Foreground color for text and icons in static content. |
33
- | `fg-interactive` | Foreground color for text and icons in interactive elements such as links and buttons. |
34
- | `stroke-surface` | Decorative borders and dividers for non-interactive surfaces. |
35
- | `stroke-interactive` | Accessible borders for interactive controls. |
36
- | `stroke-focus` | Stroke color specifically for focus rings. |
65
+ | Value | Description |
66
+ | -------- | ---------------------------------- |
67
+ | `bg` | Background color |
68
+ | `fg` | Foreground color (text and icons) |
69
+ | `stroke` | Border and outline color |
70
+ | `padding`| Internal spacing within an element |
71
+ | `gap` | Spacing between elements |
72
+ | `radius` | Border radius for rounded corners |
73
+ | `width` | Border width |
74
+ | `size` | Font size |
75
+ | `family` | Font family |
76
+
77
+ **Target** is the component or element type the token applies to.
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 |
87
+
88
+ **Modifier** is an optional size or intensity modifier.
89
+
90
+ | Value | Description |
91
+ | ----------------------------------- | -------------------- |
92
+ | `2xs`, `xs`, `sm`, `md`, `lg`, `xl` | Size scale modifiers |
93
+
94
+ #### Color Token Modifiers
95
+
96
+ Color tokens extend the base pattern with additional modifiers for tone, emphasis, and state:
97
+
98
+ ```
99
+ --wpds-color-<property>-<target>-<tone>[-<emphasis>][-<state>]
100
+ ```
37
101
 
38
102
  **Tone** defines the semantic intent of the color.
39
103
 
40
- | Value | Description |
41
- | --------- | ---------------------------------------------------------------------------------------- |
42
- | `neutral` | Neutrally toned UI elements. |
43
- | `brand` | Brand-accented or primary action colors. |
44
- | `success` | Positive or completed states. |
45
- | `info` | Informational or system-generated context. |
46
- | `caution` | Heads-up or low-severity issues; “proceed carefully.” |
47
- | `warning` | Higher-severity or time-sensitive issues that require user attention but are not errors. |
48
- | `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 |
49
113
 
50
114
  > [!NOTE]
51
115
  > `caution` and `warning` represent two escalation levels of non-error severity.
@@ -53,17 +117,17 @@ The design system defines color tokens using the following naming scheme:
53
117
 
54
118
  **Emphasis** adjusts color strength relative to the base tone, if specified. The default is a normal emphasis.
55
119
 
56
- | Value | Description |
57
- | -------------------- | ------------------------------------------- |
58
- | `strong` | Higher contrast and/or elevated emphasis. |
59
- | `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 |
60
124
 
61
125
  **State** represents the interactive state of the element, if specified. The default is an idle state.
62
126
 
63
- | Value | Description |
64
- | ---------- | ---------------------------------------- |
65
- | `active` | Hovered, pressed, or selected state. |
66
- | `disabled` | Unavailable or inoperable state. |
127
+ | Value | Description |
128
+ | ---------- | ----------------------------------- |
129
+ | `active` | Hovered, pressed, or selected state |
130
+ | `disabled` | Unavailable or inoperable state |
67
131
 
68
132
  ## Theme Provider
69
133
 
@@ -74,7 +138,7 @@ import { ThemeProvider } from '@wordpress/theme';
74
138
 
75
139
  function App() {
76
140
  return (
77
- <ThemeProvider color={ { primary: 'blue' } }>
141
+ <ThemeProvider color={ { primary: 'blue' } } density="compact">
78
142
  { /* Your app content */ }
79
143
  </ThemeProvider>
80
144
  );
@@ -83,11 +147,21 @@ function App() {
83
147
 
84
148
  The `color` prop accepts an object with the following optional properties:
85
149
 
86
- - `primary`: The primary/accent seed color (default: `'#3858e9'`)
87
- - `bg`: The background seed color (default: `'#f8f8f8'`)
150
+ - `primary`: The primary/accent seed color (default: `'#3858e9'`).
151
+ - `bg`: The background seed color (default: `'#f8f8f8'`).
88
152
 
89
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.
90
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
+
91
165
  ### Nesting Providers
92
166
 
93
167
  The provider can be used recursively to override or modify the theme for a specific subtree.
@@ -95,10 +169,10 @@ The provider can be used recursively to override or modify the theme for a speci
95
169
  ```tsx
96
170
  <ThemeProvider color={ { bg: 'white' } }>
97
171
  { /* light-themed UI components */ }
98
- <ThemeProvider color={ { bg: '#1e1e1e' } }>
99
- { /* dark-themed UI components */ }
172
+ <ThemeProvider color={ { bg: '#1e1e1e' } } density="compact">
173
+ { /* dark-themed UI components with compact spacing */ }
100
174
  <ThemeProvider color={ { primary: 'red' } }>
101
- { /* dark-themed with red accent */ }
175
+ { /* dark-themed with red accent, inheriting compact density */ }
102
176
  </ThemeProvider>
103
177
  </ThemeProvider>
104
178
  { /* light-themed UI components */ }
@@ -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");
@@ -115,4 +115,4 @@ function checkAccessibleCombinations({
115
115
  buildBgRamp,
116
116
  checkAccessibleCombinations
117
117
  });
118
- //# sourceMappingURL=index.js.map
118
+ //# sourceMappingURL=index.cjs.map
@@ -25,7 +25,7 @@ __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
30
  return (0, import_fn.serialize)((0, import_fn.to)(color, import_fn.sRGB), { format: "hex", inGamut: true });
31
31
  }
@@ -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
@@ -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
@@ -55,10 +55,10 @@ var DEFAULT_RAMPS = {
55
55
  bgFill1: "#3858e9",
56
56
  fgFill: "#eff0f2",
57
57
  bgFill2: "#2e49d9",
58
- surface2: "#f6f8fc",
59
- surface6: "#c7d2ee",
58
+ surface2: "#f6f8fd",
59
+ surface6: "#c7d2ed",
60
60
  surface5: "#dbe2f4",
61
- surface4: "#e4eaf7",
61
+ surface4: "#e6eaf4",
62
62
  surface3: "#fff",
63
63
  fgSurface4: "#0b0070",
64
64
  fgSurface3: "#3858e9",
@@ -66,11 +66,11 @@ var DEFAULT_RAMPS = {
66
66
  fgSurface1: "#85a9ff",
67
67
  stroke3: "#3858e9",
68
68
  stroke4: "#2337c8",
69
- stroke2: "#9aaad3",
70
- stroke1: "#a2b1d6",
71
- bgFillDark: "#1b1e26",
69
+ stroke2: "#9caacc",
70
+ stroke1: "#a3b1d4",
71
+ bgFillDark: "#1a1e27",
72
72
  fgFillDark: "#eff0f2",
73
- bgFillInverted2: "#1b1e26",
73
+ bgFillInverted2: "#1a1e27",
74
74
  bgFillInverted1: "#13009f",
75
75
  fgFillInverted: "#eff0f2",
76
76
  surface1: "#ecf0f9"
@@ -80,27 +80,27 @@ var DEFAULT_RAMPS = {
80
80
  info: {
81
81
  ramp: {
82
82
  bgFill1: "#0090ff",
83
- fgFill: "#1b1e23",
83
+ fgFill: "#1a1f24",
84
84
  bgFill2: "#007fed",
85
- surface2: "#f5f9fd",
86
- surface6: "#bdd5f1",
87
- surface5: "#d4e4f6",
88
- surface4: "#dfebf8",
85
+ surface2: "#f3f9ff",
86
+ surface6: "#bcd5f1",
87
+ surface5: "#d3e4f7",
88
+ surface4: "#deebfa",
89
89
  surface3: "#fff",
90
90
  fgSurface4: "#001b4f",
91
91
  fgSurface3: "#006bd7",
92
92
  fgSurface2: "#008bfa",
93
- fgSurface1: "#59b0ff",
93
+ fgSurface1: "#58b0ff",
94
94
  stroke3: "#006bd7",
95
95
  stroke4: "#004fa9",
96
- stroke2: "#94b5d9",
97
- stroke1: "#9fbcdd",
98
- bgFillDark: "#1b1e23",
99
- fgFillDark: "#eff0f2",
100
- bgFillInverted2: "#1b1e23",
96
+ stroke2: "#95b5d9",
97
+ stroke1: "#9fbcdc",
98
+ bgFillDark: "#1a1f24",
99
+ fgFillDark: "#eef0f3",
100
+ bgFillInverted2: "#1a1f24",
101
101
  bgFillInverted1: "#002a69",
102
- fgFillInverted: "#eff0f2",
103
- surface1: "#e9f1fa"
102
+ fgFillInverted: "#eef0f3",
103
+ surface1: "#e4f1ff"
104
104
  },
105
105
  direction: "darker"
106
106
  },
@@ -109,25 +109,25 @@ var DEFAULT_RAMPS = {
109
109
  bgFill1: "#4ab866",
110
110
  fgFill: "#1b1f1c",
111
111
  bgFill2: "#37a756",
112
- surface2: "#f0fcf2",
113
- surface6: "#7eea95",
114
- surface5: "#b5f1bf",
115
- surface4: "#cbf5d1",
112
+ surface2: "#eaffed",
113
+ surface6: "#88e89b",
114
+ surface5: "#aff3bb",
115
+ surface4: "#c5f7cc",
116
116
  surface3: "#fff",
117
117
  fgSurface4: "#002900",
118
118
  fgSurface3: "#007f30",
119
119
  fgSurface2: "#2b9e4e",
120
- fgSurface1: "#53c06e",
120
+ fgSurface1: "#53c16e",
121
121
  stroke3: "#007f30",
122
122
  stroke4: "#006013",
123
- stroke2: "#7dc189",
124
- stroke1: "#82c98f",
123
+ stroke2: "#84c08e",
124
+ stroke1: "#8ac894",
125
125
  bgFillDark: "#1b1f1c",
126
- fgFillDark: "#edf2ed",
126
+ fgFillDark: "#eaf3eb",
127
127
  bgFillInverted2: "#1b1f1c",
128
128
  bgFillInverted1: "#003701",
129
- fgFillInverted: "#edf2ed",
130
- surface1: "#dbf8df"
129
+ fgFillInverted: "#eaf3eb",
130
+ surface1: "#cbfdd2"
131
131
  },
132
132
  direction: "darker"
133
133
  },
@@ -136,25 +136,25 @@ var DEFAULT_RAMPS = {
136
136
  bgFill1: "#f0d149",
137
137
  fgFill: "#1f1e1b",
138
138
  bgFill2: "#dcbe2f",
139
- surface2: "#fdf9e7",
140
- surface6: "#ecd264",
141
- surface5: "#f5e297",
142
- surface4: "#f7eab3",
139
+ surface2: "#fff9c9",
140
+ surface6: "#e8d172",
141
+ surface5: "#f7e18a",
142
+ surface4: "#fee994",
143
143
  surface3: "#fff",
144
144
  fgSurface4: "#281d00",
145
- fgSurface3: "#836b00",
146
- fgSurface2: "#a58700",
147
- fgSurface1: "#c7a900",
148
- stroke3: "#836b00",
149
- stroke4: "#635000",
150
- stroke2: "#bfb17a",
151
- stroke1: "#c7b97f",
145
+ fgSurface3: "#826a00",
146
+ fgSurface2: "#a48600",
147
+ fgSurface1: "#c6a800",
148
+ stroke3: "#826a00",
149
+ stroke4: "#624f00",
150
+ stroke2: "#bdb17e",
151
+ stroke1: "#c5b883",
152
152
  bgFillDark: "#1f1e1b",
153
- fgFillDark: "#f6f1da",
153
+ fgFillDark: "#fdf1bf",
154
154
  bgFillInverted2: "#1f1e1b",
155
155
  bgFillInverted1: "#392c00",
156
- fgFillInverted: "#f6f1da",
157
- surface1: "#f9f0c8"
156
+ fgFillInverted: "#fdf1bf",
157
+ surface1: "#ffef9b"
158
158
  },
159
159
  direction: "darker"
160
160
  },
@@ -163,25 +163,25 @@ var DEFAULT_RAMPS = {
163
163
  bgFill1: "#f0b849",
164
164
  fgFill: "#1f1e1b",
165
165
  bgFill2: "#dda633",
166
- surface2: "#fdf7ee",
167
- surface6: "#f1ce8f",
168
- surface5: "#f6e0b9",
169
- surface4: "#f8e8cc",
166
+ surface2: "#fff7e0",
167
+ surface6: "#f4cc84",
168
+ surface5: "#faddac",
169
+ surface4: "#fde6bd",
170
170
  surface3: "#fff",
171
171
  fgSurface4: "#2e1900",
172
- fgSurface3: "#936400",
173
- fgSurface2: "#b68000",
174
- fgSurface1: "#d8a12c",
175
- stroke3: "#936400",
176
- stroke4: "#704a00",
177
- stroke2: "#caae7c",
178
- stroke1: "#d2b581",
172
+ fgSurface3: "#926300",
173
+ fgSurface2: "#b47f00",
174
+ fgSurface1: "#d7a02a",
175
+ stroke3: "#926300",
176
+ stroke4: "#6f4900",
177
+ stroke2: "#c7ad7e",
178
+ stroke1: "#d0b381",
179
179
  bgFillDark: "#1f1e1b",
180
- fgFillDark: "#f3f0e9",
180
+ fgFillDark: "#f7efe2",
181
181
  bgFillInverted2: "#1f1e1b",
182
182
  bgFillInverted1: "#422800",
183
- fgFillInverted: "#f3f0e9",
184
- surface1: "#faeeda"
183
+ fgFillInverted: "#f7efe2",
184
+ surface1: "#ffecc4"
185
185
  },
186
186
  direction: "darker"
187
187
  },
@@ -190,10 +190,10 @@ var DEFAULT_RAMPS = {
190
190
  bgFill1: "#cc1818",
191
191
  fgFill: "#f2efef",
192
192
  bgFill2: "#b90000",
193
- surface2: "#fdf6f5",
194
- surface6: "#f5c8c1",
195
- surface5: "#f9dbd7",
196
- surface4: "#fae4e1",
193
+ surface2: "#fff6f4",
194
+ surface6: "#f3c8c2",
195
+ surface5: "#f8dcd7",
196
+ surface4: "#f6e6e3",
197
197
  surface3: "#fff",
198
198
  fgSurface4: "#470000",
199
199
  fgSurface3: "#cc1818",
@@ -201,14 +201,14 @@ var DEFAULT_RAMPS = {
201
201
  fgSurface1: "#ff8879",
202
202
  stroke3: "#cc1818",
203
203
  stroke4: "#9d0000",
204
- stroke2: "#de988e",
205
- stroke1: "#e1a198",
204
+ stroke2: "#d39c95",
205
+ stroke1: "#daa39b",
206
206
  bgFillDark: "#231c1b",
207
207
  fgFillDark: "#f2efef",
208
208
  bgFillInverted2: "#231c1b",
209
209
  bgFillInverted1: "#640000",
210
210
  fgFillInverted: "#f2efef",
211
- surface1: "#fbece9"
211
+ surface1: "#fcece9"
212
212
  },
213
213
  direction: "darker"
214
214
  }
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/color-ramps/lib/default-ramps.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RampResult } from './types';\nimport type { DEFAULT_SEED_COLORS } from './constants';\n\nexport const DEFAULT_RAMPS: Record<\n\tkeyof typeof DEFAULT_SEED_COLORS,\n\tRampResult\n> = {\n\tbg: {\n\t\tramp: {\n\t\t\tsurface2: '#f8f8f8',\n\t\t\tbgFill1: '#555',\n\t\t\tfgFill: '#f0f0f0',\n\t\t\tbgFill2: '#484848',\n\t\t\tsurface6: '#d2d2d2',\n\t\t\tsurface5: '#e2e2e2',\n\t\t\tsurface4: '#eaeaea',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#1e1e1e',\n\t\t\tfgSurface3: '#6d6d6d',\n\t\t\tfgSurface2: '#8a8a8a',\n\t\t\tfgSurface1: '#aaa',\n\t\t\tstroke3: '#8a8a8a',\n\t\t\tstroke4: '#6c6c6c',\n\t\t\tstroke2: '#d8d8d8',\n\t\t\tstroke1: '#e0e0e0',\n\t\t\tbgFillDark: '#1e1e1e',\n\t\t\tfgFillDark: '#f0f0f0',\n\t\t\tbgFillInverted2: '#1e1e1e',\n\t\t\tbgFillInverted1: '#2d2d2d',\n\t\t\tfgFillInverted: '#f0f0f0',\n\t\t\tsurface1: '#f0f0f0',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tprimary: {\n\t\tramp: {\n\t\t\tbgFill1: '#3858e9',\n\t\t\tfgFill: '#eff0f2',\n\t\t\tbgFill2: '#2e49d9',\n\t\t\tsurface2: '#f6f8fc',\n\t\t\tsurface6: '#c7d2ee',\n\t\t\tsurface5: '#dbe2f4',\n\t\t\tsurface4: '#e4eaf7',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#0b0070',\n\t\t\tfgSurface3: '#3858e9',\n\t\t\tfgSurface2: '#5b82ff',\n\t\t\tfgSurface1: '#85a9ff',\n\t\t\tstroke3: '#3858e9',\n\t\t\tstroke4: '#2337c8',\n\t\t\tstroke2: '#9aaad3',\n\t\t\tstroke1: '#a2b1d6',\n\t\t\tbgFillDark: '#1b1e26',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1b1e26',\n\t\t\tbgFillInverted1: '#13009f',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#ecf0f9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tinfo: {\n\t\tramp: {\n\t\t\tbgFill1: '#0090ff',\n\t\t\tfgFill: '#1b1e23',\n\t\t\tbgFill2: '#007fed',\n\t\t\tsurface2: '#f5f9fd',\n\t\t\tsurface6: '#bdd5f1',\n\t\t\tsurface5: '#d4e4f6',\n\t\t\tsurface4: '#dfebf8',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#001b4f',\n\t\t\tfgSurface3: '#006bd7',\n\t\t\tfgSurface2: '#008bfa',\n\t\t\tfgSurface1: '#59b0ff',\n\t\t\tstroke3: '#006bd7',\n\t\t\tstroke4: '#004fa9',\n\t\t\tstroke2: '#94b5d9',\n\t\t\tstroke1: '#9fbcdd',\n\t\t\tbgFillDark: '#1b1e23',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1b1e23',\n\t\t\tbgFillInverted1: '#002a69',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#e9f1fa',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tsuccess: {\n\t\tramp: {\n\t\t\tbgFill1: '#4ab866',\n\t\t\tfgFill: '#1b1f1c',\n\t\t\tbgFill2: '#37a756',\n\t\t\tsurface2: '#f0fcf2',\n\t\t\tsurface6: '#7eea95',\n\t\t\tsurface5: '#b5f1bf',\n\t\t\tsurface4: '#cbf5d1',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#002900',\n\t\t\tfgSurface3: '#007f30',\n\t\t\tfgSurface2: '#2b9e4e',\n\t\t\tfgSurface1: '#53c06e',\n\t\t\tstroke3: '#007f30',\n\t\t\tstroke4: '#006013',\n\t\t\tstroke2: '#7dc189',\n\t\t\tstroke1: '#82c98f',\n\t\t\tbgFillDark: '#1b1f1c',\n\t\t\tfgFillDark: '#edf2ed',\n\t\t\tbgFillInverted2: '#1b1f1c',\n\t\t\tbgFillInverted1: '#003701',\n\t\t\tfgFillInverted: '#edf2ed',\n\t\t\tsurface1: '#dbf8df',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tcaution: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0d149',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dcbe2f',\n\t\t\tsurface2: '#fdf9e7',\n\t\t\tsurface6: '#ecd264',\n\t\t\tsurface5: '#f5e297',\n\t\t\tsurface4: '#f7eab3',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#281d00',\n\t\t\tfgSurface3: '#836b00',\n\t\t\tfgSurface2: '#a58700',\n\t\t\tfgSurface1: '#c7a900',\n\t\t\tstroke3: '#836b00',\n\t\t\tstroke4: '#635000',\n\t\t\tstroke2: '#bfb17a',\n\t\t\tstroke1: '#c7b97f',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f6f1da',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#392c00',\n\t\t\tfgFillInverted: '#f6f1da',\n\t\t\tsurface1: '#f9f0c8',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\twarning: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0b849',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dda633',\n\t\t\tsurface2: '#fdf7ee',\n\t\t\tsurface6: '#f1ce8f',\n\t\t\tsurface5: '#f6e0b9',\n\t\t\tsurface4: '#f8e8cc',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#2e1900',\n\t\t\tfgSurface3: '#936400',\n\t\t\tfgSurface2: '#b68000',\n\t\t\tfgSurface1: '#d8a12c',\n\t\t\tstroke3: '#936400',\n\t\t\tstroke4: '#704a00',\n\t\t\tstroke2: '#caae7c',\n\t\t\tstroke1: '#d2b581',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f3f0e9',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#422800',\n\t\t\tfgFillInverted: '#f3f0e9',\n\t\t\tsurface1: '#faeeda',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\terror: {\n\t\tramp: {\n\t\t\tbgFill1: '#cc1818',\n\t\t\tfgFill: '#f2efef',\n\t\t\tbgFill2: '#b90000',\n\t\t\tsurface2: '#fdf6f5',\n\t\t\tsurface6: '#f5c8c1',\n\t\t\tsurface5: '#f9dbd7',\n\t\t\tsurface4: '#fae4e1',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#470000',\n\t\t\tfgSurface3: '#cc1818',\n\t\t\tfgSurface2: '#f74c40',\n\t\t\tfgSurface1: '#ff8879',\n\t\t\tstroke3: '#cc1818',\n\t\t\tstroke4: '#9d0000',\n\t\t\tstroke2: '#de988e',\n\t\t\tstroke1: '#e1a198',\n\t\t\tbgFillDark: '#231c1b',\n\t\t\tfgFillDark: '#f2efef',\n\t\t\tbgFillInverted2: '#231c1b',\n\t\t\tbgFillInverted1: '#640000',\n\t\t\tfgFillInverted: '#f2efef',\n\t\t\tsurface1: '#fbece9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n};\n"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RampResult } from './types';\nimport type { DEFAULT_SEED_COLORS } from './constants';\n\nexport const DEFAULT_RAMPS: Record<\n\tkeyof typeof DEFAULT_SEED_COLORS,\n\tRampResult\n> = {\n\tbg: {\n\t\tramp: {\n\t\t\tsurface2: '#f8f8f8',\n\t\t\tbgFill1: '#555',\n\t\t\tfgFill: '#f0f0f0',\n\t\t\tbgFill2: '#484848',\n\t\t\tsurface6: '#d2d2d2',\n\t\t\tsurface5: '#e2e2e2',\n\t\t\tsurface4: '#eaeaea',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#1e1e1e',\n\t\t\tfgSurface3: '#6d6d6d',\n\t\t\tfgSurface2: '#8a8a8a',\n\t\t\tfgSurface1: '#aaa',\n\t\t\tstroke3: '#8a8a8a',\n\t\t\tstroke4: '#6c6c6c',\n\t\t\tstroke2: '#d8d8d8',\n\t\t\tstroke1: '#e0e0e0',\n\t\t\tbgFillDark: '#1e1e1e',\n\t\t\tfgFillDark: '#f0f0f0',\n\t\t\tbgFillInverted2: '#1e1e1e',\n\t\t\tbgFillInverted1: '#2d2d2d',\n\t\t\tfgFillInverted: '#f0f0f0',\n\t\t\tsurface1: '#f0f0f0',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tprimary: {\n\t\tramp: {\n\t\t\tbgFill1: '#3858e9',\n\t\t\tfgFill: '#eff0f2',\n\t\t\tbgFill2: '#2e49d9',\n\t\t\tsurface2: '#f6f8fd',\n\t\t\tsurface6: '#c7d2ed',\n\t\t\tsurface5: '#dbe2f4',\n\t\t\tsurface4: '#e6eaf4',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#0b0070',\n\t\t\tfgSurface3: '#3858e9',\n\t\t\tfgSurface2: '#5b82ff',\n\t\t\tfgSurface1: '#85a9ff',\n\t\t\tstroke3: '#3858e9',\n\t\t\tstroke4: '#2337c8',\n\t\t\tstroke2: '#9caacc',\n\t\t\tstroke1: '#a3b1d4',\n\t\t\tbgFillDark: '#1a1e27',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1a1e27',\n\t\t\tbgFillInverted1: '#13009f',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#ecf0f9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tinfo: {\n\t\tramp: {\n\t\t\tbgFill1: '#0090ff',\n\t\t\tfgFill: '#1a1f24',\n\t\t\tbgFill2: '#007fed',\n\t\t\tsurface2: '#f3f9ff',\n\t\t\tsurface6: '#bcd5f1',\n\t\t\tsurface5: '#d3e4f7',\n\t\t\tsurface4: '#deebfa',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#001b4f',\n\t\t\tfgSurface3: '#006bd7',\n\t\t\tfgSurface2: '#008bfa',\n\t\t\tfgSurface1: '#58b0ff',\n\t\t\tstroke3: '#006bd7',\n\t\t\tstroke4: '#004fa9',\n\t\t\tstroke2: '#95b5d9',\n\t\t\tstroke1: '#9fbcdc',\n\t\t\tbgFillDark: '#1a1f24',\n\t\t\tfgFillDark: '#eef0f3',\n\t\t\tbgFillInverted2: '#1a1f24',\n\t\t\tbgFillInverted1: '#002a69',\n\t\t\tfgFillInverted: '#eef0f3',\n\t\t\tsurface1: '#e4f1ff',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tsuccess: {\n\t\tramp: {\n\t\t\tbgFill1: '#4ab866',\n\t\t\tfgFill: '#1b1f1c',\n\t\t\tbgFill2: '#37a756',\n\t\t\tsurface2: '#eaffed',\n\t\t\tsurface6: '#88e89b',\n\t\t\tsurface5: '#aff3bb',\n\t\t\tsurface4: '#c5f7cc',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#002900',\n\t\t\tfgSurface3: '#007f30',\n\t\t\tfgSurface2: '#2b9e4e',\n\t\t\tfgSurface1: '#53c16e',\n\t\t\tstroke3: '#007f30',\n\t\t\tstroke4: '#006013',\n\t\t\tstroke2: '#84c08e',\n\t\t\tstroke1: '#8ac894',\n\t\t\tbgFillDark: '#1b1f1c',\n\t\t\tfgFillDark: '#eaf3eb',\n\t\t\tbgFillInverted2: '#1b1f1c',\n\t\t\tbgFillInverted1: '#003701',\n\t\t\tfgFillInverted: '#eaf3eb',\n\t\t\tsurface1: '#cbfdd2',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tcaution: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0d149',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dcbe2f',\n\t\t\tsurface2: '#fff9c9',\n\t\t\tsurface6: '#e8d172',\n\t\t\tsurface5: '#f7e18a',\n\t\t\tsurface4: '#fee994',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#281d00',\n\t\t\tfgSurface3: '#826a00',\n\t\t\tfgSurface2: '#a48600',\n\t\t\tfgSurface1: '#c6a800',\n\t\t\tstroke3: '#826a00',\n\t\t\tstroke4: '#624f00',\n\t\t\tstroke2: '#bdb17e',\n\t\t\tstroke1: '#c5b883',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#fdf1bf',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#392c00',\n\t\t\tfgFillInverted: '#fdf1bf',\n\t\t\tsurface1: '#ffef9b',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\twarning: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0b849',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dda633',\n\t\t\tsurface2: '#fff7e0',\n\t\t\tsurface6: '#f4cc84',\n\t\t\tsurface5: '#faddac',\n\t\t\tsurface4: '#fde6bd',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#2e1900',\n\t\t\tfgSurface3: '#926300',\n\t\t\tfgSurface2: '#b47f00',\n\t\t\tfgSurface1: '#d7a02a',\n\t\t\tstroke3: '#926300',\n\t\t\tstroke4: '#6f4900',\n\t\t\tstroke2: '#c7ad7e',\n\t\t\tstroke1: '#d0b381',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f7efe2',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#422800',\n\t\t\tfgFillInverted: '#f7efe2',\n\t\t\tsurface1: '#ffecc4',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\terror: {\n\t\tramp: {\n\t\t\tbgFill1: '#cc1818',\n\t\t\tfgFill: '#f2efef',\n\t\t\tbgFill2: '#b90000',\n\t\t\tsurface2: '#fff6f4',\n\t\t\tsurface6: '#f3c8c2',\n\t\t\tsurface5: '#f8dcd7',\n\t\t\tsurface4: '#f6e6e3',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#470000',\n\t\t\tfgSurface3: '#cc1818',\n\t\t\tfgSurface2: '#f74c40',\n\t\t\tfgSurface1: '#ff8879',\n\t\t\tstroke3: '#cc1818',\n\t\t\tstroke4: '#9d0000',\n\t\t\tstroke2: '#d39c95',\n\t\t\tstroke1: '#daa39b',\n\t\t\tbgFillDark: '#231c1b',\n\t\t\tfgFillDark: '#f2efef',\n\t\t\tbgFillInverted2: '#231c1b',\n\t\t\tbgFillInverted1: '#640000',\n\t\t\tfgFillInverted: '#f2efef',\n\t\t\tsurface1: '#fcece9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,gBAGT;AAAA,EACH,IAAI;AAAA,IACH,MAAM;AAAA,MACL,UAAU;AAAA,MACV,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACR,MAAM;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AAAA,EACA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACR,MAAM;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACR,MAAM;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACR,MAAM;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AAAA,EACA,OAAO;AAAA,IACN,MAAM;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AACD;",
6
6
  "names": []
7
7
  }
@@ -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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/color-ramps/lib/find-color-with-constraints.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { get, OKLCH, type PlainColorObject } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { solveWithBisect } from './utils';\nimport { WHITE, BLACK, CONTRAST_EPSILON } from './constants';\nimport { clampToGamut, getContrast } from './color-utils';\nimport { type TaperChromaOptions, taperChroma } from './taper-chroma';\n\n/**\n * Difference of contrast values that grows linearly with the Y luminance.\n * We get more precise linear interpolations when we use this.\n * @param c1 First contrast.\n * @param c2 Second contrast.\n * @return Difference of logarithms.\n */\nfunction cdiff( c1: number, c2: number ) {\n\treturn Math.log( c1 / c2 );\n}\n\n/**\n * Solve for L such that:\n * - the L applied to the seed meets the contrast target against the reference\n * - the search is performed in one direction (ie lighter / darker)\n * - more constraints can be applied around lightness\n * @param reference\n * @param seed\n * @param target\n * @param direction\n * @param options\n * @param options.lightnessConstraint\n * @param options.lightnessConstraint.type\n * @param options.lightnessConstraint.value\n * @param options.taperChromaOptions\n */\nexport function findColorMeetingRequirements(\n\treference: PlainColorObject,\n\tseed: PlainColorObject,\n\ttarget: number,\n\tdirection: 'lighter' | 'darker',\n\t{\n\t\tlightnessConstraint,\n\t\ttaperChromaOptions,\n\t}: {\n\t\tlightnessConstraint?: {\n\t\t\ttype: 'force' | 'onlyIfSucceeds';\n\t\t\tvalue: number;\n\t\t};\n\t\ttaperChromaOptions?: TaperChromaOptions;\n\t} = {}\n): {\n\tcolor: PlainColorObject;\n\treached: boolean;\n\tachieved: number;\n\tdeficit?: number;\n} {\n\t// A target of 1 means same color.\n\t// A target lower than 1 doesn't make sense.\n\tif ( target <= 1 ) {\n\t\treturn {\n\t\t\tcolor: reference,\n\t\t\treached: true,\n\t\t\tachieved: 1,\n\t\t};\n\t}\n\n\tfunction getColorForL( l: number ): PlainColorObject {\n\t\tlet newL = l;\n\t\tlet newC = get( seed, [ OKLCH, 'c' ] );\n\n\t\tif ( taperChromaOptions ) {\n\t\t\tconst tapered = taperChroma( seed, newL, taperChromaOptions );\n\t\t\t// taperChroma returns either { l, c } or a ColorObject\n\t\t\tif ( 'l' in tapered && 'c' in tapered ) {\n\t\t\t\tnewL = tapered.l;\n\t\t\t\tnewC = tapered.c;\n\t\t\t} else {\n\t\t\t\t// It's already a ColorObject, return it directly\n\t\t\t\treturn tapered;\n\t\t\t}\n\t\t}\n\n\t\treturn clampToGamut( {\n\t\t\tspaceId: 'oklch',\n\t\t\tcoords: [ newL, newC, get( seed, [ OKLCH, 'h' ] ) ],\n\t\t} );\n\t}\n\n\t// Set the boundary based on the direction.\n\tconst mostContrastingL = direction === 'lighter' ? 1 : 0;\n\tconst mostContrastingColor = direction === 'lighter' ? WHITE : BLACK;\n\tconst highestContrast = getContrast( reference, mostContrastingColor );\n\n\tif ( lightnessConstraint ) {\n\t\t// Apply a specific L value.\n\t\t// Useful when pinning a step to a specific lightness, of to specify\n\t\t// min/max L values.\n\t\tconst colorWithExactL = getColorForL( lightnessConstraint.value );\n\t\tconst exactLContrast = getContrast( reference, colorWithExactL );\n\t\tconst exactLContrastMeetsTarget =\n\t\t\tcdiff( exactLContrast, target ) >= -CONTRAST_EPSILON;\n\n\t\t// If the L constraint is of \"force\" type, apply it even when it doesn't\n\t\t// meet the contrast target.\n\t\tif (\n\t\t\texactLContrastMeetsTarget ||\n\t\t\tlightnessConstraint.type === 'force'\n\t\t) {\n\t\t\treturn {\n\t\t\t\tcolor: colorWithExactL,\n\t\t\t\treached: exactLContrastMeetsTarget,\n\t\t\t\tachieved: exactLContrast,\n\t\t\t\tdeficit: exactLContrastMeetsTarget\n\t\t\t\t\t? cdiff( exactLContrast, highestContrast )\n\t\t\t\t\t: cdiff( target, exactLContrast ),\n\t\t\t};\n\t\t}\n\t}\n\n\t// If even the most contrasting color can't reach the target, the target is unreachable.\n\t// On the other hand, if the contrast is very close to the target, we consider it reached.\n\tif ( cdiff( highestContrast, target ) <= CONTRAST_EPSILON ) {\n\t\treturn {\n\t\t\tcolor: mostContrastingColor,\n\t\t\treached: cdiff( highestContrast, target ) >= -CONTRAST_EPSILON,\n\t\t\tachieved: highestContrast,\n\t\t\tdeficit: cdiff( target, highestContrast ),\n\t\t};\n\t}\n\n\t// Bracket: low fails, high meets.\n\t// Originally this was seed.oklch.l \u2014 although it's an assumption that works\n\t// only when we know for sure the direction of the search.\n\t// TODO: can we bring this back to seed.oklch.l ?\n\tconst lowerL = get( reference, [ OKLCH, 'l' ] );\n\tconst lowerContrast = cdiff( 1, target );\n\tconst upperL = mostContrastingL;\n\tconst upperContrast = cdiff( highestContrast, target );\n\n\tconst bestColor = solveWithBisect(\n\t\tgetColorForL,\n\t\t( c ) => cdiff( getContrast( reference, c ), target ),\n\t\tlowerL,\n\t\tlowerContrast,\n\t\tupperL,\n\t\tupperContrast\n\t);\n\n\treturn {\n\t\tcolor: bestColor,\n\t\treached: true,\n\t\tachieved: target,\n\t\t// Negative number that specifies how much room we have.\n\t\tdeficit: cdiff( target, highestContrast ),\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAAkD;AAKlD,mCAAO;AACP,mBAAgC;AAChC,uBAA+C;AAC/C,yBAA0C;AAC1C,0BAAqD;AASrD,SAAS,MAAO,IAAY,IAAa;AACxC,SAAO,KAAK,IAAK,KAAK,EAAG;AAC1B;AAiBO,SAAS,6BACf,WACA,MACA,QACA,WACA;AAAA,EACC;AAAA,EACA;AACD,IAMI,CAAC,GAMJ;AAGD,MAAK,UAAU,GAAI;AAClB,WAAO;AAAA,MACN,OAAO;AAAA,MACP,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,EACD;AAEA,WAAS,aAAc,GAA8B;AACpD,QAAI,OAAO;AACX,QAAI,WAAO,eAAK,MAAM,CAAE,iBAAO,GAAI,CAAE;AAErC,QAAK,oBAAqB;AACzB,YAAM,cAAU,iCAAa,MAAM,MAAM,kBAAmB;AAE5D,UAAK,OAAO,WAAW,OAAO,SAAU;AACvC,eAAO,QAAQ;AACf,eAAO,QAAQ;AAAA,MAChB,OAAO;AAEN,eAAO;AAAA,MACR;AAAA,IACD;AAEA,eAAO,iCAAc;AAAA,MACpB,SAAS;AAAA,MACT,QAAQ,CAAE,MAAM,UAAM,eAAK,MAAM,CAAE,iBAAO,GAAI,CAAE,CAAE;AAAA,IACnD,CAAE;AAAA,EACH;AAGA,QAAM,mBAAmB,cAAc,YAAY,IAAI;AACvD,QAAM,uBAAuB,cAAc,YAAY,yBAAQ;AAC/D,QAAM,sBAAkB,gCAAa,WAAW,oBAAqB;AAErE,MAAK,qBAAsB;AAI1B,UAAM,kBAAkB,aAAc,oBAAoB,KAAM;AAChE,UAAM,qBAAiB,gCAAa,WAAW,eAAgB;AAC/D,UAAM,4BACL,MAAO,gBAAgB,MAAO,KAAK,CAAC;AAIrC,QACC,6BACA,oBAAoB,SAAS,SAC5B;AACD,aAAO;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,QACT,UAAU;AAAA,QACV,SAAS,4BACN,MAAO,gBAAgB,eAAgB,IACvC,MAAO,QAAQ,cAAe;AAAA,MAClC;AAAA,IACD;AAAA,EACD;AAIA,MAAK,MAAO,iBAAiB,MAAO,KAAK,mCAAmB;AAC3D,WAAO;AAAA,MACN,OAAO;AAAA,MACP,SAAS,MAAO,iBAAiB,MAAO,KAAK,CAAC;AAAA,MAC9C,UAAU;AAAA,MACV,SAAS,MAAO,QAAQ,eAAgB;AAAA,IACzC;AAAA,EACD;AAMA,QAAM,aAAS,eAAK,WAAW,CAAE,iBAAO,GAAI,CAAE;AAC9C,QAAM,gBAAgB,MAAO,GAAG,MAAO;AACvC,QAAM,SAAS;AACf,QAAM,gBAAgB,MAAO,iBAAiB,MAAO;AAErD,QAAM,gBAAY;AAAA,IACjB;AAAA,IACA,CAAE,MAAO,UAAO,gCAAa,WAAW,CAAE,GAAG,MAAO;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA;AAAA,IAEV,SAAS,MAAO,QAAQ,eAAgB;AAAA,EACzC;AACD;",
6
+ "names": []
7
+ }
@@ -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,
@@ -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