@wordpress/theme 0.1.0 → 0.1.1-next.2f1c7c01b.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 (142) hide show
  1. package/README.md +69 -9
  2. package/bin/generate-default-ramps/index.ts +49 -0
  3. package/bin/generate-primitive-tokens/index.ts +14 -9
  4. package/bin/terrazzo-plugin-figma-ds-token-manager/index.ts +11 -4
  5. package/build/color-ramps/index.js +21 -39
  6. package/build/color-ramps/index.js.map +3 -3
  7. package/build/color-ramps/lib/color-utils.js +39 -0
  8. package/build/color-ramps/lib/color-utils.js.map +7 -0
  9. package/build/color-ramps/lib/constants.js +18 -25
  10. package/build/color-ramps/lib/constants.js.map +3 -3
  11. package/build/color-ramps/lib/default-ramps.js +220 -0
  12. package/build/color-ramps/lib/default-ramps.js.map +7 -0
  13. package/build/color-ramps/lib/find-color-with-constraints.js +57 -71
  14. package/build/color-ramps/lib/find-color-with-constraints.js.map +3 -3
  15. package/build/color-ramps/lib/index.js +25 -68
  16. package/build/color-ramps/lib/index.js.map +3 -3
  17. package/build/color-ramps/lib/ramp-configs.js +12 -11
  18. package/build/color-ramps/lib/ramp-configs.js.map +1 -1
  19. package/build/color-ramps/lib/register-color-spaces.js +7 -0
  20. package/build/color-ramps/lib/register-color-spaces.js.map +7 -0
  21. package/build/color-ramps/lib/taper-chroma.js +35 -27
  22. package/build/color-ramps/lib/taper-chroma.js.map +3 -3
  23. package/build/color-ramps/lib/types.js +2 -1
  24. package/build/color-ramps/lib/types.js.map +1 -1
  25. package/build/color-ramps/lib/utils.js +12 -9
  26. package/build/color-ramps/lib/utils.js.map +2 -2
  27. package/build/context.js +3 -2
  28. package/build/context.js.map +1 -1
  29. package/build/index.js +2 -1
  30. package/build/index.js.map +1 -1
  31. package/build/lock-unlock.js +3 -2
  32. package/build/lock-unlock.js.map +1 -1
  33. package/build/prebuilt/js/design-tokens.js +14 -1
  34. package/build/prebuilt/js/design-tokens.js.map +2 -2
  35. package/build/prebuilt/json/figma.json +214 -32
  36. package/build/prebuilt/ts/design-tokens.js +38 -1
  37. package/build/prebuilt/ts/design-tokens.js.map +2 -2
  38. package/build/private-apis.js +3 -2
  39. package/build/private-apis.js.map +1 -1
  40. package/build/theme-provider.js +19 -17
  41. package/build/theme-provider.js.map +4 -4
  42. package/build/types/css-modules.d.js +0 -1
  43. package/build/types.js +2 -1
  44. package/build/types.js.map +1 -1
  45. package/build/use-theme-provider-styles.js +50 -36
  46. package/build/use-theme-provider-styles.js.map +3 -3
  47. package/build-module/color-ramps/index.js +20 -28
  48. package/build-module/color-ramps/index.js.map +2 -2
  49. package/build-module/color-ramps/lib/color-utils.js +19 -0
  50. package/build-module/color-ramps/lib/color-utils.js.map +7 -0
  51. package/build-module/color-ramps/lib/constants.js +13 -10
  52. package/build-module/color-ramps/lib/constants.js.map +2 -2
  53. package/build-module/color-ramps/lib/default-ramps.js +196 -0
  54. package/build-module/color-ramps/lib/default-ramps.js.map +7 -0
  55. package/build-module/color-ramps/lib/find-color-with-constraints.js +56 -60
  56. package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  57. package/build-module/color-ramps/lib/index.js +28 -55
  58. package/build-module/color-ramps/lib/index.js.map +3 -3
  59. package/build-module/color-ramps/lib/ramp-configs.js +11 -10
  60. package/build-module/color-ramps/lib/ramp-configs.js.map +1 -1
  61. package/build-module/color-ramps/lib/register-color-spaces.js +7 -0
  62. package/build-module/color-ramps/lib/register-color-spaces.js.map +7 -0
  63. package/build-module/color-ramps/lib/taper-chroma.js +40 -16
  64. package/build-module/color-ramps/lib/taper-chroma.js.map +2 -2
  65. package/build-module/color-ramps/lib/utils.js +7 -4
  66. package/build-module/color-ramps/lib/utils.js.map +2 -2
  67. package/build-module/context.js +2 -1
  68. package/build-module/context.js.map +1 -1
  69. package/build-module/index.js +1 -0
  70. package/build-module/index.js.map +1 -1
  71. package/build-module/lock-unlock.js +2 -1
  72. package/build-module/lock-unlock.js.map +1 -1
  73. package/build-module/prebuilt/js/design-tokens.js +13 -0
  74. package/build-module/prebuilt/js/design-tokens.js.map +2 -2
  75. package/build-module/prebuilt/json/figma.json +214 -32
  76. package/build-module/prebuilt/ts/design-tokens.js +37 -0
  77. package/build-module/prebuilt/ts/design-tokens.js.map +2 -2
  78. package/build-module/private-apis.js +2 -1
  79. package/build-module/private-apis.js.map +1 -1
  80. package/build-module/theme-provider.js +18 -6
  81. package/build-module/theme-provider.js.map +3 -3
  82. package/build-module/use-theme-provider-styles.js +52 -31
  83. package/build-module/use-theme-provider-styles.js.map +2 -2
  84. package/build-types/color-ramps/index.d.ts +9 -16
  85. package/build-types/color-ramps/index.d.ts.map +1 -1
  86. package/build-types/color-ramps/lib/color-utils.d.ts +22 -0
  87. package/build-types/color-ramps/lib/color-utils.d.ts.map +1 -0
  88. package/build-types/color-ramps/lib/constants.d.ts +6 -8
  89. package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
  90. package/build-types/color-ramps/lib/default-ramps.d.ts +7 -0
  91. package/build-types/color-ramps/lib/default-ramps.d.ts.map +1 -0
  92. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +7 -5
  93. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
  94. package/build-types/color-ramps/lib/index.d.ts +5 -2
  95. package/build-types/color-ramps/lib/index.d.ts.map +1 -1
  96. package/build-types/color-ramps/lib/register-color-spaces.d.ts +2 -0
  97. package/build-types/color-ramps/lib/register-color-spaces.d.ts.map +1 -0
  98. package/build-types/color-ramps/lib/taper-chroma.d.ts +7 -3
  99. package/build-types/color-ramps/lib/taper-chroma.d.ts.map +1 -1
  100. package/build-types/color-ramps/lib/utils.d.ts +7 -3
  101. package/build-types/color-ramps/lib/utils.d.ts.map +1 -1
  102. package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
  103. package/build-types/prebuilt/ts/design-tokens.d.ts.map +1 -1
  104. package/build-types/use-theme-provider-styles.d.ts +4 -0
  105. package/build-types/use-theme-provider-styles.d.ts.map +1 -1
  106. package/docs/ds-tokens.md +34 -0
  107. package/package.json +19 -9
  108. package/src/color-ramps/index.ts +24 -41
  109. package/src/color-ramps/lib/color-utils.ts +34 -0
  110. package/src/color-ramps/lib/constants.ts +8 -6
  111. package/src/color-ramps/lib/default-ramps.ts +200 -0
  112. package/src/color-ramps/lib/find-color-with-constraints.ts +70 -79
  113. package/src/color-ramps/lib/index.ts +27 -61
  114. package/src/color-ramps/lib/register-color-spaces.ts +13 -0
  115. package/src/color-ramps/lib/taper-chroma.ts +47 -19
  116. package/src/color-ramps/lib/utils.ts +8 -9
  117. package/src/color-ramps/stories/index.story.tsx +16 -22
  118. package/src/color-ramps/test/__snapshots__/index.test.ts.snap +96 -96
  119. package/src/color-ramps/test/index.test.ts +27 -15
  120. package/src/prebuilt/css/design-tokens.css +90 -32
  121. package/src/prebuilt/js/design-tokens.js +12 -0
  122. package/src/prebuilt/json/figma.json +214 -32
  123. package/src/prebuilt/ts/design-tokens.ts +36 -0
  124. package/src/use-theme-provider-styles.ts +47 -25
  125. package/tokens/color.json +184 -32
  126. package/tsconfig.bin.json +13 -0
  127. package/tsconfig.bin.tsbuildinfo +1 -0
  128. package/tsconfig.json +6 -4
  129. package/tsconfig.src.json +9 -0
  130. package/tsconfig.src.tsbuildinfo +1 -0
  131. package/bin/build-tokens.js +0 -83
  132. package/build/color-ramps/lib/cache-utils.js +0 -57
  133. package/build/color-ramps/lib/cache-utils.js.map +0 -7
  134. package/build/style.module.css.js +0 -2
  135. package/build-module/color-ramps/lib/cache-utils.js +0 -31
  136. package/build-module/color-ramps/lib/cache-utils.js.map +0 -7
  137. package/build-module/style.module.css.js +0 -1
  138. package/build-style/style.css +0 -3
  139. package/build-types/color-ramps/lib/cache-utils.d.ts +0 -22
  140. package/build-types/color-ramps/lib/cache-utils.d.ts.map +0 -1
  141. package/src/color-ramps/lib/cache-utils.ts +0 -56
  142. package/tsconfig.tsbuildinfo +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/theme-provider.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useId } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ThemeContext } from './context';\nimport { useThemeProviderStyles } from './use-theme-provider-styles';\nimport { type ThemeProviderProps } from './types';\nimport styles from './style.module.css';\n\nfunction cssObjectToText( values: CSSProperties ) {\n\treturn Object.entries( values )\n\t\t.map( ( [ key, value ] ) => `${ key }: ${ value };` )\n\t\t.join( '' );\n}\n\nfunction generateCSSSelector( {\n\tinstanceId,\n\tisRoot,\n}: {\n\tinstanceId: string;\n\tisRoot: boolean;\n} ) {\n\tconst rootSel = `[data-wpds-root-provider=\"true\"]`;\n\tconst instanceIdSel = `[data-wpds-theme-provider-id=\"${ instanceId }\"]`;\n\n\tconst selectors = [];\n\n\tif ( isRoot ) {\n\t\tselectors.push(\n\t\t\t`:root:has(.${ styles.root }${ rootSel }${ instanceIdSel })`\n\t\t);\n\t}\n\n\tselectors.push( `.${ styles.root }.${ styles.root }${ instanceIdSel }` );\n\n\treturn selectors.join( ',' );\n}\n\nexport const ThemeProvider = ( {\n\tchildren,\n\tcolor = {},\n\tisRoot = false,\n}: ThemeProviderProps ) => {\n\tconst instanceId = useId();\n\n\tconst { themeProviderStyles, resolvedSettings } = useThemeProviderStyles( {\n\t\tcolor,\n\t} );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tresolvedSettings,\n\t\t} ),\n\t\t[ resolvedSettings ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ themeProviderStyles ? (\n\t\t\t\t<style>\n\t\t\t\t\t{ `${ generateCSSSelector( {\n\t\t\t\t\t\tinstanceId,\n\t\t\t\t\t\tisRoot,\n\t\t\t\t\t} ) } {${ cssObjectToText( themeProviderStyles ) }}` }\n\t\t\t\t</style>\n\t\t\t) : null }\n\t\t\t<div\n\t\t\t\tdata-wpds-theme-provider-id={ instanceId }\n\t\t\t\tdata-wpds-root-provider={ isRoot }\n\t\t\t\tclassName={ styles.root }\n\t\t\t>\n\t\t\t\t<ThemeContext.Provider value={ contextValue }>\n\t\t\t\t\t{ children }\n\t\t\t\t</ThemeContext.Provider>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n"],
5
- "mappings": "AAkEE,mBAEE,KAFF;AA1DF,SAAS,SAAS,aAAa;AAK/B,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AAEvC,OAAO,YAAY;AAEnB,SAAS,gBAAiB,QAAwB;AACjD,SAAO,OAAO,QAAS,MAAO,EAC5B,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO,GAAI,GAAI,KAAM,KAAM,GAAI,EACnD,KAAM,EAAG;AACZ;AAEA,SAAS,oBAAqB;AAAA,EAC7B;AAAA,EACA;AACD,GAGI;AACH,QAAM,UAAU;AAChB,QAAM,gBAAgB,iCAAkC,UAAW;AAEnE,QAAM,YAAY,CAAC;AAEnB,MAAK,QAAS;AACb,cAAU;AAAA,MACT,cAAe,OAAO,IAAK,GAAI,OAAQ,GAAI,aAAc;AAAA,IAC1D;AAAA,EACD;AAEA,YAAU,KAAM,IAAK,OAAO,IAAK,IAAK,OAAO,IAAK,GAAI,aAAc,EAAG;AAEvE,SAAO,UAAU,KAAM,GAAI;AAC5B;AAEO,MAAM,gBAAgB,CAAE;AAAA,EAC9B;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,SAAS;AACV,MAA2B;AAC1B,QAAM,aAAa,MAAM;AAEzB,QAAM,EAAE,qBAAqB,iBAAiB,IAAI,uBAAwB;AAAA,IACzE;AAAA,EACD,CAAE;AAEF,QAAM,eAAe;AAAA,IACpB,OAAQ;AAAA,MACP;AAAA,IACD;AAAA,IACA,CAAE,gBAAiB;AAAA,EACpB;AAEA,SACC,iCACG;AAAA,0BACD,oBAAC,WACE,aAAI,oBAAqB;AAAA,MAC1B;AAAA,MACA;AAAA,IACD,CAAE,CAAE,KAAM,gBAAiB,mBAAoB,CAAE,KAClD,IACG;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACA,+BAA8B;AAAA,QAC9B,2BAA0B;AAAA,QAC1B,WAAY,OAAO;AAAA,QAEnB,8BAAC,aAAa,UAAb,EAAsB,OAAQ,cAC5B,UACH;AAAA;AAAA,IACD;AAAA,KACD;AAEF;",
3
+ "sources": ["../src/theme-provider.tsx", "../src/style.module.css"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useId } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ThemeContext } from './context';\nimport { useThemeProviderStyles } from './use-theme-provider-styles';\nimport { type ThemeProviderProps } from './types';\nimport styles from './style.module.css';\n\nfunction cssObjectToText( values: CSSProperties ) {\n\treturn Object.entries( values )\n\t\t.map( ( [ key, value ] ) => `${ key }: ${ value };` )\n\t\t.join( '' );\n}\n\nfunction generateCSSSelector( {\n\tinstanceId,\n\tisRoot,\n}: {\n\tinstanceId: string;\n\tisRoot: boolean;\n} ) {\n\tconst rootSel = `[data-wpds-root-provider=\"true\"]`;\n\tconst instanceIdSel = `[data-wpds-theme-provider-id=\"${ instanceId }\"]`;\n\n\tconst selectors = [];\n\n\tif ( isRoot ) {\n\t\tselectors.push(\n\t\t\t`:root:has(.${ styles.root }${ rootSel }${ instanceIdSel })`\n\t\t);\n\t}\n\n\tselectors.push( `.${ styles.root }.${ styles.root }${ instanceIdSel }` );\n\n\treturn selectors.join( ',' );\n}\n\nexport const ThemeProvider = ( {\n\tchildren,\n\tcolor = {},\n\tisRoot = false,\n}: ThemeProviderProps ) => {\n\tconst instanceId = useId();\n\n\tconst { themeProviderStyles, resolvedSettings } = useThemeProviderStyles( {\n\t\tcolor,\n\t} );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tresolvedSettings,\n\t\t} ),\n\t\t[ resolvedSettings ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ themeProviderStyles ? (\n\t\t\t\t<style>\n\t\t\t\t\t{ `${ generateCSSSelector( {\n\t\t\t\t\t\tinstanceId,\n\t\t\t\t\t\tisRoot,\n\t\t\t\t\t} ) } {${ cssObjectToText( themeProviderStyles ) }}` }\n\t\t\t\t</style>\n\t\t\t) : null }\n\t\t\t<div\n\t\t\t\tdata-wpds-theme-provider-id={ instanceId }\n\t\t\t\tdata-wpds-root-provider={ isRoot }\n\t\t\t\tclassName={ styles.root }\n\t\t\t>\n\t\t\t\t<ThemeContext.Provider value={ contextValue }>\n\t\t\t\t\t{ children }\n\t\t\t\t</ThemeContext.Provider>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n", "const css = `.style-module__root__26kw6 {\n\tdisplay: contents;\n}\n`;\ndocument.head\n .appendChild(document.createElement(\"style\"))\n .appendChild(document.createTextNode(css));\nexport {css};\nexport default {\n \"root\": \"style-module__root__26kw6\"\n};"],
5
+ "mappings": ";AAQA,SAAS,SAAS,aAAa;AAK/B,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;;;ACdvC,IAAM,MAAM;AAAA;AAAA;AAAA;AAIZ,SAAS,KACJ,YAAY,SAAS,cAAc,OAAO,CAAC,EAC3C,YAAY,SAAS,eAAe,GAAG,CAAC;AAE7C,IAAO,gBAAQ;AAAA,EACb,QAAQ;AACV;;;ADwDE,mBAEE,KAFF;AAhDF,SAAS,gBAAiB,QAAwB;AACjD,SAAO,OAAO,QAAS,MAAO,EAC5B,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO,GAAI,GAAI,KAAM,KAAM,GAAI,EACnD,KAAM,EAAG;AACZ;AAEA,SAAS,oBAAqB;AAAA,EAC7B;AAAA,EACA;AACD,GAGI;AACH,QAAM,UAAU;AAChB,QAAM,gBAAgB,iCAAkC,UAAW;AAEnE,QAAM,YAAY,CAAC;AAEnB,MAAK,QAAS;AACb,cAAU;AAAA,MACT,cAAe,cAAO,IAAK,GAAI,OAAQ,GAAI,aAAc;AAAA,IAC1D;AAAA,EACD;AAEA,YAAU,KAAM,IAAK,cAAO,IAAK,IAAK,cAAO,IAAK,GAAI,aAAc,EAAG;AAEvE,SAAO,UAAU,KAAM,GAAI;AAC5B;AAEO,IAAM,gBAAgB,CAAE;AAAA,EAC9B;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,SAAS;AACV,MAA2B;AAC1B,QAAM,aAAa,MAAM;AAEzB,QAAM,EAAE,qBAAqB,iBAAiB,IAAI,uBAAwB;AAAA,IACzE;AAAA,EACD,CAAE;AAEF,QAAM,eAAe;AAAA,IACpB,OAAQ;AAAA,MACP;AAAA,IACD;AAAA,IACA,CAAE,gBAAiB;AAAA,EACpB;AAEA,SACC,iCACG;AAAA,0BACD,oBAAC,WACE,aAAI,oBAAqB;AAAA,MAC1B;AAAA,MACA;AAAA,IACD,CAAE,CAAE,KAAM,gBAAiB,mBAAoB,CAAE,KAClD,IACG;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACA,+BAA8B;AAAA,QAC9B,2BAA0B;AAAA,QAC1B,WAAY,cAAO;AAAA,QAEnB,8BAAC,aAAa,UAAb,EAAsB,OAAQ,cAC5B,UACH;AAAA;AAAA,IACD;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,15 @@
1
- import Color from "colorjs.io";
1
+ // packages/theme/src/use-theme-provider-styles.ts
2
+ import {
3
+ parse,
4
+ to,
5
+ get,
6
+ serialize,
7
+ sRGB,
8
+ HSL
9
+ } from "colorjs.io/fn";
10
+ import memoize from "memize";
2
11
  import { useMemo, useContext } from "@wordpress/element";
12
+ import "./color-ramps/lib/register-color-spaces";
3
13
  import { ThemeContext } from "./context";
4
14
  import semanticVariables from "./prebuilt/ts/design-tokens";
5
15
  import {
@@ -7,7 +17,9 @@ import {
7
17
  buildAccentRamp,
8
18
  DEFAULT_SEED_COLORS
9
19
  } from "./color-ramps";
10
- const legacyWpComponentsOverridesCSS = [
20
+ var getCachedBgRamp = memoize(buildBgRamp, { maxSize: 10 });
21
+ var getCachedAccentRamp = memoize(buildAccentRamp, { maxSize: 10 });
22
+ var legacyWpComponentsOverridesCSS = [
11
23
  ["--wp-components-color-accent", "var(--wp-admin-theme-color)"],
12
24
  [
13
25
  "--wp-components-color-accent-darker-10",
@@ -63,37 +75,49 @@ const legacyWpComponentsOverridesCSS = [
63
75
  ]
64
76
  ];
65
77
  function customRgbFormat(color) {
66
- const rgb = color.to("srgb");
67
- return [rgb.r, rgb.g, rgb.b].map((n) => Math.round(n * 255)).join(", ");
78
+ const rgb = to(color, sRGB);
79
+ return [get(rgb, "srgb.r"), get(rgb, "srgb.g"), get(rgb, "srgb.b")].map((n) => Math.round(n * 255)).join(", ");
68
80
  }
69
81
  function legacyWpAdminThemeOverridesCSS(accent) {
70
- const parsedAccent = new Color(accent).to("hsl");
71
- const hsl = parsedAccent.coords;
72
- const darker10 = new Color("hsl", [
73
- hsl[0],
74
- // h
75
- hsl[1],
76
- // s
77
- Math.max(0, Math.min(100, hsl[2] - 5))
78
- // l (reduced by 5%)
79
- ]).to("srgb");
80
- const darker20 = new Color("hsl", [
81
- hsl[0],
82
- // h
83
- hsl[1],
84
- // s
85
- Math.max(0, Math.min(100, hsl[2] - 10))
86
- // l (reduced by 10%)
87
- ]).to("srgb");
82
+ const parsedAccent = to(parse(accent), HSL);
83
+ const coords = parsedAccent.coords;
84
+ const darker10 = to(
85
+ {
86
+ space: HSL,
87
+ coords: [
88
+ coords[0],
89
+ // h
90
+ coords[1],
91
+ // s
92
+ Math.max(0, Math.min(100, coords[2] - 5))
93
+ // l (reduced by 5%)
94
+ ]
95
+ },
96
+ sRGB
97
+ );
98
+ const darker20 = to(
99
+ {
100
+ space: HSL,
101
+ coords: [
102
+ coords[0],
103
+ // h
104
+ coords[1],
105
+ // s
106
+ Math.max(0, Math.min(100, coords[2] - 10))
107
+ // l (reduced by 10%)
108
+ ]
109
+ },
110
+ sRGB
111
+ );
88
112
  return [
89
113
  [
90
114
  "--wp-admin-theme-color",
91
- parsedAccent.to("srgb").toString({ format: "hex" })
115
+ serialize(to(parsedAccent, sRGB), { format: "hex" })
92
116
  ],
93
117
  ["--wp-admin-theme-color--rgb", customRgbFormat(parsedAccent)],
94
118
  [
95
119
  "--wp-admin-theme-color-darker-10",
96
- darker10.toString({ format: "hex" })
120
+ serialize(darker10, { format: "hex" })
97
121
  ],
98
122
  [
99
123
  "--wp-admin-theme-color-darker-10--rgb",
@@ -101,7 +125,7 @@ function legacyWpAdminThemeOverridesCSS(accent) {
101
125
  ],
102
126
  [
103
127
  "--wp-admin-theme-color-darker-20",
104
- darker20.toString({ format: "hex" })
128
+ serialize(darker20, { format: "hex" })
105
129
  ],
106
130
  [
107
131
  "--wp-admin-theme-color-darker-20--rgb",
@@ -115,7 +139,7 @@ function semanticTokensCSS(filterFn = () => true) {
115
139
  modesAndValues["."]
116
140
  ]);
117
141
  }
118
- const toKebabCase = (str) => str.replace(
142
+ var toKebabCase = (str) => str.replace(
119
143
  /[A-Z]+(?![a-z])|[A-Z]/g,
120
144
  ($, ofs) => (ofs ? "-" : "") + $.toLowerCase()
121
145
  );
@@ -170,17 +194,14 @@ function useThemeProviderStyles({
170
194
  primary
171
195
  };
172
196
  const computedColorRamps = /* @__PURE__ */ new Map();
173
- const bgRamp = buildBgRamp({ seed: seeds.bg });
197
+ const bgRamp = getCachedBgRamp(seeds.bg);
174
198
  Object.entries(seeds).forEach(([rampName, seed]) => {
175
199
  if (rampName === "bg") {
176
200
  computedColorRamps.set(rampName, bgRamp);
177
201
  } else {
178
202
  computedColorRamps.set(
179
203
  rampName,
180
- buildAccentRamp({
181
- seed,
182
- bgRamp
183
- })
204
+ getCachedAccentRamp(seed, bgRamp)
184
205
  );
185
206
  }
186
207
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/use-theme-provider-styles.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\nimport Color from 'colorjs.io';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ThemeContext } from './context';\nimport semanticVariables from './prebuilt/ts/design-tokens';\nimport {\n\tbuildBgRamp,\n\tbuildAccentRamp,\n\tDEFAULT_SEED_COLORS,\n\ttype RampResult,\n} from './color-ramps';\nimport type { ThemeProviderProps } from './types';\n\ntype Entry = [ string, string ];\n\nconst legacyWpComponentsOverridesCSS: Entry[] = [\n\t[ '--wp-components-color-accent', 'var(--wp-admin-theme-color)' ],\n\t[\n\t\t'--wp-components-color-accent-darker-10',\n\t\t'var(--wp-admin-theme-color-darker-10)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-darker-20',\n\t\t'var(--wp-admin-theme-color-darker-20)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-inverted',\n\t\t'var(--wpds-color-fg-interactive-brand-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-background',\n\t\t'var(--wpds-color-bg-surface-neutral-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground-inverted',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-100',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-200',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-300',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-400',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-600',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-700',\n\t\t'var(--wpds-color-fg-content-neutral-weak)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-800',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n];\n\nfunction customRgbFormat( color: Color ) {\n\tconst rgb = color.to( 'srgb' );\n\treturn [ rgb.r, rgb.g, rgb.b ]\n\t\t.map( ( n ) => Math.round( n * 255 ) )\n\t\t.join( ', ' );\n}\n\nfunction legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {\n\tconst parsedAccent = new Color( accent ).to( 'hsl' );\n\n\tconst hsl = parsedAccent.coords;\n\tconst darker10 = new Color( 'hsl', [\n\t\thsl[ 0 ], // h\n\t\thsl[ 1 ], // s\n\t\tMath.max( 0, Math.min( 100, hsl[ 2 ] - 5 ) ), // l (reduced by 5%)\n\t] ).to( 'srgb' );\n\tconst darker20 = new Color( 'hsl', [\n\t\thsl[ 0 ], // h\n\t\thsl[ 1 ], // s\n\t\tMath.max( 0, Math.min( 100, hsl[ 2 ] - 10 ) ), // l (reduced by 10%)\n\t] ).to( 'srgb' );\n\n\treturn [\n\t\t[\n\t\t\t'--wp-admin-theme-color',\n\t\t\tparsedAccent.to( 'srgb' ).toString( { format: 'hex' } ),\n\t\t],\n\t\t[ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10',\n\t\t\tdarker10.toString( { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10--rgb',\n\t\t\tcustomRgbFormat( darker10 ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20',\n\t\t\tdarker20.toString( { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20--rgb',\n\t\t\tcustomRgbFormat( darker20 ),\n\t\t],\n\t];\n}\n\nfunction semanticTokensCSS(\n\tfilterFn: ( entry: [ string, Record< string, string > ] ) => boolean = () =>\n\t\ttrue\n): Entry[] {\n\treturn Object.entries( semanticVariables )\n\t\t.filter( filterFn )\n\t\t.map( ( [ variableName, modesAndValues ] ) => [\n\t\t\tvariableName,\n\t\t\tmodesAndValues[ '.' ],\n\t\t] );\n}\n\nconst toKebabCase = ( str: string ) =>\n\tstr.replace(\n\t\t/[A-Z]+(?![a-z])|[A-Z]/g,\n\t\t( $, ofs ) => ( ofs ? '-' : '' ) + $.toLowerCase()\n\t);\n\nfunction colorRampCSS( ramp: RampResult, prefix: string ): Entry[] {\n\treturn [ ...Object.entries( ramp.ramp ) ].map(\n\t\t( [ tokenName, tokenValue ] ) => [\n\t\t\t`${ prefix }${ toKebabCase( tokenName ) }`,\n\t\t\ttokenValue.color,\n\t\t]\n\t);\n}\n\nfunction generateStyles( {\n\tprimary,\n\tcomputedColorRamps,\n}: {\n\tprimary: string;\n\tcomputedColorRamps: Map< string, RampResult >;\n} ): CSSProperties {\n\treturn Object.fromEntries(\n\t\t[\n\t\t\t// Primitive tokens\n\t\t\tArray.from( computedColorRamps )\n\t\t\t\t.map( ( [ rampName, computedColorRamp ] ) => [\n\t\t\t\t\tcolorRampCSS(\n\t\t\t\t\t\tcomputedColorRamp,\n\t\t\t\t\t\t`--wpds-color-private-${ rampName }-`\n\t\t\t\t\t),\n\t\t\t\t] )\n\t\t\t\t.flat( 2 ),\n\t\t\t// Semantic color tokens (other semantic tokens for now are static)\n\t\t\tsemanticTokensCSS( ( [ key ] ) => /color/.test( key ) ),\n\t\t\t// Legacy overrides\n\t\t\tlegacyWpAdminThemeOverridesCSS( primary ),\n\t\t\tlegacyWpComponentsOverridesCSS,\n\t\t].flat()\n\t);\n}\n\nexport function useThemeProviderStyles( {\n\tcolor = {},\n}: {\n\tcolor?: ThemeProviderProps[ 'color' ];\n} = {} ) {\n\tconst { resolvedSettings: inheritedSettings } = useContext( ThemeContext );\n\n\t// Compute settings:\n\t// - used provided prop value;\n\t// - otherwise, use inherited value from parent instance;\n\t// - otherwise, use fallback value (where applicable).\n\tconst primary =\n\t\tcolor.primary ??\n\t\tinheritedSettings.color?.primary ??\n\t\tDEFAULT_SEED_COLORS.primary;\n\tconst bg =\n\t\tcolor.bg ?? inheritedSettings.color?.bg ?? DEFAULT_SEED_COLORS.bg;\n\n\tconst resolvedSettings = useMemo(\n\t\t() => ( {\n\t\t\tcolor: {\n\t\t\t\tprimary,\n\t\t\t\tbg,\n\t\t\t},\n\t\t} ),\n\t\t[ primary, bg ]\n\t);\n\n\tconst themeProviderStyles = useMemo( () => {\n\t\t// Determine which seeds are needed for generating ramps.\n\t\tconst seeds = {\n\t\t\t...DEFAULT_SEED_COLORS,\n\t\t\tbg,\n\t\t\tprimary,\n\t\t};\n\n\t\t// Generate ramps.\n\t\tconst computedColorRamps = new Map< string, RampResult >();\n\t\tconst bgRamp = buildBgRamp( { seed: seeds.bg } );\n\t\tObject.entries( seeds ).forEach( ( [ rampName, seed ] ) => {\n\t\t\tif ( rampName === 'bg' ) {\n\t\t\t\tcomputedColorRamps.set( rampName, bgRamp );\n\t\t\t} else {\n\t\t\t\tcomputedColorRamps.set(\n\t\t\t\t\trampName,\n\t\t\t\t\tbuildAccentRamp( {\n\t\t\t\t\t\tseed,\n\t\t\t\t\t\tbgRamp,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn generateStyles( {\n\t\t\tprimary: seeds.primary,\n\t\t\tcomputedColorRamps,\n\t\t} );\n\t}, [ primary, bg ] );\n\n\treturn {\n\t\tresolvedSettings,\n\t\tthemeProviderStyles,\n\t};\n}\n"],
5
- "mappings": "AAIA,OAAO,WAAW;AAKlB,SAAS,SAAS,kBAAkB;AAKpC,SAAS,oBAAoB;AAC7B,OAAO,uBAAuB;AAC9B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AAKP,MAAM,iCAA0C;AAAA,EAC/C,CAAE,gCAAgC,6BAA8B;AAAA,EAChE;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA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AAM,GAAI,CAAE;AAAA;AAAA,MAEtD,+BAAgC,OAAQ;AAAA,MACxC;AAAA,IACD,EAAE,KAAK;AAAA,EACR;AACD;AAEO,SAAS,uBAAwB;AAAA,EACvC,QAAQ,CAAC;AACV,IAEI,CAAC,GAAI;AACR,QAAM,EAAE,kBAAkB,kBAAkB,IAAI,WAAY,YAAa;AAMzE,QAAM,UACL,MAAM,WACN,kBAAkB,OAAO,WACzB,oBAAoB;AACrB,QAAM,KACL,MAAM,MAAM,kBAAkB,OAAO,MAAM,oBAAoB;AAEhE,QAAM,mBAAmB;AAAA,IACxB,OAAQ;AAAA,MACP,OAAO;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,SAAS,EAAG;AAAA,EACf;AAEA,QAAM,sBAAsB,QAAS,MAAM;AAE1C,UAAM,QAAQ;AAAA,MACb,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACD;AAGA,UAAM,qBAAqB,oBAAI,IAA0B;AACzD,UAAM,SAAS,YAAa,EAAE,MAAM,MAAM,GAAG,CAAE;AAC/C,WAAO,QAAS,KAAM,EAAE,QAAS,CAAE,CAAE,UAAU,IAAK,MAAO;AAC1D,UAAK,aAAa,MAAO;AACxB,2BAAmB,IAAK,UAAU,MAAO;AAAA,MAC1C,OAAO;AACN,2BAAmB;AAAA,UAClB;AAAA,UACA,gBAAiB;AAAA,YAChB;AAAA,YACA;AAAA,UACD,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD,CAAE;AAEF,WAAO,eAAgB;AAAA,MACtB,SAAS,MAAM;AAAA,MACf;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,SAAS,EAAG,CAAE;AAEnB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\nimport {\n\tparse,\n\tto,\n\tget,\n\tserialize,\n\tsRGB,\n\tHSL,\n\ttype ColorTypes,\n} from 'colorjs.io/fn';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport './color-ramps/lib/register-color-spaces';\nimport { ThemeContext } from './context';\nimport semanticVariables from './prebuilt/ts/design-tokens';\nimport {\n\tbuildBgRamp,\n\tbuildAccentRamp,\n\tDEFAULT_SEED_COLORS,\n\ttype RampResult,\n} from './color-ramps';\nimport type { ThemeProviderProps } from './types';\n\ntype Entry = [ string, string ];\n\nconst getCachedBgRamp = memoize( buildBgRamp, { maxSize: 10 } );\nconst getCachedAccentRamp = memoize( buildAccentRamp, { maxSize: 10 } );\n\nconst legacyWpComponentsOverridesCSS: Entry[] = [\n\t[ '--wp-components-color-accent', 'var(--wp-admin-theme-color)' ],\n\t[\n\t\t'--wp-components-color-accent-darker-10',\n\t\t'var(--wp-admin-theme-color-darker-10)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-darker-20',\n\t\t'var(--wp-admin-theme-color-darker-20)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-inverted',\n\t\t'var(--wpds-color-fg-interactive-brand-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-background',\n\t\t'var(--wpds-color-bg-surface-neutral-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground-inverted',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-100',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-200',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-300',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-400',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-600',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-700',\n\t\t'var(--wpds-color-fg-content-neutral-weak)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-800',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n];\n\nfunction customRgbFormat( color: ColorTypes ) {\n\tconst rgb = to( color, sRGB );\n\treturn [ get( rgb, 'srgb.r' ), get( rgb, 'srgb.g' ), get( rgb, 'srgb.b' ) ]\n\t\t.map( ( n ) => Math.round( n * 255 ) )\n\t\t.join( ', ' );\n}\n\nfunction legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {\n\tconst parsedAccent = to( parse( accent ), HSL );\n\n\tconst coords = parsedAccent.coords;\n\tconst darker10 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 5 ) ), // l (reduced by 5%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\tconst darker20 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 10 ) ), // l (reduced by 10%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\n\treturn [\n\t\t[\n\t\t\t'--wp-admin-theme-color',\n\t\t\tserialize( to( parsedAccent, sRGB ), { format: 'hex' } ),\n\t\t],\n\t\t[ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10',\n\t\t\tserialize( darker10, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10--rgb',\n\t\t\tcustomRgbFormat( darker10 ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20',\n\t\t\tserialize( darker20, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20--rgb',\n\t\t\tcustomRgbFormat( darker20 ),\n\t\t],\n\t];\n}\n\nfunction semanticTokensCSS(\n\tfilterFn: ( entry: [ string, Record< string, string > ] ) => boolean = () =>\n\t\ttrue\n): Entry[] {\n\treturn Object.entries( semanticVariables )\n\t\t.filter( filterFn )\n\t\t.map( ( [ variableName, modesAndValues ] ) => [\n\t\t\tvariableName,\n\t\t\tmodesAndValues[ '.' ],\n\t\t] );\n}\n\nconst toKebabCase = ( str: string ) =>\n\tstr.replace(\n\t\t/[A-Z]+(?![a-z])|[A-Z]/g,\n\t\t( $, ofs ) => ( ofs ? '-' : '' ) + $.toLowerCase()\n\t);\n\nfunction colorRampCSS( ramp: RampResult, prefix: string ): Entry[] {\n\treturn [ ...Object.entries( ramp.ramp ) ].map(\n\t\t( [ tokenName, tokenValue ] ) => [\n\t\t\t`${ prefix }${ toKebabCase( tokenName ) }`,\n\t\t\ttokenValue.color,\n\t\t]\n\t);\n}\n\nfunction generateStyles( {\n\tprimary,\n\tcomputedColorRamps,\n}: {\n\tprimary: string;\n\tcomputedColorRamps: Map< string, RampResult >;\n} ): CSSProperties {\n\treturn Object.fromEntries(\n\t\t[\n\t\t\t// Primitive tokens\n\t\t\tArray.from( computedColorRamps )\n\t\t\t\t.map( ( [ rampName, computedColorRamp ] ) => [\n\t\t\t\t\tcolorRampCSS(\n\t\t\t\t\t\tcomputedColorRamp,\n\t\t\t\t\t\t`--wpds-color-private-${ rampName }-`\n\t\t\t\t\t),\n\t\t\t\t] )\n\t\t\t\t.flat( 2 ),\n\t\t\t// Semantic color tokens (other semantic tokens for now are static)\n\t\t\tsemanticTokensCSS( ( [ key ] ) => /color/.test( key ) ),\n\t\t\t// Legacy overrides\n\t\t\tlegacyWpAdminThemeOverridesCSS( primary ),\n\t\t\tlegacyWpComponentsOverridesCSS,\n\t\t].flat()\n\t);\n}\n\nexport function useThemeProviderStyles( {\n\tcolor = {},\n}: {\n\tcolor?: ThemeProviderProps[ 'color' ];\n} = {} ) {\n\tconst { resolvedSettings: inheritedSettings } = useContext( ThemeContext );\n\n\t// Compute settings:\n\t// - used provided prop value;\n\t// - otherwise, use inherited value from parent instance;\n\t// - otherwise, use fallback value (where applicable).\n\tconst primary =\n\t\tcolor.primary ??\n\t\tinheritedSettings.color?.primary ??\n\t\tDEFAULT_SEED_COLORS.primary;\n\tconst bg =\n\t\tcolor.bg ?? inheritedSettings.color?.bg ?? DEFAULT_SEED_COLORS.bg;\n\n\tconst resolvedSettings = useMemo(\n\t\t() => ( {\n\t\t\tcolor: {\n\t\t\t\tprimary,\n\t\t\t\tbg,\n\t\t\t},\n\t\t} ),\n\t\t[ primary, bg ]\n\t);\n\n\tconst themeProviderStyles = useMemo( () => {\n\t\t// Determine which seeds are needed for generating ramps.\n\t\tconst seeds = {\n\t\t\t...DEFAULT_SEED_COLORS,\n\t\t\tbg,\n\t\t\tprimary,\n\t\t};\n\n\t\t// Generate ramps.\n\t\tconst computedColorRamps = new Map< string, RampResult >();\n\t\tconst bgRamp = getCachedBgRamp( seeds.bg );\n\t\tObject.entries( seeds ).forEach( ( [ rampName, seed ] ) => {\n\t\t\tif ( rampName === 'bg' ) {\n\t\t\t\tcomputedColorRamps.set( rampName, bgRamp );\n\t\t\t} else {\n\t\t\t\tcomputedColorRamps.set(\n\t\t\t\t\trampName,\n\t\t\t\t\tgetCachedAccentRamp( seed, bgRamp )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn generateStyles( {\n\t\t\tprimary: seeds.primary,\n\t\t\tcomputedColorRamps,\n\t\t} );\n\t}, [ primary, bg ] );\n\n\treturn {\n\t\tresolvedSettings,\n\t\tthemeProviderStyles,\n\t};\n}\n"],
5
+ "mappings": ";AAIA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,OAA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C,WAAO,QAAS,KAAM,EAAE,QAAS,CAAE,CAAE,UAAU,IAAK,MAAO;AAC1D,UAAK,aAAa,MAAO;AACxB,2BAAmB,IAAK,UAAU,MAAO;AAAA,MAC1C,OAAO;AACN,2BAAmB;AAAA,UAClB;AAAA,UACA,oBAAqB,MAAM,MAAO;AAAA,QACnC;AAAA,MACD;AAAA,IACD,CAAE;AAEF,WAAO,eAAgB;AAAA,MACtB,SAAS,MAAM;AAAA,MACf;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,SAAS,EAAG,CAAE;AAEnB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,28 +1,21 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import './lib/register-color-spaces';
1
5
  import type { RampResult as InternalRampResult, Ramp } from './lib/types';
2
6
  export { DEFAULT_SEED_COLORS } from './lib/constants';
3
7
  /**
4
8
  * Creates a background ramp.
5
- * @param params
6
- * @param params.seed
7
- * @param params.debug
9
+ * @param seed The seed color for the background ramp.
8
10
  */
9
- export declare function buildBgRamp({ seed, debug, }: {
10
- seed: string;
11
- debug?: boolean;
12
- }): InternalRampResult;
11
+ export declare function buildBgRamp(seed: string): InternalRampResult;
13
12
  /**
14
13
  * Creates an accent ramp (ie used by primary, success, info, warning and error
15
14
  * ramps).
16
- * @param params
17
- * @param params.seed
18
- * @param params.bgRamp
19
- * @param params.debug
15
+ * @param seed The seed color for the accent ramp.
16
+ * @param bgRamp The ramp of the background on which the accent is shown.
20
17
  */
21
- export declare function buildAccentRamp({ seed, bgRamp, debug, }: {
22
- seed: string;
23
- bgRamp?: InternalRampResult;
24
- debug?: boolean;
25
- }): InternalRampResult;
18
+ export declare function buildAccentRamp(seed: string, bgRamp?: InternalRampResult): InternalRampResult;
26
19
  /**
27
20
  * Checks that all bg/fg combinations generated by the ramps meet contrast
28
21
  * targets.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color-ramps/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACX,UAAU,IAAI,kBAAkB,EAEhC,IAAI,EACJ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,EAC5B,IAAI,EACJ,KAAK,GACL,EAAE;IACF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,GAAI,kBAAkB,CAMtB;AAsBD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAE,EAChC,IAAI,EACJ,MAAM,EACN,KAAK,GACL,EAAE;IACF,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,GAAI,kBAAkB,CAUtB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAE,EAC5C,MAAM,EACN,WAAgB,GAChB,EAAE;IACF,MAAM,EAAE,kBAAkB,CAAC;IAC3B,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACnC;YAES,MAAM,IAAI;aACT,MAAM;YACP,MAAM,IAAI;aACT,MAAM;mBACA,MAAM;IA6CtB;AAED,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color-ramps/index.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,6BAA6B,CAAC;AAIrC,OAAO,KAAK,EACX,UAAU,IAAI,kBAAkB,EAEhC,IAAI,EACJ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,WAAW,CAAE,IAAI,EAAE,MAAM,sBAMxC;AAsBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,kBAAkB,GACzB,kBAAkB,CAOpB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAE,EAC5C,MAAM,EACN,WAAgB,GAChB,EAAE;IACF,MAAM,EAAE,kBAAkB,CAAC;IAC3B,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACnC;YAES,MAAM,IAAI;aACT,MAAM;YACP,MAAM,IAAI;aACT,MAAM;mBACA,MAAM;IA6CtB;AAED,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { type ColorTypes } from 'colorjs.io/fn';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import './register-color-spaces';
9
+ /**
10
+ * Get string representation of a color
11
+ * @param color Color object to stringify
12
+ * @return String representation
13
+ */
14
+ export declare function getColorString(color: ColorTypes): string;
15
+ /**
16
+ * Get contrast value between two colors
17
+ * @param colorA First color
18
+ * @param colorB Second color
19
+ * @return WCAG 2.1 contrast ratio
20
+ */
21
+ export declare function getContrast(colorA: ColorTypes, colorB: ColorTypes): number;
22
+ //# sourceMappingURL=color-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/color-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAKN,KAAK,UAAU,EACf,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,UAAU,GAAI,MAAM,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAI,MAAM,CAE5E"}
@@ -1,13 +1,10 @@
1
- /**
2
- * External dependencies
3
- */
4
- import Color from 'colorjs.io';
5
1
  /**
6
2
  * Internal dependencies
7
3
  */
4
+ import './register-color-spaces';
8
5
  import type { Ramp } from './types';
9
- export declare const WHITE: Color;
10
- export declare const BLACK: Color;
6
+ export declare const WHITE: import("colorjs.io/fn").PlainColorObject;
7
+ export declare const BLACK: import("colorjs.io/fn").PlainColorObject;
11
8
  export declare const UNIVERSAL_CONTRAST_TOPUP = 0.05;
12
9
  export declare const WHITE_TEXT_CONTRAST_MARGIN = 3.1;
13
10
  export declare const ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS: {
@@ -20,8 +17,8 @@ export declare const ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS: {
20
17
  readonly max: 0.98;
21
18
  };
22
19
  };
23
- export declare const LIGHTNESS_EPSILON = 0.001;
24
- export declare const MAX_BISECTION_ITERATIONS = 25;
20
+ export declare const LIGHTNESS_EPSILON = 0.004;
21
+ export declare const MAX_BISECTION_ITERATIONS = 10;
25
22
  export declare const CONTRAST_COMBINATIONS: {
26
23
  bgs: (keyof Ramp)[];
27
24
  fgs: (keyof Ramp)[];
@@ -32,6 +29,7 @@ export declare const DEFAULT_SEED_COLORS: {
32
29
  primary: string;
33
30
  info: string;
34
31
  success: string;
32
+ caution: string;
35
33
  warning: string;
36
34
  error: string;
37
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,KAAK,OAAoC,CAAC;AACvD,eAAO,MAAM,KAAK,OAAoC,CAAC;AAIvD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAO7C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAO9C,eAAO,MAAM,sCAAsC;;;;;;;;;CAGzC,CAAC;AAGX,eAAO,MAAM,iBAAiB,QAAO,CAAC;AAEtC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,qBAAqB,EAAE;IACnC,GAAG,EAAE,CAAE,MAAM,IAAI,CAAE,EAAE,CAAC;IACtB,GAAG,EAAE,CAAE,MAAM,IAAI,CAAE,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CACf,EA+BA,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;CAO/B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/constants.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,KAAK,0CAAuB,CAAC;AAC1C,eAAO,MAAM,KAAK,0CAAuB,CAAC;AAI1C,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAO7C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAO9C,eAAO,MAAM,sCAAsC;;;;;;;;;CAGzC,CAAC;AAGX,eAAO,MAAM,iBAAiB,QAAO,CAAC;AAEtC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,qBAAqB,EAAE;IACnC,GAAG,EAAE,CAAE,MAAM,IAAI,CAAE,EAAE,CAAC;IACtB,GAAG,EAAE,CAAE,MAAM,IAAI,CAAE,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CACf,EA+BA,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RampResult } from './types';
5
+ import type { DEFAULT_SEED_COLORS } from './constants';
6
+ export declare const DEFAULT_RAMPS: Record<keyof typeof DEFAULT_SEED_COLORS, RampResult>;
7
+ //# sourceMappingURL=default-ramps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-ramps.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/default-ramps.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,MAAM,CACjC,MAAM,OAAO,mBAAmB,EAChC,UAAU,CA+LV,CAAC"}
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import Color from 'colorjs.io';
4
+ import { type ColorTypes } from 'colorjs.io/fn';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import './register-color-spaces';
5
9
  import { type TaperChromaOptions } from './taper-chroma';
6
10
  /**
7
11
  * Solve for L such that:
@@ -15,22 +19,20 @@ import { type TaperChromaOptions } from './taper-chroma';
15
19
  * @param direction
16
20
  * @param options
17
21
  * @param options.strict
18
- * @param options.debug
19
22
  * @param options.lightnessConstraint
20
23
  * @param options.lightnessConstraint.type
21
24
  * @param options.lightnessConstraint.value
22
25
  * @param options.taperChromaOptions
23
26
  */
24
- export declare function findColorMeetingRequirements(reference: Color, seed: Color, target: number, direction: 'lighter' | 'darker', { lightnessConstraint, taperChromaOptions, strict, debug, }?: {
27
+ export declare function findColorMeetingRequirements(reference: ColorTypes, seed: ColorTypes, target: number, direction: 'lighter' | 'darker', { lightnessConstraint, taperChromaOptions, strict, }?: {
25
28
  lightnessConstraint?: {
26
29
  type: 'force' | 'onlyIfSucceeds';
27
30
  value: number;
28
31
  };
29
32
  taperChromaOptions?: TaperChromaOptions;
30
33
  strict?: boolean;
31
- debug?: boolean;
32
34
  }): {
33
- color: Color;
35
+ color: ColorTypes;
34
36
  reached: boolean;
35
37
  achieved: number;
36
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"find-color-with-constraints.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/find-color-with-constraints.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,YAAY,CAAC;AAa/B,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,gBAAgB,CAAC;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4BAA4B,CAC3C,SAAS,EAAE,KAAK,EAChB,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GAAG,QAAQ,EAC/B,EACC,mBAAmB,EACnB,kBAAkB,EAClB,MAAa,EACb,KAAa,GACb,GAAE;IACF,mBAAmB,CAAC,EAAE;QACrB,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACX,GACJ;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAsItD"}
1
+ {"version":3,"file":"find-color-with-constraints.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/find-color-with-constraints.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,OAAO,yBAAyB,CAAC;AASjC,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,gBAAgB,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC3C,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GAAG,QAAQ,EAC/B,EACC,mBAAmB,EACnB,kBAAkB,EAClB,MAAa,GACb,GAAE;IACF,mBAAmB,CAAC,EAAE;QACrB,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;CACZ,GACJ;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA+H3D"}
@@ -1,11 +1,14 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import './register-color-spaces';
1
5
  import type { Ramp, RampDirection, RampConfig, RampResult } from './types';
2
- export declare function buildRamp(seedArg: string, config: RampConfig, { mainDirection, pinLightness, debug, rescaleToFitContrastTargets, }?: {
6
+ export declare function buildRamp(seedArg: string, config: RampConfig, { mainDirection, pinLightness, rescaleToFitContrastTargets, }?: {
3
7
  mainDirection?: RampDirection;
4
8
  pinLightness?: {
5
9
  stepName: keyof Ramp;
6
10
  value: number;
7
11
  };
8
12
  rescaleToFitContrastTargets?: boolean;
9
- debug?: boolean;
10
13
  }): RampResult;
11
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAEX,IAAI,EACJ,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,SAAS,CAAC;AA0LjB,wBAAgB,SAAS,CACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,EAClB,EACC,aAAa,EACb,YAAY,EACZ,KAAa,EACb,2BAAkC,GAClC,GAAE;IACF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE;QACd,QAAQ,EAAE,MAAM,IAAI,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;CACX,GACJ,UAAU,CA8IZ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/index.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAUjC,OAAO,KAAK,EAEX,IAAI,EACJ,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,SAAS,CAAC;AAsLjB,wBAAgB,SAAS,CACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,EAClB,EACC,aAAa,EACb,YAAY,EACZ,2BAAkC,GAClC,GAAE;IACF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE;QACd,QAAQ,EAAE,MAAM,IAAI,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACjC,GACJ,UAAU,CAyGZ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=register-color-spaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-color-spaces.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/register-color-spaces.ts"],"names":[],"mappings":""}
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import Color from 'colorjs.io';
4
+ import { type ColorTypes, type ColorObject } from 'colorjs.io/fn';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import './register-color-spaces';
5
9
  export interface TaperChromaOptions {
6
10
  gamut?: 'p3' | 'srgb';
7
11
  alpha?: number;
@@ -23,10 +27,10 @@ export interface TaperChromaOptions {
23
27
  * @param lTarget
24
28
  * @param options
25
29
  */
26
- export declare function taperChroma(seed: Color, // already OKLCH
30
+ export declare function taperChroma(seed: ColorTypes, // already OKLCH
27
31
  lTarget: number, // [0..1]
28
32
  options?: TaperChromaOptions): {
29
33
  l: number;
30
34
  c: number;
31
- };
35
+ } | ColorObject;
32
36
  //# sourceMappingURL=taper-chroma.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"taper-chroma.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/taper-chroma.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,WAAW,kBAAkB;IAClC,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,KAAK,EAAE,gBAAgB;AAC7B,OAAO,EAAE,MAAM,EAAE,SAAS;AAC1B,OAAO,GAAE,kBAAuB,GAC9B;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAkE1B"}
1
+ {"version":3,"file":"taper-chroma.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/taper-chroma.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAMN,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAEjC,MAAM,WAAW,kBAAkB;IAClC,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,UAAU,EAAE,gBAAgB;AAClC,OAAO,EAAE,MAAM,EAAE,SAAS;AAC1B,OAAO,GAAE,kBAAuB,GAC9B;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CA8ExC"}
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type Color from 'colorjs.io';
4
+ import { type ColorTypes } from 'colorjs.io/fn';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import './register-color-spaces';
5
9
  import type { Ramp, RampStepConfig, RampDirection } from './types';
6
10
  /**
7
11
  * Make sure that a color is valid in the p3 gamut, and converts it to oklch.
8
12
  * @param c
9
13
  */
10
- export declare const clampToGamut: (c: Color) => Color;
14
+ export declare const clampToGamut: (c: ColorTypes) => import("colorjs.io/fn").PlainColorObject;
11
15
  /**
12
16
  * Topologically sort steps based on their dependencies
13
17
  * @param config - The steps configuration object
@@ -21,7 +25,7 @@ export declare function sortByDependency(config: Record<keyof Ramp, RampStepConf
21
25
  * @return An object with "better" and "worse" properties, each holding a
22
26
  * ramp direction value.
23
27
  */
24
- export declare function computeBetterFgColorDirection(seed: Color, preferLighter?: boolean): {
28
+ export declare function computeBetterFgColorDirection(seed: ColorTypes, preferLighter?: boolean): {
25
29
  better: RampDirection;
26
30
  worse: RampDirection;
27
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAYpC,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAA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ED;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CACjD,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,aAAa,UAIxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AASvD,QAAA,MAAM,QAAQ,UAAY;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,gCAEA,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAmBhC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,QAAQ,CAkI9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAE,OAAO,QAAQ,CAyFzD,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AASvD,QAAA,MAAM,QAAQ,UAAY;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,gCAEA,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAmBhC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,QAAQ,CA4H9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAE,OAAO,QAAQ,CAyFzD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"design-tokens.d.ts","sourceRoot":"","sources":["../../../src/prebuilt/ts/design-tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;wBA2UE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,CAAE;AAzU/C,wBAyUgD"}
1
+ {"version":3,"file":"design-tokens.d.ts","sourceRoot":"","sources":["../../../src/prebuilt/ts/design-tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;wBA+WE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,CAAE;AA7W/C,wBA6WgD"}
@@ -2,6 +2,10 @@
2
2
  * External dependencies
3
3
  */
4
4
  import type { CSSProperties } from 'react';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import './color-ramps/lib/register-color-spaces';
5
9
  import type { ThemeProviderProps } from './types';
6
10
  export declare function useThemeProviderStyles({ color, }?: {
7
11
  color?: ThemeProviderProps['color'];
@@ -1 +1 @@
1
- {"version":3,"file":"use-theme-provider-styles.d.ts","sourceRoot":"","sources":["../src/use-theme-provider-styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmB3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAiKlD,wBAAgB,sBAAsB,CAAE,EACvC,KAAU,GACV,GAAE;IACF,KAAK,CAAC,EAAE,kBAAkB,CAAE,OAAO,CAAE,CAAC;CACjC;;;;;;;;EA2DL"}
1
+ {"version":3,"file":"use-theme-provider-styles.d.ts","sourceRoot":"","sources":["../src/use-theme-provider-styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAiB3C;;GAEG;AACH,OAAO,yCAAyC,CAAC;AASjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAgLlD,wBAAgB,sBAAsB,CAAE,EACvC,KAAU,GACV,GAAE;IACF,KAAK,CAAC,EAAE,kBAAkB,CAAE,OAAO,CAAE,CAAC;CACjC;;;;;;;;EAwDL"}
package/docs/ds-tokens.md CHANGED
@@ -31,6 +31,8 @@ Do not edit directly.
31
31
  | `--wpds-color-bg-surface-info-weak` | Background color for surfaces with info tone and weak emphasis. |
32
32
  | `--wpds-color-bg-surface-warning` | Background color for surfaces with warning tone and normal emphasis. |
33
33
  | `--wpds-color-bg-surface-warning-weak` | Background color for surfaces with warning tone and weak emphasis. |
34
+ | `--wpds-color-bg-surface-caution` | Background color for surfaces with caution tone and normal emphasis. |
35
+ | `--wpds-color-bg-surface-caution-weak` | Background color for surfaces with caution tone and weak emphasis. |
34
36
  | `--wpds-color-bg-surface-error` | Background color for surfaces with error tone and normal emphasis. |
35
37
  | `--wpds-color-bg-surface-error-weak` | Background color for surfaces with error tone and weak emphasis. |
36
38
  | `--wpds-color-bg-interactive-neutral` | Background color for interactive elements with neutral tone and normal emphasis. |
@@ -60,6 +62,16 @@ Do not edit directly.
60
62
  | `--wpds-color-bg-thumb-brand-disabled` | Background color for thumbs with a brand tone and normal emphasis (eg. slider thumb and filled track), in their disabled state. |
61
63
  | `--wpds-color-fg-content-neutral` | Foreground color for content like text with normal emphasis. |
62
64
  | `--wpds-color-fg-content-neutral-weak` | Foreground color for content like text with weak emphasis. |
65
+ | `--wpds-color-fg-content-success` | Foreground color for content like text with success tone and normal emphasis. |
66
+ | `--wpds-color-fg-content-success-weak` | Foreground color for content like text with success tone and weak emphasis. |
67
+ | `--wpds-color-fg-content-info` | Foreground color for content like text with info tone and normal emphasis. |
68
+ | `--wpds-color-fg-content-info-weak` | Foreground color for content like text with info tone and weak emphasis. |
69
+ | `--wpds-color-fg-content-warning` | Foreground color for content like text with warning tone and normal emphasis. |
70
+ | `--wpds-color-fg-content-warning-weak` | Foreground color for content like text with warning tone and weak emphasis. |
71
+ | `--wpds-color-fg-content-caution` | Foreground color for content like text with caution tone and normal emphasis. |
72
+ | `--wpds-color-fg-content-caution-weak` | Foreground color for content like text with caution tone and weak emphasis. |
73
+ | `--wpds-color-fg-content-error` | Foreground color for content like text with error tone and normal emphasis. |
74
+ | `--wpds-color-fg-content-error-weak` | Foreground color for content like text with error tone and weak emphasis. |
63
75
  | `--wpds-color-fg-interactive-neutral` | Foreground color for interactive elements with neutral tone and normal emphasis. |
64
76
  | `--wpds-color-fg-interactive-neutral-active` | Foreground color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. |
65
77
  | `--wpds-color-fg-interactive-neutral-disabled` | Foreground color for interactive elements with neutral tone and normal emphasis, in their disabled state. |
@@ -281,3 +293,25 @@ Do not edit directly.
281
293
  | `--wpds-color-private-bg-bg-fill-inverted1` | N/A |
282
294
  | `--wpds-color-private-bg-fg-fill-inverted` | N/A |
283
295
  | `--wpds-color-private-bg-surface1` | N/A |
296
+ | `--wpds-color-private-caution-bg-fill1` | N/A |
297
+ | `--wpds-color-private-caution-fg-fill` | N/A |
298
+ | `--wpds-color-private-caution-bg-fill2` | N/A |
299
+ | `--wpds-color-private-caution-surface2` | N/A |
300
+ | `--wpds-color-private-caution-surface6` | N/A |
301
+ | `--wpds-color-private-caution-surface5` | N/A |
302
+ | `--wpds-color-private-caution-surface4` | N/A |
303
+ | `--wpds-color-private-caution-surface3` | N/A |
304
+ | `--wpds-color-private-caution-fg-surface4` | N/A |
305
+ | `--wpds-color-private-caution-fg-surface3` | N/A |
306
+ | `--wpds-color-private-caution-fg-surface2` | N/A |
307
+ | `--wpds-color-private-caution-fg-surface1` | N/A |
308
+ | `--wpds-color-private-caution-stroke3` | N/A |
309
+ | `--wpds-color-private-caution-stroke4` | N/A |
310
+ | `--wpds-color-private-caution-stroke2` | N/A |
311
+ | `--wpds-color-private-caution-stroke1` | N/A |
312
+ | `--wpds-color-private-caution-bg-fill-dark` | N/A |
313
+ | `--wpds-color-private-caution-fg-fill-dark` | N/A |
314
+ | `--wpds-color-private-caution-bg-fill-inverted2` | N/A |
315
+ | `--wpds-color-private-caution-bg-fill-inverted1` | N/A |
316
+ | `--wpds-color-private-caution-fg-fill-inverted` | N/A |
317
+ | `--wpds-color-private-caution-surface1` | N/A |